Category Archives: Algorithms

Summarizing large amounts of text

There are a few tricks that can be used to summarize a body of text into a paragraph. One of the simplest methods is to simply grab the first n characters from the text and use it as the summary. … more …

ColdFusion dynamic sitemap

I searched the web this morning in hopes that someone has already written a recursive sitemap generator in ColdFusion. It may be out there, but I gave up after browsing page 10 of the Google search for "ColdFusion sitemap". The … more …

Accept fractions in place of numeric input

If there's one thing your competitor probably isn't doing, when it comes to online tools, it's accepting fractions for numeric input. For instance, if you have a tool that calculates the square footage of a room, why not allow the … more …

Bulk inserts to reduce trips to database

By combining multiple inserts into one bulk insert statement, you can reduce the total number of statements sent to the database, speeding up combined execution of your script. The below example illustrates this concept using a ColdFusion code snippet. <cfquery … more …

Normalizing a string (PHP)

We'll present one algorithm below which demonstrates the use of a loop and the ord function to step through the characters in a string. In our case, we wish to normalize strings which are formatted as such: unitedStates, tomSmith, fordFocus … more …