Re: libURL: load unload bug?

2007-02-17 Thread David Bovill

Thanks - Ive added that check and so far so good.

I think it would be good to add libUrlResetAll - it would have saved me
from quiting and restarting a number of times? But thanks for documenting
and structuring the code so nicely!
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: libURL: load unload bug?

2007-02-17 Thread Dave Cragg


On 17 Feb 2007, at 11:12, David Bovill wrote:


Thanks - Ive added that check and so far so good.

I think it would be good to add libUrlResetAll - it would have  
saved me

from quiting and restarting a number of times?


If you do use libUrlResetAll, be careful. My general advice would be  
to try not to use it, but if you do, use it at the end of a handler  
or before a period of idle time. If you have any url calls (get  
url, etc.) after libUrlResetAll in the same handler, the results can  
be unpredictable. I'm not completely clear of the reason for this.  
libUrlResetAll clears a bunch of script local variables (using  
delete local), and I suspect that the engine may not do this  
deletion immediately. So subsequent url calls may start and then have  
the script locals pulled from under them so to speak. I can't  
confirm this, just a suspicion. :-)


So instead of this:

   libUrlResetAll
   repeat ...
 load url whatever
   end repeat

better to do this if possible:

   libUrlResetAll
   send startLoading to me in 50 milliseconds

   on startLoading
 repeat ...
   load url whatever
 end repeat
   end startLoading

I'm guilty of not paying proper attention to libUrlResetAll. I've  
always treated it as a developer's tool, and not something to be  
left in the patient after the operation. (I only use it when I'm  
working on libUrl.)


Cheers
Dave
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


libURL: load unload bug?

2007-02-16 Thread David Bovill

What could this be?

I have found that on occasion urls cease to work and this time rather than
quiting and starting again I took a look at what it could be... I found that
while some urls still worked a few returned very fast and empty - one of
them was an image and one www.google.com. Testig the image url in a browser
proved that the image was there. It looked like it was a problem with the
url cache so I wrote this script:

   repeat for each line someURL in the cachedurls
   unload url someURL
   end repeat
   put the cachedurls

and checked that the cache was empty - still no joy with the urls that were
causing the problem. Next I edited the script of the internet library (added
a space) in order to kill the local variables that cache the url's and hey
presto the urls worked again ???

Is there an occasional problem with unload? In that empty url's perhaps
resulting from faulty calls are not cleared with an unload call? Or should I
call something like libUrlResetAll - not documented AFAIK to reset things?
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: libURL: load unload bug?

2007-02-16 Thread David Bovill

To confirm - issueing libUrlResetAll fixes the problem.

But what is the problem ??? I am loading thumbnails into my application
asynchronously using the load with message command. As each thumbnail
comes over I get the url from the cache and put the data into the thumbnail
image finally unloading the url so as to clear the image from the cache
memory. Seems all to work fine except that every so often with loads of 100
images well the cache gets mucked up - here are the scripts:

setprop image_Loaded photoURL
   put the long id of the target into thumbView
   load url photoURL with message image_DisplayLoaded
end image_Loaded

on image_DisplayLoaded someURL, someStatus
   put url someURL into someImage
   set the image_Value of me to someImage
   unload url someURL
end image_DisplayLoaded

setprop image_Value someImage
   put the short id of the image_Object of me into imageObjectID
   put someImage into image id imageObjectID of me
end image_Value

Perhaps I am not checking the status before unloading? Should not cause this
problem but still... ?
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: libURL: load unload bug?

2007-02-16 Thread Dave Cragg


On 16 Feb 2007, at 20:49, David Bovill wrote:


To confirm - issueing libUrlResetAll fixes the problem.

But what is the problem ??? I am loading thumbnails into my  
application
asynchronously using the load with message command. As each  
thumbnail
comes over I get the url from the cache and put the data into the  
thumbnail
image finally unloading the url so as to clear the image from the  
cache
memory. Seems all to work fine except that every so often with  
loads of 100

images well the cache gets mucked up - here are the scripts:

setprop image_Loaded photoURL
   put the long id of the target into thumbView
   load url photoURL with message image_DisplayLoaded
end image_Loaded

on image_DisplayLoaded someURL, someStatus
   put url someURL into someImage
   set the image_Value of me to someImage
   unload url someURL
end image_DisplayLoaded

setprop image_Value someImage
   put the short id of the image_Object of me into imageObjectID
   put someImage into image id imageObjectID of me
end image_Value

Perhaps I am not checking the status before unloading? Should not  
cause this

problem but still... ?



I can't say for sure what the problem is, but you probably should  
check the status at the beginning of the image_DisplayLoaded handler.


I see a possible problem if the load has failed for some reason, and  
then you immediately do a get url. In this case, the get url will  
try to retrieve the data directly from the server, and may well fail  
too as it's to the same url. Something like:


on image_DisplayLoaded someURL, someStatus
  if someStatus is cached then  
put url someURL into someImage
set the image_Value of me to someImage
unload url someURL
  else
unload url someURL
## do some error handling here
## error message, etc.
  end if
end image_DisplayLoaded

I'm not saying this is the problem, but it might be good to eliminate  
this possibility first.


Cheers
Dave
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution