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
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

“expect errors”

Phil Goodwin
Friday, February 8, 2013

Helps

"expect errors" when compiling Ruby with clang

Compiled Ruby with clang and the compile output contained a warning to "expect errors". Has anyone experienced these alleged errors?

One member or our audience said that they had compiled the same way and not experienced any problems.

Interestings

Update your rack gem

Nasty remote execution vulnerability.

rack.github.com

parallel_tests prepare task does not drop tables

If you're using parallel_tests, be aware that, unlike rake db:test:prepare, the rake parallel:prepare task does not purge the databases before it loads the schema. You'll only notice this if you're dropping tables – the dropped tables will stay forever in the parallel databases.

We have a fork that works properly. (Pull request coming soon.)
https://github.com/pivotal-gemini/parallel_tests

Events

02/15: Block Party

http://engine.is/blockparty

next Friday celebrating start ups in SF w/food trucks at lunch time.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 5/3/2012 Time, time and more time

Phil Goodwin
Thursday, May 3, 2012

Helps

“How do I avoid timing problems while doing integration tests on single page apps?”

  • Use a wait_until block with a selector which has not been cached.
  • Use a wait_until block with a piece of javascript using evaluate_script which you expect to return when your page is finished loading.
  • Use a wait_until block which waits for all AJAX to stop using $.ajaxStop().

Interesting

  • Time.parse(invalid) will throw an exception, but
    Time.zone.parse(invalid) will return nil. Because Time.parse is part of the Ruby library while Time.zone is part of Rails.
  • parallel_tests really does speed up your tests. It munges all the output together into an ugly mess though.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 5/2/2012 A hack a day…

Phil Goodwin
Wednesday, May 2, 2012

Interesting

  • Date.today is not aware of the local timezone, but Date.yesterday is. Use Date.current or Time.zone.now instead.
  • Hackathon May 12-13 for mobile game development. More info
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 5/1/2012 Coping with external APIs

Phil Goodwin
Wednesday, May 2, 2012

Helps

“How do I not use VCR with Webmock in a spec?”

Use VCR.eject_cassette, see: docs

“Facebook now expires all tokens after 60 days. If you schedule a task with Facebook in the future it may use the expired token. Any solutions?”

Sadly there is nothing you can do. Send the user an email to re-auth.

“Good way to get replies on Twitter?”

Nope. Crawl thorough all your mentions, to get to your replies.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 4/30/2012 Facebook and Unicorns

Phil Goodwin
Monday, April 30, 2012

Helps

“How do I prevent Facebook from kicking out my “demo” user when all the devs are logging into that account multiple times a day?”

Some people have had luck with creating that kind of account dynamically on a per use basis.

“How do you make sure unicorn restarts when running under runit?”

A project is running Unicorn under runit, and finding it doesn’t always restart when it’s told to. It seems Unicorn just isn’t responding to the signal. No one had seen anything similar.

“Can heroku_san automate the managing of my addons?”

Update to the newest version! See the github pull request

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 8/30/2011 Cruisin’ for trouble

Phil Goodwin
Tuesday, August 30, 2011

Helps

*Why is Cruise Control green when my tests are failing?

Probably because the rake task running the tests returns zero. Cruise Control relies on the exit code of the processes it runs to determine whether to report success or failure. This seems like a common Cruise Control pitfall. It’s good practice to run a failing test through Cruise Control during initial set up in order to avoid this problem

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 5/27/2011 Hack For Change, Guiderails goes public, Jenkins & Jasmine jems

Phil Goodwin
Friday, May 27, 2011

Helps

*Is there a way to change the URL that CCRB pulls from when it builds?

“Use Jenkins” (we will be standardizing on Jenkins in the near future anyway)

Apparently the answer has been found successfully in the past by grepping through the Ruby portion of the CCRB source.

Interesting

  • Hack For Change, sponsored by Change.org is inviting engineers and designers to spend 24 hours to build a web or mobile app that can help advance positive change. Top-rated hacks will be awarded a total of $10,000 to ensure their continued success and will gain recognition through widespread media coverage and promotion. http://hackforchange.com

  • Guiderails: Pivotal’s Rails 3 Templates, has been made publicly available on GitHub. https://github.com/pivotal/guiderails

  • While there is not consensus on how hash tags in URLs that are being redirected should be handled, Safari stands apart from most other modern browsers by throwing them away entirely.

  • When configuring a new project for Jenkins, remember to specify the branch to build, otherwise Jenkins will try to pull and build all branches from the repo.

  • Jasmine has a bug in its “runs and waits for” construct that causes it to ignore changes to the defaults for the timer and message on the “waits for” block.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 5/25/2011 Cloudfront logs, terrible YAML, and RubyMine can CanCan

Phil Goodwin
Wednesday, May 25, 2011

Helps

*Is there a way to log in and download log files from Cloudfront, preferably programmatically? They can be obtained from the management console but access is needed from the command line.

Interesting

  • In Ruby 1.9.2 the delayed_job facility uses the Psych parser to serialize and Syck to deserialize the delayed job, with unpleasant results. One way to solve the problem is to go into the Ruby installation and “if false” away the Psych source code, it’s an admittedly terrible approach, but it has the appeal of actually working.

  • Ruby Mine does not behave well with CanCan out of the box.
    The problems can be fixed by editing the CanCan Ruby file and commenting out the line that sets rspec equal to spec unless rspec is already defined.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 12/17/2010 Comparing indexed date columns, git subtrees, Headless Selenium for CI

Phil Goodwin
Friday, December 17, 2010

Helps

Is there a way to get MySql indexing to speed up queries involving greater and less than operators on date columns?

Postgres handles these operators a little bit better than MySql, but may not actually solve this problem.

Using millis instead of dates would give the DB the best chance of handling this scenario.

We are using Git’s subtree merge facility instead of submodules to stay synced to a different repository for part of our project. How do we push changes back to that repo?

See Tim Connor’s blog post “Git sub-tree merging back to the subtree for pushing to an upstream“. Early in that post is a pointer to an article describing the the subtree merge operation. Tim goes on to explain how to push your changes back through the chain.

Interesting

  • Some cloud environments leave the names of temp files visible even when their contents are not accessible. Be sure to use obfuscated names for your temporary files!

  • The “Headless” gem allows you to easily set up an alternate “display” that allows programs to execute in a headless environment. See this blog post about how to use Headless to run Selenium tests on a CI box: http://www.aentos.com/blog/easy-setup-your-cucumber-scenarios-using-headless-gem-run-selenium-your-ci-server

  • Ccrb will bog down to painfully slow levels if more than a couple of CC Tray clients are pinging it repeatedly during a build.

  • Cron will not honor your .rvmrc file unless you do some work to set up the environment. If you set up your cron job like this:

0 6 * * * /bin/bash -l -c 'echo /home/someuser/.rvm/bin/rvm rvmrc trust ... && cd ... 

the -l & -c parameters cause bash to load your environment as if your were logging in before running the specified commands. Someone also mentioned that rvm-shell can be used as a solution to this problem.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 12/15/2010: :Include… everything

Phil Goodwin
Wednesday, December 15, 2010

Interesting

  • Problem: Select includes “*” by default, so selecting by specific column names does not work

If you write:

class Thing < ActiveRecord::Base
  has_many :posts
end

class Post < ActiveRecord::Base
  default_scope select(column_names - ['body'])
end

Thing.includes(:posts).all does the following for the posts query:

SELECT id, fk_column_id, column1, etc, posts.*
FROM posts
WHERE (pages.fk_column>in IN(1,2,3))

It takes the default select scope, but also appends posts.* to the end of it.

This is caused by the :select find_option in the find_associated_records inside of association_preload.rb. This is what it is now:

:select => preload_options[:select]
                || options[:select]
                || Arel::SqlLiteral.new("#{table_name}.*")

It seems like the third || case is not needed, since that is the default for any select and it causes the above behavior.

Joseph Palermo has filed a ticket with Lighthouse about this…

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Phil Goodwin

Phil Goodwin
San Francisco

Subscribe to Phil's Feed

Author Topics

agile (8)
clang (1)
db (1)
party (1)
rack (1)
ruby (1)
ccrb (3)
events (1)
jasmine (1)
jenkins (1)
open source (1)
ci (1)
database (1)
git (1)
headless (1)
rvm (1)
selenium (1)
shell (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • 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 >