Community Member Profile

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

Recent Blog Comments By Dan G. Switzer, II

  • Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusion

    Posted on May 22, 2013 at 12:29 PM

    @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 lea... read more »

  • Stateless Service Singletons vs. Stateful Service Entities

    Posted on Apr 3, 2013 at 2:03 PM

    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, j... read more »

  • Handling Forbidden RESTful Requests: 401 vs. 403 vs. 404

    Posted on Jul 19, 2012 at 2:43 PM

    @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 ho... read more »

  • Writing My First Unit Tests With MXUnit And ColdFusion

    Posted on Jul 10, 2012 at 5:28 PM

    @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... read more »

  • Writing My First Unit Tests With MXUnit And ColdFusion

    Posted on Jul 10, 2012 at 4:46 PM

    @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 fi... read more »

  • Tracing Event Binding And Event Triggering In jQuery

    Posted on Jun 28, 2012 at 8:27 AM

    @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 appear... read more »

  • Tracing Event Binding And Event Triggering In jQuery

    Posted on Jun 27, 2012 at 2:31 PM

    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... read more »

  • ColdFusion 10 - Looping Over Function Arguments

    Posted on Apr 16, 2012 at 5:00 PM

    @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 us... read more »

  • ColdFusion 10 - Hashing Binary Data And Byte Arrays

    Posted on Apr 2, 2012 at 10:52 AM

    I was able to get it working fine w/an image using fileReadBinary(). I tested it before posting my comment.... read more »

  • Hashing Byte Arrays (Binary Data) With ColdFusion Before ColdFusion 10

    Posted on Apr 2, 2012 at 10:46 AM

    @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 hashBy... read more »

  • ColdFusion 10 - Hashing Binary Data And Byte Arrays

    Posted on Apr 2, 2012 at 10:43 AM

    Ben: I think all CF10 is doing is running the equivalent of toString() on binary data. If I change: writeOutput( "BIN Fingerprint: " & hash( messageBinary ) ); to: writeOutput( "BIN Fingerprint: " & hash( toString(messageBinary) ) ); It wo... read more »

  • Disabling Auto-Correct And Auto-Capitalize Features On iPhone Inputs

    Posted on Jan 5, 2012 at 11:29 AM

    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 jus... read more »

  • Extending JavaScript Arrays While Keeping Native Bracket-Notation Functionality

    Posted on Dec 1, 2011 at 3:04 PM

    @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 Col... read more »

  • Storing And Retrieving Global Dates And Times In The Database

    Posted on Sep 27, 2011 at 3:12 PM

    @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... read more »

  • Storing And Retrieving Global Dates And Times In The Database

    Posted on Sep 27, 2011 at 10:52 AM

    @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... read more »

  • Storing And Retrieving Global Dates And Times In The Database

    Posted on Sep 26, 2011 at 12:45 PM

    @Ben: Why are you jumping through so many hoops to convert a date from a user's local time into UTC? Here's all you need: today = createDateTime(2011, 9, 26, 9, 0, 0); TimeZone = createObject("java","java.util.TimeZone").getTime... read more »

  • Working With Time Zones And Daylight Savings Time (DST) In ColdFusion And Java

    Posted on Sep 22, 2011 at 2:38 PM

    I forgot to mention, that was for reports--so if you generate a report that dumped out that last 10,000 tickets, there could have been many date/time fields on each row and each row might have been for a different timezone.... read more »

  • Working With Time Zones And Daylight Savings Time (DST) In ColdFusion And Java

    Posted on Sep 22, 2011 at 2:36 PM

    @Ben: If you want really ugly, the help desk application that I work in used to have the ability to show times in the customer times. This was all done via a very elaborate SQL query. I ended up killing that feature because it was so slow and really not all that helpful (since people... read more »

  • Working With Time Zones And Daylight Savings Time (DST) In ColdFusion And Java

    Posted on Sep 22, 2011 at 12:00 PM

    Also, the benefit of storing times in UTC/GMT is that you never have to worry about correcting date/times in your database. For example, if you're storing an offset for your servers timezone and then using that offset for calculations, what happens if you ever need to change the timezone on... read more »

  • Working With Time Zones And Daylight Savings Time (DST) In ColdFusion And Java

    Posted on Sep 22, 2011 at 11:55 AM

    I always set up servers to run in the GMT timezone and then within my code always store dates in GMT/UTC. This does mean that you need to: 1. Convert all date/times a user inputs in your site into GMT/UTC. 2. Convert all date/times displaying to a user in their correct timezone... read more »

Member Account Kinky Solutions Shop
  • Help Wanted - Find Your Next ColdFusion Job
InVision App - Prototyping Made Beautiful With Prototyping Tools