Injecting JavaScript to the foot of a ColdFusion Page

A question came up on Twitter today:

hard to do “JavaScript at the bottom” in CFML with MVC frameworks… wish we have a tag. Thought? #coldfusion

A great question, this is the answer in Adobe ColdFusion.

Use the request scope.

This is one of those random places where request scope is actually very helpful.  It breaks encapsulation, but you’re going to have to do that anyway.

So first you write a page wrapper, that displays the content of a variable named request.footer.

http://gist.github.com/541051.js?file=pageWrapper.cfm

Then you write your view and pump your javascript to inject.

http://gist.github.com/541051.js?file=uiWidget.cfm

Then you write your page with those components in it.

http://gist.github.com/541051.js?file=index.cfm

This will ultimately yield this:

http://gist.github.com/541051.js?file=results.html

In the future, I’d like to see us solve this problem natively, like but until then here’s a solution.

Adobe at the Heartland Developers Conference 2010

I’m happy to say I’ll be at the Heartland Developers Conference in Omaha Nebraska this year.

I’ll be talking about ColdFusion, and how it can power truly rapid RIAs. In order to explain the whole workflow, I’ll be touching on ORM, scripting, Flash Catalyst, Flex 4 and Flash Builder.

Additionally, two other Adobeans will be making the trip, Paul Trani and Kevin Hoyt. Here’s our lineup:

So hope to see everyone in Omaha this September 8-10.

 

Some Things About MappedSuperClass in ColdFusion 9.0.1

I was fooling around with inheritance in super classes in ColdFusion 9.0.1. I was trying to add that whole dynamic/static inheritance thing to Apptacular so you can add on to an Apptacular application without having to worry about changes being overridden by the regeneration process. Typically when you do that, the dynamic, rewritten class is usually the parent of the child static class. The child, static, class is what you refer to in the rest of code and in which you write custom code. The scaffolder never touches this file again, allowing you to alter things in the database, rescaffold and not overwrite code customizations. I hearby call this “non-destructive scaffold regeneration,” regardless of what other people call it.

ORM entities can’t really work that way. If you try to setup that sort of thing, ORM craps out in ColdFusion with an error. CF9 ORM doesn’t really like ORM objects being the parent of other items, unless you are using inheritance mapping.

However, if you use the “mappedSuperClass” cfc attribute that is now available in ColdFusion 9.0.1 you can achieve sort of the same thing, but you have to flip this on its head. The superclass is the one that is static, and you can edit, while the dynamic one is the child.

This is mostly good. Except for one thing: one of the main reasons to write code this way is so you can override methods, and if the child is the one that is dynamic, and overwritten, then you cannot override the methods from the static parent. You can add methods and properties, but you cannot override them.

At first glance this seems like a deal breaker, but it doesn’t have to be. Most generated ORM entities are light on code, because of implicit getters and setters. But those implicit getters and setters are exactly what you want to override in an ORM entity. However it turns out that explicit functions will always override implicit ones, even when the explicit function is in the super class and not the child class.

I put together a simple little demo to show this off:

http://gist.github.com/509846.js

Result from test.cfm:

GetFirstName = Yo

GetRealFirstName = Aiden

So it’s a little upside down, but if you want to do some non-destructive scaffold regeneration with ColdFusion 9 ORM, it’s a workable solution. Expect this to come to an Apptacular near you soon.

 

1 Day of Apptacular

24 hours after pushing Apptacular out, I have over 150 downloads, and only 2 reported problems.

Awesome!

One of the problems was that a user tried to run Apptacular against a database without primary keys. Apptacular and ORM in general have a dependency on primary keys. I should make that clearer in the documents, and error, and I will. But just know that.

In the meantime, keep downloading Apptacular and checking out my materials on it.

Build Hotter Apps Using Catalyst and ColdFusion

I was chatting with someone last night, and they said:

“Most ColdFusion apps are designed to be intranet apps… and boy do they look like it.”

It’s true. ColdFusion enables rapid application development, but not necessarily pretty rapid application development. However Flash Catalyst enables rapid, pretty, application development.

And let’s be clear here, pretty is not superficial. It’s not just about chrome and bling. It’s about making application that your users want to use instead of apps that your users have to use.

So if you’d like to see how to turbo charge your front end development with effective, pretty, ui’s come to my session:

How Catalyst Will Transform the ColdFusion Developer.” Friday 3:15PM – 4:15PM Ballroom D

Get Apptacular

We’ll be releasing Apptacular soon on labs.adobe.com, but I’m tired of saying “It’s coming soon.”

You want Apptacular: Go get it: http://bit.ly/Apptacular

If you have any issues, please report them using this site: http://bit.ly/ApptacularIssues

If you want to participate in building Apptacular, you want to look at the source, and tests, etc. Check it out on GitHub: http://bit.ly/ApptacularGitHub

If you want to know more about what Apptacular can do for you, check out these tutorial videos:

Dear ColdFusion Denier

So, hey, how are you doing? You’re here because you said something about ColdFusion, and questioned if anyone uses it, or something to that effect. If you’re genuine in your questioning of ColdFusion use and not just flamebaiting, let’s talk.

I work for Adobe, and I am the evangelist for ColdFusion. I can say categorically that people do use ColdFusion.

But what are the hard numbers that we can quantify? From our sales, community and web teams I can grab the following numbers:

  • 12,000+ companies are customers of ColdFusion
  • 350+ ColdFusion user groups are in existence
  • 11,000+ copies of ColdFusion Server and ColdFusion Builder are downloaded every month.

Number of developers is a trickier issue. There is no direct way of tracking this. We can look at sales, but there isn’t a typical ratio of server to developer. So we have to rely on estimates. We have recently had some conflicting data here. Third-party numbers that we have access to say one thing; our internal estimates based on older models say another thing. Both agree that we’ve gained developers, but the numbers are too far apart to be useful. We are in the processes of doing a ColdFusion developer census using a new method, so if you are a ColdFusion developer please participate.

Numbers are great, but let me introduce you to the community of ColdFusion developers.

First, you probably met some when you dissed ColdFusion on Twitter. As you discovered the ColdFusion twitters are passionate, but you may not have seen how helpful they are. Ask a real question about ColdFusion on twitter something like:

  • Do #ColdFusion Excel features let you work with xls files only, or does it handle xlsx?
  • Does outer joining work for objects work in HQL in #ColdFusion?
  • What’s the CFscript equivalent of cfquery tag in #ColdFusion 9?

I assure you, you’ll get the best responses 140 characters can buy.

Also check out the community on StackOverflow. We also have one at Dzone. And at github. We’ve got a small but growing presence in all of them.

Now, you might notice that participation is constant, but not a tremendous amount. That’s because the ColdFusion Community tends to be a bit insular. As a whole the community is working on it, but when you look at ColdFusion only resources like CFTalk and ColdFusionBloggers.org you’ll see constant volume.

Finally, if you look at the number of open source projects available at Riaforge.org, you’ll see again that there are definitely OS collaboration around ColdFusion.

Finally check out the list of ColdFusion conferences. A third of them are new conferences and have popped up over the past 3 years. We’re seeing a shift from huge national conferences to smaller regional conferences in the US, as well as a few more international events and activities mostly in Europe.

All of these point to a vibrant community that is engaged and loves using ColdFusion. Are we the biggest community? No, and no one will dispute that. But we are a community; we’re evidently still growing in numbers, and still branching out into new social networks. We use ColdFusion, and we love it.

To sum up this long answer to your short question: Do people still use ColdFusion?
Hell yeah.

Now, you might be changing your argument, from “no one uses it” to “well it’s not good because…” Well if that’s the case, I have another blog post for you to read.

More FUD for Thought

Get it? FUD for thought… I kill me.

I was all fired up and started writing some stuff up about FUD, and why you shouldn’t do it, and what not.

So I started writing, and it felt really familiar, like I read it somewhere else… so I did some searches for key phrases and turned up this post on not resorting to FUD. It quotes me… talking about FUD in my forthcoming book.

I just totally almost plagiarized myself. Here what I had to say about FUD:

FUD stands for “fear, uncertainty and doubt.” Though the phrase was coined in the mid 1970’s, the concept has been around since the first caveman traded a rock to another one “in case the mastodons come back.” More recently it’s been marketers, public relations flacks, and sales guys who use this on you. Basically, the idea is to tell you something that will make you afraid of a rival’s tool, enough so that you invest with the FUD’er.

At a smaller level, this happens in the workplace a lot. Developers with experience with proprietary tools spread rumors about crazy license implications of open source tools. Open source adherents spread horror stories of hidden code in proprietary tool kits.

It’s ultimately self-defeating. At best it can win people some sort of short term gains, but in the long term, it is a road to nowhere. Eventually people wise up to be bullied repeatedly and some people speak out. This spread of information inoculates the rest and the technique becomes ineffective. [from chapter “Create Trust“]

I stand by that. FUD does ruin credibility. It hurts you, it hurts your listeners. Even if your product is better, talk about why your product is better, not why the other guy’s is worse.