<?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>Michael S. Clark &#187; PHP</title>
	<atom:link href="http://www.ne0ge0.com/tags/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ne0ge0.com</link>
	<description>When I talk, the world ignores me...</description>
	<lastBuildDate>Mon, 12 Dec 2011 15:44:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Reading SQL Server Timestamp Field Using PHP</title>
		<link>http://www.ne0ge0.com/2011/11/30/reading-sql-server-timestamp-field-using-php/</link>
		<comments>http://www.ne0ge0.com/2011/11/30/reading-sql-server-timestamp-field-using-php/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 15:53:04 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/?p=597</guid>
		<description><![CDATA[I&#8217;ve been working on a project where I have to maintain data in a SQL Server database. In order to prevent different users updating the same data at the same time, I&#8217;ve also employed optimistic locking by using a &#8220;timestamp&#8221; field called OLToken on each table which is binary. This field is read out and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a project where I have to maintain data in a SQL Server database. In order to prevent different users updating the same data at the same time, I&#8217;ve also employed <a href="http://en.wikipedia.org/wiki/Optimistic_locking" target="_blank">optimistic locking</a> by using a &#8220;timestamp&#8221; field called OLToken on each table which is binary. This field is read out and is used in any Insert and Update statements to ascertain if the record has been updated since the data was read out.</p>
<p>I&#8217;m using PHP to get each record. There isn&#8217;t much on the web about working with timestamp fields in PHP, so I created the function below to convert and store the OLToken as an integer:</p>
<pre class="brush: php; title: ; notranslate">
function ConvertOLToken ($theToken)
{
   $OLToken = &quot;&quot;;
   for ($i = 0; $i &lt; strlen ($theToken); $i++)
   {
      $Byte = dechex (ord ($theToken[$i]));
      $OLToken .= str_pad ($Byte, 2, &quot;0&quot;, STR_PAD_LEFT);
   }
   return hexdec($OLToken);
}
</pre>
<p>This value is passed back to stored procedures as an integer parameter and used in stored procedures:</p>
<pre class="brush: sql; title: ; notranslate">
IF EXISTS (
   SELECT 1
   FROM [Table]
   WHERE [ID] = @pID
      AND [OLToken] = CONVERT([binary](8), @pOLToken))
BEGIN
...
END
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2011/11/30/reading-sql-server-timestamp-field-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading WordPress on NearlyFreeSpeech.net</title>
		<link>http://www.ne0ge0.com/2011/08/26/upgrading-wordpress-on-nearlyfreespeech-net/</link>
		<comments>http://www.ne0ge0.com/2011/08/26/upgrading-wordpress-on-nearlyfreespeech-net/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 12:11:27 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[NearlyFreeSpeech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/?p=540</guid>
		<description><![CDATA[I ran into problems with the auto-upgrade facility of WordPress on my sites hosted here, on NearlyFreeSpeech.net. Through trial and error, I established the following works: Add the following lines to wp-config.php: Using PuTTY, log-in. Enter the following command: chgrp -R web *. This will change the group ownership of all files and directories to [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into problems with the auto-upgrade facility of WordPress on my sites hosted here, on NearlyFreeSpeech.net.</p>
<p>Through trial and error, I established the following works:</p>
<ol>
<li>Add the following lines to <code>wp-config.php</code>:
<pre class="brush: php; title: ; notranslate">
define('FS_METHOD', 'direct');
define('FTP_BASE', '/public/');
define('FTP_CONTENT_DIR', '/public/wp-content/');
define('FTP_PLUGIN_DIR ', '/public/wp-content/plugins/');
define('FTP_USER', '---your username---');
define('FTP_HOST', 'ssh.phx.nearlyfreespeech.net:22');
define('FTP_PASS', '---your password---');
</pre>
</li>
<li>Using <a title="PuTTY Download Page" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">PuTTY</a>, log-in.</li>
<li>Enter the following command: <code>chgrp -R web *</code>. This will change the group ownership of all files and directories to <code>web</code>. This is the required ownership for WordPress to perform the upgrade.</li>
<li>Enter the following command: <code>chmod -R 777 *</code>. This will change the permissions on all files and directories to full public access.</li>
<li>Perform any WordPress upgrades; core, plugins or themes. It shouldn&#8217;t ask for any connection details.</li>
<li>Enter the following command: <code>find . -type d -print0 | xargs -0 chmod 755</code>. This will reset all directory permissions to read-only for everyone except the owner (you).</li>
<li>Enter the following command: <code>find . -type f -print0 | xargs -0 chmod 644</code>. This will reset all file permissions to read-only for everyone except the owner (you).</li>
<li>Enter the following command: <code>chmod -R 775 wp-content</code>. This will update the permissions on the <code>wp-content</code> directory to be 775, allowing uploads, including from the media library.</li>
</ol>
<p>You only have to do steps 1 and 3 once. Steps 4 to 8 have to be performed for upgrade.</p>
<p>Although not essential, the last three steps should be performed, as it is highly insecure to leave permissions set as public (777).</p>
<p>Also using SSH rather than FTP conforms with the view of NearlyFreeSpeech.net that FTP should not be used as passwords are transferred in plaintext.</p>
<p>Thanks to SNARP for the <a title="How to Get WordPress Working Under PHP safe_mode on NearlyFreeSpeech.net" href="http://snarp.dreamwidth.org/124165.html" target="_blank">original article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2011/08/26/upgrading-wordpress-on-nearlyfreespeech-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online Shop using AJAX</title>
		<link>http://www.ne0ge0.com/2009/07/16/online-shop-using-ajax/</link>
		<comments>http://www.ne0ge0.com/2009/07/16/online-shop-using-ajax/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 08:37:21 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/?p=351</guid>
		<description><![CDATA[The Pro Shop that I developed at Computa Services for the Carnoustie Golf Links, is now live. It uses concurrent AJAX, calling a lightweight PHP+XML web service layer to communicate with a Microsoft SQL Server. The management application that the staff at the Links use to administer the bookings is written in C#, using C# [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="https://www.carnoustiegolflinks.co.uk/ProShop/">Pro Shop</a> that I developed at <a href="http://www.computa.co.uk">Computa Services</a> for the <a href="http://www.carnoustiegolflinks.co.uk">Carnoustie Golf Links</a>, is now live.</p>
<p>It uses concurrent AJAX, calling a lightweight PHP+XML web service layer to communicate with a Microsoft SQL Server.</p>
<p>The management application that the staff at the Links use to administer the bookings is written in C#, using C# web services back to the SQL Server.</p>
<p>Like the online booking, the AJAX layer is based on &quot;<a href="http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object">The Ultimate AJAX object</a>&quot; by Patrick Hunlock, which I&#8217;ve found to be one of the only objects that elegantly supports concurrency.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2009/07/16/online-shop-using-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tee-Time Booking Using AJAX</title>
		<link>http://www.ne0ge0.com/2008/11/15/tee-time-booking-using-ajax/</link>
		<comments>http://www.ne0ge0.com/2008/11/15/tee-time-booking-using-ajax/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 14:34:47 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/2008/11/15/tee-time-booking-using-ajax/</guid>
		<description><![CDATA[The online tee-time booking system that I developed at Computa Services for the Carnoustie Golf Links, is now live. It uses concurrent AJAX, calling a lightweight PHP+XML web service layer to communicate with a Microsoft SQL Server. The management application that the staff at the Links use to administer the bookings is written in C#, [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="https://www.carnoustiegolflinks.co.uk/OnlineBooking/">online tee-time booking system</a> that I developed at <a href="http://www.computa.co.uk">Computa Services</a> for the <a href="http://www.carnoustiegolflinks.co.uk">Carnoustie Golf Links</a>, is now live.</p>
<p>It uses concurrent AJAX, calling a lightweight PHP+XML web service layer to communicate with a Microsoft SQL Server.</p>
<p>The management application that the staff at the Links use to administer the bookings is written in C#, using C# web services back to the SQL Server.</p>
<p>The AJAX layer is based on &quot;<a href="http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object">The Ultimate AJAX object</a>&quot; by Patrick Hunlock, which I&#8217;ve found to be one of the only objects that elegantly supports concurrency.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2008/11/15/tee-time-booking-using-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Permalinks on IIS7</title>
		<link>http://www.ne0ge0.com/2008/07/25/wordpress-permalinks-on-iis7/</link>
		<comments>http://www.ne0ge0.com/2008/07/25/wordpress-permalinks-on-iis7/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 07:33:15 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Blog Add-ons]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/2008/07/25/wordpress-permalinks-on-iis7/</guid>
		<description><![CDATA[Under usual circumstances, hosting WordPress on IIS7 would not normally allow permalinks to be used. There are some commercial solutions, including the ISAPI_Rewrite module (which I couldn&#8217;t get to work). Another less elegant solution was to create a replacement 404 error page that would perform the redirection. This worked, but when the redirection occurred, any [...]]]></description>
			<content:encoded><![CDATA[<p>Under usual circumstances, hosting WordPress on IIS7 would not normally allow permalinks to be used. There are some commercial solutions, including the <a href="http://www.helicontech.com/">ISAPI_Rewrite module</a> (which I couldn&#8217;t get to work).</p>
<p>Another less elegant solution was to <a href="http://tech.einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/">create a replacement 404 error page</a> that would perform the redirection. This worked, but when the redirection occurred, any POSTed values were lost, so no forms could be used.</p>
<p>I thought all was lost until yesterday, I stumbled across <a href="http://learn.iis.net/page.aspx/466/enabling-pretty-permalinks-in-wordpress/">an article on Microsoft&#8217;s IIS site</a>.</p>
<blockquote><p>This walkthrough will guide you through how to enable &#8220;<a href="http://codex.wordpress.org/Using_Permalinks">Pretty Permalinks</a>&#8221; for blog posts in the <a href="http://www.wordpress.org/">WordPress</a> blog engine installed on IIS 7.0. Typically, without URL rewriting functionality on a Web server, WordPress users have to use â€œAlmost Prettyâ€ URLs (for example, <a href="http://example.com/index.php/yyyy/mm/dd/post-name/">http://example.com/index.php/yyyy/mm/dd/post-name/</a>). This was the primary option for users who chose to host WordPress on IIS. Now, with the URL rewrite module available, you can have &#8220;Pretty Permalinks&#8221; (for example, <a href="http://example.com/year/month/day/post-name/">http://example.com/year/month/day/post-name/</a>) for WordPress blogs hosted on IIS 7.0.</p></blockquote>
<p>This solved all my problems for a major project I&#8217;m involved in. It involves the URL Rewrite Technical Preview that can be found <a href="http://learn.iis.net/page.aspx/460/using-url-rewrite-module/">here</a>.</p>
<p>[<em>Via: <a href="http://learn.iis.net/page.aspx/466/enabling-pretty-permalinks-in-wordpress/">IIS.net</a></em>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2008/07/25/wordpress-permalinks-on-iis7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Supporting PicLens</title>
		<link>http://www.ne0ge0.com/2008/06/11/supporting-piclens/</link>
		<comments>http://www.ne0ge0.com/2008/06/11/supporting-piclens/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 15:40:31 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Blog Add-ons]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Galleries]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/?p=256</guid>
		<description><![CDATA[I&#8217;ve added PicLens support to all of my galleries. The required RSS feed is dynamically generated using PHP as are the thumbnails so you would only have to provide a gallery of images. I&#8217;ve zipped up the code here.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added PicLens support to all of my <a title="Galleries" href="http://www.ne0ge0.com/index.php/galleries/" target="_self">galleries</a>.</p>
<p>The required RSS feed is dynamically generated using PHP as are the thumbnails so you would only have to provide a gallery of images.</p>
<p>I&#8217;ve zipped up the code <a title="PicLens scripts" href="http://www.ne0ge0.com/files/piclens.zip" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2008/06/11/supporting-piclens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Syndicating The Courier</title>
		<link>http://www.ne0ge0.com/2008/05/29/syndicating-the-courier/</link>
		<comments>http://www.ne0ge0.com/2008/05/29/syndicating-the-courier/#comments</comments>
		<pubDate>Thu, 29 May 2008 08:15:25 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/?p=254</guid>
		<description><![CDATA[I&#8217;ve been waiting a while for The Courier (my local paper) to provide an RSS feed for their news stories. Anyway, I decided to do one myself. I&#8217;ve zipped up the code here and I&#8217;ve hosted it on my employer&#8217;s server here. Give me a shout if you find an errors or improvements.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been waiting a while for <a title="The Courier" href="http://www.thecourier.co.uk" target="_blank">The Courier</a> (my local paper) to provide an <a title="Wiki: RSS" href="http://en.wikipedia.org/wiki/Rss" target="_blank">RSS feed</a> for their news stories.</p>
<p>Anyway, I decided to do one myself. I&#8217;ve zipped up the code <a href="http://www.ne0ge0.com/files/thecourier-co-uk_rss.zip">here</a> and I&#8217;ve hosted it on my employer&#8217;s server <a title="The Courier Syndicated Feed" href="http://www.computa.co.uk/thecourier-co-uk_rss.php" target="_blank">here</a>.</p>
<p>Give me a shout if you find an errors or improvements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2008/05/29/syndicating-the-courier/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Analytics</title>
		<link>http://www.ne0ge0.com/2007/09/03/google-analytics/</link>
		<comments>http://www.ne0ge0.com/2007/09/03/google-analytics/#comments</comments>
		<pubDate>Mon, 03 Sep 2007 12:36:20 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Blog Add-ons]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/index.php/2007/09/03/google-analytics/</guid>
		<description><![CDATA[I recently signed up for Google Analytics and added my sites and the sites created and hosted by the company I work for. The WordPress plugin I chose is this one by Semiologic. A very valuable tool if you&#8217;re interested in site usage statistics.]]></description>
			<content:encoded><![CDATA[<p>I recently signed up for Google Analytics and added my sites and the sites created and hosted by <a href="http://www.computa.co.uk">the company I work for</a>.</p>
<p>The WordPress plugin I chose is <a href="http://www.semiologic.com/software/marketing/google-analytics/">this one by Semiologic</a>.</p>
<p>A very valuable tool if you&#8217;re interested in site usage statistics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2007/09/03/google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Site Launched</title>
		<link>http://www.ne0ge0.com/2006/11/13/new-site-launched/</link>
		<comments>http://www.ne0ge0.com/2006/11/13/new-site-launched/#comments</comments>
		<pubDate>Mon, 13 Nov 2006 08:56:21 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/index.php/2006/11/13/new-site-launched/</guid>
		<description><![CDATA[I&#8217;ve finally got around to launching the website for the 7th Arbroath Boys&#8217; Brigade Company. It will be used to keep everyone informed of news, events, competitions, etc. and also to provide a resource for the boys to look at to familiarise themselves with the Company. It can be found at http://www.7a.bb-network.org.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally got around to launching the website for the 7th Arbroath Boys&#8217; Brigade Company. It will be used to keep everyone informed of news, events, competitions, etc. and also to provide a resource for the boys to look at to familiarise themselves with the Company.</p>
<p>It can be found at <a href="http://www.7a.bb-network.org">http://www.7a.bb-network.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2006/11/13/new-site-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft links to open source Zend</title>
		<link>http://www.ne0ge0.com/2006/11/01/microsoft-links-to-open-source-zend/</link>
		<comments>http://www.ne0ge0.com/2006/11/01/microsoft-links-to-open-source-zend/#comments</comments>
		<pubDate>Wed, 01 Nov 2006 08:37:29 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Interests]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ne0ge0.com/index.php/2006/11/01/microsoft-links-to-open-source-zend/</guid>
		<description><![CDATA[&#8230;the deal will mean that PHP programs will run on past and future versions of Microsoft Web server software including the upcoming Longhorn. Zend&#8217;s co-founder, Andi Gutmans, said that while PHP has always worked on Windows it never performed very well. The deal will mean that technical improvements by Zend and Microsoft to make it [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
<p>&#8230;the deal will mean that PHP programs will run on past and future versions of Microsoft Web server software including the upcoming Longhorn.</p>
<p>Zend&#8217;s co-founder, Andi Gutmans, said that while PHP has always worked on Windows it never performed very well. The deal will mean that technical improvements by Zend and Microsoft to make it easier to run PHP on Windows.</p>
</blockquote>
<p>It&#8217;s about time PHP got the recognition we all know it deserves.</p>
<p>[<em>Via: <a href="http://www.theinquirer.net/default.aspx?article=35460">The Inquirer</a></em>, <a href="http://it.slashdot.org/article.pl?sid=06/10/31/2047209&amp;from=rss"><em>Slashdot</em></a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ne0ge0.com/2006/11/01/microsoft-links-to-open-source-zend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

