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, … Continued

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 … Continued

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 … Continued

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 … Continued

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 … Continued

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 … Continued

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 … Continued

Typography Links

Most of the really pleasant web designs I see seem to display more than a little evidence of classical typographic knowledge. Here’s my collection of typography-related resources, including links to some classic (and some common) fonts. Tips and Tricks Mark Boulton: Five Simple Steps to Better Typography Richard Rutter & Mark Boulton: Web Typography Sucks … Continued

HenPlus

For a while, I’ve been using a great little Java-based GUI SQL client called dbVisualizer. It’s a nifty little database management tool that — here’s the good part — supports virtually every database backend under the sun. I use it to manage PostgreSQL and MySQL databases at home and PostgreSQL and Microsoft SQL Server at … Continued

URLs in demiblog

URL design is important. For this reason I’ve put a lot of thought into the URLs used by demiblog. demiblog has a PHP object SiteURLSpace that maps between URLs and data queries. This means that demiblog’s URLs don’t necessarily have to bear much resemblence to its code structure. It’s also pretty easy to completely replace … Continued

Non-Intuitive Surnames

Below is a non-comprehensive list of surnames which are pronounced non-intuitively. (Or one could argue that they are pronounced perfectly sensibly but the spelling is non-intuitive.) I've also included a count of how many times each surname applies in the 2006/07 Brighton telephone directory, to give you an idea of the relative importance of learning … Continued

The Great Wi-Fi Controversy

Last night, Panorama broadcast Wi-Fi: a warning signal unmasking the “controversy” over Wi-Fi health risks. This is one of those many controversies in science that are not really controversies as far as the vast majority of scientists are concerned, such as the “controversy” over whether global warming is caused by changes in solar output. Panorama … Continued

The Tao of HTML 5 – Part II

Part of the problem with the WHATWG HTML 5 specification is that it’s primarily written by browser makers. (Hixie, its editor, is the exception, as he currently works for Google, though in the past was employed by the Mozilla Foundation and Opera.) This has steered the focus of the specification towards browser manufacturers — the … Continued

MySQL WTF?!

I’m currently in the process of extending demiblog’s database support. Version 0.1.0 only supports PostgreSQL, but I plan on also supporting MySQL in the next release, and a few other databases further down the line. Because this cross-database support had always been planned, I’ve been very careful in writing my SQL to make sure that … Continued