Blocking User Agents

ColdFusion, IIS

I recently setup a new dev server and the CF service kept crashing in the middle of the night. Looking at the traffic it was bots from the other side of the planet and they were clearly not listening to the robots.txt file. Since it's a dev server I don't really want them advertising my site so off to google I went for a solution. I came across this simple way to block user agents. I currently use IIS on my dev server so I followed the instructions and woke up the next morning with a dev server that was still running. Yay! I did have an issue with the user agent switcher not working on Firefox on my mac so I never tested. I figured I'd let the bots do my testing. So far it's JP 1, Bots 0 after one day.


Using remote functions with JQuery but you want to use XML pass the query paramters?

ColdBox, ColdFusion

Are you using remote functions with JQuery but you want to use XML pass the query parameters? If you aren't you should be.

Well, why in the heck would I suggest such a thing? It's because Steve had the brilliant idea to reduce execution plans on the database using this nifty trick. So if we combine frequently used GET type queries (AKA get stuff from tablename where blah) into a single query and use a parameter to tell the stored procedure what to return we can reduce plans and improve server performance. So wow cool idea, but umm I'm calling the model directly dude. Steve being a DBA says, "why can you just generate XML like you always do?". Well as most Coldboxers should know, "When you call a CFC from the URL like that, it isn't autowired.  This is because the CF engine just creates a CFC instance directly and WireBox doesn't have a way to intercept that."  (Thank you Brad)

What does this mean? My handy dandy tools like my XMLConverter and populateModel tools aren't available. Loving my framework the way I do... I think, oh hell, I'm not going to manually write my own special XML tool. I'm way too smart, well lazy, for that.

So Brad tell me ....

"ColdBox 4 does have a new feature though, where CFCs that extend the base proxy class will get autowired in the pseudo-constructor.  Otherwise, you'd have to do something like application.wirebox.autowire( this ) in the CFC.  Or, for that matter, application.wirebox.getInstance( 'foo' )."

Well I'm not at CB4 yet. So I guess I'll call the autowire my darn self.

 Here is an example. 

component extends="baseService"


application.wirebox.autowire( this );

remote query function test(numeric param1=0,numeric param2=0)


            LOCAL.xml = XMLConverter.structToXML(Arguments);





Now being a lazy programmer, my hand dandy XMLConverter that can take a struct and make it XML autoMagically is injected in my base model (typing is hard work ya'll). Since this this model initializes wirebox and extends the base model I can use it. Yee Haw. Normally, I use populateModel to grab the form data and convert it a model that is a struct and then convert that to XML. But in this case as I pass stuff into the model it becomes part of the arguments struct so it already created my struct for me. Sweet! Just replace my dump with the usual stored procedure call and the DBA is happily processing XML.

Warning: Please don't be a dumb dumb and use this method for sensitive data. Use a handler so you can do things like an interceptor or a prehandler to check that the person asking for data is supposed to be getting the data. We only use this for frequent reference table type information. We NEVER use this to save data. 

Here's to being smart, um lazy. 




ColdBox, ColdFusion

I started getting this issue when using CFDOCUMENT one day. 

cfdocument Parsing problem occurred during the rendering process of this document.

I typically use Coldbox as a framework so in this case I had a layout where I was CFDOCUMENT to do all my PDF "rendering". So the customer reported to me that the server has an issue creating PDFs. I tried everything only to learn the basically CFDOCUMENT if very picky when it comes to W3C validation. In my CFDOCUMENT, I had done a CFINCLUDE on my CSS. That CSS was the cause of my IOException problem.

<style type="text/css" rel="stylesheet">

        <cfinclude template="/includes/css/style.css"  >


I modified my CSS and the problem went away. So hopefully this saves you some time.

Validate your HTML:
Validate your CSS:

CFHTTP using script

So I thought since CF11 allows the use of script tags that maybe I had a work around for the Update 3 bug. I rewrote my code as shown below but I still get the issue with the file being empty.


function elasticEmail2(event,rc)



cfhttp(result = "LOCAL.result",method = "put",

        url = "[email protected]&api_key=removed&file=EGTest",

        getAsBinary = "yes")


        cfhttpParam(type = "file",name="EGTest",file="c:\somefolder\test.csv",mimetype="Content-type: text/csv");

        cfhttpParam(type="formfield",name="username",value="no-[email protected]");





  cfhttp(result = "LOCAL.result2",method = "post",

        url = "")


         cfhttpParam(type="formfield",name="username",value="no-[email protected]");










Bug filed here:



Coldfusion 11 Update 3 has an issue with using HTTP to put files


So I've blogged about all this Elastic Email stuff. One of things that I do is create csv files that are then posted via API using http to Elastic Email using the mail merge API.  I recently migrated servers and suddenly had a issue. I was previously using CF9 and everything was good. Well I jumped all the way to CF11. I had tested my code in Dev which was CF11 so I thought I was good to go. Well I didn't check but my dev server was running 11,0,0,289974 and prod was running update 3. I downgraded and I was back in business.

As the updater says....

"ColdFusion 11 Update 3 includes support for JDK 8, Tomcat 7.0.54 and other platforms/servers/databases besides ~195 bug fixes (internal and external) in AJAX, Charting, Caching, Database, Language, Mobile Support, Net Protocols, Security and other areas."

....but it also introduces a cfscript http put bug.