26 May 2010, 12:14pm
/dev/random
by chris

leave a comment

How Many WalMarts in an Oil Spill?

Re: the BP Gulf oil spill:

I think we need to start measuring this one in something other than barrels. When it gets to 50 trillion barrels, its gonna be hard for the average person to digest. Lets start saying the spill has reached 7000 Walmarts of oil, people would understand that.

And then the math starts. Well played, Reddit, well played.

17 May 2010, 10:22am
/dev/random
by chris

leave a comment

Rspec with Rails3 beta and Rspec 2 beta

The problem: running

spec filename.rb

against a project built on Rails 3 beta and using Rspec 2 beta generated the following error (I can’t imagine why there were any issues):

/Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `require’: no such file to load — spec/adapters/mock_frameworks/rspec (LoadError)
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `require’
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:197:in `load_dependency’
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `require’
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/rspec-1.3.0/lib/spec/runner/options.rb:312:in `plugin_mock_framework’
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/rspec-1.3.0/lib/spec/runner/options.rb:138:in `run_examples’
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/rspec-1.3.0/lib/spec/runner.rb:61:in `run’
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/gems/rspec-1.3.0/lib/spec/runner.rb:45
from /Users/chris/.rvm/gems/ruby-1.8.7-p249/bin/spec:19

As you can see from the error it is in fact not running the rspec beta but rather trying to use the system’s rspec 1.3.0. Problematic, that.

Turns out the solution was to use bundle* to run the individual spec (this, of course, assumes you’re managing your gems with Bundler):

bundle exec rspec filename.rb

*In the project above I have a whole separate environment managed by RVM specifically for the latest über-stable Ruby (ruby 1.8.7 (2010-01-10 patchlevel 249) as of this writing), the Rails and Rspec beta.

9 May 2010, 9:34am
/dev/obj-c
by chris

leave a comment

“Must have an entity”

Playing around with CoreData today, I started to get the following error message:

2010-05-09 10:27:28.568 Climb_It[2330:207] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘executeFetchRequest:error: A fetch request must have an entity.’

This was being thrown as a result of some initialization code in my AscentMethod class, and everything in the code looked good to me.

Turns out the issue was a naming problem. In the .xcdatamodel file I’d named the entity “ascentMethod” instead of “AscentMethod”.

Name changed, problem solved.