CFEclipse is a community project that builds on the open-source Eclipse framework to deliver expert, code-centric developers a new option for ColdFusion development. CFEclipse provides Eclipse with an outline view, a CFC (ColdFusion component) view, code completion (code hinting), syntax highlighting text editors for CFML and CFC files, and many more ColdFusion-specific features.

Eclipse can be downloaded from http://www.eclipse.org and CFEclipse from http://www.cfeclipse.org.

One thing CFEclipse does not have is WYSIWYG ability. Its complete focus is on writing ColdFusion code (so-called hand coding) and building tools that help you write code. If you do a lot of visual or page-layout development, for instance, if you rely heavily on drag-and-drop tools, wizards, or the Design view in Macromedia Dreamweaver, CFEclipse may not be the tool for you.

However, to make your life easier when coding, below is a list of keyboard shortcuts that make common tasks available in a couple of keystrokes:

Keys Description
Key Shortcuts
Ctrl+Shift+L Key Assist (dialog windows)
Alt+Shift+Q Show View
Comments
Ctrl+Shift+M ColdFusion Comment <!--- --->
Ctrl+Shift+C Context sensitive comment
Surround Selection
Ctrl+3 Pound/hash marks ##
Ctrl+’ Single quotes ''
Ctrl+Shift+” Double quotes ""
Ctrl+Shift+O <cfoutput></cfoutput>
Ctrl+Shift+D <cfdump var="##">
Ctrl+Shift+R <cfscript></cfscript>
Insert
Ctrl+Enter <br/>
Ctrl+Shift+Space &nbsp;
Ctrl+Shift+P <p></p>
Ctrl+I <em></em>
Ctrl+B <strong></strong>
Edit
Alt+Up or Alt+Down arrow Moves the current line up or down
Ctrl+Alt+Up or Ctrl+Alt+Down Duplicates line above/below current
Shift+Enter Insert line below current line
Ctrl+Shift+Enter Insert line above current line
Ctrl+D Deletes current line
Ctrl+Delete Delete next word
Ctrl+Backspace Delete previous word
Ctrl+Shift+Delete Delete to end of line
Function Keys
F1 Tag/function reference at http://www.cfdocs.org
F5 Refresh browser view
F8 Scribble pad
Ctrl+F3 Surround with ##
Ctrl+F5 Reload dictionaries
Ctrl+F6 Switch editor
Ctrl+F7 Switch view
Ctrl+F8 Switch perspective
Search / Find
Ctrl+H Search
Ctrl+F Find
Ctrl+K Find next
Ctrl+Shift+K Find previous
Browsing
F12 View current page in browser
Shift+F12 View current page in secondary browser
F5 Refresh internal browser
Shift+F5 View current page in internal browser
Ctrl+Shift+F5 View project root in internal browser
Windows / Navigation
Ctrl+Shift+R Opens the Open Resource (while in Navigator)
Ctrl+E List open files, then start typing the name
Ctrl+F6 Tab back through open files
Ctrl+Shift+F6 Tab forwards through open files
Ctrl+M Maximise/Minimse Current window
Miscellaneous
Tab Indent code
Shift+Tab Un-indent code
Ctrl+L Goto line number
Ctrl+Q Repeat last tag
Ctrl+Shift+Z Insert Color

Sweatshop is the leading specialist running retailer in the UK with 29 stores and 6 websites. We organise 2 of the largest road races in the UK and have been in business since 1971.

Sweatshop Logo

Over the next 18 months Sweatshop is looking to dramatically develop its websites, road races and retail operation. We are looking for key personnel to take the business forward as we intend to treble the size of the company in the next 5 years.

Objectives:
To improve the profitability and efficiency of the business by developing applications as required, and give the business much better access to the information it currently holds.

Role:
This role will involve re-authoring existing websites and helping to drive innovative new ideas and concepts throughout the business. This is a fantastic opportunity to drive the online side of the business forward.

Responsibilities:

  • Build web and IT automation to improve process and capability of the company.
  • Support and improve existing developments.
  • Build and implement new website functionality.
  • Build robust & scalable applications.
  • Build reports for existing systems.
  • Work with the senior management team to develop new business ideas.
  • Work with business users to specify and document requirements.
  • Estimate and report on effort required for all projects.
  • Communicate with business users and management, progress on all projects.
  • Manage own time effectively.

Qualifications:
A graduate calibre candidate with an appropriate technical qualification.

Essential Technical Skills:
Coldfusion technology, MS SQL server and MySQL, PHP, JavaScript, HTML, ASP, VB6/VB.net, Crystal reports.

Experience:
3+ years commercial development work including some time within an e-commerce environment or working for an established FMCG company.

Attributes:
Good communicator, Analytical, Ability to work on own initiative, Self starter.

Interested candidates:
If you’re interested and share the company values of ground breaking customer service, integrity, success, teamwork and the welfare of staff, write to:

Sarah Whatley, Sweatshop, 12 Station Road, Hampton, Middlesex TW12 2BX or
email HR@Sweatshop.co.uk

Salary:
£36k+ £40k+ (negotiable dependent on skills and experience)

The THIS scope in the Application.cfc contains several built-in variables that allow you to set the properties of the application; the name, session management etc. With the release ColdFusion 8 comes the introduction of application-based pathing in the form of the THIS.mappings and THIS.customTagPaths variables.

The THIS.mappings variable can specify a structure that contains ColdFusion mappings. These settings take precedence over the mappings defined by ColdFusion Administrator Server Settings > Mappings page for the current application. Each structure element consists of the logical path as the key and the absolute path as the value. To use this variable, you must set the Enable Per Application Settings option on the ColdFusion Administrator Server Settings > Settings page.

For example:

<cfset THIS.mappings['/com'] = "C:\Inetpub\com" />

This is syntactically equivalent to using the structInsert() function:

<cfset structInsert(THIS.mappings, '/com', 'C:\Inetpub\com') />

The THIS.customTagPaths variable can specify a list that contains ColdFusion custom tag paths. These settings take precedence over the custom tag paths defined by the ColdFusion Administrator Server Settings > Mappings page for the current application. To use this variable, you must set the Enable Per Application Settings option on the ColdFusion Administrator Server Settings > Settings page.

For example:

<cfset THIS.customTagPaths = "C:\Inetpub\wwwroot\myAppOne\customTags" />

Since we can specify a list, this is also valid:

<cfset THIS.customTagPaths = "C:\Inetpub\wwwroot\myAppOne\customTags,C:\Inetpub\wwwroot\myAppTwo\customTags" />

Alternatively, we could represent the list as:

<cfset THIS.customTagPaths = "C:\Inetpub\wwwroot\myAppOne\customTags" />
<cfset THIS.customTagPaths = listAppend(THIS.customTagPaths, "C:\Inetpub\wwwroot\myAppTwo\customTags" />

For a long time, ColdFusion developers have needed the ability to define application-level settings actually in the application itself. These two new application-based pathing variables bring the ColdFusion developer a step closer to being able to produce out-of-the-box applications that can install in shared environments with little fuss and, more importantly, without the need to access the ColdFusion Adminsitrator to create the necessary mappings and custom tag paths.

Download the SQL Server 2005 JDBC Driver 1.2, a Type 4 JDBC driver that provides database connectivity through the standard JDBC application program interfaces (APIs) available in J2EE (Java2 Enterprise Edition).

This release of the JDBC Driver is JDBC 3.0 compliant and runs on the Java Development Kit (JDK) version 1.4 and higher. It has been tested against all major application servers including BEA WebLogic, IBM WebSphere, JBoss, and Sun.

Arrays and Structures are considered to be complex data types in ColdFusion. In contrast, simple data types are ones that contain a single piece of data, such as an Integer, String, or Boolean value. A complex data type can contain multiple pieces of data, which, in the case of arrays, are usually related. All the data are referenced under a single variable name. You can think of a complex variable as a variable that contains a collection of other variables inside it. An array maps Integers to arbitrarily typed objects (Integers, Strings, Booleans and Objects) while a structure, or associative array, maps arbitrarily typed objects to arbitrarily typed objects.

Arrays and structures are also known as reference types. A reference is an object containing information which refers to data stored elsewhere, as opposed to containing the data itself. References are fundamental to constructing many data structures and in exchanging information between different parts of a program. References increase flexibility in where objects can be stored, how they are allocated, and how they are passed between areas of code. As long as we can access a reference to the data, we can access the data through it, and the data itself need not be moved. They also make sharing of data between different code areas easier; each keeps a reference to it.

Array and structure reference types are pointers to a memory space. Pointers are the most primitive and error-prone but also one of the most powerful and efficient types of references, storing only the address of an object in memory. Because arrays and structures are pointers to a space in memory, it allows for easy copying of that data. However, when copying an array or structure, there is a distinct difference between how the copy is performed. This difference relates to the concepts of shallow and deep copying.

When copying an array, a deep copy is performed by ColdFusion. This means that the data is copied and a reference to the new copy is created in memory. Therefore, following the example below, a change in the value held at position 1 of array b will not over-write the value held in position 1 of array a as they have different memory references:

<cfscript>
	a = arrayNew(1);
	a[1] = 100;
	b = a; //deep copy for Array
	b[1] = 500;
	writeOutput(a[1]); // the returned result is 100
</cfscript>

We can also use the little-known Java function equals() to demonstrate that the two arrays are not equal (the references are different).

<!--- 
the following returns false
a and b do not refer to the same object
 --->
<cfdump var="#a.equals(b)#">

This is not the case for a structure. When copying a structure, as in the example below, a shallow copy is performed by ColdFusion. This means that a change in b.name will also result in a change of a.name:

<cfscript>
	a = structNew();
	a.name = "Simon Whatley";
	b = a; //shallow copy for Struct
	b.name = "John Doe";
	writeOutput(a.name); // the returned result is John Doe
</cfscript>

Using the equals() method, we can show that the two structures refer to the same object:

<!--- 
the following returns true
a and b refer to the same object
 --->
<cfdump var="#a.equals(b)#">

However, by using the duplicate() function, a deep copy of a structure can be performed:

<cfscript>
	a = structNew();
	a.name = "Wu Mingshi";
	b = duplicate(a); //deep copy for Struct
	b.name = "Ivan Ivanovic";
	writeOutput(a.name); // the returned result is Wu Mingshi
</cfscript>

The above code results in two structures being created.

Arrays and structures although similar, behave very differently. Both are known as reference types which refer to a pointer in memory. Both have the ability to contain multiple values underneath a single variable name. Both use an index to access an individual value, but the index is numeric for arrays and a arbitrary, text value for structures. Arrays are extremely useful for numeric calculations, tabular data, and data sorting. Structures, by their nature, cannot be sorted by value, only by key name. They are commonly for related data, where order is not important and direct access to an individual element is important. Many of ColdFusion’s variable scopes (such as server, application, variables, session, form etc) can be accessed as structures.

New Atlanta is announcing today, at CFUnited Europe, a ColdFusion technology conference in London, U.K., that they will be creating and distributing a free open-source Java Platform, Enterprise Edition (Java EE) version of BlueDragon, their ColdFusion-compatible web application server.

You can read the full release here:

http://www.newatlanta.com/products/bluedragon/open_source/faq.cfm

Will Adobe follow suit with their ColdFusion server technology? They have done similar things with the BlazeDS, so it stands to reason that ColdFusion could follow the same route.

Terrence Ryan sees things differently, however, and has a good article here:

Yawn, BlueDragon Goes Open Source.

In an earlier post I eluded to the implicit creation of arrays in ColdFusion 8. Well, the same can be said of structures.

A structure, also known as an associative array, is a complex data type composed of a collection of keys and a collection of values, where each key is associated with one value (a key-value pair). The operation of finding the value associated with a key is called a lookup or indexing, and this is the most important operation supported by a structure. The relationship between a key and its value is sometimes called a mapping or binding. For example, if the value associated with the key “Age” is 29 and “City” is “London”, we say that our structure maps “Age” to 29 and “City” to “London”.

Using structures, you can call the array element you need using a string rather than a number, which is often easier to remember. The downside is that these aren’t as useful in a loop because they do not use numbers as the index value.

We can think of an address book as a good example of a structure. The classic way of creating and assigning key-values pairs to a structure, in earlier versions of ColdFusion, would be as follows:

<cfscript>
strPerson = structNew();
strPerson.firstName = "Jean";
strPerson.lastName = "Dupont";
strPerson.city = "Paris";
</cfscript>

Or an alternative method uses array-notation to create the necessary key-value pairs:

<cfscript>
strPerson = structNew();
strPerson["Firstname"] = "Hans";
strPerson["Lastname"] = "Mustermann";
strPerson["Country"] = "Germany";
</cfscript>

NB. When using the array-notation, the key names keep their case. However, running the following code results in the value “France” being overwritten with “Germany”, even though the key name is a different case. This serves to highlight that ColdFusion is not case-sensitive.

<cfscript>
strPerson = structNew();
strPerson["Country"] = "France";
strPerson["COUNTRY"] = "Germany";
</cfscript>

Implicit Structures

With the introduction of implicit structures in ColdFusion 8, the creation of structures is greatly simplified. For example, rather than having to use the structNew() function, we can now simply do the following:

Using strings for values:

<cfscript>
myStruct = {firstname="Simon", lastname="Whatley", city="London"};
</cfscript>

Implicit Structures - Strings as Keys and Values

Using integers for values:

<cfscript>
myStruct = {account_no=12345678, sort_code=123456};
</cfscript>

Implicit Structures - Integers as Values

Using integers as keys:

This example most closely represents an array since arrays have numeric keys.

<cfscript>
myStruct = {10001="John", 10002="Doe", 10003="New York"};
</cfscript>

Implicit Structures - Integers as Keys

The integer could represent the unique identifier of an object, for example, user ID or order ID. Therefore, if we had nested structures like below, 10001 would be the ID of Simon Whatley, whilst 10002 would be the ID of John Doe.

<cfscript>
myStruct1 = {firstname="Simon", lastname="Whatley", city="London"};
myStruct2 = {firstname="John", lastname="Doe", city="New York"};
myStruct3 = {10001=myStruct1, 10002=myStruct2};
</cfscript>

Implicit Structures - Nested Structures

Mixed data types:

It is possible to mix the data types in an structure. For example, we can use an Integer, String and Array as elements within an array, with no problems. Since we need to know the key name before accessing the value, it is also likely we will know the type of the value and will be able to handle it accordingly. However, never assume this is always the case, so type checking is necessary when retrieving the data.

The example below demonstrates the ability to add arrays to structures.

<cfscript>
myArray1 = [1,2,3];
myArray2 = ["One","Two","Three"];
myStruct = {array1=myArray1, array2=myArray2};
</cfscript>

Implicit Structures - Nested Arrays

Structures, by their nature, cannot be sorted by value, only by the key name. They are best for related data, where order is not important and direct access to an individual element is important. Many of ColdFusion’s variable scopes can be accessed as structures, for example, Server, Application, Session and Variables etc.

Words of Caution

Implicit structures do have their limitations. For example, you cannot nest implicit struct, or indeed array, creation.

<cfscript>
myStruct1 = {
	myStruct2 = {
		firstName = "Jean",
		lastName = "Dupont",
		country = "France"
	},
	myStruct3 = {
		firstName = "Juan",
		lastName = "Pablo",
		country = "Spain"
	}
}
</cfscript>

The above will throw the following parsing error:

coldfusion.compiler.ParseException: 
Invalid CFML construct found on line 3 at column 10.

UPDATE: The recent ColdFusion Update now includes the ability to nest implicit structures.

To get around this problem, you can create each structure individually and then use the structure as the value in a key-value pair (as seen in the nested structure example above).

A (possible) strength of ColdFusion is that you can add key-value pairs as many times as is necessary. This is the same for explicit and implicit structure creation. However, the following code and screenshot serves to demonstrate that whether you explicitly or implicitly create a structure, if you duplicate a key, the last key-value pair in the sequence is the one that is represented in the structure:

<cfscript>
myStruct = {
	firstName = "Jean",
	lastName = "Dupont",
	country = "France",
	country = "Germany"
};
</cfscript>

Implicit Structures - Duplicate Keys

A great new feature of ColdFusion 8 is its new implicit creation of Arrays and Structures. In addition to the updates to operators in ColdFusion, those of you familiar with JavaScript will recognise and welcome these changes.

An array is a data structure consisting of a group of elements that are accessed by indexing. In most programming languages each element has the same data type. However, ColdFusion, as we will see, is not strictly typed and therefore allows any data type to be stored in combination. This allows strings, integers, booleans and other complex data types all to be stored in the same array. However, doing this certainly isn’t a good practice as it causes signification complication when accessing the stored data.

Variables of a simple data type commonly only store a single value but, in some situations, it is useful to have a variable that can store a series of related values - using an array. Arrays are described as complex data types because they can hold data in a structured, complex way.

For example, suppose a routine is required that will calculate the average age among a group of six students. The ages of the students could be stored in six integer variables, added together and then divided by 6:

<cfscript>
age1 = 19;
age2 = 20;
age3 = 21;
age4 = 22;
age5 = 23;
age6 = 18;
 
average_age = (age1 + age2 + age3 + age4 + age5 + age6) / 6;
 
writeOutput(average_age); // returns 20.5
</cfscript>

However, a better solution would be to store the data in a six-element array and calculate the average age based upon the sum or the ages and the array length:

<cfscript>
age = arrayNew(1);
age[1] = 19;
age[2] = 20;
age[3] = 21;
age[4] = 22;
age[5] = 23;
age[6] = 18;
 
sum_age = 0;
 
//loop over the age array adding age together all ages
for (i = 1; i <= arrayLen(age); i++)
{
    sum_age += age[i];
}
 
//calculate the average age
average_age = sum_age / arrayLen(age);
 
writeOutput(average_age); // returns 20.5
</cfscript>

This is a few more lines of code, but allows for the flexibility of increasing or decreasing the number of elements (in this case ages) in the array, with no impact upon the core calculation.

NB: Unlike other programming languages, ColdFusion array indexes start from 1 not 0 (zero).

Implicit Arrays

With the introduction of implicit arrays in ColdFusion 8, the creation of arrays is greatly simplified. For example, rather than having to use the arrayNew(1) function, we can now simply do the following:

<cfscript>
myArray1 = [1,2,3]; //integers
</cfscript>

Implicit Arrays - Integer Example

This means that we can take the age calculation from ealier, and make the code even simpler to write:

<cfscript>
//implicity create the age array
age = [19,20,21,22,23,18];
 
sum_age = 0;
 
//loop over the age array adding age together all ages
for (i = 1; i <= arrayLen(age); i++)
{
    sum_age += age[i];
}
 
//calculate the average age
average_age = sum_age / arrayLen(age);
 
writeOutput(average_age); // returns 20.5
</cfscript>

Further examples

The following code snippets serve to exemplify my earlier comment that arrays can store any data type and indeed, any data type in combination.

Using strings:

<cfscript>
myArray2 = ["One","Two","Three"]; //strings
</cfscript>

Implicit Arrays - String Example

Using complex data types:

<cfscript>
myArray3 = [myArray1,myArray2]; //complex types (arrays)
</cfscript>

Implicit Arrays - Variables Example

Using implicit structures:

<cfscript>
myStruct1 = {firstname="Simon", lastname="Whatley", city="London"};
myStruct2 = {firstname="John", lastname="Doe", city="New York"};
myArray = [myStruct1, myStruct2];
</cfscript>

Implicit Arrays - Complex Example

The last two examples above serve to demonstrate that any complex data type can be used in conjuction with an array. This has not changed between ColdFusion version 7 and 8.

Mixing data types:

Although certainly not good practice, it is possible to mix the data types in an array. For example, we can use an Integer, String and Array as elements within an array, with no problem. However, it is when accessing this data that problems will arise.

<cfscript>
myArray4 = [1,"Two",myArray2];
</cfscript>

Implicit Arrays - Combined Example

Although the ColdFusion engine is not strict with regard to what data types are used within an array, always stick to the same type for each element.

Words of Caution

Implicit arrays do have their limitations. For example, you cannot nest implicit array, or indeed struct, creation.

<cfscript>
arrayOne = [
	arrayTwo = [1,2,3],
	arrayThree = [4,5,6]
]
</cfscript>

The above will throw the following parsing error:

coldfusion.compiler.ParseException: 
Invalid CFML construct found on line 3 at column 13.

UPDATE: The recent ColdFusion Update now includes the ability to nest implicit arrays.

In arithmetic and algebra, when a number or expression is both preceded and followed by a binary operation (a calculation involving two operands), a rule is required for which operation should be applied first. From the earliest use of mathematical notation, multiplication took precedence over addition, whichever side of a number it appeared on. Thus 3 + 4 × 5 = 5 × 4 + 3 = 23.

Operator precedence, therefore, determines the order in which operators are evaluated in a statement. Operators with higher precedence are evaluated first.

A simple example can be expressed as follows:

<cfscript>
x = 3 + 4 * 5;
writeOutput(x); //returns 23
</cfscript>

This is equivalent to wrapping the 4 * 5 in parentheses:

<cfscript>
x = 3 + (4 * 5);
writeOutput(x); //returns 23
</cfscript>

If we switched the parentheses, the result returned would be entirely different:

<cfscript>
x = (3 + 4) * 5;
writeOutput(x); //returns 35
</cfscript>

This is an important point to note. Operators have an order of precedence, but this can be overridden using parentheses. Statements within parentheses are always evaluated first, before moving on to the outer statements.

Associativity

The concept of Associativity determines the order in which operators of the same precedence are processed. For example, consider the following expression (where OP stands for order of precedence):

a OP b OP c

Left-associativity (left-to-right) means that it is processed as:

(a OP b) OP c

Right-associativity (right-to-left) means it is interpreted as:

a OP (b OP c)

The following table details operators order of precedence:

Precedence Operator type Associativity Individual operators
1 increment n/a ++
decrement n/a
2 logical-not right-to-left !
unary + right-to-left +
unary negation right-to-left -
3 multiplication left-to-right *
division left-to-right /
modulus left-to-right %
4 addition left-to-right +
subtraction left-to-right -
5 relational left-to-right <
<=
>
>=
6 equality left-to-right ==
!=
7 logical-and left-to-right &&
8 logical-or left-to-right ||
9 assignment right-to-left =
+=
-=
*=
/=
%=
&=

Summary

Warning: Multiplication and division are of equal precedence, and addition and subtraction are of equal precedence. Using any of the above rules in the order addition first, subtraction afterward would give the wrong answer to

10 - 3 + 2

The correct answer is 9, which is best understood by thinking of the problem as the sum of positive ten, negative three, and positive two.

10 + (-3) + 2

It is usual, wherever you need to calculate operations of equal precedence to work from left to right. The following rules of thumb are useful:

First: perform any calculations inside parentheses (brackets)

Second: Next perform all multiplication and division, working from left to right

Third: Lastly perform all addition and subtraction, working from left to right

However, with experience, the commutative law, associative law, and distributive law allow shortcuts. For example,

17 x 24 / 12

is much easier when worked from right to left, where here the answer is 34.

GeSHi started out as a module for the phpBB forum system to enable highlighting of programming languages, which was largely unavailable at the time. Since its conception it has spawned into a standalone project, supported by many web-based PHP content management systems.

Since I’m a ColdFusion developer, it was necessary to write a language reference file for ColdFusion and in particular, version 8.

You can download the file (30KB) here and upload it into your website’s GeSHi folder. You will need to rename it to cfm.php.

By including the content between a set of pre tags, <pre lang=”cfm”></pre>, GeSHi will implement the correct syntax for ColdFusion.

« Older entries § Newer entries »