Chad Woolley's blog



Chad WoolleyChad Woolley
Standup 8/1/2008
edit Posted by Chad Woolley on Friday August 01, 2008 at 06:18PM

Interesting

  • If you need to add inflections in Rails, make sure you do it before your initializer block in environment.rb. If you put it after the initializer, it will cause your routes to be re-parsed, which will slow down app/test startup significantly. For example:
  require 'active_support'
  ActiveSupport::Inflector.inflections do |inflect|
    inflect.irregular "criterion", "criteria"
    inflect.irregular "Criterion", "Criteria"
  end

  Rails::Initializer.run do |config|

Chad WoolleyChad Woolley
Standup 7/31/2008
edit Posted by Chad Woolley on Friday August 01, 2008 at 07:35AM

Interesting

  • There is some strangeness with Rails' handing of invalid dates outside of the range for a Time object. For example, February 31, 1900. This involves Rails turning it into a Time object, and then back into a Date.

  • Multiple have found an interesting edge case bug in MySql which results in inconsistent ordering. It has been repeated in versions 5.1a and 5.1b, but we didn't navigate the MySql bug system yet to find/report it. Here are the query conditions to reproduce it, which could be common in test scenarios for some projects:

* LIMIT <= 5
* ORDER BY id DESC
* > 5 rows in table
* Where clause has index (not compound with id)

Chad WoolleyChad Woolley
Standup 7/30/2008
edit Posted by Chad Woolley on Friday August 01, 2008 at 07:07AM

Interesting

  • We had an excellent tech talk on Vertebra from Ezra Zygmuntowicz and the folks at EngineYard. If you've ever been a sysadmin responsible for many boxes, you'll appreciate the awesome potential of Vertebra...

  • NetBeans and symlinks: a team was having problems with symlinks in SVN disappearing after a client edited the project in NetBeans. No, he was not using Windows...

  • Here are some tips for working with acts_as_paranoid (We have helpers for some of these in our common libraries):

Add :scope for validates_uniqueness_of

validates_uniqueness_of :user_id, :scope => :deleted_at

Add :conditions for named_scope with :joins

named_scope :friends,
          :select => "users.*",
          :joins => :paranoid_relation,
          :conditions => 'paranoid_relations.deleted_at IS NULL',

Ask for Help

  • acts_as_paranoid isn't upgrading well as we move to newer Rails versions. What are the best alternatives?

  • A team was is having problems getting PHP to read php.ini...

Chad WoolleyChad Woolley
Standup 7/29/2008
edit Posted by Chad Woolley on Tuesday July 29, 2008 at 07:56PM

Interesting

  • There are now fixes in the master branch of Desert on GitHub. This addresses some problems with views in Rails 2.1 and Edge Rails.

Ask for Help

What are the best practices for managing dependency plugins or libraries that now live on GitHub (such as Desert)?

Chad WoolleyChad Woolley
Standup 01/18/2008
edit Posted by Chad Woolley on Friday January 18, 2008 at 05:46PM

Interesting Things

  • If you use Git, and have problems with gitk, try qgit. It may work better for you.

Chad WoolleyChad Woolley
Standup 01/17/2008
edit Posted by Chad Woolley on Thursday January 17, 2008 at 07:01PM

Interesting Things

  • There is a gotcha when creating a Ruby Hash with a default value. If you pass a object to the constructor, such as an empty hash, the same object will be used for all default values. That probably isn't what you want. Instead, use the form of the constructor which takes a block. Here is an illustration:

    $ irb 
    >> trickyhash = Hash.new({})
    => {}
    >> trickyhash[:a][:a] = 1
    => 1
    >> trickyhash[:b]
    => {:a=>1}
    >> betterhash = Hash.new {|h,k| h[k] = {} } 
    => {}
    >> betterhash[:a][:a] = 1
    => 1
    >> betterhash[:b]
    => {}
    
  • ruby-prof and KCachegrind are very useful for profiling and performance optimization. We had problems compiling the OS X Darwin Port of KCachegrind, though - you may just want to run it on linux.

  • Vine Server and Viewer 3.0 has been released.

Ask for Help

  • "QuickSilver for Dummies?" - What is a good resource to learn about QuickSilver?

Chad WoolleyChad Woolley
Standup 01/16/2008
edit Posted by Chad Woolley on Wednesday January 16, 2008 at 08:02PM

Ask for Help

  • "Does Intellij Idea sometimes do an SVN up without asking?"
    • Sometimes, if you do an svn up on the command line, IntelliJ will not always pick up the changes. You need to make sure you click the "refresh" button in the version control "Changes" view, not just the "synchronize" button on the main toolbar.

Chad WoolleyChad Woolley
Standup 01/15/2008
edit Posted by Chad Woolley on Wednesday January 16, 2008 at 04:03AM

Ask for Help

  • "Can you use Google Maps on an https page?"
    • Probably via an iframe. Is there a preferred way?