### Starting ColdFusion Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md This command starts the ColdFusion service after installation. ```bash /cf_root/cfusion/bin/coldfusion start ``` -------------------------------- ### Starting the Installation Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md This command initiates the ColdFusion installation process. Replace with the actual installation file name. ```bash ./ ``` -------------------------------- ### Starting ColdFusion on Windows Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command to start ColdFusion on Windows. ```bash coldfusion.exe -start -console ``` -------------------------------- ### Starting ColdFusion on UNIX/Linux/Solaris/MAC OSX Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command to start ColdFusion on UNIX-like systems. ```bash ./coldfusion start ``` -------------------------------- ### Example with start argument Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/replace.md Example showing how to use the 'start' argument (CF2021+) to specify the position to begin searching for replacements. ```javascript getRes = replace("Love ColdFusion", "o", "O","ALL","3"); writeOutput(getRes); ``` -------------------------------- ### Get folder example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfexchangefolder.md Example of getting extended information for the Inbox folder. ```html ``` -------------------------------- ### Using non zero start parameter Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/bitmaskclear.md Example demonstrating the use of a non-zero start parameter. ```javascript bitMaskClear(3, 1, 1) ``` -------------------------------- ### For Loop Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/script.md A basic example of a 'for' loop in CFScript. ```CFScript for (i=1; i <= 5; i++) { // all statements in the block are looped over result = i * 2; writeOutput(result); } ``` -------------------------------- ### Add virtual directory Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Example of adding a virtual directory with aliases. ```xml ``` -------------------------------- ### Converting Java Code Examples to CFML Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/java.md Illustrates how to translate a Java code example into CFML, emphasizing the need for full package names and understanding the difference between static and instance methods. ```java Car myCar = CarFactory.create(); myCar.setDriver( new Driver("Pete") ); Driver myDriver = myCar.getDriver(); myDriver.eject(); ``` -------------------------------- ### Hashed Cookie Name Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/security-authentication.md Demonstrates using the hash() algorithm for cookie name obfuscation. ```cfml __#hash( 'some_cookie_name', 'SHA-256', 'UTF-8', 25 )# ``` -------------------------------- ### Simple ExtensionList() Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/extensionlist.md This example shows a very basic usage of the function to get a list of available extensions. ```javascript dump(extensionList()); ``` -------------------------------- ### Running the Linux Installer in GUI Mode Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md This command launches the Linux installer with a graphical user interface. ```bash ./ -i gui ``` -------------------------------- ### Obfuscated Cookie Name Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/security-authentication.md Provides an example of an obfuscated cookie name to confuse potential attackers. ```cfml __ga_tracking_beacon_ ``` -------------------------------- ### String Slicing Examples Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/strings.md Examples demonstrating how to extract sub-strings using array notation with start, stop, and step values. ```cfscript myString = "This is my string. I love CFDocs!"; writeOutput(myString[1]); // Returns T // First character from start of string. writeOutput(myString[-1]); // Returns ! // First character from end of string. writeOutput(myString[20:28]); // Returns I love CF writeOutput(myString[20:50]); // Returns Error : Cannot access array element at position 50. -- This will not wrap. writeOutput(myString[-20,-10]); // Returns ring. I lov writeOutput(myString[1,-10]); // Returns This is my string. I lov writeOutput(myString[1:]); // Returns This is my string. I love CFDocs! // Full string from position 1 to end. writeOutput(myString[:10]); // Returns This is my // String from position 1 to position 10. writeOutput(myString[5:25:5]); // Returns yiI // Every 5th character from position 5 to 25. writeOutput(myString[::2]); // Returns Ti sm tig oeCDc! // Every other character in the string. ``` -------------------------------- ### Using non zero mask start and length parameters Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/bitmaskclear.md Example demonstrating the use of non-zero mask start and length parameters. ```javascript bitMaskClear(10, 1, 2) ``` -------------------------------- ### Example using onApplicationStart Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/application.md This example shows how to set an application variable within the onApplicationStart method. ```cfml component { this.name = "myApplication"; function onApplicationStart() { application.something = "otherthing"; } } ``` -------------------------------- ### Invoking a static method Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/java.md Example of invoking the static `currentTimeMillis()` function in the `java.lang.System` class. It shows how to get a reference to a class to invoke a static method on. ```cfml javaSystem = createObject("java", "java.lang.System"); currentTime = javaSystem.currentTimeMillis(); writeOutput(currentTime); ``` -------------------------------- ### Query Loop Example (Row Iteration) Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/script.md Shows how to loop through query results by row in CFScript. ```CFScript q = queryNew("id,data", "integer,varchar", [ [11, "aa"], [22, "bb"], [33, "cc"] ] ); for (row in q) { writeOutput("#q.currentRow#:#row.id#:#row.data#;"); //result: 1:11:aa;2:22:bb;3:33:cc; } ``` -------------------------------- ### Get Sunday Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/dayofweekasstring.md An example of how to get the string 'Sunday' using the dayOfWeekAsString function. ```javascript dayOfWeekAsString(1) ``` -------------------------------- ### Example for getting cell formula Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/spreadsheetgetcellformula.md Example of getting Excel spreadsheet cell value and formula. ```javascript columnsList = "Name,Employed,Sales,Earnings,Some Value"; employees = [ { "Name": "Robert","Employed":"Y","Sales":1,"Earnings":500 }, { "Name": "Wilma","Employed":"Y","Sales":15,"Earnings":5500 }, { "Name": "Eric","Employed":"Y","Sales":3,"Earnings":1200 }, { "Name": "Fred","Employed":"Y","Sales":1,"Earnings":500 }, { "Name": "Dillan","Employed":"Y","Sales":15,"Earnings":5500 }, { "Name": "Dana","Employed":"Y","Sales":3,"Earnings":1200 }, { "Name": "Sandy","Employed":"Y","Sales":1,"Earnings":500 }, { "Name": "Ellen","Employed":"Y","Sales":15,"Earnings":5500 }, { "Name": "Richard","Employed":"Y","Sales":3,"Earnings":1200 } ]; // create a spreadsheet s = SpreadsheetNew("Example"); // add the header row spreadsheetAddRow(s, columnsList); // Add some employee data employees.each(function(record,row){ spreadsheetAddRow(s, "", row + 1); // Add the row data by column name ListToArray(columnsList).each(function(columnName,col){ if(structKeyExists(record,columnName)){ SpreadsheetSetCellValue(s, record[columnName], row + 1, col); } }); }); // Capture the number of rows plus the header row numRows = ArrayLen(employees) + 1; // Create some random data in the 5th column for (i=2; i<= numRows; i=i+1) SpreadsheetSetCellValue(s,i,i,5); // add a totals row spreadsheetAddRow(s, "", numRows + 1); // Set the formula for the cell in the last row, column 3 to be the sum of // 'Sales' SpreadsheetSetCellFormula(s,"SUM(#Chr(64+3)#2:#Chr(64+3)#10)",numRows+1,3); // Set the formula for the cell in the last row, column 4 to be the sum of // 'Earnings' SpreadsheetSetCellFormula(s,"SUM(#Chr(64+4)#2:#Chr(64+4)#10)",numRows+1,4); // Set the formula for the cell in the last row, column 5 to be the sum of // 'Some Value' SpreadsheetSetCellFormula(s,"SUM(#Chr(64+5)#2:#Chr(64+5)#10)",numRows+1,5); for (i=3; i<= 5; i=i+1){ //Get the formula from last row column i ex: ($E11) formulaValue=SpreadsheetGetCellFormula(s,numRows+1,i); //Get the value from last row column i ex: ($E11) cellValue=SpreadsheetGetCellValue(s,numRows+1,i); writeOutput("Total: " & cellValue & "
"); writeOutput("formula: " & formulaValue & "
" ); } writedump(var=s,label="Example");
``` -------------------------------- ### Create a certificate file Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command to generate a certificate file using keytool. ```bash cfroot\jre\bin\keytool -genkey -alias tomcat -keyalg RSA ``` -------------------------------- ### Using non zero read mask start and length parameters Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/bitmaskread.md Example demonstrating the use of non-zero start and length parameters. ```javascript bitMaskRead(10, 1, 3) ``` -------------------------------- ### Get Sunday Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/dayofweekshortasstring.md Example of getting the short string for Sunday. ```javascript dayOfWeekShortAsString(1) ``` -------------------------------- ### While Loop Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/script.md A template for a 'while' loop in CFScript. ```CFScript while (condition) { // statements } ``` -------------------------------- ### Import a certificate Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command to import a certificate into the Java cacerts keystore. ```bash cfroot\jre\bin\keytool.exe -importcert -keystore "cfroot\jre\lib\security\cacerts" -file selfsignedcert.cer -storepass password ``` -------------------------------- ### Web Server Configuration Tool - General Commands Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md General commands for the Web Server Configuration Tool, including uninstalling and listing web servers. ```bash ./wsconfig -uninstall ``` ```bash ./wsconfig -list ``` -------------------------------- ### Export a certificate Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command to export a certificate from a keystore. ```bash cfroot\jre\bin\keytool -export -alias certificatekey -keystore keystore.jks -rfc -file selfsignedcert.cer ``` -------------------------------- ### xUnit Style Example Test Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/testbox.md An example of an xUnit style test case using TestBox. ```cfml component displayName="My Sweet Suite" extends="testbox.system.BaseSpec" { function testSomething() { var something = true; $assert.isTrue(something); $assert.notIsEmpty(something); } } ``` -------------------------------- ### Get Error Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting error information using the cfadmin tag. ```html ``` -------------------------------- ### Get Debug Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting debug information using the cfadmin tag. ```html ``` -------------------------------- ### Lookup a User in Active Directory Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfldap.md This example gets the user's data from active directory and displays a thumbnail image stored in active directory. ```html ``` -------------------------------- ### Get the datasource Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting datasource information using the cfadmin tag. ```html ``` -------------------------------- ### Simple Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/queryexecute.md SQL Only Example. Assumes that a default datasource has been specified (by setting the variable this.datasource in Application.cfc) ```javascript qryResult = queryExecute("SELECT * FROM Employees"); ``` -------------------------------- ### Year of a datetime object example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/year.md Example demonstrating how to get the year from a datetime object. ```javascript dt = createdatetime(2016,1,1,5,30,25); y = year( dt ); writeoutput( y ); ``` -------------------------------- ### storeAddACL Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/storeaddacl.md Example demonstrating how to use storeAddACL to add permissions to an S3 bucket. ```cfml ``` -------------------------------- ### Simple listFirst Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/listfirst.md A very basic listFirst example. ```javascript listFirst("one,two,three,four"); ``` -------------------------------- ### Simple listLast Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/listlast.md A very basic listLast example ```javascript listLast("one,two,three,four"); ``` -------------------------------- ### Complex ExtensionList() Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/extensionlist.md This example was created by Michael Born to check the version of an installed extension. ```javascript var extension = extensionList().filter( ( extension ) => extension.name == "Hibernate ORM Engine" ); if ( !extension.recordCount ){ throw( "Hibernate extension is not installed; please install it now." ); } else { var installedExtensionVersion = extension.version; writeOutput( "You have the Hibernate extension version " & installedExtensionVersion & " installed." ); } ``` -------------------------------- ### Simple Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/getapplicationmetadata.md Prints the statements using application meta data. ```javascript // Fetch application meta data data = getApplicationMetadata(); // Print application name writeOutput("Application name is " & (data.name.length() ? data.name : "unspecified") & "
"); // Print session timeout writeOutput("Session timeout is " & data.sessionTimeout & "
"); // Print session management writeOutput("Session management is " & (data.sessionManagement ? "enabled" : "disabled")); ``` -------------------------------- ### Find first instance starting from beginning of string. Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/findoneof.md We're not passing a start index in this example. ```javascript string_to_search = 'The rain in Spain falls mainly in the plains.' writeOutput( findOneOf('in', string_to_search) ) ``` -------------------------------- ### Compress a file Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/compress.md Compress the file "example.txt" to a zip-file. ```javascript compress("zip", "example.txt", "output.zip") ``` -------------------------------- ### Query Loop Example (CF11+ Group) Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/script.md Demonstrates the 'cfloop' tag with the 'group' attribute for query iteration in CF11+. ```CFScript cfloop(query=q, group="fk") { writeOutput("#fk#"); } ``` -------------------------------- ### Tag Syntax Example 3 Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/imageaddborder.md Create the border. ```javascript ``` -------------------------------- ### Get list of errors Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the list of errors using the cfadmin tag. ```html ``` -------------------------------- ### Get Debugging List Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the debugging list using the cfadmin tag. ```html ``` -------------------------------- ### Write a string to the output stream "Hello World" Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/systemoutput.md Example of writing a string to the output stream. ```javascript systemOutput("Hello World"); ``` -------------------------------- ### Trim example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/trim.md An example of using the trim function. ```javascript '>' & trim(' CFDocs ') & '<' ``` -------------------------------- ### If / else if / else Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/script.md Demonstrates conditional logic using 'if', 'else if', and 'else' in CFScript. ```CFScript count = 10; if (count > 20) { writeOutput(count); } else if (count == 8) { writeOutput(count); } else { writeOutput(count); } ``` -------------------------------- ### Get Debug Data Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting debug data using the cfadmin tag. ```html ``` -------------------------------- ### Example Usage Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/addsoapresponseheader.md Example of setting a username header and retrieving response headers. ```javascript ws = createObject("webservice", "http://localhost/soapheaders/headerservice.cfc?WSDL"); addSOAPRequestHeader(ws, "http://mynamespace/", "username", "tom", false); ret = ws.echo_me("argument"); header = getSOAPResponseHeader(ws, "http://www.tomj.org/myns", "returnheader"); XMLheader = getSOAPResponseHeader(ws, "http://www.tomj.org/myns", "returnheader", true); ``` -------------------------------- ### Get the datasource settings Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting datasource settings using the cfadmin tag. ```html ``` -------------------------------- ### Example 1: Using queryInsertAt Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/queryinsertat.md An example demonstrating the use of the queryInsertAt function. ```javascript qry=queryNew("rowid,name", "integer,varchar",[ [1, "Jay"],[2, "Bob"],[3, "Theodore"],[4, "William"] ]); rufus=QueryNew("rowid,name","integer,varchar",[[42,"Rufus"]]); queryInsertAt(qry,rufus,3); WriteDump(qry); ``` -------------------------------- ### Get an admin contextes Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting admin contexts using the cfadmin tag. ```html ``` -------------------------------- ### Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/array.md Creates and dump a new array. ```javascript exampleArray = Array("example-string", 1, {structExample = "value"}, [1,2,3]); dump(exampleArray); ``` -------------------------------- ### Basic Example Source: https://github.com/cfmleditor/cfdocs/blob/master/assets/vendor/plugins/split-pane/README.md A basic HTML and JavaScript example demonstrating how to set up and use the split-pane plugin. It includes CSS for styling and JavaScript for initialization. ```html Basic Example
This is the left component
This is the right component
``` -------------------------------- ### Get the Component admin Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the admin component using the cfadmin tag. ```html ``` -------------------------------- ### Get the application settings Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting application settings using the cfadmin tag. ```html ``` -------------------------------- ### Get the application listener Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the application listener using the cfadmin tag. ```html ``` -------------------------------- ### Basic Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfclient.md A very basic example demonstrating the usage of the cfclient tag. ```html #myvar# ``` -------------------------------- ### Generate a private key Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command to generate a private key for SSL/TLS configuration. ```bash cfroot\jre\bin\keytool -genkeypair -alias certificatekey -keyalg RSA -validity 7 -keystore keystore.jks ``` -------------------------------- ### Example Usage Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/querycolumncount.md An example demonstrating how to use queryColumnCount to get the number of columns in a new query. ```javascript myQuery = queryNew("ID,name,age"); writeOutput( queryColumnCount( myQuery ) ); ``` -------------------------------- ### Changing Permissions for Installation File Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md This command grants executable permissions to the installation file, which is necessary before running the installer. ```bash chmod 777 ColdFusion_11_WWEJ_solaris64.bin ``` -------------------------------- ### getTotalSpace in-memory example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/gettotalspace.md Example of using getTotalSpace to get in-memory space and outputting it in MB. ```ColdFusion total app ram memory: #decimalFormat(totalRamSpace)/(1024 * 1024)# mb ``` -------------------------------- ### Example Usage Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/entityloadbyexample.md An example of how to use the entityLoadByExample function with ColdFusion tags. ```cfml ``` -------------------------------- ### Full function example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/stringreduce.md Example demonstrating the full stringReduce function. ```javascript letters="abcdef"; closure=function(inp1,inp2){return inp1 & inp2;} writeOutput( StringReduce(letters,closure,"z") ); ``` -------------------------------- ### getCanonicalPath Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/getcanonicalpath.md Example of using getCanonicalPath to get the canonical path of the base template path. ```javascript writeOutput( getCanonicalPath(getBaseTemplatePath()) ); ``` -------------------------------- ### Non-Member Function Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/arrayfirst.md Example of using the non-member function to get the first item from an array. ```javascript seinfeldArray = ["Jerry","Elaine","Kramer","George"]; WriteOutput(arrayFirst(seinfeldArray)); ``` -------------------------------- ### Member Function Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/arrayfirst.md Example of using the member function to get the first item from an array. ```javascript someArray = [1,2,3,4]; WriteOutput(someArray.first()); ``` -------------------------------- ### Full stringEach function example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/stringeach.md Example demonstrating the full stringEach function. ```javascript letters="ahqwz"; callback=function(inp){ writeoutput(inp == "q");} StringEach(letters,callback); ``` -------------------------------- ### isIPV6 Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/isipv6.md An example of how to use the isIPV6 function. ```javascript isIPV6("127.0.0.1"); ``` -------------------------------- ### Member function example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/stringeach.md Example demonstrating the string.each member function. ```javascript letters="ahqwz"; letters.each(function(inp){writeoutput(inp == "q");}); ``` -------------------------------- ### Get Sunday with French Locale Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/dayofweekshortasstring.md Example of getting the short string for Sunday using the French locale. ```javascript dayOfWeekShortAsString(1,"fr") ``` -------------------------------- ### Formatting examples Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/decimalformat.md Examples demonstrating the usage and output of the decimalFormat function with various numeric inputs. ```javascript formattedInt = decimalFormat(123); // 123.00 writeOutput(formattedInt & "
"); formattedWithSeparators = decimalFormat(1000000); // 1,000,000.00 writeOutput(formattedWithSeparators & "
"); formattedDecimal = decimalFormat(987.15); // 987.15 writeOutput(formattedDecimal & "
"); formattedRoundedUp = decimalFormat(456.789); // 456.79 - rounds up writeOutput(formattedRoundedUp & "
"); ``` -------------------------------- ### Simple queryRowData example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/queryrowdata.md Example to get a particular row value from a query using the queryRowData function. ```javascript ``` -------------------------------- ### Script Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/structreduce.md An example demonstrating the script syntax for structReduce. ```javascript rainbow = { "Red"="Whero", "Orange"="Karaka", "Yellow"="Kowhai", "Green"="Kakariki" }; ui = structReduce( rainbow, function(previousValue, key, value) { return previousValue & "
#key#
#value#
"; }, "
" ) & "
"; writeDump(rainbow); writeOutput(ui); ``` -------------------------------- ### Example Usage Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/gettagdata.md An example of how to call getTagData to get information about the cfmail tag. ```javascript getTagData('cf','mail') ``` -------------------------------- ### Tag Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/imagegetiptctag.md Example of retrieving the camera make using imageGetIPTCtag. ```cfml ``` -------------------------------- ### Create a Directory (Script Syntax) Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfdirectory.md Example of creating a directory using script syntax. ```html directoryCreate(expandPath("./new_directory")); ``` -------------------------------- ### Basic Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/getdirectoryfrompath.md Demonstrates how to use getDirectoryFromPath to extract a directory from a path. ```javascript getDirectoryFromPath("C:\temp\file.txt") ``` -------------------------------- ### Get the admin Default Password Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the default admin password using the cfadmin tag. ```html ``` -------------------------------- ### Get the custom tag setting Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting a custom tag setting using the cfadmin tag. ```html ``` -------------------------------- ### StringLen() Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/stringlen.md Output the length of the string "Hello World" using StringLen(). ```javascript StringLen("Hello World") ``` -------------------------------- ### Tag Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/callstackget.md This example demonstrates the tag syntax for computing the factorial of a number, including error handling. ```cfm #cfcatch.message#
#cfcatch.detail#
``` -------------------------------- ### Get the custom tag mappings Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting custom tag mappings using the cfadmin tag. ```html ``` -------------------------------- ### Get the admin char set Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the admin character set using the cfadmin tag. ```html ``` -------------------------------- ### Get smallest numeric value of an array Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/arraymin.md Example of using arrayMin to get the smallest numeric value of an array. ```javascript someArray = [23,45,87,2,4]; writeOutput(arrayMin(someArray)); ``` -------------------------------- ### QueryLazy Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/querylazy.md This example demonstrates how to use the querylazy function to execute a query without loading the data entirely to memory. ```javascript records = 0 queryLazy( sql="SELECT * FROM users;", listener=function(row){ // Do something with a query row records++; }, options={ datasource:"MyDatasource" } ); echo("Records: #records#"); ``` -------------------------------- ### Simple Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/arrayeach.md A simple example demonstrating the usage of arrayEach. ```javascript letters = ["a","b","c","d"]; arrayEach(letters, function(element,index) { writeOutput("#index#:#element#;"); }); ``` -------------------------------- ### Restarting ColdFusion on Windows Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command to restart ColdFusion on Windows. ```bash coldfusion.exe -restart -console ``` -------------------------------- ### Tag Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/imagesetbackgroundcolor.md Example showing how to set the background color, and then draw a rectangle on an image filled with that color. ```javascript ``` -------------------------------- ### Get the datasource drivers available Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the list of available datasource drivers using the cfadmin tag. ```html ``` -------------------------------- ### Script Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/callstackget.md This example demonstrates the script syntax for computing the factorial of a number, including calls to callStackGet() to show the call stack at different points. ```cfm numeric function factorial(n) { if (n == 1) { writeDump(callStackGet()); writeOutput('
'); return 1; } else { writeDump(callStackGet()); writeOutput('
'); return n * factorial(n-1); } } factorial(5);
``` -------------------------------- ### Simple rowData example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/queryrowdata.md Example to get a particular row value from a query using script syntax with the rowData method. ```javascript var myQuery = queryNew("id,title,author","integer,varchar,varchar",[[1,"Charlottes Web","E.B. White"],[3,"The Outsiders","S.E. Hinton"],[4,"Mieko and the Fifth Treasure","Eleanor Coerr"]]); writeDump(myQuery.rowData(3)); ``` -------------------------------- ### Web Server Configuration Tool - Apache Commands Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command-line options for configuring and unconfiguring Apache web servers with the Web Server Configuration Tool. ```bash (Windows only) wsconfig.exe ws apache dir (Linux or MAC only) ./wsconfig ws apache dir ``` ```bash (Windows only) wsconfig.exe ws apache dir bin /httpd script /apachectl (Linux or Mac only) ./wsconfig ws apache dir bin /httpd script /apachectl ``` ```bash (Windows only) wsconfig.exe -ws apache dir -cluster (Linux or MAC only) ./wsconfig -ws apache dir -cluster ``` ```bash ./wsconfig -remove ws apache dir ``` ```bash ./wsconfig -remove ws apache dir bin /httpd script /apachectl ``` -------------------------------- ### monthShortAsString Script Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/monthshortasstring.md An example of using monthShortAsString in a script, showing how to get the short string for a month and output it. ```javascript getVal = monthShortAsString(3); writeOutput(getVal); ``` -------------------------------- ### Create a Directory (Tag Syntax) Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfdirectory.md Example of creating a directory using tag syntax. ```html ``` -------------------------------- ### Basic cfgrid example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfgrid.md This is a very simple demonstration of a working grid without using a query. ```html ``` -------------------------------- ### Compress a directory Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/compress.md Compress the "example-directory" to a zip-file. ```javascript compress("zip", "example-directory", "output.zip") ``` -------------------------------- ### Get the admin default security manager Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Example of getting the default admin security manager using the cfadmin tag. ```html ``` -------------------------------- ### Simple encodeForJavaScript Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/encodeforjavascript.md A simple example demonstrating the usage of encodeForJavaScript. ```javascript encodeForJavaScript("foo()") ``` -------------------------------- ### Run a function asynchronously and get the result Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/runasync.md This example demonstrates how to run a function asynchronously and retrieve its result using the get() method. ```javascript future = runAsync(function(){ return "Hello World!"; }); writeOutput(future.get()); ``` -------------------------------- ### Script Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfstoredproc.md Example of calling a stored procedure and getting multiple result sets using script syntax. ```html cfstoredproc( procedure="spu_my_storedproc",datasource="myDSN" ) { cfprocparam( cfsqltype="cf_sql_date", value=myDateParam ); cfprocresult( name="qSummary", resultset=1 ); cfprocresult( name="qDetails", resultset=2 ); } ``` -------------------------------- ### Tag Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfstoredproc.md Example of calling a stored procedure with a parameter and getting a result set using tag syntax. ```html ``` -------------------------------- ### Script Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/directoryexists.md Checking if a directory called 'icons' exists and then creating the directory if it does not exist. ```javascript if (!directoryExists(expandPath('/assets/img/icons'))) { directoryCreate('assets/img/icons'); } ``` -------------------------------- ### Example Usage Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/structequals.md An example demonstrating the usage of structEquals with two configuration objects. ```javascript config1 = {a:0, b:0}; config2 = {a:0, b:1}; writeOutput( structEquals(config1, config2) ); ``` -------------------------------- ### Simple QueryCurrentRow Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/querycurrentrow.md An example demonstrating how to get the currentRow number using the queryCurrentRow function in CFML. ```cfml #queryCurrentRow(myQuery)# ``` -------------------------------- ### Script Syntax Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cflog.md An example of using the writeLog function, which is equivalent to cflog in script syntax. ```html writeLog(text = "Logging some info.", type = "information", application = "no", file = "myLogFile"); ``` -------------------------------- ### space.cfm Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/getfreespace.md Example demonstrating how to use getFreeSpace to get and display free RAM and disk space. ```javascript Free Application RAM Memory = #decimalFormat(freeRAMSpace / (1024 * 1024))# MB
Free Hard Disk Space = #decimalFormat(freeDiskSpace / (1024 * 1024 * 1024))# GB ``` -------------------------------- ### bitMaskSet with Non-Zero Mask Start and Length Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/bitmaskset.md Example of using bitMaskSet with non-zero start and length parameters for the mask. ```javascript bitMaskSet(10, 2, 1, 2) ``` -------------------------------- ### Member Function Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/arrayeach.md An example demonstrating the usage of the member function 'each'. ```javascript a = ["a","b","c"]; a.each(function(element,index,array){ writeOutput("#index#:#element#;"); }); ``` -------------------------------- ### bitMaskSet with Non-Zero Start Parameter Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/bitmaskset.md Example of using bitMaskSet with a non-zero start parameter, demonstrating bit shifting. ```javascript bitMaskSet(10, 1, 2, 1) ``` -------------------------------- ### Combined Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/queryexecute.md Complete example showing use of an sql statement, query parameters using Struct of Structs, while specifying the datasource . ```javascript sql = "SELECT * FROM Employees WHERE empid = :empid AND country = :country"; qparams = structNew(); qparams.empid = { value=1, cfsqltype="cf_sql_integer" }; qparams.country = { value="Canada", cfsqltype="cf_sql_varchar" }; options = { datasource="myDataSourceName" }; qryResult = queryExecute(sql, qparams, options); ``` -------------------------------- ### Example Usage Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/fileopen.md Opens a file, reads a line, and then closes it. ```javascript // Open File var fileObject = fileOpen("/path/to/file.txt"); // Perform Actions try { // Read Line writeOutput(fileReadLine(fileObject)); } // Error Handling catch(any ex) { // Report Exception writeDump(ex); } // Always Close finally { // Close File fileClose(fileObject); } ``` -------------------------------- ### Simple currentRow Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/querycurrentrow.md An example demonstrating how to get the currentRow number from a query using script syntax in CFML. ```cfscript var myQuery = queryNew("id,title","integer,varchar",[[1,"Charlottes Web"],[3,"The Outsiders"],[4,"Mieko and the Fifth Treasure"]]); cfloop(query = "myQuery"){ if (title Eq "Mieko and the Fifth Treasure"){ writeOutput(myQuery.currentRow()); } } ``` -------------------------------- ### Simple queryGetCell (getCell) Script Based Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/querygetcell.md Example to get a particular column (title) value in script syntax using getCell. ```javascript var myQuery = queryNew("id,title","integer,varchar",[[1,"Charlottes Web"],[3,"The Outsiders"],[4,"Mieko and the Fifth Treasure"]]); writeOutput(myQuery.getCell('title',2)); ``` -------------------------------- ### Current Hour of the day Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/hour.md Example of getting the current hour of the day. ```javascript hour( now() ) ``` -------------------------------- ### Simple encodeForDN Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/encodefordn.md A simple example demonstrating the usage of encodeForDN. ```javascript encodeForDN("x,y") ``` -------------------------------- ### Hidden Form Field Encryption Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/guides/security-encryption.md An example demonstrating how to obfuscate form field names and encrypt form field values for enhanced security. ```ColdFusion myKey = 'tf0wcU7556DTt0ftUSkWOZlk82FkL7acSCnsCuWPHZ8='; myAlgorithm = 'BLOWFISH/CBC/PKCS5Padding'; myEncoding = 'HEX'; writeOutput( "" ); ``` -------------------------------- ### Usage Example Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/getsafehtml.md Demonstrates the usage of the getSafeHTML function. ```javascript ``` -------------------------------- ### Run a function after the asynchronous function and use a five milliseconds timeout when calling get() Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/runasync.md This example shows how to chain functions using then() and apply a timeout to the get() method. ```javascript future = runAsync(function(){ return 5; }).then(function(input){ return input + 2; }); result = future.get(3); // 3 is timeout(in ms) writeOutput(result); ``` -------------------------------- ### Web Server Configuration Tool - IIS Commands Source: https://github.com/cfmleditor/cfdocs/blob/master/guides/en/installCF/install.md Command-line options for configuring and unconfiguring IIS web servers with the Web Server Configuration Tool. ```bash wsconfig.exe -ws iis -site ``` ```bash wsconfig.exe -ws iis -site ``` ```bash wsconfig.exe -ws iis -site -cluster ``` ```bash wsconfig.exe -remove -ws iis -site ``` ```bash wsconfig.exe -remove iis -site ``` -------------------------------- ### Scripted Tag Syntax Example (Lucee) Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfstoredproc.md Example of calling a stored procedure and getting multiple result sets using scripted tag syntax for Lucee. ```html cfstoredproc( procedure="spu_my_storedproc",datasource="myDSN" ) { procparam( cfsqltype="cf_sql_date", value=myDateParam ); procresult( name="qSummary", resultset=1 ); procresult( name="qDetails", resultset=2 ); } ``` -------------------------------- ### Example Usage Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/functions/minute.md Demonstrates how to extract the minute from a datetime object. ```javascript dt = createdatetime(2016,1,1,5,30,25); m = minute( dt ); writeoutput( m ); ``` -------------------------------- ### Get extensions Source: https://github.com/cfmleditor/cfdocs/blob/master/docs/tags/cfadmin.md Retrieves a list of all installed extensions for web or server. ```html ```