Justin Carter's madfellas.com

Running CF7 and CF8 Services with a batch file menu

As a follow up to my previous post on Running CF7 and CF8 simultaneously on IIS7 I thought I would share the batch file I use to manage the starting and stopping of the ColdFusion services and some other tips. Note that this mostly Vista specific stuff, including the batch file itself (it uses the 'choice' command which is different in Vista compared to previous versions of Windows).

When running both CF7 and CF8 on the same development machine I generally set all the services to Manual start-up and set only one of the ColdFusion Application Server services to Automatic (Delayed Start). Delayed Start is a new option in Vista that aims to keep your system snappier at boot up, so any services that are set to Delayed Start won't be started immediately during the boot process and will instead execute later when other services have had time to start and finish using time-critical resources.


To manage the starting and stopping of the ColdFusion services I wrote a simple batch file that has a menu for selecting which service you want to start or stop. If you save the batch file as UserDocumentsscriptscf.bat it is easy to have quick access to the file by hitting the windows key and typing 'cf.bat'. You can then right click on the file and choose "Run as administrator" so that the process will have permission to start and stop services.


When the script is running you will be presented with a simple, straight forward menu.


Below is the full script if you would like to use it. It could be customised to add any other services you might want to start and stop such as MS SQL Server, MySQL, PostgreSQL, IIS, Apache, etc. Note: use the "view plain" or "copy to clipboard" links to easily copy the code, paste into Notepad, and save as cf.bat.


@echo off
REM ColdFusion Services helper batch file, by Justin Carter
REM http://www.madfellas.com
REM This script is provided as is, with no warranty of any kind.
REM Use at your own risk :)
echo. 1) Start ColdFusion 8
echo. 2) Stop ColdFusion 8
echo. 3) Start ColdFusion MX 7
echo. 4) Stop ColdFusion MX 7
echo. Q) Quit
choice /c 1234Q /n /m " Choose a menu option:"
if Errorlevel 5 goto quit
if Errorlevel 4 goto stopcf7
if Errorlevel 3 goto startcf7
if Errorlevel 2 goto stopcf8
if Errorlevel 1 goto startcf8
goto quit
net start "ColdFusion 8 Application Server"
REM net start "ColdFusion 8 .NET Service"
REM net start "ColdFusion 8 ODBC Agent"
REM net start "ColdFusion 8 ODBC Server"
REM net start "ColdFusion 8 Search Server"
echo. ColdFusion 8 Services started
goto menu
net stop "ColdFusion 8 Application Server"
net stop "ColdFusion 8 .NET Service"
net stop "ColdFusion 8 ODBC Agent"
net stop "ColdFusion 8 ODBC Server"
net stop "ColdFusion 8 Search Server"
echo. ColdFusion 8 Services stopped.
goto menu
net start "ColdFusion MX 7 Application Server"
REM net start "ColdFusion MX 7 ODBC Agent"
REM net start "ColdFusion MX 7 ODBC Server"
REM net start "ColdFusion MX 7 Search Server"
echo. ColdFusion MX 7 Services started.
goto menu
net stop "ColdFusion MX 7 Application Server"
net stop "ColdFusion MX 7 ODBC Agent"
net stop "ColdFusion MX 7 ODBC Server"
net stop "ColdFusion MX 7 Search Server"
echo. ColdFusion MX 7 Services stopped.
goto menu

Running CF7 and CF8 simultaneously on IIS7

Recently I started work at a new job in London and found myself needing to do some local development with CFMX7 while still keeping my existing CF8 installation available for local development as well. One option — which is what I did initially to get up and running quickly — was to run CFMX7 in stand-alone mode using the built-in web server, but eventually I needed to be able to switch between multiple projects (web roots) easily because I could be working on more than one project at a time.

Since we use IIS in our production environments it makes sense to use it in a development environment as well, rather than playing with Apache or another web server, and I also wanted to keep everything under a single web server instance so that I didn't have to worry about fiddling with port numbers and and multiple web server services. Thankfully IIS7 makes per-web site configuration really easy with it's web.config files, as you will see below.


