Let’s look at building a somewhat complex Postgres SQL query step-by-step. This query uses some cool features like generate_series , common table expressions (“with” queries), and several date functions. This is a reporting query on an internal, open source app to track guests in the office and help plan catering I wrote and maintained while I was still at Heroku. Being on the Heroku Postgres team…
This is the story of my battle with the raccoon. the setup In the back of my parents’ house there is a screened in porch and a cat. The cat has a door to get in and out and do whatever it is cats do during the day and hang out at night by the house. Lately a raccoon has been sneaking every night, washing its hands in the cat’s water, and eating all the cat’s food. The cat kinda tries to avoid the…
I gave a few talks and just realized I never put them up anywhere. The first talk is one I gave as an introduction to BDD using rspec to some students at uiuc. It seems like giving an “intro to bdd” talk is something everyone has to eventually do ;) Intro to Behavior Driven Design from will l on Vimeo . Second is a talk I gave at pecha kucha, which is a lot like ignite. Same auto advancing format,…
Here’s the problem: you’re working on a topic branch and add a gem to your Gemfile, and someone else has added a gem to master before you’re done. When you go to rebase, every single one of your commits is going to have a conflict with Gemfile.lock . All you have to do is run bundle lock to get bundler to relock then add that and continue your rebase. But that’s so damn tedious. Good news! I just…
Full-stack, acceptance, integration, or whatever-you-want-to-call-it testing should be a large part of your test suite. I’m not going to waste time trying to convince anyone of this, since there are probably a million other blog posts doing that (and probably twice as many arguing the different names). Rather, I’ll show you the hands-down best way to do it with what’s out there right now. Follow…
I’ll be speaking about using CouchDB from ruby at the upcoming Red Dirt Ruby Conference on May 6th in Oklahoma City. The format is new, at least to me. There are four themes: Ruby, Rails 3, NoSQL, and Servers. My talk is in the NOSQL theme and it will give you everything you need to get started using CouchDB from Ruby. The rest of the lineup looks amazing, and I’m really looking forward to it.…
Continuous integration is a must. But if your team can’t easily see the current build status, you loose a major benefit of CI: short feedback loops. The longer it takes to notice that the build is broken, the worse off you’ll be. I wrote really simple radiator that shows the current build state and the SHA of the associated commit just using HTML and JavaScript. We have it sitting up in the corner…
It’s been out for a while now, but as a community we just aren’t using it. Why? There have been technical excuses, namely broken gems. It’s probably true that this is holding people back from upgrading, but gems can be fixed if we actually cared. So it’s not a technical reason. I’ve also seen marketing excuses. Odd numbers are generally for developmental releases and even for production. Yeah…
I’ll assume you already know and love Cucumber and are using it. I’ll go even farther and assume you’re writing your steps in Webrat since that’s what cucumber ships with. Now, I really like webrat. It’s a wonderful DSL and fun to work with, but it does have one problem: no javascript, no ajax. Enter Celerity Celerity is a headless browser for jruby that can do javascript. Now you can run your…
I just got back from acts_as_conference and it was great! I promised a few people that I’d put up my slides so here they are: </embed> Thanks again to everyone who made this a fantastic conference. Video Update (2/13): Confreaks just posted all the videos for acts_as_conference. There were a lot of great talks so be sure to check them out. The full page for my talk has links for ridiculously high…
If you have anything approaching a large test suite, the time spent running them becomes an important factor. The longer they take, the less often I tend to run them, which is bad. And I’m probably not alone in that. Ideally you’d be refactoring all your tests, removing duplication and such. If you’re just interested in speeding things up, though it’d be nice to know where the slow specs are.…
New Approach to an Old Problem Your applications need to store and retrieve data. That’s nothing new. CouchDB , and other document databases like Amazon SimpleDB, are new to the game however. Okay, I’ll admit the general concept is some 20 years old , but it’s safe to say that they’ve recently started to gain popularity over the last year or so. Learning a document database is worthwhile, even if…
I’ve often been annoyed at the lack of ||<< after being spoiled with ||= for so long. The workaround I’ve typically used is to go ahead and use ||= [ ] to make sure I have an empty array. That’s ugly though. You’re dropping down a level and writing the “how” instead of the “why”. Today some code <a href=http://blog.jayfields.com/2008/09/ruby-recording-method-calls-and.html>Jay Fields posted</a>…
My current project involves pulling gene names and group data from a tab separated file, then coloring those genes on a pathway diagram. Just like any other part of an application, the parser should be well tested. But how exactly should you go about testing all the different edge cases that the parser will see? One method I've worked with was to have several sample files in the fixtures directory…
I just read a post advocating changing NilClass#method_missing to always return nil . Their argument is that you no longer have to check if you actually have something before calling methods on it like: @sun && @sun.still_burning? Instead, you could just call @sun.still_burning?, which is nice. I usually just check isthesunstillburning.com 20 times a day to make sure, but you get the point.…
With the recent release of Merb 0.5 , I’ve decided to use it along with datamapper for one of my new projects. It isn’t different enough to be completely foreign, but enough to be a refreshing change. I haven’t done a whole lot with either yet, but I have had a patch accepted, ran into a huge, annoying problem with autotest, and found out how to watch the SQL datamaper is generating. stats patch…