I’m really curious to know why initializing objects, primarily Hashes (maps, dictionaries, key-value lookups, whatever you want to call them) are such a pain to initialize.

In your typical Java scenario this is how you initialize your Hash:

HashMap hashyMcHash = new HashMap();
hashyMcHash.put("foo", "bar");
hashyMcHash.put("car", "jar");
hashyMcHash.put("arr", "rawr");
// And... so on

Meanwhile, most sane languages allow you to do crazy things like this:

hashyMcHash = {foo: "bar", car: "jar", arr: "rawr"};

Now, in languages like Python, Ruby, JavaScript those are just parts of the language and you kinda get them for free, so I can understand something like that not being available in Java. Now, lets look at another statically typed language that I think took a fair compromise between how to initialize a Hash.

NSDictionary hashyMcHash = [[NSDictionary alloc] initWithObjectsAndKeys: @"foo", @"bar", @"car", @"jar", @"arr", @"rawr", nil];

To me this seems like a pretty fair compromise for initializing our Hashes since it allows me to state what some default values in it will be in code that is fairly readable. I have an idea of how one could do it in Java, though don’t know if it exists or not.

// Constructor would probably look like this:
// HashMap(K[] keys, V[] values)
HashMap hashyMcHash =
                new HashMap(
                    ["foo", "car", "arr"],
                    ["bar", "jar", "rawr"],
                );

If this does exist, please let me know because I’d really love something like this. If it doesn’t… why?

 

Yesterday was my first attempt at making homebrewed beer. It’s a long day of work, though hope it will pay off.

Getting into homebrewing did have a bit of an upfront cost since I had to get my hands on a bunch of equipment that I didn’t have at home. Luckily, my father used to brew back when I was a kid and still had someof his old equipment. It wasn’t much, but every little bit helps in getting started.

Although I was really excited to get brewing, there’s a bunch of upfront work that needs to be done before the fun can actually happen. All of the equipment from my parents was pretty dirty and needed to be cleaned quite thoroughly, as well as sanitized. I chose to go with bleach as my sanitizer of choice, but it was worth it. I initially thought the buckets I had inherited were just stained, but the dark coloring inside my buckets was actually dirt which got removed during the sanitization phase.

After everything was clean, I was finally able to get to the brewing. This included a bunch of waiting for things like boiling water which will be used later for ensuring I have a 5 gallon batch of beer. I did need to watch a lot of pots to see if they would start to boil, which wasn’t too exciting.

Once I was finally able ready to start making my wort, this is when it got intersting. My brew consisted of some grain as well as malt extracts, so I had to steep the malts (similar to making tea) for a while. After steeping my malts and adding the extract I was then ready to get everything setup for adding my hops.

The final step in the preparation of the wort was to remove it from the heat and rapidly cool it to prevent something called a ‘chill haze’, which is really more of a cosmetic problem. I didn’t have much ice and wanted to get the wort cooled faster so I took a risk and stirred it around the pot. This might have been a bad idea, since I may oxidized the wort, but I tried to be as careful as possible, so I’m fairly optimistic.

Last steps were to aerate the wort by passing the wort and water mixture between the pot and the fermeter then add the yeast.

Now with my beer sitting in my closet away from any cats and light, I wait and hope that it’s going to be as good as it smells.

 

So I found out that there is a plugin for emacs that makes it easier for me to publish content to my blog without having to actually log onto the admin page in my browser.

I might actually start publishing more often now! Looking forward to it.

The tool I’m using is called WebloggerMode which I installed via the emacs package manager.

© 2011 Christopher Saunders Suffusion theme by Sayontan Sinha