<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
	<channel>
		<language>en_GB</language>
		<title>Articles Tagged with &quot;Programming&quot;</title>
		<link>http://tobyinkster.co.uk/tag/programming/</link>
		<description></description>
		<item>
			<title>29/03/2008: Cognition 0.1 Alpha 6</title>
			<link>http://tobyinkster.co.uk/blog/2008/03/29/cognition-alpha6/</link>
			<description>&lt;p&gt;Tonight I&amp;#8217;ve released another alpha version of &lt;a href=&quot;http://buzzword.org.uk/cognition/&quot;&gt;Cognition&lt;/a&gt;, my semantic web parser. Changelog includes:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Microformats:&lt;/em&gt;
&lt;ul&gt;
&lt;li&gt;Add option (disabled by default) to require &lt;code class=&quot;html&quot;&gt;&amp;lt;head profile&amp;gt;&lt;/code&gt; for microformat support. Microformat profiles are treated as &lt;strong&gt;opaque strings&lt;/strong&gt;! Supports the following profiles:
&lt;ul&gt;
&lt;li&gt;http://purl.org/uF/2008/03/&lt;/li&gt;
&lt;li&gt;http://www.w3.org/2006/03/hcard or http://purl.org/uF/hCard/1.0/&lt;/li&gt;
&lt;li&gt;http://dannyayers.com/microformats/hcalendar-profile or http://purl.org/uF/hCalendar/1.0/&lt;/li&gt;
&lt;li&gt;http://purl.org/uF/hAtom/0.1/&lt;/li&gt;
&lt;li&gt;http://purl.org/uF/rel-tag/1.0/&lt;/li&gt;
&lt;li&gt;http://purl.org/uF/rel-license/1.0/&lt;/li&gt;
&lt;li&gt;No profiles required for rel-enclosure, adr or geo (yet).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Support for hAtom, WebSlices.
&lt;ul&gt;
&lt;li&gt;In addition to hAtom 0.1, rel-enclosure is supported within hEntries.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Improve include-pattern support to prevent some infinite loops.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;span class=&quot;caps&quot;&gt;GRDDL&lt;/span&gt;:&lt;/em&gt;
&lt;ul&gt;
&lt;li&gt;Add option (disabled by default) to require &lt;head profile&gt; for &lt;span class=&quot;caps&quot;&gt;GRDDL.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Add option to check profile &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;s for&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
		</item>
		<item>
			<title>22/01/2008: CSS to HTML Compiler</title>
			<link>http://tobyinkster.co.uk/blog/2008/01/22/css-compile/</link>
			<description>&lt;p&gt;I&amp;#8217;ve searched around the &amp;#8216;Net for something like this before, but without success, so decided to write my own. The basic idea is this: there are certain circumstances in which you need to write some styled &lt;acronym title=&quot;Hypertext Markup Language&quot;&gt;HTML&lt;/acronym&gt; without access to the document&amp;#8217;s header. For example, when composing &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;-formatted e-mails, which may be displayed in a web-based e-mail client; when adding content to limited content-management system; or in an &lt;a href=&quot;http://www.ebay.co.uk&quot;&gt;eBay&lt;/a&gt; auction description. In such a situation, you can&amp;#8217;t (validly) include a &lt;code class=&quot;html&quot;&gt;&amp;lt;link rel=&amp;quot;stylesheet&amp;quot;&amp;gt;&lt;/code&gt; element, nor a &lt;code class=&quot;html&quot;&gt;&lt;style&gt;...&lt;/style&gt;&lt;/code&gt; block (if you &lt;strong&gt;do&lt;/strong&gt; include such a construct it may just about work, but the document will not be valid), so instead you are reduced to using &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;&lt;code class=&quot;html&quot;&gt;style&lt;/code&gt; attributes all over the place.&lt;/p&gt;

&lt;p&gt;However, it is slow work using &lt;code class=&quot;html&quot;&gt;style&lt;/code&gt; attributes as you can&amp;#8217;t take advantage of &lt;acronym title=&quot;Cascading Style Sheet&quot;&gt;CSS&lt;/acronym&gt; selectors. Instead&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>06/01/2008: dhyana.pl/0.3</title>
			<link>http://tobyinkster.co.uk/blog/2008/01/06/dhyana/</link>
			<description>&lt;p&gt;Here&amp;#8217;s my latest update to &lt;a href=&quot;/tag/dhyana/&quot;&gt;dhyana.pl&lt;/a&gt;&amp;#8230;&lt;/p&gt;

&lt;h2&gt;Change Log&lt;/h2&gt;


&lt;ul&gt;
&lt;li&gt;Added a title to the output image, which can be in a different font and colour from the rest of the text.&lt;/li&gt;
&lt;li&gt;Use Getopt to parse command line, and accept more options.&lt;/li&gt;
&lt;li&gt;Improved handling of certain dodgy &lt;span class=&quot;caps&quot;&gt;WMV &lt;/span&gt;files, mostly thanks to Matt Pinkham.&lt;/li&gt;
&lt;li&gt;Improved use of &lt;span class=&quot;caps&quot;&gt;FFMPEG&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Code straightened out to use functions&amp;nbsp;&amp;#8212; it used to be one big long mess.&lt;/li&gt;
&lt;li&gt;Added a help function&amp;nbsp;&amp;#8212; just run the program with the &lt;tt&gt;&amp;#8212;help&lt;/tt&gt; paramater.&lt;/li&gt;
&lt;/ul&gt;



&lt;h2&gt;Requirements&lt;/h2&gt;


&lt;ul&gt;
&lt;li&gt;Perl Getopt::ArgvFile&lt;/li&gt;
&lt;li&gt;Perl Getopt::Long &amp;#8805; 2.33&lt;/li&gt;
&lt;li&gt;Perl Pod::Usage;&lt;/li&gt;
&lt;li&gt;mplayer&lt;/li&gt;
&lt;li&gt;ImageMagick&lt;/li&gt;
&lt;/ul&gt;



&lt;h3&gt;Optional&lt;/h3&gt;


&lt;ul&gt;
&lt;li&gt;Perl File::chdir&lt;/li&gt;
&lt;li&gt;Perl File::Spec&lt;/li&gt;
&lt;li&gt;Perl Cwd&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;FFMPEG&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;All of the Perl modules can be found in &lt;a href=&quot;http://www.cpan.org&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CPAN&lt;/span&gt;&lt;/a&gt;, here is the &lt;a href=&quot;http://ffmpeg.mplayerhq.hu/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;FFMPEG&lt;/span&gt;&lt;/a&gt; site and here is &lt;a href=&quot;http://mplayerhq.hu/&quot;&gt;mplayer&lt;/a&gt;. And don&amp;#8217;t forget &lt;a href=&quot;http://imagemagick.org&quot;&gt;ImageMagick&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Download&lt;/h2&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;/blog/2008/01/06/dhyana/files/dhyana.pl&quot;&gt;Perl script&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/blog/2008/01/06/dhyana/files/dhyana.pl.html&quot; title=&quot;for viewing online&quot;&gt;Source code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
		</item>
		<item>
			<title>18/11/2007: Dhyana.pl Updated</title>
			<link>http://tobyinkster.co.uk/blog/2007/11/18/dhyana/</link>
			<description>&lt;p&gt;This release works around errors in capturing screen shots from certain &lt;span class=&quot;caps&quot;&gt;WMV &lt;/span&gt;files. It also changes the default geometry from 240&amp;#215;180+0+0 to &amp;#8220;auto&amp;#8221; which is an automatically calculated, hopefully appropriate, geometry.&lt;/p&gt;</description>
		</item>
		<item>
			<title>19/08/2007: Sequential Video Thumbnails on Linux</title>
			<link>http://tobyinkster.co.uk/blog/2007/08/19/dhyana/</link>
			<description>&lt;p&gt;So, I was looking for a way to create sequential video thumbnails (&lt;a href=&quot;/blog/2007/08/19/dhyana/files/pb-s02e03.jpeg&quot;&gt;like this one&lt;/a&gt;) from a video file on Linux. I found that my options were severely limited. On Windows there are a plethora of tools capable of this fairly simple task, including &lt;a href=&quot;http://sourceforge.net/projects/guliverkli/&quot;&gt;Media Player Classic&lt;/a&gt;, but on Linux all I could find was &lt;a href=&quot;http://developer.berlios.de/projects/qframecatcher/&quot;&gt;QFrameCatcher&lt;/a&gt;. The QFrameCatcher website was inaccessible yesterday; today I managed to download the source code, but couldn&amp;#8217;t get it to build.&lt;/p&gt;

&lt;p&gt;Anyway, I decided it probably wouldn&amp;#8217;t be very difficult to build my own so&amp;#8230;&lt;/p&gt;

&lt;h2&gt;dhyana.pl&lt;/h2&gt;

