Blog

Improving Lucee's QoQ Support Again- now 200% faster

Posted by Brad Wood
Dec 01, 2022 20:12:00 UTC

Two years ago, I published this post detailing how I had refactored the Query of Query support in Lucee to be much better and also much faster:

https://www.codersrevolution.com/blog/improving-lucees-query-of-query-support

I removed the single-threaded HSQLDB callback for grouped/aggregate and distinct selects and tuned the performance.  QoQ's are a bit of a polarizing feature in CFML.  They've suffered in the past from poor support and poor performance which has caused a lot of people to avoid them.  There are certainly places where queryMap(), queryFilter(), and queryReduce() are the best approach, but there are also times where you simply can't beat the readability and conciseness of an ordered,  aggregated select.  I know developers who tell me they never use "reduce" higher order functions because they are too confusing, but I've never met a developer who didn't understand "GROUP BY department"! 

I've got several other ideas to increase the feature set of QoQ in CFML including native support for INNER and OUTER joins as well as this idea of exposing CFML string, number, and date functions directly in QoQ.  I've also put in a handful of tickets for Adobe ColdFusion to invite them to follow in the improvements I've added to Lucee. I'd send them pulls, if I could : (

Detect if a User is Online with RabbitMQ Web Stomp

Posted by Brad Wood
Mar 13, 2021 00:41:00 UTC

We're using RabbitMQ and its Web Stomp plugin for websockets for several projects at work.  Using a Stomp.js library in the browser, our app users connect and subscribe to topics using their username and JWT, which we validate using a custom HTTP back end auth in Rabbit.  I've recently written a rest-over-stomp module for ColdBox MVC which allows you to push the response of any Coldbox event or API call out over a websocket channel to any browser listening on that channel.  This allows for the following

  • Browser can request data and receive it async
  • Any random server-side process can simply decide to push fresh data out to browser
  • Each user subscribes to a custom topic specific to them (via permissions enforced by my custom HTTP backend auth) so I have a direct data bus to any users's browser
  • Unlike Ajax calls, there is no HTTP/TCP negotiation of each request since the websocket is a persistent connection to the server

A quick comparison of using Python and CFML to write the same CLI tool

Posted by Brad Wood
Jan 27, 2021 07:47:00 UTC

A few days ago, Joseph Lamoree posted about a cool little command line tool he wrote in Python that would scan a list of servers check check for a public facing administrator.  

I thought this would be a great example to compare and contrast writing the same simple command line tool in CFML using a CommandBox task runner.  Here is what I came up with

Create your own Desktop "Toaster" Popups in CommandBox Servers

Posted by Brad Wood
Jan 21, 2021 00:16:00 UTC

Here's a quick one that I tried out for the first time today.  Someone asked if it was possible for a CF app to have a desktop notification on the server it's running.  CommandBox servers have a try icon that runs inside the JVM of the server that can create popups and even Swing windows.  Turns out, it's actually really easy to tap into this to get a toaster popup on your desktop.  

Improving Lucee's Query of Query Support

Posted by Brad Wood
Sep 12, 2020 01:29:00 UTC

One of the really great features of CFML is the ability to run SQL against a result set in memory.  This allows you to union separate results together or even apply additional filtering on an exiting result if you can't control what the DB gives you.  Like everything, there is a time and a place for this.  There are people who strongly dislike QoQ (query of queries) but my take is that I think they're great when used with relatively small data sets and unless performance profiling shows they are causing issues, I have no problems using them.  

Who's had more vulns, take 3: Java, ColdFusion, ROR, .NET

Posted by Brad Wood
Oct 09, 2019 01:36:00 UTC

There's a fair amount of disingenuity, or perhaps just willful ignorance to the statistics here and I talk to a lot of people who are astonished that CFML is still in use due to the alleged massive numbers of vulnerabilities.  One would think simply touching the code might give you rabies.  Some CFers suggested that it's a form of "virtue signalling" by infosec professionals to throw CF under the bus, winking at each other over there shared distaste for a platform they have little knowledge of but assume sucks.

A Quick Example Of Functional Programming (FP) In CFML

Posted by Brad Wood
Jun 30, 2019 01:23:00 UTC

I was adding a feature to CommandBox CLI this week when I typed up some code that iterated over the keys in a struct, filtering out the ones it needed and then performed an action on the matching ones.  I used the functional methods structFilter() and structEach() in CFML.  They are an example of functional programming as they accept functions as input.  This also means we can call them "higher order" functions.  But termininologo aside, I typed up the same code using an older interactive approach just to compare the too.  It was an interesting and rather self contained example so I thought I'd share it as a real life use case for FP (functional programming).

Connect To SQLite DB using CFML via CommandBox Task Runners

Posted by Brad Wood
Sep 27, 2018 05:10:00 UTC

Here's a quick trick on working with a SQLite DB from CFML quicky and easily.  I was playing with the SQLite DB that the original .NET version of GitHub for Desktop and I wanted to access the db file from the CLI to query data and manipulate it.  The steps where very easy  

The very first step was the easiest, and this was to create a blank CommandBox Task Runner:

task create --open

Using OSGI To Load A Conflicting Jar Into Lucee Server

Posted by Brad Wood
Sep 21, 2018 07:24:00 UTC

This post falls in the category of something that took me several hours to figure out and other people are not likely to figure it out on their own and I'm likely to forget it if I don't write it down!  The problem is if you have a jar file with some 3rd party library that you want to use in Lucee.  Often times this works great, but other times the dependencies of that library may conflict with other jars already loaded into the classpath for Lucee, its bundled libs, or the servlet container. 

Using Adobe cf_scripts in CommandBox behind IIS/Boncode

Posted by Brad Wood
Jul 11, 2018 06:34:00 UTC

This post falls in the category of something I hammered out for a client today and I thought to myself, "Wow, that's just obscure enough that no one would probably figure it out on their own."  As such, I figured I'd put it into a blog post for Google to index and for me to point people to in the future.

If you use any of the CF UI tags, CFChart, CFForm, or CFAjax functionality, then you need to have some web accessible JS, CSS, etc files for it to function.  In older versions of CF, this was under the /CFIDE folder which wasn't very cool since it made it harder to block access to that folder by default.  On the most recent versions of Adobe CF, you can hit it as /cf_scripts and the IIS connector has a built in handler that passes those requests through.  

Site Updates

Entries Search