Skip navigation

I shouldn’t do this, but I pulled you out for a moment to give you a hint.

in-the-way

Voilà, ma petite Amélie, vous n’avez pas des os en verre. Vous pouvez vous cogner à la vie. Si vous laissez passer cette chance, alors avec le temps, c’est votre cœur qui va devenir aussi sec et cassant que mon squelette. Alors, allez y, nom d’un chien!

maximize

Credits: Humor-sans font by ch00f, based on the handwriting on xkcd.

Post hidden and mangled, after it has been pointed out to me how it can be misinterpreted as more than a silly writing exercise… Yay self-censorship :( I failed to get across the point that these are (based on) things I’ve been a reluctant witness to, and not things I’ve invented…

Read More »

Peter Norvig is director of research at Google, and coauthor of the textbook Artificial Intelligence: A Modern Approach. I recently came across an interesting essay by him, called Teach Yourself Programming in Ten Years. He argues that like anything else, programming takes years to learn, and that books claiming to teach it in 24 hours or 7 days are snake oil.

Other interesting things I found on his website are some thoughts on climate change, and a list of infrequently-asked questions about Python.

Here are some pictures taken recently at a resort near Hîrjauca, Moldova.

John McCarthy, one of the pioneers of Artificial Intelligence, has an interesting page on the sustainability of human progress. He argues that we oughtn’t be afraid of Earth’s increasing population, nor of eventually running out of oil. I was surprised to find out that he is a skeptic about global warming (search for “global warming” on this page). He is now the second prominent scientist that I know of (after physicist Freeman Dyson), who thinks that the fear about global warming is unwarranted.

On the other hand, John McCarthy does say the following:

As I have read more about climate change, I have become convinced that I cannot learn enough about the subject to be entitled to an opinion on my own.

I wanted to create a video slideshow out of a bunch of pictures. The several GUIs I tried were all disappointing: they duplicated the same picture across many frames, resulting in a large file. Instead, I wanted each picture to use a single frame, and the frames to move very slowly (e.g. 4 seconds per frame, or 0.25 FPS).

Mencoder has a feature to do this, and it lets you specify the output format, resolution, and FPS. For example, we can do:

mencoder mf://*.JPG -mf w=640:h=480:fps=0.25 \
         -ovc lavc -lavcopts vcodec=mpeg4 \
         -o output.avi

There are two annoying limitations (my version is SVN-r1.0~rc3+svn20090426-4.4.3):

  • It does not support images of different resolutions.
  • It gets confused by EXIF orientation tags, which are used by most cameras nowadays.

This can result in a cryptic error message:

Unsupported PixelFormat 38 0.00fps Trem:   0min   1mb  A-V:0.000 [366:0]
Unsupported PixelFormat 38
VDec: vo config request - 640 x 480 (preferred colorspace: Unknown 0x0000)
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.

Luckily, the convert tool from ImageMagick comes to our rescue. To resize an image to the desired resolution, we can do:

convert orig.jpg \
        -auto-orient -resize 640x480 -gravity center \
        -background black -extent 640x480 \
        result.jpg

The -auto-orient bit rotates the image to neutralize the EXIF orientation tag. The -background black -extent 640x480 bit pads the image with black. This is useful if the aspect ratios don’t match, for example if the original image is in portrait, but the desired resolution is in landscape.

The final result: a quick-and-dirty script to resize all images and create the video slideshow: mk_slideshow.sh. It is not the most user-friendly (it could take resolution and FPS as command-line parameters, for example), but it gets the job done.

Bonus tip:
To see the EXIF orientation tag of a JPEG image, we can use the identify command from ImageMagick:

identify -verbose image.jpg |grep Orientation

If it is anything other than TopLeft (or 1), mencoder will get confused.

Have fun making lolcat slideshows ;-)

I watched Amélie again last night. It is threatening to become my favorite movie. Its carefully crafted layers of cuteness and quirkiness and loneliness and courage, sweetened by Yann Tiersen’s music, were as uplifting as always. Ah, if only life could be that interesting…

Anyway, these last few weeks I’ve been thinking that I want to start writing a blog again. I used to have one in high school, but I pretty much abandoned it since I came to Tufts. I could always blame it on the lack of time, but it wasn’t just that. Another superficial reason was that I got on facebook. For a while, school papers were enough to drain my writing impulses, and max-420-letter wall posts were enough to satisfy my erratic bouts of self-expression. The deeper reason, though, was that I was embarrassed by the cheesy stuff I’d written when I was “younger”, and I wanted to disassociate myself from it all. Even though there are things I wrote earlier that I still like. (Let’s see now: Am I more embarrassed by the immature person I was then, or by how much of that person is still in me? Hmm…)

Fun fact: From starting that blog until leaving home: 240 posts in 602 days, approx 0.40 posts per day. From coming to the US until today: 26 posts in 1073 days, approx 0.024 posts per day. A 16-fold rarefaction in inspiration? Damn, they must have some pretty bad food here :) I think the reason I stopped writing publicly went way beyond embarrassment. It was closer to an expectation of perpetual embarrassment, a defeating feeling that whatever I wrote would be obsolete and laughable in a few years, no matter what. I felt that, because there were so many people around me who were smarter and more adjusted and better writers than me, nothing I could ever say or write or do had anything to offer to the world. So I protected myself, instinctively avoiding anything that was even remotely threatening, including writing. I tried to never let anyone see my flaws, because if they did, they wouldn’t want to be around me anymore.

All of the above hasn’t made me into a particularly happy guy. (Any reasonable person is probably rolling their eyes “duh” at this point.) It has been slowly dawning on me that there are people who will not run away when you reveal some of your aches and insecurities, but who will listen and give you a hug instead. If I believed in a god, I would thank him (her?) for such people. So what does that mean for writing? It means that there is value in what I have to say, even if I think it’s so imperfect. And there is no harm in laughing at it five or ten years from now. Hipolito from Amélie said it this way:

Life is but a draft, an endless rehearsal of a show that will never play.

So why not share the draft with others, while there is still time?