&lt;p&gt;dhyana.pl is a small Perl script that co-ordinates &lt;a href=&quot;http://mplayerhq.hu&quot;&gt;mplayer&lt;/a&gt; and &lt;a href=&quot;http://imagemagick.org&quot;&gt;ImageMagick&lt;/a&gt; to create a lovely montage of thumbnails. (Dyhana&amp;nbsp;&amp;#8212; roughly pronounced as &lt;em&gt;&amp;#8220;jahna&amp;#8221;&lt;/em&gt;&amp;nbsp;&amp;#8212; is the Sanskrit word for a deep meditation.)&lt;/p&gt;</description>
		</item>
		<item>
			<title>12/08/2007: PHP Debugging with Style -OR- How I Learned to Stop Worrying and Love the Bug</title>
			<link>http://tobyinkster.co.uk/blog/2007/08/12/php-debugging-with-style/</link>
			<description>&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;lets you &lt;a href=&quot;http://www.php.net/set-error-handler&quot;&gt;define your own error handler&lt;/a&gt;, so I decided to get a bit fancy. MegaErrorHandler (&lt;a href=&quot;http://groups.google.com/groups?q=spacegirl+meh&quot;&gt;&lt;span class=&quot;caps&quot;&gt;MEH&lt;/span&gt;&lt;/a&gt;) outputs its errors as specially-formatted &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;comments, with the details of the error encoded using &lt;a href=&quot;http://json.org/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A small client-side script, with an associated stylesheet then pulls this data out of the comments and formats it as a nice little interactive bug-viewing console, allowing you to view a stack trace for each bug, inspect superglobals, view the syntax-highlighted source code for the file where the error occurred, check the list of defined constants and other useful things&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>20/07/2007: Parsing an HTML Table with PEAR's XML_HTMLSax3</title>
			<link>http://tobyinkster.co.uk/blog/2007/07/20/html-table-parsing/</link>
			<description>&lt;p&gt;Here&amp;#8217;s an example of how to parse an &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;table into an array using the &lt;a href=&quot;http://pear.php.net&quot;&gt;&lt;span class=&quot;caps&quot;&gt;PEAR&lt;/span&gt;&lt;/a&gt; module &lt;strong&gt;&lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;_HTMLSax3&lt;/strong&gt;. It supports the &lt;code class=&quot;html&quot;&gt;&amp;lt;tr&amp;gt;&lt;/code&gt;, &lt;code class=&quot;html&quot;&gt;&amp;lt;td&amp;gt;&lt;/code&gt; and &lt;code class=&quot;html&quot;&gt;&amp;lt;th&amp;gt;&lt;/code&gt; elements and the &lt;code class=&quot;html&quot;&gt;rowspan&lt;/code&gt; and &lt;code class=&quot;html&quot;&gt;colspan&lt;/code&gt; attributes&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>19/07/2007: PHP Domain Class</title>
			<link>http://tobyinkster.co.uk/blog/2007/07/19/php-domain-class/</link>
			<description>&lt;p&gt;On Usenet an often-asked question is how to programmatically determine the &amp;#8220;domain&amp;#8221; of a particular hostname. That is, excluding the components traditionally thought of as subdomains. As an example, &lt;tt&gt;groups.google.com&lt;/tt&gt; and &lt;tt&gt;www.google.com&lt;/tt&gt; both have a domain of &lt;tt&gt;google.com&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Invariably, one answer comes back stating that you just need to chop off everything from the front, leaving only the last two components. But then someone will chime in pointing out that &lt;tt&gt;groups.google.co.uk&lt;/tt&gt; would be left as just &lt;tt&gt;co.uk&lt;/tt&gt; that way, when what is really wanted is &lt;tt&gt;google.co.uk&lt;/tt&gt;. And the eventual resolution of the argument will be &amp;#8220;it just can&amp;#8217;t be done&amp;#8221;.&lt;/p&gt;

&lt;p&gt;The problem is that there&amp;#8217;s technically no difference between a domain and a subdomain: it&amp;#8217;s simply a matter of convention. Fortunately, this issue is actually quite important to browser programmers, as it&amp;#8217;s a key issue in cookie security: browsers must allow subdomains within a domain to share cookie data, but not allow cookies&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>17/07/2007: PHP vs Perl</title>
			<link>http://tobyinkster.co.uk/blog/2007/07/17/php-vs-perl/</link>
			<description>&lt;p&gt;Here&amp;#8217;s a simple program which calculates, to eight decimal places, the value of &lt;a href=&quot;http://en.wikipedia.org/wiki/Golden_ratio&quot;&gt;the Golden Ratio &amp;phi;&lt;/a&gt; implemented in both &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;and Perl, to demonstrate their similarities&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>17/07/2007: Pretty Printing for PHP</title>
			<link>http://tobyinkster.co.uk/blog/2007/07/17/php-pretty-printer/</link>
			<description>&lt;p&gt;Here&amp;#8217;s a &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;function for reformatting the whitespace in &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;code&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>19/04/2007: The Importance of Software Testing</title>
			<link>http://tobyinkster.co.uk/blog/2007/04/19/mgs/</link>
			<description>&lt;p&gt;Most programmers, especially those who work on server software, will have been in a situation when we&amp;#8217;ve been reconfiguring, upgrading, modifying or otherwise replacing some piece of vital software on a physically remote server, and things haven&amp;#8217;t gone quite as expected.&lt;/p&gt;

