Austin Putman's blog



Austin PutmanAustin Putman
Standup 03/30/2011
edit Posted by Austin Putman on Wednesday March 30, 2011 at 10:05AM

Ask for Help

We have an html table with rows that correspond to
database rows. We'd like an easy way to implement per- > row editing of this data, but <TR>s are not happy to be wrapped in a <FORM>. How fix?

  • use javascript to copy the data to a form element or do a straight AJAX post
  • Backbone.js has the ability to link html elements to server-backed data models, might be handy here
  • put forms around individual <TBODY> elements for the individual rows

We're using ActiveResource as a foundation for our API client, but it doesn't process JSON errors correctly. How fix?

This has been in the issues tracker for ActiveResource for over a year and is marked low priority. HttpParty was suggested as an alternative, anyone else have something they like?

Interesting Things

Some folks are using HTML5 Canvas and are taking IE9's canvas support for a spin. Turns out that if you apply some font settings to text on a canvas and then rotate it, IE9 will actually shift the center point of the text, creating a surprising jump, diagonal in this case. If you don't want your text to hopscotch across the page, you have to rotate it first, then apply the font.

Webrat used with selenium doesn't follow redirects with Rails 2.3 on Mongrel. One team used thin instead of mongrel, which solves this problem. Using webrat with thin requires a patch

Austin PutmanAustin Putman
Standup 03/28/2011: It's over -10,000!
edit Posted by Austin Putman on Monday March 28, 2011 at 09:26AM

Turns out there's a hidden "feature" in jQuery's .animate method. If your starting point for an animation is less than -10,000 px, it sets it to 0. Meaning your -10000 to -12000 animation is going to move a surprising 12000 pixels. There, fixed that for ya!

The -10,000px limit is hard-coded deep in the jQuery animate code, we speculate that it may resolve an issue in one browser or another. So before you start creating Ken Burns-style photo pans with your gigapixel images, make sure you have a plan to dodge this limit.

