Running Coldfusion 9 Without IIS6 Metabase

I’ve installed CF9 a few times, but until recently it’s always been a rushed affair and I just bumbled through the install to get a working server up fast. This time around I decided to do some research and perform the install with  performance and security in mind.

It always bothered me that when installing CF9 you had to enable the IIS6 Metabase role in the server just to get it working. But with update 9.0.1 that’s no longer the case. Just install that update and remove the IIS6 roles and you’re good to go.

Check out this great vid from MrBond8821:

The YouTube ID of http://www.youtube.com/embed/cjeU_4dKRYc is invalid.

Enabling Java Servlet Directory Browser in Coldfusion 9 Administrator

When you first install CF9 you’ll soon notice that any administration page that offers to let you browse the directory structure will give you an I/O error.

This file browsing servlet requires RDS to function. The RDS servlet is disabled by default. It should be disabled on a production server, but if you’d like to use this feature you’ll need to un-comment the servlet call in your server’s web.xml.

In my case this file was located at F:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\web.xml but I’m running multiserver. Your’s could be under your CF9 install directory if you’re running CF as a standard install.

Un-comment these two servlet definition blocks in web.xml.

AND

Now restart your CF server instance and navigate back to the administration page you were wanting to use.

 

Coldfusion Method to Convert a Query to CSV

I’ve been working with Magento recently and finally came to the point where I needed to import data from MSSQL into Magento’s MySQL. First idea in the pipe was to use build an exporter in our existing CF arcetecture and import the resulting output using Magento’s DataFlow profiles.

I’ve since decided to fore go that setup and go for the gold with Magento’s API (that’s a story for another time!). But while still working on that short lived DataFlow import idea found my self needing to convert a CF query object into CSV. Some Googling lead me to Ben Nadal’s place and some example code.

I’ve since modified his code to fit my purposes and present it here for your purusement. The main difference between Ben’s snippet and my own is the use of script syntax and I’m just looping over query.columnlist for the header row rather than passing in a list of column names. I didn’t need to limit columns returned in the CSV

Bench-marking cfdirectory v. java.io.file

Today I’m working on decreasing execution time on a script that does a couple DB querys and cfdirectory lists. After some preliminary testing my gut perception has proven true; the exorbinate execution time is due to cfdirectory.

So I set out to find a faster way of getting file information from directories and sure enough taking things back to Java is the way to go. See my benchmark code below and the results. I’m sure you’ll agree.

        // UNC path to look in
	curDir = '\myuncpath';

	// ftime will hold the execution time
	// fio is our java.io.File object
	ftime = gettickcount();
		fio = createObject('java','java.io.File');
		mylist = fio.init(trim(curDir)).list();
	ftime = gettickcount() - ftime;

I run the exact same thing in cfdirectory (tumblr strips cfml tags from posts or i”d post that here too). The results in my case show: files: 3409, ftime: 31, dtime: 17608.

That’s 3409 files. Java returns a list of names in 31ms while cfdirectory does the same in 17.5 seconds.