Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Monthly Archives: April 2007

Pivotal Labs

Standup 4/17/2007

Pivotal Labs
Wednesday, April 18, 2007

Interesting Things

  • Nesting a javascript generator within a javascript generator does not work:
<code>
  new.rhtml:
  link_to_function "myFunction" do |page|
     page.insert_html :bottom, :partial => 'new_stuff'
   end

   _new_stuff.rhtml:
   link_to_function "remove" do |page|
     page.replace_html 'some_id', ""
   end
</code>

The quotes in the nested JS are not escaped properly.

  • The plugin team introduced new email validation for the User plugin. They covered this with functional/unit tests within the plugin but projects using the plugin will need to update their own Selenium tests.

Total Stand-up Meeting Time: 10:00 minutes

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Christian Sepulveda

The Need for Professional Development

Christian Sepulveda
Tuesday, April 17, 2007

People need professional development, whether conscious of this or not. It is my
opinion that one of the most common reasons people change jobs is the lack of
professional development.

Boredom and the lack of a challenge are common reasons people cite when leaving
a job. This is a cry for professional development; their new job provides a new
context with new challenges,which stimulate the individual, encouraging new
perspectives and the assimilation of new information.

It is preferable for everyone that the employee does not have to take such
drastic measures as changing jobs to satisfy the need for professional
development. Unfortunately many companies, particularly startups, do not have
any program for professional development, even if only an informal one. There is
too much to do and never enough time; how can you expect a fledgling company to
spend scarce resources on developing employees? Most would rather hire
individuals with the skill set required for the job and not be responsible for
their development.

Herein lies a common mistake; many employers confuse developing employees with
hiring for established skills. They are independent as current skills addresses
short term needs whereas professional development addresses long term concerns
of retention, satisfaction and future skill requirements.

Considering the cost and time required for recruitment and training, it is
foolish for an organization to dismiss professional development, regardless of
the “good reasons”. Like character in individuals, it is telling if an
organization will respond to its challenges rather than succumb to excuses. An
organization’s commitment or negligence regarding professional development
reveals much about its values. For many employees, this will be a greater cause
to change jobs.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Standup 4/16/2007

Pivotal Labs
Tuesday, April 17, 2007

Standup 04/16/2007

Help

  • Problems with initial start up of CrusieControl daemon script. J of cc.rb can take a look.
  • Running Selenium on IE7 remotely

