Model-Glue 3 - Example of Custom Event Types

Now that Model-Glue 3 has been announced and available for folks to play with, it's time to start working up some demos so folks can see stuff in action. Joe has included a few demos in the zip, but if I don't play with it myself, I don't learn.

Before I go any further, and yes, I will be repeating this warning a lot, keep in mind the following two points:

  1. Model-Glue 3 is in Alpha. Everything I talk about here may stop working tomorrow. If it does, I'm going to hunt Joe down and make him rewrite Model-Glue in Pascal.
  2. Like every new feature, there are "good" ways of using it and "not so good" ways of using it. This is the first time I've done this feature. It may be a stupid example. I may look back in a month and ask - what was I drinking.

So with the above in mind, let's dig in.

Proposals for ColdFusion 9 - From the Enemy's Camp

Yesterday I was reading an interesting article (from Dzone):

The future of PHP

So why is an admitted ColdFusion fan-boy reading about PHP? As much as I love CF and think nothing compares to it (cue Sinead), I don't for one minute think that it has a monopoly on all the good ideas.

While reading the article (oh, btw, congrats on getting XML, SOAP, and Unicode support in guys - welcome to CF6) I noticed a few things that I thought could perhaps be of use in ColdFusion. I'm definitely not sure about these ideas, but I've shared them with Ben and a few friends and thought I'd share them with my readers. Again - I'm not sure about this. Feel free to call em out as dumb ideas. Also note that my knowledge of PHP isn't high - so I may be misunderstanding how PHP works.

CFLOG and Permissions

Here is an issue I've run into a few times in the recent months and I've never figured it out till now. Thanks go to cfconcepts@twitter for pointing me in the right direction.

From time to time I've noticed that cflog would suddenly stop working. It wouldn't throw an error it just wouldn't... log. I was never able to nail down exactly what the issue was, but today I really wanted to dig into it. I threw out a message on twitter and cfconcepts mentioned that I should check permissions.

Now - at first - I was sure he (or she) was wrong. Obviously if cflog tried to write to a file that it didn't have permissions for - it would cfthrow, right? Nope. Apparently cflog silently fails.

How did I get a permissions issue in the first place? I run cf/apache on startup on my Mac. But from time to time I have to stop and restart them. I sometimes use the command line and sometimes use the graphical tools for this. I had stopped and restarted CF as a normal user. When I restarted it using sudo it was suddenly able to write to the file again.

Anyone else encounter this? Obviously those of you on Windows probably never see this.

Ask a Jedi: Getting the current directory

I sometimes like to start the morning off with an easy question. Makes me feel all smarty-pants and stuff. Here is a quickie from Patrick that may actually be news to some folks, so hopefully it will be easy for me - helpful for others.

Hi Ray, me again I have a, maybe silly, question about getting the current directory. I have to get the current directory in which a template resides. But I don't want the full path.

If i run www.example.com/folder/index.cfm i should get "folder" but not path/to/somewhere/in/the/system/folder. I tried with expandpath("./") and getDirectoryFrom Path(ExpandPath(CGI.SCRIPT_NAME)) but this always returns a full path. Any built in function i forgot to try? Thanks for a hint!

Running Model-Glue 3 on a box with Model-Glue 2

Just a quick tip. If your box is setup to run Model-Glue2 already, you probably have a ColdFusion mapping set up for ModelGlue that points to the V2 framework. If you want to play with V3 but not mess up your V2 sites (not to imply Joe is anything less than perfect), then consider this simple tip.

Make a new instance of the application template, then open up Application.cfc and add this:

<cfset this.mappings["/ModelGlue"] = "/Users/ray/Documents/workspace/ModelGlue3/trunk/ModelGlue/">

Of course you would edit the path to point to the right folder. This will overrule the ColdFusion Admin's mapping and use a model specific to the application. Of course, this requires ColdFusion 8.

Ask a Jedi: Multiple templates and Model-Glue

Shimju asks:

In a model-glue app, suppose I have 3 templates files - templateA, templateB and templateC. All are set as private events in model-glue.xml. Now my requirement is I want to select a particular template dynamically based on Arguments.event.AddResult("templateA") which we set on contoller method for the event. Based on this, I want corresponding template should appear for that event. Can you please advice how we can accomplish this.

cfObjective Slides/Code

I've attached a zip with the slide and code from my Spry presentation, as well as the slides from my Model-Glue presentation. My MG presentation did have a bit of code, but as it was just me playing with the application skeleton, I figure folks don't care too much for that.

Once again Jared and team have done an excellent job with the conference. I was a bit worried about the location since last years was so good, but the hotel was perfectly fine. (Well, the chairs felt like they were designed by the Marquis de Sade, but maybe it was just my bony you know what.) The speakers were top notch and I loved just the general high-level nature of the entire conference.

I totally forgot to ask folks to fill out the speaker evaluations, so any feedback folks want to give, either here or via my contact page, would be welcome. (And yes, that includes negative feedback as well.)

2 quick links (one tech, one music)

First off, Todd Sharp has just released slidesix, which he describes in more detail here. It is a presentation hosting service built in ColdFusion (with Model-Glue FTW!). One of the coolest features is that you can record audio for a slideshow directly on the site.

Secondly - NIN has released this second new single, also for free. This time they used Facebook. You can download it here. As I'm in the middle of Mark Madenl's Transfer presentation, I haven't played it yet, but the first free track was pretty darn good.

Model-Glue 3 - The New Frakin' Awesomeness

Before I get started - you can download the Alpha now available.

My notes from Joe's Model-Glue 3 presentation at cfObjective. Please pardon the bad writing here and some text are direct quotes without me using quotes (so basically, all copyright Joe).

Another hint on ColdFusion 9?

During the keynote at cfObjective, Jason Delmore had a slide up for maybe 30 seconds or so. He hinted that something special was up there, although it was disguised to most as pseudo-code for fun. Looking at the code, and taking Jason's hints - it leads you to think that you may be able to fully develop CFCs with cfscript. I.e., a 100% script based CFC. Possible CF9 feature?

More Entries