Entries Tagged as 'Language enhancements'

We are excited to announce that the next versions of ColdFusion Server and ColdFusion Builder are now live and available

Thanks to everyone from the ColdFusion community who has contributed to this release in terms of constant feedback and support. 

Here are some of the highlights of ColdFusion 11 and ColdFusion Builder 3:

Mobile Application Development Workflow

ColdFusion 11 along with ColdFusion Builder 3 gives you a unique end-to-end workflow for mobile application development addressing the challenges associated with building, testing, debugging and deploying enterprise class mobile applications - both web based as well as installed mobile apps.

Language Enhancements

While there are a range of enhancements made to the language, some of the features that can be called out are full CFSCRIPT support, support for Member Functions and JSON enhancements.

PDF Functionality

ColdFusion 11 now leverages a new engine for HTML to PDF conversion that does an almost perfect job of converting most HTML/CSS to its corresponding PDFs pixel-to-pixel. Along with the new engine, CFPDF has additional functionality to support digital signatures and archiving PDFs. 

Security

ColdFusion 11 has a built-in mechanism to prevent access of Administrator or its components from external access. ColdFusion 11 has additional built-in functions to prevent XSS, thus allowing  concurrent logins through CFLOGIN. ColdFusion also supports mail encryption through CFMAIL.

For a more detailed overview of what’s new in ColdFusion 11, take a look at this link from the documentation.

ColdFusion Builder 3 bundled with ColdFusion 11

ColdFusion 11 Standard and ColdFusion 11 Enterprise is bundled with copy (ies) of ColdFusion Builder 3. With one copy of ColdFusion Standard, you get one license of ColdFusion Builder 3 and with one copy of ColdFusion Enterprise, you get three copies of ColdFusion Builder 3.

Java 7 Update 55

As you may be aware, Java has come up with an update (Java 7 Update 55) with critical security fixes. This update was released on 15th of April. ColdFusion 11, ColdFusion 10 and ColdFusion 9 have already been certified on Java 7 Update 55.

For ColdFusion 11, all attempts were made to include this update as part of the final CF11 installers though this was very close to our launch date. We ran into an issue with the installer with a third-party platform used by ColdFusion, on Java 7 Update 55. We have escalated this issue with the vendor and are working with them for a fix. For now, the Java version bundled with the final installers of ColdFusion 11 is Java 7 Update 51.

But we fully understand the importance of Java 7 Update 55 and want to assure the ColdFusion community that we are committed to fixing this issue. We are also planning to replace all the ColdFusion 11 installers to include Java 7 Update 55 as soon as we are able to obtain a fix from the vendor.

However, as always you can use Java 7 Update 55 with ColdFusion 11, ColdFusion 10 and ColdFusion 9 by pointing to an external Java location.

Linux support for the new PDF Engine

The Linux support for the new PDF engine in ColdFusion 11 will be available through an update within the next few weeks.

Availability of installers for CF10 and CFB 2.0.1

ColdFusion 10 installers and ColdFusion Builder 2.0.1 installers will only be available for download on adobe.com for a limited time – till the 14th of May, 2014. If you need these installers for later use, then please download them before the 14th of May, 2014.

Continuing the blog posts series on language enhancements, today, I am going to cover the Query functions and explain its various overloaded methods in detail. Before I discuss this feature, here is the list of language features added in ColdFusion Splendor.

Script syntax for Query tag is available in Splendor through the generic "Script support for tags". This generic solution works well for all the other tags except CFQuery. CFQuery, being a bit complex, necessitated a need to provide an easy to use script-syntax for query execution. So, to simplify it in a script block, the query functions have been added in Splendor. These are designed in-line with existing ORM execute functions. The general syntax of query functions are:
QueryExecute(sql_statement);
QueryExecute(sql_statement, queryParams);
QueryExecute(sql_statement, queryParams, queryOptions);

As shown above, query functions can be invoked by passing one, two, or three parameters. The first parameter, an SQL statement is mandatory and the other two (queryParams and queryOptions) are optional. 

Query params:

There are two different ways to pass a parameter to an SQL query: named and positional (unnamed). In named parameter, you use ":" as the placeholder and pass a struct to queryParam. For the positional one, "?" is used as the placeholder and the values of the parameters are passed as an array to queryParams. 

  //named parameter 
  QueryExecute("select * from Employee where country=:country and artistid=:id", {country='USA', id:1});
  
  // positional parameter
  QueryExecute("select * from Employee where country=:? and artistid=?", ['USA', 1]);

If required, the CFQueryParam attributes information can also be passed for executing a query. For this, the attributes of an individual queryParam are first defined in a struct and then this struct is passed, rather passing  a simple string or number, as a  value of that param. To understand it better, an example is shown below:

//queryparams with attributes
QueryExecute("select * from Employee where country=:country and empId=id, {id:101, country:{name="USA", CFSQLType='CF_SQL_CLOB', list=true }});

QueryOptions

QueryOptions is a struct which contains different attribute values of a Query tag. In the following example, a "datasource" attribute has been passed in the queryOptions parameter. Similarly, all the attributes (except name) can be passed to queryOptions before executing a query.

 QueryExecute("select * from Artists where artistid=:id", {id:1},{datasource= "cfartgallery"});

This feature has been covered in details in Splendor document. See the doc for more information.

We have a series of e-seminars lined up that gives you a good understanding of the various features of ColdFusion Splendor, which is now in public beta. If you haven't downloaded ColdFusion Splendor already, here is the link where you download the public beta.

Here are the list of e-seminars:

1. Title- Public Beta E-seminar: ColdFusion Splendor Overview Date: 1st April Time: 8 am pacific. Find the recording for the e-seminar here

2. Title- Public Beta E-seminar: Everything about Mobile Application Development Date: 10th April Time 8 am pacific. Find the recording for the e-seminar here

3. Title- Public Beta E-seminar: Delicious Language Enhancements in ColdFusion Splendor Date: 12nd April Time 8 am pacific. Find the recording for the e-seminar here 

4. Title- Public Beta E-seminar: Pixel Perfect PDFs in ColdFusion Splendor Date: 24th April Time 8 am pacific. Find the recording for the e-seminar here

 

 

 

In the previous post, I blogged about JSON serialization enhancements and covered a couple of features around it. This post, a continuation from the last one, will cover the remaining features added in ColdFusion Splendor to serialize a ColdFusion object better. Before going into the details of the remaining improvements, here is the complete list of JSON features.

  • Data type preservation for Query and CFC 
  • Case preservation of struct keys
  • Added "Struct" as new QueryFormat
  • Custom serializer

Added "Struct" as new QueryFormat

In ColdFusion, Row and column are the supported types to serialize a query object. However, none of these two formats are fit for the jQuery type JavaScript framework. These JavaScript frameworks work well with column-value (like struct) format and to facilitate easy integration with these frameworks, a new query format "struct" has been introduced in ColdFusion Splendor. So, starting from Splendor, 3 different format types rowcolumn, and struct are now supported to serialize a query object to a JSON string. For example, to serialize a query object with 3 rows and 2 columns (colour,id), the serialized JSON string for row and struct query format will look like:

row  format:   {"ROWCOUNT":3, "COLUMNS":["COLOUR", "ID"], DATA:{"colour": ["red", "green", "blue"], "id": [1,2,3]}}

struct format:  [{"colour":"red", "id":1}, {"colour":"green", "id":2}, {"colour":"blue", "id":3}]

As you can notice, the struct format is based on the key-value pair and is quite simple. The only downside of this format is the repetition of the column names. Here, the column names are repeated for each and every row.

Custom serializer

ColdFusion Splendor has enhanced JSON serialization support to help you hook your own custom serializer for serializing a ColdFusion object. The custom serializer enables you to register your own handler for serializing and deserializing the complex object. If the serializer is not specified, ColdFusion will use the in-built serialization handler.

Steps to use the custom serializer: There are two steps involved to hook a custom serializer in ColdFusion.

 1. Implement the custom serializer:  The customSerializer handler, a CFC, has four functions for you to implement.

  1. canSerialize
  2. serialize
  3. canDeserialize
  4. deserialize
 2. Register the handler:  Handler needs to be registered by adding its entry to application.cfc as following:
Application.cfc
<cfset this.customSerializer="MyCustomSerializer" />

This custom serializer has been explained in great details in ColdFusion Documentation

 

I started a series of blog posts on language enhancements and so far covered Script support for tags and Member functions. Today, I will be blogging about the new features added in ColdFusion Splendor to improve JSON serialization. Before I dive into the details of JSON serialization enhancements, here is the list of the language features:

JSON serialization was first introduced in ColdFusion 8 and we constantly worked on improving this feature continously over the past several ColdFusion versions.

The complete list of JSON-level enhancements added to ColdFusion Splendor are:

  1. Data type preservation for Query and CFC 
  2. Case preservation of struct keys
  3. Added "Struct" as new QueryFormat
  4. Custom serializer
Data type preservation for Query and CFC
It has always been a challenge to rightly identify the underlying data type of a CFC property or of a column data of a query object. Prior to Splendor, ColdFusion used to check whether a data type can be converted to a number or boolean. If it can be converted, ColdFusion will automatically convert the property value to number/boolean irrespective of whether the property values needs conversion. Starting from Splendor, the metadata of the query, retrieved from the underlying database, will be used to identify the right data type of a column and the column data will be serialized based on that. Similarly, for a CFC, the CFC metadata will be retrieved and used to detect the right data type of the CFC property to serialize into.
Entity.cfc
 <cfcomponent persistent="true" table="partners" ... >
     <cfproperty name='zipcode' type="string" />
</cfcomponent>
index.cfm
   <cfscript>
        t = createObject("component", "Entity");
        t.setData("01003");
        writeoutput(serializeJSON(t));
   </cfscript>  

CF10 output      : {"zipcode": 1003}
Splendor output : {"zipcode": "01003"}

In the above example, unlike in ColdFusion10, the zipcode value is serialized as a string  and not as a number. Though the value looks like a numeric one, it will not be serialized as a number rather the data type information is retrieved from the underlying CFC metadata and  will be used to serialize it. 

Case preservation of struct keys

Prior to Splendor, ColdFusion did not preserve the case of a struct key but it converted it to the uppercase. Starting from Splendor, ColdFusion will preserve the original case of the struct key in which it is defined. But in case if you want to go back to the old ColdFusion behavior, you can use either the application setting or ColdFusion Administrator setting to switch back to the old behavior.  The following code will help you understand how this behavior works in ColdFusion10 and now:

<cfscript>
   data = {};
   data.empName ="John";
   data.age = 21;
   writeoutput(serialize(data));
</cfscript> 

Output in ColdFusion10   : {'EMPNAME'= 'John', 'AGE'=21}
Output in Splendor          :  {'empName '= 'John', 'age'=21}

To keep this post short, I will be blogging the remaining JSON features in a separate post. Please refer the ColdFusion Splender public beta documentation for more details on JSON enhancement.