Recent Blog Comments By Dan G. Switzer, II

I think Angular sets the "Content-Type" request header to "application/json". To make your code more full proof, you could just add something to your onRequest event handler to look if the "Content-Type" header is "application/json" and if it is, then do your ... read more »

You can get the same affect w/pure CSS too: http://jsfiddle.net/dswitzer/6Ye7B/embedded/result/ I had to change the <div> to an <a> so that element would actually get focus. Tried to use a <button> element (which would be more correct) but scrolling a button element didn't seem... read more »

@Ben: The funny thing is, I even found a blog post you wrote that indicates the limit is 2 threads: http://www.bennadel.com/blog/1886-Ask-Ben-Processing-Files-With-CFThread-In-ColdFusion.htm :) I could definitely be wrong, but what I seem to recall being the case was that a single request coul... read more »

I'm pretty sure Standard is limited to 2 threads, not 10. I know some documentation says 10, but Peter Freitag has a blog entry indicating it was 2: http://www.petefreitag.com/item/708.cfm And I'm pretty sure that was my finding as well, but maybe I'm remembering it incorrectly.... read more »

@Ben, Regarding query objects and auto-case rules. If you use getMetaData() on a query object (i.e. getMetaData(queryVar)), then you will get an array of column information. The data should contain: * Name - case sensitive--either exactly how you typed it or if "*" then the case it is i... read more »

@Ben: What version of Java are you using? Also, did you test users.id to see what Java reports as the data type? I wonder if it's not a Java primitive data type, but getting returned as something else--which is why it's not returning the value. If this is the case, it could lead to issues elsewh... read more »

I think it really depends on the use case on whether you use your singleton/stateless pattern works or whether it makes more sense to use a traditional transient object. If the code is being executed at in high iterations, then I think the stateless singleton pattern makes a ton of sense, just beca... read more »

@Ben: I recently implement our a RESTful version of our API (which uses MAC Access Authentication.) I found I used RFC2616 quite a bit in helping me decide what status codes should be returned. :) As for whether or not 403 or 404 is the correct response, it does really boil down to how much you wa... read more »

@Phil: There's are definitely tests that only do one thing. For example, you have to write your exception tests like that. I just started finding I wrote a lot less code if I just create an array of tests, w/expected results. Because I'm often doing multiple assertions test as well. I might be che... read more »

@Phil: I started originally doing one method for each individual test, but I found it ended up just taking way too much of my time and just ended up making for really bloated Test.cfcs. I found as long as you make sure to include a unique description for each error (so it's easy to find your error... read more »

@Duncan: The "Tilt" add-on is no longer needed--it's built into Firefox 11+ and was the feature I was talking about. @Ben: To get to the the 3D view, you must open the native Firefox Inspector (right click on a page, and press "Q" when the context menu appears.) From there you... read more »

On a related note, modern browsers have really great developer tools nowadays that can help really go a long way to help troubleshoot these kinds of problems. The problem is some of the tools are a little more obscure and don't get much press coverage. For example, in Firefox you can see a 3D view ... read more »

@Ben: I labored hard when they introduced the Image* functions that they be implemented as objects and not dozens of function calls. They just keep polluting the function name space and I think that also tends to promote procedural code in some way. I've also wondered if they start using a more OO... read more »

@Ben: I made this comment in your previous post, but in pre-CF10 you can also just call toString() on the binary data before calling hash() and you should get the same results. That means pre-CF10 you can do: imageHash = hash( toString(imageBinary) ); That said, the hashBytes() is nice work! Nev... read more »

I was curious if the autocorrect would also disable keyboard shortcuts in iOS5 and it does *not*. This is nice because I've set up a shortcut of @@ to insert my e-mail address. This means user defined shortcuts still work, it only affects spelling corrections. Now if I could just figure out how t... read more »

@Ben: If you were actually trying to do something like this for real code, I wouldn't bother defining things in the Collection.prototype--I'd just immediately extend the Array object you create in the Collection() constructor. Since you're not actually returning an instance of the Collection, addi... read more »

@Ben: The getOffset() returns the total number of milliseconds a current time stamp is away from UTC. So for the time stamp of "2011-09-26 09:00:00" (which we convert to Epoch) it will use the Java lookup tables to determine whether the current time is in DST, then add that to the base ... read more »

@Ben: Strange, because I'm the exact opposite. :) I'll break it down for you, so hopefully the code will be more clear. 1) Set a date in the user's local time. today = createDateTime(2011, 9, 26, 9, 0, 0); 2) Get a reference to the user's time zone TimeZone = createObject("java&quot... read more »