Bartram's Bits

Tuesday, May 29, 2007

Submit CFCALENDAR onchange

I'm building an application that needs a calendar picker tool and I decided to check out the CFCALENDAR form control. It turns out that since it is a flash component, the onchange event uses ActionScript rather than JavaScript. This proved a bit frustrating for me since I knew zero ActionScript going into this and I was initially unable to find any help online. I eventually came across a page, Passing Variables Around - Flash to HTML and Back that talked about how to emulate a METHOD="GET" submit in ActionScript. I then learned about how AS names fields and some basic date functions and came up with the following code:

<cfparam name="TestDate" default="#Now()#">
<cfoutput>#TestDate#</cfoutput>
<cfform name="TestForm" id="TestForm" action="cfcalendar.cfm">
<cfcalendar name="TestDate" selecteddate="#DateFormat(TestDate,'mm/dd/yyyy')#"
onchange="getURL('cfcalendar.cfm?TestDate=' + (TestDate.selectedDate.getMonth()+1) + '/' +
TestDate.selectedDate.getDate() + '/' + TestDate.selectedDate.getFullYear());">
</cfform>

The key was to reference the field name selectedDate rather than TestDate, otherwise you keep passing the original date. I then needed to reassemble the date into a format that ColdFusion would understand using the getMonth, getDate, and getFullYear functions. Also I needed to add one to the result of getMonth since ActionScript starts counting months at 0 instead of 1.

Labels:

Wednesday, May 16, 2007

Development Directory Structure

While implementing version control, I changed several things in my development environment. One of those things is the directory structure. I did some reading online, especially ColdFusion MX Coding Guidelines - Structure: Application, Component, Tag etc (scroll down to the Directory Structure For Applications section). Most of what everybody else talked about referred back to this guide. The big question that I had as a developer was; how to handle multiple sites? The apparent consensus is to place each application in wwwroot whose parent is cfmxroot. Each application has its own webroot where the .cfm files go and other non-web folders. The overall development environment then has folders for supporting files within the cfmxroot. The following is the expanded structure including some folders which I probably won't use, but are there if I need them:
C:\cfmxroot
config
extensions
components
customtags
includes
wwwroot
appname
db
extensions
components
customtags
includes
webroot
images
shared
css
documents
images
js
services

Labels:

Implementing Subversion w/ TortoiseSVN

I've known of the benefits of version control especially Subversion for a while now, but for whatever reasons, I hadn't made "the leap" until now. I bookmarked the series Configuring a Development Environment with Apache, Subversion, TortoiseSVN, and Subclipse most recently, but like many of my bookmarks it sat unread for a while. What is different is that Monday evening I began reading it and implementing it as I went along. I've read and worked through Parts 1-3 augmented with The ACME Guide and am now using a repository with one of my current projects. While the articles are great and were able to get me up and running, I have found I have a need for a quick reference while I am still getting comfortable with the process.

goto C:\svnrepos
create a new folder
right click on the new folder and select TortoiseSVN>create repository here
slect Native filesystem (FSFS)
right click on th new folder and select ToroiseSVN>Repo-browser
change URL to http://localhost/svn/new folder name
right click and select Create Folder
New name: trunk
Log: Create trunk folder
right click and select Create Folder
New name: branches
Log: Create branches folder
right click and select Create Folder
New name: tags
Log: Create tags folder
goto directory of code to import
right click and select TortoiseSVN>Import
URL of repository, select newly created repository and add /trunk
in development environment create new folder
right click new folder and select SVN Checkout...
accept defaults and click OK

To commit changes to the repository, right click and select SVN Commit...
To update from the repository, right click and select SVN Update...

Disclaimer - This entry is not recommended as a how-to article, rather it simply documents my current process.

Labels:

Thursday, May 10, 2007

New in CFMX 6&7: What did you miss?

At lunch today I attended Charlie Arehart's CFUnited preview presentation, New in CFMX 6&7: What did you miss? online a la the ColdFusion Meetup Group. It looks like I'm really going to miss out by not attending this conference! Charlie has provided a loooooong list of both major features of CFMX 6 & 7 as well as not so major enhancements in CFMX 6 (no list for 7). Being only 30 minutes he was not able to go into detail on any of these items, but he sure wetted my appetite and gave me a lot to research. He started with an example of an enhancement that came out way back in ColdFusion 4.01 that is not widely known: ListQualify(), for example, can convert a list such as "red,blue,green" to 'red','blue','green' for use with a SQL clause WHERE IN(...)

ColdFusion MX 6 Major Features
ColdFusion Components (CFCs)
Web Services
Flash Remoting
XML

ColdFusion MX 7 Major Features
Great User Experience
- Printable Web Content
- Structured Business Reports
- Flash Forms and Controls
- XML Forms
- New CFCHART engine
- Ready-to-use chart styles
- Improved text searching capabilities
Rapid Development
- Dreamweaver extensions
- Improved form validation
- Parameter validation
- Strong encryption
- Integrated NT Domain authentication
- Improved XML functionality
- In-memory Query Metadata support
- Debugging improvements
- Cross-site Scripting attack prevention
- Application event traps
- Enhanced Web Services support
Flexible Deployment
- Enterprise Manager
- EAR/WAR deployment
- Sourceless deployment
- Administrator API
- License Usage Scanner
New Classes of Application Development
- SMS Gateway
- Lotus Sametime Gateway
- XMPP Gateway
- File System Gateway
- CFML Aynchronous Gateway
- Extensible Gateway Architecture

More than just the "major" features: Other big CFMX 6 enhancements
Build tag-based UDFs with CFFUNCTION
Enable user authentication and autorization with CFLOGIN
Implement Developer Resource Controls with Sandbox/Resource Security
Dynamic charting with CFCHART
Improved debugging and tracing with CFTRACE
Internationalization of your applications
Several Regular Expression (RE) support changes
CFTHROW can now throw an object
CFLOG now always writes thread, date, and time
CFHTTP reading text file in as query, new FirstRowAsHeaders attribute
Verity K2 Server Improvements
New commenting flexibility
Still more CFMX 6 enhancements
- Dreamweaver MX
- Database connectivity
- Query of Query enhancements
- Several CFLDAP changes
- CFMAIL spooling option changes
- Sort order in ListSort, ArraySort
- Date processing functions have short, medium, long formats
- Localization functions now follow Java standard rules
Some CFMX 6 hidden gems
- CFLOCATION fixed to properly set cookies
- Compilation/PreCompilation of CF Templates
- Extensibility of Built-in Web Server
- CFIMPORT of CF Custom Tags
- Sever-side Redirect forwarding
- CFMX Tag Updater for CF Studio AKA HomeSite Plus
- CFSETTING RequestTimeOut
- Optional UUID for CFTOKEN
- UrlSessionFormat() Function
- Exception Handling in CFSCRIPT
- Evaluation within expressions
- New variable scopes available as structures
- Appending arrays to one another

Resources for learning more

ColdFusion MX 7 Upgrade Guide
CF7 Migration Guide
CF 7 Evaluator's Guide
Edition Comparison Matrix (5,6,7)

Labels:

ColdFusion 8 Preview

Ben Forta came to the cccfug on May 7 as part of his Scorpio User Group Tour to present a sneak peak of ColdFusion 8. The gathering was quite crowded and very enthusiastic. Ben spoke for 2.5 hours on the following key items grouped into 3 categories:

Developers Section
CFIMAGE
AJAX
FckEditor
Yahoo Calendar Control
CFWINDOW
CFFORM binds
low level CFFILE handling
CFTHREAD
CFDOCUMENT enhancements
Reporting enhancements
CFC Interfaces
Argument collections - use a structure to pass default settings to any cf tag
Implicit Array & Structure creation
Javascript operators in CFSCRIPT
Eclipse Debugger

Integration Section
CFOBJECT invokes .NET Assemblies within the CLR
* ColdFusion can talk to ColdFusion, Java, and .NET Objects all at once
MS Echange - full client control
CFPRESENTATION creates Adobe Connect Breezos
Flash Media Server Gateway
CFFEED - Atom and RSS
CFPDF - PDF manipulation
CFPDFFORM - populate and extract data in PDF forms

Management and Administration
Server Monitoring API and Flex front-end
User-based Admin & RDS
Per application settings

Labels: