August 2011
1 post
Five Android Customization Apps I Can't Live...
I recently upgraded to a Samsung Droid Charge, which overall I’m quite pleased with. With the clean slate provided by the new phone, I immediately set to installing and configuring things to my liking. Below are five apps that replace, extend, or enhance functionality that ships with the phone; my system wouldn’t feel complete without them.
LauncherPro
A replacement for the Android...
June 2011
3 posts
This is a good kitten. →
This is a good puppy. →
This is a good puppy. →
May 2011
1 post
This is a good puppy. →
April 2011
4 posts
Screentopia!
I’m a big fan of GNU Screen. Split-screen is indispensable for writing code, and it’s convenient to be able to run a bunch of interactive processes and switch between them really easily (control-A [0-9]). I like screen, so much, that I never want to use a terminal emulator without it.
So, to that end, I generally set up gnome-terminal to execute screen at startup. That way, when I...
Test after_commit hooks with transactional...
Rails 3 introduced after_commit and after_rollback hooks, which are quite useful for situations in which a call to an external service relies on a consistent database state from that service’s perspective. Unfortunately, out of the box, it’s quite difficult to test these hooks, because Rails by default wraps each test case in a database transaction (rolling this transaction back at the...
This is a good puppy. →
This is a good puppy. →
March 2011
4 posts
1 tag
Use backup gem with Heroku's pgbackups
The backup library is a powerful, flexible, easy-to-use way to configure and execute data backups for your Ruby app. It doesn’t support Heroku’s pgbackups out of the box, but the library has an excellent modular design, making it dead simple to code up a module for pgbackups.
Here’s my quick-and-dirty crack at it. It works, but has basically no configuration options (not that...
This is a good puppy. →
This is a good puppy. →
This is a reasonably good puppy. →
February 2011
6 posts
1 tag
Voting rights
Non-driver ID cards in Wisconsin cost $28. Doesn’t that make this bill a poll tax? And isn’t that in violation of Section 10 of the Voting Rights Act, which is the law that enforces the 15th Amendment?
Just checking.
Using ENUMs with Rails →
Great article by friend and former colleague John Crepezzi. John and I both think Rails developers should focus more on using databases as they were intended to be; Rails tends to move a lot of database-layer considerations (column lengths, “uniqueness”, nullability, relational integrity, etc.) improperly into the application layer. If you’re looking to take better advantage of...
This is a good puppy. →
I mean, it’s really, really good.
NewRelic metrics for Mongoid
The rpm_contrib project provides a one-stop shop for monitoring lots of services commonly used in Rails apps. It’s got an instrumentation module for Mongoid, but unfortunately it doesn’t work (at least in Mongoid 2.0), because it’s instrumenting on methods on Mongoid::Document that may or may not actually be called in the course of a query. Happily, we can add full...
1 tag
This is a good puppy. →
1 tag
This is a good puppy. →
January 2011
10 posts
1 tag
http://xkcd.com/854/ →
1 tag
Breakfast Quinoa →
I’ve been eating a lot of quinoa recently, having discovered an unopened bag of it in my cupboard. Mostly I’ve just been cooking it in the rice cooker and then stirring in golden raisins (also foraged from my cupboard) and a little olive oil and dried parsley. But this recipe made a very tasty breakfast, once you get over the weird combination of quinoa’s vegetable-y flavor and...
1 tag
This is a good puppy. →
1 tag
1 tag
This is a good puppy. →
1 tag
Custom error pages in Rails 3
Updated: It’s public, not app/views.
Just so that posterity may have more luck Googling for this than I did: to create a custom error (5xx) page in Rails 3, create a static HTML file with the error code in your base public directory, e.g.:
public/500.html
If you’re internationalized (and you are, right?), you can add an I18n extension:
public/500.en.html
These paths are...
1 tag
Use observers with Mongoid 2 and Rails 3
Mongoid 2 doesn’t have built-in support for ActiveModel observers, but thanks to the modular design of Rails 3, it’s trivial to tack on:
Drop that somewhere into your load path, include Mongoid::Observing in the models you’d like to observe, and it’ll work just like ActiveRecord observers.
1 tag
http://xkcd.com/844/ →
1 tag
Spork, Mongoid 2, Rails 3
In one of my (to date) signal accomplishments of 2011, I recently upgraded the Clique application to Rails 3. One thing I couldn’t get working right away, though, was the excellent Spork library, which lets you run RSpec without having to reload your application dependencies on every run. In particular, I couldn’t get Spork to pick up changes to my model classes. Not a deal-breaker,...
1 tag
Happy new year, America. →
December 2010
2 posts
2 tags
Sunspot 1.2 released (finally)
After a firmly ridiculous amount of time in release candidate status (mainly owing to lack of time on my part), Sunspot 1.2 final is out. Here’s the inside scoop.
Upgrading
First, if you’re using Sunspot::Rails, you no longer need to explicitly load the ‘sunspot/rails’ source file (in fact, if you do, things won’t work right). So if you’re using Rails 3 (or...
This is a good puppy. →
May 2009
3 posts
1 tag
Sunspot 0.8 is out
On Friday, I released the next milestone in Sunspot, version 0.8. This version doesn’t add to or change any of the basic functionality, but does add some advanced features which the app I work on for my day job happens to demand. Here’s a rundown:
Direct access to the Query API
Users of Sunspot will doubless be familiar with Sunspot’s search DSL, which gives an English-like...
Installing alternate Ruby versions as optional...
As a developer of Ruby libraries and applications, I’d like to make sure my code works in all of the major ruby implementations, but I’ve also got my “main” Ruby, the one that has been with me through thick and thin and happens to be the version installed on our production servers. The other Rubies need a place on my machine, but I’d like that place to be out of the...
A 15-line alternative to multiruby
Today’s mission was to get Sunspot working in all the major Ruby implementations (MRI, YARV, JRuby). I personally use MRI 1.8.6p114, and hadn’t had a need to install any other Ruby implementations, so I first tried out multiruby, which handles all of the installing and running of different Ruby versions. Alas, it didn’t work very well - after all, package management is a...
April 2009
2 posts
Git Tip of the Day: git cherry-tree
The problem
Recently I came across a situation in which I needed to make some fairly major changes to our codebase, and those changes needed to apply to two different branches - both a version branch that’s currently in QA, and the master branch. The changes involved reverting a few commits as well as making new changes that were too big to comfortably fit into one commit. One option would...
ShellElf runs shell commands from a Starling queue →
ShellElf is a small daemon that reads shell commands out of a Starling queue and runs them. Great if you need to do non-trivial processing tasks in the background. It’s lightweight but has a few neat features:
Post back to a specified HTTP service on success/failure for each command batch
Exit gracefully on TERM/INT - either finish the current batch, or reenqueue it, before exiting.
...
March 2009
5 posts
rake db:rollback_to_common →
If you find yourself having to switch locally between different git branches that have different database schemata, (for instance, a master branch and a production branch), one of the biggest hassles is keeping the database in the right state. We wrote this rake task to make the process painless: just specify the branch you’re about to switch to, and it will automatically roll back to the...
Using Git Submodules for Shared Rails Components →
I’ve been thinking for a while about how nice it would be to share the model layer of our Rails app with other codebases that don’t have to load up all of Rails. In particular, this would neatly allow one to avoid using Workling (which essentially runs the entire Rails stack as a Daemon), instead building lightweight queue-reading daemon processes that still have access to the model...
Where are the REST frameworks? →
I’ve been thinking a lot about REST lately - what it means for Rails developers, and what it means in the broader scheme of things (the two are scarcely related). This article is an interesting addition to the discussion, and I’m especially intrigued by the treatment of hyperlinking and its relationship with the traditional Rails approach of polymorphic associations.
Using Ruby's Autoload Method To Configure Your App... →
Good primer on Ruby’s autoload keyword, which makes it easy to only load pieces of a library or application when you need them
blowmage: anyone remember seeing a screenshot of _why's computer about a year ago? he was using a tiled window manager. can't find the url...
JamesKilton: ion?
JamesKilton: wmii?
Mikoangelo: _why uses a window manager?
Mikoangelo: I thought he just used eight switches and an enter key
February 2009
3 posts
1 tag
Three changes I'd like to see to DataMapper before...
DataMapper is an excellent Ruby ORM, brought to you by (roughly) the same rock stars who built Merb and are now working on building the first production-ready version of Rails. DataMapper boasts some obvious advantages over ActiveRecord - a small core with a gem-based plugin framework, an object store (to enforce one-object-per-row within a session), and a very clever strategy for implicitly...
Why you see hundreds of "SHOW TABLES" queries when...
As part of my continuning quest to make ruby-prof a useful part of my optimization toolkit, I decided to finally investigate why, when running the profiler, I was seeing the SQL query “SHOW TABLES” output over and over, hundreds of times, in the log. And it was super-slow - over a minute to finish a request that otherwise clocked in around a second.
After digging around in ruby-prof...
2 tags
Sunspot 0.0.2 released
Finally, another release of sunspot, my library for awesome interaction with Solr in Ruby. I haven’t had much time to work on it in the past couple of months, so version 0.0.2 isn’t exactly earth-shattering. The good news is that, starting in a couple of weeks, my employers have me slated to spend much of my workday developing Sunspot, with the goal of putting it into production early...