Help

  • Determining a users default time zone - someone must have solved this already, right? Well, Javascript only gives you the time offset, which isn't that useful, but Fleegix has some good support we've used on other projects.
  • The after_commit gem - we wanted to create an audit entry every time a particular model failed to create successfully. We tried using the after_rollback hook in both our tests and our development environment but it just didn't work. The before_rollback callback also didn't work, but the non-rollback callbacks in the gem seemed to behave. Anyone have any thoughts outside of overriding ActiveRecord ourselves?

Interesting Things

  • Vows - real async Javascript testing for Node.js. Jasmine does support some async testing, but it sounds like it's a bit clunky to do.
  • Using RVM on the server - is anybody doing this? Apparently not yet, but we had some strongly differing opinions on the matter as to how useful it would be and if it's the right tool for the job. To be continued...
  • Rails 2.3.8 + mongrel_rails + Rack 1.1.0 - cookies do not work. At all. Apparently with Rack, cookies get fed into mongrel_rails as an array, while Mongrel expects them to be a String. Looks like someone already ran into this. The fix is to throw this in a Rails initializer file:

    class Mongrel::CGIWrapper
      def header_with_rails_fix(options = 'text/html')
        @head['cookie'] = options.delete('cookie').flatten.map { |v| v.sub(/^\n/,'') } if options.class != String and options['cookie']
        header_without_rails_fix(options)
      end
      alias_method_chain(:header, :rails_fix)
    end if Rails.version == '2.3.8' and Gem.available?('mongrel', Gem::Requirement.new('~>1.1.5')) and self.class.const_defined?(:Mongrel)
    

    (As an aside, running mongrel_rails by using script/server works fine, we only found this issue when running our Webrat Selenium tests, which calls mongrel_rails in some different way that causes this bug to be exposed.)

Dan PodsedlyDan Podsedly
Chicago Tracker Users Group (CHI.TUG) meetup on Jul 22
edit Posted by Dan Podsedly on Tuesday June 29, 2010 at 03:57PM

We're forming a Tracker User Group in the windy city, and the first meetup is scheduled for Jul 22, at the Hashrocket Chicago office.

I'll be there to talk about the concepts and history behind Tracker, our experience with it, and will give a demo to those that are interested. It's a great place to give feedback and ask lots of questions.

Space is limited, so RSVP soon.

David GoudreauDavid Goudreau
Standup 6/29/10 - EngineYard Redis change
edit Posted by David Goudreau on Tuesday June 29, 2010 at 09:47AM

Help!

  • Ey cloud deploy - has anyone done a deploy to EY cloud and seen the Mongrel instances not get bounced?
  • Does anyone have any tips on testing distributed applications? We're looking for the least ugly/painful way to do it well.

Interesting Things

  • Rvm and sudo - for goodness sake don't do it.
  • Sass not recompiling on deploys - a few of our projects have seen Sass files not recompile/update for some reason that we've yet to track down. So instead of spelunking through Sass code we just force the issue by having a rake task that forces the recompile - see this post for details.
  • Rails xhr redirect - one of our projects is using the xhr_redirect plugin to support ajax redirects - careful if you want to use it in your tests - it self-destructs if your Rails environment == 'test'
  • Android meetup tonight at 6:30 PM - check out the details.
  • New Redis recipe from EY - following up from yesterday, the new EY recipe to set up Redis appears to work fine with a little tweaking.

David GoudreauDavid Goudreau
Standup 6/28/10 - EngineYard Redis change
edit Posted by David Goudreau on Monday June 28, 2010 at 09:45AM

Interesting Things

  • Redis at EngineYard - EY recently fixed a bug in their system chef scripts that was unintentionally installing Redis, so if you're relying on it being there you may find it missing on your next deploy. EY has apparently just added a recipe for running Redis on a utility slice in ey-cloud-recipes. We haven't tried it out yet but at first glance it looks ok. This new recipe doesn't support running Redis on a solo instance, but it doesn't look too hard to change it to do that.

  • Library reorganization - we here at Pivotal have a library of books we let people 'check out'. We've just reorganized it a bit. Let our local librarians know if it's working for ya.

  • Mobile meetup - there's a mobile meetup tonight from 6-8 PM tonight at Horatius in Potrero Hill. They're expecting people from top mobile companies including entrepreneurs, application developers, designers, marketing/business, etc - please RSVP at the Facebook to attend.

Dan PodsedlyDan Podsedly
Pivotal Tracker scheduled weekly maintenance
edit Posted by Dan Podsedly on Wednesday June 23, 2010 at 02:07PM

For the next month or so, we will be rolling out a series of changes to various parts of the Tracker server architecture, including moving to a Memcached distributed cache for certain requests, cookie based sessions, switching from Mongrel to Passenger, splitting the very large history table, etc.

We're doing this to improve performance, and eliminate potential scaling issues as our traffic grows. To reduce risk, we'll introduce these changes in separate updates, once a week.

These updates will occur on Wednesdays at 7:30pm PDT (including tonight), and last under an hour each. If there are any long running migrations needed, we'll plan them for weekends, or handle them incrementally, to avoid any extended down times.

We understand that these week night outages are inconvenient to many of you, especially in Asia. We apologize in advance, and will try and keep the updates as brief as possible.

Matthew KocherMatthew Kocher
Standup 6/23/2010: Mock what isn't there
edit Posted by Matthew Kocher on Wednesday June 23, 2010 at 09:16AM

Help

  • Is there a reason why java on 64 bit linux doesn't seem to go above 4GB of ram even if it's given more? Some docs say that 2GB is the max, which is clearly not the case. Other projects report they have JVMs as large as 12 gigs. The search for a reason for the OOM errors goes on.

  • How do you mock the backtick or array operator with RR? This is done in rspec by mocking the symbol on the class that it's being called in, but it's not obvious in RR. Suggestions included finding a different way to test the behavior, wrapping the system call in a function that's easily mockable, or investigating another way to shell out.

Interesting

  • Free Ruler, the measurement tool of choice for pivots who need more than the pixels measurements of Command-Shift-4, doesn't just know the pixel density of the display it's running on. 20" Aluminum iMacs are significantly different from what it assumes.

  • The Jasmine javascript BDD testing framework project was jealous of the newcomer Cedar's @cedarbdd twitter. They've struck back by creating @jasminebdd. You can follow both for updates, announcements and tips.

  • Some devs working on a mobile JS app recently discovered Prototype's wrap function after implementing the same thing many times before. They did preface this with "is anyone else still using Prototype" so as to not offend the jQuery zealots.

Matthew KocherMatthew Kocher
Standup 6/22/2010:
edit Posted by Matthew Kocher on Tuesday June 22, 2010 at 09:25AM

Interesting

  • Don't put your expectations on a proxy, as the proxy might not get called in your code as the proxy may have turned into a real object by the time you use it. The right thing to do is to put your expectations on your proxy target, and you can do this on either either the target or proxy_target of the proxy object. Proxy_target is strongly preferred by some pivots.

Help

  • One project in the office is deploying varnish to EY Cloud, and was wondering if anyone else had gone down this path before. There is a EY Cloud chef recipe for varnish, but it is not supported thus changes with EY cloud may break it in the future.

Danger

  • A pivot warns that the recent facebooker gem (1.0.70 and 1.0.71) come with a gemspec that reports version 1.0.67. This causes bundler and RubyMine to both be very confused. If you find yourself in this situation complain loudly and then remove all previous version from your system.

Matthew KocherMatthew Kocher
Standup 6/21/2010: A Monday morning assortment
edit Posted by Matthew Kocher on Monday June 21, 2010 at 02:00PM

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.

Dan PodsedlyDan Podsedly
July 1 NY.TUG Meetup
edit Posted by Dan Podsedly on Saturday June 19, 2010 at 07:45AM

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.

Michael SofaerMichael Sofaer
Standup 06/18/2010: ActionMailer day
edit Posted by Michael Sofaer on Friday June 18, 2010 at 02:48PM

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.

Other articles: