Interesting Things
- jQuery mobile: awesome!
- jQuery 1.6 is out and will break you. Read the change notes and upgrade with care. [Ed.: you do have JS tests, don't you?]
Explore Blog posts about everything we are up to, Tech Talk videos covering a huge range of timely topics and Event listings to keep you current on happenings at the Labs.
Schubert warns us that Rail’s extensions that add to_time method may cast types in unexpected ways:
Date#to_time => Time
Time#to_time => Time
but DateTime#to_time => DateTime
Use === when checking equality with DateTime and you don’t care about precision (This does not work with Time however)
Your humble author cautions that the new Laullon GitX is not ready for prime time. When adding multiple files with a single click, a garbage commit with a long funny name is created without adding the files.
Instead, consider Brother Bard’s excellent fork of GitX
Ian “Waffles” Zabel mentioned that jQuery 1.6 has been released. Notable changes include case-mapping of HTML5 data- attributes, performance improvements, and more.
Lee Edwards reminds us “It’s Star Wars Day. May the 4th be with you.” <⁄rimshot>
You may be asking yourself why you’d want to do this in the first place. Well here’s why I would want to do it.
We had some Webdriver based Cucumber tests that passed fine locally but kept failing on our CI box. Our CI box is a bit underpowered at the moment so I thought what might be happening is that our tests weren’t waiting long enough for the Ajaxy stuff to happen because the Ajax responses were taking a long time.
After some poking around in the source code of jQuery, I found the $.active property. This property keeps track of the number of active Ajax requests that are going on and I thought this might help us out.
What I came up with was this gist:
I added this step right after my Cucumber step that caused the Ajax call so that Cucumber would wait to move on until I knew that everything was done.
This step solved our CI failures and all was good in our test suite again.
Check your instance variable and methods names for conflicts with libraries or frameworks you are using if you get unexpected failures
Example 1: defining @response in your RSpec test setup when expecting to use the response from a HTTP request overwrites the result of the request. (don’t expect @request or @url to do you any favors either)
Example 2: Don’t define a #process method on a Rails controller
As Dan mentioned on Monday, Tracker uses an architecture in which a large number of polling requests are serviced by web servers communicating with an in-memory cache, and over the past few weeks we’ve hit a number of resource limits on our cache servers. Yesterday we found a small change that had a big impact on this resource load.
After moving the cache to dedicated servers earlier in the week, we continued to encounter network-related resource problems. One of the limits was on the total number of open network connections, which were reaching over 100,000 during peak usage. We reasoned that this large number of connections was due to new connections being created for every cache lookup. We also know (from discussing WebSockets among other things) that for small messages the overhead of opening and closing a connection is much larger than the message itself. Once we started looking for a way to make these connections persistent the answer wasn’t hard to find: http://wiki.nginx.org/HttpUpstreamKeepaliveModule
We rolled out this change yesterday; today network connections to the cache peaked at around 3000. The reduction in network traffic between the web and cache servers should keep us well clear of the kinds of resource limits we’ve recently encountered. We’re still very interested in moving to a WebSockets architecture in the future- in the meantime this change stabilizes our environment and gives us some room to grow.
rake db:migrate db:seed ...) ruby classes do not get reloaded in between tasks so you can end up with old class definitions.“Sean asked about git rebase complaining about no changes?”
The suggestion was that it was generally safe to just skip in this situation.
I apologize for posting this 2 days late.
Are there any open services like the Music Genome Project? Our
project needs to calculate distance between 2 songs.
Some people think the Music Genome Project is open. Related,
but not directly answering the question is MusicBrainz, an open
system for identifying music via accoustic fingerprint.