<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SmartLogic Solutions Blog &#187; Nick Gauthier</title>
	<atom:link href="http://blog.smartlogicsolutions.com/category/nick-gauthier/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com</link>
	<description>News and updates from the people at SmartLogic Solutions</description>
	<lastBuildDate>Tue, 30 Nov 2010 21:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Testing AJAX with Test::Unit</title>
		<link>http://blog.smartlogicsolutions.com/2010/10/08/testing-ajax-with-testunit/</link>
		<comments>http://blog.smartlogicsolutions.com/2010/10/08/testing-ajax-with-testunit/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 19:58:17 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=979</guid>
		<description><![CDATA[If you want real end-to-end testing of a page with functioning AJAX, use Selenium. But I was interested in doing just a bit of JS speccing to make sure that the AJAX routes I called worked and that the data that came back fit the JS that I had written. So, I figured with a [...]]]></description>
			<content:encoded><![CDATA[<p>If you want real end-to-end testing of a page with functioning AJAX, use Selenium. But I was interested in doing just a bit of JS speccing to make sure that the AJAX routes I called worked and that the data that came back fit the JS that I had written.</p>
<p>So, I figured with a little <a href="http://github.com/jnicklas/capybara">capybara</a> and a little <a href="http://github.com/cowboyd/therubyracer">therubyracer</a>, I could test my javascript with real route calls. Let&#8217;s check it out.<br />
<span id="more-979"></span></p>
<p>The Javascript I want to test:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> dataObject <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> getRemoteData <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/remote_path.json'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    dataObject <span style="color: #339933;">=</span> $.<span style="color: #660066;">parseJSON</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We will pretend that hitting /remote_path.json returns the following response in JSON:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;my_information&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;my response data&quot;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>I want to test:</p>
<ol>
<li>That /remote_path.json is accessible and returns information</li>
<li>That dataObject is populated with a Javascript Object containing the params I pass down</li>
</ol>
<p>Here is my commented testing code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  test <span style="color:#996600;">'get some information via ajax'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#008000; font-style:italic;"># Create a new JS Context. :with =&gt; self means that</span>
    <span style="color:#008000; font-style:italic;"># the global namespace is the current context</span>
    js = <span style="color:#6666ff; font-weight:bold;">V8::Context</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:with</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># Load up our JS file</span>
    js.<span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>Rails.<span style="color:#9900CC;">root</span>, <span style="color:#996600;">'public'</span>, <span style="color:#996600;">'javascripts'</span>, <span style="color:#996600;">'application.js'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># Define a mock method for getting JSON data</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> getJSON<span style="color:#006600; font-weight:bold;">&#40;</span>url, callback<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#008000; font-style:italic;"># When the JS wants some data, get it for real w/ capybara</span>
      visit url
      <span style="color:#008000; font-style:italic;"># And call the JS function passed in (ruby =&gt; js)</span>
      callback.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span>page.<span style="color:#9900CC;">body</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    js.<span style="color:#CC0066; font-weight:bold;">eval</span> <span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#123;</span>
      <span style="color:#006600; font-weight:bold;">/*</span> Mock out jQuery <span style="color:#006600; font-weight:bold;">*/</span>
      var $ = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>;
&nbsp;
      <span style="color:#006600; font-weight:bold;">/*</span> Setup the mock <span style="color:#9966CC; font-weight:bold;">in</span> the right place <span style="color:#006600; font-weight:bold;">&#40;</span>JS <span style="color:#006600; font-weight:bold;">=&gt;</span> ruby<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">*/</span>
      $.<span style="color:#9900CC;">getJSON</span> = getJSON; 
&nbsp;
      <span style="color:#006600; font-weight:bold;">/*</span> Mock out jquery parseJSON to call ruby JSON.<span style="color:#9900CC;">parse</span>
         Since the args are the same, it is plug <span style="color:#9966CC; font-weight:bold;">and</span> play!
         <span style="color:#006600; font-weight:bold;">&#40;</span>JS <span style="color:#006600; font-weight:bold;">=&gt;</span> ruby<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">*/</span>
      $.<span style="color:#9900CC;">parseJSON</span> = JSON.<span style="color:#9900CC;">parse</span>;
&nbsp;
      <span style="color:#006600; font-weight:bold;">/*</span> Trigger our JS <span style="color:#006600; font-weight:bold;">*/</span>
      getRemoteData<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;
&nbsp;
      <span style="color:#006600; font-weight:bold;">/*</span> Assert what we expect <span style="color:#006600; font-weight:bold;">&#40;</span>JS <span style="color:#006600; font-weight:bold;">=&gt;</span> ruby<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">*/</span>
      assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot; &quot;</span>, dataObject.<span style="color:#9900CC;">access_key</span><span style="color:#006600; font-weight:bold;">&#41;</span>;
    <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This is not an example of an incredibly useful test, but I found the ability to bind back and forth easily between ruby and javascript to be <strong>mind-blowingly incredible</strong>. I mean, look at that last line, where I call assert and pass a javascript object to it!</p>
<p>Huge thanks to <strong><a href="http://github.com/cowboyd">Charles Lowell (cowboyd)</a></strong> for his hard work on <a href="http://github.com/cowboyd/therubyracer">therubyracer</a>.</p>
<p>Enjoy the weekend! </p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/" rel="bookmark" class="crp_title">Timecop: Freeze Time in Ruby for Better Testing</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/10/26/testpilot-rails-integration-testing-pattern/" rel="bookmark" class="crp_title">TestPilot &#8211; Rails Integration Testing Pattern</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/20/google-ajax-libraries-on-rails/" rel="bookmark" class="crp_title">Google AJAX Libraries on Rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/08/using-active-x-and-javascript-to-scan-from-your-web-app/" rel="bookmark" class="crp_title">using active x and javascript to scan from your web app</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/15/using-swfobject-to-seamlessly-upgrade-to-flash-player-10/" rel="bookmark" class="crp_title">Using SWFObject to Seamlessly Upgrade to Flash Player 10</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2010/10/08/testing-ajax-with-testunit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nick&#8217;s Highlights from Windy City Rails</title>
		<link>http://blog.smartlogicsolutions.com/2010/09/11/nicks-highlights-from-windy-city-rails/</link>
		<comments>http://blog.smartlogicsolutions.com/2010/09/11/nicks-highlights-from-windy-city-rails/#comments</comments>
		<pubDate>Sat, 11 Sep 2010 23:07:21 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=972</guid>
		<description><![CDATA[I attended and spoke at Windy City Rails. I tried to take more notes this time. Out of 6 talks an lightning talks, I have ~500 lines of notes. Enjoy!. Jake Scrugges &#8211; Metrics Based Refactoring: What To Do With Your Code Metrics Metric-Fu is a ruby metric bundle rake metrics:all => generates a master [...]]]></description>
			<content:encoded><![CDATA[<p>I attended and spoke at Windy City Rails. I tried to take more notes this time. Out of 6 talks an lightning talks, I have ~500 lines of notes. Enjoy!.<br />
<span id="more-972"></span></p>
<h2>Jake Scrugges &#8211; Metrics Based Refactoring: What To Do With Your Code Metrics</h2>
<ul>
<li>Metric-Fu is a ruby metric bundle</li>
<li>rake metrics:all<br />
=> generates a master report of a bunch of metrics</li>
<li>There are a lot of metrics, where do you start?</li>
<li>Everyone wants to refactor, but where do you start?</li>
<li>Flay
<ul>
<li>Analyzes code duplication</li>
<li>Finds violations of DRY</li>
<li>Solutions: Extract Method, Modules, etc.</li>
<li>Single Responsibility Principle</li>
</ul>
</li>
<li>Churn
<ul>
<li>Looks through your commits to see what stuff changes the most</li>
<li>Files that change the most are &#8220;God Objects&#8221; &#8211; stuff that does everything</li>
<li>Any time anything changes, the God Object has to change</li>
<li>Bad smell, should be smaller objects with greater focus</li>
<li>Tells you where your most volatile code is</li>
</ul>
</li>
<li>Rcov
<ul>
<li>Main reason metric-fu blows up</li>
<li>Problem is, metric-fu is mostly static analysis, but rcov is running the code</li>
<li>Rcov runs the test suite, which is sometimes hard to get working</li>
<li>Rcov makes sure your coverage is good where it needs to be (most complicated and volatile code)</li>
<li>Writing tests for the sake of coverage is harmful</li>
<li>Write tests when you are in the code and you understand it (not a week later, &#8220;let&#8217;s write some tests!&#8221;)</li>
</ul>
</li>
<li>Flog and Saikuro
<ul>
<li>Both are complexity management</li>
<li>Saikuro (pronounced cyclo as in cyclomatic complexity) measures cyclomatic complexity</li>
<li>Saikuro = number of paths through the code, and cyclomatic complexity is exponential in growth</li>
<li>Flow looks at branching, but uses ABC</li>
<li>Assignments</li>
<li>Branches</li>
<li>Calls</li>
<li>Flog generates a score based on ABC</li>
<li>&lt; 20 is good, 20-40 is a grey area, 40-60 is a warning, 60+ is FIX IT!</li>
<li>How do you fix it?</li>
<li>Extract method</li>
<li>Missing object (need a new class to handle this behavior)</li>
<li>If that doesn&#8217;t work, re-architect</li>
<li>Seriously, you don&#8217;t need complicated methods in <em>any</em> app</li>
<li>Director method: calls a couple of sub methods, doesn&#8217;t do much actual work</li>
<li>Take care not to over-factor. If you are a guest in the code, just clean it<br />
as necessary. You don&#8217;t need to fully re-organize.</li>
</ul>
</li>
<li>Reek, Roodi, and RailsBestPractices
<ul>
<li>Reek: if it could possibly be a problem, I&#8217;ll tell you</li>
<li>Roodi: only if I&#8217;m really sure, I&#8217;ll tell you</li>
<li>RailsBestPractices: just rails stuff</li>
<li>All parse the code and look for design problems</li>
<li>Very ambitious! Code trying to understand what you&#8217;re trying to do</li>
<li>Awesome because you can look up the definition of the problem and see how to fix it.</li>
<li>Trouble because it&#8217;s a machine trying to identify human problems, which is difficult</li>
</ul>
</li>
<li>Continuous Integration
<ul>
<li>Metric-fu on your code</li>
<li>Most CI&#8217;s allow you to have artifacts for a build</li>
<li>J.S. runs his nightly at midnight</li>
</ul>
</li>
<li>Pay attention to trends over time
<ul>
<li>Is your refactoring making things better?</li>
<li>Did the last feature skyrocket flay scores?</li>
<li>How is the influx of new developers affecting the code quality</li>
<li>Did the highly paid consultants produce good work?</li>
</ul>
</li>
<li>Take metrics as advice (not law)
<ul>
<li>It is a tool, use it intelligently (like a GPS system)</li>
<li>Don&#8217;t let a manager get in charge of this</li>
<li>Up to you and your team to establish conventions and stick to them</li>
</ul>
</li>
<li>Coming soon
<ul>
<li>Fail the build on bad metrics</li>
<li>Resisted for a while because there may be false negatives</li>
<li>Failing a build is a serious incident, needs to mean something</li>
<li>Metrics are not as definitive as tests</li>
</ul>
</li>
<li>Coming later (and/or soonish)
<ul>
<li>Meta metrics</li>
<li>Imagine a report that flagged a method as having high churn, poor coverage, and high complexity</li>
<li>This method is trouble waiting to happen</li>
<li>No so easy to write this feature</li>
<li>J.S. needs help!</li>
<li>Need to re-architect the system to understand classes and methods, not just lines of code</li>
</ul>
</li>
<li>Questions
<ul>
<li>Can you use other source control?</li>
<li>I think so, check out the churn gem</li>
<li>How is the performance?</li>
<li>Not great, but you only have to run it once a day</li>
<li>If you don&#8217;t have test coverage, now what?</li>
<li>start w/ rehacktoring (refactoring w/o tests)</li>
<li>do that until you understand it enough to write tests</li>
<li>write tests!</li>
<li>What about front-end heavy stuff? Javascript?</li>
<li>No idea! These are all ruby tools. Maybe there are JS tools out there?</li>
<li>You should test your javascript. Sapphire is the &#8220;new hot thing&#8221;.</li>
</ul>
</li>
</ul>
<h2>John McCaffrey &#8211; Analyzing and Improving the Performance of your Rails Application</h2>
<ul>
<li><a href="http://railsperformance.blogspot.com">http://railsperformance.blogspot.com</a></li>
<li>O(n) queries is bad</li>
<li>Code he refactored went from 2811 to 17 queries per action</li>
<li>Leverage: small amounts of work for large amounts of value</li>
<li>Delay directly correlates w/ loss of revenue
<ul>
<li>Bing: 1s = 2.8% decrease, 2s = 4.3%</li>
<li>Google: users that had a delay for a short period of time, actually searched less even after the delay was removed.</li>
<li>Yahoo: added a 400ms delay and users bailed before the pages even loaded</li>
<li>Shopzilla: reduced delay from 6s to 1.2s.</li>
<li>Conversion rate rate up 7-12%</li>
<li>Saved infrastructure costs by 50%</li>
<li>Release cost decreased</li>
</ul>
</li>
<li>Fred Wilson (VC): Speed is #1 of the 10 golden principles of successful web apps</li>
<li>So where to begin?</li>
<li>Anti-patterns:
<ul>
<li>&#8220;Scalability can be sprinkled on later&#8221;</li>
<li>Guessing, not testing</li>
<li>Ad-hoc, unstructured</li>
</ul>
</li>
<li>&#8220;Premature optimization is the root of all evil&#8221; &#8211; Donald Knuth</li>
<li>&#8220;If you can not measure it, you can not improve it&#8221; &#8211; Lord Kelvin</li>
<li>Measure</li>
<li>Repeatable tests</li>
<li>Isolate your changes</li>
<li>(Scientific method!)</li>
<li>Visibility is important for working on a team</li>
<li>Response time = latency</li>
<li>Requests per second = throughput</li>
<li>Load, utilization, scalability, throughput, concurrency, capacity</li>
<li>Performance != Scalability
<ul>
<li>Performance = response time</li>
<li>Scalability = ability to grow to more requests</li>
<li>Adding more workers will not improve latency</li>
</ul>
</li>
<li>Twitter: dynamic html = 250ms, but 3369ms is static assets
<ul>
<li>Don&#8217;t waste your time on the 250ms, go for the big slow chunks</li>
</ul>
</li>
<li>Walmart: 3 redirects, 388ms dynamic, 4580ms static content</li>
<li>Use YSlow
<ul>
<li>Do less work</li>
<li>Distribute content</li>
<li>Cache</li>
<li>Compress</li>
<li>Fight queued work</li>
</ul>
</li>
<li>Google page speed
<ul>
<li>similar to yslow</li>
<li>includes paint events</li>
<li>separates out ads and trackers from your site</li>
<li>&#8220;how fast it feels&#8221;</li>
<li>If the web is faster, they make more money</li>
</ul>
</li>
<li><a href="http://www.showslow.com/">http://www.showslow.com/</a> tracks your site (or competitors, will check every 24h)</li>
<li><a href="http://webpagetest.com/">http://webpagetest.com/</a> runs page speed and yslow for you, and show progressive rendering</li>
<li><a href="http://gtmetrix.org">http://gtmetrix.org</a></li>
<li><a href="http://zoompf.com">http://zoompf.com</a> </li>
<li><a href="http://loadimpact.com">http://loadimpact.com</a> </li>
<li><a href="http://gomez.com">http://gomez.com</a> </li>
<li>See Greg Pollack&#8217;s Scaling Rails series</li>
<li>Majority of the Alexa top 1,000 sites don&#8217;t do even the easiest things
<ul>
<li>42% don&#8217;t gzip</li>
<li>44% >2 css files</li>
<li>56% serve css from a cookied domain</li>
<li>62% don&#8217;t minify</li>
</ul>
</li>
<li>Gzip is the simplest and smartest thing you can do</li>
<li>Minify js
<ul>
<li>jsmin, yuicompressor, sprockets</li>
<li>Asset packager</li>
<li>javascript_include_tag :cache => &#8220;cache/all&#8221;</li>
</ul>
</li>
<li>Sprited images</li>
<li>Spriteme.org</li>
<li>JqueryUI gives you sprited images</li>
<li>Image optimization
<ul>
<li>Smush.it</li>
</ul>
</li>
<li>Expires and browser caching</li>
<li>Set a far-future expire to tell the browser it can cache it</li>
<li>Combined with a query string lets you version a file</li>
<li>Rails Caching: make the static parts of your dynamic content cached</li>
<li>railslab.newrelic.com</li>
<li>request-log-analyzer</li>
<li>Rack::Bug</li>
<li>NewRelic</li>
<li>Scout</li>
<li>Get on the heroku mailing list / blog to learn about scaling issues</li>
<li>Apache bench</li>
<li>httperf</li>
<li>jmeter</li>
<li>Database issues
<ul>
<li>Bad queries</li>
<li>Not utilizing explain</li>
<li>Inadequate indexes</li>
<li>N+1 queries</li>
<li>Selecting more data than needed</li>
<li>Inconsistent queries for the same data</li>
<li><a href="http://github.com/dsboulder/query_reviewer/">http://github.com/dsboulder/query_reviewer/</a> </li>
</ul>
</li>
<li><a href="http://github.com/eladmeidar/rails_indexes">http://github.com/eladmeidar/rails_indexes</a>
<ul>
<li>rake tasks to find missing indexes</li>
<li>columns that need to be sorted</li>
<li>lookup fields</li>
<li>columns used in a group-by</li>
</ul>
</li>
<li><a href="http://github.com/samdanavia/ambitions_query_indexer">http://github.com/samdanavia/ambitions_query_indexer</a> haven&#8217;t tried it yet, check it out</li>
<li><a href="http://github.com/sdsykes/slim_scrooge">http://github.com/sdsykes/slim_scrooge</a> Instruments your code and looks for bad &#8220;select *&#8221;</li>
<li>Aman Gupta</li>
<li>Joe Damato</li>
<li><a href="http://timetobleed.com/">http://timetobleed.com/</a></li>
<li><a href="http://memprof.com/">http://memprof.com/</a> </li>
<li>yajl-ruby for C++ extension json parsing</li>
<li>Ruby 1.9 for massive performance</li>
</ul>
<h2>Kevin Gisi &#8211; It&#8217;s time to repay your debt</h2>
<ul>
<li>We&#8217;re leveraging an awesome framework and language, and it&#8217;s time to give back</li>
<li>Releasing gems is easy</li>
<li>(Showing some code to refactor out into a gem)</li>
<li>Ruby community has an incredible (and overwhelming) amount of choice</li>
<li>Choice is good and important</li>
<li>There exist incomplete and unstable solutions</li>
<li>You should release a &#8220;product&#8221;, not an incomplete solution
<ul>
<li>Aesthetics</li>
<li>Utility</li>
</ul>
</li>
<li>Agile: Do the bare minimum to get something delivered
<ul>
<li>(Nick: isn&#8217;t it to embrace change?)</li>
</ul>
</li>
<li>Delivered: coded, deployed, supported, tested, extensible, usable by the client</li>
<li>Treat open source libraries and client deliverables</li>
<li>The Lazy programmer&#8217;s manifesto
<ul>
<li>I want to write code once</li>
<li>I want to be able to read code w/o docs</li>
<li>I want to be able to rely on libraries</li>
<li>I wants to use adaptable solutions for numerous problems</li>
<li>I want to always be working on something new</li>
</ul>
</li>
<li>Idea filtering
<ul>
<li>To share</li>
<li>business value</li>
<li>practical use</li>
<li>To learn</li>
<li>no requirements</li>
<li>don&#8217;t post it publicly (community does not value your stupid web framework)</li>
</ul>
</li>
<li>Testing
<ul>
<li>We all say we do it (it&#8217;s time to start)</li>
<li>RSpec and Cucumber are easy to set up</li>
<li>Design verification tool</li>
</ul>
</li>
<li>(really turning into a rant at this point)</li>
<li>Extensible
<ul>
<li>Write clean code (don&#8217;t post spikes)</li>
<li>Peer review</li>
<li>Follow the Unix philosophy: do one thing really well</li>
<li>Leverage other gems</li>
</ul>
</li>
<li>Documentation
<ul>
<li>Who&#8217;s looking at your code?</li>
<li>RDoc, YARD, etc</li>
<li>Getting Started</li>
<li>Blog post!</li>
</ul>
</li>
<li>Supported
<ul>
<li>If you can&#8217;t maintain your app, don&#8217;t post it</li>
</ul>
</li>
<li>Be Honest
<ul>
<li>Hand over the reigns if you can&#8217;t support it</li>
<li>Be a net positive</li>
<li>Don&#8217;t announce things that aren&#8217;t done</li>
</ul>
</li>
<li>If you have to
<ul>
<li>Put it in a limited venue</li>
<li>Add a disclaimer</li>
</ul>
</li>
<li>The internet doesn&#8217;t filter bad ideas very well
<ul>
<li>It does make things hard to do if they don&#8217;t work well</li>
<li>Having enough eyes</li>
</ul>
</li>
<li>&#8220;Ruby treats you like a grown up programmer&#8221; &#8211; Matz</li>
<li>What happens when grown-ups have too much fun?</li>
<li>How to be a good parent
<ul>
<li>Avoid sensory overload</li>
<li>Sometimes spoon feed</li>
<li>Remember you&#8217;re used to the status quo</li>
<li>Be a mentor <a href="http://railsmentors.org">http://railsmentors.org</a> </li>
<li>Provide solutions to problems, not blocks of code</li>
</ul>
</li>
<li>(I wish this was a &#8220;how to do a good job&#8221; and not &#8220;you suck, stop sucking&#8221;. I think he wants to be the king of the rubygems app store)</li>
</ul>
<h2>Lightning Talks</h2>
<h3>Micah Martin &#8211; Limelight</h3>
<ul>
<li>Tool to build GUIs in ruby</li>
<li>Built a gui calculator in 5 minutes</li>
</ul>
<h3>Sean Scofield &#8211; The Awesome Power of Rails Engines</h3>
<ul>
<li>Engines make it easy for frameworks to be built on top of rails</li>
<li>Engine is a complete application that can provide the stuff rails apps provide</li>
<li>app directory is auto loaded</li>
<li>You can supply models, views, controllers in your engine</li>
<li>You can override locale by dropping it in app</li>
<li>Engines extending engines, for example Spree</li>
<li>Bundler ties it all together</li>
</ul>
<h3>Mike Buselli &#8211; Brush::Pipeline</h3>
<ul>
<li>Running external OS commands</li>
<li>sys
<ul>
<li>lower level, more convenient for specific takss</li>
<li>chaining commands</li>
</ul>
</li>
<li>pipeline
<ul>
<li>better at chaining commands</li>
<li>pipeline ['head', 'README'], ['tail', '-n2']</li>
<li>Each part of the pipeline can run in different directories</li>
<li>stderr and stdout redirection</li>
<li>argv[0] renaming</li>
<li>restrict access to open files</li>
<li>Works great on POSIX including cygwin</li>
</ul>
</li>
</ul>
<h3>Chris Hallendy and Nick Lewis &#8211; Realtime Apps</h3>
<ul>
<li>Demo of node.js &lt;-> Redis &lt;-> Rails</li>
</ul>
<h3>Joe Fiorini (sp?) &#8211; Web Katas</h3>
<ul>
<li>Problem: web developers don&#8217;t know http</li>
<li>Rails is big and awesome, but it&#8217;s hard to troubleshoot</li>
<li>It allows us to ignore how http works.</li>
<li>Code Katas <a href="http://bit.ly/codekatas">http://bit.ly/codekatas</a> </li>
<li>No-framework webapp development (Rack) to learn how http cookies work</li>
<li>More Katas
<ul>
<li>Auth token</li>
<li>See Other response status</li>
<li>Move permanently</li>
<li>Session state handling</li>
<li><a href="http://bit.ly/webkatas">http://bit.ly/webkatas</a></li>
</ul>
</li>
</ul>
<h3>Jim Remsik &#8211; Improv: Comedy to Coding</h3>
<ul>
<li>Programming is a people problem</li>
<li>You write code for other people</li>
<li>We use ruby because it is expressive and easy for others to read and maintain</li>
<li>Improv after-hours at hashrock</li>
<li>Yes-and, drop your preconcieved notions at the door</li>
<li>Support your team</li>
</ul>
<h3>Malcolm Arnold &#8211; Ruby Nuby</h3>
<ul>
<li>Brand new social movement dedicated to teaching ruby on rails to disadvantaged youths</li>
<li>Maximize social good by spreading ruby</li>
</ul>
<h3>Praveen Alavilli &#8211; Monetizing your apps</h3>
<ul>
<li>&#8220;chase your dream, money will follow&#8221;</li>
<li>Still a mystery to a lot of people how the money follows</li>
<li>Indirect
<ul>
<li>advertising</li>
<li>offers</li>
<li>referalls</li>
</ul>
</li>
<li>Direct
<ul>
<li>e/m-commerce</li>
<li>freemium</li>
<li>causium (donate money to a cause)</li>
<li>pay as you use</li>
<li>free to use pay for service</li>
<li>premium content</li>
<li>digital goods</li>
<li>virtual currency</li>
<li>subscriptions</li>
</ul>
</li>
<li>Challenge: apply these models to your use cases</li>
<li>Gateway (i.e. Payflow, Authorize.net)</li>
<li>Checkout (Google, PayPal, Amazon)</li>
<li>Platform (PayPal, Amazon)</li>
<li>Also services on top (Chargify, Spreedly, Freshbooks)</li>
<li>Choose one that works the best</li>
<li>Your users need to be able to pay somehow, should not be hard to pay</li>
<li>PCI compliance for charging directly</li>
<li>secure and privacy enabling</li>
<li>Adaptive Payments API</li>
</ul>
<h2>Ryan Singer &#8211; Weaving Design and Development</h2>
<ul>
<li>UI Design and Programming, working together</li>
<li>(telling a story about working with a startup and doing design for them)</li>
<li>Designer says &#8220;let&#8217;s change this button&#8221; while pairing with dev, dev makes the change instantly</li>
<li>XP is focused on delivery</li>
<li>In XP, feedback loops are not as important</li>
<li>Feedback can be difficult if you are purely focused on delivery</li>
<li>Shared code base, code runs on designers computers</li>
<li>Avoid the designer w/ folders full of PSDs and static content
<ul>
<li>Becomes a spec, then the dev has to implement it</li>
</ul>
</li>
<li>Static files are like spikes, for exploration and experimentation</li>
<li>Actual changes need to keep up with the codebase</li>
<li>At 37Signals, no sync problem, because the designers are working in the code base</li>
<li>HAML and Mustache are out, because designers can&#8217;t deal with them</li>
<li>Templates with logic</li>
<li>Avoid helpers writing HTML and presenters writing html</li>
<li>Start together, don&#8217;t bring the designers in late, or the developers in late</li>
<li>Architecture before design leaves UX to too late in the process</li>
<li>Designers starting everything before programmers start, it may be impossible or impractical to code</li>
<li>P&amp;D decide on domain language and basic model</li>
<li>P stub models, controllers, routes, and templates</li>
<li>D few days lead on designing and building templates</li>
<li>Simultaneous
<ul>
<li>P design and build models, controllers, routes, helpers, dynamic templates</li>
<li>D design and build templates and helpers</li>
<li>Repeat this process continuously</li>
</ul>
</li>
<li>Share the codebase</li>
<li>All views are in templates w/ logic (ERB or similar, not HAML)</li>
<li>Start together for domain language and models for communication</li>
<li>constantly committing to the same codebase</li>
<li>Train designers in git and ruby and other things</li>
<li>Designers are motivated to learn so they can make changes directly: it gives them more power</li>
</ul>
<h2>Nick Gauthier &#8211; Grease your Suite</h2>
<h2>Les Hill and Jim Remsik &#8211; Sustainably Awesome</h2>
<ul>
<li>Comfortable and productive environment is crucial</li>
<li>sustainable pace is important. 40h weeks.</li>
<li>cargo culting</li>
<li>Pet friendly</li>
<li>The point is not to do what we do, but to recognize our goals. Don&#8217;t cargo cult these tips!</li>
<li>Casual</li>
<li>No Micromanagement</li>
<li>Don&#8217;t penny pinch</li>
<li>Keep a budget and spend it wisely</li>
<li>$400 per week grocery budget</li>
<li>No death marches</li>
<li>No meetings (except daily standup and project standup and monthly company status meeting)</li>
<li>No hierarchy</li>
<li>No future-proofing (software and organizational practices)</li>
<li>What do you do when a developer rm -rfs?
<ul>
<li>No sudo for devs?</li>
<li>3 manager approval before running a script?</li>
<li>Develop a backup solution and a common machine image?</li>
</ul>
</li>
<li>&#8220;Process is an embedded reaction to prior stupidity&#8221; &#8211; Clay Shirky</li>
<li>A project came along that needed work done ASAP</li>
<li>Crafted an MVP and built it without changing their process</li>
<li>The MVP did not overlap with their mockups and specs</li>
<li>Started with story cards and team boards</li>
<li>Moved to pivotal tracker</li>
<li>Tim Pope had a suggestion about how to work stories in pivotal that worked really well</li>
<li>Always open to try new things and experiment with new processes</li>
<li>Enjoy your work</li>
<li>Don&#8217;t hire people you don&#8217;t like, or without passion</li>
<li>Hire smart people that get things done</li>
<li>Must be a great cultural fit</li>
<li>Hiring
<ul>
<li>phone screening</li>
<li>week long &#8220;test drive&#8221;</li>
<li>gems you use are important</li>
<li>editors you use are important</li>
<li>test driven (and test-first) style</li>
<li>hang out after hours to check for a cultural fit</li>
</ul>
</li>
<li>&#8220;If I&#8217;m not saying &#8216;hell yeah!&#8217; about something, then I say no&#8221; &#8211; Derek Sivers</li>
<li>Firing: due to lack of communication or mistake, probably on both sides</li>
<li>Fire fast, but with compassion</li>
<li>Approach building a team the same way you build software</li>
</ul>
<h2>Yehuda Katz &#8211; Rails 3</h2>
<ul>
<li>Rails core family is getting bigger</li>
<li>Rails 2 was very intertwined</li>
<li>Broke things up cleanly</li>
<li>Instead of Railties being a big glue layer w/ initialization stack, it became a small part or Rails 3 and specifies the framework for applications and engines</li>
<li>Engines are special plugins now that inherit from Railties</li>
<li>Applications inherit from Engines</li>
<li>Railtie lets you add features to rails</li>
<li>Railties provide a series of Hooks</li>
<li>Inheriting from Railtie doesn&#8217;t do anything, but it has lots of functionality</li>
<li>Railtie lets you configure the application, such as pull in generators</li>
<li>Rake Tasks are another Railtie Hook
<ul>
<li>Extra stuff you want to have happen in rake, and not on boot<br />
rake_tasks do<br />
load &#8220;my_stuff/my_tasks.rake&#8221;<br />
end</li>
</ul>
</li>
<li>before_configuration hook = right inside Rails::Application, before user stuff happens, but you know about rails root and stuff.</li>
<li>config.to_prepare : in dev, run every time, in production, run once (i.e. compass template compilation)</li>
<li>Framework loading: ActiveSupport.on_load = i.e. when action mailer loads, monkey patch in some code. Then you don&#8217;t have to try to detect ActionMailer, you just say, when it loads do stuff.</li>
<li>Don&#8217;t do if(defined) because it depends on order</li>
<li>Decouple via Instrumentation</li>
<li>ActiveSupport::Notifications.instrument(&#8220;receive.action_mailer&#8221;) do |payload|; #callback; end</li>
<li>Worth Noting: we worked really hard making things mostly backwards compatible</li>
<li>The old way may appear to work, even if it doesn&#8217;t</li>
<li>AbstractController is decoupled from ActionController</li>
<li>ActionDispatch = Rack++</li>
<li>ActiveModel lets other persistence engines connect to ActionController. Only need to support ~5 methods</li>
<li>Tight Integration without Coupling</li>
<li>Integration first, decouple later</li>
<li>Migrating:
<ol>
<li>Install Rails 2.3.9.</li>
<li>bundler</li>
<li>rails_xss</li>
<li>Deprecations &#8211; get the count to 0</li>
<li>Upgrade</li>
<li>Deprecations again!</li>
</ol>
</li>
<li>Helpers should call partials, not generate html</li>
<li>Rails 3.1: We&#8217;re not burned out!
<ul>
<li>Engines</li>
<li>@drogus did all the engine work</li>
<li>Engine Migrations</li>
<li>Static assets (w/o copying). Leave it in the engine, and Rack::Static will find it</li>
<li>Self-contained engine</li>
<li>Built-in http caching, to get away from filesystem caching</li>
<li>fresh_when? calculates an etag from the post and returns 304 if not fresh</li>
<li>caching at the browser layer</li>
<li>etag can be based on an AR object</li>
<li>If you have Varnish, you can turn off Rack::Cache and fresh_when will be built in</li>
<li>This also means that when you turn on Akamai, you already have all the code that makes it work well</li>
<li>Enables Edge-Cached SCSS</li>
<li>Rack::Cache is like Memcache, but uses HTTP semantics</li>
<li>Assets </li>
<li>ERB == SCSS (I have content that needs to be processed before it hits the browser) </li>
<li>Solution: build in compilation pipeline</li>
<li>app.css.scss (like app.html.erb)</li>
<li>posts/index.css.scss</li>
<li>Treats CSS the same as HTML for templating</li>
<li>SCSS template handler => http response => rack::cache</li>
<li>It just works w/ varnish and the like</li>
<li>Spriting</li>
<li>Compass and lemonade are merging w/ a new sprite api</li>
<li>Put all your images in images/sprites/ 1, 2, 3, 4, .png</li>
<li>Lets you include all the images as a sprite</li>
<li>Gives you a bunch of css classes to use the sprites</li>
<li>SCSS can take CSS, and then add stuff in</li>
<li>You don&#8217;t need imagemagick, there is a pure ruby PNG spriting library</li>
<li>AutoFlush &#8211; it&#8217;s cool, read his blog, running out of time</li>
<li>flush content to the browser as it is rendering</li>
<li>Tradeoffs you have to deal with, like exceptions</li>
<li>Browser can be working on your CSS while you are doing SQL queries</li>
<li>Keep content_for at the top of the template</li>
<li>Exceptron</li>
<li>Stolen from merb</li>
<li>ExceptionsController to render and take actions when exceptions happen</li>
<li>Performance</li>
<li>We did pretty well in 3.0, definitely some trouble spots</li>
<li>More mechanisms for performance</li>
<li>Big Arel rewrite for 3.1</li>
<li>Possible to get to 2x faster over 3.0</li>
</ul>
</li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2010/09/07/nicks-highlights-from-ruby-hoedown/" rel="bookmark" class="crp_title">Nick&#8217;s Highlights from Ruby Hoedown</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/11/23/web-2-0-expo-nyc-wrap-up/" rel="bookmark" class="crp_title">Web 2.0 Expo NYC Wrap Up</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/11/multithreading-in-ruby-on-rails/" rel="bookmark" class="crp_title">Multithreading in Ruby on Rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/03/13/slow-actions-in-rails-projects/" rel="bookmark" class="crp_title">Slow Actions in Rails Projects</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/02/01/setting-up-ubuntu-9-10-for-ruby-on-rails-development/" rel="bookmark" class="crp_title">Setting Up Ubuntu 9.10 for Ruby On Rails Development</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2010/09/11/nicks-highlights-from-windy-city-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nick&#8217;s Highlights from Ruby Hoedown</title>
		<link>http://blog.smartlogicsolutions.com/2010/09/07/nicks-highlights-from-ruby-hoedown/</link>
		<comments>http://blog.smartlogicsolutions.com/2010/09/07/nicks-highlights-from-ruby-hoedown/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 13:11:46 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=963</guid>
		<description><![CDATA[I attended and spoke at Ruby Hoedown 2010. Below are my notes from the conference. Day One (Nuby Hoedown) David A. Black &#8211; The Well-Grounded Nuby Seven key points, with code examples Every expression evaluates to an object if statements and class definitions return objects operations are messages (==, +, etc) methods are messages (to_s) [...]]]></description>
			<content:encoded><![CDATA[<p>I attended and spoke at Ruby Hoedown 2010. Below are my notes from the conference.</p>
<p><span id="more-963"></span></p>
<h2>Day One (Nuby Hoedown)</h2>
<h3>David A. Black &#8211; The Well-Grounded Nuby</h3>
<ul>
<li>Seven key points, with code examples</li>
<li>Every expression evaluates to an object</li>
<li>if statements and class definitions return objects</li>
<li>operations are messages (==, +, etc)</li>
<li>methods are messages (to_s)</li>
<li>a[2] is equivalent to a.<a href="2"></a></li>
<li>case is really if, elsif, etc, which is really x1.===(x0), x2.===(x0), etc.</li>
<li>String === String is false! Classes define === as meaning &#8220;is the argument an instance of me&#8221;</li>
<li>Objects have lookup paths they use to find the method among their associated modules and classes</li>
<li>Super means keep searching for the next method up. Not necessarily the super class, could just be<br />
in a module that was included the most recently.</li>
<li>instance.extend(module) will include the module into that instance, not the entire class</li>
<li>every object has a singleton class that represents the instance. So the above in actually including<br />
the module into the instance&#8217;s singleton class.</li>
<li>there is always a &#8220;self&#8221;. defaults to main:Object</li>
</ul>
<h3>Kevin W. Gisi &#8211; Dynamic Ruby for Nubies</h3>
<ul>
<li>DSLs help bridge the gap between an idea and code, as a layer of abstraction</li>
<li>I got lost :-(</li>
</ul>
<h3>Lunch</h3>
<ul>
<li>Om nom nom</li>
</ul>
<h3>Nick Gauthier &#8211; The Six Ws of Testing</h3>
<ul>
<li>I think it went well. Very low on technical content but many Nubies came to talk to me afterward and said they enjoyed it. I&#8217;m sure I bored the technical folks to tears. But hey, it&#8217;s the Nuby Hoedown!</li>
</ul>
<h3>Matt Yoho &#8211; Gem Authoring and Deployment</h3>
<ul>
<li>&#8220;require&#8221; loads code once, it is smart</li>
<li>&#8220;load&#8221; loads the code without doing any checks</li>
<li>You should not &#8220;require &#8216;rubygems&#8217;&#8221; it should already be on the load path</li>
<li>Don&#8217;t use jeweler, use a real gemspec
<p>http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/</p>
<p>Unsure about this, maybe the gemspec has enough automation you don&#8217;t have to do this any more?</li>
<li>Aruba lets you write cuke specs within cuke specs. Helps with command line applications</li>
</ul>
<h3>Hack Session of DOOM</h3>
<ul>
<li>Two features and one bug on hydra!</li>
</ul>
<h3>Scott Chacon &#8211; Getting Git</h3>
<ul>
<li>http://gitref.org</li>
<li>http://progit.org</li>
<li>schacon@gmail.com (put conf name in subj when emailing questions)</li>
<li>tree -a for nice tree list of a directory</li>
<li>check out his slides for example of cool showoff styling and layout
<p>http://github.com/schacon/showoff-wrangling-git</li>
<li>Email him to ask what he uses for his diagrams and highlights (backgrounds)</li>
<li>Would be really cool to allow a [dot] keyword in showoff to interpret the following graphviz code as a diagram</li>
<li>git log branchA ^branchB<br />
show commits reachable by A but not by B<br />
for example, I&#8217;m working on branch my-feature<br />
git log my-feature ^master<br />
is the stuff I&#8217;ve done that&#8217;s not in master yet</li>
<li>git branch &#8211;merged<br />
show me all branches that have been merged (safe to delete)</li>
<li>git branch &#8211;no-merged<br />
show me all branches that have not been merged</li>
</ul>
<h2>Day Two</h2>
<h3>Bryan Liles &#8211; Coding in Anger (or is that Desperation?)</h3>
<ul>
<li>Bryan Liles sings country</li>
<li>&#8220;run through the problem, take no prisoners&#8221; &#8230; &#8220;and undoubtedly do some bad things&#8221;</li>
<li>&#8220;we build straw houses&#8221;</li>
<li>&#8220;if you do it the wrong way just to get it done, you&#8217;ll get hit in the future&#8221;</li>
<li>Cargo Cult: &#8220;we&#8217;re all guilty of it&#8221; and &#8220;it&#8217;s bad&#8221;
<ul>
<li>Copy-pasting other people&#8217;s code without understanding it</li>
<li>&#8220;Copying code is not bad&#8221;</li>
<li>&#8220;It might do the right thing, but it might not be doing the right thing&#8221;</li>
<li>Read the code first</li>
<li>Respect the copyright</li>
<li>Understand what you copy</li>
<li>Don&#8217;t &#8220;copy and paste&#8221;</li>
<li>UNDERSTAND WHAT YOU COPY</li>
</ul>
</li>
<li>&#8220;It takes a big man to understand humility&#8221; </li>
<li>Break a task down and constantly refine task estimates</li>
<li>A desperate coder is a bad coder</li>
</ul>
<h4>bonus lightning talk: You are your own sales person</h4>
<ul>
<li>you are the product</li>
<li>you are the salesperson</li>
</ul>
<h3>Justin Love &#8211; You already use Closure</h3>
<ul>
<li>Block based programming</li>
<li>containment: f = File.read vs File.open do |f| &#8230;; end</li>
<li>You can call a proc with []<br />
proc.call(a,b) is equivalent to proc[a,b]</li>
<li>duwanis in IRC: &#8220;rack of lambda&#8221;</li>
</ul>
<h3>Nick Gauthier &#8211; Grease your Suite</h3>
<h3>Matthew Bass &#8211; A/B Testing for Developers</h3>
<ul>
<li>Choose a metric</li>
<li>Do some experiments</li>
<li>Compare the metrics</li>
<li>Vanity for rails A/B testing</li>
</ul>
<h3>Yossef Mendelssohn &#8211; The Perpetual Novice</h3>
<ul>
<li>Dryfus skill acquisition model</li>
<li>Novice level: follow the rules, do what you&#8217;re told</li>
<li>Adv. Beginner: limited ability to perceive different aspects of the situation</li>
<li>Competence: multitasking, handle more information, see how actions are related to goals</li>
<li>Proficiency: higher level view of the task, prioritize, adapt</li>
<li>Expert: no longer relying on rules and guidelines, deep &amp; tacit understanding, intuition</li>
<li>be mindful of your scenario: other people (or yourself) need to deal with the work you&#8217;ve done</li>
<li>unconscious incompetence: you don&#8217;t know what you&#8217;re doing and you don&#8217;t know that you don&#8217;t know it</li>
<li>conscious incompetence: you don&#8217;t know what you&#8217;re doing, but you know that you don&#8217;t know what you&#8217;re doing</li>
<li>conscious competence: you can do it and you understand it, but you have to think about it</li>
<li>unconscious competence: it is second nature to you. You know what you&#8217;re doing and you don&#8217;t have to try</li>
<li>Dunning-krueger effect:
<ul>
<li>when you don&#8217;t know what you don&#8217;t know, you don&#8217;t appreciate the skill itself, and are therefore very confident of yourself.</li>
<li>If you understand the skills, the more competent people think they are not very competent</li>
</ul>
</li>
<li>You need to practice, outside your main work</li>
<li>Focus on getting better, the entire time</li>
<li>low level people working together can be dangerous</li>
<li>a skilled person working with a lower level person need to work at the lower person&#8217;s level</li>
<li>Shuhari
<ul>
<li>Shu: learning fundamental techique, rules and guidelines (acceptance)</li>
<li>Ha: detach, digress, and break from tradition. think for yourself</li>
<li>Ri: transcendence: moved past rules and guidelines (no form)</li>
</ul>
</li>
<li>Shoshyu: beginner&#8217;s mind. In the beginner&#8217;s mind there are many possibilities. In an expert&#8217;s mind, there are few.
<ul>
<li>Experts have a tendency to stop asking questions</li>
<li>Beginners always ask questions</li>
</ul>
</li>
<li>Something doesn&#8217;t suck just because it&#8217;s old</li>
</ul>
<h3>Starcraft interlude</h3>
<ul>
<li>Nick Gauthier vs Bryan Liles and Saxon</li>
</ul>
<h3>Ben Scofield &#8211; Keynote</h3>
<ul>
<li>Practice is important for mastery</li>
<li>Practice is not fun</li>
<li>mastery is know how to do things, not just knowing what was done</li>
<li>mastery is not required</li>
<li>as a company, deciding what not to do is as important (or more) as deciding what to do</li>
<li>Pick out what is most important to succeed, and outsource the rest</li>
<li>errbit : open source alternative to hoptoad</li>
<li>as a company, focus on the most important stuff</li>
<li>live intentionally: think about what you&#8217;re spending your time on.</li>
<li>Embrace adequacy (and mediocrity)</li>
</ul>
<h2>Day Three</h2>
<p>Family friendly ruby conf in disney world. $189/night @ contemporary. Free conference.</p>
<p>http://magic-ruby.com</p>
<h3>Michael Jackson &#8211; Parsing Expressions in Ruby</h3>
<ul>
<li>Different school of thought alternative to regular expressions</li>
<li>Regexes are great but complicated ones get really gross, even after 10 or 12 characters</li>
<li>parsing expressions are:
<ul>
<li>declarative</li>
<li>recursive</li>
<li>readable</li>
<li>easy to maintain</li>
<li>not ambiguous</li>
<li>slow :-) (in ruby)</li>
</ul>
</li>
<li>Citrus gem</li>
</ul>
<h3>John Willis &#8211; Configuration Management in the Cloud with Chef</h3>
<ul>
<li>infrastructure as code</li>
<li>need to be able to share with teammates</li>
<li>can&#8217;t have &#8220;the deploy guy&#8221;</li>
<li>Chef is a library for configuration management</li>
<li>Chef client runs on the system (to accept commands and configuration)</li>
<li>Chef server is a RESTful API</li>
<li>Each system you configure is a Node</li>
<li>Attributes are searchable</li>
<li>Knife is the tool you use to interact with the API</li>
<li>Nodes have Roles, which describe what a Node should be</li>
<li>Nodes have a Run List
<ul>
<li>What Roles or Recipes to apply in Order</li>
</ul>
</li>
<li>A Resource is a Package or a Service</li>
<li>E.G. Package &#8220;sudo&#8221; &#8220;1.6.8p12&#8243; and it figures out what package manager to use</li>
<li>Services support actions (e.g. apache supports &#8220;restart&#8221; and &#8220;status&#8221;)</li>
<li>Resources take action through providers</li>
<li>Data bags store arbitrary data
<ul>
<li>E.G. put a user w/ their ssh key in a data bag, so you can add them as a user on the server</li>
</ul>
</li>
<li>Cookbooks are shareable</li>
<li>&#8220;Open source for infrastructure&#8221;</li>
<li>Open training</li>
<li>Cloud service independence (swap from slicehost to rackspace just by adding credentials)</li>
<li>http://www.opscode.com
<ul>
<li>5 chef servers for free</li>
</ul>
</li>
<li>@opscode @botchagalupe</li>
<li>Chef beats puppet on cloud support (more vendors)</li>
</ul>
<h3>Backchannel notes</h3>
<ul>
<li>Whiskydisk for deploy</li>
</ul>
<h3>Alex Sharp &#8211; Refactoring in Practice</h3>
<ul>
<li>Shantytown application: you want to bulldoze it, but people live there</li>
<li>testing in crucial for refactoring</li>
<li>avoid the EPIC refactor</li>
<li>changing the implementation without changing its behavior</li>
<li>deprecate action
<ul>
<li>for example, hoptoad a deprecation warning on old calls to actions</li>
<li>helpful when there are ajax calls you are not sure about</li>
</ul>
</li>
<li>take out small chunks and get them under test</li>
<li>lack of framework knowledge &#8211; often using existing solutions is an easy refactor</li>
<li>Domain driven development &amp; domain modeling</li>
<li>Document the smells</li>
<li>delete code that you aren&#8217;t using</li>
</ul>
<h3>Brian Hogan &#8211; There&#8217;s a Wheel for that Already</h3>
<ul>
<li>&#8220;I don&#8217;t want to use that because I don&#8217;t like how it looks&#8221;</li>
<li>How often is &#8220;better&#8221; really just an opinion</li>
<li>Forwardable &#8211; delegate a method to another class</li>
<li>Rails.root.join(&#8216;config&#8217;, &#8216;x.yml&#8217;)</li>
<li>dir, base = path.split</li>
<li>open-uri wraps net/http, net/https, net/ftp</li>
<li>Tempfile (like tmpdir, but just for one file)</li>
<li>x = Tempfile.new(&#8216;hydra.yml&#8217;)</li>
<li>OpenStruct.new(Yaml.load(&#8216;config.yml&#8217;))</li>
<li>Observer<br />
@@@ ruby<br />
def initialize<br />
  add_observer MyObserver.new<br />
end<br />
&#8230; later<br />
call: &#8220;changed&#8221; !</li>
<li>bash alias for serving static files via webrick<br />
I wasn&#8217;t able to write it down quick enough.</li>
<li>PStore for storing data</li>
<li>CSV is great if it doesn&#8217;t need to be faster</li>
<li>Home Run for datetime speedup via C extension</li>
<li>Oh no, I had to catch my flight and I missed the rest of this awesome talk!</li>
</ul>
<h3>Glenn Vanderburg &#8211; Keynote</h3>
<ul>
<li>Wasn&#8217;t there. See notes from Lone Star Ruby Conf. It was probably the same talk</li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2010/09/11/nicks-highlights-from-windy-city-rails/" rel="bookmark" class="crp_title">Nick&#8217;s Highlights from Windy City Rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/04/introducing-environmentalize-an-intuitive-environment-focused-config-structure-for-your-rails-applications/" rel="bookmark" class="crp_title">Introducing environmentalist: an intuitive, environment-focused config structure for your rails applications</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/08/30/nicks-highlights-from-lone-star-ruby-conf/" rel="bookmark" class="crp_title">Nick&#8217;s Highlights from Lone Star Ruby Conf</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/23/dont-abuse-the-session/" rel="bookmark" class="crp_title">Don&#8217;t Abuse the Session</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/10/merging-a-has_many-relationship-into-one-instance/" rel="bookmark" class="crp_title">Merging a :has_many relationship into one instance</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2010/09/07/nicks-highlights-from-ruby-hoedown/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nick&#8217;s Highlights from Lone Star Ruby Conf</title>
		<link>http://blog.smartlogicsolutions.com/2010/08/30/nicks-highlights-from-lone-star-ruby-conf/</link>
		<comments>http://blog.smartlogicsolutions.com/2010/08/30/nicks-highlights-from-lone-star-ruby-conf/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 21:12:05 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=954</guid>
		<description><![CDATA[I recently attended and spoke at Lone Star Ruby Conf 2010. I took notes on anything technical I thought would be useful to bring back and use day-to-day at SmartLogic. Keep in mind there were many excellent talks that aren&#8217;t on this list, it&#8217;s just a snippet of things I wanted to look into more. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently attended and spoke at Lone Star Ruby Conf 2010. I took notes on anything technical I thought would be useful to bring back and use day-to-day at SmartLogic. Keep in mind there were many excellent talks that aren&#8217;t on this list, it&#8217;s just a snippet of things I wanted to look into more.</p>
<p><span id="more-954"></span></p>
<h2>Day one</h2>
<h3>Adam Keys &#8211; Rails&#8217; Next Top Model: Using ActiveModel and ActiveRelation</h3>
<ul>
<li>Rails 3 &#8211; ActiveSupport::Concern</li>
<li>Accessors + Concern cleans up code</li>
<li>New encryption classes for secure keys and encrypted data transfer</li>
<li>ActiveModel::Validator for non AR validations</li>
<li>validates_with MyValidator</li>
<li>ActiveModel::Serialization for hydra?</li>
<li>serialization: require ‘attributes’ and ‘attributes=’</li>
<li>serializable_hash =&gt; to_json, to_xml, from_json, from_xml</li>
<li>ActiveRelation (AREL)</li>
</ul>
<h3>Jesse Crouch &#8211; Building fast, lightweight data-driven apps using the Infochimps API</h3>
<p>Infochimps API to create linkedin’ 2nd degree network with twitter data. Check it out at <a href="http://trst.me">http://trst.me</a></p>
<h3>Aman Gupta &#8211; Debugging Ruby: Understanding and Troubleshooting the VM and your Application</h3>
<p>Slides: http://dl.dropbox.com/u/635/debugging_ruby-lsrc.pdf</p>
<ul>
<li>lsof -nPp : get open files for a specific pid</li>
<li>strace: observe functions being called. Can see reads and writes between processes, like rails hitting mysql</li>
<li>compile ruby w/ &#8211;enable-pthreads (not by default in debian or in rvm)</li>
<li>See http://rvm.beginrescueend.com/rubies/installing/ end of page for how to do this via RVM</li>
<li>tcpdump for networking</li>
<li>google perftools for ruby profiling</li>
<li>pprof ruby =&gt; graphical output</li>
<li>home_run for C based time parsing</li>
<li>perftools.rb for ruby diagrams of usage time</li>
<li>gdb.rb to executive ruby from gdb, when running ruby via gdb</li>
<li>bleak house: ruby memory leak detector</li>
<li>rack-perftools: rack middleware for perftools.rb</li>
<li>google perftools for forking</li>
</ul>
<h3>Caleb Clausen – What every Ruby programmer should know about threads</h3>
<ul>
<li>Thread safe objects: mutex, queue, sizequeue, condition variable</li>
<li>Semaphores to signal between threads</li>
<li>Mutex to lock and unlock resources</li>
</ul>
<h3>Jesse Wolgamott &#8211; Battle of NoSQL stars: Amazon&#8217;s SDB vs Mongoid vs CouchDB vs RavenDB</h3>
<ul>
<li>CouchDB is ACID, has great replication</li>
<li>Mongo has great rails support</li>
</ul>
<h2>Day two</h2>
<h3>James Edward Gray II &#8211; Ruby in the Wild</h3>
<ul>
<li>Logarithmic graphs!</li>
<li>Rubyists like to do a lot of stuff from scratch</li>
<li>&#8220;I&#8217;ve always been a fan of sqlite&#8221; &#8211; wha?</li>
<li>For fun, scatch an itch, try something new</li>
<li>&#8220;I try to make it a fun place [to work]&#8220;</li>
<li>Greg Brown wearing a Boh hat for his interview</li>
<li>Core of rake written in 30 mins</li>
<li>Rake file list in place of Dir.glob for hydra? (FileList ?)</li>
<li>File matching to compare input (source) and output (binary). Maybe for Sauron?</li>
</ul>
<h3>Chat with Scott Bellware</h3>
<p>I had a great chat with Scott Bellware about Agile, Lean, and his own style of OO integration testing. He recommended this book:</p>
<p><a href="http://www.amazon.com/gp/product/1935401009?ie=UTF8&#038;force-full-site=1">The Principles of Product Development Flow: Second Generation Lean Product Development</a></p>
<p>Also, he sent me a link to how he does his OO testing scenarios:</p>
<p><a href="http://github.com/sbellware/preview-signup">http://github.com/sbellware/preview-signup</a></p>
<p>I flew back after lunch on day two, so I&#8217;ll have to catch the rest in the videos!</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2010/09/07/nicks-highlights-from-ruby-hoedown/" rel="bookmark" class="crp_title">Nick&#8217;s Highlights from Ruby Hoedown</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/11/23/web-2-0-expo-nyc-wrap-up/" rel="bookmark" class="crp_title">Web 2.0 Expo NYC Wrap Up</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/09/19/fork-pools-in-ruby-on-rails/" rel="bookmark" class="crp_title">Fork Pools in Ruby on Rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/11/multithreading-in-ruby-on-rails/" rel="bookmark" class="crp_title">Multithreading in Ruby on Rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2007/05/07/sls-welcomes-scott-davis-to-the-team/" rel="bookmark" class="crp_title">SLS Welcomes Scott Davis to the Team</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2010/08/30/nicks-highlights-from-lone-star-ruby-conf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing PostGIS 1.5 on PostgreSQL 8.4 on Ubuntu</title>
		<link>http://blog.smartlogicsolutions.com/2010/03/04/installing-postgis-1-5-0-on-postgresql-8-4-on-ubuntu-9-10/</link>
		<comments>http://blog.smartlogicsolutions.com/2010/03/04/installing-postgis-1-5-0-on-postgresql-8-4-on-ubuntu-9-10/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 19:54:02 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[postgis]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=867</guid>
		<description><![CDATA[I had a bit of trouble installing the latest PostGIS 1.5 under PostgreSQL 8.4. Here are my instructions. These work on Ubuntu 8.04, 9.04, 9.10, 10.04, and 10.10. UPDATE This post has been updated to include the awesome instructions from Leo regarding using the postgis-unstable ppa. Thanks Leo! 1. Install PostGIS from PPA System -> [...]]]></description>
			<content:encoded><![CDATA[<p>I had a bit of trouble installing the latest PostGIS 1.5 under PostgreSQL 8.4. Here are my instructions. These work on Ubuntu 8.04, 9.04, 9.10, 10.04, and 10.10.</p>
<p><span id="more-867"></span></p>
<p><strong>UPDATE</strong></p>
<p>This post has been updated to include the awesome instructions from Leo regarding using the postgis-unstable ppa. Thanks Leo!</p>
<h3>1. Install PostGIS from PPA</h3>
<p>System -> Administration -> Software Sources</p>
<p>Click on the &#8220;Other Software&#8221; tab.</p>
<p>Click on &#8220;+Add&#8221;</p>
<p>Enter: &#8220;ppa:ubuntugis/ubuntugis-unstable&#8221;</p>
<p>More info: <a href="https://launchpad.net/~ubuntugis/+archive/ubuntugis-unstable">https://launchpad.net/~ubuntugis/+archive/ubuntugis-unstable</a></p>
<p>Now install the package &#8220;postgresql-8.4-postgis&#8221;</p>
<h3>2. Setup your database</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">createdb my_db
createlang plpgsql my_db
psql <span style="color: #660033;">-d</span> my_db <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>postgresql<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.4</span><span style="color: #000000; font-weight: bold;">/</span>contrib<span style="color: #000000; font-weight: bold;">/</span>postgis-<span style="color: #000000;">1.5</span><span style="color: #000000; font-weight: bold;">/</span>postgis.sql
psql <span style="color: #660033;">-d</span> my_db <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>postgresql<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.4</span><span style="color: #000000; font-weight: bold;">/</span>contrib<span style="color: #000000; font-weight: bold;">/</span>postgis-<span style="color: #000000;">1.5</span><span style="color: #000000; font-weight: bold;">/</span>spatial_ref_sys.sql
psql <span style="color: #660033;">-d</span> my_db <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>postgresql<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.4</span><span style="color: #000000; font-weight: bold;">/</span>contrib<span style="color: #000000; font-weight: bold;">/</span>postgis_comments.sql</pre></div></div>

<p>Now you should be able to make a geometry table.</p>
<h3>3. Setup your geometry table</h3>
<p>At this point I&#8217;m showing how to make an example table. Your usage of the PostGIS library will probably differ.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">SEQUENCE</span> points_id_seq;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> points <span style="color: #66cc66;">&#40;</span> id <span style="color: #993333; font-weight: bold;">INTEGER</span> <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NEXTVAL</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'points_id_seq'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">SELECT</span> AddGeometryColumn<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'points'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'location'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">4326</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'POINT'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">INDEX</span> points_location_idx <span style="color: #993333; font-weight: bold;">ON</span> points <span style="color: #993333; font-weight: bold;">USING</span> GIST <span style="color: #66cc66;">&#40;</span> location <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #66cc66;">//</span> <span style="color: #993333; font-weight: bold;">CREATE</span> a point
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> points<span style="color: #66cc66;">&#40;</span>location<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span>ST_GeomFromText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'POINT(-76.615657 39.327052)'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #66cc66;">//</span> <span style="color: #993333; font-weight: bold;">RETURNS</span> the point
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> points <span style="color: #993333; font-weight: bold;">WHERE</span> ST_Distance<span style="color: #66cc66;">&#40;</span>location<span style="color: #66cc66;">,</span> ST_GeomFromText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'POINT(-76 39)'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">1</span>;
&nbsp;
<span style="color: #66cc66;">//</span> Does <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">RETURN</span> the point
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> points <span style="color: #993333; font-weight: bold;">WHERE</span> ST_Distance<span style="color: #66cc66;">&#40;</span>location<span style="color: #66cc66;">,</span> ST_GeomFromText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'POINT(-76 39)'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #66cc66;">.</span>1;</pre></div></div>

<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/06/13/ruby-on-rails-polymorphic-association-benchmarks/" rel="bookmark" class="crp_title">Ruby on Rails Polymorphic Association Benchmarks</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/01/16/ext4-on-ubuntu-904/" rel="bookmark" class="crp_title">EXT4 On Ubuntu 9.04</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/06/deploying-rails-apps-with-capistrano-without-root-or-sudo-privileges/" rel="bookmark" class="crp_title">Deploying Rails Apps with Capistrano without root or sudo Privileges</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/07/i-cant-upgrade-rubygems-from-111-to-120-on-ubuntu/" rel="bookmark" class="crp_title">I can&#8217;t upgrade RubyGems from 1.1.1 to 1.2.0 on Ubuntu</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/02/01/setting-up-ubuntu-9-10-for-ruby-on-rails-development/" rel="bookmark" class="crp_title">Setting Up Ubuntu 9.10 for Ruby On Rails Development</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2010/03/04/installing-postgis-1-5-0-on-postgresql-8-4-on-ubuntu-9-10/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Using Byobu and Landscape to improve remote Ubuntu sessions</title>
		<link>http://blog.smartlogicsolutions.com/2010/01/22/ubuntu-byobu-landscape/</link>
		<comments>http://blog.smartlogicsolutions.com/2010/01/22/ubuntu-byobu-landscape/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 20:44:11 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=827</guid>
		<description><![CDATA[SSHing into remote servers can be an awkward experience, but it doesn&#8217;t have to be. You can turn your ssh console into a terminal-style window manager with Byobu, and get more system information via landscape. &#8220;Byobu is a Japanese term for decorative, multi-panel screens that serve as folding room dividers. As an open source project, [...]]]></description>
			<content:encoded><![CDATA[<p>SSHing into remote servers can be an awkward experience, but it doesn&#8217;t have to be. You can turn your ssh console into a terminal-style window manager with Byobu, and get more system information via landscape.<br />
<span id="more-827"></span></p>
<blockquote><p><em>&#8220;Byobu is a Japanese term for decorative, multi-panel screens that serve as folding room dividers. As an open source project, Byobu is an elegant enhancement of the otherwise functional, plain, practical GNU Screen.&#8221;</em></p>
<p><a href="https://wiki.ubuntu.com/MeetingLogs/openweekKarmic/Byobu">https://wiki.ubuntu.com/MeetingLogs/openweekKarmic/Byobu</a></p></blockquote>
<p>SSH into your server and install the two packages:</p>
<blockquote><p><code><strong>sudo apt-get install byobu landscape-common update-motd</strong></code></p></blockquote>
<p>Next, run byobu-config:</p>
<div id="attachment_832" class="wp-caption aligncenter" style="width: 652px"><img class="size-full wp-image-832" title="byobu-config" src="http://blog.smartlogicsolutions.com/wp-content/uploads/2010/01/byobu-config.png" alt="Change Byobu settings with byobu-config" width="642" height="400" /><p class="wp-caption-text">Change byobu settings with byobu-config</p></div>
<p>You can change Byobu&#8217;s colors if you&#8217;d like. I like the &#8220;dark&#8221; theme.</p>
<p>The important setting to change is the last one: &#8220;<strong>Byobu currently does not launch at login</strong>&#8220;. Select that and press return. Now you can go back to the menu and exit byobu-config (tab to the exit choice and hit return).</p>
<p>Now log out and log back in again. You&#8217;ll now access Byobu automatically.</p>
<div id="attachment_841" class="wp-caption aligncenter" style="width: 652px"><img class="size-full wp-image-841" title="byobu-login" src="http://blog.smartlogicsolutions.com/wp-content/uploads/2010/01/byobu-login.png" alt="Byobu as your session manager" width="642" height="400" /><p class="wp-caption-text">Byobu as your session manager</p></div>
<p>The new MOTD (that&#8217;s &#8220;Message of the Day&#8221;, which is the text that is displayed when you login) has system information, thanks to <strong>landscape-common</strong>. This will let you know if your almost out of memory or disk space, or if you&#8217;re under heavy load.</p>
<p>Now let&#8217;s look at the information Byobu provides. The bottom row of Byobu contains, from left to right, your Distribution logo and name, uptime, load, cpu frequencies, ram amount and usage, and the date.</p>
<p>The upper row are your windows. Press <strong>F2</strong> to create a new window. Along the bottom of the screen you&#8217;ll now see two entries in the top row of the footer. Press <strong>F3</strong> to move to the previous window and <strong>F4</strong> to move to the next window.</p>
<p>Press <strong>F8</strong>, then give the window a name, like &#8220;echo&#8221;. I like to name each tab with the task I&#8217;m doing, like &#8220;console&#8221;, &#8220;mysql&#8221;, and &#8220;top&#8221;.</p>
<p>You can press <strong>F7</strong> to enter copy/scrollback mode. Use the arrow and page-up/down keys to move around your session. Press the spacebar to start copying. Now move your cursor somewhere else. Then press space again to copy the selection. Byobu doesn&#8217;t have a paste hotkey, so you have to use the screen hotkey, which is <strong>CTRL-a ]</strong> (thats <strong>CTRL-a</strong>, then let go of control and press <strong>]</strong>).</p>
<p>You can press <strong>F12</strong> to quickly lock your terminal, to grab a quick cup of coffee (or read this blog!).</p>
<p>Let&#8217;s explore how to maintain a session. Issue the following command:</p>
<blockquote><p><code><strong>echo hi</strong></code></p></blockquote>
<p>That will print out &#8220;hi&#8221; on the screen. Now let&#8217;s exit this session. Press the Byobu hotkey <strong>F6</strong> to &#8220;Detach&#8221; from Byobu.</p>
<p>You&#8217;ll notice you&#8217;re still logged in, this is because Byobu is an application that runs on top of your session. So now you have to exit again to get back to your local machine.</p>
<p>Now SSH back into your machine. You&#8217;ll notice that command is still on the screen! &#8220;Detaching&#8221; does not end your session, it just detaches you from it. That means you can log in, run a long running task, and then Detach and come back in the morning when your task is done.</p>
<p>For extended information on Byobu, check out its <a href="http://manpages.ubuntu.com/manpages/karmic/en/man1/byobu.1.html">Ubuntu Man Page</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/" rel="bookmark" class="crp_title">Mount options to improve ext4 file system performance</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/07/i-cant-upgrade-rubygems-from-111-to-120-on-ubuntu/" rel="bookmark" class="crp_title">I can&#8217;t upgrade RubyGems from 1.1.1 to 1.2.0 on Ubuntu</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/26/loosely-defined-link_to-may-cause-problems-when-overriding-url_helper/" rel="bookmark" class="crp_title">Loosely defined link_to may cause problems when overriding url_helper</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/12/watch-multiple-logs-in-a-single-terminal/" rel="bookmark" class="crp_title">Watch Multiple Logs in a Single Terminal</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/11/problems-with-restful_authentication-plugin-and-internet-explorer-cookies/" rel="bookmark" class="crp_title">Problems with restful_authentication Plugin and Internet Explorer Cookies</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2010/01/22/ubuntu-byobu-landscape/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>DRY up your Controllers with find_or_redirect</title>
		<link>http://blog.smartlogicsolutions.com/2009/10/23/dry-up-your-controllers-with-find_or_redirect/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/10/23/dry-up-your-controllers-with-find_or_redirect/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 19:27:46 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=721</guid>
		<description><![CDATA[Do you do this: class ModelsController &#60; ApplicationController before_filter :find_model def show end &#160; def destroy @model.destroy end &#160; private &#160; def find_model @model = Model.find_by_id&#40;params&#91;:id&#93;&#41; unless @model redirect_to :action =&#62; :index flash&#91;:error&#93; = &#34;Invalid model id&#34; return false end end end in every controller? Gets repetitive doesn&#8217;t it? How about this: class ModelsController find_or_redirect [...]]]></description>
			<content:encoded><![CDATA[<p>Do you do this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">class</span> ModelsController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
    before_filter <span style="color:#ff3333; font-weight:bold;">:find_model</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> show
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> destroy
      <span style="color:#0066ff; font-weight:bold;">@model</span>.<span style="color:#9900CC;">destroy</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    private
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> find_model
      <span style="color:#0066ff; font-weight:bold;">@model</span> = Model.<span style="color:#9900CC;">find_by_id</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#0066ff; font-weight:bold;">@model</span>
        redirect_to <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:index</span>
        flash<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;Invalid model id&quot;</span>
        <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">false</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>in every controller? Gets repetitive doesn&#8217;t it?<br />
<span id="more-721"></span><br />
How about this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">class</span> ModelsController
    find_or_redirect
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> show
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> destroy
      <span style="color:#0066ff; font-weight:bold;">@model</span>.<span style="color:#9900CC;">destroy</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now that&#8217;s DRY!</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">gem install find_or_redirect</pre></div></div>

<p>More info on the <a href="http://github.com/ngauthier/find_or_redirect">find_or_redirect github page</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/07/21/advanced-model-based-searches-in-rails/" rel="bookmark" class="crp_title">Advanced Model Based searches in rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/10/merging-a-has_many-relationship-into-one-instance/" rel="bookmark" class="crp_title">Merging a :has_many relationship into one instance</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/28/faking-a-will-paginate-collection-on-an-active-resource-model/" rel="bookmark" class="crp_title">Faking a Will Paginate Collection on an Active Resource model</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/26/loosely-defined-link_to-may-cause-problems-when-overriding-url_helper/" rel="bookmark" class="crp_title">Loosely defined link_to may cause problems when overriding url_helper</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/09/reading-and-replacing-text-in-word-docx-and-excel-xlsx-documents-using-ruby/" rel="bookmark" class="crp_title">Reading and replacing text in Word DocX and Excel XlsX documents using Ruby</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/10/23/dry-up-your-controllers-with-find_or_redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mount options to improve ext4 file system performance</title>
		<link>http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 15:15:26 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=677</guid>
		<description><![CDATA[I recently boosted my rails test suite running time by around 30% by adding certain mount options for my ext4 partition (works for ext3 too). I thought I&#8217;d blog about it because the first time I tried my system wouldn&#8217;t boot! So here are the step by step instructions: 2) Run: > tune2fs -o journal_data_writeback [...]]]></description>
			<content:encoded><![CDATA[<p>I recently boosted my rails test suite running time by around <strong>30%</strong> by adding certain mount options for my ext4 partition (works for ext3 too). I thought I&#8217;d blog about it because the first time I tried my system wouldn&#8217;t boot! So here are the step by step instructions:</p>
<p><span id="more-677"></span></p>
<p><strong>2) Run:</strong><br />
> tune2fs -o journal_data_writeback /dev/sdXY<br />
Where /dev/sdXY is replaced by the partition that you want to boost</p>
<p><strong>4) Edit fstab</strong></p>
<p>> nano -w /mnt/sdXY/etc/fstab</p>
<p>Find the line that references sdXY. It will look something like:</p>
<p><code># /dev/sda2<br />
UUID=be2f0ac2-4683-4550-bcd1-704a1a840b3e / ext4 relatime,errors=remount-ro 0 1</code></p>
<p>The first entry is the UUID (although on your system this could just be /dev/sdXY). The second entry is the path (/ for me). Third is the fstype (ext3/4). Fourth are the options. Fifth is for dump and sixth is pass. See man fstab(5) for more info.</p>
<p>Change the options to:</p>
<p><code>noatime,data=writeback,barrier=0,nobh,errors=remount-ro</code></p>
<p>(you can leave all of yours in place, if they weren&#8217;t the same as mine.</p>
<p>The main ones are replacing atime/relatime with <strong>noatime</strong>. This causes the FS to not write read-times to a file when read. Think about it. Writing to the FS for every read of the FS? crazy!</p>
<p>Next is <strong>data=writeback</strong>. This means that metadata for files can be written lazily after the file is written. This will not cause file system corruption, but it may cause the most recent changes to be lost in the event of a crash (so you may jump back into the past a bit).</p>
<p>Next is barrier, which is slightly more dangerous:</p>
<blockquote><p>barrier=<0|1(*)> This enables/disables the use of write barriers in<br />
the jbd code. barrier=0 disables, barrier=1 enables.<br />
This also requires an IO stack which can support<br />
barriers, and if jbd gets an error on a barrier<br />
write, it will disable again with a warning.<br />
Write barriers enforce proper on-disk ordering<br />
of journal commits, making volatile disk write caches<br />
safe to use, at some performance penalty. If<br />
your disks are battery-backed in one way or another,<br />
disabling barriers may safely improve performance.</p></blockquote>
<p>Next is nobh:</p>
<blockquote><p>bh (*) ext4 associates buffer heads to data pages to<br />
nobh (a) cache disk block mapping information<br />
(b) link pages into transaction to provide<br />
ordering guarantees.<br />
&#8220;bh&#8221; option forces use of buffer heads.<br />
&#8220;nobh&#8221; option tries to avoid associating buffer<br />
heads (supported only for &#8220;writeback&#8221; mode).</p></blockquote>
<p>You can skip barrier and nobh if you&#8217;d like. noatime and data=writeback are the big ones.</p>
<p><strong>6) Reboot to your system.</strong></p>
<p>If you have any trouble booting, just boot a recovery disk and revert the fstab changes.</p>
<p>EDIT: Updated to no longer require recovery disk booting thanks to <a href="http://www.notgeeklycorrect.com/resources/2010/01/06/accelerate-your-tests-in-rails-with-ubuntu/">Nicolas Alpi&#8217;s response post</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/01/16/ext4-on-ubuntu-904/" rel="bookmark" class="crp_title">EXT4 On Ubuntu 9.04</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/26/loosely-defined-link_to-may-cause-problems-when-overriding-url_helper/" rel="bookmark" class="crp_title">Loosely defined link_to may cause problems when overriding url_helper</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/01/22/ubuntu-byobu-landscape/" rel="bookmark" class="crp_title">Using Byobu and Landscape to improve remote Ubuntu sessions</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/08/benchmark-ruby-code-with-r-rsruby-and-better-benchmark/" rel="bookmark" class="crp_title">Benchmark Ruby Code with R, rsruby and better-benchmark</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/07/i-cant-upgrade-rubygems-from-111-to-120-on-ubuntu/" rel="bookmark" class="crp_title">I can&#8217;t upgrade RubyGems from 1.1.1 to 1.2.0 on Ubuntu</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Find the Unique Sessions for a Rails Application</title>
		<link>http://blog.smartlogicsolutions.com/2009/05/04/find-the-unique-sessions-for-a-rails-application/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/05/04/find-the-unique-sessions-for-a-rails-application/#comments</comments>
		<pubDate>Mon, 04 May 2009 15:32:47 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[log files]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=617</guid>
		<description><![CDATA[Today we&#8217;re going to look at how to find the number of unique sessions over a specific time frame for a rails application. We&#8217;ll be using the slow-actions gem. Slow-Actions is great tool for determining the slow areas of a rails application. Since it is built on a rails log parser, it can be used [...]]]></description>
			<content:encoded><![CDATA[<p>Today we&#8217;re going to look at how to find the number of unique sessions over a specific time frame for a rails application. We&#8217;ll be using the <a href="http://github.com/ngauthier/slow-actions/tree/master">slow-actions</a> gem.</p>
<p><span id="more-617"></span></p>
<p>Slow-Actions is great tool for determining the slow areas of a rails application. Since it is built on a rails log parser, it can be used for many other things. For example, here is some standard output from slow-actions when you want to know the speed of different user sessions within a specific date range:</p>
<pre>
slow-actions log/development.log --sessions --start-date=2009-03-01 --end-date=2009-04-01
           Cost    Average Max
+ ece0e17b48a5fe0fc766fa42f199fb66 (51 entries, 58% Error)
| Total:   2883.262 732.948 3100.00
| Render:  0.00000 0.00000 0.00000
| DB:      55.8220 14.1900 99.0000 

+ e1181ad94b34b41aff2a74ee62d5fb57 (10 entries, 30% Error)
| Total:   1563.912 676.276 1426.00
| Render:  0.00000 0.00000 0.00000
| DB:      14.5350 6.28500 19.0000 

+ 867bc340e6d65e673f29c57189feaf2b (133 entries, 0% Error)
| Total:   1083.138 221.450 386.000
| Render:  0.00000 0.00000 0.00000
| DB:      44.2030 9.03700 90.0000 

Etc...
</pre>
<p>Now, if we grep for &#8220;entries&#8221; we get a line for each session:</p>
<pre>
slow-actions log/development.log --sessions --start-date=2009-03-01 --end-date=2009-04-01 | grep entries
+ ece0e17b48a5fe0fc766fa42f199fb66 (51 entries, 58% Error)
+ e1181ad94b34b41aff2a74ee62d5fb57 (10 entries, 30% Error)
+ 867bc340e6d65e673f29c57189feaf2b (133 entries, 0% Error)
+ 99b39c7a9af55fc01056b5f127dc4c98 (75 entries, 0% Error)
+ 6ee15c4f3bc804ac68e9e868d9c3f7e6 (14 entries, 0% Error)
+ 80928c25c83590c4f89b91f8d4c8896d (9 entries, 0% Error)
+ c78cfa1cb086b3f473015b212ca3da11 (12 entries, 0% Error)
+ 48cd02cf6544493077c84eb16821bda2 (3 entries, 66% Error)
+ ac027817dcf87d473efb54cd737b2a80 (2 entries, 0% Error)
+ dff2ca2678852b06bbb6c7ca0a85b0a9 (1 entries, 0% Error)
+ 08ed3bc031c23bd3b2572ef7ce60d066 (1 entries, 0% Error)
</pre>
<p>Pipe that to word count, and we have the number of unique sessions within a specified time period:</p>
<pre>
slow-actions log/development.log --sessions --start-date=2009-03-01 --end-date=2009-04-01 | grep entries | wc -l
11
</pre>
<p>On a 54m log file, that takes only 0.761s!</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/03/13/slow-actions-in-rails-projects/" rel="bookmark" class="crp_title">Slow Actions in Rails Projects</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/11/problems-with-restful_authentication-plugin-and-internet-explorer-cookies/" rel="bookmark" class="crp_title">Problems with restful_authentication Plugin and Internet Explorer Cookies</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/01/22/ubuntu-byobu-landscape/" rel="bookmark" class="crp_title">Using Byobu and Landscape to improve remote Ubuntu sessions</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/02/03/properly-setting-http_referer-in-a-rails-integration-test-to-upload-file/" rel="bookmark" class="crp_title">Properly Setting HTTP_REFERER in a Rails Integration Test for a File Upload</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/12/watch-multiple-logs-in-a-single-terminal/" rel="bookmark" class="crp_title">Watch Multiple Logs in a Single Terminal</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/05/04/find-the-unique-sessions-for-a-rails-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Sanitize Email to Preview HTML Emails Locally</title>
		<link>http://blog.smartlogicsolutions.com/2009/04/30/using-sanitize-email-to-preview-html-emails-locally/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/04/30/using-sanitize-email-to-preview-html-emails-locally/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 13:26:04 +0000</pubDate>
		<dc:creator>Nick Gauthier</dc:creator>
				<category><![CDATA[ActionMailer]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nick Gauthier]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=605</guid>
		<description><![CDATA[John Trupiano has a great post to get you started with sanitize_email for Ruby on Rails. I wanted to preview my HTML emails without having to fill up my online email inboxes with tons of email (and then I&#8217;d have to make filters too). I also didn&#8217;t want to manage actually sending real email. So, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.smartlogicsolutions.com/wiki/John_Trupiano">John Trupiano</a> has <a href="http://blog.smartlogicsolutions.com/2009/04/25/reintroducing-sanitize_email-work-with-production-email-without-fear/">a great post</a> to get you started with <a href="http://github.com/jtrupiano/sanitize_email/tree/master">sanitize_email</a> for Ruby on Rails.</p>
<p>I wanted to preview my HTML emails without having to fill up my online email inboxes with tons of email (and then I&#8217;d have to make filters too). I also didn&#8217;t want to manage actually sending real email. So, I set up my machine for local delivery. Read on for instructions.<br />
<span id="more-605"></span><br />
I am running Ubuntu 9.04, however these instructions should be fine at least back to 8.04.</p>
<h3>Step 1 &#8211; Install Postfix</h3>
<p><code>sudo aptitude install postfix</code></p>
<p>During the install, choose &#8220;Local Delivery Only&#8221;</p>
<h3>Step 2 &#8211; Configure Evolution for Receiving Locally</h3>
<p>Open up Evolution &#8220;Applications->Internet->Evolution Mail&#8221;</p>
<p>Set up a new account and choose local delivery. When it asks you for a path, put in:</p>
<p><code>/var/mail/&lt;username&gt;</code></p>
<p>Note that this path may not exist if you&#8217;ve never received mail.</p>
<h3>Step 3 &#8211; Configure Sanitize Email</h3>
<p>In your rails test environment.rb put:</p>
<p><code>config.action_mailer.delivery_method = :sendmail</code></p>
<p>Then, in the initializer where you set up sanitize email:</p>
<p><code>ActionMailer::Base.sanitized_recipients = ["<username>@<hostname>"]<br />
ActionMailer::Base.local_environments = %w( test )</code></p>
<p>If you need to know your username or hostname, just open up a terminal. The command &#8220;whoami&#8221; will give you your username, and &#8220;hostname&#8221; will give you the hostname.</p>
<h3>Step 4 &#8211; Run your tests</h3>
<p>Now, run your rails tests. You <em>should</em> have a test for every email you send, and that should trigger them to be sent locally. You may have to tell Evolution to Send/Receive. Keep in mind your tests will probably fail because they will expect email to be in test mode.</p>
<h3>Step 5 &#8211; Set it back</h3>
<p>Remember, when you&#8217;re done previewing your email, reset config.action_mailer.delivery_method!</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/04/25/reintroducing-sanitize_email-work-with-production-email-without-fear/" rel="bookmark" class="crp_title">Reintroducing sanitize_email | Work with Production Email without Fear</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/02/better-setup-for-environments-in-rails/" rel="bookmark" class="crp_title">Better setup for environments in Rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/02/01/setting-up-ubuntu-9-10-for-ruby-on-rails-development/" rel="bookmark" class="crp_title">Setting Up Ubuntu 9.10 for Ruby On Rails Development</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/04/26/integrity-ci-on-passenger-222-with-ruby-enterprise-edition-on-ubuntu-804/" rel="bookmark" class="crp_title">Integrity CI on Passenger 2.2.2 with Ruby Enterprise Edition on Ubuntu 8.04</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/08/benchmark-ruby-code-with-r-rsruby-and-better-benchmark/" rel="bookmark" class="crp_title">Benchmark Ruby Code with R, rsruby and better-benchmark</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/04/30/using-sanitize-email-to-preview-html-emails-locally/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

