Archive for March, 2009

man ps: OSX strikes back.

It seems that man pages on OSX are misaligned with the commands sometime. Example: From $ man ps I read: -e Identical to -A. But look how identical they are: luigi@noname:~$ ps -e PID TT STAT TIME COMMAND 12332 s000 S+ 0:00.03 -bash PATH=/usr/bin:/bin:/usr/sbin:/sbin TMPDIR=/var/folders/+K 12376 s001 R 0:00.03 -bash PATH=/usr/bin:/bin:/usr/sbin:/sbin TMPDIR=/var/folders/+K luigi@noname:~$ ps -A […]

Mocking JNDI

Testing components that use JNDI to get DataSources and other resources can be annoying, because (hopefully) you don't want to run your unit tests inside the application server. JNDI is a good example of how the ServiceLocator makes testing harder. When you can't turn around the JNDI to get your resources and inject them into […]

Today I used commons-net to verify when an IP address is in a subnet specified in CIDR notation. So, I got a bug. This code: SubnetUtils utils = new SubnetUtils(""); System.out.println("lower address: " + utils.getInfo().getLowAddress()); System.out.println("higher address: " + utils.getInfo().getHighAddress()); System.out.println(" is in range? :" + utils.getInfo().isInRange( "" )); gives this output: lower address: […]

Fonts: OSX vs Linux.

Which one do you read best? A. B. Don't read this until you've answered yourself: ˙xnuıl ɯoɹɟ sǝɯoɔ ǝldɯɐs puoɔǝs ǝɥʇ 'xso ɯoɹɟ uǝʞɐʇ sı ǝldɯɐs ʇsɹıɟ ǝɥʇ

Recently at Devoxx I've heard that type inference will be available on Java7 to shorten collections instantiations. (If I remember correctly, from Josh Bloch's workshop). I catched the idea, and started using Type Inference and Varargs to shorten my code. Here's an example: static <K, V> Map<K, V> newHashMap() { return new HashMap<K, V>(); } […]

Two Saturdays ago, I bought the Wireless Apple Mightymouse. Very nice looking, but I find it much harder to use than the MacBook's touchpad. Basically the problem is the acceleration, there's no way to set it up without external utility: usboverdrive, steermouse, about $20 each. While you can adjust mouse acceleration in any decent OS, […]

Ant macrodefs

With ant it's possible to create macros and use them like standard ant tasks. For instance, in a previous project I was using a proprietary build tool that needed to be launched at the command line. So I created an ant script that was launching that tool from eclipse, and to reuse the invocation logic […]


You are currently browsing the NewInstance weblog archives for March, 2009.

Longer entries are truncated. Click the headline of an entry to read it in its entirety.


March 2009
« Feb   Apr »

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:



Tag Cloud