Archive for the 'Java' Category



Another funny video I found around.

I/O Exception handling

I very much prefer this approach: OutputStream out = new MyOutputStream(…); //may throw IOException try { //use the stream } finally { out.close(); } than this: OutputStream out = null; try { out = new MyOutputStream(…); //may throw IOException //use the stream } finally { if (out != null) { out.close(); } } I just [...]

When I first had to use OS X I had hard time with some things that weren’t working as expected. I thought they were usability bugs, but of course don’t try to argue about that with a veteran Apple user, because “you’re ugly and stupid, and that’s the way it should be! And OSX has [...]

SSH Bash Completion

Today I was having a look on how the git-completition is implemented. If you have not enabled the completition for git, I think you should really read my article on how to do it. So I found this two links, that explain the basics on how to implement bash completion for simple commands: An introduction [...]

Are you habit to have some configuration files packaged inside the jar of your application? If so, you can still have a look at those configuration files in the running environment using the unzip Unix utility. $ unzip -p /opt/myapp/lib/my-app.jar log4j.properties log4j.rootLogger=INFO,stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Threshold=INFO log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{dd-MMM hh:mm} [%-5p] %m%n The -p option uncompress and prints [...]

I wrote in a previous article how easy it is to translate Java object to/from XML, without adding exotic library dependencies to your project; recently I’ve going through the code of one of my colleague and I discovered that the 3 line necessary to marshal and un-marshal the XML can be shortened to a single [...]

Eclipse Save Actions

I recently started to use a feature in Eclipse 3.6.1 that I didn’t notice before: the “Save Actions”. Basically you can configure some actions that will be done automatically when you save a Java source. Some of them are really useful, like Organizing the imports, adding ‘final’ to private member instances, etc. Here the screen-shot [...]

Just discovered an interesting bug in Java interpreter and compiler, that makes them hang when converting the value 2.2250738585072012e-308. Nice to know. The bug has been reported to Oracle, but I supposed they will include this in their collection of bugs and sell it as “Oracle Database 12g” product. :-)

Unit test naming conventions

There are a certain number of naming conventions used for unit tests. At beginning, with JUnit 3, to define a test it was mandatory that the class name was named like MyClassTest, be extending from TestCase and all the test method names were starting with ‘test’ as in ‘testMyMethod()’. I think that this is a [...]

Android sdk 2.2_r2 sources

Yesterday I took back some source samples I was using to learn android, so I got a good chance to build android-sdk-2.2_r2-src.jar for anyone that may need it. I remember to readers that there is a script to generate those on this blog post, where I also explain how to use those files. For the [...]




About

You are currently browsing the NewInstance weblog archives for the 'Java' category.

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

Calendar

February 2012
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
272829  

Follow me

twitter flickr LinkedIn feed

Enter your email address:

Archives


Categories

Tag Cloud