Category Archives: Uncategorized

Ubuntu — now also in liquid form

Just had my first one and it tastes great! Didn’t know that there was such a thing until I happened to see a bunch of them at Coop Konsum Avenyn in Gothenburg. I bought the last three they had! :)

BTW, It’s got nothing to do with my favorite linux distribution expect for the name and the fact that, just like the guys doing Ubuntu Linux, the people behind Ubuntu Cola is trying to make the world a better place.

Ant + Log4j

Hibernate’s SchemaExportTask ant task always gives very informative error messages (not! Smiling). Here’s an example:

BUILD FAILED
build.xml:267: Schema text failed: Could not parse mapping document from file SomeClass.hbm.xml

To get some useful info on what went wrong we need to specify a log4j configuration file:

niklas@niklas:~$ ANT_OPTS=-Dlog4j.configuration=file:///path/to/log4j.properties ant some-task

Don’t forget file://!

Here’s a simple log4j.properties file you could use:

log4j.rootLogger=DEBUG, consoleAppender
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

Spring and named constructor arguments

I’m a big fan of Spring and I’ve been using various parts of it now for the last two and a half years. Using the Spring dependency injection container has indeed made my life (as a programmer, of course Eye-wink) a lot easier. In this post I will demonstrate a technique which could be incorporated into Spring to add support for constructor injection using named parameters. The same technique could also be useful for scripting languages like Jython and Groovy to add support for calling Java methods using named parameters. Continue reading

Downloading YouTube movie clips to your local hard drive

I tried to watch this YouTube clip the other day but found that my flash player had a hard time synching the audio and video. Very annoying! And as far as I can see YouTube doesn’t provide a download link to let me download the movie and play it directly from my hard drive. I really wanted to see this clip but couldn’t stand the audio lagging behind. I figured there must be a way to hack that flash thing they are using to play the movie. It turned out to be quite easy! Continue reading

Rotating video clips shot in "portrait" mode

When using my Canon IXUS 40 digital camera to record short videos I sometimes accidently rotate the camera 90 degrees. Of course this isn’t a problem when taking photos since it’s very simple to rotate an image using Photoshop, GIMP, ImageMagick, etc.

The solution might seem less obvious when dealing with video files. Fortunately, there’s this great tool called mencoder (which is part of MPlayer) which let’s us fix things like this: Continue reading