Interesting Things

  • after_filter is called after the template is rendered, thus you cannot set instance variables in it and expect them to be available in the template. The after_filter method is good for post-render content manipulation or analysis such as gzipping, translating to pig latin or determining content-length. Perhaps it would be useful to add a before_render hook?
  • Remember integration tests are for full stack http testing (routes, REST, etc). Functional tests do not test full stack. Integration tests require some special handling.
  • After a reload on an association proxy object, the reference becomes a true Array (they always respond true to is_a?(Array). This means that none of the association proxy methods are available!
<code>
    class Foo < ActiveRecord::Base
       has_many :bar
    end

    foo = Foo.new
    foo.bars.reload.build
    NoMethodError: undefined method `build' for []:Array
</code>

Total Stand-up Meeting Time: 14:00 minutes

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Chad Woolley

Avoiding Constants in Rails

Chad Woolley
Monday, April 16, 2007

In his post “Redefining Constants” ( http://www.pivotalblabs.com/articles/2007/04/14/redefining-constants ), Brian Takita describes how to redefine Rails constants at test time. He points out that “it’s all dirty”, and that “…maybe the storage service can be an attribute that can be changed for individual tests.”.

In a comment, I suggested that a global configuration object would be a better approach, and here’s an example. It still uses a constant (as opposed to a global singleton object), but the constant is an object (a hash) which contain other values and objects. This avoids the need to redefine constants to use different values at test-time.

Create a sample Rails app

$ rails railsdi
$ cd railsdi/
$ ls
$ script/generate controller Sample
$ # create development/test databases

Declare the configuration hash

First, add a constant in boot.rb. Just ignore the warning to not modify boot.rb – it’s not talking about you. Put this at the beginning, right after the section that defines RAILS_ENV

boot.rb

REGISTRY = {}

Set per-environment defaults

Set any values or objects you want in the registry:

development.rb

REGISTRY[:key] = "development_value"

test.rb

REGISTRY[:key] = "test_value"

production.rb

REGISTRY[:key] = "production_value"

Verify that the correct values are used in each environment

Make a simple controller and view to verify the values are set per-environment:

sample_controller.rb

class SampleController < ApplicationController
  def index
    @registry_value = REGISTRY[:key]
  end
end

sample/index.rhtml

Rails Environment: <%= RAILS_ENV %>
Registry Value: <%= @registry_value %>

Start up the app in development and production environments, and hit http://localhost:3000/sample

Verify that registry values can be overridden at test time

sample_controller_test.rb

  def test__can_redefine_registry_value
    REGISTRY[:key] = 'overridden_value'
    get :index
    assert_equal 'overridden_value', assigns['registry_value']
  end

Summary

I think this is a pretty good approach, and it feels a lot like testing in an app that uses a Dependency Injection/Registry architecture (in other words, simple to override anything you want). I’d be interested to hear if there are any situations that could not use this approach, and would have to fall back to defining constants in the environment files.

It would also be interesting to hear if anyone has had success integrating a Rails application with a Dependency Injection approach (using Needle or a home-grown solution).

– Chad

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Redefining Constants

Pivotal Labs
Saturday, April 14, 2007

We all like a good oxymoron, like redefining constants. There are times where we need to redefine a constant to test an edge case in the application code. Before I go into this example, please note that redefining constants is generally not a good way to have maintainable software. If you find yourself needing to redefine a constant, it may be an indication that refactoring is needed.

Given that, lets get into an example where you may need to redefine a constant. Lets say an app has does file uploads to Amazon’s S3 service. A common practice to upload to a real S3 account made for the production, development, or demo environment.

When in the test environment, a fake S3 service would be used instead. The fake service is useful to keep your tests fast and running predictably.

To get a different File Upload service object in each of your environments, one can have the S3 configuration in the environment files:

test.rb

STORAGE_SERVICE = FakeStorageService.new

development.rb

STORAGE_SERVICE = S3StorageService.new("development_service", "access_key", "secret_access_key")

production.rb

STORAGE_SERVICE = S3StorageService.new("production_service", "access_key", "secret_access_key")

The File Upload service objects can be set to constants in the environment file. This works great when testing the logic of the objects that use the File Upload service. However it is a good idea to run an integration test that does a real upload.

Since the tests are running in the test environment, a fake File Upload service is being used. Well now we want to use a real service that points to a test S3 account. An easy trick is to redefine the constant to the S3 service in setup and then redefine the constant back to the fake service on teardown.

There are a few ways of doing this…

Just Reset the Constant

context "A real S3 call" do
  setup do
    STORAGE_SERVICE = S3StorageService.new("test_service", "access_key", "secret_access_key")
  end
  teardown do
    STORAGE_SERVICE = FakeStorageService.new
  end
end

This is the simplest approach, but it produces an error:

warning: already initialized constant STORAGE_SERVICE

###Use silence_warnings

context "A real S3 call" do
  setup do
    silence_warnings do
      STORAGE_SERVICE = S3StorageService.new("test_service", "access_key", "secret_access_key")
    end
  end
  teardown do
    silence_warnings do
      STORAGE_SERVICE = FakeStorageService.new
    end
  end
end

This solution removes the warning, but now a certain section of your code will not have warning at all. Also, one could argue that you lose semantic meaning. It also feels like a hack.

Redefine the Constant

class Module
  def redefine_const(name, value)
    __send__(:remove_const, name) if const_defined?(name)
    const_set(name, value)
  end
end

context "A real S3 call" do
  setup do
    Object.redefine_const(
      :STORAGE_SERVICE,
      S3StorageService.new("test_service", "access_key", "secret_access_key")
    )
  end
  teardown do
    Object.redefine_const(
      :STORAGE_SERVICE,
      STORAGE_SERVICE = FakeStorageService.new
    )
  end
end

Calling redefining the constant does not generate a warning. Also it does provide semantic value because you are actively declaring that you are redefining the constant. If there are other warnings, you will also see them.

Its all Dirty

Redefining constants is a non-standard tatic, especially for those new to Ruby. Since this is unconventional and is often contrary to assumptions, it may lead to unpredictable behavior.

Maybe the storage service can be an attribute that can be changed for individual tests.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Chad Woolley

Best Remote Pairing Audio/Video Options

Chad Woolley
Friday, April 13, 2007

Dave asked about this, in response to my “Best Remote Pairing Settings” post (http://www.pivotalblabs.com/articles/2007/04/13/best-remote-pairing-setting), so here’s my take on it.

Audio Software:

For audio, Skype is the best. It takes a lot of CPU though. Sometimes the audio gets flaky, but restarting it usually fixes it. Also, Skype on the mac seems to crash sometimes. Audio over Yahoo and MSN messenger is pretty bad compared to skype, I think this is because Skype’s peer-to-peer technology gives a much superior audio quality.

Video Software:

For video, Skype is very good, but only does 1-on-1 currently, not conference video. If you want cross-platform conference video, Yahoo video is the currently the best (only?) free option. Unfortunately, yahoo doesn’t let you resize the video window like skype does.

iChat is really nice and does video conferencing, but requires a Mac on both ends. Also, iChat seems to need a lot of open ports (see portforward.com). I still haven’t gotten around to playing with our firewall to open the necessary iChat ports. I tried ssh-tunneling all the ports listed for iChat on portforward.com, but that didn’t work.

Audio Hardware:

For group conversation, the PolyCom Communicator, Model C100s, is the best (http://www.polycom.com). It works on Macs and PCs. It also has built-in echo cancellation which usally works pretty well with Skype. It also takes a headphone jack, so you can hear the room, but still let your pair wear headphones. The only downside is that the speaker is kind of underpowered, and you can’t be heard in a loud room, but unless you are talking to the entire room your pair can just wear headphones. Also, it’s hard to hear really large rooms over the polycom. For that, you can use a sudio mic (see below)

For headsets, the Plantronics GameCom Pro1 (Digital Signal Processing) is an awesome headset. It’s really comfortable, which is a big deal if you wear it all day long. The only downside is that it is USB only, which means you can’t use a splitter to

If you want to listen to a large room, and the Polycom isn’t cutting it, you can invest in a studio quality microphone, and a tube preamp. We use the Behringer Tube Ultragain MIC100 Preamp, and a nice sudio directional mic – not sure of the brand now, because I’m remote :). Just plug these into an input jack via an adapter. The main downside of this is you don’t get the echo-cancellation like you get with the Polycom, so you always hear yourself talk. You can mitigate this by putting the speakers far away from the mic, but it’s still difficult.

One other note – on MacBooks, the audio input doesn’t seem to work with a normal jack mic (non-USB). It is a dual-purpose jack or something. I’ve only had success with USB mics on my MacBook.

Video Hardware:

The QuickCam Orbit MP is a very nice webcam, and you can even move it around through software – it has little motors on it that let you point it different directions, if you have remote VNC access to the box it is connected to.

The QuickCam Orbit works with Skype and Yahoo on the Mac, but has problems with other software. The remote motor control doesn’t seem to work, and iMovie and some other Mac apps don’t recognize it.

The iSight is also a decent Mac webcam, but the resolution isn’t as good as the QuickCam Orbit, and it’s not remotely controllable.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Chad Woolley

Best Remote Pairing Settings

Chad Woolley
Friday, April 13, 2007

I am a remote employee at Pivotal, so I do a lot of remote pairing, and I’m always trying new options. Here’s a quick writeup on what I’ve found to work best.

This is specifically for working over a WAN. If you are on a LAN, other options will be better (and you should just get on the same machine as your pair anyway!). Remote pairing is pretty usable unless bandwidth is causing problems. CPU also makes a big difference – performance on an iMac is a lot better than on a Mac mini, especially the 1.6Mhz mini. I’m using the term “server” to mean the machine running the VNC server, and “client” to mean the machine running the VNC client.

Mac Server:

OSXVNC (Vine Server) with default settings. Turn on shared VNC connections if you want.

Windows server:

UltraVNC with the Video Driver Hook seems to work best; it’s almost as fast as Windows Remote Desktop, but it requires that you use the UltraVNC client, which is only available for Windows. However, sometimes you get screen redraw issues with the video driver hook. This seems to be due to network or CPU issues, because it works great most of the time on most machines. If this happens, you can fall back to the Tight protocol on the client.

The “WinVNC Current User Properties” I use for the UltraVNC server are:

  • Poll Full Screen (Ultra Fast)
  • Poll Foreground Window
  • Poll Windows Under Cursor
  • System Hook DLL
  • Video Hook Driver
  • Low Accuracy (Turbo Speed)
  • DON’T CHECK Poll Console Windows Only
  • DON’T CHECK Poll on Event Only

Windows Client for server with a single monitor:

If you are using the UltraVNC windows server with the video driver hook, then you should use the UltraVNC client, with the “Ultra” encoding and 256 colors, with CopyRect and Cache encoding enabled.

If you are not using the UltraVNC video hook on your server, then UltraVNC is still a good client, with these settings:

  • Tight Encoding
  • 256 colors (less colors don’t seem to help that much)
  • Use CopyRect Encoding
  • Use Cache Encoding
  • Zip/Tight Compression enabled, set to 9
  • Jpeg (Tight) Quality, set to 1
  • Track Remote Cursor Locally
  • Viewer Scale (whatever works for you)

Windows Client for a server with a dual monitor and a client with a dual monitor:

UltraVNC client has a bug where it scales, but will still not show any more width than one of the client’s monitors, even though you make the window bigger. RealVNC does not have this problem, so it’s probably a better client in this situation, even though it doesn’t allow configuration of all the above options like UltraVNC does (at least not from the GUI).

Mac Client:

  • Chicken of the VNC is OK, but it doesn’t do scaling, and doesn’t allow you to specify ports via the double-colon syntax (only displays, which means you have to do math if you are ssh tunneling)
  • Free RealVNC is OK, but it doesn’t do scaling
  • Enterprise RealVNC does scaling
  • There are several other mac clients such as VNCThing and VNCDimension, but they don’t work on my mac for some reason, and don’t seem to have any more features than Chicken of the VNC or RealVNC.

Linux server and client:

I’ve not been too impressed with the VNC linux servers or clients. They seem to be slow and crash a lot (both RealVNC and TightVNC). Your mileage may vary.

Alternatives I’ve tried and found to be inferior:

  • The built in VNC server in OSX (slow and unconfigurable)
  • Apple Remote Desktop (which is really just VNC too, and just as slow and unconfigurable)
  • Timbuktu Pro (no faster than VNC, and had refresh issues)
  • NoMachine NX (server only runs on Linux. It’s a great option if you are connecting to Linux)
  • Windows Remote Desktop/rdesktop (logs off server GUI, so unusable for remote pairing)

Other Notes:

I’ve read that running VNC over a compressed SSH tunnel will help performance. However, I think with the latest VNC protocols, which already do compression, this doens’t make much of a difference.

Summary:

Most of these observations are from running different clients side-by-side. They are very subjective, because bandwidth and CPU are always affecting the performance. Let me know what your experiences are, and if you have any different ideas.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Joe Moore

Standup 04/10/2007

Joe Moore
Monday, April 9, 2007

Interesting Things

  • Has Ruby 1.8.6 dropped some important methods from Enumerable? For example, we can’t seem to find each_slice, and there seems to be very little documentation for 1.8.6.

Total Stand-up Meeting Time: 10:00 minutes

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Pivot Blogs

Alex Chaffee
Sunday, April 8, 2007

Look for upcoming personal Pivot blogs. (We call ourselves Pivots.)

Christian Sepulveda, our VP Business Development has the first. It can be found at chris.blogs.pivotallabs.com

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Christian Sepulveda

High Concept

Christian Sepulveda
Saturday, April 7, 2007

Chris Risley, of Bessemer Venture Partners (bvp.com), first introduced me to
the idea of high concept. It is a term borrowed from the film and
television industry that summarizes a proposed idea and usually leads a pitch.
It is intended to evoke immediate interest and possibly understanding of the
idea. For example, YouTube could have been described as “user posted video on
the web”.

All too often, an entrepreneur over complicates the communication of her
endeavor. Besides her passion, she has been spending an enormous amount of
time contemplating, refining and planning her new business. So, she rushes to
explain all the richness and subtleties of the idea and how its
innovation will change the market. She may even assume that you can’t fully
appreciate the value of the idea without being told all its nuance.

It is true that complete understanding will take some time and exploration.
But this isn’t a prerequisite of interest and when pitching the idea to a VC,
friend and the target market, capturing interest quickly is critical. The
audience’s attention has to be earned and most will not have the patience of
suspending interest while lots of background and tangential information is
provided.

Herein lies the power of the high concept; it facilitates immediate interest
and understanding. The high concept doesn’t have to (and rarely will) capture
the breadth and richness of the idea, but some essence that makes a connection
with the audience. 

But is can also focus the entrepreneur and this focus is probably more
valuable than the mechanism of communicating the idea to others. Entrepreneurs
get easily distracted and assume, just as when communicating, their idea needs
full implementation before releasing into the market. What they presume is the
minimal feature set for a release tends to have fluff that could be
removed.

The high concept is a simple litmus test; how does feature X support the high
concept? This should not be a slavish rule but a sanity check. As Einstein
said, “Everything should be made as simple as possible, but not simpler.” This
focus can save an entrepreneur time and money, particularly at early stages
where time-to-market is paramount and final value propositions are still
emerging.

I have two favorite examples of high concept. In television, an NBC executive
asked Michael Mann to come up with a show based on the idea “MTV cops”. The
result was Miami Vice and I think it is clear how the show tied to the high
concept. In the Web 2.0 space, Meebo is “IM through a web page”. Simple and
concise, just like the actual product. I think many would envy Meebo’s
success and attention.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Topics

  • agile (778)
  • rails (113)
  • testing (86)
  • ruby (83)
  • ruby on rails (70)
  • jobs (62)
  • javascript (54)
  • techtalk (44)
  • rspec (38)
  • activerecord (29)
  • productivity (29)
  • gogaruco (29)
  • ironblogger (29)
  • git (28)
  • nyc (27)
  • rubymine (25)
  • mobile (22)
  • bloggerdome (20)
  • cucumber (20)
  • process (19)
  • pivotal tracker (19)
  • jasmine (19)
  • design (18)
  • ios (18)
  • webos (17)
  • objective-c (17)
  • android (16)
  • palm (16)
  • "soft" ware (16)
  • fun (15)
  • tracker ecosystem (15)
  • ci (15)
  • cedar (15)
  • rails3 (14)
  • performance (14)
  • bdd (14)
  • gem (13)
  • selenium (12)
  • css (12)
  • goruco (12)
  • bundler (12)
  • tdd (12)
  • meetup (11)
  • railsconf (11)
  • nyc-standup (11)
  • capybara (10)
  • mac (10)
  • mojo (10)
  • chef (10)
  • rubygems (9)
Subscribe to Community Feed
  1. ←
  2. 1
  3. 2
  4. 3
  5. →
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >