PHP Domain Class

On Usenet an often-asked question is how to programmatically determine the “domain” of a particular hostname. That is, excluding the components traditionally thought of as subdomains. As an example, groups.google.com and www.google.com both have a domain of google.com. Invariably, one answer comes back stating that you just need to chop off everything from the front, […]

PHP Linkifier

Here’s a nifty bit of code I wrote a while back (utilising a function from PHP SmartyPants) that takes a bunch of HTML, searches it for some word or phrase that you specify, and turns all occurances of it into a link, unless it’s already a link!

PHP vs Perl

Here's a simple program which calculates, to eight decimal places, the value of the Golden Ratio φ implemented in both PHP and Perl, to demonstrate their similarities. Perl #!/usr/bin/perl $a = 1; $b = 1; $c = undef; $psi_old = undef; print “Approximating psi…\n”; while (1) { $psi = sprintf(‘%.08f’, $b/$a); last if ($psi_old eq […]

Long-Awaited Zeldman Article

Jeffrey Zeldman has posted a long-awaited article on the problem of ‘maybe’ options on forms. So long awaited indeed that many of the comments are dated over 37 years ago.

The End of an Era

Tony Blair is to step down as Prime Minister and First Lord of the Treasury, and it looks like he’ll soon be taking a job as Steward of the Chiltern Hundreds. He’ll also apparently moonlight as a Middle East peace envoy — in other news, outgoing Deputy PM John Prescott will be taking up a […]

A New Look for TobyInkster.co.uk

This site has had a few facelifts recently. Hopefully this one will stick. It’s based on two main principles: Use Hoefler Text for copy. It’s an absolutely gorgeous font which comes with Mac OS X that I was recently using on a printed document. Hoefler has a delicious set of italic glyphs — they were […]

Typography in demiblog

I've said it already, and I'll say it again: typography is a very important and oft-neglected aspect of web design. demiblog is my CMS; although great typography requires the conscious effort of the author/typesetter, and can't be handled automatically by a CMS, there are certainly steps a CMS can take to ease the burden on […]

Political Map of the UK

(Requires Javascript.) See below for an explanation on how these placements were calculated. UK-Wide Country-Specific (New) Labour Conservative Liberal Democrats Greens Respect Coalition UK Independence Party (UKIP) British National Party (BNP) Scottish National Party (SNP) Plaid Cymru Democratic Unionist Party (DUP) Sinn Fein Social Democratic & Labour Party (SDLP) Ulster Unionist Party (UUP) Alliance The […]

dict, thes & ency

dict is a command that is supplied with most Linux and BSD distributions. If you enter dict foo at the command-line, you get back the dictionary definition of “foo”. Normally several different dictionaries are supplied, including some dictionaries of translation, and it’s possible to look up the word on various online dictionaries too. As counterparts […]