Ian Fisher's blog



Ian FisherIan Fisher
Standup 6/24/2011: How pure is your json?
edit Posted by Ian Fisher on Friday June 24, 2011 at 10:09AM

Ask for Help

"We're using the json gem in production, but jasmine is requiring the json_pure gem for our tests. How can we run our rspec tests with the json gem (instead of json_pure) to better reproduce production?"

Nobody had a definitive answer, but one suggestion was to explicitly declare the json_pure gem in your gemfile with require: false.

Interesting Things

  • Mysql will not let you insert a record with an id of 0 if you have auto-incrementing ids turned on. However, if you really need to create a record with an id of 0 in your tests, you can turn off the auto-incrementing id feature in a before suite block.

Update:

Here is the SQL command to turn off the auto incrementing feature in mysql:

SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'

Ian FisherIan Fisher
Standup 6/22/2011: Cache bust revisited
edit Posted by Ian Fisher on Wednesday June 22, 2011 at 09:19AM

Ask for Help

"How do you make sure that an Android activity registered for an intent is always shown when that intent occurs? If the app is running and another activity is visible, the intent doesn't seem to have any effect."

There was one suggestion to try making the activity a singleton.

"What is the recommended way to cache bust assets referenced in CSS files?"

  • Use a sass function to append the cache bust value to the URL
  • Use css_asset_tagger plugin. This won't work on read-only file systems like Heroku.
  • Rails 3.1 is adding asset management features, so keep an eye out for that.

Interesting Things

  • You can use a selector drawable to set Android text color for the various states (focused, selected, etc.) using a drawable xml file. Intellij will complain and say this is invalid syntax but the application will use the file as you would expect. This only seems to work for the android:textColor attribute in TextViews.

  • RubyMine has trouble locating code definitions for code in gems installed with bundler via a git url when using rvm. rvm puts gems installed with git into another directory that RubyMine doesn't seem to know about.

Ian FisherIan Fisher
Standup 6/21/2011: Our varnish is stale
edit Posted by Ian Fisher on Tuesday June 21, 2011 at 09:15AM

Ask for Help

"Varnish seems to be serving an old asset after a deploy. Where should we look to make it serve the new asset we just deployed?"

You should be looking at your web server's cache settings. If you are cache busting assets on deploy (built in to Rails 2 & 3) then Varnish should always serve the latest assets. You can also use cache headers to determine the TTL Varnish will use, although a "cache forever" + cache bust strategy should be used if possible.

Ian FisherIan Fisher
Standup 6/20/2011: The sound of failure
edit Posted by Ian Fisher on Monday June 20, 2011 at 09:20AM

Ask for Help

"How do you start nginx on boot on port 80 using homebrew?"

If you sudo add the plist using launchctl it should let you start nginx on port 80. There might be some settings you will need to add to the plist file to make sure nginx starts as the right user.

Interesting Things

  • jQuery 1.5 and IE 9 causes epic failure. What does that failure sound like? We're not sure, but using jQuery 1.5.1 will make it so you don't have to find out.