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
Pivotal Labs

NYC Standup Roundup – Week of 4/19

Pivotal Labs
Saturday, April 24, 2010

Interesting

  • A Pivot noted a facepalm + headdesk moment when debugging an issue whose cause turned out to be related to two adjacent string literals being auto-concatenated by Ruby’s parser.

    >> "foo" "bar"
    => "foobar"
    

In this case, a missing comma in a method call went undetected because of this language characteristic. Whether or not this follows the principle of least surprise is an exercise left up to the reader.

  • Another pair warned that while this is valid syntax in Ruby 1.8.7 and beyond:

    define_method(:burninate) { |&block| block.call("burninating") }
    

.. in 1.8.6 you can’t use a block as a parameter of a block.

  • Another pair noted that exceptions with Sunspot can cause wider failures on a site than just those that touch Solr. The symptom on this project was that if Solr was inaccessible for any reason every page on the site would throw an error. Their fix was to use Sunspot’s SessionProxy to wrap methods with some exception handling love.

  • Lastly, GoRuCo — the Gotham Ruby Conference — will be held on May 22nd at Pace University’s downtown campus. The roster of talks is up and registration is open for business.

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

NYC Standup Roundup – Week of 4/12

Pivotal Labs
Sunday, April 18, 2010

Help

Does anybody have any good techniques for dealing with STDOUT/STDERR and exception handling when shelling out in Ruby on Windows?

Nobody did. Do you? Please share in the comments.

Interesting

A pair ran system updates on their Snow Leopard box which caused bunch of test failures in their project. Most of the failures were occurring around the parts of the application that used BigDecimal. After digging they found:

     >> BigDecimal.new("1.01").to_f
     => 1.1

Oops! Looks like Apple shipped Ruby 1.8.7 p173 with a recent update. p173 has a bug that some dude introduced into BigDecimal. The fix was to update to p174 which was released quickly after this was discovered.

While on the subject, BigDecimal is kind of a drag. Its #inspect output is inhumane and new’ing up BigDecimal objects requires an ugly call to its constructor. A Pivot recommended using the undocumented bigdecimal/util which adds a convenience method to Float for creating new BigDecimals:

    >> require 'bigdecimal/util'
    >> 3.14159265.to_d
    => #<BigDecimal:10056bea8,'0.314159265E1',12(16)>

And a nickel’s worth of free advice?

    >> BigDecimal.send :alias_method, :inspect, :to_s
    >> 98.6.to_d
    => 0.986E2

Unless you prefer:

    #<BigDecimal:101137c78,'0.986E2',8(8)>
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

NYC Standup Round-up for Mar 15th – Mar 19th

Pivotal Labs
Friday, March 19, 2010

Spring is just around the corner, and it has been a beautiful week here in sunny NYC. We’ve learned a lot this week, as you’ll see as we do the Round-up!

Ask For Help

  • Kevin and I are having a heck of a time using Web Driver to drive an app that uses Google Maps. Whenever we click on or type into anything displayed on the map, the contents of the map (including the Google logo and the zoom control) move about 20 pixels up. Our tests seem to still work, it just looks like it’s broken. Anyone else seen this or know what might cause it?