We're committed to providing clients with license information for all the libraries we use on each project. To that end, some Pivots have created LicenseFinder, a command line tool which scans your project for Rubygems and summarizes the license data it can recognize. It's recently had some upgrades. [Check it out].(https://github.com/pivotal/LicenseFinder)

Austin PutmanAustin Putman
Standup 8/10/2009: Catatonic Edition
edit Posted by Austin Putman on Tuesday August 10, 2010 at 09:46AM

"Anyone have any experience with the pfeed gem? We're interested in a no-frills activity feed"

Crickets dominate the standup landscape. It is suggested that our guests, Diaspora, may have some opinions on activity feeds.

-fin-

"I've upgraded Firefox to 3.6 and my selenium and cucumber specs are busted. Anyone else have this issue?"

The selenium-rc jar that comes with webrat needs to be manually updated to the latest version. See prior(http://pivotallabs.com/users/alexander/blog/articles/1241-standup-5-10-2010) posts(http://wjb-tech.blogspot.com/2010/03/ruby-cucumber-webrat-selenium.html).

"Does anyone else ever get ghost files, where RubyMine shows the file as empty but other text editors show the contents, only to have the file return on its own after a few hours?"

Removing RubyMine's cache directory doesn't seem to help, nor does restarting RubyMine. Perhaps we can look for a "Mediocre Code Opacity: 0" in the RubyMine display settings?

Interesting Things

If your debugger stops working in RubyMine, you may want to uninstall all your ruby-debug gems and start from a fresh copy of ruby-debug-ide version >= 3.4.7.

JetBrains often asks for a copy of the project displaying the problem when a ticket is submitted. Maybe we should set up a "RubyMine problem project".

EngineYard is making progress on their new command-line deploy interface. If you'd like the EY web deploy interface to conform to the patterns of the CLI gem, there's now a setting in Engine Yard to convert your project over to those rules, meaning you can deploy without re-chef-ing your server. Much faster.

Austin PutmanAustin Putman
Standup 7/22/2010: XML <-> JS scrimmage. Go!
edit Posted by Austin Putman on Thursday July 22, 2010 at 09:36AM

Ask for Help

"Is there a good heap analyzer to debug some memory issues in our app?"

Some options to look into include rubyprof, valgrind, bleakhouse and memprof.

"Anyone else having problems with RubyMine 2.02 allowing the cursor to be placed at arbitrary locations out beyond the end of the line? We've turned off the setting that controls this."

This can happen if RM is in column-edit mode. Also there's a setting to "Strip Trailing Spaces" -- if you previously were allowing arbitrary cursor placement, you may need to enable this to clean up.

"Anyone have experience dealing with E4X to parse javascript in XML? It seems to be choking on é characters -- in the iso-8559 doctype these are legal content."

No solutions were forthcoming. To recreate this error yourself, plug the following into your Firebug console:

var someHtml = '<p>cr&egrave;me fraiche</p>';
new XML(someHtml);

// => "TypeError: unknown XML entity egrave"

"What is the best javascript XML parser?"

jQuery is recommended in the browser and also works on top of env.js in Rhino. libxmljs is built on top of V8.

"Webmock is having trouble correctly parsing matching query params in SSL. Anyone seen this?"

The easiest thing may be to skip the SSL requirement for the tests.

UPDATE: The webmock issue was resolved using a couple of techniques. Firstly, the keys for your query params have to be symbols, not strings. This avoids a problem with sorting them for the comparisons. Secondly, it's better to pass the expected url as a regex. This may be related to :443 getting added to the end of SSL requests, or may just be a bug.

Ask for Help

"Is there a way to get better access to the logs in Heroku?"

heroku logs only displays the last 100 lines; This isn't even enough for the full stack trace of the last error in many cases. One team is having problems using the ExceptionLogger plugin as well. Hoptoad might resolve this somewhat. We're really looking for a heroku logs --tail, which doesn't exist.

Interesting Things

  • RubyMine has the handy feature of showing your test failures while the test suite is still running. Unfortunately, should you try to click on a failed test to see the output, RM has a nasty habit of stealing your window to continue showing the output of the current running test. No more. You can click the little gear on the upper right corner of the left testing pane. From there you can uncheck "Track Running Test".
  • The new RubyMine EAP has a bug where you lose your current indentation when you hit enter twice. A fix is on the way.
  • jQuery will sometimes execute the contents of script tags embedded in HTML before you attach then to the DOM. This occurs when doing a wrap or a replace, and might happen other times too.
  • Tonight is the SFRuby meetup. Rumor has it there will discussions of agile over soft serve ice cream.

Interesting Things

  • On Friday someone suggested that Solr offers per-queue transactionality. Further testing indicates this isn't the case. If a series of changes are entered on one queue and a commit occurs on another queue, all pending changes across all queues are committed and reflected in the index. Consider yourselves warned.

  • Solr has an optimize command to reduce the size of the index. This is important to performance because Solr attempts to hold the full index in memory. Using the optimize command can push index size down to 20% of pre-optimized levels. If you're using Sunspot to interface with Solr, it doesn't expose the optimize command. Here's a way you can call it directly:

Sunspot.session.session.send(:connection).update RSolr::Message::Generator.new.build { |b| b.optimize }
  • If you're using nginx on EngineYard, you might be surprised when your configuration changes don't take effect for https:// users. EngineYard keeps ssl configuration in a separate file -- look for [project name].ssl.conf

  • We've reached the halfway point for GoGaRuCo ticket sales. If you are thinking of coming, now is the time to get your tickets. Sarah Mei has been added to the speaker list.

  • Some of our folks using delayed job were having trouble because they needed access to the RAILS_ENV. They modified their delayed_job start and restart commands to export the RAILS_ENV into the environment. When exported, the ENV value is inherited by the daemonized child process:

cd ./project_root && export RAILS_ENV=production && delayed_job start