<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>adamhopkinson.co.uk</title>
	
	<link>http://adamhopkinson.co.uk/blog</link>
	<description />
	<lastBuildDate>Thu, 26 Aug 2010 22:17:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-RC1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/adamhopkinson" /><feedburner:info uri="adamhopkinson" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><item>
		<title>Sharpen an image using PHP and GD</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/k0tYD3Y5UvQ/</link>
		<comments>http://adamhopkinson.co.uk/blog/2010/08/26/sharpen-an-image-using-php-and-gd/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 22:17:44 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sharpen]]></category>

		<guid isPermaLink="false">http://adamhopkinson.co.uk/blog/?p=153</guid>
		<description><![CDATA[PHP and GD can be used to sharpen images on the fly - read on to find out how.]]></description>
			<content:encoded><![CDATA[<p>PHP and GD can sharpen images by providing a matrix to <code>imageconvolution</code>:</p>
<pre>// create the image resource from a file
$i = imagecreatefromjpeg('otter.jpg');

// define the sharpen matrix
$sharpen = array(
	array(0.0, -1.0, 0.0),
	array(-1.0, 5.0, -1.0),
	array(0.0, -1.0, 0.0)
);

// calculate the sharpen divisor
$divisor = array_sum(array_map('array_sum', $sharpen));

// apply the matrix
imageconvolution($i, $sharpen, $divisor, 0);

// output the image
header('Content-Type: image/jpeg');
imagejpeg($i);</pre>
<div id="attachment_157" class="wp-caption aligncenter" style="width: 424px"><img class="size-full wp-image-157" title="Otter, before and after sharpening" src="http://adamhopkinson.co.uk/blog/wordpress/wp-content/uploads/2010/08/otter.jpg" alt="Otter, before and after sharpening" width="414" height="164" /><p class="wp-caption-text">Otter, before and after sharpening</p></div>
<p><a title="Image credit" href="http://www.flickr.com/photos/kevenlaw/" target="_blank">Image courtesy Kevin Law</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=k0tYD3Y5UvQ:t4VO1SAspXE:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=k0tYD3Y5UvQ:t4VO1SAspXE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=k0tYD3Y5UvQ:t4VO1SAspXE:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2010/08/26/sharpen-an-image-using-php-and-gd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2010/08/26/sharpen-an-image-using-php-and-gd/</feedburner:origLink></item>
		<item>
		<title>ZooPHP – a PHP wrapper for Zootool</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/a4ljgjwg77I/</link>
		<comments>http://adamhopkinson.co.uk/blog/2010/04/12/zoophp-a-php-wrapper-for-zootool/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 22:31:15 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zootool]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/blog/?p=132</guid>
		<description><![CDATA[Zootool is fast becoming the most practical and funkiest way to bookmark online. With the recent addition of an API, I've created a PHP wrapper to ease embedding of Zootool data.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a title="Zootool bookmarks" href="http://zootool.com">Zootool</a> more and more recently to bookmark things I see on the web. The visual representation of saved items works better for me than <a title="Delicious bookmarking" href="http://delicious.com">Delicious</a> and browser bookmarks are a non-starter these days.</p>
<p>Since the news of an API last week, I&#8217;ve been working on a little class wrapper &#8211; partly to hone my OOP skills and partly to support some great work by Bastian &#8211; and my class is now ready. I&#8217;ve named it ZooPHP.</p>
<pre>$zoo = new ZooPHP($key, $secret);
$zoo->getPopularItems();</pre>
<p><span id="more-132"></span></p>
<p>To start using ZooPHP, you&#8217;ll need a <a href="http://zootool.com/api/keys">Zootool API key</a>. The script is released under a BSD license and is documented, but should be fairly self-explanatory:</p>
<pre>$zoo-&gt;setAuth('username', 'password');
$zoo-&gt;setFormat('array');
$zoo-&gt;getUser('bastian');
$zoo-&gt;getUserFriends('bastian');
$zoo-&gt;getUserFollowers('bastian');
$zoo-&gt;getUserItems('bastian');
$zoo-&gt;getLatestItems();
$zoo-&gt;getItem('iw6og3');
$zoo-&gt;getPopularItems();
$zoo-&gt;addItem('adamhopkinson.co.uk', 'adamhopkinson.co.uk', 'zoophp, php, wrapper');</pre>
<p>You&#8217;ll only need to call <code>setAuth</code> if you want to <code>add</code> items or return private items with <code>getItems</code>.</p>
<p><a class="download" title="Download ZooPHP" href="/files/code/zoophp/zoophp.zip">Click here to download your copy of ZooPHP »</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=a4ljgjwg77I:Aij1N0KAwi0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=a4ljgjwg77I:Aij1N0KAwi0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=a4ljgjwg77I:Aij1N0KAwi0:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2010/04/12/zoophp-a-php-wrapper-for-zootool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2010/04/12/zoophp-a-php-wrapper-for-zootool/</feedburner:origLink></item>
		<item>
		<title>Firefox Themes causing out of position pixels</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/MgwYTUoiL3o/</link>
		<comments>http://adamhopkinson.co.uk/blog/2009/08/14/firefox-themes-causing-out-of-position-pixels/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 11:22:54 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/blog/?p=127</guid>
		<description><![CDATA[That Web Guy had a problem with a design not being pixel perfect &#8211; only it turned out to be down to the theme he was using in Firefox. Bug?]]></description>
			<content:encoded><![CDATA[<p><cite>That Web Guy</cite> had a problem with a design not being pixel perfect &#8211; only it turned out to be <a href="http://www.thatwebguyblog.com/show_article.php?id=2673">down to the theme he was using in Firefox</a>. Bug?</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=MgwYTUoiL3o:_KywxeezsAc:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=MgwYTUoiL3o:_KywxeezsAc:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=MgwYTUoiL3o:_KywxeezsAc:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2009/08/14/firefox-themes-causing-out-of-position-pixels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2009/08/14/firefox-themes-causing-out-of-position-pixels/</feedburner:origLink></item>
		<item>
		<title>Google Reader adds filters to ‘Mark as Read’</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/BZt-7cf-xGY/</link>
		<comments>http://adamhopkinson.co.uk/blog/2009/08/13/google-reader-adds-filters-to-mark-as-read/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 22:39:29 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[google reader]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[webapp]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/blog/?p=124</guid>
		<description><![CDATA[Feed subscribers can now declare partial feedreader bankruptcy thanks to an update to Google Reader.]]></description>
			<content:encoded><![CDATA[<p>Users of Google Reader can now declare partial feedreader bankruptcy &#8211; feeds older than a day, a week or two weeks can now be marked as read, rather than wiping everything.</p>
<div id="attachment_125" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-125" title="Google Reader - Mark as Read" src="http://www.adamhopkinson.co.uk/blog/wordpress/wp-content/uploads/2009/08/Picture-1-300x73.png" alt="Filtering which items to flush in Google Reader" width="300" height="73" /><p class="wp-caption-text">Filtering which items to flush in Google Reader</p></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=BZt-7cf-xGY:ugE1gEKfPkI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=BZt-7cf-xGY:ugE1gEKfPkI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=BZt-7cf-xGY:ugE1gEKfPkI:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2009/08/13/google-reader-adds-filters-to-mark-as-read/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2009/08/13/google-reader-adds-filters-to-mark-as-read/</feedburner:origLink></item>
		<item>
		<title>Orbicule and MobileMe to overlap functionality</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/YPk7rdkZe34/</link>
		<comments>http://adamhopkinson.co.uk/blog/2009/06/29/orbicule-and-mobileme-to-overlap-functionality/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 12:27:43 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[appstore]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[orbicule]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/blog/?p=120</guid>
		<description><![CDATA[In a post on forthcoming OS support for Orbicule, support for sending a message to an iphone and remotely playing a noise is mentioned. With the recent release of iPhone OS 3.0, these are the major selling factors Apple is&#160;&#8230; <a href="http://adamhopkinson.co.uk/blog/2009/06/29/orbicule-and-mobileme-to-overlap-functionality/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In a post on <a title="Orbicule: Looking forward" href="http://www.orbicule.com/blog/2009/06/preparing-for-future.html">forthcoming OS support for Orbicule</a>, support for sending a message to an iphone and remotely playing a noise is mentioned. With the recent release of iPhone OS 3.0, these are the major selling factors Apple is using to entice users to MobileMe.</p>
<p>With all the reports over the approval process for apps being submitted to App Store, can Orbicule guarantee that their app will get through with these features? <a title="Podcaster refused by Apple" href="http://www.pcworld.com/article/151026/podcasting_app_rejected_from_the_app_store.html">Apple previously refused to approve </a><em><a title="Podcaster refused by Apple" href="http://www.pcworld.com/article/151026/podcasting_app_rejected_from_the_app_store.html">Podcaster</a></em> on the grounds that it duplicated the functionality of the podcast section of iTunes.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=YPk7rdkZe34:JfYIvC3JQn0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=YPk7rdkZe34:JfYIvC3JQn0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=YPk7rdkZe34:JfYIvC3JQn0:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2009/06/29/orbicule-and-mobileme-to-overlap-functionality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2009/06/29/orbicule-and-mobileme-to-overlap-functionality/</feedburner:origLink></item>
		<item>
		<title>WordPress plugin: External Files</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/h90iWxC60vA/</link>
		<comments>http://adamhopkinson.co.uk/blog/2009/06/24/wordpress-plugin-external-files/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 19:13:53 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/blog/?p=116</guid>
		<description><![CDATA[External Files is a WordPress plugin which allows authors to insert code snippets from a file or url and automatically syntax highlights the code. Authors can specify the lines to show (or show the whole file/url) and override the automatic&#160;&#8230; <a href="http://adamhopkinson.co.uk/blog/2009/06/24/wordpress-plugin-external-files/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>External Files</em> is a WordPress plugin which allows authors to insert code snippets from a file or url and automatically syntax highlights the code. Authors can specify the lines to show (or show the whole file/url) and override the automatic highlighting option.</p>
<p>To use, put your file path/url in the shortcode [external].</p>
<p><a title="External Files" href="http://wordpress.org/extend/plugins/external-files">Click here to download </a><em><a title="External Files" href="http://wordpress.org/extend/plugins/external-files">External Files</a></em></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=h90iWxC60vA:_NuVSF1L4H0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=h90iWxC60vA:_NuVSF1L4H0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=h90iWxC60vA:_NuVSF1L4H0:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2009/06/24/wordpress-plugin-external-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2009/06/24/wordpress-plugin-external-files/</feedburner:origLink></item>
		<item>
		<title>WordPress Plugin: Feed Extensions</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/t4mCLY4KC74/</link>
		<comments>http://adamhopkinson.co.uk/blog/2008/12/18/wordpress-plugin-feed-extensions/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 21:21:19 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/blog/?p=105</guid>
		<description><![CDATA[Feed Extensions is a new plugin that allows you to add a footer to the end of each post in your feed. The content can be added via the settings page (under Settings » RSS Extensions) and comes with a&#160;&#8230; <a href="http://adamhopkinson.co.uk/blog/2008/12/18/wordpress-plugin-feed-extensions/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Feed Extensions is a new plugin that allows you to add a footer to the end of each post in your feed. The content can be added via the settings page (under Settings » RSS Extensions) and comes with a set of inserts which can be used to show various things such as the blog url, a security hash of the post or  the author name.</p>
<p>The plugin will be available very soon.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=t4mCLY4KC74:A4idE201Ito:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=t4mCLY4KC74:A4idE201Ito:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=t4mCLY4KC74:A4idE201Ito:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2008/12/18/wordpress-plugin-feed-extensions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2008/12/18/wordpress-plugin-feed-extensions/</feedburner:origLink></item>
		<item>
		<title>Add an address lookup to your web forms – Part 1</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/c3qXRGrOxAE/</link>
		<comments>http://adamhopkinson.co.uk/blog/2007/05/13/add-an-address-lookup-to-your-web-forms-part-1/#comments</comments>
		<pubDate>Sun, 13 May 2007 12:49:35 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/blog/2007/05/13/add-an-address-lookups-to-your-web-forms-part-1/</guid>
		<description><![CDATA[In this tutorial I&#8217;m going to show you how to add an inline address lookup to your web forms using the PostcodeAnywhere webservice and the Yahoo! Connection Manager. Get a PCA account First, you&#8217;ll need to sign up to Postcode&#160;&#8230; <a href="http://adamhopkinson.co.uk/blog/2007/05/13/add-an-address-lookup-to-your-web-forms-part-1/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I&#8217;m going to show you how to add an inline address lookup to your web forms using the <a href="http://www.postcodeanywhere.co.uk/" title="PostcodeAnywhere">PostcodeAnywhere</a> webservice and the Yahoo! <a href="http://developer.yahoo.com/yui/connection/" title="Yahoo Connection Manager">Connection Manager</a>.</p>
<p><span id="more-102"></span></p>
<h3>Get a PCA account</h3>
<p>First, you&#8217;ll need to sign up to Postcode Anywhere and add some credits. A beginner pack of 300 credits will set you back Â£25+VAT and will get you 300 address lookups (if you only want the basic details returned for each address).</p>
<h3>Use PHP to build the webservice client</h3>
<p>An AJAX lookup works by passing some data to a script on the webserver, which performs some translation (in our case, connects to the webservice) and returns the result to the page where javascript makes the updates. Create a new php file on your webserver call getpostcode.php</p>
<p>Set up the defaults for the lookup:</p>
<pre name="code" class="php:nogutter">
&lt;?php

$account_code = 'PCA_ACCOUNT';
$license_code = 'PCA_LICENCE';

$postcode = '';
$building = '';

?&gt;</pre>
<p>Then, get the postcode and building number or name from the query string:</p>
<pre name="code" class="php:nogutter">
if ( array_key_exists('postcode', $_QUERY) ) {
	$postcode = $_QUERY['postcode'];
}

if ( array_key_exists('building', $_QUERY) ) {
	$building = $_QUERY['building'];
}</pre>
<p>Then we have to build the REST url that will ask the webservice for the address:</p>
<pre name="code" class="php:nogutter">
$url = 'http://services.postcodeanywhere.co.uk/csv.aspx?';
$url .= 'account_code=' . $account_code;
$url .= '&amp;license_code=' . $license_code;
$url .= '&amp;action=fetch';
$url .= '&amp;postcode=' . $postcode;
$url .= '&amp;building=' . $building;
$url .= '&amp;style=simple';</pre>
<p>Use the php file function to get the data from the webservice into a variable called $data</p>
<pre name="code" class="php:nogutter">$data = file($url);</pre>
<p>We&#8217;ve asked the webservice to return the data in csv format, so we&#8217;re expecting two lines. The first will contain the field names and the second will contain the values. First, we want to return an error if the webservice call failed:</p>
<pre name="code" class="php:nogutter">
if(!$data) {
	die('{"status":"error"}');
}</pre>
<p>The status: error message is in JSON format so that it can be understood by the javascript which will handle the address lookup.</p>
<p>The php file function returns an array, with each line in a different array element &#8211; so the first line will be in $data[0] and the second in $data[1] (arrays always start at 0 not 1!).</p>
<p>Next we want to trim any whitespace such as spaces or newline characters from the end of each line:</p>
<pre name="code" class="php:nogutter">$data[0] = trim($data[0]);
$data[1] = trim($data[1]);</pre>
<p>then we trim all extra speech marks from the start and end to help us split the lines up</p>
<pre name="code" class="php:nogutter">$data[0] = trim($data[0], '"');
$data[1] = trim($data[1], '"');</pre>
<p>Now we can split the lines into two arrays, one for field names and one for values</p>
<pre name="code" class="php:nogutter">$field_names = explode('","', $data[0]);
$field_values = explode('","', $data[1]);</pre>
<p>and throw up an error if the number of fields isn&#8217;t the same as the number of values</p>
<pre name="code" class="php:nogutter">if(count($field_names) != count($field_values)) {
	die('{"status":"error"}');
}</pre>
<p>Empty the $data array and loop through the field names and values, building up an array of name =&gt; value pairs</p>
<pre name="code" class="php:nogutter">$data = array();

for($counter = 0; $counter &lt; count($field_names); $counter++) {
	$data[$field_names[$counter]] = $field_values[$counter];
}</pre>
<p>PostcodeAnywhere returns a field called error_number if there&#8217;s a problem in the request. If this field exists, return an error to the form:</p>
<pre name="code" class="php:nogutter">if(array_key_exists('error_number', $data)) {
	die('{"status":"error"}');
}</pre>
<p>Finally, output the data in JSON format:</p>
<pre name="code" class="php:nogutter">$output = '';
foreach($data AS $key=&gt;$value) {
	$output .= '"' . $key . '":"' . $value . '",';
}
//$output = trim($output, ',');
$output = '{"status":"ok",' . $output . '}';
echo $output;</pre>
<p>In part 2, we&#8217;ll look at how to use the Yahoo Connection Manager to put this data on your form. Check back in a few days&#8230;</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=c3qXRGrOxAE:jdP7kJf_mdU:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=c3qXRGrOxAE:jdP7kJf_mdU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=c3qXRGrOxAE:jdP7kJf_mdU:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2007/05/13/add-an-address-lookup-to-your-web-forms-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2007/05/13/add-an-address-lookup-to-your-web-forms-part-1/</feedburner:origLink></item>
		<item>
		<title>Feed readers for OSX</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/tw6BNTX9im8/</link>
		<comments>http://adamhopkinson.co.uk/blog/2006/08/23/feed-readers-for-osx/#comments</comments>
		<pubDate>Wed, 23 Aug 2006 22:19:34 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/2006/08/23/feed-readers-for-osx/</guid>
		<description><![CDATA[It&#8217;s been a week since I bought my first Mac, and i&#8217;m starting to install software that I knew I could only manage a week without &#8211; the first of which is a feedreader. I use Newsgator online and therefore&#160;&#8230; <a href="http://adamhopkinson.co.uk/blog/2006/08/23/feed-readers-for-osx/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a week since I bought my first Mac, and i&#8217;m starting to install software that I knew I could only manage a week without &#8211; the first of which is a feedreader.</p>
<p>I use Newsgator online and therefore have a paid FeedDemon install on my Dell laptop, as these synchronise. This means I can read stuff in FeedDemon when i&#8217;m at my desk and Newsgator when i&#8217;m not without having to read the same items twice over.</p>
<p>This presents an obvious choice for a Mac feedreader &#8211; NetNewsWire (Lite). This also synchronises with Newsgator and so will save me a lot of time and effort during the daily catch-up.</p>
<p>I feel though that as Newsgator brought in each component, they have done the bare minimum to integrate it into the brand. Neither of the application-based readers under the Newsgator umbrella do any more than synch with Newsgator. Surely it would make more sense to have them support the same features and synchronise settings (ie flagged items, watch lists) with Newsgator instead of simply synchronising subscriptions. One step further would be to bring the same look and feel to both feedreaders &#8211; if iTunes can look the same on both Windows and Mac, then FeedDemon and NetNewsWire can.</p>
<p>RSS is a technology that is begging to be jumped on by the uneducated masses &#8211; as shown by the inclusion of feed readers in IE7 &#8211; but Newsgator don&#8217;t seem to have spotted this potential yet.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=tw6BNTX9im8:VDw83S9r4n0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=tw6BNTX9im8:VDw83S9r4n0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=tw6BNTX9im8:VDw83S9r4n0:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2006/08/23/feed-readers-for-osx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2006/08/23/feed-readers-for-osx/</feedburner:origLink></item>
		<item>
		<title>Windows-based Macs without OSX</title>
		<link>http://feedproxy.google.com/~r/adamhopkinson/~3/r7URa1oXypY/</link>
		<comments>http://adamhopkinson.co.uk/blog/2006/08/22/windows-based-macs-without-osx/#comments</comments>
		<pubDate>Tue, 22 Aug 2006 22:57:07 +0000</pubDate>
		<dc:creator>Adam Hopkinson</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.adamhopkinson.co.uk/2006/08/22/windows-based-macs-without-osx/</guid>
		<description><![CDATA[I was reading an article by Sam Gerstenzang entitled &#8216;Why Boot Camp is the Beginning of the End for Windows&#8216; (ok, so i&#8217;m four months behind on my feed-reading) and mostly I agree with his conclusion, that although Boot Camp&#160;&#8230; <a href="http://adamhopkinson.co.uk/blog/2006/08/22/windows-based-macs-without-osx/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was reading an article by Sam Gerstenzang entitled &#8216;<a title="Why Boot Camp is the Beginning of the End for Windows" href="http://www.samgerstenzang.com/blog/archives/2006/04/why-boot-camp-is-the-beginning-of-the-end-for-windows">Why Boot Camp is the Beginning of the End for Windows</a>&#8216; (ok, so i&#8217;m four months behind on my feed-reading) and mostly I agree with his conclusion, that although Boot Camp enables more of the market to run Windows, it will eventually cause the downfall of Windows itsself.</p>
<p>One thing that occurred to me is that even when (if?) Boot Camp is to be included in the upcoming OSX Leopard, users still need to run the program within OSX to install Windows on a Mac.</p>
<p>If I were Steve Jobs, I&#8217;d plan to integrate Boot Camp into the wizard that OSX launches (to configure the machine) when a new Mac is first used by the end user. If the options available were&#8230;</p>
<ol>
<li>Customise OSX</li>
<li>Customise OSX and install Windows</li>
<li>Just install Windows, and set it as the startup</li>
</ol>
<p>&#8230;Apple would be able to catch the market of users who will never want to leave Windows but do want a reliable and stylish machine. This wouldn&#8217;t necessarily speed up the downfall of Windows, but would bring Apple some of the market share currently owned by Dell, Lenovo and other large scale hardware manufacturers.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=r7URa1oXypY:GMdfX_oUIJo:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/adamhopkinson?a=r7URa1oXypY:GMdfX_oUIJo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/adamhopkinson?i=r7URa1oXypY:GMdfX_oUIJo:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://adamhopkinson.co.uk/blog/2006/08/22/windows-based-macs-without-osx/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://adamhopkinson.co.uk/blog/2006/08/22/windows-based-macs-without-osx/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.211 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-08-26 22:17:59 -->
