Saturday, 29 November 2014

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

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)

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

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.



Weekend code puzzle: my answer (Python version)

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)

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

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

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

I'm just going to regurgitate the intro paragraph to the survey ( 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

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

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

Can you spot what's wrong with it?

Weekend code puzzle: ChrisG's answer (CFML)

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?

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)

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)

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?

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


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

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

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

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

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.


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

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

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

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

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.