Interesting Times

I’ve recently handed in my notice, and am leaving COSMIC. As is the way of these things though, everything has got quite interesting all of a sudden.

For instance, there has been quite a lot of interest in the car share booking system that I wrote for – it is a curious situation to be in. In terms of intellectual property everything I developed at COSMIC has to stay at COSMIC, clearly this is both good and bad.

Moorcar Booking System

Bad in that everything I have written over the past two and a half years is not mine and as it stands I have some nice solutions in place now, solutions which I know inside out and can drop into place.

Good in that these times of transition give one time to learn new things and a brief breathing space to develop new things. I’ve been taking this time to put together a new toolbox of code and to throw myself into object orientated PHP.

I’m also taking the time to get really up to speed with CakePHP, I’m putting together a skeleton with everything you need at the beginning of a web project, security, pagination, pages, uploads etc.

All in all the bad shrivels into insignificance, writing code is process of learning day by day, of course it doesn’t matter that I can’t use that code. When I it need I can just write again, better, have learned from experience.

The really interesting thing is that COSMIC are considering making Rocket, the CMS framework I developed into an open source project. This is intriguing – but also a bit scary. I am proud of it, it is fast, stable and flexible, it contains some elegant solutions. However it also contains rubbish, dead ends and blind alleys where the development was going in one direction and then it changed, unresolved philosophical issues… if the project was made open source it is a bit like one of those dreams where people imagine themselves walking down the road naked (I have never had one of these dreams) – people get to see everything. To be fair I think it would need a bit of work before it was suitable or made sense in wider context. On the other hand I would be able to legitimately use all that code. It also has a very cool logo, designed by my friend Hannah Storie.


Recent Projects

I’ve just completed quite a major project. An e-commerce site for Joshua’s Harvest Store in Devon. The shop has about 4000 products and ties into a 3rd party stock control system that is used in their shop. Every day the products listed on the site are syncronised with the stock control system using a scheduled uploads and the summary sales data is generated to be imported back into the Stock Control System.

It has taken a long time and hasn’t been particularly easy but it is always a good feeling when a complex piece of work is up and running.



Multiple CMS systems with Symbolic Links

If you are a web developer you will very often be in the situation where you have to manage a server that has a large number of websites running on it all of which are running the same Content Management System. So far so good, everything is in one place and you know how your server is setup.

But what happens when you find a bug in the CMS system or you need to upgrade all the sites? You probably have a simple proceedure in place that goes something like this:

  1. Update & Test the development copy of the website.
  2. Copy the website to a file server into a new directory (named by date or version).
  3. Upload the files from the file server to the live web server.

The idea being that you always have an exact copy of the files on your live server on a local server, and that you can easily revert to an seralier version should you have to.

(This is assuming you aren’t using a CVS system, just a well organised file system and some good procedures.)

If you only have a couple of websites this isn’t a problem, but if you have 20 or 60 then suddenly you can end up having to deal with a lot of operations. If you host on a Linux server the solution to your problems is called a Symbolic Link. When I think of Symbolic Links I think of Alice in Wonderland and magic tunnels.

Wikipedia describes Symbolic Links like this:

In computing, a symbolic link (often shortened to symlink and also known as a soft link) consists of a special type of file that serves as a reference to another file or directory. Unix-like operating systems in particular often feature symbolic links.

Unlike a hard link, a symbolic link does not point directly to data, but merely contains a symbolic path which an operating system uses to identify a hard link (or another symbolic link). Thus, when a user removes a symbolic link, the file to which it pointed remains unaffected. (In contrast, the removal of a hard link will result in the removal of the file if that file has no other hard links.) Systems can use symbolic links to refer to files even on other mounted file systems. The term orphan refers to a symbolic link whose target does not exist.

Symbolic links operate transparently, which means that their implementation remains invisible to applications. When a program opens, reads, or writes a symbolic link, the operating system will automatically redirect the relevant action to the target of the symlink. However, functions do exist to detect symbolic links so that applications may find and manipulate them.

Users should pay careful attention to the maintenance of symbolic links. Unlike hard links, if the target of a symbolic link is removed, the data vanishes and all links to it become orphans. Conversely, removing a symbolic link has no effect on its target.

Personally I don’t find this very helpful – what it means in practice however is that you can have create what appears to be a directory, but the contents of that directory are stored somewhere completely different. Even better you can create lots of these directories each of which appears unique, but which in fact all point to the same data.

Why have 60 copies of the same identical data and update it 60 times when instead you can update the source data once?


Symbolic Links

This is screenshot of a Linux directory listing illustrating the symbolically linked directories all pointing to the same files. To update all the CMS systems all you would need to do is update a single directory. This is a very simplified view of course, to run a system like this in real life each website needs its own configuration file(s) etc.

Looking at the file system via FTP you see this:

FTP screenshot

How to create a Symbolic Link

To create a symbolic link you need access to the command prompt – this will usually be via SSH. I use a small program called putty to do this.

The command is: ln -s source_file myfile where source_file is the file or directory you wish to link to and myfile is the name of the symbolic link you wish to create.

This screenshot shows the commands I use to create the symbolic links in the other examples:

Screenshot of putty in action

Just Imagine

strong>If I was a Genetic Engineer I would help people to Purr.

As you lie in post-coital torpor, Purr contentedly.

Avoid embarrassing gaps in conversation, simply purr.

No need to talk at a job interview, Just Purr with calm assurance.