Sunday, May 29, 2005

Investigating Java Tag Libraries

This Memorial Day weekend I decided to spend some time looking into Java Tag Libraries (JTLs) and how to use them with ColdFusion. The how I've been aware of for quite some time of course, but I've never really had the time or strong enough inclincation to start perusing some of the JTL sites out there and try some of this stuff out. There is some seriously cool stuff out there, and dropping it into ColdFusion is extremely simple.

I started by downloading a bunch of the JTLs from The Jakarta Project to give this all a whirl. Tip #1: Even if you drop the JTLs (the jar and tld files specifically, though from what I've messed with you can just use the jar) into your WEB-INF/lib directory, you have to restart ColdFusion for them to get picked up properly. I won't bother telling you how much time I wasted before I gave that a shot, so you're welcome for saving you the hassle. ;-)

The Jakarta stuff is pretty basic but there are some real gems in there. The screen scraping tag, for example, is pretty slick. I'm sure we've all been faced with the task of scraping HTML content to get one particular chunk that we want to, um, "borrow" for our own purposes, and it's usually a matter of making a CFHTTP call and doing some subsequent string manipulation to get what we're after. With the scrape JTL you still have to know what you're looking for, but getting the results is pretty darn simple:

<cfimport taglib="/WEB-INF/lib/taglibs-scrape.jar" prefix="scrp" />

<scrp:page url="" time="20">
<scrp:scrape id="quote" begin="<big>" end="</big>" anchors="yes" />

As you might guess that gives you Macromedia's current stock price as scraped from Yahoo! finance. Sure, not all that earth-shattering, and there are numerous web services that will give you stock quotes, but I thought this was a half-way decent example. Some of the string manipulation functions in the String JTL are slick as well, and there's a LOT of other stuff to check out on the Jakarta page.

The really cool thing is that there are TONS of JTLs out there for the taking. I'm going to peruse all the sites that I can find and see if there are cool ones to share--I've already found some great calendar and image manipulation tags, and I've barely scratched the surface of what's available. And by the example above I hope you can see how easy these are to use.

So this is how a true geek spends Sunday night of Memorial Day weekend. :-) How about the rest of you? Any cool JTLs you use or other experiences along these lines you'd like to share?


You aren't the only geek spending the eve of memorial day doing code!

Some pretty cool stuff man, I'll definately be looking forward to what else you find

Saturday, May 28, 2005

Kicking It Old School with Fusebox 3

It was bound to happen sooner or later--I knew one day I'd be faced with tackling Fusebox. Given its pervasiveness in the CF community I'm just surprised it took as long as it did. Recently I was asked to evaluate an application (peer review) that was written in Fusebox 3 so I took the opportunity to re-read the excellent Fusebox: Developing ColdFusion Applications by Jeff Peters and Nat Papovich. I'd kinda sorta read this book numerous times in the past, and I've worked a bit on pre-existing Fusebox 3 applications before, but this was the first time I really spent a lot of time wrapping my brain around it.

First I should say that I was never really a Fusebox fan before, but upon what is probably the fifth or sixth read of this book, I can honestly say I probably didn't like it before because I hadn't experienced enough pain yet as a developer from the standpoint of dealing with poorly-written spaghetti-code that brings on diziness, nausea, and a lot of cursing just to look at it. I also think my experience with Mach-II has, oddly enough, made me understand Fusebox a bit better. Now that I think I understand it much better, I'm really starting to like it a whole lot more.

The other impetus behind my recent revisiting of Fusebox 3 is because I potentially have a big development project coming up (contract job) and the client is using ColdFusion 5 and probably doesn't want to upgrade at this point. So rather than develop the way I used to develop in CF 5 (which would likely bring on all the negative side effects mentioned above), I decided I better take another run at Fusebox. After all, with so many people behind it, it must have some merit.

The first thing that struck me was how, in my mind at any rate, Fusebox 3 really kind of models objects without using objects. This might be a crude analogy, but what struck me is that circuits are kind of like objects, while fuses are kind of like methods that would be in an object. The other thing I was very impressed with that didn't seem to take hold in my previous studies of Fusebox was the extreme modularity it achieves; it's like tight cohesion and loose coupling, only without objects. Again, I think I didn't appreciate this before because I hadn't yet been through enough nasty projects and torn out enough hair to really get how important this is. Now that I'm older, wiser, and have enough holes in my scalp, I had the lightbulb moment with Fusebox that's mentioned in the early pages of the book.

