Monday, 31 December 2012

Lists with empty-string delimiters

G'day:
Blimey; three articles today. Once again, this stems from a thread on the Railo Google Group, this time regarding a bug I found in Railo (or that I think is a bug), which resulted in some questioning whether it's a bug in Railo, a bug in ColdFusion, or a bug in both. And the more I look into it, the less sure I am about it.

And the situation I found the... erm... "anomalous  behaviour" (shall I say) was in the code I was writing for the previous two articles' investigation.

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

Thursday, 27 December 2012

More balance, fewer @rseholes

G'day:
There's been a bit of back-and-forth on Twitter (nothing of any merit, sadly) regarding my posting from the other day regarding some "shortcomings" in the attitude of some of the users on Stack Overflow, and also - given how said users behave - some potential areas for improvement in the Stack Overflow process.

I don't contest that the first part of the article was quite vitriol-laden, and that was by design. However later in the article I did try to discuss - in an objective, balanced way (? well, mostly) - where I think things could be improved.  However I think I did not succeed in the objectivity, or some people didn't get past the headline, or if they got that far, didn't read past the vitriol. I am guilty of doing this (to myself) in my writing sometimes.

Anyway, the article was put on the twitter radar of one of the blokes who started Stack Overflow (thanks Stephen Moretti for thinking to do that), and there was a brief exchange between myself and Jeff Atwood (the S/O bloke) and some others. I think Jeff was a bit defensive, but in his defence, I can see how he'd find my article incendiary. And equally my responses to him could have been more diplomatic. Well the ones I made just now, anyhow. I'll leave it to you - the reader - to dig it up in my Twitter history if you so choose. It's not very exciting.

So, here I am again. What I'm going to try to do in this article is to articulate my point differently:
  • no vitriol, snippiness, back-handedness or passive aggressiveness (this will be a stretch for me, as you can imagine ;-)
  • maintaining objectivity (OK, that's a variation on the above);
  • trying to convey my thoughts more clearly than I have previously.

The very first thing I'd like to say is I really like Stack Overflow! Jeff, if you only glance at this article before dismissing it, hopfully you'll see that bold red bit there.

Wednesday, 26 December 2012

Regular expressions in CFML (part 5: syntax - look-arounds, and how the engine parses the string it's matching)

G'day:
This is part five of the series I started with the introduction article: "Regular Expressions in ColdFusion (part 1: overview)", and followed with a discussion entitled "Regular expressions in ColdFusion (part 2: concepts)". Then I moved onto syntax with "Regular expressions in ColdFusion (part 3: syntax - single characters)" and "Regular expressions in ColdFusion (part 4: syntax - repetition, sub-expressions and back-references)".

Please note that this article - more so than the other ones - does not stand-alone. It's more a "part 2" of the preceding article. I advise reading at least that one before reading this one. But, really, one should read the whole lot in order. But bring food and water with you before starting.

Look-arounds

Another type of sub-expression is a look-around. Look-arounds do what the name suggests: they look around to see if there's a match (or there specifically isn't a match). They can look ahead from the current position in the string being processed, or they can look behind. So we have four different sorts of look-around:
  • positive look-ahead;
  • negative look-ahead;
  • positive look-behind;
  • negative look-behind.
ColdFusion's regex engine only supports look-aheads (both positive and negative ones).

Before I explain how these work, let's back up a bit and examine what goes on when a regular expression pattern matching exercise takes place on a given string.

Tuesday, 25 December 2012

Christmas Spirit, StackOverflow style (#2 in a list of why StackOverflow is populated by @rseholes)

G'day:
Is it the season for "Peace on Earth and goodwill to all men"? No, on StackOverflow it's more like "Screw you, newbie @rsehole: I have power over you, die die die" for some people. And, again, people like this demonstrate how the Stackoverflow approach to site self-management needs some thought.

NB:
If you read this article, also please make sure you read the follow-up to it as well.


A newbie ColdFusion user has posted a newbie-ish question over on Stackoverflow. Given the treatment they've received from non-ColdFusion users over there, I would not be surprised if it's their last.  Here's a summary of their question (by someone called "volume one"):