Stubblog


Implementing Hudson & Maven
May 25, 2010, 1:58 pm
Filed under: Uncategorized

At work we have a small, but perfectly formed set of Java applications that help run our business, and we have a well practised methodology for developing, testing and deploying all our modules.

The perfectly formed claim above is a lie. The various modules are a rats nest of inter-dependencies and there’s an incestuous level of circular dependency between some of these modules. And while our methodology for testing and deployment might be well practiced, it’s certainly not straight forward and could easily be streamlined and improved with better tools.

On our old build box, which released it’s magic smoke some months ago, a build cycle would take over half an hour because it had to start with the application with the most dependants and work it’s way down the stack from there. That’s hardly good for instant feedback when your check in breaks the build.

In order to be able to implement Continuous Integration for our Java stack, there were several problems we needed to solve:

  • Monolithic build
  • Dependency Nightmare
  • Deployments
  • Visibility of build statistics.

There are others, but these were the main ones for me. The old build platform was based on ant and Cruise Control, using ant wasn’t bad, but for new developers there was quite a bit of work involved in getting a module built. This wasn’t all down to ant, but it didn’t make it easy to manage a projects dependencies.

Some of the 3rd party dependencies we have are ancient, and it’s hard to find the right jar file for most of them. There are reasons for this, but I’m not going to go into them here.

This is where Maven comes in, it’s ability to manage any dependencies a module might have was the biggest draw, tell it which library you want, and what version and let it worry about where it comes from. So I picked the module that had no dependencies on any of our other applications and started to convert that.

The biggest lesson I learned from that is do not try and munge the Maven pom to fit your file structure, change your file structure to match what Maven expects, once you’ve done a couple, it really doesn’t take that long. As well as making the conversion smoother, in the long run you get the benefit of every project looking the same, so new developers know where the source is, they know where the tests are and they know where the extra resources like jboss config files are. It’s a good example of convention over configuration.

The next problem you’ll come across is working out which of the many Maven repositories you’ll need to use, many of the libraries are duplicated across more than one repo, and in some instances the same class is available in multiple artifacts. I didn’t find a quick solution to this, it was instinct & trial and error. Some of them are obvious though.

Once we had the first module converted over, we started to look at the next one. We quickly noticed that many of our apps share dependencies, so I created a parent pom file that they can all share to get the same dependencies. This also made it easy to plug in the code quality checks later as well.

So I’m nearly at the end of this post, and I haven’t mentioned Hudson yet. Why did I choose Hudson over the incumbent Cruise Control? Well the build scripts that built the apps on the build box were different to the ones that developers used to build the same app on their dev box, and I wanted to unify that, also when I looked at the 2, Hudson was up and building something from scratch in about 30 minutes, and cruise control wasn’t even anywhere close. Initially I had some problems with stability, the Hudson process would become unresponsive over night, moving from the default Winstone app server to Tomcat seems to have sorted this out though. Watch out for file permissions in the Hudson directory though if you do the same, it made a plugin I use vanish, which made all my builds that depend on it disappear for a time too!

Using maven also solves the monolithic build problem because each module just becomes a dependency the same way log4j or junit are. It doesn’t help the circular dependencies either, you have to fix them yourself. Using a repository manager like Nexus is a really good idea too.

Creating a project in Hudson is easy, point it at your code repository and away you go. Simplicity is crucial if you want to get everyone in the department on board and it doesn’t get much simpler than that.

I’d like to say a massive thanks to the members of the Sheffield Java User Group who helped me get over some of the initial problems I had using Maven.

Next I’m going to cover the various Hudson & Maven plugins that we use.



Git branch in your bash prompt
January 18, 2010, 1:31 pm
Filed under: Uncategorized

While trying to work out how the excellent tab completion works for git, I found /etc/bash_completion.d/git which mentions the __git_ps1 command, you can use this to put the current branch in your bash prompt

here’s mine:

