I got drunk and fell in love (a drinking game)

Submitted by davidc on Fri, 12/10/2010 - 05:02

In my game design workshop this week, the task was to come up with and iteratively redesign and prototype a game based on two fundamental concepts provided by another team: an action, and a feeling.

I gave out "flying" and "nausea", and that group had fun making a terribly sickening game where one player is an airplane, spins around rapidly five times, and tries to "land" at an airport - another player - by touching their hand. Dizziness and nausea does indeed rapidly ensue.

Another Quiet Night in England

Submitted by davidc on Wed, 09/08/2010 - 02:20

Oysterband are one of my favourite bands, and I've had the privilege of hearing them live many times. My second-favourite song of theirs is "Another Quiet Night in England", but nothing I find through a Google search gives me the correct lyrics - at least for the version I have. Strange, but here's the real lyrics of Oysterband's "Another Quiet Night in England":

Just another quiet night in England
And far away, the dogs are barking
Just another quiet night in England
Rubbish burns in an empty mall
And money rides while people crawl
And another quiet night goes by

Doctor Who Series 5 and Blockbusters sheet music

Submitted by davidc on Mon, 06/28/2010 - 12:53

I was trying to the transcribe the epic music from Doctor Who series 5, but it's been a very long time since I've had any musical training. So I figured I'll put it here in case someone else can do a better job. dr_series_5preview is the source MP3 I was working off - the ID3 tag claims the song is named "Every Star, Every Planet". There's also an attempt at "Quiz Wizard", the old Blockbusters theme music.

Reading the Windows Registry from Java without JNI

Submitted by davidc on Fri, 06/19/2009 - 02:51

Here is a class that allows you to read the Windows Registry without having to install any JNI library. It is implemented purely using introspection and will therefore compile and run on any platform. It would be possible to extend this to also write to the registry, but I didn't need this functionality. I hesistate to call this "pure Java" as it does make native calls, but it does avoid the need for external dependencies to do so.

Java Preferences using a file as the backing store

Submitted by davidc on Thu, 06/18/2009 - 20:19

java.util.prefs is great. Since it arrived, I've not had to worry about storing configuration in property files, or where those files should go. It abstracts away any platform differences and stores the preferences in a suitable place for the platform, e.g. in the registry under Windows.

I recently received a request to allow an application to have its configuration stored in a file instead of the registry. The user wanted it to run on any computer from a flash drive, with the configuration moving too. You can easily change the Preferences implementation using the java.util.prefs.PreferencesFactory system property, but the Sun JVM only ships with the platform-specific Preferences implementation, i.e. WindowsPreferences under Windows. I therefore needed to create my own Preferences implementation, which is detailed in this article.

IPv6 Source Address Selection on Linux

Submitted by davidc on Mon, 05/11/2009 - 12:36

Sometimes it is desirable to have the outgoing IPv6 address on an interface selected deterministically. All else being equal, Linux will default to using the latest address added to the interface as the source address. This is generally not what you would expect or want. This article describes how to influence the source address selection under Linux.

Singleton Java application

Submitted by davidc on Tue, 04/28/2009 - 05:12

Sometimes it is necessary to have a Java application that can only have one open instance, but still is able to handle command-line arguments (for example, requests to open a file). For native applications, this is easy to accomplish using native methods, but with Java the facilities are limited. This article describes a method to accomplish the goal using pure Java, with java.nio locking and local TCP sockets. It also explains how and why this is unnecessary under Mac OS X.