Affichage des articles dont le libellé est ruby. Afficher tous les articles
Affichage des articles dont le libellé est ruby. Afficher tous les articles

mardi 9 octobre 2007

I want closures in Java !

It's true, trying other programming languages, different enough from your main programming language make you a better programmer/designer in general.

My main programming language is Java, but I also do a lot of Ruby, and it definitely helps me to find new technics in Java.

Now, the problem is : the more I use closures in Ruby, the more I miss closures in Java...

However sometimes, even in Java, the only answer to some OOP problem is some sort of closure, implemented via a callback interface with an anonymous inner class. But the syntax cost of such a construct is very high. All the more so since only final local variables can be used in the anonymous inner class.

So. I do hope closure will make it in the next release of Java.

dimanche 7 octobre 2007

XMLRPC/Ruby presentation for TSP

The slides of my presentation on the implementation of a TSP consumer in Ruby for the first TSP workshop are archived here.

lundi 10 septembre 2007

Sort JPG images by EXIF date in Ruby

Everybody now has a digital camera, and, during special events everybody takes plenty of pictures, and you end up with all these JPG images from different cameras. Each set of pictures tells the same story from the beginning, so it would be great to be able to reinterleave all of them in order to tell one single story.

That what the folllowing little Ruby script does, thanks to the libexif-ruby library. If you run it in a directory with JPG images, it will create a subdirectory and copy all images, renaming them, prefixing with the EXIF date set by the camera.

First, install the libexif-ruby library. On Ubuntu you can type :

Then copy the following script in a ruby script file :