<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Blog of Clive</title>
	
	<link>http://blog.cwenterprises.co.uk</link>
	<description>PHP, MySQL, jQuery code, ideas and general developer crap</description>
	<lastBuildDate>Sun, 12 Feb 2012 12:47:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/BlogOfClive" /><feedburner:info uri="blogofclive" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Installing Debian Linux on  Dell Inspiron 1501</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/cW5c5P6Nxzs/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/12/installing-debian-on-dell-inspiron-1501/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 15:15:53 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[inspiron]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[wireless drivers]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=338</guid>
		<description><![CDATA[Ever wondered how to install linux wireless network drivers on your Dell Inspiron 1501. I've recently given it a go and succeeded. Follow this guide and you'll soon have your laptop running smoothly.]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been setting up Debian Linux on a Dell Inspiron 1501 that I&#8217;ve had lying around refusing to load windows. While the install and setup procedure has been quite easy, I have found that the wireless device doesn&#8217;t want to work. This is a bit of a problem as I don&#8217;t want to be tied to 1 room in my house. After lots of Googling and cursing at failed attempts I have found a solution that works.</p>
<p>Open /etc/apt/sources.list<br />
Click Third-Party Software tab<br />
Add deb http://ftp.us.debian.org/debian squeeze main contrib non-free<br />
Click Close</p>
<p>Open Root Terminal<br />
type
<div class="codesnip-container" >aptitude update</div>
<p>wait for the system to get the new package information</p>
<p>type
<div class="codesnip-container" >aptitude install wireless-tools</div>
<p>Wait for those to download and install</p>
<p>type
<div class="codesnip-container" >aptitude install firmware-b43-installer</div>
<p>Again wait for these to download and install.</p>
<p>type
<div class="codesnip-container" >reboot</div>
<p> and the machine will restart your wireless light will turn on before you get to your login screen. Upon logging in you will be able to connect your Dell Inspiron 1501 to a wireless network and surf wirelessly till you hearts content</p>
<p>I hope this helps if you have a Dell Inspiron 1501 or any other laptop with Broadcom wireless device based on the b43 driver.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/12/installing-debian-on-dell-inspiron-1501/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/12/installing-debian-on-dell-inspiron-1501/</feedburner:origLink></item>
		<item>
		<title>Emailology – The Science of Looking Good in the Inbox</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/sFRYsYH8_i0/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/11/emailology-the-science-of-looking-good-in-the-inbox/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 19:42:38 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=334</guid>
		<description><![CDATA[Emailology &#8211; The Science of Looking Good in the Inbox. While catching up on some rss feeds today this little gem popped into my window. It contains a boilerplate for HTML emails in loads of email programs. The compressed mode which is 109 lines of code. &#160; &#160; The site also contains faq about common [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.emailology.org/#1">Emailology &#8211; The Science of Looking Good in the Inbox</a>.</p>
<p>While catching up on some rss feeds today this little gem popped into my window. It contains a boilerplate for HTML emails in loads of email programs. The compressed mode which is 109 lines of code.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.emailology.org/#1"><img src='http://blog.cwenterprises.co.uk/wp-content/uploads/2011/11/emailology.11.jpg' alt='FAQ&#039;s' /></a></p>
<p>&nbsp;</p>
<p>The site also contains faq about common email clients for individual styling or tips. You can also view a standards guide to see which tag and attributes are supported to get the most out of your campaign.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.emailology.org/#1"><img src='http://blog.cwenterprises.co.uk/wp-content/uploads/2011/11/emailology.21.jpg' alt='Standards sheet to shot supported tags and attributes' /></a></p>
<p>This site is definitely one that will be in my links list. I can see this coming in very handy when I&#8217;m doing my next client mailer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/11/emailology-the-science-of-looking-good-in-the-inbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/11/emailology-the-science-of-looking-good-in-the-inbox/</feedburner:origLink></item>
		<item>
		<title>PHP Filename Friendly Function</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/HUrC4kZxUd0/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/11/php-filename-friendly-function/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 14:52:48 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=300</guid>
		<description><![CDATA[This function outputs a string that is filename friendly. It removes all non-characters and punctuation from the input and converts to lowercase. I find this useful for seo friendly cms pages. This function is still being tweaked so any improvements would be most appreciated. function checkCharacters&#40;$title&#41; &#123; &#160; &#160; &#160; &#160; $final_text = &#8221;; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>This function outputs a string that is filename friendly. It removes all non-characters and punctuation from the input and converts to lowercase. I find this useful for seo friendly cms pages. This function is still being tweaked so any improvements would be most appreciated.</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> checkCharacters<span class="br0">&#40;</span><span class="re0">$title</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$final_text</span> <span class="sy0">=</span> <span class="st_h">&#8221;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$title</span> <span class="sy0">=</span> <a href="http://www.php.net/strtolower"><span class="kw3">strtolower</span></a><span class="br0">&#40;</span><a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><a href="http://www.php.net/stripslashes"><span class="kw3">stripslashes</span></a><span class="br0">&#40;</span><span class="re0">$title</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="re0">$i</span><span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span><span class="re0">$i</span><span class="sy0">&lt;</span>strlen<span class="br0">&#40;</span><span class="re0">$title</span><span class="br0">&#41;</span><span class="sy0">;</span><span class="re0">$i</span><span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$letter</span> <span class="sy0">=</span> <a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$title</span><span class="sy0">,</span><span class="re0">$i</span><span class="sy0">,</span>1<span class="br0">&#41;</span><span class="sy0">;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ascii</span> <span class="sy0">=</span> <a href="http://www.php.net/ord"><span class="kw3">ord</span></a><span class="br0">&#40;</span><span class="re0">$letter</span><span class="br0">&#41;</span><span class="sy0">;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="re0">$ascii</span><span class="sy0">&gt;=</span>97 <span class="sy0">&amp;&amp;</span> <span class="re0">$ascii</span><span class="sy0">&lt;=</span>122<span class="br0">&#41;</span> <span class="sy0">||</span> <span class="br0">&#40;</span><span class="re0">$ascii</span><span class="sy0">&gt;=</span>48 <span class="sy0">&amp;&amp;</span> <span class="re0">$ascii</span><span class="sy0">&lt;=</span>57<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="re0">$final_text</span> <span class="sy0">.=</span> <span class="re0">$letter</span><span class="sy0">;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="re0">$final_text</span> <span class="sy0">.=</span> <span class="st0">&quot;-&quot;</span><span class="sy0">;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$final_text</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/11/php-filename-friendly-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/11/php-filename-friendly-function/</feedburner:origLink></item>
		<item>
		<title>CSS center content within a div</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/J4Z9MS6Q6XA/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/07/css-center-within-div/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 20:51:46 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[positioning]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=314</guid>
		<description><![CDATA[Here’s an old bit of code that I found to position something centrally inside an element.]]></description>
			<content:encoded><![CDATA[<p>Here’s an old bit of code that I found to position something centrally inside an element.</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">#idOfTheDiv</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">400px</span><span class="sy0">;</span> <span class="coMULTI">/* here you put the width that you need */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">height</span><span class="sy0">:</span> <span class="re3">200px</span><span class="sy0">;</span> <span class="coMULTI">/* here you put the height that you need */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">position</span><span class="sy0">:</span><span class="kw2">absolute</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">left</span><span class="sy0">:</span><span class="re3"><span class="nu0">50</span>%</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">top</span><span class="sy0">:</span><span class="re3"><span class="nu0">50</span>%</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">margin-left</span><span class="sy0">:</span><span class="re3">-200px</span><span class="sy0">;</span> <span class="coMULTI">/* this number always to be the width divided two in negative */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">margin-top</span><span class="sy0">:</span><span class="re3">-100px</span><span class="sy0">;</span> <span class="coMULTI">/* this number always to be the height divided two in negative */</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/07/css-center-within-div/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/07/css-center-within-div/</feedburner:origLink></item>
		<item>
		<title>Google+ support added to posts</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/ax9NMDVljE4/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/07/google-support-added-to-posts/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 21:56:33 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[social media]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=320</guid>
		<description><![CDATA[Now that Google+ buttons have been out for ages, I&#8217;ve finally got them added to my posts. That&#8217;s all for this post, just thought I&#8217;d make people aware!]]></description>
			<content:encoded><![CDATA[<p>Now that Google+ buttons have been out for ages, I&#8217;ve finally got them added to my posts. </p>
<p>That&#8217;s all for this post, just thought I&#8217;d make people aware! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/07/google-support-added-to-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/07/google-support-added-to-posts/</feedburner:origLink></item>
		<item>
		<title>PHP Function to find the last key of a multidimensional array</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/n_4sKRAV2eI/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/07/php-function-to-find-the-last-key-of-a-multidimensional-array/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 20:31:35 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[multidimensional]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=316</guid>
		<description><![CDATA[This function is great for retrieving the last key of a multidimensional array. I use this function on a site that stores cake options such as size, shape, ribbon colour, icing colour and text fields for use in a shopping basket. Not all cakes have all the options so i need to know where the end of the array is, hence this function.]]></description>
			<content:encoded><![CDATA[<p>This function is great for retrieving the last key of a multidimensional array. I use this function on a site that stores cake options such as size, shape, ribbon colour, icing colour and text fields for use in a shopping basket. Not all cakes have all the options so i need to know where the end of the array is, hence this function.</p>
<p>Hope this helps people, if there is a better way of doing it, please feel free to discuss in the comments.</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><a href="http://www.php.net/array_push"><span class="kw3">array_push</span></a><span class="br0">&#40;</span><span class="re0">$_SESSION</span><span class="br0">&#91;</span><span class="st0">&quot;cake&quot;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&quot;items&quot;</span><span class="br0">&#93;</span><span class="sy0">,</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;product&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">&quot;id&quot;</span><span class="br0">&#93;</span><span class="sy0">,</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;size&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">&quot;cake-size&quot;</span><span class="br0">&#93;</span><span class="sy0">,</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;message&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">&quot;cake-message&quot;</span><span class="br0">&#93;</span><span class="sy0">,</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;style&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">&quot;shape&quot;</span><span class="br0">&#93;</span><span class="sy0">,</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;flavour&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$cakeflavour</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;qty&quot;</span> <span class="sy0">=&gt;</span> 1<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$arkey</span> <span class="sy0">=</span> <a href="http://www.php.net/array_pop"><span class="kw3">array_pop</span></a><span class="br0">&#40;</span><a href="http://www.php.net/array_keys"><span class="kw3">array_keys</span></a><span class="br0">&#40;</span><span class="re0">$_SESSION</span><span class="br0">&#91;</span><span class="st0">&quot;cake&quot;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&quot;items&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/07/php-function-to-find-the-last-key-of-a-multidimensional-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/07/php-function-to-find-the-last-key-of-a-multidimensional-array/</feedburner:origLink></item>
		<item>
		<title>PHP Colour lightness function</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/IfJhq-I4jKY/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/06/php-colour-lightness-function/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 18:02:11 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=296</guid>
		<description><![CDATA[Following on from my other 2 useful functions I thought I would show you another one which I have found useful for determining if a colour background needs a white or black text colour over the top. I found this function a while back so can&#8217;t take the credit for writing it myself, I have [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from my other 2 useful functions I thought I would show you another one which I have found useful for determining if a colour background needs a white or black text colour over the top. </p>
<p>I found this function a while back so can&#8217;t take the credit for writing it myself, I have no idea to give the credit to but whoever you are thank you. </p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> get_brightness<span class="br0">&#40;</span><span class="re0">$hex</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// returns brightness value from 0 to 255</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// strip off any leading #</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$hex</span> <span class="sy0">=</span> <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">&#40;</span><span class="st_h">&#8216;#&#8217;</span><span class="sy0">,</span> <span class="st_h">&#8221;</span><span class="sy0">,</span> <span class="re0">$hex</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$c_r</span> <span class="sy0">=</span> <a href="http://www.php.net/hexdec"><span class="kw3">hexdec</span></a><span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$hex</span><span class="sy0">,</span> 0<span class="sy0">,</span> 2<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$c_g</span> <span class="sy0">=</span> <a href="http://www.php.net/hexdec"><span class="kw3">hexdec</span></a><span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$hex</span><span class="sy0">,</span> 2<span class="sy0">,</span> 2<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$c_b</span> <span class="sy0">=</span> <a href="http://www.php.net/hexdec"><span class="kw3">hexdec</span></a><span class="br0">&#40;</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$hex</span><span class="sy0">,</span> 4<span class="sy0">,</span> 2<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="re0">$c_r</span> <span class="sy0">*</span> 299<span class="br0">&#41;</span> <span class="sy0">+</span> <span class="br0">&#40;</span><span class="re0">$c_g</span> <span class="sy0">*</span> 587<span class="br0">&#41;</span> <span class="sy0">+</span> <span class="br0">&#40;</span><span class="re0">$c_b</span> <span class="sy0">*</span> 114<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">/</span> <span class="nu0">1000</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>The function takes your hex colour input and returns a value between 0 and 255. 0 is the darkest and 255 is lightest. I find a value around 80-90 is a good place to change the text colour from white to black, but this figure is worth experimenting with.</p>
<p>I hope this function helps you as much as it has me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/06/php-colour-lightness-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/06/php-colour-lightness-function/</feedburner:origLink></item>
		<item>
		<title>PHP Function IP if behind a proxy</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/FhnYa_aPmWY/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/06/ip-if-behind-a-proxy/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 05:26:54 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[ip address]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=291</guid>
		<description><![CDATA[Following from my last post, here is the method to get your IP address if you are behind a proxy. It's a much better function than the earlier post as it will almost guarantee a return result.]]></description>
			<content:encoded><![CDATA[<p>Following from my last post, here is the method to get your IP address if you are behind a proxy.</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> getRealIPAddr<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><a href="http://www.php.net/empty"><span class="kw3">empty</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;HTTP_CLIENT_IP&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> &nbsp; <span class="co1">//check ip from share internet</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ip</span><span class="sy0">=</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;HTTP_CLIENT_IP&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">elseif</span> <span class="br0">&#40;</span><span class="sy0">!</span><a href="http://www.php.net/empty"><span class="kw3">empty</span></a><span class="br0">&#40;</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;HTTP_X_FORWARDED_FOR&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> &nbsp; <span class="co1">//to check ip is pass from proxy</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ip</span><span class="sy0">=</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;HTTP_X_FORWARDED_FOR&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ip</span><span class="sy0">=</span><span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;REMOTE_ADDR&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$ip</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>As this method gets more accurate results it is better to use this than the previous function.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/06/ip-if-behind-a-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/06/ip-if-behind-a-proxy/</feedburner:origLink></item>
		<item>
		<title>PHP Function to return your IP address</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/R3mSYEmd3Rs/</link>
		<comments>http://blog.cwenterprises.co.uk/2011/06/php-function-to-return-your-ip-address/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 20:20:58 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[ip address]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=287</guid>
		<description><![CDATA[Here's a quick little function which can be used to return your IP address. Not as useful as the next method but a simple quick solution]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick little function which can be used to return your IP address</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> getRemoteIPAddress<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ip</span> <span class="sy0">=</span> <span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">&#8216;REMOTE_ADDR&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$ip</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>The result can be very handy when combined with an if statement to code  parts of a site you don&#8217;t want the end user to see. Just remember you need to know your IP address before you can create the statement below.</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$ip</span> <span class="sy0">=</span> getRemoteIPAddress<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$ip</span> <span class="sy0">==</span> <span class="st0">&quot;insert your IP here&quot;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//run the code only you want to see here</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2011/06/php-function-to-return-your-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2011/06/php-function-to-return-your-ip-address/</feedburner:origLink></item>
		<item>
		<title>Getting a missing window back on-screen</title>
		<link>http://feedproxy.google.com/~r/BlogOfClive/~3/6UNlVCZpvzo/</link>
		<comments>http://blog.cwenterprises.co.uk/2010/11/getting-a-missing-window-back-on-screen/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 12:40:58 +0000</pubDate>
		<dc:creator>Clive Walkden</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[pc]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.cwenterprises.co.uk/?p=284</guid>
		<description><![CDATA[I had an interesting experience the other day where an application window appeared off screen and therefore hindered my progress on a website build. I put this down to the fact that I run two monitors on my work machine and since moving them, I must have put them the opposite way around. This had [...]]]></description>
			<content:encoded><![CDATA[<p>I had an interesting experience the other day where an application window appeared off screen and therefore hindered my progress on a website build. I put this down to the fact that I run two monitors on my work machine and since moving them, I must have put them the opposite way around. This had me a little confused for a while, and as always the case, this website is running a couple of days behind schedule already.</p>
<p>After thinking the software had crashed when I requested this particular window, I decided to just try hitting the escape key to see if the window had opened and was not appearing on the main or secondary monitor. Bingo, application responding again to mouse clicks! When this has happened in the past the window offscreen has been the main application window so right clicking in the taskbar and selecting move has generally got me working again. Not this time as it was a window within the program.</p>
<p>The workaround that I found was this.</p>
<p>Use Alt+Space, then M, then Arrow key, and then move your mouse. The window snaps to your cursor and everything is all good again. Time for me to crack on with the web project!</p>
<p>Hope this helps people with similar problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cwenterprises.co.uk/2010/11/getting-a-missing-window-back-on-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.cwenterprises.co.uk/2010/11/getting-a-missing-window-back-on-screen/</feedburner:origLink></item>
	</channel>
</rss>

