Entries Tagged as “Rapid Application Development”

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.   



Public Beta for ColdFusion and ColdFusion Builder is now available!

February 19, 2014 / Rakshith Naresh

  Performance | Thunder | Adobe ColdFusion | Mobile | productivity | Rapid Application Development | Splendor | web application development | web application security

In case you haven't already noticed,the public beta for the major version of ColdFusion codenamed Splendor and for the next major version of ColdFusion Builder Thunder is now available.

Here is where you can get access to the public beta for both the products on Adobe Labs - http://labs.adobe.com/technologies/coldfusion/

You can quickly go over what's new in ColdFusion Splendor here. There are also a couple of videos on the video tab that gives you a quick introduction to what's new in ColdFusion. The link for the documentation home page is at - https://wikidocs.adobe.com/wiki/display/coldfusionen/Home

There are lots of new features and enhancements in Splendor and in Thunder. We look forward to hearing your feedback during the public beta.

 

 

 

 


ColdFusion mobile features are not just about cfclient, but it is necessary

November 06, 2013 / Ram Kulkarni

  CF Summit | CFBuilder | ColdFusion | Mobile | productivity | Rapid Application Development | Splendor

This is a follow-up post on "Source code of CFSummit2013 mobile application" . There has been a lot of discussion in the comments of that post, as well as on a number of social media channels. I saw that some of the reactions were based on incomplete understanding of these features.

But first things first - Mobile features in Splendor and Thunder are specifically targeted for mobile application development. If you are not doing any mobile development or do not plan to do so in the near future, then these features may not appeal to you.

ColdFusion Mobile features are not just about cfclient

A lost of discussion is happening around cfclient. It is being assumed that this is a complete feature. Well, it is not. It is a part of overall mobile development features of Splendor and Thunder. These features can be categorized in four broad areas - 

Read More


Amazon Web Services Webinar - Leverage the power of Adobe ColdFusion on AWS

September 16, 2013 / Rakshith Naresh

  Adobe ColdFusion | Announcements | productivity | Rapid Application Development | web application development | web application security

Amazon is organizing a webinar on the 18th of September at 10 am PT titled 'Leverage the power of Adobe ColdFusion on AWS'. You can register for this AWS webinar here

Learn about the AWS offering from,

Tom Laszewski, Solutions Architect, Amazon Web Services

Chandan Kumar, Computer Scientist, Adobe

Akhila K. Srinivas, Software Engineer, Adobe

 


Blue Mango Theme Design By Mark Aplet

Super Powered by Mango Blog