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

Rajan Agaskar

Standup 12/10/2009

Rajan Agaskar
Thursday, December 10, 2009

Helps

  • Fast/Simple share widget plugins?
    A project was in need of a turn-key plugin to provide Digg/Twitter/Facebook links. The two suggestions were the ever-popular “roll-your-own”, and pivotal’s own bookmark_fu. The latter of which, if you glance downwards and towards the right, you’ll see in use on this very blog! (Unless, of course, you’re using Google Reader and robbing us of our ad revenue riches).

Interesting

  • SpecRails Superclass Shenanigans

A Pivot found that when spec_rails is loaded, the superclass of spec suites changes to ActiveSupport::TestCase, instead of ExampleGroup (which, in this case, had a number of useful and necessary methods added to it). [1]

  • hirb

This carefully named plugin provides really nice sql-console-style formatting for ActiveRecord queries made from the irb console. I’m going to install it right away so I can pretend I still remember how to write MySQL queries by hand!

[1] I was working on a brilliant analogy that referenced Dick Dastardly and Muttley here, but I totally failed. Still, Wacky Races was totally rad, right? Radder than sneakily replacing superclasses, anyhow.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Rajan Agaskar

Standup 12/9/2009

Rajan Agaskar
Wednesday, December 9, 2009

Interesting Things

  • Fixjour blows up on validations for associated models

    Two Pivots experienced this problem on separate projects. The general consensus was that generating objects with correct associations can be difficult. FactoryGirl was recommended as a fixture plugin that handles this problem particularly well. It was also suggested that rolling your own object mothers was trivial (fisticuffs ensued).

  • timeout.rb

Timeout.rb raises an exception to kill child threads; it so happens that this exception can be caught, and possibly swallowed. This is truly a Noid to be avoided at all costs.

  • UPDATE: Tests using Paperclip fail to run

When Paperclip cannot find identify in the path, it will raise an error that suggests it has been called with incorrect arguments. This is a bold-faced lie.

One Pivot remarked that these tests should really be mocking Paperclip in the first place, which seems an appropriate response to dishonesty.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Rajan Agaskar

Standup 12/8/2009

Rajan Agaskar
Tuesday, December 8, 2009

Interesting Things

  • fleegix.date.Date – Javascript, DST, and You

In 1895, George Vernon Hudson somehow managed to convince the world (of the Wellington Philosophical Society) that Daylight Savings Time was a good idea.[1] Hudson, an amateur entomologist, was motivated by his desire to look for bugs after work.[2] Sadly he did not forsee that determining DST for multiple regions using JavaScript would be a non-trivial task.

Javascript provides some rudimentary timezone support with Date.parse, but does not automatically apply daylight savings time, in other words:

Date.parse('Sep 9 2009 11:00:00 PST');

and

Date.parse('Sep 9 2009 11:00:00 PDT');

return different timestamps. fleegix.date.Date (a plugin for the fleegix.js library) lets you express the timezone as a region string, automatically taking into account whether or not that region observes Daylight Savings Time (by using Olson files), and providing the same interface as the native Javascript date. This means you can get an proper timestamp with the following:

new fleegix.date.Date('9/9/2009 11:00:00', 'America/Los_Angeles');

This is arguably more useful than Daylight Savings Time itself.

  • RightScale errors

Two Pivots experienced an issue where RightScale was caching their connection to Amazon upon creation. This led to the connection start time parameter getting further and further out of date until Amazon failed to accept the upload with a ‘Request Time Too Skewed’ error. No workaround was discussed, but it was roundly decided that any error with the word “Skewed” in it is pretty awesome. [3]

[1] Well, according to Wikipedia, so it might as well have been Ron Paul for all we know.

[2] aaaaaand rimshot.

[3] Not really.

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

LinkedIn Gem for a Web App

Will Read
Monday, December 7, 2009

There’s an untapped cash cow out there when it comes to recruiting and her name is LinkedIn. Until recently, only LinkedIn had access to your profile and social graph, but all that changed with the release of their OAuth-based API. I’f you’ve hooked into Twitter or Google then this authentication process should feel very familiar to you. To help you along, pengwynn released a LinkedIn gem last week.

What’s lacking is a good controller example, you kind of have to piece it together yourself. So code first, explanation second. Here’s what a simple LinkedIn authentication controller might look like:

<code>
#uncomment the line below if you aren't using bundler
#require 'rubygems'
require 'linkedin'

