Tuesday, January 23, 2007

New blog is up

Hi all,

My new blog is up. I will not be posting any more blog entries to this blog. Please check out my new blog at:

http://www.dkferguson.com/BlogCFC/



Thanks,

--Dave

Friday, January 05, 2007

Flush output from inside cfscript

So, you have a huge cfscript section but you want to flush some output without ending the cfscript? Maybe you are looping over some data and want flush out some data as it loops. Now, I bet you are thinking what I was. How can I do this? I can't use cfflush inside cfscript. You are right, but there is a way. Try this:

getPageContext().getOut().flush();

This works just like cfflush. It will flush all generated output to the browser. But, you can use it inside cfscript!

That is it for now,

--Dave

Wednesday, January 03, 2007

My article is comming out!

The December '06 issue of the Coldfusion Developer's Journal will have my article in it. The article covers some interesting ways to get around a couple issues with the directory watcher gateway.

--Dave

Tuesday, January 02, 2007

Query columns = CF Objects

I spent about 30 minutes this morning tracking down a bug. For the life of me I could not see what the problem was. I had a asynchronous event throwing an error and the error in the logs stated there was an error invoking the event gateway. However, due to the way that CF logs errors the message, however accurate, did not give very much detail as to where the error actually occurred. So, I turned on my custom debugging for gateways that I wrote and was able to track down the error. The error was actually in an include not the async code itself. Finding it was one thing. Then trying to figure out why there was an error was a different story.

I had a query output where one of the columns was "client". Now, normally this would not be an issue. However, there was an error in the query so the column "client" was not in the query. Thus CF tried to use the client scope for the output. Since I was trying to output a simple value "#client#" it threw an error "Complex object types cannot be converted to simple values".

The moral of the story:

Avoid using CF objects like "client" as column names.

--Dave

Monday, January 01, 2007

Happy New Year

Have a great year. May the forces of evil become confused while tying to find you.

--Dave

Thursday, December 21, 2006

New Project "CFCMapper"

I am working on a new project. It was the result of my need to figure out a few things in a different project I was working on.

I have named this project "CFCMApper". Basically it maps out all the dependences between CFCs. The mapper will crawl a directory recursively and find all the CFCs. It will take what it finds and map out other object calls are made from inside the CFCs. IT will then store the results and create a browsable version. You can then see what object calls are being made by a CFC. You will also be able to do the inverse and see what CFCs are calling an specific object.

This is not a replacement for the CFC explorer that ships with ColdFusion. It is merely a tool to see the dependences between objects. The CFC explorer does not examine the code for object calls nor does it create a list of dependences. The CFCMapper does not go into detail about the CFC.

More details to come as I work out all the code. I will be setting up a website for it very soon so stay tuned. The website will allow you to sign-up to get a prerelease version to take it for a test drive. If you want to get an alpha version to play around with send me an email (dave@dkferguson.com) and I'll get it to you.

--Dave

Tuesday, December 19, 2006

Store Object in CF Query

I was working on an application that takes an xml document and transforms it into a simulated database query return. I made a minor typo and discovered something that I did not know was possible. Instead of putting the xmlText into the cell I actually put the whole xml node into the cell. For example:

TheQuery = QueryNew("col1, col2");
TheXML = XMLParse("c:\thexml.xml", false);
void = QueryAddRow(TheQuery , 1);
void = QuerySetCell(TheQuery , "col1", TheXML.rootNode.xmlChildren[i].subNode.xmlText);
void = QuerySetCell(TheQuery , "col2", TheXML.rootNode.xmlChildren[i].subNode);


In the example above the output would have the xmltext of the subNode in col1 and the entire subNode in col2.

I am not quite sure how or where to use this. However, knowing it is possible may be handy someday.

--Dave