Diary : programming

Menu

Diary
OldIRC
URLs
misc
techie
writing

More content will be added to fill this space at some point in the future.

home :: Diary :: programming

Fri, 03 Nov 2006

Collecting free postcode data

Could you spare two minutes to locate your house/workplace on a online map, and type in your postcode?

The downside is that you have to find your house on old maps. The upside is that you get to look at old maps.

Why? To help build a free-to-use database that links Postcode to Latitude/Longitude - something desperately needed in the UK.

Over the last month I've been working on a website to collect the locations of postcodes. Update: It is here

The idea is to use out-of-copyright OS maps, and to get people to locate their home on the map, and specify the postcode. Get enough people to do it (perhaps for their workplace too), and you will have a not-perfect-but-good-enough-for-most-purposes database that anybody will be free to use.

We have even had an article in the Gurdian and a mention by Ed Parsons at the Ordinance Survey.

Last updated: 13:07, 03 Nov 2006 Link..

Thu, 31 Aug 2006

Art of SQL

[cover image]
The Art of SQL

A year ago I didn't know much about SQL. I knew that the keywords were INSERT, UPDATE, SELECT and DELETE. I knew that indexes made things faster and I had been taught the theory behind what makes something 1st, 2nd, 3rd normal form, but that is it.

I saw that some of our sites were slow and that was due to bad SQL design and lack of indexes. I soon learned enough SQL that, when combined with a bit of a guess about how I would execute the queries if I was a computer, I was able to make the queries faster. Since then I have been more and more interested in making sure that queries are as efficient as possible, sadly something that can be very important, but is difficult to test in the early stages of an application's life as there isn't a lot of data in the database so slow approaches taken by the query analyser are not noticable.

Recently I have been reading ' The Art of SQL ' by Stéphane Faroul . This is a treatment of the idea of optimising your databases from the theory side, just the way that I have been taught about everything else. It doesn't really tell you what to do, but it explains why it all happens the way it does, and suggests mays of approaching the common problems. I have found it easy to read and not at all drudgery. It isn't really a reference book, more of a book that you read from cover to cover. You may, however, wish to return to it from time to time when you encounter a problem that was discussed in the book.

Last updated: 14:20, 31 Aug 2006 Link..

Sun, 15 Jan 2006

Locking in Coldfusion

There is something screwy in Coldfusion's locking. If you make a cfm page that contains the code below. What you would expect is that executing the code would never take more than a shade over 15 seconds, as it can wait up to one second to aquire the lock, and then spend 14 seconds sleeping.

It appears that in some cases, this is what happens. For example, if you get the page from two wget sessions. It also will show you the error message if you go to the URL, then (whilst waiting) hit refresh. Unfortunately if you go to the URL in two different windows in Firefox, it appears that the second window will wait the whole time for the lock to be released (so up to 28 seconds total). I can't see why this would happen. Could it be something session related?

<cftry>
<cflock name="testLock" timeout="1" throwOnTimeout="yes">
  Got lock, sleeping...<cfflush>
    <cfset thread = CreateObject("java", "java.lang.Thread")>
    <cfset thread.sleep(14000)>
  finished.
</cflock>
<cfcatch type="Lock">
 Another process already has the lock.
</cfcatch>
</cftry>

Last updated: 16:51, 15 Jan 2006 Link..

Thu, 30 Dec 2004

Life Publishing

There is a lot of movement from certain parts of the internet population towards publishing the details of their life. This may include thoughts, photographs, todo lists, calenders, that sort of thing.

The majority of it is for the benefit of the publisher and a couple of friends. Some grow so large that thousands of people read their thoughts, and look at their holiday photographs.

There is some very good on-line software to organise this sort of thing for you, and most of it can be locked down so that only yourself, or selected friends can see the content if you so desire. Unfortunately it doesn't seem ideal to be uploading all your photos to a site on the internet, just so that you can organise them for yourself. It seems kinda wasteful. What you need is something that you can run locally, to organise your life, and optionally publish parts of it to the big wide interweb, possibly limited to sets of people.

The major pieces are there. Good blogging software can be run locally. Passable photo galleries exist in their millions. I'm not sure why I think it just isn't complete. I want to have Furl , Flickr , Blogger , Bloglines , Gmane and probably more all running on my machine where I have control of my data, and I want the ability to authorise people from some central authority to view the published content, so that they don't have to create yet another username and password, oh, and I want the moon on a stick. Maybe when I have all this I will be happy, or maybe it will just make me want more.

All this blog software, and integrating it, and adding RSS/Atom feeds of everything looks like good fun. If only I had some content. This is part of the driver towards me having a separate, dynamic blog, which I can do this with. The only thing is that, although I don't want to write my own system to blog with, I do want to have the fun of fiddling. I think I will try to go with Blojsom as it is a java version (losely based I think) on Bloxsom which I am using at the moment for this site. This should give me some scope for adding extra features.

Last updated: 23:41, 30 Dec 2004 Link..