Add Google cloudprint & wifi access to your older printer with a headless $35 Raspberry Pi

There are several articles saying how easy it is to set up a $35 Raspberry Pi to let you print to your printer with your Chromebook or mobile devices.

One problem. They all lie.

Read more ›

Posted in Technical HOWTOs

How to make breaking changes and not break all the things

The Problem

Incremental feature development against existing systems frequently involves rethinking and rebuilding existing components. If it’s possible, the easiest way to add support for your new feature is to introduce a new, optional attribute on a model (or in the case of a relational database, adding a NULLable column to an existing table, or adding a new table). Sometimes, though, that either isn’t possible, or wouldn’t be the best design going forward, given your new knowledge of the feature set of the product at hand. You’re left with the uncomfortable realization that the best design would be something completely different that isn’t backward-compatible with current systems.

When there are multiple systems that consume a given data model (say, a front-end webserver, an API, tons of cron jobs, and many backend daemons, like in the case of Twitter’s Ads systems), you can’t just “stop the world,” ALTER your tables, and deploy all the new code. That’s fine if it’s you and another nerd in a garage, but when you’ve got paying customers, you don’t want to give them an excuse to spend their money elsewhere.

What to do?

Read more ›

Posted in Technical HOWTOs

Inspecting ActiveRecord-generated queries

For the vast majority of rails CRUD applications, you aren’t going to need exotic SQL queries, but when you need to make assertions on the generated query, there are two options at your disposal.

Assume you have the following model:

Read more ›

Posted in Technical HOWTOs Tagged with: , ,

How to test your rails application with Travis CI on different databases engines

Travis CI is an awesome continuous integration service that’s free for open-source projects.

If you’d like to test your app against multiple database engines, it’s fairly simple.
For these examples, I’m testing my app against SQLite, MySQL, and PostgreSQL.

Read more ›

Posted in Technical HOWTOs

How to deal with Amazon’s “requested Availability Zone is no longer supported” error

In shutting down the AdGrok servers (talk about bittersweet…), I stopped the instances, but then remembered I wanted to shred the files first, so I clicked “start,” and was greeted by the following error:

The requested Availability Zone is no longer supported. Please retry your request by not specifying an Availability Zone or choosing us-west-1b, us-west-1c.

Read more ›

Posted in Technical HOWTOs Tagged with:

It really is rocket science!

This last Friday I taught my “it really is rocket science” class to another hundred children (Kindergarten through 5th grade). Last year PTO Today wrote an article about Arts and Science day, and interviewed me. This year, the kids were great, I had tons of help, and the new rocket launcher designs let the kids experiment with different pressures and different launch angles. Good stuff!

The launcher design is almost exactly from Slater Harrison’s awesome overhead water rockets. Thanks!

Posted in Technical HOWTOs Tagged with: ,

How to fix “rake/rdoctask is deprecated. use rdoc/task instead”

Seeing this?

Edit your Rakefile and change these lines:

to look like this:

You may need to add gem 'rdoc' to your Gemfile, too. While you’re at it, you might want to add rdoc/ to your .gitignore, too

Posted in Technical HOWTOs Tagged with: ,

How to wrangle the pg (postgresql) gem with macports and rvm

Seeing this?

Wondering how or where to get this mythical pg_config? It’s part of the PostgreSQL package. If you’re running MacPorts, it’s easy:

Then, following the instructions on the RVM website, run

Posted in Technical HOWTOs Tagged with: , , , ,

HOWTO: Fix git-gui’s “Spell checking is unavailable” dialog

Launching git gui from the command line, when built with MacPorts, causes an irritating dialog to pop up:

The solution is simple:

Posted in Technical HOWTOs Tagged with: ,

Creating acts_as_… gems for Rails 3.1.x

Update January 2012: since originally writing this post, I’ve recanted my love for rails plugins — having a stubbed rails app in your plugin’s test directory is just too funky. If you need an example of a rails 3.2.x plugin that uses rspec 2 and has Travis CI integrated, check out closure_tree. But even that setup feels to heavyweight.

The original post follows.

There are a lot of posts on how to build rubygems. With Rails 3.1, though, they’re all old and busted.

The new hotness is built right into rails now. Just incant

You’ll get:

  • a .gemspec and Gemfile to get started
  • a dummy rails app to integration test your new gem against
  • a (deprecated) RDoc rake task

When you run rake, you’ll see “rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)”. To remedy, follow these steps.

The Edge edition of the Ruby on Rails Guides has more information.

Posted in Technical HOWTOs Tagged with: , ,