donkirkby

Saturday, May 14, 2011

Birthday cakes for programmers

I recently designed this birthday cake for a friend who is also a programmer. Here's the code that appears on the cake:
    int i=4;
while (i--)
/* 0100010 */
printf("%s%s\n",
"Happy birthday"
,i-1? " to you":
" dear Aki" );
/*TODO:use a
fork()*/
As you can see in the picture, the zeros and ones were replaced by candles on the cake. (Can you figure out how old the birthday boy is?)

Tools & Techniques

I got the original inspiration for this cake when I read the "Surprise for a programmer on Birthday" question on Stack Overflow. Sadly, that question has been deleted because too many people hate fun. However, you can see a shadow of its former glory on the Stack Printer archive site.
I used Péter Török's idea of code that prints the words to the Happy Birthday song and wrote my own version of the code laid out in a circular shape. Yes, I tested my code. I also included Josh's idea of binary birthday candles, although they were frustrating because I didn't space them far enough apart. The lit candles would ignite their unlit neighbours.
Once I had the code written and laid out, I was trying to think how I could ice the cake neatly enough to keep it legible. Then I remembered that some shops sell cakes with your photo on them. Could I draw an image of the code in a paint program and e-mail it to them? A call to my local Dairy Queen made me happy. Turns out they have edible paper and edible ink, and they just print it in a regular ink jet printer, how cool is that?
So all I had to do was draw the code, right? Not so fast, buddy! I wanted to make it look like an old dot-matrix printout, so I searched for a free dot-matrix font. There are a few of them, but they're all proportional instead of monospaced. Well, after much fruitless searching and head scratching I discovered Inkscape's vertical text orientation. With that, I could use the dot-matrix font I found, and force it to be monospaced. I had to type the text in columns instead of the usual lines - weird, but achievable. After that, I just added the green bars and I was done.
If you want to adapt my design for a friend's cake, you can download my SVG file and the font, then edit it in Inkscape.

Prior Art

Lots of other people have done similar things, here's a survey of some that I found. Sew Tara might have the most popular choice with a classic XKCD strip.
Penelope/Tania asked the stack overflow question that was my direct inspiration, and this is her cake.
Chantastic and team made this internationalized XML cake, along with a Spring XML cake, a SQL cake, and a UML cake. The UML cake looks like they figured out the edible paper trick before I did.
I love the syntax colouring on this one. Not sure who the original baker was, but the earliest source I could find was onehumor.com.
The Good Eats community describe this as a mistake that happened when the bakery's mail system mangled some MS Outlook HTML, but I think it would be funny to do intentionally.
Janet McKnight made this QR code cake and successfully decoded it with a phone camera.
I have an irrational desire for this pi cake. fungus amungus even posted instructions to make your own.

Update: My birthday cake

Aki returned the favour by designing a gamer cake for me. The cake itself looked like an old VT100 terminal, but he rigged up an LCD projector to display the screen contents on the surface of the cake. Then he wrote an interactive fiction piece about me at the office on my birthday. I've never played a text-adventure game with a room full of people watching before; it's a little distracting. When the little game finished, it triggered an animation of Conway's Game of Life that segued into "Happy Birthday Don". All in all, very impressive, Aki.

Labels:

4 Comments:

At 8:59 pm , Blogger tania said...

i stumbled across this while looking for the remaining cake ideas. that was MY question!!! i think it's awesome that people are still making "coded" cakes. YAY! oh, this is tania (penelope) btw.

 
At 11:25 pm , Blogger donkirkby said...

Hey, @Tania, thanks for saying hello.

 
At 9:45 am , Anonymous Anonymous said...

This comment has been removed by a blog administrator.

 
At 7:58 am , Anonymous Anonymous said...

This comment has been removed by a blog administrator.

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home