<?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>Cardboard Coder</title>
	
	<link>http://www.cardboardcoder.com</link>
	<description>Sometimes it's all you need...</description>
	<lastBuildDate>Fri, 05 Mar 2010 09:45:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/cardboardcoder/Card" /><feedburner:info uri="cardboardcoder/card" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>cardboardcoder/Card</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Stop Most Robots Posting to your Forms</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/N0ewPQ9Xufs/</link>
		<comments>http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 09:45:07 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=489</guid>
		<description><![CDATA[Sometimes you don&#8217;t want to use captchas or &#8220;are you human questions&#8221; on your forms, well here&#8217;s a simply way to block the vast majority of bots posting to your website forms.

This quick technique is easy to implement and relies on that fact that bots are stupid and pick up on keywords and try to [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you don&#8217;t want to use captchas or &#8220;are you human questions&#8221; on your forms, well here&#8217;s a simply way to block the vast majority of bots posting to your website forms.</p>
<p><span id="more-489"></span></p>
<p><img class="alignleft" style="margin: 10px;" title="Robot (Wall-E)" src="http://gandt.blogs.brynmawr.edu/files/2009/01/wall-e-dancing-robot-plays-mp3s.jpg" alt="" width="130" height="130" />This quick technique is easy to implement and relies on that fact that bots are stupid and pick up on keywords and try to complete all the fields in a form.</p>
<p>The best way to stop bots is to always use a combination of techniques, such as captchas and IP address checking, but this method will help eliminate a lot of junk.</p>
<p>On your form simply include a hidden text field called something generic like &#8220;email&#8221; if you have an email field call it something obscure like &#8220;customcontact&#8221; eg:</p>
<pre class="brush: html">
&lt;form method=&quot;post&quot; action=&quot;/form&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;customcontact&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;email&quot; /&gt;
&lt;input type=&quot;submit&quot; value=&quot;GO&quot; /&gt;
&lt;/form&gt;
</pre>
<p>The bot will see the hidden email field and try to populate it. On you form validation, check to see if this field is empty:</p>
<pre class="brush: php">

if(empty($_POST[&#039;email&#039;])) {
// you are a human
} else {
// you are a robot
}
</pre>
<p>If the field has something in it, a bot has made the submission so discard it.</p>
<p>If you find that this still doesn&#8217;t work try using CSS instead:</p>
<pre class="brush: html">
&lt;form method=&quot;post&quot; action=&quot;/form&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;customcontact&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;email&quot; style=&quot;display:none;&quot;/&gt;
&lt;input type=&quot;submit&quot; value=&quot;GO&quot; /&gt;
&lt;/form&gt;
</pre>
<p>The bot will see the field and try to populate it as it ignores CSS styles, an actual user won&#8217;t see the field so won&#8217;t be able to add anything to it.</p>
<p>This is not a fail-safe way to stop bots submitting your form, but will help reduce a number of rudimentary bot attacks on your forms.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;t=Stop+Most+Robots+Posting+to+your+Forms" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Stop+Most+Robots+Posting+to+your+Forms+-+http://b2l.me/h5bef+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;title=Stop+Most+Robots+Posting+to+your+Forms" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;title=Stop+Most+Robots+Posting+to+your+Forms" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;title=Stop+Most+Robots+Posting+to+your+Forms" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;t=Stop+Most+Robots+Posting+to+your+Forms" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;title=Stop+Most+Robots+Posting+to+your+Forms" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;title=Stop+Most+Robots+Posting+to+your+Forms&amp;summary=Sometimes%20you%20don%27t%20want%20to%20use%20captchas%20or%20%22are%20you%20human%20questions%22%20on%20your%20forms%2C%20well%20here%27s%20a%20simply%20way%20to%20block%20the%20vast%20majority%20of%20bots%20posting%20to%20your%20website%20forms.%0D%0A%0D%0A%0D%0A%0D%0AThis%20quick%20technique%20is%20easy%20to%20implement%20and%20relies%20on%20that%20fact%20that%20bots%20are%20stupid%20and%20pick%20up%20on%20keywords%20and%20tr&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;title=Stop+Most+Robots+Posting+to+your+Forms" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/&amp;title=Stop+Most+Robots+Posting+to+your+Forms&amp;body=Sometimes%20you%20don%27t%20want%20to%20use%20captchas%20or%20%22are%20you%20human%20questions%22%20on%20your%20forms%2C%20well%20here%27s%20a%20simply%20way%20to%20block%20the%20vast%20majority%20of%20bots%20posting%20to%20your%20website%20forms.%0D%0A%0D%0A%0D%0A%0D%0AThis%20quick%20technique%20is%20easy%20to%20implement%20and%20relies%20on%20that%20fact%20that%20bots%20are%20stupid%20and%20pick%20up%20on%20keywords%20and%20tr" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Stop%20Most%20Robots%20Posting%20to%20your%20Forms%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22Sometimes%20you%20don%27t%20want%20to%20use%20captchas%20or%20%22are%20you%20human%20questions%22%20on%20your%20forms%2C%20well%20here%27s%20a%20simply%20way%20to%20block%20the%20vast%20majority%20of%20bots%20posting%20to%20your%20website%20forms.%0D%0A%0D%0A%0D%0A%0D%0AThis%20quick%20technique%20is%20easy%20to%20implement%20and%20relies%20on%20that%20fact%20that%20bots%20are%20stupid%20and%20pick%20up%20on%20keywords%20and%20tr%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/03/stop-most-robots-posting-to-your-forms/</feedburner:origLink></item>
		<item>
		<title>Move a background image in relation to the mouse</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/99nE9jYLUJc/</link>
		<comments>http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 09:21:52 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=480</guid>
		<description><![CDATA[To add a bit of flare to your site you may want to move a background image in relation to where the users cursor is, this can create some very cool animation.


Using this code snippet can produce some very funky results, if could use it for accessibility highlighting where to mouse is for instance, or [...]]]></description>
			<content:encoded><![CDATA[<p>To add a bit of flare to your site you may want to move a background image in relation to where the users cursor is, this can create some very cool animation.</p>
<p><span id="more-480"></span></p>
<p><img class="alignleft" style="margin: 10px;" src="http://www.anuglymind.co.uk/images/words-repeat.jpg" alt="" width="200" height="200" /></p>
<p>Using this code snippet can produce some very funky results, if could use it for accessibility highlighting where to mouse is for instance, or to create a crude animation.</p>
<p>It works very well when you just want to add a bit of dynamic movement to the site but don&#8217;t want to use flash because of accessbility issues.</p>
<p>We tend to find it works best with tiled backgrounds, as you then never see the clipping where the image ends and it makes it look perspective.</p>
<p>First of all add an id and the initial style to your element, in our example we are going to dynamically move the body background image so we add this:</p>
<pre class="brush: html">

&lt;body id=&quot;doc&quot; style=&quot;background-position:0px 0px&quot;&gt;
</pre>
<p>Then simply include this piece of lovely JavaScript:</p>
<pre class="brush: javascript">

var IE = document.all?true:false

if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
} else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX
tempY = e.pageY
}

if (tempX &lt; 0){tempX = 0}
if (tempY &lt; 0){tempY = 0}

var pos = tempX + &quot;px &quot; + tempY + &quot;px&quot;;

document.getElementById(&#039;doc&#039;).style.backgroundPosition = pos;

}
</pre>
<p>If you need to you can change the id of the element with the background image or even include delays to create momentum etcetera.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;t=Move+a+background+image+in+relation+to+the+mouse" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Move+a+background+image+in+relation+to+the+mouse+-+http://b2l.me/gsfua+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;title=Move+a+background+image+in+relation+to+the+mouse" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;title=Move+a+background+image+in+relation+to+the+mouse" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;title=Move+a+background+image+in+relation+to+the+mouse" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;t=Move+a+background+image+in+relation+to+the+mouse" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;title=Move+a+background+image+in+relation+to+the+mouse" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;title=Move+a+background+image+in+relation+to+the+mouse&amp;summary=To%20add%20a%20bit%20of%20flare%20to%20your%20site%20you%20may%20want%20to%20move%20a%20background%20image%20in%20relation%20to%20where%20the%20users%20cursor%20is%2C%20this%20can%20create%20some%20very%20cool%20animation.%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AUsing%20this%20code%20snippet%20can%20produce%20some%20very%20funky%20results%2C%20if%20could%20use%20it%20for%20accessibility%20highlighting%20where%20to%20mouse%20is%20for%20&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;title=Move+a+background+image+in+relation+to+the+mouse" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/&amp;title=Move+a+background+image+in+relation+to+the+mouse&amp;body=To%20add%20a%20bit%20of%20flare%20to%20your%20site%20you%20may%20want%20to%20move%20a%20background%20image%20in%20relation%20to%20where%20the%20users%20cursor%20is%2C%20this%20can%20create%20some%20very%20cool%20animation.%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AUsing%20this%20code%20snippet%20can%20produce%20some%20very%20funky%20results%2C%20if%20could%20use%20it%20for%20accessibility%20highlighting%20where%20to%20mouse%20is%20for%20" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Move%20a%20background%20image%20in%20relation%20to%20the%20mouse%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22To%20add%20a%20bit%20of%20flare%20to%20your%20site%20you%20may%20want%20to%20move%20a%20background%20image%20in%20relation%20to%20where%20the%20users%20cursor%20is%2C%20this%20can%20create%20some%20very%20cool%20animation.%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AUsing%20this%20code%20snippet%20can%20produce%20some%20very%20funky%20results%2C%20if%20could%20use%20it%20for%20accessibility%20highlighting%20where%20to%20mouse%20is%20for%20%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/02/move-a-background-image-in-relation-to-the-mouse/</feedburner:origLink></item>
		<item>
		<title>Video Game Website Gives all it’s profit to Charity</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/hqlnv6LUiiY/</link>
		<comments>http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 12:34:22 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[charity]]></category>
		<category><![CDATA[PS3]]></category>
		<category><![CDATA[Video Games]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=477</guid>
		<description><![CDATA[Sometimes you read an article that just makes you smile, this is such one:
http://www.ps3attitude.com/new/2010/02/no-fuss-reviews-4000-charity/
A video game review website that has given all of it&#8217;s profit to video game related charities to help with things such as anti-social behaviour and really given vulnerable children the chance to get of the street and enjoy some entertainment.





		
			Share this [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you read an article that just makes you smile, this is such one:</p>
<p><a href="http://www.ps3attitude.com/new/2010/02/no-fuss-reviews-4000-charity/">http://www.ps3attitude.com/new/2010/02/no-fuss-reviews-4000-charity/</a></p>
<p>A video game review website that has given all of it&#8217;s profit to video game related charities to help with things such as anti-social behaviour and really given vulnerable children the chance to get of the street and enjoy some entertainment.</p>



<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;t=Video+Game+Website+Gives+all+it%27s+profit+to+Charity" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Video+Game+Website+Gives+all+it%27s+profit+to+Charity+-+http://b2l.me/f59xf+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;title=Video+Game+Website+Gives+all+it%27s+profit+to+Charity" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;title=Video+Game+Website+Gives+all+it%27s+profit+to+Charity" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;title=Video+Game+Website+Gives+all+it%27s+profit+to+Charity" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;t=Video+Game+Website+Gives+all+it%27s+profit+to+Charity" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;title=Video+Game+Website+Gives+all+it%27s+profit+to+Charity" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;title=Video+Game+Website+Gives+all+it%27s+profit+to+Charity&amp;summary=Sometimes%20you%20read%20an%20article%20that%20just%20makes%20you%20smile%2C%20this%20is%20such%20one%3A%0D%0A%0D%0Ahttp%3A%2F%2Fwww.ps3attitude.com%2Fnew%2F2010%2F02%2Fno-fuss-reviews-4000-charity%2F%0D%0A%0D%0AA%20video%20game%20review%20website%20that%20has%20given%20all%20of%20it%27s%20profit%20to%20video%20game%20related%20charities%20to%20help%20with%20things%20such%20as%20anti-social%20behaviour%20and%20re&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;title=Video+Game+Website+Gives+all+it%27s+profit+to+Charity" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/&amp;title=Video+Game+Website+Gives+all+it%27s+profit+to+Charity&amp;body=Sometimes%20you%20read%20an%20article%20that%20just%20makes%20you%20smile%2C%20this%20is%20such%20one%3A%0D%0A%0D%0Ahttp%3A%2F%2Fwww.ps3attitude.com%2Fnew%2F2010%2F02%2Fno-fuss-reviews-4000-charity%2F%0D%0A%0D%0AA%20video%20game%20review%20website%20that%20has%20given%20all%20of%20it%27s%20profit%20to%20video%20game%20related%20charities%20to%20help%20with%20things%20such%20as%20anti-social%20behaviour%20and%20re" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Video%20Game%20Website%20Gives%20all%20it%27s%20profit%20to%20Charity%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22Sometimes%20you%20read%20an%20article%20that%20just%20makes%20you%20smile%2C%20this%20is%20such%20one%3A%0D%0A%0D%0Ahttp%3A%2F%2Fwww.ps3attitude.com%2Fnew%2F2010%2F02%2Fno-fuss-reviews-4000-charity%2F%0D%0A%0D%0AA%20video%20game%20review%20website%20that%20has%20given%20all%20of%20it%27s%20profit%20to%20video%20game%20related%20charities%20to%20help%20with%20things%20such%20as%20anti-social%20behaviour%20and%20re%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/02/video-game-website-gives-all-its-profit-to-charity/</feedburner:origLink></item>
		<item>
		<title>jQuery loading animation during page load or form submission</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/sp0pbBSbYNQ/</link>
		<comments>http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 09:02:14 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=470</guid>
		<description><![CDATA[This is a really quick and nasty way to display a div while a form is submitting.
First off ensure you include jQuery in the head of your document and before you call any other JavaScript Library.
Then on your forms submission button add an onclick event like so:

&#60;input id=&#34;uploadBtn&#34; onclick=&#34;loadingscreen();&#34; name=&#34;uploadBtn&#34; type=&#34;button&#34; /&#62;

Now include the div [...]]]></description>
			<content:encoded><![CDATA[<p>This is a really quick and nasty way to display a div while a form is submitting.</p>
<p><span id="more-470"></span><img class="alignleft" style="margin: 10px;" title="Filling out a Form" src="http://markontheworld.files.wordpress.com/2007/08/filling-out-form.jpg" alt="" width="182" height="121" />First off ensure you include jQuery in the head of your document and before you call any other JavaScript Library.</p>
<p>Then on your forms submission button add an onclick event like so:</p>
<pre class="brush: javascript">
&lt;input id=&quot;uploadBtn&quot; onclick=&quot;loadingscreen();&quot; name=&quot;uploadBtn&quot; type=&quot;button&quot; /&gt;
</pre>
<p>Now include the div that contains a loading animation at the top of the page and style it as you see fit, then set it&#8217;s display as &#8220;none&#8221; using an inline style like so:</p>
<pre class="brush: javascript">

&lt;div id=&quot;myControl_loadingdiv&quot; class=&quot;on&quot; style=&quot;display:none;&quot;&gt;&lt;/div&gt;
</pre>
<p>Now in the head of your page set the function we assign to the button like so:</p>
<pre class="brush: javascript">
$(document).ready(function() {
$(&#039;#myControl_loadingdiv&#039;).hide();

});

function loadingscreen() {
$(&#039;#myControl_loadingdiv&#039;).show();
$(document).ready(function() {
$(&#039;#myControl_loadingdiv&#039;).show();

});
};
</pre>
<p>This nasty method takes advantage of the document ready function in jQuery, by including it in a function when it is called it checks again to see if the document is indeed ready (which it will not as the form is submitting) but once the form has submitted the animation will disappear. This is handy particularly for Ajax forms but could be used in all manner of ways.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;t=jQuery+loading+animation+during+page+load+or+form+submission" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=jQuery+loading+animation+during+page+load+or+form+submission+-+http://b2l.me/fw3xn+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;title=jQuery+loading+animation+during+page+load+or+form+submission" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;title=jQuery+loading+animation+during+page+load+or+form+submission" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;title=jQuery+loading+animation+during+page+load+or+form+submission" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;t=jQuery+loading+animation+during+page+load+or+form+submission" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;title=jQuery+loading+animation+during+page+load+or+form+submission" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;title=jQuery+loading+animation+during+page+load+or+form+submission&amp;summary=This%20is%20a%20really%20quick%20and%20nasty%20way%20to%20display%20a%20div%20while%20a%20form%20is%20submitting.%0D%0A%0D%0AFirst%20off%20ensure%20you%20include%20jQuery%20in%20the%20head%20of%20your%20document%20and%20before%20you%20call%20any%20other%20JavaScript%20Library.%0D%0A%0D%0AThen%20on%20your%20forms%20submission%20button%20add%20an%20onclick%20event%20like%20so%3A%0D%0A%0D%0A%5Bsourcecode%20language%3D%22javas&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;title=jQuery+loading+animation+during+page+load+or+form+submission" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/&amp;title=jQuery+loading+animation+during+page+load+or+form+submission&amp;body=This%20is%20a%20really%20quick%20and%20nasty%20way%20to%20display%20a%20div%20while%20a%20form%20is%20submitting.%0D%0A%0D%0AFirst%20off%20ensure%20you%20include%20jQuery%20in%20the%20head%20of%20your%20document%20and%20before%20you%20call%20any%20other%20JavaScript%20Library.%0D%0A%0D%0AThen%20on%20your%20forms%20submission%20button%20add%20an%20onclick%20event%20like%20so%3A%0D%0A%0D%0A%5Bsourcecode%20language%3D%22javas" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22jQuery%20loading%20animation%20during%20page%20load%20or%20form%20submission%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22This%20is%20a%20really%20quick%20and%20nasty%20way%20to%20display%20a%20div%20while%20a%20form%20is%20submitting.%0D%0A%0D%0AFirst%20off%20ensure%20you%20include%20jQuery%20in%20the%20head%20of%20your%20document%20and%20before%20you%20call%20any%20other%20JavaScript%20Library.%0D%0A%0D%0AThen%20on%20your%20forms%20submission%20button%20add%20an%20onclick%20event%20like%20so%3A%0D%0A%0D%0A%5Bsourcecode%20language%3D%22javas%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/02/jquery-loading-animation-during-page-load-or-form-submission/</feedburner:origLink></item>
		<item>
		<title>SQL – Bad error messages</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/yIYgqg7IkfI/</link>
		<comments>http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 16:45:02 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Useful Links]]></category>
		<category><![CDATA[bad]]></category>
		<category><![CDATA[codes]]></category>
		<category><![CDATA[confused]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[messages]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=468</guid>
		<description><![CDATA[All us SQL guys must have come accross an error that leaves us confused&#8230;. sometimes more confused then if it said nothing!
I have been looking at this blog recently and thought this post was top notch &#8211; take a look:
http://sqlblog.com/blogs/aaron_bertrand/archive/2010/02/04/bad-error-messages.aspx





		
			Share this on Facebook
		
		
			Tweet This!
		
		
			Digg this!
		
		
			Share this on del.icio.us
		
		
			Share this on Reddit
		
		
			Post this to MySpace
		
		
			Stumble upon [...]]]></description>
			<content:encoded><![CDATA[<p>All us SQL guys must have come accross an error that leaves us confused&#8230;. sometimes more confused then if it said nothing!</p>
<p>I have been looking at this blog recently and thought this post was top notch &#8211; take a look:</p>
<p><a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2010/02/04/bad-error-messages.aspx">http://sqlblog.com/blogs/aaron_bertrand/archive/2010/02/04/bad-error-messages.aspx</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;t=SQL+-+Bad+error+messages" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=SQL+-+Bad+error+messages+-+http://b2l.me/fm2u7+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;title=SQL+-+Bad+error+messages" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;title=SQL+-+Bad+error+messages" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;title=SQL+-+Bad+error+messages" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;t=SQL+-+Bad+error+messages" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;title=SQL+-+Bad+error+messages" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;title=SQL+-+Bad+error+messages&amp;summary=All%20us%20SQL%20guys%20must%20have%20come%20accross%20an%20error%20that%20leaves%20us%20confused....%20sometimes%20more%20confused%20then%20if%20it%20said%20nothing%21%0D%0A%0D%0AI%20have%20been%20looking%20at%20this%20blog%20recently%20and%20thought%20this%20post%20was%20top%20notch%20-%20take%20a%20look%3A%0D%0A%0D%0Ahttp%3A%2F%2Fsqlblog.com%2Fblogs%2Faaron_bertrand%2Farchive%2F2010%2F02%2F04%2Fbad-error-message&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;title=SQL+-+Bad+error+messages" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/&amp;title=SQL+-+Bad+error+messages&amp;body=All%20us%20SQL%20guys%20must%20have%20come%20accross%20an%20error%20that%20leaves%20us%20confused....%20sometimes%20more%20confused%20then%20if%20it%20said%20nothing%21%0D%0A%0D%0AI%20have%20been%20looking%20at%20this%20blog%20recently%20and%20thought%20this%20post%20was%20top%20notch%20-%20take%20a%20look%3A%0D%0A%0D%0Ahttp%3A%2F%2Fsqlblog.com%2Fblogs%2Faaron_bertrand%2Farchive%2F2010%2F02%2F04%2Fbad-error-message" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22SQL%20-%20Bad%20error%20messages%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22All%20us%20SQL%20guys%20must%20have%20come%20accross%20an%20error%20that%20leaves%20us%20confused....%20sometimes%20more%20confused%20then%20if%20it%20said%20nothing%21%0D%0A%0D%0AI%20have%20been%20looking%20at%20this%20blog%20recently%20and%20thought%20this%20post%20was%20top%20notch%20-%20take%20a%20look%3A%0D%0A%0D%0Ahttp%3A%2F%2Fsqlblog.com%2Fblogs%2Faaron_bertrand%2Farchive%2F2010%2F02%2F04%2Fbad-error-message%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/02/sql-bad-error-messages/</feedburner:origLink></item>
		<item>
		<title>SQL AD Group membership</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/VHy_J7lij2Q/</link>
		<comments>http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 14:57:55 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Active]]></category>
		<category><![CDATA[AD]]></category>
		<category><![CDATA[Directory]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[membership]]></category>
		<category><![CDATA[Procedure]]></category>
		<category><![CDATA[SP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Stored]]></category>
		<category><![CDATA[users]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=456</guid>
		<description><![CDATA[Hi all,
I have been working on a way to return Active directory group membership from a linked AD server in SQL.
Its quite hard as you can`t return it from the group &#8211; you have to return it from the user. What i wanted was to return every group within an OU and its members.

I first [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>I have been working on a way to return Active directory group membership from a linked AD server in SQL.</p>
<p>Its quite hard as you can`t return it from the group &#8211; you have to return it from the user. What i wanted was to return every group within an OU and its members.<br />
<span id="more-456"></span><br />
I first found this person and thier code:</p>
<p><a href="http://blog.sdbonline.com/blog/?tag=/sql+server">http://blog.sdbonline.com/blog/?tag=/sql+server</a></p>
<p>So i used this code and modified it somewhat. It now takes many more parameters and returns all group membership from an OU. You obviously have to set up the linked SQL server first.</p>

<p>One of the hardest parts of this was the fact that it seemed to have some kind of limit to how much you can query the AD. To get round this i put a wait in after a certain amount of groups (configured by the parameters). I found that every 500 waiting 2 minutes was the safest root. It also waits 2 minutes to start, in case you have run it recently.</p>
<pre class="brush: sql">
ALTER PROCEDURE [dbo].[sp_getADGroupUsers]
@LDAPRoot nvarchar(200),
@OUGROUP nvarchar(200),
@OUUSERS nvarchar(200),
@Waittime nvarchar(10),
@WaitGap integer,
@ServerName nvarchar(30)

AS

BEGIN
DECLARE @SQLString nvarchar(4000)
DECLARE @group_name nvarchar(500)
DECLARE @group_cursor CURSOR
Declare @GroupSamAccountname nvarchar(100)
declare @i integer

--Create a temp table to hold the results
CREATE TABLE #ADSI (
GroupCN nvarchar(500),
SamAccountname nvarchar(100))

--build an SQL string to return the ADsPath for the requested group
set @SQLString = N&#039;SET @group_cursor = CURSOR STATIC FOR SELECT SUBSTRING(ADsPath,&#039;+ cast(len(@ldaproot)+1 as varchar) + &#039;,LEN(ADsPath))

FROM OPENQUERY(&#039;+ @ServerName +&#039;,&#039;&#039;SELECT ADsPath FROM &#039;&#039;&#039;&#039;&#039; + @LDAPRoot + @ouGROUP + &#039;&#039;&#039;&#039;&#039;
WHERE objectClass = &#039;&#039;&#039;&#039;Group&#039;&#039;&#039;&#039; &#039;&#039;) FOR READ ONLY; OPEN @group_cursor&#039;

--Execute the statement (will return the ADsPath in @group_cursor
EXECUTE sp_executesql @SQLString, N&#039;@group_cursor CURSOR OUTPUT&#039;,
@group_cursor OUTPUT

set @i = 0

FETCH NEXT FROM @group_cursor INTO @group_name
WHILE @@FETCH_STATUS = 0
BEGIN

--work out account name
set @GroupSamAccountname = substring(@group_name, 4, (len(@group_name) - len( @OUGROUP))-4)

--Get data for group
SET @SQLString = N&#039;INSERT INTO #ADSI SELECT &#039;&#039;&#039; + @GroupSamAccountname + &#039;&#039;&#039;,SamAccountname
FROM OPENQUERY(&#039;+ @ServerName +&#039;,&#039;&#039;SELECT ADsPath,
SamAccountname FROM &#039;&#039;&#039;&#039;&#039; + @LDAPRoot + @OUUsers + &#039;&#039;&#039;&#039;&#039;
WHERE objectCategory = &#039;&#039;&#039;&#039;Person&#039;&#039;&#039;&#039; and objectClass = &#039;&#039;&#039;&#039;user&#039;&#039;&#039;&#039;
and memberOf=&#039;&#039;&#039;&#039;&#039; + @group_name + &#039;&#039;&#039;&#039;&#039; &#039;&#039;) &#039;;

--execute the statement
EXECUTE sp_executesql @SQLString;

set @i = @i + 1

IF @i = @waitgap
BEGIN
WAITFOR DELAY @waittime
set @i = 0
END

FETCH NEXT FROM @group_cursor INTO @group_name
END

--return the resultset
--(use DISTINCT as a user might be a member of several groups)
SELECT DISTINCT * FROM #ADSI

--explicitely drop the temp table
DROP TABLE #ADSI
END </pre>

<p>And here is how you call it:</p>
<pre class="brush: sql">
DECLARE @RC int
DECLARE @LDAPRoot nvarchar(200)
DECLARE @FriendlyGroupName nvarchar(200)
DECLARE @OUGROUP nvarchar(200)
DECLARE @OUUSERS nvarchar(200)
declare @waittime nvarchar(10)
declare @waitgap integer
declare @ServerName nvarchar(30)

set @ldaproot = &#039;LDAP://DC.domain.com/&#039;

--Where are the groups you want to return
set @OUGROUP = &#039;OU=groups,DC=Domain,DC=co,DC=uk&#039;
--Where are the users you want to return
set @OUUSERS = &#039;OU=users,DC=domain,DC=co,DC=uk&#039;
--Waiting time between groups
set @waittime = &#039;00:02:00&#039;
--How big are the groups
set @waitgap = 500
--Your AD linked server in SQL
set @ServerName = &#039;ADSI&#039;

EXECUTE @RC = [SystemsIntegration].[dbo].[sp_getADGroupUsers]
@LDAPRoot

,@OUGROUP
,@OUUSERS
,@waittime
,@waitgap
,@ServerName
</pre>
<p>Hope this helps someone,</p>
<p>Dan</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;t=SQL+AD+Group+membership" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=SQL+AD+Group+membership+-+http://b2l.me/fmufx+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;title=SQL+AD+Group+membership" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;title=SQL+AD+Group+membership" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;title=SQL+AD+Group+membership" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;t=SQL+AD+Group+membership" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;title=SQL+AD+Group+membership" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;title=SQL+AD+Group+membership&amp;summary=Hi%20all%2C%0D%0A%0D%0AI%20have%20been%20working%20on%20a%20way%20to%20return%20Active%20directory%20group%20membership%20from%20a%20linked%20AD%20server%20in%20SQL.%0D%0A%0D%0AIts%20quite%20hard%20as%20you%20can%60t%20return%20it%20from%20the%20group%20-%20you%20have%20to%20return%20it%20from%20the%20user.%20What%20i%20wanted%20was%20to%20return%20every%20group%20within%20an%20OU%20and%20its%20members.%0D%0A%0D%0AI%20first%20found%20th&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;title=SQL+AD+Group+membership" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/&amp;title=SQL+AD+Group+membership&amp;body=Hi%20all%2C%0D%0A%0D%0AI%20have%20been%20working%20on%20a%20way%20to%20return%20Active%20directory%20group%20membership%20from%20a%20linked%20AD%20server%20in%20SQL.%0D%0A%0D%0AIts%20quite%20hard%20as%20you%20can%60t%20return%20it%20from%20the%20group%20-%20you%20have%20to%20return%20it%20from%20the%20user.%20What%20i%20wanted%20was%20to%20return%20every%20group%20within%20an%20OU%20and%20its%20members.%0D%0A%0D%0AI%20first%20found%20th" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22SQL%20AD%20Group%20membership%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22Hi%20all%2C%0D%0A%0D%0AI%20have%20been%20working%20on%20a%20way%20to%20return%20Active%20directory%20group%20membership%20from%20a%20linked%20AD%20server%20in%20SQL.%0D%0A%0D%0AIts%20quite%20hard%20as%20you%20can%60t%20return%20it%20from%20the%20group%20-%20you%20have%20to%20return%20it%20from%20the%20user.%20What%20i%20wanted%20was%20to%20return%20every%20group%20within%20an%20OU%20and%20its%20members.%0D%0A%0D%0AI%20first%20found%20th%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/02/sql-ad-group-membership/</feedburner:origLink></item>
		<item>
		<title>Actionscript 2.0 Image Fade (Flash Slideshow) from XML</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/otmuk4_lVmc/</link>
		<comments>http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 09:31:08 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=432</guid>
		<description><![CDATA[This article describes how to use flash to cycle through images as read from an XML file using only Acriptscript, with no timeline objects what-so-ever, what we are going to make can be previewed here.


// image fading scripts
import mx.transitions.Tween;
import mx.transitions.easing.*;
var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load(http://mydomain/screensaver/slideshow.xml);
myShowXML.onLoad = function() {
_root.myWidth = myShowXML.firstChild.attributes.width;
_root.myHeight = myShowXML.firstChild.attributes.height;
_root.mySpeed = myShowXML.firstChild.attributes.speed;
_root.myImages [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes how to use flash to cycle through images as read from an XML file using only Acriptscript, with no timeline objects what-so-ever, what we are going to make can be<a href="http://www.cardboardcoder.com/examples/slideshow-example.html" target="_blank"> previewed here</a>.</p>
<p><span id="more-432"></span>
<pre class="brush: javascript">
// image fading scripts
import mx.transitions.Tween;
import mx.transitions.easing.*;
var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load(http://mydomain/screensaver/slideshow.xml);
myShowXML.onLoad = function() {
_root.myWidth = myShowXML.firstChild.attributes.width;
_root.myHeight = myShowXML.firstChild.attributes.height;
_root.mySpeed = myShowXML.firstChild.attributes.speed;
_root.myImages = myShowXML.firstChild.childNodes;
_root.myImagesNo = myImages.length;
createContainer();
callImages();
};
function createContainer() {
_root.createEmptyMovieClip(&quot;myContainer_mc&quot;,1);
// up to you if you want a border
//myContainer_mc.lineStyle(5,0x000000,100);
myContainer_mc.lineTo(_root.myWidth,0);
myContainer_mc.lineTo(_root.myWidth,_root.myHeight);
myContainer_mc.lineTo(0,_root.myHeight);
myContainer_mc.lineTo(0,0);
myContainer_mc._x = 0;
myContainer_mc._y = 0;
}
function callImages() {
_root.myMCL = new MovieClipLoader();
_root.myPreloader = new Object();
_root.myMCL.addListener(_root.myPreloader);
_root.myClips_array = [];
_root.myPreloader.onLoadStart = function(target) {
_root.createTextField(&quot;myText_txt&quot;,_root.getNextHighestDepth(),0,0,100,20);
_root.myText_txt._x = (Stage.width-_root.myText_txt._width)/2;
_root.myText_txt._y = (Stage.height-_root.myText_txt._height)/2;
_root.myText_txt.autoSize = &quot;center&quot;;
// use this to add in manual text
//_root.myText_txt.text = &quot;test&quot;;
};
_root.myPreloader.onLoadProgress = function(target) {
// this will added loading text over the image while its loading the next//_root.myText_txt.text = &quot;Loading.. &quot;+_root.myClips_array.length+&quot;/&quot;+_root.myImagesNo+&quot; Completed&quot;;
};
_root.myPreloader.onLoadComplete = function(target) {
_root.myClips_array.push(target);
target._alpha = 0;
if (_root.myClips_array.length == _root.myImagesNo) {
_root.myText_txt._y = myContainer_mc._y + myContainer_mc._height;
_root.target_mc = -1;
moveSlide();
myShowInt = setInterval(moveSlide, (_root.mySpeed*1000)+1000);
}
};
for (i=0; i&lt;_root.myImagesNo; i++) {
temp_url = _root.myImages[i].attributes.url;
temp_mc = myContainer_mc.createEmptyMovieClip(i, myContainer_mc.getNextHighestDepth());
_root.myMCL.loadClip(temp_url,temp_mc);
} }
function moveSlide() {
current_mc = _root.myClips_array[_root.target_mc];
new Tween(current_mc, &quot;_alpha&quot;, Strong.easeOut, 100, 0, 1, true); _root.target_mc++;
if (_root.target_mc&gt;=_root.myImagesNo) {
_root.target_mc = 0;
_root.myClips_array = undefined;
nextScene();
}
// this will add the title of the image over the image
//_root.myText_txt.text = _root.myImages[target_mc].attributes.title;
next_mc = _root.myClips_array[_root.target_mc];
new Tween(next_mc, &quot;_alpha&quot;, Strong.easeOut, 0, 100, 1, true);
}
</pre>
<p>First of all you need to include the transitions for tween and easing as follows:</p>
<pre class="brush: javascript">
import mx.transitions.Tween;
import mx.transitions.easing.*;
</pre>
<pre class="brush: javascript">
var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load(http://mydomain/screensaver/slideshow.xml);
myShowXML.onLoad = function() {
</pre>
<p>Next we setup the script to read the XML file, by setting a location and creating a load function.</p>
<pre class="brush: javascript">
_root.myWidth = myShowXML.firstChild.attributes.width;
_root.myHeight = myShowXML.firstChild.attributes.height;
_root.mySpeed = myShowXML.firstChild.attributes.speed;
_root.myImages = myShowXML.firstChild.childNodes;
_root.myImagesNo = myImages.length;
</pre>
<p>This sets up a few global variables such as the height and width of our container, our transition speed and counts all the child nodes to see how many images we are dealing with.</p>
<pre class="brush: javascript">
function createContainer() {
_root.createEmptyMovieClip(&quot;myContainer_mc&quot;,1);
// up to you if you want a border
//myContainer_mc.lineStyle(5,0x000000,100);
myContainer_mc.lineTo(_root.myWidth,0);
myContainer_mc.lineTo(_root.myWidth,_root.myHeight);
myContainer_mc.lineTo(0,_root.myHeight);
myContainer_mc.lineTo(0,0);
myContainer_mc._x = 0;
myContainer_mc._y = 0;
}
</pre>
<p>Next we create a container to hold the image, which is called from as a function from the previous lines of Actionscript.</p>
<pre class="brush: javascript">
function callImages() {
_root.myMCL = new MovieClipLoader();
_root.myPreloader = new Object();
_root.myMCL.addListener(_root.myPreloader);
_root.myClips_array = [];
_root.myPreloader.onLoadStart = function(target) {
_root.createTextField(&quot;myText_txt&quot;,_root.getNextHighestDepth(),0,0,100,20);
_root.myText_txt._x = (Stage.width-_root.myText_txt._width)/2;
_root.myText_txt._y = (Stage.height-_root.myText_txt._height)/2;
_root.myText_txt.autoSize = &quot;center&quot;;
// use this to add in manual text
//_root.myText_txt.text = &quot;test&quot;;
};
</pre>
<p>Next we add the image to the container and center them, just in case they are not quite the right size.</p>
<pre class="brush: javascript">
_root.myPreloader.onLoadProgress = function(target) {
// this will added loading text over the image while its loading the next
//_root.myText_txt.text = &quot;Loading.. &quot;+_root.myClips_array.length+&quot;/&quot;+_root.myImagesNo+&quot; Completed&quot;;
};</pre>
<p>This piece of code preloads the images and can optionally display loading text if you remove the comment add to the start of the line.</p>
<pre class="brush: javascript">
if (_root.myClips_array.length == _root.myImagesNo) {
_root.myText_txt._y = myContainer_mc._y + myContainer_mc._height;
_root.target_mc = -1;
moveSlide();
myShowInt = setInterval(moveSlide, (_root.mySpeed*1000)+1000);
}
};
</pre>
<p>Next we iduce the slide function and set the interval in accordance with the XML file.</p>
<p>The last piece of the Actionscript performs all of the tweening and plays the next scene once all the images have been display, the XML file that controls all of this, looks like this:</p>
<pre class="brush: xml">
&lt;slideshow width=&quot;1440&quot; height=&quot;1080&quot; speed=&quot;20&quot;&gt;
&lt;image url=&quot;\\myserver\slide1.jpg&quot; title=&quot;Welcome to SNC&quot; /&gt;
&lt;image url=&quot;\\myserver\slide2.jpg&quot; title=&quot;Webpage Zooming&quot; /&gt;
&lt;image url=&quot;\\myserver\slide3.jpg&quot; title=&quot;ID Cards&quot; /&gt;
&lt;image url=&quot;\\myserver\slide4.jpg&quot; title=&quot;Learner View Survey&quot; /&gt;
&lt;image url=&quot;\\myserver\slide5.jpg&quot; title=&quot;Blackboard Promo&quot; /&gt;
&lt;image url=&quot;\\myserver\slide6.jpg&quot; title=&quot;The Granary&quot; /&gt;
&lt;/slideshow&gt;
</pre>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;t=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML+-+http://b2l.me/ezves+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;title=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;title=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;title=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;t=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;title=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;title=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML&amp;summary=This%20article%20describes%20how%20to%20use%20flash%20to%20cycle%20through%20images%20as%20read%20from%20an%20XML%20file%20using%20only%20Acriptscript%2C%20with%20no%20timeline%20objects%20what-so-ever%2C%20what%20we%20are%20going%20to%20make%20can%20be%20previewed%20here.%0D%0A%0D%0A%5Bsourcecode%20language%3D%22javascript%22%5D%0D%0A%2F%2F%20image%20fading%20scripts%0D%0Aimport%20mx.transitions.Tween%3B%0D%0Aimpo&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;title=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/&amp;title=Actionscript+2.0+Image+Fade+%28Flash+Slideshow%29+from+XML&amp;body=This%20article%20describes%20how%20to%20use%20flash%20to%20cycle%20through%20images%20as%20read%20from%20an%20XML%20file%20using%20only%20Acriptscript%2C%20with%20no%20timeline%20objects%20what-so-ever%2C%20what%20we%20are%20going%20to%20make%20can%20be%20previewed%20here.%0D%0A%0D%0A%5Bsourcecode%20language%3D%22javascript%22%5D%0D%0A%2F%2F%20image%20fading%20scripts%0D%0Aimport%20mx.transitions.Tween%3B%0D%0Aimpo" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Actionscript%202.0%20Image%20Fade%20%28Flash%20Slideshow%29%20from%20XML%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22This%20article%20describes%20how%20to%20use%20flash%20to%20cycle%20through%20images%20as%20read%20from%20an%20XML%20file%20using%20only%20Acriptscript%2C%20with%20no%20timeline%20objects%20what-so-ever%2C%20what%20we%20are%20going%20to%20make%20can%20be%20previewed%20here.%0D%0A%0D%0A%5Bsourcecode%20language%3D%22javascript%22%5D%0D%0A%2F%2F%20image%20fading%20scripts%0D%0Aimport%20mx.transitions.Tween%3B%0D%0Aimpo%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/01/actionscript-2-0-image-fade-flash-slideshow-from-xml/</feedburner:origLink></item>
		<item>
		<title>Bad Code Offsets Update: Open Web Innovation</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/d9B-U1f3Mes/</link>
		<comments>http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 09:02:42 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Useful Links]]></category>
		<category><![CDATA[bad]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[donate]]></category>
		<category><![CDATA[offsets]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=442</guid>
		<description><![CDATA[Just a quick post to draw attention to the Bad Coder Offsets on the DailyWTF website.

We have all written bad code sometime in our lives &#8211; if nothing else when we were learning&#8230;..  so if you can afford it donate a little to projects which benefit many coders and techies.
Take a look at: http://thedailywtf.com/Articles/Bad-Code-Offsets-Open-Web-Innovation.aspx





		
			Share this [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to draw attention to the Bad Coder Offsets on the DailyWTF website.</p>
<p><span id="more-442"></span></p>
<p>We have all written bad code sometime in our lives &#8211; if nothing else when we were learning&#8230;..  so if you can afford it donate a little to projects which benefit many coders and techies.</p>
<p>Take a look at: <a href="http://thedailywtf.com/Articles/Bad-Code-Offsets-Open-Web-Innovation.aspx">http://thedailywtf.com/Articles/Bad-Code-Offsets-Open-Web-Innovation.aspx</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;t=Bad+Code+Offsets+Update%3A+Open+Web+Innovation" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Bad+Code+Offsets+Update%3A+Open+Web+Innovation+-+http://b2l.me/ec6rx+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;title=Bad+Code+Offsets+Update%3A+Open+Web+Innovation" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;title=Bad+Code+Offsets+Update%3A+Open+Web+Innovation" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;title=Bad+Code+Offsets+Update%3A+Open+Web+Innovation" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;t=Bad+Code+Offsets+Update%3A+Open+Web+Innovation" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;title=Bad+Code+Offsets+Update%3A+Open+Web+Innovation" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;title=Bad+Code+Offsets+Update%3A+Open+Web+Innovation&amp;summary=Just%20a%20quick%20post%20to%20draw%20attention%20to%20the%20Bad%20Coder%20Offsets%20on%20the%20DailyWTF%20website.%0D%0A%0D%0A%0D%0A%0D%0AWe%20have%20all%20written%20bad%20code%20sometime%20in%20our%20lives%20-%20if%20nothing%20else%20when%20we%20were%20learning.....%C2%A0%20so%20if%20you%20can%20afford%20it%20donate%20a%20little%20to%20projects%20which%20benefit%20many%20coders%20and%20techies.%0D%0A%0D%0ATake%20a%20look%20at%3A&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;title=Bad+Code+Offsets+Update%3A+Open+Web+Innovation" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/&amp;title=Bad+Code+Offsets+Update%3A+Open+Web+Innovation&amp;body=Just%20a%20quick%20post%20to%20draw%20attention%20to%20the%20Bad%20Coder%20Offsets%20on%20the%20DailyWTF%20website.%0D%0A%0D%0A%0D%0A%0D%0AWe%20have%20all%20written%20bad%20code%20sometime%20in%20our%20lives%20-%20if%20nothing%20else%20when%20we%20were%20learning.....%C2%A0%20so%20if%20you%20can%20afford%20it%20donate%20a%20little%20to%20projects%20which%20benefit%20many%20coders%20and%20techies.%0D%0A%0D%0ATake%20a%20look%20at%3A" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Bad%20Code%20Offsets%20Update%3A%20Open%20Web%20Innovation%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22Just%20a%20quick%20post%20to%20draw%20attention%20to%20the%20Bad%20Coder%20Offsets%20on%20the%20DailyWTF%20website.%0D%0A%0D%0A%0D%0A%0D%0AWe%20have%20all%20written%20bad%20code%20sometime%20in%20our%20lives%20-%20if%20nothing%20else%20when%20we%20were%20learning.....%C2%A0%20so%20if%20you%20can%20afford%20it%20donate%20a%20little%20to%20projects%20which%20benefit%20many%20coders%20and%20techies.%0D%0A%0D%0ATake%20a%20look%20at%3A%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/01/bad-code-offsets-update-open-web-innovation/</feedburner:origLink></item>
		<item>
		<title>Why Have a Console Over a PC for Gaming?</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/6lQy1cfOlzE/</link>
		<comments>http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 20:14:40 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[PC]]></category>
		<category><![CDATA[PS3]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Wii]]></category>
		<category><![CDATA[Xbox 360]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=426</guid>
		<description><![CDATA[It&#8217;s this old nutshell again, but we discuss the main points as to why we believe consoles have an advantage for gaming compared to the good old PC.
Before we get started, I would just like to say I used to be a hardcore PC gamer before I came to the realisation of the following points, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s this old nutshell again, but we discuss the main points as to why we believe consoles have an advantage for gaming compared to the good old PC.</p>
<p><span id="more-426"></span>Before we get started, I would just like to say I used to be a hardcore PC gamer before I came to the realisation of the following points, also PC gaming is a thriving market especially if you love the ability to modify your games. These points are meant to assist not dictate.</p>
<p><strong>Price</strong></p>
<p><img class="alignleft" style="margin: 10px;" title="SLI Graphics Cards" src="http://www.maximumpc.com/files/u69/SLI_0.png" alt="" width="243" height="177" />To have a gaming rig to play the latest games in HD you need to spend quite a lot of money, about 5 times the cost of a gaming console. Not only that you need to factor in the price for an operating system and HD graphics card that also outputs sound in HD or an HD sound card if you want to experience 7.1 DTS HD surround sound . The games may be a bit more expensive on consoles if you buy new, but the trade-in market is much bigger so you will be able to recoup some money back if you require.</p>
<p><strong>Ease of use</strong></p>
<p><img class="alignright" style="margin: 10px;" title="PS3 Disc Tray" src="http://z.about.com/d/playstation/1/0/U/6/Img3669_tif_jpgcopy.jpg" alt="" width="308" height="205" />Often if you want to play a game you will just want to pop in the disc and away you go. With a PC this is often not the case, with PC games you will need to install the software and resolve any conflicts. You will also need to change many more settings and install the latest graphics or Direct X drivers. A PC often takes longer to load a game then what a console would when you factor in the whole boot-up process.</p>
<p><strong>Local Play</strong></p>
<p>Most console games provide the ability for more than one person to play on the same system, but how many PC games do? If you want to play your friends simply buy some more pads and chuck in your favourite game, if you want to play with more than one person locally on a PC you will need to buy additional peripherals install the drivers and tweak the settings, providing the game supports local play in the first place.</p>
<p><img class="alignleft" style="margin: 10px;" title="Wii Party" src="http://www.unplggd.com/uimages/unplggd/unplggd032708wiipart.jpg" alt="" width="324" height="215" /></p>
<p>The console will also most likely live in your lounge making a family centric media center not just for you tucked away in your room, this makes the console a more social platform especially for parties.</p>
<p><strong>Your Wife </strong></p>
<p>So you spent days perfecting your warrior and have focused for hours to delve deep into the last dungeon of the game, right at the point you are about to reveal the secret of the last scroll you wife turns up and demands use of the PC so she can visit her Facebook.</p>
<p>If you have a PC for gaming, you will need to consider buying a netbook, laptop or additional unit as because the PC is used for more than gaming then it is likely other members of your family, your wife, friends or kitty will want to use the PC for some other purpose.</p>
<p><strong>Out of the Box Features</strong></p>
<p><img class="alignright" style="margin: 10px;" title="Wireless NAS" src="http://common.ziffdavisinternet.com/util_get_image/13/0,1425,i=133313,00.jpg" alt="" width="240" height="180" />Things like VidZone allow you to turn you TV into a personalised music channel, NetFlix allows you to stream on-demand HD movies and the BBC iPlayer means your wife can watch that episode of Eastenders she missed. Consoles these days offer other features ensuring it is rooted in the living room to make it the ultimate media centre with the option to stream movies from NAS devices or PC&#8217;s so that it really can access a wealth of media in an instant.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;t=Why+Have+a+Console+Over+a+PC+for+Gaming%3F" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Why+Have+a+Console+Over+a+PC+for+Gaming%3F+-+http://b2l.me/dywwn+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;title=Why+Have+a+Console+Over+a+PC+for+Gaming%3F" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;title=Why+Have+a+Console+Over+a+PC+for+Gaming%3F" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;title=Why+Have+a+Console+Over+a+PC+for+Gaming%3F" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;t=Why+Have+a+Console+Over+a+PC+for+Gaming%3F" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;title=Why+Have+a+Console+Over+a+PC+for+Gaming%3F" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;title=Why+Have+a+Console+Over+a+PC+for+Gaming%3F&amp;summary=It%27s%20this%20old%20nutshell%20again%2C%20but%20we%20discuss%20the%20main%20points%20as%20to%20why%20we%20believe%20consoles%20have%20an%20advantage%20for%20gaming%20compared%20to%20the%20good%20old%20PC.%0D%0A%0D%0ABefore%20we%20get%20started%2C%20I%20would%20just%20like%20to%20say%20I%20used%20to%20be%20a%20hardcore%20PC%20gamer%20before%20I%20came%20to%20the%20realisation%20of%20the%20following%20points%2C%20also%20PC%20g&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;title=Why+Have+a+Console+Over+a+PC+for+Gaming%3F" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/&amp;title=Why+Have+a+Console+Over+a+PC+for+Gaming%3F&amp;body=It%27s%20this%20old%20nutshell%20again%2C%20but%20we%20discuss%20the%20main%20points%20as%20to%20why%20we%20believe%20consoles%20have%20an%20advantage%20for%20gaming%20compared%20to%20the%20good%20old%20PC.%0D%0A%0D%0ABefore%20we%20get%20started%2C%20I%20would%20just%20like%20to%20say%20I%20used%20to%20be%20a%20hardcore%20PC%20gamer%20before%20I%20came%20to%20the%20realisation%20of%20the%20following%20points%2C%20also%20PC%20g" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Why%20Have%20a%20Console%20Over%20a%20PC%20for%20Gaming%3F%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22It%27s%20this%20old%20nutshell%20again%2C%20but%20we%20discuss%20the%20main%20points%20as%20to%20why%20we%20believe%20consoles%20have%20an%20advantage%20for%20gaming%20compared%20to%20the%20good%20old%20PC.%0D%0A%0D%0ABefore%20we%20get%20started%2C%20I%20would%20just%20like%20to%20say%20I%20used%20to%20be%20a%20hardcore%20PC%20gamer%20before%20I%20came%20to%20the%20realisation%20of%20the%20following%20points%2C%20also%20PC%20g%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2010/01/why-have-a-console-over-a-pc-for-gaming/</feedburner:origLink></item>
		<item>
		<title>Face Detection with PHP</title>
		<link>http://feedproxy.google.com/~r/cardboardcoder/Card/~3/MCvv4TwGAYM/</link>
		<comments>http://www.cardboardcoder.com/2009/12/face-detection-with-php/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 17:13:49 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[GD Lib]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cardboardcoder.com/?p=419</guid>
		<description><![CDATA[A very useful piece of PHP code that will highlight any pictures where a face has been detected.
Heres the first piece of PHP code you will need, it would be best to make this an include:


class Face_Detector {

protected $detection_data;
protected $canvas;
protected $face;
private $reduced_canvas;

public function __construct($detection_file = &#039;detection.dat&#039;) {
if (is_file($detection_file)) {
$this-&#62;detection_data = unserialize(file_get_contents($detection_file));
} else {
throw new Exception(&#34;Couldn&#039;t [...]]]></description>
			<content:encoded><![CDATA[<p>A very useful piece of PHP code that will highlight any pictures where a face has been detected.</p>
<p><span id="more-419"></span>Heres the first piece of PHP code you will need, it would be best to make this an include:</p>
<pre class="brush: php">

class Face_Detector {

protected $detection_data;
protected $canvas;
protected $face;
private $reduced_canvas;

public function __construct($detection_file = &#039;detection.dat&#039;) {
if (is_file($detection_file)) {
$this-&gt;detection_data = unserialize(file_get_contents($detection_file));
} else {
throw new Exception(&quot;Couldn&#039;t load detection data&quot;);
}
//$this-&gt;detection_data = json_decode(file_get_contents(&#039;data.js&#039;));
}

public function face_detect($file) {
if (!is_file($file)) {
throw new Exception(&quot;Can not load $file&quot;);
}

$this-&gt;canvas = imagecreatefromjpeg($file);
$im_width = imagesx($this-&gt;canvas);
$im_height = imagesy($this-&gt;canvas);

//Resample before detection?
$ratio = 0;
$diff_width = 320 - $im_width;
$diff_height = 240 - $im_height;
if ($diff_width &gt; $diff_height) {
$ratio = $im_width / 320;
} else {
$ratio = $im_height / 240;
}

if ($ratio != 0) {
$this-&gt;reduced_canvas = imagecreatetruecolor($im_width / $ratio, $im_height / $ratio);
imagecopyresampled($this-&gt;reduced_canvas, $this-&gt;canvas, 0, 0, 0, 0, $im_width / $ratio, $im_height / $ratio, $im_width, $im_height);

$stats = $this-&gt;get_img_stats($this-&gt;reduced_canvas);
$this-&gt;face = $this-&gt;do_detect_greedy_big_to_small($stats[&#039;ii&#039;], $stats[&#039;ii2&#039;], $stats[&#039;width&#039;], $stats[&#039;height&#039;]);
$this-&gt;face[&#039;x&#039;] *= $ratio;
$this-&gt;face[&#039;y&#039;] *= $ratio;
$this-&gt;face[&#039;w&#039;] *= $ratio;
} else {
$stats = $this-&gt;get_img_stats($this-&gt;canvas);
$this-&gt;face = $this-&gt;do_detect_greedy_big_to_small($stats[&#039;ii&#039;], $stats[&#039;ii2&#039;], $stats[&#039;width&#039;], $stats[&#039;height&#039;]);
}
return ($this-&gt;face[&#039;w&#039;] &gt; 0);
}

public function toJpeg() {
$color = imagecolorallocate($this-&gt;canvas, 255, 0, 0); //red
imagerectangle($this-&gt;canvas, $this-&gt;face[&#039;x&#039;], $this-&gt;face[&#039;y&#039;], $this-&gt;face[&#039;x&#039;]+$this-&gt;face[&#039;w&#039;], $this-&gt;face[&#039;y&#039;]+ $this-&gt;face[&#039;w&#039;], $color);
header(&#039;Content-type: image/jpeg&#039;);
imagejpeg($this-&gt;canvas);
}

public function toJson() {
return &quot;{&#039;x&#039;:&quot; . $this-&gt;face[&#039;x&#039;] . &quot;, &#039;y&#039;:&quot; . $this-&gt;face[&#039;y&#039;] . &quot;, &#039;w&#039;:&quot; . $this-&gt;face[&#039;w&#039;] . &quot;}&quot;;
}

public function getFace() {
return $this-&gt;face;
}

protected function get_img_stats($canvas){
$image_width = imagesx($canvas);
$image_height = imagesy($canvas);
$iis =  $this-&gt;compute_ii($canvas, $image_width, $image_height);
return array(
&#039;width&#039; =&gt; $image_width,
&#039;height&#039; =&gt; $image_height,
&#039;ii&#039; =&gt; $iis[&#039;ii&#039;],
&#039;ii2&#039; =&gt; $iis[&#039;ii2&#039;]
);
}

protected function compute_ii($canvas, $image_width, $image_height ){
$ii_w = $image_width+1;
$ii_h = $image_height+1;
$ii = array();
$ii2 = array();

for($i=0; $i&lt;$ii_w; $i++ ){
$ii[$i] = 0;
$ii2[$i] = 0;
}

for($i=1; $i&lt;$ii_w; $i++ ){
$ii[$i*$ii_w] = 0;
$ii2[$i*$ii_w] = 0;
$rowsum = 0;
$rowsum2 = 0;
for($j=1; $j&lt;$ii_h; $j++ ){                 $rgb = ImageColorAt($canvas, $j, $i);                 $red = ($rgb &gt;&gt; 16) &amp;amp;amp; 0xFF;
$green = ($rgb &gt;&gt; <img src='http://www.cardboardcoder.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> &amp;amp;amp; 0xFF;
$blue = $rgb &amp;amp;amp; 0xFF;
$grey = ( 0.2989*$red + 0.587*$green + 0.114*$blue )&gt;&gt;0;  // this is what matlab uses
$rowsum += $grey;
$rowsum2 += $grey*$grey;

$ii_above = ($i-1)*$ii_w + $j;
$ii_this = $i*$ii_w + $j;

$ii[$ii_this] = $ii[$ii_above] + $rowsum;
$ii2[$ii_this] = $ii2[$ii_above] + $rowsum2;
}
}
return array(&#039;ii&#039;=&gt;$ii, &#039;ii2&#039; =&gt; $ii2);
}

protected function do_detect_greedy_big_to_small( $ii, $ii2, $width, $height ){
$s_w = $width/20.0;
$s_h = $height/20.0;
$start_scale = $s_h &lt; $s_w ? $s_h : $s_w;         $scale_update = 1 / 1.2;         for($scale = $start_scale; $scale &gt; 1; $scale *= $scale_update ){
$w = (20*$scale) &gt;&gt; 0;
$endx = $width - $w - 1;
$endy = $height - $w - 1;
$step = max( $scale, 2 ) &gt;&gt; 0;
$inv_area = 1 / ($w*$w);
for($y = 0; $y &lt; $endy ; $y += $step ){
for($x = 0; $x &lt; $endx ; $x += $step ){                     $passed = $this-&gt;detect_on_sub_image( $x, $y, $scale, $ii, $ii2, $w, $width+1, $inv_area);
if( $passed ) {
return array(&#039;x&#039;=&gt;$x, &#039;y&#039;=&gt;$y, &#039;w&#039;=&gt;$w);
}
} // end x
} // end y
}  // end scale
return null;
}

protected function detect_on_sub_image( $x, $y, $scale, $ii, $ii2, $w, $iiw, $inv_area){
$mean = ( $ii[($y+$w)*$iiw + $x + $w] + $ii[$y*$iiw+$x] - $ii[($y+$w)*$iiw+$x] - $ii[$y*$iiw+$x+$w]  )*$inv_area;
$vnorm =  ( $ii2[($y+$w)*$iiw + $x + $w] + $ii2[$y*$iiw+$x] - $ii2[($y+$w)*$iiw+$x] - $ii2[$y*$iiw+$x+$w]  )*$inv_area - ($mean*$mean);
$vnorm = $vnorm &gt; 1 ? sqrt($vnorm) : 1;

$passed = true;
for($i_stage = 0; $i_stage &lt; count($this-&gt;detection_data); $i_stage++ ){
$stage = $this-&gt;detection_data[$i_stage];
$trees = $stage[0];

$stage_thresh = $stage[1];
$stage_sum = 0;

for($i_tree = 0; $i_tree &lt; count($trees); $i_tree++ ){
$tree = $trees[$i_tree];
$current_node = $tree[0];
$tree_sum = 0;
while( $current_node != null ){
$vals = $current_node[0];
$node_thresh = $vals[0];
$leftval = $vals[1];
$rightval = $vals[2];
$leftidx = $vals[3];
$rightidx = $vals[4];
$rects = $current_node[1];

$rect_sum = 0;
for( $i_rect = 0; $i_rect &lt; count($rects); $i_rect++ ){                         $s = $scale;                         $rect = $rects[$i_rect];                         $rx = ($rect[0]*$s+$x)&gt;&gt;0;
$ry = ($rect[1]*$s+$y)&gt;&gt;0;
$rw = ($rect[2]*$s)&gt;&gt;0;
$rh = ($rect[3]*$s)&gt;&gt;0;
$wt = $rect[4];

$r_sum = ( $ii[($ry+$rh)*$iiw + $rx + $rw] + $ii[$ry*$iiw+$rx] - $ii[($ry+$rh)*$iiw+$rx] - $ii[$ry*$iiw+$rx+$rw] )*$wt;
$rect_sum += $r_sum;
}

$rect_sum *= $inv_area;

$current_node = null;
if( $rect_sum &gt;= $node_thresh*$vnorm ){
if( $rightidx == -1 )
$tree_sum = $rightval;
else
$current_node = $tree[$rightidx];
} else {
if( $leftidx == -1 )
$tree_sum = $leftval;
else
$current_node = $tree[$leftidx];
}
}
$stage_sum += $tree_sum;
}
if( $stage_sum &lt; $stage_thresh ){
return false;
}
}
return true;
}
}
</pre>
<p>To use the code you will require a specific DAT file: <a href="http://svay.com/experiences/face-detection/detection.dat">http://svay.com/experiences/face-detection/detection.dat</a> , the DAT file should be in the same folder as the piece of code as above, if this is not possible you will need to set the location in the piece of PHP code to follow.</p>
<p>Whenever you want to highlight a face in a picture run this piece of PHP code:</p>
<pre class="brush: php">

$detector = new Face_Detector(&#039;detection.dat&#039;);
$detector-&gt;face_detect(&#039;myface.jpg&#039;);
$detector-&gt;toJpeg();
</pre>
<p>Change the &#8220;myface.jpg&#8221; string to the image you wish to check. The result will look something like this:</p>
<p><img class="aligncenter size-full wp-image-420" title="detection" src="http://www.cardboardcoder.com/wp-content/uploads/2009/12/detection.jpg" alt="detection" width="150" height="150" /></p>
<p>If you require a true or false response then return &#8220;$passed&#8221; instead and remove the line that outputs the jpeg image. This code is very useful and could be used for many purposes including:</p>
<ul>
<li>Checking ID card photos (if the code can&#8217;t find the face the picture may not be clear enough)</li>
<li>Sorting images into people and places</li>
<li>Check if images taken by a webcam contain a face</li>
</ul>
<p>If you have any suggestions about the code or any other ideas of its uses, let us know!</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?u=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;t=Face+Detection+with+PHP" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Face+Detection+with+PHP+-+http://b2l.me/cj3b4+(via+@cardboardcoder)" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;title=Face+Detection+with+PHP" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;title=Face+Detection+with+PHP" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;title=Face+Detection+with+PHP" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;t=Face+Detection+with+PHP" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;title=Face+Detection+with+PHP" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.cardboardcoder.com/2009/12/face-detection-with-php/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;title=Face+Detection+with+PHP&amp;summary=A%20very%20useful%20piece%20of%20PHP%20code%20that%20will%20highlight%20any%20pictures%20where%20a%20face%20has%20been%20detected.%0D%0A%0D%0AHeres%20the%20first%20piece%20of%20PHP%20code%20you%20will%20need%2C%20it%20would%20be%20best%20to%20make%20this%20an%20include%3A%0D%0A%0D%0A%5Bsourcecode%20language%3D%22php%22%5D%0D%0A%0D%0Aclass%20Face_Detector%20%7B%0D%0A%0D%0Aprotected%20%24detection_data%3B%0D%0Aprotected%20%24canvas%3B%0D%0Apr&amp;source=Cardboard Coder" rel="nofollow" class="external" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;title=Face+Detection+with+PHP" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-pingfm">
			<a href="http://ping.fm/ref/?link=http://www.cardboardcoder.com/2009/12/face-detection-with-php/&amp;title=Face+Detection+with+PHP&amp;body=A%20very%20useful%20piece%20of%20PHP%20code%20that%20will%20highlight%20any%20pictures%20where%20a%20face%20has%20been%20detected.%0D%0A%0D%0AHeres%20the%20first%20piece%20of%20PHP%20code%20you%20will%20need%2C%20it%20would%20be%20best%20to%20make%20this%20an%20include%3A%0D%0A%0D%0A%5Bsourcecode%20language%3D%22php%22%5D%0D%0A%0D%0Aclass%20Face_Detector%20%7B%0D%0A%0D%0Aprotected%20%24detection_data%3B%0D%0Aprotected%20%24canvas%3B%0D%0Apr" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Face%20Detection%20with%20PHP%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22A%20very%20useful%20piece%20of%20PHP%20code%20that%20will%20highlight%20any%20pictures%20where%20a%20face%20has%20been%20detected.%0D%0A%0D%0AHeres%20the%20first%20piece%20of%20PHP%20code%20you%20will%20need%2C%20it%20would%20be%20best%20to%20make%20this%20an%20include%3A%0D%0A%0D%0A%5Bsourcecode%20language%3D%22php%22%5D%0D%0A%0D%0Aclass%20Face_Detector%20%7B%0D%0A%0D%0Aprotected%20%24detection_data%3B%0D%0Aprotected%20%24canvas%3B%0D%0Apr%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.cardboardcoder.com/2009/12/face-detection-with-php/" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.cardboardcoder.com/2009/12/face-detection-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.cardboardcoder.com/2009/12/face-detection-with-php/</feedburner:origLink></item>
	</channel>
</rss>
