Archive for February, 2006

Uncategorized

CF Updater ( Mystic) For All - Mac and Linux

If you read the title and were hoping that Adobe had updated the downloads page, i am sorry to have misled you. However if you are a *nix user who would like to run the mystic updater on your dev box, then I have a solution for you. Unfortunately it requires access to a Windoze box with CF 7.01 on it already. If you have such resources then its actually very easy to get what you need.

Step 1. Run the cf flex 2.0 updater beta on your windows machine. My instructions assume you have a multiserver box, but I am sure you can sort out the other options if you need to. Which of course I had problems with but found a solution.

Step 2. Copy the files represented in the graphic below to a folder outside your jrun install. This graphic starts at the {jrun-install}/servers/cfusion/cfusion.ear/cfusion.war folder.

Step 3. Move that new set of files over to your *nix box. Create a new instance of cf and copy the new files in.

You should now be able to start up cf with all the new functionality that is provided by the updater. How can you test this? Well you need to compile a swf that runs a test. And I have instructions for setting up flex 2.0 sdk from a post eariler on my blog. Stay tuned for what you need to add to your setup to make the “ColdFusion” remoteObject calls work from your compiled swf’s.

Uncategorized

CF Updater (Mystic) Multiserver Install Problem

I did a little searching and didnt find any info on this, but when I ran the CF Mystic Updater so I could play with flex 2.0 and ColdFusion, I ran into a problem. I use the multisever install and although all the new files get posted in the correct location it is unable to update the web.xml to add the /flex2gateway/ servlet mapping.

In the installation log I found that it was trying to update the web.xml located at

c:JRun4wwwrootWEB-INFweb.xml

Those familiar with the differences between cf multiserver and cf standalone will recognize that path as the one for cf standalone, except with jrun instead of coldfusionmx7.

Anyway, I just created the wwwroot folder and WEB-INF folders and copied my web.xml from a valid cf intance into that folder. When I ran the updater the second time this file was updated correctly. Then I just copied it back into the webroot of my cf instances and I was good to go.

I hope this may help someone searching for a solution, as I was :)

Uncategorized

Portland CFUG Tonight - Subversion

Tonight at the portland cfug I am giving a presentation on Subversion. In that presentation I refer to several url’s that people can refer to for more info. I want to get those up here now so I dont forget later :)

Reference Material

Subversion Book

Subversion Quick Reference Card

Application Files

Subversion

SvnService - svn service for windows

TortoiseSVN

SmartSVN

Subclipse

Uncategorized

Using Flex 1.5 with ARF! and Reactor and Coldspring

I have gotten to work on a couple flex applications lately. Mostly just a pretty GUI for some data stuff. Normal CRUD operations. When you get right down to it is your average boring stuff.

So I decided that I would see what is required to get a couple of the popular CF ORM tools to work with Flash Remoting. I first implemented ARF! then Reactor. But not satisfied with the game I played I proceeded to set up ColdSpring with the 2 frameworks so I could use the Remoting Tools built into that framework.

Before I get into using the tools, I mentioned above, I think it would be a good idea to cover some basics on making remoting work.

Flex has made flash remoting a trivial chore. By using the mx:RemoteObject tag it is very simple to access your cfc and pull out your data. A simple remote Object looks like this:


source="/simpleRemoting/flashRemotingResponder"
result="resultHandler(event.result)"
fault="faultHandler(event.fault.faultstring)"
id="ro" />

The end point attribute is your domain plus the flash gateway url. The source is then the path to the cfc you are trying to call. The livedocs will explain the other attributes if you are trying to make this work :)

With this set up in your Flex file you could activate a remote method like :



Now lets just for a minute take a look at what we are actually calling on the other ColdFusion backend. We might have a cfc that has a function that looks something like this.


access="remote" returntype="query">


SELECT * FROM USERS;



That is all that is required in CF to return this data to flex. In our remote object above we reference a resultHandler() method that should deal with our results when they come back. An example of how our result handler could work might look like this:




public var users:Array;
public function resultHandler(results:Array):Void{
users = results._items;
}

The code above uses an array called users as the dataProvider for a data grid in flex. In the resultHandler method we populate the users array with the results of our remote call. In other words we set users equal to our members from our query.

Now if you are new to this you might wonder how we were able to set an array object with the results of a query. Part of the magic that happens in our remote gateway, is that when we return a query from a cfc, it actually turns that into an array of objects.

The trick then is getting the array of objects to be an array of a particular kind of object. And to do this justice I will just refer you to the article that explained it to me over on dirk’s site.

But to summarize what needs happen there are 3 steps. The first is that your object that gets returned from CF needs to have a public property called “_REMOTECLASS”. The value of that is the full path of the cfc. The second and third pieces has to do with configuring Flex. I use a function that gets called on initialze of my application. In this you set the static property that the Flex remoting classes use to identify what type of object is coming from cf. I use something like this.


var dep1:path.to.vo.Member;
public function initApp():Void {
mx.utils.ClassUtil.FLEX_CLASS_FIELD = "_REMOTECLASS";
}

The last peice of the magic that happens in the flex remoting gateway, is to have a dummy var that is the AS type that your cf object should be mapped to. I have included this in the code above. Then the third peice has to do with how your AS object gets mappend when you send data back to the CF gateway. In your AS class you need to use the registerObject line and map the cf type to the as object.


static var registered=Object.registerClass("path.to.MemberTo",path.to.vo.Member);

And with those pieces in place you should get your objects returned as the correct types. I will be showing examples of this as I publish the code for the various versions I have created. So stay tuned.

Uncategorized

Wrapup of my Flex 2 Ant Adventure

Previously I had several posts about getting Flex 2 to compile on my mac. The information was spread over several posts, so I wanted to summarize that info here.

The first step is to get a copy of the Framework files. For mac users this requires access to a linux or Windows box. I used the Flex Enterprise Services install and chose the compile to war option. In the location you choose to install there will be a tools folder. Those are the files you need. I also found on a pc that after installing the Flex Builder 2 app, I have a framework folder which appears to have the same files.

In my regular eclipse I create a new project, and select a location for it on my filesystem. In that project I created a flex folder. Then I just needed to copy the lib and frameworks folders from the install location mentioned above.

Now back in eclipse, at the root of our project, I create my hello.mxml. Just a simple Flex 2 file outputing some text in a label. And then the last peice is my build file. Save the script below as build.xml in the root of your project.















Now if you run the default task in that file you will be provided with a hello.swf file that you can run and distribute as you like.

Feel free to let me know if you run into any problems with this, as i have only tested it for my own local development.

Uncategorized

Flex 2 Beta 1 Compiles on OS X with Ant

I blogged yesterday about my trials in getting Ant to compile the new Flex 2 Beta files. My buddy Rob Rohan hit me on IM today to see if I had any luck. I explianed were I got to with the process. I offered to send him my files to get him a head start on making it work.

Not 30 minutes later he had a script that was compiling all but for one error. I asked him to shoot me back his ant script and I would take a look. Well no looking was required. I dropped his task into my build file and it worked like a charm (after updating some path properties)

So here for the world to share is the task that made it all happen for me ;) Thanks Rob!


value="${installdir}/asc.jar:${installdir}/batik-dom.jar:${installdir}/batik-svggen.jar:${installdir}/commons-logging.jar:${installdir}/swfkit.jar:${installdir}/axis.jar:${installdir}/batik-ext.jar:${installdir}/batik-transcoder.jar:${installdir}/compc.jar:${installdir}/xercesImpl.jar:${installdir}/batik-awt-util.jar:${installdir}/batik-gvt.jar:${installdir}/batik-util.jar:${installdir}/fdb.jar:${installdir}/xercesPatch.jar:${installdir}/batik-bridge.jar:${installdir}/batik-parser.jar:${installdir}/batik-xml.jar:${installdir}/jaxrpc.jar:${installdir}/xmlParserAPIs.jarbatik-css-patch.jar:${installdir}/batik-script.jar:${installdir}/commons-collections.jar:${installdir}/mm-velocity-1.4.jar:${installdir}/batik-css.jar:${installdir}/batik-svg-dom.jar:${installdir}/commons-discovery.jar:${installdir}/mxmlc.jar"
/>














In order to have the files i needed to make this run, I installed the Flex 2 Enterprise Services. I chose the “I have my own j2ee server” option. In the folder that is created by this installation is a tools directory. I dropped that folder into a project in eclipse and named it flex. The cdir property in the script is the full path to that folder.

Have some fun now all you mac-ers!

UPDATE
On my previous post on this phoc888 commented that he had a functioning Ant script as well. His was much shorter than mine and rob’s so I wanted to post it here.



fork="true"
failonerror="true"
maxmemory="128m"
>






Uncategorized

Mystic - CF Update for Flex 2 Conectivity

Not so long ago we found out that there was going to be a release for cf before version 8.0 (Scorpio) called Mystic. Well it appears a beta of the first release of Mystic is available on labs under the label of “ColdFusion/Flex Connectivity”.

The release is labeled as a zip, making me think I could update my linux and mac servers, but when the install came down as an exe. So once I get to work i will run the install and see if I can get what I need to update my servers.

Stay tuned for more on that ;)