Feb

19

Posted by : Billy | On : February 19, 2012

On Mac, I typically use the ColdFusion Launcher GUI to start/stop ColdFusion (v 9). However, as ColdFusion 10 will be using Tomcat, you can start/stop in the same manner as you start/stop other servers apps like Tomcat, Apache, Railo, etc – via the command line, which is my preference. (I have a ~/servers/ folder, where I launch things via the command line as my development needs dictate: CFML, node.js, you name it)

With the move to Tomcat, the following is available to you in CF10: (I’m on Mac; adjust paths as appropriate for you platform; for example, on Windows, probbably c:\ColdFusion10\)


cd (cf10directory)
cd bin
./coldfusoion restart

Obviously this starts CF10 .. more examples follow, assuming you’re in (Coldfuion10Directory)/bin (these should be obvious, no explanation necessary)


./coldfusion stop


./coldfusion start

An additional option, “status”, just tells you what’s going on


./coldfusion status

The final option, “wsconfig” is how integrate CF10 into existing web servers like IIS or Apache. This command is pretty complex, and worthy of a post by itself. Supposedly to get a GUI similar to what you’re used to, you run


java -jar wsconfig.jar

but this file was nowhere to be found.

Feb

19

Posted by : Billy | On : February 19, 2012

Much has been made of the move from Jrun to Tomcat in ColdFusion 10. This move has changed up the directory structure of ColdFusion 10 compared to prior versoins.

Many of us are no stranger to Tomcat, where CF is deployed as a WAR, inside the webapps folder (unless you changed this in (tomcatdirectory)/conf/server.xml). Say you wanted to add a virtual directory: you knew to go to the server.xml and add a new entry under the <Host> node.

So where is the Tomcat directory in ColdFusion 10?

(ColdFusion10installDirectory)/cfusion/runtime

Adjust as necessary of course for Windows. (probably c:\ColdFusion10\cfusion\runtime)

As best I can tell, Tomcat admin is as you’d expect, so to add a virtual host or change the root directory, you go to (directoryAsAbove)/conf/server.xml

I’ll of course update my blog as find exceptions to the normal Tomcat process

Feb

19

Posted by : Billy | On : February 19, 2012

When I install ColdFusion on my local macine, I typically give it an easy little password for the admin, etc, something like “cf”

Of course, this is rare: most places tend to keep you from using something so easily guessed. I’d never use such a password in production, but I like to get in fast when I’m developing.

When installing the beta 1 release of ColdFusion 10, I saw this for the first time:

So CF 10 tries to set on the right path, but gives you the flexibility if you want an easy password. Maybe they should force you (or at least give you a develpment/production option: forced password complexity if it’s production), but nice to see this change (even if it means I have to click a few extra buttons during install)

Jan

22

Posted by : Billy | On : January 22, 2012

For a while now, I’ve been using Sublime Text instead of ColdFusion Builder/CFEclipse – it’s faster and just gets out of the way. (I do still use Eclipse for MXUnit plugin however)

Getting ColdFusion support wasn’t too hard – I used the great package at https://github.com/indynagpal/coldfusion-sublime-text-2. However, it felt a little too “hands-on” for me for 2011.

