Skip to main content


Showing posts from 2009

JavaFX Composer

Just trying out the new FX Composer in Netbeans 6.8. Looks pretty cool!
Checkout at

Type safe hibernate criteria

Here is a cool thing I figured out today to use type safe property name in hibernate criteria. Typically this is done with strings, but with lambdaj, it can be done as:

import static ch.lambdaj.Lambda.on;
import ch.lambdaj.function.argument.Argument;
import ch.lambdaj.function.argument.ArgumentsFactory;
DetachedCriteria criteria = DetachedCriteria.forClass(Contract.class);
criteria.add(Restrictions.eq(propertyName(on(Contract.class).getContractKey()), 43));

public static String propertyName(Object placeHolder) {
Argument actualArgument = ArgumentsFactory.actualArgument(placeHolder);
return actualArgument.getInkvokedPropertyName();

Notice how the Restrictions does not take string literal and uses lambdaj to evaluate the property name from java method directly. Pretty cool ah?

Blame it on the Genes

I was just randomly watching a PBS Nova show today

Ah ha.. that figures. When I was growing up, my parents had a big issue with me for now eating enough greens. For me, I just could not stand certain green vegetables for their bitter taste but my dad loved eating those - and forcing me to like them too. How I wish I could have told them to blame it on the genes!
Google may be all cool and great, but living in Canada, Google does not seem to care as much for us. Microsoft already has traffic reports for Toronto in their maps - with that I don't really see any reason to use Google Maps anymore! Google - get your act together!