Tech Blog

ColdFusion

ColdFusion 9 and ColdFusion Builder public beta available now

by Rolando on Jul.13, 2009, under ColdFusion

Adobe has released ColdFusion 9 (Centaur) and ColdFusion Builder (Bolt) public beta versions today. As I write this post, I’m downloading the installers for both. I look forward to see the new features CF 9 brings us.

The new features that mostly caught my attention are:

  • Built-in ORM based on Hibernate, this is a great addition and probably the biggest change to the product. I’m a fan of Transfer ORM and thankful for all the work Mark Mandel has put into the project for the CF Community. I don’t know if the built-in ORM will be better than Transfer or not yet. But having a ORM built-in to CF is definitely a great option to have. Especially when working with clients that are skeptical or have policies against Open Source software.
  • Implicit getters and setters (finally!). This seemed obvious for sometime now. I’ve been using snippets to create the getters & setters for a long time but now I can better spend my time. One thing I hope and that is that the methods can be overwritten if needed.
  • Closed gap between CFML and CFSCRIPT.  I write most of my code in CFScript so this is a big one for me. I’m not sure exactly what this means but if it means I can do everything that CFML does using only CFScript then (whoohoooo!) this makes me extremely happy.
  • ColdFusion services exposed for Flex and AIR via Actionscript libraries.  This is powerful stuff and indeed one of the best additions to the product.

The ColdFusion Builder, which is based on the Eclipse IDE also looks very promising and is probably the most anticipated part of this release.  The community has been asking for a CF-IDE for sometime now, especially since the release of the Flex Builder.  With the CF Builder you will be able to manage servers and deploy projects right from the IDE by using FTP.  The IDE will also help by completing tags as you type and by listing things like datasources when typing “datasource=” inside a cfquery tag. For a list of the new features checkout the post by Ben Forta at http://www.adobe.com/devnet/coldfusion/articles/cfbuilder_whatsnew.html

To download the public beta version of the products visit http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_coldfusion9

Leave a Comment :, , , more...

EnvironmentConfig - About

by Rolando on Jun.03, 2009, under EnvironmentConfig

EnvironmentConfig (EC) aims to solve a problem developers face when using multiple tiers in the development lifecycle.  That is that each server/environment may have properties that do not match the other servers. For instance, in a three tier development setup (development, staging and production) you may find that the data-source names (DSN’s), mail server address and credentials, path to certain folders, etc. differ from server to server.  On each deployment or every time a patch is applied, the developer must ensure those variable properties are correct or else the application will break.  Ensuring each environment contains the right values for each property may become a tedious process, especially if the application evolves constantly.

EnvironmentConfig address this issue by allowing the developers define each environment and properties in an XML file once. This file is processed when the application starts and EC will automatically detect the environment the application is running at, based on the domain name. The environment’s specific properties are loaded and available to the developer for use in a several ways depending on configuration set.

stProperties

By default EC will return two structures with the properties set in the XML file. One follows the exact configuration set in the XML where you can declare both, simple values and structures of properties. This one is called stProperties .

stFlattened

stFlattened return the same properties and values as stProperties, however it flattens all structure properties and contains a single structure with all properties as single values.

GlobalConfig object

EC can be configured to create a GlobalConfig object (CFC). GlobalConfig is the default name but it can be named as desired and the path where is created can be set as well. If told to, EC will create this ColdFusion Component on the fly as a Bean with setters and getters for all the properties of that environment. The setters are set to private access while the getters are set to public encapsulating the properties and making them read-only through the life of the application.

You can choose to use any of the three options mentioned above to store and access the application properties. To make the accessible from anywhere in the application, you should place the selected option in the Application scope.

Notice that if the structures are used to handle the properties without the GlobalConfig object, these can be overwritten at anytime during the life of the application, while the properties are protected if the GlobalConfig object is used.

To Install EnvironmentConfig you can create a ColdFusion mapping to the EnvironmentConfig folder or just drop it in the root of your website.

Leave a Comment :, more...

EnvironmentConfig 1.1 - Beta

by Rolando on Jun.03, 2009, under EnvironmentConfig

EnvironmentConfig (EC) has been revamped and now gives you more power and flexibility to set an application properties. You can now use complex values (structures) as properties and reuse properties as variables throughout the config file. Another neat feature added to this version is the ability to use ColdFusion methods that return a simple value in the config (XML) file, as well as the ability to create a ColdFusion component (CFC) as a config Bean populated with the properties on the fly.

