Stretch Media
home services Solutions news about us Blog contact us

Using external services-config.xml files and setting up on Mac

Problem:

I want to reference a remote instance of the services-config.xml file for a project I'm working on. I'm now developing on the mac platform (which I love) and need to figure out how to reference it.

Solution:

1) Connect to and "mount" the external drive on which the services-config.xml file resides.

Connecting to the remote drive via Finder by choosing Go -> Connect to Server or Cmd+K will give you access to the networked drive, but doesn't help you when you need to reference that drive (mapping in Windows) within the compiler settings in FlexBuilder. So...

Fire up Terminal and navigate to the root of your system, and then into your Volumes directory. Create a new directory here as follows:

mkdir [new_name]

Choose something relevant as the name as you'll be referencing it in a second.

Next, use the following command to "mount" your remote network drive to this new drive you've just created.

mount_smbfs //[userame]:[password]@[remote_server_url]/[drive]/ /Volumes/[new_name]

Each of the vars used here is pretty straight forward, but make sure you use the same when you reference the "mounting" location in /Volumes

You won't be returned with any confirmation of success, but if you don't get any error, then it's setup successfully.

Now, go back into FlexBuilder, and setup your services pointer to:

-services '/Volumes/[new_name]/ColdFusion8/wwwroot/WEB-INF/flex/services-config.xml'

or whatever your path may be.

Virtual Mapping in ColdFusion 8

I was setting up the ColdFusion 8 server on my new Mac Pro today and am using the development server now in lieu of IIS which I always used on my Windows dev boxes previously. When setting up a virtual directory, I'd always just set it up through IIS. Setting up virtual directories in ColdFusion was a bit of a change for me, and after an hour of head scratching when my CF mapping didn't work when trying to call CFM files through browser, I figured out the following to setup a virtual directory for built-in ColdFusion development server:

1) Open up the jrun-web.xml file located in ColdFusion8/wwwroot/WEB-INF directory.
2) Add a virtual directory mapping as follows:

<virtual-mapping>
<resource-path>/cf/*</resource-path>
<system-path>/Users/meutznerb/Documents/dev_flex3/CFMiddleTier/</system-path>
</virtual-mapping>

3) Save the file, and restart the CF server instance.

The mapping above will now allow me to call files from

http://localhost:8500/cf/
and reference the CFMiddleTier directory in my Documents/dev_flex3 directory.

The trick was getting the directory path correct... starting from /Documents/... would not work, and required the full path with /Users/meutznerb/Documents/... to be defined.

That's my mac newbie tip for the day :-)

ColdFusion 8 released

http://www.adobe.com/products/coldfusion/

A debugger... thank the gods!!!

Export to Excel with Flex 2.0 and ColdFusion

Hi,

I didn't really find a suitable solution for exporting to Excel after a bit of searching through forums and blogs, so I came up with the following. I wanted to achieve seamless "click to generate a report" from Flex and have the file option dialog popup in the browser allowing me to open or save. Here's what I came up with. While I don't see any issues with the solution, I realize it's a bit of a hack, and would appreciate any CF wizards letting me know if this is going to create problems.

From Flex, I'm calling a CFC function with my data being passed back as an array. The CFC takes the data and stores it to an application variable in CF. I then send a trivial result back to Flex. On the CFC result inside Flex, I make a call to a template CFM file which uses the cfcontent tag to generate the excel file from an html table structure I build with the saved application variable data.

CFC

<cffunction name="exportToExcel" access="remote" returntype="any" output="true">
<cfargument name="data" type="array" required="yes" default="" />
<cfset session.exportData = #ArrayNew(1)#>
<cfreturn 'true'>
</cffunction>


Flex

if(event.result == 'true')
{
var request:URLRequest = new URLRequest(URLToCFTemplate);
flash.net.navigateToURL(request, "_self");
}


Brendan

Updated: Download the source files here - Download

Named Parameters in ColdFusion

BlogCFC was created by Raymond Camden. This blog is running version 5.5.1.