<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>Scott Tesoriere</title>
	<link href="http://tesoriere.com/atom.xml" rel="self"/>
	<link href="http://tesoriere.com/"/>
	<updated>2012-05-15T21:26:17+02:00</updated>
	<id>http://tesoriere.com</id>
	<author>
		<name>Scott Tesoriere</name>
		<email>scott@tesoriere.com</email>
	</author>
	
	<entry>
		<title>Rails &#8212; A faster way for next and previous links on a post, article, or any model</title>
		<link href="http://tesoriere.com/2012/01/12/rails--next-and-previous-links-for-a-post--article--or-any-model/"/>
		<updated>2012-01-12T00:00:00+01:00</updated>
		<id>http://tesoriere.com/2012/01/12/rails--next-and-previous-links-for-a-post--article--or-any-model</id>
		<content type="html">&lt;p&gt;This is a simple, but common question I come across when dealing with people learning rails, as they inevitably do a bloggish type app first.&lt;/p&gt;

&lt;h3&gt;I assume you have a model like the one below&lt;/h3&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CreateArticles&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Migration&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;change&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;create_table&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:articles&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:title&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:body&lt;/span&gt;

      &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timestamps&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;Adding the next/prev links&lt;/h3&gt;

&lt;p&gt;Personally, I prefer to add instance methods as well as a scope or a class method. Check it out below:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Article&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;id &amp;gt; ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;id ASC&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# this is the default ordering for AR&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:previous&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;id &amp;lt; ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;id DESC&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;next&lt;/span&gt;
      &lt;span class=&quot;no&quot;&gt;Article&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;previous&lt;/span&gt;
      &lt;span class=&quot;no&quot;&gt;Article&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;previous&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;#### used below to benchmark&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# scope :next_by_date, lambda {|created_at| where(&amp;quot;created_at &amp;gt; ?&amp;quot;,created_at).order(&amp;quot;created_at ASC&amp;quot;) } # this is the default ordering for AR&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# scope :previous_by_date, lambda {|created_at| where(&amp;quot;created_at &amp;lt; ?&amp;quot;,created_at).order(&amp;quot;created_at DESC&amp;quot;) }&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# def next_by_date&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#  Article.next_by_date(self.created_at).first&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# end&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# def previous_by_date&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#  Article.previous_by_date(self.created_at).first&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# end&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;How it works&lt;/h3&gt;

&lt;p&gt;If you're confused, don't be! Let's assume we have an array of article ids: &lt;code&gt;[1,2,4,6]&lt;/code&gt;. If we're looking for the next article for &lt;strong&gt;2&lt;/strong&gt;, it would obviously be &lt;strong&gt;4&lt;/strong&gt;. Programmatically, you can't just say &lt;code&gt;Article.find(id+1)&lt;/code&gt;, because it won't exist in some situations where articles are deleted.&lt;/p&gt;

&lt;p&gt;We have to find the next id above &lt;strong&gt;2&lt;/strong&gt;, hence &lt;code&gt;where(&quot;id &amp;gt; ?&quot;, id)&lt;/code&gt;. However, if you order the ids &lt;em&gt;descending&lt;/em&gt; you'll get &lt;strong&gt;6&lt;/strong&gt;, because &lt;strong&gt;6&lt;/strong&gt; is the highest in the list while still being larger than &lt;strong&gt;2&lt;/strong&gt;. Knowing that, we then sort the list &lt;em&gt;ascending&lt;/em&gt;, because &lt;strong&gt;4&lt;/strong&gt; will be first on the list when ordering &lt;em&gt;ascending&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This, of course, assumes you're using the instance methods as I did, if you used &lt;code&gt;.last&lt;/code&gt; instead, the ordering for each would be reversed.&lt;/p&gt;

&lt;h3&gt;It's slightly faster than sorting by a date, or any other field not indexed&lt;/h3&gt;

&lt;p&gt;Since you're sorting by the primary key, it should be much faster than sorting by any other field, as the primary key is usually indexed in most databases. Plus, it's computationally easier to sort an integer, however slightly.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;INSERT INTO articles (title, body, user_id, created_at) VALUES &amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100000&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; 
  &lt;span class=&quot;n&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;(&amp;#39;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;#39;,&amp;#39;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;#39;, 1, &amp;#39;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.days.ago&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;#39;)&amp;quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sql&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;,&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Benchmark&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bm&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;report&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Article&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next_by_date&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;report&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;by date: &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Article&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next_by_date&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;report&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Article&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;report&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;by id: &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Article&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;I ran each twice just incase some caching occurred, and the results were:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;      user     system      total        real
by date:   0.000000   0.000000   0.000000 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;  0.017141&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
by id:     0.000000   0.000000   0.000000 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;  0.000682&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Changing the repetition will demonstrate a linear pattern, say O(n), for finding the next by, whereas by date will demonstrate a more exponential pattern, perhaps nearing O(n&lt;sup&gt;2).&lt;/sup&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>The awkward things Siri says</title>
		<link href="http://tesoriere.com/2011/10/16/the-awkward-things-siri-says/"/>
		<updated>2011-10-16T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/10/16/the-awkward-things-siri-says</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://tesoriere.com/images/assets/2011/sirisays.png&quot; title=&quot;the shit Siri says&quot; alt=&quot;The awkward things Siri says&quot; /&gt;&lt;/p&gt;

&lt;h2&gt;A quick example of how easy nodejs easy to get up and running&lt;/h2&gt;

&lt;p&gt;I'll go into detail later, but essentially, this site uses &lt;a href=&quot;http://nodejs.org&quot;&gt;nodejs&lt;/a&gt;, &lt;a href=&quot;http://expressjs.com&quot;&gt;expressjs&lt;/a&gt;, &lt;a href=&quot;http://railwayjs.com&quot;&gt;railwayjs&lt;/a&gt;, &lt;a href=&quot;https://github.com/LearnBoost/knox&quot;&gt;knox&lt;/a&gt; for s3 uploads, a &lt;a href=&quot;https://github.com/visionmedia/connect-redis&quot;&gt;redis&lt;/a&gt; session store, and a &lt;a href=&quot;http://mongoosejs.com/&quot;&gt;mongodb&lt;/a&gt; backend via &lt;a href=&quot;http://mongoosejs.com/&quot;&gt;mongoose&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://shitsirisays.info&quot;&gt;Site&lt;/a&gt; &lt;a href=&quot;http://iactuallysaid.com&quot;&gt;can be found&lt;/a&gt; &lt;a href=&quot;http://shitsirisays.us&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Questions?&lt;/h2&gt;

&lt;p&gt;You might have some questions, and I can answer them! I'll post some how-to's soon.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Node.js &#8212; Getting oAuth Up and Running Using Express.js and Mongoose</title>
		<link href="http://tesoriere.com/2011/10/10/node.js-getting-oauth-up-and-working-using-express.js-and-railway.js/"/>
		<updated>2011-10-10T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/10/10/node.js-getting-oauth-up-and-working-using-express.js-and-railway.js</id>
		<content type="html">&lt;h2&gt;Getting Started&lt;/h2&gt;

&lt;p&gt;If you're interested in how to incorporate this into &lt;a href=&quot;http://railwayjs.com&quot;&gt;railwayjs&lt;/a&gt;, see &lt;a href=&quot;/2011/10/10/node.js-getting-oauth-running-with-railway.js/&quot;&gt;this other article&lt;/a&gt; instead. I normally use &lt;a href=&quot;http://jashkenas.github.com/coffee-script/&quot;&gt;coffeescript&lt;/a&gt;, but for the purposes of this article, I converted it to javascript. For the impatient, this project can be found &lt;a href=&quot;http://github.com/scottkf/expressjs-oauth&quot;&gt;in my github repos&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's assume our &lt;code&gt;app.js&lt;/code&gt;/&lt;code&gt;server.js&lt;/code&gt; looks like this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;express&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;hello world&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;views&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/app/views&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;view engine&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;jade&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3001&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Now, getting oAuth up and running can be easy, but you have to make sure you have &lt;a href=&quot;http://www.mongodb.org/&quot;&gt;mongodb&lt;/a&gt; up and running first, since we're using &lt;a href=&quot;https://github.com/bnoguchi/mongoose-auth&quot;&gt;mongoose-auth&lt;/a&gt;. You could very well use &lt;a href=&quot;https://github.com/bnoguchi/everyauth&quot;&gt;everyauth&lt;/a&gt;, which &lt;a href=&quot;https://github.com/bnoguchi/mongoose-auth&quot;&gt;mongoose-auth&lt;/a&gt; is based upon, though it would require a little more effort if you were to change to another database. This is pretty easy: in Ubuntu, you can just &lt;code&gt;apt-get install mongodb&lt;/code&gt;, or in osx, &lt;code&gt;brew install mongodb;&lt;/code&gt;. If you need to install &lt;a href=&quot;https://github.com/mxcl/homebrew&quot;&gt;homebrew&lt;/a&gt; for OSX, &lt;code&gt;/usr/bin/ruby -e &quot;$(curl -fsSL https://raw.github.com/gist/323731)&quot;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;Working with MongoDB&lt;/h2&gt;

&lt;p&gt;Let's connect to mongo:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;mongoose&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Schema&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Schema&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ObjectId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;SchemaTypes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ObjectId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  
&lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;mongodb://localhost/example&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;Incorporate mongoose-auth&lt;/h2&gt;

&lt;p&gt;To get this working, we have to add the following to our app.js:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;./config/oauth_providers&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UserSchema&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({})&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;mongoose-auth&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;UserSchema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;plugin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;everymodule&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;facebook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;myHostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;http://local.host:3001&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;redirectPath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;twitter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;myHostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;http://local.host:3001&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;consumerKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;twit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;consumerKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;consumerSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;twit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;consumerSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;redirectPath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;myHostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;http://local.host:3001&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;redirectPath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;User&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UserSchema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;mongodb://localhost/example&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;User&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The configuration for this file resides in a different folder, I made a &lt;code&gt;config&lt;/code&gt; folder and put the &lt;code&gt;oauth_providers.js&lt;/code&gt; file in there, it looks like this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;fb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;111565172259433&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;85f7e0a0cc804886180b887c1f04a3c1&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;twit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;consumerKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;JLCGyLzuOK1BjnKPKGyQ&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;consumerSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;GNqKfPqtzOcsCtFbGTMqinoATHvBcy1nzCTimeA9M0&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;11932f2b6d05d2a5fa18&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;2603d1bc663b74d6732500c1e9ad05b0f4013593&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;instagram&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clientId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;be147b077ddf49368d6fb5cf3112b9e0&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clientSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b65ad83daed242c0aa059ffae42feddd&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: these keypairs really shouldn't be made public, but they exist in the &lt;a href=&quot;https://github.com/bnoguchi/mongoose-auth/blob/master/example/conf.js&quot;&gt;mongoose-auth repo&lt;/a&gt;, so you can test using them. This also assumes you have something setup in /etc/hosts to map local.host to 127.0.0.1, example: &lt;code&gt;127.0.0.1    local.host&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In addition, we have to configure express a little differently:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;views&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/app/views&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;view engine&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;jade&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bodyParser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cookieParser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;secret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;secret&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;middleware&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;helpExpress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The above sets up cookies, adds a session key, hooks into mongooseAuth to the app, and exposes &lt;a href=&quot;https://github.com/bnoguchi/everyauth&quot;&gt;everyauth's routes&lt;/a&gt; to express' views.&lt;/p&gt;

&lt;h2&gt;Logging in&lt;/h2&gt;

&lt;p&gt;Now, just by visiting &lt;a href=&quot;http://local.host:3000/auth/twitter&quot;&gt;http://local.host:3000/auth/twitter&lt;/a&gt;, for example, and logging in, you'll be redirected back to the homepage. To check to make sure it's working, we have to add some views, make a folder called &lt;code&gt;views&lt;/code&gt; and place the following in it named &lt;code&gt;index.jade&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;- var &lt;span class=&quot;nv&quot;&gt;items&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;facebook&amp;quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&amp;quot;github&amp;quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&amp;quot;twitter&amp;quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&amp;quot;instagram&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
- &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;!everyauth.loggedIn&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  h2 Not Authenticated
  each item in items
   a&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/auth/&amp;#39;&lt;/span&gt; + item&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
     span Connect with &amp;lt;span &lt;span class=&quot;nv&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;text-transform: capitalize&amp;quot;&lt;/span&gt;&amp;gt;!&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;item&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;

- &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;  &lt;/span&gt;h2 Authenticated
  &lt;span class=&quot;c&quot;&gt;#user-id Logged in with `user.id` #{user.id} - aka `everyauth.user.id` #{everyauth.user.id}&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.facebook&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 Facebook User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.facebook.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.twitter&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 Twitter User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.twitter.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.github&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 GitHub User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.github.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.instagram&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 Instagram User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.instagram.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  h3
    a&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/logout&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Logout
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;And don't forget to change the route, to&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;And if you've been following, you'll see that all the twitter metadata is displayed. You're done! There's a lot of other things you can do, like being able to link each different account, whether or not to remember the user, and if anyone needs help with that, I can show you how to do it.&lt;/p&gt;

&lt;p&gt;This project can be found &lt;a href=&quot;http://github.com/scottkf/expressjs-oauth&quot;&gt;in my github repo, expressjs &amp;amp; oauth&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Node.js &#8212; Getting oAuth Up and Running Using Express.js, Railway.js and Mongoose</title>
		<link href="http://tesoriere.com/2011/10/10/node.js-getting-oauth-running-with-railway.js/"/>
		<updated>2011-10-10T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/10/10/node.js-getting-oauth-running-with-railway.js</id>
		<content type="html">&lt;h2&gt;Let's get started&lt;/h2&gt;

&lt;p&gt;If you're interested in how to incorporate this without using &lt;a href=&quot;http://railwayjs.com&quot;&gt;railwayjs&lt;/a&gt;, see &lt;a href=&quot;/2011/10/10/node.js-getting-oauth-up-and-working-using-express.js-and-railway.js/&quot;&gt;this other article&lt;/a&gt; instead.&lt;/p&gt;

&lt;p&gt;This is assuming you already have a working &lt;a href=&quot;http://railwayjs.com&quot;&gt;railwayjs&lt;/a&gt; project working. If not:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;sudo npm install railway -g
rw i blog &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;blog
npm install -l
rw g crud post title content
&lt;span class=&quot;c&quot;&gt;# make sure mongodb is running&lt;/span&gt;
rw s 3000
open http://localhost:3000/posts
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;If you need to install mongodb, it's simple. In Ubuntu, you can just &lt;code&gt;apt-get install mongodb&lt;/code&gt;, or in osx, &lt;code&gt;brew install mongodb;&lt;/code&gt;. If you need to install &lt;a href=&quot;https://github.com/mxcl/homebrew&quot;&gt;homebrew&lt;/a&gt; for OSX, &lt;code&gt;/usr/bin/ruby -e &quot;$(curl -fsSL https://raw.github.com/gist/323731)&quot;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;Setting up the environment&lt;/h2&gt;

&lt;p&gt;First things first, change your &lt;a href=&quot;https://gist.github.com/1275489&quot;&gt;package.json&lt;/a&gt; to include &lt;a href=&quot;https://github.com/bnoguchi/mongoose-auth&quot;&gt;mongoose-auth&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;railwayjs project&amp;quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;version&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;0.0.1&amp;quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;engines&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;node &amp;gt;= 0.4.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;main&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;server.js&amp;quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;jade-ext&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;jade&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 2.2.2&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;connect&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 1.4.2&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;railway&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0.1.6&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;yaml&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0.1.2&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;coffee-script&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 1.1.1&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;mime&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 1.2.2&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;qs&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;               &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0.1.0&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;mongoose&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;         &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 1.3.6&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;mongodb&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0.9.4-5&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;connect-mongodb&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0.3.0&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;mongoose-auth&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;gt;= 0.0.2&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;nodeunit test/*/*&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Next, we're going to change our &lt;a href=&quot;https://gist.github.com/1275489&quot;&gt;config/environment.js&lt;/a&gt; to look like the following:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;express&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;mongoose-auth&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;./mongoose_oauth&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cwd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cwd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cwd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;views&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cwd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/app/views&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;view engine&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;jade&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cwd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/public&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;maxAge&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;86400000&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bodyParser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cookieParser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;secret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;secret&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// MAKE SURE THIS IS COMMENTED OUT, otherwise it will produce errors that are mostly nonsensical&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//app.use(app.router)&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;methodOverride&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;middleware&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;helpExpress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Notice the use of the require statement, &lt;code&gt;require('./mongoose_oauth');&lt;/code&gt;, &lt;a href=&quot;https://gist.github.com/1275489&quot;&gt;this files contents are here and look like:&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;mongoose&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Schema&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;./oauth_providers&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UserSchema&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({})&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;mongoose-auth&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;UserSchema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;plugin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mongooseAuth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;everymodule&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;facebook&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;myHostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;http://local.host:3001&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;redirectPath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;twitter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;myHostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;http://local.host:3001&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;consumerKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;twit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;consumerKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;consumerSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;twit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;consumerSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;redirectPath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;everyauth&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;myHostname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;http://local.host:3001&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;redirectPath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;User&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UserSchema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;User&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mongoose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;User&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;User&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;modelName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;User&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Also notice, the configuration file, &lt;a href=&quot;https://gist.github.com/1275489&quot;&gt;config/oauth_providers.js&lt;/a&gt;, this looks like:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;fb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;111565172259433&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;85f7e0a0cc804886180b887c1f04a3c1&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;twit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;consumerKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;JLCGyLzuOK1BjnKPKGyQ&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;consumerSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;GNqKfPqtzOcsCtFbGTMqinoATHvBcy1nzCTimeA9M0&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;github&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;11932f2b6d05d2a5fa18&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;appSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;2603d1bc663b74d6732500c1e9ad05b0f4013593&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;instagram&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clientId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;be147b077ddf49368d6fb5cf3112b9e0&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clientSecret&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b65ad83daed242c0aa059ffae42feddd&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: these keypairs really shouldn't be made public, but they exist in the &lt;a href=&quot;https://github.com/bnoguchi/mongoose-auth/blob/master/example/conf.js&quot;&gt;mongoose-auth repo&lt;/a&gt;, so you can test using them. This also assumes you have something setup in /etc/hosts to map local.host to 127.0.0.1, example: &lt;code&gt;127.0.0.1    local.host&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;The views&lt;/h2&gt;

&lt;p&gt;Now, if you were to run your app, &lt;code&gt;rw s 3000&lt;/code&gt;, and &lt;a href=&quot;http://local.host:3000/auth/twitter&quot;&gt;go to http://local.host:3000/auth/twitter&lt;/a&gt;, you would find, after logging in to twitter, it redirects you back to the homepage, as per the &lt;a href=&quot;https://gist.github.com/1275489&quot;&gt;mongoose_oauth.js config&lt;/a&gt;. But how do you know if you're actually logged in, and the user is being stored in the session?&lt;/p&gt;

&lt;p&gt;Well, we have to update a view to contain the following information:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;- var &lt;span class=&quot;nv&quot;&gt;items&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;facebook&amp;quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&amp;quot;github&amp;quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&amp;quot;twitter&amp;quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&amp;quot;instagram&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
- &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;!everyauth.loggedIn&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  h2 Not Authenticated
  each item in items
   a&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/auth/&amp;#39;&lt;/span&gt; + item&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
     span Connect with &amp;lt;span &lt;span class=&quot;nv&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;text-transform: capitalize&amp;quot;&lt;/span&gt;&amp;gt;!&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;item&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;

- &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;  &lt;/span&gt;h2 Authenticated
  &lt;span class=&quot;c&quot;&gt;#user-id Logged in with `user.id` #{user.id} - aka `everyauth.user.id` #{everyauth.user.id}&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.facebook&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 Facebook User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.facebook.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.twitter&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 Twitter User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.twitter.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.github&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 GitHub User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.github.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  - &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.instagram&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    h3 Instagram User Data
    &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; JSON.stringify&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;everyauth.instagram.user&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  h3
    a&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/logout&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; Logout
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;And Done!&lt;/h2&gt;

&lt;p&gt;Now you should see various metadata depending on how you're logged in. All the files above can be found &lt;a href=&quot;https://gist.github.com/1275489&quot;&gt;in this gist&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Migrating from Rails 3.1 RC4 to RC5 using Heroku's Cedar Stack (also compass, unicorn, and sendgrid)</title>
		<link href="http://tesoriere.com/2011/08/08/migrating-from-rails-3.1-rc4-to-rc5-using-heroku%27s-cedar-stack--also-compass--unicorn--and-sendgrid-/"/>
		<updated>2011-08-08T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/08/08/migrating-from-rails-3.1-rc4-to-rc5-using-heroku's-cedar-stack--also-compass--unicorn--and-sendgrid-</id>
		<content type="html">&lt;h2&gt;A mouthful, indeed&lt;/h2&gt;

&lt;p&gt;I'm currently developing a super duper secret project which uses Rails 3.1 and is hosted on &lt;a href=&quot;http://heroku.com&quot;&gt;Heroku&lt;/a&gt;. With the release of Rails 3.1 RC5, I've decided to migrate to &lt;a href=&quot;http://devcenter.heroku.com/articles/cedar&quot;&gt;Heroku's Cedar stack&lt;/a&gt; after reading &lt;a href=&quot;http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/&quot;&gt;Michael's article&lt;/a&gt; about how easily unicorn can be implemented on the new stack.&lt;/p&gt;

&lt;p&gt;I've already migrated one app, &lt;a href=&quot;http://wastedonsteam.com&quot;&gt;Wasted on Steam&lt;/a&gt;, and the performance enhancements are amazing, as you might expect. Using siege, it was able deal with 100 concurrent requests repeated 10 times in &lt;em&gt;2.5&lt;/em&gt; seconds per request. Previously, it had taken &lt;em&gt;10&lt;/em&gt; seconds per request. This is amazing, especially considering &lt;a href=&quot;http://wastedonsteam.com&quot;&gt;Wasted on Steam&lt;/a&gt; uses a network blocking request to update data.&lt;/p&gt;

&lt;p&gt;For this other app, this super duper secret one, I thought I would detail the process.&lt;/p&gt;

&lt;h2&gt;The initial setup&lt;/h2&gt;

&lt;p&gt;Currently, there's no way to migrate the stack automatically, so we have to clone and proceed:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;git clone git@heroku.com:&amp;lt;your_app_name&amp;gt;.git cedar_testing
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Next, create the app on the new stack:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;heroku create --stack cedar
git config heroku.remote heroku
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;The code changes&lt;/h2&gt;

&lt;h3&gt;Gemfile fixes&lt;/h3&gt;

&lt;p&gt;Rails 3.1.rc5 separated the asset-building gems into their own group in the Gemfile, called &lt;code&gt;:assets&lt;/code&gt;, so we need to make some changes and clean it up so it looks like this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;http://rubygems.org&amp;#39;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;rails&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;3.1.0.rc5&amp;#39;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:assets&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;sass-rails&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;~&amp;gt; 3.1.0.rc&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;coffee-rails&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;~&amp;gt; 3.1.0.rc&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;uglifier&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;compass&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;0.12.0.alpha.0.91a748a&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:git&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;git://github.com/chriseppstein/compass.git&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:branch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;rails31&amp;#39;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;pg&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;kaminari&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;redcarpet&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;devise&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;sprockets&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;cancan&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;mime-types&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;treetop&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;ancestry&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;gt;= 1.2.2&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;nokogiri&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;1.4.4&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;oa-oauth&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:require&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;omniauth/oauth&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;oa-openid&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:require&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;omniauth/openid&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;omniauth&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;gt;= 0.2.6&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;dalli&amp;#39;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:production&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;unicorn&amp;#39;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;


&lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:development&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:test&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;Miscellaneous fixes&lt;/h3&gt;

&lt;p&gt;Please note, we no longer need to include the old version of rake, nor the therubyracer (the &lt;a href=&quot;http://devcenter.heroku.com/articles/rails31_heroku_cedar&quot;&gt;Cedar stack&lt;/a&gt; now includes node.js). It's very important that you update the path to use the native node.js by typing:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;heroku config:add &lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin:bin
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Supposedly, this is supposed to happen on new apps by default, but I had issues. Now, &lt;strong&gt;make sure&lt;/strong&gt; you run &lt;code&gt;bundle update&lt;/code&gt; now to update the Gemfile!&lt;/p&gt;

&lt;p&gt;Next, we need to update our &lt;code&gt;application.rb&lt;/code&gt;; it's changed in RC5. Around line, replace with the following:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;no&quot;&gt;Bundler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:assets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;defined?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Bundler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Now, if you're using &lt;a href=&quot;http://compass-style.org&quot;&gt;Compass&lt;/a&gt; like I am, you'll need to create an initializer in &lt;code&gt;config/initializers/sass.rb&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;configuration&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sass&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tap&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;load_paths&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Gem&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loaded_specs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;compass&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;full_gem_path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/frameworks/compass/stylesheets&amp;quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Thanks to &lt;a href=&quot;http://metaskills.net/2011/07/29/use-compass-sass-framework-files-with-the-rails-3.1.0.rc5-asset-pipeline/&quot;&gt;Ken Collins&lt;/a&gt; for that bit! I imagine, as some point when Rails 3.1 is released this will be done automatically.&lt;/p&gt;

&lt;p&gt;Next, in your &lt;code&gt;production.rb&lt;/code&gt;, change the &lt;code&gt;config.action_dispatch.x_sendfile_header&lt;/code&gt; to:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;action_dispatch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_sendfile_header&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;nil&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;If you use sendgrid&lt;/h3&gt;

&lt;p&gt;The &lt;a href=&quot;http://devcenter.heroku.com/articles/cedar&quot;&gt;Cedar stack&lt;/a&gt; is supposed to be less magical and black-boxy then the others, so if you use sendgrid, we have to accommodate for it in our &lt;code&gt;production.rb&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;action_mailer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;raise_delivery_errors&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;action_mailer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;smtp_settings&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:address&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;smtp.sendgrid.net&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:port&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;25&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:authentication&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:plain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:user_name&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;SENDGRID_USERNAME&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:password&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;SENDGRID_PASSWORD&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:domain&lt;/span&gt;         &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;SENDGRID_DOMAIN&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;Using unicorn instead of thin&lt;/h2&gt;

&lt;h3&gt;Our Procfile&lt;/h3&gt;

&lt;p&gt;This &lt;code&gt;Procfile&lt;/code&gt; tells &lt;a href=&quot;http://heroku.com&quot;&gt;Heroku&lt;/a&gt; exactly which process groups need to exist for various reasons. Like a &lt;code&gt;web&lt;/code&gt; group to run our unicorn. Our &lt;code&gt;Procfile&lt;/code&gt; is quite simple as we only need the main web process, &lt;a href=&quot;https://github.com/defunkt/unicorn&quot;&gt;Unicorn&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;web&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bundle&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unicorn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;$PORT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;/config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;unicorn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;The unicorn config&lt;/h3&gt;

&lt;p&gt;Place this in your &lt;code&gt;config&lt;/code&gt; directory and call it &lt;code&gt;unicorn.rb&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;worker_processes&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# amount of unicorn workers to spin up&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;# restarts workers that hang for 30 seconds&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;You'll have to play around with the configuration depending on how memory-heavy your app is. &lt;a href=&quot;http://wastedonsteam.com&quot;&gt;Wasted on Steam&lt;/a&gt; uses a ton of gems and it can easily run 4 worker processes.&lt;/p&gt;

&lt;h2&gt;Push the changes to heroku&lt;/h2&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;git add Procfile config/unicorn.rb
git commit -a -m &lt;span class=&quot;s2&quot;&gt;&amp;quot;Updated for Heroku and Unicorn&amp;quot;&lt;/span&gt;
git push heroku master
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;The data&lt;/h2&gt;

&lt;p&gt;If you have any configuration variables, you'll want to go to the old app and do &lt;code&gt;heroku config -s&lt;/code&gt; and migrate them over using &lt;code&gt;heroku config:add &amp;lt;VARIABLE&amp;gt;=&amp;lt;DATA&amp;gt; &amp;lt;HELLO&amp;gt;=&amp;lt;MOREDATA&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, we have to pull the database from our old app. This will only work if you have the gem &lt;code&gt;taps&lt;/code&gt; installed, so &lt;code&gt;gem install taps&lt;/code&gt;. Go to your old app folder and type the following:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;heroku db:pull sqlite://backup.sql
mv backup.sql ../cedar_testing
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ../cedar_testing
heroku db:push sqlite://backup.sql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;If you have any issues, simply type &lt;code&gt;git remote rm heroku; git remote add heroku git@heroku.com:&amp;lt;new_app_name&amp;gt;.git&lt;/code&gt; then proceed with the steps above. This usually fixes everything.&lt;/p&gt;

&lt;h2&gt;We're done!&lt;/h2&gt;

&lt;p&gt;Hopefully, everything should work now as planned. Make sure you go to &lt;code&gt;http://&amp;lt;yourapp&amp;gt;.herokuapp.com&lt;/code&gt; and not &lt;code&gt;http://&amp;lt;yourapp&amp;gt;.heroku.com&lt;/code&gt;, and you should see the site!&lt;/p&gt;

&lt;h2&gt;Comparing performance&lt;/h2&gt;

&lt;p&gt;This app is a simple app, but to give you an idea of how it performs, again with 100 concurrent requests repeating 10 times:&lt;/p&gt;

&lt;h3&gt;Old &amp;amp; Busted&lt;/h3&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;Transactions:                 995 hits
Availability:              99.50 %
Elapsed &lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;:              62.90 secs
Data transferred:           1.35 MB
Response &lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;:              5.26 secs
Transaction rate:          15.82 trans/sec
Throughput:             0.02 MB/sec
Concurrency:               83.19
Successful transactions:         995
Failed transactions:               5
Longest transaction:           15.67
Shortest transaction:           0.12
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;New hotness&lt;/h3&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;Transactions:                1000 hits
Availability:             100.00 %
Elapsed &lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;:              19.99 secs
Data transferred:           1.36 MB
Response &lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;:              0.61 secs
Transaction rate:          50.03 trans/sec
Throughput:             0.07 MB/sec
Concurrency:               30.33
Successful transactions:        1000
Failed transactions:               0
Longest transaction:           14.04
Shortest transaction:           0.11
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;Many articles helped get me here&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://devcenter.heroku.com/articles/cedar&quot;&gt;Heroku's&lt;/a&gt; &lt;a href=&quot;http://devcenter.heroku.com/articles/rails31_heroku_cedar&quot;&gt;articles&lt;/a&gt; on migrating helped a lot. &lt;a href=&quot;http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/&quot;&gt;Michael's&lt;/a&gt; article on using unicorn on Cedar was the inspiration, and finally, &lt;a href=&quot;http://metaskills.net/2011/07/29/use-compass-sass-framework-files-with-the-rails-3.1.0.rc5-asset-pipeline/&quot;&gt;Ken's&lt;/a&gt; article helped me get &lt;a href=&quot;http://compass-style.org&quot;&gt;Compass&lt;/a&gt; integrated. Thanks!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Random Freeze Fix for GTX 460 in 10.6 (osx86)</title>
		<link href="http://tesoriere.com/2011/07/23/random-freeze-fix-for-gtx-460-in-10.6--osx86-/"/>
		<updated>2011-07-23T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/07/23/random-freeze-fix-for-gtx-460-in-10.6--osx86-</id>
		<content type="html">&lt;h2&gt;Update: completely rid yourself of freezes!&lt;/h2&gt;

&lt;p&gt;While I had no more random freezes in 10.6.*, upgrading to Lion allowed for full stability and full use of graphics acceleration via OpenCL/CUDA/OpenGL. So please, upgrade to Lion, go purchase it on the App Store. &lt;a href=&quot;http://itunes.apple.com/us/app/os-x-lion/id444303913?mt=12&quot;&gt;http://itunes.apple.com/us/app/os-x-lion/id444303913?mt=12&lt;/a&gt;. There are many guides available detailing installation.&lt;/p&gt;

&lt;h2&gt;So far, anyway!&lt;/h2&gt;

&lt;p&gt;Newly released drivers for the Quadro 4000 for Mac can be used for the GTX 460, and this combination with 10.6.7 and Chameleon rc750 have completely removed any random freezes thus far. The system has been running for 24 hours now.&lt;/p&gt;

&lt;h2&gt;But it still locks up :(&lt;/h2&gt;

&lt;p&gt;Ultimately, if you still have freezes, consider going &lt;a href=&quot;http://apple.com&quot;&gt;here&lt;/a&gt; and buying one of &lt;a href=&quot;http://store.apple.com/us/browse/home/shop_mac/family/mac_mini&quot;&gt;these&lt;/a&gt;. If that's not the way you want to spend your money, then go &lt;a href=&quot;http://ebay.com&quot;&gt;here&lt;/a&gt; and looking for one of &lt;a href=&quot;http://www.amd.com/us/products/desktop/graphics/ati-radeon-hd-5000/hd-5870/Pages/ati-radeon-hd-5870-overview.aspx&quot;&gt;these&lt;/a&gt;, which work without issue, without injection in OSX 10.6.7.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://us.download.nvidia.com/Mac/Quadro_Certified/256.01.00f03/Retail_256.01.00f03v7.dmg&quot;&gt;http://us.download.nvidia.com/Mac/Quadro_Certified/256.01.00f03/Retail_256.01.00f03v7.dmg&lt;/a&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Wasted on Steam - an analytic tool for the Steam platform</title>
		<link href="http://tesoriere.com/2011/07/09/wasted-on-steam/"/>
		<updated>2011-07-09T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/07/09/wasted-on-steam</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://tesoriere.com/images/assets/2011/wastedonsteam.png&quot; title=&quot;Wasted on Steam&quot; alt=&quot;Wasted on Steam&quot; /&gt;&lt;/p&gt;

&lt;h2&gt;I was always curious...&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://steampowered.com&quot;&gt;Steam&lt;/a&gt; has existed for about 8 years now, and I was always curious how much time and money I've &lt;strike&gt;wasted&lt;/strike&gt; spent with the service. I created a webapp to calculate how many hours have been spent as well as an approximate cost of an account's worth. There are gaps in steam's data, so it's not entirely accurate, but it's a good estimate. &lt;a href=&quot;http://wastedonsteam.com&quot;&gt;Go on&lt;/a&gt;, check it out! &lt;a href=&quot;http://wastedonsteam.com&quot;&gt;http://wastedonsteam.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What's it made out of?&lt;/h2&gt;

&lt;p&gt;It's built using Rails 3.1, which was the other main motivator for creating this - testing out the new assets pipeline in Rails 3.1. It's hosted on &lt;a href=&quot;http://heroku.com&quot;&gt;heroku&lt;/a&gt;, uses gruff to make simple price graphs, nokogiri to update the data, the money class to store the prices, and delayed_job to push all the updating into the background.&lt;/p&gt;

&lt;p&gt;The gemfile is below:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;rails&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;3.1.0.rc4&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;sass&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;coffee-script&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;uglifier&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;attempt&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;gruff&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:require&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;rmagick&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:require&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;nokogiri&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;1.4.4&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;sprockets&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;gt; 2.0.0.beta.2&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;compass&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:git&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;https://github.com/chriseppstein/compass.git&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;jquery-rails&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;money&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;steam-prices&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:git&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;https://github.com/scottkf/steam-prices.git&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;linguistics&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;redcarpet&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;kaminari&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;devise&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;dalli&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;delayed_job&amp;#39;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:production&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;hirefire&amp;#39;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
	</entry>
	
	<entry>
		<title>Rails 3.1 &#8212; SQL logging to STDOUT during testing (with rspec, test::unit, or cucumber)</title>
		<link href="http://tesoriere.com/2011/05/28/rails-3.1---sql-logging-to-stdout-during-testing--with-rspec--test-unit--or-cucumber-/"/>
		<updated>2011-05-28T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/05/28/rails-3.1---sql-logging-to-stdout-during-testing--with-rspec--test-unit--or-cucumber-</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;/images/assets/2011/rails31-env-stdout.jpg&quot; title=&quot;Test.rb&quot; alt=&quot;test.rb&quot; /&gt;&lt;/p&gt;

&lt;h2&gt;Seemingly random SQL logging?&lt;/h2&gt;

&lt;p&gt;A simple fix, you probably have &lt;code&gt;config.logger = Logger.new(STDOUT)&lt;/code&gt; in your test.rb or application.rb!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Rails 3.1 &#8212; Using ERB/HAML/etc within a Coffeescript JS file</title>
		<link href="http://tesoriere.com/2011/05/28/rails-3.1---coffeescript-erb-chaining/"/>
		<updated>2011-05-28T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/05/28/rails-3.1---coffeescript-erb-chaining</id>
		<content type="html">&lt;p&gt;Need to use some information from your application in your new Coffeescript file? All you have to do is rename it with .erb.coffee or .&lt;builder&gt;.coffee instead of .coffee. This lets you do things like&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;#currency_select&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;change&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/^\/(&amp;lt;%=Country.currencies.keys.join &amp;#39;|&amp;#39;%&amp;gt;)|(?!(&amp;lt;%=Country.currencies.keys.join &amp;#39;|&amp;#39;%&amp;gt;))\//i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;option:selected&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The best part about it is that Rails still knows when to generate the file, it doesn't do it each time! The only thing you can't directly access are the routes (e.g. root_path(), etc), but a gem called &lt;a href=&quot;https://github.com/mtrpcic/js-routes/blob/master/js.rake&quot;&gt;&lt;em&gt;js:routes&lt;/em&gt;&lt;/a&gt; can take care of that for you.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Rails 3.1 &#8212; 'load_missing_contant': Expected ... to define ... (LoadError)</title>
		<link href="http://tesoriere.com/2011/05/28/rails-3.1---%27load_missing_contant%27--expected-...-to-define-...--loaderror-/"/>
		<updated>2011-05-28T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/05/28/rails-3.1---'load_missing_contant'--expected-...-to-define-...--loaderror-</id>
		<content type="html">&lt;h2&gt;Seeing this error?&lt;/h2&gt;

&lt;p&gt;This is a simple one to fix. I had two Classes of the same name but with different scopes, one was a model and the other a class in a separate module under lib. You have three options in this scenario:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Choose more appropriate names&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Move the module out of lib into a gem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rename the filename of the Class under the lib/ folder, while retaining the same class name.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</content>
	</entry>
	
	<entry>
		<title>Rails 3.1 &#8212; Testing with remote XML/HTML using Nokogiri, stubs, and rspec</title>
		<link href="http://tesoriere.com/2011/05/19/testing-with-remote-xml-in-rails-3.1-using-nokogiri-and-stubs/"/>
		<updated>2011-05-19T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/05/19/testing-with-remote-xml-in-rails-3.1-using-nokogiri-and-stubs</id>
		<content type="html">&lt;h2&gt;So you're pulling remote data, woo!&lt;/h2&gt;

&lt;p&gt;I suppose this works in Rails 3.x, but, in order to not be a burden on the server you're grabbing the data from, it would be nice to not have to grab the data each and EVERY time you have to run the unit tests, so you have to mock Nokogiri, but how. It's quite simple, assuming you're using Nokogiri like this: &lt;code&gt;doc = Nokogiri::XML(open(&quot;http://tesoriere.com?xml=1&quot;))&lt;/code&gt;. In your unit test, all you have to do is mock the parse function and you're done!&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;doc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Nokogiri&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;XML&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;spec/support/tesoriere.xml&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Nokogiri&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;XML&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Document&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stub!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Nokogiri&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;XML&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Document&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;should_receive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;and_return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;doc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
	</entry>
	
	<entry>
		<title>Rails 3.1 &#8212; use the jQuery Google Library instead of the default</title>
		<link href="http://tesoriere.com/2011/05/19/rails-3.1--use-the-jquery-google-library-instead-of-the-default/"/>
		<updated>2011-05-19T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/05/19/rails-3.1--use-the-jquery-google-library-instead-of-the-default</id>
		<content type="html">&lt;p&gt;Rails 3.1 supports all sorts of fun new technologies out of the box, Coffeescript, Sprockets and more. However, the default jQuery 1.6.1 library that is included by default isn't minified, as well as the jQuery-rails library. This results in a whopping 250kb javascript overhead.&lt;/p&gt;

&lt;p&gt;To reduce the overhead, and use the Google jQuery library instead, you have to make a couple changes. First, in &lt;code&gt;app/assets/javascripts/application.js&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;//= require jquery
//= require jquery_ujs
//= require_tree .
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Change this to:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;//= require jquery_ujs
//= require_tree .
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;And in your &lt;code&gt;app/views/layouts/application.html.*&lt;/code&gt; change the header by adding an additional line:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;erb&quot;&gt;&lt;span class=&quot;x&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &amp;lt;title&amp;gt;Steamhours&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stylesheet_link_tag&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&amp;quot;application&amp;quot;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;javascript_include_tag&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&amp;quot;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;javascript_include_tag&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;application&amp;quot;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;csrf_meta_tags&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Note, you can't just add &lt;code&gt;//= require https://../jquery.min.js&lt;/code&gt; because sprockets builds the resulting js file each time Rails receives a request (assuming it has changed). It really wouldn't make much sense to download the api and redistribute it, it would defeat the point of even using it in the first place.&lt;/p&gt;

&lt;p&gt;All the additions in Rails 3.1 are wonderful, go try them out!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Rails 3.1 &#8212; Fixing the 'ajax:loading' event</title>
		<link href="http://tesoriere.com/2011/05/19/rails-3.1-%26%238212%3B-fixing-the-%27ajax-loading%27-event/"/>
		<updated>2011-05-19T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/05/19/rails-3.1-&#8212;-fixing-the-'ajax-loading'-event</id>
		<content type="html">&lt;p&gt;Having difficulty getting the &lt;code&gt;ajax:loading&lt;/code&gt; event to trigger? All you have to do is use &lt;code&gt;ajax:beforeSend&lt;/code&gt; instead! An example:&lt;/p&gt;

&lt;h2&gt;Our example coffeescript:&lt;/h2&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;toggleLoading&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#loading&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toggle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#loading&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toggle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;form[data-remote]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;ajax:beforeSend&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;toggleLoading&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;ajax:complete&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;toggleLoading&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;ajax:success&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#list&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parseJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;ajax:error&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;Our form:&lt;/h2&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;erb&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;form_for&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@profile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;hours_form&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:show&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:remote&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field_set_tag&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:profile_name&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text_field&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:profile_name&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;submit_tag&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Submit&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;&amp;lt;div id=&amp;quot;loading&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;Loading...&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;And finally, the controller:&lt;/h2&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ProfilesController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ApplicationController&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;index&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@profile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Profile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;show&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@profile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Profile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:include&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:games&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;respond_to&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;html&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;js&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:json&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@profile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
	</entry>
	
	<entry>
		<title>Integrating and maintaining a calendar of events within the Symphony CMS</title>
		<link href="http://tesoriere.com/2011/05/03/generating-a-calendar-with-the-symphony-cms/"/>
		<updated>2011-05-03T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2011/05/03/generating-a-calendar-with-the-symphony-cms</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://tesoriere.com/images/assets/2011/symphony-calendar-gist.png&quot; title=&quot;calendar xslt utility&quot; alt=&quot;Calendar XSLT Utility&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://symphony-cms.com&quot;&gt;Symphony&lt;/a&gt; doesn't easily offer a way to integrate a calendar of events into an existing setup, so I've come up with an &lt;a href=&quot;https://gist.github.com/902159&quot;&gt;XSLT Utility&lt;/a&gt; to make it a little easier.&lt;/p&gt;

&lt;p&gt;After having to revisit a calendar of events and kind of &lt;a href=&quot;http://symphony-cms.com/discuss/thread/32743/&quot;&gt;hacking my way through it originally&lt;/a&gt;, I've come up with another way to incorporate an event calendar more easily into an existing site. A very simple example &lt;a href=&quot;http://cal.tesoriere.com&quot;&gt;is hosted here&lt;/a&gt;. The source is &lt;a href=&quot;https://github.com/scottkf/lighthousearts.org&quot;&gt;available at github&lt;/a&gt;. If you have any issues, please discuss them at github or at &lt;a href=&quot;http://symphony-cms.com/discuss/thread/66262/&quot;&gt;the Symphony forums: http://symphony-cms.com/discuss/thread/66262/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Requirements&lt;/em&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://symphony-cms.com/discuss/thread/27336/&quot;&gt;Nils' Date and Time Field Extension&lt;/a&gt; - Because it uses a nice interface and allows for easier management of events; make sure to take the experimental branch.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/902159&quot;&gt;This event I created&lt;/a&gt;, found on github, placed in your workspace/events folder.&lt;/li&gt;
&lt;li&gt;A section to handle all the events with a single &lt;a href=&quot;http://symphony-cms.com/discuss/thread/27336/&quot;&gt;Date &amp;amp; Time field&lt;/a&gt;, it must contain at least one &lt;em&gt;other&lt;/em&gt; field, like name, description, etc. But you can have as many as you like. They will all be displayed, and can be disabled by using CSS display:none; on the &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt;. For example, if we had a field called description it would be produced as &lt;code&gt;&amp;lt;li class=&quot;description&quot;&amp;gt;&lt;/code&gt;, so &lt;code&gt;.description { display: none; }&lt;/code&gt; would get rid of it.&lt;/li&gt;
&lt;li&gt;Attach the event to whatever page you want to display the calendar on.&lt;/li&gt;
&lt;li&gt;Attach a data-source pulling whatever events you wish, you can limit it by date to reduce the amount of entries, but &lt;strong&gt;do not&lt;/strong&gt; change the grouping.&lt;/li&gt;
&lt;li&gt;Finally, in the page you wish to drop the calendar in, the php xmlns must be added to the &lt;code&gt;&amp;lt;stylesheet&amp;gt;&lt;/code&gt; tag, and the function to generate the calendar must be used. An example page would look like is below. The second parameter next to the function is the name of the data source. The third is an optional path to link to the event by id so you provide the root path (if none is provided it will just be listed as text). The fourth is an optional class to provide the table with, the default is calendar.&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;      &lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:stylesheet&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;version=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;xmlns:xsl=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;xmlns:php=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://php.net/xsl&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;

        &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:import&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;../utilities/master.xsl&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

        &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;match=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/data&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;

        &lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&amp;gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;$page-title&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;php:function(&amp;#39;generate_calendar&amp;#39;, &lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;          calendar-main-events, concat($root,&amp;#39;/calendar/event&amp;#39;), &lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;          &amp;#39;calendar&amp;#39;)&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;disable-output-escaping=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;br&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:template&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Bugs/features&lt;/em&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It's not possible to have a date field in the same section you plan to use for the events, it conflicts with a date time field.&lt;/li&gt;
&lt;li&gt;If you have two calendars on the same page, when you switch months/years, it will switch them on both calendars.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;You can download it at &lt;a href=&quot;https://gist.github.com/902159&quot;&gt;my Github repo&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>How to get CM7 on your HTC Incredible (Android 2.3/Gingerbread)</title>
		<link href="http://tesoriere.com/2011/02/09/how-to-get-cm7-on-your-htc-incredible--android-2.3-gingerbread-/"/>
		<updated>2011-02-09T00:00:00+01:00</updated>
		<id>http://tesoriere.com/2011/02/09/how-to-get-cm7-on-your-htc-incredible--android-2.3-gingerbread-</id>
		<content type="html">&lt;h2&gt;Why this is important and why I am not responsible for your phone exploding :(&lt;/h2&gt;

&lt;p&gt;I originally switched from an iPhone 3GS to the HTC Incredible because ATT was &lt;a href=&quot;http://www.penny-arcade.com/comic/2002/02/11/&quot;&gt;molesting&lt;/a&gt; my wallet. Only, I discovered the default OS wasn't too responsive, and there was a ton of crap on it. Aside from that, I didn't really have any complaints, and so enter custom roms and &lt;a href=&quot;http://www.cyanogenmod.com/&quot;&gt;Cyanogen Mod 7 (CM7)&lt;/a&gt;
and the point of this article.&lt;/p&gt;

&lt;p&gt;CM7 is a customizable, nearly universal &lt;a href=&quot;http://www.zdnet.com/blog/burnette/top-10-features-in-android-23-gingerbread/2143&quot;&gt;Gingerbread/Android 2.3&lt;/a&gt; ROM. There's a port for almost each Android device that can be &lt;a href=&quot;http://forum.xda-developers.com/showthread.php?t=744807&quot;&gt;rooted&lt;/a&gt;. A phone being rooted is something akin to jailbreaking an iPhone. It just let's you do more stuff. I'm not talking about you pirates :(&lt;/p&gt;

&lt;h2&gt;BEFORE YOU BEGIN!&lt;/h2&gt;

&lt;p&gt;Please note than this will start your phone fresh, so you might considering &lt;a href=&quot;http://www.tested.com/news/complete-guide-to-backing-up-your-android-phone/423/&quot;&gt;backing up all of your data&lt;/a&gt; if you don't already have a backup. To make a backup of your apps, please consider using &lt;a href=&quot;https://market.android.com/details?id=com.appspot.swisscodemonkeys.apps&quot;&gt;AppBrain&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;How do I do it?&lt;/h2&gt;

&lt;p&gt;&lt;img style=&quot;height: 300px; width: auto; float:right;&quot; src=&quot;/images/assets/rom-manager.jpeg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To install the rom is fairly easy. You have to (1) root the phone, and (2) install the rom. I won't explain it step by step, because there are plenty of resources. To begin, please read about more of the &lt;a href=&quot;http://forum.xda-developers.com/showthread.php?t=744807&quot;&gt;terminology and disclaimers here&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rooting the phone&lt;/strong&gt;. The software to do it is called Unrevoked Forever and can be &lt;a href=&quot;http://unrevoked.com/rootwiki/doku.php/public/unrevoked2&quot;&gt;downloaded here&lt;/a&gt;. After download the software, the process is described in detail at &lt;a href=&quot;http://unrevoked.com/rootwiki/doku.php/public/forever&quot;&gt;their website, unrevoked.com&lt;/a&gt;. It's just involves running the programs, and clicking through the prompts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Downloading CM7&lt;/strong&gt;. You can either download &lt;a href=&quot;https://market.android.com/details?id=com.koushikdutta.rommanager&quot;&gt;Rom Manager&lt;/a&gt; after the phone is rooted and download CM7 through there, which is located under Cyanogen nightly, or &lt;a href=&quot;http://mirror.teamdouche.net/?type=nightly&amp;amp;device=inc&quot;&gt;download it here&lt;/a&gt;, copy it to the phone and use Rom Manager to install it. Supposedly #29 is stable, I'm on an earlier version and everything works fine.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;If you get past step one, which you should, you can backup your current phone (which is one nice thing about rooting) as a &lt;a href=&quot;http://wiki.cyanogenmod.com/index.php?title=Howto:_Using_the_Recovery#NANDroid_backups&quot;&gt;nandroid backup&lt;/a&gt;, which is akin to an iTunes iPhone backup, and always revert back to it if nothing works well.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>GTX 460 in Mac OSX 10.6.5 (or osx86)</title>
		<link href="http://tesoriere.com/2010/11/16/gtx-460-in-mac-osx-10.6.5--or-osx86-/"/>
		<updated>2010-11-16T00:00:00+01:00</updated>
		<id>http://tesoriere.com/2010/11/16/gtx-460-in-mac-osx-10.6.5--or-osx86-</id>
		<content type="html">&lt;h2&gt;Completely rid yourself of freezes!&lt;/h2&gt;

&lt;p&gt;While I had no more random freezes in 10.6.*, upgrading to Lion allowed for full stability and full use of graphics acceleration via OpenCL/CUDA/OpenGL. So please, upgrade to Lion, go purchase it on the App Store. &lt;a href=&quot;http://itunes.apple.com/us/app/os-x-lion/id444303913?mt=12&quot;&gt;http://itunes.apple.com/us/app/os-x-lion/id444303913?mt=12&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;But... But... That's illegal!&lt;/h2&gt;

&lt;p&gt;Actually, no, it's not. I'm not selling, nor condoning the use or creation of a hackintosh. If you however, are a hobbyist and are curious, the &lt;strong&gt;GTX 460&lt;/strong&gt; family of nVidia graphic cards now work in Snow Leopard (osx86).&lt;/p&gt;

&lt;p&gt;All one has to do is &lt;a href=&quot;http://www.nvidia.com/object/quadro-macosx-256.01.00f03-driver.html&quot;&gt;go here&lt;/a&gt; and &lt;a href=&quot;http://www.nvidia.com/object/quadro-macosx-256.01.00f03-driver.html&quot;&gt;download the latest drivers for Snow Leopard&lt;/a&gt;. This, however, requires you to update to 10.6.5, and use an appropriate boot loader with the following in com.apple.boot.plist:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;key&amp;gt;GraphicsEnabler&amp;lt;/key&amp;gt;
    &amp;lt;string&amp;gt;Yes&amp;lt;/string&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;More information can be found on &lt;a href=&quot;http://www.insanelymac.com/forum/index.php?showtopic=214219&amp;amp;st=960&quot;&gt;insanelymac&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Cucumber, capybara, lightboxes, and you</title>
		<link href="http://tesoriere.com/2010/10/21/cucumber--capybara--lightboxes--and-you/"/>
		<updated>2010-10-21T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/10/21/cucumber--capybara--lightboxes--and-you</id>
		<content type="html">&lt;p&gt;Selenium wasn't playing very nice with lightboxes during one of my tests, it just said &lt;em&gt;it wasn't visible&lt;/em&gt;! Thanks! That helps all you have to do is wait silly:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;gherkin&quot;&gt;&lt;span class=&quot;k&quot;&gt;When &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;I wait until I can see &amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;new_category&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;And the step definition:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;no&quot;&gt;When&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/^I wait until I can see &amp;quot;([^&amp;quot;]*)&amp;quot;$/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;has_css?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:visible&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
	</entry>
	
	<entry>
		<title>Cucumber, capybara, and checking for the existence of selected options within a select box</title>
		<link href="http://tesoriere.com/2010/10/21/cucumber--capybara--and-checking-for-the-existence-of-options-within-a-select/"/>
		<updated>2010-10-21T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/10/21/cucumber--capybara--and-checking-for-the-existence-of-options-within-a-select</id>
		<content type="html">&lt;p&gt;Checking for a selected option within Cucumber/Capaybara is quite simple:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;gherkin&quot;&gt;&lt;span class=&quot;k&quot;&gt;Then &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;quot; should be selected for &amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;article_category_id&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;And the step definition:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;no&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/^&amp;quot;([^&amp;quot;]*)&amp;quot; should be selected for &amp;quot;([^&amp;quot;]*)&amp;quot;$/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;has_xpath?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;//option[@selected = &amp;#39;selected&amp;#39; and contains(string(), &amp;#39;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;#39;)]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;You could easily extrapolate this for use within an unselected value, just by removing the selected bit:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;no&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/^&amp;quot;([^&amp;quot;]*)&amp;quot; should be seen within &amp;quot;([^&amp;quot;]*)&amp;quot;$/&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;has_xpath?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;//option[contains(string(), &amp;#39;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;#39;)]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
	</entry>
	
	<entry>
		<title>When should I use Ruby on Rails, or something else? (Comparing Symphony and Rails)</title>
		<link href="http://tesoriere.com/2010/10/18/when-should-i-use-ruby-on-rails--or-something-else-/"/>
		<updated>2010-10-18T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/10/18/when-should-i-use-ruby-on-rails--or-something-else-</id>
		<content type="html">&lt;p&gt;When beginning a new project, the first thing I come across is what software/language/methodology do I use to complete the project? The answer is quite simple, &lt;em&gt;it depends&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;Oh, you clever chap, what a cheeky answer&lt;/h2&gt;

&lt;p&gt;The truth of that matter is, it does depend solely on your application requirements and your knowledge of what's available. Nearly 90% of the time in my situation, it either comes down to either of two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rubyonrails.org&quot;&gt;Ruby on Rails&lt;/a&gt; or&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://symphony-cms.com&quot;&gt;Symphony CMS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The other 10% of the time I use my own solution, as in &lt;a href=&quot;http://samos.coaps.fsu.edu&quot;&gt;SAMOS&lt;/a&gt;, but that's for another day.&lt;/p&gt;

&lt;p&gt;Both Rails and Symphony subscribe to a &lt;a href=&quot;http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller&quot;&gt;Model-View-Controller (MVC)&lt;/a&gt; architectural software design methodology. Rails treats the methodology quite literally, while Symphony does so a little more loosely. The nomenclature in each are as follows:&lt;/p&gt;

&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;th&gt;&lt;strong&gt;Rails&lt;/strong&gt;&lt;/th&gt;&lt;th&gt;&lt;strong&gt;Symphony&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;Model&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Model&lt;/td&gt;&lt;td&gt;Section&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;View&lt;/em&gt;&lt;/td&gt;&lt;td&gt;View&lt;/td&gt;&lt;td&gt;Pages&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;Controller&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Controller&lt;/td&gt;&lt;td&gt;Data-Sources/Pages/Components&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;


&lt;p&gt;I won't really describe rails much, because there's plenty of information about it. A great place to start is here: &lt;a href=&quot;http://edgeguides.rubyonrails.org/getting_started.html&quot;&gt;http://edgeguides.rubyonrails.org/getting_started.html&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Then I'll go somewhere else!&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;However&lt;/em&gt;, &lt;a href=&quot;http://symphony-cms.com&quot;&gt;Symphony&lt;/a&gt; could use some explanation. Symphony's models are called sections (which contain many fields, just like fields in a database), and they are just like rails models. It's views are controlled by pages, and it's controllers are controlled (hah!) by data-sources, pages, and components. While that may be a little confusing, it works quite wonderfully.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pages&lt;/strong&gt; control what gets output as HTML, but you can also include logic in them, just like Rails does with ERB/HAML. However, a best practice is to stub out a lot of the logic into components (templates) to make it more DRY.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data-sources&lt;/strong&gt; are the link between the pages/components and the sections/fields. In rails, this would be the ActiveRecord interface. They grab data in a certain way based on lots of different things in lots of different ways.&lt;small&gt; I couldn't be more vague, I know.&lt;/small&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Components&lt;/strong&gt; are similar to helpers/partials in rails, where you can lump similar things together so you can reuse them.&lt;/p&gt;

&lt;h2&gt;Go on then, answer the original question&lt;/h2&gt;

&lt;p&gt;How I decide which to use basically involves me looking at this table and deciding how I feel like torturing myself for that certain project. Most of the time the biggest issues are whether or not it contains a lot of logic that needs to be tested, and which template language I want to use.&lt;/p&gt;

&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;th&gt;&lt;strong&gt;Rails&lt;/strong&gt;&lt;/th&gt;&lt;th&gt;&lt;strong&gt;Symphony&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;Testable?&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Yes, I use BDD&lt;/td&gt;&lt;td&gt;Not so much&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;Template Language&lt;/em&gt;&lt;/td&gt;&lt;td&gt;ERB/HAML&lt;/td&gt;&lt;td&gt;XSLT (this is quite amazing)&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;GUI&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Nope&lt;/td&gt;&lt;td&gt;Yes, &lt;a href=&quot;http://symphony-cms.com/workspace/assets/images/backend/section-table-1259390359.png&quot;&gt;you can see an example here&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;Output&lt;/em&gt;&lt;/td&gt;&lt;td&gt;HTML/XML/JSON/etc&lt;/td&gt;&lt;td&gt;HTML (as xml), JSON&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;em&gt;Database&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Everything you can throw at it&lt;/td&gt;&lt;td&gt;MySQL&lt;/td&gt;&lt;/tr&gt;'
    &lt;tr&gt;&lt;Td&gt;&lt;em&gt;Hosted at Godaddy?&lt;/em&gt;&lt;/td&gt;&lt;td&gt;FML&lt;/td&gt;&lt;td&gt;DIAF&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;


&lt;p&gt;There are a couple other things to compare, but these are often the most important.&lt;/p&gt;

&lt;h2&gt;Great! Losing patience, how do you decide?&lt;/h2&gt;

&lt;p&gt;If it's more of a web application and not as much as website, I often use rails, because they usually involve logic that should be &lt;strong&gt;tested&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;template language&lt;/strong&gt; shouldn't be, but is a huge issue to a shallow individual such as myself. You can do exactly the same stuff in both ERB/HAML and XSLT. They both have their advantages and disadvantages. ERB/HAML's main pro going for is that it's easy to use and quite succinct. XSLT's plus is that it's XSLT and lets you traverse data (XML) in such an amazing way, but it comes at price, it's quite verbose and ancient (it's from 1999). For me? &lt;em&gt;It depends&lt;/em&gt;, again, and how bored I am with one over the other.&lt;/p&gt;

&lt;p&gt;Whether or not I need Symphony's &lt;strong&gt;GUI&lt;/strong&gt; is also another important issue. If I don't feel like building an interface and using the default Symphony UI for tech-savvy clients I will often choose this (though you can also make your own interface as well).&lt;/p&gt;

&lt;p&gt;Once again, if it's more of web app, I'll often use rails because I might need an API (where I might need to &lt;strong&gt;output&lt;/strong&gt; XML/JSON) right away, or at some point in the future. In Symphony, you can output XML right out of the box, and can &lt;a href=&quot;http://symphony-cms.com/discuss/thread/32047/&quot;&gt;create a REST API&lt;/a&gt;, but the CUD part of CRUD is a little harder to manage in symphony this way.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;database&lt;/strong&gt; usually isn't as huge issue, and mainly depends on where the app/site is being hosted. Symphony currently only supports MySQL, but nearly every host supports MySQL, so whatever!&lt;/p&gt;

&lt;p&gt;And there you have it, it simply &lt;em&gt;depends&lt;/em&gt;, on... lots of stuff. &amp;lt;/shill&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>WPInks, our new partner in elegant photography</title>
		<link href="http://tesoriere.com/2010/09/28/wpinks--our-new-partner-in-elegant-design/"/>
		<updated>2010-09-28T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/09/28/wpinks--our-new-partner-in-elegant-design</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;/images/assets/wpinks.JPG&quot; title=&quot;WP Inks&quot; alt=&quot;WP Inks&quot; /&gt;&lt;/p&gt;

&lt;h2&gt;Well &lt;em&gt;I&lt;/em&gt; certainly didn't take that picture.&lt;/h2&gt;

&lt;p&gt;Someone else must have! In an effort to maintain my focus on mostly development and design, I've partnered with a local business, &lt;a href=&quot;http://wpinks.com&quot;&gt;WP Inks&lt;/a&gt; (West Palm). &lt;em&gt;WP Inks&lt;/em&gt; is a design firm specializing in Photography, Calligraphy and Interior Design. Examples can be found at &lt;a href=&quot;http://wpinks.com&quot;&gt;their website&lt;/a&gt;. Their main focus is family photography, still photography, engagement photos and the like.&lt;/p&gt;

&lt;p&gt;I've known the President of the company for a long time now, and I'd stake my reputation on the quality and commitment of their company.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Rails 3.x &#8212; Self-referential has_many :through Parent&lt;->Child relationship modelling</title>
		<link href="http://tesoriere.com/2010/09/01/rails-3--self-referential-has_many--through-parent---child-relationship-modelling/"/>
		<updated>2010-09-01T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/09/01/rails-3--self-referential-has_many--through-parent---child-relationship-modelling</id>
		<content type="html">&lt;h2&gt;Seriously?&lt;/h2&gt;

&lt;p&gt;Srsly, that's more of an SEO title than anything, because damnit, I know how the hell it works at an SQL level and it was frustrating to get working in Rails because of syntax, namely &lt;code&gt;:class_name =&amp;gt; :object&lt;/code&gt;, when it should be &lt;code&gt;:class_name =&amp;gt; &quot;object&quot;&lt;/code&gt;. I hope someone finds this useful, because when it comes to rails 3 there's not too much stuff that's recent.&lt;/p&gt;

&lt;h2&gt;Get to the point, show me the goods&lt;/h2&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;rails new confusingTitleProject
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;confusingTitleProject
rails g model Person name:string
rails g model PersonRelationship parent_id:integer child_id:integer
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;




&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#App/Models/PersonRelationship.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;PersonRelationship&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;belongs_to&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:parent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Person&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;belongs_to&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Person&amp;quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;#App/Models/Person.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  
  &lt;span class=&quot;n&quot;&gt;validates_presence_of&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:first_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:last_name&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;has_many&lt;/span&gt;     &lt;span class=&quot;ss&quot;&gt;:parent_child_relationships&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;PersonRelationship&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:foreign_key&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:child_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:dependent&lt;/span&gt;             &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:destroy&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;has_many&lt;/span&gt;     &lt;span class=&quot;ss&quot;&gt;:parents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:through&lt;/span&gt;               &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:parent_child_relationships&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:source&lt;/span&gt;                &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:parent&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;has_many&lt;/span&gt;     &lt;span class=&quot;ss&quot;&gt;:child_parent_relationships&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt;            &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;PersonRelationship&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:foreign_key&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:parent_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:dependent&lt;/span&gt;             &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:destroy&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;has_many&lt;/span&gt;     &lt;span class=&quot;ss&quot;&gt;:children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:through&lt;/span&gt;               &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:child_parent_relationships&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;:source&lt;/span&gt;                &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:child&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Then, as an example, you can do the following to add a parent:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;parents&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
	</entry>
	
	<entry>
		<title>Migrating from mephisto to jekyll</title>
		<link href="http://tesoriere.com/2010/08/25/tesoriere.com-on-jekyll/"/>
		<updated>2010-08-25T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/08/25/tesoriere.com-on-jekyll</id>
		<content type="html">&lt;h2&gt;My life story:&lt;/h2&gt;

&lt;p&gt;Pfft, I'll save my virtual breath.&lt;/p&gt;

&lt;p&gt;I've finally got around to moving my website (this one you're looking at!) to &lt;a href=&quot;http://github.com/mojombo/jekyll&quot;&gt;Jekyll&lt;/a&gt;. Why? Well, &lt;strong&gt;lots&lt;/strong&gt; of reasons! But, &lt;a href=&quot;http://embrangler.com/2010/03/embrangler-moving-to-jekyll/&quot;&gt;they&lt;/a&gt; &lt;a href=&quot;http://hobodave.com/2010/01/08/moving-to-jekyll-disqus/&quot;&gt;have&lt;/a&gt; &lt;a href=&quot;http://www.sriramkrishnan.com/blog/2009/08/moving-jekyll-disqus.html&quot;&gt;already&lt;/a&gt; been mentioned &lt;a href=&quot;http://blog.rayapps.com/2010/08/09/moving-blog-from-wordpress-com-to-jekyll/&quot;&gt;numerous times&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, if you don't know what &lt;a href=&quot;http://github.com/mojombo/jekyll&quot;&gt;Jekyll is&lt;/a&gt;, I implore you to &lt;a href=&quot;http://wiki.github.com/mojombo/jekyll/&quot;&gt;visit the wiki&lt;/a&gt; and learn about it, it's great fun if you're familiar with the terminal in osx, unix, *nix, or just about anything without a super fancy user interface. It lets you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;write your posts in Markdown or Textile (or anything you want to extend it to)&lt;/li&gt;
&lt;li&gt;use plain old css and html&lt;/li&gt;
&lt;li&gt;host your site anywhere with space, &lt;a href=&quot;http://theappleblog.com/2010/08/12/how-to-blogging-with-jekyll-and-mobileme/&quot;&gt;(even mobileme)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;use git or svn as a naturally way of supporting article revisions, which mephisto did beautifully (I prefer git)&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;So long demon, it's been... hell.&lt;/h2&gt;

&lt;p&gt;I came from mephisto, &lt;a href=&quot;http://techno-weenie.net/2010/6/23/you-can-let-go-now/&quot;&gt;which is dead now&lt;/a&gt;, but luckily &lt;a href=&quot;http://wiki.github.com/mojombo/jekyll/blog-migrations&quot;&gt;there is a way to migrate everything&lt;/a&gt; (except the tags :() to Jekyll. Comments also! Huzzah! The process is listed there, so I won't rehash what was said.&lt;/p&gt;

&lt;h2&gt;Boy that sure is &lt;em&gt;a lot&lt;/em&gt; of purple.&lt;/h2&gt;

&lt;p&gt;The design hasn't changed much, only tweaked a little. Let's face it, I'm no amazing designer, I usually hire other people for that. However, I've never found a great way to represent myself, so this will do for now. The important &lt;em&gt;technical&lt;/em&gt; bit is that is uses HTML5 and CSS3 (via &lt;a href=&quot;http://compass-style.org/&quot;&gt;compass, which is amazing&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;In order to maintain compatibility with older browsers, there's something called &lt;a href=&quot;http://www.modernizr.com/&quot;&gt;modernizr&lt;/a&gt;, which translates HTML5 elements such as &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; into something older browsers can deal with. It really is as simple as adding this into your header:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/javascripts/modernizr-1.5.min.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;and this into your body tag&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;no-js&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;You can view my default layout for this site on &lt;a href=&quot;http://github.com/scottkf/tesoriere.com/blob/master/_layouts/default.html&quot;&gt;github, right here&lt;/a&gt;. I make liberal use of the newer HTML5 elements (and &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; should I ever need it)!&lt;/p&gt;

&lt;h2&gt;Articles with name-tags are fun!&lt;/h2&gt;

&lt;p&gt;I had to re-tag all the articles after migrating, but I also needed a way to support /tag/something here urls. I described this process in a separate post, called &lt;a href=&quot;/2010/08/25/automatically-generated-tags-and-tag-clouds-with-jekyll--multiple-word-tags-allowed-/&quot;&gt;Automatically generated tags and tag clouds with Jekyll (multiple word tags allowed)&lt;/a&gt;. I should probably fire my ghost-writer.&lt;/p&gt;

&lt;h2&gt;Musings from the peanut gallery.&lt;/h2&gt;

&lt;p&gt;Comments are a tricky thing since everything is statically generated, hence that whole &lt;em&gt;&quot;you can do this on MobileMe&quot;&lt;/em&gt; &lt;a href=&quot;http://theappleblog.com/2010/08/12/how-to-blogging-with-jekyll-and-mobileme/&quot;&gt;thing&lt;/a&gt;. But as everyone knows by now, &lt;a href=&quot;http://disqus.com&quot;&gt;disqus&lt;/a&gt; is a great way to implement them.&lt;/p&gt;

&lt;p&gt;The whole process to implement them is actually a relatively easy one, you just have to use some &lt;a href=&quot;http://disqus.com/comments/universal&quot;&gt;universal code&lt;/a&gt; after making an account from the disqus website to add it in.&lt;/p&gt;

&lt;h2&gt;Sending tesoriere.com to it's home.&lt;/h2&gt;

&lt;p&gt;Deployment is relatively easy with a rake task using rsync to send over all that data to wherever. It's really as simple as:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;sh &lt;span class=&quot;s1&quot;&gt;&amp;#39;rsync -rtzh --delete _site/ #{DEPLOY_USER}@#{DEPLOY_HOST}:~/#{domain}/&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;Please don't steal me :(&lt;/h2&gt;

&lt;p&gt;You can view the &lt;a href=&quot;http://github.com/scottkf/tesoriere.com/tree/master&quot;&gt;full source of this &lt;strong&gt;entire site&lt;/strong&gt; on github&lt;/a&gt;! It really only takes a couple days to do, and it's worth it if you want to try something new, simple, and I'm sure as hell my hosting company appreciates less load.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Highlighting liquid code in a liquid template with Jekyll (Escape a liquid templating tag)</title>
		<link href="http://tesoriere.com/2010/08/25/liquid-code-in-a-liquid-template-with-jekyll/"/>
		<updated>2010-08-25T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/08/25/liquid-code-in-a-liquid-template-with-jekyll</id>
		<content type="html">&lt;p&gt;This is a somewhat confusing thing to achieve, highlighting &lt;a href=&quot;http://liquidmarkup.org/&quot;&gt;liquid templating code&lt;/a&gt; in a code block, and made even more confusing by the title. Take this example from &lt;a href=&quot;/2009/04/17/mephisto-next-article-link-and-previous-article-link/&quot;&gt;this article about I wrote about mephisto&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;#previous link
{% if article.previous? %}
  {{article | previous_article | link_to_article }}
{% else %}
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;home&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
{% endif %}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;To actually display the liquid template code you have to get crazy with the curly brackets; the code in the markdown (in my case) file actually looks like:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;#previous link
{{ “{% if article.previous? “}}%}
    {{ “{{article | previous_article | link_to_article  “}}}}
{{ “{% else “}}%}
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;home&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
{{ “{% endif “}}%}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Typing that above leads to a sweet infinity effect, but do yourself a favor and don't copy/paste that, just &lt;a href=&quot;http://github.com/scottkf/tesoriere.com/blob/master/_posts/2010-08-25-liquid-code-in-a-liquid-template-with-jekyll.markdown#L9-17&quot;&gt;take it from this post on github&lt;/a&gt;, because to actually type that I had to use &lt;code&gt;&amp;amp;ldquo;&lt;/code&gt;. Of course a &lt;em&gt;proper&lt;/em&gt; way to do would be to extend markdown/textile in pygments to support the liquid templating language, but that's for another day.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Automatically generated tags and tag clouds with Jekyll (multiple word tags allowed)</title>
		<link href="http://tesoriere.com/2010/08/25/automatically-generated-tags-and-tag-clouds-with-jekyll--multiple-word-tags-allowed-/"/>
		<updated>2010-08-25T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/08/25/automatically-generated-tags-and-tag-clouds-with-jekyll--multiple-word-tags-allowed-</id>
		<content type="html">&lt;p&gt;Jekyll is a great thing, and supports tags right out of the box, but in order to get urls like in mephisto, /tags/something here, you have to either add an extension (&lt;a href=&quot;http://github.com/rfelix/my_jekyll_extensions&quot;&gt;which do exist, though I haven't tried&lt;/a&gt;), or generate them with the Rakefile, or however really, but I chose the Rakefile. Luckily &lt;a href=&quot;http://blog.rayapps.com/2010/08/09/moving-blog-from-wordpress-com-to-jekyll/&quot;&gt;raimonds simanovskis had already done so&lt;/a&gt;, but his solution didn't support tags with spaces, which I had used in mephisto, and to not break compatibility when switching, I had to edit the relevant part of his Rakefile to support tags with spaces.&lt;/p&gt;

&lt;p&gt;So an &lt;a href=&quot;http://github.com/scottkf/tesoriere.com/raw/master/_posts/2009-8-31-cloning-an-iso-to-a-usb-flash-drive-or-anywhere-using-dd-in-snow-leopard-10-6-with-a-progress-meter-of-sorts.markdown&quot;&gt;an example post looks like this:&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt; 
&lt;span class=&quot;l-Scalar-Plain&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;post&lt;/span&gt;
&lt;span class=&quot;l-Scalar-Plain&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;Cloning an ISO to a USB flash drive (or anywhere) ...&lt;/span&gt;
&lt;span class=&quot;l-Scalar-Plain&quot;&gt;syntax-highlighting&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;yes&lt;/span&gt;
&lt;span class=&quot;l-Scalar-Plain&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; 
&lt;span class=&quot;p-Indicator&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;dd&lt;/span&gt;
&lt;span class=&quot;p-Indicator&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;snow leopard&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;l-Scalar-Plain&quot;&gt;Oh, and Leopard too...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The original method (&lt;a href=&quot;http://github.com/scottkf/tesoriere.com/blob/f9959290aad95de65b7bc7fcf7f308bb1053d352/Rakefile#L99-133&quot;&gt;can be viewed in it's entire, original, unedited form  here&lt;/a&gt;). To allow support for tags with space &lt;em&gt;(which some people don't like but I do!)&lt;/em&gt;, you have to change it so it looks like:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Generate tags pages&amp;#39;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:tags&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:tag_cloud&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Generating tags...&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;rubygems&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;jekyll&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Jekyll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Filters&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Jekyll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({})&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Jekyll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_posts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# Remove tags directory before regenerating&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;FileUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rm_rf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;tags&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;posts&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;HTML&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;layout: default&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;title: &amp;quot;tagged: #{tag}&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;syntax-highlighting: yes&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;  &amp;lt;h1 class=&amp;quot;title&amp;quot;&amp;gt;#{tag}&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;   &lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;   {% for post in site.posts %}&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;       {% for tag in post.tags %}&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;           {% if tag == &amp;#39;#[tag]&amp;#39;%}&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;               {% include post.html %}&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;           {% endif %}&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;       {% endfor %}&lt;/span&gt;
&lt;span class=&quot;sh&quot;&gt;   {% endfor %}&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;HTML&lt;/span&gt;

    &lt;span class=&quot;no&quot;&gt;FileUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mkdir_p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;tags/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;tags/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/index.html&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;w+&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;html&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Done.&amp;#39;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Note the line &lt;code&gt;if tag == &quot;#[tag]&quot;&lt;/code&gt; should be &lt;code&gt;if tag == &quot;#{tag}&quot;&lt;/code&gt; but liquid 2.0 doesn't support escaping, and my ghetto method doesn't work. So just pull the entire function from github.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://github.com/scottkf/tesoriere.com/blob/master/Rakefile#L100-137&quot;&gt;View my entire Rakefile @github&lt;/a&gt;.&lt;/h3&gt;
</content>
	</entry>
	
	<entry>
		<title>GTX470/480 (Fermi) in OSX</title>
		<link href="http://tesoriere.com/2010/06/21/gtx470-480-fermi-in-osx/"/>
		<updated>2010-06-21T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2010/06/21/gtx470-480-fermi-in-osx</id>
		<content type="html">&lt;p&gt;This may or not be relevant to you, but it's interesting. How to use a GTX470/480/465/480M in OSX.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.insanelymac.com/forum/index.php?showtopic=214219&quot;&gt;http://www.insanelymac.com/forum/index.php?showtopic=214219&lt;/a&gt;&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Premier Medical Care</title>
		<link href="http://tesoriere.com/2009/10/13/premier-medical-care/"/>
		<updated>2009-10-13T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/10/13/premier-medical-care</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://tesoriere.com/images/assets/2009/10/14/Screen_shot_2009-10-14_at_9.21.40_AM.png&quot; rel=&quot;portfolio&quot; title=&quot;premier medical care&quot;&gt;&lt;img alt=&quot;premier medical care picture&quot; title=&quot;project picture&quot; src=&quot;http://tesoriere.com/images/assets/2009/10/14/Screen_shot_2009-10-14_at_9.21.40_AM.png&quot; title=&quot;premier medical care&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Premier Medical Care's new website, he also happens to be my physician. &lt;a href=&quot;http://premiermedicalcarepb.com&quot;&gt;http://premiermedicalcarepb.com&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Cloning an ISO to a USB flash drive (or anywhere) using DD in Snow Leopard 10.6 with a progress-ish meter</title>
		<link href="http://tesoriere.com/2009/08/31/cloning-an-iso-to-a-usb-flash-drive-or-anywhere-using-dd-in-snow-leopard-10-6-with-a-progress-meter-of-sorts/"/>
		<updated>2009-08-31T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/08/31/cloning-an-iso-to-a-usb-flash-drive-or-anywhere-using-dd-in-snow-leopard-10-6-with-a-progress-meter-of-sorts</id>
		<content type="html">&lt;p&gt;Oh, and Leopard too.&lt;/p&gt;

&lt;p&gt;What a title. I recently needed to use G-Parted, but didn't have any blank disc's laying around, and the method they describe on the &lt;a href=&quot;http://gparted.sourceforge.net/liveusb.php&quot;&gt;gparted wiki&lt;/a&gt; to do this with a USB disk doesn't work on OSX. So, I used &lt;a href=&quot;http://en.wikipedia.org/wiki/Dd_(Unix)&quot;&gt;DD&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Open up terminal (from Applications/Utilities or use Spotlight) and type what follows &lt;em&gt;substituting as necessary&lt;/em&gt;. My USB device was located at /dev/disk3. You can find the device name in Disk Utility by right-clicking on the device, and choosing 'information'.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;THIS WILL OVERWRITE WHATEVER'S ON THE DISK&lt;/b&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;sudo dd &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/path/to/iso.iso.dmg.img &lt;span class=&quot;nv&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/dev/disk3 &lt;span class=&quot;nv&quot;&gt;bs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1024
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;And voila, you have a &lt;em&gt;read-only&lt;/em&gt; replica of the iso on your usb device. Please note the emphasis on &lt;em&gt;read-only&lt;/em&gt; in the case of an ISO.&lt;/p&gt;

&lt;p&gt;To see a progress bar (of sorts), open up a new terminal window and type the following&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;ps auxww | grep &lt;span class=&quot;s2&quot;&gt;&amp;quot; dd &amp;quot;&lt;/span&gt; | grep -v grep | awk &lt;span class=&quot;s1&quot;&gt;&amp;#39;{print $2}&amp;#39;&lt;/span&gt; | &lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;pid; &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;kill&lt;/span&gt; -SIGINFO &lt;span class=&quot;nv&quot;&gt;$pid&lt;/span&gt;; &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;I originally got the progress bit from &lt;a href=&quot;http://www.kclug.org/wiki/index.php/Dd_progress&quot;&gt;here&lt;/a&gt;, but changed it to work with OSX.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Using a 3.0 iPhone on T-Mobile? Get MMS Working!</title>
		<link href="http://tesoriere.com/2009/06/16/using-a-3-0-iphone-on-t-mobile-get-mms-working/"/>
		<updated>2009-06-16T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/06/16/using-a-3-0-iphone-on-t-mobile-get-mms-working</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://tesoriere.com/images/assets/2009/6/17/web.jpg&quot; rel=&quot;lightbox&quot;&gt;&lt;img src=&quot;http://tesoriere.com/images/assets/2009/6/17/web.jpg&quot; alt=&quot;settings&quot; style=&quot;width: 150px; height: auto; float: right; margin-left: 10px&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am, and have been. T-Mobile's customer service is beyond amazing.&lt;/p&gt;

&lt;p&gt;Go to settings -&gt; general -&gt; network -&gt; cellular data&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;APN: wap.voicestream.com&lt;/li&gt;
&lt;li&gt;MMSC: 216.155.174.84/servlets/mms&lt;/li&gt;
&lt;li&gt;MMS Proxy: 216.155.165.50:8080&lt;/li&gt;
&lt;li&gt;Username: leave empty&lt;/li&gt;
&lt;li&gt;Password: leave empty&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Click the picture --^ to see how it looks on the phone.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Keep Flippin' website v3</title>
		<link href="http://tesoriere.com/2009/06/15/keep-flippin-website-redone/"/>
		<updated>2009-06-15T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/06/15/keep-flippin-website-redone</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://tesoriere.com/images/assets/2009/6/15/Picture_1.png&quot; rel=&quot;portfolio&quot;&gt;&lt;img alt=&quot;keep flippin picture&quot; title=&quot;project picture&quot; src=&quot;http://tesoriere.com/images/assets/2009/6/15/Picture_1.png&quot; title=&quot;keep flippin website&quot; alt=&quot;keep flippin website&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;New Hotness (updated)&lt;/h2&gt;

&lt;p&gt;I've recently changed the Schedule page, and a hidden, non-publicly page, to use a Rails Application as a 'data-source' to provide the Schedule of classes, as well as other stuff on that non-public page.  This was done in an effort to help ease the transition between the software that Keep Flippin' currently uses to manage itself, and the new software I will be writing. More will follow in the coming months!&lt;/p&gt;

&lt;h2&gt;Old and Busted (original)&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;Below this is all tech-talk.&lt;/b&gt; To summarize, I used new stuff to make the site better, make it quicker, and more responsive. &lt;a href=&quot;http://keepflippin.com&quot;&gt;This is what I made.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://keepflippin.com&quot;&gt;new keep flippin website&lt;/a&gt; is built using &lt;a href=&quot;http://compass-style.org/&quot;&gt;compass&lt;/a&gt; for the CSS (this is &lt;em&gt;amazing&lt;/em&gt;), &lt;a href=&quot;http://symphony-cms.com&quot;&gt;symphony&lt;/a&gt;, some &lt;a href=&quot;http://tesoriere.com/tags/symphony%20extension&quot;&gt;extensions I created&lt;/a&gt;, &lt;a href=&quot;http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html&quot;&gt;SASS&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/xslt&quot;&gt;XSLT&lt;/a&gt; and &lt;a href=&quot;http://github.com/scottkf&quot;&gt;GitHub&lt;/a&gt; to keep track of everything.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>I know I've been living under a rock</title>
		<link href="http://tesoriere.com/2009/06/14/i-know-i-ve-been-living-under-a-rock/"/>
		<updated>2009-06-14T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/06/14/i-know-i-ve-been-living-under-a-rock</id>
		<content type="html">&lt;p&gt;But have you seen &lt;a href=&quot;http://wiki.github.com/mojombo/jekyll/install&quot;&gt;jekyll&lt;/a&gt;?. It makes blogging seem like it might be fun. I bet the people at my hosting company would appreciate it too.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Dealing with database concurrency (locking) in the Symphony CMS</title>
		<link href="http://tesoriere.com/2009/06/13/dealing-with-database-concurrency-locking-in-the-symphony-cms/"/>
		<updated>2009-06-13T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/06/13/dealing-with-database-concurrency-locking-in-the-symphony-cms</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://tesoriere.com/assets/2009/6/14/Picture_1.png&quot; alt=&quot;picture of it&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Symphony doesn't natively supported &lt;a href=&quot;http://www.google.com/search?q=pessimistic+database+locking&quot;&gt;pessimistic database locking&lt;/a&gt;, so I created an extension in symphony to handle it, both in the backend and the frontend. It's somewhat complicated to implement, but so far it works pretty great. I created it because one of the next big projects I'm working on will be used by many people at once, and I was considering using symphony to create it, as opposed to Rails.&lt;/p&gt;

&lt;p&gt;You can get it &lt;a href=&quot;https://github.com/scottkf/pessimistic-db-locking/tree&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Report any issues at &lt;a href=&quot;https://github.com/scottkf/pessimistic-db-locking/issues&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Uploading multiple files with Symphony CMS</title>
		<link href="http://tesoriere.com/2009/06/01/uploading-multiple-files-with-symphony-cms/"/>
		<updated>2009-06-01T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/06/01/uploading-multiple-files-with-symphony-cms</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://tesoriere.com/images/assets/2009/6/2/Picture_1.png&quot; title=&quot;mass upload utility&quot; alt=&quot;Mass Upload Utility&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Many CMS' don't offer a way to manage picture galleries easily, and neither does symphony out of the box. But, after playing with symphony some, I decided that I liked it and the next project I would do would be with symphony.&lt;/p&gt;

&lt;p&gt;So I created a plugin (in symphony: extension) that allows you to upload multiple files, and create entries (in this example, gallery items, or rows in the database, etc) to allow you to accomplish this easily.&lt;/p&gt;

&lt;p&gt;You can download it at &lt;a href=&quot;http://github.com/scottkf/massuploadutility&quot;&gt;my Github repo&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>Symphony CMS</title>
		<link href="http://tesoriere.com/2009/05/28/symphony-cms/"/>
		<updated>2009-05-28T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/05/28/symphony-cms</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://tesoriere.com/assets/2009/5/29/kf.jpg&quot; /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;I've been working on moving &lt;a href=&quot;http://keepflippin.com&quot;&gt;this&lt;/a&gt; to &lt;a href=&quot;http://symphony-cms.com&quot;&gt;this&lt;/a&gt;. It's got a bit of a learning curve, but I would say it's like Rails for designers with a GUI. That's not a bad thing. The bad thing is that it uses &lt;a href=&quot;http://www.w3.org/TR/xslt&quot;&gt;XSLT 1.0&lt;/a&gt;. Which is the least powerful language ever written (spec was written 8 years ago). It's not a procedural language, and if you don't treat it as one, you'll be ok.&lt;/p&gt;

&lt;p&gt;Some posts about tutorials will follow.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>mephisto next article link, and previous article link</title>
		<link href="http://tesoriere.com/2009/04/17/mephisto-next-article-link-and-previous-article-link/"/>
		<updated>2009-04-17T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/04/17/mephisto-next-article-link-and-previous-article-link</id>
		<content type="html">&lt;p&gt;8.2 either removed the two functions I used to manage article navigation at the bottom (move your eyes dowwwwn just above the comments), or I added them and thought they came for free. After looking at the &lt;a href=&quot;http://github.com/emk/mephisto/tree/0535b5ff99d45c94e6cb5d54d8ddaf24081840bd/app/drops&quot;&gt;date in the master repo&lt;/a&gt; the latter appears to be true!&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#article_drop.rb&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;## this goes in app/drops/article_drop.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;next?&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@source&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;blank?&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;previous?&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@source&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;previous&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;blank?&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Then to use it, go to your liquid template and add the following somewhere important:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;#previous link
{% if article.previous? %}
  {{article | previous_article | link_to_article }}
{% else %}
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;home&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
{% endif %}

#next link
{% if article.next? %}
{{article | next_article | link_to_article }}
{% else %}
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;home&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
{% endif %}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;If you want the links to have different text, say next/previous, you need to change the previous like so&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;#previous link
{% if article.previous? %}
  {{article | previous_article | link_to_article: &amp;#39;PREVIOUS&amp;#39; }}
{% else %}
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;home&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
{% endif %}

#next link
{% if article.next? %}
{{article | next_article | link_to_article: &amp;#39;NEXT&amp;#39; }}
{% else %}
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;home&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
{% endif %}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;It would appear that the prev/next_article filters check to see if one exists, but I prefer to link back to home for usability purposes, and this lets me do that.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>embed a mobileme gallery in a design, on any website</title>
		<link href="http://tesoriere.com/2009/04/11/mobileme-for-a-picture-gallery/"/>
		<updated>2009-04-11T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2009/04/11/mobileme-for-a-picture-gallery</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://tesoriere.com/images/assets/2009/4/12/mobileme.png&quot; style=&quot;height:80px;width:auto;float:right;margin-left:10px&quot; /&gt; On the right there's a new link for 'pictures', I'm embedding a mobileme gallery within the frame of the extremely wide tesoriere.com layout. It's not thaaaat terrible, but honestly, don't most people use facebook now?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;The relevant code is simple, and can be found through iWeb, but to save you the trouble:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://gallery.me.com/&amp;lt;username&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;frameborder=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;scrolling=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;no&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;You have to give it a big enough frame [w:855px,h:630px], or allow it to scroll.&lt;/p&gt;

&lt;p&gt;PS. It's also hosted on MobileMe with a CNAME pointing to web.me.com from me.tesoriere.com.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>up next</title>
		<link href="http://tesoriere.com/2009/03/07/up-next/"/>
		<updated>2009-03-07T00:00:00+01:00</updated>
		<id>http://tesoriere.com/2009/03/07/up-next</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://www.tesoriere.com/images/assets/2008/6/8/sandalhut.png&quot; rel=&quot;portfolio&quot; title=&quot;sandalhut&quot;&gt;&lt;img src=&quot;http://www.tesoriere.com/images/assets/2008/6/8/sandalhut.png&quot; title=&quot;sandalhut&quot; alt=&quot;sandalhut&quot; style=&quot;height:auto;width:400px&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last year, I completed a simple commerce website where I used my own solution written in rails. It worked, but it was a very simple application, not much flare, not much ajax (which is omg exciting). So for this, it would've wound up being a little too simplistic, and to avoid having to reinvent the square wheel, I tried using substruct. Substruct is great for what it is, but it hasn't been updated in some time now, so I tried redoing it with spree, and that's where I am now. The transition has been pretty smooth since I had finished most of the views already. As far as the functionality, it seems like a winner! Huzzah.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>mephisto - section with multiple pages on homepage (static intro page)</title>
		<link href="http://tesoriere.com/2008/06/21/mephisto-section-with-multiple-pages-on-homepage-static-intro-page/"/>
		<updated>2008-06-21T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2008/06/21/mephisto-section-with-multiple-pages-on-homepage-static-intro-page</id>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://www.tesoriere.com/assets/2008/6/21/Picture_3.gif&quot; title=&quot;mephisto picture&quot; alt=&quot;mephisto picture&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The way mephisto works, you can't have a static intro page (one article per page, a 'paged' section), and a blog in a subdirectory (ie. /journal). These options are found under the 'sections' tab.&lt;/p&gt;

&lt;p&gt;The reason it breaks is because of the way mephisto uses permanent links. It won't prefix permanent links with the URL associated with their section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There are a number of ways to fix this:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sneaky template manuvering (the solution I took described below)&lt;/li&gt;
&lt;li&gt;changing the way permanent links are constructed in the mephisto code-base (seemingly the proper way) and submitting a patch to include it in future revisions&lt;/li&gt;
&lt;li&gt;just moving the whole mephisto installation to a subdirectory. This has it's problems because you wouldn't have access to the articles at all to slap on your introduction page. I use them to represent the 'portfolio' on this website.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The first method is the quickest; using the templates to achieve this is fairly simple and straightforward. In your 'layout.liquid', which is the default template, you can add the following:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;Include file &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;journal&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; contains invalid characters or sequences
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;There also exists a '&lt;em&gt;home.liquid' and '&lt;/em&gt;journal.liquid' template with however you want them to be designed. And that's it!&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>datamapper - many-to-many parent child relationship</title>
		<link href="http://tesoriere.com/2008/06/17/datamapper-many-to-many-parent-child-relationship/"/>
		<updated>2008-06-17T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2008/06/17/datamapper-many-to-many-parent-child-relationship</id>
		<content type="html">&lt;p&gt;I started playing around with datamapper to see if I could model an many to many parent/child relationship (self-referential habtm?) for an upcoming project. The plan was to use sproutcore for the gui (once I figured it out!), and merb as a webservice that it interacts with.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://jit.nuance9.com/2008/06/datamapper-parent-child-relationship.html&quot;&gt;Justin gave me a kickstart&lt;/a&gt; with datamapper, and I eventually came up with:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#Person.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;DataMapper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Resource&lt;/span&gt;


  &lt;span class=&quot;n&quot;&gt;property&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:serial&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;has&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:relationships&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;has&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:parents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:through&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:relationships&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Person&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;has&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:through&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:relationships&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Person&amp;#39;&lt;/span&gt;


  &lt;span class=&quot;c1&quot;&gt;# parent = Person.create()&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# child = Person.create()&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# relationship = Relationship.new(:parent =&amp;gt; parent)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# child.relationships &amp;lt;&amp;lt; relationship&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# child.save&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;#Relationship.rb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Relationship&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;DataMapper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Resource&lt;/span&gt;
  
  &lt;span class=&quot;n&quot;&gt;property&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:serial&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;belongs_to&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:person&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;belongs_to&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:parent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Person&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;belongs_to&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:class_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Person&amp;#39;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;I'll eventually write some spec's for it.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>new design</title>
		<link href="http://tesoriere.com/2008/06/04/new-design/"/>
		<updated>2008-06-04T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2008/06/04/new-design</id>
		<content type="html">&lt;p&gt;There's a new design up today, and it came out pretty well. I still believe it needs more &lt;a href=&quot;http://mootools.net&quot;&gt;cowbell&lt;/a&gt; for it to truly shine. It runs on &lt;a href=&quot;http://mephistoblog.com&quot;&gt;mephisto&lt;/a&gt; and uses &lt;a href=&quot;http://www.digitalia.be/software/slimbox&quot;&gt;slimbox&lt;/a&gt; for the lightbox popups.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>dr lorne s. stitsky - revised</title>
		<link href="http://tesoriere.com/2008/05/29/dr-lorne-s-stitsky-revised/"/>
		<updated>2008-05-29T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2008/05/29/dr-lorne-s-stitsky-revised</id>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://www.tesoriere.com/images/assets/2008/5/29/Picture_1.png&quot; rel=&quot;portfolio&quot;&gt;&lt;img src=&quot;http://www.tesoriere.com/images/assets/2008/5/29/Picture_1.png&quot; style=&quot;width:400px;height:auto&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I just finished the 2nd version of &lt;a href=&quot;http://drstitsky.com&quot;&gt;Dr. Stitsky's website&lt;/a&gt; to match his current marketing materials.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>gardenhouse</title>
		<link href="http://tesoriere.com/2008/05/28/gardenhouse/"/>
		<updated>2008-05-28T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2008/05/28/gardenhouse</id>
		<content type="html">&lt;p&gt;&lt;a title=&quot;Gardenhousedecor.net&quot; rel=&quot;portfolio&quot; href=&quot;http://lh4.ggpht.com/scott.tesoriere/SDQN4ihl72I/AAAAAAAAAWE/FhzYEivy5vo/Picture%201.png?imgmax=800&quot;&gt;&lt;img alt=&quot;picture of gardenhousedecor.net&quot; src=&quot;http://lh4.ggpht.com/scott.tesoriere/SDQN4ihl72I/AAAAAAAAAWE/FhzYEivy5vo/s400/Picture%201.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I just finished developing a website for Cheryl Maeder, for her business, &lt;a href=&quot;http://gardenhousedecor.net/&quot;&gt;Gardenhouse&lt;/a&gt;. They designed the majority of it, and I used &lt;a href=&quot;http://textpattern.com/&quot;&gt;textpattern&lt;/a&gt; to control the backend, using &lt;a href=&quot;http://www.digitalia.be/software/slimbox&quot;&gt;Slimbox&lt;/a&gt; to display pictures, and &lt;a href=&quot;http://www.electricprism.com/aeron/slideshow/&quot;&gt;Slideshow 2.0&lt;/a&gt; for the 'art' page. Everything worked out &lt;a href=&quot;http://gardenhousedecor.net/web14&quot;&gt;pretty well&lt;/a&gt;.&lt;/p&gt;
</content>
	</entry>
	
	<entry>
		<title>dr lorne s. stitsky</title>
		<link href="http://tesoriere.com/2008/05/28/dr-lorne-s-stitsky/"/>
		<updated>2008-05-28T00:00:00+02:00</updated>
		<id>http://tesoriere.com/2008/05/28/dr-lorne-s-stitsky</id>
		<content type="html">&lt;p&gt;&lt;a title=&quot;drstitsky.com&quot; rel=&quot;portfolio&quot; href=&quot;http://lh4.ggpht.com/scott.tesoriere/SDQbDihl73I/AAAAAAAAAWM/OA1RGfEmKig/Picture%201.png?imgmax=720&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;&quot; src=&quot;http://bp1.blogger.com/_jMVuxhHFgcI/SDQbDihl73I/AAAAAAAAAWM/s_IoMWewhFc/s400/Picture+1.png&quot; border=&quot;0&quot; alt=&quot;picture of drstitsky.com&quot; id=&quot;BLOGGER_PHOTO_ID_5202813217141026674&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I recently finished a web site for &lt;a href=&quot;http://drstitsky.com/&quot;&gt;Dr. Lorne L. Stitsky&lt;/a&gt;, for his personal practice. His slogan is, &quot;putting the care back into healthcare... one house call at a time&quot;. It's not just a marketing ploy either, he actually makes housecalls. I designed and developed the site, it uses &lt;a href=&quot;http://mephistoblog.com/&quot;&gt;Mephisto&lt;/a&gt; as a backend and &lt;a href=&quot;http://www.huddletogether.com/projects/lightbox2/&quot;&gt;Lightbox&lt;/a&gt; for the gallery.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;: the site is pending a redesign to match Dr Stitsky's new theme. The website was created before he had a theme set in mind.&lt;/p&gt;
</content>
	</entry>
	
</feed>
