<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>iBrasten - Blog</title>
  <id>tag:www.ibrasten.com,2010:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://www.ibrasten.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.ibrasten.com/" rel="alternate" type="text/html"/>
  <updated>2008-04-14T10:50:11Z</updated>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2008-04-14:4668</id>
    <published>2008-04-14T10:49:00Z</published>
    <updated>2008-04-14T10:50:11Z</updated>
    <category term="ruby"/>
    <category term="scruffy"/>
    <link href="http://www.ibrasten.com/articles/2008/4/14/available-mildly-successful-open-source-project" rel="alternate" type="text/html"/>
    <title>Available: Mildly successful open-source project.</title>
<content type="html">
            &lt;p&gt;
It shouldn't surprise anyone to learn that I haven't been able to work on &lt;a href=&quot;http://scruffy.rubyforge.org&quot;&gt;Scruffy&lt;/a&gt; -- the Ruby-based SVG graphing engine -- in a very long time.  And yet, it seems like people continue to download and use it more and more.  Since my need for a graphing library is nonexistent for the foreseeable future, I don't think I'm the best person to continue working on Scruffy at this point.  Software is best written by those who need it.
&lt;/p&gt;
&lt;p&gt;
I do not intend on handing Scruffy to any random person, but if anyone out there thinks they can make a case for themselves you're welcome to &lt;a href=&quot;mailto:brasten@gmail.com&quot;&gt;contact me&lt;/a&gt;.  In general, I'm keeping an eye out for someone who &lt;strong&gt;has been using Scruffy professionally for some time&lt;/strong&gt; and has ideally &lt;strong&gt;already made significant code changes to Scruffy&lt;/strong&gt; for their projects.  
&lt;/p&gt;
&lt;p&gt;
I'd also like to find someone who has a similar vision for Scruffy as I do.  I never intended for Scruffy to be simply a Gruff replacement.  Gruff is good enough for what it does.  Today, most Scruffy usage involves rasterizing the SVG graph to an image.  At the time this was a necessary evil, but I think we're rapidly approaching a time when &lt;strong&gt;Scruffy could serve straight SVG&lt;/strong&gt;.  This is, I believe, the ultimate goal for Scruffy and opens a bunch of new possibilities ( layout and theming via CSS, dynamic graph updates via JavaScript, etc ).
&lt;/p&gt;
&lt;p&gt;
I'll be maintaining control of Scruffy for the foreseeable future as I'm not currently aware of anyone I'd trust to take it.  But I'd love to hear from anyone who thinks they may be that developer.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2008-04-13:4655</id>
    <published>2008-04-13T20:27:00Z</published>
    <updated>2008-04-13T20:31:29Z</updated>
    <category term="merb"/>
    <category term="perl"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://www.ibrasten.com/articles/2008/4/13/a-quick-summary-perl-and-merb" rel="alternate" type="text/html"/>
    <title>A quick summary: Perl and Merb</title>
<content type="html">
            &lt;p&gt;
There are quite a few little topics to catch up on since I've last posted, so I'm going to try and break them up into fewer, smaller posts.  This post is just a general overview of what I've been up to over the last few months.
&lt;/p&gt;

&lt;h3&gt;A brief detour into Perl-land&lt;/h3&gt;
&lt;p&gt;
Just over six months ago I took a contract working in Perl.  I had never worked in Perl and quite honestly had &lt;strong&gt;never intended on working in Perl&lt;/strong&gt;.  Still, the project sounded fun and I enjoy the opportunity to learn new [to me] things.  It also provided the opportunity to work for/with a guy who is basically the Perl version of Tobias L&amp;uuml;tke or Rick Olson.  It's difficult to turn down an opportunity to learn a new technology from one of the best that technology has to offer.
&lt;/p&gt;
&lt;p&gt;
Six months of Perl development later, I'm able to say that &lt;strong&gt;Perl doesn't suck&lt;/strong&gt; as much as I'd always thought.  The language itself is tricky, and this seems to have produced an awful lot of horrible Perl code &quot;out there.&quot;  I discovered, though, if you know how to write good Perl you can produce some decent looking code.  With the project soon coming to an end, I'm saddened that I'll not be able to continue using my newly-acquired skills.  Getting comfortable with Perl took me a little time, but I think I was just starting to [relatively] rock at it!  If the right opportunity came along, I would not be opposed to working in Perl again.
&lt;/p&gt;
&lt;p&gt;
My language-crush on Ruby did not disappear, however.  The mental separation of working in Perl and playing in Ruby gave me a chance to play with some personal projects in my spare time  -- free of the outside influences of a Ruby-based project.  All of which leads me to my second topic...
&lt;/p&gt;