As of version 1.1 you can:

  • Use complex values as structures in the form of map->property (just like in ColdSpring). Thanks to Paul Marcotte for adding this functionality
  • Use ColdFusion functions to format or generate output. For instance you can use #expandPath("/uploads")# and you will get the absolute path of the folder as the value of a property like “C:\sites\mysite\assets\uploads”
  • Reuse properties as variables in the config file using the syntax ${propertyName}. For instance let’s say you have a folder path of /assets, but under assets you have /images, /videos, etc. You can now set a property for assets as
    <property name="assetsPath">/assets</property>
    then you can set the images and videos path as
    <propertyname="imagesPath">${assetsPath}/images</property>
    <property name="videosPath">${assetsPath}/videos</property>
  • EC now return two structures with the properties, one is a structure with sub-structures (if you use complex values) and another one flattened (thanks to Tom De Manincor)
  • Another new feature is that EC can create a properties Bean for you on the fly. So, if instead of using properties in a struct as properties.myProperty you can encapsulate them in a Bean object. The properties will be read-only and you would access them like GlobalConfig.getMyProperty(). You can specify where you want it written to by passing the object notation path as 'model.GlobalConfig', EC will create the file then under ‘/model’ as ‘GlobalConfig.cfc’  I prefer this over the structure as the application properties are read-only and no one can modify them during the application’s life.
  • If you use ColdSpring as your object factory, tell EC to create the ColdSpring definition file for you and all you have to do is add the include line at the bottom of your main ColdSpring file. From there on you can ask ColdSpring for the properties bean as you’d do with any other object.

This version still on Beta, but if you want to try it feel free to download it from the RIA Forge page http://environmentconfig.riaforge.org/

I look forward to getting feedback from you on features you’d like to see added. Report bugs at the RIAForge page.

Following will be a series of posts with samples of the multiple ways you can use EnvironmentConfig.

1 Comment :, more...

Adobe Certified Expert in Advanced ColdFusion 8 –arrived

by Rolando on Apr.22, 2009, under ColdFusion

The ACE certificate (or I should say, certificates) arrived in the mail yesterday!  For some reason I got two; one says Advanced the other one doesn’t.  I’m not sure if that’s how it was supposed to be but certainly, I’d have prefer to get two copies of the one with “Advanced” on it.

I’ve never been a big fan of certifications but they certainly help and many companies require them to give you the job. That is indeed why I got the certification (I’m still hapily with AboutWeb), because we needed it to get a contract. So, I finally had to confront the elephant in the room. Now, I only whish I had done this earlier.  Maybe my fear was the “what if”, but at the end I was “forced” to do it and got a score of 95%.

I’m glad I took it and encourange everyone in the CF Community to take the test.  Is good to have the peace of paper to back up your resume.  Think of it as a letter of recommendation from Adobe’s President & CEO …yes it’s signed by him.

P.S. I wanted to have an e-copy of the certificate and tried out lighting technique that worked pretty good. This is what I got:

ACE Advanced CF8 Certificate

ACE Advanced CF8 Certificate

For details on how I took the picture go to my Photography blog

2 Comments :, more...

Attending to CF.Objective!

by Rolando on Mar.28, 2008, under ColdFusion

I finally got approval to go to CF.Objective this year!  I've been wanting to go since I heard great things about last year's conference.  This year schedule looks promising too, with great speakers and tracks.  I don't see myself sticking to one track but rather picking the best (for me) of the different sessions.

By glancing through the schedule I'm already looking forward to Advanced Techniques With The ColdBox Framework  by Luis Majano; ColdSpring 1337 by Chris Scott; Transfer ORM Caching Mechanics by Mark Mandel.  There are other ones which I need to make my mind for since they overlap like the workshop by John Paul Ashenfelter (I attended to one of his pressos in CFUnited and it was great) and CF with Air by Samer Sadek ( a coworker of mine).

Regardless of what I pick,  I'm sure this will be a great learning experience as well as a good chance to share the great guys of the CF community. If you haven't buy your tickets yet, hurry up and get registered!

See you at Objective!

Leave a Comment : more...

Speaking at Baltimore Adobe User Group Inaugural Meeting

by Rolando on Mar.24, 2008, under ColdFusion, LiveCycle ES

This Wednesday, I'll be speaking at the new Baltimore Adobe User Group (BAUG) on LiveCycle ES.  If you live around the Baltimore area, this is a great opportunity to learn what is LiveCycle ES and what it can do for your company.  My presentation comprise two parts as described below:

What’s all the buzz about Adobe LiveCycle ES?

Have you heard about LiveCycle and how great it is but never had a chance to see it in action? Maybe you’ve heard how it can unlock PDF documents, control who can view/print/copy documents even when these have left your network, render forms in multiple formats (HTML, PDF and SWF) all with a single file. Learn why the buzz about LiveCycle ES and why renowned companies like Wachovia and the Federal Government are using LiveCycle ES to automate their business processes.

Unleash the power of Reader Extensions ES

Have you ever filled out a PDF form and, after all the effort, noticed you cannot save your data? Or maybe try to add attachments, comments, signatures, connect to a database but are unable because of the limitations of Adobe Reader? Learn how you can use LiveCycle Reader Extensions ES to unlock these and more capabilities for single or bulk PDF documents.

 

I'll be preceded by Curtis Layton, whom will be speaking on: Intro to Object Oriented Programming in ColdFusion.

You can get more details about the event at the BAUG website: http://baltimore-aug.org/

Leave a Comment :, , , more...

Transfer becoming a Professional Open Source Software

by Rolando on Jan.21, 2008, under Transfer ORM

Mark Mandel has announced today that Transfer ORM will become a Professional Open Source Software.  He wants to dedicate more time to present the framework and travel to conferences (he will remain coding for the framework though).  I’m sure we all agree Mark has done an excellent job developing, maintaining Transfer and keeping up with the developer group, so it is of great pleasure to hear Mark’s new endeavors.

If you wish to become actively involved with Transfer, check this out, Mark is looking for people interested in the following areas:

  • Transfer Support
    A subscription and/or per incident model for support as pertaining to Transfer installation, use and/or any overall issues. 
  • Transfer Training
    A Transfer curriculum that will come in a series of short courses, as well as single/multiple day training programs, covering both on-line training, and in-person training.
  • Transfer Developer Certification
    Much like ColdFusion Developer Certification,a Developer certification give you a listing on the new Transfer site as certified, as well as a spiffy certificate.
  • Transfer Training Certification
    Again, much like ColdFusion Training Certification, this would give you a listing on the Certified Trainers page on the Transfer ORM site, as well as access to the training materials.

If you are interested in any of the above programs you can contact him via the contact form, or the Transfer Google Group

To see the full details and his original post checkout his blog post http://www.compoundtheory.com/?action=displayPost&ID=281

Leave a Comment : more...

Environment Config - A single application config file for your CF Apps

by Rolando on Jan.17, 2008, under EnvironmentConfig

When working with web applications we often, very often, face the problem that the configurations in the various environments where the application will be deployed differ from one another.  This could be anything from different datasource names, security credentials, email server address and most important it could be an application setting to set your application mode (dev mode, live mode).  I say “most important” because if you have an e-commerce this flag could be the difference between charging customers or letting every transaction go through (Free goodies!).

 A way to deal with this problem (I believe the most commonly adopted) is to use a config file to set all this properties.  That’s where the famous “.ini” comes in (or XML), which is that text file with the variables for an environment.  It does the job but now you have a config file per environment and this could be a local, a dev, a staging and a production file.  So, now you have another problem, which is you have to make sure not to replace any of these files every time you do an update to your app (been there, done that).  You can use Ant to avoid making this mistake but you still have multiple copies of the config file lying around.  So, what if you can have a single file that “knows” what properties and values to use depending on the environment that is at?

Rob Gonda and I, created a very simple environment configurator that works of a single XML file and sets the needed properties based on the server is at.  We did this over a year ago but neither of us took the time to blog about it.  Now that I still see developers using multiple config files, I’ve decided post this as a small project on RIAForge.org. I’ve called it Environment Config for lack of creativeness, I guess.

The basics:

It consists of 2 files, one XML file and one CFC.  In the XML file you define all your environments and properties and pass the location of the file to the CFC which will parse your XML file and return a structure with the properties. Is that simple!

The Anatomy of the Environment XML:

The XML structure has two main elements, “default” and “environment”.

Default  - Under default you add those properties that are common to all your environments

Environment – Define one per server environment.

Pattern – Inside Environment you’ll find the Patterns element which contains the Pattern. This is a Regex string that holds the server’s name or a Regex pattern.  So you can enter something like: “^myapp.local” or “^.*.local” to match anything that ends in “.local”.  You can define as many Pattern elements as needed per environment.

Property – Also located inside the Environment is the config element which contains the Property.  You can define as many Property elements as needed per environment.  If you define a property that was defined in the Default element, it will be overwritten by the one in the Environment. 

If you look at the sample environment.xml, you’ll notice that in the production environment, the pattern is defined as ‘.*’ which is pretty much a “catch all” pattern.  I recommend using this for production environments so that later on you don’t get a call from your client asking you why his site is broken since he acquired a new domain.

Thanks for your feedback and suggestions!

Leave a Comment : more...

cfform to generate dynamic PDF forms?

by Rolando on Jan.14, 2008, under ColdFusion

 I’m trying to figure out if there’s a way to generate dynamic PDF forms with ColdFusion or anything at all and ran into this at CFFORM reference page for CF8:

Incorporating interactive fields in PDF forms      

ColdFusion 8 lets you use the cfform tag to create PDF forms that contain static and interactive form fields. The cfform tag must exist within a cfdocument tag (where format=”pdf”). Only one cfform tag can exist within a cfdocument tag.

Completed forms can be posted to the server as an HTTP Post, or the entire PDF can be submitted as binary stream. If the PDF is submitted, you can use the cffile tag to save completed PDF form to a hard drive:

<cffile action=”write” file=”c:\savedpdf.pdf” output=”#PDF.content#”>

The output can be manipulated and extracted by using the tag.

Only the following cfform attributes are supported in generating PDF forms:

  • action
  • format
  • method
  • name
  • onSubmit
  • skin
  • style

To embed an existing PDF form generated by LiveCycle Designer or Acrobat, use the tag.

Then they provide the following example which has some obvious errors:

A simple PDF form     

<cfdocument format="pdf">
    <cfdocumentsection ../>
    ...
    ...
    <cfform type="html/xform">
        <cfinput type="textbox" name="employeeName" value="#fullName#"
readonly="true">
        <cfinput type="textbox" name="employeeID" value="#id#" readonly>
        <cfselect name="contributionPercentage" options="#optionsStruct#"
 required="true">
        <cfinput type="submit" name="SubmitAsHTTPPost">
        <cfinput type="submit" name="SubmitAsPDF" submitType="PDF">
    </cfform>
    ...
    ...
    <cfdocumentsection ../>
</cfdocument>

 

Of course I got all excited about it but after several attempts all I got was a
PDF document that looked like a form but that didn’t work at all. It was merely
a PDF Document.

 So I wonder, is this a big goof from Adobe or can you really create dynamic PDF forms with ColdFusion (without any LiveCycle interaction).

Leave a Comment : more...

Transfer Config App - Auto Generate your Transfer Config File

by Rolando on Sep.13, 2007, under TransferConfig

I've been working on a simple application that introspect any ColdFusion 8 supported database using cfdbinfo and generates the Transfer ORM config file for you.  It also works with the new (unstable) version of transfer meaning it handles composite key tables.

I've added a very simple front-end that let's you see all the tables Meta-Data, preview the XML Config File before creating it and of course it lets you create the file itself.

You can set a few config settings depending on what best works for you:

  • UUID Convention - This is meant for SQL server that does not have  UUID data type but instead we use char(35),so if you have this turned on every time a Char(35) is found will be interpreted as a UUID data type.

  • Generate PK - ask transfer to generate the PK value for you.

  • Collection Type - <array|struct> lets you choose wich collection type you want to use for the OneToMany relationships.

  • Relationship type to use - In transfer you can pick whether to use the ManyToOne or OneToMany relationships and this will vary depending on your needs. As of now you can only select this as a general setting meaning whatever you pick it will be used on all the Objects created. However both relationships will always be created, it'll just comment out the other one. So if you want to change for one or the other after the file is created all you need to do is uncomment those lines.

  • File name - By default I have the file named transferX.xml.  The destination of the file you can change for each site in the environment.xml file mentioned below.


Integrated with the application is something I had done sometime ago with the help of Rob Gonda (which he showed at CFUnited this year) but we never blogged about it.  That is the Environment Configurator  which is nothing else than an XML file with a CFC that lets you setup different environments and variables (ie Dev, Staging, Production).  I know, that's useless for the transfer file which is the same along environments …well I'm using it a bit different here.  Instead of copying the Transfer Config App into each one of my projects, I have it in a single location and I add each new site to the environment xml file (ie roland-lopez.com, adobe.com). Then, I add a virtual directory to each site called /transferConfig pointing to Transfer Config, so when the App starts it will notice which domain I'm comming from and will load the specific DSN, among other settings.

For version 2 of Transfer Config I plan to allow for custom settings of each object. So that you can pick things like the relationship type, collection type, generate PK, etc for each table …and yes a better UI.

You can submit bugs and/or requests for the next version at roland [at] soft-itech [dot] com

You can download the App at RIAforge.org

—modified on: 9/17/2007

I just added version 1.0.1 of Transfer Config this includes the following fixes and enhancements:

  • Fixed: App would break if database in use contained a table with no primary key defined.
  • Enh: change App to be able to run in transferConfig subfolder (can be run directly under the root too)
  • Enh: added ability to pick DSN directly from the view/form. The way this will work depends on your settings:
    • If you have the Admin password for CF you can add it to the environment.xml.cfm file and the CF Admin API will be used to get a list of DSN's.
    • If don’t have Admin privileges on the server, it will try to use the CF serviceFactory to get a list of the DSN’s.
    • If none of the previous two are an option, a text field will be used filled out by default with the DSN value you specified in the environment xml file.
  • Enh: Prevent direct access to the environment XML file for (obvious) security reasons.
  • Other minor enhancements.

—–

20 Comments : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...