Entries Tagged as railo
I have been doing a lot of JavaScript development recently and finally got my head round Ternary operations. Something that Railo Server has had for a while and I think was introduced to Adobe CF8 CF9 a while ago too. I just never got round to making it part of my standard coding practices, so I thought I would share.
If you have been doing this for a while, no need to point and laugh at me, but if you haven't, let me explain.
In your code you get to points where you have some code that looks like this:
<cfif MyVar EQ "something">
<cfset myResult = 1>
<cfelse>
<cfset myResult = 0>
</cfif>
When I see that, I tend to think, what is the fastest way to do this? What makes more sense? In the code above, in *theory* the variable myResult will always be created, but since it is always created, why have the cfelse statement?
I started coding in this manner subsequently:
<cfset myResult = 0>
<cfif MyVar EQ "something">
<cfset myResult = 1>
</cfif>
This way the myResult variable is always set to a "default" and only modified if the statement becomes true. For some reason this makes me feel happier and that the code is more robust (and of course, there is less of it).
With a ternary operation, you can even reduce ALL that code (omg! 4 lines of code!) into a single line:
<cfset myResult = MyVar EQ "something" ? 1 : 0>
The code above now is all in one line. The whole logic relating to the myResult variable is neatly encompassed in one line. Suddenly I feel so much happier.
Tags:
cfml · coldfusion · railo
One of the new functions that will be introduced in Railo 3.3 is the ImageFilter() function. This is one hell of a function with a LOT of parameters, so I thought rather than create some massive documentation index for it, I would make something a little but more fun; so introducing The Image Filter Explorer!
This small application allows you to explore the different filters you can use against an image, and see the result, along with a code sample of how to do that particular function.
You can check it out here: http://www.markdrew.co.uk/filterexplorer/
Tags:
railo
cf.Objective() 2011 is just round the corner and they are looking for you! Yes you! to make it the best ever conference!
All you have to do is get some ideas for presentations as well as vote for your favourite presentations that have already been submitted.
Remember! Vote Early! Vote Often!
Make your Vote count at the cf.Objective() Call for Speakers!
Tags:
cfObjective · railo
Last night at CFObjective ANZ, Gert Franz and I were invited to the CodeWar hosted by Robin from RocketBoots. I have to say it was a great event at the European Beer Cafe in Melbourne, and the Railo "Flower Power" team managed, somehow, even with jetlag and lots of beers, to win (pure luck I have to say!).
[Read more →]
Tags:
cfObjective · codewar · html5 · railo
Yesterday, I presented the NoSQL and CouchDB to the UK CFUG. I think it went down well and there were lots of questions and interest in the subject of Not Only SQL and how they can be used with your applications.
As promised, you can download the presentation with links and code samples here
You can also view the presentation over at Slide Six
You can check out the presentation on Adobe Connect: http://experts.na3.acrobat.com/p93766981/
Tags:
couchdb · getrailo · presentations · railo · ukcfug
September 30, 2010 · 1 Comment
I have spent a while working on this extension and after a hiatus of client work I managed to get it all uploaded and documented onto the Railo Wiki.
CouchDB is a noSQL database that allows you to store complex documents and get them by key (and revision), it is very performant and easy to replicate which makes it a great alternative as a distributed caching system, hence we created the CouchDB Cache Extension!
It is fairly simple to install, you just have to add the preview extension provider (http://preview.getrailo.org/ExtensionProvider.cfc) to the list of your Railo Extension Providers and then under your Extensions/Applications section you should now see the CouchDB Cache extension, just install that, create a Cache Connection and start using it for your Objects, Templates, Queries etc!
There are more detailed installation instructions over at the Wiki, why not check it out? http://wiki.getrailo.com/wiki/extensions:couchdb
Tags:
couchdb · getrailo · railo
Background: I am writing a little app to help us here at Railo with some of our contacts, nothing over the top or anything and wanted to take Sean Corfield's FW/1 for a spin.
As I am developing, I went the most direct route, I just did some queries in the service layer so my code looks like:
<cffunction name="list" output="false">
<cfset var clients = 0>
<cfquery name="clients" datasource="#variables.dsn#">
SELECT * FROM contact;
</cfquery>
<cfreturn clients>
</cffunction>
<cffunction name="view" output="false">
<cfargument name="clientid">
<cfset var qclient = 0>
<cfquery name="qclient" datasource="#variables.dsn#">
SELECT * FROM contact WHERE id = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.clientid#">;
</cfquery>
<cfreturn qclient>
</cffunction>
OK, nothing world shattering, so I wanted to start using the ORM features of Railo (join the pre-release group to test them out!). I changed my code to look like:
<cffunction name="list" output="false">
<cfset var clients = 0>
<cfquery name="clients" dbtype="orm">
FROM contact
</cfquery>
<cfreturn clients>
</cffunction>
<cffunction name="view" output="false">
<cfargument name="id">
<cfreturn entityLoad("contact",arguments.id,true)>
</cffunction>
I then defined my "contact" (I can show the code but it's hardly rocket science) and then when I reloaded I got the error:
Component [contact] has no acessible Member with name [ID]
Of course! My view code looks like:
<input type="hidden" name="id" value="#rc.data.id#">
I could change all my calls to fields to
<input type="hidden" name="id" value="#rc.data.getid()#">
but why bother? I just went to the Railo Admin -> Archives & Resources: Component -> Magic Functions and enabled them, now all my view code works just as expected and I didn't have to change my view code.
Tags:
getrailo · railo
On the final CFUnited, Railo will be there in force!
You can come visit us at our stand to find out the awesome consulting services we provide as well as, of course, our most awesome Open Source CFML Engine! (yes! I used "awesome" twice!)
There might even be some delicious Swiss chocolate there too!
Apart from the stand, you can also check out our team's presentations
Sean Corfield will be talking about:
And you can also catch Gert Franz's topic:
Since most of us will be en-route to the conference tomorrow, why not email us today if you have any queries ahead of time?
See you all there! I am sure it's going to be awesome!
Tags:
cfunited · getrailo · railo
When you send an email from the <cfmail> tag in Railo, there are times that for whatever reason the email won't be sent. Rather than digging through a bunch of folders to see what hasn't been sent, you can do a couple of things.
You can view all the task spool in the Railo Web Administrator -> Services -> Tasks page by going to http://<your server>/railo-context/admin/web.cfm?action=services.tasks
Or you can programatically get the task spool by doing the following code:
<cfadmin action="getSpoolerTasks" type="web" password="#password#" returnVariable="tasks">
<cfdump var="#tasks#">
You get a query by return that has the type, the item, how many times it has tried and an array of exceptions that have happened, this way you can manually or programatically deal with the errors.
Tags:
getrailo · railo
In the first part of this series I looked at creating an extension and an extension provider which suited my needs.
In this post I shall be looking at getting Railo server into your Eclipse project so that you can debug your code.
So that we can keep it all neat and tidy, I am going to create a project in Eclipse, that will contain the source code for the extension, the extension provider, and Jetty running Railo.
Why would I put ALL of this in one project you might ask (you might?). I want to be able to debug the server itself, set breakpoints and check variables as I write my code.
[Read more →]
Tags:
extensions · getrailo · railo