Watch out for Inherited Meta Data

I've been working on a project that makes heavy use of metadata over
the past few weeks and just got bit hard by a little quirk with
metadata.  Metadata is created on the first call to getMetaData()
for a given CFC type, and then cached for quicker subsequent
recall.  That's a good thing.  However, you can run into
issues with inheritance, because the metadata is only updated for the
specific CFC it was generated for.  In other words, if you update
a superclass of a CFC, the CFC's metadata won't change, even though
it's behaviour might.  If you're on *nix, running touch `find .
-name "*.cfc"`
will take care of the problem by forcing CF to recompile
all your CFCs (and consequently regenerate their meta data).

However,
that's not the really insidious quirk.  You would think that since
a superclass's metadata doesn't refresh when you change the superclass,
that the metadata originally from the superclass would be separate from
the superclass's meta data.  However, that's not the case, and you
can actually modify the superclass's metadata by updating a copy of the
subclass's metadata.

Couple
caveats.  First, this was demonstrated (repeatedly) on CFMX 6.1; I
have
no idea if the same gotcha exists on CF7.   Second, I can't make a
simple repeatable test case out of it.  It happens every time in
my app, but when I make a standalone example things works
consistently.  I suspect it has something to do with the specific
order that the getMetaData calls, the copying of the metadata
structures, and the updating of the fields, but I haven't been able to
pin-point it.

Solution?  Don't ever maintain a reference to any part of a
CFC's metadata.  If you need to keep a registry of metadata
snippets, always use duplicate().  Adding that fixes the problem,
because duplication ensures no lingering cross-object references
persist.

CFSCRIPT List Loop?

Ever wanted to do a list loop inside a CFSCRIPT block?  I mean,
you can already loop over an array or a structure just as easily as you
can with tags, why not a list?  Well, for some reason Macromedia
decided that capability wasn't particularly important, but you can work
around it using function variables.

