Erik Hanson's blog



Erik HansonErik Hanson
Standup 2011-03-04: Beter Later Than Neverer
edit Posted by Erik Hanson on Sunday March 06, 2011 at 07:52PM

Ask for Help

"window.onhashchange doesn't work in Android's version of WebKit?"

The event exists, but it doesn't ever get fired. Apparently this also happens in Mobile Safari. Does anyone know how to get it to work?

"What's the latest and greatest replacement for acts_as_list?"

Apparently there's no fabulous replacement for acts_as_list.

Interesting Things

Erik HansonErik Hanson
Standup 2011-03-02: Better Late Than Never
edit Posted by Erik Hanson on Sunday March 06, 2011 at 07:37PM

Ask for Help

"'Teamcity formatter missing' error?"

Any ideas how to work around a "Teamcity formatter error" message when running specs (using RSpec 2) in RubyMine?

" Paperclip breaks when a filename contains a '#' character"

Apparently this has been fixed but not released?

Interesting Things

  • Selenium Conference is taking place in San Francisco on April 4-6.

  • MongoDB apparently stores pre-epoch dates as far-future dates and converts them back from future to past dates automatically. However, it does not convert them when searching or sorting.

Erik HansonErik Hanson
Standup 2011-03-01: Spork! Spork! Spork!
edit Posted by Erik Hanson on Tuesday March 01, 2011 at 05:50PM

Ask for Help

"Has anyone else had their Selenium tests break after upgrading from rails 2.3.8 to 2.3.11?"

One team was using Rack 1.1.0, Mongrel 1.1.5 and Rails 2.3.8. When they upgraded to Rails 2.3.11, their Selenium tests started failing. After some investigation they found this commit which they used to create a monkeypatch for Rack 1.1.0:

# Back-porting this patch: https://github.com/rack/rack/commit/f6f3c60938ea3b08f3292a2480e6753c293584e5
module Rack
  module Utils
    class HeaderHash < Hash
      def [](k)
        super(@names[k]) if @names[k]
        super(@names[k.downcase])
      end
    end
  end
end

Anyone have a better solution?

"Slower test suite with Spork?"

Spork can speed up the start-up time of your test suite, but has anyone seen it slow down the overall test run? One Pivot was seeing a 10% slowdown in overall suite speed.

Interesting Things

Erik HansonErik Hanson
Standup 2011-02-28: The Cowbell Isn't Going To Ring Itself
edit Posted by Erik Hanson on Monday February 28, 2011 at 09:21PM

Ask for Help

"jQuery throwing a syntax error when using is("[data-foo]")?"

Has anyone seen jQuery throw a syntax error when passing a data- attribute name to the is() function? This code often works, but started throwing a syntax error after some markup was removed and then re-inserted into the DOM:

$("#foo").attr("data-bar") = 5;
$("#foo").is("[data-bar]");

Interesting Things

Erik HansonErik Hanson
Standup 2009-11-06
edit Posted by Erik Hanson on Friday November 06, 2009 at 01:38PM

Ask for Help

Exceptions thrown in Rails views get wrapped by ActionView::TemplateError which makes rescuing specific exceptions hard

It's probably best to prepare all your data in your controller or models and not in the view, which will obviate this and other problems.

Ask for Help

Does anyone have suggestions for an off-the-shelf data reporting tool to help display some data in a webapp for internal users to see?

form.submit() vs. <form onsubmit="...">: An onsubmit attribute added to a form element doesn't get called when form.submit() is called from Javascript.

  • Try using Javascript to attach an onsubmit handler rather than adding it as an attribute of the form element.
  • Instead of calling form.submit() from Javascript, send a click event to a hidden submit button.

Timezones are being ignored when a date is passed into ActiveRecord's find method, but are not ignored when passed into other methods.

This seems to be due to a bug in ActiveSupport's to_s(:db). One solution is to override to_s and fix the time zone.

Interesting Things

  • When trying to create an ssh tunnel to EngineYard, set GatewayPorts to yes in sshd, otherwise the tunnel won't bind to your local computer.

  • WAVE Toolbar (Web accessiblity evaluation tool) is a great Firefox extension that shows you which parts of your pages have accessibility issues.

  • The next meeting of the San Francisco Pivotal Tracker Users Group is tonight at 6:30 PM at the Pivotal Labs headquaters on Market St.

Erik HansonErik Hanson
Standup 2009-11-02: WTF?
edit Posted by Erik Hanson on Tuesday November 03, 2009 at 08:55AM

Interesting Things

  • git-wtf is a useful script for showing the state of your git repo. It was mentioned specifically for its ability to show you the details about the commits you haven't yet pushed (especially if there have been multiple commits by other people in the meantime).

Erik HansonErik Hanson
Standup 2009-02-26
edit Posted by Erik Hanson on Thursday February 26, 2009 at 10:00PM

Interesting Things

  • Shotgun is an automatic reloading version of the rackup command that's shipped with Rack.

Erik HansonErik Hanson
Standup 2009-02-25
edit Posted by Erik Hanson on Thursday February 26, 2009 at 09:46PM

Interesting Things

  • The Golden Gate Ruby Conference is now accepting proposals for talks.

  • Rails by default stores its session in a browser cookie as an encrypted string. If you want to get the contents of that cookie from within Rails, you can call "session.dbman.send :marshal, session.data". If you want to get that value from tests, you'll have to use an integration test, as functional tests mock out too much of the session store.

Erik HansonErik Hanson
Standup May 2, 2008
edit Posted by Erik Hanson on Friday May 02, 2008 at 04:35PM

Ask for Help

  • "Can anyone recommend a tool to help find cross-site scripting (XSS) vulnerabilities?" One suggestion was Wikto.

Other articles: