Well, I submitted by PR for adding CFScript to Rouge, so we’ll see how that turns out. I only worked on CFScript - I don’t have much use for tag highlighting, at present, and that kept the scope of the project more manageable. I was pretty happy with the result, though it did take more time than I had anticipated. CFML certainly has its quirks, and I even stumbled across a few operators that I was unaware of.
This wasn’t supposed to be long post - just a quick write-up on a helpful function that I stumbled upon. It never ceases to amaze me when I encounter an aspect of ColdFusion (function, feature, tool, etc) that’s new to me, but has been around for years. This time, the function is
callStackGet(), which was apparently introduced in ColdFusion 10, but I had never encountered before.
We recently had the need to validate rich text input in one of our applications. In the past we’ve rolled our own validation, using various regex strings. While this worked, we’re always looking for better ways to solve problems, which is why I was intrigued to find the isSafeHTML and getSafeHTML functions. These were added in ColdFusion 11, but I had not heard of them. While we ultimately didn’t end up using them, that’s how I fell down this particular rabbit hole.
When I started blogging with Jekyll, one of the projects that interested me was working on a CFML lexer for Rouge. It’s been a while since I’ve written a post, so it seemed like a good time to just dive in, get my hands dirty, and see what happened. All I’m doing in this post is getting Rouge set up, so that I can start tinkering with it.
There are two small projects I’ve been working on: salesforceiqcfc and screenshotlayercfc. They are basic, CFML API wrappers for the SalesforceIQ and Screenshotlayer.com APIs, respectively. Their benefit to me is twofold: 1) I can use the actual functionality of the APIs in my applications, and 2), the exercise of writing the wrappers got me to think about APIs, my code, and open source code in a much more engaged way.
We recently encountered a memory leak that I suspected was the result of poor var scoping, but I couldn’t locate the offending code. In the past, I’ve used varscoper (sometimes in conjunction with CodeChecker) to locate this type of error. Both have worked, and are very good tools, but I never worked out a system for making them easy to integrate in my day-to-day development. I had seen the CFLint project, but the need to download jars and use Maven was a bit intimidating - until I actually gave it a shot.
One of the most common application requirements is outputting an arbitrary amount of data in organized rows and columns. It used to be done with tables, now it’s done with Bootstrap; it looks better, but the principle is the same: output items until the row is full, then start a new one - and make sure you close all the tags that you open, in the correct order.
We recently upgraded to ColdFusion 11 (I know, less than ideal timing). The process was relatively smooth because we ran ColdFusion 10 and 11 side-by-side before completing the upgrade. I don’t think we took this approach when moving from ColdFusion 9 to 10, but it’s actually fairly easy to do. We only ran into one complication - an IIS configuration issue - that had a simple solution, and also helped deepen my understanding of how the application server interacts with IIS.
I wrote procedural CFML for a long time. Even though I’ve moved on to using FW/1, I’m still trying to develop the habit of “thinking MVC”. Every once in a while I have an “ah ha” moment, where I realize that I’ve been thinking procedurally, and there’s a better way to structure my code. This is a small instance of my gradual shift from a procedural to MVC mindset.
One of the most regularly occuring frustrations in development is spending time working through what seems like a complex problem, only to discover, in the end, that it was caused by something embarrassingly simple. For better or worse, sometimes that’s just the way it is - the answer isn’t obvious until you’ve reached it the long way around, especially early in the process of learning something new. That’s what happened to me here, so this post likely won’t be very instructive; just another log of me taking the long way around to reach a simple answer.