&lt;h3&gt;Merb, Merb, the musical fruit...&lt;/h3&gt;
&lt;p&gt;
This isn't a very elegant way of putting it, but:  &lt;strong&gt;Merb. Kicks. Ass.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I had honestly begun to feel a bit disenchanted with Rails when I took the Perl project.  I quickly discovered that I was not as eager to build a random Rails application in my spare time when I no longer had any financial incentive to work with it.  I'm not complaining; I completely respect that &lt;em&gt;DHH did not develop Rails to make Brasten Sager happy&lt;/em&gt;.  Rails is what DHH needs it to be, and in my completely irrelevant opinion it's still the second-best framework for my purposes.
&lt;/p&gt;
&lt;p&gt;
This post is more of a personal narrative than any kind of technical article, so I'll skip the bullet-point list of &lt;em&gt;Reasons I Like Merb&lt;/em&gt;.  Instead, here's the one-paragraph explanation.  Every time I created a new Rails application I often ended up writing the same code (or copying from a previous project) to solve a whole list of minor annoyances.  Merb largely solves all those things for me right out of the box.  The Merb guys obviously write web applications the same way I do and they've written a framework that feels the way I want a framework to feel.
&lt;/p&gt;
&lt;p&gt;
Of course, your mileage may vary.
&lt;/p&gt;
&lt;p&gt;
More posts hopefully coming soon, stay tuned!
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-11-06:3153</id>
    <published>2007-11-06T17:39:00Z</published>
    <updated>2008-05-29T10:41:11Z</updated>
    <category term="dashboard"/>
    <category term="widgets"/>
    <link href="http://www.ibrasten.com/articles/2007/11/6/dashboard-web-clips" rel="alternate" type="text/html"/>
    <title>Dashboard Web Clips</title>
<content type="html">
            &lt;p&gt;So, web clips are much much cooler than I anticipated.  You can change up your dashboard weekly or daily based on interests at the time.  For example, clipping out a little Flash object yesterday gave me quick access to a particular fund-raising effort I wanted to track:&lt;/p&gt;

&lt;img src=&quot;http://farm3.static.flickr.com/2216/1891062506_cc8a40e229.jpg&quot; width=&quot;350&quot; /&gt;&lt;br /&gt;&lt;br /&gt;

&lt;p&gt;Just one thing I can't figure out though... is there any way to package a web clip into a widget that can be uploaded or otherwise transfered to another computer?  If you know how to do that, leave a comment!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-11-06:3149</id>
    <published>2007-11-06T00:48:00Z</published>
    <updated>2008-05-29T10:41:21Z</updated>
    <category term="2008"/>
    <category term="politics"/>
    <category term="ronpaul"/>
    <link href="http://www.ibrasten.com/articles/2007/11/6/why-spend-millions-on-advertising" rel="alternate" type="text/html"/>
    <title>Why spend millions on advertising...</title>
<content type="html">
            &lt;p&gt;... when you can get 10-times as much press for free.&lt;/p&gt;


	&lt;p&gt;In case you haven&#8217;t been paying attention, Ron Paul&#8217;s campaign is closing in on $4 million mark for today.  The record-breaking haul has put the campaign well beyond the half-way mark for their $12 million Q4 fund raising goal.&lt;/p&gt;


	&lt;p&gt;What&#8217;s even more amazing, the entire thing was coordinated by grassroots supporters, without any (much?) help from the campaign itself.&lt;/p&gt;


	&lt;p&gt;Freedom Kicks Ass.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-10-24:3069</id>
    <published>2007-10-24T20:07:00Z</published>
    <updated>2007-12-06T06:16:02Z</updated>
    <category term="textmate netbeans ruby themes"/>
    <link href="http://www.ibrasten.com/articles/2007/10/24/fadetogrey-netbeans-textmate-themes" rel="alternate" type="text/html"/>
    <title>FadeToGrey - NetBeans/TextMate themes</title>
<content type="html">
            &lt;p&gt;Heavily modified, but based on the &lt;a href=&quot;http://www.rubyrobot.org/article/rubyrobot-theme-for-textmate&quot;&gt;RubyRobot&lt;/a&gt; theme for TextMate (worth checking out).&lt;/p&gt; 

&lt;p&gt;HTML/XML colors are intentionally higher contrast than normal since, in my experience, I'm often looking for specific attributes/values or Ruby code.&lt;/p&gt;

&lt;p&gt;Slight differences between NetBeans and TextMate versions, obviously, due to different syntax colorization rules.  NetBeans pictured below:&lt;/p&gt;

&lt;img src=&quot;http://farm3.static.flickr.com/2327/1732727100_547cacc6de.jpg?v=0&quot; width=&quot;375&quot; /&gt;&lt;br /&gt;
&lt;img src=&quot;http://farm3.static.flickr.com/2186/1731873161_a228de3b2b.jpg?v=0&quot; width=&quot;375&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/com-superruby-netbeans-themes-fadetogrey.nbm&quot;&gt;FadeToGrey - NetBeans&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/FadeToGrey.tmTheme&quot;&gt;FadeToGrey - TextMate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-10-23:3059</id>
    <published>2007-10-23T18:22:00Z</published>
    <updated>2007-10-23T18:26:53Z</updated>
    <category term="rails java glassfish jruby netbeans"/>
    <link href="http://www.ibrasten.com/articles/2007/10/23/three-things-you-should-care-about" rel="alternate" type="text/html"/>
    <title>Three things you *should* care about...</title>
<content type="html">
            &lt;p&gt;The top three things Ruby developers SHOULD be paying attention to:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
&lt;b&gt;&lt;a href=&quot;http://jruby.codehaus.org/&quot;&gt;JRuby&lt;/a&gt;&lt;/b&gt;
&lt;p&gt;I have to admit, this one has surprised me.  I was a big fan of JRuby a while back, but not as a general-purpose Ruby runtime.  It was showing some promise as a niche integration project, but nobody was actually going to run Rails applications on it, right?&lt;/p&gt;
&lt;p&gt;Oops.&lt;/p&gt;
&lt;p&gt;Turns out, running a Rails application on JRuby is becoming more reasonable every day (more on that later).  JRuby is making huge leaps in performance and compatibility and, I believe, Ruby-to-bytecode compilation has the potential to be a game-changer.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
&lt;b&gt;&lt;a href=&quot;http://www.netbeans.org&quot;&gt;NetBeans&lt;/a&gt;&lt;/b&gt;
&lt;p&gt;I'm as big of a TextMate fan as the next guy.  One of my favorite side-effects of switching to Ruby was leaving my old Java IDEs behind.  Well, time has changed, and as of NetBeans 6 Beta 1 I've pretty much left TextMate behind.&lt;/p&gt;
&lt;p&gt;I'm not necessarily saying that you should switch to NetBeans TODAY...  but at the pace they're going, it's definitely something to keep your eye on in the near future.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
&lt;b&gt;&lt;a href=&quot;http://glassfish.dev.java.net&quot;&gt;GlassFish&lt;/a&gt;&lt;/b&gt;
&lt;p&gt;The fact is, current production Ruby/Rails options kind of suck.  Yes, it's as &quot;easy&quot; as &quot;mongrel_rails start&quot;, at first.  But then you need to set up a cluster of, let's say, 3 mongrels.  Then you need to proxy requests from Apache in some kind of load-balanced fashion which -- in many installations -- requires a separate application. Then you REALLY need to set up monit because, honestly, Mongrel doesn't stay up 24x7x52.&lt;/p&gt;
&lt;p&gt;Then what if one of them gets slashdotted (literally or figuratively)?  I had to run 8 Mongrels on one particular application just to keep it running during a traffic spike.  Now, the application's developers had NOT designed it for high-traffic, but regardless, it still took frantic manual intervention to keep it running.&lt;/p&gt;
&lt;p&gt;... now imagine a Rails server that requires only one instance running...  performant enough to bypass Apache in many cases...  capable of scaling up or down the number of Rails threads running based on traffic levels, automatically... can do all of this for any number of Rails applications you wish to deploy, and comes with a pretty nifty web console to administrate it all (if desired).&lt;/p&gt;
&lt;p&gt;That's the promise of Rails on GlassFish v3.  It's still a ways off, but you'd be doing yourself a favor to start thinking about it now.&lt;/p&gt;
  &lt;/li&gt;

