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: February 2011

Pivotal Labs

Standup 2/17/11: The awesome $.widget.bridge, Devise 1.1.6, Resetting a jQuery widget, Cookie-less sessions in Rails, CSS3 flexible box model

Pivotal Labs
Thursday, February 17, 2011

Ask for Help

“Is there any way to do cookie-less sessions in Rails?”

Josh Susser mentioned Rails used to support this (by encoding the session ID in all links like PHP can do) but no longer offers this feature and may try to fight your attempts to do it.

This pattern is discouraged because links which are shared with someone else through copy-and-paste would effectively log them in as that user. Very dangerous.

“Is there any way to take an element widgetized by a jQuery plugin and reinitialize everything (i.e. call the initializer again as if it’s an untouched element)?”

jQuery plugins ultimately do lower-level, destructive modifications to the DOM so, unless the plugin supports some kind of resetting, there’s no jQuery feature to do this directly. You can do a reset at the application layer through something like this:

var unmodified = $("#overlay").clone();
$("#overlay").overlay();
$("#overlay").replaceWith(unmodified);
$("#overlay").overlay();

Interesting Things

  • Use jQuery UI’s $.widget.bridge to create new $.fn widget functions that wrap a more object-oriented Javascript function.

Here is an example:

var widget = function(options, element){
    this.name = "ACME Widget #42";
    this.options = options;
    this.element = element;
};

widget.prototype = {
    wizbang: function(){
        console.log("wizbang called!");
    },
    _secret_sauce: function(){
        console.log("Protect me jQuery UI!")
    }
};

$.widget.bridge("acme_widget", widget);
var widget = $("#victim").acme_widget();

widget.data("acme_widget").name;       // => "ACME Widget #42"
widget.acme_widget("wizbang"); // => "wizbang called!"

widget.acme_widget("_secret_sauce"); // Just returns #victim, does not execute _secret_sauce.

For more information, see this blog post.

  • Devise 1.1.6 has been released, fixing a security hole and a compatibility issue with versions of Rails earlier than 3.0.4. More Info

  • You can use the new CSS3 “flexible box model” to get Tracker-like panes. It works only in modern browsers (sorry IE, you’re no longer “modern”).

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

Morning Standup 2/16/11 – Running tests in parallel, RSpec's =~ matcher, and the new Selenium RC gem

Pivotal Labs
Wednesday, February 16, 2011

Interesting Things

  • To run tests in parallel, one pivot experimented with two libraries: hydra and parallel_tests. He found that hydra was difficult to setup and eventually gave up to try parallel_tests. Setting up parallel_tests turned out to be quite simple and gave him about a 3x performance boost on an 8 core machine. Not linear with the number of cores but still significant.
  • Nate Clark recently released a new version of the Selenium RC gem which, among other things, fixes an issue causing tests to hang during initialization.
  • The RSpec =~ matcher (which asserts two arrays should contain the same elements) is still awesome.

Here is an example of using the =~ matcher:

[1,2,3].should =~ [1,2,3]   # => green
[1,2,3].should =~ [3,2,1]   # => green
[1,2,3,4].should =~ [3,2,1] # => red
[1,2].should =~ [3,2,1]     # => red

It also gives you a really useful failure message:

Failure/Error: [1,2,3,4].should =~ [3,2,1] # => red
  expected collection contained:  [1, 2, 3]
  actual collection contained:    [1, 2, 3, 4]
  the extra elements were:        [4]
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Josh Knowles

Red Rover is looking for two awesome Rails developers to join their team

Josh Knowles
Wednesday, February 16, 2011

At Pivotal Labs, one of the services we provide our clients is helping them interview and hire. Pivotal Labs and our clients place a strong emphasis on Agile development and its many aspects: Pair Programming, Test-Driven Development, rapid iterations, and frequent refactoring.

Red Rover is a profitable start up on a big mission – to accelerate the development of human potential by better organizing and connecting communities. Over 30,000 people use our software to connect to other people who share their passions and discover relevant information in their community. This work involves Ruby, HBase / Hadoop, and Lucene among other things.

You are a great Rails developer looking for a start up with the right mix of possibility and humility. You respect what it takes to have paying customers using your app. You respect what it takes to keep those paying customers. You also believe in dedicating your time to a project that is doing something worthwhile for the world. In short, you share our values.

If you want to be our lead developer, step up and claim it. You’ll be pairing with Pivotal Labs, our development partner, which means great process and learning from the best. From there, it’s up to you to impress with your ability to work well with a team, provide steady guidance, share and communicate solid ideas that move the project forward, and showcase a keen understanding of the vision.

Must Haves:

  • 2+ year experience with the Ruby language and the Rails framework, must have a proficiency with the entire Ruby on Rails stack.
  • 4+ years of standards compliant HTML/XHTML, CSS, JavaScript, and JQuery.
  • 4+ years of Java, PHP or equivalent platform experience (including related DB experience such as MySQL, Oracle, MSSQL, etc).
  • Enthusiasm for test driven development, agile development, pair programming is a must. We’re happy to teach these things if your last shop was lame and didn’t think this would be “worth the effort”.

Bonus Points:

  • Strong passion for education and collaboration.
  • Bachelors’ in Computer Science or a related field, or equivalent experience (we really like experience).
  • Ability to Do More Faster.
  • Professional ping pong experience (we have a table and are competitive).

In return, we’re offering:

  • Competitive salary and options.
  • Free breakfast, really f-ing good coffee.
  • Partnership with a small team who cares about your success.
  • Really great technical challenges with a team able to tackle them.
  • Awesome work environment in Union Square, NYC.

Email me at dan@redroverhq.com with some intro, links to your social media presence (esp stackoverflow, quora, github, twitter, etc), and example projects you’ve done in the past. See if you can pull off not sending a resume. If not, send that thing over instead.

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

Morning Standup 2/15/11

Pivotal Labs
Tuesday, February 15, 2011

Ask for Help

“Is there a way to implement interactive Tracker-like panes with pure CSS?”

One pivot suggested using tables but said that it might lead to problems with IE compatibility. The CSS3 flexible box model was ruled out because it does not have good backwards compatibility.

Interesting Things

  • One pivot changed the username and password for a Heroku account and noticed that it caused the API key to stop working. He removed the key and added it again and it fixed the issue.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Valentine's Day (2/14/11) Standup: Git Rebasing and NodeJS package manager issue

Pivotal Labs
Monday, February 14, 2011

Overview

  • “Could someone quickly explain the pros and cons of using git rebase over git merge?“

  • “Has anyone had a problem with NodeJS not seeing libraries installed with its package manager npm?”

Answers

“Could someone quickly explain the pros and cons of using git rebase over git merge?”

A few points pivots brought up:

  • Rebase gives you a pretty line of history without the merge commits. Merging causes the history to grow horizontally as you add pairs to the team.
  • Doing forensics (e.g. git bisect) on changes made by others can be a very manual process without rebasing.
  • Merges have the upside of showing what really happens. In a conceptual sense, you really are working in parallel tracks and stitching the tracks together.
  • Rebasing is good because you’re rewriting history to clean things up. You can fix mistakes in prior commits or commits messages.
  • But then again, who really cares? Is the extra effort needed to learn and apply the complexities of a rebase workflow worth the gain?
  • Also, RubyMine has a rebase feature but it’s caused problems for some pivots. Be very careful when you’re letting a tool like RubyMine make big changes like a rebase to your repo.

More info about git rebasing: http://book.git-scm.com/4_rebasing.html

“Has anyone had a problem with NodeJS not seeing libraries installed with its package manager npm?”

Another pivot had encountered this issue before and suggested adding the NODE_PATH variable to the user’s bash environment:

