Wednesday, March 18, 2009

Multidimensional hashes in javascript

When i first started out with javascript i had no idea how to make a multidimensional array or a hash. Then, for a while i did not know how to use it properly after creating it. Now that i _think_ i know what i am doing i want share this very useful knowledge with the world.

First things first. A hash is the corner stone of all javascript objects and it is easy to create:

Each of the above is a perfectly valid way to create and access a hash. Quotes around the name allows you to use reserved words as the name, such as "function".

One thing to note here, is that the name must be either a string or a number, if its a number, you are better off using an array (if all your other keys are numbers too). This means that the name cannot be an object.

Now lets create a hash with more than one dimension. The function below is used to both init and add to a 3D hash.

We make sure not to access any elements that are undefined / not an object.

Now all we have left is a function to get values from our hash. This is not as straight forward as it may seem
The first statement is wrong, because if any of the 3 values passed in does not exist in the hash, you will try to access a property of undefined, causing an error. The second statement makes sure that each dimension exists before trying to access it, and finally returns either the value you want, or undefined.

Thats it!

Thursday, March 12, 2009

ST31000333AS disk size incorrect. 31MB

Problem: Today after rearranging the hard drives in my case, i noticed that my 1TB seagate drive was not coming up, instead i had a 32MB non-formatted drive. Checking the drive's hardware shows that it was indeed my 1TB ST31000333AS seagate barracuda. I tried changing the sata ports, and also ran it in an external usb enclosure. Drive size was reported as being 32MB by the bios and windows at all times. Seatools for windows did not show any problems with the drive.

Solution: I downloaded seatools for dos (direct link to eng iso), and burned it to a bootable cd. Booted to seatools and using advanced options set the drive capacity to MAX. rebooted, checked bios, drive was again 1TB. windows was able to detect and restore my drive letter, and files. I am happy.

Monday, March 09, 2009

Trip's Crazy Spicy Chicken Wings

This was really good. Yummy. Here it is:


there's not really a recipe per se. but they're pretty easy as long as you don't mind getting your kitchen greasy.

basically, you just start with chicken breasts cut up in to bite size cubes. then, the breading. i'm still searching for the best way to get the breading to be 
1) crispy and more importantly 
2) stay stuck to the chicken. 
for the party, i tried marinating the chicken in buttermilk and then dredging in flour.
i have made them since, however, by dredging the chicken in flour, then in an eggwash, then in store bought dried breadcrumbs. this worked much better.

to fry them, i just melted some vegetable shortening (supposedly better than oil because it can reach a higher temperature without smoking) in a pan (about 1/4 to 1/2 deep). then fried them on side #1 until brown, then turning and frying more once or twice depending on the size/shape/etc of the chicken piece. don't put too many in the pan at once or it will drop the temperature of the shortening. add more shortening if the grease levels are too low or if it seems to have lost some of its zip.

for the sauce, i went arount 1/3 melted butter, 2/3 frank's red hot for the "mild" (to me at least) version-- i don't think frank's hot enough on its own, so i add hot sauce (from the little bottles)-- any one that's really hot will do, since 99% of the flavor will come from the frank's.

i think that's it...