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
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 4/1/2011: April Fool's edition

David Goudreau
Friday, April 1, 2011

Ask for Help

“Paperclip and fixture builder – we’re getting some strange errors that for some reason are fixed when you rerun fixture builder – any ideas?”

No one has run into this specifically, but a few people said to make sure you’re mocking out Paperclip.

“Fakeweb, Webmock, VCR, artifice – what’s a good Ruby/Rails developer to use?”

It was mentioned that Artifice is good for Selenium tests while Fakeweb and Webmock are good for rSpec tests. VCR’s got some fans as well. Sounds like you can’t go all that wrong whatever you choose.

Interesting-y

  • GoGaRuCo – This year it will be September 16th & 17th. A call for proposals will be going out sometime in the near future.

  • Unicorn – it turns out that Unicorn doesn’t reopen logs after a log rotation unless the path to the log in Unicorn is absolute – so don’t use relative paths!

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 3/31/2011: Process.spawn pwns all yer codez!

David Goudreau
Thursday, March 31, 2011

Interestings

Get your Rails mentoring on at RailsBridge this April 8th & 9th @ the Modcloth offices in downtown SF. It’s very rewarding.

If you have nested_attributes updating an attribute that is NOT in your attr_accessible attribute list on your ActiveRecord model you won’t get an exception – it will just silently fail. It will, however, output a warning line to your Rails log file. Fun for the whole family.

Using popen to open a process actually calls ‘sh -c’ to open your process, so the process you just ran is actually the child of the ‘sh -c’ process you just ran. This makes tracking down PIDs simply wonderful. :-) You can use ‘exec’ instead and your process will be the parent process. But if you’re using the new hotness you can instead use Process.spawn in Ruby 1.9.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 3/29/2011: Git it!

David Goudreau
Tuesday, March 29, 2011

Ask for Help

“Is there a better way to work on a feature, set that feature set aside, do a small change, check that small change in, then resume work on the feature, all using Git?”

git stash was originally used. There were also suggestions to use a feature branch or use one of the Git GUI tools (gitx, tower, smartgit, gitti) that let you partially stage your changes then check in. Or git-friendly workflow scripts or the ol’ reliable git cherry-pick.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 7/1/10 – Caching Apache images that have ?123456789

David Goudreau
Thursday, July 1, 2010

Help

  • Does anyone know how to set a caching header for urls that end with a cachebusting string (e.g. ?123456789)? Apparently you’re not allowed to get the query string when mucking with rewrite rules. A couple of people think that you are able to get your hands on it…somehow.
  • How do you do a screen capture from the Mac command line? We want to do a screen capture of a running emulator. Maybe something like this?

Interesting Things

  • Rails 2.3.8 – for nested attributes, ‘_destroy’ is the new ‘_delete’. Looks like the Rails team is on top of it. Use

    @foo.update_attributes(:foo_attributes => {'0' => {:id => '1',  '_destroy' => '1'}})
    

    instead of

    @foo.update_attributes(:foo_attributes => {'0' => {:id => '1',  '_delete' => '1'}})
    
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 6/30/10 – Selenium blah blah blah RSpec focused test blah blah blah Rubymine blah blah

David Goudreau
Wednesday, June 30, 2010

Help

  • Determining a users default time zone – someone must have solved this already, right? Well, Javascript only gives you the time offset, which isn’t that useful, but Fleegix has some good support we’ve used on other projects.
  • The after_commit gem – we wanted to create an audit entry every time a particular model failed to create successfully. We tried using the after_rollback hook in both our tests and our development environment but it just didn’t work. The before_rollback callback also didn’t work, but the non-rollback callbacks in the gem seemed to behave. Anyone have any thoughts outside of overriding ActiveRecord ourselves?

Interesting Things

  • Vows – real async Javascript testing for Node.js. Jasmine does support some async testing, but it sounds like it’s a bit clunky to do.
  • Using RVM on the server – is anybody doing this? Apparently not yet, but we had some strongly differing opinions on the matter as to how useful it would be and if it’s the right tool for the job. To be continued…
  • Rails 2.3.8 + mongrel_rails + Rack 1.1.0 – cookies do not work. At all. Apparently with Rack, cookies get fed into mongrel_rails as an array, while Mongrel expects them to be a String. Looks like someone already ran into this. The fix is to throw this in a Rails initializer file:

    class Mongrel::CGIWrapper
      def header_with_rails_fix(options = 'text/html')
        @head['cookie'] = options.delete('cookie').flatten.map { |v| v.sub(/^n/,'') } if options.class != String and options['cookie']
        header_without_rails_fix(options)
      end
      alias_method_chain(:header, :rails_fix)
    end if Rails.version == '2.3.8' and Gem.available?('mongrel', Gem::Requirement.new('~>1.1.5')) and self.class.const_defined?(:Mongrel)
    

    (As an aside, running mongrel_rails by using script/server works fine, we only found this issue when running our Webrat Selenium tests, which calls mongrel_rails in some different way that causes this bug to be exposed.)

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 6/29/10 – EngineYard Redis change

