ColdFusion server not so expensive

I often hear one objection to using ColdFusion is that it is necessary to buy the server software.

Good news. Now that ColdFusion is owned by Adobe, companies that have a discount account with Adobe also get a discount on CF server.

I learned this on a discussion list and have not had a chance to verify with Adobe.

ColdFusion MX 7 & MySQL Connection on Windows & Linux

As you know ColdFusion & MySQL connection is a bit tricky. There is a Technote from Adobe. But I also want to give some simple tips.

You can check my simple tutorial via "http://www.howtoforge.com/coldfusion7_mysql4.1_connection".

Restarting Server by ColdFusion

Sometimes we may need to restart our server because of some problems. Specially on windows based servers this would be headache if you have a remote server. Mainly we can use tools like "Terminal Services", "PC Anywhere", or "VNC" etc. But there would be also to reach these interfaces.

I would like to suggest a simple page which may help to restart you server via ColdFusion.

We can use command line as following via CFEXECUTE tag.

<cfexecute
   name="C:\Windows\system32\shutdown.exe"
   arguments="-r -f">

</cfexecute>

In case of not having "shutdown.exe" in some systems, we can use also IIS to restart the server as following.
<cfexecute
   name="C:\Windows\system32\iisreset.exe"
   arguments="/reboot">

</cfexecute>

What you can do is put this code somewhere in the server with password protection (of course!) and running them if you need to restart the server.

Getting Java System Information

As you know ColdFusion is based on Java. If we would like to have some more information about using the Java platform we can use the following code.

<cfset SysJVM = CreateObject("java", "java.lang.System").properties>
<cfoutput>
   <cfloop collection="#SysJVM#" item="id">
      <strong>#id#</strong>: #SysJVM[id]# <br />
   </cfloop>
</cfoutput>


What I Do After First Dreamweaver Installation

I have just formatted my drive C after having a new hard disk and installed everything again and again. Of course Dreamweaver is also installed from scratch. After starting Dreamweaver for the first time I need to set some settings. Here is what I do after a new Dreamweaver installation.

  • First I am a ColdFusion/Flex developer and I prefer code environment.

  • Then "Edit-> Preferences" and some "must have" changes.
    • Code Hints: "After typing the open tag's. ">"."
    • New Document: "Default document -> ColdFusion template", "Default encoding -> Unicode", check for "Include Unicode Signature (BOM)".
    • Validator: XHTML 1.0 transitional

  • and some other stuff which are not so important but would be good for me.
    • General: check for "Reopen documents on startup"
    • Code Coloring: ColdFusion (this selection was a bug and do not work on every Dreamweaver installation)
    • Code Format: check for "Automatic wrapping"


  • If you have other initial setup for CF in Dreamweaver, please share with us.

SQL tricks - creative JOINs with legacy data

Have you ever needed to extract data from old tables and use it in a way the table designer never planned on? This seems to be an all-too-common experience.

Recently, I learned that I could parse a number out of a string field, cast it as an integer, and actually use that result in a JOIN (as if it were a foreign key) to another table's integer primary key. Here is the JOIN part of my query:

...
inner join listings as list
on list.listing_id =
CAST ( RIGHT(op.description,(LEN(op.description)-CHARINDEX(':',op.description))) AS integer )

A few years ago, before I began to understand the power of SQL, I would have done something like this by hand in Excel. Details of the problem and solution are included below if you'd like to read on ...

[More]

Regular expression to search for FORM and CFFORM tags

Recently I needed to go through a large body of code, checking all forms to be sure they met certain requirements. There was a lot of old ColdFusion code, written by many different people over a period of years. I didn't have one single string to search on, and wanted to find them all in one search.

Solution: I wrote a regular expression that allowed me to search for all <form> or <cfform> tags, regardless of case, using my favorite extended search utility, Homesite's Extended Find.

It's a fairly simple regular expression, but it was a big deal for me because (1) it worked! and (2) I figured out how to write it, so now I know I can write another one when I need it. Here it is:

[<]([cC][fF])?[fF][oO][rR][mM][[:space:]]
For those not familiar with searching by regular expressions in Homesite, it's the same as a normal Extended Find, but you check the box for Regular Expression so it treats your search text as a pattern, not a literal.

If anyone knows how to make the same search work in Dreamweaver or in CFEclipse, would you please post a comment here for everyone? It may be due to different RegEx syntax or other issues, but I'm not sure how to do this outside of HomeSite. Awaiting your reply ....

Multi Version of Internet Explorer on Same PC

When you need to test a web page with multiple browsers in order to get the page rendering the same, there are some limitations. Normally, there can be only one installed version of Internet Explorer on one PC.

But there are some different ways of having multiple Internet Explorer versions on one PC. The easy way is getting "standalone" Internet Explorer files. You can get different IE versions from following web site (unofficial, of course) and put them in their own directories and run as you need.

http://browsers.evolt.org/?ie/32bit/standalone

Programming Language Inventor test

Sometimes when spending hours fixing a bug it seems that programming language inventors have fedishly clever minds designed to torture us programmers. Can you tell the difference between programming language inventors and serial killers?

http://www.mattround.freeserve.co.uk/files/killerquiz.swf

Simple Unicode Tips

Here are some simple tips that would be helpful while working with Unicode data.

- While registering Microsoft SQL Server Database, please be sure to check "Enable Unicode for data sources configured for non-Latin characters" setting in ColdFusion DSN settings.
MS SQL Server Un'code setting in CF Admin

- If you are using MS SQL Server, use "nvarchar", "nchar" etc. for text fields.

- If you are using MySQL, use "utf8" as main encoding for tables.

    CREATE TABLE unicode_stuff (
    ...
    ) CHARACTER SET utf8;

- Use "cfqueryparam" in SQL queries.
    <cfquery name="getData" datasource="cfdocexamples">
       SELECT    FirstName,
             LastName
       FROM   employees
       WHERE   LastName = <cfqueryparam value="#LastName#" cfsqltype="CF_SQL_VARCHAR">
    </cfquery>

- Use a Unicode capable editor such as Dreamweaver or Eclipse. Do not use Homesite or CFStudio for projects that we need Unicode support.

Adobe TechNote: Unicode issues in HomeSite/HomeSite+ 5.5
http://www.adobe.com/go/tn_19059

- Save your files in "Unicode" and BOM (Byte Order Mark) enabled. This is possible in any text editor such as Notepad or in Dreamweaver. BOM is important for Unicode text that we have direct as static content in our files.
DW Unicode Page

- Use meta tag to have Unicode support.
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

- Try to use standard coding such as XHTML.
<!DOCTYPE html PUBLIC "Çspan style='color: #808080'ÈÇemÈ-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Ç/emÈÇ/spanÈ<html xmlns="http://www.w3.org/1999/xhtml">
...

BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner
Home | About Us | Software Development | Server Optimization | Client Portfolio | Training | Contact Us

Copyright © TeraTech Inc 2007. All rights Reserved.
TeraTech Inc 405 E Gude Dr Suite 207, Rockville MD 20850 | MAP Map | Tel.: +1 (301) 424 3903 | Fax: +1 (301) 762 8185 | Contact Us