Probably because I have a Java background I had the lightbulb moment with OO very early on, and frameworks like Mach-II made sense to me immediately. Since I've done so many projects with Mach-II now and seen the tremendous benefits frameworks offer (clients *do* change their minds now and again ...), I think I can now appreciate Fusebox 3 a lot more, and it has me a lot more interested in learning Fusebox 4.1.

So wish me luck as I "kick it old school" with this new development project on CF 5 and Fusebox 3. Even though this puts me back squarely in the year 2001 or so, I'm actually excited because it's a huge part of the CF community and culture that I just haven't had much experience with yet, and because I'm so used to using CFCs in CFMX now, I think I'd probably lose my mind if I went back to CF 5 development without some sort of framework. Maybe that's also why I'm thinking of the circuits = objects/fuses = methods analogy--it'll make me feel like I'm using objects even if I'm not. ;-)


Hey Matt,

Glad you were able to revisit and see the benefit of the Fusebox methodology. If you need any assistance on your new project "kicking it old school" give me a call. ;o)


Hey Matt, I'm about to embark on using CFCs in an FB3 app for the first time. I've used them a lot FB4 apps, but never in FB3. Did you find any example apps or best practices for this combo, or did you come up with your own? Thanks.

Hi Steve--I guess my question would be if you have the ability to use CFCs, why not use FB 4.1? Since FB3 came out pre-CFC availability but you have to be on CFMX 6.1 or better to use CFCs, I'd be curious as to why CFCs with FB3 instead of just using FB 4.1.

Well, the short answer is that Fusebox 3 is our agency's coding standard. So, I need to code in that even though we're using CF6.1.

But, all of this is now moot, as I found out yesterday that the server which the app will live on is still running CF5. Arrrgh!

