Posted on 02/04/2018
Ruby does not have a built-in enum type. The meta_enum gem can fill the gap.
Posted on 08/08/2017
Upgrading a production PostgreSQL server can be a complex and delicate process. But in a development environment downtime is not an issue and database size is typically fairly small. For these cases performing the same upgrade process as production can be overkill. There is a simpler way.
Posted on 09/08/2016
While working on the Websocket Shootout, I frequently needed to connect to a websocket server and interact directly. None of the existing tools I was aware of had exactly the features I was wanted. That led to the creation of ws.
Posted on 07/07/2016
Polymorphic associations can be difficult to correctly represent in a relational database. In this post I will compare and contrast four different ways to model these challenging relationships.
Posted on 02/15/2016
Given a bank account of debit and credit transactions, what is the greatest balance the account ever had? Given a hotel with arrivals and departures, what is the greatest number of guests the hotel ever had? Both of these are examples of finding the greatest running total. Finding the greatest running total is a great exercise with which to explore some of the lesser known features of PostgreSQL such as window functions, custom aggregates, and C functions.
Posted on 12/28/2015
This article compares the performance of map lookup and switch statements in Go?
Posted on 04/23/2015
Queries returning aggregate, summary, and computed data are frequently used in application development. Sometimes these queries are not fast enough. Caching query results using Memcached or Redis is a common approach for resolving these performance issues. However, these bring their own challenges. Before reaching for an external tool it is worth examining what techniques PostgreSQL offers for caching query results.
Posted on 12/18/2014
Hashrocket hosts an internal conference twice a year called Miniconf where we take a day to share ideas with each other. This last Miniconf I gave a quick 20 minute talk with a grab bag of Linux, shell, PostgreSQL, and Ruby tricks. This article is that talk converted to text format.
Posted on 10/04/2014
React to file system changes by executing a command
Posted on 08/07/2014
In the course of optimizing the pgx PostgreSQL driver I observed a number of performance characteristics of Go that I hope you will find useful.
Posted on 04/19/2014
New release of Tern rewritten in Go
Posted on 08/18/2013
Writable common table expressions are a powerful feature of PostgreSQL that is rarely used when building applications with an ORM like ActiveRecord. It allows inserts, updates, and deletes to be performed in the WITH clause of an SQL statement. Here are a few techniques that I have found useful.
Posted on 02/22/2013
Surus now can use PostgreSQL's JSON functions to build JSON much faster than Rails to_json
Posted on 01/29/2013
A new feature in PostgreSQL 9.2 is JSON support. It includes a JSON data type and two JSON functions. These allow us to return JSON directly from the database server. This article covers how it is done and includes a benchmark comparing it with traditional Rails JSON generation techniques.
Posted on 08/25/2012
Use your favorite GUI text editor on remote servers over SSH.
Posted on 02/16/2012
Accelerate ActiveRecord with PostgreSQL specific support
Posted on 02/07/2011
New gem to simplify complex database schema migrations
Posted on 11/29/2010
New gem to simplify time of day handling
Posted on 11/14/2009
A simple gem plugin for testing database constraints.
Posted on 08/08/2009
A math puzzle from The Art of Game Design by Jesse Schell is solved with Ruby.
Posted on 07/11/2009
Random internet connection loss was solved by installing DD-WRT.
Posted on 06/22/2009
The path to the Firefox binary changes on upgrade. This can break Selenium.
Posted on 06/20/2009
Ruby is more at home on *nix than on Windows. This tutorial covers setting up a Windows machine as a VM host, installing an Ubuntu VM, building Ruby 1.9, and setting up file sharing between Windows and the VM.