Sign Up For adCenter - Get $50 In Free* Clicks.

Web News

Germany to Ban Online Gambling Jan. 1 Under Accord...
Online gambling will be banned in Germany as of Jan. 1 after German states ratified an accord that preserves the country's state monopoly for lotteries and most forms of betting. At least 13 of Germany's 16 states have...

Vehicle stickers obligatory for green zones in Germany
Cars will require special stickers to enter inner- city areas when Germany's first environmental green zones come into force in Berlin, Cologne and Hanover on January 1. Only vehicles that meet specific exhaust emission...

DG e-store sees 2m hits in one week after launch
German record label Deutsche Grammophon (DG) has announced that its online music store, DG Web Shop, saw two million page impressions during the site's first week of operations. DG, a division of Universal Music...


12.27.07


Getting A List Of Application Names In
ColdFusion


By Raymond Camden

Andy asks:

Is there a way to get a list of application names from all of the Application.cfc running on a server. I'm trying to dynamically build a server.applicationNameArray by just dropping a web app into the web tree. Thanks for your time.

Technically the answer to this is no, but there are two ways of doing this. The first way is to use the SeverMonitor API. There isn't a 'get a list of application names', but there is a method named getAllApplicationScopesMemoryUsed. This method returns the memory used by all application scopes on your server. The keys of the structure are your application names. Here is an example:

<cfset password = "poorspearsfamily">
<cfinvoke component="CFIDE.adminapi.administrator" method="login" adminpassword="#password#" returnVariable="result">

<cfinvoke component="CFIDE.adminapi.servermonitoring" method="getAllApplicationScopesMemoryUsed" returnVariable="ascopes">
<cfdump var="#ascopes#">


Sign Up For adCenter - Get $50 In Free* Clicks.

By the way, check out the memory usage for the model-glue app:

The Model-Glue app is the one in red. Model-Glue is so good it gives your server RAM. Yeah, that's it.

So the second solution is a bit of an hack, but has been around for a while. If you define an application w/o a name, the Application scope for that unnamed application will contain a bunch of junk, including a pointer to all the applications on your server. Consider this code:

<cfapplication>
<cfloop item="k" collection="#application#">
   <cfif isStruct(application[k]) and structKeyExists(application[k], "applicationname")>
    <cfdump var="#application[k]#" label="#k#">
   </cfif>
</cfloop>


This will dump each Application and all it's variables. Note the CFIF and how I check to see if the variable is an application scope. Not perfect, but in my test with both code blocks, it returned the same thing. (Well, the second code block didn't show the blank key for the unnamed application scope like the first one did.)

Comments


About the Author:
Raymond Camden, ray@camdenfamily.com and ray.camdenfamily.com. Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy.

About DevWebProDE
DevWebProDE is for professional developers ... those who build and manage applications and sophisticated websites. DevWebProDE delivers via news and expert advice New Strategies In Development.

DevWebProDE is brought to you by:

SecurityConfig.comNetworkingFiles.com
NetworkNewz.comWebProASP.com
DatabaseProNews.comSQLProNews.com
ITcertificationNews.comSysAdminNews.com
LinuxProNews.comWirelessProNews.com
CProgrammingTrends.comNetworkNewz.com



-- DevWebProDE is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
 © 2007 iEntry Inc.  All Rights Reserved  Privacy Policy Legal    

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


New Strategies In Development DevWebProDE News Archives About Us Feedback DevWebProDE Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact