cfftp listdir

I've recently found cfftp tag in existing project. Honestly, I'm so far to use this tag and ignored wherever I found here and there. Now, I must need to know how does it work and how useful it for CF developer. Unfortunately, I didn't found enough documentation in Adobe CFML documentation. That's why I need to try to test it by myself by reading Adobe CFML documentation. First of all, we need to open FTP connection when we start using this tag.

view plain print about
1<cfftp action="open" connection="conn" username="[ur_username]" password="[ur_password]" server="[ur_ftp_server]">

Above coding, you will see "action, connection, username, password and server". action = "open" it helps us to open FTP connection. connection = "ur_ftp_connection_name" it's just name username / password = your ftp server's authentication server = "ftp.server.com" it's for your server is on Live server "my_FTP" it's for local development just like intranet.

view plain print about
1<cfftp action="listdir" connection="conn" name="myftpList" directory="getImages">
2<cfdump var="#qryName#">

Above coding stands for retrieving folders and files of FTP root. action = "listdir" it helps us to retrieve folders and files from this ftp root. connection = "[ur_ftp_connection_name]" the name when you open FTP connection. name = "[output_ftp_data]" The name of your FTP Query. Directory = "[directory_name]" The directory folder which you want to display. After using FTP, we need to close our existing FTP connection like that.

view plain print about
1<cfftp action="close" connection="conn">

action = "[close]" Close our ftp connection. connection = "[ur_ftp_connection_name]" the name of FTP which you open.

cffunction with extra space

Honestly, I didn't recognize "output" attribute of cffunction and I rarely use this attribute most of my UDF. Currently, I know how useful this attribute once I use UDF in input. If we don't assign "output" in cffunction, you will get extra space once you use this cffunction in input. If we want to use cffunction in input,  we need to assign "output=false" in cffunction.

Incredible CFZip

I'm now oddly crazy over Coldfusion because they let me develop what I want to. Among Coldfusion's core tags, cfzip is included as one of the incredible tags. You need to write a lot of coding more than Coldfusion if you want to retrieve the information of files in win-zip. Likewise, unzip to zip file also. In Coldfusion, need to write  only 2 or 3 lines CFML coding for this case.

Retrieve file information from zip file

view plain print about
1<cfset dirPath = GetDirectoryFromPath(GetCurrentTemplatePath())>
2<cfzip file="c:/myApp.jar" action="list" name="entry">
3<cfdump var="#entry#">
Unzip to zip file
view plain print about
1<cfset dirPath = GetDirectoryFromPath(GetCurrentTemplatePath())>
2<cfzip file="#dirPath#cfform_fileUpload.zip" action="unzip" destination="#dirPath#" />

Google App Engine with Coldfusion

Today I'm quite satisfied of what I did. Because I can run and deploy Coldfusion Application in Google App Engine with OpenBlueDragon. It's cool that we don't need to buy Coldfusion Server if we want to host our Coldfusion project. It's 100% FOC just like PHP. Unfortunately, 10% of Coldfusion function and tags are not supported in OpenBlueDragon. I've developed RSS Feed reader project and hosted it in Google App Engine

view plain print about
1<cfset source = "http://www.ppshein.net/rss.cfm" />
2<cfhttp url="#source#" />
3<cfset myBlogXMLDoc = xmlParse(cfhttp.filecontent) />
4<cfset BlogNodes = xmlSearch(myBlogXMLDoc,'/rss/channel/item') />

Above coding stands for fetching data from my blog. In Adobe Coldfusion, to read data from RSS, we can use but in OpenBlueDragon, supports only for Create action. That's why I used with .

view plain print about
1<cfoutput>
2    <cfloop from="1" to="10" index="i">
3    <!---
4        The array contents need to parsed
5        so you can easily get '
6        at the child nodes children and attributes.
7    --->

8    <cfset BlogXML = xmlparse(BlogNodes[i]) />
9    <div id="title">#BlogXML.item.title.xmlText#</div>
10    <div id="date">#BlogXML.item.pubDate.xmlText#</div>
11    <div id="description">#BlogXML.item.description.xmlText#</div>
12    <div id="link"><a href="#BlogXML.item.link.xmlText#" target="_blank">Read More</a></div>
13    </cfloop>
14</cfoutput>

Above coding stands for displaying Blog entities from my blog. You can see example here. It's not my wordpress blog. It's just clone.

Configure CF9 multi-instance in window 2008 (64 bit)

Today, I need to configure coldfusion9 multi-instance in window 2008. It's my first time to do in my developer life. In this case, my  so-called senior showed me how to configure multi-instance in window 2008. I don't know how's complicated in CF7 and CF8. But in CF9, it's quite easy if you know that. Ok, let's go. First of all, you need to choose number two option (multiserver configuration) when you start installing CF9. Then, proceed as usual installation. After installing, open Coldfusion administration. Scroll down left-side bar and go to ENTERPRISE MANAGER > Instance Manager. After that, click on New Instance Button regarding following screen (screen - 1).

After that, Add New Coldfusion Server form will be came out. And fill all needed information like following screen (screen - 2). Server Name is your new instance name. Just give "Demo" as your new instance name.  Server Directory is where you want to put your application folder. I think, the rest information are just optional.

After creating new instance, open IIS and get ready to create new website (screen - 3).

After that, you need to fill all needed information for new website as following screen (screen - 4). In this screen, just give "Demo" as your new website name. For Physical Path,  choose the path where you stored your application folders. Then you need to assign Port. Default port is 80 but oddly you can't use this port because default website is already used this port number. So you need to choose another port 81 as example.

After that, go to Start Menu and find Web Server Configuration Tool. If you can't get it into Start Menu, go like following hierarchy Start Menu > All Programs > Adobe > Web Server Configuration Tool (screen - 5).

After that, you will get following screen (screen - 6). In this screen, you will get Web Server Configuration box then click Add button.

Then, you need to fill all needed information into this box (screen - 7). You don't need to change for JRun Host. JRun Server dropdown, you will see "Admin", "Cfusion" and "Demo". You need to choose "Demo" because it's either your new instance or new website. In Web Server, you don't need to choose other web servers because you will need to use IIS as our Default Web Server. In IIS Website, you will see "All" and "Demo". In this case, you need to choose "Demo" as your website. After that, click Ok button. After that, prompt will display that you need to restart your website. Don't worry click "OK" as restarting your website.

After After all, open your Internet Explorer and type "http://localhost:81" then your website will be coming up smoothly. And, open Task Manager and to go Process tab, then will see new process is running as your website. How's easy.!! Special thanks to Mr_Nil who also guide me about that.

Coldfusion vs PHP

Today, I feel like myself to compare about Coldfusion vs PHP. It's for neither debate nor competition. It's just for sharing advantages and disadvantages of them as much as I know.

Coldfusion

Advantages

  • easy to develop
  • easy to use very nice built-in functions
  • easy to integrate with other Adobe's products (flex, air ...)
  • has other CFML servers like Bluedragon and SmithProjects

Disadvantages

  • expensive hosting
  • less resources
  • not wide environment

PHP

Advantages

  • All are free
  • tons of resources
  • wide environment

Disadvantages

  • need to write so many lines
  • not that much easy to integrate with Adobe's products
  • not that much easy to integrate with .NET libraries

Resources : http://stackoverflow.com/questions/234296/coldfusion-vs-php

http://www.adobe.com/devnet/coldfusion/articles/php_cfmx.html

ListChangeDelims

I've downloaded all of coldfusion 8 functions and printed out to put my wall for ACE coldfusion 8 exam. Sometimes, I just read through and test how does it work. Among them, ListChangeDelims is one of the coolest functions of Coldfusion 8 list function. Using this function is to replace new delimiter into old one. Oddly, it looks alike Replace function of Coldfusion but pretty different. Replace function is useful for string, paragraph and so on. ListChangeDelims is just for List (please point me out if you know more).

view plain print about
1<cfset oldlist = "pps|ppshein|pyaephyoeshein">
2<cfset newlist = ListChangeDelims(oldlist, "-", "|")>
3<cfoutput>#newlist#</cfoutput>

Internal 500 error CF9 on Window 2008

Today is my first time to install Coldfusion 9 into Window 2008 server. When I was in myanmar, to install cf8 in window 2000 or 2005 is quite easy to install and to configure website in older IIS. In window 2008, everything are new such as IIS, security and so on. So, I need to install cf9 into 2008. After installing in window 2008, everything is so smooth. Once I browse Coldfusion Administrator, I encounter the weird problem. That's Internal Server Error like following image.

That's why I browse for seeking some solution how happen like that. This 500 status code most likely causes:

  • IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
  • IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
  • IIS was not able to process configuration for the Web site or application.
  • The authenticated user does not have permission to use this DLL.
  • The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

That's why I think of it might be cause of whether my window's system type or not. So, I decided to empathize to solve this system type. Lately, I found that I need to "Enable 32-bit applications" to "true".

After change it, everything is as smooth as lace now..!!

Coldfusion with RIA

I'm not sure whether I've posted about this website or not in my past. But, it's not boring whenever I return to this site, Asfusion. Because I love all of their GUI and flash form. In these days, GUI is one of the needed facts in our application. That's why almost enterprise keep designing the best GUI. When you promote your application, the first impression is GUI not  your function. That's why your client won't know how much your back-up function is incredible or not. These are one of the best RIA screenshot created with Coldfusion.

Convert to Ordinal Format

Today, I need to develop one simple CFML UDF, which convert numeric format to Ordinal format. It's just simple UDF but useful for future my projects.

Coding

view plain print about
1<cffunction name="convertOrdinal" returntype="string" output="false">
2    <cfargument name="inputInt" required="yes" type="numeric" />
3    <cfparam name="OrdFormat" default="">
4    <cfsilent>
5        <cfif inputInt MOD 10 EQ 1 AND inputInt MOD 100 NEQ 11>
6            <cfset OrdFormat = "st" />
7        <cfelseif inputInt MOD 10 EQ 2 AND inputInt MOD 100 NEQ 12>
8            <cfset OrdFormat = "nd" />
9        <cfelseif inputInt MOD 10 EQ 3 AND inputInt MOD 100 NEQ 13>
10            <cfset OrdFormat = "rd" />
11        <cfelse>
12            <cfset OrdFormat = "th" />
13        </cfif>
14        <cfreturn TRIM(inputInt & OrdFormat) />
15    </cfsilent>
16</cffunction>

Usage

view plain print about
1<cfoutput>#convertOrdinal(1)#</cfoutput>

Top of Page