• RSpec and BDD

    RSpec: Behavior Driven Development framework for Ruby. It's like writing your specifications in English that's executable. Eight tools in one, and a really nice Mock Objects framework.

  • Unobtrusive IFrame shim - a half solution

    Something that really bugged me when using YUI Calendars and YUI AutoComplete widgets was how IFrame shims are currently being managed in libraries and home-brewed code (we use IFrame shims in many places as well). YUI Calendars doesn't have a built-in IFrame shim, YUI AutoComplete has its own, and we use our own IFrame shim library.

    For the uninitiated, IFrame shims are basically IFrames dynamically inserted (hence "shim") under overlaying DOM elements so that any <select> elements do not show through in IE 5.5 and above. A common example would be dynamically generated divs that float on top of drop downs in forms, such as the Yahoo! Calendar widget example below.

    An example of the select box see through problem in IE 5.5+


    So anyway, the thing that's bugging me is the awkwardness in inserting IFrame shims where they are needed and the duplication of unnecessary code to create, show, and hide the IFrame shims. Ideally, I'd like to do something like this to attach IFrame shims and forget about them:

    var iframeShim = new net.codefront.IFrameShim('elementId');

    Or the conceptually nicer way of attaching IFrame shim "behavior":

    net.codefront.IFrameShim.attachShim($('elementId'));

    No need for manually displaying and hiding the IFrame shim, polluting display logic and event handlers. I don't care how all that shimming is done nor should I have to. I don't want to have to call displayShim() whenever I display a floating div and hideShim() when I hide it. It should be smart enough to display the shim when the overlay is showing and to hide when the overlay is no longer visible.

    As it is, I am seeing code duplicated in many places to manage these IFrame shims, and that's a bad smell. Ahh ahh, before I go further, I am completely aware that I could be completely off-base and such a miraculous time-saver of a library already exists. If so, I want to know!

    Trying to fix this problem, I came up with this bit of JavaScript, which you shouldn't bother reading. The idea is to allow me to do this:

    var shim = new com.bezurk.widget.IFrameShim('myFloatingCalendar');
    shim.manualShim = false;
    shim.manualDeshim = false;

    And I have a 'myFloatingCalendar' element that's automagically shimmed whenever it's displayed. (The shim.manualShim and shim.manualDeshim are defaulted to false, and are shown purely for explanatory purposes.)

    There is one problem though - I can't figure out an elegant way to "listen" to the display and hide events of the element that's shimmed. The way I've done it is to rely on Prototype's PeriodicalExecuter (extended to support a stop() method) to poll for the visibility of the element. Naturally this is an ugly hack and causes noticeable flicker.

    I've looked at custom events (YUI and Dojo have very nice event handling libraries) but can't see how to hook this up unobtrusively. If you have a suggestion or a solution, I want to hear it!

  • The first rule of Maintenance is - you do not talk about Maintenance

    What would Tyler Durden do if he had to bring down his Web 2.0 service for maintenance?

    Someone in the office thought this message would be appropriate.

  • When Firefox extensions annoy

    Firefox extensions are a good thing (since sliced bread and embedded ActiveX controls...), in fact some of them are my most compelling reasons for using and loving Firefox.

    Anyway, so with that World Cup thing that's going on I installed an extension called FootieFox that tracks any goals being scored in real-time and pops up a small little notification message. All fine and dandy, great unobtrusive little widget. Well, right until "FootieFox Education Day", when the extension started showing a banner that overlaid everything else on the screen, blinding up in obnoxious slowness, sitting there for a few seconds, and blinding down painfully with no way to dismiss it except to wait.

    FootieFox extension overlay annoyance


    I promptly uninstalled the extension. (Great extension, but that "I'm gonna block out everything else so you have to read me" banner thing annoyed me.)

  • The first Firefox ads are out

    Firefox Flicks has just put up 3 of the first ads that have been submitted to the Firefox ads competition. Check them out. Drama queen was my favorite of the three, though they are all surprisingly very good quality ads.

subscribe via RSS