I'm speaking at NCDevCon 2014

{ Posted By : Eric Cobb on September 4, 2014 }
Related Categories: Tips 'n Tricks, Databases, SQL Server, Conferences

I'm a little late in blogging this, but I'm excited to announce that I will be speaking at NCDevCon 2014! This will be my first time back at NCDevCon since I spoke there in 2010, so I'm definitely looking forward to it. My session is SQL Server Tips for Everyday Programmers. If you're in the area, be sure to get registered and come on out to NCDevCon, there's an excellent line up of sessions this year!

How to see if a function exists in a CFC

{ Posted By : Eric Cobb on January 21, 2011 }
Related Categories: Tips 'n Tricks, CFML

Just recently I came across a situation where I needed to determine if a specific method was available in a CFC. I have a case where I'm creating specific methods for specific departments. So in the code, if Department A has a method, do this, if not do that. As it turns out, this is super super simple to do from within the CFC.

How simple is it?
It is so simple that I couldn't believe it when I tried it and it really worked. I had to do a double take because, well, I'm really not used to my code working right the first time. I actually felt smert for a change, like I knew what I was doing!

More »

When is a Structure not a Structure?

{ Posted By : Eric Cobb on November 4, 2010 }
Related Categories: Tips 'n Tricks, CFML

A few days ago I was working on an application I inherited and needed to clear a structure that was stored in the session. No problem, right? Just use StructClear(). But every time I tried, I got an "Element is undefined" error. I knew the elements were there, I could output them with no problems. But for some reason, StructClear() refused to see my structure.

More »

Using an array to sort dates.

{ Posted By : Eric Cobb on October 7, 2010 }
Related Categories: Tips 'n Tricks, CFML, ColdFusion

Here's an interesting little tidbit I thought I'd pass on. Yesterday I had a case where I needed to select the latest date out of about 4-5 given dates. The dates could range anywhere from today to a year ago. My first inclination was to just have a bunch of CFIFs comparing the dates and filtering through and determine which one was the latest. But then, I thought about how easily arrays can sort values and wondered if I could apply that to dates as well. As it turns out, you can, and it's really simple to do.

More »

Using RepeatString to create a mask in NumberFormat

{ Posted By : Eric Cobb on September 2, 2010 }
Related Categories: Tips 'n Tricks, CFML

Today I was working on creating a CSV file that required numeric columns to be a fixed number of digits, using leading zeros to make up the difference. So, for example, if the column required 5 digits, the number 123 should show up as 00123. This is super simple using the NumberFormat() function in CFML, simply specify a mask like so:

<cfset variables.myNum = NumberFormat(123,'00000')>

But, in my particular case, I had several columns that required 12 and 15 digit numbers.

More »

ColdFusion debugging breaks jQuery AJAX calls

{ Posted By : Eric Cobb on June 17, 2010 }
Related Categories: Tips 'n Tricks, jQuery, ColdFusion

This may be a no-brainier for some, but I fought with it for about 2 hours yesterday so I wanted to make note of it in case it happened again.

I had a situation where my code worked correctly on my local development machine, but wouldn't work in our staging environment. The exact problem was that I was using jQuery to call a CFC, which returned some JSON, and jQuery then populated a div with it. Pretty basic stuff. But for some reason, on our staging server jQuery encountered problems and would never populate the div, even though I could see in FireBug where the CFC call was returning the JSON correctly. All code was identical in every comparison, and both sites were using the same database so the data was identical as well.

More »

Using a Java Object to replace blanks in a list.

{ Posted By : Eric Cobb on March 26, 2010 }
Related Categories: Tips 'n Tricks, CFML, Java

Today I was working on parsing through a CSV file, when I came across the all too familiar "ColdFusion ignores blank list elements" situation. This is nothing new, it has been around forever, and there's even an excellent udf on cflib that does a great job of handling this. But, I was feeling a little creative and decided to see if I could tap into Java and accomplish the same thing.

As it turns out, it was actually pretty easy to do.

More »

Using Java objects to loop through a directory and check date last modified on files.

{ Posted By : Eric Cobb on February 25, 2010 }
Related Categories: Tips 'n Tricks, CFML, Java

This is probably a no-brainer for some of you, but I was playing around with CFML's underlying Java capabilities the other day and thought I would share this little gem. Not that it's all that extraordinary, or even really useful, I've just got some free time and I haven't blogged anything in a couple of weeks so I figured "why not?".

More »