class AuthController < ApplicationController

  def index
    # get your api keys at https://www.linkedin.com/secure/developer
    client = LinkedIn::Client.new("your_api_key", "your_secret")
    request_token = client.request_token(:oauth_callback =>
                                      "http://#{request.host_with_port}/auth/callback")
    session[:rtoken] = request_token.token
    session[:rsecret] = request_token.secret

    redirect_to client.request_token.authorize_url

  end

  def callback
    client = LinkedIn::Client.new("your_api_key", "your_secret")
    if session[:atoken].nil?
      pin = params[:oauth_verifier]
      atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)
      session[:atoken] = atoken
      session[:asecret] = asecret
    else
      client.authorize_from_access(session[:atoken], session[:asecret])
    end
    @profile = client.profile
    @connections = client.connections
  end
end
</code>

So the flow your user sees is this:

  • visit /auth/ which automatically redirects me to log in via LinkedIn
  • type in my LinkedIn user name and password, click submit
  • submitting takes me to /auth/callback which might show my profile and connections

What the code does:

  • creates a new LI client based on your credentials as a LinkedIn developer
  • get a request token (pay attention, there’s 2 kinds) , and sets the callback to your callback action
  • saves off the request token-token and the request token-secret into the session, you’ll need to reconstruct the request token in the callback, and the request token itself doesn’t have a marshal-load method defined.
  • sends the user off to the LinkedIn log in page
    — user logs in and is send to the callback action —
  • create a new LI client with the developer key and secret from LinkedIn
  • check to see if the access token (2nd kind of token) has been created before
  • create the access token using the oauth_verifier sent from LinkedIn and the old request token (1st kind) that you save in the session.
  • authorize the client and save off the access token info so you don’t have to send your user back to LI when he comes back (*here I save the access token into the session for simplicity in the example, you should put this in a database probably)
  • if the access token exists, just authorize the client usoing the access token
  • finally, use the client to do interesting things like show the user his profile and his connections.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Sean Beckett

Three New Tech Talks posted

Sean Beckett
Monday, December 7, 2009

Three new Tech Talks have been posted to our talks page:

  • MDD: How TDD and BDD Miss the Point – Terralien Founder Nathaniel Talbott introduces Metric Driven Development, or MDD. Exclusive focus on TDD and BDD can miss the bigger picture and drive optimizations that negatively impact the business as a whole. Part business talk and part technical talk, Nathaniel discusses what MDD is, why you should be doing it from day one, and what cool Ruby tools you can leverage to make it happen.

  • Aristotle and the Art of Programming – Jon Dahl ponders the big questions. What can programmers learn from the thought of Aristotle, Kant, and Mill? More than you might think. He links philosophical ethics and ideas to the processes, tools, and methodologies of software development as we discuss a critical question: is successful development primarily a matter of finding the right rules, creating the right outcomes, or cultivating the right virtues?

  • Introduction to MongoDB -
    MongoDB is a scalable, high-performance, open source, schema-free, document-oriented database. Mike Dirolf of 10gen, the company behind MongoDB, will discuss the features that make it an interesting choice as a datastore for web applications. He will give examples of how to interact with MongoDB from Ruby and discuss how MongoDB’s auto-sharding allows it to provide infinite scalability.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

MongoDB

Monday, December 7, 2009 | Run time: 53:04

MongoDB is a scalable, high-performance, open source, schema-free, document-oriented database. Mike Dirolf of 10gen, the company behind MongoDB, will discuss the features that make it an interesting choice as a datastore for web applications. He will give examples of how to interact with MongoDB from Ruby and discuss how MongoDB’s auto-sharding allows it to provide infinite scalability.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Aristotle and the Art of Software Development

Monday, December 7, 2009 | Run time: 46:23

Jon Dahl ponders the big questions. What can programmers learn from the thought of Aristotle, Kant, and Mill? More than you might think. He links philosophical ethics and ideas to the processes, tools, and methodologies of software development as we discuss a critical question: is successful development primarily a matter of finding the right rules, creating the right outcomes, or cultivating the right virtues?

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

EDD: How TDD and BDD Miss the Point

Monday, December 7, 2009 | Run time: 56:02

Terralien Founder Nathaniel Talbott introduces Experiment Driven Development, or EDD. Exclusive focus on TDD and BDD can miss the bigger picture and drive optimizations that negatively impact the business as a whole. Part business talk and part technical talk, Nathaniel discusses what EDD is, why you should be doing it from day one, and what cool Ruby tools you can leverage to make it happen.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Rajan Agaskar

Standup 12/7/2009

Rajan Agaskar
Monday, December 7, 2009

Interesting Things

  • Pivotal Core Bundle – Deprecations deprecated!

Two Pivots heroically removed some deprecated extensions and rake tasks from the Pivotal Core Bundle. Do not be surprised if your favorite code jams (like cancel_default_validates_associated class method) disappear next time you pull.

  • Move files fast!
    Some lucky pivot discovered that mv file.tgz * will move all files in the current path into the last file or directory it can find.

If for some reason you do not want this to happen, it is recommended that you always specify a destination when moving files.

To help you remember this protip, here’s a totally worthless analogy that involves automobiles: would you get into a cab without telling the driver where you wanted to go?

No, you would not, because he would take you to IHOP, and you hate pancakes. You wanted to go to Waffle House, which is unfortunate, because the nearest Waffle House is in Nevada.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Adam Milligan

Programmers Anonymous

Adam Milligan
Sunday, December 6, 2009

I recently had an opportunity to work on a relatively high-profile project with a crazy timeline. A coworker and I spoke with the client for the first time around lunchtime on a Friday, and the client needed a completed website, complete with a relatively sophisticated design (which had, at that moment, not yet been delivered by the designer) and a relatively sophisticated data model, by mid-day the coming Monday. That’s 72 hours to build and skin a fully functioning website.

I realize that “fully functioning” doesn’t tell you much about the scope of the project, but we live in a world of non-disclosure agreements. Suffice to say, it was a non-trivial amount of work.

Keeping in mind that the two of us had already worked 36 hours of our 40-hour work week on other projects, we agreed to take on the project. Between the two of us we worked about 60 hours that weekend, most of it solo, and had the site finished at start of business Monday morning. This might not seem particularly heroic (particular to anyone who writes software for the game industry), but keep in mind that at Pivotal we believe strongly in the concept of sustainable pace; we really do work eight hour days, five days a week. People working late at Pivotal is relatively unusual; people working weekends is almost unheard of.

The thing that struck me about this project was that I enjoyed it. I had a little rush of excitement when I agreed to give up my weekend and work late into the night as necessary. Even as I was doing it, bleary-eyed and mentally dull, I felt the high of accomplishment.

I spent the next several days trying to get my sleep schedule back to normal, and feeling generally tired and worn out. At the same time the two of us on the project spent a fair bit of our time, unsurprisingly, regretting some of the decisions we had made while working late into the night. Also during that week I came to something of a startling realization: I’m an addict.

I knew when we agreed to work on the project that the amount of sleep I would lose would make me miserable. I also knew that putting in a bunch of time over the weekend would mean starting work the next week without a day off, without time to do the non-work things I need to get done. More directly, while I was working on the project when I hadn’t taken a break all day and hadn’t slept the night before I knew my focus was poor, I knew my decision-making skills were compromised, and I knew I was prone to cutting corners I shouldn’t have cut; I consciously thought these things to myself at the time. And yet, I continued to work, without taking a break.

I don’t claim to be an expert on the psychology of addiction, but I do know that I’ve met a lot of people with drug and alcohol problems in the past. Lots of them talk about how they know that drinking/shooting up/huffing/whatever is hurting them, and hurting their friends and family, but they do it anyway. Because they’re addicted.

How many programmers work past the point of fatigue at which they can continue to make effective design decisions, to clearly think through scenarios, or to correctly differentiate between a reasonable trade-off and a regrettable hack? How many do so when they know their judgement is compromised, because they’re getting their fix of problem solving?

Proponents of “flow,” like Joel Spolsky (whose credentials for “writing great software” appear to be a summer internship at Microsoft and a silver tongue) will tell you this is a good thing; starting the flow of a great programmer takes so much effort you want it to go on for as long as possible. I’m not convinced; I know when I’m sharp and when I’m not, and I don’t even trust myself to stop the magic when I’m not doing my best work. And, this is a bit like an alcoholic explaining the health benefits of vodka.

Addicts most commonly manage their addictions by talking with other addicts. Maybe that’s an as yet unheralded benefit of pair programming: someone to cut you off when you’ve had one too many.

  • 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. ←
  2. 1
  3. 2
  4. 3
  5. 4
  6. →
  • 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 >