Archive | ColdFusion

Creating Customs Tags in Coldfusion; An example

Mon, Oct 20, 2008

Comments

ColdFusion Image
In this example I will show you how to create a Custom tag in ColdFusion. The idea of a Custom tag is to allow you to package chunks of code into reusable modules that you can then reuse through out your project. They are similar to UDF (User Defined Functions) with the exception that Custom tags are self-contained, have a specific purpose and goal-oriented. In addition, one does not have to understand how exactly the Custom Tag works, all you do is plug in the variables and watch the tag do it’s work.
(more…)

Continue reading...

Passing Paramaters using HTTPService in Flex to ColdFusion

Sun, Sep 21, 2008

Comments

http Passing Paramaters using HTTPService in Flex to ColdFusion
This Example involves passing parameters from Flex to ColdFusion and then having ColdFusion Process what we need and sending it back to flex via flashvars. The HTTPService class is much slower than say using the RemoteObject class or even the WebService class but If you are not doing any heavy lifting like this example then you should not be seeing any performance difference. Instead of a CFC file we use a CFM file and the parameters being passed are actually in the URL of the CFM file and not to a function. For Example when You Enter your name it will be like http://mySite.com/myFile.cfm?yourName=ColdFusion. Click Here for the Example and the Source Code is Enabled.

Technorati Tags: ColdFusion CFM, flashvars, flex HTTPService Example, HTTPService Flex, RemoteObject, WebService

Continue reading...

RemoteObject Class in Flex and ColdFusion Example

Sun, Sep 21, 2008

Comments

remoteflex RemoteObject Class in Flex and ColdFusion Example
This Example uses the RemoteObject Class/MXML Tag in Flex to send some parameters to a ColdFusion CFC file, the ColdFusion CFC file then processes the parameters that Flex sent it then sends the results back which we display in Flex.  The Example is simple and straightforward and you can use this as a stepping stone to create bigger applications. You can, for example query up a Database from ColdFusion then have flex send some parameters which ColdFusion can take and determine for example to delete,insert,filter, something from the Database.  A couple of things you need to take note of. 1) You must set the destination=”ColdFusion” or you will get this error:

