Archive for the 'Java' Category

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

I've been using some proprietary frameworks and libraries, that are using Files objects, and only File objects, everywhere in the interfaces. It's not that is bad to have methods accepting File objects, but it's not wise to accept only that. For example the DOM/SAX XML parser in the JDK, accept File object but includes also […]

Workaround to multi threaded testing

Since it has been introduced in JDK 1.5, I have loved the Executor abstraction over multi threaded execution. Basically you define tasks, implementing Runnable or Callable interfaces, and you submit those tasks to an Executor implementation, knowing that before or later the task will be processed. It's the Executor who knows how the tasks must […]

Lady Java

This is video is quite recent, but already very popular. It’s a parody of Lady Gaga songs, about Java. Looks like Oracle is gonna benefit of the Java wave even though they already declared themselves as bad asses, more interested on money and control than on technology. Java rocks, and ever will. Despite Oracle.

JavaBeans to XML, with no libraries.

Converting JavaBeans to XML and viceversa is quite a common task, and there are tons of libraries around for this purpose. But I always like to use what is already available in the JRE, avoiding dependencies as much as possible. In the past I and Simone developed a rest API using the JSR57 serialization, that […]


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.


March 2017
« Nov    

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:



Tag Cloud