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
Nathan Wilmes

Standup 5/20/2010: More about SEO routes

Nathan Wilmes
Thursday, May 20, 2010

Ask for Help

“Any clever ways to catch out of bounds exceptions from Solr?”

This is a follow-up to yesterday’s Solr question. After some investigation, it looks like none of the major providers catch out of bound exceptions for very large numbers. Rather than instrumenting every Ruby call with validations to prevent these numbers from getting into Solr, are there any other brilliant ideas?

Interesting Things

  • Follow-up to the help from 5/19/2010′s SEO routing question. The latest hotness appears to be FriendlyId (http://github.com/norman/friendly_id) This plugin makes human-friendly slugs and comes with a variety of interesting features, including versioning and slug scoping.

  • Power RubyMine commands:

Goto File + line #: If you use ctrl-shift-N to go to a file, try typing in a line number after a colon, something like “my_file:30″. You’ll end up on that line.

Analyze stack trace: This tool lets you paste in an external stack trace, and gives you the ability to browse to all of the pieces of that stack trace.

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

Standups 5/18/2010 and 5/19/2010: SEO routes

Nathan Wilmes
Wednesday, May 19, 2010

Ask for Help

“Our site requires crafting URLs in a very particular SEO-friendly way. Rails doesn’t seem to give us a good solution for our URLs. Any suggestions?”

One of our clients needs to make their app accept and generate compound URLs that look something like the following:

http://my.site/jkrowling-series-harrypotter-book-1

where author, series, and book are all different domain concepts. Rails RESTful resources don’t really support this format. There wasn’t an immediate solution, but among the peanut gallery of ideas:

  • Hyphens are better than slashes in URL crafting, but Rails doesn’t separate on slashes at all

  • to_param solutions – Overriding to_param to something that starts with an integer ID generates URLs that look very slug-like, but can use standard Rails Domain.find mechanisms. For example, a book.to_param might be overridden to be “1-bookname”, which works for all purposes. The problem with this solution is that it doesn’t quite fit the requirements here, and doesn’t cover the compound needs.

  • Custom routes are always a possibility. You can hook up a special (non-resource) controller that understands flexible browse-y routes like the one above, parses them, and delegates to the more standard resource controllers. The problem here is that you have to figure out a decent delegate pattern and route generation pattern.

  • In general, URL crafting is a separate art from domain model crafting, and Rails doesn’t really cater to this. You will have to design URL-centric code to suit your URL crafting.

“Any ideas on ways to performance test IE7?”

No immediate ideas, but potentially more later.

“When users enter very large search parameters for numbers we get the following exception out of RSolr:”

RSolr::RequestError: Solr Response: For_input_string_11111111111111111111__javalangNumberFormatException

Is there an elegant solution to this aside from validating that all input parameters aren’t larger than max int?

Interesting Things

  • When using named scope methods that refer to other named scope methods, you may discover that your SQL has some redundant condition clauses. This is a bug in Rails 2, and has been true for several versions. However, it’s a harmless bug – MySQL will understand the extraneous condition clauses just fine, without performance implications.

  • Mocking Paperclip for tests is a careful art. See our other blog post: Stubbing out Paperclip ImageMagick in Tests

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/13/2010

Alexander Murmann
Thursday, May 13, 2010

Interestings

Webtoolkit Base64 encoding is wrong

If you need to do Base64 encoding/decoding in JavaScript, you likely came across this link (as it’s the #1 Google hit for: “base64 enocde javascript”):

http://www.webtoolkit.info/javascript-base64.html

This code (for encode) works just fine as long as you’re only dealing with strings whose contents are plain ASCII test (no high bits set).

But this code does a UTF encode before the Base64 encode. Which means that any characters with the high-bit set will get expanded first and your Base64 encoding will be wrong. For example, if you build a SHA1 encoded string and then Base64 encode it, you’ll get a resultant string that’s longer than the expected 28 bytes.

Our solution was to keep Googling around until we found some JavaScript Base64 code that did not do any Unicode expansion. Here’s one that does the right thing – there are more, but are hard to find:

http://nerds-central.blogspot.com/2007/01/fast-scalable-javascript-and-vbscript.html

Factory Girl after_create

You might want to use factory_girl to create an object that includes another object. If both factory methods make use of the after_create callback the child’s after_create will be called before the parent’s. This behavior might seem unintuitive and you should keep this in mind working with factory_girl.

Ruby Mine running focused tests from inside context

It turns out that having shoulda anywhere in your project will break running focused tests from inside a context. This will also break ii you use a plugin that comes with shoulda.

Ruby Mine commit & push

Ruby Mine’s behavior when using commit together with the push option might not behave as expected. For us it merged a branch and truncated all changes that had occurred on that branch since the last update.

WebKit JS treats “export” as keyword

One of the many unused keywords in JavaScript is “export”. Firefox lets you use it since it’s de facto unused. However, using “export” in your JavaScript will break your code in WebKit-based browseres.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/12/2010

Alexander Murmann
Wednesday, May 12, 2010

Interesting — Tagging and Excluding of Filters in Solr Facets

You may want to use multi-select faceting to constrain the results shown for one facet but still want to see the values and counts of other facets that are not matched by your constraint. To solve this you often had to use two queries. Since Solr 1.4 you can tag and exclude filters and save the additional query.

Help — Adding Memcached to Models

“I want to use memcached for my ActiveRecord models and am looking for recommendations on how to do this”

Of the available gems the memcached gem can be recommended. The memcached gem wraps the libmemcached client which is written in pure C. This implementation gives it a performance advantage over the memcached_client gem.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/11/2010

Alexander Murmann
Tuesday, May 11, 2010

Interesting — Backtrace in RSpec

Since version 1.2.9 RSpec per default does not print the full backtrace. Calling spec with the -b --backtrace option will print the full trace.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Alexander Murmann

Standup 5/10/2010

Alexander Murmann
Monday, May 10, 2010

Interestings

gmail_smtp plugin not needed with Ruby 1.8.7

If you uses Ruby 1.8.7 or higher you can natively connect to Gmail and do not need to install a plugin as you used to with older Ruby versions .

selenium/webrat/snowleopard

Selenium uses webrat as default which causes problems under Snowleopard. Getting the latest version of Selenium and replacing the gem’s JAR-file with it will solve this problem.

Ask for Help

Reloading libs in development

“How to setup Rails to reload libraries under development?”

The initializer block in environment.rb contains the line

<code>config.load_paths += %W( #{RAILS_ROOT}/extras )</code>


which is commented out by default. Here the lib folder can be added in order to have it reloaded.

Selenium with with Firefox 3.6

"How to get Firefox 3.6 to work with Selenium?"

Your need to install he latest gem for Selenium RC from gem cutter. You then need to get the latest version of Selenium and replace the gem's JAR file with the latest one you just downloaded.

Using relative picture size to crop from original image.

"I am using Paperclip and need the size of the original picture"

Paperclip::Geometry offers methods to get the image's dimensions. However, if you want to access those for a new file, the earliest you can access these is with the after_save hook. Thus you might have to save the file twice.

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

Standup 04/05/2010: Cinco de Mayo

Pivotal Labs
Wednesday, May 5, 2010

Ask for Help

Paperclip Slowness

“In one web request we are collecting the file paths of about 250 objects that have attachments via Paperclip. Unfortunately this is really slow and takes a couple seconds to finish. Does anyone have thoughts on how we could speed this up? Is de-normalizing the file path a reasonable solution?”

Moderation of Solr Search Results

“One of our projects uses Solr and acts_as_solr to provide search results to users. One particular result is showing up far higher than we want. What is the best way to use boosting to downgrade the score of an individual result in Solr?”

Interesting Things

Bike to Work Day
May 13th is Bike to Work Day in San Francisco. We are hoping more people take advantage of this to try biking to work for the first time. To mix things up for those that normally bike to work we are planning a Bike to Lunch.

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

Standup 04/04/2010: Risks of not using a Primary Key

Pivotal Labs
Tuesday, May 4, 2010

Happy Star Wars Day!

Ask for Help

“While Apache is serving a large static file it becomes slow to serve other requests. We think this may be an Apache configuration issue. Any suggestions?”

Interesting Things

Enable-pthreads Headache
In Ruby 1.8 the --enable-pthreads build option will dramatically slow down your program, as documented here and here. Do not enable it unless you need it, which is unlikely.

Don’t need a primary key? Think again
You might think that you can get away with not having a primary key on a table and just rely on a database index for lookups. This is very dangerous because MySQL will no longer be able to store the records on disk sorted by primary key. Not having this ordering becomes an issue if you want to operate on the records in batches. For instance, normally you ask for all the records having an id between 0 and 1000. Because they are stored by primary key these 1000 records will be in a group on the disk and the lookup will be quick. When doing the same thing with an index instead of a primary key, and a primary key does not exist, the records will be in scattered locations on the disk and the hard drive will have to do many seeks to access them all. The time to do query will be orders of magnitude greater.

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

Looking for Ruby on Rails developers

Dan Podsedly
Monday, April 19, 2010

Pivotal Labs has been at the forefront of agile development since it’s early days. We’ve taken what we’ve learned by applying agile concepts on a countless number of real world projects, and honed these skills into a very effective way to build software. Along the way, we also built a great project management and collaboration tool – Pivotal Tracker.

Not only does Tracker serve as a critical component of our own development process, it’s also relied on by thousands of teams out there in the world, from open source developers, to fast growing startups, and high profile, established companies.

It’s a great app, yet we have lots of ideas for how we’d like to improve it. Want to help us? If you’re a Ruby on Rails developer, enthusiastic about agile development, and want to help us to take Tracker to the next level, read on.

We’re currently looking for developers in the Denver/Boulder, Colorado area. Familiarity with Ruby on Rails is important, as are strong Javascript, CSS, and overall web UI skills. At Pivotal Labs, we pair and test drive 100% of the time, so any experience with pair-programming and/or test driven development would be a huge plus. We’re also big on aggressive refactoring, so be ready to roll up your sleeves.

If you’re interested in working with us, please send your current resume to tracker-jobs@pivotallabs.com, and tell us a little about yourself. Principals only, please.

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

Standup 4/9/2010: New Bundler API Gotcha

Pivotal Labs
Friday, April 9, 2010

Interesting Things

Switching to Bundler 0.9.x?

If your old gem definitions use :lib => false, don’t forget to change it to :require => false

Additionally, older versions of Bundler use the deprecated named argument :require_as (instead of Rails’ :lib and Bundler 0.9′s :require) to override the path that Bundle requires for you.

Here is an example of how to tell Bundler 0.9.x not to require a gem automatically:

gem "leetsauce", :require => false
  • 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. 39
  5. 40
  6. 41
  7. 42
  8. 43
  9. 44
  10. 45
  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 >