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
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
David Goudreau

Sass development at the speed of Javascript

David Goudreau
Thursday, June 10, 2010

Surrendering to Sass

I’ve finally gone all-out for Sass. The last thing that was holding me back was the speed with which I could make Sass file changes in RubyMine and see them in Firefox. I’d gotten so used to the ReCss bookmarklet being mapped to Ctrl-Z-Z using the ShortcutKey2URL Firefox addon that I couldn’t go from 0.1 seconds (using Javascript to reload my css files) to see my changes to 1 second (by doing a full-page refresh in the browser) to force Sass to recompile the css files.

Enter Erik Hansen, Javascript guru and all-around nice guy, for a 5 minute pair session where we added a synchronous ajax call to the ReCss bookmarklet to ‘/’ of our application to force Sass to recompile.

javascript:void(function(){var i,a,s;$.ajax({url: '/', async: false});a=document.getElementsByTagName('link');for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href) {var h=s.href.replace(/(&|%5C?)forceReload=d+/,'');s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf())}}})();

Note the

$.ajax({url: '/', async: false})

at the beginning of the line – we’re hitting the root of our application with a synchronous ajax call (using jQuery because our application uses it and it is available) to force the application server to return a response which consequently forces Sass to recompile all the sass files we’ve changed. It’s pretty darn fast. One caveat – if your ‘/’ action is slow on your site because it loads a bunch of models and such (it’s not yet on our site), you should be able to create a Sass action in your home controller that doesn’t do much anything and point the ajax call at that instead – you might wanna enable that only in development mode, too.

And by the way, I’ve also fallen in love with the FireSass Firefox plugin. It’s a must-have for Sass development.

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

Standup 6/3/2010: Jasmine bundled with RubyRacer

Pivotal Labs
Thursday, June 3, 2010

Interesting Things

Jasmine bundled with RubyRacer
Jasmine is now optionally bundled with the RubyRacer gem. This lets you run Jasmine tests through Google’s V8 engine in a browser-less environment. Similarly, some Pivots paired Jasmine with Johnson and env.js to produce JazzMoney. Right now, JazzMoney is the only headless testing tool for Ruby that has DOM support, but I’m sure RubyRacer has that in mind. You can find JazzMoney here.

Help

Does anyone know how to run specs with a certain name? We’re using RSpec to generate fixtures for our Jasmine tests and want those to be updated right before we run our Jasmine task.

You can set SPEC_OPTS with the ‘e’ flag and give it a string to match test names. Something like this: rake spec SPEC_OPTS='-e "should generate a fixture"'

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

Standup 6/2/2010: RubyMine integrates with Tracker

Pivotal Labs
Wednesday, June 2, 2010

Interesting Things

RubyMine Integration
RubyMine is integrating with Pivotal Tracker! Beta version 2.5 lets you follow stories through the IDE’s task tool and tags your source control comments with the current tasks. It’s nice to see the title of your current story as you work. I’m excited to see what deeper integrations lie ahead. This screenshot shows what it looks like selecting a story through the menu item Tools > Task > Open…
Selecting stories through open task autocomplete.

Preview Woes

In the the process of pulling assets out of a PDF we’ve noticed Preview crashes opening files larger than 45MB. Adobe Reader opens the same files without problems. Has anyone else had problems with Preview?

I ran into that issue and used the PDF optimizer in Acrobat to pull-out unnecessary markup and compress the images. That seemed to take care of the issue for Preview.

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

"Pivotal News Network" Highlights from May

Pivotal Labs
Wednesday, June 2, 2010

The Pivotal News Network has been going strong for six months (Pivots: talk to me if you’d like to share into the feed). Here are some highlights from May:

  • from Startup Product Development: Simple Now vs. Complex Later

When starting any software project, there’s an age old argument: should we build something simple that solves our current problem or should we use an existing product that’s more complex, but more feature rich, since we know that’s where we’re going to end up in the future?

…

an oft neglected repercussion of building too much too quickly is that the extra functionality can calcify your product and make it very rigid. Releases become more complex, new features take longer to implement and bugs take longer to fix. You can find yourself a prisoner of your product, maintaining functionality and features that no one ( or very few ) people use. It can demoralize a engineering team, making them more and more susceptible to the nuclear option: the big rewrite.

