<?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>Ryan Kanno: The diary of an Enginerd in Hawaii&#187; HowTo</title>
	<atom:link href="http://blog.localkinegrinds.com/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.localkinegrinds.com</link>
	<description>Everything you&#039;ve ever thought, but never had the balls to say.</description>
	<lastBuildDate>Sat, 03 Sep 2011 13:19:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>For the Horde &#8211; DIY World of Warcraft Brownies</title>
		<link>http://blog.localkinegrinds.com/2010/08/05/for-the-horde-diy-world-of-warcraft-brownies/</link>
		<comments>http://blog.localkinegrinds.com/2010/08/05/for-the-horde-diy-world-of-warcraft-brownies/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 17:54:17 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/?p=404</guid>
		<description><![CDATA[For the Horde &#8211; DIY World of Warcraft Brownies I noes I haven&#8217;t updated my blog in a few months more than a year, but I&#8217;ve been busy working at a small, local news startup. Since one of my New Year&#8217;s resolutions was to be a more diligent blogger, I thought I would start this [...]]]></description>
			<content:encoded><![CDATA[<h2>For the Horde &#8211; DIY World of Warcraft Brownies</h2>
<p>I noes I haven&#8217;t updated my blog in <del datetime="2010-01-15T02:55:15+00:00">a few months</del> more than a year, but I&#8217;ve been busy working at a small, <a href="http://www.civilbeat.com">local news startup</a>.  Since one of my New Year&#8217;s resolutions was to be a more diligent blogger, I thought I would start this year off with a *whiz-bang*, non-technical post!</p>
<p>(I guess it&#8217;s pretty ironic that I&#8217;m posting this in <del datetime="2010-07-01T02:24:02+00:00">January</del> August, huh? <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
<p>Last December, I was invited to a Christmas Party.  Not your standard-fare holiday party, mind you, but a &#8220;World of Warcraft Guild&#8221; Christmas Party. Wanting to bring something unique to the potluck, I ended up making &#8220;For The Horde Brownies&#8221;&#8230; and this is a blog detailing the experience.</p>
<h3>&#8250;&#8250; Setup</h3>
<ul>
<li>Your favorite brownie mix/recipe</li>
<li>Powdered sugar</li>
<li>Print out of the <a href='http://blog.localkinegrinds.com/wp-content/uploads/2010/08/for_the_horde.pdf'>For the Horde pdf</a></li>
<li>X-Acto knife (or scissors)</li>
</ul>
<h3>&#8250;&#8250; Baking the brownies</h3>
<p>I&#8217;ll be the first to admit that I&#8217;m no baker.  While there are those that profess it as their passion, I see it purely as a means to an end.  With that said, you can use &lt;insert your favorite brownie mix here&gt; to make the brownies or if you&#8217;re feeling exceptionally adventurous, maybe use <a href="http://coffeetea.about.com/od/miscchocolate/r/chocbrownie.htm">one</a> of these <a href="http://www.recipegirl.com/2010/02/01/deep-dark-brownies-2/">recipes</a>.  Whatever your poison, just make sure it appears edible &#8211; enough to trick your guests with; kind of like this.</p>
<p><a href="http://farm5.static.flickr.com/4068/4277348635_3f1182e650.jpg" title="Your favorite brownie mix" rel="lightbox"><img alt="Your favorite brownie mix" src="http://farm5.static.flickr.com/4068/4277348635_3f1182e650_m.jpg" class="thumb" style="float: left; "></a></p>
<p><a href="http://farm5.static.flickr.com/4054/4278095010_be616f499f.jpg" title="The magical concoction!" rel="lightbox"><img alt="The magical concoction!" src="http://farm5.static.flickr.com/4054/4278095010_be616f499f_m.jpg" class="thumb" style="float: left; "></a></p>
<p><a href="http://farm5.static.flickr.com/4032/4277348763_b6dd064d42.jpg" title="Pulling the wool over sheep's eyes" rel="lightbox"><img alt="Pulling the wool over sheep's eyes" src="http://farm5.static.flickr.com/4032/4277348763_b6dd064d42_m.jpg" class="thumb" style="float: left;"></a></p>
<div style="clear:both;">&nbsp;</div>
<h3>&#8250;&#8250; Preparing the Horde symbol</h3>
<p>While baking your magical brownies, print out the <a href='http://blog.localkinegrinds.com/wp-content/uploads/2010/08/for_the_horde.pdf'>enclosed Horde pdf</a>.  You&#8217;ll want to make a few copies to practice your X-Acto skills on.  Of course, if your scissor-fu is amazing, feel free to wield those instead.  (It took me two tries with the X-Acto to get it just right).  After you&#8217;ve finished removing the Horde symbol, it should resemble the following:</p>
<p><a href="http://farm3.static.flickr.com/2756/4278095122_9035e6f154.jpg" title="Horde symbol" rel="lightbox"><img alt="Horde symbol" src="http://farm3.static.flickr.com/2756/4278095122_9035e6f154_m.jpg" style="float: left; " class="thumb"></a></p>
<p><a href="http://farm3.static.flickr.com/2771/4277348879_21c5c71c9e.jpg" title="Horde symbol cutout" rel="lightbox"><img alt="Horde symbol cutout" src="http://farm3.static.flickr.com/2771/4277348879_21c5c71c9e_m.jpg" style="float: left; " class="thumb"></a></p>
<div style="clear:both;">&nbsp;</div>
<h3>&#8250;&#8250; For the Horde!</h3>
<p>After you have a cut out of the Horde symbol, you can use the powdered sugar to apply the symbol to your brownies.  If you mess up, like I did, fret not.  </p>
<div class="bold info">Pro-tip: if the powdered sugar goes awol, use some water to dissolve the sugar and clean up the edges.</div>
<p><a href="http://farm5.static.flickr.com/4070/4278095224_9e72201d4d.jpg" title="Practice Run" rel="lightbox"><img alt="Practice Run" src="http://farm5.static.flickr.com/4070/4278095224_9e72201d4d_m.jpg" style="float: left;" class="thumb"></a></p>
<p><a href="http://farm3.static.flickr.com/2695/4278095290_0f9f603b82.jpg" title="Applying the symbol" rel="lightbox"><img alt="Applying the symbol" src="http://farm3.static.flickr.com/2695/4278095290_0f9f603b82_m.jpg" style="float: left;" class="thumb"></a></p>
<div style="clear:both;">&nbsp;</div>
<p><strong>Your final product should end up looking something like the following:</strong></p>
<p><a href="http://farm5.static.flickr.com/4011/4278095328_9525d6c343.jpg" title="For the Horde" rel="lightbox"><img alt="For the Horde" src="http://farm5.static.flickr.com/4011/4278095328_9525d6c343_m.jpg" style="float: left; " class="thumb"></a></p>
<div style="clear:both;">&nbsp;</div>
<h2>Voila!</h2>
<h3>&#8250;&#8250; Credits</h3>
<p>As usual, I must give props where props are due.</p>
<h4>People I owe a soul to</h4>
<ul>
<li><a href="http://www.twitter.com/sarakata">@sarakata</a> for the wonderful idea (and baking the brownies)</li>
<li><a href="http://www.twitter.com/pwnies">@pwnies</a> for the magical <a href="http://blog.localkinegrinds.com/wp-content/uploads/2010/08/for_the_horde.svg">Horde svg image file</a></li>
<li><a href="http://www.twitter.com/mirthlab">@mirthlab</a> for creating the <a href='http://blog.localkinegrinds.com/wp-content/uploads/2010/08/for_the_horde.pdf'>Horde pdf file</a></li>
<li>Last but not least, all the smarties on the Illlist who gave me a myriad of suggestions on how to accomplish this</li>
</ul>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=404&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2010/08/05/for-the-horde-diy-world-of-warcraft-brownies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Capistrano to deploy to WebFaction</title>
		<link>http://blog.localkinegrinds.com/2008/09/16/using-capistrano-to-deploy-to-webfaction/</link>
		<comments>http://blog.localkinegrinds.com/2008/09/16/using-capistrano-to-deploy-to-webfaction/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 16:57:30 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[WebFaction]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[ror]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/?p=215</guid>
		<description><![CDATA[Update If you like to stay on the edge, check out my latest post describing how to use Capistrano 2.5 to deploy Rails 2.3 to Webfaction! There&#8217;s nothing I love more than sweet automation. After spending the better part of an hour searching the great Googs, there was only a single blog I could find [...]]]></description>
			<content:encoded><![CDATA[<h2>Update</h2>
<p>If you like to stay on the edge, check out my latest <a href="http://blog.localkinegrinds.com/2009/07/27/update-using-capistrano-2-5-to-deploy-rails-2-3-to-webfaction/">post describing how to use Capistrano 2.5 to deploy Rails 2.3 to Webfaction</a>!  </p>
<hr/>
<p><a href="http://blog.localkinegrinds.com/wp-content/uploads/2008/09/automator-icon.jpg" rel="lightbox[215]"><img src="http://blog.localkinegrinds.com/wp-content/uploads/2008/09/automator-icon.jpg" alt="" title="automator-icon" width="200" height="200" class="alignright size-full wp-image-233" /></a></p>
<h2>There&#8217;s nothing I love more than sweet automation.</h2>
<p>After spending the better part of an hour searching the great Googs, there was only a single blog I could find describing <a href="http://mega.blaix.com/2007/8/29/capistrano-on-webfaction">how to use Capistrano to deploy to WebFaction</a>.  <em>Unfortunately, Justin was describing a Capistrano 1.4 deployment.</em> I found a <a href="http://forum.webfaction.com/viewtopic.php?id=598">few</a> <a href="http://forum.webfaction.com/viewtopic.php?id=1610">posts</a> on the <a href="http://forum.webfaction.com/">WebFaction forums</a>, but nothing concrete.  So after a few hours fiddling with the technology, here&#8217;s how I configured my <a href="http://www.rubyonrails.org/">Rails</a> 2.1.1 project to use <a href="http://www.capify.org/">Capistrano</a> 2.5 to deploy to <a href="http://www.webfaction.com">WebFaction</a>.</p>
<h3>Assumptions</h3>
<p>Before getting started, I&#8217;m going to assume the following:</p>
<ul>
<li>I&#8217;m assuming you&#8217;ve already used the one-click WebFaction goodness to create a brand new Rails application in ~/webapps/&lt;application_name&gt;.  If you don&#8217;t know what I&#8217;m referring to, make sure to check out the <a href="http://www.webfaction.com/demos/rails-typo">Rails and Typo Demo screencast</a>.  Make sure you have a domain, application, and website configured.</li>
<li>I&#8217;m also going to assume that your nifty Rails application is safely stored away in either a <a href="http://subversion.tigris.org/">Subversion</a> or <a href="http://git.or.cz/">Git</a> repository and you&#8217;ve frozen Rails in your application.</li>
<li>Finally, I&#8217;m going to assume you setup your database via <a href="http://www.webfaction.com/screencasts/control-panel-demo/demo.html">WebFaction&#8217;s control panel</a>.
</ul>
<h3>Installing Capistrano</h3>
<p>The very first thing you have to do is install Capistrano on your <em>local machine</em> by issuing the following command:</p>
<pre class="console">
$ gem install -y capistrano
</pre>
<p>After installing Capistrano, the first thing you have to do is to &#8220;capify&#8221; your local Rails project.  Change into your project&#8217;s root directory and issue the following command:</p>
<pre class="console">
$ capify .
</pre>
<p>This configures your Rails project to play nicely with Capistrano.  Two files should&#8217;ve been created; <strong>Capfile</strong> in the project root and <strong>config/deploy.rb</strong>.  The deploy.rb file contains the Rails project application-specific deployment configuration.</p>
<h3>Configuring WebFaction</h3>
<p>Jumping back to WebFaction, I followed a few of the steps in <a href="http://mega.blaix.com/2007/8/29/capistrano-on-webfaction">Justin&#8217;s blog</a>.  First thing&#8217;s first, ssh into your WebFaction account and create a directory called <strong>webapps-releases</strong> in your home directory.  This directory is where we&#8217;re going to deploy the application to.</p>
<p>Since you&#8217;ve already configured a Rails application at ~/webapps/&lt;application_name&gt;, change into that directory.  You should see a standard Rails project with the exception of an extra file called autostart.cgi.  Remove everything in the directory except the autostart.cgi file by issuing the following commands:</p>
<pre class="console">
$ cd ~/webapps/&lt;application_name&gt;
$ mv autostart.cgi ~/
$ rm -rf *
$ mv ~/autostart.cgi .
</pre>
<p>Once the directory is clear, create a symlink to the log directory that will be in the webapps-releases directory we created earlier.</p>
<pre class="console">
$ ln -s ~/webapps-releases/&lt;application_name&gt;/shared/log ~/webapps/&lt;application_name&gt;/log
</pre>
<p><strong>Note:</strong> I&#8217;m assuming here that the WebFaction app and the Rails application have identical names.</p>
<p>Next, open up your favorite editor of choice (*cough*Vi*cough*) and edit the <strong>autostart.cgi</strong> file.  Jump to the end of the file and comment out the following line:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">&nbsp;
<span style="color: #808080; font-style: italic;"># os.system('/usr/local/bin/mongrel_rails start -d -e production -P /home/&lt;webfaction_username&gt;/webapps/&lt;webfaction_app_name&gt;/log/mongrel.pid -p &lt;port&gt;')</span></pre></td></tr></table></div>

<p>and right below it, cut and paste the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">&nbsp;
  <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/usr/local/bin/mongrel_rails start -c /home/&lt;webfaction_username&gt;/webapps-releases/&lt;webfaction_app_name&gt;/current -d -e production -P /home/&lt;webfaction_username&gt;/webapps/&lt;webfaction_app_name&gt;/log/mongrel.pid -p &lt;port&gt;'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<h3>Creating your custom deploy.rb</h3>
<p>After configuring WebFaction, we have to configure the Capistrano application deployment configuration.  On your local machine, find the file <strong>config/deploy.rb</strong> and replace it with the one below.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:webfaction_username</span>, <span style="color:#996600;">&quot;&lt;webfaction_username&gt;&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:webfaction_db_type</span>, <span style="color:#996600;">&quot;&lt;webfaction_db_type&gt;&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:webfaction_db</span>, <span style="color:#996600;">&quot;&lt;webfaction_db&gt;&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:webfaction_db_username</span>, <span style="color:#996600;">&quot;&lt;webfaction_db_username&gt;&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:webfaction_port</span>, <span style="color:#996600;">&quot;&lt;webfaction_port (get from autostart.cgi)&gt;&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:database_yml_template</span>, <span style="color:#996600;">&quot;database.example.yml&quot;</span>
&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:application</span>, <span style="color:#996600;">&quot;test&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:deploy_to</span>, <span style="color:#996600;">&quot;/home/#{webfaction_username}/webapps-releases/#{application}&quot;</span>
&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:scm</span>, <span style="color:#ff3333; font-weight:bold;">:subversion</span>
set <span style="color:#ff3333; font-weight:bold;">:scm_user</span>, <span style="color:#996600;">&quot;&lt;scm_username&gt;&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:scm_password</span>, <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#6666ff; font-weight:bold;">Capistrano::CLI</span>.<span style="color:#9900CC;">password_prompt</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Subversion password for #{scm_user}: &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
set <span style="color:#ff3333; font-weight:bold;">:repository</span>, <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;--username #{scm_user} --password #{scm_password} --no-auth-cache &lt;http://path/to/your/svn/goes/here/&gt;&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span> 
&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:user</span>, <span style="color:#996600;">&quot;#{webfaction_username}&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:use_sudo</span>, <span style="color:#0000FF; font-weight:bold;">false</span> 
&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:domain</span>, <span style="color:#996600;">&quot;&lt;webfaction_domain&gt;&quot;</span>
&nbsp;
role <span style="color:#ff3333; font-weight:bold;">:app</span>, domain
role <span style="color:#ff3333; font-weight:bold;">:web</span>, domain
role <span style="color:#ff3333; font-weight:bold;">:db</span>,  domain, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
&nbsp;
desc <span style="color:#996600;">&quot;Symlink public to what webfaction expects the webroot to be&quot;</span>
task <span style="color:#ff3333; font-weight:bold;">:after_symlink</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:web</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  run <span style="color:#996600;">&quot;ln -nfs #{release_path}/public /home/#{webfaction_username}/webapps/#{application}/&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:deploy</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Taken from http://jonathan.tron.name/2006/07/15/capistrano-password-prompt-tips </span>
  <span style="color:#008000; font-style:italic;"># Thanks Jonathan! :)</span>
  desc <span style="color:#996600;">&quot;Creates the database configuration on the fly&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:create_database_configuration</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;yaml&quot;</span>
    set <span style="color:#ff3333; font-weight:bold;">:production_db_password</span>, <span style="color:#CC0066; font-weight:bold;">proc</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#6666ff; font-weight:bold;">Capistrano::CLI</span>.<span style="color:#9900CC;">password_prompt</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Remote production database password: &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
    db_config = <span style="color:#CC00FF; font-weight:bold;">YAML</span>::load_file<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;config/#{database_yml_template}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    db_config.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'test'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    db_config.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'development'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    db_config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'production'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'adapter'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;#{webfaction_db_type}&quot;</span>
    db_config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'production'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'database'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;#{webfaction_db}&quot;</span>
    db_config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'production'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'username'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;#{webfaction_db_username}&quot;</span>
    db_config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'production'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'password'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = production_db_password
    db_config<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'production'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'host'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;localhost&quot;</span>
&nbsp;
    put <span style="color:#CC00FF; font-weight:bold;">YAML</span>::dump<span style="color:#006600; font-weight:bold;">&#40;</span>db_config<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#996600;">&quot;#{release_path}/config/database.yml&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:mode</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> 0664
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  after <span style="color:#996600;">&quot;deploy:update_code&quot;</span>, <span style="color:#996600;">&quot;deploy:create_database_configuration&quot;</span>
&nbsp;
  desc <span style="color:#996600;">&quot;Redefine deploy:start&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:start</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    invoke_command <span style="color:#996600;">&quot;/usr/local/bin/mongrel_rails start -c #{deploy_to}/current -d -e production -P /home/#{webfaction_username}/webapps/#{application}/log/mongrel.pid -p #{webfaction_port}&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:via</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> run_method
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  desc <span style="color:#996600;">&quot;Redefine deploy:restart&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:restart</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    invoke_command <span style="color:#996600;">&quot;/usr/local/bin/mongrel_rails restart -c #{deploy_to}/current -P /home/#{webfaction_username}/webapps/#{application}/log/mongrel.pid&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:via</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> run_method
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  desc <span style="color:#996600;">&quot;Redefine deploy:stop&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:stop</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    invoke_command <span style="color:#996600;">&quot;/usr/local/bin/mongrel_rails stop -c #{deploy_to}/current -P /home/#{webfaction_username}/webapps/#{application}/log/mongrel.pid&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:via</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> run_method
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<div style="font:normal 1.1em arial; background-color:#E5F3FF; padding:1em; margin:1em 0; border:1px solid #114477; color:#33415D;"><strong>Note:</strong> Change all the values in tags like <strong>&lt;webfaction_username&gt;</strong>, <strong>&lt;webfaction_db&gt;</strong>, <strong>&lt;webfaction_db_username&gt;</strong>, etc. to those values that fit your configuration!<br/>Otherwise, this file in itself won&#8217;t do you any good.</div>
<p><strong>Props out to <a href="http://jonathan.tron.name/">Jonathan</a> for the fantastic Capistrano tips!</strong></p>
<p>After copying the deploy.rb file and editing the appropriate variables, run the following command in your Rails project&#8217;s root directory:</p>
<pre class="console">
$ cap deploy:setup
</pre>
<p>This command creates the appropriate directory structure for Capistrano on the deployment server based upon values set in your deploy.rb.  Next, run the following command to check your dependencies.</p>
<pre class="console">
$ cap deploy:check
</pre>
<p>If everything is successful, you should see a message that reads something like&#8230;<br/></p>
<p><strong>You appear to have all necessary dependencies installed</strong></p>
<p>Next, push your code out to the server using the following command:</p>
<pre class="console">
$ cap deploy:update
</pre>
<p>Finally, to start up your application run the following Capistrano command:</p>
<pre class="console">
$ cap deploy:start
</pre>
<p>Now, you should be able to run the standard Capistrano tasks to deploy your application to WebFaction!</p>
<h3>Explanation</h3>
<p>Most techies like to have an explanation of what&#8217;s going on with the Capistrano deploy.rb.  I could probably write another blog about it, but I&#8217;m lazy (and pressed for time).  The :create_database_configuration task basically writes the database.yml production configuration on the fly (courtesy of this <a href="http://jonathan.tron.name/2006/07/15/capistrano-password-prompt-tips">blog posting</a>).</p>
<p>The basic gyst of the rest of the script is that WebFaction is proxying a Mongrel instance.  The Capistrano deploy.rb override the original deploy:start, deploy:stop, and deploy:restart tasks to run Mongrel commands that WebFaction can understand.  Typically, the default Capistrano tasks run script/spin and reaper, but it was easier just to redefine the task.  <strong>If anyone has any tips/suggestions to improve the script, I&#8217;m all ears!  </strong></p>
<h2>Voila! (Enjoy)</h2>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=215&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2008/09/16/using-capistrano-to-deploy-to-webfaction/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Backing up your Subversion (SVN) repository on Dreamhost with cron</title>
		<link>http://blog.localkinegrinds.com/2008/02/10/backing-up-your-subversion-svn-repository-on-dreamhost-with-cron/</link>
		<comments>http://blog.localkinegrinds.com/2008/02/10/backing-up-your-subversion-svn-repository-on-dreamhost-with-cron/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 22:02:56 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[back-up]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontabs]]></category>
		<category><![CDATA[hotcopy]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/2008/02/10/backing-up-your-subversion-svn-repository-on-dreamhost-with-cron/</guid>
		<description><![CDATA[Two events spurred me to write this blog. First, my 2 year old &#8220;Subversion + Dreamhost + Post-Commit&#8221; blog still gets quite a number of hits. Second, after the latest Dreamhost outage move, I&#8217;m beginning to feel a little more vigilant about backing up my data. As a standard disclaimer, if you&#8217;re not familiar with [...]]]></description>
			<content:encoded><![CDATA[<h3>Two events spurred me to write this blog.</h3>
<p>First, my <a href="http://blog.localkinegrinds.com/2006/12/15/dreamhost-subversion-post-commit-tutorial/">2 year old &#8220;Subversion + Dreamhost + Post-Commit&#8221; blog</a> still gets quite a number of hits.  Second, after the latest <a href="http://www.dreamhoststatus.com/2008/02/08/randy-move-going-ahead/">Dreamhost <strike>outage</strike> move</a>, I&#8217;m beginning to feel a little more vigilant about backing up my data.  </p>
<div class="disclaimer">As a standard disclaimer, if you&#8217;re not familiar with the Unix shell, I <strong>highly suggest</strong> you not try this unless under the supervision of someone who reads Perl books for fun.  By accessing your Dreamhost shell, you can seriously f-up your account and I will not fix it for you.  You have been warned. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (Don&#8217;t you just love smileys?)</div>
<h3>Setup</h3>
<p>There are a few prerequisites to being able to back up your <a href="http://subversion.tigris.org/">SVN</a> repository.</p>
<ol>
<li>First and foremost, you must have already installed a SVN repository into your Dreamhost account via the <a href="https://panel.dreamhost.com/index.cgi?tree=goodies.svn&#038;">control panel</a>.</li>
<li>Second, you must know how to <a href="http://wiki.dreamhost.com/Ssh">SSH into your Dreamhost account</a>.  As a FYI, you sorta-kinda-need to know what that means in order to follow this tutorial.</li>
</ol>
<h3>Grabbing the backup script</h3>
<p>Wait, you didn&#8217;t think I was writing my own right?  In any case, if you actually installed/compiled Subversion on your own, it would&#8217;ve contained this file, <a href="http://svn.collab.net/repos/svn/trunk/tools/backup/hot-backup.py.in">hotbackup.py</a>.  Fortunately for us, Dreamhost has this file conveniently available at: <strong>/usr/bin/svn-hot-backup</strong>, but it&#8217;s an older version of the backup script.  There are some subtle differences like being unable to pass in the number of backups you want the script to manage.  Personally, I like to be on the edge, so let&#8217;s get the latest version.  Execute the following commands from your home directory.</p>
<pre class="console">
$ cd ~
$ mkdir scripts
$ cd scripts
$ wget http://svn.collab.net/repos/svn/trunk/tools/backup/hot-backup.py.in
$ mv hot-backup.py.in svn-hot-backup.py
</pre>
<p>The commands issued above created a directory called scripts in your home directory, switched into the directory, downloaded the latest hot-backup.py file from <a href="http://www.collab.net">CollabNet</a>, and renamed it to svn-hot-backup.py.  Now that you have the file, you&#8217;ll need to make a few edits.  Personally, I&#8217;m accustomed to vi, but pick your poison (pico, nano, text editor of your choice) and find these two values (they should be close to the top of the file in consecutive lines).</p>
<pre class="script">
# Path to svnlook utility
svnlook = r"@SVN_BINDIR@/svnlook"

# Path to svnadmin utility
svnadmin = r"@SVN_BINDIR@/svnadmin"
</pre>
<p>and change them to the following:</p>
<pre class="script">
# Path to svnlook utility
svnlook = r"/usr/bin/svnlook"

# Path to svnadmin utility
svnadmin = r"/usr/bin/svnadmin"
</pre>
<p>(If you&#8217;re wondering, if and when you compile/install Subversion yourself, these two variables would have been automagically filled in for you.)</p>
<p>The python script we downloaded not only performs a <a href="http://svnbook.red-bean.com/en/1.0/re33.html">hotcopy</a> of your svn directory, but also can archive it and manage a set number of copies.  <strong>Pretty neat right?</strong></p>
<h3>Preparing for the backups</h3>
<p>Before you can actually back up your SVN repository, you&#8217;ll want to create a directory structure to manage your backups.  Execute the following commands from your home directory.</p>
<pre class="console">
$ cd ~
$ mkdir backup
$ cd backup
$ mkdir svn
$ cd ~/scripts
</pre>
<p>The commands issued above created a directory called <strong>backup</strong> in your home directory, switched into the directory, and created another directory called <strong>svn</strong> within the backup directory.  We&#8217;ll be using this directory to store all your backups.  Finally, we switched back into the scripts directory created in the previous steps.  Now that we have the backup script and directory structure to manage the back ups, let&#8217;s test it out!</p>
<p>Before you can back up your repository, you&#8217;ll have to know the name of the Subversion repository you&#8217;re trying to back up.  To find the name of your repository, you can either look in the svn directory in your home directory, or you can check out the <a href="https://panel.dreamhost.com/index.cgi?tree=goodies.svn&#038;">ID value in your Subversion Goodies control panel</a>.  In any case, remember the name of your SVN repository and issue the following commands.</p>
<pre class="console">
$ cd ~/scripts/
$ python2.4 svn-hot-backup.py --archive-type=zip --num-backups=10 ~/svn/REPOSITORY_NAME_HERE/ ~/backup/svn/
</pre>
<div style="font:bold 1.1em arial; background-color:#E5F3FF; padding:1em; margin:1em 0; border:1px solid #114477; color:#33415D;">Notice, change the value of REPOSITORY_NAME_HERE to the id of the SVN repository you want backed up.</div>
<p>You should see the following in the console:</p>
<pre class="console">
Beginning hot backup of '/home/USERNAME/svn/lkg/'.
Youngest revision is REVISION_NUMBER
Backing up repository to '/home/USERNAME/backup/svn/REPOSITORY_NAME_HERE-701'...
Done.
Archiving backup to '/home/USERNAME/backup/svn/REPOSITORY_NAME_HERE-701.zip'...
Archive created, removing backup '/home/USERNAME/backup/svn/REPOSITORY_NAME_HERE-701'...
</pre>
<div style="font:bold 1.1em arial; background-color:#DDFFDD; border:1px solid #009900; padding:1em; margin:1em 0;">If you see the following, the backup was a <span style="font:bold 1.25em arial; color:#006600;">success</span>!  You can even check on the file by changing into the backup/svn directory!</div>
<h2>Voila! (But there&#8217;s more)</h2>
<h3>Automating the backups</h3>
<p>Now that you actually have the script backing up your SVN repository, let&#8217;s automate them!  To do so, we&#8217;ll use the handy <a href="http://en.wikipedia.org/wiki/Crontab">cron daemon</a>.  Cron has similarities to the Windows task scheduler in that it provides a service that enables a user to execute commands at a specified date/time or set intervals.  To tell cron the tasks you want to execute, you&#8217;ll need to load a configuration file called a crontab.  You can read more about it <a href="http://blog.dreamhosters.com/kbase/index.cgi?area=2506">here</a> and <a href="http://wiki.dreamhost.com/Cron">here</a>. In any case, here&#8217;s what my crontab configuration file looks like.</p>
<pre class="script">
MAILTO=ryankanno@CHANGE_TO_YOUR_EMAIL.com
# minute (0-59),
# |      hour (0-23),
# |      |       day of the month (1-31),
# |      |       |       month of the year (1-12),
# |      |       |       |       day of the week (0-6 with 0=Sunday).
# |      |       |       |       |       commands
  0      0       *       *       *      /usr/bin/python2.4 /home/USERNAME/scripts/svn-hot-backup.py --archive-type=zip --num-backups=10 /home/USERNAME/svn/REPOSITORY_NAME/ /home/USERNAME/backup/svn/
</pre>
<p>Create a file in your scripts directory called svn_backup_once_a_day.cron and copy the contents above into your file.  I&#8217;ve setup my crontab to backup my svn repository once a day.</p>
<div style="font:bold 1.1em arial; background-color:#E5F3FF; padding:1em; margin:1em 0; border:1px solid #114477; color:#33415D;">Notice, change the value of ryankanno@CHANGE_TO_YOUR_EMAIL.com to your email address (or comment the line out with a # if you don&#8217;t want emails sent to you), USERNAME to your Dreamhost username, and REPOSITORY_NAME to your Subversion repository.</div>
<p>Once you have this file called svn_backup_once_a_day.cron in your scripts directory, load the file into your crontab by issuing the following command:</p>
<pre class="console">
$ crontab svn_backup_once_a_day.cron
</pre>
<p>As a FYI, this will replace your old crontab.  If you have other items already running on cron, it&#8217;s a good idea to list them via the crontab -l command first.  If you want to make sure that your cron will run, you can test it out by setting the values in the crontab to the time you want it to run.  I&#8217;ll leave this as an exercise to the reader. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Storing your backups</h3>
<p>Though out of scope of this blog, you&#8217;ll still have to store your backups somewhere.  Please just don&#8217;t leave them in your <a href="http://www.dreamhost.com">Dreamhost</a> account.  Your best bet is probably to get an <a href="http://aws.amazon.com/s3">Amazon S3 account</a> and store your backups there.  Personally, I like to run another script immediately after the hotcopy finishes that pushes the backup to my S3 account.  Other options include scp/sftp&#8217;ing the backups to your home machine.  Here&#8217;s a <a href="http://blog.dreamhosters.com/kbase/index.cgi?area=2599">link</a> to read more about that option.</p>
<h2>Voila! Enjoy!</h2>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=165&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2008/02/10/backing-up-your-subversion-svn-repository-on-dreamhost-with-cron/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Upgrading your DVR: How to increase your DVR&#8217;s recording time</title>
		<link>http://blog.localkinegrinds.com/2008/02/01/upgrading-dvr-with-more-recording-time/</link>
		<comments>http://blog.localkinegrinds.com/2008/02/01/upgrading-dvr-with-more-recording-time/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 10:05:14 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[8300hd]]></category>
		<category><![CDATA[dvr]]></category>
		<category><![CDATA[hawaii]]></category>
		<category><![CDATA[recording-time]]></category>
		<category><![CDATA[scientific-atlanta]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/2008/02/01/upgrading-dvr-with-more-recording-time/</guid>
		<description><![CDATA[This blog is for all my Hawaii television addicts. Since I rarely have time to watch live television, my Oceanic Time Warner DVR is constantly filled to max capacity. This means I&#8217;m always battling my inner demons on what shows I have to erase&#8230; Rock of Love, A Shot at Love, Flavor of Love&#8230; you [...]]]></description>
			<content:encoded><![CDATA[<h2>This blog is for all my Hawaii television addicts.</h2>
<p>Since I rarely have time to watch live television, my <a href="http://www.oceanic.com/OceanicWebApps/Index.html">Oceanic Time Warner</a> DVR is constantly filled to max capacity.  This means I&#8217;m always battling my inner demons on what shows I have to erase&#8230; <a href="http://blog.vh1.com/2007-12-20/rock-of-love-2-first-look/">Rock of Love</a>, <a href="http://remotecontrol.mtv.com/2007/11/28/a-shot-at-love-recap-episode-8-lap-dance-granny/">A Shot at Love</a>, <a href="http://blog.vh1.com/2007-08-03/flavor-flavs-backwith-a-new-taste/">Flavor of Love</a>&#8230; you know, all the good stuff.  To solve my problem, I&#8217;ve finally decided to invest the $150 to upgrade my DVR and increase its total number of recording hours.</p>
<h4>Luckily for you, I&#8217;ll walk you through the steps to upgrade your own DVR!</h4>
<p style="width:95%; font-size:1em; background-color:#ffeeee; border:1px solid #990000; padding:1.5em; margin:1em 0;">
As a standard disclaimer, if you attempt to upgrade your own DVR and f-it up, I can&#8217;t and won&#8217;t fix it.  So&#8230; if technology scares you, please parents, do not try this unless supervised by your technology-oriented youngster.  If you don&#8217;t understand what SATA, external enclosures, or hard drives mean, do not, and I repeat <strong>do not try this at home!</strong>
</p>
<h3>The setup</h3>
<p>Before you can upgrade your DVR, you&#8217;ll need to make sure that you have the <a href="http://www.scientificatlanta.com/products/consumers/new_explorer8300HD.htm">Scientific Atlanta Explorer 8300HD</a>.  Just match what your DVR looks like to the one in the picture.  It&#8217;s not that hard.  This is what mine looks like: <a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10500014.jpg' title='The front of my DVR' rel="lightbox">the front</a> and <a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg09170003.jpg' title='The back of my DVR' rel="lightbox">the back</a>. I do know for a fact that Oceanic has a few versions of their cable boxes out in the wild.  I&#8217;m pretty sure you can upgrade (some of) the other models as well, but I&#8217;ve personally only upgraded the 8300HD.  So if you want to be ballsy and upgrade a different cable box, feel totally free &#8211; just be warned that this guide won&#8217;t apply to you.  I&#8217;m not even sure if you can still turn in your old cable box because of the <a href="http://the.honoluluadvertiser.com/article/2007/Dec/17/ln/hawaii712170349.html">demand for HDTV in Hawaii</a>, but calling up Oceanic can&#8217;t hurt.</p>
<p>Aside from owning an 8300HD, you&#8217;ll need three additional components to make this upgrade work.  I&#8217;ve included links to where I purchased the following items.  Fear not, I don&#8217;t make any commissions on these links so feel free to buy these products from anywhere you see fit.  </p>
<ul>
<li>1 external SATA enclosure (I used a <a href="http://shop4.outpost.com/product/4573757;jsessionid=WwPVfJx9HgljtUbOWPH75Q**.node2?site=sr:SEARCH:MAIN_RSLT_PG">KingWin from Fry&#8217;s</a> for 30 bucks.)</li>
<li>1 SATA/IDE harddrive (I used a <a href="http://shop4.outpost.com/%7B2Qbw-GvA+uzSPeJ1taMJHQ**.node2%7D/product/4551377">Maxtor 500 GB</a> for about a 100.)</li>
<li>1 SATA to eSATA cable (I used a <a href="http://www.monoprice.com/products/product.asp?c_id=102&#038;cp_id=10226&#038;cs_id=1022603&#038;p_id=3750&#038;seq=1&#038;format=2">6 ft cable from Monoprice.com</a> for 5 bucks.)</li>
</ul>
<p>Here are a few pictures of the aforementioned items.</p>
<p style="text-align:center; margin:auto;">
<a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10200005.jpg' title='External SATA enclosure' rel="lightbox[requirements]"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10200005.thumbnail.jpg' alt='External SATA enclosure' class="thumb"/></a><a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg09060001.jpg' title='Maxtor SATA 500 GB hard drive' rel="lightbox[requirements]"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg09060001.thumbnail.jpg' alt='Maxtor SATA 500 GB hard drive' class="thumb"/></a><a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10340008.jpg' title='eSATA to SATA cable' rel="lightbox[requirements]"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10340008.thumbnail.jpg' alt='eSATA to SATA cable' class="thumb"/></a><a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10280006.jpg' title='Everything unpacked!' rel="lightbox[requirements]"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10280006.thumbnail.jpg' alt='Everything unpacked!' class="thumb"/></a>
</p>
<h3>The results</h3>
<p>First, make sure your 8300HD is turned off.  Place the hard drive into the external enclosure.  Next, after <a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg09180004.jpg' title='Connecting the hard drive to the dvr' rel="lightbox">connecting the external SATA enclosure to the 8300HD</a> (with the SATA to eSATA cable), power the external hard drive before turning the DVR box back on.  Note, it&#8217;s extremely important that the external SATA enclosure be turned on prior to the cable box being powered on.  Once booted, the 8300HD should recognize a new, external data source and prompt you to format the new drive.  The following message should appear:</p>
<p><a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10400011.jpg' title='Format hard drive prompt' rel="lightbox"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10400011.thumbnail.jpg' alt='Format hard drive prompt' class="thumb" /></a></p>
<p>Once formatted, you should see a success message:</p>
<p><a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10410012.jpg' title='Format success!' rel="lightbox"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10410012.thumbnail.jpg' alt='Format success!' class="thumb"/></a></p>
<h2>Voila! DVR Upgraded!</h2>
<h3>The benes</h3>
<p>There are numerous benefits to increasing your DVR&#8217;s total recording time.</p>
<ul>
<li>No more having to rush home because you forgot the DVR is full.</li>
<li>No more making those life-altering decisions about what movies to delete.</li>
<li>Being able to store almost a year&#8217;s worth of reality crap is fun!</li>
</ul>
<p>Of course, there&#8217;s the almost 4X increase in the DVR&#8217;s recording time as you can see by the  following before and after pictures.  Not bad!</p>
<p style="text-align:center; margin:auto;">
<a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10380009.jpg' title='Before upgrade' rel="lightbox[results]"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10380009.thumbnail.jpg' alt='Before upgrade' class="thumb"/></a><a href='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10420013.jpg' title='After upgrade' rel="lightbox[results]"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2008/01/cimg10420013.thumbnail.jpg' alt='After upgrade' class="thumb"/></a>
</p>
<h3>The cons</h3>
<p>There&#8217;s no such thing as a free pass in life&#8230; so here are a few of the cons.</p>
<ul>
<li>As I wrote earlier, the <strong style="font-size:110%;">external hard drive needs to be powered on before your cable box.</strong>  This means one of two things.  Either you always turn the external drive on first or leave it on permanently.  Since I know I could never remember to do the former, I&#8217;ve decided to leave the device on permanently &#8211; meaning a slightly larger electricity bill.  As someone trying to get off the grid, that makes me sad.</li>
<li>You can&#8217;t rip the recorded video off the external hard drive.  Unfortunately, the <a href="http://www.google.com/search?q=8300hd+encrypted&#038;ie=utf-8&#038;oe=utf-8&#038;aq=t&#038;rls=org.mozilla:en-US:official&#038;client=firefox-a">data is encrypted</a>.  Unless you&#8217;re a cryptographic expert, worked on the 8300HD, or have a few <a href="http://en.wikipedia.org/wiki/Beowulf_(computing)">Beowulf clusters</a>, deal with it.  You won&#8217;t be able to share your recordings.</li>
<li>$150 bucks is a lot to spend on easing one&#8217;s mind, but I think it&#8217;s money well spent considering the prices <a href="http://www.weaknees.com/maxtor-quickview-expander-qvx.php">here</a> and <a href="http://discountechnology.com/8300HD-eSATA-Hard-Drive-for-Scientific-Atlanta-8300HD-DVR-250GB?category=12">here</a>.
</ul>
<h3>Some linkage</h3>
<p>Of course I couldn&#8217;t have upgraded my DVR without the Internet.  Here&#8217;s a link to the forums and guides I read to assist me along the way.  Check them out, some of them are quite interesting.</p>
<ul>
<li><a href="http://www.scientificatlanta.com/ExplorerClubGuides/getting_started/4003870.pdf">Scientific Atlanta 8300HD User Guide</a></li>
<li><a href="http://www.avsforum.com/avs-vb/showthread.php?t=471859">AVSForum&#8217;s SA 8300 HD Tips &#038; Tricks &#8212; SARA thread</a></li>
<li><a href="http://baseportal.com/cgi-bin/baseportal.pl?htx=/xnappo/main">Scientific Atlanta 8300HD SARA eSATA Database</a></li>
</ul>
<p>Finally, check out <a href="http://flickr.com/photos/ryankanno/sets/72157603820776544/">my flickr set</a> if you need to see any more pictures!</p>
<h2>Enjoy!</h2>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=151&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2008/02/01/upgrading-dvr-with-more-recording-time/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Using the extra() QuerySet modifier in Django for WeGoEat</title>
		<link>http://blog.localkinegrinds.com/2007/10/24/using-the-extra-queryset-modifier-in-django-for-wegoeat/</link>
		<comments>http://blog.localkinegrinds.com/2007/10/24/using-the-extra-queryset-modifier-in-django-for-wegoeat/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 15:17:01 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[extra]]></category>
		<category><![CDATA[hawaii]]></category>
		<category><![CDATA[queryset]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[wegoeat]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/10/24/using-the-extra-queryset-modifier-in-django-for-wegoeat/</guid>
		<description><![CDATA[Since I actually used this method to reduce the number of Update:&#8221;explicit&#8221; SQL calls made in WeGoEat, I figured I&#8217;d write a little blog explaining the context in which it was used, and maybe, just maybe, it&#8217;ll help shed some light on how others can take advantage of this neat little function. Background As a [...]]]></description>
			<content:encoded><![CDATA[<p>Since I actually used this method to reduce the number of <strong>Update:&#8221;explicit&#8221;</strong> SQL calls made in <a href="http://www.wegoeat.com">WeGoEat</a>, I figured I&#8217;d write a little blog explaining the context in which it was used, and maybe, just maybe, it&#8217;ll help shed some light on how others can take advantage of this neat little function.</p>
<h2>Background</h2>
<p>As a <a href="http://www.djangoproject.com">Django</a> &#8220;proof-of-concept&#8221;, I&#8217;m working on a <a href="http://www.wegoeat.com/">local restaurant review site</a> for my home state of Hawai`i.  (I actually just released it yesterday).  For each restaurant, I want to be able to calculate the average of all reviews and <a href="http://www.wegoeat.com/restaurants/browse/by/island/oahu/page/1/records/50/">display this listing in a paginated view</a>.  (<em>Yes, I do realize there&#8217;s no average rating, but that has to do with there being no users. ;P</em>).</p>
<h2>The Problem</h2>
<p>Having a serious &#8220;wtf was I thinking moment&#8221;, I initially wrote a Restaurant model function that returned the average (review) rating for each restaurant instance.  Little did I realize that when I actually displayed the restaurant&#8217;s average reviews, I would be making an additional SQL avg() call for <strong>every</strong> restaurant.  Though I&#8217;m paging &#8220;n&#8221; records at a time, this function added an additional &#8220;n&#8221; SQL calls for <a href="http://www.wegoeat.com/restaurants/browse/by/letter/a/page/1/records/50/">every</a> <a href="http://www.wegoeat.com/restaurants/browse/by/letter/b/page/1/records/50/">view</a> <a href="http://www.wegoeat.com/restaurants/browse/by/letter/c/page/1/records/50/">that</a> <a href="http://www.wegoeat.com/restaurants/browse/by/letter/d/page/1/records/50/">contained</a> <a href="http://www.wegoeat.com/restaurants/browse/by/letter/g/page/1/records/50/">a restaurant</a> <a href="http://www.wegoeat.com/restaurants/browse/by/letter/h/page/1/records/50/">listing</a>, just to name a few.</p>
<p>In pseudo-code, my initial naive function resembled the following:  (I&#8217;m sure we&#8217;re all guilty of writing something of the sort&#8230; ok, fine, I know I was. ;P)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">     <span style="color: #ff7700;font-weight:bold;">def</span> get_average_review<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
         query = <span style="color: #483d8b;">'QUERY TO GET AVERAGE (SELECT AVG(rating)...); (I have the query below)'</span>
         <span style="color: #808080; font-style: italic;"># Get cursor from connection</span>
        cursor = connection.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        cursor.<span style="color: black;">execute</span><span style="color: black;">&#40;</span>query<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> cursor.<span style="color: black;">fetchall</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p><strong>Duh.</strong></p>
<p>Here&#8217;s a picture of the number of queries it took:</p>
<div style="text-align:center; padding:1.5em;"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2007/10/duh.jpg' alt='Duh' style="border:1px solid #aaa;"/></div>
<h2>The &#8220;extra()&#8221; solution</h2>
<p>After profiling my application and realizing what a bone-headed mistake I made, I began researching the <a href="http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none">extra() Queryset modifier</a>.  Yes, I realize that these extra lookups aren&#8217;t the most portable and often violate the DRY principle, but it&#8217;ll probably suffice for <strike>most of</strike> all my personal projects. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Since I&#8217;m already retrieving a list of Restaurants and filtering them via <a href="http://wegoeat.com/restaurants/browse/by/letter/">letter</a>, <a href="http://wegoeat.com/restaurants/browse/by/island/">island</a>, and <a href="http://wegoeat.com/restaurants/browse/">what not</a>, I figured I could add an average rating subquery.  The entire call looks as such:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">     restaurants = Restaurant.<span style="color: black;">objects</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>name__istartswith = letter<span style="color: black;">&#41;</span>.<span style="color: black;">extra</span><span style="color: black;">&#40;</span>
             <span style="color: #dc143c;">select</span>=<span style="color: black;">&#123;</span><span style="color: #483d8b;">'avg_rating'</span>: <span style="color: #483d8b;">'SELECT AVG(overall_rating) FROM restaurants_restaurant as res, reviews_review, django_content_type <span style="color: #000099; font-weight: bold;">\</span>
                                          WHERE restaurants_restaurant.id = res.id <span style="color: #000099; font-weight: bold;">\</span>
                                          AND res.id = reviews_review.object_id <span style="color: #000099; font-weight: bold;">\</span>
                                          AND reviews_review.content_type_id = django_content_type.id <span style="color: #000099; font-weight: bold;">\</span>
                                          AND django_content_type.model = <span style="color: #000099; font-weight: bold;">\'</span>restaurant<span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: black;">&#125;</span>,
                       <span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>As you can see, I&#8217;m exploiting the fact that restaurants_restaurant will be available from the Restaurant.objects.filter() call.  (I know, I know&#8230; bad for portability).</p>
<h2>But voila!</h2>
<p>Now, in my templates, when I iterate over the restaurants, I can get issue the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">for</span> restaurant <span style="color: #ff7700;font-weight:bold;">in</span> restaurant_list <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
<span style="color: #66cc66;">&lt;</span>tr<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>td<span style="color: #66cc66;">&gt;&lt;</span>a href=<span style="color: #483d8b;">&quot;{{restaurant.get_absolute_url}}&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> restaurant.<span style="color: black;">name</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/a<span style="color: #66cc66;">&gt;&lt;</span>/td<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>td<span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">if</span> restaurant.<span style="color: black;">avg_rating</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
	   <span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> load show_stars <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span> 
           <span style="color: #66cc66;">&lt;</span>span <span style="color: #ff7700;font-weight:bold;">class</span>=<span style="color: #483d8b;">&quot;average-rating&quot;</span><span style="color: #66cc66;">&gt;</span>
	   <span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> show_stars <span style="color: #66cc66;">&lt;</span>strong<span style="color: #66cc66;">&gt;</span>restaurant.<span style="color: black;">avg_rating</span><span style="color: #66cc66;">&lt;</span>/strong<span style="color: #66cc66;">&gt;</span> of <span style="color: #ff4500;">5</span> <span style="color: #008000;">round</span> to quarter <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
           <span style="color: #66cc66;">&lt;</span>/span<span style="color: #66cc66;">&gt;</span>
           <span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endif <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/td<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>/tr<span style="color: #66cc66;">&gt;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endfor <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span></pre></td></tr></table></div>

<p>Notice how I used my <a href="http://blog.localkinegrinds.com/2007/10/02/displaying-stars-with-rounding-as-a-django-templatetag/">show_stars template tag</a> that I blogged about a few weeks ago to display the average restaurant rating.  (Cheap shameless plug, but damn effective! <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )  I&#8217;d link to a page in action, but since I just opened up my site to a few select users, I&#8217;ll update this post when I actually have any reviews. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Oh, and before I forget, thanks to my co-worker Stephen for assisting me with my SQL issues! <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here&#8217;s a picture of the final result:</p>
<div style="text-align:center; padding:1.5em;"><img src='http://blog.localkinegrinds.com/wp-content/uploads/2007/10/yay.jpg' alt='Yay'  style="border:1px solid #aaa;"/></div>
<h2>Note:</h2>
<p>As an added bonus, I also realized a few other &#8216;spots&#8217; where the .extra() Queryset modifier would come in handy.  Since I&#8217;m also using the wonderful <a href="http://code.google.com/p/django-voting/">django-voting</a> application from <a href="http://insin.webfactional.com/weblog/">Jonathan Buchanan</a>, I came across <a href="http://groups.google.com/group/django-users/browse_thread/thread/119b5d6581d43dc6/671a25f972a082ed">this post about accessing a dictionary via a template</a> in the <a href="http://groups.google.com/group/django-users">Django-users Google Group</a>.</p>
<p>Basically, I had come across the same issue as the poster.  Since I allow users to vote on reviews (similar to <a href="http://www.amazon.com">Amazon</a>, <a href="http://www.yelp.com">Yelp</a>, etc.), I wanted to retrieve the score of each Review instance to display on a <a href="http://www.wegoeat.com/reviews/browse/latest/">paginated listing of all Reviews</a>.  Using the same extra() modifier, I was able to inject the total number of votes and the score when I retrieved all Reviews as such:</p>
<p><strong>Btw, I just injected most of the code from Jonathan&#8217;s template tag. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">.<span style="color: black;">extra</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">select</span>=<span style="color: black;">&#123;</span><span style="color: #483d8b;">'total_votes'</span>: <span style="color: #483d8b;">'SELECT COUNT(vote) FROM votes as v, reviews_review as rev, django_content_type <span style="color: #000099; font-weight: bold;">\</span>
                                        WHERE reviews_review.id = rev.id <span style="color: #000099; font-weight: bold;">\</span>
                                        AND v.object_id = reviews_review.id <span style="color: #000099; font-weight: bold;">\</span>
                                        AND v.content_type_id = django_content_type.id <span style="color: #000099; font-weight: bold;">\</span>
                                        AND django_content_type.model = <span style="color: #000099; font-weight: bold;">\'</span>review<span style="color: #000099; font-weight: bold;">\'</span>'</span>, 
&nbsp;
                                        <span style="color: #483d8b;">'score'</span>: <span style="color: #483d8b;">'SELECT SUM(vote) FROM votes as v, reviews_review as rev, django_content_type <span style="color: #000099; font-weight: bold;">\</span>
                                        WHERE reviews_review.id = rev.id <span style="color: #000099; font-weight: bold;">\</span>
                                        AND v.object_id = reviews_review.id <span style="color: #000099; font-weight: bold;">\</span>
                                        AND v.content_type_id = django_content_type.id <span style="color: #000099; font-weight: bold;">\</span>
                                        AND django_content_type.model = <span style="color: #000099; font-weight: bold;">\'</span>review<span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: black;">&#125;</span>,<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<h3>Pretty neat right?</h3>
<p>Now, when iterating through the reviews, I can use the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">for</span> review <span style="color: #ff7700;font-weight:bold;">in</span> object_list <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
	<span style="color: #66cc66;">&lt;</span>tr<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>td<span style="color: #66cc66;">&gt;&lt;</span>a href=<span style="color: #483d8b;">&quot;{{review.content_object.get_absolute_url}}&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> review.<span style="color: black;">content_object</span>.<span style="color: black;">name</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/a<span style="color: #66cc66;">&gt;&lt;</span>/td<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>td<span style="color: #66cc66;">&gt;&lt;</span>a href=<span style="color: #483d8b;">&quot;{% url profile-detail username=review.user.username %}&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> review.<span style="color: #dc143c;">user</span>.<span style="color: black;">username</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/a<span style="color: #66cc66;">&gt;&lt;</span>/td<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>td<span style="color: #66cc66;">&gt;&lt;</span>nobr<span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> load show_stars <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
			<span style="color: #66cc66;">&lt;</span>span <span style="color: #ff7700;font-weight:bold;">class</span>=<span style="color: #483d8b;">&quot;rating&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> show_stars review.<span style="color: black;">overall_rating</span> of <span style="color: #ff4500;">5</span> <span style="color: #008000;">round</span> to half <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/span<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>/nobr<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>/td<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>td<span style="color: #66cc66;">&gt;&lt;</span>span style=<span style="color: #483d8b;">&quot;font-weight:bold; color:#092e20;&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> review.<span style="color: black;">get_recommendation_display</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/span<span style="color: #66cc66;">&gt;&lt;</span>/td<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>td<span style="color: #66cc66;">&gt;&lt;</span>span style=<span style="color: #483d8b;">&quot;font-size:.875em;&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> review.<span style="color: black;">submit_date</span>|timesince <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span> ago<span style="color: #66cc66;">&lt;</span>/span<span style="color: #66cc66;">&gt;&lt;</span>/td<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>strong<span style="color: #66cc66;">&gt;&lt;</span>td<span style="color: #66cc66;">&gt;</span>Total of <span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> review.<span style="color: black;">score</span>|default:<span style="color: #ff4500;">0</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span> <span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> review.<span style="color: black;">total_votes</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span> <span style="color: black;">&#123;</span><span style="color: black;">&#123;</span>  review.<span style="color: black;">total_votes</span>|pluralize:<span style="color: #483d8b;">&quot;person,people&quot;</span> <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span>.<span style="color: #66cc66;">&lt;</span>/td<span style="color: #66cc66;">&gt;&lt;</span>/strong<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>/tr<span style="color: #66cc66;">&gt;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endfor <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span></pre></td></tr></table></div>

<p>Hope y&#8217;all learned something like I did! <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Oh, and before I forget my standard disclaimer, &#8220;since this is on my blog, feel free to take/use/steal/distribute/copy/modify any code you see fit, but if you find any bugs, have any comments, or think the code can be cleaner, Iâ€™d love to hear from you.&#8221;</p>
<h2>Enjoy!</h2>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=136&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2007/10/24/using-the-extra-queryset-modifier-in-django-for-wegoeat/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>How to tie your tie (like a Merovingian).</title>
		<link>http://blog.localkinegrinds.com/2007/03/30/how-to-tie-your-tie-like-a-merovingian/</link>
		<comments>http://blog.localkinegrinds.com/2007/03/30/how-to-tie-your-tie-like-a-merovingian/#comments</comments>
		<pubDate>Fri, 30 Mar 2007 19:43:42 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[geeky]]></category>
		<category><![CDATA[how-to-tie-a-tie]]></category>
		<category><![CDATA[how-to-tie-a-tie-like-a-Merovingian]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[matrix-reloaded]]></category>
		<category><![CDATA[Merovingian]]></category>
		<category><![CDATA[nerdy]]></category>
		<category><![CDATA[tie]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/03/30/how-to-tie-your-tie-like-a-merovingian/</guid>
		<description><![CDATA[Update (7/6/2009): Check the comments as Scott has provided an excellent link to a breakdown of the Merovingian&#8217;s various ties from the Matrix series! I&#8217;ve always wondered how the Merovingian in the Matrix tied his tie. It&#8217;s bothered me for years&#8230; I guess it&#8217;s that attention to detail that keeps me up coding at 2am [...]]]></description>
			<content:encoded><![CDATA[<h3>Update (7/6/2009):</h3>
<p>Check the comments as Scott has provided an <a href="http://xirdal.lmu.de/cgi-bin/blosxom.cgi/2008/06/13">excellent link</a> to a breakdown of the Merovingian&#8217;s various ties from the Matrix series!</p>
<hr/>
<p>I&#8217;ve always wondered how the <a href="http://en.wikipedia.org/wiki/Merovingian_(The_Matrix)">Merovingian</a> in the <a href="http://en.wikipedia.org/wiki/The_Matrix_%28series%29">Matrix</a> tied his tie.  It&#8217;s bothered me for years&#8230; I guess it&#8217;s that attention to detail that keeps me up coding at 2am in the morning. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And then (as if through divine intervention) I was sent this video link on <a href="http://www.youtube.com">youtube</a>&#8230;</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/YA-n2xkYX6s"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/YA-n2xkYX6s" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></p>
<h2 style="margin-top:1em; margin-bottom:1em;">Yes, I know&#8230; I&#8217;m a nerd. (But you still love me)</h2>
<hr />
<p><strong>Update:</strong>  As Rudy commented, in the Matrix, the tie is actually &#8216;backwards&#8217;.  Apparently, there are nerdier people out there than me because I totally forgot about that detail. <img src='http://blog.localkinegrinds.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<h2 style="margin-top:1em; margin-bottom:1em;">Thanks Rudy!</h2>
<p>In any case, a link was conveniently provided&#8230; (<em>though, personally, I still like the other video</em>.)</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/1tVqtnM8izE"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/1tVqtnM8izE" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></p>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=101&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2007/03/30/how-to-tie-your-tie-like-a-merovingian/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>My Dreamhost + Django + Subversion Setup</title>
		<link>http://blog.localkinegrinds.com/2007/03/29/my-dreamhost-django-subversion-setup/</link>
		<comments>http://blog.localkinegrinds.com/2007/03/29/my-dreamhost-django-subversion-setup/#comments</comments>
		<pubDate>Thu, 29 Mar 2007 12:13:22 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[development-setup]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[http://www.wegoeat.com]]></category>
		<category><![CDATA[post-commit-hook]]></category>
		<category><![CDATA[restaurants]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wegoeat]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/2007/03/29/my-dreamhost-django-subversion-setup/</guid>
		<description><![CDATA[Since I haven&#8217;t put out a technical article in a while, this blog will explain how I&#8217;ve setup Dreamhost + Django + Subversion to play nicely together in a seamless development environment via a shared hosting provider. Hopefully &#8211; someone, somewhere can find this information useful and insightful in their own development environment. The very [...]]]></description>
			<content:encoded><![CDATA[<p>Since I haven&#8217;t put out a technical article in a while, this blog will explain how I&#8217;ve setup <a href="http://www.dreamhost.com">Dreamhost</a> + <a href="http://www.djangoproject.com">Django</a> + <a href="http://subversion.tigris.org/">Subversion</a> to play nicely together in a seamless development environment via a shared hosting provider.  Hopefully &#8211; someone, somewhere can find this information useful and insightful in their own development environment.</p>
<p>The very first thing I did was unleash my first <a href="http://www.djangoproject.com/">Django</a> web application on <a href="http://www.dreamhost.com">Dreamhost</a>.  Thanks to an excellent tutorial from <a href="http://www2.jeffcroft.com/blog/2006/may/11/django-dreamhost/">Jeff Croft</a>, a detailed explanation about <a href="http://www.djangoproject.com/documentation/fastcgi/">FastCGI contained within the Django documentation</a>, and a few helpful pointers on the <a href="http://wiki.dreamhost.com/index.php/Django">Dreamhost wiki</a>, I was able to get my application deployed in a matter of a few hours.</p>
<h2>You can check it out <a href="http://www.wegoeat.com/">here</a>!</h2>
<p>However, after going through Jeff&#8217;s excellent tutorial, I still wasn&#8217;t completely satisfied with my Django deployment on Dreamhost.  <em>Something was missing</em>.  There wasn&#8217;t a seamless way to continue development on my home machine, deploy to a test environment, and still keep <a href="http://www.wegoeat.com">my live site</a> intact.  After all, I&#8217;m a true believer in the open source dictum of  &#8216;<em>release early, release often</em>&#8216;, and without a way to test my application on a live server, I wasn&#8217;t happy with my configuration management.</p>
<p>Ideally, I envisioned having a live web application (i.e. <a href="http://www.wegoeat.com">http://www.wegoeat.com/</a>) and another url that I could deploy my beta releases to (i.e. <a href="http://beta.wegoeat.com">http://beta.wegoeat.com/</a>).  From a configuration management standpoint, I would tag major release builds and to maintain that release over its life (via bug fixes, minor enhancements), I would create a branch of the tag.  Thus, the live site would be updated from the branches directory, while the beta url would update from the trunk in my Subversion repository.  So to summarize the &#8216;extra&#8217; steps I did to ensure a smoother deployment cycle, I&#8217;ve conjured up the following action list.</p>
<ol>
<li>The very first thing I did was follow <a href="http://www2.jeffcroft.com/blog/2006/may/11/django-dreamhost/">Jeff&#8217;s tutorial</a> &#8211; instead of creating a single directory in my django_projects directory, I created two.  One was named &#8216;project_live&#8217; and the other &#8216;project_beta&#8217;.</li>
<li>Next, I checked out the appropriate source files from the appropriate locations in my Subversion repository.  The &#8216;project_live&#8217; directory came from my branches directory and represents my &#8216;live&#8217; site.  The &#8216;project_beta&#8217; directory came from the trunk and represents my &#8216;beta&#8217; site.  Obviously, the settings.py file for the Django applications as well as the configuration files for FastCGI were different according to the directories.  Since my settings will probably be very different then your settings, I&#8217;ll leave this as an exercise to the reader.</li>
<li>Note, as far as Dreamhost goes, I created two domain entries, one @ <a href="http://www.wegoeat.com">http://www.wegoeat.com</a> that will host my live site, and another @ <a href="http://beta.wegoeat.com">http://beta.wegoeat.com</a> that will be my beta site.</li>
<li>I followed <a href="http://blog.localkinegrinds.com/2006/12/15/dreamhost-subversion-post-commit-tutorial/">my own tutorial</a> and created a post-commit hook to update the appropriate Dreamhost directories when I committed to the repository.</li>
</ol>
<h2 style="margin-top:1em;">And voila!  We&#8217;re done.</h2>
<p>Now, I can develop on my home machine where I&#8217;ve checked out the trunk of my Subversion repository.  Whenever I commit, the post-commit hook updates the project_beta directory on my Dreamhost account, and all the while, <a href="http://www.wegoeat.com">my live site</a> is still functioning.</p>
<p>Stay tuned for my next blog where I discuss how to get <a href="http://wiki.dreamhost.com/index.php/Installing_PHP5#Custom_PHP_5">Custom PHP</a> + <a href="www.mediawiki.org/">MediaWiki</a> + <a href="http://www.eaccelerator.net/">EAccelerator</a> playing nicely together on Dreamhost!</p>
<p><!--adsense--></p>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=96&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2007/03/29/my-dreamhost-django-subversion-setup/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8220;The Real Mr. Kanno&#8221; Presents : How To Change Your Car Battery</title>
		<link>http://blog.localkinegrinds.com/2006/11/02/how-to-change-your-car-battery/</link>
		<comments>http://blog.localkinegrinds.com/2006/11/02/how-to-change-your-car-battery/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 08:01:35 +0000</pubDate>
		<dc:creator>ryankanno</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[battery]]></category>
		<category><![CDATA[car]]></category>
		<category><![CDATA[dad]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[kanno]]></category>
		<category><![CDATA[rodney]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.localkinegrinds.com/2006/11/02/how-to-change-your-car-battery/</guid>
		<description><![CDATA[As a child, I always thought of my dad as the ultimate source of knowledge. His head was incessantly buried in the newspaper solving the daily Jumble and crossword puzzle. To this day, whenever anything is amiss in my life &#8211; whether the toilet isn&#8217;t flushing, my car&#8217;s clutch is slipping, or I need to [...]]]></description>
			<content:encoded><![CDATA[<p>As a child, I always thought of my dad as the ultimate source of knowledge.  His head was incessantly buried in the newspaper solving the daily <a href="http://www.jumble.com/play.html">Jumble</a> and <a href="http://www.freecrosswords.org/">crossword puzzle</a>.  To this day, whenever anything is amiss in my life &#8211; whether the toilet isn&#8217;t flushing, my car&#8217;s clutch is slipping, or I need to hang a painting &#8211; the phone call to my father is always first on my list.  </p>
<p>Over the years, I&#8217;ve come to realize that no matter how many academic accolades I achieve &#8211; I&#8217;ll never know as much as my dad.  Don&#8217;t get me wrong, my years of schooling has educated me quite a bit&#8230; on discrete and differential calculus, complex algorithmic analysis, and other such (<em>useless</em>) topics.  All my years of education didn&#8217;t teach me the most important lessons of them all&#8230; simple life lessons.  </p>
<p>I&#8217;ve realized that I need to start capturing and documenting my father&#8217;s knowledge &#8211; before it skips my generation.  So without further adieu, I present to you, the first in a short series of &#8220;How To&#8217;s&#8221; featuring the &#8220;OG Mr. Kanno&#8221; aka my dad&#8230; <strong>Enjoy!</strong><br/><br/></p>
<div style="text-align:center;"><span style="font-weight:bold; font-size:1.2em; background-color:#e9edf2; padding:.25em 1em; border-top:1px solid black;border-bottom:1px solid black;">How To Change Your Car Battery</span ><br/>
<p>(<em>and save some <a href="http://www.urbandictionary.com/define.php?term=dollabill">dolla-dolla bills</a>!</em>)</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/IX4RB4LVQpo"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/IX4RB4LVQpo" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></div>
<p><br/></p>
<img src="http://blog.localkinegrinds.com/?ak_action=api_record_view&id=33&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.localkinegrinds.com/2006/11/02/how-to-change-your-car-battery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: blog.localkinegrinds.com @ 2012-02-07 20:33:48 -->
