In the past few weeks, I’ve had a few conversations with web developers and back-end engineers who are unfamiliar with Ruby, in which I’ve tried to explain how Ruby can be nearly as expressive as Perl (tiny amounts of code can accomplish a lot) while being as readable as Python or Java. In fact, I think that Ruby’s expressiveness can remove distracting boilerplate code, allowing compact expressions to be far more readable than a more verbosely written version of the same algorithm.
Continue reading “On Ruby’s Expressiveness- The Littlest Microframework Explained”
Category: Uncategorized
The Princess and the Pea, as a Cucumber Feature
Kent Beck tweeted:
User story: “As a princess I want to confirm my royalty so I get bruised after sleeping on 40 mattresses over a pea”. Just tell real stories”
That sounded so much like a Cucumber feature that I decided to write it as one:
1 2 3 4 5 6 7 8 9 10 11 |
Feature: Physical Sensitivity In order to confirm my royalty As a princess I want to be very delicate Scenario: 40 mattresses on a pea Given there is a pea on the bed And there is a stack of 20 mattresses on the pea And there is a stack of 20 featherbeds on the mattresses When I try to sleep on top of the stack of featherbeds Then I should not be able to sleep |
Unix tip: kill -STOP and kill -CONT
Pretty much every Unix user knows about the kill command, and most know about ‘kill -KILL’ aka ‘kill -9’.
But do you know about kill -STOP and kill -CONT?
Continue reading “Unix tip: kill -STOP and kill -CONT”
Rails Migration Antipatterns and How To Fix Them
Migrations are one of the best features of Rails. Although some folks prefer pure SQL rather than Rails migration DSL, I don’t know of anyone who dislikes the idea of a versioned schema that can evolve in a controlled and repeatable fashion.
But because the concept of database migrations is such a powerful one, it’s tempting to jam any old change that affects the database into a new migration and run rake db:migrate
to make it happen. I’ve been guilty of a bit of this in the past, and I’ve joined some projects that did other ugly things in migrations. In the process I’ve learned the hard way that there are some things you must never do in a migration or they will come back to haunt you later. Here they are.
Continue reading “Rails Migration Antipatterns and How To Fix Them”
Making Bundler 0.8.5 install Nokogiri on Leopard with a newish libxml
Nokogiri on a standard installation of Leopard is complain-y about a couple of old libraries:
“HI. You’re using libxml2 version 2.6.16 which is over 4 years old and has plenty of bugs. We suggest that for maximum HTML/XML parsing pleasure, you upgrade your version of libxml2 and re-install nokogiri. If you like using libxml2 version 2.6.16, but don’t like this warning, please define the constant I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 before requring nokogiri.”
Aaron Kalin figured out how to fix this if you’re installing nokogiri as a system gem, but I want to use Bundler and keep my system gems down to the bare minimum. I figured out how to do this under Bundler 0.8.5.
Continue reading “Making Bundler 0.8.5 install Nokogiri on Leopard with a newish libxml”