runningTotal = 0;
listLoop("1,2,3", loopBody);
function loopBody(item) {
runningTotal = runningTotal + item;
writeOutput("Running Total: #runningTotal#
");
}

This code will loop over a the list "1,2,3", calculating and
outputting a running total as it goes.  It's not amazingly
elegant, because there isn't actually a for or while keyword, and the
loop "body" is in a separate function, but it is a simple loop over a
list in CFSCRIPT.  The magic 'listLoop' function is here:

function listLoop(myList, bodyFunction) {
var a = listToArray(myList);
var i = "";
for (i = 1; i LTE arrayLen(a); i = i + 1)
bodyFunction(a[i]);
}

It's pretty simple, just a quick dynamic function call.  This
type of programming is usually found in JavaScript (and related
languages) where functions are nothing more than a data type.  CF
doesn't quite meet that spec, because it forces you to declare
functions explicity (unlike other variable types), and doesn't provide
a function literal syntax (along with the omitted array and structure
literal syntaxes).  However, it's still an effective code trick
for certain scenarios.

Seamless MySQL Connector J 3.x on ColdFusion

I use MySQL 4.1 almost exclusively for my work, and was a little bummed
that neither CF 6.1 nor CF7 support the 3.x Connector J driver for
it.  You can use the old driver, but you run into issues because
the authentication stuff changed between MySQL 4.0 and 4.1, and only
the new 3.x drivers support the new authentication.  Macromedia's
got a technote
about setting up the new driver with CF, but that's still clunky,
because you have to use the "other" database type when setting up your
datasources.  Very clunky and error prone.  However, there's a
simple fix.

Inside the CF install there is a file named
'neo-query.xml'.  Where exactly it is depends on what version of
CF you installed.  In a J2EE install, it's in
/WEB-INF/cfusion/lib.  Within that file is all your configured
datasources, as well as the base information for each database
type.  A simple matter of changing the MySQL type's driver class
to be the one listed in the technote rather than the current value, and
you can again create MySQL datasources using the 'MySQL' datasource
type, and not have to mess with the 'other' type.  All the other
settings can remain the same, though you may want to change the name of
the driver type as well (on CF7 it's "MySQL (3.x)").

Note, the
file is a big-ass one-line WDDX packet, so I'd highly recommend
a decent XML editor, rather than a text editor.  I used XML Buddy
for Eclipse (one piece of my Eclipse toolkit); it's outline view makes
decyphering the WDDX enormously easier.  There are also various
other neo-XXXXX.xml files in that same directory, all filled with other
settings and stuff that can be played around with.  Just be
careful, but if you screw them up, your server might inexplicably stop
working untill you manually undo whatever you did.

BD 6.2 Update

Vince from NA just provided some clarification on the 6.2 release and
RC expiration on the BD mailing list.  BD.NET is the only edition
that is set to expire on the 31st, and it doesn't expire, it just
reverts to developer edition.  The Java editions don't expire
based on dates, they expire based on the trial licenses (never for
free, 30 days for JX, and based on the eval license for the J2EE
edition).  So unless you're running BD.NET, the March 31st
deadline isn't a concern.

Of course, after the final 6.2 release, NA is dropping all support for
the RC, so you're better off upgrading sooner than later, but there
isn't the hard deadline to do so.

BlueDragon 6.2 is Coming

The final release of BlueDragon 6.2 is due out "very, very soon,"
according to Vince from New Atlanta.  Perhaps more important to
those that have been using 6.2 RC is that the RC is set to expire on
March 31st, so you'll have to upgrade any systems to 6.2 before that
date.

I'm excited to see what tweaks and fixes NA has made from the RC to the
final release (since this site and several others are running on the
pre-release version), but I'm a little concerned that the timeframe is
so tight to get the upgrade in.  Hopefully no code will break with
the new version, because there isn't going to be much time to fix it.

A Non-OSX PowerBook?

My PowerBook saga continues.  I thought that I'd come up with a
pretty stable system last week: install 10.3 from the install CDs and
don't apply ANY updates.  Some of the updaters would be nice to
have, but at least with bare-bones 10.3 allowed me to do things like
boot up.  Unfortunately, last night, it decided that it didn't
like running stock 10.3 anymore either.

So now I'm looking at alternative OSes for the machine.  Gentoo
Linux seems to be the best candidate from my brief looking.  Has
anyone had any experience running Linux on a PowerBook G4, and can
offer tips, tricks, or other guidance?

Sean Corfield on Frameworks

It's been forever since I've posted, but I'm going to try and get back
to posting at least a couple times a week again.  First topic is Sean Corfield's
"Frameworks: Fusebox or Mach-II" talk that he gave last night at the
Seattle CFUG meeting.  I'm not sure that's the exact title, but
it's close enough.  There were about 20 people there, and the
atmosphere was very relaxed, which was a nice change from the usual
lecture format.

Sean went through a brief overview of the two frameworks, how they were
built, and why certain design decisions were made.  Then he demoed
six different versions of a very simple task management app, including
"stock" Fusebox, MVC Fusebox, Fusebox w/ OO, Fusebox w/ Tartan, basic
Mach-II, and Mach-II w/ a "real" OO model.  He picked the perfect
app to demo, complex enough to actually show the framework doing it's
job, but simple enough keep the discussion about the framework and not
the app itself.

He also had some very nice graphics detailing in a visual format how
the applications worked, using the two frameworks and various
styles.  Very clear and concise, and seemed to get a very good
reaction.

Finally, he ran through some pro and cons of each framework, talked a
little bit about his and Macromedia's use of the two frameworks (MM
standardized on Mach-II, Sean uses Fusebox 4.1 for his non-work stuff),
and then about how to select the proper framework for the job. 
All in all, a very enlightening talk, with some good discussion amongst
the group stemming out of it.

Macromedia, Blackstone, and the Little Guy

Well, as is no doubt now common knowledge, CF 7 (Blackstone) is
out.  Let me be one of the first to congratulate Macromedia on a
solid product update with some nice enhancements.  Let me also be
one of the first to say I don't consider it worth the upgrade from CFMX
(6.1), unless you're using Enterprise edition.  Some of the
features are quite nice, some have a real wow factor, and there are
even a handful that are quite useful.  But it seems that the
beneficial ones are mostly Enterprise-only, and not worth the extra
$4,800 compared to what you get for $1,200 with Standard edition.

Application events are the single greatest enhancement in the
release.  Without question, the new forms stuff is nice, but
mostly the fact that they now generate decent code (why this wasn't
fixed before is unclear), not all the skinning/Flash crap.  The
Administrator API could prove handy, and the fixes to QofQs is also
nice to see.  Still not a whole lot for your $650 upgrade fee, if
you ask me.  Now if Standard edition came with async processing
(with or without the rest of the gateway stuff), that would have made
it much more reasonable.

The company I work for (an ASP with CF-based products) runs CF on seven
different servers: a production cluster of seven machines of which
three run CF, another standalone production box (different apps), one
staging server (used for both the cluster and the single box), and two
shared development servers.  The development servers run the
DevNet Enterprise edition with a handful of instances each, and the
rest run Standard edition.  Unfortunately, since DevNet is going
away, we're going to end up having to fork for at least one Enterprise
license, but that's a whole separate rant.  I certainly wouldn't
consider us to be a large user of CFMX, but we're not a tiny little
company either, and CF 7 is obviously targetted WAY over our
heads.  Bottom line, CF 7 is cool, but I know we won't be
upgrading any time soon unless circumstances change significantly.

Macromedia is shifting to the enterprise market with their whole server
line, and seemingly without much regard for the little guy, and that
pisses me off.  ColdFusion is a great product, and while it
integrates very nicely into enterprise environments, one of it's
hallmarks has always been it's combination of simplicity and
ease-of-use, without having to sacrifice power.  It seems almost
like Macromedia is mocking that concept by offering all the power to
the large client (who needs to be even richer with CF 7 than CFMX), and
offering a lot of eye candy to the smaller user.

And now, without further ado, let the flames begin….

Me and My Feisty Mac

I swear, my Powerbook is the feistiest computer ever.  I just
installed the 2005-001 security update, rebooted, and Finder refuses to
run.  It just loads and crashes at about 2 second intervals,
indefinitely.  Most of my other apps work (FireFox, Dreamweaver,
etc.), but some don't (iTerm, Adium), so I don't know what's up.

Last time it got massively pissy like this, it was bad memory. 
But the clever guys down at Apple opted to use the TINIEST screws
imaginable, and I don't have a screwdriver that will even come CLOSE to
fitting in them, so pulling the sticks out to check isn't an
option.  So now I gotta either live without Finder and a decent
terminal (because Terminal just sucks), or go fork $30 for some schmuck
to unscrew three little screws for me so I can pull out my memory
sticks and see if that fixes it.  Needless to say, after
yesterday's experience, I'm loth to let any "presumed expert" come
close to my machine.

As nice as it is to have that big ol' screen, have *nix under the hood,
I've gotten to the point where I'd rather be running Windows, because
at least it's stable when it's taken care of.  And how friggin'
pissed does it make me to actually say that.

Fun with Computers

First some background: our primary office file server has been acting
up periodically for a while now, and recently has become much more
insistant.  All things considered, it'd done it's job remarkably
well, and without anything even approximating sufficient
hardware.  So after this morning's crash, we moved on getting a
new box to replace it.  The load is light (we have an office about
about 15), and space isn't an issue, so a low-end workstation tower
with an extra bit of memory is all we needed.

Then the fun started.  I strolled the block down from my office to
Northwest Computer Supply, and asked them for some parts.  I knew
basically what I wanted, but not the specifics, and (foolishly, you'll
see) trusted them to make that work.  The list was megar: a
motherboard, the cheapest P4 on the rack, 1GB of RAM, a cheap case and
a cheap CD drive.  I already had hard disks.  Pretty
simple.  Got my parts, and was back at the office in less than
half an hour.

Get everything installed except the processor, and realize numbnuts has
given me a motherboard for the wrong processor footprint (Celeron, vs
Pentium, I believe).  No No worries, I go to trade the P4 for a
Celeron; it's not like a file server needs much processing power. 
No can do, because I opened the processor box.  Fine.  I'll
get a new motherboard ($150 vs $97).

Come back to the office, pull everything back out of the case so I can
get the motherboard and take it down the street, exchange it, and bring
my shiny new P4-compatible board back to the office, and get it back in
the case.

Pull the RAM back out of it's sleeves, and go to put it in. 
Whoops!  It doesn't fit!  Back down the block.  "We
don't have any in stock, but we can order it for you.  Probably be
here Friday.  We can do overnight, but it'll probably cost an
additional $12 or so."  "Excuse me?  You want me to pay the
shipping, because your sorry ass can't read that the MB takes DDR2, and
you sold me DDR?"  Of course, I shouldn't have assumed he was
clever, he had just sold me an incompatible processor a couple hours
before. 

I returned the DDR, and went to the store on the next block to get some
DDR2, which they had in stock, and while it was more expensive, at
least is was in the county.  Back to the office, ready to finally
get this computer together.

Ha.

Everything back in the case, and go to hook up the power supply. 
Now I learn that numbnuts has managed to provide a power supply that is
incompatible with the motherboard. I had no idea this was even
possible.  So now I'm waiting.  Hoping.  Praying. 
Dear God, please let these idiots manage to fix their mess.  I
have little faith.

So, what have I learned today?  Never, ever assume that people
selling computers know ANYTHING, even if their job is nothing except
putting computers together.  I am absolutely flabbergasted that
this man has a job, and has had it for quite a while.  Perhaps
it's just been my unlucky day, but c'mon, the only things that fit
together were the friggin' IDE cables.  Of course, I should have
been suspicious when they refused to sell me a system without a copy of
Windows attached, and instead required me to buy unassembled parts, but
even so.  Needless to say, they will no longer be getting any of
my business.