Abhijit Hiremagalur's blog
Help
One project is releasing soon but has not yet been indexed by Google, what's the best way to get Google to index the website quickly?
How do people distinguish between nil and a cache miss when using Memcached and Ruby?
- Some suggested using a
:symbolto representnil
form_for @object sometimes posts to the wrong action, has anybody else seen this?
Help
"Recommendations for a configurable embedded video player"
- Lot's of people recommend Flowplayer
- Other's suggested looking the Youtube APIs
Interesting Things
Help
"What Ruby PDF libraries are people using?"
- Especially for HTML to PDF generation
Interesting Things
- Rails controller filters can also be objects
- Any object with a before, after or filter method can be a filter
- Will Read attempts the Matrix knot

Help
"How do you permanently remove a git tag?"
- One team would like a delete a tag created by their CI, but it keeps coming back if somebody who has pulled the tag locally does a push.
Interesting Things
- Web based sprite generator - here
This also makes the generated sprite really small which is great if you care about page load times. A Ruby+ImageMagick sprite generator might also be a good thing to build.
- Cool way of detecting if a file is UTF-8 enconded using Ruby+IConv - here
Ask for Help
"Is there an onReady() for AJAX events?"
- onAJAXReady() ?
- JQuery Live Events might do the trick
Ask for Help
"Daemon best practices in Ruby?"
- We haven't tried DaemonKit
- SimpleDaemon is what we currently use, which we suspect of interfering with monit (had problems with multiple instances starting, and process not starting upon reboot).
- A couple of people suggested looking at Daemonize
- Always monitor daemons with sanity checks (e.g. memory usage); use Monit or God
- Roll your own?
"cut doesn't handle strange characters in large (5GB) text file, are there other unix commands for text file manipulation that are utf-8 compliant?"
- Try
awk/sedmaybe - Try using
od/hexdumpto figure out what the weird characters are
UPDATE 01/14/2009: Chad's corrections
Interesting Things
- Using 'require' explicitly interferes with class reloading in Rails
Frederick Cheung discusses this in more detail here. This might be related to the Selenium + class reloading issues some pivots have experienced in recent weeks. The alternative is to rely on Rails automagic loading or 'require_dependency'.
- acts_as_fu makes writing database independent tests for models is easier
Props to pivot Pat Nakajima for creating acts_as_fu.
This is a cross post from my personal blog, because I'd like to hear from other Pivots about why they test.
First about unit and integration tests.
- I write unit tests for focused feedback; i.e. tell me exactly what broke. To keep them focused I try to keep them orthogonal which usually means using fakes of any collaborators.
- I write integration tests where I need more safety than a unit test will offer. They seem even more important when I’m stubbing and mocking a lot in a dynamically typed language like Ruby.
- I write both types of tests to help convey intent and understand the problem better. I TDD with either a unit test or integration test, whichever feels natural.
Then about interaction and state based testing.
- I pick the approach that feels natural at the time, favouring neither by default. I struggle with rules about when to use which.
- I dislike interaction tests that look suspiciously similar/symmetrical/coupled to the code they refer to. I expect a test to earn its right to exist, and therefore add to the size of the codebase and build’s time, by either conveying intent that is difficult to express in the code itself (which is why I love the term ‘example‘) or addressing some other consciously identified risk.
So, now it's your turn - why do you test?







