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: June 2010

Matthew Kocher

Standup 6/21/2010: A Monday morning assortment

Matthew Kocher
Monday, June 21, 2010

Help

A pivot asks if anyone has used any of the multitude of grid frameworks in a production site. Assorted developers have used and liked Blueprint, Compass and 960 grid. Blueprint was the most used, but no one had any complaints. It seems that often times people think they need a grid when really they just want a three column layout.

Interesting

Another pivot reports that they are very happy after setting “paste and match style” to the default behavior for Cmd-V. The peanut gallery pointed out that you might want to paste without matching styles occasionally, and it was decided this would be an acceptable use of the mouse when it was necessary. Read more at Thaweesak

And an anecdote

The paste and match style discussion reminded another developer of a time when they were trying to compare two things pasted from terminal. They learned the hard way that there are character encoding or other issues that caused cause the diff to not include all the differences that they were looking for.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Dan Podsedly

July 1 NY.TUG Meetup

Dan Podsedly
Saturday, June 19, 2010

The next scheduled meeting of the New York Tracker Users Group (NY.TUG) will be on July 1, at the Pivotal Labs New York office.

We will be giving an overview of the idea behind Pivotal Tracker and the common features. Based on time and interest, we’ll also go into more detail about advanced features, upcoming features, and the philosophy behind Tracker.

Beverages and light snacks will be provided.

Please RSPV soon, as space is limited.

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

Standup 06/18/2010: ActionMailer day

Pivotal Labs
Friday, June 18, 2010

Ask for Help

“How can I turn off logging of email attachments in ActionMailer?”

You’re not the only person ever to ask that.

Actionmailer’s deliver method looks like this:

     # File vendor/rails/actionmailer/lib/action_mailer/base.rb, line 473
473:     def deliver!(mail = @mail)
474:       raise "no mail object available for delivery!" unless mail
475:       unless logger.nil?
476:         logger.info  "Sent mail to #{Array(recipients).join(', ')}"
477:         logger.debug "n#{mail.encoded}"
478:       end
479:
480:       begin
481:         __send__("perform_delivery_#{delivery_method}", mail) if perform_deliveries
482:       rescue Exception => e  # Net::SMTP errors or sendmail pipe errors
483:         raise e if raise_delivery_errors
484:       end
485:
486:       return mail
487:     end

And the actual delivery methods look like this:

     # File vendor/rails/actionmailer/lib/action_mailer/base.rb, line 594
594:       def perform_delivery_smtp(mail)
595:         destinations = mail.destinations
596:         mail.ready_to_send
597:         sender = mail['return-path'] || mail.from
598:
599:         Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
600:             smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
601:           smtp.sendmail(mail.encoded, sender, destinations)
602:         end
603:       end

If you compare lines 477 and 601, you will see that they both hook directly into the “encoded” method on the Tmail object. If you want to fix this, you’re going to have to patch (or monkeypathch) ActionMailer


“Why is Selenium running tests before Jelly has finished loading?”

The answer to this was that Webrat has a waiting period, and if you have a long load time you need to increase it.

try this to fix your selenium timeout problem (in your selenium_spec_helper.rb or equivalent):

Webrat.configure do |config|
  config.mode = :selenium
  config.selenium_browser_startup_timeout = 60
end

Interesting Things

  • RVM hooks into Textmate.
    You can set up Textmate to run tests using an RVM Ruby. See this, for example.
  • There are WWDC videos on iTunes if you have a Developer account.
  • Garbage Collection: If you are using REE you need to pay attention to your garbage collection strategies. Even at low load levels it can make a difference in request time.
  • Syslog-ng templates: If you have multiple servers, and you are using syslog-ng and Splnuk (you should be) you can format your syslog-ng log lines using templates.
  • mail_safe: This is a gem that whitelists domains so all outbound email instead goes to you. Just install it and then
    config.gem mail_safe

    Of course, if you do this in production your emails won’t work. Use it wisely.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Adam Milligan

Keeping track of Cedar

Adam Milligan
Friday, June 18, 2010

If you’re interested in following the growth of Cedar, or just testing iPhone projects in general, you can join the public Cedar discussion group or follow Cedar on Twitter at @cedarbdd.

