Henry Cipolla

I hate blog taglines.

Creating an Array of Hashes in Ruby

I just made a simple mistake which I figure would be good share with anybody new-ish to Ruby. I wrote the following code to create an array of hashes and fill in some values. Can you guess what the output is?


#!/usr/bin/env ruby

testArray = Array.new(5, Hash.new)
0.upto(4) do |i|
testArray[i][:value] = i
end

0.upto(4) do |i|
puts testArray[i][:value]
end

If you said:
4
4
4
4
4

then you are right. The problem with this code is the Hash.new only creates one hash. And then each element in the array is a reference to that hash. So when any value is changed, all are changed. Instead, moving the hash creation inside the loop fixes everything:

#!/usr/bin/env ruby

testArray = Array.new(5, 0)
0.upto(4) do |i|
testArray[i] = Hash.new
testArray[i][:value] = i
end

0.upto(4) do |i|
puts testArray[i][:value]
end

outputs:
0
1
2
3
4

The Perfect Gift For An Artistic Foodie

I have written a couple of useful posts on here, but I don’t think any are going to be as helpful as this. I was recently introduced to El Bulli a Spanish restaurant that is on the absolute bleeding edge of the really crazy field of molecular gastronomy. I can’t describe it, so just read the wikipedia page. Most importantly note that:

  • The restaurant has a 3 Michelin star rating
  • Restaurant Magazine has ranked them Best Restaurant in the World 4 times
  • 800,000 people try to eat there per year, of which only 8,000 are accommodated

That aside, this brings me to my point. The reason this restaurant is so popular is the absurd creations they create in their laboratory. (Yes, this restaurant has a laboratory). They invent new ways of serving foods by breaking them down and reconstructing them. The results are of course very tasty, but also absolutely stunning to look at (photos taken from www.elbulli.info. Go there for many more)

Margarita at El Bulli
Cherries at El Bulli
Melon Cavier at El Bulli
Lyophilisation at El Bulli

Now, every few years the restaurant puts out their cookbook with details about how they create their amazing foods and many absolutely fantastic pictures. There is a reason some people call it ‘food-porn’. It’s very pricey, but if you know somebody who is seriously into food and has an appreciation for colorful presentation then you will never ever find a better gift than one of these:

Trust me on this, the pictures are amazing and the food is like nothing else you will ever read about.

Apologies, Updates, and Djatmaterra

Apologies
First off, apologies to anybody who reloaded this page in the last 2 months hoping there would be some new content. As it turns out, starting a business, participating in the usual summer hobbies, and working a part-time job can be pretty time consuming. Now that I finally have a moment, I figured I’d write a post. Shockingly enough I have several more coming because I actually have things to write about. Be advised!

updates

  • Andrew and I incorporated our business in Delaware. The company is called Char Software, inc. and the company website is www.charsoftware.com. Don’t expect anything exciting there until we launch our first project. We expect to launch at the end of the summer. We have an almost-usable beta version of our technology and hope to have customers soon.
  • The Pansy Patrol is gearing up for its most absurd publicity stunt to date. I can’t say too much, but it involves two Proteges. Expect some absurd videos before the summer ends
  • I broke down and decided that even though I’m on a budget, I can’t go a summer without some track time so I’m doing the August 18 and September 22 track days with the SCDA. If anybody is interested drop me a line!

Djatmaterra
In college I roomed with Adam Kaufman. He was a great roommate and I have plenty of fond memories of the time: (Absurd arguments at 6am, covering the hallway with cups of water, taking trips to the suburbs, etc). Now he is in a band called Djatmaterra. He asked me to come to one of his shows and I decided to check it out. I was really skeptical about what I would find because my memories of Adam as a singer were not particularly grand. So, you can imagine my surprise when Adam and his band put on an incredible show. They still have some bugs to work out, but I was genuinely entertained and will go to see them again; which is more than I can say about most things on this planet. One of the things that I did not realize was how much like running a startup creating a band can be. They have to drum up interest, get ‘customers’, keep focused, work out scheduling problems, deal with a budget, etc. I guess I can appreciate this angle of things now that I’m in a similar boat and so I hope to watch succeed. If you are even the least bit interested in small bands and local music you should take a look at their MySpace page (yes, I hate Myspace pages. But this is the one of the absurdly rare cases where it is acceptable) and maybe even see them in person.

Boston BarCamp 3 rocked!

I have to admit that walking into an elementary school at 9am had me in a pretty grumpy mood with low expectations for Boston Barcamp 3. As is sometimes the case (in very, very rare circumstances, I assure you) I was wrong. The event was great. Absolutely everybody there was interesting and had something cool to say. The talks were great and I came away with a renewed passion for my own work. I spent a lot of time pursuing topics that were interesting to me and had no impact on my business. I also spent time talking with other people interested in the mobile device space as well as startups in general and got a tremendous amount of valuable feedback.

It’s impossible to talk about everybody I ran into and everything I saw, but here are some of my personal highlights:

  • Dan Grover from Wonder Warp did a fun and really informative talk on iPhone programming. Scarey stuff.
  • Matt from Pandemic Labs did a talk about viral marketing. At first I was concerned that nobody at a tech meetup would want to talk about such things but I was surprised to find this presentation was a great success.
  • Attended an interesting talk about turning twitter into a distributed service. This was interesting because I have not been following the drama around twitter but apparently this is quite an exciting topic.
  • At least three different people that gave Andrew and I clever things to think about when trying to sell the service we are creating to businesses.
  • Got the founder of MyPunchBowl.com’s opinions on a number of issues including SEO and the importance of creating only one product.
  • Saw a lot of the people I met at the Cambridge Enterprise Web 2.0 Meetup.

Unfortunately I will not be able to attend the second day, but this is a great event and well worth your time guys!

Just got back from The Cambridge Enterprise Web 2.0 Meetup

As the title implies, I just got back from this meetup. As with all meetups, the people were great, there was a lot of interesting people, and I’ve received several new ways of looking at the application Andrew and I are currently working on. I think it is definitely true that great ideas are not created in a room alone.

Anyway, here are some of the links for people that came up in some of the discussions I had:

I’m sure I forgot something, but hopefully this is sufficient for now. :)

P.S. I don’t see any way to change Gmail’s threading model…

Custom Super Mario World level which plays music with items

One of the convenient things about having a blog is that whenever I come across a nifty thing online I can just write about it once here and link my friends, rather than explain it time and time again.

Quick background:
Super Mario World is remembered by many as one of the greatest games of all time. It is so popular that the emulation community hacked up the game in such a way that allows the creation of custom levels. A new game was even released by the emulation community called Super Demo World which turns Mario World into a side-scrolling puzzle game.

This video:
Today, one of the popular things in the emulation community is creating levels in which the player does not touch the controls and instead, the level moves Mario about. Here is one such video except it also uses all of the items in the game to make a very well done musical score:

The link
http://kotaku.com/387830/this-hands+free-super-mario-world-level-plays-sweet-sweet-music

It kind of sounds like the songs we made in Mario Paint.

Iron Man is a Batman Clone

I went to see Iron Man last weekend and, unsurprisingly, I have three opinions to share:

  1. Does anybody else think it is slightly ridiculous that his solution to the problem of being captured by terrorists is to create an all-powerful suit powered by some futuristic reactor? The man is trapped in a bunker, being watched by cameras 24 hours a day, and surrounded by explosives. Isn’t there anything more practical? It worked out for him, but only because his captors were complete dolts.
  2. I enjoyed the movie. I was particularly partial to his interaction with his own robots. This was extremely well done and very comical. Again we get into the problem of, why a super suit? If he is so capable that he built robots with intelligence so great they can make jokes and banter with us, why is he bothering with suits and not just super-robots?
  3. I felt like the character was a lot like Batman. But I wasn’t so sure so I made the following table:
    Tony Stark Bruce Wayne
    Has no parents around Has no parents around
    Has an assistant who makes everything possible Has a butler who makes everything possible
    Is fantastically wealthy Is fantastically wealthy
    Got his money from a company his father created Got his money from a company his father created
    The company is named after his father The company is named after his father
    Was almost kicked out of his own company Was almost kicked out of his own company
    Uses technology to fight crime Uses technology to fight crime
  4. Criticism aside, it was enjoyable. I’d recommend it. It is fun being old enough that all the movies coming out are remakes of television shows I watched as a kid!

Video of Noah spinning at Lime Rock

This is my blog and it is the summer so it wouldn’t feel right if I didn’t have a video clip of some sort of car event up here. Unfortunately I have very little to show for myself since I’m saving my money for my company but 2 weeks ago Noah had a really good spin at Lime Rock I figured I’d share. He wrote a little blurb about it on pansypatrol.com.

A True Gamer’s Video Clip

One of my friends linked me to this video which made me chuckle because it appealed to the gamer in me. I wish it weren’t so, but I definitely a know a lot of guys who would rather have the Playstation than the girl. Personally, I’d take both. :)

Solutions to common problems encountered while configuring your PC to dual boot Vista and OSX

PC Laptop + OSX There are a bunch of guides out there on how to dual boot Vista and OS X on your PC. While I have listed the general steps that I followed below, this post is intended to be a troubleshooting guide for some of the weird problems you can run into while trying to do this.

hfs+ partition error on boot
This usually means that you have a problem with your master boot record (MBR) or the partition id is unrecognizable to the loader. To fix this:

  1. boot the Mac OS Installer DVD
  2. from the Utilities menu, open a terminal
  3. from the terminal run
    fdisk /dev/rdisk0 (or whatever device you are using)
  4. look for your OS X partition. If the id for it is not ‘AF’ then setting it to AF should fix your problem. This is concerning though because Apple’s Disk Utility should set this properly.
  5. if the id is AF then you can rebuild your MBR by quitting fdisk and running
    fdisk -u /dev/rdisk0

b0 error on boot
This is usually caused by the OSX partition not being marked as active. To fix this:

  1. boot the MAC OS Installer DVD and open a terminal from the Utilities menu
  2. launch fdisk with
    fdisk -e /dev/rdisk0 (or appropriate device)
  3. press p and enter to see a list of partitions
  4. find your Mac OSX partition in the list
  5. type f to make it active. For example if the partition you want to make active is number 1, type:
    f 1
  6. enter the command:
    write to commit the changes
  7. on reboot, things work.

Windows fails to boot, claiming \Windows\system32\winload.exe is missing or corrupted
There are a number of things that can cause this. Fortunately this is really easy to fix. Just pop in your Vista DVD and run through the automated recovery to have it rebuild your \boot\BCD and update the MBR. Note that this requires that your Vista partition be flagged as bootable.

Vista DVD is unable to find any installations of Windows to restore or when you try and install Vista it gives you the error “Windows is unable to find a System Volume that meets its criteria for installation” or when you are manually using bcdedit to fix your mbr it tells you it cannot write to the disk
As unintuitive as it sounds, this is usually caused by the Vista partition not being flagged as bootable. To fix this, follow the steps for making a partition active from the b0 error on boot instructions, except use the id of your Vista partition instead of your OSX partition.

You have both operating systems installed and can boot Vista but EasyBCD does not have the auto-configure Mac device option that you are looking for
The fix for this is to not use EasyBCD for this. I find this to be an unnecessary complication. Instead, simply copy the Darwin x86 bootsector (known as chain0) tor you local hard drive and use bcdedit to make Vista’s boot loader load Vista:

  1. Copy chain0 to c:\ (or the root of whichever drive Vista is installed on)
  2. from an elevanted command prompt do the following:
    bcdedit /copy {current} /d “Mac OS X”
    bcdedit /enum active
    this will display your active partitions Find the one labelled “Mac OS X”. Under it you’ll see a line titled “identifier” followed by a GUID sorrounded by {} chars. Copy that id
    bcdedit /set {IdYouCopied} PATH \chain0
  3. Reboot, you’ll see Mac OS X listed as an option. Select it. Then it will give 5 seconds to press a key to go into advanced options. Press any key. You’ll then see a list of all your partitions. Select the Mac partition and you should be good to go.

Steps I took to get my dual boot install working:

  1. I used the Disk Management snap-in to the Computer Management Console to shrink my Vista partition. This left me with a 30 GB Vista partition and a bunch of unpartitioned space. Using the same tool I created another 30 GB Partition.
  2. I booted the Mac Installer from a PC-bootable Mac DVD, used the Disk Partition utility to format the new partition with HFS+ (with journaling) and installed Mac on my box
  3. Installer finished, rebooted my machine and gave me HFS+ error
  4. I Rebooted the Mac Installer to fix that (this step is not necessary)
    Made the Vista Partition bootable and rebooted to see that Vista’s boot loader can’t find winload.exe. Used a Vista DVD to fix this
  5. booted Vista and copied chain0 to my root (c:\)
  6. used bcdedit to add an entry to the Vista Boot loader to boot Mac

Feel free to post any problems you have. Maybe somebody can answer them. :)

Close
E-mail It