Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Monthly Archives: January 2008

Mike Grafton

Standup – 1/31/2008

Mike Grafton
Thursday, January 31, 2008

Help!

  • Has anybody successfully used the drag-and-drop functionality included in the newer versions of Selenium? It doesn’t appear to work – the mouse events never seem to get fired.

Interesting

  • If you’re messing with the solr.war inside of the solr_runner plugin, beware that the webapps directory (in which it sits) is scanned by Jetty for .war files, and that when your use ‘rake solr_runner:start’, you might not be running off the .war file you think you are. When we started SOLR this way, we saw some output from Jetty that indicated that it was unpacking and using the wrong .war file from that directory (in our case, it apparently used solr.war.new!).

    The moral of the story is, if you want to swap in a new version of solr.war, just move it on top of the existing one, and don’t put any other files in there.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Mike Grafton

Standup – 1/30/2008

Mike Grafton
Wednesday, January 30, 2008

Help!

  • Does anybody know anything about Lucene scoring using a document boost?

    We see an exponential relationship between document boost and the fieldNorm component of the score for each term. Can anybody explain this?

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Standup 01/28/2008

Pivotal Labs
Tuesday, January 29, 2008

A day late, but…

Interesting Things

  • We’re re-working some internal Rails plugins. This effort includes a redesign of how those plugins deliver routes to the application.

    Look forward to a post from Nathan on designing plugin-provided routes.

  • Teleport:

    A number of Pivots have experimented with using Synergy — often configured with QuickSynergy — as a productivity enhancement tool for pair programming. The basic idea is to have a shared computer set up as a Synergy client of two other, user-driven machines. This allows for collaborative editing in the shared environment as well as individual work, such as reviewing a particular API.

    Jonathon noted that Teleport provides a similar kind of capability which may also be worth checking out. Teleport does differ a bit from Synergy…

    Pluses:

    • Simple, bonjour-enabled configuration via an OS X system preferences pane
    • Bi-directional capabilities. That is, two machines can be both servers and clients of each other
    • Can drag-drop to copy files and folders between machines
    • Pasteboard is synchronized between machines

    Minuses:

    • Pasteboard is synchronized between machines (careful, or you might unintentionally overwrite a copy buffer)
    • OS X only
    • Closed source
    • The one client of two servers setup doesn’t seem to work out right, so only one developer can split of to a “research” machine
    • It’s a bit buggy regarding configuration
    • Can’t do some of the advanced configuration that Synergy can, e.g. re-mapping keys
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Mike Grafton

Standup 01/29/2008

Mike Grafton
Tuesday, January 29, 2008

Help!

  • How do I turn off coloring in the RSpec runner?

    The answer: don’t put

    --color

    in your spec/spec.opts file.

Interesting

  • There’s an easy way to merge hashes in Javascript, using either JQuery or Prototype.

    For JQuery:

    $.extend(target, hash1, hash2, ...)

    For Prototype:

    Object.extend(target, hash)

    JQuery’s syntax is a bit nicer since you can merge any number of hashes into the target hash.

    This is handy for grabbing JSON off the wire and merging it into an existing or “default” object.

    You can use this to merge prototypes, achieving a type of “inheritance” (or what passes for such in Javascript). But be careful, since the rightmost hash wins – IE, its properties overide properties by the same name in the target.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

IE Javascript memory leak dector

Pivotal Labs
Sunday, January 27, 2008

http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Brown Bag: Blaine Cook on Starling

Pivotal Labs
Saturday, January 26, 2008

This week we were treated to a lunchtime tech-talk by Blaine Cook of Twitter. He came to talk to us about Starling, the all-Ruby message queue system that runs much of Twitter. Blaine spoke about the history and motivation for creating Starling, then showed how it worked, and talked about possible future enhancements and directions for further development.

Starling looks quite simple to use. The Starling server speaks the memcache protocol, so to talk to it you just need to load up the memcache-client gem and create a client instance. Note, the Starling server doesn’t use memcached for its implementation at all; it just speaks the protocol.

Some interesting bits about why Blaine built Starling. It basically comes down to that every other solution had some problem that made it unsuitable for them to use. Here’s the list:

  • rq (by Ara Howard) – nfs/disk based, high latency
  • DRb – not robust under load
  • Rinda – very slow! O(n) for take operations
  • Apache ActiveMQ – super complex
  • RabbitMQ – Erlang dependency

In the last few months we’ve seen a lot of Starling-like things appear, some inspired by Starling itself.

  • beanstalkd – uses memcached for storage, not persistent or recoverable
  • bj – database backed
  • thruqueue – uses Thrift protocol, ugly
  • sparrow – Starling imitator
  • ap4r – full-featured

Interesting new directions for Starling… Currently Starling has some overhead from polling on both client and server sides. Kevin Clark and Chris Wanstrath have hacked it to run using EventMachine to eliminate polling. Not sure what happens if clients die while request is waiting to be filled. Also, some issues with load balancing and starvation need to be looked at. And there are opportunities to build a richer client API.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Teaching Your Tests To Report Unused Parameters

Pivotal Labs
Wednesday, January 23, 2008

Recently I was about to check in some changes and did a last minute
click through of the application. All of a sudden I’m staring at a stack
trace. My tests were green and I had functional tests for the failing
controller/action.

Tests are like pants — they cover your backside while you focus on other
things like adding features to your application. Suddenly I felt a
breeze on my cheeks. Something was amiss.

I soon discovered the action and its associated tests had diverged
over time. Some of the parameters were renamed in the action but not
in the functional test. Since some of the work of the action was
conditional on the presence of certain parameters, that work was no
longer being tested.

This exposed weaknesses in the tests and code, such as expected
side effects in the tests that are never checked. If they had been
checked the tests would have failed and the parameter name mismatch
would have been discovered.

Most functional tests provide specific parameters that should at least
be examined during the processing of the action. Reporting unread
parameters would strengthen those tests. It was conceivable to me that
some of the other functional tests had similar unused parameters. I
wanted all of my functional tests to report all unused parameters.

The first step was to instrument the params hash. I wanted to track
access to the params hash and report parameters that were not read
during the processing of the action. I don’t know what all is done to
params during the lifecycle of a test. I’m only interested in access
from the time the action starts till it returns so I need to be able
to turn the tracking on and off at specific times.

It turns out that Rails uses a subclass of Hash called
HashWithIndifferentAccess.
I added my changes to
HashWithIndifferentAccess in test/test_helper.rb:

class HashWithIndifferentAccess
  def [](key)
    @accessed_keys ||= {}
    @accessed_keys[key] = true
    super
  end

  def start_logging
    @accessed_keys = {}
  end

  def end_logging
    @accessed_keys['action'] = true
    @accessed_keys['controller'] = true
    never_accessed = []
    self.each_key do |key|
      never_accessed << key unless @accessed_keys.include?(key)
    end
    raise "Some keys never accessed: #{never_accessed.join(', ')}" unless never_accessed.empty?
  end
end

With these changes an exception will be raised if any first level keys
are not read between start_logging
and end_logging.

In each of my functional tests I added code similar to this (from account_controller_test.rb):

class AccountController
  around_filter :check_params
  private
  def check_params
    params.start_logging
    yield
    params.end_logging
  end
end

The around filter starts and ends the logging in the context of the
action.

With these changes in place my tests no longer passed and my
backside was warm and protected again.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Chad Woolley

Standup 01/18/2008

Chad Woolley
Friday, January 18, 2008

Interesting Things

  • If you use Git, and have problems with gitk, try qgit. It may work better for you.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Chad Woolley

Standup 01/17/2008

Chad Woolley
Thursday, January 17, 2008

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?
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Chad Woolley

Standup 01/16/2008

Chad Woolley
Wednesday, January 16, 2008

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.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Topics

  • agile (780)
  • rails (113)
  • testing (88)
  • ruby (83)
  • ruby on rails (70)
  • jobs (62)
  • javascript (55)
  • techtalk (44)
  • rspec (38)
  • ironblogger (32)
  • productivity (30)
  • activerecord (29)
  • gogaruco (29)
  • git (28)
  • nyc (27)
  • rubymine (26)
  • bloggerdome (23)
  • mobile (22)
  • process (21)
  • pivotal tracker (20)
  • cucumber (20)
  • jasmine (19)
  • design (18)
  • ios (18)
  • webos (17)
  • objective-c (17)
  • android (16)
  • palm (16)
  • "soft" ware (16)
  • fun (15)
  • tracker ecosystem (15)
  • ci (15)
  • cedar (15)
  • rails3 (14)
  • performance (14)
  • bdd (14)
  • gem (13)
  • css (13)
  • tdd (13)
  • selenium (12)
  • goruco (12)
  • bundler (12)
  • meetup (11)
  • railsconf (11)
  • nyc-standup (11)
  • capybara (10)
  • mac (10)
  • mojo (10)
  • chef (10)
  • api (10)
Subscribe to Community Feed
  1. 1
  2. 2
  3. 3
  4. →
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >