ColdFusion Tips and Tutorials

ColdFusion Tips and Tutorials. Tips on ColdFusion, AJAX, CSS, JavaScript, HTML, Design, and more.

CFUnited Developer Conference 2010
Use this code TIPSCUST to get $100 off your registration @ CFUnited! We'll see you There!


ColdFusion Tips
Page 1 2 3
148 ColdFusion, Ajax, FuseBox, Tips, and Tut
147 Included Point of View
146 Javascript - OnFocus
145 Nathan's Rules of Professional Web Desig
144 Universal Server-Side Check | Bandwidth
143 Meeting Schedule | Identification Sessio
142 Breaking Frames Without Javascript
141 Unreal Forms
140 Screen Resolution
139 Human Help
138 Better Server-Side Validation
137 Automatic Server-Side Validation
136 Regular Expression Laboratory,ColdFusion
135 Rank-Ordered Site Search
134 Building Cryptograms
133 Well-Formed Includes
132 Grouping Families for Visits
131 Display Families on a Map Grid
130 Slide Shows
129 Determine Your Database Engine
128 ColdFusion in Context: Maxlength Lies
127 Something Extra
126 Parsing Database Structure from Data Def
125 Valid Values Maintenance
124 Print 1
123 Hide Session Id
122 Downsizing Data to Access
121 Time to Load a Page, FuseBox 4
120 Order and Rank by Subset
119 Warn through E-mail & Update on Paste Sp
118 Paste Spreadsheets, ColdFusion Component
117 Review Files Having Fixed-Length Fields
116 Organized Help
115 Sequence Slider
114 Bad Bits
113 Logical Deduction
112 Whiteout
111 Forced Navigation
110 Managing Permissions
109 Time Travel
108 Test First
107 Get Distance Between Map Coordinates
106 Validating Checkboxes
105 Matrix Manipulation
104 Field Help
103 Fake Object Not Found
102 Rank Order Correlation Coefficient
101 From Calling Pairs to Calling Tree
100 Posting Notice
99 Logout Persuasion
98 Release Session Memory
97 Use Identically Named Fields
96 Web Bug
95 Password Generation
94 Core Queries
93 Use CFFTP
92 Insert, Update, and Delete
91 Stack
90 T-Value
89 Bulk Data Entry and E-mail Validation
88 Quick Reset
87 Design 1
86 Use CFFTP
85 Support Login with AutoPost
84 Login and Site Protection
83 XY Graphs in a Graphing Calculator
82 Read Encrypted Files
81 Showing Progress
80 Frugal Cross-Browser Javascript
79 Tabbed Folders
Page 1 2 3



Custom Search
ColdFusion TIPS PLUS


Issue 00121 http://www.cftipsplus.com



I. My Comments

II. ColdFusion In Context: Time to Load a Page

By R. Martin Ladner
martin.ladner@charter.net


Advanced, Intensive ColdFusion Training!
Visit this site. If you have plans to get training here is a company
that provides Advanced, Intensive ColdFusion Training. Check them out.
http://www.coldfusiontraining.com/index.cfm?ref=cftipsplus


I. Comments:

If you have some news or information pertaining to ColdFusion that you think we should add please let us know. I am trying to decide where to buy or rent in the Washington, DC general area. Virginia, Maryland, and Delaware are even being considered. If you know of a house in foreclosure, or a cheap place to rent, or a place for sale with in 2 hours of DC let me know.


Keep Coding,
Nathan Stanford
http://www.cftipsplus.com
admin<at>cftipsplus.com

If you have suggestions for articles send them to us.
If you would like to write for cftipsplus.com
send us an email to:

NathanS<at>nsnd.com

IF YOU WANT TO BE AN AUTHOR SEND IN YOUR COLDFUSION TIPS.

Remember this is a great way to get your name known in the
ColdFusion Community.



New CF News
*Macromedia CF Community manager to give Keynote at CFUN-03*
Christian Cantrell, the Macromedia CF Server Community manager will be giving the keynote speach at CFUN-03 on Saturday 6/21/03. Christian will be speaking on the future of ColdFusion. Given all the changes happening with CFMX and Flash this seems like a hot topic to me! You can learn more at http://www.cfconf.com/cfun-03/

*Fusebox 4 released, more details at CFUN-03*
Fusebox version 4 was release in Atlanta GA today 5/7/03. Fusebox 4 will add new features using XML and compilation of the switch file. It also includes many ideas from FuseQ, the version of Fusebox written by John Quarto-vonTivadar that allow for multiple fuseactions and streamed output into CSS and Flash front ends. If you can't make it to Atlanta there will be four talks on Fusebox 4 at CFUN-03. The speakers include Hal Helms, Jeff Peters, John Quarto-vonTivadar and Sandra Clark. For more information see http://www.cfconf.org/cfun-03/



II. ColdFusion in Context: Time to Load a Page
By R. Martin Ladner
martin.ladner@charter.net



A major design and testing problem has been to objectively determine the time it takes for a page to load on the client's browser. If your applications weren't initially set up to provide that information, picture yourself, stopwatch in hand, waiting for a browser window to test your button-pushing reflexes. However, there's a better way to proceed without having to retro-fit the entire application. Eight little lines may be all you need.

Overview
First, a timing review is in order. Knowing how many milliseconds it takes ColdFusion to execute the instructions on a page is not the same thing as knowing how long it took for the client's browser to receive and display the generated page. One interval is independent of network speed; the other is not. To time how long it takes to load a page, you have to start with the browser itself.
The most accurate way to do this from the client's standpoint would be to start timing when the client clicks "submit" and stop timing when the NEXT page has finished loading. This would include the time for the server to receive the signal and generate a response rather than just timing how long it takes the response to load.

However, this kind of instrumentation would be very hard to add after the fact. The start time would have to be passed to the server in a cookie, URL, or form field, compared with a time taken at the end of the next page load, and stored or displayed in some fashion.

The additional information the "perfect" method would provide may not be worth the effort in most cases. The page request itself is small compared with a page; so, its impact on the time perceived by the user is small. And, the execution time is not only small (if you've done your job right) but can be displayed by ColdFusion on the page itself during debugging. That leaves the page loading time itself, the subject of this tip.

If you could take a time hack at the beginning and end of every page and display the difference in the status bar, you'd have a simple means of determining how long every page took to load. That's exactly what you can do in eight lines.

Code
Place these four lines at the beginning of Application.cfm. ColdFusion automatically inserts code from this file at the beginning of every page request. This code will cause the client browser to stuff the number of milliseconds since a reference date into "startms".

<script language="javascript">
now=new Date();
var startms=now.getTime();
</script>

Place these four lines at the end of OnRequestEnd.cfm (creating this file if it doesn't exist). ColdFusion looks for this file in the same directory in which it found Application.cfm, and inserts code from this file at the end of every page request. This code will cause the client browser to check the millisecond counter again, subtract the previous count, and write the result to the browser's status bar where you can read it.


<script language="javascript">
later=new Date();
window.status=later.getTime()-startms;
</script>

Try it Out
This change won't write to the server, and it's overwritten by other status messages, but it appears unobtrusively in the status bar as each page finishes loading and can therefore be used by us in comparing the performance of new code to old. This change can be made to production code without harming it (assuming no conflict in variable names). Your clients probably won't notice the difference under normal circumstances, but your help desk folks can ask for this information when clients complain about slow load times. You'll learn HOW long troublesome pages take to load; so, you can decide how to allocate your scarce resources to make things better.

In theory, an application may have many Application.cfm pages: one in each of many directories. If it does, each one must be modified, and each one must have a corresponding OnRequestEnd.cfm in that same directory. However, that's easy to do.

If you often have one page call another, you may see a number briefly enter the status bar and then get replaced with still another number. Just watch carefully, taking your knowledge of the code into account. If you see zero fly by, you're using a cached copy and should clear your browser cache for accurate results (or you're testing on your own box and need to browse across a network instead for realistic results).

Try this; you'll like it. In just a few minutes, it will give you information you can't get in any other way without days or weeks of work.

=Marty=


SPONSOR ADS:
This e-mail is sponsored by the following ads.



Advanced, Intensive ColdFusion Training!
Visit this site. If you have plans to get training here is a company
that provides Advanced, Intensive ColdFusion Training. Check them out.
http://www.coldfusiontraining.com/index.cfm?ref=cftipsplus


Publisher and Creator:
Nathan Stanford,
NathanS<at>nsnd.com
http://www.cftipsplus.com

Macromedia and ColdFusion are U.S. registered trademarks.


Copyright (c) 2000 - 2003
CFTIPSPLUS.COM and NSND.COM

Permission is granted to circulate this publication via
MANUAL forwarding by email to friends provided that the text is
forwarded in its entirety and no fee is charged.

Photo of Nathan Stanford
Nathan Stanford
LinkedIn

R. Marty Ladner's
Site