<?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>The Code Dojo</title>
	<atom:link href="http://dojo.codegreene.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dojo.codegreene.com</link>
	<description>The Code Dojo is the veritable repository of random musings from the development team at Code Greene.</description>
	<lastBuildDate>Fri, 15 Jul 2011 18:56:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Restructuring a flat MPTT array into a tree array</title>
		<link>http://dojo.codegreene.com/2011/restructuring-a-flat-mptt-array-into-a-tree-array/</link>
		<comments>http://dojo.codegreene.com/2011/restructuring-a-flat-mptt-array-into-a-tree-array/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 03:50:25 +0000</pubDate>
		<dc:creator>Benjam</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=661</guid>
		<description><![CDATA[I have a flat MPTT (also called a nested set) array (really any tree ordered array will work, not necessarily an MPTT array) which has it&#8217;s elements output in order as follows: Top Parent 1 Child 1-1 Child 1-2 Sub-Child 1-2-1 Sub-Child 1-2-2 Child 1-3 Top Parent 2 Child 2-1 &#8230; Each element is it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I have a flat <acronym title="Modified Pre-ordered Tree Traversal">MPTT</acronym> (also called a nested set) array (really any tree ordered array will work, not necessarily an MPTT array) which has it&#8217;s elements output in order as follows:</p>
<ul>
<li>Top Parent 1</li>
<li>Child 1-1</li>
<li>Child 1-2</li>
<li>Sub-Child 1-2-1</li>
<li>Sub-Child 1-2-2</li>
<li>Child 1-3</li>
<li>Top Parent 2</li>
<li>Child 2-1</li>
<li>&#8230;</li>
</ul>
<p>Each element is it&#8217;s own entry in the one dimensional array.  This makes outputting that data in any kind of readable form very difficult, where keeping track of parents and branches are required in order to make sense of it.  This gets pretty messy, pretty quickly.  And the deeper the tree, the more complicated the process.</p>
<p>To make this easier to deal with, the array should be built in a tree format as follows:</p>
<ul>
<li>Top Parent 1
<ul>
<li>Child 1-1</li>
<li>Child 1-2
<ul>
<li>Sub-Child 1-2-1</li>
<li>Sub-Child 1-2-2</li>
</ul>
</li>
<li>Child 1-3</li>
</ul>
</li>
<li>Top Parent 2
<ul>
<li>Child 2-1</li>
<li>&#8230;</li>
</ul>
</li>
</ul>
<p>Where the children of the elements in the tree are actually children of the elements in the array.</p>
<p>In order to do this quickly and painlessly, we are going to parse through this array twice&#8230; no iterations, just a couple of foreach loops and we&#8217;ll get our tree exactly how we want it.</p>
<p>In order to do this, we must first make sure our array indexes are the same as the IDs of the items we are sorting (because we are pulling this from a database, right?).</p>
<p>To do this in CakePHP we run it through the Set::combine function like so:<br />
<code>Set::combine($tree_data, '/Model/id', '/.');</code></p>
<p>If you are not using CakePHP, you can create a new array, and as you foreach through your original array, set elements in the new array accordingly:<br />
<code>
<pre>
$old_tree_data = $tree_data;
$tree_data = array( );
foreach ($old_tree_data as $node) {
	$tree_data[$node['Model']['id']] = $node;
}
</pre>
<p></code></p>
<p>Now that we have our array indexes set to our model ID, we can proceed.</p>
<p>The trick to this method is not to move the nodes around, because if we did that, we&#8217;d still have to keep track of what went where, and that&#8217;s exactly what we&#8217;re trying to avoid.  Instead, we&#8217;re going to use references to keep track of our data as it gets moved around.  That way we still have our original base array element that we can play with without having to know where it actually is in the tree.</p>
<p>Here is the code, and then we&#8217;ll go through it and explain.<br />
<code>
<pre>
foreach ($tree_data as $key =&gt; $node) {
	if ( ! $node['Model']['parent_id']) {
		continue;
	}

	if ( ! isset($tree_data[$node['Model']['parent_id']]['Child']) {
		$tree_data[$node['Model']['parent_id']]['Child'] = array( );
	}

	$tree_data[$node['Model']['parent_id']]['Child'] =&amp; $tree_data[$key];
}
</pre>
<p></code></p>
<p>Now to explain&#8230; We parse through the array and for each element, we first test the element to see if it has a parent, if it does not, we just skip it, there&#8217;s no need to go further.</p>
<p>We then check and see if the parent element has an index called &#8216;Child&#8217; and if it does not, we create one and set it as an array.</p>
<p>Then we do the magic.  We set the next item in the parent node&#8217;s Child element to the <em><strong>reference</strong></em> of the current node.  We don&#8217;t actually move the node.  So now if you look at the array, you&#8217;ll see two entries for the current node, one inside the parent element, and one that was the original in the flat array.</p>
<p><strong>WARNING</strong>: One thing to note here, is that we are not setting it to the reference of <code>$node</code>, but to the reference of <code>$tree_data[$key]</code>.  The reason for this is because if the element is referenced to <code>$node</code>, the next time through the loop, the value of <code>$node</code> will change and <strong>all</strong> of the referenced elements will be set to the new value of <code>$node</code>, and we certainly don&#8217;t want that.</p>
<p>The magical part of this, is that no matter where the references end up, the original is still there to be modified.  So for instance if I have a branch path with IDs as follows: 12, 5, 13, 14&#8230; it doesn&#8217;t matter what that path is, I can still access the element with ID 14 by modifying <code>$tree_data[14]</code>.  So if element 14 has child nodes, I can place them in the tree by modifying <code>$tree_data[14]['Child']</code>, and wherever that node is actually supposed to be, it will get modified there as well.  That&#8217;s the beauty of references.</p>
<p>Now to clean up the array, we just parse through it once more, and clear out the original reference nodes (the ones that have parents):<br />
<code>
<pre>
foreach ($tree_data as $key =&gt; $node) {
	if ( ! empty($node['Model']['parent_id']) {
		unset($tree_data[$key]);
	}
}
</pre>
<p></code></p>
<p>And that&#8217;s it! No messing around with paths&#8230; no iterative functions&#8230; just twice through an array (maybe three times), and it&#8217;s all sorted, compartmentalized, and pretty.</p>
<p>If you have other methods of getting your trees into a usable form, please let us know in the comments.  We love seeing how other people do things.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2011/restructuring-a-flat-mptt-array-into-a-tree-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Geolocation</title>
		<link>http://dojo.codegreene.com/2010/geolocation/</link>
		<comments>http://dojo.codegreene.com/2010/geolocation/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 21:39:35 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=647</guid>
		<description><![CDATA[Mobile applications are all the rage as smart phones are moving from smart to genius. Along with this movement is the movement to location aware applications. Your phone has GPS, your laptop has wifi, and your IP is known (generally) to be tied to a specific location. Given these new technologies being more commonplace the [...]]]></description>
			<content:encoded><![CDATA[<p>Mobile applications are all the rage as smart phones are moving from smart to genius. Along with this movement is the movement to location aware applications. Your phone has GPS, your laptop has wifi, and your IP is known (generally) to be tied to a specific location. Given these new technologies being more commonplace<a href="http://www.w3c.org"> the W3C</a> has seen it fit to add <a href="http://dev.w3.org/geo/api/spec-source.html">an API</a> to web design for Geo Location.</p>
<p>Although not technically a piece of the <a href="http://dev.w3.org/html5/spec/Overview.html">HTML5 spec</a>, it is commonly used in conjunction with HTML5 and easy to use.</p>
<p>The geolocation API exposes three methods on the navigator object in javascript, two for getting location information about your user <strong>getCurrentPosition</strong> and <strong>watchPosition</strong>, and the other is a paired method for watchPosition, it is <strong>clearWatch</strong>.</p>
<p>The first, getCurrentPosition, returns a one time shot of where the user is. This is good for pinning a map or giving static directions. The second, watchPosition, continues polling at regular intervals to keep tabs on where the user is. This is perfect for giving dynamic directions, or tracking a movement. The two calls are mirrors of one another in that they both accept three arguments (success handler, error handler, geolocation options). The two calls are also both asynchronous, with a caveat that if this is a user&#8217;s first visit to your site they may be prompted to allow their position to be shared, this could cause the browser to stop loading.</p>
<p>The odd ball function here is clearWatch, which simply clears any watches you have assigned, in other words it stops tracking your user.</p>
<p>Now that we know the basics let&#8217;s dig in!</p>
<pre><code>if(navigator.geolocation){
     navigator.geolocation.getCurrentPosition(function (position){
         var lat = position.coords.latitude;
         var lon = position.coords.longitude;

         alert('Lat: '+ lat +' \nLon: '+ lon);
     }
}</code></pre>
<p>The example above is about as simple as it gets, a simple one shot to get the users coordinates and then output them to the browser.</p>
<p>That is all there is to Geolocation in the browser, pair it up with Google Maps API and you have an award winning geolocation application ready to please the world.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/geolocation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharpening the Blades: Useful Tweets</title>
		<link>http://dojo.codegreene.com/2010/sharpening-the-blades-useful-tweets/</link>
		<comments>http://dojo.codegreene.com/2010/sharpening-the-blades-useful-tweets/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 19:30:58 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=632</guid>
		<description><![CDATA[Below are some tweets that I have seen recently that I have found to be helpful. Smashing Magazine &#8211; HTML5/CSS3 Cheatsheet &#8211; http://bit.ly/aj0yfA Ben Ludman &#8211; URL shorteners and CakePHP &#8211; Snook.ca http://bit.ly/btTmSP And this site &#8211; HTML5 Doctor &#8211; I couldn&#8217;t track down the tweet that I found it from, but it is a [...]]]></description>
			<content:encoded><![CDATA[<p>Below are some tweets that I have seen recently that I have found to be helpful.</p>
<p><a href="http://twitter.com/smashingmag" target="_blank">Smashing Magazine</a> &#8211; HTML5/CSS3 Cheatsheet &#8211; <a rel="nofollow" href="http://bit.ly/aj0yfA" target="_blank">http://bit.ly/aj0yfA</a></p>
<p><a href="http://twitter.com/benludman" target="_blank">Ben Ludman</a> &#8211; URL shorteners and CakePHP &#8211; Snook.ca <a rel="nofollow" href="http://bit.ly/btTmSP" target="_blank">http://bit.ly/btTmSP</a></p>
<p>And this site &#8211; <a href="http://html5doctor.com/" target="_blank">HTML5 Doctor</a> &#8211; I couldn&#8217;t track down the tweet that I found it from, but it is a great resource for HTML5.</p>
<p>I looked for some tweets about Magento, but just couldn&#8217;t find any that were appealing.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/sharpening-the-blades-useful-tweets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharpening the Blades: Redesign v. Realign and Better Buttons with CSS3</title>
		<link>http://dojo.codegreene.com/2010/sharpening-the-blades-redesign-v-realign-and-better-buttons-with-css3/</link>
		<comments>http://dojo.codegreene.com/2010/sharpening-the-blades-redesign-v-realign-and-better-buttons-with-css3/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 15:55:33 +0000</pubDate>
		<dc:creator>Master Sensei</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[CSS3 Button]]></category>
		<category><![CDATA[Realign]]></category>
		<category><![CDATA[Redesign]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=621</guid>
		<description><![CDATA[After some time off, the Sharpening the Blades series is back with two front-end/design articles. Luke, Redesign v. Realign I really liked this article. As designers when we are approached by a client we always start to redesign their project. Sometimes all they want is a realign though. This article defines what a redesign is [...]]]></description>
			<content:encoded><![CDATA[<p>After some time off, the Sharpening the Blades series is back with two front-end/design articles.</p>
<p>Luke, <a href="http://www.webdesignerdepot.com/2010/06/redesign-vs-realign/" target="_blank">Redesign v. Realign</a><img class="alignright size-full wp-image-623" style="border: 1px solid #444444; margin: 8px 0pt 20px 20px; padding: 2px;" title="design-thumb" src="http://dojo.codegreene.com/wp-content/uploads/2010/06/design-thumb.jpg" alt="" width="100" height="100" /><br />
I really liked this article. As designers when we are approached by a client we always start to redesign their project. Sometimes all they want is a realign though. This article defines what a redesign is and what a realign is. The way each is approached is different and when they are followed I think it will lead to more happy clients. The hard part is defining when each is needed. This article will help with that. Web designers give this a read.</p>
<p>Mike, <a href="http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/" target="_blank">Better Buttons with CSS3</a><img class="alignright size-full wp-image-622" style="margin: 8px 0pt 20px 20px; padding: 2px; border: 1px solid #444444;" title="css3-button" src="http://dojo.codegreene.com/wp-content/uploads/2010/06/css3-button.png" alt="" width="100" height="100" /><br />
With better browser support, CSS3 is finally starting to get some traction. While IE is still emerging from the dark ages, there&#8217;s no reason we can&#8217;t start using CSS3. Web Designer Wall recently published an article on creating web buttons with nothing more than CSS. Even though rounded corners, gradients, text shadows, and box shadows aren&#8217;t all supported, your buttons will look fantastic for browsers that do, and perfectly usable for the ones that don&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/sharpening-the-blades-redesign-v-realign-and-better-buttons-with-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento and Stackable Hosting</title>
		<link>http://dojo.codegreene.com/2010/magento-and-stackable-hosting/</link>
		<comments>http://dojo.codegreene.com/2010/magento-and-stackable-hosting/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 17:24:49 +0000</pubDate>
		<dc:creator>Master Sensei</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Magento Mavens]]></category>
		<category><![CDATA[Stackable]]></category>
		<category><![CDATA[Xmission]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=618</guid>
		<description><![CDATA[Alley-way neighbor, Xmission, wrote a nice little post about Magento and one of their hosting products, Stackable, and happened to mention our CTO, Mac. Check it out here: Magento and Stackable Hosting, A Perfect Fit! We have run a couple of installs on Stackable and it truly is a great product. If you haven&#8217;t already, [...]]]></description>
			<content:encoded><![CDATA[<p>Alley-way neighbor, Xmission, wrote a nice little post about Magento and one of their hosting products, Stackable, and happened to mention our CTO, Mac.</p>
<p>Check it out here: <a href="http://transmission.xmission.com/2010/04/29/magento-and-stackable-hosting-a-perfect-fit" target="_blank">Magento and Stackable Hosting, A Perfect Fit!</a></p>
<p>We have run a couple of installs on Stackable and it truly is a great product. If you haven&#8217;t already, check out our Magento specific site &#8211; <a href="http://www.magentomavens.com" target="_blank">Magento Mavens</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/magento-and-stackable-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hackUTOS &#8211; A Code Festival</title>
		<link>http://dojo.codegreene.com/2010/hackutos-a-code-festival/</link>
		<comments>http://dojo.codegreene.com/2010/hackutos-a-code-festival/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 20:04:39 +0000</pubDate>
		<dc:creator>Master Sensei</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Food]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[UTOS]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=613</guid>
		<description><![CDATA[A friend of ours sent us an email with some information about a cool event coming up called hackUTOS &#8211; A Code Festival. It looks pretty cool and it will be interesting to see what kind of things can be hacked and created at this event. For more information: Event Website Facebook Event Page]]></description>
			<content:encoded><![CDATA[<p><a href="http://dojo.codegreene.com/wp-content/uploads/2010/04/hackUTOS.png"><img class="alignright size-full wp-image-614" title="hackUTOS" src="http://dojo.codegreene.com/wp-content/uploads/2010/04/hackUTOS.png" alt="" width="293" height="158" /></a>A friend of ours sent us an email with some information about a cool event coming up called hackUTOS &#8211; A Code Festival. It looks pretty cool and it will be interesting to see what kind of things can be hacked and created at this event.</p>
<p>For more information:</p>
<p><a href="http://wiki.utos.org/Event:hackUTOS_-_A_Code_Festival" target="_blank">Event Website</a><br />
<a href="http://www.facebook.com/?sk=events#!/event.php?eid=114694361876524">Facebook Event Page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/hackutos-a-code-festival/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Features on The Code Dojo</title>
		<link>http://dojo.codegreene.com/2010/new-features-on-the-code-dojo/</link>
		<comments>http://dojo.codegreene.com/2010/new-features-on-the-code-dojo/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 21:41:27 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[cufon]]></category>
		<category><![CDATA[custom share icons]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[new]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=610</guid>
		<description><![CDATA[Having been the creator and manager of several WordPress sites, there were a few things this blog was lacking so I took some time to update them. This was one of Code Greene&#8217;s first WordPress site and was built in early 2009, so naturally it was a bit outdated. Here are a few things to [...]]]></description>
			<content:encoded><![CDATA[<p>Having been the creator and manager of several WordPress sites, there were a few things this blog was lacking so I took some time to update them. This was one of Code Greene&#8217;s first WordPress site and was built in early 2009, so naturally it was a bit outdated. Here are a few things to notice as you read that have been updated.</p>
<p>1. <strong>Custom Font Replacement:</strong> We had been using sIFR, but shortly after we built this site, cufón came around and we fell in love. Any custom fonts you see are now generated by cufón.</p>
<p>2. <strong>Dynamic Sidebar:</strong> The old sidebar was hard coded. I took that out and made each section it&#8217;s own widget which allows to move them around easily if needed and also add third-party widgets should we choose to do so.</p>
<p>3. <strong>RSS:</strong> I created a FeedBurner RSS so be sure to update &#8211; <a href="http://feeds.feedburner.com/TheCodeDojo" target="_blank">http://feeds.feedburner.com/TheCodeDojo</a></p>
<p>4. <strong>The Clan:</strong> Under The Clan section in the sidebar, you can now click on one of the names and it takes you to a new page with that persons bio and all the posts they have written.</p>
<p>5. <strong>Facebook Fan Page:</strong> We started a Facebook Fan Page &#8211; you can become a fan here: <a href="http://www.facebook.com/CodeGreene" target="_blank">http://www.facebook.com/CodeGreene</a></p>
<p>6. <strong>Custom Share Icons:</strong> <a href="http://dojo.codegreene.com/mike-metcalf" target="_self">Mike</a> built us custom share icons to fit our ninja theme. Thanks Mike!</p>
<p>7. <strong>Contact Page:</strong> Rather than sending you, the user, to codegreene.com to fill out a contact form, you can now send us your requests by going here: <a href="http://dojo.codegreene.com/ninjas-for-hire" target="_self">http://dojo.codegreene.com/ninjas-for-hire</a> &#8211; so drop us a line.</p>
<p>A few subtle changes will be coming in the future &#8211; let us know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/new-features-on-the-code-dojo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sharpening the Blades: Future of Web Typography, Helpful jQuery Methods, April Fools &#8211; PHP Style</title>
		<link>http://dojo.codegreene.com/2010/sharpening-the-blades-future-of-web-typography-helpful-jquery-methods-april-fools-php-style/</link>
		<comments>http://dojo.codegreene.com/2010/sharpening-the-blades-future-of-web-typography-helpful-jquery-methods-april-fools-php-style/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 21:11:11 +0000</pubDate>
		<dc:creator>Master Sensei</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[April Fools]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=576</guid>
		<description><![CDATA[This April Fools edition of Sharpening the Blades only has two serious articles and we&#8217;ll let you decide on the last one. Luke talks about the Future of Web Typography, Benjam talks about jQuery Methods and Mac, well, Mac is the playful one at the office so he chimes in with his April Fools joke [...]]]></description>
			<content:encoded><![CDATA[<p>This April Fools edition of Sharpening the Blades only has two serious articles and we&#8217;ll let you decide on the last one. Luke talks about the Future of Web Typography, Benjam talks about jQuery Methods and Mac, well, Mac is the playful one at the office so he chimes in with his April Fools joke for all you PHP gurus.</p>
<p><strong>Luke</strong>,<a href="http://www.smashingmagazine.com/2010/03/01/css-and-the-future-of-text/" target="_blank"> Future of Web Typography</a><img class="alignright size-full wp-image-581" style="border: 1px solid #444444; margin: 8px 0pt 0pt 20px; padding: 2px;" title="web-typography" src="http://dojo.codegreene.com/wp-content/uploads/2010/04/web-typography.jpg" alt="" width="100" height="100" /><br />
For years typography on the web has been very limited when compared to what can be in the print world. Over the last few years though we have been given more and more tools to help us accomplish good typography on the web. As time goes on these tools will get better and will become more widely supported. There was an article on Smashing Magazine this week that talked about a lot of these tools that are available to web designers. I really enjoyed reading up, refreshing my memory of code I haven&#8217;t used in a while, and also learning some new ways of styling type. Read it over, the text on your website will be very happy you did.</p>
<p><strong>Benjam,</strong> <a href="http://net.tutsplus.com/tutorials/javascript-ajax/20-helpful-jquery-methods-you-should-be-using/" target="_blank">20 Helpful jQuery Methods You Should Be Using</a><img class="alignright size-full wp-image-579" style="border: 1px solid #444444; margin: 8px 0pt 0px 20px; padding: 2px;" title="nettuts" src="http://dojo.codegreene.com/wp-content/uploads/2010/04/nettuts.jpg" alt="" width="100" height="100" /><br />
While developing a website, I use a lot of tools, both in the creation of the website files (my text editor of choice, file manager, etc.), and within the website itself (CakePHP, jQuery, CSS, etc.), and I&#8217;m always interested in finding features of those tools that I might not be very familiar with.  While I have a deep familiarity with the features I use regularly, and a passing familiarity with most of the features of these tools, it&#8217;s always good to get a refresher on what I could be using more.  Here is a post highlighting 20 jQuery methods/features (actually 33 methods in 20 groups) that should be in everybody&#8217;s familiarity tool box.</p>
<p>Mac, <a href="http://phpdeveloper.org/news/14281" target="_blank">April Fools &#8211; PHP Style</a><img class="alignright size-full wp-image-580" style="border: 1px solid #444444; margin: 8px 0pt 0pt 20px; padding: 2px;" title="phpdeveloper" src="http://dojo.codegreene.com/wp-content/uploads/2010/04/phpdeveloper.jpg" alt="" width="100" height="100" /><br />
This discusses a topic that we often only think about once or twice a year, but it is still worthy of our attention and deserves some practice to improve our skills. Also, while you are there, subscribe to the <a href="http://www.phpdeveloper.org/feed" target="_blank">PHP Developers feed</a>. The main guy, Chris Cornutt, does an excellent job of filtering the best PHP articles.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/sharpening-the-blades-future-of-web-typography-helpful-jquery-methods-april-fools-php-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The ‘nth-child’ Pseudo-selector</title>
		<link>http://dojo.codegreene.com/2010/the-%e2%80%98nth-child%e2%80%99-pseudo-selector/</link>
		<comments>http://dojo.codegreene.com/2010/the-%e2%80%98nth-child%e2%80%99-pseudo-selector/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 16:00:08 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=503</guid>
		<description><![CDATA[As Front End Web Devs CSS is our biggest tool. CSS itself keeps getting better and better. We need to keep up on our tool to use it to its fullest. I&#8217;d like to talk about a pseudo-selector tool that I have not used much that I would like to embrace in upcoming projects. I [...]]]></description>
			<content:encoded><![CDATA[<p>As Front End Web Devs CSS is our biggest tool. CSS itself keeps getting better and better. We need to keep up on our tool to use it to its fullest. I&#8217;d like to talk about a pseudo-selector tool that I have not used much that I would like to embrace in upcoming projects. I find that it will be really valuable to me. I think the Backend Devs will like it to because I won&#8217;t have to come bug them as much if I can make proper use of this selector. It is the nth-child selector.</p>
<p><img class="alignright size-full wp-image-534" src="http://dojo.codegreene.com/wp-content/uploads/2010/03/nth-child.png" alt="nth-child" width="252" height="208" /></p>
<p>Lets say that a client decided they would like the background of every other &lt;li&gt; tag to be darker than the rest. This &lt;li&gt; is created dynamically. In the past I would have to go contact a Back End Dev and have him write some code to put a class on every other &lt;li&gt;. Then I would go style those with the new class. With the use of the nth-child pseudo selector I can do this with the CSS alone. Here&#8217;s how:</p>
<p><code>ul li:nth-child(2n+1) { background:#212121; } </code></p>
<p>The expression 2n+1 will match the first, third, fifth, seventh, and so on, elements if they exist. 2n+1 isn&#8217;t the only expression you can run. Here is a list of a few possibilities:</p>
<ul>
<li>4n+1 would select the first, fifth, ninth, thirteenth&#8230;</li>
<li>4n would select fourth, eighth, twelfth, sixteenth&#8230;</li>
<li>-n+5 would select fifth, fourth, third, second, first, none</li>
</ul>
<p>If this isn&#8217;t making perfect sense yet just run the math loop in your head and it will. Lets take the first example again. 2n+1</p>
<ul>
<li>2*0+1=1</li>
<li>2*1+1=3</li>
<li>2*2+1=5</li>
<li>2*3+1=7</li>
</ul>
<p>Before we go out and use this everywhere I should point out that IE doesn&#8217;t support this in any of its versions. The saving point to this though is that <a href="http://www.jquery.com">jQuery</a> does support all CSS selectors so if you are using <a href="http://www.jquery.com">jQuery</a> you should be fine. For examples of how the nth-child works with jQuery see <a href="http://api.jquery.com/nth-child-selector/">this page</a>. Happy Coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/the-%e2%80%98nth-child%e2%80%99-pseudo-selector/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Well-known problems with undocumented solutions</title>
		<link>http://dojo.codegreene.com/2010/well-known-problems-with-undocumented-solutions/</link>
		<comments>http://dojo.codegreene.com/2010/well-known-problems-with-undocumented-solutions/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 16:23:02 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://dojo.codegreene.com/?p=551</guid>
		<description><![CDATA[I just spent about an hour banging my head on a brick wall with the apparently well known &#8220;Unable to create selectable TCP socket&#8221; problem, which manifests itself most notably with failing imap_open() calls from PHP. It is related to fd_setsize and a frequent limit of 1024 open files (or at least selectable open files). [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent about an hour banging my head on a brick wall with the apparently well known &#8220;Unable to create selectable TCP socket&#8221; problem, which manifests itself most notably with failing imap_open() calls from PHP. It is related to fd_setsize and a frequent limit of 1024 open files (or at least selectable open files). It is quite well documented that it is some kind of bug/shortcoming in the c-client libraries that underlie a lot of email-related stuff, particularly the UW suite of tools like uw-imap, pine, alpine, etc. as well as the IMAP extension in PHP. I love being able to go Google for answers and find a ton of related content. It is really annoying though when people have been talking about this bug for years, since at least early 2007, with very very few workable solutions posted, or even workarounds.</p>
<p>So, I&#8217;m going to do my part: I found a workaround that I think might work very well for a lot of people who run into this problem. It&#8217;s biggest advantage is that it is very very easy to try, and has almost no downside, even if it doesn&#8217;t work for your particular situation. In my case, I found that Apache did indeed have a lot of files open, including log files for all my VirtualHosts, all the libraries that httpd depends on, files from sites that are hosted there (though it seems to open and close those just fine), and a large buildup of hundreds of entries for /tmp that were open and apparently never got closed properly. In my case, the server in question has an uptime of over 2 years, and while &#8220;apachectl restart&#8221; runs at least daily for log rotation, it seems that doesn&#8217;t really close unused file descriptors. The workaround I discovered was running &#8220;apachectl stop&#8221; followed by &#8220;apachectl start&#8221; which fixed the problem completely for me, at least for the next year or two I hope. From over 1600 open files, after restarting Apache fully that way, it only reopened about 325 files. And the imap_open() calls started succeeding as they should.</p>
<p>One last thought before I hop off my soapbox: when you find an answer to a problem, and that answer was hard to find or was not well documented, do your part to remedy that for the next guy or girl to hit that problem, and post your solution somewhere that Google will find it. It makes the internet a better place for all of us, and makes us all more productive. Who knows, maybe down the road you&#8217;ll run into the same problem again yourself, and not remember how to solve it until you find your own post from years before, and it will be your own time you&#8217;ll save. I fully recognize that a lot of what I accomplish each day is based on work done by others that I have found and emulated, as they say, standing on the shoulders of giants. Each contribution to the body of human knowledge lets us reach that much higher, so when you can, add your bit and as we all do that, it adds up.</p>
]]></content:encoded>
			<wfw:commentRss>http://dojo.codegreene.com/2010/well-known-problems-with-undocumented-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

