Entries for month: February 2012
A couple of weeks ago I run a competition to win my Railo 3 Beginner's Guide book. So now is the time to announce the winners!
In first place is Ben B. who wins a signed copy of the book for his myth "The cost for creating a cfc object is minimal and has no real cost."
In joint second place, winning an electronic copy of the book are:
Ray V. with his myth "Is there really a cookie called CFMagic?"
and
Steven R. with his myth "ColdFusion will always timeout to the value I provide in the ColdFusion Adminsitrator."
In third place, winning a mention in my presentation is Brendan with his myth "cfml produced html is full of whitespace"
Congratulations to you all! I shall get the presentation updated for cf.Objective!
I have also put the code up on how I run the code and presentation on github, so you can check out the CFML Mythbusters presentation for yourself!
Tags:
Book · CFConferences · cfObjective · getrailo · railo
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?
Tags:
Book · railo