Category: Rails

Using Git Log to Show Last Month’s Commits

Every month, I have to produce a short bulleted list of tasks I worked on from the previous month. Usually I end up straining my memory trying to remember everything I did. The last time I had to make this list I realized that our git repository contained all this information. I had to find… Read more »

Letting Go

I love deleting code. It’s one of my favorite maintenance tasks. Every unnecessary line of code in an application weighs on my mind like an unpaid bill. I feel a sense of glee when I get a chance to delete a feature we don’t need anymore. Every line, function, class, and feature has a cost…. Read more »

Iterating over consecutive items with Underscore.js

Ruby Enumerable’s each_cons Ruby’s Enumerable module has a useful method called each_cons. It’s useful when you need to perform an operation over N consecutive items. Here’s an example: a = [1,2,3,4,5,6] a.each_cons(3) { |l| puts l.inspect } # output [1, 2, 3] [2, 3, 4] [3, 4, 5] [4, 5, 6] It’s like a moving… Read more »

Determining if a Spherical Polygon Contains a Pole

I’ve been working on a library for NASA that validates polygons describing areas on the Earth. The polygons are metadata for Earth Science data, such as images from an orbiting satellite. A polygon is represented by a list of points in counter clockwise order defining an outer boundary. The polygon can also have holes which… Read more »

Waiting For Torquebox / JBoss to Start

We recently started to use Torquebox on one of our projects. Torquebox is a Ruby application platform built on top of the JBoss Java application server. It has a lot of great features that you can read about on their website torquebox.org. Switching from a custom coded Tomcat environment for deploying JRuby applications to Torquebox… Read more »

Connection Pool Thread Safety in Rails and JRuby

I work on a high volume Rails application that has a REST API for indexing and searching high volume science metadata. We chose JRuby to implement it because of the easy deployment to our Tomcat application server and our existing experience in the Java ecosystem. JRuby’s threading and performance characteristics didn’t hurt either. The application… Read more »

Ruby Clojure Integration

Lately I’ve been looking into the Clojure programming language, a Lisp that’s implemented on top of the JVM. One of the aspects of Clojure that I’m interested in is its ability to integrate into existing projects, especially Ruby projects. Since Clojure runs on the JVM and already integrates with Java it should be easy to… Read more »