However, today I discovered another ColdFusion package. The folks over at sublimetext.info (as best I can tell, not connected to the official company) have a GitHub repo at http://github.com/SublimeText with a number of Sublime Text packages for various languages. ColdFusion is one, and while it doesn’t have the massive snippet support of indynagpal’s, it does do a good job of mirroring some of the most common shortcuts used in Eclipse. You can do the downloading and unzipping thing (or git clone) – uggh – but you can also use the very excellent package manager over at http://wbond.net/sublime_packages/package_control to install ColdFusion support in Sublime Text in just a few steps:

  • Install Sublime Text from http://www.sublimetext.com if you haven’t already (unregistered version currently never times out, but I recommend purchasing it – the time you’ll save not waiting around for Eclipse to load will pay for itself quickly!)
  • Open Sublime, press CTRL (Update: both Mac and PC – *NOT* CMD on Mac) + ` (For the confused: hold down those 2 keys at the same time – note it’s the character below ESC, not a single quote)
  • Copy and paste the following into the console that comes up in Sublime Text: (from http://wbond.net/sublime_packages/package_control/installation)
    import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
  • When it finishes (“Please restart Sublime Text to finish installation” shows in the bottom line of console), close Sublime Text and reopen
  • Click Preferences > Package Control
  • Click “Package Control: Install Package”
  • Scroll to or just type “ColdFusion” – hit Enter
  • You’ll see some action in the status bar of the app – it’ll tell you when it’s installed
  • Code your little ColdFusion heart out now – for into on shortcuts, etc, see the readme at https://github.com/SublimeText/ColdFusion

 

Nov

28

Posted by : Billy | On : November 28, 2011

Every EC2 instance is based on an Amazon Machine Image (AMI), which is basically a VM image. These can be “off the shelf”, or even better, you can customize one to your exact needs.This is really useful when you want to replicate machines, spreading work load across a mini cluster.

You can automate this from ColdFusion. Typically I’ll have a URL I call that starts up a series of tasks on each machine. Since the address for each machine is assigned by Amazon (you can get fancy with Elastic IPs if you’d like, but there’s really no need), it’s a matter of querying Amazon for the list of server names. Of course, if you’re running different types of machines, you want to filter by AMI ID, which of course changes each time you build a new image.

I won’t get into the exact code for querying here, but here’s how you get the AMI for a given machine from within ColdFusion: (Assumption is that this machine is one of your cluster machines, so once you have its AMI ID, you can filter for other machines like it)

<cfscript>
if (! isdefined("application.amiId")){
application.amiId=fileRead("http://169.254.169.254/2011-01-01/meta-data/ami-id");
}
request.amiID = application.amiId;
</cfscript>

Note: above tested in Open BlueDragon 2.0 – use <cfhttp> tag for engines that don’t support fileRead(uri)

As you might guess, that IP address is an API for EC2 metadata. The date is the API version (call the root IP address to get a list of API versions), “meta-data” is the API service, and “ami-id” is the value you’re requesting. (Call the URL without “ami-id” for a list of available values). For more information, go to http://docs.amazonwebservices.com/AWSEC2/2008-08-08/DeveloperGuide/index.html?AESDG-chapter-instancedata.html

Sep

15

Posted by : Billy | On : September 15, 2011

A couple of weeks ago I had the pleasure of having a conversation with Carl Franklin and Richard Campbell on .NET Rocks!, one of the premier .NET podcasts out there. While I ColdFusion is definitely my first love, I do plenty of .NET development, mostly C# WinForms and plain ole C# objects. That said, I think the show is great for more than just .NET – I can’t tell you the number of times I’ve learned new information on their site unrelated to .NET.

The Show

Our conversation was a follow-up to some email I sent them regarding a show where Rey Bango was a guest (talking about JavaScript). Rey, currently at Microsoft, was a ColdFusion guy back in the day, and on the show, ColdFusion was referred to as a “blast from the past”. I think that’s far from true: while ColdFusion is an “old” technology, it’s highly relevant today. So… a few emails later, they brought me on the show to talk up some ColdFusion.

When you speak in a public venue, you generally have an unlimited list of things you want to discuss, but a limited amount of time. So as you can imagine, there were tons of things I wanted to talk about that I’ll try to touch on here.

To the ColdFusion community: You’ll probably find a lot of things I failed to mention, which I did, but the focus was to emphasize that ColdFusion is a modern day language that is as relevant as .NET, PHP, and others. I think we accomplished that purpose. Also, the conversation was a very candid one, and looking back, I fear I may have come off as bashing Adobe a bit. I hope that’s not how my comments were received, but rather, but in the spirit they were given: a desire that Adobe more eagerly embraces its role as a server-side leader and putting ColdFusion more front and center.

To the .NET developers: Based purely on what you heard on the show, you probably have some impressions about what ColdFusion is, and what it isn’t, and how it’s deficient. I’ll attempt to address some of those ideas here

Event handling

ColdFusion does have a large degree of event handling, but it’s more like ASP.NET’s page lifecycle approach: onServerStart/End, onApplicationStart/End, onSessionStart/End, onRequestStart/End, etc. There are error events as well: onError, onMissingMethod, etc. There is also event handling inside of ColdFusion 9′s Hibernate integration, based on various ORM events. It also has an event gateway, which let’s you respond to various non-request events (such as watching a directory or message queue and responding based on defined listeners).

Moreover, the various MVC frameworks add more. (In speaking on MVC, I’ll be referencing ColdBox, which I know best. However, I’m certain most or all of what I address with apply to the others.) These frameworks have additional events (or extend the ones built into ColdFusion) accessible via framework methods, and you can even define your own events.

What you don’t really have are client events triggering events on the server. (I’m not talking things like jQuery events, but rather, ASP.NET code-behinds) ColdFusion doesn’t care about your markup, or how it received it’s headers: it just responds to what it’s given. This how all languages work, and it’s purer to the heart of what HTTP really is. (Hence, the movement away from WebForms towards ASP.NET MVC)

Tag-based syntax

Many think of ColdFusion as HTML++, since it has a tag-based syntax. This is true, but this in no way takes away from the language – it is a fully featured programming language. (Looping, calling web services, threading, PDF integration, database integration, objects, etc….)

However, for those who don’t like this syntax, ColdFusion has an C-style syntax that anyone familiar with C# should feel comfortable with. In the past, it was simply a way to do basic variable manipulation. However, over time, it has grown to include more and more of the language. As of the most recent version, you can query databases, send mail, write log files, create threads, and pretty much everything you’d do in tags, with only a short list of exceptions (rarely used platform-specific tags). You can even write objects fully in “CFScript” (while that goes back to CF’s roots, it’s now a misnomer in my opinion, as it’s more of a “second language” than scripting)

I had an app doing a lot of crazy things with Selenium RC. Originally the app was written in C# (because iterations of it used WebClient and then the iMacros .NET object), and I was utilizing the Selenium .NET object. However, I recently migrated over to using ColdFusion, relying on CFSelenium. I was able to copy and paste this code from C# directly into ColdFusion, and it ran with very little modification (in the catch block, the Exception type is different, and I removed “System.Threading.” from my Sleep() calls).

ORM

ORM has extensive use in the .NET space, whether you’re using the built-in Linq-to-SQL, or Entity Framework, or an add-on framework like NHibernate. ColdFusion integrates Hibernate as a core feature. You can even create objects, give them a “persistent” attribute, and they’ll become entities with no boilerplate needed. In addition, there’s a couple of great custom ORM frameworks that came out in the years prior to the Hibernate integration, Transfer and Reactor.

What about the rest of LINQ, where you can use SQL-like syntax to query non-database resources? ColdFusion has a feature called Query-of-Queries. This allows you to take a recordset, perform an in-memory query of it, and create a new recordset. Yes, ColdFusion has its own built-in SQL parser. This is cool, but this can be used for more than databases, as a number of ColdFusion functions return query objects, such as <cfdirectory>. Moreover, ColdFusion allows you to construct your own recordsets using functions like queryNew(), querySetCell(), etc, so you could mold any data structure into a format that lets you query, essentially doing what LINQ-to-Objects does.

.NET integration

You can integrate .NET classes into your ColdFusion applications – it can call them the same way it can call ColdFusion objects you’ve written, Java classes, or SOAP web service, via createObject().

Some of ColdFusion’s winning moves are the integrated features that other platforms require add-on components for: easily sending and receiving email, image or chart generation, PDF file generation, etc. ColdFusion exposes a number of these features (known as ColdFusion as a Service) via a series of SOAP services.

 

ColdFusion is a great platform, and like all platforms, it has its pros and cons. I hope I’ve helped the intelligent developer out there see that most of the worn-out arguments about the platform don’t hold much water or are outright incorrect, and that it’s a valuable thing to have in your toolbox, like .NET, Ruby, etc. I want to thank Carl and Richard for having me on .NET Rocks!, and want them to keep up the awesome work.

Aug

01

Posted by : Billy | On : August 1, 2011

Bear with me, this is quite a narrative, but my start in ColdFusion was really the launching point for my career and adult-life, so if I’m going to tell the story, I’m going to tell it right. :-)

Technology-wise, you could say I was a late bloomer. Not so much because I was late “taking” to technology, but rather, I was a bit late having access to, growing up in a family of very limited means. I really didn’t get my hands on computers until I was in my last couple of years of high school. But did I take off … Took a “computer science” class pretty much by accident, and discovered that the Turbo Pascal they were teaching was totally “me”. Had a TI-85 for a math class… I learned its TI-BASIC without any manuals or real examples. I bought a friend’s second-hand 286 and started banging out QBasic on it. No access to the Internet yet though ….

Then I went to college (Fall 1996) – a tiny little school in southeastern Oklahoma, but they did have the Internet (in labs, no dorm access at that point). Spent hours in those labs..first just killing time on the sites and chat rooms of the day, like everyone else. Then I discovered HTML and Geocities. I actually preferred writing my code by hand in what was nothing more than a giant <textarea> than using their “site creators”. As far as programming goes I didn’t do much .. a little JavaScript, but mostly of the copy and paste variety. I did actually take a C++ course my first semester, but I never went beyond that with my college computer courses.

Eventually I bought another computer – a 486. Windows 3.11, then NT4, then 95. Was still learning more and more web “development”, and then I discovered a neat little editor called Bradbury Homesite. I had tried others, but I was really impressed with the power it gave me with file management, toolbars with all sorts of tags, while maintaining simplicity as an editor. I noticed this tab labeled CFML .. I checked out the icons. Huh.. kinda looks like HTML, but adding them to my Geocities page didn’t do much, so I didn’t pay them much mind.

During this time I was truly sucked into the Internet, spending all hours online.. nothing like going to bed at 7:30 am when you have a 9:30 am class. As you imagine, grades nose-dived, and I found myself without financial aid. Loans and grants were how I went to school, so now I found myself stuck: no school, so no dorm, and I had to provide for myself (didn’t really have the kind of family I’d call for money or move back home to). Sooo.. I got a job. Or a few… after a couple of failed fast-food jobs, I took a job with a local computer store answering phones for their ISP help desk.

This was a little company, and their “Internet” department consisted of about four employees at the time. We did dial-up, web hosting, and web design. Our design platform? Front Page. Awwww yeahh… They let me do some server administration, and then some web design. Wanting to add a little bit of dynamic action to our sites, I learned a little ASP 2, building some pages with Access backends. Didn’t really go too far with that though….

A competing computer store/ISP was doing web design, using ColdFusion … apparently one of our programmers (the computer store started life as a programming company, with a separate group of 3 or 4 doing custom work, mostly in VB) who was an adjunct professor, caught wind of this. He recommended it, and so we bought it.

You know how it goes.. a bit of fuss is made, people get excited, but then they tend to focus back on the day-to-day and things kinda get pushed to the side. My manager spent a little time with it, learning a little bit.. we all looked up him as the programming expert. My immediate supervisor then built a few things, learning it.. and that was it. It sat on the shelf for a few weeks.

At that point, I made the decision, “Heck I want to learn this too….” So I took it totally upon myself. Installed it at work, and took the disks home, and installed it there. Included was ColdFusion 4.0, as well as CF Studio. I was blown away that Studio was Homesite with a bit more CF-specific features (Allaire bought Bradbury, and was later bought by Macromedia, who continued to sell Homesite through version 5.5.. some of its innovations made it into Dreamweaver and even CF Builder … some of its tag icons are found in CFEclipse!). I also had the manuals that came with it, which is how I learned, by working through what passed for tutorials and through just reading the language reference cover to cover (I hadn’t even heard of Ben Forta yet, haha…)

In short time, I became the CF expert. To be honest, what I was doing in those days would be embarrassing to look at now (I think that was the last time I used <cfupdate>! Also, no SQL Server or the like … all MS Access), but I knew more than the others in the department. Within a few months, I was gone, taking my first “real” programming job in January, 2000, right before the dot-com bust. I do look back at those days with a bit of fondness.. I don’t often get to grab onto new technologies and get to that magical place: the place where I’m fueled not by caffeine but by the fever of learning, in an almost trance-like state …