Archive for the ‘How to’s’ Category

How to stop XSLT from escaping XML in output

Tuesday, September 28th, 2010

I was asked by a colleague today how to prevent XSLT from escaping XML “special characters” in its output. i.e. < was being escaped to &lt ;. I didn't know but somebody else did...

<xsl:value-of select=”somethingWhichContainsXml” />

should be 

<xsl:value-of select=”somethingWhichContainsXml” disable-output-escaping=”yes” />

Tags: ,
Posted in Development, How to's | No Comments »

Display Version in Android Application

Thursday, August 26th, 2010

I was looking for a way to display the Version on the splash screen of my Android app, more specifically, the “versionName” as defined in the application’s AndroidManifest.xml

After A LOT of looking I discovered PackageInfo, which is a Java API to all of the info held in the manifest.

Armed with this information is was easy to produce the following:

private void displayVersionName() {
    String versionName = "";
    PackageInfo packageInfo;
    try {
        packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    	versionName = "v " + packageInfo.versionName;
    } catch (NameNotFoundException e) {
    TextView tv = (TextView) findViewById(;

Tags: ,
Posted in Development, How to's | No Comments »

Log4j Nested Diagnostic Contexts (NDC)

Wednesday, June 2nd, 2010

Introduction and Problem

Log4j is a brilliant set of libraries which provides good “out of the box” logging capabilities.

Sometimes however, in multi-threaded environments (for example web apps), it can be hard to decipher the interleaved messages from the various clients

Tags: , ,
Posted in Development, How to's | 2 Comments »

Use Quartz to schedule tasks in Spring

Friday, May 7th, 2010

Quartz is a full-featured, open source job scheduling service that can be integrated with, or used along side virtually any Java EE or Java SE application.

In this simple example (notionally checking Twitter for updates) we integrate it with Spring.

Tags: , ,
Posted in Development, How to's | No Comments »

How to Quickly Setup Subversion Server on Linux (Ubuntu)

Saturday, January 2nd, 2010


First of all you’ll need to see if you’ve got Subversion installed. Check this article on how to query installed packages or just try executing:

% svn help

If you haven’t got Subversion installed then:

% apt-get install subversion

Users and Groups

% addgroup subversion
% usermod -a -G subversion yourUser

Create Repository

% svnadmin create /path/to/repository

Configure Repository

% chgrp -R subversion /path/to/repository
% chmod -R g+rws /path/to/repository
% vi /path/to/repository/conf/svnserve.conf

Edit/uncomment the following lines:

anon-access = none
auth-access = write
password-db = passwd

% vi /path/to/repository/conf/passwd

Add the following line:

yourUser = yourSecretPassword

Start Subversion Server as Daemon

svnserve -d


You will need sudo or root access (unless you want to see a lot of permission denied errors!)
If you see this error (when using Windows SVN client):

Can’t move
‘..\..\.svn\entries’ to ‘..\..\.svn\entries’:
The file or directory is corrupted and unreadable.

Then try excluding the local directory from the Windows Indexer.

Tags: ,
Posted in Development, How to's | No Comments »