Community Member Profile

Dan G. Switzer, II
Member since Dec 11, 2008

Recent Blog Comments By Dan G. Switzer, II

  • Your jQuery Selector Context Can Be A jQuery Object

    Posted on Mar 15, 2010 at 10:59 AM

    If you *know* you're dealing with a jQuery object, always do: context.find(selector) over: $(context).find(selector) - or - $(selector, context) IMO, passing in a jQuery object as the context is only useful if you've written code where the context could be eithe... read more »

  • Drawing On The iPhone Canvas With jQuery And ColdFusion

    Posted on Mar 5, 2010 at 10:15 AM

    On a practical note, you could use this code as a way of adding signatures to an iPhone mobile app. Use the canvas element as the "Sign Here" box and use the CF code to save the signature as an image.... read more »

  • Using jQuery's Animate() Step Callback Function To Create Custom Animations

    Posted on Feb 19, 2010 at 11:45 AM

    PS - I'm probably finding *too* much enjoyment from flicking the image around the page. :)... read more »

  • Using jQuery's Animate() Step Callback Function To Create Custom Animations

    Posted on Feb 19, 2010 at 11:42 AM

    You made the statement: One of the things that I thought would be interesting would be to use the step callback function to override the current animation. Unfortunately, this cannot be done directly; not only is the step function called after each animation step (not before), should yo... read more »

  • Traversal vs. Collection Filtering In jQuery

    Posted on Feb 19, 2010 at 9:46 AM

    @Jon: Instead of: $('em',$(this)).first().css("fontweight","bold"); You're better off using: $('em', this).first().css("fontweight","bold"); - or - $(this).find('em').first().css("fontweight","bold"); There's some overhead in calling $(), so if you can mini... read more »

  • Traversal vs. Collection Filtering In jQuery

    Posted on Feb 17, 2010 at 12:32 PM

    @Ben: The problem I have with this entry is your two different selectors have completely different meanings. In the first example you're not grouping by table cell at all, but the second one you are. Also, there's a difference between the behavior in :first and :first-child. The... read more »

  • jQuery forEach() Experiment For Branch-Wise Implicit Iteration

    Posted on Feb 15, 2010 at 5:04 PM

    Interesting approach changing the chain to an object. You could copy all of the jQuery functions as methods using: var fn = []; for( var k in $.fn ){ if( typeof $.fn[k] == "function" ) fn.push(k); } // Add the override classes to the ForEach prototype. $.eac... read more »

  • Selecting The Closest Parent On Multiple Nodes With The jQuery Plugin ClosestParents()

    Posted on Feb 15, 2010 at 12:23 PM

    @Ben: The end() just restores the jQuery array stack. The problem is you have no way of re-running the actual execution chain--which is what you'd need to do.... read more »

  • Selecting The Closest Parent On Multiple Nodes With The jQuery Plugin ClosestParents()

    Posted on Feb 15, 2010 at 11:25 AM

    @Ben: The forEach() was really a hypothetical concept for jQuery (and yes, other languages have the concept.) Due to how jQuery handles chaining (well, really how JS handles it) it's not possible. The problem is you'd have awareness of the rest of the chain--which you don't have. Tha... read more »

  • Selecting The Closest Parent On Multiple Nodes With The jQuery Plugin ClosestParents()

    Posted on Feb 15, 2010 at 10:53 AM

    While the plug-in certain works, you could have done the same thing with: $( "a" ).each(function (){ $(this).parents( "div:first" ).addClass( "parent" ); }); This would have given you the same result. What would be nice is of there was a forEach() method, then you co... read more »

  • Explicitly Ending A ColdFusion Session

    Posted on Feb 15, 2010 at 10:45 AM

    In method #3, you could also just extend the root Application.cfc, that might make the code a little more intuitive and would allow you to leverage other logic in the root Application.cfc. (NOTE: This is one of the places where I wish you could reference an object by a relative path.)... read more »

  • Clearing The Session Scope Does Not End Your ColdFusion Session

    Posted on Feb 11, 2010 at 11:51 AM

    I think this is a bit misleading, because your Expire.cfm isn't really expiring the user's session, it's just forcing the server to re-assign them new cookies, thus creating a *new* session. The old session is still in-memory and technically active, it's just no longer being used.... read more »

  • Using $Variable In jQuery Code Is Just Hungarian Notation

    Posted on Dec 10, 2009 at 2:02 PM

    Here's why I like the $ prefix: var table = document.getElementById("#tableId"); var $table = $("#tableId"); I often have variables for both the actual DOM element and for a jQuery equivlent--which happens a lot in plug-in development. So, while I could do things like: <... read more »

  • Building A Fixed-Position Bottom Menu Bar (ala FaceBook)

    Posted on Oct 30, 2009 at 10:41 AM

    I've been meaning to point this out for a long time, but the your object/embed code for embedding your videos is a bit messed up. You have different dimensions between the object & embed tags: object element: width="256" height="246" embed element: width="546" height="544" Sinc... read more »

  • jQuery Powered Mine Sweeper Game

    Posted on Oct 27, 2009 at 11:52 AM

    One thing to keep in mind is since you're using the "bomb" class on the element to mark a "bomb", one can easily use Firebug to find the bombs. If doing in a real environment (such as for an online contest,) you'd want to avoid using the client-side to store the results. You'd really want... read more »

  • Ask Ben: Keeping Close Track Of Who Is Currently Online

    Posted on Aug 27, 2009 at 12:55 PM

    As Rick stated earlier, you can keep the heartbeat completely separate from the session life. Just keep track of the last page hit in the session scope and then to determine if the user is still "active" (or online) just check the time since the last page hit. While using a heartbeat... read more »

  • Ask Ben: Keeping Close Track Of Who Is Currently Online

    Posted on Aug 27, 2009 at 12:47 PM

    @Ben: Why not just do: <cfcontent type="text/plain" reset="true" variable="true" /> ? That will reset the buffer w/out any overhead of conversion.... read more »

  • Negative CSS Margins Are Not Cool

    Posted on Aug 19, 2009 at 3:14 PM

    Since this topic got revived from the dead, it reminds me that I just read an article recently talking about negative margins are extremely valid CSS. Here's the article--I found it very interesting: read more »

  • Learning ColdFusion 9: Delete Array Elements With ArrayDelete()

    Posted on Aug 4, 2009 at 10:58 AM

    It seems like ArrayDelete() should have an optional 3rd argument for selecting whether you want to remove all instances or only the first (like the removeXXX() functions have.)... read more »

  • Win A FREE Ticket To CFUNITED 2009

    Posted on Jul 31, 2009 at 3:59 PM

    While narrowing it down to one is quite near impossible, the session highest on my list is the "Coldbox" by Luis Majano. I'm getting ready to due a major re-write of an application and I'm almost positive I'm using Coldbox as the framework, so I'd like to learn as much as possible about the... read more »

Member Account Kinky Solutions Shop