cf pest control by shlomy gantz president, bluebrick inc
TRANSCRIPT
![Page 1: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/1.jpg)
CF Pest Control
By Shlomy Gantz
President, BlueBrick Inc.
![Page 2: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/2.jpg)
Famous Last words
• “…if debugging is defined as the art of taking bugs out of a program , programming must be putting them in…”
• “..It’s not a bug, It’s a feature “
Microsoft
![Page 3: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/3.jpg)
Types of bugs
• Syntax Error
• Run-Time Errors
• Logical Errors
![Page 4: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/4.jpg)
Types of bugs - Syntax Errors
• Syntax Error Example
<CFSET ClientName = “Shlomy Gantz”>
<CFSET URLstr = URLstr & urlendcodedformat(ClientName)>
![Page 5: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/5.jpg)
Types of bugs - Run-Time Errors
• Run-Time Error Example
<CFQUERY NAME=“GetOverPaidEmp” Datasource=“Payroll”>
SELECT SUM(Salary) AS TotalSalary,
COUNT(Emp_ID) as NumOfEmployees
FROM AnnualSalary
WHERE SALARY > 100000
</CFQUERY>
<CFSET AVGSalary = GetOverPaidEmp.TotalSalary/GetOverPaidEmp.NumOfEmployees>
<CFOUTPUT>#AVGSalary#</CFOUTPUT>
![Page 6: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/6.jpg)
Types of bugs - Logical Errors
• Logical Error example
<CFSET MyList=“Shlomy,Michael,Emily,Abraham”>
<CFSET ShlomyExists_YN = listfind(MyList,”shlomy”)>
<CFOUTPUT>#YesNoFormat(ShlomyExists_YN)#</CFOUTPUT>
![Page 7: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/7.jpg)
Other things that can go wrong
• Database connection (ODBC,MDAC …)• Cold Fusion server • Web Server• OS• Hardware
![Page 8: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/8.jpg)
Debugging Steps
• Plan• Back-up• Isolate• Find The error• Fix - Don’t patch• Look for similar• Document
![Page 9: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/9.jpg)
“Debugger’s Block”
• If all else fails
• … and if that doesn’t work
![Page 10: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/10.jpg)
Cold Fusion Administrator
![Page 11: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/11.jpg)
Cold Fusion Administrator
![Page 12: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/12.jpg)
Enable CFML stack trace
• CF tracks what tags have run during page process.
• Can be used either through CFTRY/CFCATCH or the HomeSite+
Debugger
![Page 13: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/13.jpg)
Report Execution Times
![Page 14: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/14.jpg)
Show Variables
• Show all variables processed by ColdFusion:
– Application– Cookie– Server – CGI– Form– Session – Client– Request– URL
![Page 15: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/15.jpg)
Detail View
• Breakdown of all templates run during a page process.
• Processing time for each template
![Page 16: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/16.jpg)
Database Activity
• Query Name • RecordCount• Processing Time • Query Executed
![Page 17: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/17.jpg)
Enable Performance Monitoring
![Page 18: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/18.jpg)
Enable Robust Exception Information
• physical path of template • URI of template • line number and line snippet • SQL statement used (if any) • Data source name (if any) • Java stack trace
![Page 19: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/19.jpg)
Debugging IP Addresses
• By Default All when debugging is turned on all users can see debug information.
• You can restrict access to the debugging info through this feature by IP address
![Page 20: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/20.jpg)
Log Files
• Easier Log File Administration
![Page 21: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/21.jpg)
Log Files
• Easier Log Analysis
![Page 22: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/22.jpg)
System Probes
• Monitor your ColdFusion Applications
![Page 23: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/23.jpg)
Code Analyzer
![Page 24: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/24.jpg)
Debugging with HomeSite+
• Setting up Development Mapping.
![Page 25: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/25.jpg)
Using the interactive debugger
![Page 26: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/26.jpg)
Debugging CF applications
• Show your variables (not only once)• Create breakpoints and Follow the flow• Use Exception handling to automatically
alert when errors occur• Look at your application logs• <CFDUMP>
![Page 27: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/27.jpg)
<CFABORT> & <CFOUTPUT>
• Using CFABORT to create breakpoints
<cfinclude template="Header.cfm">
<cfquery datasource="#dsn#" name="getContacts"> Select * from Contacts WHERE Active_YN=1 </cfquery>
<cfoutput>#getContacts.recordcount#</cfoutput> <cfabort>
![Page 28: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/28.jpg)
<CFABORT> & <CFOUTPUT>
• Following the flow <CFIF …………> Step 1
<CFIF ………………..> Step 1.1
<CFELSE>Step 1.2</CFIF>
<CFELSE> Step 2 </CFIF>
![Page 29: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/29.jpg)
Debugging in CFML
• <cfquery debug>
• <cfstoredproc debug=“yes|no”>
• <cfsetting showdebugoutput=“yes/no”>
![Page 30: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/30.jpg)
Debugging CF applications
• <CFERROR>• <CFTHROW>• <CFRETHROW>• <CFCATCH><CFTRY>• <CFLOG>• <CFTRACE>
![Page 31: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/31.jpg)
<CFERROR>
• <CFERROR TYPE="Request" or "Validation" or "Monitor" or "Exception" TEMPLATE="template_path" MAILTO="email_address" EXCEPTION="exception_type">
![Page 32: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/32.jpg)
<CFTRY><CFCATCH>
• <CFTRY>• ... Add code here• <CFCATCH
TYPE="exceptiontype"> • ... Add exception processing code
here </CFCATCH> • ... Additional CFCATCH blocks go
here </CFTRY>
![Page 33: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/33.jpg)
<CFTHROW><CFRETHROW>
• <CFTHROW TYPE="exception_type" MESSAGE="message" DETAIL="detail_description" ERRORCODE="error_code" EXTENDEDINFO="additional_information">
![Page 34: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/34.jpg)
<CFLOG>
• <cflog type="Error" file="myapp_errors" text="Exception error -- Exception type: #error.type# Template: #error.template#, Remote Address: #error.remoteAddress#, HTTP Rerference: #error.HTTPReferer# Diagnositcs: #error.diagnostics#">
![Page 35: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/35.jpg)
<CFTRACE>
• <cftrace abort = "Yes or No" category = "string" inline = "Yes or No" text = "string" type = "format" var = "variable_name" >
![Page 36: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/36.jpg)
IsDebugMode()
• <cfif IsDebugMode()> <h3>Debugging is set in the
ColdFusion Administrator</h3> <cfelse> <h3>Debugging is disabled</h3> </cfif>
![Page 37: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/37.jpg)
Application Logs
• Read your application logs regularly Error","TID=199","07/27/00","13:32:35","127.0.0.1","Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)","An error has occurred. HTTP/1.0 404 Object Not Found“
"Error","TID=199","07/27/00","13:32:45","127.0.0.1","Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)","Error resolving parameter SLOT_IDColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either: You have misspelled the parameter name, or You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.The error occurred while evaluating the expression: #slot_id# The error occurred while processing an element with a general identifier of (#slot_id#), occupying document position (4:12) to (4:20) in the template file D:\wwwroot\cfun2000\Examples\JS\JSexample1_CFMW\edit_def.cfmThespecific sequence of files included or processed s:D:\WWWROOT\CFUN2000\EXAMPLES\JS\JSEXAMPLE1_CFMW\EDIT_DEF.CFM .Date/Time: 07/27/00 13:32:45Browser: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)Remote Address: 127.0.0.1HTTP Referer: http://127.0.0.1/cfun2000/Examples/JS/JSexample1_CFMW/EDIT.HTMLTemplate: D:\wwwroot\cfun2000\Examples\JS\JSexample1_CFMW\edit_def.cfm“
"Warning","TID=152","07/27/00","15:07:21","In a CF_TagName construct custom tag file 'C:\CFUSION\CustomTags\Pages.cfm' will occlude custom tag file 'C:\CFUSION\CustomTags\cf_pages\Pages.cfm'." "Warning","TID=152","07/27/00","15:07:21","In a CF_TagName construct custom tag file 'C:\CFUSION\CustomTags\Pages.cfm' will occlude custom tag file 'C:\CFUSION\CustomTags\cf_pages\images\Pages.cfm'."
![Page 38: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/38.jpg)
CFDUMP
• Read your application logs regularly
<CFDUMP VAR="#myVar#">
![Page 39: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/39.jpg)
Debugging Databases
• SQL query analyzer
![Page 40: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/40.jpg)
Common Mistakes
“So what are we doing wrong?”
![Page 41: CF Pest Control By Shlomy Gantz President, BlueBrick Inc](https://reader036.vdocuments.net/reader036/viewer/2022062309/56649f345503460f94c5112b/html5/thumbnails/41.jpg)
Tools & Techniques
• <CFMAIL> Alerts• Monitoring Tools (
http://www.pingalink.com )• Testing Tools (
http://www.opendemand.com )• BugTraq• Automatic Code Generation Tools
– CodeSaver / CodeCharge / CommerceBlocks
• LoRCAT