Entries for month: May 2012

Railo 4.0 Previews: Member Functions

May 31, 2012 · 15 Comments

For a long while Railo has had a number of functions available for you to be able to modifyand work with collections such as Arrays, Structures and Queries. These functions take the format of Array*(), Struct*() and Query*().

Some examples of these functions are:

  • Arrays: arrayeach, arrayprepend, arrayslice, array, arrayset, arrayfind, arraysum, arrayfilter, arrayappend, arraysort, arrayreverse, arraymerge, arrayclear, arrayfirst, arraycontains, arrayindexexists, arraydelete, arrayresize, arrayfindallnocase, arrayfindnocase, arraymax, arrayinsertat, arrayavg, arraydeleteat, arraycontainsnocase, arraynew, arraytostruct, arraylast, arrayisdefined, arrayfindall, arraymid, arraymin, arrayswap, arrayisempty, arraylen, arraytolist
  • Structs: structupdate, structinsert, structkeytranslate, structfindvalue, structget, structdelete, structfilter, structfindkey, structappend, structcopy, structkeyexists, structfind, structnew, structkeyarray, struct, structisempty, structcount, structsort, structclear, structeach, structkeylist
  • Query: queryslice, querysort, querycolumnarray, querycolumncount, queryaddrow, querysetcell, querydeletecolumn, querydeleterow, querynew, queryaddcolumn, querygetcell, querycolumnlist, querycolumnexists, query, queryrecordcount

In Railo 4.0 we are adding the ability to use them as methods attached to the collections themeselves, so so that instead of doing ArrayLen(myArray) you will simply be able to do myArray.len().

Let's look at some examples: Sample Objects:
These are the objects we are going to be modifying:
<cfscript>
   myItems = ListToArray("one,two,three,four,house,dog,ball");
      myStr = {
         one: "Onsey",
         two: "Twosey",
         three: "Thressey"
      };
   </cfscript>

New Way of using the objects
In Railo 4.0 we can now do the code:
dump(var=myItems.len(), label="Shortcut for ArrayLen(myItems)");
Which would give us the following:

Appending is pretty easy too:
myItems.append("elvis");
   dump(var=myItems, label="Shortcut for ArrayAppend(myItems, 'elvis')");


We can now even loop using a closure:
var filter = function(arg1){
      dump(var=arg1, label="key of the struct from a closure");
      dump(var=myStr[arg1], label="value of the struct");   
   };
      myStr.each(filter);


And of course, this also works on Structures (and Queries):
dump(var=myStr.keyList(), label="List Keys");
   dump(var=myStr.keyExists("one"), label="Key Exists");



15 CommentsTags: Preview

Railo 4.0 Previews: Memory Monitor Extension

May 30, 2012 · 2 Comments

An extension that we released a little while back and have been getting feedback on is the Memory Monitor Extension.

Once installed, this extension adds a new section in the Railo Server Administrator that allows you to inspect the memory of your SERVER, APPLICATION and SESSION scopes

[Read more →]

2 CommentsTags: Extension · Preview · Railo 4.0

Railo 4.0 Previews: Cached Functions

May 29, 2012 · 13 Comments

In this first post of the Railo 4.0 previews, we are going to focus on the Cached Functions feature. In Railo 4.0  you can cache your functions and methods in a CFC, so that after the first request the results and output are  obtained from cache rather than re-evaluated each time. 

Let's look at an example.

Take the following code in CacheDemo.cfc:

component {
   function getTime(String name, Numeric age)
         cachedwithin="#createTimeSpan(0, 0, 0, 10)#" {
      return Now() & " " & arguments.name & " " & arguments.age;
   }
}

You can see that we have added the argument cachedwithin to the getTime function, when we call this multiple times, we will get the same result, as now the output and result of the method are cached!:

<cfset comp = new cfcs.CacheDemo()>

<cfdump var="#comp.getTime()#" label="Inital call">
<cfset sleep(1500)>
<cfdump var="#comp.getTime()#" label="Cached call">

<!--- now with attributes --->
<cfdump var="#comp.getTime("Elvis", "29")#" label="Inital call">
<cfdump var="#comp.getTime("Sean", "42")#" label="Inital call">
<cfset sleep(1500)>
<cfdump var="#comp.getTime("Elvis", "29")#" label="Cached call">
<cfdump var="#comp.getTime("Sean", "42")#" label="Cached call">

Results:

You can even cache a call to function within a page, not just components:

<cffunction name="cacheTest" cachedwithin="#CreateTimeSpan(0,0,1,0)#">
   <cfreturn Now()>
</cffunction>

<cfdump var="#cacheTest()#" label="Initial Call">
<cfset sleep(1500)>
<cfdump var="#cacheTest()#" label="Cached Call">

Results:

13 CommentsTags: Preview · Railo 4.0

Railo at cf.Objective(): The Evolution of Railo

May 22, 2012 · 16 Comments

Last week, most of the Railo team were at the cf.Objective() conference in Minneapolis, Minnesota. This is a great conference for us as we love showing the new things we have been working on to a live audience. 

This year, we had the opportunity to show off some of the great new features of Railo 4.0 which we will be releasing a public beta in June. But this year was also special, we had a different announcement to make and this is what we are really excited about. 

Railo Technologies, the company behind Railo Server is evolving. We have been working with a number of companies in Europe and the US to bring to you a new entity called "The Railo Company". This new version of Railo Technologies will be the next iteration of our plans to bring to you the best CFML Server platform, not just for the next few years but to guarantee  the development of the Railo Server for the next 10 years and more. 

The investors are a range of European companies that have been delivering CFML based solutions for many years and with their support and knowledge we can see a bright future ahead.

Some of the companies are well known to you, some not so much so, but our investors are:

Gert Franz, CEO of Railo Technologies said:

This is a watershed moment for Railo as we can now promise the continued quality and innovation that has marked Railo’s development to date and ensure the global market that Railo is here to stay.
I am very happy with the newly founded Railo company and the trust the investing companies around the world put into us. It will give us the unique opportunity to guarantee the existence of CFML for the next 10-15 years. Lots of companies have invested heavily into CFML, trained and educated their staff and released lots of software based on CFML.
This venture allows them to continue trusting what I truly think is the best development platform for the web.

What will change for you?
Nothing will change for most of our users, you will be getting the same Open Source engine, but now with added resources dedicated to adding features, fixing bugs and providing documentation. We will be announcing a number of incentives and licensing options over the next few months. 

What is a major boon is the knowledge that you will have a stable company, with strong backers with no hinderance to the brand itself. 

In essence what we are saying to all CFML developers is:

CFML is HERE TO STAY
We are MARKETING it
We are SUPPORTING it
We are DEVELOPING it
For the next 10 years and foreseeable future

You can view the full press release on the Railo Website

16 CommentsTags: Community · Conference · Open Source · Partners · People · Railo 4.0

Prevent threading problems with local scope

May 21, 2012 · 2 Comments

By default, variables defined inside a function or method are stored in the variables scope (of the template or the component). This can lead to threading problems if - for instance - a component is stored as a singleton in the application scope. Railo allows you to prevent this problem by controlling the local scope.

[Read more →]

2 CommentsTags: Configuration · HowTo · Performance

Improve performance by turning off Scope Cascading

May 14, 2012 · 9 Comments

Scope cascading, also known as scope precedence makes it easier for inexperienced developers to code, but slows down server performance. In Railo, scope cascading can be turned off.

[Read more →]

9 CommentsTags: Configuration · Performance · Tips

Configure contexts individually

May 07, 2012 · No Comments

Railo Server creates a new web context for every website running on the same Railo instance. And since you have an individual web administrator available for each website, you can define different settings for each website which for instance allows you to configure two websites that they run in two time zones.

[Read more →]

No CommentsTags: Configuration · HowTo · Tips