Interesting Things

  • Kevin and I discovered that Capybara’s page.execute_script doesn’t like to execute multiple statements. It really wants to evaluate a single expression. The upside of this is that it’s really good at casting Javascript values into Ruby; it seems to work well with strings, numbers, and even arrays. If you really want to execute multiple statements, you can do this:

      page.execute_script <<-JS
        (function(){
          statement1();
          statement2();
          return someValue;
        })()
      JS
    
  • Todd found out the hard way that Ruby’s String#sprintf (also seen as the String#%) will cast your string numbers to octal if you’re not careful. Behold:

      >> "%d" % "010"
      => "8"
      >> "%d" % "08"
      ArgumentError: invalid value for Integer: "08"
        from (irb):2:in `%'
        from (irb):2
    

    Make sure you don’t feed sprintf a string number that starts with a 0 unless you mean it to be octal.

  • Rachel tells us that there’s an upcoming Rails workshop for women in NYC. Rumor has it that Pivotal’s own Sarah Mei is behind it. She’s been known to do such things before. Details as they become available.

  • Pat’s improv show is tonight! Check him out at the Magnet Theater.

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

NYC Standup Round-up for Mar 8th – Mar 12th

Pivotal Labs
Friday, March 12, 2010

Spring is in the air here in sunny NYC! Well, it was sunny for a bit. Now it’s turned into that classic film-noir drizzle. That’s authentic New York weather outside our window as we do the Round Up!

Ask for Help

  • I asked, “In Jasmine, how do you spy on a constructor?” Suppose you have a constructor called Widget. Saying spyOn(window, "Widget") swaps out the real Widget function with a spy. The real Widget implementation takes its prototype with it, which means that Widgets created while the constructor is spied on don’t get the methods a Widget would get. That’s true even when you spy with spyOn(window, "Widget").andCallThrough().

    Also, there doesn’t seem to be a way to stub out object construction and return an object of your choosing. In Rspec in Ruby you can say,

    Widget.should_receive(:new).and_return(my_fake_widget)

    because .new is a class method. But in Javascript, new is a keyword which always creates a new object. I’m guessing there’s no good way around this, but if there is one, we could really use it.

    Update: This is, as it turns out, entirely incorrect. Jasmine’s .andReturn() does let you stub constructors properly. I still have no idea how this works. See the comments for more discussion.

Interesting Stuff

  • Todd notifies us that in ActiveRecord, dynamic finders with too-few arguments fail silently. That is, if you say,

    Person.find_by_first_name_and_last_name_and_email(”Todd”, “Persen”)

    and fail to specify a value for email, the value is taken to be nil. That means that the finder will look for someone named “Todd Persen” with a nil email address. You might have meant that. More likely, you made a mistake. AR should probably check the number of arguments it’s given against the number of columns in the finder name.

  • You already know that Pivotal does real Extreme Programming. But did you know that we have…Extreme Breakfast?

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

NYC Standup Round-up for Mar 1st – Mar 5th

Pivotal Labs
Friday, March 5, 2010

It’s been a quiet week in New York City, my hometown. Let’s do the round-up.

Ask for Help

  • Ian Z. asked, “Given a <select> input element, how do I select an option by its name and not its value using jQuery?”

    The answer? You can’t. Or you couldn’t. But the very act of observation changes the phenomenon which is observed), and by lunch, you could. Pat’s just crazy like that.

    $.fn.choose is available in chewable Gist form.

And that’s it. I’ll see you back here next week.

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

NYC Standup Round-up for Feb 22th – Feb 26th

Pivotal Labs
Friday, February 26, 2010

Live from the set of Snowpocalypse 4: The Reckoning, it’s the weekly NYC Standup Round-up!

Interesting

  • Corey points out that the Google Maps embed code wants to be put directly on a page, not loaded on demand with something like jQuery’s $.getScript(). Luckily, there’s a fix: adding an async=2 param to the Google Maps API URL. More info in a post from Olly Hodgson.

  • Rachel and Pat found out the hard way that Bundler 0.9.8 doesn’t run on Ruby 1.8.6. Upgrade your Ruby or stick to Bundler 0.9.7.

  • The same team had a real headache even upgrading from Bundler 0.7.0 to 0.9.8. The gem cache directory moves and the Gemfile format changes, among other things. This sounds like more than a minor-version change to your standup scribe.

  • Don’t put Coca-Cola in the freezer. I know, you want it to get cold faster. You’ll come back for them in like five minutes. It seems like a great idea. But out of sight, out of mind, and the next day, you open the freezer to grab your microwave burrito and you find these waiting to explode all over you:

    Oh ,the Cokemanity.

    I’m just asking you to think this through. Do you want frozen Coke foam splattered across your nice shirt? You can put an end to this madness. Just don’t do it.

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

NYC Standup Round-up for Dec 28th – Jan 8th

Pivotal Labs
Monday, January 11, 2010

Points of Interest

  • Following a recipe from Dan Chak‘s Enterprise
    Rails
    , we came across code following this
    pattern:

    class Thing
      def foo
        def bar(args)
          # some code
        end
        # some code that calls bar()
      end
    end
    

    The structure of this code suggests that bar is scoped only within
    the context of foo. But alas, that is not the case. Ruby simply
    defines Thing#bar the first time foo is called, analogous to
    define_method :bar. Misleading syntax, for sure.

  • Ryan Davis‘s Flay is awesome. If you’re not
    familiar with it, Flay parses your Ruby and compares subtrees with
    each other to find where code has been duplicated (or nearly so).
    Run on a codebase of over 20,000 lines of Ruby, Flay was able to
    quickly indicate places where we had duplicate code lying around, as
    well as many likely targets for refactoring work. We’ve found it to
    be helpful in keeping code DRY.

  • This looks interesting: MagicPrefs gives you gestures
    for your Magic Mouse (Yes, Pivotal NYC has Magic Mice, as well as
    27″ iMacs. Apply today!).

  • In Snow Leopard, mapping CapsLock => Ctrl when two keyboards are
    plugged in is problematic. You can do it by plugging in one keyboard
    at a time and mapping each one individually. If anyone knows the
    story behind why this is, or how to deal more easily, please comment!

  • Another interesting link: Open Frameworks is a
    “creative coding” toolkit (like Processing) that’s
    implemented in C++. Why ask why?

  • Another lesson learned the hard way: starting up a bunch of leopard
    machines at the same time wreaks havoc on the network for a few
    minutes. Packet storm, dropped packets, etc. Is Bonjour to blame?
    Inquiring minds want to know.

  • If you’re trying to stub a subclass of ActionMailer::Base with
    Double Ruby (also known as RR), and you’re having issues, try
    stubbing the method on ActionMailer::Base directly. There’s some
    weirdness there with method_missing in Rails 2.3.

Help Wanted

  • Does anyone know how to make command-1 through command-9 switch
    tabs inside of Term.app? By default, these keys are bound to
    switching windows, and we’d love to be able to do this on tabs
    instead.

  • Rails’s select_tag(..., :multiple => true) option doesn’t properly
    set selected on the generated options. This appears to be a boog,
    and anyone who’s interested in helping a Pivot write a patch, please
    comment below!

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

NYC Standup Roundup for Dec 14th – Dec 24th

Pivotal Labs
Monday, December 28, 2009

Happy Holidays from NYC!

Interesting

  • Someone noticed that rspec’s should_not (rdocs here)
    returns false when the spec passes, whereas should returns true
    when it passes. This has unexpected results when a should_not is
    used within a Webrat wait_for loop (code here)
    – wait_for loops until its body returns true. Fail!
  • John Resig has implemented a jQuery.require method that should be
    in the next release. Check out the commit and the lengthy
    discussion here.
    Everyone’s a critic.
  • One Pivotal project that recently switched from MySQL to Postgres
    noticed that PG sorts NULL values differently than MySQL. The
    default in PG is NULLS FIRST when ordering DESC, and NULLS LAST
    otherwise. You can override this behavior by using a NULLS FIRST or
    NULLS LAST clause
    in your ORDER BY.
  • Someone was reminded the hard way that Ruby’s rescue, by default,
    only catches exceptions inherited from StandardError.

Help

  • Does anyone know of a service or library that will convert an email
    into a tracker story? The use case is stake holders who send
    UI/UX requirements within emails with attachments, etc.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

NYC Standup Roundup – Week of 12/7

Pivotal Labs
Friday, December 11, 2009

Interesting

   >> false.blank?
   => true
  • blank? first checks to see if a method responds to empty? and if not evaluates !self which in false’s case will always be true. This caused a pair a bit of confusion when trying to validate the completeness of a form that had a checkbox.

  • Railscamp — an all-weekend hackfest — is being held in Rhode Island in March of next year.

  • All API keys were recently reset on Gemcutter due to a security bugfix – in order to publish gems you’ll need to update your gemcutter gem to regenerate your key.

  • Postgres will return an error if you attempt to ORDER BY columns that are not specified in the SELECT. This is painful in cases where you’re using DISTINCT with any kind of JOIN.

  • One team cut their deployment down from 7 minutes to 30 seconds with a few cap recipe tweaks. Most of the time was saved by symlinking gem bundler-related directories to prevent bundler from building native gems on each deploy and by only running database migrations when anything in db/migrate had changed.

  • When using the inherited hook for ActiveRecord::Base, beware of tables that have their name overriden by set_table_name. The inherited hook will execute prior to that statement being evaluated which can cause strange results.

  • Getting Selenium to work with Snow Leopard involves some manual file renaming hackery — for anybody struggling with this there are a couple of posts out there to walk you through the process.

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

NYC Standup Roundup – Week of 11/30

Pivotal Labs
Friday, December 4, 2009

Help

RubyMine and gem bundler don’t seem to get along – RubyMine complains that bundled gems aren’t attached but these gems aren’t available when we try to attach them. Any ideas?

  1. RubyMine uses your gem path so you’ll be able to attach to the gem if you add your gem bundler path to your ~/.gemrc file

  2. There’s an option to disable this nagging alert in the preferences.

Is there a good Rails plugin skeleton/template out there?

Know of one? Let us know in the comments.

Interesting

  • Don’t use sleep 1 or such in before blocks in rspec if you need to ensure a delay between two events. A before block is ran between all nested contexts so you’re probably incurring a larger penalty. Instead, you should stub Time.now.

  • One team implemented git commit hooks to facilitate communication – on rebase or merge new messages from a text file in the project root are displayed to alert other pairs to changes such as gem upgrades, noteworthy database changes, etc.

  • 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 nyc-standup Feed
  1. 1
  2. 2
  3. →
  • 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 >