Showing posts with label Aurelien Deleusiere. Show all posts
Showing posts with label Aurelien Deleusiere. Show all posts

Tuesday, 7 January 2014

ColdFusion: Participate in your community

One of the things a lot of the ColdFusion community members could do to improve things is... lift their game when it comes to being part of the community!

There's been a coupla examples over the last few days of this sort of thing:

Bug 3678476
Few Image functions are not shown in the Coldfusion image functions list


This URL should contain the below image function:

Rupesh commenting against bug 3678093:

cfloop does have a charset attribute which is used for reading the file. however this is missing from the documentation. This needs to be documented.

(my emphasis)

From Twitter:

(and even once I fixed this one, conversation continued as to how (not) good my fix actually was!)

But in all three examples the person writing is correct.

And all three examples are now fixed. Why? Because I just went in and bloody fixed them.

Wednesday, 21 August 2013

CFML: What's the truth?

This might be painfully obvious to everyone, but I had a "what the hell?" moment this morning when having a look at some of Aurel's code posted against one of my earlier articles. It turns out I have the wrong expectations as to what and when CFML considers values to be boolean.

I've gotta be quick as it's taken most of my lunch break to distill the code down to something simple, but here's the crux of the matter:

truths = [-2,-1,1,2,true,'"yes"'];

for (A in truths){
    test(A, true);
    for (B in truths){
        same = A==B;
        bothNumeric = isNumeric(A) && isNumeric(B);
        expression =
        test("#A# EQ #B#", same || !bothNumeric);

function test(expression, expected){
    var result = evaluate("#expression# ? true : false");
    var colour = result == expected ? "green" : "red";

    writeOutput('<span style="color:#colour#">#expression#: #result#</span><br>');

Do you like my - fairly legitimate, I think? - use of evaluate() in there? ;-) But that's an aside. Here's the output: