InvalidTag

8 July 2007 01:42 (EST)
Today I was trying to post YouTube video code with another blog, but got object html tag replaced with InvalidTag string. After googling a bit following solution comes through: set scriptprotect="none" with your cfapplication tag to disable Global Script Protection which is enabled by default in your CFMX server. Another way to disable this option is to use CF Admin.

More information on this issue available at Adobe LiveDocs.
Tags coldfusion cfmx server trick

Variables Naming Conflict

27 June 2007 01:28 (EST)
Recently I had a chance to play a bit with Facebook API, which uses REST-based interface. There is ColdFusion client library developed by Andrew Duckett and called Facebook REST Client CFC and CFMX Facebook Application Starter example written by Cory Johnson.

While developing application with use of FBML instead of IFRAME (which works just fine) Facebook server has started throwing "http error 500" upon calls to Callback URL of my application. Source code of error page had details of the error commented out — "Form entries incomplete or invalid". ( read more on Variables Naming Conflict )

MySQL MyISAM vs InnoDB

13 June 2007 20:10 (EST)
Last month I have noticed that my blog is not showing up with Google search results. Using Google Webmaster Tools I have discovered multiple 403 (Access Forbidden) errors thrown by web server on Googlebot attempts to index website.

After small investigation I have figured out that my hosting provider (Hostingfuse) has blocked Googlebot crawler (without notifying me, thanks guys) due to website performance issues.

ColdFusion instance on the server was locking up and restarting every 5 minutes upon website indexing by Googlebot. Pages generation was extremely slow taking from 20 seconds up to 20 minutes to complete.

Reducing Googlebot crawling rate and pages caching did not help as server loading was still high, so after playing a bit with scripts and SQL queries I have noticed that MySQL database response time was ridiculously slow. By tweaking local MySQL instance, tables' structure and queries I found a solution in the end: switch tables type from InnoDB to MyISAM.

Now database taking less space on hosting server (MySQL official docs says: InnoDB tables require a lot more disk space than MyISAM tables) and queries are fast as they should be.

So, consider database type for each project separately, not sticking to your past experience, even if it was positive.

Smith goes Open Source

8 May 2007 22:25 (EST)
On 7th May 2007 youngculture AG decided to open source its ColdFusion Server "Smith".

Smith is an open source, cross-platform ColdFusion® engine, written entirely in Java. Running on top of Java Runtime Environment and Java Servlet Container, it can be virtually deployed on any operating system and work with any web server. Smith represents lightweight, yet reliable alternative to the existing ColdFusion® servers.


This is definitely one of the best news for CF community this year along with recent news about Adobe Flex soon to be open source and forthcoming release of Adobe ColdFusion 8.

OpenID CFC: Consumer v.0.2

8 May 2007 01:39 (EST)
New version (0.2) of consumer library for OpenID auth framework has been released tonight. This version has completely new structure, more transparent and easy to understand logic. Both 'smart' and 'dumb' modes are supported, few internal comments added.
Tags coldfusion cfc cfmx openid consumer

Null Character

6 May 2007 01:22 (EST)
It looks like ColdFusion interpret the null character as an empty string instead of a valid character.

What would you see by running the following code? Length of "test" string will be 6, instead of 7.
<cfset test = "123" & Chr(0) & "abc" />
<cfoutput>#Len(test)#</cfoutput>

So basically you are loosing null character. This might not be a problem in most of the cases, but becomes quite important issue for a specific tasks as encryption and decryption where you have to control all ASCII characters.

In order to solve the problem and get correct results you should use URLDecode("%00") function instead of Chr(0), like in this example below:
<cfset test = "123" & URLDecode("%00") & "abc" />
<cfoutput>#Len(test)#</cfoutput>

The length is 7 now!

How to compact MS Access database

16 April 2007 15:20 (EST)
This example works only if MS Access is installed on web server (but such case is not advised for security reasons):

<cfscript>
   caller.error = 0;
   if (not isDefined("attributes.database"))
      caller.error = caller.error + 1;
   else {
      if (not FileExists(attributes.database))
         caller.error = caller.error + 2;
      path = GetDirectoryFromPath(attributes.database);
      success = 0;
      while (success eq 0) {
         attributes.tempdatabase= path & randrange(1000,9999) & ".mdb";
         if (not FileExists(attributes.tempdatabase))
         success = 1;
      }
   }
   if (isDefined("attributes.backup"))
      if (FileExists(attributes.backupdatabase))
         caller.error = caller.error + 4;
</cfscript>

<cfif not caller.error>

   <cfif isDefined("attributes.backupdatabase")>
      <cffile action="copy" source="#attributes.database#" destination="#attributes.backupdatabase#" />
   </cfif>

   <cftry>
      <cfobject type="com" action="connect" name="objaccess" class="Access.Application" />
      <cfcatch type="Any">
         <cfset request.comerror = cfcatch.message />
         <cfset caller.error = 10 />
         <cfobject type="com" action="create" name="objaccess" class="Access.Application" />
      </cfcatch>
   </cftry>

   <cftry>
      <cfscript>
         objDBEngine = objaccess.DBEngine;
         temp = objDBEngine.CompactDatabase("#attributes.database#","#attributes.tempdatabase#");
      </cfscript>
      <cfcatch type="any">
         <cfset request.comerror = cfcatch.message />
         <cfif cfcatch.message is "">
            <cfset request.comerror = cfcatch.detail />
         </cfif>
         <cfset caller.error = 10 />
      </cfcatch>
   </cftry>

   <cfif FileExists(attributes.tempdatabase)>
      <cffile action="delete" file="#attributes.database#" />
      <cffile action="rename" source="#attributes.tempdatabase#" destination="#attributes.database#" />
   </cfif>

</cfif>

And make sure that database is not locked with CF server.

ColdFusion 8 "Scorpio" Beta

11 April 2007 12:45 (EST)
Applications for the Scorpio Beta are now being accepted.
Please visit Adobe Prerelease Program and click on "Join Adobe Prerelease Program Now".
Tags coldfusion beta prerelease

Remove HTML from a string

8 March 2007 11:17 (EST)
REReplaceNoCase(string,"<[^>]*>","","ALL")
Tags coldfusion html strip tags

cfDecrypt

8 March 2007 11:14 (EST)
cfDecrypt is an utility to decrypt (decode) .cfm files encrypted with cfCrypt (cfEncode) program included in ColdFusion.
Tags coldfusion file decrypt cfdecrypt
Pages   ← previous   next
1 2 3 4