MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Manuel d'utilisateur Page 29

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 44
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 28
29Writing CFX Tags with Visual C++
NOTE
The tag computes the population standard deviation, which means that it is most appropriate for analyzing a complete set of data.
You could easily alter it to compute the sample standard deviation instead, which would make it more appropriate for analyzing a
random subset of the data.
The attributes for the new tag are listed in Table 30.13. If you want to see how this tag is used in a
ColdFusion page, skip ahead to Listing 30.7.
Table 30.13 <CFX_ComputeStandardDeviation> Tag Syntax
ATTRIBUTE DESCRIPTION
query The name of a query, such as the result of a <cfquery> tag, that contains
numbers for which to compute the standard deviation.
column The column of the query that contains the numbers for which to compute the
standard deviation.
variable A variable name; the tag will return the computed standard deviation (a single
number) in the variable you specify here.
Listing 30.6 shows the C++ source code used to create the <CFX_ComputeStandardDeviation> tag.
The code is quite simple. About half of it is concerned only with the actual mathematical computa-
tions, which have little to do with the CFX API itself. The remainder (mostly at the top and bottom
of the listing) are straightforward CFX calls that use the methods described in the first section of
this chapter to exchange information with the ColdFusion page using the tag.
Listing 30.6 Request.cpp—C++ Source Code For the <CFX_ComputeStandardDeviation> Ta g
/////////////////////////////////////////////////////////////////////
//
// CFX_COMPUTESTANDARDDEVIATION - Cold Fusion custom tag
//
// Copyright 2002. All Rights Reserved.
//
#include “stdafx.h” // Standard MFC libraries
#include “cfx.h” // CFX Custom Tag API
#include “math.h”
void ProcessTagRequest( CCFXRequest* pRequest )
{
try
{
/* BEGIN ATTRIBUTE VALIDATION */
// Make sure a VARIABLE attribute was actually passed to the tag
if ( pRequest->AttributeExists(“VARIABLE”)==FALSE ) {
pRequest->ThrowException(
“Error in CFX_ComputeStandardDeviation Tag”,
“No VARIABLE attribute specified.”);
}
Vue de la page 28
1 2 ... 24 25 26 27 28 29 30 31 32 33 34 ... 43 44

Commentaires sur ces manuels

Pas de commentaire