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?]

Mike GehardMike Gehard
Waiting for jQuery Ajax calls to finish in Cucumber
edit Posted by Mike Gehard on Tuesday May 03, 2011 at 06:16PM

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.

Ken MayerKen Mayer
Standup 2010-11-19: TGIF
edit Posted by Ken Mayer on Friday November 19, 2010 at 09:32AM

Helps

What options exist for mobile application development?

The general consensus seems to be that many of these frameworks work fine for simple applications, but quickly run into walls, bugs, and fails once things are less than straightforward. If you're writing a simple application, it probably falls in the mobile web application category and then all you need is a web view. YMMV, but know what you want your application to do before making a choice. Most likely, you have to write a native application for each platform.

Interestings

  • jQuery 1.4.4 Released Read the blog entry for details; if you're having issues, they might be solved in this release.

JB SteadmanJB Steadman
more page dynamics, less client logic
edit Posted by JB Steadman on Saturday January 23, 2010 at 07:45PM

Ajaxed pages frequently need to update many parts of the page within ajax callbacks. Here I'll outline how we use jQuery and Rails do this on Mavenlink. Our approach encodes behavior declaratively in markup and minimizes client-side logic.

John PignataJohn Pignata
NYC Standup Roundup - Thanksgiving Week
edit Posted by John Pignata on Wednesday November 25, 2009 at 12:09PM

Help

Is there a way to ensure at_exit will always be ran regardless of how the program exits without wrapping all code in an ensure block?

Ideas included:

  1. Use a runner class to execute the program and wrap that in an ensure block.

  2. trap("EXIT") { block } should get triggered no matter how the program terminates (sigint, exception, etc)

What are the likely causes of RangeError exceptions during test runs?

<RangeError: 0x23513ec is recycled object>
  1. This is generally caused by C extensions.

  2. Their appearance coincided with a Darwin ports update — perhaps you're running native gems against different versions of libraries than they were compiled against.

Are there any techniques out there to take a series of bytes and run some heuristics on them to determine the likely encoding of the string it represents?

Anybody out there have any ideas? Please let us know in the comments!

Interesting

  • Passing :multiple => false or nil to the select helpers causes unpredictable results — the helper still builds input element names assuming an array of items will be passed back. The helper checks only that the key is present in the options hash and not the value which means if you need to conditionally render a multiple, you'll have to make sure you don't specify the :multiple key at all.

  • Using $('textarea').val() causes unpredictable results as a textarea doesn't keep its data in a value attribute. Use text()) instead.

  • IE 7 and 8 (and more than likely 6) seem to have a problem with jQuery selectors that match links based upon the href attribute — changing the href of the matched elements does not get reflected in the document.

  • From a Blabs comment: Taps is a Sinatra web service from Heroku that's used to move data from one database to another. It transmits data as serialized arrays and loads them using ActiveRecord so it's DB agnostic.

  • Disabling a label via jQuery will not disable the input that it refers to in the for attribute as the label is not a container.

Happy Thanksgiving!

Abhijit HiremagalurAbhijit Hiremagalur
Standup 01/16/2009: onReady() for AJAX, Web Sprites & Detecting UTF-8
edit Posted by Abhijit Hiremagalur on Monday January 19, 2009 at 10:09PM

Interesting Things

  • Web based sprite generator - here

This also makes the generated sprite really small which is great if you care about page load times. A Ruby+ImageMagick sprite generator might also be a good thing to build.

  • Cool way of detecting if a file is UTF-8 enconded using Ruby+IConv - here

Ask for Help

"Is there an onReady() for AJAX events?"