dans.blog


The miscellaneous ramblings and thoughts of Dan G. Switzer, II

CFMX: urlDecode() function uses default URL scope charset to decode strings...

If you're getting an Error casting an object of type to an incompatible type message while when using CFMX's urlDecode() function, this is because you're using the wrong charset.

I was getting this error trying to parse some data coming from an XHTML document. Turns out the urlDecode() uses the charset of the URL scope as the default charset to use when decoding a string. Since the charset of the text in my XML document was different than that of my URL scope, I was getting the error. The message isn't very descriptive to the problem, so I spent time trying to cast the string using javaCast() function.

See the urlDecode() documentation for more information.


CFMX UDF: Parsing a URI into a struct...

Ever needed to parse a qualified URI to examine a URL for specific information? I'm working on some code that needs to examine links in a document and extract information about the links.

To make sure I was doing things by the spec, I made sure to check out RFC2396. Fortunately, the RFC has a nice little regular expression for breaking a URI into it's core pieces: scheme, authority, path, query and fragment.

However, those core portions are still pretty broad. The authority can include user info, domain and port information. The path can include embedded parameters inside each segment. So, I took the core regular expression to break up a URI and then I do further parsing on the authority and path portions of the URI.

more…


Fiddler Issue: Slow running HTTP requests on local IPs (i.e. 192.168.1.*)

For those of you using Fiddler HTTP Debugger (which is a great tool I've blogged about many times in the past,) there appears to be an issue when using IP addresses. This is especially noticable when using private subnet IP addresses (such as 192.168.1.*.)

The problem I was seeing was that requests to my developer server came to a crawl when using Fiddler. Speed to external domains was working fine. If I turned off capturing, speed resumed. I finally was able to figure out that by setting up a DNS entry, speed would resume.

Since this was slowing me down, I sent Eric Law, the developer of Fiddler, an e-mail message reporting the problem. He was very quick in researching the problem.

more…


CF TIP: Determing if a UDF argument is "null"

Ok, so the title is misleading. CF doesn't really have a concept of null, but it does have the concept of "not exists."

If you need to differentiate between when an argument of a function has been supplied or not, set the required attribute to true and leave the default attribute off. If the argument is not supplied to the function, then a against structKeyExists(arguments, "argumentName") will return false. If a value has been supplied, the function will return true.

Here's an example:

more…


CFMX UDF: Creating a query from a zip file

The other day I had the need to unzip the contents of a zip file. However, I did not want to unzip the file to disk, I really wanted to grab the binary data in memory so I could write it to MS SQL as an image data type.

As I normally do, I first did a quick Google and CFLib.org search to see if I could find anything that did exactly what I wanted. The only examples I could find were of writing the zip contents to disk. While I could have written to disk and then read the file from disk, I know I could do what I wanted by just creating a ByteArrayOutputStream. So I took the unzipFile UDF I found (written by Samuel Neff) and basically re-wrote it.

I decided I actually wanted to return a complete query object of all the zip file information. I thought this would be useful for other projects (in case I ever need to "browse" a zip file.)

more…


Saw Jeff Scott Soto fronting Journey...

Well, Sunday night I went to see Journey and Def Leppard with Jenn and a group of friends (Todd, Monica, Eric, Krista and some neighbors of Todd & Monica.) Jeff Scott Soto was singing for Journey in replacement for Steve Augeri (the current lead singer), as Steve is suffering from a throat infection. If you've never heard Augeri sing, if you close your eyes, you would indeed think it was Steve Perry singing. Augeri was an excellent choice to take over the reigns.

Anyway, I was pretty excited to hear Soto sing for Journey. I've been a fan of Soto's since his early work with Yngwie Malmsteen (I love his vocals on I'll See The Light Tonight.) Overall Jeff did an excellent job, but they definitely seem to alter the set to match his vocals. My only disappointment was that he didn't even try to sing any of the songs Steve Perry sang in falsetto (Open Arms, Faithfully, Who's Crying Now.) Those were the songs that I thought might bring Jeff some trouble, but I wanted to hear him sing them, as I've never really heard Jeff attempt to sing anything in that style (not saying he hasn't done it, I've just never heard it if he has.)

To my surprise Deen Castronovo (the drummer) sang those three songs. While he doesn't have the impact of either Steve (but who really does,) I was really shocked out how well he sang those songs. I never had any idea Deen had those kind of pipes. I've always considered him a kick ass drummer, just never knew he could sing like that.

more…


CFTHREAD/CFJOIN POC released!

Damon Cooper has blog Rupesh Kumar's latest CFTHREAD Proof of Concept (POC).

Rupesh is an Adobe "scientist" (a cool word for CF Developer Engineer.) He was very active in listening to feedback from the original version of the code that was released. I, along with a few other developers, were in active discussions with him over issues with the first release. Thanks to Rupesh's hard work, he's addressed the issues that were discussed.

The biggest changes are the addition of being able to pass attributes to the CFTHREAD tag (which allows you to pass in variables who's values can't change,) threads having their own unique scope (so that variables outside the thread aren't negative affective,) and the addition of the thread.OUTPUT and thread.ERROR variables.

more…


September 11, 2006

Just wanted to give my condolences and well wishes to all those Americans who lost their lives on 9-11, to all the heroes that contributed to the rescue and safe evacuation of thousands of people from the World Trade Center, to those that were in the Pentagon and finally all the brave passengers of United flight 93—who after knowing the events that happened in New York and DC, made the decision to take down their own plane, instead of letting the terriorist cause more damage.