Tyler Schultz's blog
Help:
Anyone have any IP Geolocation software recommendations?
- MaxMind provides downloadable databases and updates
- Google provides an api called google.loader.ClientLocation
Firebug binds up and forces me to restart Firefox when modifying CSS.
- Try Safari or Webkit. You can add css styles to a class on an element by editing an existing element, finishing the current style with a semi-colon, and declaring a new style.
Interesting:
- Optional params to a lambda: declare the lambda with *args and get warning free lambda to which you can pass no arguments.
class MyClass
named_scope :in_progress, lambda { |*args| param = (args.empty? ? true : args.first); {:conditions => {:in_progress => param} }}
#MyClass.in_progress # < return all in progress records
#MyClass.in_progress(false) # < return all non-in-progress records
#MyClass.in_progress(true) # < return all in-progress records
end
Rubymine 2.0 RC2 is out. Release notes include better performance and reduced memory usage.
Pivotal Labs will be a stop on the Startup Crawl during Rubyconf.
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







