<?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/" version="2.0">

<channel>
	<title>Michael Wales</title>
	
	<link>http://www.michaelwales.com</link>
	<description />
	<lastBuildDate>Mon, 13 Jul 2009 21:04:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</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" href="http://feeds.feedburner.com/MichaelWales" type="application/rss+xml" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">MichaelWales</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>CodeIgniter RefreshAugusta Presentation Video</title>
		<link>http://www.michaelwales.com/codeigniter/codeigniter-refreshaugusta-presentation-video</link>
		<comments>http://www.michaelwales.com/codeigniter/codeigniter-refreshaugusta-presentation-video#comments</comments>
		<pubDate>Tue, 26 May 2009 16:48:18 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=320</guid>
		<description><![CDATA[Chris Harrison has provided a video of my RefreshAugusta presentation, in which I presented an "Introduction to CodeIgniter." Please provide your criticisms, critiques, questions and comments within the comments of this post.]]></description>
			<content:encoded><![CDATA[<p>As promised, <a href="http://cdharrison.com/" title="Chris Harrison">Chris Harrison</a> has provided a video of my <a href="http://www.refreshaugusta.com/" title="RefreshAugusta">RefreshAugusta</a> presentation, in which I presented an &#8220;Introduction to CodeIgniter.&#8221; I&#8217;ve yet to watch it myself (no sound at this computer) but I look forward to everyone&#8217;s critiques!</p>
<p>Please, be brutally honest with me. I would like to continue these presentations and there is always room for improvement.</p>
<p><object width="504" height="290"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4847215&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4847215&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="504" height="290"></embed></object></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=dfe3dPU4uVQ:CCXFyF5n4QI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=dfe3dPU4uVQ:CCXFyF5n4QI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=dfe3dPU4uVQ:CCXFyF5n4QI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=dfe3dPU4uVQ:CCXFyF5n4QI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=dfe3dPU4uVQ:CCXFyF5n4QI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=dfe3dPU4uVQ:CCXFyF5n4QI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/codeigniter/codeigniter-refreshaugusta-presentation-video/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>RefreshAugusta Recap</title>
		<link>http://www.michaelwales.com/codeigniter/refreshaugusta-recap</link>
		<comments>http://www.michaelwales.com/codeigniter/refreshaugusta-recap#comments</comments>
		<pubDate>Thu, 21 May 2009 11:11:34 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=307</guid>
		<description><![CDATA[<img class="alignright" alt="RefreshAugusta" title="RefreshAugusta" src="http://refreshaugusta.com/wp-content/uploads/2008/12/banner_refreshaugusta_270x1.png" />This evening I presented an "Introduction to CodeIgniter" at the monthly RefreshAugusta meeting. The location was excellent and comfortable, the attendees were great to talk to and overall welcoming and Chris Harrison had free food and giveaway prizes, thanks to Powerserve and Adobe! I've included my slides from the presentation as well as the slide notes, which contain the majority of the content.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" alt="RefreshAugusta" title="RefreshAugusta" src="http://refreshaugusta.com/wp-content/uploads/2008/12/banner_refreshaugusta_270x1.png" />This evening I presented an &#8220;Introduction to CodeIgniter&#8221; at the monthly <a href="http://www.refreshaugusta.com/" title="RefreshAugusta">RefreshAugusta</a> meeting. <a href="http://www.thewellaugusta.org/" title="The Well">The location</a> was excellent and comfortable, the attendees were great to talk to and overall welcoming and <a href="http://cdharrison.com/" title="Chris Harrison">Chris Harrison</a> had free food and giveaway prizes, thanks to <a href="http://powerserve.net/" title="Powerserve">Powerserve</a> and <a href="http://www.adobe.com/" title="Adobe">Adobe</a>!</p>
<p>After some lighthearted chatter outside and a filling of Meat Lover&#8217;s pizza (also known as <em>the only pizza worthy of existence)</em>, the presentations started. <a href="http://www.mourfield.com/" title="Peter Mourfield">Peter Mourfield</a> kicked things off with a jQuery presentation that was pretty informative. Unfortunately, most of the crowd had a pretty good understanding of jQuery and this rendered the first portion of his presentation redundant. Peter recovered quickly and I enjoyed his &#8220;explain via slide, demonstrate in code&#8221; style.</p>
<p>When Peter was done it was my turn &#8211; this being my first public speaking event outside of <a href="http://en.wikipedia.org/wiki/Airman_Leadership_School" title="Wikipedia: Airman Leadership School">Airman Leadership School</a> I was a tad bit nervous, but the great crowd and atmosphere made things a lot easier (not to mention the couple cold ones I tossed back at <a href="http://davebonds.info/" title="Dave Bonds">Dave Bonds</a>&#8216; house prior).</p>
<p>Overall, the feedback I was receiving from the crowd during the presentation and afterward let me know I was doing a pretty damn good job up there. A lot of smiles or nodding heads and very few puzzled/confused looks &#8211; if I saw those I tried to expound on that off the top of my head and you could see the question mark turn into a lightbulb over their head pretty quickly (yes, like <em>The Sims</em>, this is how I see people in my daily life).</p>
<p>I received a lot of great questions afterward and almost everyone told me they were going to check out <a href="http://www.codeigniter.com/">CodeIgniter.com</a> or <a href="http://www.expressionengine.com/">ExpressionEngine.com</a> as soon as possible.</p>
<p>I&#8217;ve included my slides from the presentation (via <a href="http://www.slideshare.net/">SlideShare</a>). I fall within the &#8220;summarize on screen and explain verbally&#8221; crowd when it comes to presentations, so the meat and potatoes can be found within the slide notes (which I have conveniently placed below the presentation).</p>
<p><strong>Update:</strong> Video is <a href="http://www.michaelwales.com/codeigniter/codeigniter-refreshaugusta-presentation-video" title="Michael Wales: CodeIgniter RefreshAugusta Presentation Video">available</a>!<br />
Chris Harrison is working the video this week and I will make a separate post when that is available. <a href="http://www.oddzuki.com/" title="Kenny Adams">Kenny Adams</a> has already uploaded some <a href="http://www.flickr.com/photos/38323678@N02/" title="Flickr: RefreshAugusta (20 May 2009)">pictures of the event</a> as well.</p>
<div style="width:425px;text-align:left" id="__ss_1467565"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=reaugustamay-codeigniter-090520194132-phpapp02&#038;stripped_title=introduction-to-codeigniter-refreshaugusta-20-may-2009" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=reaugustamay-codeigniter-090520194132-phpapp02&#038;stripped_title=introduction-to-codeigniter-refreshaugusta-20-may-2009" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></div>
<p><strong>Slide 2</strong><br />
#1 Google result for &#8220;open source PHP framework&#8221;</p>
<p><strong>Slide 3</strong><br />
Free to download<br />
Can virtually do anything with framework<br />
- Can not create a commercial blogging application</p>
<p><strong>Slide 4</strong><br />
EE2 is built on top of the CodeIgniter framework</p>
<p><strong>Slide 5</strong><br />
EllisLab supports the company and it’s 11 employees off of ExpressionEngine primarily.<br />
CodeIgniter is the foundation of the new version of ExpressionEngine.<br />
EllisLab is committed to supporting the framework, it’s not a side project it is the core of their business.</p>
<p><strong>Slide 6</strong><br />
In 2001, Rick Ellis started work on a blogging engine for his clients.<br />
The first installation of pMachine was for Nancy Sinatra (Frank Sinatra’s daughter).</p>
<p><strong>Slide 7</strong><br />
In 2002, pMachine was released.<br />
Featured in Mac World and Mac Addict as well as a Blogging book published by McGraw/Hill.<br />
Rick Ellis starts developing software full-time.</p>
<p><strong>Slide 8</strong><br />
ExpressionEngine succeeds pMachine and is a more fully feature complete Content Management System.</p>
<p>ExpressionEngine sees great success within the designer market, on their personal blogs (Veerle Pieters, for instance).</p>
<p><strong>Slide 9</strong><br />
EllisLab pulls the core code out of ExpressionEngine and refactors into a framework.</p>
<p><strong>Slide 10</strong><br />
At SXSW ’08, EllisLab announces ExpressionEngine 2.</p>
<p>Derek Allard, Code Architect for EllisLab, announces that ExpressionEngine 2 will run on top of the CodeIgniter framework.</p>
<p>Full Circle: CodeIgniter was born from ExpressionEngine and now it is powering ExpressionEngine</p>
<p><strong>Slide 11</strong><br />
Benchmarking performed by AvnetLabs w/ eAccelerator opcode caching</p>
<p>10.5x faster than CakePHP, 2.9x faster than Zend Framework (similar configurations / similar functionality)</p>
<p>I’ve never seen a benchmark where CodeIgniter didn’t outperform all competitors</p>
<p><strong>Slide 12</strong><br />
Statistics dated Oct 08, from nexen.net</p>
<p>Shows about a 50/50 split between PHP4 and 5 support.</p>
<p>No doubt PHP5 has taken the lead by now, but many users still stuck on PHP4.</p>
<p>CodeIgniter utilizes PHP5 features/performance-enhancing functionality when present.</p>
<p><strong>Slide 13</strong><br />
MySQL is by far the most supported but could switch without the need to completely rewrite code.<br />
Supports MySQL, MS SQL, Oracle, PostgreSQL, SQLite and ODBC connectors.</p>
<p>ActiveRecord class allows you to think in PHP and generate SQL.</p>
<p><strong>Slide 14</strong><br />
Facebook, MySpace, Twitter and other social networks have seen the rise of a new form of worm.<br />
These worms are Javascript based, essentially the attacker enters code into a form that your site displays somewhere.<br />
This allows the malicious code to run from your domain essentially bypassing all of the domain-lock features Javascript has built-in.</p>
<p>At the flick of a boolean variable, CodeIgniter will automatically protect all of your form fields from XSS vulnerabilities.</p>
<p><strong>Slide 15</strong><br />
CodeIgniter automatically generates SEO friendly URLs</p>
<p>Of course, this is easily overidden: regular expression pattern matching to point to controller/method and pass variables</p>
<p><strong>Slide 16</strong><br />
Nearly every CodeIgniter library and helper can be overridden – allowing you to increase functionality.<br />
Examples: auto-discovery of partial views, auto-discovery of models, authentication by basing application classes off of my own controller class, which in turns extends the CodeIgniter Controller class</p>
<p><strong>Slide 17</strong><br />
Rasmus Lerdorf at fOScon 08.</p>
<p>He gave a presentation pretty much slamming all PHP frameworks. If he had to pick one, it would be CodeIgniter.</p>
<p><strong>Slide 18</strong><br />
The model represents our data – in this particular case we are returning data from a database.<br />
Could return data from anything – a Web API, an XML file, JSON, etc.</p>
<p><strong>Slide 19</strong><br />
All models extends CodeIgniter’s Model class and must call the parent class’ constructor from their own constructor.</p>
<p><strong>Slide 20</strong><br />
This function starts building our SQL query by creating the ORDER BY portion.</p>
<p>get() will run the query against the posts table, returning 10 results starting at row 0.<br />
We also have a get_where() method, that allows you to pass WHERE statements.<br />
get()  will return all columns, but a select() method is available to define columns if necessary.</p>
<p>We use the num_rows() method to return a result object or the FALSE boolean.</p>
<p><strong>Slide 21</strong><br />
The controller accepts and handles all user input (URLs, POST/GET requests, etc.)</p>
<p>Like the model, a controller extends the CI Controller class.<br />
Controllers must call their parent constructor from within their own constructor.</p>
<p>index() method is called by default, if a method is not defined in the URL.<br />
We load our post model, then call the get_all() method of that model.<br />
We then load a view, called home, and pass it our array of variables (in this case, only the posts).</p>
<p><strong>Slide 22</strong><br />
Like the model, a controller extends the CI Controller class.<br />
Controllers must call their parent constructor from within their own constructor.</p>
<p><strong>Slide 23</strong><br />
index() method is called by default, if a method is not defined in the URL.<br />
We load our post model, then call the get_all() method of that model.<br />
We then load a view, called home, and pass it our array of variables (in this case, only the posts).</p>
<p><strong>Slide 24</strong><br />
The view is simply an HTML file with PHP inter-mixed.<br />
Logic should be kept to a bare minimum – just echo data in the view.<br />
Templating engines can be used and CI even has a Template Parsing class (why would you want to add more processing time)?<br />
Notice the lack of the $data variable – within a view, CodeIgniter brings all $data keys (or child objects) up to top-level variables.</p>
<p>Normally, we would check for a FALSE value before looping and show a “No Posts” message – lack of space on screen here.</p>
<p><strong>Slide 25</strong><br />
Loop through each of the results returned from our database call (which happened in the model).</p>
<p><strong>Slide 26</strong><br />
Echo out the title of the post, title was one of the fields within our posts table.</p>
<p><strong>Slide 27</strong><br />
Echo out the excerpt of the post, once again a field within our table.</p>
<p><strong>Slide 28</strong><br />
Use a CodeIgniter helper to generate a link to read the entire post.<br />
First parameter is the URI segments, second is text of the link, third is an optional array of HTML attributes.<br />
Slug was a field within our database – CodeIgniter has a helper to autocreate slugs from text.</p>
<p>Would use URI routing to process this request and send it to Controller/Method</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=vrxLNtXR6YA:k1rp0lN5xdI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=vrxLNtXR6YA:k1rp0lN5xdI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=vrxLNtXR6YA:k1rp0lN5xdI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=vrxLNtXR6YA:k1rp0lN5xdI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=vrxLNtXR6YA:k1rp0lN5xdI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=vrxLNtXR6YA:k1rp0lN5xdI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/codeigniter/refreshaugusta-recap/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CodeIgniter Convention Over Configuration</title>
		<link>http://www.michaelwales.com/codeigniter/codeigniter-convention-over-configuration</link>
		<comments>http://www.michaelwales.com/codeigniter/codeigniter-convention-over-configuration#comments</comments>
		<pubDate>Sun, 26 Apr 2009 20:20:11 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=300</guid>
		<description><![CDATA[If you've ever worked with <a href="http://www.rubyonrails.org/" title="Ruby on Rails">Ruby on Rails</a> you are no doubt a fan of it's convention over configuration policy. By simply naming files in a specific manner, the framework will take care of the loading for you - saving you a line of code within your application. We'll implement some of this functionality in our own CodeIgniter applications.]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever worked with <a href="http://www.rubyonrails.org/" title="Ruby on Rails">Ruby on Rails</a> you are no doubt a fan of it&#8217;s convention over configuration policy. By simply naming files in a specific manner, the framework will take care of the loading for you &#8211; saving you a line of code within your application.</p>
<p>Typically, in all of my <a href="http://www.codeigniter.com/" title="CodeIgniter">CodeIgniter</a> applications I implement a master view file that takes care of common code throughout all views. That master view file will then load a partial view file, based on the controller/method that is being requested. My partials always follow a specific naming convention: <samp>views/[controller]/[method].php</samp> &#8211; so it will be very easy for us to implement auto-loading of these partials.</p>
<p>Additionally, I follow another strict naming convention in my CodeIgniter applications, that I picked up from Ruby on Rails. Controllers are always pluralized nouns, models are named the singular version of that noun. This strict naming convention affords us the opportunity to once again auto-load a controller&#8217;s specific model.</p>
<p>There are a number of ways to tackle this problem, most notably hooks and hierarchical inheritance. I&#8217;ll be using the latter method in this example, since it provides a clear &#8220;breadcrumb&#8221; for others to follow as they review our application&#8217;s code. Typically, hooks are a bit more magical and don&#8217;t quite jump out at someone unfamiliar with the application and the framework it rests on.</p>
<p>We&#8217;re going to create our own Controller class called <samp>MY_Controller.php</samp>. This will enable CodeIgniter&#8217;s autoloading of extended libraries. We&#8217;ll then base all of our application&#8217;s classes off of <samp>MY_Controller</samp>.</p>
<script type="text/javascript" src="http://gist.github.com/102147.js"></script>
<p>We&#8217;re using CodeIgniter&#8217;s Router class to get the controller and method that is currently being called. This is a foolproof way of gathering this information, since it will remain correct regardless of any <a href="http://codeigniter.com/user_guide/general/routing.html" title="CodeIgniter User Guide: URI Routing">custom routing</a> we may implement later on.</p>
<p>You&#8217;ll also see that we are defining a default partial of <samp>debug/echo</samp> &#8211; this will create a quick way to debug our application, in case a partial view file hasn&#8217;t been created yet.</p>
<p>Now we&#8217;ll create our application&#8217;s controller &#8211; I&#8217;ll be using a <samp>Users</samp> controller, since it&#8217;s something many applications implement.</p>
<script type="text/javascript" src="http://gist.github.com/102154.js"></script>
<p>We&#8217;re loading a view file named <samp>layout</samp> so let&#8217;s go ahead and create that view file (the PHP comment at the beginning is unnecessary &#8211; it&#8217;s just there to show the filename).</p>
<script type="text/javascript" src="http://gist.github.com/102156.js"></script>
<p>Finally, we&#8217;ll create the partial view file for our for our debug view and controller/method.</p>
<script type="text/javascript" src="http://gist.github.com/102158.js"></script>
<p>Now if you make a request for the <samp>Users</samp> controller you will see that our partial view is loaded correctly. If you make a request for the <samp>no_partial</samp> method of the <samp>Users</samp> controller, you should see a display of the CodeIgniter Superglobal obejct &#8211; this is because we have not created a <samp>views/users/no_partial.php</samp> view file.</p>
<p>Go ahead and create the appropriate model (<samp>models/user.php</samp>) and test out the autoloading of the model &#8211; it should work perfectly!</p>
<p>There is one downfall to this method (and it wouldn&#8217;t be <em>that</em> hard to fix) &#8211; you may come across some irregular plurals for your controller names (a model of <samp>mouse</samp> would have a controller of <samp>mouses</samp>). Implementing a correct reverse pluralization algorithm within the <samp>_get_model()</samp> method could solve this problem or you could just use custom routes to hide the improper grammar from your users (mapping <samp>mice</samp> to the <samp>mouses</samp> controller).</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=CaOoTKFe5Nc:P939OlF71GQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=CaOoTKFe5Nc:P939OlF71GQ:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=CaOoTKFe5Nc:P939OlF71GQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=CaOoTKFe5Nc:P939OlF71GQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=CaOoTKFe5Nc:P939OlF71GQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=CaOoTKFe5Nc:P939OlF71GQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/codeigniter/codeigniter-convention-over-configuration/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>RSS Feed Fixed</title>
		<link>http://www.michaelwales.com/blog-news/rss-feed-fixed</link>
		<comments>http://www.michaelwales.com/blog-news/rss-feed-fixed#comments</comments>
		<pubDate>Mon, 20 Apr 2009 19:24:31 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[Blog News]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=295</guid>
		<description><![CDATA[Just a quick post to thank the good folks on Twitter for letting me know my feed was all sorts of screwed up. I made a real quick attempt of fixing the feed and transferring it to my Google account (since Feedburner was acquired by Google) but it was all in vain.
I&#8217;ve decided to just [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to thank the good folks on <a href="http://www.twitter.com/" title="Twitter">Twitter</a> for letting me know my feed was all sorts of screwed up. I made a real quick attempt of fixing the feed and transferring it to my Google account (since Feedburner was acquired by Google) but it was all in vain.</p>
<p>I&#8217;ve decided to just roll with the default Wordpress RSS feed, since I am not really using any of Feedburner&#8217;s features anyways. So, update your readers to use the following URL please: <a href="http://www.michaelwales.com/feed" title="RSS Feed">http://www.michaelwales.com/feed</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=BTYGVHQNWqU:5ZEYiTnWK3c:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=BTYGVHQNWqU:5ZEYiTnWK3c:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=BTYGVHQNWqU:5ZEYiTnWK3c:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=BTYGVHQNWqU:5ZEYiTnWK3c:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=BTYGVHQNWqU:5ZEYiTnWK3c:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=BTYGVHQNWqU:5ZEYiTnWK3c:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/blog-news/rss-feed-fixed/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter Presentation at Refresh Augusta</title>
		<link>http://www.michaelwales.com/codeigniter/codeigniter-presentation-at-refresh-augusta</link>
		<comments>http://www.michaelwales.com/codeigniter/codeigniter-presentation-at-refresh-augusta#comments</comments>
		<pubDate>Thu, 09 Apr 2009 02:05:18 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=283</guid>
		<description><![CDATA[I have been asked to make a presentation on CodeIgniter at the May Refresh Augusta meeting. So, what would you like to see in a CodeIgniter presentation? The reAugusta attendees aren't new to the web development world, so I am leaning away from the "Why should I use a framework and why should it be CodeIgniter" approach - I am thinking something more along the lines of "Why CodeIgniter is Perfect for the New or Returning PHP Developer."]]></description>
			<content:encoded><![CDATA[<p>Before moving to Augusta, GA, I spent a lot of time on <a href="http://twitter.com/" title="Twitter">Twitter</a> &#8211; talking with others that live in the area. One of the first, and coolest, people I met was <a href="http://cdharrison.com/" title="Chris Harrison" rel="met friend colleague">Chris Harrison</a> &#8211; who just so happens to oversee <a href="http://refreshaugusta.com/" title="Refresh Augusta">Refresh Augusta</a>. reAugusta is a small group of people dedicated to &#8220;promoting design, technology, usability, and standards  to refresh the creative, technical, and professional culture of New Media endeavors in and around Augusta, Georgia.&#8221;</p>
<p><strong>Definitely something I could get involved with.</strong></p>
<p>Today, Chris asked if I would like to make a presentation on <a href="http://www.codeigniter.com" title="CodeIgniter">CodeIgniter</a> at the May meeting. What an honor! As the CodeIgniter Community Chieftain how could I possibly turn down this opportunity to evangelize the benefits of our beloved framework.</p>
<p>So, what would you like to see in a CodeIgniter presentation? The reAugusta attendees aren&#8217;t new to the web development world, so I am leaning away from the &#8220;Why should I use a framework and why should it be CodeIgniter&#8221; approach &#8211; I am thinking something more along the lines of &#8220;Why CodeIgniter is Perfect for the New or Returning PHP Developer.&#8221;</p>
<p>Your thoughts?</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=IJB8n6zNLwY:-fByicaxnHw:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=IJB8n6zNLwY:-fByicaxnHw:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=IJB8n6zNLwY:-fByicaxnHw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=IJB8n6zNLwY:-fByicaxnHw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=IJB8n6zNLwY:-fByicaxnHw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=IJB8n6zNLwY:-fByicaxnHw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/codeigniter/codeigniter-presentation-at-refresh-augusta/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing Ruby on Rails on Windows Vista</title>
		<link>http://www.michaelwales.com/ruby-on-rails/installing-ruby-on-rails-on-windows-vista</link>
		<comments>http://www.michaelwales.com/ruby-on-rails/installing-ruby-on-rails-on-windows-vista#comments</comments>
		<pubDate>Fri, 06 Feb 2009 20:29:43 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=273</guid>
		<description><![CDATA[Due to version inconsistencies, installing Ruby on Rails for Windows can be a bit tricky - especially if you are following tutorials meant for other operating systems (or a Windows tutorial that hasn't been updated). In this tutorial, I'll walk you through how to install Ruby, upgrade it to the latest Windows release, and install Ruby on Rails with full SQLite support.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rubyonrails.org/" title="Ruby on Rails">Ruby on Rails</a> has taken the web development community by storm. To be honest, even though I&#8217;m a PHP developer I find <abbr title="Ruby on Rails">RoR</abbr> to be an amazingly fun experience.</p>
<p>Unfortunately, getting <abbr title="Ruby on Rails">RoR</abbr> up and running on Windows isn&#8217;t the simplest of tasks. Version inconsistencies between gem packages (namely, <samp>sqlite3-ruby</samp>) can turn away the most diehard nerds.</p>
<p>After two tries, a few uninstallations, and more than a few beers, I finally figured it out! It was pretty simple once I got all the steps down and in the right order. In the spirit of sharing (and just getting the right information out there, in case I ever need it again), the following is a step-by-step tutorial on how to install Ruby on Rails for Windows Vista. In theory, this should work on Windows XP just as well but I have not had the opportunity to test that.</p>
<h4>The Software</h4>
<p>We&#8217;ll be installing the following software to complete our Ruby on Rails development environment:</p>
<ul>
<li>Ruby 1.8.7</li>
<li>Ruby on Rails 2.2</li>
<li>SQLite 3.6.10</li>
</ul>
<h4>Installing Ruby 1.8.7</h4>
<p>Installing Ruby is a pretty trivial task, thanks to the one-click installer. Unfortunately, that installer is only available for Ruby 1.8.6, and we want the latest and greatest! Nonetheless, it&#8217;s pretty simple to upgrade that 1.8.6 installation to 1.8.7.</p>
<p>Go ahead and download the <a href="http://rubyforge.org/frs/download.php/29263/ruby186-26.exe" title="Ruby 1.8.6 One-Click Installer">Ruby 1.8.6 one-click installer</a> as well as the <a href="ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.7-i386-mswin32.zip">Ruby 1.8.7 Windows Binaries</a>. Run through the one-click installer, using the default location of <samp>C:\ruby</samp> as the installation location.</p>
<p>The one-click installer should add the Ruby path to your <samp>PATH</samp> environment variable &#8211; if it doesn&#8217;t you can do this within the Advanced System Settings control panel. To get to this panel, go to <samp>Control Panel &gt; System</samp>, click <samp>Advanced System Settings</samp>, click the <samp>Environment Variables</samp> button near the bottom of the window, and prepend <samp>C:\ruby\bin;</samp> to the existing <samp>PATH</samp> variable. You can also do this through the command line: <samp>setx path &#8220;C:\ruby\bin;%PATH%&#8221;</samp>.</p>
<p>Now, to confirm that Ruby is installed and your environment variable is setup correctly, open the command line and type <samp>ruby &#45;&#45;version</samp>. It should tell you that you are running version 1.8.6.</p>
<p>To upgrade your installation of Ruby to 1.8.7, extract the Ruby 1.8.7 Windows Binaries you downloaded and move the included files into your <samp>C:\ruby\bin</samp> directory &#8211; overwriting files of the same name. Once again, if you run <samp>ruby &#45;&#45;version</samp> from the command line you should now be told you are running version 1.8.7.</p>
<h4>Installing Ruby on Rails</h4>
<p>We can use the RubyGems package manager to install Ruby on Rails. The first thing we want to do is make sure we have the latest version of the gem repository. From the command line enter <samp>gem update &#45;&#45;system</samp> to perform an update.</p>
<p>Installing Ruby on Rails is just as simple. <samp>gem install rails</samp> will pull down everything you need. Finally, we&#8217;ll want to install the Mongrel server, <samp>gem install mongrel</samp> from the command line will take care of that.</p>
<h4>Installing SQLite</h4>
<p>The first thing we need to do is download the SQLite binaries and place them in a location that is within our <samp>PATH</samp> environment variable. We just added <samp>C:\ruby\bin</samp> to that variable, but personally I like to place utilities like this in a directory just for independent applications. I created a directory at <samp>C:\Users\[_USERNAME_]\bin</samp> (of course, replace the <samp>[_USERNAME_]</samp> portion of that with your actual username) and then I added this location to the <samp>PATH</samp> environment variable.</p>
<p>Download the SQLite binaries from the <a href="http://www.sqlite.org/download.html" title="SQLite">SQLite website</a> and extract them into this new <samp>bin</samp> directory. I believe you only need the <a href="http://www.sqlite.org/sqlite-3_6_10.zip" title="SQLite 3.6.10">sqlite-3_6_10.zip</a> file but to be perfectly honest, I just downloaded them all and placed them within my <samp>bin</samp> directory.</p>
<p>Finally, we need to download a gem package that provides methods for Ruby to communicate with our SQLite databases. This is the part that usually catches people when setting up <abbr title="Ruby on Rails">RoR</abbr> for Windows, as the latest version of this package does not support Windows. We&#8217;ll need to download and install an older version of the package. From the command line, enter <samp>gem install &#45;&#45;version 1.2.3 sqlite3-ruby</samp> to download and install the latest version of sqlite3-ruby that does support Windows.</p>
<h4>Testing</h4>
<p>That&#8217;s all there is to it! To make sure everything worked properly, move to a clean development area within your command line (I like to use <samp>D:\rails</samp>, since my <samp>D:\</samp> partition is my development area). Run the following commands to build a test application and start the Mongrel server for this application:<br />
<samp>rails test</samp><br />
<samp>cd test</samp><br />
<samp>ruby script/server</samp></p>
<p>After a small delay you will see that the server is now running at <samp>http://127.0.0.1:3000/</samp> and if you visit that URL you will be presented with the <em>Welcome to Ruby</em> screen. Be sure to click the link for more details on your development environment and ensure no errors are displayed in this area.</p>
<p>You&#8217;re now ready to hop on the bandwagon and get your Ruby on Rails on!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=gVQ2rIHja7c:KVTe7Y4ad68:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=gVQ2rIHja7c:KVTe7Y4ad68:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=gVQ2rIHja7c:KVTe7Y4ad68:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=gVQ2rIHja7c:KVTe7Y4ad68:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=gVQ2rIHja7c:KVTe7Y4ad68:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=gVQ2rIHja7c:KVTe7Y4ad68:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/ruby-on-rails/installing-ruby-on-rails-on-windows-vista/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>6 Tips on Moving Cross-Country with Twitter</title>
		<link>http://www.michaelwales.com/startups/6-tips-on-moving-cross-country-with-twitter</link>
		<comments>http://www.michaelwales.com/startups/6-tips-on-moving-cross-country-with-twitter#comments</comments>
		<pubDate>Thu, 05 Feb 2009 19:47:08 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[Startups]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=256</guid>
		<description><![CDATA[<a href="http://www.twitter.com/" title="Twitter">Twitter</a> is an extremely useful communication tool that can serve a wide variety of purposes. I have used it extensively in my daily life and even found some great uses for it in planning my family's move cross-country. Here are 6 quick tips to make your next move much less stressful!]]></description>
			<content:encoded><![CDATA[<p>We all know the virtues of <a href="http://www.twitter.com/" title="Twitter">Twitter</a>. The ability to yell into a room with hundreds of thousands of people, where everyone can hear you equally and a few hundred take an active roll in listening to what you have to say, is immensely powerful.</p>
<p>The impact Twitter has made on my family&#8217;s upcoming move to Grovetown, GA, is immeasurable. It would have taken much more time to plan, been a lot more stressful, and I wouldn&#8217;t feel near as confident in the decisions we have made leading up to this move. Here are just a few ways I used Twitter to make the most out of our move:</p>
<h4>1. Find Friends</h4>
<p><img src="http://www.michaelwales.com/wp-content/uploads/2009/02/cake.png" alt="Find Friends" title="Find Friends" class="right" />Since much of the rest of this list relies on people living in the area in which you are moving to, the most important step is to <strong>find friends</strong>. Twitter makes it easy for you to search for people based on their location &#8211; remember to use city names, zip codes, and counties as well (since Twitter allows you to enter anything you like in the location field).</p>
<p>I&#8217;ve followed a few dozen people from the Grovetown/Augusta area and talk to 3-4 of them on a daily basis! These are people I share common interests with, enjoy the conversations we have, and would be perfectly comfortable inviting them into my home for our first face-to-face introductions.</p>
<p>Not knowing anyone in your new hometown can be a pretty daunting and fearful realization. By making friends, and starting a relationship, with a small group of people prior to your move you are starting out ahead of the game! If I get lost, need to know of a good restaurant, need help fixing/moving/unpacking &#8211; I already have the resources to get those issues resolved, through the network of friends I have already made. Plus, friends lead to more friends! People already in your new home&#8217;s area are sure to have other locals that they follow on Twitter &#8211; scour their timelines and watch for people they @reply to.</p>
<h4>2. Find a Realtor</h4>
<p><img src="http://www.michaelwales.com/wp-content/uploads/2009/02/house.png" alt="Find a Realtor" title="Find a Realtor" class="right" />One of the most stressful aspects of moving is finding a place to live &#8211; whether you will be renting or moving. A realtor in the Augusta area is a very active Twitter user and came across my name in one of my friend&#8217;s tweets (I was actually asking people for realtor recommendations).</p>
<p>Although we didn&#8217;t use this realtor to find our home (we&#8217;re renting, and the home owner is represented by someone else), she proved to be a invaluable source of information about the local area. <strong>Realtors have a deep knowledge of the local neighborhoods</strong> and are the perfect place to start when you are trying to determine which neighborhood to move into. Based on your priorities (school quality, commute time to work, distance to public parks, shopping, etc.), a realtor can narrow your home search from thousands of houses down to a more manageable 5-6.</p>
<h4>3. Selecting a House</h4>
<p><img src="http://www.michaelwales.com/wp-content/uploads/2009/02/search.png" alt="Selecting a House" title="Selecting a House" class="right" />In addition to finding a realtor, your Twitter friends can help in selecting a house. Your friends can act as a completely <strong>impartial third-party</strong> during the selection process and have no reason not to share their &#8220;gut instinct&#8221; about a property.</p>
<p>Ask if any of your friends live near, or drive by, the home you are looking at on a regular basis. If so, they usually won&#8217;t have a problem in scoping it out for you and making you aware of any issues they see. Plus, your friends will be able to tell you things you just can&#8217;t see within pictures (&#8221;there&#8217;s a sewage plant nearby, stinks all the time,&#8221; for instance).</p>
<h4>4. Finding Utility Providers</h4>
<p><img src="http://www.michaelwales.com/wp-content/uploads/2009/02/internet.png" alt="Finding Utility Providers" title="Finding Utility Providers" class="right" />You Twitter friends purchase their electricity and Internet from someone (chances are cable/satellite TV and natural gas as well). <strong>Ask them who they recommend</strong>!</p>
<p>Consumers are passionate about what they spend money on &#8211; especially in these trying economic times. We&#8217;re simply not going to spend money where we don&#8217;t see a valuable service. Follow your friends lead! More often than not, the majority of your friends will be using the same company and after a quick comparison and a few more questions you&#8217;ll know why (because they are cheaper, because their competitor&#8217;s service is horrible, because there is no other option).</p>
<h4>5. Planning Your Route</h4>
<p><img src="http://www.michaelwales.com/wp-content/uploads/2009/02/map.png" alt="Planning Your Route" title="Planning Your Route" class="right" />The quickest route from Vandenberg AFB, CA, to Grovetown, GA, is I-40; but, that&#8217;s not the route we are taking. Ask your Twitter friends what their recommendations are and let them know your priorities (fastest route, scenic route, tourist attractions, etc.). <strong>No one knows the roads like the locals</strong> and they can warn you about congested times, construction, detours, and attractions on your route.</p>
<p>In our case, we wanted a quick route without any major obstacles and we wanted to stay overnight at military installations (security and affordability). We opted to drive down to I-10 (to avoid snow in the Rocky Mountains), catch I-20 in Texas and follow it all the way to our new home (<a href="http://maps.google.com/maps?f=d&#038;source=s_d&#038;saddr=Vandenberg+AFB,+California&#038;daddr=March+AFB,+California+to:Luke+AFB,+Glendale,+AZ+to:Fort+Bliss,+Texas+to:Abilene,+TX+to:Barksdale+AFB+to:Birmingham,+AL+to:Grovetown,+GA&#038;hl=en&#038;geocode=%3B%3B%3B%3B%3BCdc7p7EUE4LUFZLr7wEdlGBs-iFOR_w3hHFKOA%3B%3B&#038;mra=pe&#038;mrcr=4,5&#038;sll=33.28462,-101.381836&#038;sspn=27.140921,39.375&#038;safe=on&#038;ie=UTF8&#038;ll=33.109948,-85.957031&#038;spn=6.834701,9.84375&#038;t=h&#038;z=7" title="Google Map of Wales' Family Trip">Google Map of route</a>). This meets all of our needs and only two of our seven stops will be in non-military hotels.</p>
<h4>6. Places to Stay</h4>
<p><img src="http://www.michaelwales.com/wp-content/uploads/2009/02/night.png" alt="Places to Stay" title="Places to Stay" class="right" />Two of our stops are not on military installations so we&#8217;ll need to reserve hotel accomodations for those nights. <strong>What better way to get a recommendation than on Twitter</strong>! Ask your friends, and others that live near the city you are stopping in, what they recommend. Send them a link to a Google map showing the route you will be taking (from the previous stop to the next stop), and you are sure to get some feedback.</p>
<p>In our case, we wanted comfortable hotels, in the low-medium price range, close to our route, and preferably offered a continental breakfast (which opens up more &#8220;fun&#8221; money for that day&#8217;s travel). Within minutes, the La Quinta Inns in Abilene, TX, and Birmingham, AL, were recommended and after a bit of research we reserved rooms (and the price wasn&#8217;t bad either, just a few dollars above comparable military reservations).</p>
<p>Depending on your relationship with your Twitter friends you may even be able to pass out on someone&#8217;s couch for the night &#8211; free of charge!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=L6jETwd3NDM:UaX0aRz3CzU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=L6jETwd3NDM:UaX0aRz3CzU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=L6jETwd3NDM:UaX0aRz3CzU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=L6jETwd3NDM:UaX0aRz3CzU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=L6jETwd3NDM:UaX0aRz3CzU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=L6jETwd3NDM:UaX0aRz3CzU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/startups/6-tips-on-moving-cross-country-with-twitter/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Wordpress Shortcode: Gist</title>
		<link>http://www.michaelwales.com/wordpress/wordpress-shortcode-gist</link>
		<comments>http://www.michaelwales.com/wordpress/wordpress-shortcode-gist#comments</comments>
		<pubDate>Tue, 03 Feb 2009 17:22:37 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=246</guid>
		<description><![CDATA[Wordpress shortcodes, introduced in Wordpress 2.5, allow you to define your own <abbr title="Bulletin Board Code">BBCode</abbr> language for your theme. Smashing Magazine has an excellent article, with plenty of examples, on <a href="http://www.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/" title="Smashing Magazine: Mastering Wordpress Shortcodes">how to use and create your own shortcodes</a>. In this article, I share my Wordpress shortcode for displaying <a href="http://gist.github.com/" title="Gist">Gist</a> code snippets.]]></description>
			<content:encoded><![CDATA[<p>Wordpress shortcodes, introduced in Wordpress 2.5, allow you to define your own <abbr title="Bulletin Board Code">BBCode</abbr> language for your theme. Smashing Magazine has an excellent article, with plenty of examples, on <a href="http://www.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/" title="Smashing Magazine: Mastering Wordpress Shortcodes">how to use and create your own shortcodes</a>.</p>
<p>I use <em>a lot</em> of code samples on this blog and I have found <a href="http://gist.github.com/" title="Gist">GitHub&#8217;s Gist</a> to be an invaluable tool for doing so. It&#8217;s essentially a Pastie, where each of your Gist&#8217;s becomes its own Git repository (plus there are all kinds of other great tools as well).</p>
<p>Unfortunately, using Gist&#8217;s embed code generates invalid xHTML (as it doesn&#8217;t include the <samp>type</samp> parameter for the <samp>script</samp> tag). Of course, I could go through each Gist and manually add <samp>type=&#8221;text/javascript&#8221;</samp> to each of them, but what a pain in the ass.</p>
<p>So, I whipped up my own Gist shortcode that allows me to simply use <samp>[ gist id="1234" ]</samp> (minus the spaces inside the brackets) in my blog posts. When Wordpress finds a shortcode in a post, it sends it to a function, and outputs the returned value of that function.</p>
<p>To add the Gist shortcode to your own Wordpress blog, just copy-paste the following code into your theme&#8217;s <samp>functions.php</samp> (if your theme doesn&#8217;t include a <samp>functions.php</samp> just make one). Yes, this Gist is being displayed via the shortcode.</p>
<script type="text/javascript" src="http://gist.github.com/57620.js"></script>
<p>This code is pretty simple to understand. The Wordpress function <samp>add_shortcode</samp> will map the first parameter (the tag within your posts) to the second parameter (the actual function name) &#8211; in this example, they are both <samp>gist</samp>.</p>
<p>Within the function itself, we call <samp>extract(shortcode_atts())</samp> which allows us to pull our shortcode&#8217;s attributes into their own local variables. Additionally, <samp>shortcode_atts()</samp> allows you to pass an array of default values as the first parameter (in case the shortcode within the post doesn&#8217;t include them). Finally, we test to make sure our <samp>$id !== NULL</samp> (meaning, the user did in fact include an ID) &#8211; if all is well, return an xHTML valid <samp>script</samp> tag which will Wordpress will then echo out, rather than our shortcode.</p>
<p>Now, I know those of you that read my blog via the <abbr title="Really Simply Syndication">RSS</abbr> feed aren&#8217;t seeing these Gists &#8211; I&#8217;m not ignoring that! I&#8217;m working up a solution that will cURL Gist and return the raw formatted code when the <abbr title="Really Simply Syndication">RSS</abbr> feed is viewed (although this may force me to leave FeedBurner and return to the standard Wordpress feed). I&#8217;m still weighing all of my options here &#8211; for now, you&#8217;ll just have to hit the domain to see the code samples.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=PCi9iKCI0r4:eqxjspoTj2A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=PCi9iKCI0r4:eqxjspoTj2A:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=PCi9iKCI0r4:eqxjspoTj2A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=PCi9iKCI0r4:eqxjspoTj2A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=PCi9iKCI0r4:eqxjspoTj2A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=PCi9iKCI0r4:eqxjspoTj2A:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/wordpress/wordpress-shortcode-gist/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pessimistic Coding</title>
		<link>http://www.michaelwales.com/codeigniter/pessimistic-coding</link>
		<comments>http://www.michaelwales.com/codeigniter/pessimistic-coding#comments</comments>
		<pubDate>Sat, 31 Jan 2009 09:53:06 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=225</guid>
		<description><![CDATA[Pessimstic development helps to ensure your applications will only respond to those situations in which it knows it can respond successfully, as well as assist you in the graceful degradation of times when a user is not behaving as expected. In this article, I provide a glowing example of pessimistic development.]]></description>
			<content:encoded><![CDATA[<p>It is fairly common for new developers to get on a &#8220;one track mind.&#8221; For example, when trying to return a user&#8217;s profile, a new developer may think:</p>
<ol>
<li>The user will enter a username.</li>
<li>Query the database for the username.</li>
<li>Display the results.</li>
</ol>
<p>Unfortunately, this is usually not the case &#8211; and is a key identifier between an entry level developer and a senior developer. Senior developers always assume the worst case scenario &#8211; a senior developer&#8217;s thought pattern is as follows:</p>
<ol>
<li>The user will enter something.</li>
<li>Make sure the user&#8217;s input is the appropriate datatype.</li>
<li>Make sure the user&#8217;s input is actually a username.
<ol>
<li>If so, display the user&#8217;s profile.</li>
<li>If not, degrade gracefully and tell the user what went wrong.</li>
</ol>
</li>
</ol>
<p>Let&#8217;s take the following code, for example, which has been developed within the open source PHP framework, <a href="http://www.codeigniter.com/" title="CodeIgniter">CodeIgniter</a>:</p>
<p><samp>/controllers/users.php</samp><br />
<br />
<script type="text/javascript" src="http://gist.github.com/55497.js"></script></p>
<p><samp>/models/user.php</samp><br />
<script type="text/javascript" src="http://gist.github.com/55501.js"></script></p>
<p><samp>/views/users/profile.php</samp><br />
<script type="text/javascript" src="http://gist.github.com/55503.js"></script></p>
<p>This is a glowing example of pessimistic development. There are numerous layers of, &#8220;the user is going to mess up&#8221; within this code example.</p>
<ol>
<li>This code is valid in PHP4 and 5 &#8211; we&#8217;re not assuming our user is going to make use of a particular version.</li>
<li>We&#8217;ve defined a default parameter value within our controller. If the browsing user of the site screws up, our model will return <samp>FALSE</samp> and we will show them an appropriate error message.</li>
<li>We&#8217;ve defined a default parameter value within our model. If the controller&#8217;s developer screws up, our model will return <samp>FALSE</samp> and we will show them an appropriate error message.</li>
<li>We&#8217;re checking to see if the user actually exists (<samp>if ($query->num_rows() === 1) {</samp>). If not, we will return <samp>FALSE</samp> and we will show them an appropriate error message.</li>
<li>We&#8217;re assuming the user will enter something completely crazy in our URI, but we typecast it into a string to ensure our database handles the input correctly.</li>
<li>We&#8217;re assuming the user, or the developer, will mess up by strictly limiting a successful return value to negative control statements (<samp>if ($username !== FALSE) {</samp>). By using pessimistic control statements, we ensure that the user (whether they be a developer or the browser user) must meet our <em>exact</em> intended parameters to receive useful data in return.</li>
</ol>
<p>By following a pessimistic coding pattern, you will ensure that your application performs as intended each and every time &#8211; regardless of developer and browser user error. This will also force you to consider graceful degradation and useful error messages, that lead the user to achieve the results they originally intended.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=V0RB2HCsc90:_dDM0rdHzI8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=V0RB2HCsc90:_dDM0rdHzI8:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=V0RB2HCsc90:_dDM0rdHzI8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=V0RB2HCsc90:_dDM0rdHzI8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=V0RB2HCsc90:_dDM0rdHzI8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=V0RB2HCsc90:_dDM0rdHzI8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/codeigniter/pessimistic-coding/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New Site Theme</title>
		<link>http://www.michaelwales.com/blog-news/new-site-theme</link>
		<comments>http://www.michaelwales.com/blog-news/new-site-theme#comments</comments>
		<pubDate>Wed, 28 Jan 2009 07:32:41 +0000</pubDate>
		<dc:creator>Michael Wales</dc:creator>
				<category><![CDATA[Blog News]]></category>

		<guid isPermaLink="false">http://www.michaelwales.com/?p=197</guid>
		<description><![CDATA[If you visit my domain, rather than view through the RSS feed, you will see a drastic change in the design of this site. Many things are currently broken (particularly image floating and code samples) but I will fix those throughout the coming days.]]></description>
			<content:encoded><![CDATA[<p>If you visit my domain, rather than view through the <a href="http://feeds.feedburner.com/mwales" title="RSS Entries"><abbr>RSS</abbr> feed</a>, you will see a drastic change in the design of this site. Many things are currently broken (particularly image floating and code samples) but I will fix those throughout the coming days.</p>
<p>As I was looking to redesign the site I really only had two requirements: 1) a wide content area, to fit plenty of code samples; and 2) a sidebar, to link throughout the domain. I found the perfect theme at <a href="http://themeforest.net?ref=walesmd" title="ThemeForest">ThemeForest.net</a> and purchased it and activated it.</p>
<p>As always, any concerns you may have, bug reports, etc. I will definitely take into consideration. Either leave a comment here or (more effective) send me a message on Twitter, <a href="http://www.twitter.com/walesmd" title="Twitter: walesmd">@walesmd</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/MichaelWales?a=1IaA7achGDg:77d19xJlD-Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=1IaA7achGDg:77d19xJlD-Y:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=1IaA7achGDg:77d19xJlD-Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=1IaA7achGDg:77d19xJlD-Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/MichaelWales?i=1IaA7achGDg:77d19xJlD-Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/MichaelWales?a=1IaA7achGDg:77d19xJlD-Y:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/MichaelWales?d=7Q72WNTAKBA" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.michaelwales.com/blog-news/new-site-theme/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