[RPC Fault faultString="[MessagingError message='The MessageAgent's destination must be set to send messages.']” faultCode=”InvokeFailed” faultDetail=”Couldn’t establish a connection to ””]

Also When you drill down to the CFC file make sure that you are Starting from where the root of your site is and to also include the src Folder in flex. So For Example myExample.src.ThisIsTheCFCFile, DO NOT put the .cfc Extension. Here is the Example, just type in Your First Name and Last Name and click Submit. Click Here for the Example and Right Click For the Source

Technorati Tags: CFC, CFM, CFML, ColdFusion, Flex, RemoteObject, RemoteObject Example

Continue reading...

New Forums for Flex, Flash, ColdFusion

Mon, Sep 1, 2008

Comments

texte New Forums for Flex, Flash, ColdFusion

I decided to make a forum (http://VadexFX.com) over the weekend for Flex, Flash, and ColdFusion since FlexCoders and other mailing lists that pertain to Adobe Technologies have started to see an increase of off-topic topics and so this should help reduce that. Also, I am not really a fan of mailing lists since you can’t post any code that is neither formatted nor able to search properly and easily find what you want. Now to not also alienate the people that like the mailing list format I am working on a plug-in for the forum that will let you subscribe to a forum or a thread in its whole and you can respond to it by email.

Also, there was a discussion a while ago about breaking up the FlexCoders into a smaller list so I made sub-forums for some of those, and everything is on one site so it won’t thin out the flex community. The plus side is that you can just visit certain forums that interest you. Signing up takes less than 20 seconds (I timed it) and you can post immediately after. Check it out and give your comments on it, the theme is simple and easy on the eye. This should be treated as a supplement to the other mailing- lists but not a replacement. Nearly all support questions or help will be on the forum for the tutorials I do. Site one more time is http://VadexFX.com

Continue reading...

Stopping and Starting ColdFusion 8 Services in Windows Via a Batch File

Wed, Jul 16, 2008

Comments

For me Jrun takes almost 500K memory when it is fully loaded, which is a waste of memory since I am not always programming ColdFusion so I decided to write 2 Batch Files to Start and Stop all ColdFusion 8 Services. Here is the Code

@echo off
echo Starting ColdFusion 8
echo ======================================================
net start "ColdFusion 8 Application Server"
net start "ColdFusion 8 ODBC Agent"
net start "ColdFusion 8 ODBC Server"
net start "ColdFusion 8 Search Server"
echo ======================================================
echo ColdFusion 8 Started


@echo off
echo Stopping ColdFusion 8
echo ======================================================
net stop "ColdFusion 8 Application Server"
net stop "ColdFusion 8 ODBC Agent"
net stop "ColdFusion 8 ODBC Server"
net stop "ColdFusion 8 Search Server"
echo ======================================================
echo ColdFusion 8 Stopped

The Files If you do not want to create them Click Here

Continue reading...

BlogStats Component Example Using Flex, ColdFusion, and LCDS

Wed, Jul 9, 2008

Comments

This component is similar to the WordPress Blog stats that shows you how many users visit your site a day. View Source is Enabled, only problem with it is it uses Application.cfc thus if I restart my server then all data is lost. If You want you can tie in a database end and have it work. If your download it then make sure to set the Gateway Instances. Gateway ID: BlogStats , Type:DataServicesMessaging and just navigate to the CFC file that is under exhd/cfc/BlogStats.cfc. Here is the example, to see it work in real time open two tabs, go into one tab and refresh say twice then navigate to the other tab and there should be a delay of around 8 seconds before it updates the count. http://sherifabdou.com/cfusion/BlogStatsExample/BlogStats.cfm

Continue reading...

understanding flex data management by using coldfusion livecycle

Sun, Jul 6, 2008

Comments

  • The Purpose of the Flex Data Management is to push data live and synchronize everything across the board with no HTTPservice requests or anything else that you have to do, everything happens in real time so you do not have to worry about a client not seeing up to date information. Ben Forta has a better explanation In this Tutorial I will show you how you can set it up and make everything work.
  • Here is the example. http://sherifabdou.com/cfusion/DataPushSample/DataPushSample.swf. This is more complicated than what I am going over but the Source View is available so you can download it and try it out. To understand the power of Data Management, you need to open the example in two tabs. Now In one Tab Click on the DataGrid to edit the Database and in the other Tab click on the same item you clicked in tab 1 to also edit it. Now You have two windows open, change the Description in the first tab and in the second tab but have them both be different descriptions. Now go back to the first tab and click save. Now go to the Second tab, if you did it correctly you should get a screen similar to this.09 understanding flex data management by using coldfusion livecycle
    • This Prevents the whole idea of racing where one information could be different from the other if two people are editing it at the same time

    (more…)

Continue reading...

Hardcoding The endpoint for AIR and ColdFusion Remoting.

Thu, Jun 5, 2008

Comments

If you are using Adobe AIR with ColdFusion Remoting and you notice that your file dropped the first letter from its name and you get and error sort of like this

RPC Fault faultString= “Send failed”
faultCode=”Client.Error.MessageSend”
faultDetail= “Channel.Connect.Failed error NetConnection.Call.Failed:

then include

<mx:RemoteObject
	  		 endpoint="http://localhost:8500/flex2gateway"/>
Continue reading...

Understanding the RemoteClass Metadata and its use in Flex and ColdFusion

Mon, Jun 2, 2008

Comments

Here is an example of how to use the RemoteClass metadata in Flex to map Actionscript objects that map directly onto ColdFusion Component that is found on a remote server. The data then can be converted to an Actionscript class with the appropriate properties and referenced in another actionscript class or MXML. My Workspace is under wwwroot/

Download Example

;
 
package vo
{
/**
* @private
* What we need to do is map on this actionscript file
* the coldufusion component, this is done by using the Remote
* Class Metadata tag. so [RemoteClass(alias="from(wwwroot Folder).path.to.coldFusionCFC")]
* Everything has to match exactly between the variables declared here and the coldFusion arguments
* that will be declared in the CFC file otherwise it will not work at all. ALso we want this class to be
* Bindable so we can show some information to know that it works
*/
[RemoteClass(alias="RemoteClassExample.src.cfc.cfcVO")]
[Bindable]
public class ColdFusionFlexVO
{
/**
* @private
* What we will be creating are simple variables to
* prove the point, this can be used for a registration form for example.
* Make Sure when you write in the Coldfusion component you use the same
* exact name, case does matter.
* Now Go to the cfcVO.cfc file under cfc
*/
public var firstName:String;
public var lastName:String;
public var emailAddress:String;
public var password:String;
 
 
public function ColdFusionFlexVO()
{
}
public function toString():String
{
var result:String= " ";
result += "First Name : "+ firstName +"\n" +
"Last Name : " + lastName + "\n" +
"Email Address : " + emailAddress +"\n" +
"Passwrod : " + password;
return result;
}
 
}
}
<!-- What we need now is to give an alias to the cfcomponent tag which is basically where this file is stored-->
<cfcomponent output="false" alias="RemoteClassExample.src.cfc.cfcVO" style="rpc">
	<!--Create The Properties that will be used, Match them exactly with these
		 public var firstName:String;
		 public var lastName:String;
		 public var emailAddress:String;
		 public var password:String;
		 Including the type -->
	<cfproperty name="firstName" type="string"/>
	<cfproperty name="lastName" type="string"/>
	<cfproperty name="emailAddress" type="string"/>
	<cfproperty name="password" type="string"/>
 
 
	<!--Now We place the arguments that we will be using which is what we will
	passing in when we create a remote object in flex, the return type is the name
	of the coldfusion cfc file which is cfcVO-->
	<cffunction name="returnVOClassObject" returntype="cfcVO" access="remote">
		<cfargument  name="firstName" required="true" type="string"/>
		<cfargument  name="lastName" required="true" type="string"/>
		<cfargument  name="emailAddress" required="true" type="string"/>
		<cfargument  name="password" required="true" type="string"/>
 
		<!--Now set the property to the argument and return it-->
		<cfset this.firstName = arguments.firstName />
		<cfset this.lastName = arguments.lastName />
		<cfset this.emailAddress = arguments.emailAddress />
		<cfset this.password = arguments.password />
 
		<!--Return the entire cfc, which will mean that we are really returning a COldFusionFlexVO-->
		<cfreturn this>
		<!--Move on to the MXML File-->
	</cffunction>
</cfcomponent>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
	 creationComplete="onCreateComplete()">
	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.rpc.events.FaultEvent;
			import mx.rpc.events.ResultEvent;
			import vo.ColdFusionFlexVO;
			/**
			 * @Private
			 * Create the class and pass to it values so we see that it works
			 */
			 [Bindable]
			 private var remoteVO:ColdFusionFlexVO;
 
 
			 private function onCreateComplete():void
			 {
			 	remoteSend.returnVOClassObject("Adobe","Flex","Adobe@flex.net","ColdFusion");
			 }
			 private function onResultEvent(event:ResultEvent):void
			 {
			 	remoteVO = event.result as ColdFusionFlexVO; //where our ColdFusionFlexVO class will be populated
			 	myText.text = remoteVO.toString();
			 }
			 private function onFaultEvent(event:FaultEvent):void
			 {
			 	mx.controls.Alert.show(event.fault.toString(),"Fault");
			 }
		]]>
	</mx:Script>
 
	<!--The Remote Object-->
	<mx:RemoteObject id="remoteSend" destination="ColdFusion" source="RemoteClassExample.src.cfc.cfcVO">
		<mx:method name="returnVOClassObject" result="onResultEvent(event)"
		            fault="onFaultEvent(event)">
 
		</mx:method>
	</mx:RemoteObject>
 
	<mx:TextArea id="myText" width="200" height="200"/>
 
</mx:Application>
Continue reading...

Flex and ColdFusion Remoting Simple DataBase Example

Sun, Jun 1, 2008

Comments

Here is a simple of Example of how you can use the RemoteService class in Flex and ColdFusion to populate a datagrid. The database that is being used is the one that comes with ColdFusion 8 (cfartgallery). Download the File and Import it via The import function in Eclipse. Make sure your workspace is under the wwwroot Folder otherwise you will have to make adjustments.

Download FCRExample

Continue reading...

Page 1 of 212»