Showing posts with label Railo. Show all posts
Showing posts with label Railo. Show all posts

Monday 31 December 2012

Don't optimise your code (annexe)

G'day (again):
In the previous article I alluded to the fact I had more to say on the approach I had to creating my test strings for those experiments. This'll just be short, as it's a variation on the same theme, and I just thought I'd share this with you.

For the previous tests I saved a million-char randomly generated string to test on. Whilst writing the code for this, I noticed some significant performance differences in various different techniques I was using to build the string.  And these are perhaps worth remembering, as far as potential optimisations go.

Don't optimise your code

G'day:
Well that headline is a gross over-simplification of what I'm going to say here. Obviously one should write code that's optimal for the task at hand, but there's a time and place for doing this sort of thing.

The Railo Google Group seems to be my muse this week (which is a sorry indictment of me on a coupla levels), after yesterday's [ed: it was y/day when I started this, it was a few days ago now] inspiration regarding making CFML built-in functions "first-class", and now this article about premature optimisation.

Friday 28 December 2012

Callbacks and built-in functions as first-class functions

G'day:
This will be my most unplanned blog article to date. I saw a thread on the Railo newsgroup over Xmas, and whilst catching up with my responses just now, decided "oh, I'll be able to come up with an article about that".

The posting on the mailing list was asking whether one can pass a built-in function (BIF) as a callback.

I currently have no idea what I'm about to say about this, so I am as interested in what I continue to type as you are (the conceit is that if you've got this far, you have at least a small amount of interest)...

Saturday 24 November 2012

Thoughts on "Coldfusion and the law of dialectics of progress" by Stofke on wheels

G'day:
This is another article that started as a comment on someone else's blog, but it got too long, so I figured I'd clutter up my own blog rather than theirs.

"Stofke on wheels" has written an interesting article entitled "Coldfusion and the law of dialectics of progress" (I wish I could come up with titles like that... without simply just copying it, like I have in this article, I mean ;-)
 
The article starts well - discussing a concept I was unaware of "Law of the handicap of a head start" - and how it possibly applies to ColdFusion - but ultimately arrives at some dubious conclusions as to how Railo is an answer to the questions left asking.

Monday 19 November 2012

Sean said that Nick said that Fusion Authority said...

G'day
Sean Corfield's written an interesting article entitled "CFML - Too Little, Too late?". I recommend you read it. It's not earthshattering and not saying anything that hasn't been said before, but it's nicely composed and is poignant and thought-provoking. And I tend to pay attention when Sean says stuff. I don't necessarily then agree, but I do pay attention ;-)

I started feeding-back to him in a comment on his own blog, but it was getting too long for a blog comment so I thought I'd revise it slightly to add context, and write it here instead.

Saturday 3 November 2012

CFML: Application.cfc-set mappings don't work in onApplicationEnd

G'day:
Well this was not what I was intending to be looking at this evening, but I made the mistake of  looking at StackOverflow and didn't understand what I was reading about mappings and onSessionEnd and ColdFusion 8, so looked into it.


I don't really care about quirks of CF8: the boat's pretty much sailed on any problems anyone finds with that.  However I wanted to make sure it wasn't still happening in CF9 or CF10.

The original problem is that ColdFusion mappings that are set in Application.cfc don't seem to exist by the time onSessionEnd() runs (this is on ColdFusion 8).  Here's some test code and the results:

<cfcomponent output="true">
    
    <cfset this.name = "testMappings">
    <cfset this.sessionManagement = true>
    <cfset this.applicationTimeout    = createTimespan(0,0,0,20)>
    <cfset this.sessionTimeout        = createTimespan(0,0,0,10)>
    
    <cfset this.mappings = structNew()>
    <cfset this.mappings["/test"] = "C:\temp">
    
    <cfset testExpandPath("Pseudoconstructor")>
    
    <cffunction name="onApplicationStart" returnType="boolean" output="true">
        <cfset testExpandPath("onApplicationStart")>
        <cfreturn true>
    </cffunction>

    <cffunction name="onApplicationEnd" returnType="void" output="true">
        <cfargument name="applicationScope" required="true">
        <cfset testExpandPath("onApplicationEnd")>
    </cffunction>
    
    <cffunction name="onRequestStart" returnType="boolean" output="true">
        <cfargument name="thePage" type="string" required="true">
        <cfset testExpandPath("onRequestStart")>
        <cfreturn true>
    </cffunction>

    <cffunction name="onRequest" returnType="void">
        <cfargument name="thePage" type="string" required="true">
        <cfset testExpandPath("onRequest")>
        <cfinclude template="#arguments.thePage#">
    </cffunction>

    <cffunction name="onRequestEnd" returnType="void" output="true">
        <cfargument name="thePage" type="string" required="true">
        <cfset testExpandPath("onRequestEnd")>
    </cffunction>

    <cffunction name="onSessionStart" returnType="void" output="true">
        <cfset testExpandPath("onSessionStart")>
    </cffunction>

    <cffunction name="onSessionEnd" returnType="void" output="true">
        <cfargument name="sessionScope" type="struct" required="true">
        <cfargument name="appScope" type="struct" required="false">
        <cfset testExpandPath("onSessionEnd")>
    </cffunction>


    <cffunction name="testExpandPath" returntype="void" access="public" output="true">
        <cfargument name="message" required="true" type="string">

        <cfset var path  = expandPath("/test")>
        <cfset var fullMessage = "#message#: #path#">
        <cfoutput>#fullMessage#<br /></cfoutput>
        <cflog file="testMappings" text="#fullMessage#">
    </cffunction>

</cfcomponent>

Pseudoconstructor: C:\apps\adobe\ColdFusion\8\instances\CF801\cfusion.ear\cfusion.war\test
onApplicationStart: C:\temp
onSessionStart: C:\temp
onRequestStart: C:\temp
onRequest: C:\temp
test.cfm: C:\temp
onRequestEnd: C:\temp
onSessionEnd: C:\apps\adobe\ColdFusion\8\instances\CF801\cfusion.ear\cfusion.war\test
onApplicationEnd: C:\apps\adobe\ColdFusion\8\instances\CF801\cfusion.ear\cfusion.war\test

Firstly, it's completely legit that the mapping doesn't work in the pseudoconstructor.  See my article on how the settings set in the this scope work if you're not sure why.

However to me it's a bug that they aren't still around in onSessionEnd() and onApplicationEnd().  Someone at Adobe clearly thinks so too, as the behaviour has been modified (partially) in CF9:

Pseudoconstructor: C:\webroots\CF902\test
onApplicationStart: C:\temp
onSessionStart: C:\temp
onRequestStart: C:\temp
onRequest: C:\temp
test.cfm: C:\temp
onRequestEnd: C:\temp
onSessionEnd: C:\temp
onApplicationEnd: C:\webroots\CF902\test

onSessionEnd() has been fixed, but not onApplicationEnd().  You'd think that if someone took the time to fix one of these, they might check the other one too eh?  Apparently not.

It's the same behaviour in ColdFusion 10.  But Railo (4.0.013) works fine: the mapping is still available in onApplicationEnd().

I've raised a bug for this: 3358817.

The work around - such as it is - for this is to set the mappings in CFAdmin: then they work fine.  Not much of a work around, but it might help some people.

Righto.

--
Adam

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 10 October 2012

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:

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.

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.

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).

Saturday 29 September 2012

valueList(): bouquet for OpenBD... play catch-up, ColdFusion & Railo

G'day:
One of the most curious things about CFML is the valueList() function.  As far as I know, it is the only function in all of CFML for which the argument must be of datatype "Query Column" (please let me know if there are any other examples?).   The Query Column (coldfusion.sql.QueryColumn in CF,  com.naryx.tagfusion.cfm.engine.cfQueryColumnData in OpenBD, and I can't coerce Railo into considering query["column"] a column like I can in CF and OpenBD, so I can't tell you what Railo the Railo class is... Railo just says it's a string), is - unfortunately - not a very well-realised data type in CFML.

Friday 28 September 2012

Wednesday 26 September 2012

Callbacks, function expressions, IIFEs, delegates (OK, and closure I s'pose)

G'day
Right, so after a coupla delays, here's the article I threatened you with that's not about closure. Obviously it actually is going to mention closure, but consigned to an afterthought (where, IMO, they kinda belong).

So what is it about? Well it's about a technique that's been possible in ColdFusion since CF5 but is not obvious so is under-utilised, a handy new syntactical construct that was added in CF10, and another one that should have been in CF10 but isn't, something for CF11... and a footnote.

Wednesday 19 September 2012

RSS feeds again

G'day:
I blame Simon for this post ;-)

OK, so I've turned the full feeds back on, but I've made a coupla smaller feeds as well.  Here're the details (also to be found on the right-hand side bar):

The default feed is the one provided by BlogSpot by default, which lists the last n articles (I didn't count how many), and provides the full text.

The other two are provided by Feedburner, and just give the last ten full articles, or the first 500 chars of those articles, respectively.

I hope this covers all the bases for everyone (when I say "everyone" that's bigging-up the half dozen people who read this thing ;-)

I'll have a proper article up at some stage later today.  I meant to write something decent yesterday, but got bogged down on the Railo forums all afternoon, "politely discussing" [cough] some vagaries of Railo I'd found. This was basically the follow-up from that previous article I wrote about the member function methods Railo has for arrays (arrayFindAll(), arrayReverse() (RAILO-2070), and arraySort() (RAILO-2069: already fixed!)), and some back and forth on Railo's <cfdump>.  Inspiring stuff.

But first I need some breakfast (am not working today).

Righto.

--
Adam

Monday 17 September 2012

Arrays in Railo (appendix to the earlier 4-part series)

G'day:
Just when you thought it was safe... here's some more on arrays in ColdFusionRailo. I've already blathered on about the ins and outs of arrays in ColdFusion... well more like arrays in CFML as I cover some stuff in not only ColdFusion but also Railo and a bit on OpenBD too:
But a comment from Gert against one of my blog posts was tucked away in the back of my mind... Railo does some of its own thing when it comes to arrays (and structs, lists, etc).

Friday 14 September 2012

Improving CFML's documentation

G'day
I started rambling on in response to a thread on the Railo newsgroup, but after I'd typed about 500 words I thought it was getting a bit long for a forum response, plus it's relevant to more than just Railo anyhow, so I'd centralise it here, and put a summary on the forum and a link back to here.

The gist of the bit of the discussion I was interested in is this bit:

Alan Holden said:
On the documentation front... and this transcends Railo a bit:

I wish there was a "CFML Rosetta Stone". It would be something like CFDocs, but with a matrix architecture so you could quickly x-reference a tag or function across ACF, Railo and OpenBD (& even desktop, cloud, Jakarta, Tomcat versions, etc). This would help us develop apps that worked across the spectrum, help us solve those "it worked here, why not here?" bugs, and thereby help to advance CFML in general - to the benefit of all.

Unfortunately, this will probably remain a wish for some time... for it would probably need to be housed and managed separately, and would take a little chunk of time (and money) to develop and maintain.

Wednesday 12 September 2012

Survey Results: ColdFusion Modularisation

G'day:
The third survey (there's a first and a second that I have also recently written up) I ran was about how we might think ColdFusion might be modularised: it was to determine how important various areas of ColdFusion are to us, how much we use them, whether we're happy to pay for them or would roll our own or simply do without if they were paid-for options.

I didn't get quite as many answers for this as I did the previous two, which is strange as this one seemed to be the most popular one (going by hits to the page).  Perhaps because there were more options to select on this one, and people couldn't be arsed.  Or having done two surveys already, people got bored.  Oh well (and I completely understand both those positions!).

Anyway, I had to scratch my head for a while as to how to present the data in a useful way, because the questions were large matrices of options, which don't lend themselves well to my fetish-of-the-week: Zingcharts (look at the results of the first two surveys to see what I mean).