Wednesday 28 November 2012

Migrating SOAP client generation

After returning from a week long holiday, I have started into a new project at work.  Unlike the previous project, this one involves adding features and fixing bugs in existing code.

After setting up the development environment and an end-to-end analysis and explanation to a colleague of how the system seems to be making use of Spring MVC, we took a look through the POM files to get an impression of what components and versions are involved.

Based on experience from a previous job, I advised my co-worker that we might want to migrate away from using Axis 1 as it isn't actively developed (last release 2006).  After browsing between the official websites for Axis, Axis2 and CXF we returned back to the end to end POM checking.

A day or so later, my first development task for the project came through from the Berlin side of the development effort - replace the use of Axis with JAX-WS.

It's reassuring to be in a team that recognise the same candidates for improvement as I see.

On the technical side, here are some links to the resources that I found most useful:

Monday 19 November 2012

iPlayer not working - Adobe Air update to blame

Since a few of the search results that lead people to view this site appear to be related to my posts about BBC iPlayer troubles, here is another problem that I have encountered.

Before going on holiday outside of the UK, I tried downloading a few programmes on the iPlayer on my Mac laptop.  After a few seconds each download attempt would fail.

Fortunately this was a known issue, and the BBC site has a workaround:

Basically it involves uninstalling the currently installed version of Adobe AIR and installing an older version.

Sunday 18 November 2012

Is the cost of software development shifting?

I recently saw someone pull out an old statement that Maintenance is 80% of the cost of development.  I recall reading something similar in a software engineering textbook in 1996 - but a lot has changed in the way that we approach the development of software since then.

Here are a few key aspects of modern software development which should hopefully have shifted the balance:
  • Regular involvement of the product owner during development;
  • Frequent opportunities to observe and verify progress and change direction if necessary;
  • Regression tests built alongside the product to detect potentially unintended side-effects of later changes;
  • Routine review of code and configuration, either through pair programming or other electronically supported system.
Taking an unrealistic and strictly numerical approach to this, if the handful of things listed above double the cost of development but halve the cost of maintenance then the investment up front should be easy to justify.

(0.2 * 2) + (0.8 / 2) = 0.8
0.8 < 1

Of course all of this is completely open to speculation.  It could well be that the software products that are produced using the XP and agile approaches are more successful and result in a longer maintenance phase.

Wednesday 14 November 2012

Recursion - propagation of error state

Processing of an arbitrary depth data structure which has a parent or child relation hierarchy seems like a natural candidate for processing recursively.

Processing becomes more complicated when the operation could throw an exception, as we then have to consider how to handle the exception:
  • Should the exception be propagated?
    • Should the caller be expected to be able to reverse any previous state changes?
  • Should the exception be caught and ignored?
    • If so, should we continue to recursively apply the operation?
An alternative approach which may be useful in some situations could be to have a helper object which takes a copy of the outermost starting object and attempts to apply the recursive operation on the copy.  If the operation is successful then the completely transformed copy object can replace the original object.  If the operation was not successful then the original object would remain untouched and the information exposed by the failing operation could be made available to the caller.

I think this may count as a special case of the Unit of Work pattern, where the objects involved are actually part of one composite structure.

From String to enum in Java


In the last year or so I have been making more and more use of the enum support in Java to provide reverse lookup from Strings to obtain a value to use in a switch statement.


When iterating over the child nodes of an XML element with a known set of relevant node names and a corresponding process to perform on the differing child node content.

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum DwarfNode {
BASHFUL("bashful"), DOC("doc"), DOPEY("dopey"), GRUMPY("grumpy"), HAPPY(
"happy"), SLEEPY("sleepy"), SNEEZY("sneezy");

private String name;

private static final Map lookup
new HashMap();

static {
for (DwarfNode nodeName : EnumSet.allOf(DwarfNode.class)) {
lookup.put(, nodeName);

public static DwarfNode lookup(String name) {
return lookup.get(name);

DwarfNode(String name) { = name;

The lookup method takes us from a String to an enum for any recognised name, which can then be used in a switch statement.

When we upgrade to Java 7 - or higher - we will be able to use a String directly in a switch statement, so this approach may become less irrelevant.

Monday 24 September 2012

Dynamic role-based access control with Spring security

A basic principle of information security is to enforce access restriction at multiple layers.

If we consider a website that presents information from a database:
- The process that handles the request HTTP will not run as a user with admin rights
- The connection to the database will not involve a user with write access to the data

If the information is not intended to be freely available then access can be restricted to logged in users.  If there is more than one level of access restriction then the users can be assigned to roles and the information can be restricted with role-based access control (RBAC).

Role-based access control in a web-based application typically involves specifying URL patterns and roles which should have access to any URLs matching the patterns.  When a request arrives, if there are authentication credentials supplied which match with a specified role then the server will process it and produce a response.

Two common ways to define the pairing between URL patterns and roles are XML and annotations but sometimes making a code or configuration change on the server is too much hassle for the day to day administrators.

In the case of Spring Security, you can set up your own whitelisting by specifying your own AccessDecisionManager with a custom AccessDecisionVoter to allow a secondary check of permission.

Your own AccessDecisionMaker can lookup urls in a database, so there is no need to modify any code or configuration file within the deployed application.

Saturday 22 September 2012

Apple making up for destructive updates

About a year ago I updated the OS on my iPad without paying enough attention to the ramifications, as a result I a significant amount of music that I had loaded on without syncing to a PC was lost along with several apps that I had downloaded from the AppStore.

This week I was surprised and delighted to find that upon upgrading iTunes on my PC to the latest version, I am now able to see my previous purchases and re-download them from the cloud.

In a few minutes time I hope to re-discover the timewasting delights of two of the Angry Birds series that I have somehow managed to live without for the last 12 months, along with some games that I had purchased but not tried out.

Now I just need to figure out a way of transferring the dozens of albums of music that I have on a PC on the other side of the planet...

Monday 13 August 2012

Keeping the B in "No BDUF"

Avoiding Big Design Up Front to be flexible for changing requirements and making decisions when you have the most information available is a commonly held principle in eXtreme Programming.

Lately I'm finding myself guilty of ignoring the word "Big", and getting stung by having to go back and make adjustments.

No BDUF != 0 DUF

Sunday 10 June 2012

BBC iPlayer Desktop Troubleshooting

A few days ago I noticed that the BBC iPlayer application on my laptop would not display the programme listing for downloaded programmes.

I went online to see that several other people have reported the same issue.

Re-installing the application made no difference.

Then I remembered that the external drive which I use for storing media files had disconnected unexpectedly recently, I considered that some files may have been partially written.  Sure enough, when I moved the most recently modified files out of the iPlayer repository the programmes lists started working again.

Without accidentally disconnecting the drive or shutting anything down in an abrupt manner, my iPlayer installation suffered a repeat of the programmes list problem again.

I'm too busy to bother tracing the exact cause, but if it happens again I will try to isolate what specific download directory is causing this issue.

Thursday 24 May 2012

How the Internet is transforming the way we watch television

I find it interesting that two of my favourite Internet based technologies are having opposing effects on the way that I watch TV programmes.

BBC iPlayer and its contemporaries allow me to download or stream movies, comedy shows, etc. to watch whenever I want.

Twitter allows people to share their views on what is currently being broadcast basically in realtime.

Wednesday 9 May 2012

Analysing social networks and recommendations

In an earlier post I mentioned that I have been playing around with the Youtube API to see how to find out how videos might be connected.

I have been able to find music videos related to each other within 5 or 6 levels of suggested videos.  Strangely my own videos on my Youtube channel don't show as being related.

The first simple, obvious optimisation that I included in the Youtube network path search was to not look up suggestions for videos that had already been checked.  Out of interest I kept a record of these duplicate suggestions and noticed that the percentage seemed quite high.  Now I am a little curious about how common duplicates are in other types of networks.

Twitter is the obvious candidate for exploring social networks, as most things are public and there is a simple RESTful API to navigate.

I may need to set up some rules to recognise someone as a celebrity or promotional / marketing account if they have a very high number of followers, likewise I could treat someone as a spammer if they follow an exorbitant number of accounts.

If I'm feeling particularly motivated to apply what I've been learning about recently, I could even import the data into a MongoDB database, set up some indexes and run some queries.  (The prevalence of JSON formatting in these platforms makes this easier than you might think).

Monday 7 May 2012

Youtube - degrees of separation

Each YouTube video is associated with several other YouTube videos - shown as "Recommended".  We can regard the videos as nodes on a network and the associations between them as connections on that network.

I'm curious about how many hops along the network is reasonable to establish that two nodes aren't related.

The YouTube API offers a way to obtain a listing of the related videos.

If we start from each end and step out to each related video then we could either get to a ridiculously large number of checks, exhaust the available memory or reach the edge of the network before finding a path between the end nodes.

If each video is related to 20 other videos, then the first video will involve checking another 20 related videos.  It is reasonable to assume that some of the related videos on each hop will be related to some of the same videos as the visited videos, so the number of queries shouldn't be multiplying by 20 for each video that is visited.

I've assembled a basic experiment and found that there are 6 levels of recommendations separating Pseudo Echo's cover of Funky Town and I See Red by Split Enz.

Of the 37,797 videos checked 15,979 were duplicates.

The next level of complexity will be to build up a record of what the videos in between are.

Friday 20 April 2012

Goals for May 2012

Having set aside the next couple of weeks to myself, I think some goals should be set so that I will be able to look back with some sense of achievement.

Goal 1: Get up to date with Java 7
Motivation: Java 6 will be officially at the end of its life this November.

Goal 2: Dabble with Neo4J
Motivation: I'm curious about ways of storing data without a conventional relational database, and I have a few ideas about graphs that I would like to manipulate in code.

Goal 3: Produce a simple prototype of a web-based application using websockets.
Motivation: Preparation for approaching real world problems with a base level of knowledge about how they can be solved.

My "couple of weeks" plan has been expanded out to three weeks, as I won a pass to a 3 day conference Progressive NOSQL Tutorials which has so far given me some hands on experience with MongoDB.  Tomorrow will cover Neo4J.

Wednesday 7 March 2012

Benefits of starting off in a small company

"Specialisation and inter-dependence leads to a higher standard of living" - at least that's what I claimed to have learnt in high school economics.  The statement included three terms that I had picked up during the year and had the added benefit of being the longest and most convoluted statement for the memory game that the class was playing.

I was fortunate enough to gain a broad education of the core aspects of web application development and deployment in my first "proper" job after graduating from university.

After a few years I realised that setting up servers for deployment and maintaining their security and performance settings didn't show up on the balance sheet as making the company money, so I tried to switch to be more focused on designing, developing and testing applications.

When I moved to the opposite side of the world (from New Zealand to London) I was expecting to be working within much larger organisations with experts and people who know their servers like the back of their hand.  So far I haven't encountered that.

Last week I traveled over to mainland Europe to configure production servers for the project that I have been involved in for over a year.  The idea was that the OS would already be installed and I would simply set up the application server and possibly apply some enhancements.  The combination of the installed OS being 32 bit on 64 bit hardware and my old-school approach to Linux server configuration (without any X Windows) meant that I had to re-install the OS and start from scratch.

I've seen mention of DevOps but haven't really looked into it.  So far I consider myself to have enough knowledge of any application and the environment that it is being deployed into to not have to introduce any new process into the mix.  However, I do have an ambition to appear less on the critical path of project activities.

3D as piracy protection

Just a theory, but has the film industry pushed 3D partly because it reduces the appeal of films that are sneakily copied by dubious people using cameras in a cinema?