Valentine’s Day 2014: Wood Carving

This year’s Valentine’s day video is going to be a little short, I’m afraid. Over the past three weeks or so, I’ve been playing with several ideas. My main goal was to have decent, full HD video for my video, since I found the video quality in my previous videos somewhat lacking. Since I didn’t have much luck finding a decent video camera to use, I decided that a still camera would have to do. Raspberry Pi in hand, I set about creating a time-lapse rig using my dad’s DSLR camera.

Raspberry Pi


It turns out that there’s a great camera control library called gphoto2, which will not only download videos from a variety of cameras, but is also capable of controlling the shutter on many Canon and some Nikon cameras. Once I had that installed, creating time-lapse videos was a fairly simple matter of one command: watch -n 10 gphoto2 –capture-image. This captures one picture every 10 seconds. My first test, watching an ice-cube melt, went pretty well, despite the fact that the tripod was a bit shaky.

In the end, I didn’t have time to build a power pack for the Raspberry Pi, so I couldn’t film without a power outlet, which is inconvenient to say the least. So, in the end, I decided to record a time-lapse video of my carving a piece of wood. Bare in mind, this is the first thing I have carved EVER. So it’s not that great, but the video is cool, at least.  It took me about an hour and 15 minutes to carve out the drawing I made.

The final obstacle was that Adobe Premiere decided that it couldn’t possibly load any video format that I threw at it, so unfortunately I couldn’t edit the video at all. so there’s a single picture at the bottom of this post showing the final result.

So, without further ado, here’s your moment of zen:

Finished Carving


Projects: I Need Them

Yesterday, I went to McGill’s Tech Fair. All manner of companies were there, scouting talent and taking applications, looking for young students who need jobs. Needless to say, they found plenty, and I was one of them.

It was the first time I had ever been to the Tech Fair, and I wasn’t entirely sure what to expect. I’ve been told my CV is impressive, but I didn’t know what companies would be looking for, or even what – exactly – I was looking for. Among the myriad mining companies (I counted around three gold mining companies) and engineering firms, I managed to find a few software companies that interested me. I chatted, asked questions, and tried to make myself seem knowledgeable, curious, and passionate. The one question I wasn’t prepared for, however, was the question I expected to be the most prepared for: what projects have you done lately?

I’ve always thought of myself as someone who does projects. I’ve always done projects. Ever since I was a kid, I’ve been building things, even to the detriment of my own schooling. I have all but four volumes of Make Magazine that have ever been published. MacGyver is my hero. On any given day, I would rather code for five hours on one of my own projects than for one hour on an assignment for school, and yet I couldn’t think of a single project that I have done recently for my own interest, and of my own volition.

This realization has been a long time coming, I think. School and extracurricular activities (read: work) have sucked up a lot of the time I would ordinarily spend hacking and coding. And when I’m not studying or working, I’m usually too lazy and worn out to start working on something else. Sure, I’ve written some little programs here and there on the weekends or over the summer – coding is a part of life for me – but I haven’t really built any of the super cool, outlandish, crazy awesome projects that I used to build when I was younger and cared less about school. And that’s a shame.

So today is when it changes. This evening, I’m going to blow a TON of time that I could be spending on a DOZEN other things, writing a program that I’ve wanted to write for a few weeks. I’m not going to finish it tonight – I may not even finish it in a week, a month, or a year – but I’m going to start it, and I’m going to have fun. I’m going to tap into my passion again: I’m going to focus on what’s important.

How to Heat Your Livingroom with Computers

It’s time I explained what all this cluster computer stuff is about. It’s kind of an insane project, but bare with me. Some of you may have played the Wikipedia game “Seven Steps to Jesus.” Basically, it’s a special case of the Wikipedia game Wikirace, where you try to get from one article to another as quickly as possible. In Seven Steps to Jesus, you try to get to the Wikipedia article about Jesus in seven clicks or less. Why Jesus? Why seven? Who knows, who cares. But the point is, that it’s fun for about ten minutes.

This ridiculous game wandered into my mind the other day, and I started thinking, “I wonder how you could create a computer program that would play Seven Steps to Jesus…” The answer depends. If you give the program access to the entire Wikipedia database, then the task is trivial. It’s very simple and quite fast to spit out the minimum number of steps from one article to another. But what if you don’t give the program access to the entire Wikipedia database? What if it has to go to an article, and choose which link to click just like humans do: with “intuition?”*

