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
Joe Moore

Standup 10/9/2008: IE 6 Alpha Transparency Fixes?

Joe Moore
Friday, October 10, 2008

Ask For Help

Once again, a project is asking for everyone’s favorite IE 6 .PNG alpha transparency fixes — more rounded corners! Examples include the CSS Behavior code, using .PNGs or .GIFs with on/off transparency, regulating IE 6 to the square Web 1.0 world, and even using on/off transparency and just knocking a pixel or two off of corners for a “good enough” rounded look.

What are your favorite IE 6 rounded-corner and/or alpha-transparency fixes?

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

Standup 10/8/2008 – testing Flash and routing helpers

Nathan Wilmes
Wednesday, October 8, 2008

Ask for Help

One of our clients is looking for high-quality third-party chat services/libraries.

Interesting Things

10.5.5 and screen sharing

The Mac screen sharing application includes a host of interesting power features. Unfortunately, upgrading to Mac 10.5.5 causes these features to go away. Workarounds at this point are to store off the application and re-install it. Or to pay $300 for the official solution. Whichever.

Additional routing-related helper methods

It can be useful to create helper methods designed to extend the routing helpers offered by routes.rb.. power “_path” and “_url” methods. While the easy solution is to define these methods in your view helper layer (the most common client of these methods), a more complete solution is to use a pattern like this:

in routes.rb:

          ActionController::Routing::Routes.draw do |map|
               ... normal routes ...
          end

          ActionController::Routing::Helpers.module_eval do
             def additional_method_name
              ...
             end
          end

Any methods added to ActionController::Routing::Helpers will be available in all of the same places that named routes are defined – controllers, views, and ActionController::UrlWriter includers.

Testing Flash in Selenium

Most Flash applications render an inline image in addition to the Flash itself. This image updates as the Flash updates, and appears to be used for caching purposes.

When you’re test-driving, you can make assertions about when this inline image updates to test Flash behavior. The image is binary, so it’s hard to make assertions about exactly what has changed.. but it’s a start.

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

Standup 10/7/2008 – Namespaces, class names, and PostGRES

Nathan Wilmes
Tuesday, October 7, 2008

Ask for Help

When using a namespaced controller, it’s hard to get url_for to work with it. Why is that?

  • The controller option for url_for attempts to apply the namespace of whatever controller context it’s inside. So if you have an Admin::MyController class, here’s what you would need to do for url_fors to this controller:

    • from within an Admin controller class: :controller => "my"

    • from outside an Admin controller class: :controller => "admin/my"

    • for a partial that is used all over the app: :controller => "/admin/my" seems safest
  • Most of us now avoid using url_for-style hashes for our links and URL references. Named routes are a lot more dependable.

  • It is possible to generate a namespaced URL from a model reference, if you are careful.

    • This approach assumes that your controller class names correspond to your model class names.
    • If your model is @model, and your controller is Admin::ModelsController, you can use a helper like the following:

       form_for [:admin, @model] do |f| ... end
      
    • This approach can limit your design, if you rely too heavily on this convention.

Interesting Things

How to read your class’s name

While working with the UltraSphinx plugin, Davis and Brandon learned that Class.name didn’t always give them the right results. Some of their classes had a class method override what Class.name returned.

Class.class_name came closer, but returns the base class for STI (single table inheritance) classes.

Class.to_s was their most reliable option.

Testing your app on both MySQL and PostGRES

David S. is working on a plugin that allows you to test your environment on multiple databases. Since we’re starting to have more projects using PostGRES, we’re uncovering situations where some of our common code makes too many assumptions about running on MySQL.

Slutty namespaces

A couple of projects ran into mysterious issues where some of their namespaced controller classes would not load when run from rake.

The culprit was that their namespace module names were the same name as their app models. The lesson – never have a module with the same name as one of your other unrelated classes. (No, I’m not talking about inner classes, which can be fine).

A prime example of this is an Admin::* namespace coexisting with an Admin model. This will cause strange problems depending on what order the classes are loaded. One recommendation is to pluralize your namespaces. In this case, your namespace would be Admins::*.

