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 2010

Davis W. Frank

Standup 5/17/2010: Nonce-sense Edition

Davis W. Frank
Monday, May 17, 2010

Interesting Things

  • Keep your OAuth Nonce values simple.

The Twitter Api, which is requiring all clients to move to OAuth for authentication by June 30, 2010, like all OAuth systems requires a nonce value for every call. This value is supposed to be random and unique for each request you make.

While there are many ways to generate a random ASCII value, our recent experience with Twitter’s OAuth system shows that a nonce value should not include a ‘%’ character – which would happen if your value has any non-URL-safe character. Twitter will return you a 401 error and tell you that your signature and token cannot be verified.

We’ve filed a bug with Twitter. But until then, keep your nonce value to ASCII letters & numbers and the calls will work just fine.

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

ActiveModelListener and AutoTagger become better Ruby citizens

Pivotal Labs
Friday, May 14, 2010

If you use auto_tagger in conjunction with a continuous integration build you may have noticed that the autotag executable exits with a status code of “1″ when it shouldn’t. Thanks to Sarah Mei I just pushed version 0.1.5, which fixes this bug. Thanks Sarah!

If you use active_model_listener, you are probably pretty tired of that active record deprecation notices. After Todd Persen pointed this out to me I just pushed version 0.2.5 which fixes this.

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

Pivotal Labs Happy Hour – Friday before GoRuCo

Pivotal Labs
Friday, May 14, 2010

Pivotal Labs is hosting a happy hour the Friday before GoRuCo at the Blue Owl.

We’re looking for brilliant Rails developers to join our team. If you’re looking for somewhere to do serious agile development, and serious Rails development, this is the place to go.

196 2nd Ave, New York, NY 10003

5/21/2010, 7:00 pm – 9:00 pm

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Christian Sepulveda

Tweed 1.7: Geotagging and more…

Christian Sepulveda
Thursday, May 13, 2010

Version 1.6 has been submitted and should be in the App Catalog soon.

Bugs

  • Character counter didn’t work if “Post on Enter” was enabled
  • Couldn’t post a photo tweet without text

Features and Changes

  • geo tagging of tweets
  • configurable notification sound
  • (hopefully) improved German translation
  • Copy Tweet has been added to popup menu
  • preference to enable/disable metatap copy for tweets
  • Email / SMS / IM tweets

Geo Tagging

  • preference to enable geo tagging
  • tweets will include location/geo tag metadata if Tweed preference is enabled and Twitter setting for adding location is enabled
  • Tweets with geo tags will display link to location (in popup menu and in tweet)

Popup menu

Our poll results for changing the popup menu resulted in 46% for A, 54% for B. Only about 100 people responded. So while B won by a small majority, we’ve implemented option A, as that was the smallest change to Tweed and we felt the least disruptive to the larger Tweed userbase.

We may change this based on feedback.

Tweed
Tweed
Tweed
Tweed
Tweed

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/13/2010

Alexander Murmann
Thursday, May 13, 2010

Interestings

Webtoolkit Base64 encoding is wrong

If you need to do Base64 encoding/decoding in JavaScript, you likely came across this link (as it’s the #1 Google hit for: “base64 enocde javascript”):

http://www.webtoolkit.info/javascript-base64.html

This code (for encode) works just fine as long as you’re only dealing with strings whose contents are plain ASCII test (no high bits set).

But this code does a UTF encode before the Base64 encode. Which means that any characters with the high-bit set will get expanded first and your Base64 encoding will be wrong. For example, if you build a SHA1 encoded string and then Base64 encode it, you’ll get a resultant string that’s longer than the expected 28 bytes.

Our solution was to keep Googling around until we found some JavaScript Base64 code that did not do any Unicode expansion. Here’s one that does the right thing – there are more, but are hard to find:

http://nerds-central.blogspot.com/2007/01/fast-scalable-javascript-and-vbscript.html

Factory Girl after_create

You might want to use factory_girl to create an object that includes another object. If both factory methods make use of the after_create callback the child’s after_create will be called before the parent’s. This behavior might seem unintuitive and you should keep this in mind working with factory_girl.

Ruby Mine running focused tests from inside context

It turns out that having shoulda anywhere in your project will break running focused tests from inside a context. This will also break ii you use a plugin that comes with shoulda.

Ruby Mine commit & push

Ruby Mine’s behavior when using commit together with the push option might not behave as expected. For us it merged a branch and truncated all changes that had occurred on that branch since the last update.

WebKit JS treats “export” as keyword

One of the many unused keywords in JavaScript is “export”. Firefox lets you use it since it’s de facto unused. However, using “export” in your JavaScript will break your code in WebKit-based browseres.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/12/2010

Alexander Murmann
Wednesday, May 12, 2010

Interesting — Tagging and Excluding of Filters in Solr Facets

You may want to use multi-select faceting to constrain the results shown for one facet but still want to see the values and counts of other facets that are not matched by your constraint. To solve this you often had to use two queries. Since Solr 1.4 you can tag and exclude filters and save the additional query.

Help — Adding Memcached to Models

“I want to use memcached for my ActiveRecord models and am looking for recommendations on how to do this”

Of the available gems the memcached gem can be recommended. The memcached gem wraps the libmemcached client which is written in pure C. This implementation gives it a performance advantage over the memcached_client gem.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/11/2010

Alexander Murmann
Tuesday, May 11, 2010

Interesting — Backtrace in RSpec

Since version 1.2.9 RSpec per default does not print the full backtrace. Calling spec with the -b --backtrace option will print the full trace.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/10/2010

Alexander Murmann
Monday, May 10, 2010

Interestings

gmail_smtp plugin not needed with Ruby 1.8.7

If you uses Ruby 1.8.7 or higher you can natively connect to Gmail and do not need to install a plugin as you used to with older Ruby versions .

selenium/webrat/snowleopard

Selenium uses webrat as default which causes problems under Snowleopard. Getting the latest version of Selenium and replacing the gem’s JAR-file with it will solve this problem.

Ask for Help

Reloading libs in development

“How to setup Rails to reload libraries under development?”

The initializer block in environment.rb contains the line

<code>config.load_paths += %W( #{RAILS_ROOT}/extras )</code>


which is commented out by default. Here the lib folder can be added in order to have it reloaded.

Selenium with with Firefox 3.6

"How to get Firefox 3.6 to work with Selenium?"

Your need to install he latest gem for Selenium RC from gem cutter. You then need to get the latest version of Selenium and replace the gem's JAR file with the latest one you just downloaded.

Using relative picture size to crop from original image.

"I am using Paperclip and need the size of the original picture"

Paperclip::Geometry offers methods to get the image's dimensions. However, if you want to access those for a new file, the earliest you can access these is with the after_save hook. Thus you might have to save the file twice.

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

Hash#fetch for fun and profit

Pivotal Labs
Saturday, May 8, 2010

I have an app where I set the alt tag of images with javascript. To reduce the size of the page, I want to emit img tags with no alt attribute, however that is not currently possible:

image_tag "foo.png", :alt => nil # => <img alt="Foo" src="/images/foo.png?48a6bc" />

I agree that images should have alt tags, and I agree that the Rails default is sensible. However, if I explicitly send :alt => nil, I expect it to omit the alt attribute altogether, to be consistent with :class and other html attributes.

This happens because under the hood the code looks like this:

options[:alt]     ||= File.basename(src, '.*').capitalize

See the issue? If options[:alt] is falsey, the default is used. Since nil is falsey, there’s no way to get options[:alt] to be nil. My requirement is:

  • If I pass an :alt attribute (even if it’s nil), use the passed in value
  • If I pass no :alt attribute, use the default

Making this happen is very simple with the marvelous Hash#fetch:

UPDATE: Thanks to Brennan Falkner and Mark-Andre Lafortune for pointing out the block syntax of fetch is the preferred way.

options[:alt] = options.fetch(:alt) { File.basename(src, '.*').capitalize }

Instead of evaluating the truthiness of the :alt value, fetch checks for the existance of the :alt key. For those of you who are interested in getting this into rails core, apply the patch and give a +1 to the related Lighthouse Ticket.

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

Standup 04/07/2010: Passenger, Solr, Git, and rSpec timeouts

Pivotal Labs
Friday, May 7, 2010

Ask for Help

Passenger Memory Bloat

“We found one of our passenger workers is using around 900MB of memory. Has anyone has problem with Passenger memory usage? We are using REE 1.8.7-2009.10.”

Solr Master-Slave Replication

“We are interested in adding automatic failover to our Solr slave when the master fails. What are some strategies for doing this?”

Interesting Things

Git Push –force Blocked
If you find your git push being rejected, even when you use git push -f, it’s probably because your git server is configured to not allow non fast-forward pushes. You’ll need to change the server configuration to allow them.

spec –timeout
Be careful when running rspec with the –timeout option. When the timeout occurs the test process will be interrupted and it will print out a stack trace for wherever it was executing when it was interrupted. This can lead to a lot of confusion if you do not immediately realize it was the result of timing out and instead think that an exception actually occurred at that point.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Topics

  • agile (778)
  • rails (113)
  • testing (87)
  • ruby (83)
  • ruby on rails (70)
  • jobs (62)
  • javascript (54)
  • techtalk (44)
  • rspec (38)
  • activerecord (29)
  • productivity (29)
  • gogaruco (29)
  • ironblogger (29)
  • git (28)
  • nyc (27)
  • rubymine (25)
  • bloggerdome (22)
  • mobile (22)
  • cucumber (20)
  • process (19)
  • pivotal tracker (19)
  • 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)
  • tdd (13)
  • selenium (12)
  • css (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. →
  • 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 >