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: May 2012

Dmitriy Kalinin

Standup May 31st, 2012: Thursday

Dmitriy Kalinin
Thursday, May 31, 2012

Interestings

  • RVM now supports custom SSL versions

Our project needs OpenSSL > v1.0.0 because we’re trying to sign something with a DSA key. We asked on github and fifteen minutes later mpapis had pushed a change to make it configurable. That’s some of the best open source service out there.

  • Chrome Heap inspector is your friend
  • Backbone Events do NOT get cleaned up

If you declare any events in the events property of a initialize, they prevent your instance from being deleted/GC’d. Use an explicit destroy function that calls this.undelegateEvents()

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Urban Dictionary: Recent Infrastructure Changes for Rails at Scale

Wednesday, May 30, 2012

Urban Dictionary is a Ruby on Rails application and the 109th most visited site in the country according to Quantcast. Today it runs entirely in the cloud — on Heroku, AWS and Akamai — and per-user costs are lower than ever. Founder Aaron Peckham discusses recent infrastructure changes to the site, the costs and benefits of each change, and tricks to minimize risk while making changes to a large site.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Matthew Kocher

05/30/2012: Resque Me

Matthew Kocher
Wednesday, May 30, 2012

Helps

  • Using resque-scheduler with resque-status

We’re attempting to use both of these together, and encountered problems getting it to work.

Another project had found the answer. Resque scheduler only calls the correct method if you provide a custom_job_class in your yaml file:

This code from resque scheduler is the smoking gun:

if (job_klass = job_config['custom_job_class']) && (job_klass != 'Resque::Job')
    constantize(job_klass).scheduled(queue, klass_name, *params)
end
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Kris Hicks

git rebase –onto

Kris Hicks
Monday, May 28, 2012

“Hold on to your butts..”
–Samuel L. Jackson as Ray Arnold in ‘Jurassic Park’

Part One:

The two-argument form of git rebase –onto

Say there’s a commit C made on master that made a change to a configuration parameter that, it turns out, wasn’t actually necessary, so that commit needs to go. For the purposes of this demonstration, commits D and E don’t rely upon the changes made in C. (If D or E did rely on C, you’d end up with a conflict to resolve, which you’d be able to do at that point.)

A--B--C--D--E master

One way to get rid of the offending commit would be to do an interactive rebase, deleting the line that has commit C on it:

git rebase -i C~1
delete the line containing commit C
save and close the editor

A quicker way is to use the two-argument git rebase --onto, as going interactive just to delete a commit (or commits) is a little overkill, and considerably slower to do.

git rebase --onto takes a new base commit (which the manpage for git-rebase calls newbase) and an old base commit (oldbase) to use for the rebase operation.

So, what we want to do is tell Git to make commit B the newbase of commit D, making C go away. This looks like:

git rebase --onto B C

But usually I like to talk about the commits I care about rather than the ones I don’t (in this case, I care about B and D, but not C), so instead of the previous command I use a backreference from D:

git rebase --onto B D~1

This means that everything in the range from B (non-inclusive) to D~1 (inclusive) will be removed.

git rebase --onto allows you to, in a non-interactive way, change the base of a commit, or rebase it. If you think about the commits as each having a base, or parent commit, you can see how you might be able to change the base of any commit to be another commit. In doing so, you remove everything that used to be in between the oldbase and the newbase.

It’s also good to know that it works exactly the same way as if you were to have done an interactive rebase and deleted the commit. Should a conflict arise while performing the rebase, Git will still pause and allow you to resolve the conflict before continuing.

I’ve also used the two-argument form when fixing a mistake: I had a branch from master, topicA, with some commits that I wanted to change via interactive rebase:

A--B master
    
     C--D--E topicA

But when I rebased, I went back too far, and rewrote a commit that I had gotten from master:

A--B' master
    
     C'--D'--E' topicA

(Note that there was no change to the master branch here, just to topicA.)

What did I do to fix this situation? Well, I can’t fix this via interactive rebase. I can, however, fix it via git rebase --onto:

git rebase --onto master C'~1

Or, in other words: Replace the oldbase C’~1 with the newbase, master (which is HEAD of master, or B).

It’s a handy undo mechanism.

If you forget to give the two-argument form of –onto its second argument, such as:

git rebase --onto master

..it will be the same as doing:

git rebase --hard master

You probably don’t want this.

Why is this? The second argument (the oldbase) is required if you want a range of commits to be applied on top of master. Without it, you haven’t supplied a range of commits to be applied on top of master, so HEAD of the branch gets reset to the HEAD of master.

What that means is any commits you have on your branch will be removed from the branch, and the branch will resemble master at that point. These commits are still in Git until garbage collection happens, accessible via the reflog (git reflog).

Part Two:

The three-argument form of git rebase –onto

Say there is a branch ‘topicA’ that diverges from master at some point:

A--B--C--D--E master
    
     F--G--H topicA

Let’s also say that someone else has branched from topicA to create topicB, and added more commits:

A--B--C--D--E master
    
     F--G--H topicA
            
             I--J--K--L--M topicB

This is an example of a real-world case I came across, where topicA had only a couple very large commits that were hard to digest and could have been split into many smaller commits. topicB was created as a continuation of the work done on topicA.

I checked out my own local copy of topicA, and through much interactive rebasing and prodigious use of git add -e, I was able to split topicA into smaller commits, making topicC:

A--B--C--D--E master
   |
   | F--G--H topicA
   |        
   |         I--J--K--L--M topicB
   |
   N--O--P--Q--R--S--T--U--V--W topicC

I talked with the person that made topicA and we agreed that my branch topicC should take the place of topicA. But what to do about the work that was done on topicB?

The operation that we wanted to do is: make topicC the new base of topicB, cutting it at the point topicB diverged from topicA, which looks like:

A--B--C--D--E master
   |
   | F--G--H topicA
   |        
   |         I--J--K--L--M topicB
    
     N--O--P--Q--R--S--T--U--V--W--I'--J'--K'--L'--M' topicC

The five commits from topicB (I through M), get played on top of topicC, starting from where topicB diverged from topicA, to create I’, J’, K’, L’, and M’.

The command to do this is:

git rebase --onto topicC topicA topicB

Where topicC is the newbase, topicA is the oldbase, and topicB is the reference for what HEAD of topicC will become.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Mark Rushakoff

Testing mass assignment with RSpec-Shoulda

Mark Rushakoff
Monday, May 28, 2012

If you’re new to Rails, or if you’ve been using Rails 2 for a long time, you might not be aware that Shoulda offers an allow_mass_assignment_of matcher that works just like it sounds. Here’s the example from the source code:

it { should_not allow_mass_assignment_of(:password) }
it { should allow_mass_assignment_of(:first_name) }

Having explicit tests for whether fields should be mass-assignable is probably safer than letting developers arbitrarily add or remove fields from the attr_accessible declarations — at least when they break a test they’ll have to think twice about it.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Tyler Schultz

[Standup][SF] 2012.05.25 – 1 git repo, 2 Procfiles, 2 Heroku Apps, CSS transitions behaving badly

Tyler Schultz
Friday, May 25, 2012

Ask for Help

*”1 git repo, 2 Heroku apps, 2 procfiles? Heroku currently is limited to 1 procfile per repo, so we’ve created a rake task that branches, modifies the procfile and pushes. Do you have a better solution?”

Is it possible to use env variables to parameterize your Procfile?

“Capybara: How can I click on a flash dialog for webcam settings?”

This was solved by right clicking and going into flash settings and enabling this permission always for this domain. Setting this up on headless CI may be more difficult.

“I have CSS transitions that behave differently when ‘user initiated’ vs initiated from a setTimeout or other event.”

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Roberto Ostinelli

[Standup][SF] 5/24 – Don’t drink and drivers

Roberto Ostinelli
Thursday, May 24, 2012

Helps

Capybara + Selenium

Using Capybara + Selenium for request tests results in a Rack application timed out during boot which ultimately throws a SystemErrorduring tests.

The single test works fine, the timeout only happens when running a full rake spec.

The same errors appears under these different setups:

  • with Database Cleaner (:truncation strategy)
  • with/without Database Cleaner (:transaction strategy, using shared connection with transactional fixtures [1])

Have tried increasing Capybara.server_boot_timeout = 240 to no avail.

=> Main suggestion is: try with another driver.

[1] http://blog.plataformatec.com.br/2011/12/three-tips-to-improve-the-performance-of-your-test-suite/

IE8 + HTML + JSON

On IE8, refreshing an URL served by a controller which handles both html and json content results in displaying the json instead of the html content.

The json response is only being accessed by an XHR request, which explicitly calls for the URL with the .json extension.

Tried explicitly setting the Content-Type header of json responses (for some reason, not set by rails 3.1), no changes in browser’s behaviour.

=> Try inverting the order of the response_to defined in the controller, setting the html as first element.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Roberto Ostinelli

[Standup][SF] 5/23 – At the beach

Roberto Ostinelli
Wednesday, May 23, 2012

Helps

  • Has anyone seen any failing scenarios when using “contentEditable” with resize set to true, to allow for automatic resizing of textareas?

=> No.

Interestings

  • Range behaviours:
>> range = 1..3
=> 1..3
>> range.first
=> 1
>> range.last
=> 3
>> range.to_a
=> [1, 2, 3]
>> exrange = 1...3
=> 1....3
>> exrange.first
=> 1
>> exrange.last
=> 3
>> exrange.to_a
=> [1, 2]
  • [related] When using Date ranges to define a BETWEEN clause in MySQL, beware that the upper date limit is excluded from the results (1 day less). Unsure about the case when the Date range is exclusive (2 days less?).

  • Lean Startup Machine is coming up!

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Scaling Web Applications with MemCachier

Wednesday, May 23, 2012
Amit Levy introduces MemCachier, a scalable cache service for cloud hosted applications available now on Heroku. MemCachier seeks to relieve developers from worrying about provisioning and managing servers, allowing applications to scale up and down seamlessly. MemCachier also provides insights that help developers understand their
cache behavior and how to cache more efficiently.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Ronan Dunlop

PivotalBooster gets a boost

Ronan Dunlop
Tuesday, May 22, 2012

We’re always thrilled to see people build cool things with our API, but we’re even more excited when these original apps are refined, improved, and polished even further to meet customer needs.

That’s exactly what Railsware has done with their latest major upgrade to their desktop app PivotalBooster.

“We are glad to announce you a major release of PivotalBooster version 1.1.0.beta.
With its new and enhanced features, working with your projects, tasks and stories will become even more convenient and flexible. For example, now it is much easier to create a new story or update an existing one in our absolutely new story detail view. Plus, the new drag-and-drop attachment feature provides you with a faster way of adding attachments. And, if you are managing several projects at once, the new filtering by the project feature is just right for you. That’s not all that new PivotalBooster has to offer to you.”

Please read Sergey Korolev’s full blog post to get the full list of new features and keyboard shortcuts for PivotalBooster.

  • 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. 4
  5. 5
  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 >