How many ways can you link a node?

Got a call from a friend last week that wanted to chat about some work we did a few years back to migrate data from one Product Data Management (PDM) system to another. Not for the first (or last) time we have come full circle and they are now looking to prise the data out and pop it back somewhere else.

PDM systems typically store mechanical design data – parts of things, if you like – along with meta data relating to the part (part number, material, weight, colour, edibility…). Perhaps the most fun thing they tend to hold is relational and positional and configuration data – what connects to what and where it is in a particular variant of whatever is being designed. Actually, edibility is quite fun too when it comes to designing motor vehicles or nuclear submarines.

Strangely, earlier in the year I had been thinking of the approach we had used to transform the data to get it in a useable form between these systems. Back in 2005 we developed a concept that Andreas Tsiotsias had dreamed up as part of some thesis or other.

Andreas had created a number of Java classes around something called PLMStructuredData in a collective called DataAdapter. Essentially there were three elements to PLMStructuredData – nodes, nodeLinks and nodeLinkInstances.

Nodes represent “something”. Which can be just about anything. A part, a tree, a picture of a part in a tree – that kind of thing. You might also hear nodes called “entities” by lesser mortals.

NodeLinks are the basic relationships between two nodes. They don’t convey very much other than that two nodes might be linked in some circumstances. There is also a hierarchy – one is a parent and one is a child. So you might have a bolt and a nut that have a nodeLink between them where the bolt is the parent and the nut is the child – and they both may also have a nodeLink to a “crazed robot mechanical arm” assembly.

The amazing trick with nodeLinks is that they are very fast to navigate to uncover relationships between stuff. In fact, they are not just amazing – they are amazingly amazing. At connecting stuff that is. I’m not so sure they would be much good to defend yourself against a bear or to borrow a fiver for your lunch from.

NodeLinkInstances define the conditions where a particular nodeLink applies. This might be “always” or if a particular attribute is true or if the root parent node in an assembly is a particular flavour. So – you might only include a link between “dashboard” and “Sennboseheiser Omni Megga Thump 2000 Sub-woofter” if the parent root node at the top of all the parents is “Ridiculously stoopid jacked up neon green drugdealermobile”. But it might also only apply if the build date was between 1986 and 1992. NodeLinkInstances transform buckets of loosely related nodes in to particular things that have meaning.

Armed with these three things, we were able to model just about anything in the universe – including the universe itself. As it was, we used it to model data in PDM systems – mostly of motor cars. At least, we were able to once I had put in place a documented and clearly defined class structure (UML with forward and reverse updating between the diagrams and the method stubs), built all the code with jUnit and dbUnit test cases and written education presentations so that the folks in India could understand what the hell we were on about.

Oh, and commented the code too. Although Dick Stephen might point out that my comments reflected the same tone as this blog entry and so some of the time were very entertaining, if a little confusing.

I also added a set of transformation plugins, a new language for defining how they operated on data (although interestingly it is the only language I know of that doesn’t actually have a name!) and invented what we called flavoured data.

When you want to transform data from one system to another – you are really just changing it’s flavour – and instead of “transformation” you are “flavouring”. It is remarkably easy to change the flavour of data once you know what you want to change it to.

There are, I know, many variants around in one form or another of what I have described above. I know this because I have seen and read about them – not always quite as obvious – but the same none the less. I also know they are the same so I won’t get sued for publishing this.

I did love the beautiful simplicity of our approach – and the innocent arrogance we had in delivering in a few months what many vendors have spent years developing.

But with the passage of time a few thoughts have been forming in my head. Yes, it doesn’t happen very often – and even when it does, it usually involves sheep or rockets or sheep powered rockets. But thoughts have formed none the less.

First of all, a confession. We were all out and out Java zealots at the time. Well, the ones who were important and knew what was what were. I’d have specified Java if I was being asked to paint a house or light a fire. Java was awesome for doing PLMStructredData – and once we had twigged the memory stuff and dropped a lot of the unwanted overheads like multi-threading when you don’t want or need multi-threading, we were able to make it really cook. But I have at last come to the realisation that maybe, just maybe, there are circumstances when Java might not be the bees knees. Not many circumstances mind – I’m painting my burning house in Java next week.

You see, one of the problems we had was that we ran all this in memory. Which is fine for smaller, lighter structures – but once the data gets hefty we had to resort to techniques such as the BOM skeleton – where you hold the structural information in memory and then make calls out to a relational database for the heftier bits of attribute data only when you need it.

