Railo awesomeness: some cool functions and options

I've been working with the Railo source code all day, and noticed some cool functions within the code. I'm taking a minute to share 'em...

querySlice(query, startrow, rowcount)

This function returns a part of the original query, defined by the startrow and rowcount.

Documentation: http://wiki.getrailo.org/wiki/FUNCTION:QUERYSLICE

Example code:

<cfset q = querynew('column1') />
<cfset queryaddrow(q) />
<cfset querysetcell(q, 'column1', "this is row 1") />
<cfset queryaddrow(q) />
<cfset querysetcell(q, 'column1', "this is row 2") />
<!--- this will dump query 'q', but only containing row 2! --->
<cfdump var="#querySlice(q, 2, 1)#" abort />

isZipFile(filepath)

Return yes/no whether the given file path is a zip file.

Documentation: http://wiki.getrailo.org/wiki/FUNCTION:ISZIPFILE

Example code:

<cfzip action="zip" source="/" file="testZip.zip" recurse="no" />
<cfoutput>
isZipFile('testZip.zip'): #isZipFile('testZip.zip')#<br />
isZipFile( getCurrentTemplatePath() ): #isZipFile( getCurrentTemplatePath() )#
</cfoutput>

someObject["set#key#"](value)

This might also be possible (?) in the most recent versions of other CFML engines, but I sure missed it when I worked with Coldfusion 7 and 8.

When you need to update values in a CFC (bean or valueObject) by calling it's setters, but you don't know beforehand which values you need to set, then I always had to use <cfinvoke>:

<cfinvoke component="#someObject#" method="set#key#">
<cfinvokeargument value="#value#" />
</cfinvoke>

Railo allows you to use struct notation:

<cfset someObject["set#key#"](value) />

Now that's a bit shorter and cleaner!

No Comments

Railo Tasks viewer extension - version 1.2.6

Just a quick post this time, about my newest Railo extension!

The Tasks Viewer extension shows all registered Scheduled tasks on the Railo server, ordered by web context. The detail page will show you all matching log entries (from scheduler.log), and shows a graph of Missed/Succesfull/Errored executions.

This graph is created by looking at the available log data. Logs are deleted when they have grown to 1 MB, so there might be times when you have very little info, and times when you have a lot. That is out of my control unfortunately.

Another feature is the Alert Service, which periodically sends you an email if any tasks threw an error, or were not executed at all.

13 Comments

Beginners, or Why the web is so hackable

Image of conversation on Stack Overflow

Nooooo, off course users can't change hidden values ;-)

From: http://stackoverflow.com/questions/1857032/jquery-ajax-post-not-working#link-post-1857032

No Comments

The Railo team wishes you a great Railo new year!

Last December, one of the busiest months for most developers, almost everyone in the Railo team took the time to create a video message for all Railo users, contributors, friends, and clients. This video is now online, wishing you a Great Railo New Year!

Railo video screenshot

1 Comment

Railo 3 for beginners book now pubished!

railo book coverMark Drew, CEO of Railo Technologies Ltd in the UK, decided to write a book about Railo. When his idea got accepted by publisher PacktPub, he asked the rest of the Railo team if we wanted to write one or more chapters as well. I immediately said yes, and then found out that even writing one chapter of a book takes a huge effort. So I researched, I wrote, and even learned some new stuff while I was writing. It was a great experience to write for something that I am already passionate about. Trying to make the reader enthusiastic, while not being too techy all the time, was a nice challenge.

Mark, and also Gert Franz and Jordan Michaels, did a great job there! The book is absolutely a must-read for anyone using Railo, and wanting to learn about Railo! It not only covers CFML basics, but goes into all areas to get the most out of Railo Server.

Read more about, or buy the Railo 3 for beginners book at packtpub.com!

No Comments