Pluralizing in ColdFusion

A few (ok, ten) years ago, I needed to generically pluralize English words in ColdFusion. Also, I wanted to be able to reverse that out ("singularize" as it were). This should be a really easy problem: If it ends with an "s" then add "es"; If it ends with a "y" then ditch the "y"; Otherwise just add "s". It turns out, though, that English is delightfully complicated.

So, Pluralizer.

I created it ten years ago, and I've used a fair number of times since. It isn't complicated enough that I've needed to update it much in that time.


Easy Caching in ColdFusion with MRECache

I avoided dealing seriously with caching for more of my programming career than I like to admit. Perhaps the old saw that "There are only two hard things in Computer Science: cache invalidation and naming things." (Phil Karlton) held me back.

Beyond that, though, I think I always had a sense that I didn't like the approaches that I found.

A few years ago, however, one of my clients started looking ahead to a major increase in traffic along with an increase in complexity. So, I needed to look into caching.


Implementing the Observer pattern in ColdFusion with Observer.cfc

Often I want to respond to events in a component, but I don't want it to need to know anything about the component that is taking action on it. This is often when I am using a generic component on my site.

The Observer pattern is perfect for this.

I didn't find an existing Observer implementation in ColdFusion that I loved and I wanted to try my hand at it, so I created Observer.cfc.


Beany.cfc: Part 2

I wrote earlier about my Beany component for handling Beans (especially immutable ones) easily. I thought this time I'd just cover a few extra little features that I've added to it to make it a bit easier to use.



Despite not being a big fan of Beans generally, I do find that there are situations in which they are useful. One of those is as configuration objects to pass in to a component. I can add the data in one packaged set.

In reading about Clojure recently, one of the big advantages of Clojure is immutable variables. I wouldn't want immutable variables in ColdFusion all of the time, but it would be really nice sometimes.


Git Branching Strategy for Web Development

There is no doubt at this point that Git is a successful version control system. GitHub is, so far as I can tell, the most popular place to host open source code. There are several popular software programs for managing Git and two very popular Git branching strategies.

Each of the two most popular branching strategies that have I seen does a great job of solving the problem for which it was created. GitHub Flow is great for open source projects. The basic idea is that work is done via cloning and merge requests.


Better Exception Handling in ColdFusion

We have been using basically the same exception handling strategy for several years. It has worked pretty well in all of that time, but we recently decided to switch it up. Our previous exception handling system (the one that we have been using for years) made sure not to display valuable information to users, but did send us an email with the pertinent information.

This made for a system that was reasonably secure (in that it didn't share any sensitive data on screen), but still allowed for us to quickly find out about any problems so that we could take care of them.


Changing SVG Colors with ColdFusion

I love SVG. I remember when I first heard about it (in 2002) and I just loved the idea. Images made of text! I remember being excited about generating images with dynamic data from my server-side code. I didn't have a problem that I could solve with it yet, but that didn't stop me from immediately buying two books on SVG ("Teach Yourself SVG" and "Designing SVG Web Graphics").


Easy Media Server

I have had my media server running for a few months now, so I thought I would document how I have it set up in case anyone else wanted to follow along.

The What and The Why

I have read several articles on media servers and most of them do a lousy job explaining what one is. Instead of trying to define a media server (and almost certainly failing badly), I will describe some of how I use mine.

Before I get to the fancy uses, let me start with the most basic. For anyone who remember VCRs, you will remember how you could stop your movie in the middle and take the tape to another player and start playing from where you left off. With a DVD, you can continue where you left off but only from the same player. With movies on my media server, I can play them on any television in the house (or even an iPad) and start where I left off from any one of them to any other of them - whether I am still at home or not.

My media server allows me to have one place for all of my movies and television shows that I have on DVD, all of my music, all of my photos, all of my audio books, all of my home videos. I can then access any of these from any television in my house, any computer, any of my Android devices, my iPad, my iPhone (yes, we actually use all of those). I can access any of this data on my mobile devices (tablets and phones) whether I am in the house or not. I can either use WiFi or mobile data to access them or I can download any media to any device (with minimal effort) before I travel and watch it without data usage.

This means that when we travel, we can watch a DVD movie on our iPad from our hotel even if we don't have internet there (so long as we thought to download it before we left) or any movie we have anywhere we do have internet. With two five year old kids, this has proven to be wonderful. We can pull up a movie in the car if we need to (we generally don't, but there have been times that it has been comforting that we could).

We can even share any of this media that we choose with anyone we want who has a (free) Plex account and a way to view Plex, whether or not that have a media server themselves (this serves as a Spoiler as to what software we use for our media server).


Tracking Down a Performance Problem

The Problem

The answer always seems obvious once you find it. One of our clients had one of their server start going down nearly every day. It quickly escalated to happening about twice a day.

The Process

We looked at recent commits for anything that could have caused a problem and found nothing. We verified that the code on the server that went down matched the code on the other servers in the cluster and that all of the server settings were the same. When we took down the offending server, another server started going down instead. At that point, we knew we were likely facing a code problem.

The site in question is one we inherited from the previous vendor, so we had no instinctive sense about where the problem might be. Fortunately, we have a good process for tracking down these sorts of problems.


More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.