Utility calls

Java is very verbose. Therefore many people have come up with calls to do very common things. For example:


This prints the contents of the array, instead of a cryptic string. This method is available since 1.5.

Another good one is:


Usually used in a finally clause, this one closes streams or readers, ignore IOExceptions, and handles null. This is available in the Apache commons-io library.


Once again, Ubuntu amazed me with zsnes (Super Nintendo Emulator) in its package repository.

There was no sound initially, until I tried “zsnes -ad sdl“. Then I got sound. But terrible and crackling. Next I tried installing alsa-oss. Didn’t work, until I invoke it with “aoss zsnes”. Good sound! And it works subsequently from the “Start Menu”. Yey!

Now the problem is my gamepad is semi-working… It works fully in Windoze, but here it only recognizes the buttons but not the directional pad. Why? I followed some tips to install joystick and jscalibrator, but it didn’t work. Until I tried this site, to chmod 666 the device, and it worked! So now I’m not sure if its just the chmod, coz I uninstalled joystick and jscalibrator and it still works. (I did not uninstall the prerequisites of joystick and jscalibrator though). So if you have the same problem you may want to try the chmod first, to find out if joystick/jscalibrator was needed.

One more thing to note: Windoze stores game states in the same folder as the ROM, while in Ubuntu, the game states are in ~/.zsnes . Took me quite a while there.