Blog

Category Filtering: 'getrailo'

Remove Filter


Want a free ticket to CFUnited?

Posted by Luis Majano
14 Jul 2009 12:00 AM
I just found out that the Railo crew is giving away a free CFUnited entry ticket. So if you want to attend CFunited on somebody else's dime, now you can :)

http://www.railo.ch/blog/index.cfm/2009/7/14/Win-a-CFUnited-ticket

Railo likes to work with nulls

Posted by Luis Majano
09 Apr 2009 12:00 AM
I just found out about two nice functions in railo:

  • isNull()
  • nullValue()

Finally, a way to interact with java nulls easily. So all you do to create null values is do

if ( isNull( CacheManager.get('key') ) ){

writeoutput("object is not found in cache")

}

What if you need a null value?

cacheMap['luis'] = nullValue()

Two very simple functions, but they sure make life so so so much easier when integrating with java. This to me are my favorite two new functions.

Railo can do array notation from method calls

Posted by Luis Majano
06 Apr 2009 12:00 AM
I just found out about this by trying it out and thought wow, FINALLY!

Let's say I have a method that returns an array. Example below:

As you can see, a very simple example. So now, in my code outside my method I want to be able to access let's say item number 3 from the method call and the key called awesomeLevel from the structure call. Then I can do this:

item3 = getArray()[3];

MyAwesomeLevel = getStruct()['awesomeLevel'];

How cool is that, finally!! Array syntax from method calls.

Railo and multi-variable assignments rock!

Posted by Luis Majano
03 Apr 2009 12:00 AM
I found a neat little feature in Railo 3.1 which I myself is calling multi-variable assignments.

Let's say you want to assign a value to multiple variables in coldfusion. You would usually do this:

Name = "Luis Majano";

ColdboxAuthor = Name;

CodexAuthor = Name;

AwesomenessAuthor = Name;

That is really neat right, well, Railo makes it fun!

Name = "Luis Majano"

ColdboxAuthor = CodexAuthor = AwesomenessAuthor = Name

How about that!! I can assign values to multiple variables, by just concatenaning the equals. Keep exploring Railo and you will find some nice hidden gems.

Railo goes open source and sporting new looks!

Posted by Luis Majano
31 Mar 2009 12:00 AM
I am so glad to see this day as CFML becomes open source. Railo has just gone open source and WOW!! What an incredible engine. Not only that, but they are sporting 3 new websites:

The websites look phenomenal and we also get a documentation website powered by Codex. I wonder who did the initial documentation?

You can download the open source version of Railo from their nice downloads page.

Railo 3.1 Supports Optional Semicolons

Posted by Luis Majano
31 Mar 2009 12:00 AM
Wouldn't you know it? Railo 3.1 supports optional semicolons! I totally love this syntax enhancement as my cfscripting can become even less noisy by adding those pesky semi-colons. How cool is this:

/* Start Exporter */

sqlBuffer = createObject("java","java.lang.StringBuilder").init('')

/* Create Function Namespace */

createNamespace(fncNamespace)

/* Read fnc Library */

xmlDoc = xmlParse(expandPath('web-cfmfunctionlibrary_1_0'))

fncXML = xmlSearch(xmlDoc,"//function")

fncXMLLen = arrayLen(fncXML)

I like this! No more noisy semi-colons. Just beware that if you are doing multiple statements on a single line, you will actually HAVE to put in the semicolons.

function formatnow(){ return "#dateformat(now(),"yyyy-mm-dd")# #timeformat(now(),"HH:mm:ss")#"; }

A part from that, I love it!

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

Posted by Luis Majano
16 Dec 2008 12:00 AM
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);

Railo Resin Apache and Mac OS X A FAST Combination

Posted by Luis Majano
05 Dec 2008 12:00 AM
Installing Railo + Apache in Mac OSX

This step by step guide is to show you how to install Railo and create a connector to Apache in Mac OS X. I am now using Railo as my development environment due to its speed and strict coding that I can assign to it. This makes sure that every ColdBox release is what it is supposed to be. I am still amazed at how fast and stable Railo is and I highly encourage you to give it a shot!

Anyways, now for the fun.

1) Download Railo from http://railo.ch/en/index.cfm?treeID=224

I downloaded the All OS download: railo-3.0.1.000-resin-3.1.2-without-jre.zip (39 MB)

Once downloaded I unpacked it and installed it in

/Applications/railo

2) Remove some windows files, because I am a cleanup freak.

rm -rf httpd.exe setup.exe win32

3) Let's compile the apache connector by following these commands, but first cd into the Railo directory via your terminal.

$ cd /Applications/railo

$ ./configure --with-apxs=/usr/sbin/apxs --with-java-home=/System/Library/Frameworks/JavaVM.framework/Home

Update:

For java in 64 bit mode (snow leopard or leopard), use the following command:

./configure --with-apxs=/usr/sbin/apxs --enable-64bit

This should spurt out a long list of compilation checks and please look at my java home as my default jvm in my Mac. Once it finishes it should finish with the following:

configure: creating ./config.status

config.status: creating Makefile

config.status: creating modules/c/src/Makefile

config.status: creating modules/c/src/common/Makefile

config.status: creating modules/c/src/apache1/Makefile

config.status: creating modules/c/src/apache2/Makefile

config.status: creating modules/c/src/resin_os/Makefile

config.status: creating contrib/init.resin

config.status: executing depfiles commands

This means we are done. So now let's make and install the mod_caucho.so connector.

$ make

$ make install

After this, you should be A-OK. The script will copy mod_caucho.so to /usr/libexec/apache2/mod_caucho.so and modify your apache conf with

#

# mod_caucho Resin Configuration

#

LoadModule caucho_module /usr/libexec/apache2/mod_caucho.so

ResinConfigServer localhost 6800

CauchoConfigCacheDirectory /tmp

CauchoStatus yes

Now it is up to you if you want to configure specifc virtual hosts to use resin or not. Example:

ServerName railo.jfetmac

DocumentRoot /Users/lmajano/Documents/MyDevelopment/

Options Indexes FollowSymLinks MultiViews Includes

DirectoryIndex index.html index.htm login.cfm index.php index.cfm

ResinConfigServer localhost 6800

CauchoConfigCacheDirectory /tmp

CauchoStatus yes

SetHandler caucho-status

Now we open the /Applications/railo/conf/resin.conf and add a few aliases that map our web application to apache:

railo.mac

After that just fire up apache and the resin server by running:

/Applications/railo/bin/httpd.sh

After that, the server runs and your application is up and running!!

Update

Some people have not been able to compile mod_caucho because Apache is running in 64bit mode and the caucho mod is 32 bit mode. Here is some extra help for you:

Here's how to change your apache to run in 32 bit mode.

From Adobe.com

---------------------------------------------

To switch Apache from running in 64-bit to 32-bit on Mac OS X 10.5, do the following:

1. Go to /usr/sbin and make a backup of httpd (for example,

httpd.back).

2. Run the following command from the terminal:

sudo lipo httpd -thin i386 -output httpd

3. To confirm the resulting http architecture, from /usr/sbin, run

the following command:

file httpd

4. The file command should give httpd:Mach-O executable i386.

5. Restart Apache by running the following command:

sudo ./apachectl restart

6. The conf file (httpd.conf) location remains the same

(/etc/apache2).

Presenting at ColdFusion Camp 2008 in Munich, Germany

Posted by Luis Majano
28 Oct 2008 12:00 AM
I will have the privilege of attending ColdFusion Camp 2008 in Munich, Germany next month. Not only attending but of course speaking about ColdBox. This is my first European event and I am truly excited about the opportunity to attend and present. Get ready Munich!!

What: ColdFusion Camp 2008

When: November 27th from 9am to 6pm

Where: Conference center Orbis, OberschleiƟheim

Price: 35 Euros!

You can find more details at http://www.cfug.de

StringBuilder.length() does not work with Adobe CF and JDK 1.6.X

Posted by Luis Majano
11 Aug 2008 12:00 AM
I have been doing some string buffer testing and wanted to take advantage of using the new class StringBuilder that was implemented in jdk 1.5. I am running cf8 with jdk 1.5 and 1.6 and decided to do some tests with it. I found out that calling buffer.length() on a cf instance running on jdk 1.6 would fail but a call to the same length method on jdk 1.5 does not. Go Figure!!

Would this be a bug on the Adobe cf java proxy? It seems to me, because the same tests on Railowork (even faster to say the least)!!

To reproduce this error, just try this below:

The string is #myBuffer.toString()#

The length is #myBuffer.length()#

The error that Adobe CF produces is that the method length() does not exist. The only workaround for this is by lengthing the string produced, but it will definitely be slower than a direct length call:

Length: #myBuffer.toString().length()#

Site Updates

Entries Search