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....

Command-Tab and friends on Mac

Most people who work with a Mac know Command-Tab to cycle through currently running applications, but few know of Command-~ (tilde): it allows you to cycle through all the windows of the current application. No more mucking around with F10....

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)....

Logging Guidelines

Logging - this is something we as developers do very badly - perhaps we need to ban the debugger. Unless you've worked in first-line support or in OPS, the only time you ever look at a log file is as a last resort. This is unfortunate, since the last resort may occur when you are trying to figure out why someone has lost money or when your company is about to be sued by a client (usually for losing their money, video, kids photo, etc)....

HTTP method primer for RESTful web services

The following is just a reminder to stop me from getting confused ;-) GET Used to fetch a resource. The server sends back a representation of the resource in the response body. Safe operation (see below). DELETE Used to delete a resource. The response from a server may contain a status message or nothing at all. It is usually nice to send back at least a 204 (No Content). Idempotent operation (see below)....

Reading code Vs searching code

Modern IDEs now allow you to search for a class or a file and go to it from the search results. On my last few projects I've seen developers using this feature almost exclusively rather than navigating their code tree. This is a very nice feature that I really enjoy using but does it have a dark side? I'm an old school hacker and I like to know how my_code is structured - its packages, dependencies, web root folders, output folders for the IDE and for automated build scripts, etc....

Concept To Cash Every Week

Turning on a sixpence - No excuses: Concept To Cash Every Week. Just saw this on InfoQ and it blew my mind. This is what I'm talking about when I mean that details matter and that there has to be a better way to deliver value to a customer. Have got to try the Pomodoro technique on my current project to see if it can improve pairing between developers (er, mostly between me and whomever is unlucky to be pairing with me)....