Friday, December 19, 2008

Hoptoad Notifier environment filter

Hoptoad is a great tool for collecting error information from your rails app, however, don't forget to filter any environment variables or parameters that contain sensitive information. This is done by adding the following lines to the config/initializers/hoptoad.rb:

config.params_filters << 'my_sensitive_param'
config.environment_filters << 'my_sensitive_env'

Replace the merged values accordingly.

Also take note that as of 11/25 proxy support has been added to the HoptoadNotifier thanks to xmlblog.

Thursday, December 11, 2008

Rails multi-param attribute processing for dates

If you're manually handling date parameters built using rails date select helper be careful with Date.new since invalid dates (02/31/2008) will raise an exception. Others have blogged about this but I haven't come across a post mentioning how to deal with invalid dates the rails way just yet.

If you let rails do the work, it will try to convert the invalid date to a valid date for you. Using that code as inspiration, you can do the following:
@birthdate = Time.local(params['birthdate(1i)'].to_i, params['birthdate(2i)'].to_i, params['birthdate(3i)'].to_i).to_date


Thursday, December 04, 2008

CouchDB Peepcode

I just downloaded the CouchDB PeepCode and was following the CouchDB installation instructions when I ran into a problem. At the time the screencast was published the erlang macport install supposedly worked, however I ran into a Bus error that has apparently been out there for sometime. Fortunately, there is a simple work around until the fix is released sometime this month (hopefully).

Tuesday, November 11, 2008

I just got back from rubyconf a few days ago. There were some great talks and I had a great time. I think I enjoyed myself more this time around as well. There is nothing like a great conference to replenish my energy level!

Wednesday, June 18, 2008

Sometimes, it's the small things that make me happy. Today I found out that the cafe located on the first floor of my client's building started offering free wifi. This is a big deal because it provides myself and the rest of the dev team more flexibility in work location. Unfortunately, our current space is less than adequate, particularly since we have loud neighbors. Although we have tried, we have not been able to procure a more suitable work area.

Anyways, it's little things like this that can improve team morale. I know mine has!

Thursday, November 08, 2007

I just got back from RubyConf a few days ago. I was really excited by David Chelimsky's and Dave Astels' talk, 'Behaviour Driven Development with RSpec'. The plain text story runner is a great addition and will be available in the next release which is coming out soon.

In a nutshell, it allows you to create plain-text, executable stories such as:

Story: Daily hour calculation

As a user
I want to be able to enter my time in and time out into my time sheet
So that I can track my hours

Scenario: calculate whole hours
Given a time in of 2007-07-09 19:00
And a time out of 2007-07-09 21:00

Then the hours should be 2

Scenario: 0 minutes is 0 hours
Given a time in of 2007-07-09 19:00
And a time out of 2007-07-09 19:00

Then the hours should be 0

The results of running this story looks like this:
denethor:stories $ruby day.rb
Running 2 scenarios:
Story: Daily hour calculation
As a user
I want to be able to enter my time in and time out into my time sheet
So that I can track my hours


Scenario: calculate whole hours

Given a time in of 2007-07-09 19:00
And a time out of 2007-07-09 21:00

Then the hours should be 2
.
Scenario: 0 minutes is 0 hours

Given a time in of 2007-07-09 19:00
And a time out of 2007-07-09 19:00

Then the hours should be 0
.


2 scenarios: 2 succeeded, 0 failed, 0 pending
A really neat thing is that the output can be saved to a file and executed.

David and Dave presented some really neat ideas around the story runner. One particularly interesting one was the potential of e-mailing to a remote story runner and getting the results e-mailed back. Lots of interesting possibilities lie here.

To get more details, check out David Chelimsky's blog.
Note that at some point the RubyConf talks will be made available online, although I am not sure when and where.

I recommend pulling the latest code from trunk (svn checkout http://rspec.rubyforge.org/svn/) and giving it a spin.

Sunday, March 11, 2007

Set-Based Design and Effective Risk Management

Set-based design is an empirical approach where a problem space is explored simultaneously through the investigation of various solutions so that the most optimal solution can be chosen at the last moment that the decision needs to be made.

There are a few benefits to this:
  1. The longer that you can put off make a decision, the more informed the decision will be. Of course, you cannot procrastinate. It is important to first decide when you must absolutely make the decision.
  2. You generate a better understanding of the problem space by tackling it from different angles.
  3. By investigating multiple solutions to a problem in parallel, you are more likely to have something functional and ready to deliver in the end. This is effective risk management.
When is it appropriate to exercise set-based design? When you have an irreversible decision to make or when you are facing a deadline which cannot be missed.

Some may consider this as a wasteful practice. Why invest so many resources in solving a particularly problem. However, in most cases the cost of missing a deadline or making an ill-informed decision is significantly higher. Even then, this may be difficult for some people to grasp when they are deep into the task at hand. When this happens, step back and consider the long term goals of the company and the product being development. I bet you will find the investment will be worth it.

You may come across customers who are hesitant to compromise on scope even when a deadline is set in stone and it is pretty clear to you that the current scope is not achievable by that deadline. Instead of running for the hills as some have suggested, consider set-based design. More often than not, the budget is there for it since the organization is more than willing to bring in as many people as it takes to get the job done. It could just be what is needed to get the customer to identify what feature-set is absolutely required to get the product to market.

To learn more about set-based design, have a look at the following resources: