I have been experiencing an annoying problem with serving large files through lenya, more specifically with DKP Log Parser’s download page. The problem manifests itself as an http error while downloading a file, resulting in an aborted download and a 0 length file being downloaded to the client. It appears rather random, some times the downloads work fine, some times they don’t. Restarting tomcat usually helps though, so I’m suspecting that the problem is caused by some buffer’s memory running low.

I have been unsuccessful in finding a solution despite searching for one. Today I however found a possible solution, it seems to work so far at least.

Bare Bones Browser Launcher

December 28th, 2006

The Bare Bones Browser Launcher is a nice little class for opening urls in the user’s default browser. It’s simple to use and often comes in handy in most GUIs (e.g. to include clickable links in the about box).

gzip and base64 in Java

December 27th, 2006

I recently had to gzip and base64 encode data before sending it via XML-RPC calls over the network, which took a bit of researching.

Java has built in support for gzip via java.util.zip.GZIPInputStream and java.util.zip.GZIPOutputStream. While there is no official Java base 64 encoder and decoder there are a couple of undocumented classes called sun.misc.BASE64Encoder and sun.misc.BASE64Decoder which seem to work fine.

Below are a couple of examples of turning the contents of a reader into gzipped base64 encoded data and turning a string containing base64 encoded gzipped data back into normal text (exceptions and comments omitted).

Read the rest of this entry

GWT becomes open source

December 13th, 2006

The Google Web Toolkit (GWT) is now open source under the Apache 2.0 license. This means that I might be starting to use GWT when I find it appropriate.

I personally hate using JavaScript because of the difficulty of debugging it (and making sure that it works for everyone) and because of not wanting to force people to run JavaScript in their browsers (I myself run NoScript). With GWT I can get around the first problem by writing in Java and hence use JavaScript when there’s no feasible alternative.