Running ColdFusion 9 on Windows 10

CommandBoxLogoMost of us find it impossible to install and run Adobe ColdFusion (ACF) 9 on Windows 10. There are a select few that suspiciously find it easy to install and run on Windows 10.

One of the more popular methods is to create a Windows 7 Virtual Machine (VM) and install Windows 7 there. I’ve even done that. But what you find, particularly on Hyper-V, is that it lacks portability. I can’t reasonably send another developer my VM. #1 due to licensing issues #2 it can be huge depending upon the size you reserved for the virtual drive.

But thanks to the Ortus team, and with a little open mindness, CommandBox takes care of this issue. From the Ortus website: “CommandBox is a standalone, native tool for Windows, Mac, and Linux that will provide you with a Command Line Interface (CLI) for developer productivity, tool interaction, package management, embedded CFML server, application scaffolding, and some sweet ASCII art. It seamlessly integrates to work with any of our *Box products but it is also open for extensibility for any ColdFusion (CFML) project as it is also written in ColdFusion (CFML) using our concepts of CommandBox Commands. It tightly integrates with our contribution community; ForgeBox, so developers can share modules world-wide.”

So basically what’s going on here, in this blog entry’s context, is CommandBox will run ACF 9+, Railo 4.2 and Lucee 4.5+. This is done by running a WAR in Java against CommandBox’s own web server which still supports ACF9 integration. Technically you’re supposed install Java 1.7 for official support of ColdFusion 9. However, from what I’ve seen, it runs just fine on Java 1.8.

Here are the easy steps in Windows to get you running in less than 10 minutes:

  1. Download CommandBox at https://www.ortussolutions.com/products/commandbox#download. I suggest “With JRE Included”.
  2. Extract the contents to something like C:\CommandBox. For all other OS’s see Installation.
  3. Open a Command Prompt
  4. Go to your new directory, such as “CD C:\CommandBox”
  5. Type “box” and enter
  6. This will then initiate Box for the first time and then take you to the Box CLI.
  7. Change the directory to your first website that needs ColdFusion 9, in this example. ex: “cd \websites\cf9test”
  8. Here we will set the ColdFusion engine, version, hostname (optional) and name (optional). Run:
    server set app.cfengine=adobe@9 (this will run the latest version of ACF 9)
    server set web.host=cf9test.local (be sure to set in DNS or your hosts file to 127.0.0.1 or you will get a “Cannot assign requested address: JVM_Bind” error)
    server set name=cf9
    *
  9. Step #8 will be saved in server.json and never needs to be done again as long as that file is intact. For more configuration arguments, see Server.json.
  10. Type “start” and enter**
  11. This will download the ColdFusion 9 WAR and extract it and then initialize it. This may take a number of minutes.
  12. Once CF9 is “installed” a browser window will open up to “http://cf9test.local” or whatever you set the web.host to. If you didn’t define web.host it will open up to “http://127.0.0.1”. Either way it will use a random port number. This port number can be defined in the server.json configuration file.
  13. Append “/CFIDE/Administrator” to the URL it is using. If you accidentally closed the browser tab, look for the blue CF task icon in your task bar. Click it once and click “open browser”.
  14. The password to the ACF admin is “commandbox”
  15. Configure necessary settings such as data sources or enable J2EE session variables if needed.
  16. Then go back to your root URL and you should be up and running.

There is so much you can do with CommandBox, including https, URL rewrite and even generating CFM frameworks. See the CommandBox Manual for more.

*When setting the server name, this will allow you to keep configurations stored such a DSN in the admin. You can use a general name such as “cf9” and use it among different instances or you can use a more specific name just for that instance or a group of instances such as “mysite”. Without it, you have a chance of loosing or overwriting configurations in the CF Admin.

There is a way to script out you ColdFusion config, such as DSN’s, using CFConfig CLI. However as of this post writing, it doesn’t allow you to use ColdFusion 9. But feel free to experiment using this with other versions or later down the road.

There are a number of other ways to configure your servers as well. See Configuring your CommandBox servers on first start by Brad Wood.

**The trick to thinking here is the webroot for the website being loaded up in your browser, is the directory you run “start” in.

Advertisements

ColdFusion Framework Note

