<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>daft spunk blog</title>
	<atom:link href="http://www.daftspunk.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.daftspunk.com</link>
	<description>web developer, graphic designer, entrepreneur, conflict hero</description>
	<lastBuildDate>Wed, 28 Dec 2011 10:37:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>PHP Chess Rank Algorithm from Facebook Movie</title>
		<link>http://www.daftspunk.com/code/php-chess-algorithm-from-facebook-movie.html</link>
		<comments>http://www.daftspunk.com/code/php-chess-algorithm-from-facebook-movie.html#comments</comments>
		<pubDate>Wed, 28 Dec 2011 10:29:09 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[chess algorithim]]></category>
		<category><![CDATA[chess algorithm]]></category>
		<category><![CDATA[chess player]]></category>
		<category><![CDATA[chess rank formula]]></category>
		<category><![CDATA[chess ranking]]></category>
		<category><![CDATA[facebook movie]]></category>
		<category><![CDATA[facesmash algorithm]]></category>
		<category><![CDATA[php chess rank]]></category>
		<category><![CDATA[the social network]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=238</guid>
		<description><![CDATA[Following on from the previous post, here is the algorithim used for ranking chess players as seen on The Social Network when Mark Zuckerberg is developing Facemash. The algorithm shown in the movie looked a bit like this: Ea = 1 / (1 + 10 ^ ((Rb-Ra)/400)) Eb = 1 / (1 + 10 ^ [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from the previous post, here is the algorithim used for ranking chess players as seen on The Social Network when Mark Zuckerberg is developing Facemash.</p>
<p>The algorithm shown in the movie looked a bit like this:</p>
<ul>
<li>Ea = 1 / (1 + 10 ^ ((Rb-Ra)/400))</li>
<li>Eb = 1 / (1 + 10 ^ ((Ra-Rb)/400))</li>
</ul>
<p>Here is something a bit more practical in the form of a PHP script:</p>
<pre class="prettyprint lang-php linenumstrigger linenums">
/**
 * Calculates odds of winning or new score.
 * New players start on 2000 points.
 *
 * @param int $player1 Player 1 Score
 * @param int $player2 Player 2 Score
 * @param int $result  Determine the result
 *                     0 = Calculate Odds (%)
 *                     1 = Player 1 Won
 *                     2 = Player 2 Won
 *                     3 = It's a Draw
 */
function calculateRank($player1, $player2, $result=0)
{
	$odds_p1 = 1/(1+pow(10,(($player2-$player1)/400)));
	$odds_p2 = 1/(1+pow(10,(($player1-$player2)/400)));

	if ($result==0)
		return array('player1' =&gt; $odds_p1*100, 'player2' =&gt; $odds_p2*100);

	$result_p1 = ($result==1) ? 1 : (($result==2) ? 0 : 0.5);
	$result_p2 = ($result==1) ? 0 : (($result==2) ? 1 : 0.5);

	$score_p1 = $player1 + (32*($result_p1-$odds_p1));
	$score_p2 = $player2 + (32*($result_p2-$odds_p2));

	return array('player1' =&gt; $score_p1, 'player2' =&gt; $score_p2);
}
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/code/php-chess-algorithm-from-facebook-movie.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Experience Points (XP) Level System</title>
		<link>http://www.daftspunk.com/code/php-experience-points-xp-level-system.html</link>
		<comments>http://www.daftspunk.com/code/php-experience-points-xp-level-system.html#comments</comments>
		<pubDate>Fri, 08 Jul 2011 13:05:22 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[experience points]]></category>
		<category><![CDATA[level up]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xp level]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=236</guid>
		<description><![CDATA[Here&#8217;s a fun little snippet that lets you create a XP leveling system similar to World of Warcraft. *ding!* function calculateXP($myPoints) { $calcStart = 0; // Level 1 Start XP $calcEnd = 10; // Level 1 End XP $calcInc = 0; // Increase by extra how many per level? $calcLevel = 6; // Multiply by [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a fun little snippet that lets you create a XP leveling system similar to World of Warcraft.</p>
<p>*ding!*</p>
<pre class="prettyprint lang-php linenumstrigger linenums">
function calculateXP($myPoints) {

        $calcStart = 0; // Level 1 Start XP
        $calcEnd = 10;  // Level 1 End XP
        $calcInc = 0;   // Increase by extra how many per level?
        $calcLevel = 6; // Multiply by how many per level? (1- easy / 20- hard)

        /* Calculate Level */
        $myLevel = 0;
        $calcCount = 0;
        do {
                $calcCount = $calcCount+1;
                if ($calcCount % 2 == 0 ) { $calcInc = $calcInc + $calcLevel; }
                if (($myPoints &lt; $calcEnd) &amp;&amp; ($myPoints &gt;= $calcStart)) { $myLevel = $calcCount; $myStart = $calcStart; $myEnd = $calcEnd; }
                $calcStart = $calcEnd;
                $calcEnd = $calcEnd + $calcInc;
        } while ($myLevel == 0);
        $myLevel--;

        /* Calculate Percentage to Next Level */
        $myPercent = (($myPoints - $myStart) / ($myEnd - $myStart)) * 100;
        $myPercent = round($myPercent);
        if ($myPercent == 0) { $myPercent = 1; }

        return array('percent'=&gt;$myPercent,'level'=&gt;$myLevel);
}
</pre>
<p>Please excuse the primitive logic and bad variable naming, this was written many years ago.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/code/php-experience-points-xp-level-system.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Landing pages for dumbasses</title>
		<link>http://www.daftspunk.com/spam/landing-pages-for-dumbasses.html</link>
		<comments>http://www.daftspunk.com/spam/landing-pages-for-dumbasses.html#comments</comments>
		<pubDate>Fri, 17 Jun 2011 00:31:16 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[spam]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[home page]]></category>
		<category><![CDATA[landing page]]></category>
		<category><![CDATA[what do i get]]></category>
		<category><![CDATA[what does it do]]></category>
		<category><![CDATA[what is it]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=235</guid>
		<description><![CDATA[If you&#8217;re going to make a site that people will actually want to use, your landing page should do no less than answer to and inform of three things: What is it? What do I have to do? What do I get? Anything else should only relate to the above, for example if there is [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re going to make a site that people will actually want to use, your landing page should do no less than answer to and inform of three things:</p>
<ol>
<li><strong>What is it?</strong></li>
<li><strong>What do I have to do?</strong></li>
<li><strong>What do I get?</strong></li>
</ol>
<p>Anything else should only relate to the above, for example if there is a potential risk of wasting resources, like the user&#8217;s precious time, reinforce the cost:reward or illustrate that other people have taken the risk before them, like the peer pressure effect from a Facebook Like Box.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/spam/landing-pages-for-dumbasses.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Half measures for 1140px Grid by Andy Taylor</title>
		<link>http://www.daftspunk.com/code/half-measures-for-1140px-grid-by-andy-taylor.html</link>
		<comments>http://www.daftspunk.com/code/half-measures-for-1140px-grid-by-andy-taylor.html#comments</comments>
		<pubDate>Wed, 15 Jun 2011 08:13:28 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[1140 grid]]></category>
		<category><![CDATA[24 column]]></category>
		<category><![CDATA[andy taylor]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[half]]></category>
		<category><![CDATA[halves]]></category>
		<category><![CDATA[new 960]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=232</guid>
		<description><![CDATA[Who uses 1024&#215;768 resolution anymore besides your grandma, give me a break. Andy Taylor&#8217;s 1140px CSS Grid could be considered the new 960 grid. Although super handy 12 columns doesn&#8217;t quite cut it for tight spaces. So using the amazing trickery of maths, this additional CSS beefs it up to potentially 24 by adding &#8220;half&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Who uses 1024&#215;768 resolution anymore besides your grandma, give me a break. Andy Taylor&#8217;s <a href="http://cssgrid.net/">1140px CSS Grid</a> could be considered the new 960 grid. Although super handy 12 columns doesn&#8217;t quite cut it for tight spaces. So using the amazing trickery of maths, this additional CSS beefs it up to potentially 24 by adding &#8220;half&#8221; columns.</p>
<h3>Appendage:</h3>
<pre class="prettyprint lang-css linenumstrigger linenums">
.halfcol { width: 2.425%; float: left; margin-right: 3.8%; }
.onecol.half { width: 9.175%; }
.twocol.half { width: 17.825%; }
.threecol.half { width: 26.475%; }
.fourcol.half { width: 35.125%; }
.fivecol.half { width: 43.775%; }
.sixcol.half { width: 52.425%; }
.sevencol.half { width: 61.075%; }
.eightcol.half { width: 69.725%; }
.ninecol.half { width: 78.375%; }
.tencol.half { width: 87.025%; }
.elevencol.half { width: 93.775%; }
</pre>
<h3>Usage:</h3>
<pre class="prettyprint lang-php linenumstrigger linenums">
&lt;div class=&quot;halfcol&quot;&gt;Half a column wide&lt;/div&gt;
&lt;div class=&quot;onecol half&quot;&gt;One and a half columns wide&lt;/div&gt;
&lt;div class=&quot;twocol half&quot;&gt;Two and a half columns wide&lt;/div&gt;
&lt;div class=&quot;threecol half&quot;&gt;Three and a half columns wide&lt;/div&gt;
&lt;div class=&quot;fourcol half&quot;&gt;Four and a half columns wide&lt;/div&gt;
&lt;div class=&quot;fivecol half&quot;&gt;Five and a half columns wide&lt;/div&gt;
&lt;div class=&quot;sixcol half&quot;&gt;Six and a half columns wide&lt;/div&gt;
&lt;div class=&quot;sevencol half&quot;&gt;Seven and a half columns wide&lt;/div&gt;
&lt;div class=&quot;eightcol half&quot;&gt;Eight and a half columns wide&lt;/div&gt;
&lt;div class=&quot;ninecol half&quot;&gt;Nine and a half columns wide&lt;/div&gt;
&lt;div class=&quot;tencol half&quot;&gt;Ten and a half columns wide&lt;/div&gt;
&lt;div class=&quot;elevencol half&quot;&gt;Eleven and a half columns wide&lt;/div&gt;
</pre>
<p>Aware this doesn&#8217;t cover the IE component, this is intentional because anything < IE9 sux.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/code/half-measures-for-1140px-grid-by-andy-taylor.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>.htaccess redirect to avoid duplicate content penalties</title>
		<link>http://www.daftspunk.com/spam/htaccess-redirect-to-avoid-duplicate-content-penalties.html</link>
		<comments>http://www.daftspunk.com/spam/htaccess-redirect-to-avoid-duplicate-content-penalties.html#comments</comments>
		<pubDate>Sat, 16 Apr 2011 01:34:04 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[spam]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[redirect www]]></category>
		<category><![CDATA[rewritecond]]></category>
		<category><![CDATA[rewriterule]]></category>
		<category><![CDATA[without www]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=227</guid>
		<description><![CDATA[This might seem like an obvious one but it&#8217;s something seldom seen in newly launched sites. If your website can be accessed with yourdomain.com and www.yourdomain.com Google will see this as two completely separate sites and penalize you for having duplicated content. You must redirect your visitors to either yourdomain.com or www.yourdomain.com &#8211; not allowing [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.daftspunk.com/cms/wp-content/uploads/duplicate-content-300x201.jpg" alt="" title="duplicate-content" width="300" height="201" class="alignright size-medium wp-image-230" />This might seem like an obvious one but it&#8217;s something seldom seen in newly launched sites. If your website can be accessed with yourdomain.com and www.yourdomain.com Google will see this as two completely separate sites and penalize you for having duplicated content. You must redirect your visitors to either yourdomain.com or www.yourdomain.com &#8211; <em>not allowing both</em>.</p>
<p>It is important to address this problem as early as possible since links can be created outside the scope of your website and the search engines may already have indexed your website under both addresses, this cannot be changed that easily.</p>
<p>The solution is simple: force a 301 redirect for all http requests that are going to the incorrect website URL.<br />
<span id="more-227"></span></p>
<h3>Redirect www.yourdomain.com to yourdomain.com</h3>
<pre class="lang-txt">
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
</pre>
<h3>Redirect yourdomain.com to www.yourdomain.com</h3>
<pre class="lang-txt">
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www.yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
</pre>
<h3>Break it down</h3>
<p><strong>Line 1 -2</strong>: Instructs apache to handle the current directory and enable the rewrite module. </p>
<p><strong>Line 3</strong>: Specifies that this rewrite should be ignored for HTTPS protocol. (edit: Thanks Al)</p>
<p><strong>Line 4</strong>: Specifies the condition for when the rule following should be triggered. For example, when the condition of HTTP_HOST (website URL) is <em>not</em> (specified with &#8220;!&#8221;) the correct website url respectively starting (^) and ending as a hostname ($). The final [NC] tag specifies that the hostname is not case sensitive. </p>
<p><strong>Line 4</strong>: Describes the action that should be performed after the above condition is met. The first segment of the rule ^(.*)$ is an important and special one, this captures the requested url without the domain as a variable ($1). The second segment defines the target of the rewrite rule, the final destinaton for the redirect. The tags at the end will determine how the redirect is performed, in this case we are performing a permanent redirect (R=301) and this is the last rule for the rewrite (L) so a result is expected.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/spam/htaccess-redirect-to-avoid-duplicate-content-penalties.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dreamweaver color scheme for Netbeans editor</title>
		<link>http://www.daftspunk.com/code/dreamweaver-color-scheme-for-netbeans-editor.html</link>
		<comments>http://www.daftspunk.com/code/dreamweaver-color-scheme-for-netbeans-editor.html#comments</comments>
		<pubDate>Sat, 02 Apr 2011 03:55:50 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[colour]]></category>
		<category><![CDATA[dreamweaver colors]]></category>
		<category><![CDATA[netbeans editor]]></category>
		<category><![CDATA[scheme]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=219</guid>
		<description><![CDATA[If you&#8217;ve stepped up your game and ditched Dreamweaver in favour of using a real PHP IDE like Netbeans then this Dreamweaver-style theme will help make the transition that much easier. Being unable to find a Dreamweaver color scheme for Netbeans code editor anywhere, this one was built from scratch today using exact color codes [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve stepped up your game and ditched Dreamweaver in favour of using a real PHP IDE like <a href="http://netbeans.org/">Netbeans</a> then this <a href='http://www.daftspunk.com/cms/wp-content/uploads/Dreamweaver.zip'>Dreamweaver-style theme</a> will help make the transition that much easier.</p>
<p>Being unable to find a Dreamweaver color scheme for Netbeans code editor <em>anywhere</em>, this one was built from scratch today using exact color codes from Dreamweaver.</p>
<p>The Netbeans theme also takes a slight influence from Visual Studio&#8217;s default colors.</p>
<p><img src="http://www.daftspunk.com/cms/wp-content/uploads/netbeans-colour.jpg" alt="" title="Neatbeans Dreamweaver Color Scheme" class="wp-image-220" /></p>
<p><strong><em>Mmmmm now that&#8217;s easy on the eyes.</em></strong></p>
<ul>
<li>Download <a href='http://www.daftspunk.com/cms/wp-content/uploads/Dreamweaver.zip'>Netbeans/Dreamweaver color scheme</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/code/dreamweaver-color-scheme-for-netbeans-editor.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Making a Side Page Menu in WordPress</title>
		<link>http://www.daftspunk.com/code/making-a-side-page-menu-in-wordpress.html</link>
		<comments>http://www.daftspunk.com/code/making-a-side-page-menu-in-wordpress.html#comments</comments>
		<pubDate>Sun, 06 Mar 2011 21:26:37 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[listing]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[pages]]></category>
		<category><![CDATA[sidebar]]></category>
		<category><![CDATA[sidemenu]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=217</guid>
		<description><![CDATA[For WordPress sites with nested pages a side menu is a valuable element to any design. First we determine if the current page is in fact the parent or a child and collect it&#8217;s ID. Then by calling the wp_list_pages command we can list the children and determine if a side menu is even required. [...]]]></description>
			<content:encoded><![CDATA[<p>For WordPress sites with nested pages a side menu is a valuable element to any design. First we determine if the current page is in fact the parent or a child and collect it&#8217;s ID. Then by calling the <strong>wp_list_pages</strong> command we can list the children and determine if a side menu is even required.</p>
<pre class="prettyprint lang-html linenumstrigger linenums">
&lt;?php
$parent_id = ($post-&gt;post_parent)?$post-&gt;post_parent:$post-&gt;ID;
$children = wp_list_pages(&quot;title_li=&amp;child_of=&quot;.$parent_id.&quot;&amp;echo=0&quot;);
if ($children) { ?&gt;
	&lt;h3&gt;&lt;?php echo get_the_title($parent_id)?&gt;&lt;/h3&gt;
	&lt;ul&gt;
		&lt;li class=&quot;&lt;?=($parent_id==$post-&gt;ID)?'current_page_item':''?&gt;&quot;&gt;&lt;a href=&quot;&lt;?=get_permalink($parent_id)?&gt;&quot;&gt;Overview&lt;/a&gt;&lt;/li&gt;
		&lt;?php echo $children; ?&gt;
	&lt;/ul&gt;
&lt;?php } ?&gt;
</pre>
<p>Beautifully simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/code/making-a-side-page-menu-in-wordpress.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cool story bro</title>
		<link>http://www.daftspunk.com/conflict/cool-story-bro.html</link>
		<comments>http://www.daftspunk.com/conflict/cool-story-bro.html#comments</comments>
		<pubDate>Sat, 05 Mar 2011 01:29:30 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[conflict]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=214</guid>
		<description><![CDATA[The story we tell ourselves to justify, reason, explain our lack of&#8230;whatever. &#8220;They always&#8230;&#8221; &#8220;That happened to me because&#8230;&#8221; &#8220;They are&#8230;&#8221; They are a person. That happened to you because it happened. They never more than they always.]]></description>
			<content:encoded><![CDATA[<p>The story we tell ourselves to justify, reason, explain our lack of&#8230;whatever.</p>
<p>&#8220;They always&#8230;&#8221;</p>
<p>&#8220;That happened to me because&#8230;&#8221;</p>
<p>&#8220;They are&#8230;&#8221;</p>
<p>They are a person. That happened to you because it happened. They <em>never</em> more than they always.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/conflict/cool-story-bro.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Recreate/Reset Table ID Fields (1,2,3,4&#8230;) using mySQL</title>
		<link>http://www.daftspunk.com/code/how-to-reset-table-id-fields-1234-using-mysql.html</link>
		<comments>http://www.daftspunk.com/code/how-to-reset-table-id-fields-1234-using-mysql.html#comments</comments>
		<pubDate>Wed, 23 Feb 2011 07:54:41 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[auto increment counter]]></category>
		<category><![CDATA[clean up table id]]></category>
		<category><![CDATA[copy mysql table]]></category>
		<category><![CDATA[duplicate mysql table]]></category>
		<category><![CDATA[id column]]></category>
		<category><![CDATA[id field]]></category>
		<category><![CDATA[modify table id]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[new id]]></category>
		<category><![CDATA[recompile table id]]></category>
		<category><![CDATA[recount table id]]></category>
		<category><![CDATA[recreate table id]]></category>
		<category><![CDATA[repopulate table id]]></category>
		<category><![CDATA[reset table id]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[table identifier]]></category>
		<category><![CDATA[update variable example]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=149</guid>
		<description><![CDATA[If you are anal retentive or obsessive–compulsive about having clean ID numbers in your mySQL tables, this code should prove itself useful as it will automatically: clean up, convert, recount, reset, recompile, recreate, repopulate the ID column for every entry modify the auto increment counter for the table It is important to note this script [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.daftspunk.com/cms/wp-content/uploads/clean_hands-223x300.jpg" alt="" title="OCD Clean mySQL" width="223" height="300" class="alignright size-medium wp-image-194" />If you are anal retentive or obsessive–compulsive about having clean ID numbers in your mySQL tables, this code should prove itself useful as it will automatically:</p>
<ul>
<li>clean up, convert, recount, reset, recompile, recreate, repopulate the ID column for every entry</li>
<li>modify the auto increment counter for the table</li>
</ul>
<p>It is important to note <strong>this script should not be used on tables with cross referenced identifiers</strong> meaning if a different table relies on the IDs of the modified table it will potentially break the references as a result of assigning the new IDs.</p>
<p>The code might also be useful for other purposes, such as cleaning up CMS page orders or providing a package with clean sample data.<br />
<span id="more-149"></span></p>
<h3>Example</h3>
<p>If your table looks like this:</p>
<pre class="lang-htm noCopy">
ID  |  Name
-------------
1   |  Wally
4   |  Sally
6   |  Harry
12  |  Mandy
</pre>
<p>This script will modify your table to this:</p>
<pre class="lang-htm noCopy">
ID   |  Name
-------------
1    |  Wally
2    |  Sally
3    |  Harry
4    |  Mandy
</pre>
<h3>mySQL Script</h3>
<pre class="lang-sql linenumstrigger linenums">
-- your_table: The table to modify
-- id: The id field/column to reset

SET @num := 0;
UPDATE your_table SET id = @num := (@num+1);
ALTER TABLE your_table AUTO_INCREMENT =1;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/code/how-to-reset-table-id-fields-1234-using-mysql.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Cultural Conflict of Environment</title>
		<link>http://www.daftspunk.com/conflict/the-conflict-of-environment.html</link>
		<comments>http://www.daftspunk.com/conflict/the-conflict-of-environment.html#comments</comments>
		<pubDate>Tue, 22 Feb 2011 12:39:03 +0000</pubDate>
		<dc:creator>spunky</dc:creator>
				<category><![CDATA[conflict]]></category>
		<category><![CDATA[blame]]></category>
		<category><![CDATA[contribute]]></category>
		<category><![CDATA[culture]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[equality]]></category>
		<category><![CDATA[fulfilment]]></category>
		<category><![CDATA[grateful]]></category>
		<category><![CDATA[happiness]]></category>
		<category><![CDATA[locality]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[product of environment]]></category>
		<category><![CDATA[society]]></category>

		<guid isPermaLink="false">http://www.daftspunk.com/?p=136</guid>
		<description><![CDATA[If you grew up in India you would be a product of that environment. This is probably the first and only time you can blame, or credit, your environment because you have absolutely no say in the matter. Beyond this point your environment becomes increasingly decided. At school you decide to hang out with the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.daftspunk.com/cms/wp-content/uploads/grass_is_greener-300x175.jpg" alt="" title="The Grass is Always Greener" width="300" height="175" class="alignright size-medium wp-image-140" />If you grew up in India you would be a product of that environment. This is probably the first and only time you can blame, or credit, your environment because you have absolutely no say in the matter. Beyond this point your environment becomes increasingly decided. At school you <em>decide</em> to hang out with the stoners or the nerds and you will likely adopt that culture/head space. It is feeble to blame the culture, environment, location or anything else. When in fact you arrived here solely based on your decisions.<br />
<span id="more-136"></span><br />
<em>&#8220;Move some place else, that will solve your problems.&#8221;</em></p>
<p>Places have different populations or &#8220;markets&#8221;. If you were a gay man the possibility of finding another gay man is greater if you lived in the city than a rural town because it has a much larger market. So if you define opportunity as meeting people who share your interests, beleifs, hobbies or whatever then a place with a huge population will have more opportunity.</p>
<p>For some the &#8220;right people&#8221; might only be found in rural areas in which case it isn&#8217;t a numbers game at all, it is about being in a rural place. For others the definition of opportunity might be solidarity which equally favours rural areas as to receive a less distracting environment. However this is all just subjective meaning, or more strongly <strong>a belief</strong>, often stemmed from a perceived or actual threat.</p>
<p>Meaning and beleifs are just that. Yours don&#8217;t mean much to anyone else, they only mean something to you. You could share a convincing story about how you came to that conclusion but that&#8217;s all it is, a story you tell yourself. It doesn&#8217;t make it real to anyone else but you.</p>
<p><em>&#8220;Oh it&#8217;s society, it&#8217;s the economy, it&#8217;s the previous generation.&#8221;</em></p>
<p>Complaining, blaming, justifying, &#8220;carrying on&#8221; are all actions that attempt to avoid the responsibility of being wrong and/or looking bad. People who persist in this are resigned from life and just waiting to die. This is the easy way out most people take but it comes at the cost of <i>happiness</i>.</p>
<p>To be happy at a basic level at least, you must be two things: grateful and fulfilled. Being grateful is easy; take a moment to stop and look at everything in your life, say thank you with complete sincerity. This is why poor people are happy, they are grateful for what little they have. Being fulfilled actually takes effort; contribute to something greater than yourself, something selfless that increases equality with the people around you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daftspunk.com/conflict/the-conflict-of-environment.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

