Digging Huge Files
Sivakatirswami
katir at hindu.org
Wed Aug 5 15:21:14 EDT 2009
Mark Wieder wrote:
> Sivakatirswami-
>
> Well, your tCompleted also remains constant - it's just the ratio of
> download locations that changes. Which makes sense, since what you're
> displaying is
>
> line 1: tRevHits
> line 2: tCompleted - tRevHits
>
> Also, are you really saying put ("1""e&"200 ") into tCompleteCode?
> Shouldn't that be put ("1""e&&"200") into tCompleteCode?
> >From your output it looks like you're trying to trap the (1.1" 200)
> string, which has a space *before* the 200. Same thing for the 206.
>
> You don't say where the mouseUp handler is located, but since you're
> not initializing your variables to zero before running, could there be
> some leftover garbage in there from the previous run?
>
>
Mark. Thanks for the pointers. It works now, but I have to wonder as
there is some serious gremlin hiding here:
1) I thought local variables are always initialized to empty after each
run of script.
Is there something I'm missing there?
global tStart
local tPartials,tRevHits,tCompleted # these were acting as globals?
2) OK we know that
if x contains "Hinduism-Today_Jul-Aug-Sep_2009.pdf" then
put x & cr after tFoundLInes
end if
works, consistently thru each run because it returns 4405 GET requests for the PDF on each run of the script.
*BUT*
if the string
1""e&&"200"
does not even exist in those 4405 found lines how is any number returned at all?
if x contains "Hinduism-Today_Jul-Aug-Sep_2009.pdf" then
put x into z
if z contains "Revolution" then add 1 to tRevHits
put ("1.1""e&"200 ") into tCompleteCode
put ("1.1""e&"206 ") into tPartialCode
if z contains tCompleteCode then add 1 to tCompleted # should not increment
if z contains tPartialCode then add 1 to tPartials # should not increment
put empty into z
put x & cr after tFoundLInes
end if
but we get:
Summary:
Downloaded with Revolution HT Navigator: 834
Complete Downloads via HT site: 1488 # should be 0
Partial Downloads 206's (mostly failures, some successes): 6801 # should be 0
3) I took your suggestions initialized the vars and fixed the string.
on mouseUp
put 0 into tPartials
put 0 into tRevHits
put 0 into tCompleted
if x contains "Hinduism-Today_Jul-Aug-Sep_2009.pdf" then
put x into z
if z contains "Revolution" then add 1 to tRevHits
put ("1.1""e&" 200 ") into tCompleteCode
put ("1.1""e&" 206 ") into tPartialCode
if z contains tCompleteCode then add 1 to tCompleted
if z contains tPartialCode then add 1 to tPartials
put empty into z
put x & cr after tFoundLInes
end if
and now I get consistent, on each run:
Summary:
Downloaded with Revo HT Navigator: 205
Complete Downloads via HT site: 840
Partial Downloads 206's (mostly failures, some successes): 2877
numbers verified in BBEDit with Search and Replace on those strings...
But still leave Questions 1 and 2 unanswer: why are local vars carrying values across sessions and how is a string that doesn't exist in the text being found at all?
I'm not sure I'll be able to answer either of those questions, but it's a lesson in good practice on initializing varibles, even locals.
Thanks for the help... Now we can dig the logs.
Sivakatirswami
More information about the use-livecode
mailing list