Friday, October 19, 2007

flex2:TFS on my mac

I'm going to use this entry mainly as a place to mark down some of the issues I encountered going through the last third of the flex2:Training from the Source book. First, I guess it's important to describe the environment I'm working in because it's not exactly what the book was looking for.

My Environment
  • Mac book pro on OS X
  • flex 3 beta 2 (not the same as the book, but issues have been minimal. The only thing I remember being different has been a few screen shots at the beginning of the book. No big deal.
  • MySQL 5.0 beta (very stable at this point, although the gui tools occasionally abend on the mac)
  • ColdFusion 8 developer edition installed to use the embedded Apache web server on OS X
In order to finish the book, you need to set up a ColdFusion site on your local computer. The site is included on the CD that is distributed with the book, but it's inside the ColdFusion for windows zip file. I've extracted the flexGrocer CF site and updated a few of the xml files that were only found on and put a copy up on my share account. You won't have to bother with unpacking the entire ColdFusion install to get the site. Both of the folders should be unpacked to your web root. You might also want to create a cf project (using cfeclipse, of course) to point to the sites in case you need to make an edit or two.

  • page 397 - This is the first place I had to deviate from the text a bit. My local webserver uses the default port, so I was able to remove the :8300 from the httpservice entries. Also, a few of the xml files were not in my copy of the site from the cd. I was able to fetch them from the site and I've included them with the site download mentioned above.
  • oops. A bug in the script I posted with the db. I named a field in the unit table "uintID". I've corrected the typos (it wound up in several places) and posted the corrected file back on my share.
  • MySql uses tinyint(1) as a boolean and mssql server records boolean values as 1 or 0 (or null, but we won't take that on here). You'll need to modify the addProduct method of the productManager.cfc file on the cf website to handle booleans coming into the object with 'yes' and 'no' values. I just did a little inline iff like this: iif(arguments.aProduct.isOrganic,1,0), and the same for isLowFat.
  • Do the same thing for the updateProduct method in the productManager.cfc file as well.
  • Edit the cffile file attribute of the productManager.cfc in the ColdFusion part of flexGrocer to point to your local install of cf.
  • Edit flexGrocer(CF)/cfcs/fileUpload.cfm to point to your flexGrocer/assets directory.
  • Edit the FlexGrocer_CF_Services.xml file that is used in your flex2 compiler settings to point to your install of ColdFusion's flash services. For me, this is: http://localhost/flex2gateway/
  • Page 428: I'm not sure if this is something strange with my setup, an error I have in the code, a difference between running on a Mac vs WinTel or an issue with the book. In order for the remoting lesson to actually work for me, I had to change the Alert command in step 12 to refer to the event result as event.result.ORDERNUM. I know there have been issues with case involving coldfusion remoting in the past, and I guess this is just another instance of that. Note that the text explains that we are expecting a generic Object and not an OrderInfo instance. I think if we had an alias for the coldFusion component in our OrderInfo vo, we might be able to return a typed object and preserve the property case with the use of the cfproperty tags. If I get some time later, I'll have to look into this.


  1. I ran into the same issue on p428 too. After jumping into debug mode I saw that event.result has all the properties in upper case so the tweak fixed it. Then I found your blog post. I'm running CF8 as a JRun instance on Windows with Apache for reference. Did you work out a way to preserve the case set in CF?

  2. No, I just blew past it once I got it to work. And, like all devs I got pulled onto a different project before I could tie up.