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 00087 http://www.cftipsplus.com

I. My Comments

II. ColdFusion In Context: Design 1
By R. Martin Ladner
martin.ladner@knology.net



Please See our sponsers at the bottom of this email.

I. Comments:

Thanks for reading my ColdFusion Tips e-zine. If you enjoy it please
consider some sort of sponsership. We have our first real sponser soon.
This should pay for some of the sites past bill.


Keep Coding,
Nathan Stanford
President/CEO
C.F. Concepts, Inc.
http://www.coldfusionmonthly.com
http://www.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:

admin@cftipsplus.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.



If you have any suggestions please email me at cftips@nsnd.com.


II. ColdFusion in Context: Design 1
By R. Martin Ladner
martin.ladner@knology.net



If your team finds that it needs and is willing to name the variables
passed between pages before it starts coding, then you should consider a
full-blown design approach. Otherwise, here is a small set of ideas
which taken together will let you create and install applications
quickly and maintain them easily and safely, letting you easily re-use
code while easing your documentation burden.
This tip will help you "connect the dots" easily, automatically extract
documentation from your code, give you more secure user sessions, and
avoid "cookie not found" errors.

Proposed Directory Approach
Leave as few documents in the top directory of the application as
possible: typically a global variables page, the home page, and a page
for unplanned exit such as a database error. This reduces the number of
points of attack that require separate protection; it also reduces
confusion.

**Put everything else in directories exactly one level below the top
directory, protected appropriately by Application.cfm for that
directory. This way, any routine can call another with ../directory_name
and always knows that the few pages in the top directory are exactly one
level up. Server mappings aren't needed within the application, and its
easy to incorporate pages and navigate between pages. If it's in your
function, get it directly. If it's not, get it from
../another_directory.

This is a simple, yet powerful technique. Many large organizations have
a relatively flat organizational chart, relying on policy rather than
direct supervision to get things done. Code can work the same way.

Put all database access pages in one directory to be included as
desired. This way, they're easy to find and easy for Application.cfm in
that directory to block their direct use. Application.cfm can be set to
redirect all direct browse attempts to the home page, yet the pages can
be included in other pages without difficulty.
Put all file access pages in one directory to be included as needed.
Ditto.

Put all stock display pages (such as global title bars) in one
directory. Ditto. Use this approach for anything to be shared.
Create a directory for each logical function such as login, account
access, billing, inventory [grin], to divy up the workload, simplify
role-based access, and make things easy to find.
That's it.

Proposed Page-Level Comment
On every page, put a page-level ColdFusion comment consisting of a short
description and decision points. Automated documentation tools can
figure other aspects of the code, but this information is needed to
understand what the code is intended to do in the first place and can
help both before and after the page is fully written.
A sample short description is written in the third person and looks like
this:
. checks login, verifies credentials,
. and sends the browser
. to the appropriate page.

An automated documentation tool would already know the filename, can
readily find and concatenate lines that begin with a period, and can
therefore readily use this input to produce a statement that looks like
this:

"gate.cfm checks login, verifies credentials, and sends the
browser to the appropriate page."

A sample set of decision points for this page looks like this:
; bad login: login.cfm
; no access: login.cfm
; admin access: admin/menu.cfm
; user access: work/menu.cfm

Express the conditions of decision points - the left-hand side - in a
notional way, indicating function rather than specific variable names.
This way, they'll be understandable by the customer and will survive
fits of variable renaming. Code comments can optionally refer to these
notional terms if desired. For example, an if statement might be
followed by a comment naming one of those notional conditions (e.g.,
"admin access") if it seems useful to do so.
That's it. Any line whose first non-white space character is a period
followed by a space becomes part of the page-level description in
documentation; any line whose first non-whitespace character is a
semicolon followed by a space can be listed by a documentation tool as a
decision point for that page. (Formatted this way, the tool could even
find them buried in code where decisions take place, but you'll probably
want to put them near the top of the page where humans will look for
them first.)

Proposed Browser Credentials
Except when browsing unprotected or login pages, require the browser to
present additional information (such as the encrypted accountID of the
account currently using that session). This reduces the likelihood that
someone will break in by finding a valid cfid/cftoken combination,
thereby hijacking an on-line user's session. (Closed sessions can't be
hijacked.) If the browser doesn't return the right encrypted accountID
for the session, access will be denied.
That's it.

Proposed Cookie Approach
Set cookies in a fashion that causes them to go away when the browser
closes. This way, your users won't have to be paranoid about them.
In general, use cookies for user identification and credentials, not for
passing application data between pages. This way, an overloaded
connection is less likely to drop or cache data that should be complete
and timely. This way, you won't accidentally send more cookie data for
your domain than the browser can handle and experience the "joy" of
having the browser drop data randomly, without warning.
That's it.

Application
As some of you may have guessed, this set of ideas may be more properly
termed programming/project s t a n d a r d s, but that word scares folks
off, sometimes with good reason. Just as the computer is the final judge
of what language statements mean; so, your projects are the final judge
of what approaches help or hinder your work. If this works, fine. If it
doesn't, do something else and tell us about it.

=Marty=


Publisher and Creator:
Nathan Stanford,
admin@cftipsplus.com

http://www.cftipsplus.com


Macromedia and ColdFusion are U.S. registered trademarks.


Copyright (c) 2000 - 2001
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.



Sponsers

-- Sponsers Coming --


Photo of Nathan Stanford
Nathan Stanford
LinkedIn

R. Marty Ladner's
Site