Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Justin Richard

Posts By

PIVOTAL LABS
[Standup][SF] 11/07/12: CSS tech talk at AirBnB tonight

Events

  • Nicole Sullivan: OOCSS and Preprocessors in a tree, K-I-S-S-I-N-G

Hosted tech talk at AirBnB tonight

https://www.airbnb.com/meetups/q8daawbyx-tech-talk-nicole-sullivan

LABS
5/18/12 Standup – Performance without downtime please

Help

Q: A team is looking for options to test their app's response times under load. What's the recommended tool?

A: Browser Mob was recommended as a hosted option. They have scripted browsers that make requests against your site.

Tsung is an Erlang project that can send a bunch of traffic to your site.

Q: Is it possible to deploy without downtime to Heroku?

A: The closest option is to have two apps that share a single database and coordinate your deploys and A/B which one serves the app publicly. This is clunky. Perhaps Heroku is working on a supported solution for rolling restarts of dynos.

PIVOTAL LABS
5/15/12 Standup – setting the template in database.yml

Interesting Things

You may need to specify a template in your rails database.yml to use the rails connection to create a Postgres database via your rake scripts that has your preferred configuration.

Specifically, a team found they needed to specify a template (template: template0) in their database.yml to create UTF8 encoded databases for their project running on Ubuntu 11.04.

Note that your milage may vary here, since the settings on the template database will vary by platform, config and compilation. You might not get the same results using template0, but its interested that you can set it since it wasn't obvious that it was even available.

PIVOTAL LABS
Standup 5/14/12 – Watch your SafeBuffer

Interesting Things

ActiveSupport::SafeBuffer do not work with all the features of #gsub. Mind your strings, or fix this bug in ruby!

# normal:
1.9.3-p125 :004 > "foo".gsub(/(?<my_string>.*)/) { $~[:my_string]*2 }
 => "foofoo"

# broken:
1.9.3-p125 :005 > "foo".html_safe.gsub(/(?<my_string>.*)/) { $~[:my_string]*2 }
 => ""

# round trip, back to working
1.9.3-p125 :006 > "foo".html_safe.to_str.gsub(/(?<my_string>.*)/) { $~[:my_string]*2 }
 => "foofoo"
</my_string></my_string></my_string>

PIVOTAL LABS
Standup 12/8/11

Interesting

The Pivotal Webstache Movember network cleared $40,000 raised to stop Dude Cancer

Joda-Time provides a quality replacement for the Java date and time classes. Months are not zero based!

EC2 is scheduling restarts for their physical machines and your instances. In some cases you can manage your own restart. Make sure you check your email and your EC2 console.

Help

Google Chrome seems to be caching and rendering the last resource served from a URL regardless of its content-type when you navigate via the back button to a page. Specifically, a client's site serves both HTML and JSON from the same URL. The JSON is the last request made because it's an async request on the page. When the user navigates away from this page then back the JSON data is rendered instead of the HTML resource. Any HTTP header change suggestions we can use to get Chrome to only render the HTML content?

Capybara seems to not allow #click on elements depending on how you call #find. What's up with this?

find('tr', :id => 'foo').click  #not clickable
find(:css, 'tr#foo').click      # is clickable

PIVOTAL LABS
Standup 12/6/2011

Interesting

A Ruby Class's default 'initialize' method takes zero or any number or arguments depending on the version of Ruby you use.

Given the Foo class:

class Foo
end

And then attempting to instantiate an instance of Foo with arguments like so:

Foo.new('any argument')

You get an invalid number of arguments error in 1.8.7 and 1.9.3.

However, 1.9.2 and 1.9.1 will just accept any number of arguments.

Ruby spec documents this behavior: https://github.com/rubyspec/rubyspec/blob/master/core/object/new_spec.rb

It appears that this difference between versions was introduced as a feature in 1.9.2 and back ported to 1.9.1 and then reverted in 1.9.3. Perhaps the reversion should be back ported now? http://redmine.ruby-lang.org/issues/2451

Help

Does anyone know of an API that provides a sales tax lookup service?

PIVOTAL LABS
Standup 5/3/11 – It's Tuesday All Day

Interesting

  • Check your instance variable and methods names for conflicts with libraries or frameworks you are using if you get unexpected failures

    Example 1: defining @response in your RSpec test setup when expecting to use the response from a HTTP request overwrites the result of the request. (don't expect @request or @url to do you any favors either)

    Example 2: Don't define a #process method on a Rails controller

  • SF Dev Ops meetup is tonight

PIVOTAL LABS
Standup 10/7/10: Apache –with-mpm compile option, IE && Rafael && jQuery, Modulr

Help

"Some of our requests are not timing out in the time specified in our mod_proxy settings in Apache."

This team's problem was later refined to the fact that these timeout settings were not being respected on all requests when the server hit a spike in load. The solution is to recompile Apache with the --with-mpm=worker option. The default option value is --with-mpm=prefork. With Apache compiled with the 'worker' value all requests respect the timeout settings.

"When using Rafael and jQuery together in our project our click handlers throw errors in IE 7 and 8"

After further investigation IE seems to keep propagating the click event even though it was handled. The following javascript was added only in IE browsers to make it behave like the other browsers.

if(document.attachEvent) {
  $(divContainingCanvas).find("*").click(function(event) {
    event.stopPropagation();
  });
}

Interesting

Modulr is a Ruby implementation of a CommonJS module that combines your multiple javascript files into a single file that is executed in dependency order. It does this by ordering the execution of your code by the require() method call. What's interesting is that you can collapse your NodeJS code into a single file to include in a browser and run Jasmine tests against. This is possible because NodeJS uses require() to link your dependent files together.

PIVOTAL LABS
Standup 2010.10.4 getting SWFUpload to work with Rails 3

Help

"We're trying to use SWFUpload in Rails 3 by using Rack middleware to rewrite the session cookie passed in via request param. In a Rails 2.3.x your Rack middleware could clobber the session cookie and reset it before it hits your main app. However, this isn't happening in Rails 3. Has anybody run into this before?"

The answer is that as of Rails 2.3.4, the session handler was moved to Rack middleware. So you need to make sure that your middleware manipulating the session is running before the Rails session middleware is run. You can do this with something like this:

config.middleware.insert_before(config.session_store, FlashSessionCookieMiddleware)

Brian Racer has a good description of getting SWFUpload working with rails 2.3.4

PIVOTAL LABS
Standup 2/5/2010: Jasmine has shared examples

Interesting##

If you're using Jasmine to test your JavaScript code and you miss the shared examples functionality you used in RSpec, you can achieve the same result by just using a plain old function. Name your function something like "mySharedBehavior" and call it in each of your describe blocks that share the behavior. Jasmine will execute the function and print your results just as if you repeated all the shared examples in each of your describe blocks. Be careful not to modify the scope of the function that contains your shared examples (Jasmine needs to control the scope).