I tend to monitor the “ColdFusion Programmers” Facebook group. Today a poster asked:

Hi guys, What do you prefer: CFWheels or Coldbox? I used before CFWheels and is good but I recently starts playing with Coldbox and so far is pretty cool – Jorge Alexandro Martinez Dominguez

My response was:

I use FW/1 for about everything because it’s simple and what I know. However ColdBox will give you a ton more functionality via modules and they aggressively keep that framework up-to-date. They are very involved in the community and even have a “Into The Box” event once a year for pre-conference. I would use either, but if you’re new to both I’d probably look at ColdBox. Both base frameworks are similar.

ColdBoxLogo2015_300Brad Wood, from Ortus Solutions, also chimed in a with a blog post from 2015 about how ColdBox 4 changed pretty drastically. It’s always a good read when asking yourself the Framework question: It’s Time You Looked At ColdBox 4

Simple jQuery AJAX w/ ColdFusion

I had a request to supply a sample HTML page that would send a subscriber’s email address to ColdFusion without reloading the page. So I figured I’d post it here for any others looking for a simple example. This method uses jQuery, AJAX and a ColdFusion component.

index.html or index.cfm

<!DOCTYPE html>
<html>
	<head>
	</head>
	<body>
		<div id="subscribeContainer">
			<input type="email"><button type="button">Subscribe</button>
		</div>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>

		<script>
			(function($) {
				// bind the button with an event handler
				$('#subscribeContainer button').click( function(e) {
					// when button is pushed, POST data to remote ColdFusion component method
					$.post(
						'subscription.cfc',
						{
							method: 'subscribe',
							email: $('#subscribeContainer input').val()
						}
						)
						.done( function() {
							// everything worked
							$('#subscribeContainer').text('You have been subscribed.');
						})
						.fail( function() {
							// something failed
							$('
<span>There was an error subscribing.</span>').appendTo('#subscribeContainer');
						}
					);
				});
			})(jQuery);
		</script>
	</body>
</html>

subscription.cfc

component {

	remote void function subscribe( required string email ) {
		// call database insert method here
	}

}

Come Work With My Team!

CF Webtools LogoCF Webtools, where I’ve placed my career coming up on 8 years, is seeking a talented ColdFusion developer. We’re 25 strong and are looking for #26!

You can either work remotely in the comforts of your own personal office space (AKA your spare bedroom) or enjoy your own office space at our Omaha, NE office. We keep in touch with each other day-to-day via Skype. This provides us with one-on-one, project chats and company-wide chats. Most of the time it’s text chatting, but we also use it for voice when it’s just more efficient.

CF Webtools is a great fit for me because it provides the diversity and challenges needed not to become worn out with the same task over-and-over. There are always new opportunities that arise over the years. With this also comes constant learning. Each project brings its own set of challenges.

Granted most projects are not picture perfect as they tend to build up technical debt over time; but you get the opportunity to sell your expertise to the customer giving them the best path forward fitting their needs.

Experience needed not only includes ColdFusion but SQL, SQL, SQL, web server, Windows, Linux, Mobile OS, basic networking and just a good set of troubleshooting skills.

Give Mark or Jason a call at 402-408-3733, tweet @cfwebtools or contact the business owner Mark via his blog at coldfusionmuse.com .

Omaha Staff 2015

Omaha Staff

 

#career, #cf-webtools, #coldfusion-2, #job, #nebraska, #omaha

Allaire Brothers talking about ColdFusion

“What is the best IDE for CFM”

I run into the question “What is the best IDE for CFM” here and there. So I thought I’d post my response here as well for others to find:

I personally use ColdFusion Builder and Sublime Text 3 for my projects at CF Webtools.

There is only one IDE for ColdFusion: ColdFusion Builder. An IDE, as opposed to a code editor, has the ability to communicate with a ColdFusion server instance and debug your code. It can also introspect your code, offering code hints based upon what your code is doing.

  • ColdFusion Builder is actively updated. Versions 1 and 2 had massive footprints that really turned me off. I have found that version 3 is much faster and therefore I find much more usable than the previous two. Builder 2016 also came out but you only gain a newer version of a JRE and Security Analyzer which you need CF Enterprise to even run. So I’ve decided not to spend the money for a fairly worthless upgrade at this point.

Everything else is just a code editor (enhanced text editor). A code editor, as opposed to an IDE, does not debug or introspect your code. In order of my recommendation:

  1. The ColdFusion Plugin for Sublime Text doesn’t support CF11 and you can’t install it on version 3 via the package manager. But overall Sublime Text is an excellent code editor. I recommend also installing a jshint package for JavaScript development. It’s a good deal for $70, plus version 3 has been free to try for a long time now while it’s in Beta.
  2. Atom was suggested for me to put on this list. It’s an open source desktop application built with HTML, JavaScript, CSS, and Node.js integration by the folks at GitHub. Adam Tuttle put out a language-cfml package. I’ve never used it but have seen it mentioned a few times on Slack.
  3. ColdFusion Builder Express makes the list as the Express version. Basically use the trial version for 60 days, then it’ll revert to a more basic and free version without the IDE functionality.
  4. CFEclipse might be the most recent with their 1.4.6 release that “only” took 2 years to come up with. But it is free.
  5. cfbrackets for Brackets is still in Beta and hasn’t been updated since June of 2014. It also doesn’t support cfscript which is a huge negative for me. Brackets is open source.
  6. Visual Studio Code was mentioned in the ColdFusion Facebook group. It has a couple of ColdFusion extensions you can install. One is based upon the SublimeText ColdFusion package. I don’t do MS programming, but from what I’ve seen VS seems like a nice piece of software, so hopefully Visual Studio Code lives up to that and becomes a nice option for ColdFusion.
  7. IntelliJ IDEA stopped ColdFusion updates for awhile, but release 15 has support for it again as of November 2015. They don’t list ColdFusion in their what’s new though. I’ve heard some good things about this, but one major downside is the cost ($500 commercial || $200 personal). As of v14 it doesn’t seem to support IDE functions such as debugging but it does have console support. I’ve heard they may have added some actual IDE features since then:Per Nick Kwiatkowski in August of 2016, “it provides limited CFC introspection. It does have the best refactoring, intellisense and Java tools out there (we deploy our copy of Lucee as WAR files). Additionally, it has a ton of tools for working with SQL, CI, and version control — which are lacking or non-existent in other tools.”

    Per James Harvey in August of 2016, “intelliJ has a servers panel that you can.set.up and use services like RDS and yes, debug from. I had my Railo, Lucee and CF servers tied into it.”

Then of course there are outdated code editors such as:

If you’re looking for a true IDE I would stick with ColdFusion Builder for the sole reason is it continues to receive ColdFusion updates. But then again “best” is subjective.

#code, #coldfusion-2, #editor, #ide

ColdFusion Builder 3 Fuzzy Features

Between ColdFusion Builder 2 and 3, I used Sublime Text editor for about a year. One of the best features that Sublime Text had was fuzzy searches.

For example, on code assist, for a cfqueryparam attribute, I could type “var” and get type=”cf_sql_varchar”. In ColdFusion Builder, you’d have to type “cf_sql_v” to get the same. May not seem like much, but when your brain is focusing on the differences, why should I have to type “cf_sql_” when everyone has that?

Another example would be when using the “Goto Anything” feature, I regularly knew approximately what file name I was looking for, but maybe not exact. So if I type “page”, I may get 30 results. Then I continue to type to get “pagedsp” and find my file “pagedisplay.cfm”. Very handy and quick.

In ColdFusion Builder 3, everything relies upon starting from the beginning of line and pretty exact. It’s very rigid. The file content searches also always take a bit of time.

2014-05-23_1654

 

The alleviate the file search issue, I installed the InstaSeach plugin : http://marketplace.eclipse.org/content/instasearch

This plugin instantly returns fuzzy results if your keyword matches text inside the current open file, a file name or content inside a file — INSTANTLY —

Highly recommend to replace your Search > File and Search > Search

 

To alleviate the code assist issue:

Go to Preferences->ColdFusion->Profiles->Editor->Code Assist and select option ‘Filter Proposals Containing Text’

Thanks to Ramchandra Kulkarni for this tip.

Now I can just type “v”, arrow down once to pass up “cf_sql_longvarchar” and hit enter.

 

It’s the little things in life.

#coldfusion-2