syntatic

Archive for November 2007

Tools in the Studio

with one comment

Process

Obtiva’s Studio is busy churning out projects and I thought it would be good to let the rest of the world what we are up to. Most of our rails projects are now using CruiseControl.rb, Zentest, restful_authentication, gems, query_trace, attachment_fu, Rcov, redgreen, exception_notification and mocha. While the list may seem long we are always looking for new tools. If you have any suggestions please comment.

As a team we’ve setup growl integrations for cruise, autotest and redgreen which is strongly suggested. Make TDD easier for yourself. As a team we really need to put out a tutorial on how to set all of this up properly. In my opinion you are doing yourself a disservice without them.

A quick side note, grep -r is mostly dead around here due to ack. Try ack, you’ll love it.

Interests

We’ve also pushed a lot of our interest into JRuby and Erlang. We are all extremely excited for the opportunities those two tools will provide. JRuby’s memory usage have our mouths drooling. If you are not paying attention to Charles Nutter’s blog you are missing out! The pace of everything surrounding JRuby is astounding. Merb and Sinatra are on our radar.

People

Joseph Leddy is deep in the bowels of ActiveWarehouse and FasterCSV where he is making millions of SQL rows consumable for our clients. Joseph is also exploring ETL Tool. He’s been aggressively implementing state machines alongside access control also. Tools unique to Joseph are query_analyzer and tail_logs which I’m eager to take a look at. Joseph recently implemented some multi-server file uploading using BackgrounDRB with tests!

Nate Jackson’s work involves sphinx via acts_as_sphinx mashed into will_paginate and aspell. He’s created an intelligent word suggestor for misspelled words and phrases using raspell. Nate spent a day or two scraping the web with hpricot, WWW:Mechanize , csspool and sass. Nate’s also pushing the studio into NetBeans for Ruby, RSpec, Dvorak and Leopard. Nate likes to include svn_tools and dot.rake in his projects.

Dave Hoover‘s working on innovative interfaces with Ajax and BackgroundDRB. Dave has picked up AR::Extensions as a hammer for memory and speed intensive ActiveRecord imports. He’s also weaving together fleximage and attachment_fu in a few projects. I don’t know much about it yet, but Dave seemed please with ZIYA and Flash chart delivery. Dave’s spent some of his time plunging into Sinatra too. Dave’s editor of choice is Textmate. Other things in his camp include: liquid, RedCloth, and chronic.

Dave also released a gem called TamTam using hpricot that will inline css. You can find the gem here. Dave and Nate paired up to create Obtiva’s first OS X widget here. I paired up with Dave to create a rails plugin for TamTam too which is named inline_css.

Ryan Platte has put together some sweet mashups with GWT, AIM Presence API, BackgrounDRb and ActiveScaffold. While Ryan wasn’t a huge fan of ActiveScaffold I was impressed. His editor of choice is rails.vim. For testing he is using UnitRecord to speed up his test suite among its other benefits. Ryan is now promoting the use of factories over fixtures. Ryan and Gareth demoed Ruby Prof to the rest of the studio. Ryan introduced me to the wonderful world of GNU Screen. The little exposure I’ve had to his projects has me very impressed.

Gareth Reeves is doing work in Event Driven Architecture and Event Driven Programming. He introduced me to testing Java with jMock.

I’ve been working with Amazon ECS, Streamlined and a session bridge between rails and Perl’s CGI Session. I strapped subdomain/SEO love onto a project using request_routing, url_for_domain, and acts_as_sluggable. Nate and I pulled ActiveMerchant into a project which was much less painful than expected. If you’re doing complex condition building my tool of choice is condition_builder. I also extended restful_authentication so that it can support authentication for multiple types of users.

Written by syntatic

November 30, 2007 at 9:42 am

ruby on rails: merge! ‘params’ with a hash indifferently

with 3 comments

When using a merge! with the params method key value pairs are not clobbered if the calling hash is using symbols as keys.

If params[:colors] contains:

params[:colors] = { "blue" => false, "green" => true }

and sym_hsh contains:

sym_hsh = { :blue => true, :red => false }

a merge! of the two will result in this:

sym_hsh.merge!(params[:colors])
=> { "blue"=> false, :blue => true, :red => false, "green" => true }

Notice the duplicate blue key and mixed key types. Some are symbols and some are strings.

Using rails you probably haven’t run into this problem much. Behind the scenes in most of rails hashes are made indifferent to key type. Indifference protects developers from running into problems with strings and symbols as hash keys.

The rails code base uses the class HashWithIndifferentAccess allowing hashes to use strings and hashes interchangeably.

When creating new hashes in a rails project it is best to avoid the problem alongside rails. You can do this by creating hashes two different ways:

hsh = HashWithIndifferentAccess.new( :blue => true, :red => false)

or this which does the above for you:

{ :blue => true, :red => false }.with_indifferent_access

Now the merge! will clobber :blue instead of appending another :blue key.

Written by syntatic

November 28, 2007 at 10:01 pm

Posted in programming, rails

Education Level

leave a comment »

June of 2007, I spent a week in Alabama with Jenna and 25+ high school students from student body. The town we served – Boligee, Alabama – is radically different than my hometown of Wheaton, Illinois. In the last ten years, the educated and the “wealthy” have abandoned it. A dying town in a dying county, many are left without hope or any vision for the future. In Boligee the median income for a family is $16,146 where it is $104,475 in Wheaton. Boligee doesn’t provide opportunity like the suburbs here do and it certainly doesn’t educate like our system does.

This experience reminded me of how much I’ve been given. I’ve been blessed with more opportunity than I can imagine. My high school education rivaled many college programs and I was able to attend an excellent college to top it off. I’ve come away from it all with little debt and a host of options for my future.

One night, it hit me: God doesn’t care how educated you are. He doesn’t require you to be educated to follow him. You can be the most educated person in your country and it doesn’t make one bit of difference when it comes to godliness.

During my stay in Alabama, I took a long hard look at the fruits of the spirit – asking myself what impact education has on them. Does it take a college education to love? Or a high school degree to have joy? Do you need a Ph. D. in peace to attain it? Does patience require a high SAT score or kindness demand an above average GPA? Do goodness and faithfulness require literacy? What impact do grades have on gentleness and self-control? The truth behind these questions humbles me. I hope that everyone has a chance to be humbled by them.

Written by syntatic

November 28, 2007 at 8:30 pm

Posted in christ, family