Adobe Coldfusion Anthology

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

One thing has beleaguered the ColdFusion ecosystem: a lack of deep knowledge. This book is a welcome palliative to that. If you're a serious ColdFusion programmer, buying this book should be a no-brainer.

Author(s): Michael Dinowitz, Judith Dinowitz
Edition: 1
Publisher: Apress
Year: 2010

Language: English
Pages: 543

Apress - Adobe ColdFusion Anthology (2010) (ATTiCA)......Page 1
Contents at a Glance......Page 5
Contents......Page 8
Foreword......Page 27
About the Authors......Page 28
About the Technical Reviewers......Page 39
Acknowledgments......Page 40
Introduction......Page 41
Part 1: ColdFusion Fundamentals......Page 43
What Is an Application?......Page 45
The onApplicationStart Method......Page 47
The onSessionStart Method......Page 48
The onRequestStart Method......Page 49
The onError Method......Page 50
The onSessionEnd Method......Page 52
The onRequest Method......Page 53
A New Application Structure......Page 55
Application.cfc Reference......Page 57
User-Defined Functions......Page 59
Naming a UDF......Page 60
Placing the UDF Definition......Page 61
The cffunction Tag......Page 62
The cfargument Tag......Page 64
The Arguments Scope......Page 65
Local Variables......Page 67
UDF Variable Protection......Page 68
Executing UDFs and Passing Parameters......Page 69
The cfinvoke Tag......Page 70
Error Handling......Page 72
A Full UDF Example......Page 73
ColdFusion Components......Page 74
Creating CFCs......Page 75
Instantiation and Constructors......Page 76
Implementing Security......Page 81
This Scope......Page 82
Caching Components......Page 83
Two Different Views......Page 85
Type Checking Parents and Children......Page 87
Parting Words......Page 88
404 Missing Template Handling: Step-by-Step Basics......Page 89
Setting Global Handlers......Page 90
What Is the onMissingTemplate() Method, and When Is It Called?......Page 91
Method Invocation within onMissingTemplate()......Page 93
When Errors Occur......Page 94
Request Errors and Corrected Requests......Page 95
Content Redirects......Page 96
Dynamic Page Generation......Page 97
Examining Template Requests......Page 98
Fusebox URL......Page 100
We’re Not Done Yet, but .........Page 101
Get the Message?......Page 103
Message Received......Page 105
Defining onMissingMethod()......Page 106
Using onMissingMethod()......Page 107
Automatic get/set Methods......Page 108
Method Injection......Page 110
Aspect-Oriented Programming......Page 112
Further Reading......Page 114
Part 2: Document Creation in ColdFusion......Page 115
PDF Support in ColdFusion MX 7 (and Earlier)......Page 117
PDF Support in ColdFusion 8.0.1 and beyond......Page 118
The isPDFFile and isPDFObject Functions......Page 119
What Exactly Can We Do with the cfpdf Tag?......Page 121
Getting and Setting Information......Page 122
Adding a Watermark......Page 126
Using DDX......Page 128
Where to Go Next......Page 130
Getting Image Dimensions with cfimage......Page 131
Resizing an Image with cfimage......Page 132
Creating a CAPTCHA Image with cfimage......Page 133
Drawing an Image from Scratch......Page 134
Using a Custom Drawing Stroke......Page 135
Drawing Text on an Image......Page 136
Additional Image Drawing Functions......Page 137
ImageScaleToFit......Page 138
Displaying the Digital Camera Model and EXIF data......Page 139
Summary......Page 141
Part 3: Essentials to Server Productivity......Page 143
How the JVM Fits into ColdFusion......Page 145
Enabling Metrics Logging......Page 146
Editing the jrun.xml File......Page 147
Splitting Up the JRun Logs......Page 148
Examining the Metrics Logging Output......Page 149
Finding the Proper Start and Maximum Heap Memory Size......Page 150
The New Metrics......Page 151
Summary......Page 152
by Doug Boude......Page 153
The Experiment......Page 154
The Moral of the Story......Page 157
Further Reading on Asynchronous Gateways......Page 158
Asynchronous Gateways Step-by-Step......Page 159
If You Can't Tell a Manager from an Employee, You Might Have a Performance Bottleneck......Page 163
If Your Foreign Key Values Are Not Defined in the Database . . .......Page 165
If You Relate Data Between Tables, but Neglect to Inform the Database . . .......Page 167
If You Store a Comma-Delimited List of Foreign Keys in a Single Column . . .......Page 168
If You Use SELECT MAX( ID ) to Get the Primary Key of a Newly Inserted Record . . .......Page 171
If Your Only Transactions Are Between You and a Cashier . . .......Page 172
If You Think the Difference Between Char and Varchar Is Typing Three More Letters . . .......Page 174
If You Think UTF-8 Is One of Those TV Channels You Used to Get with Rabbit Ears . . .......Page 176
If You Use More Than One Query to Read Data from Multiple Tables . . .......Page 177
If the Only Index Your Database Knows Is Next to Your Middle Finger . . .......Page 179
If You Run Calculations on Data Using Your Application Code . . .......Page 181
Build It Correctly from the Beginning......Page 184
Part 4: Communication and Integrating with Other Technologies......Page 185
An Introduction to Consuming and Deploying Web Services in ColdFusion......Page 187
Deploying a Web Service from a CFC......Page 188
Using a Remote Proxy Object......Page 189
Deploying a Web Service from a Standard ColdFusion Page......Page 190
Using the cfinvoke Tag......Page 193
Using the CreateObject() Function......Page 194
Using the cfhttp Tag......Page 195
Invoking a CFM-Based Web Service......Page 196
Error Handling......Page 197
And Finally.........Page 198
Passing Complex Types as Input Parameters......Page 199
Nested Complex Types......Page 201
Arrays......Page 202
Attributes......Page 204
Going to the Source......Page 206
When Structures Are Not Enough......Page 211
WSDL2Java......Page 213
Working with Complex Return Values......Page 214
Publishing Web Services......Page 215
Other Resources......Page 219
Validating a Component......Page 221
Validating an Array of Components......Page 222
Sending E-mail the Right Way......Page 223
The From Conundrum......Page 224
Sender Policy Framework (SPF)......Page 226
Checking Sender Behavior......Page 227
Checking the Content......Page 228
Miscellaneous Commandments......Page 229
ColdFusion and Exchange Integration Requirements......Page 231
Using cfexchangeconnection......Page 232
Creating an Item Structure......Page 233
Getting a UID......Page 234
Working with Attachments......Page 235
Dealing with Meeting Requests......Page 236
Using cfexchangefilter......Page 237
Connections......Page 238
Conclusion......Page 239
Messaging Patterns......Page 241
Enterprise Service Bus (ESB)......Page 242
Messaging Framework......Page 244
Running BlazeDS with a ColdFusion Event Gateway......Page 246
Concluding Thoughts......Page 251
Part 5: Object-Oriented Programming (OOP)......Page 253
OOP Fundamentals......Page 255
Encapsulation......Page 256
Where Do I Start?......Page 257
The Object-Oriented Lexicon......Page 259
Model-View-Controller (MVC)......Page 267
Handling Sessions......Page 268
Returning Data......Page 270
Conclusion......Page 271
A Four-Layer Cake......Page 273
A Review of Recipes......Page 275
What Are Those Ingredients?......Page 278
Eating Well or Poor Diet?......Page 279
Real-World Web Applications......Page 280
SOA vs. OOP......Page 281
Web Services......Page 283
Data Formats......Page 284
Security......Page 285
Error Handling......Page 287
Discoverability......Page 288
Service Interfaces......Page 289
Base Class Basics......Page 291
It’s All About the API......Page 293
The Variables Define the API......Page 294
Metaprogramming......Page 296
Resources......Page 297
Part 6: ColdFusion Frameworks......Page 299
Can Someone Just Tell Me What They ARE Already?......Page 301
Fusebox......Page 302
Model-Glue......Page 303
ColdBox......Page 304
Reactor......Page 305
Summary......Page 306
Fusebox—What and Why......Page 307
Fusebox Concepts......Page 308
Fusebox Benefits......Page 310
XML for Circuits and Fuseactions......Page 312
Implied Circuits, CFCs for Fuseactions......Page 313
Multiple Applications......Page 314
Custom Lexicons......Page 315
XML Grammar......Page 318
The event Object......Page 320
Runtime Control......Page 321
Why Upgrade?......Page 322
Introducing the Mach-II Framework......Page 323
Installing Mach-II......Page 325
Mach-II’s XML Configuration File......Page 328
Properties......Page 332
Event Filters......Page 333
Hello Mach-II......Page 334
Let’s Get Personal......Page 336
Conclusion......Page 339
Model-Glue Fundamentals......Page 341
A Recipe for Spaghetti......Page 342
Installing Model-Glue......Page 343
Creating the Application Manually......Page 344
Automating Application Creation......Page 345
ColdSpring XML Configuration File......Page 346
The Model-Glue XML Configuration File......Page 347
The controllers Block......Page 349
The event-types Block......Page 350
Setting Up the Form......Page 351
Adding Functionality......Page 352
Finishing Up......Page 354
Conclusion......Page 355
The Problem of Dependency in System Design......Page 357
ColdSpring and Component Management......Page 358
Too Many Dependencies Can Spoil the Model......Page 360
Using ColdSpring to Architect Your Application in Logical Tiers......Page 361
The Origin of Reactor......Page 363
A Look at Reactor......Page 364
Installing Reactor......Page 365
Some Simple Reactor Examples......Page 366
How Does Reactor Work?......Page 367
Slightly More Interesting Reactor Examples......Page 368
Using Iterators......Page 370
Learning More About Reactor......Page 371
Developing Applications with Transfer......Page 373
The Transfer Data Source Configuration File......Page 374
The Transfer Object Configuration File......Page 375
Object Composition......Page 377
Lazy Loading......Page 378
Decorators......Page 379
Creating the TransferFactory......Page 380
Saving an Object......Page 381
Retrieving an Object......Page 383
Deleting an Object......Page 384
Using List Queries......Page 385
Other Transfer Functionality......Page 386
Conclusion......Page 387
FW/1: The Invisible Framework......Page 389
Convention over Configuration......Page 390
Getting Started with FW/1......Page 391
A Real Application......Page 393
Beyond the Basics......Page 397
Summary......Page 399
Part 7: Designing the User Interface......Page 401
More Maintainable Business Calculations......Page 403
Business Objects......Page 404
Custom Data Types......Page 405
View CFCs......Page 407
Conclusion......Page 410
Overview......Page 411
cfpresentation The Shell......Page 412
cfpresentationslide The Message......Page 413
The Amazing Potential......Page 415
Working with JSON......Page 417
Working with cfajaxproxy......Page 421
A More Complex Example......Page 424
Conclusion......Page 426
The Challenges......Page 427
Tables......Page 428
Conclusion......Page 429
Part 8: Development Tools......Page 431
Turbo Charging Eclipse......Page 433
Preparing for Turbo Charging......Page 434
Setting Eclipse Preferences......Page 435
Installing Core Tools......Page 437
Refresh Eclipse Data......Page 438
Diagnosing Plug-in Issues......Page 439
eclipse.ini......Page 440
Switching Eclipse from the Default JVM......Page 442
More Learning......Page 443
Eclipse Runtime Commands and Various JVM Options......Page 444
JVM Options......Page 445
-XX:+UseParallelGC......Page 446
JRockit JVM Options......Page 447
-XgcPrio:pausetime......Page 448
Why Eclipse?......Page 449
Projects......Page 450
ColdFusion Server Integration......Page 451
Configuring Your Server......Page 452
CF Admin and Server Monitor......Page 453
CF Builder Extensions......Page 454
Building an Extension......Page 455
Configuring Your Application for Debugging......Page 459
Conclusion......Page 461
What Is Interactive Step Debugging?......Page 463
Getting Started with the CF8 Debugger......Page 466
First Stop: Setting a Breakpoint......Page 467
Observing Program State Information (Variables)......Page 468
Stepping Through Lines of Code......Page 469
Understanding the Stack Trace......Page 470
Stopping on an Error......Page 471
Configuring RDS in both Eclipse and ColdFusion’s Administrator Page......Page 472
Differences Between the Debugger and FusionDebug......Page 473
Summary......Page 474
Introducing Subversion......Page 475
Setting Up Subversion on a Windows Server......Page 476
Creating Your First Repository......Page 478
Importing a Web Site Project into a Repository......Page 480
Setting Up the Client Machine......Page 483
Updating, Committing, and Resolving with Subversion......Page 484
Always More to Learn......Page 486
The Advantages of Subversion......Page 487
Using Subversion......Page 488
Importing Existing Code......Page 489
Creating Branches and Tags......Page 490
Creating Patches......Page 491
Conclusion......Page 492
Branching......Page 493
Creating a Branch......Page 494
Successful Branching......Page 495
Tagging......Page 496
Merging......Page 497
Properties......Page 500
Where to Go From Here......Page 502
Automating Your Development with Ant......Page 503
Ant Installation......Page 504
Eclipse Integration......Page 505
Targets......Page 506
Tasks......Page 507
A Hello World Buildfile......Page 508
Ant Properties......Page 510
Dynamic Data in Ant......Page 511
Copying and Zipping Files......Page 512
Interacting with Subversion......Page 515
Sending E-mail......Page 516
Conclusion......Page 517
¦A......Page 519
¦C......Page 521
¦D......Page 525
¦E......Page 527
¦F......Page 528
¦......Page 529
¦I......Page 530
¦L......Page 531
¦M......Page 532
¦N......Page 533
¦O......Page 534
¦P......Page 535
¦R......Page 536
¦S......Page 538
¦T......Page 540
¦U......Page 541
¦V......Page 542
¦Z......Page 543