<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>David Carrington &#187; Development</title>
	<atom:link href="http://davidcarrington.co.uk/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidcarrington.co.uk</link>
	<description>UK web developer that loves phones</description>
	<lastBuildDate>Thu, 22 Jul 2010 11:19:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP needles and haystacks</title>
		<link>http://davidcarrington.co.uk/2010/07/php-needles-and-haystack/</link>
		<comments>http://davidcarrington.co.uk/2010/07/php-needles-and-haystack/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 07:19:40 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/?p=359</guid>
		<description><![CDATA[I was skim reading  &#8221;PHP &#8211; The Good Parts&#8221; yesterday to see if there was anything new in it. The following lines caught my eye – never knew this! The position of needle/haystack parameters in string functions is the reverse of the parameters in array functions. strstr($haystack, $needle) array_search($needle, $haystack) I just assumed the developers [...]]]></description>
			<content:encoded><![CDATA[<p>I was skim reading  &#8221;<a href="http://www.amazon.co.uk/gp/product/0596804377?ie=UTF8&amp;tag=davidcarri-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0596804377">PHP &#8211; The Good Parts</a>&#8221; yesterday to see if there was anything new in it. The following lines caught my eye – never knew this!</p>
<p><strong>The position of needle/haystack parameters in string functions is the reverse of the parameters in array functions.</strong></p>
<p><strong> </strong></p>
<p><strong>strstr($haystack, $needle)<br />
</strong><strong>array_search($needle, $haystack)</strong></p>
<p><strong> </strong></p>
<p>I just assumed the developers were completely insane and chose parameter orders at random.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2010/07/php-needles-and-haystack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dave on Usability</title>
		<link>http://davidcarrington.co.uk/2010/07/dave-on-usability/</link>
		<comments>http://davidcarrington.co.uk/2010/07/dave-on-usability/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 13:26:56 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/?p=352</guid>
		<description><![CDATA[A nice perk from working in the web development department at e2save.com: we&#8217;re allowed to buy books on the company credit card as long as we share the knowledge with the team afterwards. I decided to try this out by ordering the &#8220;Rocket Surgery Made Easy&#8220; by Steve Krug, the sequel to &#8220;Don&#8217;t Make Me Think&#8220;. [...]]]></description>
			<content:encoded><![CDATA[<p>A nice perk from working in the web development department at <a href="http://www.e2save.com">e2save.com</a>: we&#8217;re allowed to buy books on the company credit card as long as we share the knowledge with the team afterwards.</p>
<p>I decided to try this out by ordering the &#8220;<a href="http://www.amazon.co.uk/gp/product/0321657292?ie=UTF8&amp;tag=davidcarri-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0321657292">Rocket Surgery Made Easy</a>&#8220; by Steve Krug, the sequel to &#8220;<a href="http://www.amazon.co.uk/gp/product/0321344758?ie=UTF8&amp;tag=davidcarri-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0321344758">Don&#8217;t Make Me Think</a>&#8220;. I haven&#8217;t finished the sequel yet, but I thought it would benefit the team to do a 15 minute presentation on the original:</p>
<p><iframe src="http://docs.google.com/present/embed?id=ah2n9th89mcv_99fwdzggd7" frameborder="0" width="410" height="342"></iframe></p>
<p>I&#8217;m quite pleased with my <em>first ever</em> presentation (not including primary school). I assure you, it makes more sense if I&#8217;m standing there talking you through it!</p>
<p>Oh, and I&#8217;d highly recommend &#8220;<a href="http://www.amazon.co.uk/gp/product/0321344758?ie=UTF8&amp;tag=davidcarri-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0321344758">Don&#8217;t Make Me Think</a>&#8221; if you&#8217;re thinking of purchasing a web usability book. It really is quite good, although a little out of date.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2010/07/dave-on-usability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server XQuery and Namespaces</title>
		<link>http://davidcarrington.co.uk/2010/01/sql-server-xquery-and-namespaces/</link>
		<comments>http://davidcarrington.co.uk/2010/01/sql-server-xquery-and-namespaces/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 12:04:46 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[xmlns]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/?p=262</guid>
		<description><![CDATA[I just had a frustrating little SQL Server problem earlier today and would like to share the handy solution I found via Experts Exchange. SELECT ResponseXml.value('(//Reference)[1]', 'varchar(50)') FROM Transaction A fairly simple XQuery request of an XML column but annoyingly it didn&#8217;t work, and it turned out to to be because the ResponseXml had an [...]]]></description>
			<content:encoded><![CDATA[<p>I just had a frustrating little SQL Server problem earlier today and would like to share the handy solution I found via Experts Exchange.</p>
<p><code>SELECT ResponseXml.value('(//Reference)[1]', 'varchar(50)')<br />
FROM Transaction</code></p>
<p>A fairly simple XQuery request of an XML column but annoyingly it didn&#8217;t work, and it turned out to to be because the ResponseXml had an unnamed XML namespace, which SQL Server doesn&#8217;t handle too nicely.</p>
<p><code>&lt;Message xmlns="http://www.example.com/"&gt;<br />
  &lt;Reference&gt;123&lt;/Reference&gt;<br />
&lt;/Message&gt;</code></p>
<p>It&#8217;s the xmlns attribute (XML namespace) that causes the problem apparently, and the simplest solution I found was this snippet:</p>
<p><code>SELECT ResponseXml.value('declare default element namespace "http://www.example.com/"; (//Reference)[1]', 'varchar(50)')<br />
FROM Transaction</code></p>
<p>I just had to tell XQuery to use a different default namespace &#8211; a lot simpler than other suggested solutions such as removing the namespace from the XML.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2010/01/sql-server-xquery-and-namespaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Mobile Analytics and Opera Mini</title>
		<link>http://davidcarrington.co.uk/2009/12/google-mobile-analytics-and-opera-mini/</link>
		<comments>http://davidcarrington.co.uk/2009/12/google-mobile-analytics-and-opera-mini/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 22:36:12 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[Opera Mini]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/?p=175</guid>
		<description><![CDATA[Google Analytics is a popular web statistics site with lots of useful features, I&#8217;ve been a big fan since the start. Google recently added a bunch of new features, and an important one out of those for me is mobile web tracking. Typically, Google&#8217;s way of tracking site usage is to ask you to put [...]]]></description>
			<content:encoded><![CDATA[<p>Google Analytics is a popular web statistics site with lots of useful features, I&#8217;ve been a big fan since the start. Google <a href="http://analytics.blogspot.com/2009/12/holiday-bonus-more-great-features.html">recently added</a> a bunch of new features, and an important one out of those for me is <em>mobile web tracking</em>.</p>
<p>Typically, Google&#8217;s way of tracking site usage is to ask you to put a small snippet of HTML onto your site which is essentially a javascript call to their servers. Great &#8211; except a lot of mobile phones don&#8217;t actually support javascript. So the only good solution is to run some code on the server. I don&#8217;t know if it&#8217;s related to <a href="http://googleblog.blogspot.com/2009/11/investing-in-mobile-future-with-admob.html">Google&#8217;s purchase of AdMob</a>, but they&#8217;ve done exactly that and provided server side code in various programming languages (C#, PHP, etc) to achieve this. See <a href="https://ssl.gstatic.com/analytics/20091201/mobile/ga.php">ga.php</a> as a real example.</p>
<p>Great, now I&#8217;ve got beautiful graphs showing me how people use my site. But what&#8217;s that? 25% of my users live in the country <em>(not set)</em>? I&#8217;ve not heard of the place! It turns out those users more or less all used one browser: Opera Mini.</p>
<p><a href="http://www.flickr.com/photos/thox/4172396551/"><img class="alignright" title="Photo of Opera Mini looking at dabr.co.uk" src="http://farm3.static.flickr.com/2644/4172396551_09fa706773_m.jpg" alt="" width="180" height="240" /></a>Oh Opera Mini, what a strange beast you are. While the Opera browser is a full normal browser, Opera Mini is a service that installs a thin client on your phone and Norwegian proxy servers visit the site for you. Norway? Well that&#8217;s a little better than living in <em>(not set)</em>.</p>
<p>Luckily, this whole problem is fixed by a teensy change in their server side code. Rather than always fetching the browser&#8217;s current IP address, I tweaked Google&#8217;s PHP code so that it detects Opera Mini is in use and sends the real user&#8217;s IP address. To be honest, I&#8217;m a little confused why this isn&#8217;t in Google&#8217;s code in the first place.</p>
<p>So here it is. A minor fix to Google&#8217;s ga.php file (line 162) to improve Opera Mini handling:</p>
<p>Original line: <code>"&amp;utmip=" . getIP($_SERVER["REMOTE_ADDR"]);</code></p>
<p>and my version: <code> "&amp;utmip=" . getIP((stristr($_SERVER['HTTP_USER_AGENT'], 'opera mini') &amp;&amp; array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) ? $_SERVER['HTTP_X_FORWARDED_FOR']: $_SERVER["REMOTE_ADDR"]);</code></p>
<p>That&#8217;s all. Now I get real country stats :)</p>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2009/12/google-mobile-analytics-and-opera-mini/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dabr 2.0?</title>
		<link>http://davidcarrington.co.uk/2009/07/newdabr/</link>
		<comments>http://davidcarrington.co.uk/2009/07/newdabr/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 22:44:53 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Dabr]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/?p=143</guid>
		<description><![CDATA[The other day I created a new Twitter account: @newdabr. I had a burst of creative thought and rushed some code to achieve this live demo. It really isn&#8217;t much to look at, but what the site is doing is a big improvement over the original @Dabr. Storage Dabr.co.uk stores nothing. Seriously. Well, ok, it [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I created a new Twitter account: @newdabr. I had a burst of creative thought and rushed some code to achieve this <a title="Dabr 2.0?" href="http://dabr2.davidcarrington.co.uk/">live demo</a>. It really isn&#8217;t much to look at, but what the site is <em>doing</em> is a big improvement over the original @Dabr.<span id="more-143"></span></p>
<p><strong>Storage</strong></p>
<p>Dabr.co.uk stores <em>nothing</em>. Seriously. Well, ok, it logs visits like 99% of websites do on the net. It doesn&#8217;t store logins, users, tweets, settings, anything. That&#8217;s great in terms of cheaper hosting for me but it restricts what I can make the code do.</p>
<p>@newdabr is different. Very different. Every minute it asks Twitter: &#8220;<a title="Old TV campagin: Wazzup! on youtube" href="http://www.youtube.com/watch?v=2GWrrTpJ1eU">Wazzup??</a>&#8221; and stores the response in a database. While @dabr is slow and has to talk to Twitter with every click you make, @newdabr is super-snappy and just asks the local database.</p>
<p><strong>Advantages</strong></p>
<p>So we have this cool database, but how does that help? The list is pretty big and here&#8217;s just a few nice examples:</p>
<ul>
<li>Pages should load in <em>milliseconds</em>, not seconds.</li>
<li>Never miss a tweet. @newdabr knows all and can maybe resume from where you were last reading.</li>
<li>The site can happily auto-refresh.</li>
<li><em>Notifications</em>! Yes really.</li>
<li>Contact grouping &#8211; think Tweetdeck columns.</li>
<li>Expanded URLs. Want to know what a TinyURL really points to? I could cache the results and let you know.</li>
<li>Persistent settings &#8211; e.g. contact groups, colours</li>
<li>Filtering &#8211; e.g. hiding certain hashtags</li>
<li>Interested in links or photos your friends posted today? @newdabr could list them all for easy access. e.g. sidebar of today&#8217;s Twitpics.</li>
</ul>
<p><strong>Disadvantages</strong></p>
<p>Since @newdabr needs to keep chatting with Twitter all day to work, I imagine it would cost more to run and possibly wouldn&#8217;t work with tens or hundreds of accounts. For that reason, it&#8217;s going to be a slow-starting project with just me using it at first and a few alpha testers along the way.</p>
<p><strong>Timeline</strong></p>
<p>What&#8217;s one of those? Sorry, I&#8217;ve got no idea when I&#8217;ll work on it but I will keep updating the @newdabr Twitter account any time I make changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2009/07/newdabr/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Google Gears Mobile Location API</title>
		<link>http://davidcarrington.co.uk/2008/08/google-gears-mobile-location-api/</link>
		<comments>http://davidcarrington.co.uk/2008/08/google-gears-mobile-location-api/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 10:28:13 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Gears]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/?p=86</guid>
		<description><![CDATA[I&#8217;ve had a quick chance to check out Google&#8217;s new location tracking API in Google Gears for Windows Mobile phones. At first glance I say this is an absolutely awesome new feature. My first point of call is to find out if any social networking sites (e.g. Brightkite) are interested in using this to create [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a quick chance to check out <a href="http://googlemobile.blogspot.com/2008/08/new-gears-geolocation-api-powers-mobile.html">Google&#8217;s new location tracking API in Google Gears</a> for Windows Mobile phones. At first glance I say this is an absolutely awesome new feature.</p>
<p>My first point of call is to find out if any social networking sites (e.g. Brightkite) are interested in using this to create a great mobile web interface for Windows Mobile devices.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2008/08/google-gears-mobile-location-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking my phone on Google Earth</title>
		<link>http://davidcarrington.co.uk/2007/11/tracking-my-phone-on-google-earth/</link>
		<comments>http://davidcarrington.co.uk/2007/11/tracking-my-phone-on-google-earth/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 23:06:10 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Google Earth]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[KML]]></category>
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/2007/11/12/tracking-my-phone-on-google-earth/</guid>
		<description><![CDATA[After looking through various KML samples on the web during lunch today, I spent a little time experimenting with converting my existing location data into something that Google Earth could read &#8211; allowing people to track my location in real time. Manual labour About 6 times per day, I press a button on my phone [...]]]></description>
			<content:encoded><![CDATA[<p>After looking through various KML samples on the web during lunch today, I spent a little time experimenting with converting my existing location data into something that Google Earth could read &#8211; allowing people to track my location in real time.</p>
<p><strong>Manual labour</strong></p>
<p>About 6 times per day, I press a button on my phone and it sends a text message to my website with my current cell tower ID. My website then takes over and does all the smart stuff by itself. If I&#8217;ve traveled somewhere new, it automatically looks up the cell ID in a large UK database using their API to find the latitude and longitude of the cell tower I&#8217;m currently connected to. But big decimal numbers showing my current latitude and longitude aren&#8217;t all that interesting on their own.</p>
<p><strong>Sidebar widget</strong></p>
<p>The next step in my process was to add the widget on the side of my website to show everyone my current location. It&#8217;s not particularly fascinating &#8211; either I&#8217;m in my home town, at work, or traveling somewhere in between. But I&#8217;ve just added something a little more interesting.</p>
<p><strong>Google Earth</strong></p>
<p>Whereas before the link on my current location just took you to the coordinates where I&#8217;m currently sat, it will now load up a KML file showing a nice picture of a man standing on my current location, and hopefully a number of little cell towers which will show where I&#8217;ve been over the last 7 days.</p>
<p>The historic data isn&#8217;t all that interesting in Google Maps, but if I open up my KML file in Google Earth then I expose the timeline controls and I can choose to see where I was at different times and even animate my location over time.</p>
<p><strong>What&#8217;s next?</strong></p>
<p>I&#8217;ve got a habit of always wanting to do more.  I&#8217;ve cleaned up my location database so I could add in other locations (i.e. not just cell towers) and try plotting even more data. I&#8217;d like to try the following:</p>
<ul>
<li>Load up GPS data for any hikes I go on</li>
<li>Add a few key locations onto the map such as the Scout hut, my brother&#8217;s place in Canada, anything relevant to me</li>
<li>Add some kind of refresh so that it updates automatically when I&#8217;m on the move</li>
<li>Create some kind of JavScript timeline interface for Google Maps</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2007/11/tracking-my-phone-on-google-earth/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Keeping programming knowledge alive</title>
		<link>http://davidcarrington.co.uk/2007/10/keeping-programming-knowledge-alive/</link>
		<comments>http://davidcarrington.co.uk/2007/10/keeping-programming-knowledge-alive/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 12:47:36 +0000</pubDate>
		<dc:creator>David Carrington</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://davidcarrington.co.uk/2007/10/24/keeping-programming-knowledge-alive/</guid>
		<description><![CDATA[I&#8217;ve read a few articles about spoken languages across the globe fading to non-existance because no one speaks them any more and they get forgotten. &#8220;More than half of the word&#8217;s 7000 languages are endangered, because they consist of an unsustainably small – and declining – speaker base.&#8221; &#8211; New Scientist On a much less [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve read a few articles about spoken languages across the globe fading to non-existance because no one speaks them any more and they get forgotten.</p>
<blockquote><p>&#8220;More than half of the word&#8217;s 7000 languages are endangered, because they consist of an unsustainably small – and declining – speaker base.&#8221; &#8211; New Scientist</p></blockquote>
<p>On a much less epic scale, I&#8217;m concerned about my own knowledge of programming languages fading to nothing from lack of use. The best example for me is Perl.</p>
<p>Perl is the first server-side programming language I tried to learn to improve my websites. I made very basic guestbook scripts and that was about it, but I did (for a short time) know the syntax and some basic principles in the language. I&#8217;ve not used Perl for <em>5 years</em>!</p>
<p>I started looking into PHP, and never looked back. So what do I remember of Perl now? Hardly anything at all.</p>
<p>With a few years of self-taught PHP under my belt, I&#8217;m now pushing slowly into ASP.NET. This time, I&#8217;m going to keep my PHP very much alive.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidcarrington.co.uk/2007/10/keeping-programming-knowledge-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
