Posts
Sha-bang for Scala Scripts on OSX
To write executable Scala scripts on OSX (and possibly relevant for other unixes) you have to add the script “sha-bang”/“she-bang”/“sh-bang” (#!) header in the script file above the script code.
My current take on the best sha bang for OSX
#!/bin/sh exec scala -savecompiled -Dfile.encoding=UTF-8 "$0" $@ !# println("Hello wörld") Explanation:
-savecompiled Compile once and save the compiled file in a jar so that subsequent runs will not have to wait for the compilation.
Posts
Minimizing Wicket HTML/CSS Turnaround
Many Apache Wicket projects I have seen are setup with a build tool (maven,ant) that builds the entire projects and then performs an exploded deployment into a web container (tomcat, jboss, jetty). When a change in the web app is done it then needs to be redeployed into the container, which in turn triggers a cycle of shutdown and restart of the web app inside the container.
This is how it needs to be for code changes (even if there are workarounds like JRebel from ZeroTurnaround) but when you are only changing to the HTML or CSS this is a real pain.
Posts
Unit Testing a Neo4j Model
I have jumped the nosql-train and have been using neo4j in a couple of projects recently. I like the idea that the data model is a graph. It feels like less of an impedance mismatch than between classes and relational tables (JPA/ORM).
Creating a model for an application with POJOs and neo4j is pretty straightforward to do in a good way (just check out the neo4j Design Guide on their wiki).
Posts
Stack Trace Comparison and Clustering
Recently I have been working on a small library that parses java stack traces, compares them and makes it possible to cluster errors that are similar. When the same errors appears across different versions of software (the actual application and the libraries used) it is very useful to be able to identify that. The implementation is based on a masters thesis by John Lambert from 2002 (pdf).
I’ve decided to open source the library (Apache License v 2.
Posts
Migrate IMAP Mailboxes From One Server to Another
Had to sync imap mailboxes from the old (gentoo) server to the new (osx server) one, found multiple tools but couldn’t get any of them to work except for larch which works as an IMAP client instead of messing with the maildirs in some way.
On my OSX laptop I needed to install some dependent modules for ruby to run it:
$ gem install trollop --include-dependencies and then
$ gem install larch And finally, to do the actual migration - connect to the old server and the new server and copy all messages:
Posts
Overridable Method Calls From the Constructor
PMD and NetBeans both give warnings about calling non-final non-private methods from the constructor of a class.
I never really understood why it was such a bad thing until today. I was hit by the problem it causes when subclassing one of the swing model classes.
public class CustomButtonModel extends DefaultButtonModel { private final SomeClass object; public CustomButtonModel(SomeClass object) { if (object == null) throw new IllegalArgumentException("null object is a nono"); this.
Posts
Stuttering Digital Out on MacBook Pro
This saturday I decided to connect my 2010 MacBook Pro to the 5.1 reciever to watch mkv videos. After doing some reading i figured out that I needed a mini displayport to HDMI adapter for the video and a TosLink + a 3,5mm adapter for the optical output hidden in the headphone port on the laptop.
Checking out some stores in Stockholm it all would land on somewhere around 600 SEK (~60€).