dans.blog


The miscellaneous ramblings and thoughts of Dan G. Switzer, II

Viewing active "sessions" in ColdFusion

Ever need a snippet to read in the active sessions running on your server? This code was recently posted to the CF-Talk list and I thought it was worth blogging for future reference. (Thanks to Raymond Camden and Dave Carabetta for the information.)

function getSessions(appName) {
    var tracker = createObject("java", "coldfusion.runtime.SessionTracker");
    return tracker.getSessionCollection(appName);
}

variables.numSessions = 0;
variables.sessions = getSessions(application.applicationName);
variables.numSessions = structCount(variables.sessions);

<cfoutput>Total Number of Sessions: #variables.numSessions#</cfoutput>
NOTE:
This code relies on using internal undocumented ColdFusion factories. This means the code could potentially stop working if Adobe ever changes the internal factories.

more…


Retrieving the wdith/height of a SWF file from ColdFusion

Doug Hughes has been kind enough to share the code he wrote to get the dimensions of a Flash (swf) file using ColdFusion. This could prove to be very handy to anyone running a CF-based CMS or if you're serving up random Flash files.