Search Blog

Recent Comments
Re: Stats plugin ported to Model-Glue (by J.mihai at 12/14 8:52 AM)
Re: CFC DAO Generator (by rui at 7/04 5:42 AM)
Re: Updates to the DAO, Bean and Gateway generator (by rui at 7/04 4:49 AM)
Re: CFC DAO Generator (by fwscott at 6/22 7:03 PM)
Re: CFC DAO Generator (by dan at 6/22 12:38 PM)
Re: Trip to Thailand (by fwscott at 3/27 2:10 AM)
Re: CFC DAO Generator (by fwscott at 3/27 2:03 AM)
Re: CFC DAO Generator (by Garry Harstad at 3/26 12:30 PM)
Re: Trip to Thailand (by Niqui Merret at 3/23 4:51 PM)
Re: Adding a blogger ping utility to BlogCFM (by fwscott at 2/20 9:01 PM)
Categories
Annoucements (1 entries)
BlogCFM (3 entries)
CFC Generator (5 entries)
Coldfusion (11 entries)
Fusebox (2 entries)
Greasemonkey (1 entries)
Misc (3 entries)
Archives
November 2005 (2 entries)
October 2005 (1 entries)
August 2005 (1 entries)
July 2005 (4 entries)
June 2005 (5 entries)
May 2005 (7 entries)

Powered by
BlogCFM v1.01

July 2005
Stats plugin ported to Model-Glue
Ive been wanting to learn some about Model-Glue for a while now.  I figured I may as well convert the Fusebox plugin for stats so it will work with Model-Glue.  Model-Glue seemed like a good fit since all requests come in through one page, like Fusebox.

Doing this gave me a quick look at how controllers and config beans worked... mission accomplished.

You can download the "plugin" here.  Unzip the file and look at the readme for instructions on how to configure Model-Glue to use this.

Basically it creates parsed files named by the Event name, and one viewstate variable that you reference in your layout file.  The viewstate variable contains script to request three images from the server so the request gets logged in your stats program.

Using a method like this, you can exclude index.cfm from your pageviews report and you should see <EventName>.cfm requests.

One thing I couldnt figure out was.... is it possible to pass coldfusion variables from a BeanConfig.xml file?
Posted by fwscott at 7:06 PM | Comments (1)
July 2005
Fusebox Plugin for stats... take two already!
Sorry, I do this alot but I was thinking about ways to change the plugin on the way home from work...

Got to thinking that site paths still would not work or quite a few other things.  In order to be more flexible I changed things around to where it creates a parsed file and the invisible image will be served from the parsed file.

So when you look at your stats now, you will see that circuit.fuseaction.cfm was hit and then they went to anothercircuit.anotherfuseaction in your site paths.  Also doing this, your stats program does not have to support reports by query strings.

Here is the modified code, if anyone has a better way of checking/creating the parsed files... please let me know.

<cfsilent>
<!--- The full path to where the CFM files should be stored for stats --->
<cfset plugin.statsdir = "#application.fusebox.rootdirectory#fbstats\" />
<!--- The relative path to where the CFM files should be stored for stats --->
<cfset plugin.statsrelpath = "/fbstats/" />
<!--- The full path to the invisible image --->
<cfset plugin.fullimagepath = "#application.fusebox.rootdirectory#images\spacer.gif" />
<!--- Current fuseaction file to create, example: mycircuit.myfuseaction.cfm --->
<cfset plugin.currentfusefilename = myfusebox.originalcircuit & "." & myfusebox.originalfuseaction & ".cfm" />
<!--- The file to create to keep track of total client resolution, example: clientresolution.cfm --->
<cfset plugin.clientresolutionfilename = "clientresolution.cfm" />
<!--- The file to create to keep track of viewable browser client resolution, example: clientviewableres.cfm --->
<cfset plugin.clientviewableresolutionfilename = "clientviewableres.cfm" />

<!--- Create the output for the coldfusion image files
This should be just enough to serve the image.
Currently just inserting <cfcontent file="#plugin.fullimagepath#" type="image/gif"  deletefile="no" />
 --->
<cfset plugin.imageout = "">
<cfset plugin.imageout = plugin.imageout & '<cfcontent file="#plugin.fullimagepath#" type="image/gif"  deletefile="no" />' />

<!--- Check to see if our image serving files exist, if not create them with the code to serve
the blank image
--->
<cfif not(directoryexists(plugin.statsdir))>
    <cfdirectory action="create" directory="#plugin.statsdir#" />
</cfif>
<cfif not(fileexists(plugin.statsdir & plugin.currentfusefilename))>
    <cffile action="write" file="#plugin.statsdir & plugin.currentfusefilename#" output="#plugin.imageout#" />
</cfif>
<cfif not(fileexists(plugin.statsdir & plugin.clientviewableresolutionfilename))>
    <cffile action="write" file="#plugin.statsdir & plugin.clientviewableresolutionfilename#" output="#plugin.imageout#" />
</cfif>
<cfif not(fileexists(plugin.statsdir & plugin.clientresolutionfilename))>
    <cffile action="write" file="#plugin.statsdir & plugin.clientresolutionfilename#" output="#plugin.imageout#" />
</cfif>
<cfsavecontent variable="request.fbstats">
<script language="javascript" type="text/javascript">
<!--
var fbstatsscreenW = 640, fbstatsscreenH = 480;
if (parseInt(navigator.appVersion)>3) {
 fbstatsscreenW = screen.width;
 fbstatsscreenH = screen.height;
}
else if (navigator.appName == "Netscape"
    && parseInt(navigator.appVersion)==3
    && navigator.javaEnabled()
   )
{
 var fbstatsjToolkit = java.awt.Toolkit.getDefaultToolkit();
 var fbstatsjScreenSize = jToolkit.getScreenSize();
 fbstatsscreenW = fbstatsjScreenSize.width;
 fbstatsscreenH = fbstatsjScreenSize.height;
}

var fbstatsinnerwidth= 640, fbstatsinnerheight= 480; // defaults
if (self.innerHeight)
    // all except Explorer
    {
    fbstatsinnerwidth= self.innerWidth;
    fbstatsinnerheight= self.innerHeight;
    }

    else if (document.documentElement && document.documentElement.clientHeight)
    // Explorer 6 Strict Mode
    {
    fbstatsinnerwidth= document.documentElement.clientWidth;
    fbstatsinnerheight= document.documentElement.clientHeight;
    }

    else if (document.body)
    // other Explorers
    {
    fbstatsinnerwidth= document.body.clientWidth;
    fbstatsinnerheight= document.body.clientHeight;
    }

<cfoutput>
fbstatsclientviewableresimage = new Image(1,1);
fbstatsclientviewableresimage.src = "#plugin.statsrelpath##plugin.clientviewableresolutionfilename#?resolution=" + fbstatsinnerwidth + "x" + fbstatsinnerheight;
fbstatsclientresolutionimage = new Image(1,1);
fbstatsclientresolutionimage.src = "#plugin.statsrelpath##plugin.clientresolutionfilename#?resolution=" + fbstatsscreenW + "x" + fbstatsscreenH;
</cfoutput>
// -->
</script>
<cfoutput>
<img src="#plugin.statsrelpath##plugin.currentfusefilename#" height="1" width="1" border="0"  />
</cfoutput>
</cfsavecontent>
</cfsilent>

One thing to remember... If you use the application.cfm from the Fusebox downloads, you must allow the directory through the filter.

Something like:

application.cfm
<cfsilent>
<cfif right(cgi.script_name, Len("index.cfm")) NEQ "index.cfm" AND right(cgi.script_name, 3) NEQ "cfc" and  not (cgi.PATH_INFO contains "/fbstats")>
    <cflocation url="index.cfm" addtoken="no">
<cfelse>
</cfif>
</cfsilent>

Add it to your fusebox.xml.cfm. I have mine as a preFuseaction plugin, but should work in preProcess also.
           
<plugin name="fbstats" template="fbstats.cfm" />

Then just reference request.fbstats in your layout file.

You can download the zipped version here.
Posted by fwscott at 10:04 PM | Comments (0)
Fusebox plugin for log based stats programs
So I was reading on Pete Freitag's blog about the most common screen resolutions...

It got me interested in what my websites were being viewed at.  Come to find out my hosting provider's new stats engine does not support this natively.  I think quite a few Coldfusion people use HostMySite which recently dropped using Deep Metrixs and went to SmarterStats, so I hope this plugin will be useful to others.

First thing, the plugin could be integrated directly into the layout file but I decided to use a plugin instead.  I put this into the PreProcess stage. The javascript came from a few places on the internet.

<cfsavecontent variable="request.clientstats">
<script>
var screenW = 640, screenH = 480;
if (parseInt(navigator.appVersion)>3) {
 screenW = screen.width;
 screenH = screen.height;
}
else if (navigator.appName == "Netscape"
    && parseInt(navigator.appVersion)==3
    && navigator.javaEnabled()
   )
{
 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
 var jScreenSize = jToolkit.getScreenSize();
 screenW = jScreenSize.width;
 screenH = jScreenSize.height;
}

var innerwidth= 640, innerheight= 480; // defaults
if (self.innerHeight)
    // all except Explorer
    {
    innerwidth= self.innerWidth;
    innerheight= self.innerHeight;
    }

    else if (document.documentElement && document.documentElement.clientHeight)
    // Explorer 6 Strict Mode
    {
    innerwidth= document.documentElement.clientWidth;
    innerheight= document.documentElement.clientHeight;
    }

    else if (document.body)
    // other Explorers
    {
    innerwidth= document.body.clientWidth;
    innerheight= document.body.clientHeight;
    }
<cfoutput>
document.write('<img src="clientresolution.htm?resolution=' + screenW + 'x' + screenH + '" height="1" width="1" />');
document.write('<img src="fusebox.htm?fuseaction=#myfusebox.originalcircuit#.#myfusebox.originalfuseaction#" height="1" width="1" />');
document.write('<img src="clientviewableres.htm?resolution=' + innerwidth + 'x' + innerheight + '" height="1" width="1" />');
</cfoutput>
</script>
</cfsavecontent>

Then I <cfoutput>ed #request.clientstats# in the body section on my layout files.

In order to not generate a bunch of 404 errors in the server logs, I also created empty htm files for clientresolution.htm,clientviewableres.htm and fusebox.htm.

Now in SmarterStats I can run a custom report on querystrings for the files above that show client resolutions and the original fuseaction that is called per view (useful if any/all of your fuseactions are not URL submitted).

Oh and so far the results on my main website show only 16% of the requests coming in use 800x600 or lower.

Posted by fwscott at 5:46 PM | Comments (0)
July 2005
ActiveWidgets datagrid control
This is mostly for myself but others feel free to use this.

Coldfusion Custom tag for ActiveWidgets datagrid control.  Reminder that a commercial license is needed for ActiveWidgets with anything other than opensource projects.

More info and examples at http://www.franciswscott.com/activewidgets

Posted by fwscott at 9:24 AM | Comments (0)