<?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"
	>

<channel>
	<title>Gavin Holt</title>
	<atom:link href="http://www.gavin-holt.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gavin-holt.com</link>
	<description>UK Based Web Developer</description>
	<pubDate>Wed, 15 Oct 2008 15:55:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Validating dates with PHP</title>
		<link>http://www.gavin-holt.com/articles/validating-dates-with-php/</link>
		<comments>http://www.gavin-holt.com/articles/validating-dates-with-php/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 15:17:10 +0000</pubDate>
		<dc:creator>Gavin Holt</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://gavin-holt.com/?p=63</guid>
		<description><![CDATA[Since I have got into building dynamic websites, I have often found myself building forms to gather dates and times of events, birthdays, booking requests. In fact, when building large applications, it is almost guaranteed you will need to take some form of date from a user. But, when building websites, we can never trust [...]]]></description>
			<content:encoded><![CDATA[<p>Since I have got into building dynamic websites, I have often found myself building forms to gather dates and times of events, birthdays, booking requests. In fact, when building large applications, it is almost guaranteed you will need to take some form of date from a user. But, when building websites, we can never trust our users input, it is essential to the integrity of the system that all data is correct. This means we must check all data coming in and reject anything which may cause problems.</p>
<p>Dates can be a very complex thing to validate, Days in a month and leap years both present problems.</p>
<p>PHP comes with a very clever built in function called <a href="http://uk.php.net/checkdate">checkdate</a>. Many developers have 3 separate inputs or drop downs to stop users from entering false dates. When I am filling in forms, I find this irritating and time consuming.</p>
<p>It doesn&#8217;t have to be harder to validate a date from a single text box.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p63code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p632"><td class="code" id="p63code2"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> realDate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateString</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Define Function</span>
	<span style="color: #000088;">$parts</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$dateString</span><span style="color: #009900;">&#41;</span>; <span style="color: #666666; font-style: italic;">//Split the date into its seperate part Day, Month and year and store them in an array</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parts</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Check that the user supplied the date with all three bits of information, if it doesn't we return false straight away</span>
		<span style="color: #000088;">$day</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#93;</span>; <span style="color: #666666; font-style: italic;">//As I am expecting my users to enter the date in a Day/Month.Year format, the day is the first in the array</span>
		<span style="color: #000088;">$month</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>; <span style="color: #666666; font-style: italic;">// Month is second</span>
		<span style="color: #000088;">$year</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span>; <span style="color: #666666; font-style: italic;">// Year is last</span>
		<span style="color: #666666; font-style: italic;">/*
		 Use PHP's built in date check function, passing in our variables in the right order.
		 If it is right, the function will return true and in turn, our function will return true
		*/</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/checkdate"><span style="color: #990000;">checkdate</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$month</span><span style="color: #339933;">,</span><span style="color: #000088;">$day</span><span style="color: #339933;">,</span><span style="color: #000088;">$year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;
		<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// checkdate returns false, so do we</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">// User didn't supply all three peices of information, Return False</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>; 
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//End Function</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Run a date in the format day/month/year (01/01/1970 for example) and it will return true if this is a real date and false if it isn&#8217;.</p>
<p>I have provided a fully commented source file and example to help you see this is action.</p>
<p><a href="http://www.gavin-holt.com/tutorials/realdate/index.php" target="_blank">Live Example</a></p>
<p><a href="http://www.gavin-holt.com/tutorials/realdate/realdate_source.txt">Source Code </a></p>
<p>Big thanks to <a href="http://www.richardwillars.com">Rich Willars</a> for his advice on cleaning the user input.</p>
<p>As always, if you see any way of improving the script, or a flaw in mine please comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavin-holt.com/articles/validating-dates-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ya-Tube</title>
		<link>http://www.gavin-holt.com/work/ya-tube/</link>
		<comments>http://www.gavin-holt.com/work/ya-tube/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 22:04:44 +0000</pubDate>
		<dc:creator>Gavin Holt</dc:creator>
		
		<category><![CDATA[My Work]]></category>

		<guid isPermaLink="false">http://gavin-holt.com/work/ya-tube/</guid>
		<description><![CDATA[Ya-Tube started off as a small exercise in writing large, scalable code that could be    applied to a multitude of different applications. What came from it was an idea for a    social network which built on the well established format of a social network that took    [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gavin-holt.com/wp-content/uploads/2008/10/ya-tube.png" rel="lightbox[57]"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="Ya-Tube" align="right" src="http://gavin-holt.com/wp-content/uploads/2008/10/ya-tube-thumb.png" width="244" height="126" title="Ya Tube" /></a>Ya-Tube started off as a small exercise in writing large, scalable code that could be    <br />applied to a multitude of different applications. What came from it was an idea for a    <br />social network which built on the well established format of a social network that took    <br />a life of its own. Ya-Tube ended up turning into more than a small learning    <br />experience; it became a fully functioning Social Network.    <br />Ya-Tube has a multitude of features based on the best of other social networks such    <br />as MySpace and Facebook. It is coded in such a way that individual features can be    <br />updated independently meaning the entire site does not need to be down for    <br />maintenance - a critical feature in scalable web applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavin-holt.com/work/ya-tube/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Airdrie Golf Club</title>
		<link>http://www.gavin-holt.com/work/airdrie-golf-club/</link>
		<comments>http://www.gavin-holt.com/work/airdrie-golf-club/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 22:01:03 +0000</pubDate>
		<dc:creator>Gavin Holt</dc:creator>
		
		<category><![CDATA[My Work]]></category>

		<guid isPermaLink="false">http://gavin-holt.com/work/airdrie-golf-club/</guid>
		<description><![CDATA[ 
I was asked to design and develop an online website for Airdrie Gold Club to help them more effectively share information with their members and to allow potential members and visitors see what the club has to offer. As the sole person working on the project, I was responsible for the design, images and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gavin-holt.com/wp-content/uploads/2008/10/airdriegolfclub1.png" rel="lightbox[54]"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="AirdrieGolfClub" align="right" src="http://gavin-holt.com/wp-content/uploads/2008/10/airdriegolfclub-thumb.png" width="244" height="126" title="Airdrie Golf Club" /></a> </p>
<p>I was asked to design and develop an online website for Airdrie Gold Club to help them more effectively share information with their members and to allow potential members and visitors see what the club has to offer. As the sole person working on the project, I was responsible for the design, images and coding of the full system. The main features of the website for members of the public and members of the club are:- </p>
<ul>
<li>Ease of use &#8211; The website is designed in such a way that every page is available within 2 clicks from the home page </li>
<li>An extensive gallery of images of the club, club house and locker facilities </li>
<li>Live news from the golfing world, taken from multiple sources to give viewers the latest news from their favourite sport </li>
<li>An extensive links page containing links for all the local golf clubs, local sports retailers and to other golfing sites </li>
</ul>
<p>The main benefit of the system to the golf club administrators is that it can be updated from any computer with an Internet connection, by any of the administrators. </p>
<p>Main administrative features at a glance:- </p>
<ul>
<li>An online, Microsoft word like interface, used to edit the main content on each page </li>
<li>A calendar system that can be updated in real time, and is used to list upcoming events </li>
<li>A simple to use contact system that allows for all members of the club to be contacted using their email address. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.gavin-holt.com/work/airdrie-golf-club/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My Portfolio</title>
		<link>http://www.gavin-holt.com/work/my-portfolio/</link>
		<comments>http://www.gavin-holt.com/work/my-portfolio/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 20:51:12 +0000</pubDate>
		<dc:creator>Gavin Holt</dc:creator>
		
		<category><![CDATA[My Work]]></category>

		<guid isPermaLink="false">http://gavin-holt.com/uncategorized/my-portfolio/</guid>
		<description><![CDATA[ This site is my little piece of the great wide interweb. Powered using WordPress with    a custom design, this site is a showcase of my work and hosts some articles and free    scripts that I hope will be of use to my fellow web developers.    [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gavin-holt.com/wp-content/uploads/2008/10/gavinholt.png" rel="lightbox[39]"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="GavinHolt" align="right" src="http://gavin-holt.com/wp-content/uploads/2008/10/gavinholt-thumb.png" width="244" height="126" title="My Portfolio" /></a> This site is my little piece of the great wide interweb. Powered using WordPress with    <br />a custom design, this site is a showcase of my work and hosts some articles and free    <br />scripts that I hope will be of use to my fellow web developers.    <br />After about 7 weeks I became unhappy with my existing site design - I knew I could    <br />do better so I made project managed my time around client work to design an    <br />entirely new site, which I completed in a single weekend! The design is now a very    <br />clean, simple layout with simple navigation and a clear and consise content area..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavin-holt.com/work/my-portfolio/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Welcome Back!</title>
		<link>http://www.gavin-holt.com/blog/welcome-back/</link>
		<comments>http://www.gavin-holt.com/blog/welcome-back/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 20:57:23 +0000</pubDate>
		<dc:creator>Gavin Holt</dc:creator>
		
		<category><![CDATA[My Blog]]></category>

		<guid isPermaLink="false">http://gavin-holt.com/blog/welcome-back/</guid>
		<description><![CDATA[Welcome back to my little piece of the web, 
After a few server problems I am now back, with a new design (Still being tweaked) and some new content.
I am much happier with this design, although I give it 5 minutes before I am itching to change it again.
&#160;
So please feel free to comment on [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome back to my little piece of the web, </p>
<p>After a few server problems I am now back, with a new design (Still being tweaked) and some new content.</p>
<p>I am much happier with this design, although I give it 5 minutes before I am itching to change it again.</p>
<p>&#160;</p>
<p>So please feel free to comment on my new design, read my (hopefully) useful articles and come back again soon!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavin-holt.com/blog/welcome-back/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Save your Vista Laptop battery</title>
		<link>http://www.gavin-holt.com/articles/save-your-vista-laptop-battery/</link>
		<comments>http://www.gavin-holt.com/articles/save-your-vista-laptop-battery/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 17:23:44 +0000</pubDate>
		<dc:creator>Gavin Holt</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://gavin-holt.com/save-your-vista-laptop-battery/</guid>
		<description><![CDATA[Having received a Samsung R60 plus Laptop for my Christmas, I was stunned by the Aero Interface that comes with all the premium versions of Vista.
One thing I was un-happy about was the battery life of my laptop. From what I had read users who had the standard R60 with XP Pro installed where saying [...]]]></description>
			<content:encoded><![CDATA[<p>Having received a <a href="http://www.samsung.com/uk/consumer/detail/detail.do?group=itbusiness&amp;type=notebookcomputers&amp;subtype=rseries&amp;model_cd=NP-R60FY01/SUK" target="_blank">Samsung R60 plus</a> Laptop for my Christmas, I was stunned by the <a href="http://en.wikipedia.org/wiki/Windows_Aero" target="_blank">Aero Interface</a> that comes with all the premium versions of Vista.</p>
<p>One thing I was un-happy about was the battery life of my laptop. From what I had read users who had the standard R60 with XP Pro installed where saying 3-4 hours so why was I getting 1 and a half to 2 hours from my upgraded model?</p>
<p>The answer was simple; the beautiful interface was draining my battery. After many hours of goggling I found this wonderful tool.</p>
<p><a href="http://www.codeplex.com/vistabattery" target="_blank"><strong>The Vista Battery Saver</strong></a></p>
<p>This great little piece of software (Which is Free!) runs in the system tray and can manage how much of the Aero Interface is enabled and at what levels it starts switching features off.</p>
<p>For Example, my settings mean that the Aero Interface is completely disabled if I&#8217;m not connected to mains power. I don&#8217;t use the sidebar, but if you do you also have the option to turn it off when on battery or below a certain battery level.</p>
<p>The author of the software claims it can extend notebooks battery life by up to 70%.</p>
<p>If anyone has any other tips on getting more juice out of your mobile battery leave a comment or <a href="/contact-me/" target="_blank">Contact Me</a> and I&#8217;ll give it a go!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavin-holt.com/articles/save-your-vista-laptop-battery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Forwarding Hotmail-Windows Live Mail</title>
		<link>http://www.gavin-holt.com/articles/forwarding-hotmailwindows-live-mail/</link>
		<comments>http://www.gavin-holt.com/articles/forwarding-hotmailwindows-live-mail/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 17:23:27 +0000</pubDate>
		<dc:creator>Gavin Holt</dc:creator>
		
		<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://gavin-holt.com/forwarding-hotmailwindows-live-mail/</guid>
		<description><![CDATA[I was recently asked by a friend how he could forward his Hotmail email address to a new one that he can get on his phone. After much head scratching and cursing Microsoft I found the answer. To do this you must login to the Hotmail/Windows Live Mail web site.
 Once you have logged into [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently asked by a friend how he could forward his Hotmail email address to a new one that he can get on his phone. After much head scratching and cursing Microsoft I found the answer. To do this you must login to the <a href="http://mail.live.com/" target="_blank">Hotmail/Windows Live Mail web site</a>.</p>
<p> <span id="more-3"></span>Once you have logged into the account that you wish to forward, its a relatively simple process, In fact it can be put into 3 simple steps!(Pictures provided to make it even simpler).
</p>
<ol>
<li>
<div>Once logged into the web site, click the options link (found on the right hand side of the shiny blue bar)
<p><a href="http://gavin-holt.com/wp-content/uploads/2008/09/forward-wlm-1.png" rel="lightbox[3]"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="forward_wlm_1" src="http://gavin-holt.com/wp-content/uploads/2008/09/forward-wlm-1-thumb.png" width="244" height="134" title="Forwarding Hotmail Windows Live Mail" /></a> </p>
</p></div>
</li>
<li>
<div>Once in the options page, under the &#8216;Manage your account&#8217; heading find &#8216;Forward mail to another e-mail account&#8217;
<p><a href="http://gavin-holt.com/wp-content/uploads/2008/09/forward-wlm-2.png" rel="lightbox[3]"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="forward_wlm_2" src="http://gavin-holt.com/wp-content/uploads/2008/09/forward-wlm-2-thumb.png" width="244" height="87" title="Forwarding Hotmail Windows Live Mail" /></a> </p>
</p></div>
</li>
<li>
<div>On the next page, select the second option (&quot;Forward e-mail to another address&quot;) and enter the new email address where you would like to receive your hotmail.Press enter and your done!
<p><a href="http://gavin-holt.com/wp-content/uploads/2008/09/forward-wlm-3.png" rel="lightbox[3]"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="forward_wlm_3" src="http://gavin-holt.com/wp-content/uploads/2008/09/forward-wlm-3-thumb.png" width="244" height="65" title="Forwarding Hotmail Windows Live Mail" /></a> </p>
</p></div>
</li>
</ol>
<p align="left">A few warnings,</p>
<ol>
<li>
<div>No mail will be saved to your Hotmail account, it will go straight to your new account and wont be accessible via any Hotmail interface.</div>
</li>
<li>
<div>You <strong>MUST </strong>visit your Hotmail account once ever 120 days else it will be closed and your mail will stop forwarding.</div>
</li>
</ol>
<p align="left">Remember, you can &quot;un-forward&quot; you email at anytime by following steps 1 &amp; 2 and then selecting the &quot;Don&#8217;t forward&quot; option</p>
<p align="left">If anyone has any guides on how to do this with other providers or even a way to access the original Hotmail address from a mobile then comment or <a href="/contact-me" target="_blank">Contact Me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavin-holt.com/articles/forwarding-hotmailwindows-live-mail/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
