Update to S3DropBox

Another update to my S3DropBox. Due to popular demand (ahem) I've added a progress bar to track uploads and downloads. You now have something pretty to watch rather than a screenful of dots. Any other requests?...

Apache Ivy and Spring EBR

Here is how I set up the Apache Ivy dependency manager so that it can fetch springframework JARs from the SpringSource Enterprise Bundle Repository. Listing: ivysettings-custom.xml <ivysettings> <resolvers> <url name="com.springsource.repository.bundles.release"> <ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" /> <artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" /> </url> <url name="com.springsource.repository.bundles.external"> <ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" /> <artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" /> </url> <chain name="spring"> <resolver ref="com.springsource.repository.bundles.release"/> <resolver ref="com.springsource.repository.bundles.external"/> </chain> <ibiblio name="jboss" root="http://repository.jboss.org/maven2/" m2compatible="true"/> <chain name="main" dual="true"> <resolver ref="shared" /> <resolver ref="public" /> <resolver ref="spring" /> <resolver ref="jboss" /> </chain> <chain name="default" returnFirst="true"> <resolver ref="local" /> <resolver ref="main" /> </chain> </resolvers> </ivysettings> Listing: ivysettings....

Jsoup - BeautifulSoup for Java

HTML is notoriously difficult to parse and it has usually been a pain to do this in Java. Yes I know that there are parsers (like jtidy and nekohtml) that try to create a proper DOM but I’ve been waiting for something more lightweight. Enter Jsoup. It feels like a mix of JQuery and Beautiful Soup (for Python). String html = response.getContentAsString(); Document document = Jsoup.parse(html); Elements elements = document.select("#errorRef"); assertThat(elements....

StringTemplate views for Spring

StringTemplate is a great templating engine. It's powerful, simple and quite opinionated. I've come really appreciate its simple purpose: render data. No assignment, no arbitrary method invocation. It is not Turing-complete and it would make a lousy rules engine. SiteMesh is a web-page layout and decoration framework that is my current "golden hammer" when I need to provide a consistent layout across a java web-application. It seems to fit with the way that I think about web pages a whole lot more than something like Tiles - I really prefer decoration over composition as a means of layout control....

Manipulating collections with lambdaj

My day-to-day work often consists of writing web applications that aggregate data from a number of sources. Corporate constraints frequently dictate that I cannot use languages that make crunching of collections easier so I am forced into an old-fashioned for-loop frenzy. Ugh. On a recent java project my pairing buddy (Jules - thank you) suggested that we look at lambdaj. From the lamdbaj site: “lambdaj is a library that makes easier to address this issue by allowing to manipulate collections in a pseudo-functional and statically typed way”....

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

Testing anti-patterns for developers

I've been saving this rant for a while now: 1. Test everything at the front-end, in exquisite detail - every project sponsor understands what tooltip 0 really means. Also a great idea if you like long-running and fragile tests that require deployments, browsers, testing frameworks and the kitchen sink. Testing at different layers, and perhaps even without a browser or (in java) a servlet container is for the weak. 2. Perform a database cleanup before and after every test, whether it needs to be done or not....

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

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