ColdFusion

JRun going into hibernation

Tags: 

Anyone who has used ColdFusion will have heard of JRun, the out-of-the-box Java server that ColdFusion runs on top of. For many years people wondered whether JRun was going to be continued as a separate product or ditched entirely, especially seeing competing products go through multiple major releases while it sat by the way-side. Well, it seems the final decision is somewhere in the middle.

Adobe, who bought Macromedia a few years ago and took over the JRun reigns, have decided that they don't want to continue JRun as a separate product, instead have merged its development team into the ColdFusion team where it will continue to be enhanced as needed to run the Java-based engine.

So, for anyone using JRun as a stand-alone product, I'd suggest starting to research alternatives, if you haven't already; for 95% of ColdFusion developers - don't bat an eyelid, this news makes absolutely no difference to you unless you're also running separate Java apps.

Variables in ColdFusion Components (CFCs)

Tags: 

A couple of tips for anyone working with ColdFusion Components, aka CFCs:

  • You can control whether a function/method is accessible outside of the CFC or not by using the access argument on the cffunction line:
    • access="private" will make the function only available within the CFC so it can't be called from outside.
    • access="public" will make the function available to outside pages and other CFCs.
    • access="remote" will make the function available to outside pages, other CFCs and via remote applications through a web services interface (WSDL); you need to use this one if you want to make it available to Flash or Flex applications, etc.
    • access="package" will make the function available to other CFCs that extend it or are in the same code archive (called a "package").
  • You can control how variables are accessed within or from outside the CFC:
    • Any variables you set to the this scope are available outside of the CFC and as a result can conflict with other instances of your CFC! Watch out for this one!
    • If you want a variable local to only the function/method, use the var scope, e.g.
      <cfset var.widget = 'blue' />
      Note that you need to do this for loop counters too.
    • If you want to be able to access the variable from anywhere within the current instance of your CFC use either the variables scope or don't define a scope at all; for accuracy sake I recommend assigning everything to the variables scope if it doesn't fit one of the other criteria above.

Happy coding!

ColdFusion 8 public beta chews bubblegum, takes names

Tags: 

The world's first real server-side scripting language, which seemed to get quiet in its v5-v6 days, is back with a vengeance with the new ColdFusion version 8. Currently available as a public beta and due for public sale in a few months, the new release has a tonne of new features to get web developers in a tizzy. While version 7 IMHO felt like a minor upgrade for most of us (the most impressive new features were in the $6000 Enterprise edition), version 8 has lots of end-user features that really goes a great job of catching up & leapfrogging some of the competition. Here are some of the highlights:

  • AJAX interface with a huge amount of functionality: a data grid, an auto-suggest gadget, and tonnes more.
  • WYSIWYG editor replacement for textarea boxes, which uses FCKeditor.
  • Flash presentations generator to completely replace Powerpoint with something much better.
  • Built-in database. PHP 5 has SQLite, ColdFusion 8 has Derby.
  • RSS/Atom reader & generator, to make publishing or reading web feeds a non-issue.
  • PDF manipulation, everything from content modification to being able to secure documents.
  • Flex integration, for doing Flash-based applications without using Flash. Neat stuff.
  • Microsoft Exchange interface for accessing email, calendars, contacts, etc from Exchange - very useful for building intranets.
  • Image manipulation commands - after years and years of waiting, CF finally gets a command for manipulating images.
  • Really easy and powerful multi-threading - I'd like to see Ruby get multi-threading as easy as this.
  • Server improvements - not only can you more easily segregate your websites you can now also monitor how they are all performing.
  • A debugger! Has been missing since version 5.
  • Implicit struct and array creation, you don't have to manually create the variable and then assign data to it one item at a time, you can now just do <cfset months = ['January', 'February', 'March'] />.
  • Simple file commands, like finding a file's size without having to resort to Java, etc.

There's a whole bunch more, but those are some of the improvements that I'm really excited about. Go read the full What's New guide or watch the What's New videos, I think you'll be rather impressed, I know I am. I really can't wait for frameworks like Coldbox to upgrade to support some of the new features, now that would be niiiiice!

Web page attachments - download vs inline with ColdFusion

Tags: 

Here's a quick tip that'll help make life easier for anyone who's trying to use ColdFusion's CFCONTENT tag to send content to the browser. When you're sending a file to the web browser using CFCONTENT you can do it either as an inline file, i.e. the browser will probably try to display it, or you can send it as a file to be downloaded. The only problem is that to do the latter you can't do it with just the CFCONTENT tag, you first need to tell the browser that you're sending a file and then send it, for example:
[source:html]
[/source]
To pop open the magic Save As dialog in the browser you need to send the Content-disposition HTTP header and tell it you're sending an attached file, along with the filename. Easy when you know how.

Pages

Subscribe to ColdFusion