Justin Richard's blog
Interesting
The Pivotal Webstache Movember network cleared $40,000 raised to stop Dude Cancer
Joda-Time provides a quality replacement for the Java date and time classes. Months are not zero based!
EC2 is scheduling restarts for their physical machines and your instances. In some cases you can manage your own restart. Make sure you check your email and your EC2 console.
Help
Google Chrome seems to be caching and rendering the last resource served from a URL regardless of its content-type when you navigate via the back button to a page. Specifically, a client's site serves both HTML and JSON from the same URL. The JSON is the last request made because it's an async request on the page. When the user navigates away from this page then back the JSON data is rendered instead of the HTML resource. Any HTTP header change suggestions we can use to get Chrome to only render the HTML content?
Capybara seems to not allow #click on elements depending on how you call #find. What's up with this?
find('tr', :id => 'foo').click #not clickable
find(:css, 'tr#foo').click # is clickable
Interesting
A Ruby Class's default 'initialize' method takes zero or any number or arguments depending on the version of Ruby you use.
Given the Foo class:
class Foo end
And then attempting to instantiate an instance of Foo with arguments like so:
Foo.new('any argument')
You get an invalid number of arguments error in 1.8.7 and 1.9.3.
However, 1.9.2 and 1.9.1 will just accept any number of arguments.
Ruby spec documents this behavior: https://github.com/rubyspec/rubyspec/blob/master/core/object/new_spec.rb
It appears that this difference between versions was introduced as a feature in 1.9.2 and back ported to 1.9.1 and then reverted in 1.9.3. Perhaps the reversion should be back ported now? http://redmine.ruby-lang.org/issues/2451
Help
Does anyone know of an API that provides a sales tax lookup service?
Interesting
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
Help
"Some of our requests are not timing out in the time specified in our mod_proxy settings in Apache."
This team's problem was later refined to the fact that these timeout settings were not being respected on all requests when the server hit a spike in load. The solution is to recompile Apache with the --with-mpm=worker option. The default option value is --with-mpm=prefork. With Apache compiled with the 'worker' value all requests respect the timeout settings.
"When using Rafael and jQuery together in our project our click handlers throw errors in IE 7 and 8"
After further investigation IE seems to keep propagating the click event even though it was handled. The following javascript was added only in IE browsers to make it behave like the other browsers.
if(document.attachEvent) {
$(divContainingCanvas).find("*").click(function(event) {
event.stopPropagation();
});
}
Interesting
Modulr is a Ruby implementation of a CommonJS module that combines your multiple javascript files into a single file that is executed in dependency order. It does this by ordering the execution of your code by the require() method call. What's interesting is that you can collapse your NodeJS code into a single file to include in a browser and run Jasmine tests against. This is possible because NodeJS uses require() to link your dependent files together.
Help
"We're trying to use SWFUpload in Rails 3 by using Rack middleware to rewrite the session cookie passed in via request param. In a Rails 2.3.x your Rack middleware could clobber the session cookie and reset it before it hits your main app. However, this isn't happening in Rails 3. Has anybody run into this before?"
The answer is that as of Rails 2.3.4, the session handler was moved to Rack middleware. So you need to make sure that your middleware manipulating the session is running before the Rails session middleware is run. You can do this with something like this:
config.middleware.insert_before(config.session_store, FlashSessionCookieMiddleware)
Brian Racer has a good description of getting SWFUpload working with rails 2.3.4
Interesting##
If you're using Jasmine to test your JavaScript code and you miss the shared examples functionality you used in RSpec, you can achieve the same result by just using a plain old function. Name your function something like "mySharedBehavior" and call it in each of your describe blocks that share the behavior. Jasmine will execute the function and print your results just as if you repeated all the shared examples in each of your describe blocks. Be careful not to modify the scope of the function that contains your shared examples (Jasmine needs to control the scope).
Help
What remote screen sharing or VNC clients are people using for remote pairing?
Chad described his optimal remote pairing setup in 2008, but since then Apple removed the ability to do true full-screen sharing in the included Screen Sharing application with the 10.5.8 update. We've been looking for other solutions since. Apple's Remote Desktop does this, but it gets expensive on a per seat basis and isn't focused on solving our simple use case.
We're interested in finding out what you're using? Do you have a favorite VNC client?
Interesting
Pivotal's Pulse is now open source. It's a nice big view of the state of your multiple CI builds. Check out our public projects here: ci.pivotallabs.com
Refraction was updated to v0.2.0. It's a testable replacement for mod_rewrite that's implemented as Rack middle ware.
Calling #destroy on an ActiveRecord instance associated through a has_many relationship removes it from the database, but not the collection. #delete removes it from the collection and database, but you don't get the before and after callbacks.
Interesting
Interesting
The XMPP and Jabber Technologies meetup is tonight at Pivotal's office, 6:00pm.
Interesting
- Speed up your tests that use Paperclip by putting the following in your spec_helper.rb. In a new project's test suite this alone reduced the full suite run time from 25 to 5 seconds.
class Paperclip::Attachment def post_process; end end
- If you want to run Spork to speed up your tests, but aren't running on a Ruby platform that supports Kernel.fork (like windows or JRuby) then Roger Pack's Spork fork might work for you.
