<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>beautiful simple things - Home</title>
  <id>tag:www.beautifulsimplethings.com,2008:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://www.beautifulsimplethings.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.beautifulsimplethings.com/" rel="alternate" type="text/html"/>
  <updated>2008-09-17T18:41:24Z</updated>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-09-17:55</id>
    <published>2008-09-17T18:38:00Z</published>
    <updated>2008-09-17T18:41:24Z</updated>
    <category term="Geeking it up"/>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/9/17/flickr-scaling-guru-cal-henderson-talks-django-and-rails" rel="alternate" type="text/html"/>
    <title>flickr scaling guru cal henderson talks django and rails</title>
<content type="html">
            this is a hilarious talk that flickr scaling guru cal henderson gave on the current state of the art with frameworks and what they are lacking.  Mr. Henderson has some great comments on what is lacking with the current popular frameworks. Also, I haven't seen someone this funny give a talk in a long time. He should do standup comedy... enjoy
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;object height=&quot;344&quot; width=&quot;425&quot;&gt;&amp;lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/i6Fr65PFqfk&amp;hl=en&amp;fs=1&quot;&gt;&amp;lt;/param&gt;&amp;lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&amp;lt;/param&gt;&amp;lt;embed allowfullscreen=&quot;true&quot; type=&quot;application/x-shockwave-flash&quot; src=&quot;http://www.youtube.com/v/i6Fr65PFqfk&amp;hl=en&amp;fs=1&quot; height=&quot;344&quot; width=&quot;425&quot;&gt;&amp;lt;/embed&gt;&amp;lt;/object&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-09-12:48</id>
    <published>2008-09-12T21:51:00Z</published>
    <updated>2008-09-12T22:04:40Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/9/12/more-on-testing-your-tests-with-rcov" rel="alternate" type="text/html"/>
    <title>more on testing your tests with rcov</title>
<content type="html">
            If you ever wondered how good your testing is doing I highly recommend seeing how much coverage your tests are fulfilling.  You can do this by running rcov.  It will run your tests and figure out which parts of your code are being run when you run your tests. Its pretty simple you just run

&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;sudo gem install rcov
#then from your RAILS_ROOT path
rcov -o /path/to/output/results test/unit/*_test.rb test/functional/*/*_test.rb&lt;/code&gt;&lt;/pre&gt;

and you will end up getting results that SHOW things like so:

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/bikokid/i469/c0-code-coverage-information&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20080912-t7a49rm3deb2p3ba1xiyubcx3c.preview.jpg&quot; alt=&quot;C0 code coverage information&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


the teal color shows the code thats covered, the red, the code that is not covered by your tests. prett slick huh?

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/bikokid/i49n/app-controllers-user-home-controller.rb-c0-code-coverage-information&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20080912-pew3qp3f3j2y6rqh8ewb5h7q1f.preview.jpg&quot; alt=&quot;app/controllers/user/home_controller.rb - C0 code coverage information&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-05-20:39</id>
    <published>2008-05-20T00:01:00Z</published>
    <updated>2008-09-12T21:42:55Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/5/20/script-to-find-and-replace-a-string-in-all-files-and-subdirectories-using-shell-programming" rel="alternate" type="text/html"/>
    <title>script to find and replace a string in all files and subdirectories using shell programming</title>
<content type="html">
            &lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;#!/bin/sh

