
<?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>Code, Nerdyness, and Nonsense &#187; Nerdyness</title>
	<atom:link href="http://brandontreb.com/category/nerdyness/feed/" rel="self" type="application/rss+xml" />
	<link>http://brandontreb.com</link>
	<description>Code, Nerdyness, and Nonsense</description>
	<lastBuildDate>Thu, 11 Mar 2010 00:30:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress Plugin Development: Your First Plugin</title>
		<link>http://brandontreb.com/wordpress-plugin-development-your-first-plugin/</link>
		<comments>http://brandontreb.com/wordpress-plugin-development-your-first-plugin/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 00:30:33 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress filters]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wordpress plugin programming]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=778</guid>
		<description><![CDATA[<p>In this tutorial, I will show you the basics of creating a simple Wordpress plugin.  After completing it, you will have the knowledge to expand upon it and create your own Wordpress plugins.</p>


]]></description>
			<content:encoded><![CDATA[<h4>Introduction</h4>
<p>Creating plugins for Wordpress seems like a daunting task at first, but the process is actually quite simple.  Wordpress&#8217; APIs are very elegant and make plugin development a breeze.</p>
<p>The documentation for writing a plugin can be found <a href="http://codex.wordpress.org/Writing_a_Plugin">here</a>.  Make sure you bookmark it as you will be referring to the documentation quite a bit as you require more functionality.</p>
<h4>Wordpress Actions And Filters</h4>
<p>When we talk about creating a plugin for Wordpress, it usually refers to extending the functionality.  This could be something as simple as replacing all of the colon-parens with smilies or as complex as doing complete SEO optimization.  Whatever you want to create, chances are you will have to hook into a Wordpress Action or Filter.</p>
<p>Wordpress Filters are called any time there is data. They are essentially a chain of functions that will be called in order to work on the data in some way.  For example, when Wordpress displays the content of your post, rather than it saying &lt;?php echo $content; ?&gt;, it calls the function &lt;?php the_content(); ?&gt;.  Calling this function will invoke the chain of functions to be applied to the content.</p>
<p>To hook a function into this chain, you will use the add_filter function of Wordpress.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'myFunc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> myFunc<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #666666; font-style: italic;">// Do Something to the content</span>
   <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the code above our function called myFunc will be called every time the content is displayed in a Wordpress post.  I will be explaining the is more detail later in this post.</p>
<p>With the knowlege of actions and filters behind you, you are ready to write your first plugin.</p>
<h4>Setting Up</h4>
<p>The plugin we will be creating is a Word Filter plugin. It could be useful on a blog with multiple authors as a swear word filter.  We will be replace all of the &#8220;naughty words&#8221;, which we define with a substitue.</p>
<p>The first thing you want to do is FTP into your Worpdress site and create the plugin folder.  The location of the folder should be as follows.</p>
<p><strong>/wp-content/plugins/word_filter</strong></p>
<p>Note that any time you create a plugin, it must go inside of the Wordpress plugins folder.</p>
<p>Now create a file of the same name in this folder (word_filter.php). This will be the file that will hold all of our plugin code.  Just to reiterate, you should now have a file at this path:</p>
<p><strong>/wp-content/plugins/word_filter/word_filter.php</strong></p>
<p>Now we are ready to begin editing the file&#8230;</p>
<h4>Adding the Meta Information</h4>
<p>In order to identify your plugin (and give you credit for it), you must add the following information to the top of your plugin file.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
Plugin Name: Word Filter
Plugin URI: http://brandontreb.com/
Description: This plugin filters out certain words in a post.  Could be used as a swear word filter or just a global find and replace.
Version: 1.0
Author: Brandon Trebitowski
Author URI: http://brandontreb.com
*/</span></pre></div></div>

<p>All of this meta information will be used to identify the plugin.  When the user goes to activate it, all of this info will be displayed in their admin panel.  It will look something like this:</p>
<p><a href="http://brandontreb.com/wp-content/uploads/2010/03/Screen-shot-2010-03-10-at-9.46.09-AM.png"><img src="http://brandontreb.com/wp-content/uploads/2010/03/Screen-shot-2010-03-10-at-9.46.09-AM-500x31.png" alt="" title="Screen shot 2010-03-10 at 9.46.09 AM" width="500" height="31" class="alignleft size-medium wp-image-790" /></a></p>
<p>Coding time&#8230;</p>
<h4>Writing the Code</h4>
<p>The first bit of code for our word filter is the array of words to be replaced.  We will be using associative arrays where the key will be the words we are searching for and the values will be their replacements.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Array of replacements</span>
<span style="color: #000088;">$search_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'idiot'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'nice person'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'shutup'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'please be quite'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'hate'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'love'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you can see, the word &#8216;idiot&#8217; will be replaced with the words &#8216;nice person&#8217;, etc&#8230;  You could do any amount of replacement here.</p>
<p>The next step is to write our function that will do the replacing.  We will call this function word_filter.  One thing you need to be aware of is the function must take exactly one argument.  This is because we will be hooking into the the_content filter of Wordpress.  When our function gets called by the system, it will pass in the post content for every post that gets displayed. Here is what the function will look like.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> word_filter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$search_array</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Modify the content</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$search_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$find</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$find</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #339933;">,</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Return the content</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Pretty simple ehh? We loop over the $search_array and retrieve its keys and values.  We then substitue the $find string with the $replace string in the post $content.  Finally, we RETURN THE CONTENT.  I emphasized that because it is very important.  Since you are running this function in a chain of others, you must return the content so that the next function can process it.  If you don&#8217;t the chain is broken and your posts won&#8217;t contain any content.</p>
<p>The last thing that must be done is we must hook into the the_content filter of Wordpress.  Again, this is how we get our function added to the chain.  To do this, simply add the following line.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Make sure our fn gets called before displaying the content</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'word_filter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is just one of the many <a href="http://codex.wordpress.org/Plugin_API">Filters</a> that you are able to hook in to.</p>
<h4>Putting it all together</h4>
<p>When reading tutorial, I generally like to see the final source code in once place.  So, here it is in all of it&#8217;s (very simple) glory.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
Plugin Name: Word Filter
Plugin URI: http://brandontreb.com/
Description: This plugin filters out certain words in a post.  Could be used as a swear word filter or just a global find and replace.
Version: 1.0
Author: Brandon Trebitowski
Author URI: http://brandontreb.com
*/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Array of replacements</span>
<span style="color: #000088;">$search_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'idiot'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'nice person'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'shutup'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'please be quite'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'hate'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'love'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Make sure our fn gets called before displaying the content</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'word_filter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> word_filter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$search_array</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Modify the content</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$search_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$find</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$find</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #339933;">,</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Return the content</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>*Note: I omitted the php wrapper tags because they were causing problems in the output. Make sure you add them back in.</p>
<p>There you have it! Your first Wordpress plugin.  In a later tutorial I will show you how to create an admin panel that will allow users to configure all of the search and replace words.</p>
<p>If you have any comments or questions, feel free to leave them in the comments section of this post.</p>
<p>You may also download the source for this example <a href='http://brandontreb.com/wp-content/uploads/2010/03/word_filter.zip'>here</a>.</p>
<p>Happy WPCoding!</p>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/wordpress-plugin-development-your-first-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Emacs For OSX Is Out!</title>
		<link>http://brandontreb.com/emacs-for-osx-is-out/</link>
		<comments>http://brandontreb.com/emacs-for-osx-is-out/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:44:29 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Nerdyness]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[emacs mac]]></category>
		<category><![CDATA[emacs osx]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=768</guid>
		<description><![CDATA[<p style="text-align: left;"><a href="http://emacsformacosx.com/"><img class="size-medium wp-image-769 alignnone" title="Screen shot 2010-01-29 at 2.39.44 PM" src="http://brandontreb.com/wp-content/uploads/2010/01/Screen-shot-2010-01-29-at-2.39.44-PM-500x498.png" alt="" width="500" height="498" /></a></p>
<p style="text-align: center;">For all you Vi using, Emacs haters out there, I will fight you!</p>]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://emacsformacosx.com/"><img class="size-medium wp-image-769 alignnone" title="Screen shot 2010-01-29 at 2.39.44 PM" src="http://brandontreb.com/wp-content/uploads/2010/01/Screen-shot-2010-01-29-at-2.39.44-PM-500x498.png" alt="" width="500" height="498" /></a></p>
<p style="text-align: center;">For all you Vi using, Emacs haters out there, I will fight you!</p>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/emacs-for-osx-is-out/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s A Good Day To Be A Software Developer</title>
		<link>http://brandontreb.com/its-a-good-day-to-be-a-software-developer/</link>
		<comments>http://brandontreb.com/its-a-good-day-to-be-a-software-developer/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 17:23:38 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Nerdyness]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Software developer]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=749</guid>
		<description><![CDATA[<p style="text-align: center;"><img class="size-medium wp-image-752 alignnone" title="Computer-Programmer" src="http://brandontreb.com/wp-content/uploads/2010/01/Computer-Programmer-490x500.gif" alt="" width="294" height="300" /></p>
I was just reading this article posted on CNET news <a href="http://news.cnet.com/8301-13505_3-10440254-16.html?tag=newsLatestHeadlinesArea.0">Apple's tablet: It's all about developers</a> and thought to myself, it's a great day to be a software developer.  This quote from the article got me exceptionally excited.
<blockquote>"Never have developers mattered more. As Apple readies its tablet announcement party for later Wednesday morning, the big question remaining is whether developers will join, or whether they'll join <a class="zem_slink" title="Android" rel="homepage" href="http://code.google.com/android/">Google's Android</a> and Chrome initiatives."</blockquote>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-medium wp-image-752 alignnone" title="Computer-Programmer" src="http://brandontreb.com/wp-content/uploads/2010/01/Computer-Programmer-490x500.gif" alt="" width="294" height="300" /></p>
<p>I was just reading this article posted on CNET news <a href="http://news.cnet.com/8301-13505_3-10440254-16.html?tag=newsLatestHeadlinesArea.0">Apple&#8217;s tablet: It&#8217;s all about developers</a> and thought to myself, it&#8217;s a great day to be a software developer.  This quote from the article got me exceptionally excited.</p>
<blockquote><p>&#8220;Never have developers mattered more. As Apple readies its tablet announcement party for later Wednesday morning, the big question remaining is whether developers will join, or whether they&#8217;ll join <a class="zem_slink" title="Android" rel="homepage" href="http://code.google.com/android/">Google&#8217;s Android</a> and Chrome initiatives.&#8221;</p></blockquote>
<p>With the release of all of these new devices, developers have just gotten much more marketable.  It&#8217;s amazing how our worth skyrockets with every new Apple, Google, or Microsoft event.  Never before have software developers had so many opportunities to be successful.</p>
<p>There are now over 100K applications in the <a class="zem_slink" title="App Store" rel="homepage" href="http://www.apple.com/iphone/appstore/">iTunes App Store</a> with over half of them being paid.  That means, Apple is making money for upwards of 50,000 software developers!</p>
<p>I for one, love being a software developer and am very excited for what the future holds for us.</p>
<div class="zemanta-pixie" style="clear: both; margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/ff060ac5-6aff-4cba-86d7-7f9d50d6ea3a/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=ff060ac5-6aff-4cba-86d7-7f9d50d6ea3a" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/its-a-good-day-to-be-a-software-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watch Out Apple, The Kindle Dev Kit Is Almost Live</title>
		<link>http://brandontreb.com/watch-out-apple-the-kindle-dev-kit-is-almost-live/</link>
		<comments>http://brandontreb.com/watch-out-apple-the-kindle-dev-kit-is-almost-live/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 18:53:36 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Nerdyness]]></category>
		<category><![CDATA[Nonsense]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Amazon.com]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Game Boy]]></category>
		<category><![CDATA[kindle]]></category>
		<category><![CDATA[kindle api]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=739</guid>
		<description><![CDATA[<p style="text-align: center;"><a href="http://brandontreb.com/wp-content/uploads/2010/01/kindel-dev-gameboy.png"><img class="size-medium wp-image-743 aligncenter" title="kindel-dev-gameboy" src="http://brandontreb.com/wp-content/uploads/2010/01/kindel-dev-gameboy-500x333.png" alt="" width="500" height="333" /></a></p>
With the success of the Apple App Store, it seems that everyone is wanting  a piece of the pie.

Amazon is now looking to throw their hat into the ring and is releasing their own dev kit for their ever so popular Kindle.

<a href="http://www.amazon.com/gp/feature.html/?ie=UTF8&#38;docId=1000476231">http://www.amazon.com/gp/feature.html/?ie=UTF8&#38;docId=1000476231</a>

It appears that big name game developers Electronic Arts is also getting involved (WTH?!?!)

This just seems like it will be an epic fail.  Who really wants to play video games on their Kindle?  Maybe they can port <a href="http://brandontreb.com/code-monkey-music-video/">Kirby's Dreamland</a> from the original Game Boy :) .]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://brandontreb.com/wp-content/uploads/2010/01/kindel-dev-gameboy.png"><img class="size-medium wp-image-743 aligncenter" title="kindel-dev-gameboy" src="http://brandontreb.com/wp-content/uploads/2010/01/kindel-dev-gameboy-500x333.png" alt="" width="500" height="333" /></a></p>
<p>With the success of the <a class="zem_slink" title="App Store" rel="homepage" href="http://www.apple.com/iphone/appstore/">Apple App Store</a>, it seems that everyone is wanting  a piece of the pie.</p>
<p>Amazon is now looking to throw their hat into the ring and is releasing their own dev kit for their ever so popular Kindle.</p>
<p><a href="http://www.amazon.com/gp/feature.html/?ie=UTF8&amp;docId=1000476231">http://www.amazon.com/gp/feature.html/?ie=UTF8&amp;docId=1000476231</a></p>
<p>It appears that big name game developers Electronic Arts is also getting involved (WTH?!?!)</p>
<p>This just seems like it will be an epic fail.  Who really wants to play video games on their Kindle?  Maybe they can port <a href="http://brandontreb.com/code-monkey-music-video/">Kirby&#8217;s Dreamland</a> from the original Game Boy <img src='http://brandontreb.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://gizmodo.com/5453395/amazon-opens-kindle-up-for-development-app-store-ahoy">Amazon Opens Kindle Up for Development: App Store Ahoy [Kindle]</a> (gizmodo.com)</li>
<li class="zemanta-article-ul-li"><a href="http://news.cnet.com/8301-13577_3-10438661-36.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20">Amazon: Kindle app store on the way</a> (news.cnet.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/f48c6302-1cf7-4b20-aa9c-3b2147192e8f/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=f48c6302-1cf7-4b20-aa9c-3b2147192e8f" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/watch-out-apple-the-kindle-dev-kit-is-almost-live/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Code Monkey Music Video</title>
		<link>http://brandontreb.com/code-monkey-music-video/</link>
		<comments>http://brandontreb.com/code-monkey-music-video/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 22:45:52 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Nerdyness]]></category>
		<category><![CDATA[code monkey]]></category>
		<category><![CDATA[cube farm]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=736</guid>
		<description><![CDATA[Watching this video makes me appreciate the fact that I work from home.

<center>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/qYodWEKCuGg&#38;hl=en_US&#38;fs=1&#38;rel=0&#38;color1=0x006699&#38;color2=0x54abd6" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/qYodWEKCuGg&#38;hl=en_US&#38;fs=1&#38;rel=0&#38;color1=0x006699&#38;color2=0x54abd6" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</center>]]></description>
			<content:encoded><![CDATA[<p>Watching this video makes me appreciate the fact that I work from home.</p>
<p><center><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/qYodWEKCuGg&amp;hl=en_US&amp;fs=1&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/qYodWEKCuGg&amp;hl=en_US&amp;fs=1&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6" allowscriptaccess="always" allowfullscreen="true"></embed></object><br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/code-monkey-music-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XCode Shortcut</title>
		<link>http://brandontreb.com/xcode-shortcut/</link>
		<comments>http://brandontreb.com/xcode-shortcut/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 17:07:21 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[MacBook Pro]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[xcode]]></category>
		<category><![CDATA[xcode shortcuts]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=689</guid>
		<description><![CDATA[When in XCode on a <a class="zem_slink" title="MacBook" rel="wikipedia" href="http://en.wikipedia.org/wiki/MacBook">MacBook</a> Pro, doing a 3-finger swipe up will switch between the .h and .m files.

<strong>⌘-option-up will do the same thing</strong>

Productivity++
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/d1495139-6d75-42c2-bf27-46298f91b9e4/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=d1495139-6d75-42c2-bf27-46298f91b9e4" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>]]></description>
			<content:encoded><![CDATA[<p>When in XCode on a MacBook Pro, doing a 3-finger swipe up will switch between the .h and .m files.</p>
<p><strong>⌘-option-up will do the same thing</strong></p>
<p>Productivity++</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/d1495139-6d75-42c2-bf27-46298f91b9e4/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=d1495139-6d75-42c2-bf27-46298f91b9e4" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/xcode-shortcut/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programming Tip Of The Day #2 &#8211; Difference Between i++ and ++i</title>
		<link>http://brandontreb.com/programming-tip-of-the-day-2-difference-between-i-and-i/</link>
		<comments>http://brandontreb.com/programming-tip-of-the-day-2-difference-between-i-and-i/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 01:00:20 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Programming Tip Of The Day]]></category>
		<category><![CDATA[decremental operator]]></category>
		<category><![CDATA[i++]]></category>
		<category><![CDATA[incremental operator]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=677</guid>
		<description><![CDATA[Ok, so this should seem obvious and if I am insulting your intelligence by stating it, I am sorry.  One of the main reasons I want to discuss this is, I was asked this exact question in a job interview for Lockheed Martin.]]></description>
			<content:encoded><![CDATA[<p>To some, this should seem a bit obvious and if I am insulting your intelligence by discussing it, I am sorry.  But, one of the main reasons I want to discuss this topic is, I was asked this question in a job interview for Lockheed Martin.</p>
<p><b>What is the difference between i++ and ++i?</b></p>
<p>The answer is actually quite simple.</p>
<h3><span style="color: #00ccff;">i++</span> first evaluates the value of i and then increments it</h3>
<h3><span style="color: #00ccff;">++i</span> increments the value of i and then evaluates it</h3>
<p>Here is a brief example to demonstrate what I mean.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Example: i++ </span>
<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The value of i is &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Output &quot;The value of i is 5&quot;</span>
<span style="color: #666666; font-style: italic;">// i = 6</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Example: ++i </span>
<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The value of i is &quot;</span> <span style="color: #339933;">.</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Output &quot;The value of i is 6&quot;</span>
<span style="color: #666666; font-style: italic;">// i = 6</span></pre></div></div>

<p>So, now if you are ever asked about this in an interview, you will have a response.</p>
<p>Happy programming!</p>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/programming-tip-of-the-day-2-difference-between-i-and-i/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Programming Tip Of The Day #1 &#8211; Ternary Operator</title>
		<link>http://brandontreb.com/programming-tip-of-the-day-1-ternary-operator/</link>
		<comments>http://brandontreb.com/programming-tip-of-the-day-1-ternary-operator/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 00:30:48 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Programming Tip Of The Day]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[programming tip of the day]]></category>
		<category><![CDATA[programming tips]]></category>
		<category><![CDATA[ptotd]]></category>
		<category><![CDATA[ternary]]></category>
		<category><![CDATA[ternary operator]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=667</guid>
		<description><![CDATA[<p>So, I though I'd start this series called Programming Tip Of The Day to write about useful things I come across in programming.  Both to educate my readers and as a personal archive of ideas and tips.</p>

<p>I will kick it off today with a quick rant about the <strong>ternary operator</strong>.  I &#60;3 the ternary operator.  It's quick, efficient and saves a lot of ugly code.</p>]]></description>
			<content:encoded><![CDATA[<p>So, I though I&#8217;d start this series called Programming Tip Of The Day to write about useful things I come across in programming.  Both to educate my readers and as a personal archive of ideas and tips.</p>
<p>I will kick it off today with a quick rant about the <strong>ternary operator</strong>.  I &lt;3 the ternary operator.  It&#8217;s quick, efficient and saves a lot of ugly code.</p>
<p>For those of you who don&#8217;t know, the ternary operator is made up of 3 elements: The condition and two results.  It is of the form:</p>
<h2>(condition) ? (result if true) : (result if false);</h2>
<p>This is much nicer than an if statement.  So here is a brief example about how a ternary operator can replace an if-statement.</p>
<h3>if-statement</h3>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>isSnowing<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	iMustBe <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;cold&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	iMustBe <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;warm&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Same thing using ternary</h3>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">iMustBe <span style="color: #339933;">=</span> isSnowing <span style="color: #339933;">?</span> <span style="color: #ff0000;">&quot;cold&quot;</span> <span style="color: #339933;">:</span> <span style="color: #ff0000;">&quot;warm&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That is so much easier to read (IMHO).  You can even do clever things in printing.  Here is a small example in PHP for using the ternary operator when doing an echo.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;I am a &quot;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>height <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">72</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">&quot;tall&quot;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;short&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; person!&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Most languages support the ternary operator.  Check out <a href="http://en.wikipedia.org/wiki/Ternary_operation">this wiki page</a> if you want more info.</p>
<p>Happy programming!</p>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/programming-tip-of-the-day-1-ternary-operator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mac OSX Tip: Hotkey To Hide/Show the Dock</title>
		<link>http://brandontreb.com/mac-osx-tip-hotkey-to-hideshow-the-dock/</link>
		<comments>http://brandontreb.com/mac-osx-tip-hotkey-to-hideshow-the-dock/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 19:38:53 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Nerdyness]]></category>
		<category><![CDATA[dock]]></category>
		<category><![CDATA[hotkey]]></category>
		<category><![CDATA[mac hotkey]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=662</guid>
		<description><![CDATA[While mashing the keyboard (as I often do when debuggin poorly written outsourced code), I stumbled upon a very useful OSX hotkey.
<h2>⌘-option-d</h2>
This command will cause the Dock to go in and out of auto-hide mode.

Not the most useful, but very helpful to geeks like me who rearrange their desktop every day.]]></description>
			<content:encoded><![CDATA[<p>While mashing the keyboard (as I often do when debuggin poorly written outsourced code), I stumbled upon a very useful OSX hotkey.</p>
<h2>⌘-option-d</h2>
<p>This command will cause the Dock to go in and out of auto-hide mode.</p>
<p>Not the most useful, but very helpful to geeks like me who rearrange their desktop every day.</p>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/mac-osx-tip-hotkey-to-hideshow-the-dock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increase Your Twitter Following Using Your Wordpress Blog</title>
		<link>http://brandontreb.com/increase-your-twitter-following-using-your-wordpress-blog/</link>
		<comments>http://brandontreb.com/increase-your-twitter-following-using-your-wordpress-blog/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 15:00:57 +0000</pubDate>
		<dc:creator>brandontreb</dc:creator>
				<category><![CDATA[Nerdyness]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[followers]]></category>
		<category><![CDATA[popular]]></category>
		<category><![CDATA[twitlebrity]]></category>
		<category><![CDATA[twitpop]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://brandontreb.com/?p=655</guid>
		<description><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 22px; margin-left: 0px; clear: left; font-size: 13px; padding: 0px;"><a href="http://brandontreb.com/wp-content/uploads/2009/11/twitter64.png"><img class="size-full wp-image-656 alignnone" title="twitter_bird" src="http://brandontreb.com/wp-content/uploads/2009/11/twitter64.png" alt="twitter_bird" width="562" height="352" /></a></p>
TwitPop is a Wordpress plugin I wrote with one goal...To make you more popular on Twitter. There are sites that spring up from time to time claiming to get you more followers on Twitter if you follow X amount of people on the follow train. Well, now you can create your own Twitter train on your wordpress blog and really get more followers.]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 22px; margin-left: 0px; clear: left; font-size: 13px; padding: 0px;"><a href="http://brandontreb.com/wp-content/uploads/2009/11/twitter64.png"><img class="size-full wp-image-656 alignnone" title="twitter_bird" src="http://brandontreb.com/wp-content/uploads/2009/11/twitter64.png" alt="twitter_bird" width="562" height="352" /></a></p>
<p><a href="http://downloads.wordpress.org/plugin/twitpop.zip">Download TwitPop Now</a></p>
<p>TwitPop is a Wordpress plugin I wrote with one goal&#8230;To make you more popular on Twitter. There are sites that spring up from time to time claiming to get you more followers on Twitter if you follow X amount of people on the follow train. Well, now you can create your own Twitter train on your wordpress blog and really get more followers.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 22px; margin-left: 0px; clear: left; font-size: 13px; padding: 0px;">The best part is, you add your username in the admin panel and EVERYONE FOLLOWS YOU! Think of the possibilities&#8230; You could be a Twitlebrity.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 22px; margin-left: 0px; clear: left; font-size: 13px; padding: 0px;">To add to the excitement, everyone that uses your TwitPop plugin will Tweet a link back to your blog. This promotes your blog as well as your Twitter account. Check out how TwitPop works below.</p>
<p><strong>Instructions</strong></p>
<p>Log in to your Twitter account below.  You will automatically follow the people that have visited this page before you (no more than 20).</p>
<p>Then, your Twitter username will be added to the list and you will be followed by the next 20 people to use this plugin.</p>
<p><a name="twitpop">&nbsp;</a>
		<div id="twitpop">
		<fieldset class="message success" style="display:none;">
			<img src="http://brandontreb.com/wp-content/plugins/twitpop/images/success-icon.png" width="50" height="50">
			<p></p>
		</fieldset>
		<fieldset class="message error" style="display:none;">
			<img src="http://brandontreb.com/wp-content/plugins/twitpop/images/warning-icon.png" width="50" height="50">
			<p></p>
		</fieldset>
		<fieldset class="login">
			<legend>Twitter Login Information</legend>
			<form name="twitpop_form" id="twitpop_form" method="POST" action="#twitpop">
			<div>
				<label for="username">Twitter Username:</label> <input type="text" id="username" name="twitpop_username">
			</div>
			<div>
				<label for="password">Twttier Password:</label> <input type="password" id="password" name="twitpop_password">
			</div>
			<div><label for="password">&nbsp;</label><a href="#" onClick="document.twitpop_form.submit();return false;" class="btn blue"><i></i><span><span></span><i></i>Submit</span></a></div><br />
			</form>
			<p id="powered">Powered by <a href="http://brandontreb.com/twitpop">TwitPop</a></p>
		</fieldset>
	</div>
	</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 22px; margin-left: 0px; clear: left; font-size: 13px; padding: 0px;"><a href="http://downloads.wordpress.org/plugin/twitpop.zip">Download TwitPop Now</a></p>
]]></content:encoded>
			<wfw:commentRss>http://brandontreb.com/increase-your-twitter-following-using-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
