Tyler Schultz's blog



Tyler SchultzTyler Schultz
[Standup][SF] 11/22/2011: Programmatic select box changes
edit Posted by Tyler Schultz on Tuesday November 22, 2011 at 11:12AM

Help!

"How do I choose the value of a select box programmatically? The val function does not seem to do the trick."

Try setting the desired option as selected and then trigger a change event on the select input.

*"A pair is looking for 'multi file upload via iframe-transport' expertise. Specifically uploads in FireFox 3.6."

Interesting

  • The latest RubyMine EAP has improved code formatting options!

Tyler SchultzTyler Schultz
Standup 09/30/2011: Bulk inserts
edit Posted by Tyler Schultz on Friday September 30, 2011 at 09:39AM

Ask for Help

"Our delayed job consumes 2G of memory creating ~20k ActiveRecords in a loop!"

It doesn't answer why your job is using so much memory, but check out activerecord-import.

Tyler SchultzTyler Schultz
Standup 09/28/2011: Epics!
edit Posted by Tyler Schultz on Wednesday September 28, 2011 at 09:10AM

Interesting Things

  • Pivotal SF will be hosting a Tracker Users Group meetup tonight. Dan Podsedly will be speaking. He will be seeking feedback for a eagerly awaited feature to be rolled out shortly: Epics! Come and mingle with fellow Tracker users, drink some beer and eat some food.

Help

  • Some pivots are having trouble with a flash embed tag's scale attribute. The desired behavior is that the movie scale to fit the size of the element. According to documentation, this should just work. The flash content will not scale, instead the content is getting cropped.

  • Anyone have experience using Amazon RDS with Heroku?

    Several projects at Pivotal have used this combination with great success.

Interesting

  • A project had some intermittently slow queries. The problem was traced back to some large strings in one of the columns. The team solved this problem by overriding the default scope, and only selecting the expensive column when needed.

Tyler SchultzTyler Schultz
Standup 2010-12-09: Aggregating hudson builds, Time gotcha
edit Posted by Tyler Schultz on Thursday December 09, 2010 at 09:17AM

Help:

  • Does anyone know of a way to aggregate multiple projects into one hudson build? A pivot currently has 4 hudson projects that he'd like to show as one status. If any one project fails to build, then the build should go red, but hudson should still build the other three.

Interesting:

  • Time gotcha:

In 1.8.7 you'll see this:

 > Time.now
 => Wed Dec 08 22:26:37 -0800 2010

 > 1.day.ago
 => Wed, 08 Dec 2010 06:26:44 UTC +00:00

 > 1.day.ago.to_date
 => Wed, 08 Dec 2010

 > (Time.now - 1.day).to_date
 => Tue, 07 Dec 2010

In 1.9.2 you'll see this:

 ruby-1.9.2-p0 > Time.now
 => 2010-12-08 23:28:26 -0800 

 ruby-1.9.2-p0 > 1.day.ago
 => Tue, 07 Dec 2010 23:28:26 PST -08:00 

 ruby-1.9.2-p0 > 1.day.ago.to_date
 => Tue, 07 Dec 2010 

 ruby-1.9.2-p0 > (Time.now-1.day).to_date
 => Tue, 07 Dec 2010 

Tyler SchultzTyler Schultz
Standup 12/08/2010: fo sho really?
edit Posted by Tyler Schultz on Wednesday December 08, 2010 at 09:09AM

Interesting:

Interesting:

  • Tests won't run if rspec is included in the test group. rspec must be included in the development group, or both. When a test run is started the RAILS_ENV is development. After some initialization the RAILS_ENV is changed to test - a point at which the Gemfile has already been evaluated.

Tyler SchultzTyler Schultz
Standup 11/12/2009: Global method cache invalidation
edit Posted by Tyler Schultz on Thursday November 12, 2009 at 01:38PM

Interesting Thing

  • Dynamic use of Object#extend at runtime invalidates the global method cache, causing performance degradations. Consider a design that makes use of extend at class parse time. Here's a slide deck that explains in detail: What Makes Ruby Go

Help

*"Proxying Apache to Thin and getting 502 errors."

Interesting

  • Beware: Health check ping every 3 seconds * 15 mongrels * 1 week = millions of session rows. Create skip_filter entry for your health ping action.

  • Snow Leopard 10.6.2 is out. An unlucky upgrader attempted to go 10.6.1 -> 10.6.2 and it hosed the machine. This required the upgrader to reinstall Snow Leopard from disk, then upgrading to 10.6.2. Backup your data before upgrading!

  • Redefining an aliased method may not do what you expect: When the aliased method is invoked the original implementation executes.

def do_something
  puts "hello"
end

alias :do_something_else :do_something

def do_something
  puts "goodbye"
end

do_something_else    # prints "hello"

Ask for Help

"We're getting id's from facebook that are overflowing INT columns in mysql tables. Should I use BIGINT to accommodate these ids? Is this wasteful?"

Use string columns instead. VARCHAR columns will only use as much space as the id needs.

"Are VARCHAR columns slower to join than INT columns?"

Not in mysql. Strings do not have join performance penalty compared to integers.

Interesting Things

  • Edward was a guest lecturer for a Carnegie Mellon University course where students are learning to do Agile development. Course work involves pair programming, TDD, and using Ruby on Rails. The talk was well received and Edward is invited to come back next year!

  • There is an apparent rails bug (2.3.2) when building associated objects and then saving them.

class User < ActiveRecord::Base
 attr_accessor :bool
 before_validation_on_create :set_bool

 def set_bool
   self.bool = true
 end
end

class Child < User
 belongs_to :adult
 before_validation_on_create :create_adult

 def create_adult
   if adult.nil?
     self.build_adult()
   end
 end
end

class Adult < User
end

specify "should work" do
 child = Child.create!()
 child.bool.should be_true
 child.parent.bool.should be_true #fails
end