April 7th, 2008
I’m using headings in the format:
<hx id="foo">Foo</hx>
Instead of keeping track of an internal page menu by hand, it’s easily to dynamically parse the string with a regular expression (assuming you’re using level 3 headers):
function create_page_navigation(&$string)
{
$menu = array();
$pattern = '/<h3 id="(.+)">(.+)<\/h3>/';
preg_match_all($pattern, $string, $headings);
$headings_num = count($headings[1]);
for ($i = 0; $i < $headings_num; $i++)
{
$menu[] = array('slug' => $headings[1][$i], ‘title’ => $headings[2][$i]);
}
return $menu;
}
This returns an array in the following format:
Array (
[0] => Array ( [slug] => foo [title] => Foo )
[1] => Array ( [slug] => bar [title] => Bar )
)
The slug is the URN representation. You can easily iterate through this to create the corresponding HTML list.
March 25th, 2008
I still buy CDs and up until now brought the essentials out of my collection with me to university, along with my separates system. This proved an inconvenience, so I looked into docking stations but there were some problems:
After a bit of searching I found Pure included an auxiliary 3.5mm socket in some of their higher range DAB radios. I settled on the 2XT, which you can buy from Amazon for around £75.
Basically having a 3.5mm socket means that you can connect it to any device that you can connect headphones to. If you don’t know about cables, search or ask for a ‘male to male 3.5mm stereo jack’. I bought one off Ebay for £2.50 inc. postage. You connect one end to your audio device and the other end plugs into the back of the 2XT.
I appreciate good sound and have heard good things about Pure radios. I wasn’t disappointed. It includes tone control which you can turn down for Johnny Cash and up for Chopin. Digital broadcasts are also very good, unfortunately the stations have been closing down lately, but the BBC stations will remain, which are all I listen to anyway. The sound is so good that I don’t bother with my separates system when playing music on my laptop, as I can navigate my library faster than changing CDs.
Even if you decide to buy an iPod docking station, I would recommend looking out for the auxiliary jack feature. You don’t have to own a television licence to watch BBC iPlayer and having the sound come from proper speakers really makes the difference.
March 19th, 2008
Listening to the radio, I heard that there would be a discussion about Arthur C. Clarke on Front Row. I made sure I caught the program, but didn’t realise until afterwards that the comments were posthumous.
I discovered 2001 by chance, picking it randomly out of the science-fiction section some years ago in the library. I rarely have become so captivated by the first chapter of a book, reading about Moonwatcher and the dawn of humanity.
Then I watched the film, directed by Stanley Kubrick. I believe Stanley was impressed with some of Clarke’s previous works, such as The Sentinel, so he propositioned Clarke to write a novel that could be filmed and 2001 was born of this collaborative effort. It’s rarely a film completely escapes a book and becomes an art form in its own medium, but 2001 was seminal in its influence of science-fiction films to come.
Certain lines have never left me and oddly this line came to me but a few weeks ago. I don’t know what’s beyond the infinite, but Clarke leant plausibility to everything he wrote. It makes me wonder whether, like Bowman, he stared in wonder at the twinkling lights in the Monolith, the great abyss:
My God, it’s full of stars…
–2001: A Space Odyssey, David Bowman, Beyond the Infinite