Recently in ColdFusion Category

Introduction to Flex 2 Slides and Code

| 3 Comments | No TrackBacks

Last night I presented Flex 2 to the Central Pennsylvania ColdFusion User Group, right down the street from where I live. I've made the slides and sample code available for download.

The presentation was aimed at ColdFusion developers, so my goal was to show everyone how to get Flex talking with ColdFusion. I showed some of the basics of using MXML for layout, mixed in a tiny bit of ActionScript, and demonstrated how to connect to ColdFusion via HTTP (form post), WebServices, and Flash Remoting with the RemoteObject tag.

I wanted to get into ColdFusion Component and ActionScript 3 class mapping, but we were running low on time and it's not quite an "introduction" topic. However, there's a slide describing it, and you can see the sample code if you want to run through it yourself.

Thanks to everyone that came out - the turn out was actually better than I expected. I'm happy to have had the opportunity to share a little about Flex 2, and I hope my presentation was motivating enough for you to seek out more information to start building applications with it!

Tags: , , , ,

Introduction to Flex 2 Presentation

| No Comments | No TrackBacks

I'll be giving an "Introduction to Flex 2" presentation early next week, on March 7th. The presentation is for the Central Pennsylvania ColdFusion User Group, and will introduce Flex 2 from a ColdFusion developer's point-of-view.

The meeting will be held at the Country Meadows offices located at 830 Cherry Drive, Hershey, PA 17033, and will start at 6:30. If you plan on attending, be sure to RSVP at info@centralpenncfug.org in order for refreshments to be planned properly.

The presentation abstract is as follows:

Flex 2.0 extends the capabilities of the Flash Platform and allows for robust rich internet application development. Flex 2.0 is a major advancement to the Flash Platform involving a myriad of different technologies. For this meeting, Darron Schall will outline the different elements that make up Flex 2.0 and walk through creating an application with Adobe's latest offerings. Prior knowledge of Flex and/or ActionScript is not required.

My plan is to build a sample Flex 2 application that hooks up to a ColdFusion back end. The application will be on the simple side, but should give a general feel for Flex development. I'm hoping to raise a lot of questions and get people motivated to learn Flex 2. Overall, it should be a good time.

If you plan on attending, drop me a comment (and don't forget to RSVP as well). Hopefully I'll see you on the 7th!

Tags: , , , ,

Reminder: Central Penn CFUG meeting tonight

| No Comments | No TrackBacks

The Central Pennsylvania ColdFusion User's Group will be holding a meeting tonight, right down the street from me in Hershey, PA. Nic Tunney is the guest speaker, and will be covering Application.cfc.

More information can be found here. The meeting will be held at the Country Meadows offices located at 830 Cherry Drive, Hershey, PA 17033. The meeting start time on the website is 6:30, but the email announcement that went out said 6. I would err on the side of caution and say be there at 6.

This will be my first time attending the CPCFUG since moving to the area from Baltimore last year. I don't really do a lot of ColdFusion development anymore, but I'm hoping to meet some new people and support the local user group. If you're planning on attending, be sure to RSVP at info@centralpenncfug.org in order for refreshments to be planned properly.

Local user groups are a great way to learn technology, make new contacts, meet new friends, share good times, and usually get some free pizza. Check out this page to find a list of user groups in your area, and get involved!

If you've ever passed a struct from ColdFusion to Flash via Flash Remoting, you've probably noticed that all of the keys for the struct come into Flash as uppercase. In the past, this wasn't that big of a deal, but when Flash Player 7 came around with case-sensitivity, some people started to encounter problems. Here's the simple workaround...

Consider the following code:

<cfcomponent>
  <cffunction name="getSomeData" returntype="struct" access="remote">
    <cfset oData = StructNew() />
    <cfset oData.key1 = "example 1" />   <!--- converts to KEY1 --->
    <cfset oData["key2"]= "example 2" />   <!--- preserves case --->
    <cfset StructInsert(oData, "key3", "example 3") /> <!--- preserves case --->
    <cfreturn oData />
  </cffunction>
</cfcomponent>

Note that accessing a struct in the "usual" way with dot notation will convert the key to all uppercase. By using array (bracket) notation, you can preserve the case of the key. Additionally, if you use the StructInsert function you can also preserve the case of the key.

I hope this post saves someone some debugging time in the future. This question recently came up on a mailing list, so hopefully google will find this post and make the answer easier to locate. :-)

Feedback on CFC-Based Security System

| No Comments | No TrackBacks

Jim Davis is looking for some feedback on a CFC-based security system that he has recently implemented (open source). If you use ColdFusion and have some time to spare, kick this thing around a bit and give him some feedback to help make the first official release a solid one.

Here is his original announcement:

Ben Forta's Philadelphia Visit Summary

| 9 Comments | 2 TrackBacks

Tuesday June 29th marked a visit from Ben Forta to the Philadelphia Area ColdFusion User's Group on the 5th week of his user group tour. The meeting went really well, and was very informative. I took 3 pages of notes, which I've tried to summarize below.

First, it's important to point out that if you have the opportunity to hear Ben speak, you should do everything you can to attend. While my summary may somewhat spoil the surprise, there's nothing better than seeing these new features in action. I'm providing the notes below for those unable to attend, for my own personal archives, and for anyone else interested.

With that being said, ColdFusion Blackstone is shaping up to be an amazing release and I'm really looking forward to it. Without further ado, let's get started...

(Note that at some points I was writing so fast that I can't even read my own writing which resulted in the context of some things being lost. Also, I tried my best to keep this list exactly in line with what was presented, but there maybe some errors on my part that I apologize in advance for.)

ColdFusion Mappings Headache

| No Comments

This one drove me nuts.. I would consider this behavior to be a bug in CFMX and I wanted to share my experience so no one else runs into this and wastes time.

First, the server is a Windows 2k box with CFMX 6.1. I'm not sure how earlier versions of CF behave, but I would guess that they act the same.

We have 7 different sites running off of one server. In the CF Admin under mappings, we have a mapping for each site so we can use absolute paths in <cfinclude> buy saying <cfinclude template="/site1/whatever.cfm">. This is useful as all of the sites share some content that we don't want to duplicate across the sites, and each site can access files outside of its own wwwroot folder.

Now, we also have some custom UDF's defined in site1, the main site. But, it got to be a pain always <cfinclude>ing "/site1/gloablUDF/something.cfm" in every other site, so we made a mapping in the CF Admin for "/" to point to wwwroot of site 1. This worked perfectly, as now we can use <cfinclude template="/globalUDF/something.cfm"> from any site and it will pull the file off of the main site, site1. We've been doing this for a long time and haven't experienced any issues.... until...

I went to add a new mapping to the CF Admin for a project I was working on. Without really thinking, I just clicked "Add Mapping" expecting a pop-up window to appear. Of course, the page refreshed and said I need to specify a name and location in order to add a mapping. That's a big "duh" on my part, as I just glazed over the form without thinking. Ok, so now I have the form in front of me again. I fill it out to add the mapping, click "Add Mapping" and the server blows up.

Well, it didn't explode or anything, but all of a sudden all of the other sites couldn't access any of the global UDF's we defined in site 1. So what happened?

It turns out that when I submitted the empty form to add a mapping, the CF Admin defaulted it to "editing" the "/" mapping that we had for site1 - except that it didn't auto-populate the Directory Path. Because of this, when I filled out the form again and added in my new mapping, I didn't know that I was actually overwriting the "/" mapping already in place.

It was easy enough to just add the "/" mapping back, but it took me a little bit to figure out what the problem was and why it was caused. I would consider this a bug, as attempting to add an "empty" mapping should not default to editing the "/" mapping, in my opinion.

Anyway, I hope this doesn't happen to you. I'll get off the soap box now…

Using Java Objects in ColdFusion

| 1 Comment

This is just a quick little code snippet for you ColdFusion users out there. With all of the hype of Java lately in the ColdFusion community, a lot of people have been taking the initiative to learn Java. However, it may not be obvious how you can apply your newfound knowledge of Java to ColdFusion development.

Below is a very simple code snippet of leveraging a built in Java class inside of a CFML template. Note that the color highlighting isn't quite right.. you'll be best copying and pasting this into Dreamweaver MX 2004 to view the code as it should be displayed.

<cfscript>
	/*	First, we create a Java object that references the built in
	StringTokenizer class, available in the java.util package.  This
	line only declares the variable and its type, it does not call
	the object's constructor.
		
	It is similar to just doing the following in Java:
		java.util.StringTokenizer stringTokenizer;	*/
	stringTokenizer = createObject("Java", "java.util.StringTokenizer");
	
	/* 	Next, we call the constructor.  The way to do this in ColdFusion is
	actually 2 part.  If we call any non-static method of the object
	the default constructor is implicity called.  If you do not want to
	call the default constructor, you can use the "init" method to have
	ColdFusion call the object's constructor.
	
	The code below is similar to doing the following in Java:
		stringTokenizer = new java.util.StringTokenizer("This is my string", " ", false);
		
	I won't explain the parameters.. they can be found here:
		http://java.sun.com/j2se/1.4.1/docs/api/java/util/StringTokenizer.html
		
	The java docs online should definitely be in your bookmark list.	*/
	stringTokenizer.init("This is my string to break apart", " ", false);
	
	/* Display the token count */
	writeOutput("Tokens:" & stringTokenizer.countTokens() & "<br/>");
	
	/* Loop over the tokens... */
	while (stringTokenizer.hasMoreTokens()) {
		/* And display the token followed by a line break */
		writeOutput(stringTokenizer.nextToken() & "<br/>");
	}
</cfscript>

It's that easy! Now you know how to start leveraging all of those built in Java classes that you've been using in your Java projects. Additionally, now you have an idea how to take advantage of Java classes that you can find all over the internet. Good luck!



About this Archive

This page is an archive of recent entries in the ColdFusion category.

AIR is the previous category.

Flash is the next category.

Find recent content on the main index or look in the archives to find all content.

Archives

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.02