Creative Juices Bo. Co.

Satisfy Your Thirst For Something Refreshing!

ColdFusion Tips & Tricks: Components

ColdFusion Components and Var Scoping Trick

Var scoping is essential when dealing with ColdFusion Components. You can get weird results or even some hard-to-track errors if you don't do this. I'm not privy as to why this happens, I just know that it does. It's one of those mysteries that I just never bothered to research. All I know, is that sometimes it's a pain in the butt, especially when your writing a fairly complex function and you forgot to var scope an "i" in a cfloop or some other quick and dirty variable you made.

Well a few months back, I started doing something with my function variables, that I thought I would share. Not only does it solve my var problem, but it winds up making the top of my function shorter (I'm a stickler for cleanish looking code). Essentially I create a generic local struct in the begining and I'm sure to var scope it, like so:

<cfset var local = StructNew() />
read full article...

indexOf problems in Internet Explorer

Reason #592 why I hate Internet Explorer

My last step on any website design is to go through it and make sure that it works and look correct in the various flavors of Internet Explorer. I can't really say that the time spent doing this is blissful. I compare it to going to the dentist, because I never know what I'm going to find and when I do it's rarely good.

So today as I was debugging, what I thought was a very simple, JavaScript page. I came across one of those nifty "This method or function is undefined" errors from the Internet Explorer debugger. And as we all know, the IE debugger is as worthless as playing "I Spy" with a blind person.

read full article...