Reload resource bundles on the fly, finally!

posted 13-May-2009 | 2 comments

Ever since the very first time I used a properties file in Java I’ve wanted to be able to reload it upon a sysadmin request or some other circumstance without having to reload the whole application, reset the application server or use some dark proprietary Sun APIs. Well, finally in Java 1.6 we can do it!!

Read more »

Fast collection look-ups

posted 30-Apr-2009 | 6 comments

I recently had to load a bunch of objects into memory and then perform thousands of look-ups over that collection. Using the good old java.util.ArrayList just didn’t cut it, the contains() function is extremely slow (as you would guess of course since this implementation stores elements as they are inserted and without any aditional indexing structure).

Read more »

Automatically serialize POJOs to and from JSON

posted 22-Apr-2009 | 2 comments

The best tool I’ve found so far to serialize POJOs to JSON (and back again) is XStream, it’s automatic, simple and elegant, check it out.

Read more »

PHP & Java interoperable encryption

posted 16-Jan-2009 | 3 comments

I recently faced the problem of encrypting something in PHP and decrypting it using Java, this proved to be a little more of a challenge than what it initially seemed like.

Read more »

Setup your web server to properly serve MS Office 2007 files

posted 20-Oct-2008 | no comments

Most web servers are missing the new MIME types needed for Office 2007 files (docx, xslx, etc.) and when you server one of this files from your web application the users browser typically tries to open them as ZIP files.

Read more »

Download a file using Java

posted 10-Oct-2008 | 6 comments

Download a file using Java from a URL should be a simple task, well it is :P. If you just don’t want to think too much about it here is a sample method to do it.

Read more »

JarOutputStream problems on Windows

posted 8-Sep-2008 | no comments

If you ever tried to create a JAR file from Java code using JarOutputStream on a Windows platform you might have become as frustrated as me. I ran into two problems and since they took a nice part of my sleep time I’ve decided to share them and the solutions I found.

Read more »

Simple & nice Javascript date picker

posted 2-Sep-2008 | no comments

Check it out at http://www.styledisplay.com/mootoolsdatepicker/, it’s quite simple to use and looks great.

Read more »

Read a file into a byte array

posted 22-Jul-2008 | 7 comments

Need to read a file into a byte array in memory, here’s a simple code sample.

Read more »

Authenticate users using i5/OS (AS400) credentials

posted 12-May-2008 | no comments

The folks at IBM have a nice API to use i5/OS (AS400) stuff from Java code. Check it out at http://www-03.ibm.com/systems/i/software/toolbox/index.html.

What I particularly find very useful and have used often is to validate user names and passwords with the AS400 authentication services. The following code validates a userName and password.

Read more »