Where magic lives

Saturday, December 30, 2006

Freakonomics

Each chapter presents a question that lends itself to an answer using a fun application of "economics".

The latest version of the book also contains some extra content: Columns by the one of the authors that were published in the New York Times and selected articles from the authors' blog. Each one of these extra mini-chapters is as interesting as those contained in the book itself.

This is a really fun and interesting book that I would definitely recommend.

Labels:

Sunday, December 17, 2006

UK Postcode Coverage Map

On a website that I have been making I had to provide a "Find my nearest" page, one of those things where people enter their postcode to find the nearest outlet of the company in question. An easy application of Pythagoras' Theorem using the full UK postcode database that I was provided with.

In a bored moment today though I wrote a short little program to go through the database and mark a dot on a blank canvas for the coordinates of each post code. As can be seen I got a very realistic outline of Britain. Although, I was a bit disturbed by the shape of Wales so I overlayed my data onto a satellite photo of the UK, there does appear to be some sort of a problem, is my database broken?

The satellite overlay does do a good job of confirming that the less postcode dense mainland areas very often correspond to mountainous areas.

Update: Thank you Mapperz for pointing out my mistake (Northern Ireland postcodes work off a different grid system). Seeing as it is not just a simple constant offset between the two grid systems and the company I was making the site for don't have any Northern Ireland outlets, I have just omitted the BT* postcodes from my dataset leaving me with this map.

Labels: ,

Friday, December 15, 2006

Paint By Icons

I've made a new website!

You upload a JPEG photo and it returns a mosaic version of your photo made up of a subset of the 'favicons' of a mixture of 1000 currently popular websites, similar to this.

Give it a go at www.paintbyicons.com.

Labels: ,

Tuesday, December 12, 2006

PHP Error Handling for Dynamic Images

A long time ago I wrote a script to handle PHP errors in a useful way. I still use it when writing in PHP today but it is not much use if you are writing a script that is producing images so I recently wrote a version that outputs to an image. Here is a sample error and here is the source code. As long as you insist on writing totally error free code (i.e. no E_NOTICE's) it can be included directly into any page that generates images. Remember to remove it before going into production though (it spits out source code and variable dumps when there is an error).

Labels: