Mark Drew (Redux)- cf_etc...

a compendium of railo, cfml, cfeclipse and technology topics

Mark Drew (Redux)- cf_etc...

Entries Tagged as railo

CFML Mythbusters competition: Choosing the winners

February 02, 2012 · 2 Comments

A couple of weeks ago, I posted about running a competition to be in my CFML Mythbusters competition, well the competition is now over and it's time to choose the winners

Before choosing them, I thought I would post the code I am using to choose them and the process, so to be nice and transparent.

First off, everyone could post multiple times and this went into a Google Docs spreadsheet, so they could have multiple entries. Since I could see how many entries there were, for example 1-20, this is easy.

I decided to create an array (because they are much sexier than lists), each position with the number of the entry. Then randomise those positions and then simply choose positions 1,2,3 and 4 from their positions in their array

So here is the code (not including the form, since I am pretty sure you know how to make a form.):

<cfscript>
         aEntries = [];
         loop from="#FORM.from#" to="#FORM.to#" index="e"{
            ArrayAppend(aEntries,e);
         }
            
         collection = CreateObject("java", "java.util.Collections");
         collection.shuffle(aEntries);
      </cfscript>
      <cfoutput>
      <ol>
         <li>First Place: #aEntries[1]#</li>
         <li>Second Places: #aEntries[2]# and #aEntries[3]#</li>
         <li>Third Place: #aEntries[4]#</li>
      </ol>
      </cfoutput>

Did you spot the Java class? Yep! The java.util.Collections class is really handy for manipulating Arrays in different ways, and of course, since (in Railo at least) an Array can be used by the Collections it is perfect.

So what do you think? Is this a fair way to select some random people?

2 CommentsTags: Book · railo

Competition: CFML Mythbusters! Win my book!

January 16, 2012 · 11 Comments

I shall be presenting the topic "CFML Mythbusters" at a couple of conferences this year so far (cf.Objective and OpenCF Summit)!
So that you just don't have to hear about my chosen "myths" I thought I would open it up as a competition to all the readers of my blog! 

I shall be answering a lot of questions already, but would like to get some reader suggestions, for example, here are just some of the few I have (sent in by some very honorable people I have to say!):

  • “CFScript is always faster! ?Even when using for loops!” - Alfred Einstein
  • “Inline IF’s are much better than <CFIF>. I will stake my stake on it” - Abraham Van Helsing
  • “Is isDefined() bad?” - Abe Simpson
  • “<cfoutput>#Item#</cfoutput> is the only way to go” - Mohandas Gandhi
to give you some ideas!

Of course, it wouldn't be any kind of competition if you didn't win anything! So what's the prize I hear you ask?

  1. First place gets a physical, signed copy of my book, Railo 3: Beginners Guide, their question answered in the presentation (obiously) and my blog, the question dedicated to them and a big shout out when I cover their question EACH time I present it. WOW!
  2. Two second places also get their question answered in the presentation, another shout out, and an electronic version of Railo 3: Beginners Guide
  3. The third place ALSO gets their question answered in the presentation and this blog, and a shout out

I shall be drawing the results at the end of January 2012 so get your thinking hats on and then submit your Myths to be Busted!

EDIT: You can submit multiple suggestions!

11 CommentsTags: Book · railo

Railo 3: Beginner's Guide out now!

January 03, 2012 · No Comments

Happy New Year dear readers of my little blog! Just before the break for the holidays I was informed by the awesome guys and gals at Packt Publishing that my book "Railo 3: Beginner's Guide" was finally out!

It wasn't enough that they told me it was out, they even sent me a few paper versions of the book, which I shall of course treasure as my first work in print!

Anyway, the book that is over 300 pages long (actually 364), has 10 chock-a-block chapters filled with Railo Server Goodness:

  • Chapter 1: Introducing Railo Server
  • Chapter 2: Installing Railo Server
  • Chapter 3: CFML Language
  • Chapter 4: Railo Server Administration
  • Chapter 5: Developing Applications with Railo Server
  • Chapter 6: Advanced CFML Functionality
  • Chapter 7: Multimedia and AJAX
  • Chapter 8: Resources and Mappings
  • Chapter 9: Extending Railo Server
  • Chapter 10: Creating a Video-sharing Application

 

Of course, if just reading that list is not enough, why not check out the FULL listing or even download a Sample Chapter?

But instead of just skimming over the top, why not get a full copy if the book? You can get it HERE from the Packt Publishing website! It comes in many flavours, including Paper,PDF, ePub and Mobi downloads and also on PacktLib

If you do get a copy, let me know what you think! I am currently thinking of the next book too!

No CommentsTags: Book · coldfusion · railo

CFCamp 2011! Be there or be a Pretzel!

September 26, 2011 · 4 Comments

 

Munich! City of Oktober fest and Pretzels! The big soft ones with butter inside. What could be more delicious than that? I tell you what is... CFCAMP 2011 is! 

That's right ladies and gentle-folks, after a three year hiatus, there is going to be a stomping and knowledge-infusing conference in Munich this year, filled to the gills with awesome presenters and me! 

For a measly €90  a ticket (going up to €119 in October, so get them whilst they are fresh!), your mind can be blown by the likes of Charlie Arehart (he of the inside secrets into ColdFusion 10!), Luis Majano (he of the mobile knowledge), Gary Gilbert exposing his JQuery to the public, Bilal Soylu will also be locking down your apps, and of course Andy Allan and myself, giving it all from our presenter's pulpit. 

Sure you can't miss this?!

Head over to http://www.cfcamp.org/anmeldung.cfm http://www.cfcamp.org/registration.cfm?ChangeLanguageTo=en to get your tickets (yep, it's in German, just use Chrome and translate it, you are a clever person right? This time in English! Don't say we don't spoil you!)

 

 

4 CommentsTags: cfcamp · CFConferences · getrailo · railo

Checking the memory of your applications in Railo 3.3.0.026 rc

August 22, 2011 · 6 Comments

If you have ever wondered how your memory is being used in a Railo Server application, why not get the latest development release of Railo Server: 3.3.0.026 rc (you know that you can do this from the server administrator right?).

Just go to http://yourdomain/railo-context/admin/server.cfm and log in, then you can click on the "update" button, set the updates to "Development", update and then click the "execute button below to get the latest update.

Once you have done that, in the Railo Server Administrator screen, you will see info about your installation and scrolling down you will get a nice graphic on how your memory is being used, like the example below:

Yet another handy feature of Railo Server! Nice!

6 CommentsTags: getrailo · railo

CFLOOP Rant.

August 04, 2011 · 36 Comments

<rant>

I have to get this off my chest: the tag cfloop *REALLY* annoys me.

Not in all it's manifestations mind you, just in one of them, and that is... cfloop array. Why you might ask?
Well, if you want to loop an array you can do:

<cfloop array="#MyArray#" index="a">
      <cfdump var="#a#">
   </cfloop>

What "a" is in the index, is the actual item in the array. I think this is totally wrong to the point that if I had hair I would pull it out.
When the array attribute was introduced, I really think the developers had a brain fart.
They could have so easily used another attribute, maybe one that is already there. The attribute of "item" for example! I mean, it was there loitering in the tag lib, being used for collections, such as:

<cfloop array="#MyArray#" item="a">
      <cfdump var="#a#">
   </cfloop>

Now THAT makes sense! But why all the whining you might ask? Well, let's consider if you want to actually get the index of the array, what do you have to do? Oh yeah... set up another damn variable:

<cfset counter = 1>
   <cfloop array="#MyArray#" index="a">
      <cfdump var="#a#">
      <cfset counter++>
   </cfloop>

Wouldn't it have made a LOT more sense to do the following?:

<cfloop array="#MyArray#" item="a" index="counter">
      <cfdump var="#a#"> The actual item
      <cfdump var="#counter#"> The index of the item
   </cfloop>

See? now "a" can be the *ITEM* in the array and "counter" can be the *index* of the array.

</rant>

Side rant: Why name it "collection" when we could have named it "struct"? <cfloop struct="#myStruct#" item="st">
      
   </cfloop>

36 CommentsTags: coldfusion · railo

Railo for Beginners: My First Book!

July 26, 2011 · 3 Comments

Railo for Beginneers RAW Version

I got got confirmation from Packt Publishing that the RAW (read as it's written) version of the Railo for Beginners book has been released!

I have been writing this book for a while with the help of Gert Franz (Railo Technologies), Andrea Campolonghi and Paul Klinkenberg (Railo Volunteers). And of course a bunch of people that have been reviewing the book for me.

It's my first book so it has been a pretty long labour, especially since I publicly admit I coudl barely write an essay! But the prodding and cajoling by the editors to get me to finish each chapter has definately helped!

The book covers a lot of the aspects of Railo Server and I am hoping that by having this book out there more people will be interested in CFML and of course, Railo Server!

To quote the back cover:

Railo Server is one of the quickest ways to start developing complex web applications online. Widely considered as the fastest CFML (ColdFusion Markup Language) engine, Railo allows you to create dynamic web pages that can change depending on user input, database lookups, or even the time of day.

Railo 3 Beginner’s Guide will show you how to get up and running with Railo, as well as developing your web applications with the greatest of ease. You will learn how to install Railo and the basics of CFML to allow you to gradually build up your knowledge, and your dynamic web applications, as the book progresses.

Using Packt’s Beginner’s Guide approach, this book will guide you, with step-by-step instructions, through installing the Railo Server on various environments. You will learn how to use caches, resources, Event Gateways and special scripting functions that will allow you to create webpages with limitless functionality. You will even explore methods of extending Railo by adding your own tags to the server and building custom extensions. Railo 3 Beginner’s Guide is a must for anyone getting to grips with Railo Server.

What you will learn from this book :

  • Step-by-step instructions for developing web sites with CFML
  • Learn about all the resource types available and how to handle them
  • Easy to follow steps to optimise your application for high traffic
  • Create dynamic applications with the in-built Hibernate ORM
  • Secure your server by setting up access restrictions and passwords
  • Convert and display multimedia within your webpages
  • Create your own extensions for custom functionality

 

You can buy the eBook with all the currently published chapters as well as the full paper version when it's released from PacktPub Directly

3 CommentsTags: Book · railo

Denny Valliant Joins Railo!

April 01, 2011 · No Comments

It has been two years today that I have been working at Railo Technologies and it gives me great pleasure to announce that Denny Valliant (@denstar) has just joined the team!

Denny is a great addition as he has been working with various packagers for Railo, and of course, he is the Lead Developer for the CFEclipse project!
How about that for a great combination eh?!
Welcome on board Denny! Hold on tight! It's gonna be a hell of a ride!
Check out the official announcement over that the Railo Blog

No CommentsTags: cfeclipse · getrailo · railo

Railo Tip: Getting information about built in Tags and Functions

March 31, 2011 ·

I am not sure people out there know this but Railo has four awesome functions that I use all the time, they are :

  • getFunctionList
  • getTagList
  • getFunctionData
  • getTagData

 

getFunctionList* and getTagList
These two functions will return a structure with all the functions or tags that are currently installed on the Railo server. For example, getFunctionList will return:

And getTagList will return:

getTagData and getFunctionData
Of course, this information in itself isn't amazing, since how do you know the arguments for each? This is where the getTagData and getFunctionData come in useful. For Example, if you want to get all the properties of say, the function ImageFilter (I created the FilterExplorer using this function), all you have to do is:

And you will get a nice struct with all the info:

The function getTagData is slightly different, in that you have to split out the namespace when calling it, so you have to call it as follows:

Which gets you all the attributes and documentation for the tag:

 

Simply using those tags, I have started a little project using CloudBees, ColdBox and of course Railo, that I shall show off a bit later.

* getFunctionList is also available in CF9

Tags: getrailo · railo

Running Railo in CloudBees

March 30, 2011 · 10 Comments

A while ago I was playing with the Stax.net deployment system, since then they have been bought by CloudBees, a Platform as a Service for Java Web Apps and I wanted to see how easy it was to run Railo on it.

One of the advantages of running Railo in CloudBees (apart from scaling and versioning) is the ability to deploy incremental changes, rather than having to deploy the whole WAR as you have to do with AWS's BeanStalk. In this post I shall go through how to get a sample application running.

Requirements
Before we get started we need to do the following:

Once you have setup the CloudBees SDK as they have mentioned, you need to setup your API and Secret Keys, to do this you can go get your keys from your account page, and add them to the file that should have been created (if you are using OSX or a Linux OS ) in:

~/.bees/bees.conifg

Now that we have all that installed, let's go create a simple app through the CloudBees web interface, I have named my application "railo" (surprise, surprise!).
Once it has been created, click on the configure button so that you can get the ID of the application, in my case it is "markdrew/railo".

Now we have that application, we can go and download it, go to the folder you want to download the application to in the command line/terminal and type the following:

> mkdir markdrew_railo
> cd markdrew_railo
> bees getapp -a markdrew/railo


That was easy, if you setup your API and Secret keys you should get some XML and some other commands appearing and it should all be downloaded. Let's run it before adding Railo to the mix:

> bees run


After a few seconds you can head to http://localhost:8080/ and get something that looks like the following:

Now to add Railo to our application. You can stop the application by pressing Ctrl + C, and then rename the railo-3.2.2.000.war to railo-3.2.2.000.zip and uncompress it:

> mv railo-3.2.2.000.war railo-3.2.2.000.zip
> unzip -d railo railo-3.2.2.000.zip


Now that we have unzipped the WAR file into the railo directory we can copy the contents from the railo/ directory to the markdrew_railo/webapp directory.

> cp -r railo/ markdrew_railo/webapp/

To test this, we can run the "bees run" command again and after a while you can test your application at http://localhost:8080/, you should get the Railo start page! Awesome!
Stop the application using Ctrl + C and let's clean out some files that are left over that we don't need:

> rm -r webapp/WEB-INF/classes/
> rm webapp/index.jsp

Now that we have cleaned it up and tested it , let's go ahead and deploy it. This is as simple as typing:

> bees deploy

The upload will take a while since it will upload something like 55Mb as our initial upload. Once this is done you should be able to check out your application live at the url defined in your configuration, mine is: http://railo.markdrew.cloudbees.net/

Let's change the default homepage, so that we can see how much it has to upload next time. Change the contents of index.cfm to just display the current time:

<!DOCTYPE html>
<html>
<head>
<title>Changed!</title>
</head>
<body id="documentation" class="twoCol">
   <cfoutput>
      #Now()#
   </cfoutput>
</body>
</html>


This time when we run the "bees deploy" command you should see that it has very quickly uploaded the changes and they should be live, without having to re-deploy the whole thing! Awesome! This is a massive advantage over AWS Beanstalk, that where small changes would require of a total re-deploy of your application.

10 CommentsTags: cloudbees · getrailo · railo