So, no CFCs for you! :(

Hi Matt, I just found your blog while looking for a clear explanation on why use EAR over WAR file or the other way around (Still no luck) But I did find your blog on Fusebox and I'm glad you've seen the light (jk).

I've been using Fusebox for over 2 years now and I'm building a multi-deployment application for my organization using Fb4.1. It's a little disheartening seeing the faces of some of the people I have met (Developers) through the local Usergroup (WAMMO) give me a puzzled look when I mention Fusebox or even Mach II (while I know OF mach-ii I do not KNOW mach-ii), most of them don't seem to use a framework at all. or maybe I'm just asking the wrong questions.
In any case, I wanted to ask you how your project is going and what your lasting impressions over using fb over mach-ii are

Hi Rodrigo--actually the project in question didn't happen the way I thought it would; my options are wide open and I'll probably end up using Mach-II for it (the project is a very slow starter in case you were wondering about the timing!). I really did appreciate the opportunity to get up to speed on FB 3 and I've since picked up Jeff Peters' books on FB 4 and 4.1 as well, which are excellent.

Bottom line for me is that I still love the way Mach-II works and it completely jives with the way I think about things. Maybe that's why I picked up on it so quickly. I do have a new-found respect for FB as well, however, and I'm definitely in the camp that believes any framework (so long as it's a well-known, well-respected one) is better than no framework. The advantages far outweigh the disadvantages, which in many cases aren't really disadvantages per se but people refusing to give an inch to the framework (and in most cases that's all it is--about an inch to gain miles).

Thursday, May 26, 2005

Great Star Wars Review/Commentary

As I was considering writing up my personal thoughts about Episode III a friend of mine sent me a link to this commentary and I have to say it sums up my feelings about things almost perfectly.

Now before I get branded a Star Wars hater, let's get some history on my experience with Star Wars. When Episode IV first came out in 1977 I was 7 years old, and you couldn't find a bigger Star Wars fan on the planet. My neighbors down the street owned the movie theater where it was playing, so I literally saw Episode IV multiple times a day all summer. I had Star Wars clothes, pajamas, bed sheets, wallpaper, more toys than would fit in my room, all the action figures, all the trading cards, posters, blueprints, movie stills, glossy movie conceptual art done by the art director ... you name it, I had it.

1980 rolls around and Empire comes out. Same excitement, same pumping of ungodly amounts of my parents money into the franchise, same friends down the street who owned the theater.

By 1983 I'm 13 and even at that age when I saw the Ewoks in Jedi I was thinking, "this is decidedly lame." But hey, it was cool, saw it a bunch of times, but I wasn't *that* into it and the toy and miscellaneous Star Wars junk collection started to dwindle. I didn't even really care if I got all the trading cards at that point, but I went through the motions anyway.

Fast forward to 1999. I'm now 29 years old and I love good movies. You know, the kind with real acting and real story lines that don't rely on explosions, screaming, effects, and mayhem as the entire substance of the film. When I saw Phantom Menace I, as many former fans were, was pretty disappointed. I left the theater not sure whether I changed or the movies did (kind of irrelevant I suppose), but this feeling only got worse with Attack of the Clones.

Now we reach 2005 and Sith. All the cool back story that was left off-screen in the original three movies comes to life, and I have to say that the versions of the Clone Wars, Obi-Wan's showdown with Anakin, and the creation of Darth Vader that existed in my imagination from when I was 7 years old kid are (in my memory at any rate) far better than the reality put forth on the screen in Episode III.

Maybe I'm just too old to appreciate Star Wars nowadays, but to me, Star Wars has become no better than movies like "Independence Day," "The Rock," or any number of other Jerry Bruckheimer-esque flicks that are big on action and effects but have zero substance.

Two days after I saw Sith (in a half-empty theater at the 7 pm showing on the Friday of opening week, oddly enough), I saw the new film "Crash." What a difference a story, script, and good acting make.

So to Star Wars, I say this: thanks for the memories. I had a blast with this stuff as a kid, but I'm an adult now so I'll leave any future Star Wars TV shows or whatever else they have in the works to kids who might be able to continue to enjoy it.


Ugh. Looks like it might drag on for a while.

Star Wars memories,
In the summer of 1977,we were all taken on an adventure of a lifetime. We went to a Galaxy far, far, away... We had never seen anything like it. I was 14, that year and I remember going out and getting everything I could star wars. I even had a music box with the theme song.

We loved the story, the look of the places in the film, the music, the people, just everything. I was so excieted when 1980 came, and we found out "Vader" was Lukes father. That was a talked about event that year.

By the time 1983,came we were so happy that episode VI, had finally come, it took a moment to realize the ewoks were cute little mini wookies. To have been stuck on that out of everything in the story itself, was to loose the story, and the magic.

Darth Vader was dead, and we wre to wait to long to find out why he had become Darth Vader. I think if we were disapointed with the next and final films we must blame ourselves, like Wendy and the lost boys, we grewup and became jaded.

Ah yes, I remember the summers of 1977, '80, and '83 spent inside a movie theatre... although I believe 1981 (Raiders of the Lost Ark) was the best/worst.

How did you imagine the creation of Darth Vader?

Hi Trudy! I suppose I can't probably really explain how I imagined all the stuff that was referenced in the older films. It's kind of like when you read a book I guess--you build a picture in your mind and then if you go see a movie made from the book and it doesn't match, it's a bit off-putting. Plus my imagination when I was young was probably a bit more crazy than it is now. ;-)

It's not that it wasn't done well I suppose; seeing Darth Vader rise up on the table where they assembled him (which was visually reminiscent of when Han Solo was encased in carbonite to me), hearing the first instance of the infamous breathing, all this was cool, but it just didn't live up to the expectations I created in my mind as a kid I guess. Then again, nothing probably would!

Tuesday, May 24, 2005

Simeon On Using Hibernate With CF

As many of you know, Hibernate is an extremely powerful object-relational mapping tool and persistence framework for Java, and I've started a project to get it to play nicely with CF, specifically with CFCs. Step one of course is getting Hibernate working with CF at all, which isn't trivial in and of itself, but I've done this on CF standalone (i.e. not J2EE) on Windows, and now Simeon has some excellent notes about getting it working with CF on J2EE, specifically on the Mac.

My own efforts have admittedly stagnated while I complete my Master's degree, but I should be done with that in August so after that I can refocus. Simeon's efforts should really help this effort along, so thanks to him for pursuing this!


Thanks for the mention matt. But it must be said that your demo code on the yahoo groups is invaluable in getting started. So really any progress I have made should be attributed to you! :)

Tuesday, May 17, 2005

MAMBO: Serving Up CFML Apps On a Mac, On the Cheap

I know, yet another lame acronym, but hey--it's no more lame than LAMP or LAMBDA and at least my flat panel iMac actually looks like a lamp. ;-) MAMBO stands for "Mac + Apache + MySQL + BlueDragon + Other Stuff" (yes, that's a REEEAL stretch to get that last O in there, so if you have a better idea let me know!) and is a great way to serve CFML apps on the cheap if you have a spare Mac laying around. Read on for all the nitty-gritty details!


