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("77.24.0.0/16"); System.out.println("lower address: " + utils.getInfo().getLowAddress()); System.out.println("higher address: " + utils.getInfo().getHighAddress()); System.out.println("77.23.255.254 is in range? :" + utils.getInfo().isInRange( "77.23.255.254" )); gives this output: lower address: 77.24.0.1 […]

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 […]




About

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.

Calendar

March 2009
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:

Archives


Categories

Tag Cloud


Listening