ORM on Railo
Gert (of Railo) has just tweeted that if you ping them via their Contact form they'll give you access to the pre-release group.
This is a good chance to test your CF9 apps against Railo implementation or just to give ORM a whirl
Gert (of Railo) has just tweeted that if you ping them via their Contact form they'll give you access to the pre-release group.
This is a good chance to test your CF9 apps against Railo implementation or just to give ORM a whirl
Another one of those features that I knew was is in CF 9 but didn't know was in Railo and thats Application wide datasource name.
What this means is that in your Application.cfc (NOT .cfm!) you can set a per-application datasoure which lets you ommit the "datasource" attribute in your <cfquery> tags.
Your Application.cfc
Your test.cfm page
Pet Rescue SOS is a site I've had a hand in putting it together, put simply, is the place where you can register your pets, have them assigned a unique tag and identity number which can used to identify and locate your pet anywhere in the world. This service is available online 24hrs a day and you have access to your own registration section from where you can manage your account and pets.
Below for anyone interested is some of the tech specs:
I've been meaning to blog this for a while.
When it comes to getting rid of the amazing amount of whitespace CF can generate in your page there are quite for tricks to getting around this from multiple tags to server filters that you can use.
With Railo its a little more simplier. Log in to your admin panel, go to "Output" in the left hand side and check "Whitespace management: Removes all white spaces in the output that follow a white space".
And the price of the ticket should make the tightest of managers happy - €0,00 (thats £0.00 or $0.00). You read that right, its free as in beer, so check out the scotch-on-the-rocks.co.uk site for more information. Below are the dates and locations. I'm already registered for London and trying my hardest to get to the Amsterdam one as well.
| Location | Date | |
|---|---|---|
| Munich | October 19th | [Register] |
| Zurich | October 21st | [Register] |
| Milan | October 23rd | [Register] |
| Amsterdam | October 26th | [Register] |
| Brussels | October 27th | [Register] |
| London | October 29th | [Register] |
Railo 3.1 has been released. This see's a year of development come together for the open source CFML engine.
I've been running the beta source successfully for a couple of sites with no issues.
Check out the Press release, Whats new, download it, or even suggest new features and vote for others.
Updating Railo couldn't be easier. In case you didn't know, from the Administrator under Services go to Update and if a patch is available you can "Execute Update"
Whats even nicer is that you can change where you get your update from and if you want to be on the edge you can point the update url to http://dev.railo.ch/. This is currently looking at 0.24 and will give you access to the new looking admin (follow the links below for screenshots)
This is one of those features I know is coming in ColdFusion 9, but I don't know if its new in Railo 3.1.0.024 or been there for a while?
Anyway i've just found out you can "var" your variables in a CFC at any point. This isn't copying the way CF9 is planning on handling this by adding it to the LOCAL scope but it does mean you don't have to put everything at the top. Even though I'll most likely keep all my vars at the top for now its good to know that the following bit of code which in the past would throw an error now works fine.
[sourcecode language="plain"] <cffunction name="text" access="public" returntype="string" output="false"> <cfset doSomethingFirst() /> <cfset var b = "set second" /> <cfreturn b /> </cffunction> [/sourcecode]
The Ternary Operator and Railo
With CF9 beta out the blogs have been busy looking at all the new features. There has been some great reads and they've substituted for the fact that I haven't had the time to look at the new version myself yet.
Whats also been a good experience is that they have given me the chance to learn new stuff about Railo that I hadn't realised. The first one is that it already has Ternary Operator. This is a way of writing an IF/ELSE block in a single statement:
[sourcecode language="plain"] $variable = condition ? if true : if false [/sourcecode]
So in my CFSCRIPT block I have:
[sourcecode language="plain"] <cfscript> val = (true ? "A True Response" : "A False Response"); writeOutput(val); </cfscript> [/sourcecode]
After I found the Ternary Operator on Railo I've decided to have a look over the Tags documentation, and Functions documentation viewer on Railo Wiki.
Then I came across CFStopWatch. It works like CFTimer in that its used to determine how long it takes for a block of code to execute. The difference is that CFStopWatch stores the time to execute in a variable so you can reference it later. It works by wrapping the tags around the code block you want to execute and setting the time to a variable:
[sourcecode language="plain"] <cfstopwatch label="myLabel" variable="var" > CFML logic goes here <!--- pause for 1 second ---> <cfsleep time="1000"/> </cfstopwatch> <cfoutput><p>Your code took #var# milliseconds to run</p></cfoutput> [/sourcecode] Running the above code will outputCFML logic goes here Your code took 1000 milliseconds to run
I can see me using this when running code blocks which I know might take ages, you could write of the time to a log or even send an email.
I sometimes forget how useful/powerful RegEx can be. Take the following bit of CFIF logic
[sourcecode language="plain"] <cfset username = trim(form.uname) /> <cfif len(username) LT 4> <cfset errorMsg = "Your username is too short" /> <cfelseif NOT reFindNoCase("[\w]", username, 1, "false")> <cfset errorMsg = "Your username is too short" /> </cfif> [/sourcecode]A quick regex guide: the "\w" reference stands for "word character", which translates to [A-Za-z0-9_] n.b.the underscore as well
You can actually add on to the regex and at the same time cut down a lot of the logic by doing the following:
[sourcecode language="plain" gutter="true" toolbar="true" wraplines="true"] <cfif NOT refindnocase("[\w]{4,}", username, 1, "false")> <cfset errorMsg = "Usernames must be 4 characters in length and contain [A-Za-z 0-9 _" /> </cfif> [/sourcecode]The key is "{4,}". Using the curly braces to specify a specific amount of repetition of "word characters" and is equivilant to "len(username) LT 4"
Please update your bookmarks and feeds for my site.
I now have a Mango Blog at:
http://www.andyjarrett.com/blog
Feed URL: http://feeds.feedburner.com/andyjarrett
This was meant to be a guide about setting up your server with Linux, Railo, Apache, and MySQL but I've dropped Apache. Why? Well its an overhead I don't need. Resin functions perfectly well as a HTTP server and it does all I need. Why add another bit of software to fail? .... simplify :) In the long run I might change but for now I'd rather save the resources.
So ... where did this guide come from considering there are quite a few guides for this setup? Well for one reason or another I just didn't get on with them and by the end something went wrong which was mainly because I am Mac boy more than a Linux guy and sometimes I just missed the points here and there. The aim of my guide is to be clear and simple. So with a fresh Ubuntu install i'm planning on gettingt Railo running via Resin so I can call http://www.mysite.com/index.cfm
I won't lie, to make this post I have "borrowed" from other sources out there which I will try and link to at the end.
Im running Ubuntu 8.10 (Intrepid) without a graphical interface.
Note: If you are doing this on a clean, new server then before you even read on check out Slicehost.com documentation about setting up a Ubuntu server. These guides are the best and clearest I've seen online to date and cover everything you need!!!!
On to Railo
Well I've taken the plunge and moving all my personal projects over to Railo. And so the far the move has been pretty straight forward. Im still playing around with my JVM settings as my VPS has only 256mb memory, so I am just trying to get everything just right.
Though saying that I might just push up to 512mb depending on how adding the next couple of sites being loading on goes.
In case you've missed the blogs, tweets, and other general chatter, Railo 3.1 (open source) is released to the public. Check it out at getrailo.org/.
Also, in a dubious April 1st post Mark Drew has joined the team at their UK office in London as CEO!! (Congrats Mark!!)
Also the Railo Blog has a post linking to Installation guides. Obviously I haven't checked them all but Luis Majano's (of ColdBox) does have an excellent Railo (Resin) Apache and Mac OS X guide
The last session of yesterday which I didn't get a chance to blog about, due to discovering the free <cf_beer>, was Railo on the Rocks.
Gert spent the first part of session detailing what Railo is and how its changing from the 1.1 beta to the 2.0 version due to a change in the underlying architecture. He then went on to explain some of the key differences with the Railo administration functions, and how it offers more control to the overall server admin, which then cascades down into individual admin account per web context (domain/web site).
Next was resources. Resources at the heart are mappings with one key differnce the mapping no longing has to be a physical drive. You could apply a mapping to an FTP account even a zip file. With an FTP account mapped you can then use cffile action="write" to upload file specifying the destination as your mapping! No need to go near the dreaded <cfftp>
I'm now waiting for part two today.
The Railo Blog is now online. Gert Franz from Railo has now added a BlogCFC so you can catch up on all the happenings with this CFML engine.
The first couple of posts have already been good with the team going over Mark Drew's post and Vince Bonfanti's proposal about comparing CMFL engines.
Check it out at www.railo.ch/blog/
I can't seem to find any reference on the site (it's probably right in front of my face and I can't see it) but incase you don't know Railo also has a Yahoo groups list which I think is the officail(ish) list.
You can join at http://tech.groups.yahoo.com/group/railo_talk/
These were instructions oringinally for the *nix platform (which is what Mac is in essence), so if you are having trouble getting off the ground with Ubuntu etc. you can use these steps as well.
So back to installing Railo on your Mac (in as easy as I could make it steps). You should know that we are going to use the application server that comes with Railo called Resin.
As you know from a previous post, i've been looking at the possibilities of setting up a cheap CF enviroment. What I didn't mention is Railo. I remember hearing about this probably a year plus ago, and Gert Franz (Railo core developer) reminded me on the HoF again.
Well what can i say. Its shocked me a little. I've been using the Railix version which "is a fully installed and configured version that can be used instantly. This version contains a fully functional Java Server (Jetty). You can use Railo without having installed any Webservers. " To set this up all i had to do was unzip the downloaded file to c:\railo\ and run start.bat. From there it was all ready to go at http://127.0.0.1:8888/.