Sorting Lists in Java with Comparators

August 31, 2014

I always forget how to write a comparator in Java, so here's an explanation for me to refer to.

You can sort a collection in Java using Collections.sort(), passing in the collection and a Comparator:

List<Person> lPeopleList = new ArrayList<Person>();
lPeopleList.add(new Person("Stephen", 20)); 
lPeopleList ...

Showing .java files in the Browser

July 29, 2014

I have a webserver that serves generated source code - some Java, some Python and some ActionScript. There are also XML schema. This is being served via nginx and each file is downloaded when clicked on.

I wanted to change this so that the file was shown in the browser by ...

Listing Classes in a Java Package

July 18, 2014

I needed to list the Classes that existed in a Java Package. It isn't possible to do this with the default JVM, but there is a third party library called Reflections that can do the job.

Once the library and its dependencies are on the classpath, the following code ...

Building Plugins for Bamboo

June 24, 2014

I want to make a change to the way the Tomcat deployment plugin works for Bamboo, so that I can deploy with a wildcard in the WAR file name. This will let me use Tomcat 7 features to deploy multiple copies of the same WAR file and have users automatically ...

Troubleshooting Git via Stash

June 18, 2014

I have a Git repository set up on Stash from Atlassian. I've just done my first push to it and encountered the following issues:

Problem 1 - error: RPC failed; result=55, HTTP code = 0

Whilst pushing, I got the following error:

C:\dev\code>git push origin master
Password ...