Spartan Java

Trying out Google Appengine – OTP generation app

by on Jul.15, 2009, under Security, Web related

I decided to try out the new Java based version of Google Appengine. So i wrote a very simple web app that allows the user to generate one time passwords (OTP) using the HMAC-SHA1 algortihm (see OATH).

You can check it out at http://obovweb.appspot.com. As the name suggests its based on my obov library.
(continue reading…)

more...

Using SSH or SFTP resources from a Java app

by on May.22, 2009, under Security

There are many commercial SSH client libraries for Java, but it was hard to find a good open source one. Finally I stumbled upon SSHTools and I have to say it works wonderfully and the API is clean and simple.
(continue reading…)

more...

Reload resource bundles on the fly, finally!

by on May.13, 2009, under Tips

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!!
(continue reading…)

more...

Fast collection look-ups

by on Apr.30, 2009, under Performance, Tips

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).
(continue reading…)

more...

Automatically serialize POJOs to and from JSON

by on Apr.22, 2009, under JavaScript, Tips, Web related

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.

more...

PHP & Java interoperable encryption

by on Jan.16, 2009, under Articles, Security, Tips

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. (continue reading…)

more...

Paginated lists made really easy (part 2 of 2 – back-end)

by on Oct.27, 2008, under Articles, JavaScript, Web related

In our first installment we reviewed the front-end part of developing a paginated list using AJAX and Java. Now we will dive into the back-end of our pagination mechanism.
(continue reading…)

more...

Setup your web server to properly serve MS Office 2007 files

by on Oct.20, 2008, under Tips, Web related

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.
(continue reading…)

more...

Download a file using Java

by on Oct.10, 2008, under Tips, Web related

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.
(continue reading…)

more...

JarOutputStream problems on Windows

by on Sep.08, 2008, under Tips

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.
(continue reading…)

more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...