export NODE_PATH=”/usr/local/lib/node”

This solved the issue. Of course, your own node location may be different. The pivot experiencing this issue installed node from Homebrew.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Sean Beckett

Cadreon Seeks Senior Rails Developer in San Francisco

Sean Beckett
Monday, February 14, 2011

At Pivotal Labs, one of the services we provide our clients is helping them interview and hire. Pivotal Labs and our clients place a strong emphasis on Agile development and its many aspects: Pair Programming, Test-Driven Development, rapid iterations, and frequent refactoring.

Cadreon is looking for a senior Ruby on Rails developer to be part of a newly minted technology team in San Francisco. The candidate will be implementing cutting-edge advertising technologies used to service our Fortune 100 clients like Microsoft, Verizon, Chysler, and BMW. The candidate should enjoy working in a startup-like environment and be able to function well independently or in cross-functional teams.

The full job posting follows.

Responsibilities:

  • Technical architect and lead developer on implementing new advertising technologies.
  • Support and enhance existing internal systems.
  • Assist with technical integration of third party technology vendors.
  • Help evaluate Cadreon’s technology partners.
  • Contribute to the company’s overall technology strategy and vision.

Requirements and Qualifications:

  • Expert-level knowledge of Ruby (1.9) and Rails (3.0).
  • Solid experience using Javascript frameworks like Jquery.
  • Experienced in Agile development methodologies / TDD / Continuous Integration.
  • Ability to communicate technical concepts to non-technical stakeholders.
  • Understanding of online advertising landscape and technologies.
  • Thorough experience with the following tools and technologies:
  • HTML/CSS
  • AJAX
  • Rspec
  • Git
  • Capistrano
  • SQL
  • NIX environments

Helpful but not necessary:

  • Experience building ad serving technologies.
  • Knowledge of Amazon AWS EC2/S3/RDS.
  • Knowledge of Apache, J2EE, and experience building scalable solutions a plus.
  • Java/.NET/Perl development experience.
  • High-availability issues (deployment and monitoring)
  • MongoDB, Riak, CouchDB, and other document style/non-traditional (noSQL) data stores
  • Webrat/Selenium/Jasmine/Cucumber
  • Data feed management and integration

Applicants should email a cover letter and resume to Rin.Chon@Cadreon.com

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Sean Beckett

Fanhattan seeks Lead Back-end Software Engineer in San Mateo, CA

Sean Beckett
Monday, February 14, 2011

At Pivotal Labs, one of the services we provide our clients is helping them interview and hire. Pivotal Labs and our clients place a strong emphasis on Agile development and its many aspects: Pair Programming, Test-Driven Development, rapid iterations, and frequent refactoring.

Fanhattan is looking for a Lead Back-end Software Engineer to join their team in San Mateo, California. The full job posting follows.

Fanhattan is a service that will inspire you to discover all the world’s entertainment. On launch in mid 2011, Fanhattan will bring a new approach to entertainment discovery by helping you browse all the world’s movies and TV shows with a simple and elegant user experience – in the living room, on the web, and on the go. The service will encourage exploration by combining movies and TV shows with an expansive world of related content, visual assets, and information pulled from the web that bring entertainment to life. Finally, Fanhattan will give you the most comprehensive set of options on where to find the entertainment you want across the top digital media providers.

If digital entertainment is your passion, Fanhattan is for you: an obsession for user experience, disruptive technology, high-profile investors, and an experienced team of designers, engineers, and executives from both the technology and entertainment industries.

Fanhattan is headquartered 3,000 miles away from the East Side of Manhattan, in downtown San Mateo.

Responsibilities
The Fanhattan Engineering team is seeking an energetic, highly motivated Back-End Engineering lead with experience in leading a team in creating a sustainable database and a robust and flexible API that will serve multiple devices.

This role entails leading a team of 3-4 engineers as well as hands-on coding. Occasional travel may be necessary.

