INNER JOIN @question q2 ON 1 = 1
{Psst ... Cross join} ;-)
~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
So, this problem has been sitting in my kitchen. The math has been
proved and a good solution using database table joins provided, but I
just *knew* this could be solved with looping.
Of course it could be hard coded:
cfoutput
cfloop from=0 to=1 index=a1
cfloop from=0 to=1 index=a2
At 10:57 AM 25/11/2009, Ian Skinner wrote:
So, this problem has been sitting in my kitchen. The math has been
proved and a good solution using database table joins provided, but I
just *knew* this could be solved with looping.
Of course it could be hard coded:
cfoutput
cfloop from=0 to=1
At 10:57 AM 25/11/2009, Ian Skinner wrote:
cffunction name=it output=yes
cfargument name=depth type=numeric required=yes
cfargument name=answerKey type=string required=no default=
cfset var i = 0
cfif depth-- GT 0
cfloop from=0 to=1 index=i
#it(depth,answerKey ' '
Subject: Re: Working out yes/no possibilities
From: Leigh _ cfsearch...@yahoo.com
Date: Wed, November 25, 2009 6:09 am
To: cf-talk cf-talk@houseoffusion.com
INNER JOIN @question q2 ON 1 = 1
{Psst ... Cross join
Heh, good job Ian. Now, we need someone to step up and solve it with
recursion. :)
After that, someone can show us the line of jQuery code used to
accomplish it. I'm sure there's a plug-in out there... :)
~Brad
Original Message
Subject: Re: Working out yes/no possibilities
b...@bradwood.com wrote:
Heh, good job Ian. Now, we need someone to step up and solve it with
recursion. :)
I thought I was using recursion?
cfloop from=0 to=1 index=i
#it(depth,answerKey ' ' yesNoFormat(i))# !--- recursive call to this
function ---
/cfloop
Or do I have the wrong idea
Opps, I'm sorry Ian. That was, in fact, a recursive solution. That's
what I get for shooting off an E-mail while walking out the door and not
looking at your code close enough. :)
~Brad
Original Message
Subject: Re: Working out yes/no possibilities
From: Ian Skinner h
At 12:18 AM 24/11/2009, b...@bradwood.com wrote:
So, one possible output for example would be 1010101010101010101010
where each odd numbered question was marked true, and each even numbered
question was marked false.
It may take a while to churn out all 4 million combinations, but it will
May I ask why on earth you are doing this? :)
Thanks for this Brad, I'll give it a shot. As to the why, my boss
wants us to generate every possible answer in the questionnaire for
testing purposes - I know that makes no sense at all, but mine is not
to wonder why, mine is but to do and die
Ahh, me knee-jerk reactions is that he is looking for
cheating patterns ??
May I ask why on earth you are doing this? :)
Thanks for this Brad, I'll give it a shot. As to the why, my boss
wants us to generate every possible answer in the questionnaire for
testing purposes - I know that makes
At 12:15 PM 24/11/2009, b...@bradwood.com wrote:
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHA!
Sorry, did I just say that out loud. *snicker*. You should ask you
boss how may possible combinations he thinks a test of 22 questions can
have. I'd LOVE to hear how good his math skills are. Here's a thought,
Make sure you have a simple page with the task labeled on it and then
a big fat Print button. I'd be curious to see how much paper it takes
to print out those 4 million combinations.
Judah
On Tue, Nov 24, 2009 at 2:31 PM, Thane Sherrington
th...@computerconnectionltd.com wrote:
At 12:15 PM
I feel like I'm in the middle of a
dotcom startup. :) During those times, I know a guy who's job was to
keep all the clocks in the place (and they had a bunch for different
timezones) accurate to the second. Not that the company actually
needed to have that sort of accuracy, but the boss
Well, the 23rd position of binary is the total number of answers. :)
But if you are looking for a way to store it, why not just a string of
22 characters?
On Mon, Nov 23, 2009 at 5:19 PM, Thane Sherrington
th...@computerconnectionltd.com wrote:
I have a yes/no questionnaire that I want to
I'd like to get the pattern of answers for each possible pattern (so
to make this simpler, let's assume there are only 3 questions) I'd
like to figure out an algorithm that will generate:
YYY
NYY
NNY
NNN
YNN
YYN
YNY
NYN
etc.
T
At 09:32 PM 23/11/2009, Phillip Vector wrote:
Well, the 23rd
A couple of loops.
cfoutput
cfloop from=1 to=22 index=i
Itteration = #i#
cfloop from=0 to=1 index=x
#yesOrNoFormat(x)#
/cfloop
br/
/cfloop
/cfoutput
~|
Want to reach the ColdFusion community with something they want? Let them
On 11/23/2009 6:51 PM, Ian Skinner wrote:
A couple of loops.
cfoutput
cfloop from=1 to=22 index=i
Itteration = #i#
cfloop from=0 to=1 index=x
#yesOrNoFormat(x)#
/cfloop
br/
/cfloop
/cfoutput
Never mind, but I think that is close.
There are 2^22 number of combinations I believe (4,194,304). One of my
favorite ways of doing this is with SQL. Create a temp table with 2
records-- yes and no. Now, join that table to itself 22 times.
Each join will give you a Cartesian product, or all possible
combinations.
untested, but
FWIW, I ran the code below on a test pc in my home (crappy Celeron) and
it generated all 4.1 million combinations in 8 minutes and 32 seconds.
I'm pretty certain you could do a little better on server hardware.
~Brad
Original Message
Subject: RE: Working out yes
I'd recommend hiring monkeys and typewriters personally.
I'm not actually sure which is harder to come by these days.
Of out curiosity, what format do you want these answers in? Do you
want a print out of 4 million combinations? Do you want to do
something else with them? Do you want to figure
21 matches
Mail list logo