Monthly Archives: April 2009

Not hacker-proof: Getting a Social Security Number in Ireland

Right now I’m sitting in the local Welfare office to get a PPS number (thats how the Social Security Number is called here), otherwise I would not be able to legally earn any money here. Not that I would have problems earning money illegaly, its just that the local law-enforcement community gets a bit bitchy after a while in that case.

As Ireland, like all english speaking countries lacks organization and oversight when it comes to registering and controlling people, there exists no central citizen registration. Yeah, if they would accept a few lessons from Germany or France leaders like Bush (now Obama) or Blair could learn a valuable lesson on how to create a police state efficently. A social security number makes you a “real” citizen here – its needed to get a Job and maybe for all kind of other identifying purposes as well.

To get one of these numbers, all you need is a proof of address and a proof of identity.

Getting the proof of address is easy – just give them a utility bill. As there are no checks on your identity, any name will work, as long as your landlord believes your claim, that your mother named you “Donald Duck” . Given some basic people-skills, that should be easy to do.

The proof of identity is a bit more difficult. If you claim to be neither British nor Irish citizen, the Welfare-office requires a passport. Getting hold of one named “Donald Duck” is probably a bit too difficult to be carried out by novice con-artists. But getting a fake Windsor or scottish accent is not hard, and then you can take the easy route: British or Irish citizens need a birth certificate and a photographic ID (any ID!).

Birth-certificates are easy to “produce”. Either copy one – heck, they are plain paper and not meant to be tamper proof – or reapply for one choosing a suitable photographic ID. Be aware that this particular step may upset the law-enforcement community again, so be sure to do it right or to not do it. (Of course, as a good citizen I do not encourage any illegal activities of any kind. And if you have to do such things, then for heavens sake make sure that you at least prepare well.)

So how to get the photographic ID? Make one yourself. There are plenty of companies that offer services to produce company staff IDs or IDs for staff members for local events. They dont even check much on the background – so as long as you dont want to produce IDs from well-known locale companies you shall be fine. Just make sure, the ID you produce has a “official” looking name and appearance. If everything fails, register at the local library, in case they have a photo-ID for their members.

So once you have the ID, the birth certificate and the fake scottish accent, you are fine to apply for a PPS number. Welcome, newborn irish citizen “Donald Duck”.

Opening documents with their default application

When developing Java, 99% of all tasks can be solved in a platform independent manor right out of the box. But then there is that last tiny bit of tasks, that is inherently platform specific, as it has to deal with the weirdness of the host-OS.

For the Pentaho Report-Designer, we support the three major desktop platforms – Linux, Windows and Mac OS. When ever we generate a document (be it when we preview the report or when we do a actual report-run), we have to show the user the newly generated document. The cheesy way of doing this is to assume a reasonable set of default applications. For PDF, we would for instance default to launching the “Acrobat Reader”. “Hey, I dont use closed-source applications from monopolistic vendors on my machine!” you may scream out in terror. And yes, assuming a set of “standard” applications when there is no standard is not a good thing.

Luckily, there is hope. Each operating system has a magic way of launching the “right” application for a given document. Of course, its not documented at all. So calling on numerous years of messing around with operating systems, here’s my cook-book for opening documents.

1. Linux (and also Solaris)

On most modern distributions, the mapping between mime-types and corresponding applications happens based on the rules expressed in a file called /etc/mailcap(5). The command-line utility run-mailcap(8) reads the mailcap file and automatically launches the right application for the given file. So running the default application is easy:

run-mailcap 

or in Java:

Runtime.getRuntime().exec(new String[]{"run-mailcap", pathToYourFileAsString });

2. Windows

On Windows, file associations are stored in the registry. The registry is a binary file, so parsing that one is no fun. Of course, its also available via native C functions, but shipping platform dependent libraries is so 1995! Luckily, Microsoft drives a course of “never delete a documented function” and thus, the old tricks from Windows 95 still work on all recent Windows versions. Back in the old days, the most powerful toy to mess around with a system was the “rundll32″ utility. This utility can be used to invoke functions from a library (dll-file), without having to write a C-programm (I’d rather read out Perl-regular expressions in the public than to go back to C again).

The Shell32.dll contains a nice function to run the default application called “ShellExec_RunDLL”. So let’s abuse that.

rundll32.exe "SHELL32.DLL,ShellExec_RunDLL" 

3. Mac OSX

MacOS is a weird thing. Applications are stored in bundles, well, directories with a lot of binary gibberish to know what entry in there is executable. Its equally inaccessible as the Windows Registry and the Apple Developer Connection is a great place to never find anything (who would have guessed that the entry called “CFBundle” describes the application directory structure). The File-open dialog of course, treats these application bundles as if they where files, but sadly no one told the Unix-shell that these things are executable.

So we have to find magic again, this time by using the open(1) command to parse whatever makes a bundle so special and then to execute the correct native application inside the bundle.

If you just want to open the file with the default application, use

open 

If you know the application bundle and want to open the file with that specific application, you cant do that directly. Again you have to use the open(1) command, but this time with a extra parameter:

open -a  

Subversion version troubles

For all our development, we use Subversion as our sourcecode management tool. Usually, it works quite well, until you make a mistake that leads to using various versions of this tool across your systems.

The situation:

As a command line addict, I’m heavily dependent on the command-line tools for my daily work. I have three systems I work with on a regular base:

  • A Ubuntu desktop for the main development work while being in Germany, that ships with Subversion 1.4.4.
  • A Windows based notebook, for presentations and meetings, that is made usable via Cygwin and that comes with Subversion 1.4.
  • A MacBook for development and work in the field, that comes with subversion 1.4 as well.

So the situation is easy. All systems use the same command line version, and thus, Thomas should be happy. (That was back in mid-March.)

Let’s start the disaster that keeps me busy for the next days: “apt-get dist-update”

Subversion is now 1.5 on Ubuntu (via hardy-backports). And all of the sudden, my Windows and Mac systems are locked out, as Subversion *always* auto-updates the repository on any write access. Great! (The Ubuntu system is the only system with a sane filesystem (case-insensitive, unlimited path length) and a sane set of file-server capabilities (smb, nfs)).

Lets try to solve the problem. Upgrade the Windows system. Thats relatively easy, thanks to Cygwins update function. I end up with Subversion 1.5 for now. Luckily I dont use Torture-SVN on Windows, so that system is done. And more luckily, the Cygwin package maintainers did not yet publish packages for Subversion 1.6. But the next update promises to be fun.

Lets go to the Mac. Oh, SVN is bundled with XCode. So there is no update option available. Yeah, monolithic bundling makes life so easy! And no sane person would use public package systems with repositories that can hold updated versions. Luckily a Mac is nothing more than a Unix with a large set of proprietary extensions, so there is hope. So lets dig into the core.

MacPorts would want to install SVN 1.6. Of course, this version is not compatible with the older versions. And of course, there are no packages available elsewhere. And of course, there is no “downgrade”. Failure.

Next try: Lets see whether there is a pre-compiled download at the subversion site itself. After some digging in the archived parts of the site, yes, there is a Subversion 1.5.6 download. Download, install, done? Not really. Now its time for commandline configuration first, as the old 1.4-client is still installed. A quick edit later, the command line is happy.

I don’t even want to think about the monumental task to update the various VMWare images that sit on top of these physical machines. Life’s no fun when being forced to play admin.

Lessons learned:

  • Never upgrade
  • If you upgrade, take a week off afterwards to clean up the carnage – or
  • Wait with the upgrade until all your systems have all your packages available (or until the old packages dont work anymore, whichever comes last).