Archive for July, 2009

Example on content assist w.r.t Application.cfc

Here’s an example on how scoped variables declared in onApplicationStart method will be available in content assist. Note the scoped variables set in Application.cfc (Application.obj1/obj2/obj4/obj7/qVar/Counter1 in this example) and try getting content assist on them in any file in the application (as shown in test.cfm in this example). Another thing to note here is the various types of CFC variables created. Yes, we have tried to cover some such common variable assignment scenarios. Do try them out and let us know if they work as desired.
— Application.cfc —
<cfcomponent>
<cfset This.name = “TestApplication”>
<cfset This.Sessionmanagement=true>
<cfset This.Sessiontimeout=”#createtimespan(0,0,10,0)#”>
<cfset This.applicationtimeout=”#createtimespan(5,0,0,0)#”>
<cffunction name=”onApplicationStart”>
<cfset Application.obj7 = new component_testing.cfcomponent.component_01()>
<cfset cfcNames.firstName = “component_testing.cfcomponent.component_01″>
<cfset Application.obj1 = createObject(“component”, cfcNames.firstName)>
<cfscript>
cfcNameVar = “component_testing.cfcomponent.component_02″;
Application.obj2 = createobject(“component”, #cfcNamevar#);
foo = createObject(“component”, “com.adobe.coldfusion.mail”);
Application.obj4 = foo;
</cfscript>
<cftry>
<cfquery name=”testDB” dataSource=”cfdocexamples” maxrows=”2″>
SELECT Emp_ID FROM employee
</cfquery>
<cfset Application.qVar = “testDB”>
<cfcatch type=”database”>
<cfdump var=”#cfcatch#”>
</cfcatch>
</cftry>
<cflog file=”#This.Name#” type=”Information” text=”Application Started”>
<cfscript>
Application.availableResources=0;
Application.counter1=1;
Application.sessions=0;
</cfscript>
</cffunction>
</cfcomponent>
— test.cfm —
<cfset Application.availableResources>
<cfset Application.counter1>
<cfset Application.qVar>
<cfset Application.obj1.method_01()>
<cfset Application.obj2.method_11()>
<cfset Application.obj4.addParam()>
<cfset Application.obj7.method_02()>

At the Eclipse India Summit…

I’m at the Eclipse India Summit which is happening in Bangalore (17th & 18th July). My wireless network is not being very friendly, hence not been able to share the summit synopsis. Will get back with that and more on CF Builder soon. Please bear with the delay is responding to your comments/questions.

How Do I generate ORM CFC’s???

Many of you might be stuck up at this question.
So thought of giving a Captivate Demo of CFC Generator which will help you to create ORM CFC’s from tables.Not the best quality video,but should be of help :)
See it here

Previewing a File in 1-2-3 Steps

3 things are necessary here:
1. It is necessary that the file you want to preview is in webroot.
2. It is necessary that the file is a part of a project in CFBuilder.
3. It is necessary that a server is associated with this project.
Considering these conditions the three steps should be as simple as:
1. Create/Import a Project in CFBuilder and create a cfm/cfc in it.
2. Associate that server with this Project, whose webroot will contain your file to be previewed**
3. Move to the Firefox/IE tab from the Source tab to internally preview this file. Else right-click on the editor and say Run As -> ColdFusion Application to open it in external browser.
**Checkpoint: A checkpoint for preview to be successful is that when you associate a server with a project the ‘Sample URL’ field below it shows the url for the project correctly.
The same checkpoint also holds good when you want to debug. You will see me re-iterating this in my post on Debugging.
Note: Though the F12 like shortcut key is not available to preview a file, there is a small button(green arrow) at the top in the tool bar. Clicking this button will run the currently opened cfm.

ORM CFC Generator

Most of you who are already in public forums of ColdFusion Builder know about CFC Generator extension for CFBuilder. For those who are new to it,its an extension to CFBuilder which will help you to automatically create ORM CFC’s for tables listed in the RDS View of CFBuilder.
We have an updated version of CFC Generator Extension available…Try this one out.
We have added option to specify relations and join conditions .
We would like to hear your comments on this :)
While Installing the extension to CFBuilder,the server chosen should be the latest public beta build of CF9 Server.
See instructions on how to use this extension here
Adobe CFC Generator

Server Manager

As the name suggests CF Builder comes in with a packaged Server Manager giving you the ability to add various ColdFusion Servers and manage all of them under one roof.
In the public beta build you should be able to add CF8 and CF9 – Standalone, MultiServer and J2EE Installations. For now we are providing support only to JRun based CF Servers.
When I say, you can manage servers I mean that once these servers(local or remote) are added in CFBuilder you can do the following the things with it :
- Start/Stop/ Restart Remote as well as local servers.
- Launch your administrator page(CFIDE) and make changes in it within CFB.
- Launch your Server Monitor and do related tasks
- View the server logs.
- Have the server collect mappings for you so that the content assist and CFC wizard gives you the fully qualified name(Believe me you are going to love this and I am going to talk more about it soon)
- Flexibility to have the CF server running as a Service or through Console.
- Flexibility to restrict users from starting-stopping remote servers.
- SSL Support
If you want to know specifically about any of the above just write a comment so that I can take that up on priority.
Needless to say, the Preview and Debugging(Local and Remote) are Courtsey, Server Manager!
And all you need to do is just add a valid server, specify its Doc root correctly and rest is taken care of.
As far as possible we have tried to keep the processes and user actions simple. But while supporting considerable configurations and providing features, things tend to get complicated. :)
That is it, for the first post. I have a lot to mention about Server manager and CFBuilder in general and will be doing so in the next sets.

Content Assist Tips

The advantage of code completion features is that you discover them as and when you type things out in the editor. One does not need to rely much on the documentation part of it. To start off, just thought of listing down couple of features from code assist inventory.
Did you notice…
1. Content assist on CFCs is available on ‘bind’ attributes of tags also? For example, <cfdiv>, <cfgrid>, <cfinput>, <cfselect>, <cfajaxproxy> etc
2. Content assist on variables, UDFs, queries and CFCs of an included file is available on the file including it.
3. Content assist on CFCs is available with ‘new’ operator also.
<cfscript>
myObj = new “myCFC”();
myObj.method1();
</cfscript>
4. Content assist also works on project level variables for CFCs. In project properties, there is a page for ColdFusion variable mappings where you can map variables to fully qualified CFC names. For example, Application.mycfc1 might map to com.adobe.mycfcs.mycfc1. You don’t
need to create objects of this CFCs to get content assist. Application.mycfc1. should give you the methods as Application.mycfc1.mymethod1.
5. Similar to the way file browser shows up in tag attribute values that take in file/dir, content assist shows file browser for relevant functions as well. For example, fileExists(), fileDelete(), fileRead() etc.
6. Content assist processes Application.cfm and Application.cfc. Application.cfm will be treated as included file and all variables and functions will be available for content assist. But in case of Application.cfc, only scoped variables declared in onApplicationStart will be available in content assist.
7. Content assist shows implicit getter and setter functions for properties of CFCs.
For example,
—test.cfc—
component
{
pageencoding “utf8″;
property name=”x” cacheregion=”” collectiontype=”array” cfc=””;
property string y;
param name=”x” pattern=”” default=””;
param y=10 max=””;
//x = new vam();
public void function foo(required x=”hi”)
{
return arguments.x;
}
}
Now try calling method of this component.
<cfset myObj = createObject(“component”, “test”)>
<cfset myObj. shows the methods foo(x), getx(), gety(), setx() and sety()
Try out these features and post your feedback on them. I will post examples on content assist w.r.t Application.cfc soon.

Adobe ColdFusion Builder Public Beta

Adobe ColdFusion Builder peeks out of the door and everyone wants to have a look!
Most of you reading this are aware that the Adobe ColdFusion Builder’s Public Beta is now available. For those who
don’t, I guess its high time you rush and get it installed :)
For introduction, we would like to point you to Ben Forta’s Write-up on CFBuilder.
Apart from what Ben says, we will be posting stuff which take you on a Macro-Tour of the CFBuilder features.
Though this is a ColdFusion Builder Team Blog, all opinions mentioned here are personal.
Our aim here is to showcase all that you will find and that you might miss when using ColdFusion Builder!