Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Alexander Murmann

Posts By

SF Standup 2012-02-14


Headless Selenium

Ken is running his integration tests in parallel on multiple Selenium instances. It's working well for him, but having 6 Firefox windows up, makes working on the machine a pain. So he is wondering if there is a way to run FF in headless mode on OS X.

It was suggested to change the Mission Control settings so that Firefox always comes up in a separate space.

Which Gems for Twitter and Facebook

Tim wants to know which gems are currently en vogue for posting to Twitter and Facebook.

The gems to use are still the twitter gem and the koala gem

Assigning Command + Esc

Expose used to be assigned to Command + Esc. Now that that's gone the key combination should be available to be linked to. However, it seems like the key combination still can't be used.


Capybara find(...) and stale elements

Davis's help from yesterday about stale element exceptions in Capybara got resolved. It turns out that Capybara cache find results. If you execute find twice and move the element between the executions, Capybara will complaint about a stale element, instead of running find again.

Capybara has_selector vs. has_no_selector

Capybara's has_selector and has_no_selector matchers will wait for the selector to match something, in order to deal with timing issues. When using the manually negated form not.has_selector Capybara can't know that it is supposed for the condition to become true. In fact it will be waiting for the element to be there instead of the element not to be there. So if a element is supposed to disappear and you are using not.has_selector to test that, by the time Capybara runs the matcher your element might still be there and Capbara returns true and you get an error, although the element would have disappeared shortly after. The has_no_selector matcher on the other hand would keep checking until the element disappeared.

Standup 05/26/2011


Disappearing SSH keys between bash sessions

Using ssh-add will make a ssh key available for a bash session. However, on our new OS X images the key will not be available in new bash sessions and has to be re-added. It was suggested to check the ssh-config to see if something is resetting the key.


MySQL gem on Ubuntu box

Compiling the mysql gem fails on an Ubuntu production box:

ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

If you first install libmysql-rubyand libmysqlclient-dev you will be able to install the mysql gem as usually.

Resque Heroku Autoscaler Gem

For my side project I needed some worker processes. My project is hosted on Heroku which makes it really easy to add workers. However, currently I am the only user of that project and don't need a worker to be running all the time. Automatically scaling the workers up when there are pending Resque jobs and scaling them back down once all the work is done seemed like to be the obvious solution to this. Googling immediately brought up a good blog post by Daniel Huckstep. As good as that solution looks, I don't like to have untested copy-and-paste code in my project. So I decided to test drive my own solution and put it into a convenient gem which of course can be found on Github as well.


In order for the scaling to work Resque Heroku Atoscaler (RHA) needs to know your Heroku app's name, your Heroku user name and your Heroku password. Per default those are being read from the following environment variables:


If you prefer you also can configure RHA using a config block. For example you might put the following into config/initialiazers/resque_heroku_autoscaler_setup.config

require 'resque/plugins/resque_heroku_autoscaler'

Resque::Plugins::HerokuAutoscaler.config do |c|
  c.heroku_user = 'john doe'
  c.heroku_pass = ENV['HEROKU_PASSWORD']
  c.heroku_app  = "my_app_#{Rails.env}"

To use RHA in one of your jobs, just extend your job class with Resque::Plugins::HerokuAutoscaler.

For example:

require 'resque/plugins/resque_heroku_autoscaler'

class TestJob
  extend Resque::Plugins::HerokuAutoscaler

  @queue = :test

  def perform
   ...awesome stuff...

When you add the job to your Resque queue, a new worker will be started if there isn't already one. If all jobs in the queue are processed the worker will be stopped again, keeping your costs low.

Changing Scaling Behavior

Per default RHA will only start a single worker, no matter how many jobs are pending. You can change this behavior in the config block as well:

require 'resque/plugins/resque_heroku_autoscaler'

Resque::Plugins::HerokuAutoscaler.config do |c|
  c.new_worker_count do |pending|

When calculating the new number of required workers the block given to new_worker_count will be called. Thus the example will result in starting one additional worker for every 5 pending jobs.

Please let me know if you run into any problems with the gem or can think of any features that might be helpful.

Standup 11/12/2010

Interesting - Local Search API deprecation confusion

Google deprecated their Local Search API and suggest to use the Maps API GoogleBar instead. However, as it turns out, the API GoogleBar is just a wrapper around the Local Search API, that was just deprecated. You could use the Google Places API instead, but that one is currently in developer preview only. What are we supposed to do Google? Googling it did not reveal any fully satisfying answer...

Standup 11/11/2010

Interesting - Attaching JQuery UI Datepicker

When attaching JQuery UI's datepicker you should not use the class hasDatepicker since JQuery UI uses this class to mark DOM objects that already have a datepicker attached. So it won't attach a datepicker to elements with that class.

Interesting - Solr score sort

It is possible to sort results in Solr using any criteria you want and use the Solr score for a secondary sort. Some people thought that you were only able to use the Solr score as your primary sorting criteria.

Standup 11/10/2010

Help - Request for PNG not working in IE7

We request a PNG via IE7 from inside Parallels, but the file doesn't get returned. The Nginx log just shows an empty line for the request. Suggestion: Look also in Nginx's error.log for the failing request. The request might be logged here and help find out what actually went wrong.

Interesting - Google Maps suggest canoeing and jet ski routes if your destination is across the ocean.

Jet ski from Shanghai, China to Kagoshima, Japan

San Francisco to Honolulu via kayak

Standup 11/9/2010

Interesting - Making ".*" in regular expressions less greedy

Sometimes .* in regular expressions matches more than we would like it too. Let's say you have a string that includes some numbers you want to extract from a string. Our string might look like this:

some text 123 more text

now we might try to use the following regular expression to get the 123.


However, this will only get us the 3. This happens because .* will match as match as possible. Adding a ? will change this to only match what is needed.


Now we get the 123 as desired.

A nice toll to experiment with regular expressions is Rubular allows you to see the effects of your regex in combination with an example string instantly.

Standup 11/8/2010

Help - Running my own gem server

Sarah will give a Ruby introduction class for kids at RubyConf. However, there won't be any Internet connection available, but the participants will need to install several gems. A solution to this problem is the gem geminabox which allows you to run a server providing gems. Other users who have geminabox installed then are able to install gems from that server.

Standup 5/13/2010


Webtoolkit Base64 encoding is wrong

If you need to do Base64 encoding/decoding in JavaScript, you likely came across this link (as it's the #1 Google hit for: "base64 enocde javascript"):

This code (for encode) works just fine as long as you're only dealing with strings whose contents are plain ASCII test (no high bits set).

But this code does a UTF encode before the Base64 encode. Which means that any characters with the high-bit set will get expanded first and your Base64 encoding will be wrong. For example, if you build a SHA1 encoded string and then Base64 encode it, you'll get a resultant string that's longer than the expected 28 bytes.

Our solution was to keep Googling around until we found some JavaScript Base64 code that did not do any Unicode expansion. Here's one that does the right thing - there are more, but are hard to find:

Factory Girl after_create

You might want to use factory_girl to create an object that includes another object. If both factory methods make use of the after_create callback the child's after_create will be called before the parent's. This behavior might seem unintuitive and you should keep this in mind working with factory_girl.

Ruby Mine running focused tests from inside context

It turns out that having shoulda anywhere in your project will break running focused tests from inside a context. This will also break ii you use a plugin that comes with shoulda.

Ruby Mine commit & push

Ruby Mine's behavior when using commit together with the push option might not behave as expected. For us it merged a branch and truncated all changes that had occurred on that branch since the last update.

WebKit JS treats "export" as keyword

One of the many unused keywords in JavaScript is "export". Firefox lets you use it since it's de facto unused. However, using "export" in your JavaScript will break your code in WebKit-based browseres.

Standup 5/12/2010

Interesting -- Tagging and Excluding of Filters in Solr Facets

You may want to use multi-select faceting to constrain the results shown for one facet but still want to see the values and counts of other facets that are not matched by your constraint. To solve this you often had to use two queries. Since Solr 1.4 you can tag and exclude filters and save the additional query.

Help -- Adding Memcached to Models

"I want to use memcached for my ActiveRecord models and am looking for recommendations on how to do this"

Of the available gems the memcached gem can be recommended. The memcached gem wraps the libmemcached client which is written in pure C. This implementation gives it a performance advantage over the memcached_client gem.