As you might have guessed, the task becomes more complicated. Now we’re talking about machine learning (FUN!) I started to think about how you could train an AI to assign a “relatedness” value to every given article on Wikipedia by giving it access to the Wikipedia database, and having it traverse the links from one article to another. If you’ve taken a class on AI, you know that eventually, this relatedness value will converge to the shortest path. Basically, this program will do nothing useful… except heat my living room.

Except! Except that I’m going to train an RL agent in parallel. That’s the only thing that might be novel about this (other than the fact that I’m introducing the “Seven Steps to Jesus” task to the AI world.) Ordinarily, you would want the agent to learn sequentially, because if the links change, you want the agent to learn with the changes. But in this case, I really don’t give a damn about sequential updates. Also, this task is stationary (the distance between any two articles in my downloaded Wikipedia database will never change,) so updating sequentially doesn’t matter all that much.

So what you should get from this, is that this project is a HUGE waste of time. But it’s fun, and I’m learning about graph databases, and RMI, and I got to build and run a computing cluster. Maybe there’s a real task for which this approach is suited. I’m not sure though. Usually in RL, you have to run a trial many times in order to test an approach, so there’s really no point in distributing the actual processing. In other words, if you’re going to run 100 trials of your schmancy new algorithm, you might as well just run one trial on five different machines until you finish, rather than splitting up the computation (which adds overhead,) into five different parts.

The point is, I’m having fun. Leave me alone.

Discipline Week Update: Today was day four of Discipline Week, and so far so good. I’ve been trying to avoid napping, because I want to really embrace this 7am to 11pm schedule I’ve got going, but today I really needed a nap. I ended up sleeping for maybe an hour and a half, which is really too much, but we’ll see how things go tomorrow. I’ll write a more detailed post tomorrow about how Discipline Week is going, but I thought I’d let you know that it’s still a thing, and it’s going well!

*Yes, there are algorithms that do this quickly, but you’re still missing the point: the point is, this will be fun. Fun, I tell you, FUN!

My Livingroom Is A Supercomputer

As a Computer Science Student, I like the idea of being able to run my code on the biggest, baddest computers there are. Unfortunately, most of my code doesn’t need more than my laptop. In fact, many of the programs I write would run just about as well on my phone, or an Apple II. However, sometimes I do write programs that require gobs of raw computing power. Last night, I conceived an idea for just such a program. Before I even started programming, I realized that my only hope for finishing computation on the large dataset I wanted to process (all the links on Wikipedia, many times) was to spread the computation across multiple computers. I needed a cluster. So I built one.

A cluster (short for computing cluster) for those who don’t know, is basically a bunch of computers connected via a network. You could think of the Internet as a computing cluster, but the important difference between the Internet and a useful computing cluster is that a useful cluster works toward a unified goal. As you might have guessed, part of the beauty of a cluster is that the computers involved don’t have to be all that powerful by themselves to be useful. Because my family doesn’t usually get rid of computers (precisely for occasions such as this,) we had three old laptops lying around, all of which I confiscated for my cluster. Add my laptop to that, and I have a cluster of six cores. It’s not a whole lot, but it may just be enough. I also have an old switch (what most people would call a “router”) that I saved from the trash during high school, which I’m using to connect the computers together. After installing Debian Linux, and puppet to manage the configurations on all the machines, I’m almost ready to run cluster computations!

In order to run a cluster, you need a server to distribute the data you want to process, and clients to actually do the processing. In this case, I’m talking about the server and client software, not machines. So I have to write a series of programs that will split up my data and process it on each of the cluster computers. It’s simple enough when you use Java’s RMI (Remote Method Invocation.) The server maintains a collection of the processed data, which is updated whenever the clients finish processing. Once the client has finished its data, it sends back its results and requests more data.

This strategy has a lot of advantages, including the fact that I don’t have to store the entire Wikipedia database on more than one machine. Since the data is sent in chunks, I can store it all on one of the two computers in my cluster that can handle that much data. Also, the clients can work asynchronously. Since the computers don’t have to wait for each other before getting new data to work on, my laptop can crunch along at 2.53GHz per core, processing as much data as it wants, while the poor little AMD Athlon slogs through whatever data it can handle.

My livingroom table, which currently houses four computers and a switch. Delightful.

My cluster is called “End of the World,” or EotW for short. I was trying to think of a theme for the hostnames of the computers in the network, and I settled on character’s from Haruki Murakami’s novels. Since there’s a “place” in his book Hard Boiled Wonderland and the End of the World called “End of the World,” I figured that would be fitting. The nodes are named toru, watanabe, and sumire.

How much did all this cost? $20 for a power strip. Even if I didn’t have all the laptops, I could have waited until the morning, gone to the recycling center, and picked up a bunch of computers and a switch for free. That’s what I love about cluster computing: with just a little recycled hardware, you can create a pretty fast computer. It’s true, my tiny computing cluster barely rivals a new, mid-line desktop computer with an Intel Xeon processor, but it’s still faster than just my laptop. And hopefully, with all those computers working full tilt for a few days, I’ll be able to crunch through my data*.


*As I said before, I’ll discuss what I’m trying to do at another time. Trying to explain it here would make this post too long, and I want some tangible results before I start talking about it.

Valentine’s Day: Musical Hearts

Here it is, ladies and gentlemen: this year’s Valentine’s Day computer art project. For the past two years, I’ve done some sort of computer art project for Valentine’s Day. The first was a 3D printed heart with a red LED inside. Last year, I recorded my entire bus trip to school, and wrote a program to select only frames with a certain amount of red in them, and compile them into a video. This year’s project was slightly more ambitious.

My original idea was to take videos of artistically interesting things on my walk to school. A computer program would then find trackable points on the video, and “stick” hearts to those objects. The sizes of the hearts would correspond to the amplitudes of certain frequency ranges in a song that would play in the background… a song which I would compose and create on my computer.

Several factors led to my cutting out the motion tracking entirely (namely that OpenCV is complicated, and Adobe After Effects hates me.) However, the hearts respond to the sound of a song that I composed and performed using ChucK, which is a programming language for creating sound. If you hadn’t already guessed, the red heart is low frequency, pink is midrange, and white/light pink is high. While the result isn’t nearly as cool as my original idea would have been, I think it’s pretty nifty, and it was fun to make. I also learned about some valuable tools in Processing.

To record the videos, I walked from Westmount to McGill at 7:40am, in -15 degree weather, without gloves. When I got to McGill, I could hardly feel my hands. So it’s safe to say that I put a lot of effort into this video.

(There was initially a problem with the upload, which has now been corrected.)

For the sake of comparison, for last year’s video I used two programs, one of which I wrote myself (Cinelerra and a python script for selecting video frames based on color composition.) For this year’s video, I used a grand total of 8. In order of usage (more or less:) ChucK, miniAudicle, Sound Flower, Audacity, Processing, Adobe After Effects, and Adobe Premiere*, and a Java program that I wrote in Processing.

*I am currently upset with Adobe. As a student, I cannot afford a license for the Adobe Creative Suite; a marvelous collection of software. I also have no intention or ability to make a profit from the work I have would do with the Creative Suite. If I spent my free time playing with Photoshop, After Effects, and all the other neat programs on my own computer, however, I might be able to make money from my work some day, at which point I would buy the Creative Suite so I could profit from my art. On the other hand, there isn’t a chance in hell I’m going to spend $899 on the Master Collection just to tinker. Therefore, it’s in Adobe’s best interest to offer a FREE (as in beer) version of the Master Collection to students for strictly non-profit, educational use. So there, Adobe, the ball is in your court now.

The Cheapest Violin Ever Made, Part 1

It’s night time at the Basilica of San Domenico in Cremona, Italy. The grave keeper has just turned out the lights in his house and slowly shuffled up the creaky stairs to bed. A storm is brewing outside, but at the moment the clouds are content to rumble and flash, pausing occasionally to spit a few drops of rain down from the heavens. In the middle of the cemetery, a rumbling begins; it starts as a low vibration, and then the Earth starts to tremble. The large tombstone in the center of the graveyard falls backward, splitting in half when it hits the ground with a loud “thud-CRACK!” and a hand shoots up from the grass in front of the grave – something is emerging.

The grave keeper turns on a lantern (because that’s what you do when you hear something scary outside, even in the 21st century,) and peers out the window. He’s wearing a white nightcap and a white nightgown like they used to wear in the old days, because that’s his style, and they don’t just make you the grave keeper of an ancient Italian cemetery just because you’re looking for work, after all: you have to fit the part. Lightening flashes, thunder rolls, and he thinks he sees a figure outside, but he can’t be sure. He puts on his raincoat, grabs a shotgun, and walks outside, the lantern on his arm, bunny slippers on his feet.

It’s immediately apparent what has happened: the grave of Antonio Stradivari has fallen over. Determined to find the pranksters who knocked it down, he cocks his shotgun, dims his lantern, and creeps around the cemetery, checking behind each of the graves for someone who might be hiding there. He hears a loud moan. And again, but closer by. And again, this time right behind him. He turns around, and as he’s lifted up in the air by his neck, he drops his shotgun and lantern. “Do you know what they’re doing?!” exclaims a somewhat disfigured, horribly discolored, but in otherwise good shape Antonio Stradivari, “Someone – someone is building a violin – out of TWO BY FOURS!!!”

Meanwhile, in Montreal…

I’ve just started a project I’ve wanted to work on for a while now: I’m building a violin! This one’s just for practice, and I don’t want to spend money on wood that I know I’ll probably end up ruining, so I’m building my first few practice violins out of two by fours. (Did anyone here that grumble? No? Oh well, never mind.) Will it work? No, probably not. The pegs I used to join the two by fours together were shorter than I expected, the wood is knotted (thanks, Home Depot, your wood is crap,) and I’m expecting to run into holes while I’m carving. However, I hope it’ll be good practice for the real thing, and at the very least I’ll know what working delicately with truly terrible wood feels like. It should be an interesting experience at the very least, and I hope to update my blog with details as I go along.

Here are the two slabs for the back and belly in all their ugliness. They're quite solid, quite heavy, and positively riddled with knots and holes.

Note: I took a LOT of creative license for the Antonio Stradivari bit at the beginning. 1) Stradivari is not buried in a cemetery, but outside the Basilica of San Domenico, 2) I don’t believe there is a grave keeper as such, and 3) Stradivari has quite a subtle and unobtrusive tombstone which, to my knowledge, is not in the center of the “cemetery.” So basically, I lied. A lot. It was for effect: deal with it.

Where Am I?!

You may have been asking yourself “Where has he been?! It’s been an entire week or so since his last blog post!!” You would be right to ask yourself that question, and I’m going to provide you with an answer. I’ve been around.

A Roomba/Create rather precariously carrying my laptop. I made sure to drive it slowly so my computer didn't fall off. It's safe to say that this was the smartest vacuum cleaner in the building.

A lot has happened since we last talked, so try to keep up. First, I started working at McGill as a research assistant, as I said  I would be. I haven’t started any of the actual machine learning stuff though; right now I’m getting used to writing simple behaviors for the Roomba (e.g. move until you hit something, find a wall and crawl along it, etc) so that we can use the sensor data collected during the behaviors to try some simple learning algorithms. It’s been a lot of fun so far. I’ve been riding my new used bike to work, which has been fantastic. It’s an oldish, classic looking bike with an awesome front lamp that’s powered by a dynamo. I’m planning to put a capacitor in the lamp as well so it will stay lit while I’m stopped at traffic lights, but I’m waiting on that for now.

Yes, that's correct, I did model it after a Fender Telecaster. (Fender, please don't sue me: this is a one-off and a modified design. Also, immitation is the finest form of flattery, and you should think this is as awesome as I do.)

Plans for the one uke to rule them all are almost complete! I’m building a solid body ukelele with pickups I made from popsicle sticks (which actually work quite well,) and I’m hoping to have it finished by the end of the summer, but right now I’m still in the drawing/planning stage.

Feast your eyes on that delicious cake and pastry cream. You know you want it.

Several weeks ago I made a cake with two duck eggs and a goose egg, and then filled it with pastry cream made from one goose egg. It actually wasn’t as good as cake and pastry cream made with chicken eggs; the goose eggs lack a certain element of taste that cakes want, but the texture was the same. They were whiter than cakes or pastry cream with chicken eggs though, since duck and goose eggs have lighter yolks. Either way, it was a delicious excuse to eat cake. (Like you need an excuse to eat cake. Sheesh.)

They were delicious. And having eight of them for practically nothing made them taste that much better.

A few weeks before that, I made spring rolls. Once I realized that using a sushi roller for the wrappers was a horrible idea (they stick to the bamboo like no one’s business,) it actually went quite well. They weren’t entirely what I was hoping for, but they were very good nonetheless. The mayonnaise sauce I made was delicious though, and I’m proud to say I made it with no instruction at all.

It’s finally spring, and spring is rapidly turning into summer. Things are blooming, people are sneezing, and there are more people out on bike paths than I think I’ve ever seen. I saw some business guys in their suits riding along the bike path discussing business things, so I’m hoping this means biking will be the trendy thing to do in the next few years. Maybe Montreal will become another Holland. I’m not convinced it’ll go that far, but we can always hope.

So that’s it for my little summer update. I’m hoping to post some of the cool projects that have been rolling around in my head as soon as I can get them going. Until then, here’s an awesome picture of a tulip tree.

This is a tulip tree down the street from my house. It's pretty startling, especially since it has no leaves. Apparently the leaves develop after the flowers bloom and die.