<?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/"
	>

<channel>
	<title>Blog - ShiftEleven</title>
	<atom:link href="http://shifteleven.com/feed" rel="self" type="application/rss+xml" />
	<link>http://shifteleven.com</link>
	<description>Web Development Experiences and Opinions</description>
	<pubDate>Mon, 22 Sep 2008 11:06:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7-almost-beta-9300</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Converting ERB to HAML snippet</title>
		<link>http://shifteleven.com/articles/2008/06/08/converting-erb-to-haml-snippet</link>
		<comments>http://shifteleven.com/articles/2008/06/08/converting-erb-to-haml-snippet#comments</comments>
		<pubDate>Sun, 08 Jun 2008 22:45:39 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Ruby off Rails]]></category>

		<category><![CDATA[erb]]></category>

		<category><![CDATA[haml]]></category>

		<category><![CDATA[merb]]></category>

		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=80</guid>
		<description><![CDATA[I&#8217;m playing around with merb, so I&#8217;m using merb-gen to create some basic scaffolding; however, I&#8217;m not using ERB, the default rendering engine, I want to use haml.  

Haml comes with a script, html2haml, which can take HTML with ERB and convert it nicely to haml.  Seeing as I would have to run [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m playing around with <a href="http://merbivore.com/features.html">merb</a>, so I&#8217;m using <code>merb-gen</code> to create some basic scaffolding; however, I&#8217;m not using <span class="caps">ERB, </span>the default rendering engine, I want to use <a href="http://haml.hamptoncatlin.com/">haml</a>.  </p>

<p>Haml comes with a script, <code>html2haml</code>, which can take <span class="caps">HTML </span>with <span class="caps">ERB </span>and convert it nicely to haml.  Seeing as I would have to run that command more than once, I have a little command snippet that I like to use to aid with the conversion.</p>



<pre name="code" class="bash">
$ find . -name '*erb' | \
xargs ruby -e 'ARGV.each { |i| puts &quot;html2haml -r #{i} #{i.sub(/erb$/,&quot;haml&quot;)}&quot;}'
</pre>



<p>That will print out what the <code>html2haml</code> commands would be, it does <strong>not</strong> run the command.  I do that step such that I can review what will be converted.  If I like what&#8217;s going to be done, then I just run that command and pipe it into bash&#8230;like so</p>



<pre name="code" class="bash">
$ find . -name '*erb' | \
xargs ruby -e 'ARGV.each { |i| puts &quot;html2haml -r #{i} #{i.sub(/erb$/,&quot;haml&quot;)}&quot;}' | \
bash
</pre>



<p>If you like it, it probably wouldn&#8217;t hurt storing that as a shell script somewhere <img src='http://shifteleven.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/06/08/converting-erb-to-haml-snippet/feed</wfw:commentRss>
		</item>
		<item>
		<title>Code Reviews - Inherit in Git</title>
		<link>http://shifteleven.com/articles/2008/05/17/code-reviews-inherit-in-git</link>
		<comments>http://shifteleven.com/articles/2008/05/17/code-reviews-inherit-in-git#comments</comments>
		<pubDate>Sat, 17 May 2008 23:48:30 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Version Control]]></category>

		<category><![CDATA[codereview]]></category>

		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=77</guid>
		<description><![CDATA[Code Reviews are common in software development.  One programmer reviews another&#8217;s code to find potential issues or to see if the developer could have used something that the system already provided.

With multiple programmers, you can probably expect a versioning system, perhaps a centralized versioning system like SVN or Perforce.  With that system, each [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Code_review">Code Reviews</a> are common in software development.  One programmer reviews another&#8217;s code to find potential issues or to see if the developer could have used something that the system already provided.</p>

<p>With multiple programmers, you can probably expect a versioning system, perhaps a centralized versioning system like <span class="caps">SVN </span>or Perforce.  With that system, each programmer would make his/her changes and then would check in his/her changes into the repository.  From there, the programmer&#8217;s peers would review the code.</p>

<p>What&#8217;s the problem with this system?  The code is already checked in.  The pressure is on the peers to ensure that the code is good, and it&#8217;s likely that this could slip through the cracks.  I mean, those peers are working on getting 10 features complete themselves.</p>

<h2>Enter Git</h2>

<p>Well, I would argue that Git has a strong code review process built right in.  This is due to the process of how distributed version control works.</p>

<p><span id="more-77"></span></p>

<p>Programmer <strong>A</strong> creates a <a href="http://railsontherun.com/2008/3/3/how-to-use-github-and-submit-a-patch">fork</a> of the master project.  <strong>A</strong> makes his changes and commit his code; however, the code is committed to his local repository and not the master origin.  This is because <strong>A</strong> does not have write access to that repository.  </p>

<p><strong>A</strong> has to contact programmer <strong>B</strong>, who has write access.  <strong>A</strong> tells <strong>B</strong> that he should pull his code.  Since <strong>B</strong> has to pull the code, this means that <strong>B</strong> has to review the code coming in.</p>

<p>It&#8217;s this workflow that promotes code review.  Now that&#8217;s not to say that you can&#8217;t do code reviews in a centralized model, it just fits a little better in a distributed model</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/05/17/code-reviews-inherit-in-git/feed</wfw:commentRss>
		</item>
		<item>
		<title>Issue Tracking + Git = ticgit</title>
		<link>http://shifteleven.com/articles/2008/05/10/issue-tracking-git-ticgit</link>
		<comments>http://shifteleven.com/articles/2008/05/10/issue-tracking-git-ticgit#comments</comments>
		<pubDate>Sun, 11 May 2008 00:08:53 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Version Control]]></category>

		<category><![CDATA[fork]]></category>

		<category><![CDATA[git]]></category>

		<category><![CDATA[issuetracker]]></category>

		<category><![CDATA[sinatra]]></category>

		<category><![CDATA[ticgit]]></category>

		<category><![CDATA[ticgit-watchtower]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=73</guid>
		<description><![CDATA[So not only is git useful for the small projects, it&#8217;s also good for keeping track of todos and issues.  Ticgit is a distributed ticketing systems based on git.   It provides a command line interface as well as a web interface via sinatra and stores all of the ticket info in a [...]]]></description>
			<content:encoded><![CDATA[<p>So not only is <a href="http://shifteleven.com/articles/2008/04/30/version-control-isnt-for-just-the-big-projects">git useful for the small projects</a>, it&#8217;s also good for keeping track of todos and issues.  <a href="http://github.com/schacon/ticgit">Ticgit</a> is a distributed ticketing systems based on git.   It provides a command line interface as well as a web interface via <a href="http://sinatrarb.com">sinatra</a> and stores all of the ticket info in a separate branch, called <code>ticgit</code>.  Rather clever I think.</p>

<p><span id="more-73"></span></p>

<p>Ticgit takes a simplistic approach to issue tracking as <a href="http://www.lighthouseapp.com">Lighthouse</a> has done.  You can comment, add tags, manage the state of an issue, save views, and change to whom an issue is assigned.  There is still more planned, like keeping track of milestones and syncing the tickets to Lighthouse.</p>

<p>As mentioned, there is a web interface to ticgit; however, it wasn&#8217;t my cup of tea.  So I have started my own web interface, <a href="http://github.com/pope/ticgit-watchtower">tiwatchtower</a>.  It&#8217;s still a little rough around the edges, but I would love to hear any thoughts.</p>

<h2>Conclusion</h2>

<p>So far, I like it and it&#8217;s exciting to see how git can be pushed.  It&#8217;s great for keeping track of things that are on my mind without worrying about having to setup <a href="http://trac.edgewall.org/">trac</a> or having to use up a Lighthouse project.  It&#8217;s simple, effective, and worth a look at.</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/05/10/issue-tracking-git-ticgit/feed</wfw:commentRss>
		</item>
		<item>
		<title>Version Control Isn&#8217;t for Just the Big Projects</title>
		<link>http://shifteleven.com/articles/2008/04/30/version-control-isnt-for-just-the-big-projects</link>
		<comments>http://shifteleven.com/articles/2008/04/30/version-control-isnt-for-just-the-big-projects#comments</comments>
		<pubDate>Wed, 30 Apr 2008 13:37:01 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Version Control]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[git]]></category>

		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=69</guid>
		<description><![CDATA[We know that when you are working with a bunch of developers for code that&#8217;s going to be deployed to the world that version control is something that you want in your toolbox.  I would like to submit that it&#8217;s not the only reason to use source control.

I bought a Flex book to, well, [...]]]></description>
			<content:encoded><![CDATA[<p>We know that when you are working with a bunch of developers for code that&#8217;s going to be deployed to the world that version control is something that you want in your toolbox.  I would like to submit that it&#8217;s not the only reason to use source control.</p>

<p>I bought a <a href="http://www.amazon.com/Adobe-Flex-3-Training-Source/dp/0321529189">Flex book</a> to, well, teach myself Flex.  The book right now is taking me though one application and is building it out piece by piece.  So I began to think: &#8220;What if I just keep track of all my changes through git?&#8221;</p>

<p>For one, Flex is nice because it&#8217;s all <span class="caps">XML, </span>so that makes revision tracking fairly easy.  Also, git is very easy to get started because you don&#8217;t have to do any server setup.  Just issue a <code>git init</code> command and get going.  Then after each chapter, I can tag the repository for posterity&#8217;s sake.  And I have to say, it&#8217;s been great to see how the code has changes, especially since <a href="http://www.adobe.com/products/flex/">Flex Builder</a> generates code.</p>

<p>That&#8217;s one thing I love about git, and mercurial, it&#8217;s so easy to start using version control for even the littlest of tasks.</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/04/30/version-control-isnt-for-just-the-big-projects/feed</wfw:commentRss>
		</item>
		<item>
		<title>Making ActiveRecord faster by NOT indexing</title>
		<link>http://shifteleven.com/articles/2008/04/29/making-activerecord-faster-by-not-indexing</link>
		<comments>http://shifteleven.com/articles/2008/04/29/making-activerecord-faster-by-not-indexing#comments</comments>
		<pubDate>Tue, 29 Apr 2008 16:55:14 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[ActiveRecord]]></category>

		<category><![CDATA[indexing]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[performance]]></category>

		<category><![CDATA[singletableinheritance]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=64</guid>
		<description><![CDATA[Usually one of the first things I read about on how to speed up ActiveRecord is to index my columns to speed up the lookup of items.  &#8220;Of course!&#8221;  But could indexing too much be harmful?

Essentially, if your column is an enum, then indexing it could actually cause MySQL to do more work. [...]]]></description>
			<content:encoded><![CDATA[<p>Usually one of the first things I read about on how to speed up ActiveRecord is to index my columns to speed up the lookup of items.  &#8220;Of course!&#8221;  <a href="http://www.mysqlperformanceblog.com/2007/08/28/do-you-always-need-index-on-where-column/">But could indexing too much be harmful</a>?</p>

<p>Essentially, if your column is an enum, then indexing it could actually cause MySQL to do more work.  Why?  Because the data set is so large, the MySQL ends up doing a full scan.  So things like keeping track if something is active (1 or 0) then you can expect indexing to hurt.</p>

<p>So how does this effect ActiveRecord?  Well, if you&#8217;re keeping track of whether a user is active or not you would not want to index that column alone.  Nor would you want to index a <code>type</code> column if you were using single table inheritance, again, because there isn&#8217;t a lot of variance in the type.</p>

<p>So make sure that you index the right things, like IDs and leave the enum-like columns alone.</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/04/29/making-activerecord-faster-by-not-indexing/feed</wfw:commentRss>
		</item>
		<item>
		<title>Adobe, Are you kidding me?</title>
		<link>http://shifteleven.com/articles/2008/04/23/adobe-are-you-kidding-me</link>
		<comments>http://shifteleven.com/articles/2008/04/23/adobe-are-you-kidding-me#comments</comments>
		<pubDate>Thu, 24 Apr 2008 01:17:12 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[defect]]></category>

		<category><![CDATA[photoshop]]></category>

		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=54</guid>
		<description><![CDATA[So there I am, wanting to install Photoshop on my laptop, which happens be a Mac with Leopard installed when I see this lovely message:





So what does &#8220;This software cannot be installed because the file system of the OS volume is not supported&#8221; even mean???!?!  I tell you what it means, it means that [...]]]></description>
			<content:encoded><![CDATA[<p>So there I am, wanting to install Photoshop on my laptop, which happens be a Mac with Leopard installed when I see this lovely message:</p>

<p><img src="http://shifteleven.com/wp-content/uploads/2008/04/picture-1.png" alt="System Requirements Error" title="System Requirements Error" width="500" height="233" class="alignnone size-full wp-image-53" /></p>

<p><span id="more-54"></span></p>

<p>So what does &#8220;This software cannot be installed because the file system of the OS volume is not supported&#8221; even mean???!?!  I tell you what it means, <a href="http://blogs.adobe.com/jnack/2007/10/adobe_apps_on_l.html">it means that Photoshop will not run if you happened to have formatted your file system to be case sensitive</a>.  Thanks for the clear error!</p>

<p>I don&#8217;t even want to begin on how insane that sounds to me?  So what&#8217;s a person to do?</p>

<p>Well, my friend <a href="http://www.linkedin.com/in/jamesgibson">James Gibson</a> suggested that I install Photoshop in Windows and use Photoshop through <a href="http://www.vmware.com/products/fusion/">WMware</a>.  Another possibility is to <a href="http://imaginationunbound.blogspot.com/2007/12/adobe-photoshop-cs3-on-mac-os-x-case.html">rename directories to make <span class="caps">CS3 </span>work</a>.</p>

<p>I think I&#8217;m leaning towards the first option as some people are having some issues with the renaming method.  Either way, it&#8217;s kinda lame.</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/04/23/adobe-are-you-kidding-me/feed</wfw:commentRss>
		</item>
		<item>
		<title>A Tip For People using Google Code and the Issue Tracker</title>
		<link>http://shifteleven.com/articles/2008/04/12/a-tip-for-people-using-google-code-and-the-issue-tracker</link>
		<comments>http://shifteleven.com/articles/2008/04/12/a-tip-for-people-using-google-code-and-the-issue-tracker#comments</comments>
		<pubDate>Sun, 13 Apr 2008 01:12:57 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[appengine]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[goole]]></category>

		<category><![CDATA[issuetracker]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=49</guid>
		<description><![CDATA[If you are using Google Code, and let&#8217;s say that you want an issue addressed, like having ruby supported in GAE.  Please, Please, PLEASE, use the star voting and avoid making comments that are simply &#8220;+1&#8243;.  The more stars a defect has, the more attention it has, not the number of comments and [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using Google Code, and let&#8217;s say that you want an issue addressed, like <a href="http://code.google.com/p/googleappengine/issues/detail?id=29" title="Google App Engine">having ruby supported in <span class="caps">GAE</span></a>.  Please, Please, <span class="caps">PLEASE, </span>use the star voting and avoid making comments that are simply &#8220;+1&#8243;.  The more stars a defect has, the more attention it has, not the number of comments and especially the number of &#8220;+1&#8243;s.</p>

<p>Actually, you <strong>hurt</strong> the initiative to get an issue addressed when you make those comments.  You see, when you star an issue, you receive emails when that issue gets updated or commented upon.  So if an issue has 100 or so &#8220;+1&#8243; comments, then whoever put a star on that defect is going to get 100 or so emails.  After getting 20 inane emails, one might decide to remove the star from the issue, thus lowering it&#8217;s rating and hurting the campaign.</p>

<p>So please, if you want to help, just star the issue.</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/04/12/a-tip-for-people-using-google-code-and-the-issue-tracker/feed</wfw:commentRss>
		</item>
		<item>
		<title>Problem with writing RESTful Google App Engine Code</title>
		<link>http://shifteleven.com/articles/2008/04/12/problem-with-writing-restful-google-app-engine-code</link>
		<comments>http://shifteleven.com/articles/2008/04/12/problem-with-writing-restful-google-app-engine-code#comments</comments>
		<pubDate>Sat, 12 Apr 2008 23:57:07 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[appengine]]></category>

		<category><![CDATA[defect]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[restful]]></category>

		<category><![CDATA[webob]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=48</guid>
		<description><![CDATA[So after I used middleware to make browsers work with RESTful URLs in GAE, I started to write more than simple little methods and I&#8217;m trying to write a test application.  Upon doing so, I ran into a defect with how request parameters are returned for a PUT request.  To be fair, this [...]]]></description>
			<content:encoded><![CDATA[<p>So after I used middleware to <a href="http://shifteleven.com/articles/2008/04/08/letting-browsers-use-all-of-the-methods-in-google-app-engine" title="Google App Engine">make browsers work with <span class="caps">REST</span>ful <span class="caps">URL</span>s in <span class="caps">GAE</span></a>, I started to write more than simple little methods and I&#8217;m trying to write a test application.  Upon doing so, I ran into a <a href="http://code.google.com/p/googleappengine/issues/detail?id=170">defect with how request parameters are returned for a <span class="caps">PUT </span>request</a>.  To be fair, this is more of a problem with <a href="http://pythonpaste.org/webob/">webob</a> than with <span class="caps">GAE, </span>but I hope that this gets fixed because my attempts at <a href="http://mail.python.org/pipermail/python-dev/2008-January/076194.html">monkey patching</a> the problem have not worked out too well.</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/04/12/problem-with-writing-restful-google-app-engine-code/feed</wfw:commentRss>
		</item>
		<item>
		<title>Letting Browsers use all of the RESTful Methods in Google App Engine</title>
		<link>http://shifteleven.com/articles/2008/04/08/letting-browsers-use-all-of-the-methods-in-google-app-engine</link>
		<comments>http://shifteleven.com/articles/2008/04/08/letting-browsers-use-all-of-the-methods-in-google-app-engine#comments</comments>
		<pubDate>Wed, 09 Apr 2008 02:45:05 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[appengine]]></category>

		<category><![CDATA[browsers]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[middleware]]></category>

		<category><![CDATA[rack]]></category>

		<category><![CDATA[restful]]></category>

		<category><![CDATA[wsgi]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=46</guid>
		<description><![CDATA[So there was much talk and whathave you about Google&#8217;s new App Engine, and after viewing the tutorials and reading the documentation, I thought it was pretty rad too.  Because I was using rack for some previous stuff, WSGI felt right at home (probably because rack was modeled after WSGI).  There was one [...]]]></description>
			<content:encoded><![CDATA[<p>So there was much talk and whathave you about Google&#8217;s new <a href="http://code.google.com/appengine/">App Engine</a>, and after viewing the tutorials and reading the documentation, I thought it was pretty rad too.  Because I was using <a href="http://rack.rubyforge.org/">rack</a> for some previous stuff, <a href="http://www.wsgi.org/"><span class="caps">WSGI</span></a> felt right at home (probably because rack was modeled after <span class="caps">WSGI</span>).  There was one thing that bothered me however.  When writing a class using their <a href="http://code.google.com/appengine/docs/webapp/">webapp framework</a> there isn&#8217;t any magic param name, like <code>_method</code>, that I could use to mock requests methods like <code>DELETE</code> and <code>PUT</code> since the browser doesn&#8217;t support those <span class="caps">HTTP </span>methods.</p>

<p>Well my friends, fear not.  If you enjoy the sweet freedom of <span class="caps">REST</span>ful urls, I&#8217;m here to help.  Since this is all built on top of <span class="caps">WSGI, </span>we can create a some new Middleware to sit before the application to resolve this little issue.</p>

<p><span id="more-46"></span></p>

<h2> MockHTTPMethodMiddleware</h2>



<pre name="code" class="python">
from google.appengine.ext import webapp

class MockHTTPMethodMiddleware(object):
  def __init__(self, app):
    self.app = app

  def __call__(self, environ, start_response):
    method = webapp.Request(environ).get('_method')
    if method:
      environ['REQUEST_METHOD'] = method.upper()
    return self.app(environ, start_response)
</pre>



<p>The code is pretty simple.  So when this middleware is called, it processes the <code>environ</code> into a <code>Request</code> object.  From there, I just inspect the params for a key called <code>_method</code>.  If that param exists, then it overwrites the <code>REQUEST_METHOD</code> and bam&#8230;we have mocked the <span class="caps">HTTP </span>method of our choosing.</p>

<h2>Putting that code to good use</h2>

<p>Let&#8217;s pretend that this is our class is something inane like this:</p>



<pre name="code" class="python">
from google.appengine.ext import webapp

class MethodTest(webapp.RequestHandler):
  def get(self):
    self.response.headers[&quot;Content-Type&quot;] = 'text/text'
    self.response.out.write(&quot;Get&quot;)
  
  def put(self):
    self.response.headers[&quot;Content-Type&quot;] = 'text/text'
    self.response.out.write(&quot;Put&quot;)
</pre>



<p>So now when you are writing your <code>main</code> method that creates the <span class="caps">WSGI </span>application, you would write it something like:</p>



<pre name="code" class="python">
import wsgiref.handlers

def main():
  app = webapp.WSGIApplication(
      [('/', MethodTest)], 
      debug=True)
  wsgiref.handlers.CGIHandler().run(MockHTTPMethodMiddleware(app))

if __name__ == &quot;__main__&quot;:
  main()
</pre>



<p>Notice that in the run method arguments, <code>MockHTTPMethodMiddleware</code> takes <code>app</code> as a parameter, thus <code>MockHTTPMethodMiddleware</code> will run before it runs <code>app</code>.</p>

<h2>Conclusion</h2>

<p>While there wasn&#8217;t support out of the box for mocking <span class="caps">HTTP </span>methods for browsers, with a little help from a <span class="caps">WSGI</span> Middleware class, it&#8217;s not too hard to add that functionality in, nor is it hard to add anything else you would want to use.</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/04/08/letting-browsers-use-all-of-the-methods-in-google-app-engine/feed</wfw:commentRss>
		</item>
		<item>
		<title>Installing PostgreSQL on Leopard using MacPorts</title>
		<link>http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports</link>
		<comments>http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports#comments</comments>
		<pubDate>Sat, 22 Mar 2008 03:41:36 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[installation]]></category>

		<category><![CDATA[leopard]]></category>

		<category><![CDATA[macports]]></category>

		<category><![CDATA[pgadmin3]]></category>

		<category><![CDATA[postgresql]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=43</guid>
		<description><![CDATA[I have always used MySQL, but I wanted to give PostgreSQL a whirl.  This is what I did.



Prerequisites

Now I don&#8217;t want to go too deep into this, so I&#8217;m going to assume that if you are reading this, that you have the following installed



Mac OS Developer&#8217;s Tools
MacPorts
Ruby (comes with Leopard)

Ruby Gems (also comes with [...]]]></description>
			<content:encoded><![CDATA[<p>I have always used <a href="http://www.mysql.com/">MySQL</a>, but I wanted to give <a href="http://www.postgresql.org/">PostgreSQL</a> a whirl.  This is what I did.</p>

<p><span id="more-43"></span></p>

<h2>Prerequisites</h2>

<p>Now I don&#8217;t want to go too deep into this, so I&#8217;m going to assume that if you are reading this, that you have the following installed</p>


<ul>
<li><a href="http://developer.apple.com/tools/">Mac OS Developer&#8217;s Tools</a></li>
<li><a href="http://www.macports.org/install.php">MacPorts</a></li>
<li><a href="http://www.ruby-lang.org/">Ruby</a> (comes with Leopard)
<ul>
<li><a href="http://www.rubygems.org/">Ruby Gems</a> (also comes with Leopard)</li>
</ul>
</li>
</ul>



<h2>Installation</h2>

<p>So now that you have all of those dependencies out of the way, let&#8217;s get to installing us some PostgreSQL.</p>

<h3>PostgreSQL</h3>

<p>To install the database software, simply run the following command in <a href="http://www.apple.com/macosx/technology/unix.html">Terminal</a></p>



<pre name="code">
sudo port install \
  postgresql83 \
  postgresql83-server
</pre>



<p>This will install the client and server needed for you to run this on your machine.  Now pay special attention to the installation script.  At the end of installation processes, macports will display a message for you that contains some commands for you to get started with.</p>

<h4>Configuration</h4>

<p>First, execute these lines of code.  This will setup a new database for you to play with</p>



<pre name="code">
sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'
</pre>



<h4>Start PostgreSQL Automatically</h4>

<p>By running the next command, you can have PostgreSQL lunch automatically so that it&#8217;s always available to you</p>



<pre name="code">
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist
</pre>



<h3>pgAdmin <span class="caps">III</span></h3>

<p><a href="http://www.pgadmin.org/">pgAdmin <span class="caps">III</span></a> is a PostgreSQL management and administrations piece of software.  It&#8217;s a nice <span class="caps">GUI </span>to some things that you may find yourself wanting to do, like created databases and whatnot.  Installation of this is pretty cake.</p>



<pre name="code">
sudo port install pgAdmin3
</pre>



<p>Upon completion of installation, you can find the application in <code>/Applications/MacPorts/pgAdmin3</code></p>

<h3>PostgreSQL Libraries for Ruby via Gems</h3>

<p>I have to admit, the previous installation steps were nothing to cry about; however, it was this step that made me want to put together this little walkthrough.</p>



<pre name="code">
sudo env ARCHFLAGS=&quot;-arch i386&quot; \
  gem install postgres -- \
  --with-pgsql-lib=/opt/local/lib/postgresql83 \
  --with-pgsql-include=/opt/local/include/postgresql83
</pre>



<p>That&#8217;s not exactly your everyday <code>gem install</code> command.  For one, the environment variable <code>ARCHFLAGS</code> has to be set.  Secondly, the <code>gem</code> command needs to know where the PostgreSQL  libraries and include headers are so that it can compile.  Looking back, it&#8217;s actually quite easy to copy and paste that command, it just took me a while to find out exactly what I needed to make it work.</p>

<h2>Fin</h2>

<p>Well, I hope that helps anyone looking to install and setup PostgreSQL in Leopard.  Until next time&#8230;</p>]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
