Ian Fisher's blog
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'
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.
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.
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.
Ask for Help
"What do you do when your JS files are so big they crash RubyMine? Like when they are bigger than 300k..?"
Try turning off syntax highlighting. We're going to try to send a project to JetBrains that reproduces this issue so they can get log a ticket for it.
Interesting Things
Ask for Help
"What good OpenID solutions are there for rails?"
Janrain provides a service and the rpx_now gem that can handle a lot of the OpenID logic for you.
Interesting Things
- You can use rvm with the
--rvmrc --createflags to create a.rcfile in any directory that will set the version of ruby to use in that directory. A few people said this is particularly useful to do in the root directory of your projects. - jQuery 1.4.3 has a bug with IE7 and live events, e.g. if you register a live event for form submits and for button clicks, when a user clicks a form's submit button on the click event is fired and not the submit event. 1.42 seems to work correctly.
- There's an Android meetup tonight about real time development here in SF. Check it out if you're interested! We've had good experiences at previous meetups with this group.
- And last but not least... a Rails 3 RC came out late last night! Looks like they're hoping to have an official release in a few weeks.
Interesting Things
- Bundler 1.0.0.rc.1 was released - try it out and help find any issues!
- There was a warning that running thin in dev mode can cause all requests to be cached in memory... not so thin. Running in production mode doesn't seem to have this issue.
- Another warning today - Rails 2.3.8 and mongrel don't play nicely together. There are some issues with headers not being passed correctly between the two of them. It was recommended to use passenger instead of mongrel if you want to use 2.3.8.