I started with an existing CF8 installation that was originally set up to apply to all IIS web sites. I also store all my data on D: and so the the CFIDE and CFDOCS folders for CF8 were initially installed to D:inetpubwwwroot.

When it came time to install CF7 I chose to install it in server mode using the built-in web server. This places the CFIDE and CFDOCS folders for CF7 in C:CFusionMX7wwwroot, so you won't have to worry about overwriting the CF8 files.

ColdFusion Configuration

To allow IIS to talk to ColdFusion we need to make sure the JRunProxyService isn't deactivated which you can do by editing C:CFusionMX7untimeserverscoldfusionSERVER-INFjrun.xml. To do this just follow the first step in the Adobe TechNote titled ColdFusion MX: Manually configuring the web server connector for ColdFusion MX Standalone. This simply changes the deactivated value from true to false. (You can also use this opportunity to deactivate the JRun built-in web server by editing the same flag just above in the WebServer service config).

Next we need to make sure the web connector DLL's and configuration files are available. These files won't have been installed and/or created when we chose to use the built-in web server so we will have to extract and configure them manually. We could follow the rest of the above TechNote to get up and running, but it has been summarised much better (and specifically for IIS7) on page 6 of a Community MX article called Getting ColdFusion MX 7.0.2 Running on Vista and IIS. Following steps 1 to 7 you will extract the IIS related DLL files from C:CFusionMX7untimelibwsconfig.jar and create two configuration files to go with them. Give the ColdFusion MX 7 Application Server service a restart now for good measure.

IIS7 Configuration

In IIS Manager create a new web site as you would normally, with a new web root and using host headers to differentiate between web sites (e.g. create the site in D:inetpubcfmx7, give it the host header cfmx7.local and edit your hosts file to alias as cfmx7.local).

The new site will be created with the Handler Mappings from the top level web server configuration which will be pointing to the CF8 files (meaning if you were creating a new site using CF8 then it would be ready to go without any configuration). To get this site to work with CF7 we just need to change each of the ColdFusion-related mappings to use the web connector that we just extracted and configured above.

IIS7 Handler Mappings for ColdFusion MX 7

Select the newly created site in the site tree, double-click on the Handler Mappings icon, and set the executable for each CF-related mapping to C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll. The most important ones will be the wildcard (*), *.cfm(l), *.cfc and *.cfr, though it only takes a few seconds to configure the other 4 or 5 while you're at it.

That should be it, you will now have an IIS7 site running CFMX7! Create a new .cfm file and use <cfdump var="#server#"> to confirm :)

Creating additional CF7 sites

The beauty of IIS7 is that site-specific configuration is written to an XML file in your web root called web.config. This means no more stuffing around with the IIS metabase as in IIS6, and the benefit we get here is that you can keep a copy of this file (like a "template") and then next time you create a new web site that will use CF7, simple copy and paste the file into the web root and you are ready to rock without any additional configuration! This is what my own web.config file looks like:

<?xml version="1.0" encoding="UTF-8"?>
            <remove name="AboMapperCustom-75808" />
            <remove name="AboMapperCustom-75807" />
            <remove name="AboMapperCustom-75806" />
            <remove name="AboMapperCustom-75805" />
            <remove name="AboMapperCustom-75804" />
            <remove name="AboMapperCustom-75803" />
            <remove name="AboMapperCustom-75802" />
            <remove name="AboMapperCustom-75801" />
            <remove name="AboMapperCustom-75800" />
            <add name="AboMapperCustom-75800" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="None" responseBufferLimit="0" />
            <add name="AboMapperCustom-75801" path="*.jsp" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />
            <add name="AboMapperCustom-75802" path="*.jws" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />
            <add name="AboMapperCustom-75803" path="*.cfm" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />
            <add name="AboMapperCustom-75804" path="*.cfml" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />
            <add name="AboMapperCustom-75805" path="*.cfc" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />
            <add name="AboMapperCustom-75806" path="*.cfr" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />
            <add name="AboMapperCustom-75807" path="*.cfswf" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />
            <add name="AboMapperCustom-75808" path="*.mxml" verb="*" modules="IsapiModule" scriptProcessor="C:CFusionMX7untimelibwsconfig1jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />

Though I haven't tested it, you could probably use a similar procedure for older releases of CF such as CFMX 6.1, or maybe even future versions such as CF9 ;)

Happy configuring!

Focus on the window at hand: Shroudy

I've been sitting on this idea for several months and thought I would throw it out there to see if it has any merit. It has to do with workflow and focusing on your current task or, more precisely, focusing on the window(s) you are currently working in.

The idea was prompted by a post that I read on Rob Rohan's blog about WriteRoom and JDarkRoom, both of which are very minimalist, full-screen text editors somewhat reminiscent of the good old monochrome days (hah) which are simply sporting some coloured text on a black background and not much else (visibly speaking). The idea behind it is that you can focus on what you are writing without any distractions; no flashing chat windows, notifications, or other adjacent windows catching your eye.

So what happens if you want to achieve this ideal when you're working with any other applications and not just a text editor? The solution for some people is to maximise the window and be done with it, but personally I only ever maximise a select few applications (e.g. Outlook, Photoshop, Excel) because they actually demand a lot of screen real estate. Most applications I use, particularly for development work, are windowed and arranged in a way that I can quickly and easily switch between them with a single click and without going all the way down to the taskbar with the mouse.

My idea is to go with the trend of what we've already seen happening in user interfaces in the last few years, ala Lightbox, Windows Vista's Secure Desktop, and Expose on OS X (it's subtle, but it's there). We could use a dark overlay or "shroud" to mask the unused areas of the screen, allowing us to focus more clearly on the application that we are using at that moment.

Focus on the window at hand: Shroudy

In the screenshot you may notice an AIR application in the taskbar called "Shroudy", which is also the name I used in the title of this post. Don't get too excited because it is indeed a truly "dumb" application that would never work in the real world (as an AIR app), because it has no built-in "smarts" and can't get access to the OS level stuff that it would need. But what it did was let me get an idea of how it would feel to work with a shroud covering the parts of the screen I wasn't interested in at that point in time, and I have to say I think it was nice. It also got me thinking about other usability aspects which I think I have answers for...

