CFCamp 2023 – “Extras”

One of the things I’ve always loved about conferences is hearing about things that might not be “new” but you just haven’t come across before, so I thought I would list them here for my future benefit and for the benefit of anyone else who happens to come across them.

Lucee Start-Up Listeners

Lucee has start-up listeners for both the server and web contexts, in server.cfc and web.cfc that you the server and web context directories respectively. These allow you to perform actions when the server or web contexts start using the onServerStart and onWebStart methods respectively. Full details can be found in the Lucee doc’s here:

https://docs.lucee.org/guides/cookbooks/Startup_Listeners.html

<cfadmin> tag

Lucee has a tag called <cfadmin> (documented here: https://docs.lucee.org/guides/Various/cfadmin.html) that is used by the admin to perform tasks, like add/remove extensions, add/edit/remove data sources, etc… and can also be used in your own code. So, for example, if you wanted to uninstall some extensions on start-up, you could use the start-up listener above and then the <cfadmin> tag to remove the extension.

Lucee Scoping Performance Boost

There is a performance boost to be had with Lucee by setting the “Cascade” to “strict”, the search resultset option to “Off” and using local mode for functions. These all restrict the amount of “searching” Lucee has to do to find variables, however, depending on how your code is written this might result in issues/errors if you just change these settings. All three of these options can be found in the Lucee admin under the “Scope” section, so start by activating them on your development system first and fixing any issues caused by changing them.

Lucee Debugger

There is a debugger available for Lucee to debug your Lucee application. It requires a bit of setup, but once done will allow you to do normal debugger things like set breakpoints, watch variables, etc… so you can debug your code. There is a companion VSCode extension for it as well, so you can do the debugging from within VSCode.

Lucee Debugger code and setup instructions: https://github.com/softwareCobbler/luceedebug

Lucee Debugger VSCode Extension: https://marketplace.visualstudio.com/items?itemName=DavidRogers.luceedebug

Pre-warmed Commandbox Docker Containers

I feel like I should have spotted this on the Commandbox Docker page, as I’ve visited it many times, but there are “pre-warmed” Commandbox Docker containers for pretty much every release version of Lucee available. All you have to do is specify “engine” and “version” when requesting the container and it will come with that exact version pre-installed in the container, instead of downloading it on start-up. This means the start-up time for a new container will be quicker as it isn’t having to download and install Lucee as part of the start-up routine. If you head over to the Commandbox page on Docker Hub (https://hub.docker.com/r/ortussolutions/commandbox/) you will see them towards the bottom of the “Tags” list on that page and you can find the exact “tag” for the version you are looking for on the tags page.

SystemOutput()

Again, probably something I should have previously known about, but it’s just never come up and I’ve not been regularly trawling the docs to see if there is something useful there I’ve missed. The SystemOutput() function is akin to <cfdump> but instead of outputting to the browser, it outputs to the “output stream” (stdout) which is useful when using Lucee in something like Docker. More details can be found here:

https://docs.lucee.org/reference/functions/systemoutput.html

ContractPath()

Like the SystemOutput() function above, this function has been there for some time, but I’ve never looked for it. ContractPath() does the opposite to ExpandPath() taking a full path the reducing it to a relative path relating to the site’s webroot. More details can be found here:

https://docs.lucee.org/reference/functions/contractpath.html

GitHub Copilot

GitHub Copilot is something that I had not come across before but heard mentioned at CFCamp several times. It is an AI coding assistant for various coding tools like VSCode, JetBrains IDEs and so on. When coding it can offer inline context-based suggestions or you can write a comment and it can suggest the code you need to complete what the comment says. More information can be found at https://github.com/features/copilot and pricing starts at $10 per month and there is a 30 days free trial available as well.

Leave a Reply

Your email address will not be published. Required fields are marked *