It was Daniel that wrote the code, not me. ;)
His for loop is sound. Only difference between yours and his is the
use of the new "++" operator instead of the old "i = i + 1" style that
is required before CF8.
cheres,
barneyb
On Wed, Nov 19, 2008 at 10:41 AM, Mark Kruger <[EMAIL PROTECTED]> wrote:
> Barney,
>
> Unusual syntax for a "for" loop... Looks more like a "while" loop. I would
> have expected something like...
>
> for(awesomevariable=1; awesomevariable LT (ArrayLen(test);
> awesomevariable++) {
>
> }
>
> I would sort of expect your example to throw an error.
>
> I don't think that's your problem, since it seems more related to scoping if
> "test" is reporting undefined ... but it is unusual to my eye.
>
> If I were to try and do it the way your code seems to want to do it I would
> do:
>
>
> Awesomevariable = 0;
> While(awesomevariable LT arraylen(test)) {
> awesomevariable++;
> // whatever else you are doing...
> }
>
>
> -Mark
>
>
> Mark A. Kruger, CFG, MCSE
> (402) 408-3733 ext 105
> www.cfwebtools.com
> www.coldfusionmuse.com
> www.necfug.com
>
> -----Original Message-----
> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 19, 2008 12:29 PM
> To: cf-talk
> Subject: Re: CFScript for loop broken? (aka HELP!!)
>
> Is that code in a CFC that uses 'awesomevariable' and/or 'test' as a
> variable name within another method? If so, just var-scope everything and
> the problem should vanish.
>
> cheers,
> barneyb
>
> On Wed, Nov 19, 2008 at 9:38 AM, Daniel Jimenez <[EMAIL PROTECTED]>
> wrote:
>> Thanks in advance for any advice anyone can give. I'm having a very odd
> problem where, after running for a period of time, all for loops in
> CFScript break. What I have is the following very, very simple sample code
> below:
>>
>> <cfset test = ["test1","test2"]>
>> <cfscript>
>> for(awesomevariable=1; awesomevariable LT (ArrayLen(test));
>> awesomevariable = awesomevariable+1) {
>> writeOutput(test[awesomevariable]);
>> }
>> </cfscript>
>>
>> Under normal circumstances (and using an empty application.cfc), this will
> print "test1test2" to the browser. However after a period of time or
> possibly load this exact code will start throwing the error "The element at
> position 3 of dimension 1, of array variable "TEST," cannot be found". The
> server will continue throwing this error until I restart jBoss. I have two
> CF 8.0.1 Enterprise servers running on 64-bit JRockit R27.5.0 on jBoss
> 4.2.3. This problem eventually happens on both servers. It's driving me
> crazy as it takes a bit of load on the server before the problem manifests
> itself. Further more this only happens with a for loop inside of a cfscript,
> this does NOT happen inside of a cfloop! It seems the cfscript for loop
> can't count, as it attempts to access the 3rd position in a 2 position
> array.
>>
>> When the problem does finally crop up it eventually breaks my application
> (for example we use http://cflib.org/udf/CapFirstTitle on a number of
> pages). What's makes this even more of a mystery is that I'm running all of
> this EXACT same code on my current production servers which are configured
> the same with the exception of being 32 bit machines. These servers sit
> under heavy load all day with no issue.
>>
>> Has anyone seen anything like this before? We are using the 64 bit
> Coldfusion 8 (it sure would be nice if you could confirm this in CFIDE by
> the way). The JVM has a ton of free memory left in the heap, and I've seen
> the heap get much larger without causing this issue.
>>
>> Does this seem like a CF bug to anyone else? Is anyone else using 64 bit
> ColdFusion? I'm not really sure if 64 bit is the culprit, but it's really my
> only variable in comparison to my production servers.
>>
>>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315570
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4