Search Results

Search found 4 results on 1 pages for 'friedo'.

Page 1/1 | 1 

  • Lazy-loading flash objects

    - by friedo
    I'm using the jQuery lazy-loading plugin to defer loading of below-the-fold images on a large web page. This works great. Now, I would like to apply the same technique to a large Flash object which is also below-the-fold. I don't think the lazy-load plugin handles things that aren't images (at least it doesn't look that way so far.) I may have to do it myself. In that case, how do I detect when the area containing the Flash object becomes visible?

    Read the article

  • Rebuilding lazily-built attribute when an underlying attribute changes in Moose

    - by friedo
    I've got a Moose class with a lazy_build attribute. The value of that attribute is a function of another (non-lazy) attribute. Suppose somebody instantiates the class with a value of 42 for the required attribute. Then they request the lazy attribute, which is calculated as a function of 42. Then, they have the nerve to change the first attribute! The lazy one has already been built, so the builder will not get called again, and the lazy attribute is now out-of-date. I have a solution now where I maintain a "dirty" flag on the required attribute, and an accessor on the lazy one checks the dirty flag and rebuilds it if needed. However, this seems like a lot of work. Is there a way to handle this within Moose, e.g. using traits?

    Read the article

  • Is there a better way to serially submit multiple AJAX requests?

    - by friedo
    I have a page with multiple forms that I submit via Ajax POSTs serially. At first, I tried using synchronous XHR requests, but this causes the browser to lock up for the duration of the request, and breaks my DOM-manipulation effects, which is unacceptable. So the pattern I ended up using is basically this: var fcount = 0; // incremented for each form to be submitted function submit_form( num ) { var fdata = { ... }; // data from form # num $.ajax( { async: true, url: '/index.cgi', data: fdata, type: 'POST', success: function() { if ( num < fcount ) { submit_form( ++num ); } } } ); } $( '#submit_form_btn' ).click( function() { submit_form( 1 ) } ); The recursion strikes me as a bit of an ugly solution to what is essentially an iterative problem. Is there a cleaner or more elegant way that this could be handled?

    Read the article

  • What's the deal with reftype { } ?

    - by friedo
    I recently saw some code that reminded me to ask this question. Lately, I've been seeing a lot of this: use Scalar::Util 'reftype'; if ( reftype $some_ref eq reftype { } ) { ... } What is the purpose of calling reftype on an anonymous hashref? Why not just say eq 'HASH' ?

    Read the article

1