Entries Tagged as Tips
In Railo Version 4.1 we have put some thought into making your applications portable. One of most obvious things that comes to mind as a requirement for an application is defining the datasource(s) that it needs.
Already you can define the name of a datasource you are using by doing:
In version 4.1 we have enabled you to define the WHOLE connection string to the datasource in the Application.cfc file. The easiest way to see this is to actually create a datasource connection in the Railo Web Administrator. Once you have done that click on the "Edit" datasource button:

Then, at the bottom of the Edit Datasource screen you can see the snippet that you can use to actually define this datasource in the Application.cfc, for example:

You can now copy and paste that into your Application.cfc:
delete the datasource from the administrator and use the "mydatasource" datasource as you would have done anyway!
The generated example above is the "native" way that Railo needs datasources defined. But this is not all, we have a "simpler" way to define datasources, and that is by giving it the fields you would expect in the administrator. So for the above example (where we used the class and connection string) we can also define it with the field names you would expect:
Default and Inline Datasources
Defining default datasources can also be done by using the this.defaultDatasource parameter. You can then either refer to a datasource you have defined:
or create a datasource within the parameter itself :
Finally this is also true for ORM settings. You an define a datasource within your this.ormsettings structure too:
Side note about passwords:
You might notice that the password is encrypted in the "password" attribute. This is shown by the "encrypted:" prefix to the long string of code. What Railo has done is get your password and encrypted it. Making it safer to use within your code.
password:"encrypted:94fae38de2f70330df8ed879571bef699cd4bde7241f94f2309ee97fd0358be8".
Of course, you don't have to use encrypted strings. you can inou can replace the clear text password if you like rather than using the "encrypted:xyz" format.
Have fun with Railo!
Tags:
Features · Railo 4.1 · Tips
November 20, 2012 · 1 Comment
Today I needed to compare two arrays in order to find out what the differences are between the two arrays. In PHP there are around 10 dfferent functions to find out the differences between two arrays. So what I ended up doing is to create a function arrayCompare().
[Read more →]
Tags:
Features · HowTo · Railo 4.0 · Tips
September 04, 2012 · 2 Comments
One of the downsides of CFHTTP is that it does not work with NTLM authentication. The latest version of Railo 4.0.1 allows now to use NTLM authentication as well.
[Read more →]
Tags:
Features · HowTo · Preview · Railo 4.0 · Tips
With Railo 4.0 we have introduced the command line interface (CLI) that allows you to call .cfm files from your
current webroot. No webserver and no application server is involved when calling .cfm templates through the CLI.
For the moment this functionality is a little restricted but it will change until the final release of the CLI in Railo 4.0.
[Read more →]
Tags:
CLI · Features · Performance · Railo 4.0 · Tips
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 →]
Tags:
Configuration · Performance · Tips
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 →]
Tags:
Configuration · HowTo · Tips
This is a feature in Railo that confuses new Railo users very often. Railo comes with two types of administrators. In fact there are two type of administrators for every website you host on a system. In Railo all the settings you make in the Railo Web Administrator affect only the website you are calling it from.
[Read more →]
Tags:
Configuration · HowTo · Tips · Websites
Imagine you would have to pass an applications name as an url parameter. There is a shorter way of doing this without having to use a temporary variable.
[Read more →]
Tags:
HowTo · Tips
Sometimes it is important to know whether a certain variable points to the same instance of a complex object than another one. You can easily find that out with the following operator
[Read more →]
Tags:
HowTo · Tips
CFML only has some equivalents to the available tags in CFSCRIPT. In Railo you can now use almost all tags by just removing the <cf and replacing the last > with a ;
[Read more →]
Tags:
CFML · HowTo · Tips