<?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>George Palmer Blog and Portfolio</title>
	<atom:link href="http://www.gopalmer.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gopalmer.co.uk</link>
	<description>Reshaping the internet, one website at a time.</description>
	<lastBuildDate>Mon, 24 Aug 2009 16:36:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Backup Your Database into XML</title>
		<link>http://www.gopalmer.co.uk/2009/08/backup-your-database-xml/</link>
		<comments>http://www.gopalmer.co.uk/2009/08/backup-your-database-xml/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 16:33:00 +0000</pubDate>
		<dc:creator>George Palmer</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.gopalmer.co.uk/?p=126</guid>
		<description><![CDATA[I can&#8217;t stress enough the importance of keeping regular backups of your data. For many a website it doesn&#8217;t get more essential than backing up the database. Imagine loosing your entire database, the consequences could be disastrous.
Here&#8217;s a helpful snippet of PHP that outputs your database as XML.


&#60;?php
header(&#34;Content-type: text/xml&#34;); //We're going to display the XML [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t stress enough the importance of keeping regular backups of your data. For many a website it doesn&#8217;t get more essential than backing up the database. Imagine loosing your entire database, the consequences could be disastrous.</p>
<p>Here&#8217;s a helpful snippet of PHP that outputs your database as XML.</p>
<pre class="brush: php;">

&lt;?php
header(&quot;Content-type: text/xml&quot;); //We're going to display the XML so lets change the content type

//Create the connection
if (!$link = mysql_connect($host, $user, $pass)) {
 exit('Faild to connect to host.');
}

//Select a database
if (!mysql_select_db($database, $link)) {
 exit('Faild to connect to database.');
}

//get the tables
$sql = &quot;SELECT TABLES FROM {$database}&quot;;
if (!$tables = mysql_query($sql, $link)) {
 exit('Faild to retreive tables.');
}

//start the output
$xml = &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;utf-8\&quot; ?&gt;\n&quot;;
$xml .= &quot;&lt;database name=\&quot;{$database}\&quot;&gt;\n&quot;;

//loop the tables
while ($table = mysql_fetch_row($tables)) {
 //start the table output
 $xml .= &quot;\t&lt;table name=\&quot;{$table[0]}\&quot;&gt;\n&quot;;

 //get the rows
 $sql = &quot;SELECT * FROM {$table[0]}&quot;;
 if (!$rows = mysql_query($sql, $link)) {
 exit('Faild to retreive rows.');
 }

 //output the columns
 $attributes = array('name', 'blob', 'maxlength', 'multiple_key', 'not_null',
 'numeric', 'primary_key', 'table', 'type', 'default',
 'unique_key', 'unsigned', 'zerofill');

 $xml .= &quot;\t\t&lt;columns&gt;\n&quot;;

 for($i = 0; $i &lt; mysql_num_fields($rows); $i++) {

 $field = mysql_fetch_field($result, $i);

 $xml .= &quot;\t\t\t&lt;column &quot;;

 //for every attribute
 foreach ($attributes as $attribute) {
 $xml .= $xml.= $attribute.'=&quot;'.$field-&gt;$attribute.'&quot; ';
 }

 $xml .= &quot;/&gt;\n&quot;;
 }

 $xml .= &quot;\t\t&lt;/columns&gt;\n&quot;;

 //output the rows
 $xml .= &quot;\t\t&lt;records&gt;\n&quot;;

 while($row = mysql_fetch_assoc($rows)) {

 $xml .= &quot;\t\t\t&lt;record&gt;\n&quot;;

 //for each field
 foreach ($row as $key =&gt; $val) {
 $xml .= &quot;\t\t\t\t&lt;{$key}&gt;&quot;.htmlspecialchars(stripslashes($val)).&quot;&lt;/{$key}&gt;\n&quot;;
 }

 $xml .= &quot;\t\t\t&lt;/record&gt;\n&quot;;
 }

 $xml .= &quot;\t\t&lt;/records&gt;\n\t&lt;/table&gt;\n&quot;;

}

$xml .= '&lt;/datbase&gt;';

echo $xml;
</pre>
<p>Simple eh <img src='http://www.gopalmer.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  now obviously if you&#8217;re using this to backup a database you don&#8217;t want to output like this, instead you&#8217;re going to need to save it to a file. The simplest method is using PHP&#8217;s File_put_contents function http://www.php.net/file_put_contents</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gopalmer.co.uk/2009/08/backup-your-database-xml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Nicola&#8217;s Flowers</title>
		<link>http://www.gopalmer.co.uk/2009/06/nicolas-flowers/</link>
		<comments>http://www.gopalmer.co.uk/2009/06/nicolas-flowers/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 19:26:57 +0000</pubDate>
		<dc:creator>George Palmer</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.gopalmer.co.uk/?p=87</guid>
		<description><![CDATA[This site was developed to compliment directory submissions. The client realised that although their business was well represented on the Internet, there were very few directories or similar that allowed them to display enough information. <b>The total build cost for this site was just under £60.</b>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.gopalmer.co.uk/portfolio/nicolasflowers"><img class="size-full wp-image-90" title="NicolasFlowers" src="http://www.gopalmer.co.uk/wp-content/uploads/2009/06/NicolasFlowers.png" alt="Nicolas Flower Arangements" width="450" height="145" /></a></p>
<p style="text-align: center;">
<p style="text-align: left;">This site was developed to compliment directory submissions. The client realised that although their business was well represented on the Internet, there were very few directories or similar that allowed them to display enough information.</p>
<p style="text-align: left;">The requirements for this site was a basic informational page, nice design and a simple way of updating the content. The budget for this site was also very tight, but i think what has been achieved here is a very good example of what you can get for your money, even on a small budget. <strong>The total build cost for this site was just under £60.</strong></p>
<p style="text-align: left;">The sites main features are the seamless integration of Google Maps and the intuitive administration side which allows all the content to be updated and changed using a comprehensive <a title="wysiwyg" href="http://en.wikipedia.org/wiki/WYSIWYG" target="_blank">WYSIWYG</a> editor.</p>
<p style="text-align: left;">The complete development, including design was completed in under 6 hours.</p>
<p style="text-align: left;">
<p>The following skills were used during this development.</p>
<ul>
<li>(X)HTML</li>
<li>XML</li>
<li>W3C</li>
<li>JavaScript / Ajax</li>
<li>PHP5</li>
<li>PhotoShop</li>
<li>Google Maps API</li>
</ul>
<p style="text-align: left;">
<p style="text-align: left;">
]]></content:encoded>
			<wfw:commentRss>http://www.gopalmer.co.uk/2009/06/nicolas-flowers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Implementing Singleton Base Class</title>
		<link>http://www.gopalmer.co.uk/2009/06/php-53-implementing-singleton-base-class/</link>
		<comments>http://www.gopalmer.co.uk/2009/06/php-53-implementing-singleton-base-class/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 22:19:51 +0000</pubDate>
		<dc:creator>George Palmer</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.gopalmer.co.uk/?p=70</guid>
		<description><![CDATA[With the very exciting PHP 5.3 nearing release, i thought i&#8217;d write about one of the very useful functions making its way in to this version. The new get_called_class() function on its doesn&#8217;t really do a lot, but this simple little function plugs one of the many gaping holes in PHPs object model.
Just one of [...]]]></description>
			<content:encoded><![CDATA[<p>With the very exciting PHP 5.3 nearing release, i thought i&#8217;d write about one of the very useful functions making its way in to this version. The new get_called_class() function on its doesn&#8217;t really do a lot, but this simple little function plugs one of the many gaping holes in PHPs object model.</p>
<p>Just one of the things this fantastic new function can be used for is a very elegant implementation of singleton base class. We can simply extend this to create a number of fully functioning singletons.</p>
<p>Ok, lets take a look at some code.</p>
<p>The first thing we need to do is create an singleton class, heres one i prepared earlier.</p>
<pre name="code" class="php">
< ?php
class Singleton_Test
{
    //enforce singleton
    final private function __clone() {}
    final private function __construct() {}

    final public static function getInstance()
    {
        static $instance = null;

        if (null === $instance) {
            $instance = new Singleton_Test();
        }
        return $instance;
    }
}
</pre>
<p>This does exactly what is says on the tin, we get one instance and one instance only. Now lets see what happens under normal circumstances if we try to implement an abstract singleton.</p>
<pre name="code" class="php">
< ?php
abstract class Singleton_Test
{
    //enforce singleton
    final private function __clone() {}
    protected function __construct() {}

    final public static function getInstance($class)
    {
        static $instance = array();

        if (!isset($instance[$class])) {
            $instance[$class] = new $class();
        }
        return $instance[$class];
    }
}
</pre>
<p>You see the first problem we encounter is the static instance property, we need each singleton child to hold reference to its self. The obvious solution is to hold an array of child classes (lazy load style). Next is the glaring line "$instance = new Singleton_Test();" we need to loose this explicit call and replace it with something relative. An easy but far from elegant solution is to pass the name of the class you are instantiating into the getInstance() method.</p>
<p>Thanks to the new get_called_class() function we can now do this dynamically, resulting in much more elegant code. Here goes.</p>
<pre name="code" class="php">
< ?php
abstract class Singleton_Test
{
    //enforce singleton
    final private function __clone() {}
    protected function __construct() {}

    final public static function getInstance()
    {
        static $instance = array();

        $class = get_called_class();

        if (!isset($instance[$class])) {
            $instance[$class] = new $class();
        }
        return $instance[$class];
    }
}
</pre>
<p>Fantastic isn't it? Just one extra line and we have an all-singing all-dancing fully extendable singleton base class. <img src='http://www.gopalmer.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gopalmer.co.uk/2009/06/php-53-implementing-singleton-base-class/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>World of Warcraft Portal Site</title>
		<link>http://www.gopalmer.co.uk/2009/05/wow-blackrock/</link>
		<comments>http://www.gopalmer.co.uk/2009/05/wow-blackrock/#comments</comments>
		<pubDate>Thu, 28 May 2009 17:39:53 +0000</pubDate>
		<dc:creator>George Palmer</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.gopalmer.co.uk/?p=105</guid>
		<description><![CDATA[

This World of Warcraft portal site was developed using my own CMS (Piranha CMS) integrated with SMF forums. The design was created by a colleague of mine and all content was provided by the client, resulting in a very fast build. The bulk of the work was the CMS integration into their existing SMF installation.
The [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter size-full wp-image-106" title="WoW" src="http://www.gopalmer.co.uk/wp-content/uploads/2009/06/WoW.png" alt="WoW" width="450" height="145" /></p>
<p style="text-align: center;">
<p style="text-align: left;">This World of Warcraft portal site was developed using my own CMS (<a title="Piranha CMS" href="http://piranhacms.com/" target="_blank">Piranha CMS</a>) integrated with <a title="SMF" href="http://www.simplemachines.org/" target="_blank">SMF forums</a>. The design was created by a colleague of mine and all content was provided by the client, resulting in a very fast build. The bulk of the work was the CMS integration into their existing <a title="SMF" href="http://www.simplemachines.org/" target="_blank">SMF</a> installation.</p>
<p>The following skills were used during this development.</p>
<ul>
<li>(X)HTML</li>
<li>W3C</li>
<li>JavaScript / Ajax</li>
<li>PHP5</li>
<li>MySQL</li>
<li>SMF Forums Software</li>
<li>Piranha Content Management System</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.gopalmer.co.uk/2009/05/wow-blackrock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBeeHosting</title>
		<link>http://www.gopalmer.co.uk/2009/05/freebeehosting/</link>
		<comments>http://www.gopalmer.co.uk/2009/05/freebeehosting/#comments</comments>
		<pubDate>Fri, 15 May 2009 11:20:09 +0000</pubDate>
		<dc:creator>George Palmer</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Completey free web hosting]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Free Hosting]]></category>
		<category><![CDATA[free php hosting]]></category>
		<category><![CDATA[Free Web Hosting]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[no ads free hosting]]></category>

		<guid isPermaLink="false">http://www.gopalmer.co.uk/?p=58</guid>
		<description><![CDATA[This is the latest item from my old portfolio. I&#8217;m going to start a fresh here and get some more recent stuff up. If you like what you see feel free to contact me for a quote.

FreeBeeHosting was a little out of the ordinary for me. I actually purchased the very small (20 users) free [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">This is the latest item from my old portfolio. I&#8217;m going to start a fresh here and get some more recent stuff up. If you like what you see feel free to contact me for a quote.<br />
<a href="http://www.freebeehosting.com"><img class="size-full wp-image-61 aligncenter" title="www.FreeBeeHosting.com" src="http://www.gopalmer.co.uk/wp-content/uploads/2009/05/freebee.png" alt="Free Webhosting with NO Ads" width="450" height="145" /></a></p>
<p>FreeBeeHosting was a little out of the ordinary for me. I actually purchased the very small (20 users) free hosting company using the domain www.FreeBeeHosting.com. I just really liked the idea and the domain was a really cool play on words.</p>
<p>It turned out that the site itself was useless, the sign up system was unsuitable and the site as a whole needed an overhaul.</p>
<p>I set myself a simple spec to develop and implement a new sign up system which incorporated instant account activation and made use of a GeoIP database to prevent fraud. The site and forum templates were designed by myself to follow the bee theme. I outsourced the character art to a colleague of mine and the bees were born.</p>
<p>I chose to use the DirectAdmin control panel as this was little used in the free hosting scene. The sign up was then developed to make use of the DirectAdmin API. This allowed for the instant account activation in the original plan. I made use of MaxMinds GeoIP database and implemented radial search on locations to ensure perspective users were in the same vicinity as they claimed. I incorporated a 3 strike system which works by studying the sign up form for particular tags and phrases which suggest misuse of the account. If three or more terms are found the user is blacklisted and their IP blocked from sign up. This has now been extended to include location bases strikes.</p>
<p>Overall the site and system is clearly a success. The site currently hosts around 8,000 free accounts on several dedicated servers. There are no ads placed on users accounts and the all income is generated through advertisement schemes.</p>
<p>The following skills were used during this development.</p>
<ul>
<li>(X)HTML</li>
<li>XML</li>
<li>W3C</li>
<li>JavaScript / Ajax</li>
<li>OO PHP5</li>
<li>MySQL</li>
<li>PhotoShop</li>
<li>Illustrator</li>
<li>DirectAdmin API</li>
<li>Max Minds GeoIP API</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.gopalmer.co.uk/2009/05/freebeehosting/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Changing the Host Name in Linux</title>
		<link>http://www.gopalmer.co.uk/2009/05/how-to-changing-the-host-name-in-linux/</link>
		<comments>http://www.gopalmer.co.uk/2009/05/how-to-changing-the-host-name-in-linux/#comments</comments>
		<pubDate>Mon, 04 May 2009 16:56:11 +0000</pubDate>
		<dc:creator>George Palmer</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[change linux host name]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[host name]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[linux host]]></category>
		<category><![CDATA[linux host name]]></category>

		<guid isPermaLink="false">http://67.222.24.56/~admin/?p=35</guid>
		<description><![CDATA[After purchasing another dedicated cent OS server last week and experiencing some issues with DirectAdmin i pinpointed the problem. The host name was completely wrong, although not a huge deal it was causing DA to throw a tantrum.
This is so simple to put right but i couldn&#8217;t for the life of me remember how to. [...]]]></description>
			<content:encoded><![CDATA[<p>After purchasing another dedicated cent OS server last week and experiencing some issues with DirectAdmin i pinpointed the problem. The host name was completely wrong, although not a huge deal it was causing DA to throw a tantrum.</p>
<p>This is so simple to put right but i couldn&#8217;t for the life of me remember how to. After an hour or so of Googling i still couldn&#8217;t find the answer. In the end i picked up some old college notes and found what i need.</p>
<p>It is such a common task and being the nice chap that i am i put together this little how to guide. As you will see it really is easy once you know how to do it.</p>
<p>Start by popping open a terminal, in my case putty over ssh, and login to the root account.</p>
<p>You will need to edit /etc/sysconfig/network in your favourite editor. I&#8217;m using nano</p>
<pre name="code" class="c"># nano /etc/sysconfig/network</pre>
<p>Edit the line beginning HOSTNAME= with your new host name e.g. HOSTNAME=gopalmer.co.uk</p>
<p>Next edit the /etc/hosts file in the same manner, again replacing the HOSTNAME value with your new host name.</p>
<p>Now type the following into the shell (replace gopalmer.co.uk with your host name)</p>
<pre name="code" class="c"># hostname=gopalmer.co.uk</pre>
<p>Finally we need to restart the xinetd service</p>
<pre name="code" class="c"># service xinetd restart</pre>
<p>Thats it! Easy wasn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gopalmer.co.uk/2009/05/how-to-changing-the-host-name-in-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finally updated my site</title>
		<link>http://www.gopalmer.co.uk/2009/05/finally-updated-my-site/</link>
		<comments>http://www.gopalmer.co.uk/2009/05/finally-updated-my-site/#comments</comments>
		<pubDate>Fri, 01 May 2009 19:12:05 +0000</pubDate>
		<dc:creator>George Palmer</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://67.222.24.56/~admin/?p=31</guid>
		<description><![CDATA[I've finally got round to updating my site. You should see lots of useful information and i'll try to keep an up-to-date portfolio this time around. Please let me know what you think.]]></description>
			<content:encoded><![CDATA[<p>Those of you who know me will remember the old out-of-date portfolio site i had up previous to this. I finally decided to put little time into revamping the site. This time I&#8217;ve chosen to stick with a billy basic WP install (to save on development time) and just treated it with this nice, clean design i put together in photoshop.</p>
<p>This time round i plan to actually keep an up-to-date portfolio and also to finally start the blog I&#8217;ve been meaning to for far too long now. You may even see some useful tutorials appearing here over the coming months (maybe!).</p>
<p>Anyway enough of my ramblings. Here it is, hope you like it and it would be interesting to hear your comments. Also if you notice anything i&#8217;ve missed or out-of-place please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gopalmer.co.uk/2009/05/finally-updated-my-site/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
