How ofter were you asked by a client for a CSV (or excel) file with data from their app? I get asked that question quite often, so I wanted make the process as easy as possible. And guess what? You can create CSV files directly from MySQL with just one query!
Archive for November, 2008
Export CSV directly from MySQL
November 27th, 2008SQL: Ordering with NULL values
November 14th, 2008First seen at Kabisa Blog: SQL: Ordering with NULL values
This post tells you how to sort NULL values in a column to the bottom and sort the remaining non-NULL values.
This is really great in combination with LEFT JOIN queries that may yield NULL values.
RSpec’ing with Time.now
November 5th, 2008I’m currently writing some RSpec tests that use Time.now.
I want my model to calculate a duration and store the future time in the database. I’ve already specced the calculation of the duration, but I also want to spec that everything gets saved correctly. Here’s my first spec:
it "should do stuff" do m = Model.create() m.expires_at.should eql(Time.now + some_value) end
This fails.
