Tuesday, January 25, 2011

scala generics and eclipse autocompletion

The Scala 2.8.1 compiler doesn't create correctly the generics signature in some cases

https://lampsvn.epfl.ch/trac/scala/ticket/4067

Eclipse 3.6 is very strict about the signatures and it's autocompletion feature throws an exception when you work on a java project using scala code:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=332423

The issue is being fixed in both projects, but in the meantime I needed to work in eclipse with the akka library, and this issue is annoying.

I wrote a small tool which tries to fix the scala classes. Currently I tested it only on scala-library.jar, which contained the "orElse" method whose signature affected my setup. I don't know if it fixes all the problems, but I tried it on my project and eclipse  doesn't complain.

For now I only tried to put that jar in the eclipse IDE classpath, while keeping the original scala-library.jar in the executable classpath.

You can get the code at:

https://github.com/mmikulicic/scala-fix-generics

Thursday, January 13, 2011

Ballerina

A colleague of mine told me today that that his girlfriend woudln't believe that there was an optical illusion in the animated dancer image that you can find at: http://dl.dropbox.com/u/2520452/ballerina/ballerina.gif

I was just about to play with html5 canvas drawing, and so I wanted to try out to pilot the illusion with a small red ball which can rotate in both directions, following an elliptical path (an illusion of perspective) and appearing to disappear when going "behind" the dancer.

I don't know if it works for all, but for me this simple (and unprecise) animation, combined with the psycologial effect introduced by clicking on a "change direction" button, swaps the dancer's direction immediately in my head, or at least within one rotation.

Click here to se a demo

Source code on github