What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

Hashrocket => Blog


Freezin’ For A ReasonYesterday

A small faction of Hashrocket is migrating north this winter to Wisconsin!

We have a few people who are native to Wisconsin (Myself Jim "Big Tiger" Remsik, Jon Larkowski, Jenifer Remsik and Veez) and they're dragging the CEO and CFO to the Frozen Tundra for a little ... well, not really relaxation.

Four of us (Lark, Mark, Marian, and myself) are participating in the Polar Plunge to benefit Special Olympics of Wisconsin. The event consists of cutting open one of Madison's frozen lakes and going for a quick swim.

Jenifer and Desi are planning to join us for morale support.

Visit the Hashrocket Polar Plunge Team Page

Geospatial searches with ThinkingSphinxSeptember 12 2008

Geospatial searches with ThinkingSphinx

One of our recent projects required geo-aware searches of business addresses. It is not news that Hashrocket prefers ThinkingSphinx for fulltext searches. Sphinx Search and as a result ThinkingSphinx also support searching around a geographical point.

Understanding How It Works

This was my first foray into geospatial searches. ThinkingSphinx makes this task fairly straight-forward and only requires that you have a data-set containing geocoded datums. Specifically, it is assumed that you have a latitude and longitude associated with the data you are searching. ThinkingSphinx will accept columns names lat or latitude for latitude and lon, long, or longitude for longitude. One obvious missing abbreviation is lng for longitude. I have submitted a patch, in the mean time the set_property method can be used if your data do not match these expectations. Sphinx stores these geographical columns in radians to avoid the overhead of crunching these numbers on the fly. Indexes and subsequent searches therefore are expected to provide the anchor point in radians and not floating point numbers. define_index do indexes :name # Explictly convert column to radians at the time of indexing. # Note: RADIANS() is run in the context of MySQL
Where should you be on August 23rd?August 20 2008

Where will all the bright minds in Jacksonville, FL be on August 23rd? JaxCodeCamp is a free conference consisting of eight, yes EIGHT, tracks organized by JaxDUG. The event will be held at Florida Community College in the Advanced Technology Center, located at 401 W. State Street in Jacksonville, FL.

Hashrocket is sponsoring this event to foster growth in the vibrant Ruby/Rails community in Jacksonville. Veez Remsik, and Corey Grusden are participating as speakers discussing Rapid Application Development with Rails and Git. Events like this one that bring developers together to share ideas are required for a healthy tech ecosystem.

In my experience conferences are invaluable for the "hallway track". That is to say the time spent geeking out in the hallways between or instead of attending sessions and connecting with people. Carrying this a step further JaxCodeCamp has a pre-event social to help people unwind and get to know each other, and perhaps more importantly a post-event party that is likely to be the stuff of legends hosted by the Hyatt Regency Jacksonville Riverfront.

Don't miss out on this great local event, stop and talk to Corey and Veez and anyone else with a Hashrocket shirt!

RSpec 1.1.4 and Helper SpecsJuly 2 2008

Last week, RSpec 1.1.4 was released; and given my optimistic disposition I immediately upgraded. Happily, the upgrade was almost seamless. Two interdependent issues kept this from being a flawless upgrade:

  1. A new deprecation warning on our helper specs (no one really likes to see deprecation warnings)
  2. A bug in the new way to write helper specs (a show stopper)

Lets see what happens when we run our spec1.

Wonderland$ spec spec/helpers/dog_helper_spec.rb Modules will no longer be automatically included in RSpec version 1.1.4. Called from ./spec/helpers/dog_helper_spec.rb:8 .Modules will no longer be automatically included in RSpec version 1.1.4. Called from ./spec/helpers/dog_helper_spec.rb:16 . Finished in 0.393129 seconds 2 examples, 0 failures

So, what does this deprecation warning tell us? Lets examine the helper spec that generated these warnings:

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe DogHelper do describe "name_or_description()" do it "should return a description for a dog without a name" do dog = mock_model(Dog, :name => nil, :sex => 'male', :breed => 'Labrador', :color => 'black') name_or_description(dog).should == "(male Labrador, black)" end end describe "owner_link()" do it "should return a link to the owner" do owner = mock_model(User, :login => 'sally_smit
Crummy - Tasty Breadcrumbs PluginJune 30 2008

I have worked on many applications that require breadcrumbs. Every time, one of the developers has built a quick custom solution. Finally, I decided that we needed a complete solution that we could easily add to future projects, and thus Crummy was born.

Requirements

I set a few requirements that must be fulfilled in order for me to call the plugin a success. They were:

  • Ability to add breadcrumbs at Controller class level (like a before filter)
  • Ability to add breadcrumbs in the controller methods (such as actions)
  • Ability to add breadcrumbs from the views
  • Ability to add breadcrumbs with or without an url
  • No variable conflicts (such as instance variables)
  • Full and strong spec coverage
  • Good documentation

I managed to fulfill these requirements and add a few shiny methods to make life easy.

Examples of Usage

class ApplicationController class BusinessController [:comments, :show]) { |instance| instance.send :business_comments_path } # Only add the comments link on the comments and show actions. before_filter :load_comment, :only => "show" def show add_crumb @business.display_name, @business end def load_comment @comment = Comment.find(params[:id]) end end

Golden Feature

One of the most useful argument usage is add_crum