&lt;/ol&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-07-20:1465</id>
    <published>2007-07-20T15:55:00Z</published>
    <updated>2008-05-29T10:41:32Z</updated>
    <category term="apple"/>
    <link href="http://www.ibrasten.com/articles/2007/7/20/apple-hp" rel="alternate" type="text/html"/>
    <title>Apple &gt;= HP?</title>
<content type="html">
            Has anyone else noticed that AAPL is dangerously close to surpassing HPQ?  $121 billion to $126 billion as of this morning.
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-06-19:732</id>
    <published>2007-06-19T19:59:00Z</published>
    <updated>2007-09-24T23:37:40Z</updated>
    <category term="rails edge"/>
    <link href="http://www.ibrasten.com/articles/2007/6/19/edge-report-with_scope-protected" rel="alternate" type="text/html"/>
    <title>Edge report: with_scope protected</title>
<content type="html">
            &lt;p&gt;I knew all along that using with_scope outside my models was a bad idea, but I did it anyway.  So once this little change came through, I had to rethink some of my code&#8230;  &lt;/p&gt;

&lt;p&gt;Just to throw this out there &#8211; let&#8217;s &lt;a href=&quot;http://www.robbyonrails.com/articles/2007/06/18/rails-code-audits-and-reviews-continued&quot;&gt;call it peer-review&lt;/a&gt; &#8211; my new method of encapsulating with_scope usages sort of piggy-backs on &lt;a href=&quot;http://blog.imperialdune.com/2007/4/19/find-methods-in-controllers&quot;&gt;finder encapsulation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Take, for example, the following code:&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Post&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.find_active&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# ... some finder code to return all active posts&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;PostsController&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ApplicationController&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;index&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;iv&quot;&gt;@posts&lt;/span&gt; = &lt;span class=&quot;co&quot;&gt;Post&lt;/span&gt;::find_active&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;&#8230; despite my habit of encapsulating finders, I still found myself doing this:&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;  &lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# In around-filter or action&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;Post&lt;/span&gt;::with_scope( ... conditions ... ) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;c&quot;&gt;# ... yield or something&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;&#8211; Obviously, BAD.  So the alternative is to do something like Post::scope_by_active or something.  What about adding a fairly simple block_given? condition to the existing find_active method? Use your imagination on the implementation of that, but the usage would now look something like this:&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;  &lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# No block, returns all active&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;iv&quot;&gt;@posts&lt;/span&gt; = &lt;span class=&quot;co&quot;&gt;Post&lt;/span&gt;::find_active&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# block, scopes to active, returns result of block.&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;iv&quot;&gt;@my_posts&lt;/span&gt; = &lt;span class=&quot;co&quot;&gt;Post&lt;/span&gt;::find_active &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;              &lt;span class=&quot;co&quot;&gt;Post&lt;/span&gt;::find_by_user( user )&lt;tt&gt;
&lt;/tt&gt;            &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Soooo&#8230;  peer-review away!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-06-06:612</id>
    <published>2007-06-06T22:53:00Z</published>
    <updated>2008-05-29T10:42:11Z</updated>
    <category term="cbs"/>
    <category term="jericho"/>
    <category term="map"/>
    <link href="http://www.ibrasten.com/articles/2007/6/6/cbs-revives-jericho" rel="alternate" type="text/html"/>
    <title>CBS revives Jericho!</title>
<content type="html">
            &lt;p&gt;Impressive campaign &#8211; I put together a little Yahoo Maps illustration with the location and amounts of most of the contributions to &lt;a href=&quot;http://www.nutsonline.com&quot;&gt;NutsOnline.com&lt;/a&gt;&#8217;s &lt;a href=&quot;http://www.nutsonline.com/jericho&quot;&gt;Save Jericho&lt;/a&gt; campaign.  The live version &lt;a href=&quot;http://www.ibrasten.com/jericho-map.html&quot;&gt;can be seen here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well done everyone!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://farm2.static.flickr.com/1019/533737212_17efd64324.jpg?v=0&quot; /&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-06-01:583</id>
    <published>2007-06-01T04:55:00Z</published>
    <updated>2007-09-24T23:38:42Z</updated>
    <category term="rails rspec bdd"/>
    <link href="http://www.ibrasten.com/articles/2007/6/1/effectively-communicating-your-expectations" rel="alternate" type="text/html"/>
    <title>Effectively communicating your expectations</title>
<content type="html">
            &lt;p&gt;So, if you&#8217;ve tried RSpec, you know it let&#8217;s you write test code that&#8217;s easy to understand.  There are other reasons for BDD, but that is probably the first one you&#8217;ll notice.  Describe this, it should do that, this should not have five of those, etc etc.  It&#8217;s great for less assertive people like myself.&lt;/p&gt;

&lt;p&gt;Occasionally, you&#8217;ll run into situations that are not easily described with the stock RSpec API.  The RSpec guys have done a fantastic job putting together an API that is easy to manipulate, so don&#8217;t be afraid to do that!&lt;/p&gt;

&lt;p&gt;Let&#8217;s look at an example:&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;describe &lt;span class=&quot;co&quot;&gt;TicketsController&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;with unauthenticated visitor&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  it &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;should require login to access /index&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    get &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# This is the line I'll be picking on.&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    response.should redirect_to( &lt;span class=&quot;sy&quot;&gt;:controller&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;account&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;login&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; )&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Pretty basic, right?  But here&#8217;s the part that bugs me: &lt;strong&gt;it &#8220;should require login to access /index&#8221;&lt;/strong&gt; vs. &lt;strong&gt;response.should redirect_to( :controller =&amp;gt; &#8216;account&#8217;, :action =&amp;gt; &#8216;login&#8217; )&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;The expectation I&#8217;ve described in english is not the same as the expectation I&#8217;ve described in code.  Redirecting to a login page is a function of the before_filter handling your app&#8217;s security, not of the TicketsController itself.&lt;/p&gt;

&lt;p&gt;In english, my expectation is pretty clear: &#8216;it should require login&#8217;.  So let&#8217;s make the code match.&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;describe &lt;span class=&quot;co&quot;&gt;TicketsController&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;with unauthenticated visitor&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  it &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;should require login to access /index&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    get &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# Doesn't this make a lot more sense??&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    response.should require_login&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;Turns out, this is shockingly easy to accomplish:&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Add this to your spec_helper.rb or another required file&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Spec::Rails::Matchers&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;require_login&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;co&quot;&gt;RedirectTo&lt;/span&gt;.new(request, { &lt;span class=&quot;sy&quot;&gt;:controller&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;account&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;login&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; })&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;And there you go.  Requiring a login is now an expectation on the same level as all others.  It&#8217;s really very cool!  &lt;/p&gt;

&lt;p&gt;Additionally, this ALMOST gets us the negative expectation ( &#8220;response.should_not require_login&#8221; ).  There&#8217;s a very minor tweak needed to get that working, but that&#8217;s an exercise I&#8217;ll leave to you.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you don&#8217;t want to figure it out, I can be bribed with gift cards to Caffe Ladro for as little as $5.  =)&lt;/em&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-05-27:556</id>
    <published>2007-05-27T05:07:00Z</published>
    <updated>2008-05-29T10:42:18Z</updated>
    <category term="jericho"/>
    <category term="railsconf"/>
    <category term="railsconf07"/>
    <link href="http://www.ibrasten.com/articles/2007/5/27/25lbs-of-nuts-for-jericho" rel="alternate" type="text/html"/>
    <title>~25lbs of nuts for Jericho!</title>
<content type="html">
            &lt;p&gt;The Fremont office-mates contributed $30 to the NutsOnline Jericho pool.  NutsOnline is shipping packaged nuts to CBS in a fan-organized effort to save Jericho.  Some 20,000 pounds have been shipped thus far.  If you&#8217;re a Jericho fan, why not &lt;a href=&quot;http://www.nutsonline.com/jericho&quot;&gt;pitch in&lt;/a&gt;??&lt;/p&gt;

&lt;p&gt;Though I&#8217;m very much a fan of this show, it does need to be kept in perspective.  If you&#8217;re considering donating to the Jericho pool and haven&#8217;t yet contributed to one of the RailsConf charities, please &lt;a href=&quot;http://pragmaticstudio.com/donate/&quot;&gt;donate there first&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-05-20:514</id>
    <published>2007-05-20T07:24:00Z</published>
    <updated>2007-09-24T23:38:52Z</updated>
    <category term="railsconf railsconf2007"/>
    <link href="http://www.ibrasten.com/articles/2007/5/20/rejectconf-was-worth-the-railsconf-fee" rel="alternate" type="text/html"/>
    <title>RejectConf was worth the RailsConf fee...</title>
<content type="html">
            &lt;p&gt;&#8230; moreso than RailsConf has been.  The issues with RailsConf have been and will continue to be well documented, but the RejectConf guys kicked ass!&lt;/p&gt;

&lt;p&gt;I had to jet afterwards, but those of you wanting to chat, catch me at the conference tomorrow.&lt;/p&gt;

&lt;p&gt;On a final note, after weeks of attempting to find a Nintendo Wii in Seattle, I was able to track one down here in Portland!!  Awesome machine!!  It&#8217;s hooked up in the hotel room now, and in fact, this entire post was created from the Wii&#8217;s browser.  =)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-05-18:500</id>
    <published>2007-05-18T00:14:00Z</published>
    <updated>2008-05-29T10:42:31Z</updated>
    <category term="jericho"/>
    <category term="nuclear"/>
    <category term="war"/>
    <link href="http://www.ibrasten.com/articles/2007/5/18/any-other-closet-jericho-fans" rel="alternate" type="text/html"/>
    <title>Any other closet 'Jericho' fans?</title>
<content type="html">
            &lt;p&gt;Jericho canceled.  Unbelievable.&lt;/p&gt;

&lt;p&gt;I think I&#8217;m done watching TV.  Good shows don&#8217;t stand a chance anymore.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-05-17:497</id>
    <published>2007-05-17T22:17:00Z</published>
    <updated>2008-05-29T10:42:46Z</updated>
    <category term="baseball"/>
    <link href="http://www.ibrasten.com/articles/2007/5/17/ode-to-baseball-2" rel="alternate" type="text/html"/>
    <title>Ode to Baseball</title>
<content type="html">
            &lt;p&gt;Google &#8220;Ode to Baseball.&#8221;&lt;/p&gt;

&lt;p&gt;I&#8217;m #5!&lt;/p&gt;

&lt;p&gt;Awesome.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.ibrasten.com/">
    <author>
      <name>brasten</name>
    </author>
    <id>tag:www.ibrasten.com,2007-05-16:487</id>
    <published>2007-05-16T22:46:00Z</published>
    <updated>2008-05-29T10:42:56Z</updated>
    <category term="railsconf"/>
    <category term="railsconf2007"/>
    <link href="http://www.ibrasten.com/articles/2007/5/16/railsconf" rel="alternate" type="text/html"/>
    <title>RailsConf!</title>
<content type="html">
            &lt;p&gt;I&#8217;ll be heading on down to Portland in a little over a day for RailsConf!&lt;/p&gt;

&lt;p&gt;If you&#8217;re there, track me down and say hi!  If there are any hacking sessions planned, maybe I&#8217;ll take the opportunity to hack on Scruffy.&lt;/p&gt;

&lt;p&gt;I also plan on picking up a new MacBook while I&#8217;m there!  So, a lot of stuff to fit into a few days.  Should be fun!&lt;/p&gt;
          </content>  </entry>
</feed>