So how would an application like Shroudy work in the real world?

  • It would be an opaque window covering the entire screen
  • It would not appear as a running program in the taskbar, it would have an icon in the notification area
  • It would have an option to enable or disable covering the taskbar, or to disable covering the taskbar when the mouse hovers over it
  • It would have a configurable opacity level, and a configurable dynamic opacity level which could change when the mouse cursor is outside the bounds of the active window (it could get lighter for better visibility, then after some timeout go back to it's original value)
  • It would not display the "shroud" if there are no applications open
  • It would be activated or deactivated by holding the Windows key for 3 seconds (configurable)
  • It would listen for window activation messages and place itself directly below the active window in the z-order
  • It would not capture any clicks directly, but instead pass them to the window(s) behind it (a click on the desktop would deactivate it)
  • It would support multiple windows being "on-top" of the shroud, either by Control-clicking on windows ("Control-clicking through the shroud"), or even holding the Control key while the mouse cursor is over an inactive window, to bring it above the shroud while keeping the other active window(s) above the shroud
  • It would support pinning applications "always on-top" of the shroud, by selecting them in the context menu of the notification icon
  • Similarly, it would support being deactivated by default and only being active when using some certain applications, by selecting them in the context menu of the notification icon
  • It would support multiple desktops with a configuration open to choose either a common shroud across all desktops, independent shroud on each desktop, or being enabled on some desktops and not others
  • Similarly, it would support multiple virtual desktops, to support the use of applications such as DeskSpace or any native virtual desktop implementations (Windows 7, please!)

Unfortunately I'm not a Windows developer so I can't make this kind of application become a reality (I haven't touched the Win32 API or our good friends hWnd, wParam and lParam in at least 6 years! And who knows what kind of obstacles Vista might have thrown in on top). Still, I'd be interested to know if anyone thinks something like this is a good idea (or if I'm just nuts), and more interested still if someone thinks they could actually pull it off :)

And if someone does it on OS X or Linux first I'll be annoyed; maybe even annoyed enough to change operating systems! But probably not, hahaha...

Anyway, Shroudy is an application I'd like to have, or a feature I'd like my OS to have. What do you think?

Test IE6 in Vista with IETester

This one came across my Inbox last week and I didn't get around to blogging it until now. The folks that make the DebugBar (free for private use only) and Companion.JS (free) addons for Internet Explorer have released a new (also free) tool called IETester. It works in both Windows XP and Windows Vista when you have IE7 installed as the default browser and allows you to test in IE5.5 and IE6 (I'm not sure if IE8 Beta 1 has any negative effects on it though). It's only an alpha release but from the quick testing I've done it seems to work quite well. The only immediate issue I had was that it assumed Flash support was available but it was unable to render Flash content on any of the sites I tried. So if you aren't a fan of running a virtual machine all day long this could be a promising option :)

DeskSpace for Windows desktop management

I've had a couple of goes at the trial version of DeskSpace recently, but each different version had an issue or two that stopped me from using it full-time. Today I finally purchased it because v1.5.4 seems to have resolved the issues I was having :)

DeskSpace is a pretty slick app for desktop management in Windows and works great on Windows Vista. The rotating cube animation for transitioning between desktops is super smooth on my new notebook, and although you can use up to 6 desktops (1 for each side of the cube) I have been perfectly happy just using 2 desktops, as per the screenshot below. I find it works well to do general browsing and other tasks on the first desktop (which I've set to use Win+Q shortcut), and all my coding and testing on the second desktop (which I've set to use Win+W shortcut). Having different desktop backgrounds also helps you quickly recognise which desktop you are working on. You can also drag windows between the desktops if you wish.


At USD$19.95 it's a bargain price and comes with a 30 day money back guarantee too. I'll see how it goes over the next few weeks, but I think it will be sticking around on my notebook for a while!

High Res Vista Ultimate Wallpapers

Niiiiice, just came across these high res wallpapers on the Windows Vista Ultimate site. I totally dig the dark wallpapers these days ;) I might use one on my desktop PC and the other on my notebook! (hat tip: Neowin.net)

Customise Vista "Start Search" with Start++

A couple of weeks ago I came across this awesome tool called Start++ by Brandon Paddock. It allows you to configure search prefixes and search actions which can be used in the Start Search box on the Start Menu to direct your searches to a specific source, such as your favourite search engines and web sites, build playlists to play in Media Player, preview images and more... A similar feature just for searching has been around for quite a while in the Opera web browser and I was hopeful that Microsoft would pick this up at some point, so I'm really glad that Brandon has found the time to develop this handy application. Here's a screenshot of the few simple search commands that I'm currently using: And here's an example of how you could use the Start Search to find the Borat entry on IMDb: I don't think I'll ever have a Vista installation that won't include Start++, unless it becomes a part of the OS in a future service pack :)

webDU 2007 Countdown gadget for Vista Sidebar

webDU 2007 is barely more than 2 weeks away (21 March for the Workshops, 22-23 March for the Conference), and in my excitement to count down the days until it starts I have been playing around with creating gadgets for the Windows Vista Sidebar. I've whipped up a very simple gadget which contains the webDU 2007 logo and a simple counter that displays the number of days to go until the big event. This is what it will look like on your sidebar/desktop: I've also added the option to choose to count down to either the Workshops or the Conference, as seen below: I've uploaded the gadget to the Windows Live Gallery site and it has already received over 150 downloads without me even telling anyone about it, which is kind of surprising :) I don't know how many of you who are attending webDU will be running Vista, but I hope at least a few of you find this gadget useful! Download the webDU 2007 Countdown gadget Feel free to provide feedback or suggestions on the Live Gallery site or here on my blog. And if you're seeing funky problems with the colours and layout on my blog it's just because I'm still hacking BlogCFC to pieces (no, not really) while I get everything set up. Also, special thanks to Geoff Bowers for allowing me to use the webDU logo. Cheers Geoff, see you at the conference :)