Monthly Archive for December, 2004

User Error!!!

So my problem from last night where CFCs wouldn't work on the URL turned out to be a conflict between CFMX and BlueDragon. I don't have CFMX installed on my box any more, but when I uninstalled it, it left a couple Axis config files in a WEB-INF directory. BD, being the well-behaved J2EE application that it is, was trying to use them, rather than it's own, because it assumed they were placed there intentionally to override it's internal ones. Just a simple matter of deleting those files and problem gone. Yay!

I do have to give NewAtlanta props for being on the ball getting issues like this resolved. One of their engineers figured out exactly what the problem was for me, with no input from me except a copy of the error message (and that routed through a couple other people), and within a matter of hours, I had a description of the problem, how it happened, and how to solve it. This is the shining example, but for pretty much every problem I've had, I've gotten a personal response back with either help to resolve it, or at least confirmation that it's a bug, and that it's now known and will be fixed.

BlueDragon Update (a nice one!)

After getting blasted by the NewAtlanta folks in private (which I don't deny I deserved), I thought I should add some more context for my previous posts about BlueDragon.

First, I'm using BD 6.2 Beta, so bugs are to be expected, and in that sense, I don't really have any grounds for complaining when things don't work. In theory they will, but beta is beta, and it's not perfect by definition.

Second, I undoubtedly appear pretty quick to blast BD for being a "poor" CFML implementation. That's far from the case. NewAtlanta has done a fantastic job with providing an alternate CFML runtime. I'm attempting to wring every last drop of functionality out of the edge functionality CFML provides, and that means I'm constantly living on the "edge cases", where the differences between CFMX and BD are going to be most apparent. Couple that with a beta product, and there's no real reason not to expect as many problems as I've had.

Third, I'm a CFMX user for my day job, and BD is not CFMX (duh). When I get home from the office, I've been in CFMX-world all day, and assume BD ought to function the same way. That's about 95% valid, I'd say, and the last 5% are things that aren't really part of CFML, and are therefore subject to vendor-specific differences. Then there is also the lag that BD necessarily has over the CFMX. Since there isn't a spec to implement, NewAtlanta can only start working on features when Macromedia releases a version of CFMX. So it's to be expected that features which are stable, but relatively new, in CFMX will probably be buggy in BD.

Bottom line, I'm still using BD for my personal development. If the product was really so pathetic, I wouldn't be using it. Yes, it's frustrating a times, and that frustration is reflected in my posts, but in the grand scheme of things, BD's a pretty solid product.

And yes, I am making a attempt to purchase a CFMX license, but that's not necessarily a poor reflection on BD, but rather that using both interchangably isn't something I'm good at. I'd love to not buy CFMX, and instead spend the cash on a Studio MX 2004 upgrade and some random gift for my wife and/or daughter. As things stand right now, I'm probably going to do the latter. The web services bug looks like it should be resolvable without an inordinate amount of effort, and CFMX will return to "not even remotely worth the cost" status.

Anyway, my ranting and raving isn't as bad as it sounds. The day I stop posting about BD is the day that I gave up, so as long as I'm writing about it, rest assured that I see value in using it over other CFML runtimes.

The Dragon is at it Again

I was just about to come say how happy I am with BlueDragon 6.2 in comparison to how I was two weeks ago. I've had great success working with my framework and getting it moving along nicely. But, then I started on the frontend of a project I've been working on separately, and ran into another show stopper. The UI is [going to be] built using Rob Rohan's Neuromancer, and consequently need to make some web service calls to my facade CFCs. Unfortunately, BD doesn't want to do that, it just throws a big nasty Axis fault for both ?wsdl requests and for the "my.cfc?method=myMethod" means of calling CFCs for "normal" page handling.

So here I am, once again smashed up against the almost functional BlueDragon. I suppose I should just assume that nothing works, and test every bit of functionality before planning to use it, but that seems like such a back-assward approach. Oh well.

Where's The Boisvert Life??

If you came to 'www.barneyb.com' looking for The Boisvert Life, it's been moved to it's own domain: 'www.theboisvertlife.com'. I usually go to great lengths to ensure that I don't change URLs on people, but in this case, my hand was forced by some internal changes I had to make. Apologies for any inconvenience; this should be the last time it changes.

More BlueDragon Fun

I've been continuing to work with BD 6.2 beta, and having pretty good success. There have been a pretty substantial number of bumps along the way, but none of them have been show stoppers, and it is a beta offering, so it's not supposed to be perfect. All in all, things are going well.

Then I went to upgrade my server (the one running this site). Oof. Tried uninstalling 6.1. Failure. Tried reinstalling 6.1. Failure. Tried deleting all the 6.1 crap (including that pesky /usr/local/NewAtlanta/.registry file) and reinstalling 6.1. Failure. Tried downloading the 6.2 beta from New Atlanta's web site. Error because they have some weird HTTPS -> HTTP transition that lynx and w3m can't deal with. Tried their FTP server. Not accepting connections. Tried downloading it to my laptop, and then uploading it to my server. Corrupted archive. Try downloading it on my linux box at home to upload. Won't go past ~6MB. Try again. Same result. Try to start a session on my powerbook and hijack it with lynx after the HTTPS -> HTTP transition. Denied. Try the FTP server again, and it thankfully lets me in. No ls command though. Finally figure out I have to switch from passive to active FTP and I can do 'ls'. Download the beast.

45MB later…. Delete all my 6.1 stuff from the several installs (backing up my config, of course). Run the 6.2 installer. Like a champ. None of my sites work though. Cycle BD and Apache. Still nothing. Run a ps auwx | grep java on there, and to my surprise, I've got 5 independant BD processes running!! Manually kill everything, restarting BD, and viola!

So now that they've got the CFC bugs worked out, definitely time to spend a little effort on the start/stop scripts and the install/uninstall procedure. Fortunately that's stuff that I don't use much, so it won't really bother me if they don't.

BlueDragon Update

Well, after a couple days of using the BlueDragon 6.2 beta, I haven't found any major problems with it. There have been a few little bugs, but nothing show stopping yet. As well as the CFC location issues that were driving me nuts, they fixed the issue with calling overloaded Java methods.

In 6.1, you simply couldn't call overloaded methods if the only difference between the methods was the type of the parameters, and one type was a subclass of another type. An example is the format method of the java.text.SimpleDateFormat class. It has both format(java.lang.Object) and format(java.util.Date) varieties, and since Date is a subclass of Object, BD refused to differentiate between them and threw an error if you tried to call the method. JavaCast is of no help here, because it only deals with primative types. CFMX has always used the "closest" type, so if you pass a CF date, it will assume you want the Date version. Fortunately that's fixed in the 6.2 beta, which opens up a whole world of possibilities for using Java classes.

String Concatenation Tricks

Massive string concatenation isn't used all that often in CF, but it's sometimes needed. My most common use is probably creating text-only emails. You can do it with the output stream directly, but you usually run into problems with an extra line break here or there, because of the way your CF tags are laid out. But if you try and correct the formatting in the output, you end up with CF code that is horribly jumbled. The solution is doing string concatenation within a variable, but it has some downsides as well: it can be cumbersome, can be hard to follow, and for large strings can be relatively slow (because of the way Java optimizes strings).

Java, however, provides some classes that can make this process a lot easier. The simplest one is java.lang.StringBuffer. Here's an example:

<cfscript>
sb = createObject("java", "java.lang.StringBuffer").init();
sb.append("my text" & chr(10));
sb.append("my other text" & chr(10));
if (1 EQ 2)
  sb.append("never happen" & chr(10));
myTextString = sb.toString();
</cfscript>

As you can see, there's not "myTextString = myTextString & " repeated all over the place, which makes the code easier to follow. However, you still have to deal with the carriage returns, but we can solve that problem too. Now we're going to use two classes from the java.io package: StringWriter and PrintWriter. Here's the example:

<cfscript>
sw = createObject("java", "java.io.StringWriter").init();
out = createObject("java", "java.io.PrintWriter").init(sw);
out.println("my text");
out.println("my other text");
if (1 EQ 2)
  out.println("never happen");
myTextString = sw.toString();
</cfscript>

We're using the println method, which prints the supplied text, along with a newline (and/or carriage return) character. You can also use the print method to print some text without adding a newline.

In both cases, mixing logic into the string generation code is simplified, because whitespace in the program code itself is irrelevant, just like normal concatenation, but we're stripping out some of the nastiness that concatenation brings. In the latter example, we take it a step further by using some of Java's built-in classes to help take care of the nasty work (dealing with newlines).

Just as an aside, this is a prime example of both the Adapter and Decorator design patterns. The StringWriter adapts a StringBuffer for writing to, rather than string manipulations. Note that you don't see the StringBuffer in the second example, it's internal to the StringWriter instance. Then the PrintWriter decorates the StringWriter to supply additional methods to make using it easier (namely print and println).

BlueDragon 6.2 Beta

I downloaded and installed BlueDragon 6.2 Beta this evening, and as if by magic, the error messages disappeared, and for the first time in quite a while, I actually got a request to run from top to bottom without an error message!! Needless to say, I was pleasantly surprised.

At the very least, I should once again be able to continue working on my various projects, and heck, if 6.2 goes gold soon enough (and I don't run into any more seemingly random glitches), I might even get to avoid buying CFMX. That being said, I'm still going to continue scraping together cash for a license.