Ask for Help
"Our demo site is running on nginx and protected by basic auth. Flash doesn't do basic auth. What do do?"
"Any suggestions for using ActiveResource to access nested resources?" One team was trying to use ActiveResource to access a nested restful web service and found the documentation lacking.
Interesting Things
- RSOC (Ruby Summer of Code) is looking for mentors. Pivotal is a sponsor and in addition will be providing desk space for some RSOC participants.
- Neo4j meetup at Twitter HQ tonight! Details on the neo4j blog
Support for @font-face in CSS has created new possibilities for typography on the web. Like all new technologies there are hurdles, both technical and legal. Typekit aims to solve those problems with a centralized, continuously upgraded font-serving platform and licensing models that make sense for the web.
Ryan Carver of Small Batch, makers of Typekit, gives an intro to Typekit. He describes how to use the fonts and demonstrates advanced client-side tools. He also discusses their internal tools for testing and screen-shotting fonts across browsers and platforms.
See all our talks at http://pivotallabs.com/talks
Pivotal Pulse isn't just for Cruise Control any more: our open source CI aggregator now supports Hudson CI, one of the most popular open source continuous integration systems. We use Hudson on several of our projects, so supporting it in addition to Cruise Control was a natural choice. We've refactored the code to make it much easier to add support for other CI systems (hint hint).

Download the latest code from http://github.com/pivotal/pulse. When upgrading, be sure to run both bundle install and rake db:migrate.
If you are using Bundler to lock and package your gem dependencies in your app (which you should), here's some tips on making everything automatic in your Capistrano deploy.
Refer to the Bundler Documentation for instructions on how to use Bundler to properly package your gems and check everything in.
Once this is done, however, you still must ensure that two things are done on every machine to which you will deploy:
- Bundler is installed
- You run 'bundle install' on every deploy to install the packaged gems on the local machine (and compile any gems with native dependencies)
Here's the Capistrano magic to accomplish these two tasks automatically on every deploy:
before "deploy:bundle_install", "deploy:install_bundler"
after "deploy:update_code", "deploy:bundle_install"
namespace :deploy do
desc "installs Bundler if it is not already installed"
task :install_bundler, :roles => :app do
sudo "sh -c 'if [ -z `which bundle` ]; then echo Installing Bundler; sudo gem install bundler; fi'"
end
desc "run 'bundle install' to install Bundler's packaged gems for the current deploy"
task :bundle_install, :roles => :app do
run "cd #{release_path} && bundle install"
end
end
Oh, and for you GemInstaller users out there - here's an easy way to generate a Bundler Gemfile from your geminstaller.yml config:
geminstaller --bundler-export > Gemfile
You'll probably still need some tweaks, but this will get you started. Just make sure you upgrade to GemInstaller 0.5.5 first (0.5.4 forgot to put the 'source' line in the Gemfile).
Happy Bundling! -- Chad
P.S. There is a similar article here, which includes tasks to symlink your .bundle dir into the Capistrano shared directory, but my deploy was pretty fast anyway, so I didn't worry about it. YMMV.
Our friends at Carbon Five have just announced Story Mapper, a release planning tool for your Pivotal Tracker projects. Story Mapper uses the Tracker API, and allows you to plan and manage your project milestones and releases at a high level. We've already begun to use Story Mapper on our projects at Pivotal Labs, and are excited about how well the tool complements Tracker and our planning process.
Check out Carbon Five's blog post on Story Mapper to find out more, and to start using it today.
Ask for Help
"Is there any library for Base64 encoding on the iPhone?"
Interesting Things
Some Pivots created a jasmine-nodejs project to run your Jasmine specs headless using node.js
A team was getting the below error numerous times while running tests. They managed to track it down to a libxml / Nokogiri load order problem. The errors go away if they require libxml before they require Nokogiri.
ruby(59005,0xa0797720) malloc: *** error for object 0x9586b80: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug
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_scriptdoesn'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; })() JSTodd found out the hard way that Ruby's
String#sprintf(also seen as theString#%) 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):2Make sure you don't feed
sprintfa string number that starts with a0unless 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.
Help:
- Testing blocks. If you have a block and you want to spy on the internals as it executes, what do you do? Suggestions were:
- Have each method called internally throw a symbol and check for that.
- Turn it into a proc, and set expectations on that.
- Stub the methods being called internally and set expectations on those.
- pass the block to a spy object.
Other suggestions welcome. The project is using rr, which apparently can't do this last option, though that would be ideal.
- Routes in Rails are case-sensitive? /products/1/edit and /Products/1/edit don't both resolve to the same place (unless you specify in routes.rb). Rumor has it that the RFC for URIs says that the path portion of a URL is case-sensitive, as opposed to the case-insensitive domain name.
If anyone wants to read through that document and confirm...feel free.
Yesterday we had Mat Brown of Patch.com giving us a presentation on his Sunspot gem for easily adding full-text search to a Rails application via Solr.
Mat walked us through the steps for adding Sunspot to a Rails application, talked through some of the production deployment concerns of Solr and illustrated some of the new features of Solr 1.4 such as master/slave replication and sharding that make it worth a look for full-text search.
Most of our tech talks are open to the public. If you're interested in joining us for presentations like this please join our mailing list.
That's it. I'm done with TextMate. It hasn't been updated in over 2 years, either for essential functionality (replace in path) or performance fixes (searching through log files) or UI issues (how many boxes must you click to enable autosave?) or bug fixes. Every few months the author pokes his head up and says "I'm working on TextMate 3.0!" and then disappears again, happily accepting new license fees into his PayPal account.
I've just been bitten twice in two weeks by a bug that caused not just data loss, but data mangling in a way that was very difficult to fix. Here's the rough steps to reproduce:
- Edit some files in TextMate
- Leave TextMate running in the foreground
- Switch to console and "git pull" in the latest code from your workmates
- Run a search-and-replace that edits a file that was changed (by someone else) during the merge
- Save that edit
You'll see (with "git diff") that your version of the file has your new post-merge changes... but it also has reverted your buddy's changes from the merge. It's like you decided that those changes were no good and reverted them yourself and then added your own.
If you fail to notice this before checking in, you will totally hose your version control... but just for that one file. You can't just revert a whole commit... you'll have to step through change by change to figure out which change was theirs, which change was yours, and which change looks like it was yours but was actually an inadvertent revert of theirs!
I can't work under these conditions. I'm switching to RubyMine today. See http://bjclark.me/2010/03/10/rubymine-a-love-story/ for why.
P.S. I just found a bug report for this dated 2008-04-02. That's just about 2 years ago for a critical data-losing bug. Woot.


