<?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>Gavin Pearce</title>
	<atom:link href="http://www.gavinpearce.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gavinpearce.com</link>
	<description>A Web Developer and Technical Architect</description>
	<lastBuildDate>Wed, 30 Jun 2010 16:53:21 +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>Search YUM and Enable repo when needed</title>
		<link>http://www.gavinpearce.com/blog/search-yum-and-enable-repo-when-needed-298</link>
		<comments>http://www.gavinpearce.com/blog/search-yum-and-enable-repo-when-needed-298#comments</comments>
		<pubDate>Wed, 30 Jun 2010 16:53:21 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Uncategorised]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=298</guid>
		<description><![CDATA[[code]
yum search fortune --enablerepo=rpmforge
[/code]
]]></description>
			<content:encoded><![CDATA[<p>[code]<br />
yum search fortune --enablerepo=rpmforge<br />
[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/search-yum-and-enable-repo-when-needed-298/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whoa &#8211; what&#8217;s been happening</title>
		<link>http://www.gavinpearce.com/blog/whoa-whats-been-happening-292</link>
		<comments>http://www.gavinpearce.com/blog/whoa-whats-been-happening-292#comments</comments>
		<pubDate>Thu, 17 Jun 2010 10:29:30 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=292</guid>
		<description><![CDATA[It&#8217;s been awhile since I posted an update to this site, almost two months in fact, but don&#8217;t worry it&#8217;s nothing personal. Since my last, I&#8217;ve stopped working for Wunderman, the large London agency where I was once employed, and am now employed by a small, friendly agency called 3seven9. More about the move, the [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been awhile since I posted an update to this site, almost two months in fact, but don&#8217;t worry it&#8217;s nothing personal. Since my last, I&#8217;ve stopped working for Wunderman, the large London agency where I was once employed, and am now employed by a small, friendly agency called 3seven9. More about the move, the reasons behind my choice, and 3seven9, in an up-and-coming blog post.</p>
<p>In the background, there is plenty of projects going on to keep my fingers busy &#8211; keeping me firmly away from this blog &#8211; which can&#8217;t entirely be a bad thing!</p>
<p>Several new projects I&#8217;ve been working on lately have now gone live, most protected by non-disclosure agreements as ever, though the ones that I can tell you about:<br />
<a href="http://www.mointernational.com" rel="external">http://www.mointernational.com</a><br />
<a href="http://insight.kingstonsmithw1.co.uk/" rel="external">http://insight.kingstonsmithw1.co.uk/</a></p>
<p>Until next time&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/whoa-whats-been-happening-292/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find the Average Colour of a Photograph or Image</title>
		<link>http://www.gavinpearce.com/blog/find-the-average-colour-of-a-photograph-or-image-288</link>
		<comments>http://www.gavinpearce.com/blog/find-the-average-colour-of-a-photograph-or-image-288#comments</comments>
		<pubDate>Wed, 21 Apr 2010 12:00:02 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Internet tidbits]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=288</guid>
		<description><![CDATA[Just a quick one &#8211; just seen this link on finding the average colour of a photograph or image. Very handy!
http://www.wisegeek.com/how-can-i-find-the-average-color-in-a-photograph.htm
]]></description>
			<content:encoded><![CDATA[<p>Just a quick one &#8211; just seen this link on finding the average colour of a photograph or image. Very handy!</p>
<p><a href="http://www.wisegeek.com/how-can-i-find-the-average-color-in-a-photograph.htm" rel="external">http://www.wisegeek.com/how-can-i-find-the-average-color-in-a-photograph.htm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/find-the-average-colour-of-a-photograph-or-image-288/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced search options on Twitter</title>
		<link>http://www.gavinpearce.com/blog/advanced-search-options-on-twitter-271</link>
		<comments>http://www.gavinpearce.com/blog/advanced-search-options-on-twitter-271#comments</comments>
		<pubDate>Wed, 21 Apr 2010 09:00:14 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Internet tidbits]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=271</guid>
		<description><![CDATA[A quick reference guide on the advanced search options you can use on Twitter. Some of these even I didn&#8217;t know, may come in useful to someone!
&#160;



Operator
Finds tweets&#8230;


twitter search
containing both &#8220;twitter&#8221; and &#8220;search&#8221;. This is the default operator.


&#8220;happy hour&#8220;
containing the exact phrase &#8220;happy hour&#8221;.


love OR hate
containing either &#8220;love&#8221; or &#8220;hate&#8221; (or both).


beer -root
containing &#8220;beer&#8221; but [...]]]></description>
			<content:encoded><![CDATA[<p>A quick reference guide on the advanced search options you can use on <a href="http://www.twitter.com" rel="external">Twitter</a>. Some of these even I didn&#8217;t know, may come in useful to someone!</p>
<p>&nbsp;</p>
<table border="0">
<tbody>
<tr>
<th>Operator</th>
<th>Finds tweets&#8230;</th>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=twitter+search">twitter search</a></td>
<td>containing both &#8220;twitter&#8221; and &#8220;search&#8221;. This is the default operator.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=%22happy+hour%22"><strong>&#8220;</strong>happy hour<strong>&#8220;</strong></a></td>
<td>containing the exact phrase &#8220;happy hour&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=love+OR+hate">love <strong>OR</strong> hate</a></td>
<td>containing either &#8220;love&#8221; or &#8220;hate&#8221; (or both).</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=beer+-root">beer <strong>-</strong>root</a></td>
<td>containing &#8220;beer&#8221; but not &#8220;root&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=%23haiku"><strong>#</strong>haiku</a></td>
<td>containing the hashtag &#8220;haiku&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=from%3Aalexiskold"><strong>from:</strong>alexiskold</a></td>
<td>sent from person &#8220;alexiskold&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=to%3Atechcrunch"><strong>to:</strong>techcrunch</a></td>
<td>sent to person &#8220;techcrunch&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=%40mashable"><strong>@</strong>mashable</a></td>
<td>referencing person &#8220;mashable&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=%22happy+hour%22+near%3A%22san+francisco%22">&#8220;happy hour&#8221; <strong>near:</strong>&#8220;san francisco&#8221;</a></td>
<td>containing the exact phrase &#8220;happy hour&#8221; and sent near &#8220;san francisco&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=near%3ANYC+within%3A15mi"><strong>near:</strong>NYC <strong>within:</strong>15mi</a></td>
<td>sent within 15 miles of &#8220;NYC&#8221;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=superhero+since%3A2009-10-22">superhero <strong>since:</strong>2009-10-22</a></td>
<td>containing &#8220;superhero&#8221; and sent since date &#8220;2009-10-22&#8243; (year-month-day).</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=ftw+until%3A2009-10-22">ftw <strong>until:</strong>2009-10-22</a></td>
<td>containing &#8220;ftw&#8221; and sent up to date &#8220;2009-10-22&#8243;.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=movie+-scary+%3A%29">movie -scary <strong>:&#41;</strong></a></td>
<td>containing &#8220;movie&#8221;, but not &#8220;scary&#8221;, and with a positive attitude.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=flight+%3A%28">flight <strong>:&#40;</strong></a></td>
<td>containing &#8220;flight&#8221; and with a negative attitude.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=traffic+%3F">traffic <strong>?</strong></a></td>
<td>containing &#8220;traffic&#8221; and asking a question.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=hilarious+filter%3Alinks">hilarious <strong>filter:links</strong></a></td>
<td>containing &#8220;hilarious&#8221; and linking to URLs.</td>
</tr>
<tr>
<td><a href="http://twitter.com/search?q=news+source%3Atwitterfeed">news <strong>source:twitterfeed</strong></a></td>
<td>containing &#8220;news&#8221; and entered via TwitterFeed</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/advanced-search-options-on-twitter-271/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Check which ports are open on a Linux server</title>
		<link>http://www.gavinpearce.com/blog/check-which-ports-are-open-on-a-linux-server-179</link>
		<comments>http://www.gavinpearce.com/blog/check-which-ports-are-open-on-a-linux-server-179#comments</comments>
		<pubDate>Tue, 20 Apr 2010 12:00:38 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Code Library]]></category>
		<category><![CDATA[Networking and Servers]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=179</guid>
		<description><![CDATA[It&#8217;s very easy to check which ports are listening on your server before IPTABLES and your Firewall takes affect.
SSH command:

netstat -lptu

However, getting a list of open ports after IPTABLES and your Firewall have done their job requires a Port Scan. To get the fairest results this needs to be done from a different machine (depending [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very easy to check which ports are listening on your server <em>before</em> IPTABLES and your Firewall takes affect.</p>
<p>SSH command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">netstat</span> <span style="color: #660033;">-lptu</span></pre></div></div>

<p>However, getting a list of open ports <em>after</em> IPTABLES and your Firewall have done their job requires a Port Scan. To get the fairest results this needs to be done from a different machine (depending on your IPTABLES/Firewall config, and what it is you&#8217;re trying to test).</p>
<p>SSH command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nmap</span> 192.0.32.10</pre></div></div>

<p>You might also find this useful.</p>
<p>SSH command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nmap</span> <span style="color: #660033;">-sS</span> <span style="color: #660033;">-p0-65535</span> <span style="color: #660033;">-P0</span> <span style="color: #660033;">-T4</span> --osscan_limit --osscan_guess --host_timeout 15m <span style="color: #660033;">--max-retries</span> <span style="color: #000000;">0</span> --min_parallelism <span style="color: #000000;">100</span> --max_parallelism <span style="color: #000000;">500</span> <span style="color: #660033;">-O</span> <span style="color: #660033;">-oX</span> <span style="color: #660033;">-V</span> 192.168.1.1</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/check-which-ports-are-open-on-a-linux-server-179/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find closest location using longitude and latitude coordinates in PHP or MySQL</title>
		<link>http://www.gavinpearce.com/blog/find-closest-location-using-longitude-and-latitude-coordinates-in-php-or-mysql-149</link>
		<comments>http://www.gavinpearce.com/blog/find-closest-location-using-longitude-and-latitude-coordinates-in-php-or-mysql-149#comments</comments>
		<pubDate>Tue, 20 Apr 2010 09:00:08 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Code Library]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=149</guid>
		<description><![CDATA[Although at first thought it might not seem it, it&#8217;s actually very simple to find the closest location in PHP or MySQL when given a range of of longitude and latitude coordinates. 
First, lets look at the maths. For those in the know, we&#8217;re essentially calculating the difference in the hypotenuse. Whichever result returns the [...]]]></description>
			<content:encoded><![CDATA[<p>Although at first thought it might not seem it, it&#8217;s actually very simple to find the closest location in PHP or MySQL when given a range of of longitude and latitude coordinates. </p>
<p>First, lets look at the maths. For those in the know, we&#8217;re essentially calculating the difference in the hypotenuse. Whichever result returns the lowest number from our data set will be the closest.</p>
<p>The number we need is the Square Root (&radic;) of:<br />
(firstLongitude-secondLongitude)*(firstLongitude-secondLongitude)<br />
+<br />
(firstlLatitude-secondLatitude)*(firstLatitude-secondLatitude)</p>
<p>Obviously, this number is useless if we have only two locations (and then we wouldn&#8217;t be interested in which was the closest anyway!), so we would loop this equation, changing the second lat/long for each location, to figure which is nearest.</p>
<p>In PHP we can do that like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sqrt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$firstLongitude</span><span style="color: #339933;">-</span><span style="color: #000088;">$secondLongitude</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$firstLongitude</span><span style="color: #339933;">-</span><span style="color: #000088;">$secondLongitude</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$firstlLatitude</span><span style="color: #339933;">-</span><span style="color: #000088;">$secondLatitude</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$firstLatitude</span><span style="color: #339933;">-</span><span style="color: #000088;">$secondLatitude</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Remember, we&#8217;d need this to loop to be useful.</p>
<p>And in MySQL we&#8217;d select the data like this:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">ORDER BY</span> <span style="color: #000099;">SQRT</span>
<span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#40;</span>fLongitude<span style="color: #CC0099;">-</span>sLongitude<span style="color: #FF00FF;">&#41;</span><span style="color: #CC0099;">*</span><span style="color: #FF00FF;">&#40;</span>fLongitude<span style="color: #CC0099;">-</span>sLongitude<span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #CC0099;">+</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#40;</span>fLatitude<span style="color: #CC0099;">-</span>sLatitude<span style="color: #FF00FF;">&#41;</span><span style="color: #CC0099;">*</span><span style="color: #FF00FF;">&#40;</span>fLatitude<span style="color: #CC0099;">-</span>sLatitude<span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span> 
<span style="color: #990099; font-weight: bold;">ASC</span> <span style="color: #990099; font-weight: bold;">LIMIT</span> <span style="color: #008080;">1</span><span style="color: #000033;">;</span></pre></div></div>

<p>Hopefully this will help you get the ground work in place to make a decent start.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/find-closest-location-using-longitude-and-latitude-coordinates-in-php-or-mysql-149/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Display users IP quickly using a batch file</title>
		<link>http://www.gavinpearce.com/blog/display-users-ip-quickly-using-a-batch-file-258</link>
		<comments>http://www.gavinpearce.com/blog/display-users-ip-quickly-using-a-batch-file-258#comments</comments>
		<pubDate>Mon, 19 Apr 2010 12:00:18 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Code Library]]></category>
		<category><![CDATA[Networking and Servers]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=258</guid>
		<description><![CDATA[It&#8217;s a very simple script, but maybe it might help you out. If you want to help a user find out their IP address quickly, create the following .bat file for them and get them to run it.

@echo on
ipconfig
pause

]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a very simple script, but maybe it might help you out. If you want to help a user find out their IP address quickly, create the following .bat file for them and get them to run it.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">@echo <span style="color: #000080;">on</span>
ipconfig
pause</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/display-users-ip-quickly-using-a-batch-file-258/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switch your computer network configuration between DHCP and Static quickly using a batch script</title>
		<link>http://www.gavinpearce.com/blog/switch-your-computer-network-configuration-between-dhcp-and-static-quickly-using-a-batch-script-252</link>
		<comments>http://www.gavinpearce.com/blog/switch-your-computer-network-configuration-between-dhcp-and-static-quickly-using-a-batch-script-252#comments</comments>
		<pubDate>Mon, 19 Apr 2010 09:00:26 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Code Library]]></category>
		<category><![CDATA[Networking and Servers]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=252</guid>
		<description><![CDATA[I run my laptop on several different networks when testing/trialling things. Some of them have different subnets, some of them have DHCP, some of them don&#8217;t.
Constantly jumping into the Control Panel to change my network settings when I change subnet was taking awhile, and another NIC isn&#8217;t an option here, so I made these quick [...]]]></description>
			<content:encoded><![CDATA[<p>I run my laptop on several different networks when testing/trialling things. Some of them have different subnets, some of them have DHCP, some of them don&#8217;t.</p>
<p>Constantly jumping into the Control Panel to change my network settings when I change subnet was taking awhile, and another NIC isn&#8217;t an option here, so I made these quick .bat files that I can run when I need to update things</p>
<p>Set-IP-DHCP.bat:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">netsh interface ip <span style="color: #000080;">set</span> address name=<span style="color: #800000;">&quot;Local Area Connection 2&quot;</span> dhcp
netsh interface ip <span style="color: #000080;">set</span> dns name=<span style="color: #800000;">&quot;Local Area Connection 2&quot;</span> dhcp</pre></div></div>

<p>Set-IP-Static.bat:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">netsh interface ip <span style="color: #000080;">set</span> address name=<span style="color: #800000;">&quot;Local Area Connection 2&quot;</span> source=<span style="color: #000080;">static</span> addr=10.99.88.3 mask=255.255.255.240
netsh interface ip <span style="color: #000080;">set</span> dns name=<span style="color: #800000;">&quot;Local Area Connection 2&quot;</span> source=<span style="color: #000080;">static</span> addr=10.99.88.5  
netsh interface ip add dns name = <span style="color: #800000;">&quot;Local Area Connection 2&quot;</span> addr = 10.99.88.5</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/switch-your-computer-network-configuration-between-dhcp-and-static-quickly-using-a-batch-script-252/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check for valid server name using URL Rewrite &#8211; else redirect.</title>
		<link>http://www.gavinpearce.com/blog/check-for-valid-server-name-using-url-rewrite-else-redirect-182</link>
		<comments>http://www.gavinpearce.com/blog/check-for-valid-server-name-using-url-rewrite-else-redirect-182#comments</comments>
		<pubDate>Mon, 19 Apr 2010 09:00:25 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Code Library]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=182</guid>
		<description><![CDATA[A client of mine has an area of their website that can be accessed via several different domain names, all mapped to the same folder/file structure. (ignore the SEO problems that causes for now  ). 
They wanted part of this website to only be accessed by one domain, and create a 404 error otherwise. [...]]]></description>
			<content:encoded><![CDATA[<p>A client of mine has an area of their website that can be accessed via several different domain names, all mapped to the same folder/file structure. (ignore the SEO problems that causes for now <img src='http://www.gavinpearce.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ). </p>
<p>They wanted part of this website to only be accessed by one domain, and create a 404 error otherwise. I achieved this with a quick URL Rewrite:</p>
<p>Apache Conf:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteCond</span> %{SERVER_NAME} !^websubdomain\.somedomain\.co\.uk
<span style="color: #00007f;">RewriteRule</span> (.*) - [R=<span style="color: #ff0000;">404</span>,L]</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/check-for-valid-server-name-using-url-rewrite-else-redirect-182/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Run a PHP script once a day using a Cron Job</title>
		<link>http://www.gavinpearce.com/blog/run-a-php-script-once-a-day-using-a-cron-job-191</link>
		<comments>http://www.gavinpearce.com/blog/run-a-php-script-once-a-day-using-a-cron-job-191#comments</comments>
		<pubDate>Sun, 18 Apr 2010 12:00:50 +0000</pubDate>
		<dc:creator>Gavin Pearce</dc:creator>
				<category><![CDATA[Code Library]]></category>
		<category><![CDATA[Networking and Servers]]></category>

		<guid isPermaLink="false">http://www.gavinpearce.com/?p=191</guid>
		<description><![CDATA[Just a quick reference guide, I use WGET added to cron to run a PHP script once a day at 7am.
Cron command:

0 7 * * *   wget -O - -q -t 1 http://www.example.net/path-to-file/file.php

or we can use Lynx if need-be.
Cron command:

0 7 * * * /usr/bin/lynx --source http://www.example.net/path-to-file/file.php

If the file isn&#8217;t on the net, [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick reference guide, I use WGET added to cron to run a PHP script once a day at 7am.</p>
<p>Cron command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span>   <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> - <span style="color: #660033;">-q</span> <span style="color: #660033;">-t</span> <span style="color: #000000;">1</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.example.net<span style="color: #000000; font-weight: bold;">/</span>path-to-file<span style="color: #000000; font-weight: bold;">/</span>file.php</pre></div></div>

<p>or we can use Lynx if need-be.</p>
<p>Cron command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">lynx</span> <span style="color: #660033;">--source</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.example.net<span style="color: #000000; font-weight: bold;">/</span>path-to-file<span style="color: #000000; font-weight: bold;">/</span>file.php</pre></div></div>

<p>If the file isn&#8217;t on the net, you can also run it by calling PHP direct&#8230;</p>
<p>Cron command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">-q</span> <span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>x.php</pre></div></div>

<p>Remember to check your path to PHP. Hopefully this will help someone looking for the same thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinpearce.com/blog/run-a-php-script-once-a-day-using-a-cron-job-191/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