But in working recently with loads and loads of less complex data (vastly less complex – here I am, brain the size of a planet…) another thought has occurred to me – why not just hold the whole of PLMStructredData in a relational database in the first place and use Database caching and indexing to achieve what we did with our in memory techniques.

I really hope that Mike Forest isn’t reading this as this is something along the lines that he maintained we should have been doing all along (having not been quite as beguiled by Java as normal people were).

Some may remember the tree walk race that Mike and I had – and if not, may remember the constant bitching from me with a variety of excuses I dreamed up for having lost the race. But only by a few seconds. And in any real world scenario I would have won. Or if applied across multiple vehicle variants he would have been toast. And anyway – stored procedures are so 90’s and not platform or database independent. So there.

One of the standard out of the box input and output plugins for DataAdapter was a means to store and retrieve data from a relational database. But this really was just to dump the data rather than to operate on it. It would be much more interesting to enhance these and the transformation plugins for operations in the database itself.

So I have been tinkering with a few Java classes (alas – without DataAdapter as it is no longer mine). It’s quite good fun to crack open eclipse again and give it a whirl. To be honest, I haven’t the foggiest if what I come up with will be useful – but it will be fun and if it doesn’t come off – it just gives me another reason why I was right all along.

Home and away with a NAS and a MacBook

Two left feet
These boots are made for walkin' ... but not too far from my Wi-Fi or my mounts will hang my MacBook

If you have read a couple of my posts on here before, you will know that I’ve gone to some particular trouble to procure myself a development environment so that I can start writing apps – and I have taken my first faltering steps to create the first test app that runs on my iPhone.Well, being as it has taken so much time and effort to set this environment up, there was nothing for it, but to go and buy myself a MacBook Pro anyway and have the development environment handed to me on a plate. Actually, it wasn’t quite that decadent or pointless – I had a change of employer and my new employer, a gracious gentleman of taste and sophistication, gave me the option of procuring my own laptop. Sweet.

So, now I had the tools, the time and and a completed expense form. It was really tricky coming up with new and different things to avoid knuckling down to writing the app – but I managed to come up some good ones. First there was settling in to the new job, then there was getting my TOGAF Practitioner certification, then applying for my Chartered Professional status with the British Computer Society, taking the BCS “Breadth of Knowledge” test and finally booking my PRINCE2 Practitioner certification exams. When I found myself researching the Certificate in Finance, Accounting and Business (CFAB) with the Institute of Chartered Accountants in England and Wales, I knew I had taken the whole avoidance through self improvement tactic too far and needed something to get the focus back where it should be.

There was nothing for it, but to open up that MacBook, fire up xCode and crack on! It was in a slightly chilly hotel room (the radiators had been turned off and turning them on had only improved things a little bit). The lights were that particular shade of yellow that comes from super eco energy saving bulbs that are identical to the 100 watt pearescent volt glutton ones in every way except, of course, the way that they consume energy and emit light. The MacBook high definition ultra screen seared through the murk and my retinas. You just got to love a display that is only matched in its crisp sharpness by its glossy reflectiveness. Fortunately, in this room there wasn’t much to reflect. Certainly nothing that a MacBook as cool as this one would entertain. Except of course the light bulb hanging from the ceiling in the centre of the room which, by a staggering coincidence, also aligned with the centre of my screen. Leaning forwards just a fraction placed my silhouette between the light and the screen and added just enough discomfort to my lower back to give me the satisfaction that I was suffering for my art.

That’s when I noticed it for the first time – a little pop up window saying that the network drives that I had mounted from my NAS at home for photos, video and music respectively were no longer responding and asking me politely if I would like to disconnect from them. Well, given that I was many miles away from my NAS which wasn’t hooked up to the Internet, this didn’t seem entirely unreasonable, so I disconnected them. But that started me wondering what would happen when I got back home. Would they just magically come back by themselves, would they ping back to life the next time I tried to access data on them, or would they expect me to manually remount the disks every bloody time I came home. I wasn’t sure, but I suspected that the answer had the word “bloody” in it. With a sense of moral outrage and welling satisfaction – I now had reason to avoid writing an app – there was nothing to do but to spend the rest of the evening figuring out how to fix this show stopper.

As it turns out, when I got back home, things were not quite as bad as I expected. Time Machine was quite clever and mounted the drive from the NAS it needed when it ran backups every three or four minutes. Sometimes it just runs continuously with occasional breaks when you don’t need the system to do anything quickly. But even if it’s inconvenient, it’s not going to get me out of writing an app, is it?

Surely iTunes wouldn’t let me down – I clicked the familiar blue circle and up it came without a hitch even though I knew my music was on the NAS. Darn, since when did iTunes do something the way you wanted it to? In actual fact, I realised later that the iTunes library was on the local hard disk which is why it came up – it was only my music files that were on the NAS. Had I tried to play something, to my glee it would have failed – but I didn’t because I was getting cross and wasn’t in the mood for Chas and Dave. So, disconsolately, I plugged in my iPhone to upload the photos from it and was delighted to find that Image Capture couldn’t find the NAS mounted directory to save them to. Bingo -prevarication gold!

When I started looking in to this, I was pretty sure that this must be a common issue. How many people have NAS drives? Loads! How may people have MacBooks? OK, don’t answer that one, but more than three people. And sure enough the Internet is littered with articles about how to mount your NAS when at home – along with a number of applications, both free and fee for making all the necessary adjustments. But hell, this is OSX and I started doing UNIX back in 1986 so this wasn’t going to be a problem to code up myself, even if I was cheating by searching the Internet!

The strange thing was that most of the articles seemed to very nearly do what I wanted to do, but not quite. I wanted something that would connect to my NAS when at home, and disconnect when I was away – automatically. Or at least, if it didn’t disconnect, not cause any nasty problems when the NAS wasn’t there any more.