A few weeks ago I mentioned that I got rid of my dedicated server, moved my blog over to HostMySite, and moved some smaller sites that I was hosting over to my 15" flat panel G4 iMac, so here's the details on my MAMBO setup. I'm hosting this over my DSL connection and so far it's working extremely well.

Since Mac OS X (I'm on Tiger now, 10.4.1 to be exact) already has Apache built in, the web server part of things is actually quite simple. Just go into your System Preferences, then to Sharing, then turn on Personal Web Sharing. Voila, Apache is running. What this gets you is only one site and one docroot, however, so obviously some tweaking is necessary to get multiple sites running. This involves two things: a DNS server and Apache virtual hosts.

DNS Server

I don't know about you, but I tend to like keeping things as simple as possible, so I really didn't want to get into hosting my own DNS server, and I wasn't even sure if my ISP would allow that, so I looked for a way to host my DNS information somewhere else. I'm using for this because it's free, and it supports dynamic DNS (even though my IP address hasn't changed since I got my service over a year ago). Other free DNS services tend to only allow subdomains of the DNS service domain (e.g., but with you can have full domains as well as hosts, aliases, and MX records for each domain. Cool stuff. So basically I just set up each of my domains in and pointed them all to my DSL's public IP address.

Virtual Hosts

The second thing to do is edit the httpd.conf file on the Mac so it supports multiple virtual hosts. If you've ever worked with host headers in IIS this is the same concept, you just have to edit a text file and restart Apache to get this working. It's really quite simple and once you know what you're doing is actually a bit simpler than dealing with the wizards in IIS.

The httpd.conf file is located in your /etc/httpd directory, and you'll have to use a terminal window to see it (it doesn't show up in the Finder). Just open up a term window, navigate to that directory, and open up httpd.conf using pico (or your favorite text editor). You'll likely have to use the sudo command because of the permissions on the file, so if you want to use pico your command will look like this:
sudo pico httpd.conf

After you enter this you'll be prompted for your root password and then pico will open up the configuration file. What you're looking for in this file is the VirtualHost section, and there is where you tell Apache "if someone hits this server using this URL, send them here." Rather than go into details about this, I'll point you to the Apache VirtualHost Docs for more information. There's also some great articles on MacDevCenter about web serving on Mac OS X. Some are a bit dated but the general principles still apply, and you can find good information here about enabling PHP and all sorts of other good web server-related stuff.

While you're in your httpd.conf file you might also want to set up the default documents so index.cfm will come up automatically. (Yes, if you're still with me, this is all heading up to being able to serve CFML from the Mac for free!) See this article for more details on setting up your default documents.

Web Site File Placement

Finally, you of course need to know where to put your web site documents. Since we're using virtual hosts and pointing Apache to the docroot for each site the files can more or less be placed anywhere, but for organizational purposes as well as keeping with the conventions of OS X, I just created a new directory for each site under /Library/WebServer/Documents.

OK, so at this point we have our DNS information in, our virtual hosts set up in Apache, and our web site files in place. But what about a database? What about FTP? And most importantly, what about ColdFusion? Don't worry--this stuff is all a snap as well.

Database Server

This is a no-brainer. MySQL is fast, free, extremely capable, and works great on OS X. Gone are the days when you had to compile the source code for MySQL on OS X; they now have a very slick installer that even puts a little startup program in the System Preferences panel. Download it, install it, love it.

I tend to just use MySQL from the terminal, but if you want some help with your MySQL administration, phpMyAdmin is a very nice browser-based admin tool. There is also a ColdFusion version called CFMyAdmin but I'm not sure it will work on the Mac with BlueDragon (I haven't tried). There are also some nice Mac and Java database admin programs that will give you a GUI but you'd still be using straight SQL for the most part, so if you want to avoid SQL for stuff like creating tables, etc. phpMyAdmin might be the way to go. Check out SQL Grinder or Aqua Data Studio for the Mac/Java option, or for more information on enabling PHP on your Mac, see this MacDevCenter article.

FTP Access

Unless you want to maintain the sites of all your mooch friends that are using your MAMBO box instead of getting cheap hosting elsewhere, they'll need FTP access. FTP is easy to enable on the Mac, but the issue is that for every FTP user you have to set up an account on your Mac for them. This is kind of a pain, and in my mind just isn't a great idea.

Luckily there's another way, and yes it's free. (Sensing a trend here?) There's a very nice FTP server manager called PureFTPd Manager that gives OS X users a nice GUI frontend for the PureFTPd server, which I'm assuming is what OS X uses under the hood since it's based on BSD ... all I know is I installed the PureFTPd Manager and didn't have to install the server separately, and it seems to interact with the FTP checkbox in the sharing area of the System Preferences.

So the cool thing here is you can set up a single user and group (I just called mine virtualftp) and then use virtual users through PureFTPd Manager, which means you don't have to create an account on the Mac for each FTP user. Slick. Just make sure you set the permissions correctly on your /Library/WebServer/Documents directory so the virtualftp user has the access it needs and the rest takes care of itself more or less.

I also gave one trusted soul ssh access because he likes to just log onto the server and edit directly using vi, so he's happy with the MAMBO setup as well.

And saving the best for last ...

CFML: Served by BlueDragon

By now most CFers are aware of New Atlanta's alternative CFML engine BlueDragon, but if you aren't, you need to be. It's a great product, it's supported for production use on the Mac, and they have a version that's free to use in production environments. That's right--free! Perfect price tag for the MAMBO box.

Basically all that's involved here is to go to New Atlanta's web site and download the free version of BlueDragon for Mac OS X and install it. It works great with the version of Apache that comes with OS X and configures itself automatically IF YOU READ AND FOLLOW THE INSTALLATION GUIDE. There are some symbolic links you have to set up to get it to work automatically and I strongly suggest you do this. If you set up the symbolic links and install BlueDragon while Apache is still running, then it will configure itself with Apache automatically. After an Apache restart you can serve up CF apps to your heart's content! I'm pretty sure BlueDragon even sets itself up to start automatically when the server restarts, but make sure you read the BlueDragon guides for any issues related to that. Mine works, I just don't remember if I had to do anything to get it to start automatically or not.

So there you have it, MAMBO in a nutshell. O'Reilly, I'm available to write up a book on this if you're interested. ;-) I hope that helps some of you Mac folks out there (particularly the newbies) with getting a solid CF-serving environment set up on the Mac. And hey, with enough demand maybe Macromedia will make ColdFusion a first-class citizen on the Mac as well.


Just wanted to say that I really appreciate this article. PureFTPd is my FTP server of choice as well. I've been using it for various projects for almost 3 years now... Thanks agian!

O = OS X!

OK, that's the second vote for OS X, which honestly I think is probably better. I actually thought of that first but then thought it was redundant since "Mac" was already in there, but "other stuff" does seem kind of lame even though what I had in mind was PureFTPd and the other bits and pieces involved.

So "Other Stuff" or "OS X" or "Oh My!" (another suggestion from an email) is fine by me. :-)

How about:

O = Open Source Stuff

Great post by the way. We're serving our website up at work on a DP G5 Xserve & Xserve RAID with BlueDragon JX. It flat out rocks. Just getting ready to upgrade to Tiger Server & BD 6.2, just want to set it up on a test box first.


Great article! I love CF but have been tied to Windoz servers because of it. This gives me hope that I can have my cake and eat it to.

Monday, May 16, 2005

Running Scripting Languages On the JVM