&lt;p&gt;Often, fixing it is a simple matter of logging into the server remotely (via, say, secure shell) and reversing the change. In some extreme cases, the problem is so severe though, that it can&amp;#8217;t be fixed remotely&amp;nbsp;&amp;#8212; for example, you&amp;#8217;ve managed to accidentally halt the machine, so you can&amp;#8217;t log into it remotely and it needs a restart. In such a situation, you&amp;#8217;ll need to physically go over to the server (or phone someone and have them do so) and fix the problem.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;NASA&amp;#8217;&lt;/span&gt;s Mars Global Surveyor (MGS) was launched in November 1996. Fast forward almost a decade and a couple of bugs in a firmware update end up swivelling the antena further than the antenna was built to go. This led to the craft reorienting itself and exposing one of its batteries&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>16/04/2007: Create Your Own Dan Brown Novel</title>
			<link>http://tobyinkster.co.uk/blog/2007/04/16/dan-brown/</link>
			<description>&lt;p&gt;I put this together back in January 2006, but never mentioned it on my website&amp;nbsp;&amp;#8212; I just posted it on a couple of newsgroups. It&amp;#8217;s pretty good fun and rather realistic.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/Software/dan_brown/&quot;&gt;Create your own Dan Brown novel&lt;/a&gt;&lt;/p&gt;</description>
		</item>
		<item>
			<title>08/04/2007: How PHP programmers get things wrong</title>
			<link>http://tobyinkster.co.uk/blog/2007/04/08/php-wrong/</link>
			<description>&lt;p&gt;Firstly, three disclaimers: &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;is a great programming language, one of my favourites&amp;nbsp;&amp;#8212; this website is written in &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt;; there are many great &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;programmers out there, some of whom probably never get things wrong; I probably get things wrong a lot of the time.&lt;/p&gt;

&lt;p&gt;The majority of the database-backed Open Source &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;projects that I&amp;#8217;ve used/examined make the same flaw again and again&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>08/04/2007: Hurrah! A Blog for Toby!</title>
			<link>http://tobyinkster.co.uk/blog/2007/04/08/new-blog/</link>
			<description>&lt;p&gt;At last, my new &lt;span class=&quot;caps&quot;&gt;CMS &lt;/span&gt;is at a stage when I&amp;#8217;m able to actually start publishing with it. Now that I have an easy-ish tool to publish with, you can expect that this website will be updated more frequently and with more and better content.&lt;/p&gt;

&lt;p&gt;Updating this website in the past has been a major pain. I took a look at installing an off-the-shelf blogging engine to help me run the site, and after much research decided that &lt;a href=&quot;http://wordpress.org/&quot;&gt;Wordpress&lt;/a&gt; was the best of breed. After two days playing with it, I abandoned it&amp;nbsp;&amp;#8212; it didn&amp;#8217;t do everything I wanted out of a blogging engine, and the mess of &lt;span class=&quot;caps&quot;&gt;PHP &lt;/span&gt;code would have made modifications to Wordpress painful.&lt;/p&gt;

&lt;p&gt;And so in early 2006, I decided to embark upon my own blogging engine. I posted my &lt;a href=&quot;http://groups.google.com/group/alt.www.webmaster/msg/5218faa47068013a?dmode=source&quot;&gt;initial ideas&lt;/a&gt; to Usenet in February 2006 and asked for feedback. I got a few useful suggestions and started development later that month, calling the project&amp;#8230;&lt;/p&gt;</description>
		</item>
		<item>
			<title>04/04/2007: Re: Building a &quot;modular&quot; PHP site</title>
			<link>http://tobyinkster.co.uk/blog/2007/04/04/plugins/</link>
			<description>&lt;p&gt;Tyno Gendo wrote:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;I have been pondering over building a &amp;#8220;modular&amp;#8221; site which accepts add-ons built by other people. I was wondering if anyone has any links to any reading material on how you build this kind of facility into your site?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The basic technique is this:&lt;/p&gt;

&lt;p&gt;Firstly, provide a plugin registration function, which we&amp;#8217;ll call, say, &amp;#8220;plugin_register&amp;#8221;. When a plugin is loaded, it will call your plugin_register function and tell your site at least the following information:&lt;/p&gt;


&lt;ol&gt;
&lt;li&gt;How to use the plugin&amp;nbsp;&amp;#8212; i.e. provide a function name or a class name that the site can use to access the functionality of the plugin;&lt;/li&gt;
&lt;li&gt;When to use the plugin&amp;nbsp;&amp;#8212; this is normally done via a named hook&amp;#8230;&lt;/li&gt;
&lt;/ol&gt;

</description>
		</item>
	</channel>
</rss>