David Goudreau
Tuesday, June 29, 2010

Help!

  • Ey cloud deploy – has anyone done a deploy to EY cloud and seen the Mongrel instances not get bounced?
  • Does anyone have any tips on testing distributed applications? We’re looking for the least ugly/painful way to do it well.

Interesting Things

  • Rvm and sudo – for goodness sake don’t do it.
  • Sass not recompiling on deploys – a few of our projects have seen Sass files not recompile/update for some reason that we’ve yet to track down. So instead of spelunking through Sass code we just force the issue by having a rake task that forces the recompile – see this post for details.
  • Rails xhr redirect – one of our projects is using the xhr_redirect plugin to support ajax redirects – careful if you want to use it in your tests – it self-destructs if your Rails environment == ‘test’
  • Android meetup tonight at 6:30 PM – check out the details.
  • New Redis recipe from EY – following up from yesterday, the new EY recipe to set up Redis appears to work fine with a little tweaking.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 6/28/10 – EngineYard Redis change

David Goudreau
Monday, June 28, 2010

Interesting Things

  • Redis at EngineYard – EY recently fixed a bug in their system chef scripts that was unintentionally installing Redis, so if you’re relying on it being there you may find it missing on your next deploy. EY has apparently just added a recipe for running Redis on a utility slice in ey-cloud-recipes. We haven’t tried it out yet but at first glance it looks ok. This new recipe doesn’t support running Redis on a solo instance, but it doesn’t look too hard to change it to do that.

  • Library reorganization – we here at Pivotal have a library of books we let people ‘check out’. We’ve just reorganized it a bit. Let our local librarians know if it’s working for ya.

  • Mobile meetup – there’s a mobile meetup tonight from 6-8 PM tonight at Horatius in Potrero Hill. They’re expecting people from top mobile companies including entrepreneurs, application developers, designers, marketing/business, etc – please RSVP at the Facebook to attend.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Sass development at the speed of Javascript

David Goudreau
Thursday, June 10, 2010

Surrendering to Sass

I’ve finally gone all-out for Sass. The last thing that was holding me back was the speed with which I could make Sass file changes in RubyMine and see them in Firefox. I’d gotten so used to the ReCss bookmarklet being mapped to Ctrl-Z-Z using the ShortcutKey2URL Firefox addon that I couldn’t go from 0.1 seconds (using Javascript to reload my css files) to see my changes to 1 second (by doing a full-page refresh in the browser) to force Sass to recompile the css files.

Enter Erik Hansen, Javascript guru and all-around nice guy, for a 5 minute pair session where we added a synchronous ajax call to the ReCss bookmarklet to ‘/’ of our application to force Sass to recompile.

javascript:void(function(){var i,a,s;$.ajax({url: '/', async: false});a=document.getElementsByTagName('link');for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href) {var h=s.href.replace(/(&|%5C?)forceReload=d+/,'');s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf())}}})();

Note the

$.ajax({url: '/', async: false})

at the beginning of the line – we’re hitting the root of our application with a synchronous ajax call (using jQuery because our application uses it and it is available) to force the application server to return a response which consequently forces Sass to recompile all the sass files we’ve changed. It’s pretty darn fast. One caveat – if your ‘/’ action is slow on your site because it loads a bunch of models and such (it’s not yet on our site), you should be able to create a Sass action in your home controller that doesn’t do much anything and point the ajax call at that instead – you might wanna enable that only in development mode, too.

And by the way, I’ve also fallen in love with the FireSass Firefox plugin. It’s a must-have for Sass development.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Make the RubyMine 2.0.1 debugger work for you…

David Goudreau
Wednesday, February 17, 2010

In the latest Rubymine 2.0.1, we’ve had lots of problems on our workstations with getting it working reliably. Seeing as how I love using a debugger and look forward to leaving the days of puts behind, I’ve spent a fair amount of time troubleshooting this problem.

Here’s the deal – Rubymine 2.0.1 must have ruby-debug-ide -v=0.4.7 installed to work correctly, not the latest, which is ruby-debug-ide -v=0.4.9. You should also check out the Console tab of the debugger if you need any additional troubleshooting help.

So go ahead, uninstall 0.4.9, install 0.4.7 open up Rubymine 2.0.1 and start debugging – your inner troubleshooter will thank you.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 12/04/2009

David Goudreau
Friday, December 4, 2009

Help!

  • Does Git have keyword substitution like Subversion?

    Well, yes and no. You can use gitattributes to do this, though one person wonders why you’d even want to do this in the first place.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
David Goudreau

David Goudreau
San Francisco

Subscribe to David's Feed

Author Topics

agile (14)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • 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 >