ColdBox 2.6.2 is now released, merry x-mas!!


In full X-Mas spirit, here is my X-Mas Gift to the ColdFusion Community: ColdBox 2.6.2 Final Release codename series "FAITH".  This is a major maintenance release that is full of joy and goodies.  There have been over 33 critical fixes to the core, over 4 major sample applications added, over 5 more documentation guides and about 30 nice little additions that will make you giggle with joy!! So what are you waiting for, download it now!

Enjoy it and don't bother me as I leave for vacation tomorrow to El Salvador, to enjoy lots of sun, beach, good food and family!!





Railo's cool serialize() method, serialize anything!


I have been developing more and more on Railo and I am really liking some of its unique features due to its simplicity and total awesomeness. Here is a small tip on how to serialize complex objects such as queries, structures, arrays, and a whole gammut of all those types NESTED!!. All you need to do is call the serialize() method to convert the entire complex object into its string represenation. Then call evaluate() and Railo will evaluate the text back to its original object. EASY!!

At least much easier than trying to do serialization and deserialization with java. Anyways, I thought I would share this little tip:

myStruct = {fname:'Luis',lname:'Majano',great:'You Know it!!',
         dates:[now(),now()+1,now()+2],
         TodayIs:'#now()#'};
dump(myStruct);

//Serialize the struct MySerialization = serialize(myStruct);

writeOutput("MySerialized Structure: #MySerialization#");

//Reinflate it back. NewStruct = evaluate(MySerialization);


dump(newStruct);





Tip when creating case sensitive structure keys in ColdFusion


This is a tip and reminder (I just spent like 10 minutes shouting why why why!!), of a very subtle difference when creating structures in CF. AT first glance creating something like the following will produce what you expect:

mappings = structnew();
mappings.FirstName = "Luis";
mappings.LastName = "Majano";

You would say that the keys for this structure would be "FirstName" and "LastName" would you? Well, the answer is NO!! The keys would be "FIRSTNAME" and "LASTNAME" because the are uppercased by CF. If you really want to keep case, then don't use dot notation but array notation:

mappings = structnew();
mappings["FirstName"] = "Luis";
mappings["LastName"] = "Majano";

By using array notation you are explicitly setting the key with the correct case. I re-discovered this gem by yes, UNIT TESTING, the ColdBox caching engine and some tests where failing because the keys could not be found. Well, DUUHHHH!!! You where assigning them wrong. Anyways, I thought I would share my stupidity on the matter and hopefully save someone or even myself in the future, the few minutes of "WHY WHY WHY!!"




 


ColdBox 2.6.2 : FAITH