Another interesting possibility about the future of scripting languages comes in the form of Java Specification Request (JSR) 223, which describes the goal of allowing better interactivity between Java and scripting languages. Some relevant quotes from the JSR:

"This specification will introduce the basic technical background to bridge the scripting and the Java community. The specification is concerned with how to write and package Java classes that will be accessible from different scripting engines."

"This specification will describe how it is possible to bundle scripting pages into a WAR file, either stand-alone, or as part of an EAR. The specification will describe the different implications for security, resource, and class loader contexts both in the case of stand-alone WARs and as part of an EAR. The EG will also consider whether it is appropriate to deliver scripting and Java code outside of a WAR."

Sound familiar? ColdFusion is ahead of the curve once again, and since Macromedia is an official sponsor of the JSR they'll have a hand in defining how this all plays out.

This is interesting to me for several reasons, not the least of which being that the ColdFusion community, between Macromedia ColdFusion and New Atlanta's BlueDragon, is once again ahead of the curve on things. It's been possible to deploy ColdFusion apps on J2EE servers since the release of CFMX (and this got much better in CFMX 7), and with BlueDragon you can deploy CF apps on J2EE or .NET. Apparently other folks think this is a great idea, and the reference implementation of JSR 223 may include PHP as the example of how this is done.

The other thing I can't help but think is that this is the Java community's response to the .NET CLR's ability to run multiple languages. If Microsoft got anything right with the .NET architecture, this was definitely it. Giving people a choice of languages that all run on the same platform offers fantastic flexibility, and if this becomes the norm in the Java community, CF will have been way ahead of the game. I'm going to keep my eye on this JSR!

Saturday, May 14, 2005

News Flash: Scripting Languages Simple, Powerful

Interesting article concerning the rise of popularity of scripting languages, specifically PHP.  Given the recent announcement from IBM and now Oracle for support of PHP this makes for an interesting trend.  The article focuses specifically on PHP, Python, Perl (the so-called "P Languages"), and also Ruby, but the points concerning power, ease of use, and speed of development of course apply to ColdFusion as well.

Interesting quote: "... more and more businesses and IT professionals are looking to these languages as a way to simplify and speed the creation of custom in-house programs, thus avoiding the now all-too-common logjam of late or overbudget applications."  Again, looks like the arguments we CF devotees have been making all along are right, it just takes the rest of the world a bit to catch up.


The most obvious difference between the above platforms and CF is they are freely available. I'm a huge fan of CF and I personally think it's superior, but it's very hard to compete in terms of popularity with such "openly available" platforms. That said, it's probably pretty safe to say that that CF is somewhere in the middle there - Perl and PHP more popular but Python & Ruby sitting below (as of now at least).

I'm not sure I'd agree with the notion that it's "very hard to compete" with the free platforms. IBM and BEA (just to name two companies) make a *lot* of money off their Java app servers even though Tomcat and JBoss are out there and are free. Why? Because they offer features that these free alternatives don't. In my mind this is the same situation with CF. Bear in mind also that there is a free CF server available called BlueDragon that is surprisingly capable, so it's not that you can't do CF for free. I think that's a matter of education more than anything, so hopefully the article on LAMBDA (Linux, Apache, MySQL, BlueDragon, and your Application) setups in the latest CFDJ will help on that point.

The cost of the actual software license for CF is generally trivial when you compare it to the rest of the costs of a custom application. There is usually enough room in a project budget to just include a copy of cf for nothing. It can also be a deal cincher if you put a credit for the cost of the software on the services bill if they have to buy it directly.

Wednesday, May 4, 2005

ColdFusion Dead? Hardly!

I think this is a great indication of increasing momentum in the CF community. First, Macromedia announced that ColdFusion had an extremely impressive quarter:

Then New Atlanta just announced that Blue Dragon also had record sales:

I completely agree with Vince's notion that this is a win-win situation for CF. This is a great sign of a healthy community!


Its not dead, its rocking as the 26th top programming platform/language on the net! ;-)

26? I think it's moving up! :-)

It's 29 now, so up is not the direction it is moving. What's disturbing for anyone banking their profession or business on ColdFusion is that it's less popular than Prolog now.