I’ll continue to write out my thoughts on the topic here, but I’d prefer to have a method of sharing information that anyone can post to.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Davis W. Frank

Standup 2010.06.17 Bagel Thursday Edition

Davis W. Frank
Thursday, June 17, 2010

Ask for Help

“What are people using in Rails apps for authentication via Facebook Connect?”

  • Devise
  • Janrain if you want something that can use many different social websites authentication; it also hooks up sharing, etc.

“There seems to be a bias against Rails Observers. Anyone know why?”

I want to use them, but whenever I look around people seem to say they don’t like them any more. Anyone know why?

“Is Pivotal Tracker crashing for you in Safari??”

This is a known issue but we’re having a bear of a time reproducing. We’re accepting Safari stack traces over email, with bonus points for figuring out how to send us Session cookies post-crash.

Interesting Things

  • When using Passenger in spawn mode (to fork your workers), post-fork you MUST reopen any outbound sockets for things like Redis, Memcache, etc. Otherwise all your other connections will use the same socket. And you won’t notice it until oddness starts to happen when under load and processes get the wrong responses.

  • For some time now, Google Chrome has been happily giving stack traces when using Jasmine! Firefox has always done this. If you’re keeping score, only Safari refuses to give you stack traces in your failing Jasmine specs.

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

Chef-solo is great. You might not need client/server.

Pivotal Labs
Wednesday, June 16, 2010

You should be doing automated configuration, period. Chef is a great automated configuration tool.

It has to be said, however, that chef has lots of parts, arguably an excess. If you google around for chef intros you see chef-solo referenced as a simple first step into “full” or “real” chef – chef client/server.

On our project we’ve built a mature web application, we’ve been using chef for over a year, and have never once felt the need for the client/server model, and we have no reason to expect to.

Here’s how we run chef manually:

cd ~/projectroot
git pull
chef/run.sh

(that’s it)

run.sh contains:

sudo sh -c "RAILS_ENV=$RAILS_ENV chef-solo -c chef/config/solo.rb -j chef/config/$RAILS_ENV/`hostname -s`.json"

We have capistrano (multi-server ssh tool) do the equivalent on deploy:

sudo [
  "cd #{app_root}",
  "export RAILS_ENV=#{self.variables[:rails_env]}",
  "chef/run.sh"
].join(" && ")

We deploy our code and update system config at the same time.

And that’s all we need or want.

Links:

  • Cooking with Chef 101 – a chef-solo-centric chef introduction
  • Chef wiki
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Standup 06/16/2010: Image Editor Showdown

Pivotal Labs
Wednesday, June 16, 2010

Ask for Help

“Can I make RVM operate in a system-global manner? I want to use it to change the system Ruby FOREVER

The feeling was that this is the opposite of what RVM is about (trying things without commitment and side effects, and going back to the default with ‘rvm system’). If you are trying to make a particular tool use a particular version of Ruby, RVM may work for you, but if you’re trying to change your system default, you need a different tool.

Here’s someone asking about replacing mac ruby with a compiled ruby.
It seems like there’s a lot of concern out there about replacing the ruby that comes with OSX, I haven’t seen any tools that get rid of all ruby installations, and unify on a compiled version. If you know of one, I’d like to hear about it!

There is more than GIMP and Photoshop out there

It can be dangerous to suggest a tool other that Photoshop to a designer, but for a developer Photoshop is often excessive. Here are some alternatives:

  • pixelmator: $60. There’s a 30-day trial, so don’t start it until you need it. Mac only.
  • Acorn: $50. There’s a free version, so try it whenever you want! Also Mac only.
  • There are also webapps that do image editing. Check out Aviary Phoenix and MugTug Darkroom and Sketchpad
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Davis W. Frank

Standup 2010.06.14: as_if Edition

Davis W. Frank
Monday, June 14, 2010

Interesting Things

If you are overriding to_json in any of your Rails models you should read Jonathan Julian’s blog post which explains the purpose of as_json vs to_json.

Choice quote:

Enter ActiveSupport 2.3.3. Now the creation of the json is separate from therendering of the json. as_json is used to create the structure of the JSON as a Hash, and the rendering of that hash into a JSON string is left up to ActiveSupport::json.encode. You should never use to_json to create a representation, only to consume the representation.

as_json is also easier to test because it returns a Ruby Hash instead of a String.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Adam Milligan

Cedar has moved to Pivotal's GitHub account

Adam Milligan
Sunday, June 13, 2010

For anyone following the Cedar project on GitHub, I’ve moved it from my personal GitHub account to Pivotal’s GitHub account. This isn’t a fork, it’s a new repository that from here on out I’ll use as the main Cedar repository.

If you’re following Cedar, please follow the repo on the Pivotal account. If you’ve forked it please re-fork from the repo on the Pivotal account.

After enough time passes I’ll probably delete the repo on my account and recreate it as a fork of the Pivotal repo. Sorry for the inconvenience.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Adam Milligan

The run loop

Adam Milligan
Saturday, June 12, 2010

When I started writing Objective-C for iPhone and iPad projects I started to hear about these mystical and all-powerful run loops objects. Everything seems to relate to run loops, all the class references talk about how one object or another depends on run loops, the most basic iPhone application documentation even talks about how the device starts and maintains the main run loop for you because it’s so important. However, I found few straightforward descriptions of what a run loop is or how it works.

So, I read Apple’s Threading Programming Guide. I read about timers and ports and sources, about the starting and stopping and timing out of run loops. After this reading, and a bit of thought, I realized that all the sound and fury surrounding run loops blinded me to the fact that they are actually very, very simple. To wit, run loops are a mechanism for single-threaded asynchronous programming. Sound familiar? Sounds to me a lot like JavaScript.

A lot was made during the recent WWDC of the difference between synchronous and asynchronous network programming, so as an example let’s consider an AJAX request in JavaScript. To get some information from a server you’d send off a request in one function, passing in another function (or functions) for the system to call when it receives a response.

makeARequest({onSuccess: function(response) {
  // do some success stuff.
}});

Your initial function exits, and while the request is making its merry way through the series of tubes between the client and your server the system is happily going about its business. But, it has its digital ear to the ground for your response, and when that comes back it calls your function. VoilĂ , asynchronicity.

That’s a run loop. It has event sources, like some form of network socket on which it listens for your server’s response; it has timers, in the form of setTimeout() and clearTimeout(). The Apple Core Foundation run loops take a fair bit more setup to use — the network request performed by those three lines of JS would involve NSURLConnection, NSURLRequest, some form of delegate object, etc. — but it’s exactly the same idea. It’s waiting for something to happen while you take a nap; when that something happens it tells you about it.

There is one extremely significant difference between the JavaScript implementation and the Core Foundation implementation, at least in my mind: testing. In JavaScript this type of asynchronous code isn’t a run loop, it’s just JavaScript. As such, when you run your tests your code does everything you’d expect it to do; it’s the same interpreter running the tests as the production code, after all. So, when your test setup reaches into your AJAX library and stubs out the part that actually talks to the network everything continues to hum along. If you want, you step behind the curtain and send fake responses back through the AJAX object.

In comparison, a Core Foundation run loop is a special construct that the system sets up for you. When you run an app on your iPhone the device takes care of all the setup, care, and feeding of the main run loop. So, in tests, you if you want to run code that depends on a run loop you have to start the run loop yourself. Worse, starting a run loop blocks the execution of your tests until you stop the run loop. So, if you stub out the network code that actually talks to the network your code may sit and wait forever for a response that can’t possibly come. If you set up your code to return a fake response before starting the run loop your code will receive that response, but the run loop will continue to run, potentially blocking your test code forever.

This is, in my opinion, a significant problem for testing Cocoa projects. Asynchronous programming using run loops is simpler than mucking about with threads, and largely endorsed by Apple via their frameworks. But, there’s no reasonably simple way to test code written this way. You could set up a test run loop with test-specific run loop sources or timeouts to prevent it from blocking forever, but that seems immensely complex when compared to the JavaScript implementation. I would very much like to see some support from Apple in the form of a stub run loop for test environments that provides mechanisms for passing fake data to run loop sources, freezing and incrementing time to test timers and delayed invocations, etc.

I’m interested to hear other ideas you’ve had for how to get around this, or test mechanisms you’d like to see from Apple.

  • 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. 4
  6. 5
  7. →
  • 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 >