I think the tendency to lean towards a more exhaustive solution upfront comes from a time when the effort require to change software was much higher than it is today. When systems were written in C, C++, Perl or even Java, making changes was a large undertaking. The thought of possibly throwing away chunks of code was nerve racking. It represented a huge investment in time and money. However, with todays rapid development languages and frameworks like Ruby/Rails & Python/Django, the investment required to create something, both in time and money, is rapidly shrinking.

  • from Are you punching your users in the face?

Jeff [Patton]’s reply shocked me:

“The Ruby community cares about building high-quality apps, but doesn’t necessarily care about shipping high-value apps.”

Jeff went on to say that the Ruby community is obsessive about craftsmanship. This is a good thing, of course. We test. We write clean code. We take the time and care to build applications that are beautiful and do what our customers ask for.

Therein lies the rub: what customers ask for is rarely what they want, and almost never what they need. As Henry Ford put it, “If I had asked what people wanted, they would have said faster horses.” Or as I put it, your customer may pay you $1000 to deliver him a knuckle sandwich, but no amount of precision or strength training is going to leave you with a happy customer.

It turns out that constructing a high-quality application is not enough – you have to conceptualize and design an application that users will actually find useful. Doing this is every bit as difficult as constructing the software, if not harder. It requires a combination of research – generating new ideas from asking questions & identifying problems – and feedback – testing out ideas you’ve created. The Ruby & Agile worlds have been primarily focused on getting user feedback, without doing the all-important research.

  • from Agile Anti-Patterns: Democratic Design

Weeks ago, some people in the Ubuntu community got a bit disappointed with the distribution’s core team:

We are supposed to be a community, we all use Ubuntu and contribute
to it, and we deserve some respect regarding these kind of decisions.
We all make Ubuntu together, or is it a big lie?

We all make Ubuntu, but we do not all make all of it. In other words, we delegate well. We have a kernel team, and they make kernel decisions. You don’t get to make kernel decisions unless you’re in that kernel team. You can file bugs and comment, and engage, but you don’t get to second-guess their decisions. We have a security team. They get to make decisions about security. You don’t get to see a lot of what they see unless you’re on that team. We have processes to help make sure we’re doing a good job of delegation, but being an open community is not the same as saying everybody has a say in everything.

  • from Velocity as a Goal

    From my experience having velocity as a goal doesn’t make any difference to the motivation of the team which is often cited as the reason for referring to it as a target.
    In all the teams I’ve worked on people are giving their best effort anyway so they can only really have an impact on the velocity by doing one of the following:

    • Working longer hours
    • Cutting corners on quality (by less testing perhaps)
    • Finding a smarter way of working

    …
    In reality I haven’t noticed that people on the teams I’ve worked on pay that much attention to whether velocity is considered a target or not. People just do their job and we pretty much always have the same velocity each week regardless.

  • “If you split test every idea, you’ll end up with either porn or gambling.”

  • “Every time you convince a client to leave their Excel spreadsheets behind and use @PivotalTracker an angel gets his wings.”

More popular shared items:

  • 7 LESSONS LEARNED WHILE BUILDING REDDIT TO 270 MILLION PAGE VIEWS A MONTH

  • The Case for Git Rebase

  • “The best way to handover work is to leave a broken test for your colleague to fix.”

  • Nonblocking ActiveRecord & Rails

  • HTML5 vs Flash performance

  • How many lines of code does it take to create the Android OS?

  • The unimportance of product names (which got smacked down in the Google Reader comments)

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

Standup 6/1/2010: TextMate debugging & Hack Night

Pivotal Labs
Tuesday, June 1, 2010

Ask for Help

“Has anyone run into issues with TextMate’s ‘convert to RTF’?”

  • I think Yehuda just ran into that issue recently
  • As a work-around you could use the ruby UltraViolet

Interesting Things

  • Sarah Mei is hosting another SF Ruby
    Ruby Hack Night in
    our office
    tonight at 7PM
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Danny Burkes

Standup 5/27/2010

Danny Burkes
Thursday, May 27, 2010

Ask for Help

Recurring jobs

A pivot asked “what is the current state of the art in scheduling recurring processes?”

The first-order answer was simply “cron”, but then the conversation got interesting.

Cron has a few downsides-

  • Each task execution has to re-load the entire ruby/rails runtime, so, you pay a significant penalty in terms of startup time
  • Crontabs often don’t get checked into source control, so there ends up being little visibility into which jobs are running when

One suggestion to solve the visibility problem was to use the whatever gem, which allows you to express your cron schedules in a ruby DSL that can easily be kept in source control.

A suggested alternative that eliminates cron altogether is resque-scheduler with resque.

The upsides with resque-based scheduling are that all your schedule logic is expressed in ruby, and you don’t pay the ruby/rails startup penalty for each worker.

The downside is that it adds additional operational infrastructure for you to manage (the resque workers and the redis server(s)).

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Danny Burkes

Standup 5/25/2010

Danny Burkes
Tuesday, May 25, 2010

Interesting Things

  • Rails 2.3.8 is out, fixing HAML compatibility and no longer inadvertently requiring rails_xss.

  • RailsBridge Open Workshop Project is hosting Mighty Ruby Tuesday tonight in San Francisco. RailsBridge puts on workshops around San
    Francisco (and last week, in New York) that give women a safe place to learn programming, or if they’re already programmers, learn Ruby. Pivotal is a sponsor and we support this important effort to bring gender parity to the Rails community.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Danny Burkes

Standup 5/24/2010

Danny Burkes
Monday, May 24, 2010

Ask for Help

Identify and uploaded files

Running identify on uploaded files sometimes fails, because by the time identify gets hold of the file, the file extension has been lost (it has been written to /tmp or the like).

The suggested workaround was to see if the filename specified in the Content-Disposition header, if present, could be carried through to the temporary file.

Interesting Things

  • Amazon has recently introduced a reduced-durabilty pricing tier for S3 storage, with significant discounts available to those who can live with 4 9′s versus 11 9′s of reliability. This seems like a win for things like thumbnails, which can easily be re-created from the originals on the off chance that they were actually lost by S3.

  • Rails 2.3.7 is out, but it doesn’t play nice with HAML just yet. Projects using HAML should avoid upgrading until those incompatibilities are ironed out.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Nathan Wilmes

Standup 5/21/2010: validates_uniqueness_of and case sensitivity

Nathan Wilmes
Friday, May 21, 2010

Interesting Things

  • One of our clients had a large production issue due to a long-standing bug in Rails with case sensitivity.

Here’s the situation: Rails validates_uniqueness_of has a flag called :case_sensitive. This flag defaults to ‘true’, but can be flipped.

MySQL’s default collation is case-insensitive. As a result, queries will, in general, ignore case unless specifically overridden.

So one might imagine that setting :case_sensitive to false would be completely harmless in a standard MySQL application.

One would be wrong. Setting case_sensitive to false changes the query to lowercase the field in question, causing the MySQL database to ignore any indices it may have and turning the validates_uniqueness_of operation from something cheap and quick to something requiring a full table scan.

The open Lighthouse ticket on this issue is:

https://rails.lighthouseapp.com/projects/8994/tickets/2503-validates_uniqueness_of-is-horribly-inefficient-in-mysql

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Topics

  • agile (780)
  • rails (113)
  • testing (88)
  • ruby (83)
  • ruby on rails (70)
  • jobs (62)
  • javascript (55)
  • techtalk (44)
  • rspec (38)
  • ironblogger (32)
  • productivity (30)
  • activerecord (29)
  • gogaruco (29)
  • git (28)
  • nyc (27)
  • rubymine (26)
  • bloggerdome (23)
  • mobile (22)
  • process (21)
  • pivotal tracker (20)
  • cucumber (20)
  • 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)
  • css (13)
  • tdd (13)
  • selenium (12)
  • goruco (12)
  • bundler (12)
  • meetup (11)
  • railsconf (11)
  • nyc-standup (11)
  • capybara (10)
  • mac (10)
  • mojo (10)
  • chef (10)
  • api (10)
Subscribe to agile Feed
  1. ←
  2. 1
  3. ...
  4. 38
  5. 39
  6. 40
  7. 41
  8. 42
  9. 43
  10. 44
  11. ...
  12. 78
  13. →
  • 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 >