home Links Articles Books Past Meetings Photos SiteMap
The MDCFUG is sponsored by TeraTech. Visit us at www.TeraTech.com

Please send
comments/questions to

michael@
teratech.com

 

ColdFusion Debugger Presentation

Thursday, May 04, 2000

 

This document is the presentation presented to the Charlotte CFUG on using the debugger in ColdFusion Studio 4.51.  No attempt is being made here to explore all the advantages of using the Integrated Development Environment (IDE) or even to cover all the features of the built in debugger.  However, there seems to be some confusion on setting up the debugger and on the uses and limitations of the debugger.  Therefore, the aim is to show at least one method to successfully set up ColdFusion Studio 4.51 and to demonstrate some of the features and benefits of using the debugger in your development efforts.  It is assumed that you are familiar with the different methods of setting up the windows software listed below because the detail required would be beyond the scope of this presentation.

 

Setting Up ColdFusion Studio 4.51:

 

Part of the frustration associated with using the debugger has to do with setting up CF Studio so the debugger will work at all.

 

We have tested this setup on Windows 98 and Windows NT 4.0 SP 6 and it appears to be reliable on both operating systems.  It may work as well on Windows 95, but we have not tested it personally.

 

Step 1, install Personal Web Server.  This is a fairly straight forward windows installation. 

 

Step 2, install ColdFusion Server single user version from the ColdFusion Studio CD.  If you use the full server version on Windows NT 4.0 Workstation it will work, but slows all applications on my PIII 500 laptop to an unacceptable level.  The full server version on Windows 98 did not slow the system down, but I’m not sure if other problems might be lurking.

 

Step 3, install ColdFusion Studio. 

 

After completing these steps we have an installation that will allow the debugger to work.  If you are used to developing on a remote RDS server, this may seem a little odd to you, but my experience has been that the debugger will not run reliably from a remote RDS server.  Note that I have seen it work, but not consistently.

 

One final comment, the debugger is much more stable in 4.51 than it was in 4.0 or 4.1.

 

Debugger Limitations:

 

The most limiting of the “limitations” is that the debugger will not run in a page with frames.  This can be frustrating if your working with an existing site and want to debug one of the main pages that exist inside a frames page.

 

To debug, you have to create a test page to call the page you want to debug, or set variables at the beginning of the page to allow the page to load with a set of typical values. 

 

This is the worst problem with using the debugger except for the occasional IDE crash.  In 4.0 and 4.1 an IDE crash would force you to reboot NT 4.0 before ColdFusion Server would run again.  In 4.51 you should not have to reboot if the rare IDE crash occurs.  Just restart CF Studio and begin debugging again.

 

The debugger will only debug .cfm files.  You may start running the debugger with an .htm page, but the breakpoint must be set on a CFML tag or inside a <CFSCRIPT> tag on a .cfm page.

 

Debugger Features:

 

Now for the good stuff…

·         View any variable, regardless of scope.

·         Change variable values while the page is running.

·         View field values from a query.

·         View variables as they change while looping.

·         Single step one line at a time.

·         Run to cursor – especially good to process a long loop.

 

The debugger has the following tabs to view various things about the running application.

·         Variables

·         Watches

·         Recordsets

·         Tag Stack

·         Output

·         Breakpoints

 

Lets briefly discuss the function of each tab.

The Variables tab is one of the most interesting.  It contains separate lists of all the variable scopes.  The scopes are listed below.

·         Variables

·         URL

·         Form

·         Client

·         Session

·         Application

·         File

·         Request

·         Cookie

·         Server

·         HTTP

 

If you right click your mouse, a popup will give you a check list to show only the scopes you prefer to see.

 

The Watches tab allows you to set Watches on a variable to see it change value, or evaluate a variable to see if it is in scope and what it’s value is at this line in the program. 

 

The evaluate function under the Watches tab is very useful.  For example, if you want to see the value of a field in a query on the current row.  Just type in qName.FieldName and press the Evaluate button.  The data in the field will be printed out for you.  If you have a Variables.IntName whose value is 0 and you are at a line in the code where you wish the value were 1, just type in “Variables.IntName = 1” and press the Evaluate button.  You can view values in a COM object if it is a single property and not a part of a collection in the object.  Extra code is required to see the properties in a collection from a COM object. (COM objects deserve another presentation.  Any volunteers…)

 

The Recordsets tab shows a list of all queries your program has within it’s scope.  The list includes the query name, count (number of rows returned), and the SQL syntax that was sent to the database.  All good info, but the space provided to show the SQL string length is limited and will be truncated.

 

The Tag Stack tab will show you a list of cfml tags that have been pushed on the stack while single stepping through.  Run this to get the feel for it.  To date, this has not been a real asset for anyone I know using the debugger.

 

The Output tab displays the html output being sent to the browser.

 

The Breakpoints tab lists all breakpoints that are set at the moment.

 

Debugging Sample Code:

 

To demonstrate the debugger, we will demonstrate the following.

·         Setting breakpoints.

·         Starting the debugger.

·         Mapping the file that the debugger starts with, not necessarily the file that contains the breakpoint.

·         Review the Variables tab.

·         Evaluate a variable with the Watches tab.

·         Change a variable value with the Watches tab

·         Review the Recordsets tab.

·         Review the Tag Stack tab.

·         Review the Output tab.

·         Review the Breakpoints tab.

·         Single step through code.

·         Run to cursor in code.

·         Look at final output with debug info from CF Server.

 

Discussion:

 

If you need to contact me, please send the email to [email protected].  Thanks for your interest, Bill Plummer.

 

Questions from group.

 

1 – How often do you use the debugger in a normal day.  Answer:  Hard to say, but I would estimate at least 10 times.  If code fails and the reason is not obvious, I step through with the debugger and usually see the problem quickly.

 

2 – Have you used Apache Web Server instead of MS PWS.  Answer:  No, but if as you say it has a smaller footprint and is more reliable, I would like to give it a try.  Apache can be found at http://www.apache.org/ and it is free.

 

3 – How do you use the collapse code feature in CF Studio 4.51.  Answer:  Highlight the code you want to collapse, and 2 tiny buttons will appear on the side bar.  Pick either button and the code will disappear, and a tag will appear in that location.  To expand put your cursor over the tag, right click the mouse, and select Expand All.  The code will be back in place.

 

Things to do for individual members. 

 

1 – Send Dave Crawford this doc and he will post to www.charlotte-cfug.org for the group.

 

 

 


Home | Links | Articles | Past Meetings | Meeting Photos | Site Map
About MDCFUG | Join | Mailing List |Forums | Directions |Suggestions | Quotes | Newbie Tips
TOP

Copyright © 1997-2024, Maryland Cold Fusion User Group. All rights reserved.
< >