Another suggestion would be to use an extended noun form for your namespace (Administration::*). Whatever convention you use, stick to it and avoid name collisions.

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

Standup 10/6/2008 – Namespaced controllers and MySQL ordering

Nathan Wilmes
Monday, October 6, 2008

Ask for Help

David and Jonathan are having trouble with testing namespaced controllers using RSpec. They have two controllers, Admin::MyController and SuperUser::MyController, and the RSpec tests appear to be finding the wrong controller.

Their short-term solution is to put a manual require in the spec that was getting confused.

UPDATE – The issue turns out to be a naming conflict. The app has a model named SuperUser, and the existence of this model can cause class loading to be confused for SuperUser::* controllers. In Socialitis, our standard is to use plural names for controller namespace names, to prevent this sort of confusion.

Interesting Things

Steve has learned that, in general, it’s a good idea to avoid using offsets when manipulating large quantities of data in MySQL. Luckily, some of MySQL’s quirks help with this:

  • MySQL sorts indexes. The primary key is the main index that it sorts.
  • Any select without an explicit order clause will pick an index, then return data in sorted order by that index. Again, usually you’ll see the primary key first.
  • You can take advantage of this behavior to paginate through a large dataset where the order doesn’t really matter. The following statements perform better than your typical LIMIT/OFFSET clause:

    SELECT * FROM big_table WHERE id > 1 LIMIT 1000
    SELECT * FROM big_table WHERE id > 1000 LIMIT 1000
    SELECT * FROM big_table WHERE id > 2000 LIMIT 1000
    
  • acts_as_solr uses this technique for reindexing.

  • Also, inserting a record in the middle of an id ‘hole’ is not a very good idea in MySQL, because the database then puts a great deal of work into reordering all of the later records.

Here’s a link to a related blog post:
http://weblog.jamisbuck.org/2007/4/6/faking-cursors-in-activerecord

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

Standup 10/2/2008: rspec running describes in order

Pivotal Labs
Thursday, October 2, 2008

Interesting Things

  • Rspec – stubbing a class method

In Rspec you can stub a class method in a module using Module::Class:Stubs(’method’) similar to Mocha syntax
stub! does not work for Module::Class:method in rspec

  • Rspec – running test in order

If someone knows of a way to run describes in order in rspec test, please let me know

Ask for Help

“Finder conditions in rails?”

    find(:all, :conditions => 'flag is null')  where flag is boolean

This would work in tests but not in development mode. They tried changing it to

    find(:all, :conditions => 'flag != 1')  where flag is boolean

and this would work in dev mode but not in test.

Try having boolean values in database as not null and never pass null to boolean.
Make sure fixtures and development data have similar data sets.

“Selenium tests failing to load associations”

Check if you RAILS_ENV is set to test while running Selenium. There has been some cases of weird rails behavior running tests when RAILS_ENV is set to development

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

Standup 10/01/2008: where is the to_date function in ruby/rails world?

Pivotal Labs
Wednesday, October 1, 2008

Interesting Things

  • One of the teams was trying to reopen the Time class to make to_date public. Another pivot noticed that there is no built in to_date in Time class in ruby. ActiveSupport has a to_date method on Time class that is public. The most interesting one is that there is a private to_date that is added to Time class when you include Yaml.

  • We have git brown bag today on how to use git with the Pivotal Process.

Other stuff

  • We are looking for one more unix system administrator preferably with scalability experience to help with our infrastructure. The job description is here. Well there are obvious benefits and then there is also free breakfast :)
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Pivotal Labs

Standup 09/30/2008: svn log slowness; tech talk videos

Pivotal Labs
Tuesday, September 30, 2008

Interesting Things

  • svn log takes a long time when you have recently committed a large number such as 5000 files.
    Specifically, this happens when you have path based security. Here’s a link from the subversion documentation that mentions this

    All of this path-checking can sometimes be quite expensive, especially in the case of svn log. When retrieving a list revisions, the server looks at every changed path in each revision and checks it for readability. If an unreadable path is discovered, then it’s omitted from the list of the revision’s changed paths (normally seen with the –verbose option), and the whole log message is suppressed. Needless to say, this can be time-consuming on revisions that affect a large number of files

  • Check out the new links at pivotallabs.com

    • Talks lists all the tech talks that happen here at Pivotal such as Blaine Cook’s Fire Eagle talk. If you have some cool technology and would like to give a talk, contact us at techtalks@pivotallabs.com
    • Who lists all the great people who work here
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Dan Podsedly

October 's NYC Ruby Happy Hour is next Wednesday

Dan Podsedly
Friday, September 26, 2008

Next week is the first Wednesday of October, and that means another New York City Ruby Happy Hour, sponsored by Outside.in and Pivotal.

Where: Outside.in, 20 Jay St Suite 1019 (10th Fl), Brooklyn, NY
When: 7-9PM, Wednesday September 3rd
Who: If you’re a developer who uses Ruby and would like to meet some other Ruby folks, toss around ideas, or just have a few beers, we welcome you with open arms!

There will be pizza, beer and wii-based entertainment for everyone. Click here for more details, and to RSVP.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
David Stevenson

Standup 09/26/2008: proxy_target vs load_target

David Stevenson
Friday, September 26, 2008

Interesting Things

  • When defining an extension to an association, you can access the loaded association data through proxy_target. If the data hasn’t been preloaded/loaded when you call this method, it will return []. If you’d like to manually load the target, you can call load_target, and you can call loaded to determine if the proxy data has been loaded. For most situations, however, you can rely on the association to load itself when necessary by calling methods on self as follows:
has_many :people do
  def bad_people
    self.select {|person| person.bad? }
  end

  # exact same situation as 'bad_people', but 2x worse code
  def good_people
    load_target unless loaded?
    proxy_target.select {|person| !person.bad? }
  end
end
  • There’s no good way to use CSV fixtures and has_and_belongs_to_many associations, in such a way that they are easily understandable and editable by non-technical people. Foxy fixtures solved a lot of issues with fixtures, but those advantages only work with YAML fixtures. Hence, if you have a HABTM situation, you’re stuck building a lot of rows of CSV referencing arbitrarily chosen IDs across several different files.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
David Stevenson

Standup 09/24/2008: Why does my JVM crash running SOLR?

David Stevenson
Thursday, September 25, 2008

Interesting from yesterday

The difference between new-style-includes (rails 2.1+) and old-style-includes in rails is the size of the query. In the old style, rails selects all the data from all the tables in a single query, using some crazy renames that look like this:

SELECT users.id AS t1_r1, users.name AS t1_r2,
profiles.id AS t2_r1, ...
FROM users
LEFT OUTER JOIN profiles ON profiles.user_id = users.id

This can get really bad if you :include multiple has_many associations, because the number of rows multiplies rapidly! In the new-style-includes, ActiveRecord does one SELECT per table like so:

SELECT * FROM users
SELECT * FROM profiles WHERE user_id IN (1,2,3,4,5,6)

More queries, but each one returns a small number of rows, and overall is a big performance improvement. The problem comes when you add :conditions that reference tables you :include. The new style will attempt to write this query:

SELECT * FROM users WHERE profiles.gender = 'M'
# ERROR - no table profiles!

So, you can make all your includes faster as long as you don’t have any :conditions, :order, or :select clauses that select from tables other than the base finder table. In our case, we hardcoded this check to always use the new-style-includes, manually ensuring that we don’t fall into these failing situations.

Ask for Help

“Why does my JVM seg. fault when running SOLR?”

Virtual machines should never segmentation fault! It’s probably a JVM/OS/library issue, so check try a different version of the JVM and check that it has all it’s proper dependencies. Alternatively, try a different VM entirely.

“Is there a way in Excel to ‘reshape’ 2D data?”

If you have an NxM matrix in Excel, you can transpose it to a MxN matrix easily. But if you want to convert it to a (M/2)x(N*2) through a reshaping you’re probably on your own. You could open it in ruby and reshape the arrays that way…

  • 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. 58
  5. 59
  6. 60
  7. 61
  8. 62
  9. 63
  10. 64
  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 >