How To: Convert Day Number to Month and Day

I needed to convert the day number, that is, what day it is between 1 and 365, into a month and day without using Calendar / DateTime classes and such today, so I knocked up a few simple functions that work assuming it’s not a leap year (i.e. that February has 28 days).

Here they are if they’re of any use to you:

A touch cheap, but it gets the job done.

The Caliko Inverse Kinematics Library

After around 18 months of work, I’ve finally submitted my first research paper today to the Journal of Open Research Software in the form of a software meta-paper. While the paper outlines what the library is and does, the real crux of the submission is the creation of the Caliko library itself as a ‘software artifact’.

I can’t do anything with the paper until it’s either accepted or rejected (hopefully the former!) – but if you’d like to see what the library is and does – then this video should explain things quite nicely:

And if you’d like to give the whole thing a spin, then it’s merely a click away at:

One down, five to go.


Oracle Java Certfication

I passed my 1Z0-803 Java SE 7 Programmer I exam the other day – and it was without doubt the hardest exam I’ve ever taken by a country mile.

The entire thing’s made of trick-questions, corner-cases and large ‘human-compiler’ questions which have you substituting multiple pieces of borderline-legal nonsensical code into large swathes of horribly structured and badly laid out code to mentally determine which ones result in a given set of output. Horrific.

Also, on top of having to race your way through 70 questions in two hours, there are an undisclosed number of “non-assessed questions” which don’t count towards your score – the only possible reason for these I can think of is to burn the clock and artificially inflate the fail rate, thus scoring Oracle ~$300 a pop on resits for people who need an Oracle cert for their work. What a complete and utter rort.


Nailed it – but the only way I’d ever do another Oracle certification would be if there was something big like a specific job riding on it. And even then I’d think twice about whether it’d be worth the grief.

Final rating: 0 out of 5 Rubber Chickens. Avoid like leprosy.

How to: Get Minecraft working in Linux

Minecraft Wallpaper

Attempt a quickfix?

If you’re trying to run Minecraft in Linux and it’s failing with errors like:


Then the chances are you can fix it up by performing the following actions:

  • Set your LD_LIBRARY_PATH variable with:
  • (if needs be) Get rid of OpenJDK and install the official Sun/Oracle Java binaries if required.

Know how do all that? Awesome – carry on! Not so sure? Read on! ;-D

Setting the correct JRE location

First up, check if you have Java installed by typing java -version, if it comes up with something like the below, then you’re got Java installed, now we just need to find out where:

If you didn’t get anything similar to the above you might want to install the official Oracle Java implementation, which I put together a brief step-by-step for here.

Assuming you have some variety of the Java Virtual Machine (JVM) install, check if your LD_LIBRARY_PATH environment variable is set with:

If it comes up empty, then we need to find out where Java’s installed and set it correctly. To get the correct path for where your particular Java install is located, you might be tempted to try running which java:

However, this is a little bit of a fib, as Java is part of the alternatives setup where we can have multiple versions installed at once – which means that /usr/bin/java is really a symbolic link to the true java location. To find where it’s really pointing we can either ask update-alternatives how it’s configured like so (and pick a version different version if we want to):

Or we can look closely at the /usr/bin/java symlink:

Which if we then look closely at /etc/alternatives/java then points at:

Same thing as what the alternatives config’s pointing at ;-)

Now that we have the correct path, we can set it in the following manner (remember to substitute your particular Java location into the below lines!):

For 64-bit Linux:

For 32-bit Linux:

With that done, you should be able to see that it’s set by running:

Which should give you something like:

Finally, we should be fit to launch Minecraft like this (assuming the minecraft.jar file is in your home folder):

Or, without setting the memory and classpath variables, like this:

Be aware that the LD_LIBRARY path will only be set for the current session of the current shell, so you’ll have to re-set it a lot. A quick and easy way to do this is to just knock together a quick launcher script as below (substituting your paths in) and throw it in /usr/local/bin:

Final Notes

Not being able to set a persistent LD_LIBRARY_PATH is a pain, because it won’t take if set in the ~/.profile or ~/.bash_profile or ~/.bash_rc config files (I’m not so sure about ~/.pam_environment) – which you can read about here:

There’s a fix which involves disabling ssh-agent in this bug report (see post #21 here), but really for the sake of a two line launcher script I think it’s best to just leave it be.

Happy mining and crafting! =D

How To: Install the official Oracle JRE/JDK in Linux

Installing the official Sun/Oracle Java implementations used to be as easy as installing sun-java6-* and uninstalling all the OpenJDK and IcedTea (Java plugins based on OpenJDK) packages you could find – but you can’t get the offical “Sun” packages anymore, instead you have to go get the binaries from Oracle (who bought Sun Microsystems). You can take a swiz at the possible Java implementations here if you like.

Anyways, to get and install the official JRE or JDK (I’ll assume that most people aren’t going to be developing in Java so only want the Runtime Environment and not the full Development Kit):

  1. Head on over to: and download tar.gz version of the latest JRE, which at the time of writing is 1.7 update 7 (i.e. 1.7.0_07, the Linux 64-bit version of which is called jre-7u7-linux-x64.tar.gz),
  2. Extract the downloaded archive through any way you see fit. I’ll assume you downloaded it to your Downloads folder and extracted it there for the following commands,
  3. Create a new folder for it wherever your distro likes to put Java installs, for example:
  4. Move your extracted JRE to that location using:
  5. Update your alternatives to prefer the new version of java by running (one line at a time):

    If you’re installing the JDK you’ll prolly want to set the javac (Java Compiler) binary to the new version too using:

    The number at the end of the line is the priority of this binary out of any other java/javac/javaws binaries alternatives knows about, and goes from 1 (most important – try to use first) to 100 (least important – use only as a last resort)

  6. To make sure that the update-alternatives commands take, you can also run (again, one line at a time):

  7. Finally, to check it all really took, issue:

    and you should see some output showing that the newest version of Java is in effect, like this:

Done & dusted.