Joseph Palermo's blog



Joseph PalermoJoseph Palermo
Standup 03/06/2009
edit Posted by Joseph Palermo on Saturday March 07, 2009 at 07:42AM

Interesting Things

  • If you're using ack in project for textmate, be sure to edit your .ackrc file to include any non-standard file types you're using.

  • A project had a dramatic speed up in their test suite by mocking out ActionMailer in tests. Something to consider if your tests cause a lot of email side effects.

  • field_named wasn't working for us when using Webrat to drive Selenium. Our fork with the simple fix can be found here.

Joseph PalermoJoseph Palermo
Standup 03/05/2009
edit Posted by Joseph Palermo on Friday March 06, 2009 at 12:09AM

Interesting Things

  • Giving your fake acts_as_fu model the same name as an actual model you have can lead to very obscure test failures. For those not in the know, acts_as_fu gives you the ability to test your model extensions directly by creating a fake model in your tests and mixing your extensions into it.

  • A few people have been using Paperclip to manage their attachments and have found it easier to integrate than Attachment_fu.

Joseph PalermoJoseph Palermo
Standup 03/04/2009
edit Posted by Joseph Palermo on Wednesday March 04, 2009 at 10:20PM

Interesting Things

Integer("008") != "008".to_i
  • The to_i method is what you want, unless you want exceptions or octal numbers.

  • Somebody needed help constructing a named_scope where they could reference the count of an associated has_many association. There was some grumbling about using :joins and :group (and if you do this, be sure not to call count on the scope itself without also doing a :select => 'DISTINCT primary_key'). The winning solution was to just put a counter_cache on the association and use the denormalized column instead.

Joseph PalermoJoseph Palermo
Standup 03/03/2009
edit Posted by Joseph Palermo on Wednesday March 04, 2009 at 12:20AM

Interesting Things

  • Somebody was seeing mongrels hang when using an older copy of the S3 gem. It turned out the older version had the option for persistent connections defaulting to true. Setting :persistent => false or using a newer version that has false as the default fixed their problem

  • One of our sites was seeing a unbalanced distribution of requests despite the fact that the load balancer was evenly distributing connections. One host typically had 2x the traffic of the others, and it would switch every few hours to be a different host. It turned out to be the Google crawler, which uses a keepalive, getting stuck on a single host and making a lot of requests. The load balancer is only able to balance TCP connections, which Google is only using a single one of. The likely solution will be haproxy or something similar in front of the hosts to better distribute traffic.

Joseph PalermoJoseph Palermo
Standup 03/02/2009
edit Posted by Joseph Palermo on Monday March 02, 2009 at 07:39PM

Interesting Things

  • Tired of refreshing your page to view changes in your CSS? Erik Hanson has a bookmarklet you can use without refreshing your page. See it on his blog.

  • There is a beta version of the Selenium 1.1.15 gem that includes the latest selenium-server.jar (1.0 beta-2). This fixes some problems with using Firefox 3. You can get the gem here, and you can read the details here.