Ternary Operations and CFML
March 24, 2011 · By Mark Drew · 9 Comments
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
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.
→ 9 CommentsTags: cfml · coldfusion · railo
Exploring Railo's ImageFilter Functionality
March 21, 2011 · By Mark Drew · No Comments
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: www.markdrew.co.uk/filterexplorer/
→ No CommentsTags: railo
CFEclipse 1.4.4 is out!
December 22, 2010 · By Mark Drew · 1 Comment
The CFEclipse Team, lead by the awesome Den have managed to get another release of CFEclipse out!
Check out the "What's new" page for the new features in 1.4.4
Remember, you can always update CFEclipse from your Software update in Eclipse with the update site of www.cfeclipse.org/update/
If you have any issues, why not join the CFEclipse google group, this is where a bunch of friendly people will be able to help you! groups.google.com/group/cfeclipse-users
Enjoy!
→ 1 CommentTags: cfeclipse · cfml
cf.Objective() 2011 Call for Speakers!
December 08, 2010 · By Mark Drew · No Comments
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!
→ No CommentsTags: cfObjective · railo
Get the Lead Dev of CFEclipse to CFOpenSummit!
December 01, 2010 · By Mark Drew · 2 Comments
So we are starting a donation fund for Denny to attend www.opencfsummit.org/! It will be an amazing conference and I think the missing piece of the puzzle is the current Developer of CFEclipse presenting! So head over to cfeclipse.org/index.cfm/blog/dengocon/ and show your support!
Go on, you know it makes sense.
→ 2 CommentsTags: cfeclipse · cfopensummit · getrailo
CFObjective, CodeWars and Velociraptors
November 18, 2010 · By Mark Drew · 9 Comments
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 →]
→ 9 CommentsTags: cfObjective · codewar · html5 · railo
Relax with CouchDB: Presentation to the UKCFUG
October 08, 2010 · By Mark Drew · 3 Comments
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: experts.na3.acrobat.com/p93766981/
→ 3 CommentsTags: cfml · couchdb · getrailo · presentations · railo · ukcfug
Common Development Patterns: Settings per Environment
September 30, 2010 · By Mark Drew · 5 Comments
I am thinking of doing a range of blog posts related to common development patterns that I have seen implemented. These are not exactly Design Patterns, but practices that I see and have implemented myself.
To kick of this series, I thought I would talk about your application's settings depending on environment. As a background I was working on a Galleon application that in development runs on Apache with MySQL and in Staging/Live it runs on IIS and MS SQL. Generally you want to keep your environments the same of course, but the main changes were simply table names, emails and URLs so all the code was fine.
One of the things that annoyed me was that before I could check in my code to SVN, I would have to change the settings.ini.cfm file, putting all the live settings in there.
[Read more →]
→ 5 CommentsTags: cfml · coldbox · coldspring · webdev
CouchDB Cache Extension (Beta) for Railo
September 30, 2010 · By Mark Drew · 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 (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? wiki.getrailo.com/wiki/extensions:couchdb
→ 1 CommentTags: couchdb · getrailo · railo
My Desktop
August 18, 2010 · By Mark Drew · 4 Comments
Following on from Andy Jarrett's post, since he is going to show his, I am going to show my desktop.
What's yours like?
→ 4 CommentsTags: