Tuesday, 30 December 2014

A bit of fun: #Code2014

G'day:
The Hybrid Group are doing a bit of a fun Twitter survey of language usage in 2014. See here:


So go on, give it a bash.

And for the technical-accuracy-challenged of you out there (looking at you, Brad ;-), remember the language you probably use (if you're reading this), is CFML, not ColdFusion. ColdFusion is the app server (or, hopefully, Railo is the app server ;-); CFML is the language.

Anyway - ColdFusion, CFML, Cold Fusion or DBML - go have a Tweet. Support your language!

--
Adam



Saturday, 27 December 2014

Learn CFML in 24 hours: chapter 0

G'day:
I've been mulling this over since I released the CFScript docs on Github. I made a point of saying it was not aimed at teaching CFScript, it was just a reference. I then started thinking about writing a document which was a tutorial, not a reference, covering CFML. We need a decent guide to using CFML (I do not consider any of the current options to be "decent").

Thinking about it, it became clear it was going to be a non-trivial undertaking, and given my career was vacillating all over the place at the time, I pushed it into the back of my mind.

Friday, 26 December 2014

CFML: Assignments in conditional statements. Yes or no?

G'day:
I have to bang this out in 18min, as the pub is calling (it's Xmas Eve Afternoon). 17min. Crikey.

So this interesting thread cropped up on the Railo Google Group: "CFIF bug". It so transpires this compiles on Railo:

// test.cfm
a = 1;
b = 2;
if (a=b){
    writeOutput("yup");
}else{
    writeOutput("nup");
}
writeOutput("#a# #b#");

Note the typo: "=" rather than "==".

And it outputs:

yup2 2

Tuesday, 23 December 2014

JavaScript: Jasmine for unit testing

G'day:
At work, I've been tasked with getting the team up to speed with TDD whilst we redevelop our website in PHP. I knocked together a presentation on the subject a coupla months ago, but before having a chance to present it, got shifted about in the internal dept structure for a month or so, and it kinda got temporarily shelved. I posted it online: "TDD presentation". I'm back on the PHP Team now, and need to update said presentation to be more work-requirement-specific, as well as cover unit testing our JavaScript. This has been on our agenda for a coupla years, but was never allowed to get any traction by the decision makers. Decision-making has improved now, so we're all go.

I have heard about Jasmine, and like the look of it, but have never actually downloaded / installed / ran it. I'm gonna do that today.

(Oh, blogging my work is not something I do... I'm actually off on sick leave at the moment - which I feel slightly guilty about - but I need to get this stuff done, so gonna do it today whilst I am unlikely to get interruptions. I figured as I'm doing it on my own time, I get to blog about it too ;-)

I am writing about this as I do it.

Jasmine


First up: Jasmine. This is what Wikipedia has to say about Jasmine:

Jasmine is an open source testing framework for JavaScript. It aims to run on any JavaScript-enabled platform, to not intrude on the application nor the IDE, and to have easy-to-read syntax. It is heavily influenced by other unit testing frameworks, such as ScrewUnit, JSSpec, JSpec, and RSpec.
And from its own website:

Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks.

And a code sample from the same page:

describe("A suite", function() {
  it("contains spec with an expectation", function() {
    expect(true).toBe(true);
  });
});

If you're familiar with TestBox (and if you're a CFML dev, you bloody should be!), then this will look comfortingly familiar. Indeed that code would run on TestBox. I know a bit about TestBox, so this is pleasing: I have a head start!

Download & Install

I'm gonna use 2.1.3, which is - at time of writing - the latest version of Jasmine. The download page is here: jasmine 2.1.3. I've D/Led that and unzipped it into a public directory.

Running

This is too easy... it ships with a file SpecRunner.html, and browsing to that runs the tests. Here are the samples:



Nice!

Example Code

Looking at the code within SpecRunner.html, we see this:

Book review: REST Web APIs: The Book (win a copy here)

G'day:
If you're a CFML user, you probably already know that one of the cornerstone members of the CFML community - Adam Tuttle - has recently written a book "REST Web APIs: The Book". I had the privilege of being one of the pre-release reviewers - from a content and language perspective - and Adam has now asked me if I could flesh out my perceptions a bit, as a book review. I've never been asked to do a book review before. Blimey.



Monday, 22 December 2014

Weekend code puzzle: my answer (Go version)

G'day:
I sat down on Saturday / Sunday and taught myself enough Go to be able to answer the puzzle question from "Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)". I've certainly got a lot of mileage out of that one topic, eh? Oh well: I think it's a good baseline exercise for researchng new languages, and I like seeing other people's code, too. I'm so pleased I got such a good range of submissions. However it does mean it's taking me an age to slog through them all.

Right, so I discussed Adam Presley's two Go entries over the last few days: "Weekend puzzle: Adam Presley's answer (Go)" and "Weekend puzzle: Adam Presley's answer - redux (Go)", and I did a "G'day World in Go" exercise in prep for understanding his code. Not that a "G'day world" exercise was sufficient for that, but at least I got Go installed and compiling, and located the docs etc.

Sunday, 21 December 2014

Weekend code puzzle: Adam Presley's answer - redux (Go)

G'day:
Adam Presley is a bit of a star. I had a look at his original entry to the code puzzle and decided I didn't like it as it was too long-winded ("Weekend code puzzle: Adam Presley's answer (Go)"). He's subsequently come back to me with a simplified version, listed on his own blog: Response To Adam Cameron's Code Review. He took my comments in good grace, which is very good of him.

Let's have a look at this new version:

Thursday, 18 December 2014

Book review: Adam Tuttle's newest book

G'day:
Adam's been busy recently. You'll've heard about his new book "REST Web APIs: The BookREST Assured: A Pragmatic Approach to API Design" which is being released soon - I'll have a review up and a competition to win a copy next week - but he's also released the first book dedicated to ColdFusion 11's newest marquee feature: CFClient.

I know I have derided CFClient a lot, but it does have its good bits, and Adam has worked through them all and put a fairly accessible book together. Granted it's not very long, but for something that focuses on a single tag, I think that's fair enough. It's free and open source, so you should go get it, and give it a read. It might make you think again about whether or not to use CFClient. I have to admit it did give me pause for thought.

Go grab it from it's official website now (it's just a PDF): "CFClient The Good Parts".

I think Abram Adams (of trycf.com fame) said it best in his review when he said:
I felt like I was looking into the minds of Adobe engineers
It's exactly this attention to detail Adam Tuttle captures in this latest book.

CFML doyen Mark Drew had this to say:

I have been looking everywhere for an in-depth look at the useful features of the cfclient tag and I have to thank Mr Tuttle for providing it!

I am not good at reviews but I should say that this is not only The Good Parts, it is also the definitive guide.

5/5


I'll get back to you about the REST book next week (here it is: "Book review: REST Web APIs: The Book (win a copy here)"). The CFClient book'll keep you going until then.

Cheers.

--
Adam

Wednesday, 17 December 2014

Fixing CFScript: CFLDAP

G'day:
This is the first in a series of brief articles I'm going to write to demonstrate how Adobe (and, for that matter, Railo) could have implemented functionality that was formerly the preserve of tags in CFScript. The first (mostly random) example is <cfldap>. I have picked <cfldap> because someone mentioned it on IRC the other day. And I hated the advice I had to give them by way of implementing their needs in CFScript.

The problem CFML developers are faced with is that both Adobe and Railo are eroding the quality of the CFML language by implemented cross-cutting "generic" solutions for shortfalls in CFScript functionality, rather than addressing each piece of functionality professionally and thoughtfully.

Railo have implemented a generic solution which the CFML Advisory Committee came up with, years ago. The basic model is this:

Hands up: who has issues accessing the ColdFusion bugbase?

G'day:
There is a continuing issue with access to the Adobe ColdFusion bugbase: when clicking on a link (like this one: https://bugbase.adobe.com/index.cfm?event=bug&id=3909712), many many people get one of two things:

  1. redirected to a login page (that URL requires no login, so that is invalid);
  2. put into a perpetual redirect loop between ticket and login page.

I think other people have different symptoms too. And a select few actually get to see the bug. 75% of the time, I cannot get to the bug page unless I use an incognito page. Sometimes if I clear my adobe.com cookies I can get in without an incognito window, but often I still can't.

Adobe are looking at this (our man Kapil is the star there), but they cannot replicate it. This gobsmacks me, TBH, as so many people seem to have issues.

Do me a favour will you? Go click on that bug URL above, and post back what you get? Do you go straight to the ticket (lucky bugger), do you have to login? Do you get into a redirect loop? Something else? If you could let me know your OS, browser (/version) etc, that might help. If you can't get in initially, but blow awway your Adobe cookies, does that help? Anything relevant, really. If you're happy to liaise with Kapil directly, please let him know on Twitter: @KaroraKapil.

Cheers for your help.

--
Adam

PS: oh and vote for that bug, will you? Cheers.

Weekend code puzzle: Adam Presley's answer (Go)

G'day:
At long last, I'm continuing to look at each person's submissions for the code puzzle ("Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)"). There's been a bit of a hiatus because I've been busy with other things, plus generally not that interested in keeping up with this blog. Oops.

OK, so Adam's effort is in Go. The github repo for it can be found here: https://github.com/adampresley/adamCameronCodeChallenge201411.

G'day World in Go

G'day:
I've got an odd situation at present... I have a suspected lump on the inside of my eyeball, underneath my retina. I say "suspected" because the symptoms I have are those that I've had before with my other eye, and "a lump" was what it turned out to be. The manifestation of this lump is that I have a "dull" patch in my vision, caused by the light hitting the wrong part of my retina where the lump is, and my brain not quite being able to adjust for it. I'm in the NHS waiting list to get it seen to, but that's not until Dec 31. Last time the treatment was some pills, so I hope it's the same again, rather than it being like something from Un Chien Andalou. Anyway... I'm telling you this because currently I am off work due to only being able to look at a screen for a few minutes at a time, before my head starts hurting. The dull patch is to the immediate right of my focus when reading, meaning the word following the one I am currently reading is "greyed-out". Frustrating as f***.

I'm finding this jolly tedious, have decided to try to write something today, to check how long it is before I need to give up. Hopefully it'll also give my brain some training to work around the dull patch. In my vision, I mean.

So - other than the fact I'm already at the 250-word mark with completely off-topic nonsense (what is this? CFHour? ;-) - here's a short article on my experiences of getting Go up and running on this box. it's very straight forward, and this article really only serves to demonstrate how straight fwd it is, so as to perhaps give people encouragement to try it out.

Tuesday, 16 December 2014

F***ing StackOverflow. And new vs createObject() vs entityNew()

G'day:
I was typing this response on Stack Overflow, and just as I was finishing, the question was closed and I was unable to save it. What a bunch of pricks the rule-makers on StackOverflow are.

I'm not having my work wasted, so I'm publishing it here instead.

Obviously any thoughts or elaborations are welcomed.

Monday, 15 December 2014

Say "no" to Adobe and their bloody stupid generic CFScript syntax

G'day:
Firstly, sorry this blog has been a bit of a non-event recently. There's various reasons for this - none of them interesting - but I'll get back on form soon. -ish.

Now. Frickin' Adobe.

Tuesday, 9 December 2014

ColdFusion 11 update 3 and ColdFusion 10 update 15 are out

G'day:
Adobe have finalised ColdFusion 11's update 3, and ColdFusion 10's update 15. Official word is on their blog "ColdFusion 11 Update 3 and ColdFusion 10 Update 15 are available now".

I'm in the process of running them now...

ColdFusion 11 updates to version 11,0,03,292480. It claims to fix 195 issues, btw. That's pretty impressive. Although, equally, not before time.

The update installation process went smoothly (I am just running the Express install).

ColdFusion 10 updates to version 10,0,15,292549. It just mentions a security update.

Note: both updates require reconfiguring the web server connectors. As I'm just running the internal web server on both of these, I've not needed to bother with that.

I'll probably go ahead and install Java 8 now, and reconfigure these CF instances to run atop of that.

Adobe have done a good job with their fixes for ColdFusion 10 and 11 recently. However they need to reduce their cycle duration down to 2-3 monthly minimum. Once a month would be better. They don't need to fix 195 bugs every month, just the most recent ones, and a few of the longer standing ones each time. Here's hoping they can achieve this.

But: good work, Adobe. Nice one.

--
Adam

"George", eh?

G'day:
So I heard the first mention of Railo 5 in quite a while from the Railo guys today, an oblique reference from Micha:

In George (Railo 4.2 successor) the release date is set by the build process in the default.properties file, the location for this information has moved because this file is common practice with OSGi.

Two things interest me:

  • things have been very quiet re Railo 5George recently, after a lot of initial chatter about it;
  • odd to describe it as "Railo 4.2 successor" when previously they've been very open about referring to it as "Railo 5". Dunno what to make of that. I might just be reading too much into casual words on a Google group.


Anyway, it's jolly good to hear mention of it. I just bloody wish they'd hurry up and release the damned thing. At least to a public beta or something! It sounds like it's really going to be a great step forward for CFML, and will probably give Adobe a bit of a fright, I reckon.

Can't wait!

--
Adam


PS: thanks to John Whish for helping me get this article up onto coldfusionbloggers.org, which I cannot access from this machine @ present, for some reason.

Friday, 5 December 2014

(CFML) Survey results: how you write your function signatures

G'day:
Firstly, hey thanks to everyone who filled the survey in! I got over 100 responses within the space of a coupla days. That's the fastest I've had responses to a survey. Cheers!

Anyway, what did you have to say?

Adobe's most valuable employee

G'day:
No messing around: it's Anit:


TBH, I have not even checked which ticket Anit is following up on here, I'm just focusing on this bit:

#idontgiveup

And Anit doesn't. No matter what gets thrown at him. He works to help his (ColdFusion) community. No excuses, no "closed/cantbearsed". Anit just cracks on and gives us the answers.

Almost everyone else on his team could draw a page from Anit's book when it comes to client support.

Anit: thanks dude,

--
Adam

Wednesday, 3 December 2014

(CFML) It's time to get query of query improved

G'day:
I'm sure all this has done the rounds before, but I cannot find the tickets. So I have raised them again:

Tuesday, 2 December 2014

For Andy Allan

G'day:
I have no idea why I'm doing this, but here you go Andy: a blog article.

--
Adam

(CFML) A quick survey about how you write your function signatures

G'day:
The subject kinda says it all. I'm just curious as to how people tend to code their function signatures, so I'm running a short survey.

Update:

The survey is closed: Survey Monkey will only allow me to gather 100 responses, which I've now got.

Monday, 1 December 2014

Hammers and screws (and when not to use a list in CFML)

G'day:
I hope Salted (/Ross) and Ryan don't mind me pinching our IRC conversation for a blog article, but... well... too bad if they do. It's done now. This is it.

Ross was asking "whats the most efficient way to remove the first two items in a list and get back the remainder", which made my eyes narrow and decide there's probably something to get to the bottom of here. Because he mentioned "lists". And these should - in general - be avoided in CFML.



After some back and forth with Ryan, Ross settled on:

listtoarray(foo," "), arrayslice(bar,3), arraytolist(bar," ")


(pseudo code, obviously).

Now... I think lists are overused in CFML, and - indeed - they are a bit rubbish. Having a string of data and then using one character (OK, or "some characters ~") from the string as a delimiter is seldom going to work, especially with the default delimiter of comma. Because in really a lot of situations, commas are actually part of the data. And same with any other char-based delimiter (except say characters specifically intended to be delimiters like characters 28-31 (file, group record and unit separators, respectively). I really don't think lists should generally be part of a solution to anything.

With this in mind, I decided to check what was going on. This is copy-and-pasted from the IRC log (spelling and formatting addressed, otherwise it's unabridged):

16:36 <adam_cameron> Salted: first question that should be asked... why is it a list in the first place? Do you have any control over it?
16:36 <Salted> no, it's returned from a postcode lookup service
16:36 <Salted> I'm fairly certain that the address string will always have the postcode first so [p1] [pt2] [line1]
16:37 <Salted> it's not a list its a string but I'm treating it as a space delimited list for these purposes...
16:37 <adam_cameron> so it's a string? Not a list per se?
16:37 <adam_cameron> ok
16:37 <Salted> indeed
16:37 <adam_cameron> So what you actually want is everything after the second space?
16:37 <Salted> essentially yes
16:37 <adam_cameron> Not a list with the first two elements dropped off
16:37 <Salted> in this instance what you've mentioned is one and the same, if I treat it as a list
16:38 <adam_cameron> well literally, yes. However once you start treating it as a list, you're thinking about it wrong
16:39 <Salted> I don't see how thats different from thinking of strings as char arrays, for example
16:40 <Salted> "my name is ross" is both a char array of 14 elements and a list of 4 elements
16:40 <adam_cameron> because you start trying to use list functions on it
16:40 <adam_cameron> Which makes your code shit


My point here - one that Ross doesn't entirely agree with - is that just because one can use a string as a list, doesn't mean - semantically - it is a list. And one should try to keep one's code as semantically clear as possible.

What Ross has here is not a space-separated list. Later in the conversation I extracted form him what the actual data was like, and this was a sample:

X1 2YZ Apartment 1903, 10 Random Street Suburbia, OURTOWN


What we have here is... a mess. It can be assessed in a number of ways:

  • a post code part followed by an address part
  • a post code followed by a street address followed by a city
  • a post code followed by the street part of the address, the suburb part of the address, and the city part of the address
But what it isn't is a space- (or comma-, or anything-) separated list. So one should not solve this problem using lists.

One should look at the actual requirement, and solve that.

Saturday, 29 November 2014

Survey results and my own findings: timestamp vs DateTime (PHP)

G'day:
Apologies for the delay in getting back to this survey ("PHP: a survey about date data handling") - although I'm sure few people would have been waiting with bated breath - I've just had a very busy week with one thing and another. Now it's Saturday and I have a moment or two to breathe before finding a pub to watch the rugby (England v Aussie and/or Wales v South Africa, which are on simultaneously).

Anyway... here are the results:

Friday, 28 November 2014

Local scope bug (or not, if you're the ColdFusion Team)

G'day:
I just spotted this, and decided to look into it:

This defines a bugsituationbug in ColdFusion wherein if one deletes a local-scoped variable from a function, then assign an unscoped variable, that new variable goes back in the local scope, not in the variables scope.

Monday, 24 November 2014

PHP: don't forget the timestamp / DateTime survey, if you have a moment for a one-question survey

G'day:
I released this ("PHP: a survey about date data handling") on Friday, which is a bit of as rubbish day for me to ask for ppl's input as they've generally got better things to think about. Whereas on Monday people might be looking for something to do other than work.

I've got 55 responses, which ain't bad given how anonymous both myself and this blog is in the PHP world, but I wouldn't mind a few more. So if you've got an opinion on PHP timestamps vs DateTime objects, I'd be keen to hear it. Or if you can fwd it on to other people who are in the PHP world, that'd be cool too.

I'll post the analysis tomorrow. Spoiler: there's not much in it.

Cheers.

--
Adam

Weekend code puzzle: my answer (Python version)

G'day:
This is a companion exercise to my earlier articles:
I'll be using exactly the same logic as in those two, just working within Python's constraints. I freely admit to not knowing Python from a bar of soap - indeed this is the third bit of Python I have ever written - so I would not vouch for this being anything other than a comparison to the other two pieces of code, and not a demonstration of what a Python dev might consider "good code". This is not a Python tutorial.

Sunday, 23 November 2014

Weekend code puzzle: Dave's answer (Python)

G'day:
I'm continuing to look at each person's submissions for the code puzzle ("Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)").

Dave's done a Python version. Like Chris just before him, Dave got his answer in before I varied the rules slightly, so his answer just finds the first longest subseries within the threshold from within the series; it does not check same-lengthed subseries for which has the highest within-threshold total. "Within" three times in a sentence. Sorry about that.

Saturday, 22 November 2014

The Adobe ColdFusion Team are doing a bloody good job at the moment

G'day:
I know I am the first (and loudest, and most repetitive...) to whinge about Adobe's ColdFusion lads (/ladesses), but... fair's fair... there's very bloody little to complain about at the moment.

My answer to a question on Stack Overflow about DI

G'day:
I'm re-posting this here, hoping to get feedback from the DI doyens like Sean, Brad and Luis. Plus it's an easy article to post whilst I get together my article about Dave's Python code (from the quiz: "Something for the weekend? A wee code quiz (in CFML, PHP, anything really...)").

The question is here: "Dependency injection is only for testing?", and I'll reproduce it here (I'll ask the OP if this is OK, and remove/summarise if not):

Friday, 21 November 2014

PHP: a survey about date data handling

G'day:
I'm just going to regurgitate the intro paragraph to the survey (https://www.surveymonkey.com/r/XV9ZP8W) here:

I'm in the process of teaching myself PHP, having come from a CFML background. One topic that came up in conversation yesterday was how to store dates in memory (ie: in a variable). In CFML we'd use a date object. It seems in PHP there are a number of common options: using an integer in the guise of a "Unix timestamp" or using a DateTime object being two options. I'm just wondering what people tend to do here.

Thursday, 20 November 2014

Railo "unexpected" behaviour: opinions solicited

G'day:
This will be one of those really quick ones as I have precisely 19min of lunchtime left to write it.

Ryan Guill found some oddness with Railo yesterday, with code like this:

function tikiOtinga(required string s required numeric i){
    writeDump(arguments);
}

(his example wasn't in Maori, but hey).

Can you spot what's wrong with it?

Weekend code puzzle: ChrisG's answer (CFML)

G'day:
OK, now I'm gonna look at each person's submissions for the code puzzle ("Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)").

Chris has done a CFML version. He was very quick off the mark, and had his submission in before I varied the rules, so this one just solves the initial challenge which is to find the longest subseries within a given threshold, but does not consider equal-length longest subseries. Fair enough.

Tuesday, 18 November 2014

What should CFML's deleteAt() method return?

G'day:
This will be quick, as I'm out of time before I'm due to start work.

As I mentioned in my earlier article ("Weekend quiz: my answer (CFML version)"), Railo's (and ColdFusion's for that matter) Array.deleteAt() method returns a pointless boolean, rather than something useful. What do you think it should return?

Weekend code puzzle: my answer (Ruby version)

G'day:
I'll move on from this topic soon, rest assured. Having come up with a CFML answer for my code puzzle question ("Weekend code puzzle: my answer (CFML version)"), I decided to stretch myself (albeit slightly) and work out how to do it in Ruby too.

For the sake of completeness, here it is.

Weekend code puzzle: my answer (CFML version)

G'day:
This is another follow-up to "Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)". Yesterday I posted my PHP version of a solution: "Weekend code puzzle: my "answer" (PHP version... which doesn't quite work)" and now here's my CFML one. NB: It's Railo-specific CFML: it won't run on ColdFusion.

Sunday, 16 November 2014

Thursday, 13 November 2014

Weekend code puzzle... what's happened?

G'day:
Yeah, I know I've been slack with the results from the weekend code puzzle ("Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)" and "Something after the weekend..."), but I've had a crazy week at work: no time before I start my day, nor lunch breaks; and I've been tied up in the evenings. But I still intend to follow this up as soon as I can, which will probably now be Saturday.

Sorry for the delay, and - again - thanks for all your entries.

Stay tuned...

--
Adam

ColdFusion 2016: instead of <cfbell> and <cfwhistle>...

G'day:
I was asked to comment on Microsoft's announcement that the entire .Net Framework is going open source (".NET Core is Open Source"), and what we - the CFML community - should think about that in the context of ColdFusion.

Monday, 10 November 2014

Something after the weekend...

G'day:
This is just a follow-up to my Friday article: "Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)". There's a bunch of good entries: cheers for that. There's CFML, PHP, Go, Python and Clojure examples there. However I'll still looking for more though: it's not too late to give it a bash. I have not looked at any of them (beyond superficially) yet, as I didn't want other people's work influencing my own.

Friday, 7 November 2014

ColdFusion: Adobe kinda trumped me to this

G'day:
An article I've been drafting in my head is a suggestion for Adobe as to how they can make the ColdFusion release cycle less painful for their clients. They've actually done part of what I was thinking of advising today, by releasing the latest updater for ColdFusion 11 to beta for us to test ("ColdFusion 11: a decent bugfix update has been released to beta"). But I'll write down what I was thinking anyhow.

ColdFusion 11: a decent bugfix update has been released to beta

G'day:
I just noticed this: "ColdFusion 11 Update 3 is available for early access".

Looking at it, it's pretty impressive / optimistic: over 100 issues fixed.

As with all ColdFusion updates, test it in your lab environment thoroughly before thinking about putting it into production. This would always apply to anything Adobe release for ColdFusion, but especially bear in mind this is - at best - a beta.

--
Adam


Something for the weekend? A wee code puzzle (in CFML, PHP, anything really...)

G'day:
Just to demonstrate I have not an original thought in my head, I am plagiarising the topic of this article / code puzzle from a question on Stack Overflow. It's also inspired by Duncan's "Project Euler" series of blog posts.

But just to get your brains stretching (albeit: only slightly), perhaps you might want to answer the question on my terms (which opens it to a broader audience), rather than those specific to the question.

Tuesday, 4 November 2014

PHP: array_udiff()

G'day:
I'm not too sure how interesting this article is gonna be, but for the last coupla days I've been trying to solve a problem using array_udiff() to filter elements from one array based on their sameyness (I made that word up, sorry) compared to elements in another array. Now I know this perhaps isn't quite the intended purpose of a diffing function - and it turned out to not be a viable solution for this reason - but the investigation turned up some "interesting" behaviour that isn't clearly documented as far as I can tell.

First things first, look at this shambles:

Saturday, 1 November 2014

PHP & CFML: mapping and reducing

G'day:
I'm trying my hardest to answer PHP questions on StackOverflow these days, but the PHP community is so large and my PHP knowledge is so neophytic that I am never an early-enough bird to catch the worm for the easy questions. Plus a lot of the "PHP" questions are actually asking framework specific questions, and I have no idea about Laravel, Zend etc.

Still: I found an interesting question today with a pedestrian answer, so I decided to offer my own answer (to the actual question as asked). The answer would have been easy in CFML, but it was a bit of a ball-ache in PHP.

Railo won the Bitnami competition

G'day:
This just came in the e-post from Bitnami:

Hi Adam,

Thank you for voting to add Railo to the Bitnami library in our monthly contest. Good news - Railo received the most votes and will soon become part of Bitnami!. We will send an email letting you know as soon as it is available for you to try out.

Given that this contest has come to an end, a new one has now started. If there are other apps you would like to see us add to Bitnami, be sure to vote for them to get them added next!

- The Bitnami Team
Good work, Railo & CFML community.

--
Adam




Friday, 31 October 2014

TDD presentation

G'day:
A coupla weeks back I was tasked with giving a presentation to the new PHP troops: an introduction to TDD. I'm not on the PHP team now, but they might need to be doing some TDD shortly, so I figured I'd at least expose them to the presentation slides if not actually take them through it. And I figured I might as well put it up for everyone to have a look at, in case it's of any use to anyone.

It's very bare bones, and I dunno how useful it'll be if I'm not there discussing each slide, but... oh well. It's here: "TDD".

If nothing else, it might solicit some questions from people, which will be a good thing.

Cheers.

--
Adam

Thursday, 30 October 2014

Just for Andy Allan

G'day:
More times that you probably thought when you said that, I wager.

--
Adam

ColdFusion bug challenge: how quickly can one find a bug in ColdFusion 11?

G'day:
Yesterday at lunchtime, I set myself a challenge: how quickly could I find a new, unreported bug in ColdFusion 11.

If you're in the UK, can you please do me a quick favour?

G'day:
Hey, if you're in the UK, can you please run some code for me and let me know what you get?

Oh yeah... I'm back doing ColdFusion for the time being

G'day:
Not that it's particularly important, but for one reason or another, I'm been seconded back into our ColdFusion Team from the PHP Team. And will probably remain here for a month or so.

--
Adam

Monday, 27 October 2014

FFS, Adobe. Stop being such bloody amateurs

G'day:
Now this irks me (in case you had not noticed).

Here's a couple new bugs that have gone into the Adobe ColdFusion Bug Tracker:

A quick look at WireBox

G'day:
A coupla days ago I had "A quick look at DI/1", after having my interest piqued by Chris' presentation "Dependency Injection with DI/1". That went quite smoothly, so to kill some time after CFCamp, I decided to do the equivalent exercise with WireBox.

Friday, 24 October 2014

Would you install a ColdFusion hotfix/updater/patch without testing?

G'day:
First things first, this is my position (and the one I believe anyone who's not a lunatic should have): "bloody hell no, are you insane?"

But I polled the community yesterday, via Twitter:



Tuesday, 21 October 2014

CFCamp 2014 hindsight

G'day:
So CFCamp 2014 is over. First things first: Mike, you're a star. Everyone who attended thinks this. Thanks so much for organising yet another excellent CFCamp, and dealing with all the various... erm... "idiosyncracies" that sponsors and speakers and others threw at you.

I'm not flying out until tomorrow afternoon, and I don't fancy going into Munich for a night out, so I'm just hanging @ the Stadthalle in Germering. As I just said on Twitter: I seem to have the place to myself, other than the four people working on the bar here. I'll probably go over to visit my favourite wolpertinger later on for dinner, but it's too early for that. So beer and blogging it is. I've just started my third pint (well: 400ml rather than a pint, anyhow).

This is my wash-up of the conference.

A quick look at DI/1

G'day:
I'm at CFCamp at the moment, and one of the better presentations yesterday (out of a lot of good presentations, I might add) was Chris' presentation, "Dependency Injection with DI/1". It looked sufficiently interesting I thought I'd have a quick look-see at it. I have downloaded it in the past, but that's about as far as I had got.

I've been using ColdSpring at work for the last few years, but DI has come a long way since ColdSpring's heyday. So I'm familiar with the concepts of dependency injection, but only ColdSpring's implementation of it.

If you don't know what DI is, go read up on it first otherwise none of this will be very meaningful. I'm not able to get an internet connection at the moment, so I can't find a decent link for you, but I'll try to remember to update this later on. Or, hey, you probably know how Google works.

Monday, 20 October 2014

CFCamp: a Crocodile Dundee moment for me

G'day:

That's not a shot glass. This is a shotglass.

It was a bit of a messy night last night. Well, indeed, we basically sat around all afternoon @ the Stadthalle at Germering drinking Tegernseer Hell, so it was getting messy even before the evening.

Am currently sitting in Luis' CommandBox presentation. CommandBox continues to look impressive.

Quite a content-lite article this. I just liked the size of that shotglass, basically.

I'll try to write something more useful later on. But I'm also doing Twitter updates tagged with "#CFCamp" as things occur to me. That might be a better way to find out about what's going on @ CFCamp.

--
Adam

Saturday, 18 October 2014

PHP: getting AspectMock to work

G'day:
First things first: Luis, Brad, everyone at Ortus Solutions: I bloody love you guys. Working with TestBox and MockBox is an absolute pleasure compared to getting their PHP equivalents installed and working properly.

Over the last coupla weeks, meself and Duncan have been investigating unit testing on PHP, and specifically how to mock dependencies. On our old CFML code base, we have 1000s of test, and we use MockBox heavily, as we have rather a lot of dependencies which interfere with testing if they're not mocked. We only ever really moved to TestBox as a proof-of-concept before our CFML codebase was put into maintenance mode, and we shifted to PHP. Prior to that we had been using MXUnit for a number of years.

PHPUnit is a bit rough-and-ready in comparison to TestBox, but it's solid and will do the trick. However we both had an arsehole of a time getting AspectMock to work. And we both failed and moved on to other things. Earlier I'd looked at Mockery as a solution for mocking - its docs are better than AspectMock's (both a recommendation for Mockery, and an indictment of AspectMock), but it did not do something things we expect to need to be doing, whereas AspectMock claims it can (mocking static methods).

Anyway, this afternoon I found myself furrowing my brow and thought "I'm going to get that bloody thing to work... or else". Fortunately after a lot of swearing and wondering if I can hunt down and punish AspectMock's author... I finally noticed what I had been doing wrong. I presume Duncan was doing the same thing wrong, but don't know. Anyway, I got it working.

So here's my AspectMock mission from this afternoon.

TickintheBox

G'day:
I watched a good amount of bickering between two fellas who should know better last night:


(click through and read the "conversation" if you want to. I'll not reproduce it here as it's a bit embarrassing for the participants, I think).

Also, I "published" some misinformation of my own about CommandBox a day or so ago (as a comment on Cutter's blog:  "What's Wrong With ColdFusion - 2014 Edition"). So I figured I owed to Brad and Luis to actually have a look at CommandBox (which I do like the sound of, see "Ortus does what Adobe / Railo ought to have done...").

Thursday, 16 October 2014

WTaF?


ColdFusion 2016 in 2016? ColdFusion 2016+1 in 2018?

G'day:
Brad posted an interesting (if very blurry) image from CFSummit earlier:



CFML: Gert points out a schoolboy error in my prime numbers generator logic

G'day:
I was messing around with using closure to mimic a generator the other day: "CFML: prime number generator UDF, and overhead of using inline function expressions". Gert had a look at it, and spotted a shortfall in my implementation. He's provided some code as well but I've not really looked at that yet, instead wanting to nut it out myself (part as a penance, part as an exercise).

Wednesday, 15 October 2014

Warning: people have been having issues with ColdFusion 10 update 14

G'day:
I've nothing much to say other than what it says in the headline: people have reported issues with the ColdFusion 10 update 14 that was released yesterday ("ColdFusion: new security patches for 9.0, 9.0.1, 9.0.2, 10.x, 11.x"):

As is my advice with anything the Adobe ColdFusion Team produces: it does not pay to be an early adopter. Let other people find the issues first, and let the resolutions bubble up before you run the risk of experiencing them yourselves.

And if you feel you must install it immediately, as I said yesterday: install it in a test environment and fully regression test your applications first.

Don't just install it on production servers without first testing it. This obviously applies to any change you're thinking of making to the system.

Oh... the ColdFusion Team have also got around to mentioning these new updates on their blog: "Updates for ColdFusion 11, ColdFusion 10 and ColdFusion 9 released". I recommend you go and read the comments and subscribe to the thread so as to stay on top of people's findings, and Adobe's responses.

--
Adam

Tuesday, 14 October 2014

ColdFusion: new security patches for 9.0, 9.0.1, 9.0.2, 10.x, 11.x

G'day:
Patches just came out for all versions of ColdFusion from 9.0 upwards. Details in their security document: "ColdFusion Help / ColdFusion Security hot fix APSB14-23".

I've not checked the content of it, but I will say that if at this late stage of ColdFusion 9's like (it's EOL on Dec 31 this year) they're releasing individual patches for all of 9.0, 9.0.1, 9.0.2, then I am guessing it's fairly serious. So get your test machines updated as soon as possible and regression-test your apps, then look to move it to live as soon as it seems stable.

And in the mean time, we're still waiting for a more useful bug-patch for both CF10 and CF11. Wonder when to expect thosethat? They'reIt's been promised as coming out "soon" since about August, I think..?

I've just notice that the ColdFusion 10 one is actually a fairly substantial patch, fixing 60-odd issues! So that's quite good. Details in "ColdFusion Help / Bugs fixed in ColdFusion 10 Update 14".


Anyway, there you go.

--
Adam

Monday, 13 October 2014

CFCamp: what I'll be having a look at

G'day:
Blimey. It occurred to me on the train this morning than this time next week I'll be in the keynote of CFCamp 2014. That kinda snuck up on me. I guess I've been a bit distracted with PHP and stuff like that.

OK, so what am I gonna go see?

Sunday, 12 October 2014

CFML: prime number generator UDF, and overhead of using inline function expressions

G'day:
I continued to play around with faux generators in CFML after I finished "CFML: emulating generators with closure" yesterday. Whilst I didn't think the world would benefit from there being a palindrome generator on CFLib.org, it might benefit slightly by having one that generated primes. CFLib.org already has a function which returns an array of primes up to a threshold (GetPrimes()), but that's a slightly different requirement than being able to generate them one at a time. And I wanted to fiddle about anyhow, so that became my mission.

The actual code is not mention-worthy in and of itself, but a coupla things I noticed along the way probably are.

Saturday, 11 October 2014

If you're missing the @CFMLNotifier feed: @CFNotifications has picked up the slack

G'day:
SSIA, really. Adam Tuttle just asked if I still did the @CFMLNotifier Twitter feed; I do not.

But there's the @CFNotifications feed which covers the same ground, and does a more polished job of it than I ever did. This new feed is managed by Stephen Walker, of @cfuser fame.

The received wisdom of TDD [etc]: Sean's feedback

G'day:
During the week I solicited feedback on my assessment of "The received wisdom of TDD and private methods". I got a small amount of good, usefull feedback, but not as much as I was hoping for.

However Sean came to the fore with a very long response, and I figure it's worth posting here so other people spot it and read it.


'ere 'tis, unabridged:

There are broadly two schools of thought on the issue of "private" methods and TDD:

1. private methods are purely an implementation detail that arise as part of the "refactor" portion of the cycle - they're completely irrelevant to the tests and they never need testing (because they only happen as part of refactoring other methods when your tests are already passing).

2. encapsulation is not particularly helpful and it's fine to just make things public if you want to add tests for new behavior within previously private methods.

The former is the classical position: classes are a black box except for their public API, and it's that public API that you test-drive.

The latter is an increasingly popular position that has gained traction as people rethink OOP, start to use languages that don't have "private", or start working in a more FP style. Python doesn't really have private methods (sure, you can use a double underscore prefix to "hide" a function but it's still accessible via the munged name which is '_TheClass__theFunction' for '__theFunction' inside 'TheClass'). Groovy has a 'private' keyword (for compatibility with Java) but completely ignores it. Both languages operate on trust and assume developers aren't idiots and aren't malicious. In FP, there's a tendency toward making everything public because there are fewer side-effects and some helper function you've created to help implement an API function might be useful to users of your code - and it's safe when it has no side-effects!

When I started writing Clojure, coming from a background of C++, Java, and CFML, I was quite meticulous about private vs public... and in Clojure you can still easily access a "private" function by using its fully-qualified name, e.g., `#'some.namespace/private-function` rather than just `private-function` or `some.namespace/private-function`. Using `#'` bypasses the access check. And the idiom in Clojure is generally to just make everything public anyway, possibly dividing code into a "public API" namespace and one or more "implementation" namespaces. The latter contain public functions that are only intended to be used by the former - but, again, the culture of trust means that users _can_ call the implementation functions if they want, on the understanding that an implementation namespace might change (and is likely to be undocumented).

My current position tends to be that if I'm TDD-ing code and want to refactor a function, I'll usually create a new test for the specifics of the helper I want to introduce, and then refactor into the helper to make all the tests pass (the original tests for the existing public function and the new test(s) for the helper function). Only if there's a specific reason for a helper to be private would I go that route (for example, it isn't a "complete" function on its own, or it manages side-effects that I don't want messed with outside of the calling function, etc). And, to be honest, in those cases, I'd probably just make it a local function inside the original calling function if it was that critical to hide it.

Google for `encapsulation harmful` and you'll see there's quite a body of opinion that "private by default" - long held to be a worthy goal in OOP - is an impediment to good software design these days (getters and setters considered harmful is another opinion you'll find out there).

That was longer than I intended!

Yeah Sean but it was bloody good. It all makes sense, and also goes a way to make me think I'm not a lunatic (at least not in this specific context).

And I have a bunch of reading to do on this whole "encapsulation harmful" idea. I'd heard it mentioned, screwed my nose up a bit, but didn't follow up. Now I will. Well: when I have a moment.

Anyway, there you go. Cheers for the effort put in to writing this, Sean. I owe you a beer or two.

Righto.

--
Adam

CFML: emulating generators with closure

G'day:
Half way through my other article this morning ("PHP: Inspired by Duncan: palindromes via generators"), I was thinking how cool generators are, and how it sucks CFML doesn't have them (go vote, btw: RAILO-2942; and for ColdFusion: 3555025).

Then I had a watershed moment.

PHP: Inspired by Duncan: palindromes via generators

G'day:
My mate Dunc is making a habit of being my muse @ the moment. I guess it's cos we're both learning PHP at the same time, and he's blogging about it as well. This morning he has a new article following his foray into translating his CFML (and Python occasionally) knowledge into PHP: "Project Euler: problem 36 (PHP)".

Thursday, 9 October 2014

Proposed TDD logic flow

G'day:
I've been really busy this week, and haven't been able to discover much interesting about either PHP or CFML or anything, hence being quite quiet. I'll admit this is very much a filler article, and a bit of a cheeky nod to something Andy said the other day:



Earlier I asked for people's opinions regarding TDD vs private methods: "The received wisdom of TDD and private methods".

I didn't get much feedback [scowl], but thanks to Dom and Gerry (there's a cat 'n' mouse joke in there somewhere) for offering up some thoughts.

I needed to provide a workflow for the team, and I thought I'd stick it up here as well, as a bit of closure on the previous article. And to give Andy a picture to look at.

What do you think of this approach (other than "unreadable at that size". Click here):


Forget the first two steps "Assign Ticket", etc, as that's just our Jira workflow and a bit of context for our peeps, but the rest of it after that. Also the associated process of how to maintain private methods whilst still adhering to TDD.

I think there's a reasonable mix of pragmatism and dogmatism in that?

Thoughts?

--
Adam

Tuesday, 7 October 2014

The received wisdom of TDD and private methods

G'day:
As you might know, I've recently taken on a different role as a PHP developer. My employer are shifting our code base from CFML to PHP for various reasons ("So long, and thanks for all the CF"). One facet of this is we're moving off a venerable, well-established CFML code base to a new code base in the infancy of its existence (some work on it had been done before we picked up the project). In a different language.

And we've got from having about 4000 unit tests to zero.



A coupla of us are having a quick exploratory look at PHPUnit to see what it can do, and whether there's any "gotchas" we need to be aware of when testing in PHP. So far the findings seem to be that unit testing in CFML via MXUnit and TestBox - especially in conjunction with MockBox - is a bit easier than the hoops we need to jump through in PHP to achieve the same ends. This is mostly down to CFML's objects being far more dynamic than PHP's, so injecting testing helper methods and exposing non-public methods for testing is much easier.

The challenges that PHP has thrown at us has caused us to revisit our TDD and unit testing strategy. Not necessarily to revise it, but to revisit it and see if it does need revision.

Our existing policy is that all code is written via a TDD & "Clean Code" approach:
  1. the need for a piece of functionality is identified;
  2. a failing test is written to test a facet of the functionality;
  3. code is written to pass the test;
  4. repeat from 2 until the functionality is complete;
  5. refactor if necessary.

This is applied both to new functionality as well as maintenance of existing functionality. The TDD side of things drives the code design, and also demonstrates that downstream changes don't have adverse effects on earlier requirements. The usual sort of thing.

On new work, this will mean creating a new public method (and the class it needs to go in, as required), and implementing the requirement. So all the tests are on that public method. When we refactor the code, those tests all still work, which is fine.

As a result of the refactoring we might end up with some of the code moving out into public methods of other classes, or - as often - private methods of the same class.

The newly refactored public methods go through the same TDD approach as the initial one, although this is quite often just a re-homing of the tests which were previously testing the unfactored functionality from the original public method. And the original public method's tests are selectively updated to remove any tests which are now the domain of the new methods, and mocks are used in lieu of calling these factored-out methods in the remaining tests of the original function.

And traditionally we have done exactly the same thing with the refactoring that was simply moved into private methods.

Perhaps I can demonstrate this with some pseudocode. At the end of our first TDD round, and before refactoring, we have this:

Sunday, 5 October 2014

PHP: include paths... it gets worse...

G'day:
This follows on from my article from an hour or so ago "PHP: include paths are relative to the current working directory". The situation there was daft but at least had a precedent in other languages.

But this? This beggar's belief.

PHP: include paths are relative to the current working directory

G'day:
This one had me confused for a day or so last week. It seems the relative paths in include / require calls in PHP are relative to the current working directory, not the file the include statement is actually in. I'm not sure I agree with this.

Friday, 3 October 2014

Good work, CFML community

G'day:
A few days ago I knocked out a quick article about the Bitnami contest that Railo is a participant in: "Ballot stuffing: vote for Railo".

At the time Railo was on the first page of participants, but well down the list.

But the CFML community has really stepped up here I think, because as I type this, Railo is now in the lead (425 votes; second place 423). I dunno when the contest ends, and the margin is still really tight so if you want to support CFML and encourage getting the word about it out there more, go and vote.

Update:


Blimey, whilst I was writing this, Railo's vote went up to 461!

And good work everyone who did vote, and who did circulate the word.

--
Adam

Comments in code: avoid if possible

G'day:
This came up in a code review yesterday... I thought I had already written about it, but cannae find the article anywhere so perhaps I imagined it. On the other hand I apologise if I have already written about this and it's a repeat. Point it out to me if so.

So, anyway, my contention today is that comments in code are grossly over-utilised, and in general one should avoid them. The code I was looking at yesterday had a case of stating the obvious. This is not the actual code, but an analogous example:

Wednesday, 1 October 2014

Nano-optimsation of looping code. Fascinating but pointless

G'day:
It's PHP, Railo and ColdFusion today. A few days ago I was researching my "PHP: looking at some interesting "unexpected" behaviour with references" article which related to a StackOverflow question: "Assign by reference bug". One statement in one of the answers fascinated me:
(using reverse looping mostly because not enough people remember that's a thing you can do, and is more efficient than a forward loop =)
Interesting. And sounded like something I could get my teeth into and have a look at.

Tuesday, 30 September 2014

Ballot stuffing: vote for Railo

G'day:
No, I'm really not advocating ballot-stuffing. However someone's creating a poll to get Railo added to Bitnami's stack. This would improve Railo and CFML's market penetration, so it has to be a good thing. And the sort of thing the vendor's themselves ought to be promoting.

Even if you're not a Railo user or advocate, and are staunchly a ColdFusion fanboi (you know who you are), this must be good for CFML.

Go vote. Here: https://bitnami.com/stack/railo.

--
Adam

Sunday, 28 September 2014

PHP: looking at some interesting "unexpected" behaviour with references

G'day:
A week or so ago I was fascinated by this Stack Overflow question: "How to changing value in $array2 without referring $array1?". It offers this code:

// baseline.php

$array1 = array(1,20);
$x = &$array1[1];
$array2 = $array1;
$array2[1] = 22;
print_r($array1[1]); // Output is 22

And this result:

22

In PHP, as the = operator makes a copy of the variable being assigned, so one (and when I say "one", I mean "the person asking the question, and myself as well") might be surprised to see the answer is "22", rather expecting it to be "20". Surely $array1[1] is discrete from $array2[1], and $array1[1] should not be impacted by the change to $array2[1]. $x is not a macguffin in this: remove that line, and things behave "as expected". How is making $x - a reference to $array1[1] - somehow intertwined with $array2??

Saturday, 27 September 2014

PHP: significant oversight in the implementation of array_reduce() (and I find the PHP bugbase...)

G'day:
I was fishing around in Stack Overflow this morning for a quick PHP exercise to do before getting out of bed (there's some imagery for you), seeking coffee, and getting on with the day.

I found this one: "Explode my Array, remove dash from key, then Implode it back together". It already had an accepted answer which involved just a coupla foreach() loops, but I thought I could come up with something more descriptive using array_reduce(). And I thought I'd post it anyway as an alternative approach.

However I ran into a problem.

Friday, 26 September 2014

Looking at PHP's OOP from a CFMLer's perspective: object serialisation

G'day:
This continues my series which is thusfar:


The next section in the PHP OO docs is actually "Magic Methods" (oh please), but two of these are __sleep() and __wakeup(), and these relate to object serialisation, so I decided to have a look at how this works, and __sleep() and __wakeup() at the same time.

PHP: another generator example: primes

G'day:
Duncan has mused me again. He's reworking his Project Euler exercises that he'd previously done in CFML, and is now implementing in PHP. In yesterday's exercise he was looking at prime numbers: "Project Euler: problem 7 (PHP)". I thought there was scope for another exercise in using PHP generators in this for me (see previous: "PHP: generators").

Tuesday, 23 September 2014

Adobe: stop closing ColdFusion bugs you haven't dealt with

G'day:
I've had a frickin' gutsful of Adobe's amateurish and disrespectful approach to dealing with bugs in the bug tracker. I spotted yet another "closed, not enough time" issue today. One which hit me back in 2011. It was first raised in 2009. Five years ago. It first cropped up in CFMX7. It's not a complicated one, it's just that the seem to have a glitch in working with leap years, for some date calculations. "Bug 82249:(Watson Migration Closure)Datediff function does not calculate differences correctly".

This has gotta stop, Adobe.

I checked the bugbase to see how many issues had been closed with "not enough time".

349.

Dating back to 2005.

These are all bugs that have impacted paying clients sufficiently for them to bring them to Adobe's attention. And Adobe's reaction is to just go "oh well... [shrug]... [clicks the 'Close' button]".

This is unacceptable.

PHP: more boolean / null confusion (and perhaps not entirely on my part)

G'day:
I'm so very confused.

OK, there's a precedent contradicting my PHP "Null" gripe from the other day

G'day:
What would I do without my guardian angel Sean? ;-)

Over the weekend I wrote an article "PHP: a fractal of [etc]... yeah, I'm now getting where you're coming from", which I - in passing - derided PHP's choice of null being a boolean false.

Sunday, 21 September 2014

PHP: a fractal of [etc]... yeah, I'm now getting where you're coming from

G'day:
Null.

PHP: iterators

G'day:
I'm now at the pub (see "PHP: generators"), and have just started my third Guinness. I've not yet worked out what this does to my writing style, so that could be a good or a bad thing. [shrug]: it's my blog.

Anyway, In the article linked to above, I talked about generators, and in the process I mentioned PHP has the notion of iterators, but didn't really have a close look at what those are in the context of PHP. Obviously we all know what an iterator is, but I figured part of my learning process had better be to get a good handle on PHP's implementation.

Saturday, 20 September 2014

PHP: generators

G'day:
Duncan's my muse today. Like me, my mate Duncan has recently moved from our defunct CFML team to the PHP team. And like me, Dunc now needs to learn PHP. He's logging his progress as well, and if this sort of thing interests you (following our progress), then maybe keep an eye on what he's doing too.

Friday, 19 September 2014

Answering my first PHP question on Stack Overflow

G'day:
It's really quite interesting. With any CFML question someone might ask me, I am brimming with confidence (or bravado, perhaps), am self-assured, and have no problem either backing myself to be correct, or happy to say "dunno, but I'll find out". I've decided I had better start answering PHP questions on Stack Overflow, as answering questions is a really good way to learn stuff. Especially if one doesn't know the answer to start with.

I would actually love to see your Railo 5.x wishlist...

G'day:
That was a comment from Gert against the article "ColdFusion 12" article.

Fair enough.

I started writing my response as a comment, but whilst typing it my interest was piqued regarding one of my own thought processes. It would just never occur to me to write an article about a wishlist for Railo. And I don't know why. I prefer the product to ColdFusion (which is easy: it's just better, as are the company & personnel behind it), but this sort of article doesn't seem necessary to me, in a Railo context. I suppose it's because getting Adobe to do anything sensible with CFML is a hard-fought battle, and left to their own devices they either mess shit up, or come up with stuff like <cfclient>. So they need strong direction / coercion from the community. Conversely with Railo, they already have a better idea of what a CFML developer needs, and often come up with the goods before it occurs to anyone to ask for it. Or if one does make a good case on either the Google Group or Jira, they just crack on with it and do it.

So it's not neglect of Railo that doesn't have me writing "My Wishlist for Railo 5.x" etc. It's just never been necessary.

Equally in the back of my mind I know the Railo guys will take on board anything anyone suggests for ColdFusion, and either implement it first, or go "nah, not a good fit for Railo". So I suppose my article would better be titled "CFML-next Wishlist".

Still, Gert asked, so Gert gets. Here's what I said in the comment, before promoting it to being an article:

Thursday, 18 September 2014

Rendering a GitHub file in this blog

G'day:
A few days back I released that CFScript documentation effort, which at the time was just done inline as a blog article. I had not decided how best to home it so it could be found. I thought about putting it on GitHub, but in my experience Google is lousy at finding stuff on GitHub. As unimportant as the adamcameron.me domain is in the bigger scheme of things, I seem to rank quite well when it comes to CFML topics (ed: that CFScript page bloody doesn't, mate), so I figured putting it here would be a good first step.

CFScript docs now on GitHub

G'day:
That CFScript documentation thing I released the other day ("Documentation for CFScript") is now on Github @ "CFScript documentation".

Currently it's a duplicate of the stuff on the blog article, but the GitHub one will be treated as the master copy from now on. I am in the process of simply embedding that back into the original article so that the article is always current. I should have that done in the next day or so.

Wednesday, 17 September 2014

PHP: references

G'day:
Yeah, it's been a busy day today. But I'm quite pleased with the PHP stuff I've learned. This is another quick one (OK, I'll stipulate now: a lot of these PHP ones will be short, so I'll stop saying that), and harkens back to something I talked about re CFML back in 2012: "Complex data-types in CF, and how they're not copied by reference".

PHP has a concrete and code-controllable notion of references; not just something that happens under the hood like in CFML.

PHP equivalence: onMissingMethod()

G'day:
Whilst looking at overloading in PHP before ("Looking at PHP's OOP from a CFMLer's perspective: overloading (which is not what you'd assume it is)"), I thought I might need to write an equivalent on onMissingMethod(), to catch instances of me calling... methods which I expected not to exist. I didn't need to because PHP works differently form how I expected it to, but it piqued my interest so I've just looked up how this is done. It's easy.

PHP equivalence: getFunctionCalledName()

G'day:
I touched on this in the last article: "Looking at PHP's OOP from a CFMLer's perspective: overloading (which is not what you'd assume it is)". PHP has a magic constant __FUNCTION__ which returns the name of the function being called. I claimed it's kinda like getFunctionCalledName() in CFML. But not quite. Let's have a look.

(This will be a pretty short article, I think).

Looking at PHP's OOP from a CFMLer's perspective: overloading (which is not what you'd assume it is)

G'day:
This is the fifth part of a series. The first four parts are here:
Today I'm looking quickly at a PHP concept called "overloading". Which has nothing to do with the usual OO concept of "overloading", either in the sense of same-named methods with different signatures, or operator overloading. In fact I seriously dunno why they called this construct overloading at all.

Tuesday, 16 September 2014

Documentation for CFScript

G'day:
I am going to attempt to document all of CFScript, as a resource for people migrating from old-school tag-based code to script-based code. The reason I am doing this is because neither ColdFusion nor Railo provide much (or in the case of Railo: any) useful documentation of CFScript.

This is not a document for converting tags to script. It is not written from a point of view of "if you use <cfsometag> then you need to instead use [some script construct]". It simply documents CFScript. It does - however - set out how to perform all CFML functionality using CFScript. It is also not an exercise in teaching CFML (or at least the script part). It assumes you know what you're doing, and is purely a reference. I am contemplating another article / series of articles which teach CFML correctly (the various resources that exist to do this all take the wrong approach, and are a barrier to CFML uptake, IMO). [ed: obviously that plan has been permanently shelved now].

Also there won't be a great narrative structure to this article. It's just a loosely-structured series of sections covering coding topics.

I assume Railo 4.2 or ColdFusion 11, except where stated.

Update:

I have ported this stuff to GitHub. See "CFScript docs now on GitHub". The version below is a mirror of that. Given it's on GitHub, if you see any problems or want to augment these docs: DIY, and send me a pull request. Cheers.

CFML: weirdness with properties

G'day:
Sigh... didn't take long for me to be writing CFML again. My excuse is this started out being comparison code for a PHP article, but I've run into some issues.

Monday, 15 September 2014

Come on Adobe: bring Anit to CFSummit

G'day:
OK ColdFusion community: time to voice your will again.

Brad started this conversation off:

And the notion needs support: currently Anit is not attending CFSummit, and that's not really on.

Looking at PHP's OOP from a CFMLer's perspective: namespaces

G'day:
This is the fourth part of a series. The first three parts are here:
Today I'm looking quickly at namespaces.

Friday, 12 September 2014

RSS URLs

G'day:
A couple of the RSS URLs for this thing have changed. The correct ones are in the box to the right, and as follows:


I think the default one has stayed the same, but the "last ten" ones have changed, due to domain name change.

--
Adam

Sally Field

G'day:
After y/day's article "So long, and thanks for all the CF", a lot of people have been saying a lot of very flattering things. I've decided I'd sound even more like a wanker than usual if I thanked everyone individually, so I'll just say "hey, thanks for the kind words" once, now. That was it just there.

I'm also fascinated no-one has (yet) said "good riddance" or some such. I figured I'd get a bit of that. Perhaps ppl are keeping their thoughts to themselves.

A couple of updates.

I tried to switch off the @cfmlNotifier feed, but for some reason it's still broadcasting?! This is really odd because generally speaking I need to restart it every day anyhow. Weird. On that: someone's picked up the reins on that project, has grabbed my code and is trying to work out what drugs I was on when I wrote it as we speak. They hope to have it up and running shortly (they mentioned 24h, but no pressure ;-).

In one of my blog comments someone indicated I seemed to be not only leaving the community, but also slamming doors behind me: what with the renaming of the blog, the new subdomain (just "blog" rather than "blog"), unsubscribing from mailing lists etc. I can assure you I leave the community with no sense of malice at all. The simple fact is I have been focusing on CFML because I have been paid to... now I'm not being paid to: I'm not going to focus on it. My after-hours hobby is computer programming, not necessarily computer programming in CFML. I take what I do seriously, and I believe any dev who is to be taken seriously ought to be doing dev in their spare time as well as 9-5. Accordingly when I take my job as a CFML developer seriously, I look under rocks, open the cans (of worms), and stir the pot. But I simply won't be doing that with CFML any more, because I won't be using CFML any more. After I get up to speed with PHP, I'll probably do it to PHP instead. As you might have already noticed ("PHP: how does PHP deal with same-named form values? [shudder]", "PHP's error "handling". Oh dear"), I've already been calling it into question.

The "rebrand" is just - as Dom said in his response to that comment - just tech-neutralising it all, and being more representative of the content, going forward. I'm not really going to be writing about CFML any more (there's one more article in the pipeline), so it would be stupid for this thing to stick with its association to CFML. It's not like I'm unpersoning all the articles, and changing the historic "CFML" references to "PHP" or anything!

Also bear in mind I have already rebranded once. This used to be "Adam Cameron's ColdFusion Blog", but the more I started working with Railo, the less it seemed sensible to describe it as a ColdFusion blog, so changed it to "CFML".

Thursday, 11 September 2014

So long, and thanks for all the CF

G'day:
The rumours I've been seeding recently have turned out to be true. Today I got confirmation that I am leaving the CFML community and joining the PHP one.

CFScript 2.0 follow-up

G'day:
A few days ago I put up this article: "CFScript 2.0?". At that juncture I was just soliciting input from the community. It's worth reading the comments if you're not up to speed with them. Especially from a Railo perspective as Micha, the chief engineer, offers his thoughts. It's a pity we don't get similar input from Rupesh on this, from a ColdFusion perspective.

I think it's been favourable enough to warrant enhancement requests to the vendors, which I have now raised: RAILO-3199; ColdFusion: 3822362.

Go have a vote (one way or the other! Even if you disagree, your input is valuable), and put your oar in and let your vendors know what you want them to do.

Cheers.

--
Adam

Wednesday, 10 September 2014

Update regarding irritation: cheers Rakshith

G'day:
Y/day I got all ranty with this: "Please indicate your irritation @ the ColdFusion Team".

A bunch of people joined in the irritation (that sounds vaguely NSFW, I know), and fortunately Adobe have fed back:


Adam made a good follow-up point, and Rakshith responded positively to that too:


This is all positive. I thanked him on Twitter, but I just wanted to say thanks here too.

Good man, Rakshith: thanks.

--
Adam