Pwn that feature

It’s easy to start down the path of creating a feature or just making a change until you hit a roadblock. It may have you cut a corner, half-ass your testing or otherwise do a less than awesome job.

I periodically work with the guys at @gojee and they’re building out this new feature using CSS3 animations. Testing those CSS3 animations in Safari 5.1 look great and it works just as you would expect across Chrome and Firefox (sorry IE, you don’t get animations). However in Safari 5.0, it’s not all sunshine and rainbows.

It’s easy to say “well, Safari 5.0 is only 7% of our users so let’s not worry about it so much” and degrade them to static images. However, the idea to use CSS3 instead of Flash was someone’s decision.

Guess whose working on making it work across as many cool browsers as possible including Safari 5.0 tonight? Yep, that person who championed the decision but also the entire team. From chickens to pigs, everyone’s helping to change and test the feature.

They’ll end up pwning this issue and not stop until it’s done.

Ask yourself:

  • Would you delay your next feature until the current one’s perfect?
  • Would you pay extra to have the tools your team wants or needs? And not the same equipment your mom would get (unless of course she likes SSD).
  • Would you focus on fewer better features instead of many crappy ones?

After reading Steve Job’s biography and remembering a blog post on ServerFault about The Awesome Factor. The phrases “amazing or shit” and “just make it awesome” come to mind, respectively.

Everyone needs to own their own part. It can’t be one person staying up late testing everything, tweaking and ultimately making it awesome. It should be everyone owning their own change, helping out their teammate and making it awesome.

TL;DR: Own it - Love it - Just make it awesome!

Hydra - good, Hydra on Heroku - not so good

Hydra is a great tool for Rails development as it can distribute your tests to remote machines.  In my current project, we’re running Ruby 1.9.1 on Rails edge with RSpec 2.0 beta so not everything works right all the time.

The biggest culprit is having Heroku attempt to install our development and test gems.  In particular, if you list gem ‘hydra’ within your Gemfile for Heroku - rake no longer works.  You get a helpful message like this:

%  heroku rake routes --app your-app
(in /disk1/home/slugs/192557_b2246d5_db92/mnt)
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:32: warning: already initialized constant RAKEVERSION
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:404: warning: already initialized constant EMPTY_TASK_ARGS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:452: warning: already initialized constant EMPTY
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:960: warning: already initialized constant RUBY_EXT
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:964: warning: already initialized constant RUBY
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1033: warning: already initialized constant LN_SUPPORTED
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1242: warning: already initialized constant ARRAY_METHODS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1245: warning: already initialized constant MUST_DEFINE
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1249: warning: already initialized constant MUST_NOT_DEFINE
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1253: warning: already initialized constant SPECIAL_RETURN
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1259: warning: already initialized constant DELEGATING_METHODS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1569: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1575: warning: already initialized constant DEFAULT_IGNORE_PROCS
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1612: warning: already initialized constant FileList
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1638: warning: already initialized constant EARLY
/disk1/home/slugs/192557_b2246d5_db92/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1968: warning: already initialized constant DEFAULT_RAKEFILES
rake aborted!
stack level too deep
/disk1/home/slugs/192557_b2246d5_db92/mnt/Rakefile:10:in `<top (required)>'
(See full trace by running task with --trace)

So the fix is to exclude execution of the entire block by Heroku:

source 'http://rubygems.org'

gem 'rails', '3.0.0.beta3'

## snip ##

if RUBY_PLATFORM =~ /darwin/
  group :test do
    gem 'rspec', '2.0.0.beta.11'
    gem 'rspec-rails', '2.0.0.beta.11'
## snip ##
    gem 'hydra', :git => 'git://github.com/ngauthier/hydra.git'
  group :development, :test do
    gem 'wirble'
    gem 'hirb'
    gem 'awesome_print'
    gem 'ruby-debug19'      # does not support 1.9.2
gem 'ruby-debug-ide19'

If you run linux (as I do half the time), then check for this environment variable:

if ENV[“SHELL”] != “/usr/bin/git-shell”

Don't show your cards - defense in depth

I recently went to visit a popular Ruby and Rails website called the Ruby Toolbox at http://www.ruby-toolbox.com/

On my arrival, I had a friendly “Application Segmentation Fault” message.  Even more useful was the stack trace (I bolded the awesome parts):

rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_
requirements is deprecated and will be removed on or after
August 2010.  Use #requirement
** [NewRelic] New Relic RPM Agent 2.11.2 Initialized: pid = 20162
** [NewRelic] Agent Log found in /disk1/home/slugs/127160_40c7b71
>> Thin web server (v1.2.6 codename Crazy Delicious)
>> Maximum connections set to 1024
>> Listening on, CTRL+C to stop
** [NewRelic] Connected to NewRelic Service at collector7.
rails/backtrace_cleaner.rb:25: [BUG] Segmentation fault
ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux], MBARI
0x6770, Ruby Enterprise Edition 2010.01

Security is about defense in depth.  Not only are you supposed to change your passwords, but you make them hard to guess.  Not only do you check your firewall for open ports, but you make it impossible to have unauthorized applications send packets out.

So needless to say, you pull away a few layers of your security when you spit out folder structure, internal listening port, web server name/version and other product version information.

In the case of Heroku, it’s not exactly a secret that they run that flavor of ruby, rails, and web server.  Though I didn’t know it was those exact versions and that they were running REE.  Still, they shouldn’t advertise it.

Earlier →