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: June 2009

Agile Management: Advice for Entrepreneurs

Tuesday, June 30, 2009 | Run time: 45:06

Drew McManus of Road 3 shares his advice on managing agile projects. Drew describes when and how much to plan, the right way to share the plan, and how to keep the product and the engineering team properly focused while not losing the grand vision.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Will Read

Ideas as Motivation

Will Read
Tuesday, June 30, 2009

It’s hard for me to be excited about participating when I feel like I can’t contribute ideas. Sometimes it is a very formal situation created by organizational structure, for instance I don’t see those enlisted in the army having much of a voice in how their platoon operates, let alone a base or the army as a whole.

It’s hard for me to be excited about participating when I feel like I can’t contribute ideas. Sometimes it is a very formal situation created by organizational structure, for instance I don’t see those enlisted in the army having much of a voice in how their platoon operates, let alone a base or the army as a whole.

I suspect any “knowledge worker” has the same struggle that I have. Even if one has crazy hair-brained ideas, they should be heard. If they are dismissed, reasons should be given for “why” so that the idea maker can form better ideas in the future. Topics should not be off limits for discussion- if someone is tired of re-hashing a conversation, perhaps he could reflect on why the same conversation keeps happening – and address the cause, rather than the symptom.

Today I was asked about times and pairs where I wasn’t stopping my pair to catch up, to get re-engaged. What I initially took for a skill gap, might actually be my reaction to an environment where I don’t feel like my voice is heard as much as I’d like it to. While it would be nice to feel safe and warm at all times in one’s life, I have to concede that I fail to stand up and make myself heard. It is uncomfortable for me to discuss an idea that someone has already shown to be disagreeable toward.

To me, an idea is a really special concept. Someone packages up his understanding of a problem, applies all of his history, and attempts to create a solution. At worst, he hopes his idea gets feedback, more information, more understanding, so he can better fabricate ideas. In a group, his idea may spark an idea in another group member who comes up with a great solution. But when ideas go unheard, it says to the thinking employee is a near-silent whisper, “Your experience, your life, is not worthwhile.”

That whisper is my Achilles Heel. I am looking for resources that will help me combat those situations. Methods that make me a more valuable team member – because I stay engaged – because I feel that the team is getting the full benefit of having me, and my experiences at its disposal.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Abhijit Hiremagalur

Standup 06/30/2009: (Really) delete git tag, rails filter action and matrix knot!

Abhijit Hiremagalur
Tuesday, June 30, 2009

Interesting Things

  • Rails controller filters can also be objects
    • Any object with a before, after or filter method can be a filter
  • Will Read attempts the Matrix knot
    Image

Help

“How do you permanently remove a git tag?”

  • One team would like a delete a tag created by their CI, but it keeps coming back if somebody who has pulled the tag locally does a push.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Equality and sameness in Ruby

Pivotal Labs
Monday, June 29, 2009

Let’s say you are building a leetspeak that deals with w00ts. You might write a class that looks like this:

class Woot
  def ==(other)
    true
  end
end

In theory, any Woot is equal to anything else:

puts Woot.new == Woot.new # true

You might think that with this setup, you could do something like this:

x = [ Woot.new ]
y = [ Woot.new ]
z = x - y

You might expect z to be an empty array in the case, but oh how wrong you would be. In the example above, the == is never called at all.

After reading through the docs on Array, overriding all 4 equals method in ruby (eql?, equal?, ==, ===) and overriding object_id you will still not be able to make it work.

A quick look through the C code shows that Array#- hashifies the array. The hashing algorithm looks for a method called “hash” on the object. If that’s not there, it uses the memory id. Great, so now we can just add hash and be done, like this:

class Woot
  def ==(other)
    true
  end

  def hash
    1
  end
end

Wrong! You still don’t get an empty array. It turns out that the hash algorithm calls eql?, not ==, so you have to make sure to alias that as well, like so:

class Woot
  def ==(other)
    true
  end
  alias :eql? :==

  def hash
    1
  end
end

So if you want normal array semantics for your objects, be sure to provide #hash, #== and #eql?.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Joe Moore

Standup 06/26/2009: Poor ScrewUnit…

Joe Moore
Friday, June 26, 2009
  • JQuery Events/live + ScrewUnit = :-(. ScrewUnit swaps the DOM “out from under” the elements that Events/live is watching, which messes with ScrewUnit. Call die on the DOM elements that live events are watching.

  • ScrewUnit + CI + IE = :’-( Also, When ScrewUnit suites become large, they trigger IE’s “slow script” warning, which can freeze your continuous integration build. Check out the Registry Hack to set your own timeout.

  • We have a fan of Thor in the house: “Map options to a class. Simply create a class with the appropriate annotations, and have options automatically map to functions and parameters.” Which, as is (not) obvious, indicates that Thor is a replacement for rake.

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

Automated Configuration @ Velocity 2009

Pivotal Labs
Friday, June 26, 2009

Theo Schlossnagle: “I don’t care what you use: puppet, chef, bcfg2, cfengine – choose one and automate your configuration.” (Theo’s presentation was a highlight, check out the slides here.)

Allspaw and Hammond from Flickr: “If there’s only one thing you do, automate your infrastructure.”

There were lots of Puppet users at the conference, and Luke Kaines gave a good talk on it.

Interested in a Chef intro? Watch the video of Adam and Ezra’s talk:

From the Chef BoF:

  • If you’re just doing application deployment of a typical webapp then running chef-solo on deploy might be just fine for you (it is for the Remix team).
    • Ezra points out that he has a chef subproject on git that even strips out cap – chef-deploy (vs cap sudo’ing out to chef).
  • Adam gave a good explanation of the Chef run model.
    • It’s important to understand the basics of what’s going on behind the scenes – otherwise you’ll shell out right in the middle of your Chef scripts and be surprised by the run order.
    • In short, all your Chef Resource statements are evaluated in a first pass. Then they’re executed.
    • This gives Chef the opportunity to evaluate what’s to be done and optimize. Adam noted that included recipes are only executed once (analogous to ruby require’s)
    • Adam also mentioned something kind of cool – if I have this right – Resource statements return the associated Resource object. And when you refer to the Resource the same way twice, you’re getting back the same Resource instance. So your included Recipes (for example) each have the opportunity to decorate a Resource defined earlier – if, say, it ought to be configured differently based on a combination of what else is getting installed on the box. Nice.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Flickr "10+ Deploys Per Day" @ Velocity 2009

Pivotal Labs
Thursday, June 25, 2009

My favorite talk at Velocity was by Paul Hammond and John Allspaw from Flickr, who are doing real lowercase-a agile:

UPDATE

Here’s the video, highly recommended:

“If there’s one thing you do, it should be automated infrastructure”. This was a refrain through the conference – as Theo Schlossnagle put it, it doesn’t matter if it’s chef, puppet, bcfg2, cfengine – whatever works for you, just do it.

Some of their techniques:

  • One-step build. They literally go to a web page and click a button and watch the build take the full site from soup to nuts.
  • Deploys: Who. What. When. You want to make all the meta-details of a deploy easily visible to anyone. Deploy logs are readily accessible.
  • Always ship trunk. In a webapp this is possible. It vastly simplifies – everyone knows where to look for what’s going out, and what’s live.
    • Flickr does their branching in the code (take note git people), and these become natural ops levers (i.e. uh-oh turn that feature off / turn it down).
  • “Dark launches”. Facebook does this too: launch the guts of a new feature with the UI turned off so you can see how the technology works in real production.
    • Which results in anticlimactic launches, the best kind
  • They roll forward (not back) to turn features off that aren’t working.
  • “Gather shitloads of metrics”. System metrics, app metrics, everything. John has a great writeup on their Ganglia setup in his book.
    • Developers watch the metrics just as obsessively as ops. Visualization is a powerful tool used day-to-day by the whole group.
    • Developers have a way of putting in their own metrics via a little framework.
  • They’re all on IRC. This kept coming up at the conference – teams are on some chat tool like IRC, Skype chat LINK, or Campfire LINK.
    • Important events are piped into IRC, so you’ll be right in the middle of a conversation and an alert will pop in.
  • Logs are piped into a search engine so they can find things in the log history, easily.

Culture, philosophy:

  • There’s an ongoing conversation between dev and ops. They’re learning to solve the Flickr problem together. Each side’s way of thinking informs the other (major conference theme as well)
  • Failure will happen. Develop your ability to respond. Like ER doctors you practice on failures, that makes you better/competent at handling what comes along next.
  • In addition to the ops people on call, there’s always a developer who has a pager

More:

  • John Allspaw’s blog
  • Web Ops Visualizations at Flickr
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Joe Moore

Standup 06/25/2009: return vs. next vs. break vs. yslow vs. cap

Joe Moore
Thursday, June 25, 2009

Interesting Things

  • You can never return: … except when you can. From a block, that is. Returning from a block rarely works:

    result = ['one', 'two'].each do |x|
     return x
    end
    => LocalJumpError: unexpected return
    

    But, you can pass next and break arguments, which will allow you to assign return values from the block:

    result = ['one', 'two'].each do |x|
      break(x)
    end
    => "one"
    
    
    result = ['one', 'two'].each do |x|
      next(x)
    end
    => ["one", "two"]
    

You can return from a lambda, though.

  • Check out Google Page Speed, which is like Yahoo’s YSlow, only “better.”

    Page Speed is an open-source Firefox/Firebug Add-on. Webmasters and web developers can use Page Speed to evaluate the performance of their web pages and to get suggestions on how to improve them.

  • Like chef? Love capistrano? Check out chef-deploy, which “… Uses the same directory layout as capistrano and steals the git remote cached deploy strategy from cap and adapts it to work without cap and under chef.”

  • SFTUG FTW! Another successful SF Tracker User Group Meetup on 06/24. Watch for future events on the Meetup site.

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

An easy way to write named scope tests

Pivotal Labs
Thursday, June 25, 2009

The project I’m working on has a lot of named scopes which are really great. If you’re not using them already you should really try them out. Since we test drive everything we do, we needed a really easy way to write tests for all these named scopes. We came up with a little test helper method that I thought I’d share so that other people could use it.

Here’s the code:

def test_named_scope(all_objects, subset, condition)
  subset.should_not be_empty
  subset.each do |obj|
    condition.call(obj).should be_true
  end

  other_objects = all_objects - subset
  other_objects.should_not be_empty
  other_objects.each do |obj|
    condition.call(obj).should be_false
  end
end

To use it, just pass a superset of objects, the subset you want to test and then a lambda as a condition. The lambda should be true for all items in the subset and false for all the items outside of it.

It sounds complicated but it’s really easy! Here’s an example
Let’s look at a simple tag class that has a status column indicating whether the tag is on a whitelist or a blacklist. It could look like this.

class Tag < ActiveRecord::Base
   WHITELISTED = 1
   BLACKLISTED = 0
 end

We want to be able to easily grab all the whitelisted tags, so we need to add a named scope.

Here’s the spec we write first:

describe Tag do
    describe "whitelisted named_scope" do
      it "returns the whitelisted tags" do
        test_named_scope(Tag.all, Tag.whitelisted, lambda{|tag|
                                     tag.status == Tag::WHITELISTED })
      end
    end
  end
end

We run the spec, watch it fail and then go add the named scope to our Tag class.

class Tag < ActiveRecord::Base
  WHITELISTED = 1
  BLACKLISTED = 0
  named_scope :whitelisted, :conditions => {:status => WHITELISTED}
end

Then we just rerun the spec and watch it pass. Easy!

Update2: Josh Susser emailed me a really nice refactoring with the enumerable partition method and Kelly fixed a bug I introduced.

def test_named_scope(all_objects, subset, condition)
  scoped_objects, other_objects = all_objects.partition(&condition)
  scoped_objects.should_not be_empty
  other_objects.should_not be_empty
  scoped_objects.should == subset
  other_objects.should == all_objects - subset
end
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Joe Moore

Standup 06/24/2009: Nginx URL Rewrite Fu?

Joe Moore
Wednesday, June 24, 2009

Ask for Help

“Does anyone have Nginx URL rewriting fu?”

The pretty documentation is actually quite hard to work with. Does anyone else have a good reference?

Interesting Things

  • Pivotal in the New York Times: Regarding Palm Pre development and our own Tweed:

Some developers who were granted early access to Palm’s new operating system said it was worth the wait. “We find it’s the easiest one to develop for,” said Christian Sepulveda, vice president for business development at Pivotal Labs. “It allows for a richer experience, like having a pop-up menu and background processing, which is helpful.”

Mr. Sepulveda’s company developed four of the first programs available for download through Palm’s app store, including an item for Twitter called Tweed.

  • The next SF Ruby Meetup will be held here at Pivotal Labs. Sign up) and attend!
  • BART strike warning! In the Bay Area we take our commute options seriously. Here are your options if BART goes on strike
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Topics

  • agile (781)
  • 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 (21)
  • cucumber (20)
  • design (19)
  • jasmine (19)
  • ios (18)
  • webos (17)
  • objective-c (17)
  • android (16)
  • tracker ecosystem (16)
  • palm (16)
  • "soft" ware (16)
  • fun (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. 4
  5. →
  • 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 >