ColdFusion 8 cfinterface Example - Using An Interface In CF 8

Introduction

ColdFusion 8 added the cfinterface tag, which enables CF developers to use interfaces in their applications. Interfaces specify one or more functions that a ColdFusion component must implement. Coming from being a Java programmer to primarily doing ColdFusion web application development, I missed using interfaces. To help me learn how to use the new cfinterface tag, I implemented the SimUDuck application from chapter 1 of Head First Design Patterns. You can download the code (see the references below) for the application. I'll briefly walk through how cfinterface works.

[More]

Adding Percentages To A Chart Created With ColdFusion

My boss wanted me to add percentages to a chart I built using ColdFusion. I researched the CF cfchart and cfchartseries tags in the CF documentation online to see if there was some way to get CF to do this for me. I didn't find any attributes that did that. So I spent a couple of hours adding code to do the math for me and display the percentages as part of each bars label. Later I learned I wasted my time!

[More]

ColdFusion Structures and Associative Array Notation

I recently had to create a bar chart in ColdFusion using a structure data type. To make it easy to display each bar's label I used the associative array notation for the key names when I created my structure. The associative array notation enables your structure keys to "contains spaces, numbers, or special characters." (Reference 1). I've forgotten in the past that this alternative way of specifying structure keys is available in ColdFusion so this blog entry will remind me (and maybe others) about the associative array notation for structures.

[More]

Troubleshooting A Problem In Flex With Relating An ActionScript Class To A ColdFusion CFC

I recently discovered the solution to a problem I was having relating an ActionScript class to a ColdFusion CFC. To troubleshoot the problem, I created a very simple test application. In the test application, I have a Person CFC and a PersonServices CFC. The PersonServices CFC has methods that return a single Person object and an array of Person objects. On the Flex side, I have a Person ActionScript class that matches up with the Person CFC.

Initially, during my testing, the object returned by the CFC function was not being automatically cast to the correct ActionScript class type in Flex even though I had created the matching ActionScript class. Rather the type returned by the CFC was only recognized as a generic Object in my Flex application (instead of the Person ActionScript type it should have been).

[More]

Developing A Login System For A Flex Application With A ColdFusion and Database Backend Part 1

Introduction

At work, I'm developing a Flex intranet company newsletter application. One of the first parts of the application is a login for users. To document what I'm learning as I design this application, I'm starting a series of blog entries on creating a Flex application that uses a login system tied to a database backend to authenticate a user before showing the user the main application. I will start from scratch and post a series of articles on how I designed this login system.

[More]

Using A ColdFusion Structure To Create A Chart

I needed to create a chart showing our meeting registrations. Previously, I was just listing the numbers. However, the CFC function that provided me the data I was using to just list the numbers was a structure where the keys were the meeting codes and the values for the keys were the number of people registered.

At first I thought I would have to build another CFC function to return a query with a count of each meeting's registrations to use the cfchartseries tag's query attribute. But after thinking and experimenting a bit I figured out a way to use the structure I already had as the basis for the chart.

[More]

Grouping ColdFusion Query Results On Multiple Columns

I needed to display the results of a ColdFusion query grouped by the person's last name, then grouped by the person's areas of experties, and then by the roles for each area. I knew that the group attribute of the cfoutput tag allowed you to group the output (see ColdFusion 7 Online Documentation), but I thought--incorrectly-- that you could only group on one of the query columns.

[More]

Login and Logout Flex Example That Uses ColdFusion CFLogin and CFC Role Security

This example of using Flex to login/logout users and specify user roles in combination with ColdFusion's CFLogin tag on the backend is based on work done by Ray Camden (see: http://ray.camdenfamily.com/index.cfm/2006/11/25/Last-build-of-my-Flex-2ColdFusion-Security-Homework) and includes material provided in comments to Ray's blog entry by Todd Sharp and Kevin Schmidt.

The goal of this example is to allow users to login to a Flex application and after the user has successfully logged in for the Flex application to provide functionality based on the user's role. The application uses CFLogin on the backend to check the user's login information and log the user in. CFLoginUser allows you to set a role for the logged in user that CF can then check before running a CFC function with roles specified. Our Flex application can send the login credentials each time we call a CFC function. CF can use those credentials (username/password) to ensure the caller has the role that is allowed to call the CFC function.

[More]

Don't Use Delete for a CFC function Name if You Want to Call The Function From Flex

I was creating a new Flex 2.0 application using CFC's to do the create, read, update, and delete work in the database. While testing the delete CFC function from within Flex I got a syntax error when compiling if I tried to do ProgramDAO.delete( aProgramObj ).

delete is apparently a keyword in ActionScript (the word shows up blue in Flex Builder) and cannot be used as a function name even if the function is in a CFC.

[More]

Use ColdFusion Function Return Type of XML to Provide XML to Both Spry and Flex

This blog entry discusses how I create a function that queries a database, transforms the query results into XML, and returns the XML in a format that can be used by either Spry (pre-release version 1.3) or Flex 2.0. ColdFusion 7 added a return type of XML (see: ColdFusion 7 documentation). However, I've had to experiment some to get my CFC functions to return XML that can be used by both Spry and Flex 2.0.

[More]

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner