Thursday 20 September 2012


So I'm back at work after a week off, and needed to drag myself out of bed a coupla hours earlier than I had become used to, and it's bloody cold today.  So my default setting today is "pissed-off" (so: same as usual, for all intents and purposes).

Last night I was enjoying a snippy "conversation" (if that's the right term) on Twitter between a coupla people lamenting the poor quality of some of the posts of the Adobe forums (I don't know how to link to something on Twitter, so - if interested - you'll just have to look at my Twitter back log and find it that way).  With that still in the back of my mind I popped over to StackOverflow this morning to see if there were any questions I could answer.

I came across this one.  Hence the title of this blog post.

Now I imagine no-one that has sufficient... um... "presence of mind" (not quite the right term) to be trolling through ColdFusion blogs and accordingly reading this needs reminding about this, but - for goodness sake - if you find yourself not knowing something (which happens to everyone all the time), try to work the answer out for yourself!

The good thing about programming and IT in general is that everyone's a geek and everyone likes wearing their geekiness on their sleeves, so if they ever achieve anything noteworthy or otherwise... they spread the word.  So if ever anyone has solved a puzzle... the solution will be online somewhere.  If every someone's found a glitch and worked around it: it's online somewhere.  And it's reasonable to say that almost everything one might undertake has been undertaken by someone else already, and they've probably documented it somewhere.

Speaking of documentation: I don't know of any programming language that isn't documented and freely accessible online.  I might lament the quality of Adobe's docs sometimes, but at least they're there, and I'm only griping about the last 20% of any documentation effort they've done: for 80% of anyone's requirements, it's fine and it's there online.  PHP (which this StackOverflow question was about) is the same.  Indeed this is a rare instance in which PHP does something better than CF: their docs are pretty good.

And when it comes to wading through this morass of docs, Google's already done it for you.  If you have a question, just type the blimin' question into Google.  Just type it verbatim.  They have really taken most of the rocket-science away from the task of finding stuff.

Lastly, it boggles my mind how many people would prefer to use someone else's brain to do their work for them, than put a bit of effort in themselves.  The best way to improve one's ability in something is to work through the problems yerself.  If you just ask someone else to do it for you you'll not learn anything.  There's that "give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime" addage which is very accurate.  However the adjunct to that is that you get a lot better at catching fish if you actually make a point of going fishing, and honing yer fishing skills.

Right.  That was cathartic.  Time for work.

I came across another thing today that fits into this sort of rant.  Earlier in the week I read an interesting question someone asked on Twitter about how to detect whether one was in the middle of a <cftransaction> block.  I didn't know the answer to this but figured:
  1. I probably ought to know
  2. it was an interesting question, so I wanted to find out the answer.
I spent most of the afternoon stalking around various bits and pieces of CF trying to work out how to do it, and drawing a blank.  And getting cross with myself.  After a few hours (really: it was say 2-3h I was looking at this), I decided "screw this... google...".  And within a few minutes I had found a solution to it that someone else had already implemented. The lesson I re-learned here is a variation on the above: don't reinvent the wheel. Always check if someone else has done it first.  Even if they haven't, you'll probably find someone else who has tried, and you can discount the avenues they took; or you'll find someone who's done something similar, and might point you in the right direction, or prompt that flash of inspiration to get you on your way.  And to this end, I'd like to thank Bilal for blogging that solution, and I've now pared it back a bit and have added a UDF to isInTransaction().

That's enough of that.  I'll try to come up with something relating to ColdFusion or CFML tomorrow!