Wednesday 31 October 2012

ColdFusion shared hosting

G'day
Sean made an interesting comment on yesterday's article about enhancing logging in ColdFusion.  It's unrelated to that particular topic, but it's worthy of discussion, so I'm going to lift it out and replicate it here, and then put my oar in.


Here's a direct link to the original comment (and my response, and Sean's follow-up) is here.  I'm going to abridge things here, just to focus on what I want to discuss.  I will not abridge it in such a way as to change the context of what either of us were saying.

Tuesday 30 October 2012

Improvements to ColdFusion's logging

G'day
This is the result of a random thought I had overnight in response to a challenge I have accessing the logs my code creates on my shared-hosted ColdFusion account with cfmldeveloper. This is my first foray into needing stuff hosted somewhere - I've not done any non-work code that I wanted to be public-facing before - and I'm finding it an interesting experience not being the master of my own rig.  I don't mean "interesting" as code for "it sux", I do mean it as "interesting".  No problem has been insurmountable yet, but I have had to revise a coupla the things I automatically do as a matter of course.

Monday 29 October 2012

@CfmlNotifier

G'day:
I've finally sussed out how the Twitter & Bitly APIs work, and found time to knock-together a Twitter-based ColdFusion / ColdFusion Builder bug notifier.  It polls the Adobe bugbase every coupla hours and see if there's been any new activity since its last poll, and updates its Twitter account's status with the bug headline and a link to it.  So if you want to keep track of new bugs in the bugbase, then "follow" CfmlNotifier.

Thursday 25 October 2012

Railo via IIS

G'day:
This is just some feedback from a comment someone made on this blog at some point to the effect that "getting Railo to work with IIS was a nightmare" (paraphrase).  I can't actually find the comment now, so you'll just have to take my word for it. I do know that someone else I was talking to today or yesterday also said much the same thing.  And there was a thread on the Railo Google Group in which someone was bleating about this or similar too (I just glossed over it, as admin stuff bores me rigid). I was concerned there was some substance to this, so decided to check for myself.

Here's what I did:

Wednesday 24 October 2012

Sending "Tweets" via ColdFusion (via Twitter4J)

G'day:
I'm writing an application than needs to send Twitter status updates.  This is an augmentation of the ColdFusion Bugs RSS feeds I have (in the box on the right); I'm gonna send tweets out when a new bug is raised as well.  Or that's the idea.

To do this, I need to work out how to send Twitter status updates (which sounds much less daft than "tweets") from ColdFusion somehow.

This is probably well-trod ground, but the CF-based resources I initially found are all out of date, so I thought I'd post the results of my investigations here in case they're helpful to anyone.

Tuesday 23 October 2012

Hello (Coldbox) world - abridged: code only

G'day:
As alluded to yesterday, I'm posting this as a distillation of just the results of my investigations, without all the blather as to how I arrived at these results.  This'll make it easier for people to see just the code, should they want to.

The full narrative is in yesterday's article.  There is no additional material in this that was not covered y/day, so there's no need to read it.  It's here just for reference.

Monday 22 October 2012

Hello (Coldbox) world

G'day
OK, so having polled people as to what their thoughts were as to what framework I should investigate, here I am starting my Hello World "project" (that's bigging it up: I intend to get a page that says "Hello World" created, as a first step).  And I'm typing this blog article as I do so.  Very James Joyce and stream-of-consciousnesss indeed.  Except I'll use punctuation and what I write might be comprehensible.  And first year uni students will not be made to read this thing and write essays on it for years to come.  So not much like Joyce at all.

Sunday 21 October 2012

CFML: Organise yer apps properly

G'day
This is kinda a follow-up / continuation of the article I wrote the other day on how a request/response comes together, from the client browser initiating it, through to ColdFusion servicing it, and back to the client browser again.

It also stems from me opting to rebuild my PC over the weekend (started on Friday... it's pretty much done now: Sunday afternoon), and therefore reinstalling ColdFusion and getting all my apps up and running again. For those that had a laugh about me running Vista before, I've just upgraded to Windows 7, which garners less derision from those who... for some reason give a shit about that sort of thing.

Friday 19 October 2012

The CFML request/response process

G'day:
Every month or so I see someone asking questions along these lines:
  • I've set a variable in JavaScript, but my CFML code cannot see it.
  • I've got some CFML code in a variable, but when I output it it just appears on the screen, it doesn't execute.
These appear on the Adobe ColdFusion forums fairly frequently, or less often on StackOverflow.

In response to these I usually trot out a description of processes taking place when a request is made, and "the CFML server runs on the server and JavaScript runs on the client" and all that sort of rigmarole. And I type it in again each time, and it has either a lot of detail, or bugger-all detail depending on my mood at the time.

I've not had one of these for a while, so I'm about due.

Thursday 18 October 2012

DON'T Install the new ColdFusion Updater 3

G'day:
Adobe did a good job of promoting the release of the new ColdFusion Updater 3 yesterday, but have not done such a good job of promoting the fact it's got a serious bug in it, which - really - should stop people from thinking of installing it.

The bug is that ColdFusion will erase all scheduled tasks every time it is restarted. So this will be a problem for a lot of people.

Update:
Update 4 is now out, and this fixes all the problems in update 3.  That said... I recommend standing back and waiting for other people to apply it and see how they go before you dive out and install it.  "Once bitten..." etc.


I'm just writing this blog entry in a feeble effort to try to warn people against installing this updater until the fix comes out, to stop people from potentially wasting their time.

If poss, can people pls circulate this info.  I've asked Rakshith @ Adobe to do the same.

Cheers.

--
Adam

Wednesday 17 October 2012

Your IDE of choice: survey results

G'day;
I almost forgot about this one, what with all the flurry about what framework I should use, and trying to actually make some headway with it.

But there was that last survey I solicited: what IDE do y'all use.

So I've closed that one off now, and here are the results.  Cheers to the 73 people who responded to that.  That's the best participation I have had so far (which is good that it's the best response; not so good that the best response I can garner is 73 people! Not to worry: I'm not here to win any popularity contests ;-).

Tuesday 16 October 2012

New CF10 patch and new CF10 version number

G'day:

Warning:

Do not install this updater if you use scheduled tasks.  See bug 3348026. Adobe are on the case, and will - no doubt - have a fix shortly.

You might remember me banging on about how Adobe messed up the version numbers of ColdFusion 10 when they started doing "updater" releases, but weren't changing the version number to match what they were calling the releases (so Updater 1 which they were describing as 10.0.1 was still listing as 10.0 in CF Admin and the server scope).  I raised this as bug 3323518.

Well they've just released another updater today (10.0.3), and I'm pleased to say the version number now reflects the same thing as the name of the updater.

Monday 15 October 2012

Probable backwards compat bug in CF10's cachedwithin behaviour

G'day:
I'm following up a post I noticed in the Adobe ColdFusion Forums. I'm gonna write up my findings here, and then summarise / crosspost back to the forums, and perhaps raise a bug depending on what people think about it.

The general gist of the situation is that CF10's query cache seems to be bound to an application, whereas it never used to be. I can see an argument both ways for this, but it's something Adobe seem to have arbitrarily changed without telling us (I have not looked, but the person posting on the forums has, and has drawn a blank).

Update:
Rob Brooks-Bilson has pointed out that there's an Application.cfc setting that controls this:

<cfset this.cache.useinternalquerycache = true>

That about solves this one, except I think TRUE should have been the default. Mileage might vary on that one, I guess.

It's also not been documented in a fashion that's particularly easy to find, I think.  Oh well: at least it's not a bug!

Cheers for that, Rob.

Sunday 14 October 2012

I've picked a framework. Well: you've picked it for me (UPDATED)


G'day:
Right, so it's 07:45 on Saturday, I've been up since 05:00, and I'm at LHR sitting at the gate for my fortnightly trip to Ireland to see my son. And I've got an age to wait before boarding, so I'm gonna get as much of my article written as I can on which framework you've decided I should use (based on me following the groupthink).

Firstly: thanks everyone for filling-in my frameworks survey: it got over 50 responses - and fairly quickly - which is great. I've parked it now.

Here's the analysis of the breakdown.

Oops
Thanks to Seb (in then comments) for pointing out some errors in my analysis.  It seems that in the process of transferring data from various devices and apps I'd copy and pasted some stuff incorrectly.  And I concede I did not recheck them before committing them, which is a bit of a schoolboy error.  I'm glad someone is paying attention to what I'm doing (as I'm clearly not!).

So, anyway, I'm updating the results below (and will indicate clearly where they've changed).

One thing to note... the bottom line now has me using a different framework than I had indicated I was going to yesterday...


Thursday 11 October 2012

Thanks Dave Harris: a footnote about getMetadata()

G'day:
I'm following up on some comments people have left against various articles I've written recently: cheers for the thoughts / advice / general input, everyone.

I've updated my article about creating a query and populating it with data in one fell swoop in CF9 to reflect a tip Brian Swatzfager offered me, and tested out some UTF-8 stuff that Nik Stephens reminded me of in my article questioning what Adobe were thinking with their implementation of pageEncoding.  Thanks for the input you fellas.

However something Dave Harris (with whom I used to work, back in NZ) said in response to this article about my expectations of how getMetadata() works warranted a brief article of its own, to get it onto people's radar.

Typos all over the place

G'day:
The quickest one ever.

CFML: Clarification (in my mind) as to how this.[various settings] work in Application.cfc

G'day:
This might be another one of those "Adam states the obvious" articles. Sorry, but I freely admit two things:
  1. not to know everything already;
  2. to be a bit slow on the uptake sometimes.
So if you fall into those categories too, then maybe this will be worthwhile to read. Apologies to the rest of you.


One of the good things about helping out out on various ColdFusion forums is that the problems people have are not necessarily based on things I find myself doing on a regular basis, so encourages me to consider different approaches to things, and to think outside my own personal box. And this means I broaden my exposure to various facets of ColdFusion that I might not normally be exposed to. I would say I've learned more about CF by helping people solve their challenges than I have from my day-to-day work or any amount of reading blogs or articles detailing other people's investigations. That's not to say you should immediately stop reading... hey... aah... come back!

Ahem. Anyway.

Yesterday a person with the rather interesting name of Aegis Kleais was having a challenge with application-specific custom tag paths. The full thread is here, but it's long and drawn out, so I'll summarise it all below to save you... um... clicking on a link and reading the original.

Oh, before I start, I'd like to personally acknowledge Jason Dean's help and persistence on the forums. Jason's one of the more-clued-up ColdFusion community members out there, so it's an excellent asset to Adobe's forums that he mans-the-pumps there (as it were). I also like Jason's style because - and he might disagree with me here - he can be almost as grumpy as I tend to be, and doesn't shy away from having and expressing a strong opinion when he has one.  Cheers Jason.

Right, what was Aegis asking about?

Aegis (I'm gonna steer clear of personal pronouns unless I get the wrong gender...) was investigating the usage of per-application custom tag paths.  Just some background here.  In the olden days (like up to and including CFMX7 I think) the only place one could set a custom tag path was in CFAdmin, which is a server-wide setting.  These days they're settable in Application.cfc, with the this.customTagPaths setting.  Aegis was leveraging this application-specific approach and had mapped a directory, then called a custom tag on a subsequent line of Application.cfc.  But it was erroring: it just wasn't finding the custom tag file.  If the tag was placed in the same directory as Application.cfc, it ran fine. If the tag call was placed in one of the event handlers within (eg: onApplicationStart() or onRequestStart()), it worked fine.  So it wasn't a syntax or pathing issue.  Weird.  I verified this behaviour on CF8->CF10, and Railo too.

This initially flumoxed me, and I was about to suggest it was a bug when something occurred to me, and I had a watershed moment when I suddenly worked out how Application.cfc works in regards to all those this-scoped settings we use.

I thought about any other code I might run:

component {
    this.foo = "bar";
    
    // other stuff here
    
}

That code sets a variable, this.foo.  That's all it does: sets a variable.  No other action takes place.  I might subsequently do something with that variable that makes excellent stuff happen, but that's not what's happening there.

So what's this code doing:

component {

    this.name            = "myApplicationName";
    this.customTagPaths    = "/path/to/the/custom/tags/";

    public void function onApplicationStart(){
        // stuff
    }
    
    // etc

}

We all recognise this as an Application.cfc file, but it's still just some CFML code, so what is this line of code doing:

    this.customTagPaths    = "/path/to/the/custom/tags/";

It's setting a variable.  That's all it's doing.  It does not say this:

    setCustomTagPaths("/path/to/the/custom/tags/");

If it was saying that, we could reasonably conclude that subsequent to that line of code any custom tag calls would find tags in  /path/to/the/custom/tags/.

But all it's doing is setting a variable.

So I found myself thinking, "OK, what's going on then?  How does this all work?"

It occurred to me that it seems like - under the hood - the ColdFusion server is doing this (pseudocode):

appSettingAndHandlers = new Application() // ie: instantiating Application.cfc

theApp.setName(appSettingAndHandlers.name) // because name was set as this.name, it's exposed as a public variable
theApp.setCustomTagPaths(appSettingAndHandlers.customTagPaths) // use the exposed value for customTagPaths to actually make the custom tag paths
//etc

if not theApp.started() then
    theApp.start()
    appSettingAndHandlers.onApplicationStart()
/if
// etc

So what happens is - the same as any other CFC instantiation - the "calling code" (which is within the inner workings of the ColdFusion server) instantiates Application.cfc, which causes all the pseudo-constructor code to run, and then it accesses the settings created in that code to perform various other actions / config / settings etc.  But the crux is that just like when we instantiate a CFC then use it, all the pseudo-constructor code completes before anything is done with the values. This makes sense. Doesn't it?

This actually explains a situation  had in the past wherein I was creating an application-specific mapping with this.mappings, then trying to use a path leveraging that mapping in my ormSettings.cfcLocation value.  And for the same reasons, this did not work.

Anyway, with a combination of Aegis's own investigations, and guidance from Jason any myself,the problem was sorted out.  And I now know something new.

Cool.

--
Adam

Wednesday 10 October 2012

Why? Just... why?

G'day again.
I'm double-posting today as I spotted this whilst writing up the example code for the previous article.

Thanks to the Maori days of the week having a macron over some of the As, I need to give the ColdFusion compiler a bit of a nudge to explain to it to treat the source code file as UTF-8, not the default of [whatever it is]. It's a bit sh!t that one still needs to do this in the 21st Century, given even NotePad.exe can determine the encoding scheme of a file without being explicitly told, but such is the ways of ColdFusion (view for this bug please: 3342141!).

Constructing a query with data in one fell swoop

G'day:
A coupla quick ones today.

An unglamorous but handy bit of functionality was slipped into ColdFusion 10. When using queryNew() to create a recordset, one can now as the data for it in the same statement. There's two formats for this:

Tuesday 9 October 2012

getMetadata(): expectations management

G'day:
Just a quick one.  Have a look at this code:

Missed marketing opportunity?

G'day:
This is more on the "CF10 in the UK" thing that I wrote about recently.  First things first, I'm gonna reproduce a comment Rakshith made against one of the other articles here, so as to clarify things:

Hey guys, I was not referring to UK when I said 'over there'. UK was never in the context of this conversation. I was referring to <cfmldeveloper>.<com> and not UK. My bad that I should have just said <cfmldeveloper>.<com> than saying 'over there'. Sorry for the confusion.

P.S. I have better access to data than anyone could possibly have to make a ridiculous claim that Adam is the only in UK using CF10 :)

Sunday 7 October 2012

No I'm NOT the only person in the UK using CF10!

G'day:
OK so that title seems like I'm stating the obvious, but it's a reaction to my earlier article which questioned whether I was. I was questioning this because Rakshith from Adobe had suggested I was, as far as he knew. I didn't believe him, so I decided to try to find out (by running a survey).

Firstly: thanks to everyone who responded.  I got 56 responses which is quite good for the surveys I run.

Secondly: yes, I can confirm that there are people in the UK other than myself using CF10.  Phew.

Probable significant bug in ColdFusion 10's (and Railo's) RESTful web services

G'day:
Whilst waiting in the virtual queue to book my Glastonbury ticket this morning, I decided to review the new bugs raised for ColdFusion 10, over night. There's nothing better than sitting in front of my PC at 9am on a Sunday pressing refresh-refresh-refresh on six different browsers trying to buy a ticket for a festival that hasn't even announced its line-up yet, and doesn't even happen for another eight months. Still: after 90min of hammering my "reload" buttons, I had parted with my £50 deposit, and I'm all sorted for Glasto next year.

Anyway, this is not a post about mud and drugs and a looming sense of "am I too old for this?", it's about the safer territory of bugs in ColdFusion. And Railo.

Saturday 6 October 2012

Enough with the Surveys, Cameron! This time: frameworks

G'day
Yeah, sorry, I'm going to ask you to do yet another survey (update: I've stopped collecting results for this, and have done the analysis on it in this article).  I'll stop for a while after that.  Unless I think of something else about your practices I want to find out about, I mean ;-)

Unlike the other ones where I want to simply get a sense of the zeitgeist (and perhaps get it onto Adobe's radar), this one is to help me out with my dev work.

Friday 5 October 2012

How 4 can equal 3 (or possibly 5) in ColdFusion

G'day:
This was the article I was meaning to write today, but I got sidetracked with the IDE survey thing (I've got 30 replies so far: thanks!), and this took a while longer to nut out than I expected.  Plus work gets in the way sometimes (it's lunch time now... my tech leads reads this stuff, so I figure I had better mention that ;-).

OK, so thanks to my new CF bugs RSS feed I now know all about the new CF bugs that get raised as they happen.  This has been helpful for me twice already (in the space of 48h), so I'm pleased with that.

Today I got notified of 3341284 being raised, which is very similar - but not the same, as it turns out - as a bug we're experiencing in CF9.  So it got my focus.

The short version is that when one uses the argumentCollection to pass arguments around, it can screw up your arguments scope.  So this is quite serious.  This problem first cropped up in CF9 (not CF10 as per the bug report), and persists in CF10.  It's fine in CF8.  And in Railo.  And in OpenBD.

What CFML IDE do you use?

G'day:
This article / question was prompted by a few things. I've been using CF Builder since before it was first released (one of the benefits of bring on the Pre-release Programme), but have had a mixed experience with it, so I'm always questioning its merits, and listening to what other people have to say about it.

Wednesday 3 October 2012

RSS Feed for 50-most recent ColdFusion Bugs

G'day:
As per my previous article, here's the feed URL: http://adamcameroncoldfusion.cfmldeveloper.com/cfbugs/adobeBugRss.cfm. I'll also put it in my feeds box over on the right.

Hopefully this is useful for some people.

Update:
I've done the one for the equivalent feed for ColdFusion Builder as well now:
http://adamcameroncoldfusion.cfmldeveloper.com/cfbugs/adobeCfbBugRss.cfm


ColdFusion (/Builder) most recent bugs feed

G'day.
For all intents and purposes, the Adobe bug tracker is one-way traffic: one raises a bug... and that's likely to be the last interaction one has with Abode on the topic of that bug. That's not to say that Adobe don't address the bug in some way shape or form, but the humans at Adobe often don't feed back on the bug tracker in a very helpful fashion, and even if they do: there's no notification system, so one pretty much needs to come back on a regular basis to check if there's been any updates to a ticket. This is made slightly unfeasible because Adobe's reaction time to most issues is absolutely glacial compared to the likes of Railo. So checking on a regular basis is generally a fool's errand.

Tuesday 2 October 2012

I'm the only person in the UK using ColdFusion 10???

G'day:
Sorry for the attention-grabbing headline, but it's not a complete work of speculative fiction (although I kinda hope it is).

Native event framework for ColdFusion 11 ?

G'day:
ColdFusion 11 development is - apparently - underway, so I've turned my mind to what I'd like to see in CF11. One of the things I have been trying to do (with very limited success, I hasten to add) is to learn some new languages. Both with a view to moving on from ColdFusion development eventually (be that via jumping, or being pushed...), as well as it being useful to know how other languages do stuff, and bring some of those techniques back into one's day-to-day work.