if [ $# -ne 2 ]; then
        echo 1&amp;gt;&amp;amp;2 Usage: $0 [string to replace] [replacement]
        exit 127
fi

for file in $(find . -type f | grep -v .svn | grep -v .jpg | grep -v .gif | grep -v .tmp | grep -v .zip 
| grep -v .png | grep -v .ttf | grep -v .psd | grep -v tempfile.tmp)
do
        sed -e &amp;quot;s/$1/$2/g&amp;quot; $file &amp;gt; /tmp/tempfile.tmp
        mv /tmp/tempfile.tmp $file
done
for file in $(find . | grep -v .svn | grep tempfile.tmp)
do
        rm $file
done&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-02-02:37</id>
    <published>2008-02-02T01:39:00Z</published>
    <updated>2008-09-12T21:44:41Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/2/2/fast-date-values-for-fixtures" rel="alternate" type="text/html"/>
    <title>fast date values for fixtures</title>
<content type="html">
            &lt;p&gt;one of my annoyances while porting to rails 2 &#8230; and edge has to do with fixtures.  they&#8217;ve decided to use the rathole plugin . . . but alas i was using the fixture_references plugin, and it seems they do not play nicely together.  however, one thing i have learned is that i can do this:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;3.weeks.ago.to_s(:db)
=&amp;gt; &amp;quot;2008-01-11 17:38:26&amp;quot;
&amp;gt;&amp;gt; (Time.now + 3.weeks).to_s(:db)
=&amp;gt; &amp;quot;2008-02-22 17:38:42&amp;quot;
&amp;gt;&amp;gt;&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-01-29:34</id>
    <published>2008-01-29T21:48:00Z</published>
    <updated>2008-01-29T21:49:42Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/1/29/unitialized-constant-passthrough-exception-in-rails-2" rel="alternate" type="text/html"/>
    <title>unitialized constant PASSTHROUGH exception in rails 2</title>
<content type="html">
            You need to upgrade to ruby 1.8.6 . . .
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2008-01-09:33</id>
    <published>2008-01-09T18:44:00Z</published>
    <updated>2008-10-02T18:05:51Z</updated>
    <category term="Rails"/>
    <link href="http://www.beautifulsimplethings.com/2008/1/9/hacking-irb-and-console-for-ruby-and-rails" rel="alternate" type="text/html"/>
    <title>hacking irb and console for ruby and rails</title>
<content type="html">
            Two things you need for your console.  Imagine the following&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;./script/console
&amp;gt;&amp;gt; helper.users_path
&amp;quot;/users&amp;quot;
#(then highlight and copy to clipboard the following code.)&amp;lt;br/&amp;gt;
&amp;gt;&amp;gt; pastie
#(browser opens to a pastie URL of the code you just copied to the clipboard&amp;lt;br/&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
I also recommend installing &lt;a href=&quot;http://pablotron.org/software/wirble/&quot;&gt;wirble &lt;/a&gt; so you can have history in your console as well. ( sudo gem install wirble )&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
To get these helpful commands going in your irb or console session just add the following to your ~/.irbrc file.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;# load rubygems and wirble
require 'net/http'
require 'rubygems' rescue nil
require 'wirble'

# load wirble
Wirble.init
Wirble.colorize

def Object.method_added(method)
  return super(method) unless method == :helper
  (class&amp;lt;&amp;lt;self;self;end).send(:remove_method, :method_added)

  def helper(*helper_names)
    returning $helper_proxy ||= Object.new do |helper|
      helper_names.each { |h| helper.extend &amp;quot;#{h}_helper&amp;quot;.classify.constantize }
    end
  end

  helper.instance_variable_set(&amp;quot;@controller&amp;quot;, ActionController::Integration::Session.new)

  def helper.method_missing(method, *args, &amp;amp;block)
    @controller.send(method, *args, &amp;amp;block) if @controller &amp;amp;&amp;amp; method.to_s =~ /_path$|_url$/
  end

  helper :application rescue nil
end if ENV['RAILS_ENV']

def pastie
  url = URI.parse(&amp;quot;http://pastie.caboo.se/pastes/create&amp;quot;)
  parameters = {}
  IO.popen('pbpaste') do |clipboard|
    parameters[&amp;quot;paste[body]&amp;quot;] = clipboard.read
  end
  parameters[&amp;quot;paste_parser&amp;quot;] = &amp;quot;ruby&amp;quot;
  parameters[&amp;quot;paste[authorization]&amp;quot;] = &amp;quot;burger&amp;quot;
  pastie_url = Net::HTTP.post_form(url, parameters).body.match(/href=&amp;quot;([^\&amp;quot;]+)&amp;quot;/)[1]
  IO.popen('pbcopy', 'w+') do |clipboard|
    clipboard.write(pastie_url)
  end
  pastie_url
  system(&amp;quot;open &amp;quot; + pastie_url)
end&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-12-11:27</id>
    <published>2007-12-11T19:01:00Z</published>
    <updated>2007-12-11T19:04:03Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/12/11/testing-your-tests-in-rails" rel="alternate" type="text/html"/>
    <title>testing your tests in rails</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;http://glu.ttono.us/articles/2006/12/19/tormenting-your-tests-with-heckle&quot;&gt;actually modifies your tests to verify what you&#8217;re testing&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-12-06:21</id>
    <published>2007-12-06T02:15:00Z</published>
    <updated>2008-09-12T22:20:14Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/12/6/rails-inserts-heinous-html-sometimes" rel="alternate" type="text/html"/>
    <title>rails inserts heinous html sometimes</title>
<content type="html">
            Using button_to in rails inserts unnecessary div tags into your html and i recommend using the following override code in your application helper.

&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;def button_to(value, link, options={}) 
    if not options.empty?
      return super(value, link, options)
    end
  return &amp;quot;&amp;lt;input type=\&amp;quot;button\&amp;quot; value=\&amp;quot;#{value}\&amp;quot; onclick=\&amp;quot;location.href='#{url_for(link)}'\&amp;quot;/&amp;gt;&amp;quot;
end&lt;/code&gt;&lt;/pre&gt;

&lt;br /&gt;
&lt;br /&gt;
That way you get clean return values like &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;input value=&amp;quot;Submit&amp;quot; onclick=&amp;quot;http://yoururl.com&amp;quot; /&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;br /&gt;  &lt;br /&gt;
rather than getting: &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;
&amp;lt;form method=&amp;quot;post&amp;quot; action=&amp;quot;http://yoururl.com&amp;quot; class=&amp;quot;button-to&amp;quot;&amp;gt;&amp;lt;div&amp;gt;&amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Publish it&amp;quot; /&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
However this doesn't solve the method post problem
&lt;br /&gt;  &lt;br /&gt;
&lt;br /&gt;  &lt;br /&gt;
&lt;br /&gt;  &lt;br /&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-12-04:20</id>
    <published>2007-12-04T02:54:00Z</published>
    <updated>2008-09-12T22:21:46Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/12/4/controller-partials-in-rails" rel="alternate" type="text/html"/>
    <title>Controller Partials in rails</title>
<content type="html">
            I've noticed lately that I reuse a lot of code between controllers, in some cases entire methods.  What if you could do something like 
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;def comment_posted
  &amp;lt;%= render :controller_partial =&amp;gt; 'common/blog_posted' %&amp;gt; 
end&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-08-26:15</id>
    <published>2007-08-26T00:43:00Z</published>
    <updated>2007-08-26T00:49:28Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/8/26/mac-os-x-usb-guru" rel="alternate" type="text/html"/>
    <title>Mac OS X USB guru</title>
<content type="html">
            I'm trying to connect our *new* USB keyboard to an OS X machine and I want to gather the raw input data from it.  I've got USB Prober going, but it doesn't look like I can ascertain raw input from that program alone, and frankly, I need help.  If anyone is interested in seeing our new keyboard, and helping out with the driver software I'd love to cut you in on the action.  I have plenty to worry about besides driver software - including but not limited to: finding some investors/and or just selling the thing.  Starting on the User facing application, and creating some marketing buzz around the new product.  Would love to hear if anyone is interested in coming in on this for a percentage.   contact me at matt@beautifulsimplethings.com   . I can give you more details about the new keyboard.
          </content>  </entry>
  <entry xml:base="http://www.beautifulsimplethings.com/">
    <author>
      <name>matt</name>
    </author>
    <id>tag:www.beautifulsimplethings.com,2007-04-21:1</id>
    <published>2007-04-21T19:16:00Z</published>
    <updated>2007-05-03T17:42:01Z</updated>
    <link href="http://www.beautifulsimplethings.com/2007/4/21/welcome-to-bst" rel="alternate" type="text/html"/>
    <title>Welcome to BST</title>
<content type="html">
            We are Beautiful Simple Things.  We beautify, simplify, and innovate new consumer electronics. We make playing Games more fun, and working with computers a beautiful thing.  Currently, we are in the process of prototyping our first product.  Let's just say, it's a BeaST, and we are very excited.
          </content>  </entry>
</feed>