PS1='${debian_chroot:+($debian_chroot)}\[\ 033\[01;34m\]
\u@\h\[\ 033\[00m\]:\[\ 033\[01;33m\]\w\[\ 033\[1;32m\]
$(__git_ps1 " (%s)")\[\ 033\[00m\]$ '

(Remove the space from \ 033, WordPress wouldn’t escape it properly)

The magic bit being

$(__git_ps1 " (%s)")

There are a couple of options you can set too to get it to show you the status of the repo too, see the file above for more info.



How to tell when your site is dead?
January 29, 2009, 1:00 am
Filed under: Uncategorized

I’m coming to the conclusion that (at least) one of my side projects is dead, http://www.whos-playing.com is a site I wrote to help people manage 5 a side football teams, it lets you pick teams and rate your team mates to help keep the teams fair.

The idea was to have the site free while people beta tested it, then charge people to use it once I was happy that it worked Ok, but no-one wants to use it when it’s free, so I doubt people would want to pay for it.

It’s been live for about 6 months and has gained less than 100 users users, none of them active. I’ve received 2 emails regarding problems on the site, both of which were fixed in quick order, after that, neither user carried on using the site.

I tried engaging the team organisers whenever I fixed major bugs, or improved the interface in such a way that might make it usable for them, but I rarely got even a log in from them.

I’ve tried gaining users by joining various 5-a-side groups on Facebook, but it’s hard not to look spammy when you’re the most active user on there. Some people signed up, but never got any further.

One of the users works for one of the major 5-a-side football pitch providers in the UK, but his experience of the site didn’t get any further than trying to invite a few players to join his team. I’ve even emailed the FA, but heard nothing back.

So now it’s beginning to look like the site is a dud, no active users even when the site is free, even when some of the users who signed up are your friends, it doesn’t appeal to people who hang out on groups aimed at the subject it covers.

So it looks like whos-playing.com is in injury time, all the substitutes have been played, the referee has checked his watch and unless something happens soon I might have to blow the final whistle.



South Yorkshire Transport website to get an overhaul
January 20, 2009, 11:21 am
Filed under: Uncategorized

I’ve had a bit to say about the state of travel information online, and regular readers will know what I think the solution is. So when I heard that a company in the North West had been awarded a contract to overhaul SYPTE’s online information website I was quite excited, maybe now we’d get a decent service that worked on a wider range of devices, with better maps and, dare I say it, an API we can use.

That excitement started to fade as soon as I clicked on a link to Rippleffect’s website, it’s flash. If, like me, you work in an environment where you have no rights to install software on your windows machine you’re immediatly stuck. Flash has it’s place, but it’s not front and center, it’s not the first thing your customers should see (or not, in my case)

Because I have other reasons to be here, I made the effort to find the link to the non-flash version and looked to see if there was any more info on the project. There wasn’t any specific info on the SYPTE project, but they have done work for Merseyrail. I’ve had a look at the hourney planner and I immediatly saw the URL http://www.merseyrail.org/noflash.php?mode=not_installed, but it seems to work Ok on a non-flash enabled browser (Chrome in my case, see above). However when I look at the site with a Flash enabled browser … I can’t see what it uses Flash for, certainly not the journey planner, so the user experience is needlessly downgraded before I even start.

I had high hopes when I saw that a smaller, local agency rather than a large behemoth had won the work, but now I’m not so hopeful that what we’ll end up with will be any better than what’s there at the moment, but prove me wrong Rippleffect, please prove me wrong!!



Making things better.
January 4, 2009, 1:05 pm
Filed under: Uncategorized | Tags: , ,

The Next Bus is the name of my latest little web app, and this is a little post to explain why I wrote it.

Ever since I started my new job, I’ve had to start learning a whole new bunch of bus times. My last job was easy, I just used to wander across the road to the interchange and wait for the 29, the timetable told me when the next one was available.

Now however I have to catch the bus from West Bar, and the timetable just says “up to every X minutes”, but no indication of when that actually is.

There is however a service provided by Travel South Yorkshire, but good luck trying to view that on your mobile phone or PDA, even if your device can render the seemingly infinite recursion of frames, the table that presents the timetable is missing some vital tags, the one that starts a new row for example, the HTML just gives the tags to end a row. More by good luck than good judgement, most desktop browsers manage to render this.

So last night I decided to do something about it. I’ve written a web app that takes the bad markup and cleans it up, rendering your stop information as valid XHTML 1.0 Strict.

Go to http://thenextbus.appspot.com with your mobile device and enter your stop number, if you’re not stood next to the bus stop right now, you can find the stop number by searching http://tsy.acislive.com/. Once you have your stop on screen, simply save it as a bookmark to use next time.



Is there really more to the UK IT sector than London & Brighton?
December 18, 2008, 7:57 pm
Filed under: Uncategorized | Tags: , , ,

Over 12 months ago I wrote a bit of a rant about how I thought the tech sector in the north was being overlooked.

So 18 months later are things still the same, or has there been any progress, or is the UK tech scene still firmly rooted in the south?

You can see from the comments on the original post that Ryan Carson’s FOWA bus did come to Manchester, which was a good start.

The list of conferences and unconferences in the north grows too, there have been Barcamps in Sheffield, Manchester, Liverpool, Leeds & Barcamp NorthEast was held in Newcastle. Geekup has expanded from Manchester & Leeds and now has meetings in Chester, Liverpool, Preston and Sheffield.

A new conference aimed at the stuff that can easily be missed when creating an app or website, ThinkVisibility, was announced last week, looking at revenue streams, SEO, accessibility and usability, and that’s happening in Leeds.

NWS2.0 goes from strength to strength, companies like edocr & Yuuguu continue to shine and the myriad of freelancers, design agencies and small web shops are based up north.

3 of the largest online stores (Ebuyer, Dabs & Scan) are based in the north, we have 2 large ISP’s (Plusnet, who I work for, and Zen ).

Sheffield, Leeds & Manchester all have large universities with well respected computer science degrees.

We have communities based around PHP (phpnw), Ruby and Python amongst others, and they all hold regular meet ups around the north.

So yeah, I think it’s fair to say that 18 months later there is more to the UK IT sector than London & Brighton, even more than when i made that post …

Have I missed something? Add a comment and tell me which of your favorite Northern companies & conferences I missed



Who’s Playing?
July 14, 2008, 12:06 am
Filed under: Uncategorized

www.whos-playing.com is my latest web app, and here is the announcement I made over the weekend about it’s soft launch.

Who’s Playing is a new service for people who organise after work, social 5-a-side football games. It aims to take the slog out of emailing a whole bunch of people, collating the responses and finally,
picking two sides that are equal, perhaps the hardest part of making the game enjoyable for everyone.

Organisers invite their players to join the site and as part of the short sign up process, players must give themselves a rating, which is used to pick balanced sides. After each game the other players get to
vote on how well they think the other players performed, and this is used to keep the rating accurate and up to date.

To organize a game, the team owner simply chooses a date, time and location and his players are sent an email with all the details and a link to click if they want to play.

Once the game has enough people signed up to play, an organiser can
let Who’s Playing select 2 evenly balanced sides. Once he’s happy with the sides he can mail them to everyone who’s playing.

Who’s Playing is currently undergoing open beta testing, and match organisers are encouraged to sign up for an account so their feedback can incorporated into the site before development is completed.

While use of Who’s Playing is free at the moment, once completed the cost will be just £10 a month (or just 25p a week extra per player if you have 5 players per side, less if you play larger games), new sign
ups that help test the site will be given 3 months free when the site is officially launched.

Read more on the Who’s Playing blog