My first thought was to use automounts. These will make the mounts to servers when you access a mounted directory and disconnect if you don’t use them for a certain time. …and then reconnect if attempt to use them again. I set this up easily enough (it involves editing /etc/auto_master and creating an /etc/auto_smb. Plenty of guidance elsewhere if you want it – but here are mine:


# Automounter master map
+auto_master # Use directory service
/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/- -static
/- auto_smb

## Automounter master map#+auto_master # Use directory service/net -hosts -nobrowse,hidefromfinder,nosuid/home auto_home -nobrowse,hidefromfinder/Network/Servers -fstab/- -static/- auto_smb/etc/auto_smb:

/Users/<username>/Volumes/music -fstype=smbfs ://<user>:<password>@<NAS>/music

/Users/<username>/Volumes/photo -fstype=smbfs ://<user>:<password>@<NAS>/photo

/Users/<username>/Volumes/video -fstype=smbfs ://<user>:<password>@<NAS>/video

I found the problem with this, however was that if you strayed in to a directory used by automounter whilst away from home, it hung around for a very long time attempting to connect. And heaven forbid if you tried to save anything using Word, Powerpoint or Excel. They just seems to smell that there might be a mount you could conceivably attempt to use – even if you weren’t using it – and hang for even longer than Finder did.

Two things eventually came to my rescue. First was the excellent article here ( which explains how to set up a LaunchAgent to detect when your WAN changes and a locationchanger script that to detect when your WAN is at home and when it is somewhere else. I modified the script to mount my NAS directories when at home. However, when away from home, I found that the mounts did not unmount automatically and we were back to the Finder and programs hanging when going near the mounts.

That’s when I remembered back to my days working at Rover Group in the late 90’s under the expert tutelage of Obe Wan Kenobe – otherwise known as Paul Manton. I never did make Jedi, but back in those days we had problems with clients hanging when there were brief network outages and so we changed our mounts to be “soft” mounts. Soft mounts will drop from beneath applications if the network connection is lot. Of course, this can be bad news for an application with open file handles. Soft mounts think of them more like love handles in that it can choose to ignore them rather than hang around awaiting perfection. This can result in unsaved data being lost – but if you haven’t saved something that is being written to a NAS device and then you move 76 miles away and expect it to magic the data with pixie magic then you probably deserve to lose that data anyway. What are you expecting, magic?

So here is my modified locationchanger script. With the soft mounts it pops up the dialogue asking if you want to disconnect when you move away from your WAN and automatically reconnects to the NAS when at home.


# automatically change configuration of Mac OS X based on location

# author: Onne Gorter <>

# url:

# version: 0.4

# set -x

# redirect all IO to /dev/null (comment this out if you want to debug)

exec 1>/dev/null 2>/dev/null

# get a little breather before we get data for things to settle down

sleep 2

# get various system information

SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I\

| grep ‘ SSID:’ | cut -d ‘:’ -f 2 | tr -d ‘ ‘`

EN0IP=`ifconfig en0 | grep ‘inet ‘ | cut -d’ ‘ -f 2`

EN1IP=`ifconfig en1 | grep ‘inet ‘ | cut -d’ ‘ -f 2`


# locations (use to be used Location name here)


# detect HOME


ATHOME_EN0IP=<home network address>

ATHOME_EN1IP=<home network address>

if [ -z $LOCATION ]; then

case $SSID in





if [ -z $LOCATION ]; then

case $EN0IP in





if [ -z $LOCATION ]; then

case $EN1IP in





if [ -z $LOCATION ]; then

# still didn’t get a location, so do automatic




case $LOCATION in


echo “At home…”

if [ -z “`mount | grep ‘/Users/<userid>/Volumes/music’`” ]


mount_smbfs -o soft //<user>:<password>@<NAS>/music /Users/<userid>/Volumes/music


if [ -z “`mount | grep ‘/Users/<userid>/Volumes/photo’`” ]


mount_smbfs  -o soft //<user>:<password>@<NAS>/photo /Users/<userid>/Volumes/photo


if [ -z “`mount | grep ‘/Users/<userid>/Volumes/video’`” ]


mount_smbfs -o soft //<user>:<password>@<NAS>/video /Users/<userid>/Volumes/video



automatic )

echo “Not at home…”



# do some stuff here that needs to happen after every network change

# echo `date` “Location: $LOCATION – $REASON” >> $HOME/.locationchanger.log

exit 0

Of course, this now means that I have no excuse but to get on with coding the app…

Hello World – How difficult could it be?

Well, it has been a few weeks since the last update. In the intervening time, I have descended deeper into the Apple labyrinth with the procurement of an iPad (with my lovely wife as an accomplice) and shelled out to join the Apple iOS Developer programme (More on that in future posts). However, where we left the story was a bit further back through the sands of time – having secured myself a Mac running Snow Leopard to host my sparkly new development environment….

Apple iOS Software Development Kit
An SDK is a cardboard box with the letters S, D & K on the front.

First things first – I needed to get my mits on the iOS Software Development Kit (SDK) – which, remarkably, is free and includes the Xcode IDE (Integrated Development Environment – the thing you use to write the code). You can get it from here yourself if you don’t believe me: Of course, before you can get it, you need to register as an Apple developer – ahhh the subtlety as you slip in to the snare…  But once registered, it’s free to download.

Actually, it’s only kind of free. Well, it is and it isn’t. That is to say, it’s free in so far as saying yes to the license terms and conditions. I carefully read them, reviewed the finer points with legal council and submitted a Judicial review in the High Court to get a definitive position on the “forfeiture of soul” clause.

Where it’s not so kind of free is that although you can write and compile code for the iPhone simulator that they so nicely provide as part of the SDK, you can’t actually install the results on an actual iPhone. Not yet anyway. For that you need to buy in to the iOS developer programme (see above). Ah ha! The trap is sprung!

But that’s OK – fair dues – for my first outing, all I wanted to do was to do the obligatory “Hello World” app, compile it up and run it on the simulator. Easy peasy, lemon squeezy.

Somehow, in navigating the Apple developer web site, I managed to sail straight past the “Hello World” app – and landed myself the sample “MoveMe” app. The ironic thing is that in writing this blog update I came across it straight away and had to really look hard for MoveMe. So I took the scenic route the first time – is that a crime or something? It is? Oops. I plead insanity.

A picture of the Xcode GUI
XCode - it's an IDE, but not as we know it.

Anyway – downloaded the sample code and unpacked it in the downloads area of my Mac. I really must put these things in a more sensible place – but hey ho. Fired up Xcode and pointed it at the sample code. Clicked on “Build and Go” – and before I knew what had happened a simulator iPhone pops up and there is the app.

As an app, it’s not all that exciting – a button that flashes the word “Welcome” for a split second flash frame (conspiracy theorists take note). You can then drag the button around the screen and when you let go – it goes boinnnggg back to the centre of the screen.

Hang on a minute – now I come to think of it, there wasn’t very much in the way of actual coding going on there. Not exactly a very fair hello world test, is it? I can hear the mocking voices of the Program Police mock my attempts by mockingly saying things that are mocking. But “Pah!” I say (more in a kind of off hand east coast way rather than the French version which includes a semi shrug) – there may not have been much in the way of coding – but this proves that my development environment works, doesn’t it? Lost for words now, aren’t you, mock cop?

So there we have it – a redefinition of success for the Hello World app … that wasn’t even the hello world app in the first place. Of course the real test of the development environment would be to get the app on to my iPhone. Now that would be clever, that would be a real achievement and that would set me back £59…

Choose your weapon

A multi platform development environment - and available on Windows!

Casting my mind back – I was the proud owner of a glossy new iPhone 4, but had no other Apple devices or experience. So when the mood took me to have a pop at developing an iPhone app, I naturally looked at how I might go about doing so using my Windows 7 PC and a bit of creativity.

I quickly rumbled a delightful development environment called Appcelerator Titanium Mobile. This is a snazzy way to make web applications for the iPhone – so if you are o-fay with JavaScript, HTML, CSS et al. then you can use this to create native looking applications that can be compiled up for both iPhone and Android platforms.

Now if you are not particularly technically minded (and are still reading at this point) – all this means is that you can use the same skills that are used to make whizzy web pages like the one you are looking at. Everyone can do that – even my mum. Well, she could if she got past playing solitaire. Anyway, you might ask what good is that on an iPhone – after all you’ve got a Safari web browser anyway? Well, that is a very good question, thank you for asking. Firstly it gives you a common way to write applications for Apple and non-Apple stuff (like an Android based Google phone) so you only have to write them once. Secondly, if it exposes some of the special features of the devices – like the GPS for instance – so you might be able to do all kinds of clever things. Lastly, there is a Titanium platform that runs under Windows! Result.

I excitedly installed Titanium for windows and fired it up. It became clear very quickly that all was not quite well and that the options to do stuff with iPhones were conspicuous by their absence. Not so much that they had sloped off down the pub for lunch as they had suffered a total existence failure. A bit of digging revealed what needed doing to complete the install was to download the iOS development libraries from Apple. And this was (obvious in hindsight perhaps) slightly inconvenient as I was using Window 7. You see, the iOS development libraries are only available to install (for the iPhone 4) under Snow Leopard. That means I needed a Mac of some sort in order to go any further. It all started off so promising. 🙁

Small, but perfectly formed.

Now getting your hands on a Mac that can run the latest version of stuff can be something of an expensive business. Probably the cheapest entry point to buy from new is to go for a funky little Mac Mini. These will set you back the better part of £800 once you have bought a keyboard, mouse, iPod stand, MobileMe, leather carry case and a strange bit of white plastic which seemed very important in the store, but has no subsequent purpose or meaning.

But why stop there – how about going for the panoramic omni-mega supersize iMac – or the ultimate in portable chic – the MacBook Pro. Regrettably, my bank account doesn’t have a number with four digits in it at the end of the month (two would be nice together or just a positive sign at the front) and I’m not given to melting plastic to satisfy spending splurges. Not really an option for the sake of curiosity. But they are nice. Very nice.

There is always the possibility of going on to ebay to pick up an ultra-cheap nearly new Mac. I don’t know if there is something I do wrong on ebay, but when I’m looking through the auctions, I seem to find lots of nearly new stuff that is at least as expensive as buying it new from a shop – or some older second hand stuff that is still about as expensive as the new – but without a tedious warranty or the baggage of consumer rights. Actually, I did pick up some door handles from ebay once that were quite reasonable. Unfortunately, you can’t install OSX on a door handle.

But there is another way. An all together darker and furtive way. Not a way that your Gran would have approved of – but maybe a way that your Uncle Gary would have had a quiet word with you about afterwards. The legalities are somewhat grey and the characters who promote the approach are even greyer. I speak, in hushed tones, of the Hackintosh. A Hackintosh is a way to install the OSX operating system on a standard PC by modifying the bootloader and device drivers to work with bits you can buy from your local computer tin shifter. Even if you pay for the operating system software, the terms and conditions may preclude you from installing it on anything other than official Apple hardware – although it is interesting that the European Competition Commission are currently investigating IBM for anti-competitive practices because IBM does not license it’s mainframe operating system on anything other than IBM hardware. Hmmmm.

Quite which approach I ended up taking, I will leave to the mysteries of time and space. Suffice to say that I started off with just an iPhone and now I’d also picked up a Mac. And there were even more jolly purchases to make before landing the first app on the phone.

It was fun, but through clenched teeth.