Tech Sharing

Tech Sharing

Advertisement

Posts Tagged ‘ Coldfusion ’

Loop Over ColdFusion Structure

By on December 30, 2011

Just a quick reference on how to loop over a structure without knowing its keys. By the loop, you may also convert the structure

.

<cfset aaaa.ab1 = '111'>
<cfset aaaa.ab2 = '222'>
<cfset aaaa.ab3 = '333'>
<cfset aaaa.ab4 = '444'>

<cfset logcontent = "">
<cfloop list="#structKeyList(aaaa)#" index="key">
<cfoutput>
<cfset logcontent = logcontent & "(" & #key# & ": " & #aaaa[key]# & ")">
</cfoutput>
</cfloop>

<cfdump var="#aaaa#">

Useful Coldfusion Resources

By on November 24, 2011

This list is intended for developers new to ColdFusion, or to developers already using CF but looking for additional resources or information.

Adobe ColdFusion Resources

 

ColdFusion Documentation

 

Essential Resources

 

ColdFusion IDEs

 

Open Source CFML Engines

 

MVC Frameworks

 

ORM and Dependency Injection Frameworks

Hardening ColdFusion Server E-Book

By on September 23, 2011

This is a very good tips from Pete Freitag on how to hardening your ColdFusion server. This E-Book include some important topic such as:

  • Installation Tips
  • ColdFusion Administrator Settings
  • Sandbox Security
  • Hiding Version Information
  • Overview of Web App Firewalls
Hardening Coldfusion Powerpoint (477)

 

 

 

Just came back from long valentine holiday and get the complaint from my colleague that they never received the schedule task report for few days. But when I check in our system, all the data and report successfully run as per scheduled.


After Google for a while, found some blogger discuss about this issue where the problem come from the CFMail spooling. Basically this is because of ColdFusion server loses it’s connection to the mail server momentarily or the mail server authentication fail due to some small problem, you can easily find out this problem from the CFIDE mail.log.


I also Google the solution to resolve this issue as the step is pretty simple but you may need to take down ColdFusion services for a moment so that the file lock is deleted. Here are the few simple step that help you to spool our your stuck email.


1. Cut and paste all .cfmail files from the spool folder into a temporary folder at any where of your server.

2. Restart the Coldfusion services.

3. Drag the .cfmail files from your temporary folder back into spool folder at about 200 message at a time, waiting for the email to be process and moving in another batch for process again.


Normally as the adminitrator or developer, you will not notice this issue until your client complaint that they never received certain email for sometime, or you may need to check your mail.log regulary to see is any issue exists for your cfmail tag to deliver the email.


Hope this help.

Pausing scheduled tasks in CF8

By on January 14, 2011


This is a pretty good function for CF8 administrator where you can pause your schedule task whenever you like to. Not like the previous version of Coldfusion where the administrator only can only edit or delete the scheduled task.


With this function exists, you can pause it wihtout editing anything like what you did last time by changing the url to something else or change to date to expire the scheduled task.




Currently on running schedule task display



Currently pause scheduled task display



CFMX 6.1 scheduled task display without the pause and resume button




Last whole week working with a project which involve the integration with 3th party API through the HTTPS secure channel using coldfusion CFHTTP. I come across with the following error message:


I/O Exception: peer not authenticated


Try to Google it for some time and find out that I need to import the 3th party certificate into my Coldfusion server by using some keytool certificate import tools. Trying few times but still can’t get it work until I found a blog which showing a very effective way and free tools for import the certificate.


These instructions are for Windows based machines but the concepts and tools should work on Mac or Unix based platforms.


1. Install tools

Download and install Portecle JVM certificate manager

(portecle-1.5.zip) You do not need the source (src) version

https://sourceforge.net/projects/portecle

The easiest way to install Portecle is to unzip the contents of the zip file to a directory such as C:Program Filesportecle-1.5 Then find the file “Portecle.jar”, right click it and send it to your desktop as a shortcut. You can then use this shortcut to launch Portecle. (optionally you can also change the name of the shortcut and change the icon to use the portecle.ico file for the icon)


2. Extract the certificate

The easy way to get the certificate is ask from the issuer, but if you unable to do so, you may have another alternative solution which you open the https page in your browser and double click on the lock logo at bottom left of the browser (the lock appear just beside the url addrss for Google Chrome)


Double click on the lock –> click the certificate information button –> go to details –> click the copy to file button –> Follow the wizard and select the base-64 encoded X.509 (.cer) format –> save the file


3. Install Certificate to Java Virtual Machine and/or ColdFusion server

Start Portecele.

On the [File] menu, select [Open Keystore File] navigate to and locate the keystore you are interested in.

For many java installations this will be located in your “jrelibsecurity” directory and might be named “cacerts”

For the ColdFusion 8 default developer install the path will be “c:coldfusion8runtimejrelibsecuritycacerts”

You will have to enter the password for the keystore. The default password is “changeit”


Now you are ready to import the key.

From the [Tools] menu select [Import Trusted Certificate]

Navigate to and locate the certificate you saved and click [Import]

You will need to reenter the keystore password.

You can change the alias if you desire but I would recommend leaving it as the default

Note: You may also be prompted to “trust” the certificate.


Click on the save button at the top of the portecle


4.       Restart you Java Virtual Machine/coldfusion application server.

For ColdFusion not installed on top of JRun you just need to restart the ColdFusion service. If you are running on top of JRun you also need to restart JRun.


Up to now, you already successfully import your partner certificate to your coldfusion/java server.


Please feel free to leave your suggestion if any. Click here for more information regarding Protecle


That’s nothing perfect in the world, no matter how good the application and web site is, that’s still some hole that we may need to handle. By handling that kind of hole, we try to make our application close to perfect.


This powerpoint show that Why we need the error handling, What are error, how the error being handled, type of error, type of error handling.


Advanced ColdFusion - Error Handling (534)


Error Catching with CFERROR and CFCATCH (712)

Get the array lenght in Coldfusion

By on September 4, 2009

When dealing with array, we cannot run away for looping. Because only with looping, you can cut short your hard coded script to read the value from array. And also you no need to worry about the dynamic of array.


Arraylen is the function that determines the number of elements in an array.


The syntax is ArrayLen(array)


Code

<!— Assigning value into 3D array —>

<cfset ResultsArray[1][1][1] = ‘a’>
<cfset ResultsArray[1][1][2] = ‘b’>

<cfset ResultsArray[1][2][1] = ‘3’>
<cfset ResultsArray[1][2][2] = ‘4’>

<cfset ResultsArray[2][1][1] = ‘z’>
<cfset ResultsArray[2][1][2] = ‘x’>

<cfset ResultsArray[2][2][1] = ‘m’>
<cfset ResultsArray[2][2][2] = ‘p’>

<cfset ResultsArray[3][1][1] = ‘ww’>
<cfset ResultsArray[3][1][2] = ‘xx’>

<cfset ResultsArray[3][2][1] = ’22’>
<cfset ResultsArray[3][2][2] = ‘cc’>


<!— Read the array lenght for 1st D, 2nd D, and 3th D —>
<cfoutput>
#ArrayLen(ResultsArray)#<br> <!— Get the lehgth of 1st D —>
#ArrayLen(ResultsArray[1])#<br><!— Get the lehgth of 2nd D —>
#ArrayLen(ResultsArray[1][1])#<br><!— Get the lehgth of 3th D —>
</cfoutput>