If you’re passionate about building the next wave of immersive experiences around digital media and consumer electronics devices, this role is for you.

Skills and Experience
A strong candidate for this role will match many of these criteria:

  • Strong experience leading Agile development
  • Synthesize priorities – work collaboratively with leads from Product Management, Operations, and Marketing to internalize business needs and drive priorities for the team.
  • Scheduling – prioritize projects, set achievable, motivating, stretch goals, and manage the team to hitting the deadlines
  • Some experience working with our technology stack (Ruby/Sinatra/Unicorn, jQuery, MongoDB, Solr/Sunspot, Varnish, nginx) or similar
  • You are a doer and a leader who can shift from one role to another as your teamgrows
  • Demonstrated passion for digital media technologies.

Contact
If interested, please submit your resume to jobs@fanhattan.com with the label “Lead Software Engineer – Backend”, followed by your first and last name, in the subject line.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Grant Hutchins

pg_search: How I Learned to Stop Worrying and Love PostgreSQL full-text search

Grant Hutchins
Friday, February 11, 2011

I’m a Pivotal Labs developer at our NYC offices working on the Casebook development team. Casebook is a child-welfare-focused web application used by governments and non-profit organizations. Our users are social workers, caseworkers, and their leadership who work with children, families, and the broader community to provide services that ensure children are safe and healthy.

Search worries

Our users need to quickly find accurate information about the people on their workload to respond appropriately in crises and keep a high quality written record of their work with the children and families.

Solr powered Casebook’s initial search engine. Solr is built in Java, so we set up our application servers to run Java alongside our Ruby on Rails web application. We maintained a real-time copy of our important searchable data, such as people’s names, in our Solr index.

Our Solr-based approach ran into a few problems. Sometimes users would see outdated search results or, even worse, errors. This was annoying and also potentially damaging to our users’ ability to keep up with emergency situations.

Keeping our data synched in multiple locations caused most of our problems with Solr. Some of our more complex code paths would update the database but not propagate those changes to the search index. Users saw search-related error messages when there were communication problems with our Solr instances.

We had some fail-safes in place.

We wrote code that automatically restarted the Solr instances when they crashed. When we found the search data diverged from our application data, we manually rebuilt the search index to get the two data stores back in sync. These solutions just managed our problems rather than solving them.

These problems aren’t unique to Solr. Other tools like Lucene, Ferret, and Sphinx have the same shortcomings when combined with Ruby on Rails.

Using the database itself as the search index

So the thought occurred to our team that we ought to try to make the database itself be the search index. We use a PostgreSQL database, and PostgreSQL 8.3 and later have built-in support for full-text search. PostgreSQL is a popular, mature SQL database solution that works great with Active Record. If you use Heroku, then you are already using a PostgreSQL 8.3 database that supports full-text search.

Since full-text search in PostgreSQL uses fairly complex SQL queries, we decided that the best approach would be to take advantage of Active Record’s scopes. The idea is to make it easy to write code that looks like this:

Book.search_title("Ruby").include(:author).where("created_at > ?", 1.year.ago).limit(10)

So, I am proud to introduce pg_search, a Ruby gem that makes it easy to build search scopes that work just like this.

Installing pg_search is easy. If you’re using Bundler, just add

gem "pg_search"

to your Gemfile and you’re good to go.

To use pg_search to build the Book.search_title scope above, you would write:

class Book < ActiveRecord::Base
  include PgSearch
  pg_search_scope :search_title, :against => [:title]
end

It’s as simple as that!

Adding more features

We took cues from the texticle gem to figure out how to generate our SQL code. Thanks to Aaron Patterson for this wonderful gem! However, our Solr solution had several features that texticle and the basic PostgreSQL full-text search alone don’t currently provide, like ignoring diacritical marks (accents like ü), searching for soundalikes, and searching for words that are misspelled.

We spent a day or two trying to hack texticle into something we could use, but realized that if we started from scratch we could more easily build a gem that could combine more than one PostgreSQL feature into a single search scope. That way, we could improve our Book.search_title scope by using unaccent to ignore accent marks, Double Metaphone to match soundalikes, and trigrams to match misspellings.

So with all of these features turned on, we get the following code:

class Book < ActiveRecord::Base
  include PgSearch
  pg_search_scope :search_title,
    :against => [:title],
    :using => [:tsearch, :dmetaphone, :trigrams],
    :ignoring => :accents
end

Except for :tsearch, the default-in full-text search implementation, the other features require you to install certain contrib packages into your database. For now, this is an exercise for the reader, but we hope to help automate this process soon.

Our gem development approach

We started by taking our application with the existing Solr-based search intact and boosting our test coverage as we could to cover all of the different cases (misspellings, soundalikes, etc.) for some of our most complicated searchable models. Once we were satisfied with our test coverage, we completely removed the Solr search code and were left with dozens of failing tests.

We then created a blank gem and starting adding features to it one-by-one to get each of our application’s tests to pass. First we made sure that simple situations were solid, such as when the search query string exactly matches the searchable text.
Then we moved on to the complicated parts.

Our existing application uses Ruby 1.8 and Rails 2.3, and at the same time we have a new second project that uses Ruby 1.9 and Rails 3. So we made sure that all of our code worked in both environments. I will write another blog post soon about how we used two instances of autotest to make this easy to do.

The great thing about this approach is that we were able to start by defining a set of behaviors based on what our real-world application needed. This kept our code lean. Also, we were able to define our own syntax for the pg_search_scope method. By mimicking the Active Record scope syntax, hopefully we have created something that is easy to pick up. We would just add a new option to one of our calls to pg_search_scope and code until it worked as desired.

User impact

Our users have noticed the difference after we deployed our updated search implementation. We had been rebuilding the search index or troubleshooting a search related bug a few times a week. We haven’t seen a search related help request from our users since we made the changes. In addition, our developers are happier because code deployments are much more reliable and easy to understand.

Overall, the project has been a resounding success!

Getting involved

pg_search isn’t complete yet (will it ever be?). There are many more features we’d like to have to improve performance, search quality, and overall user experience.

For example, right now our developers have to hand-build SQL indexes to improve query speed. pg_search should automatically generate those indexes for us based on which PostgreSQL features are in use.

That’s just one example. We’d love to hear more ideas from you about how pg_search can improve to meet users needs.

To learn more, read our documentation. We also have a public Pivotal Tracker project for requesting features and bugfixes, and a Google Group for discussing pg_search and other Case Commons open source projects.

Also, the Casebook team is currently hiring for an Agile Developer.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Jacob Maine

Standup 2/11/2011: disappearing script tags

Jacob Maine
Friday, February 11, 2011

Interesting Things

  • When jQuery attaches <script> tags, they quickly disappear. It adds them to the DOM, executes them and then removes them. If you switch to document.appendChild, you can search for and find the tags at a later point. jQuery may be trying to work around browser limits on the number of script tags.

Ask for Help

  • “What’s the best way to start a gem?”

bundle gem scaffolds a simple gem. Don’t forget to add a license!

More info on how jQuery handles script tags.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Jacob Maine

Standup 2/10/2011: Broken RSpec array matcher; Introducing Enyo

Jacob Maine
Thursday, February 10, 2011

Interesting Things

  • An upgrade to Rails 3.0.4 broke RSpec’s =~ Array matcher (which disregards ordering). Oddly, there are times when == (which respects ordering) passes but =~ fails.
  • Check out the Trove Hack Day. Trove lets you access photos from a variety of sites through one API.
  • We’re excited about the new Palm webOS App Framework, Enyo.

Ask for Help

“We’re deploying green builds directly to production. But the depend option isn’t working on the CI box. Any ideas?”

Run capistrano with trace to get reports on which dependencies are or are not being used.

  • 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 >