Update to S3DropBox

I've released a new version of my S3DropBox. You can now right-click on any file to download it, delete it or create a public link to it. Comments, feedback and bugs are always welcome....

Post-Redirect-Get in Rails

For a while now I've been flying the flag for using a post-redirect-get design pattern when writing web applications. In my opinion the current crop of web frameworks still make it very easy to do the "bad" thing since to do PRG properly you need to think what kind of an interaction you want with users and not cop out saying its technically very difficult in . If you resort to ActiveX controls, popups without navigation bars and/or weird javascript hacks to stop users from clicking refresh or back buttons then perhaps you should have written a better web application....

PicoContainer and Jersey

The Jersey JAX-RS project provides bindings for springframework and google-guice. However I wanted to see what it would take to use PicoContainer as an IoC container within Jersey. Verdict: not much at all. Nicely extensible. To see what I mean please take a look at my jersey-pico project on GitHub. I can now create JAX-RS services in Java or Groovy with a very simple IoC container....

Java and iPhone AES interoperability

I’ve been trying to get my head around cryptography on the iPhone so that I can create a native iPhone app (iPasskeep) that interoperates with my JPasskeep password keeper application. It has taken a while to get my head around CommonCrypto APIs - how to use them, how not to use them and their limitations. It then took a bit of fiddling to find the right incantations in Java to get an interoperable cryptographic transformation....

Django RESTful resources

Last year I blogged about a neat trick in Django to have multiple views per HTTP verb. Since then I’ve been playing with RESTful applications and decided to see if there was a nicer way to expose “resources” in Django. The following is what I’ve come up with so far. Listing: router.py from django.http import Http404, HttpResponseNotAllowed def get_handler_method(request_handler, http_method): try: handler_method = getattr(request_handler, http_method.lower()) if callable(handler_method): return handler_method except AttributeError: pass class Resource: http_methods = ['GET', 'POST', 'HEAD', 'PUT', 'DELETE', 'OPTIONS', 'TRACE'] @classmethod def dispatch(cls, request, *args, **kwargs): request_handler = cls() if request....

JPasskeep and Command-Q on Mac

I've released a new version of my long-running password keeper application: JPasskeep. This new release is now able to handle a Command-Q keystroke on the Mac, giving a user (i.e. me) an chance to save any updated entries. No more mousing around to close a window. The actual mechanism to do this was to reflectively call Apple's EAWT application classes to allow me to register the correct event listener. Hmm, run anywhere with java GUI apps....

From Java to Groovy

Recently I’ve been playing with some old Java Swing applications and I found myself wishing that I could replace all the anonymous inner-classes with some clean Groovy closures. The job of converting a java source file to a groovy source file is pretty simple and eminently scriptable. Here’s my take on a python script to do just that: from optparse import OptionParser from subprocess import Popen, PIPE import os def rename(src, dest, use_svn): if use_svn: output = Popen(['svn', 'rename', src, dest], stdout=PIPE)....

Another example J2EE application

I've uploaded to GitHub (http://github.com/tomcz/pico-webapp/tree/master) the web application that I use to teach people about dependency injection (using PicoContainer), post-redirect-get browser interaction, RESTful URIs and strict template rendering (using StringTemplate). This application does not use Spring Framework by deliberate design - as soon as I introduce it to any teaching session I spend more time talking about Spring then talking about what I am usually there to accomplish. As usual, any comments, bugs or enhancement requests are very welcome....

Example J2EE application

I hate maven with an almost homicidal passion. It only works if your brain works like maven, for the rest of us in the real world its just a pain in the arse. But it does have one good idea - it provides a simple, out of the box way of creating a project structure (but so do rails, django and grails in a much better way). I've decided to publish my own example web application project/structure on GitHub - http://github....

JPasskeep is now on GitHub

I need to stop distributing JPasskeep source code as zip files - yuck. So for anyone who may be interested at what lurks under the cover of the pretty GUI the code is now available on GitHub - http://github.com/tomcz/jpasskeep/tree/master. Comments, suggestions, bugs, patches, forks, or pitch-forks are always welcome; even if sometimes ignored ;-)...