Entries Tagged as “scripting language”

Language Enhancements in ColdFusion Splendor - Improved JSON serialization 2

April 03, 2014 / Awdhesh Kumar

  ColdFusion 11 | Language enhancements | Rapid Application Development | scripting language | Splendor

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.

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

 


Language Enhancements in ColdFusion Splendor - Improved JSON serialization

April 02, 2014 / Awdhesh Kumar

  ColdFusion 11 | Language enhancements | Rapid Application Development | scripting language | Splendor

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.   



Pre-release for new platform support

February 08, 2013 / Rakshith Naresh

  Caching | Adobe ColdFusion | Adobe ColdFusion 10 | Announcements | Rapid Application Development | scripting language | web application development

[Update: Support for Windows 8 and Windows 2012 announced for ColdFusion 10 and ColdFusion Builder 2.0.1 : link]

[Update: Pre-release not open anymore]

We are opening up for a short pre-release to get your feedback on the support for new platforms for ColdFusion 10.

Here’s the program description for the pre-release:

The ColdFusion 10 – New Platform Support Prerelease program is intended to get feedback from the pre-release participants on the new platforms that we are supporting for ColdFusion 10. The scope of this prerelease is to ensure that ColdFusion 10 is functional on the new platforms - Windows Server 2012, Windows 8 and OS X 10.8 just as on the existing platforms that ColdFusion 10 is currently supported on.

 

If you are interested in participating in this pre-release, send an email to rakshith@adobe.com indicating that platform (Windows Server 2012/Windows 8/OS X 10.8) that you will be able to give us feedback on. The pre-release will open to a limited number and for a very short duration. So do send in your interest soon. We are also looking to get a balanced feedback across all the three platforms and that is the reason indicating the platform that you will be able to test on becomes important.


 


Product Roadmap for ColdFusion

August 13, 2012 / Rakshith Naresh

  Adobe ColdFusion | Announcements | Application Server | creating a website | Rapid Application Development | scripting language | web application development | web programming

Here is the public facing roadmap for the next two major versions of ColdFusion. As with any other product roadmap, The details listed in it are high level themes/directions that are being considered for the future releases and it is not possible to provide more details about individual items at this time.

The intended future features/directions described in this document are under consideration by Adobe Systems and are not commitments for future products, technologies, or services. The roadmap is subject to change at Adobe Systems’ sole discretion and Adobe Systems does not guarantee the features or release dates. 

This roadmap will also be available on the product website soon for download.


Adobe ColdFusion Mobile and HTML5 Survey

June 14, 2012 / Rakshith Naresh

  HTML5 | Adobe ColdFusion | Announcements | creating a website | productivity | Rapid Application Development | scripting language | web application security

I have posted the Adobe ColdFusion Mobile and HTML5 survey here. Please spare a few minutes to help Adobe take the right steps to build the future of the product that you love - Adobe ColdFusion!


Blue Mango Theme Design By Mark Aplet

Super Powered by Mango Blog