Exists, there is a, etc.

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: Exists, there is a, etc.

Post by rrBUSS9EE » Tue May 29, 2012 3:52 pm

Ok… I have setup a network filter on my Mac so I can monitor outgoing connections and this appears to be a cacheing issue. Here is what is going on:

On hosted sites that do not have a custom 404 page, if the file in turl exists, "get url turl" connects to the server the first time and downloads the data. Subsequent calls to "get url turl" do not establish an outgoing connection, but the content of turl is still returned. Obviously the content of turl is cached somewhere.

if the file referenced in turl does not exist, an outgoing connection is established every time "get url turl" is called, and nothing is returned (so nothing is cached).

==========================

On the hosted domains where there is a custom 404 page configured, the url passed to "get url" initially connects to the server. This happens whether or not the file exists. Subsequent calls to "get url" with the same url does not establish an outgoing connection regardless of whether or not the file exists.

I believe the difference here is due to the custom 404 page redirect, where there is a file with data that is returned when a referenced file does not exist. What is odd is that the html of the custom 404 page is not returned in iOS, where it is on the desktop in LC.

So there are two issues here. The first being, in iOS, no result returned when the file does not exist. The second is that the html of the custom 404 redirect is also not being returned in iOS as it is on the desktop.

So, I guess a work around that would apply to my app would be a way to clear the cached data described above. Unfortunately I don't see a command in Dictionary that accomplishes this. Does anyone know a way to do this?

Klaus
Posts: 14183
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exists, there is a, etc.

Post by Klaus » Tue May 29, 2012 4:28 pm

Hi rrbusse9ee,

don't know if this applies here, but check "cachedURLs" and "unload" in the dictionary.


Best

Klaus

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: Exists, there is a, etc.

Post by rrBUSS9EE » Tue May 29, 2012 4:35 pm

Thanks Klaus… but I am pretty sure these don't apply to mobile platforms.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Exists, there is a, etc.

Post by sturgis » Tue May 29, 2012 4:56 pm

Hmm. while it shouldn't be necessary, a workaround might be to append "#" & the milliseconds to your url. This way the url will always appear to be fresh, and as long as there isn't a named anchor point in the page it should be a non-issue to include the #4351414 at the end of the url.

As Klaus mentioned if you are using "load" anywhere to load the urls they should show up in the cachedurls if you aren't using load then it shouldn't be an issue. If you are, then you'll need to unload the url, and try again.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Exists, there is a, etc.

Post by jacque » Tue May 29, 2012 5:23 pm

sturgis wrote:Just noticed this from your posted code jacque..

Code: Select all

on mouseUp
  put fld 1 into tURL
  put "Result:" && the result && url tURL into fld 2[b] -- won't the result always be empty this way since the url hasn't been hit yet? [/b]
end mouseUp
If this does work, its an extremely cool trick! (if not, am assuming its a typo or copy/paste error)
Sorry, yes, it was a paste error. I'd edited my post incorrectly. Here's the real script:

Code: Select all

on mouseUp
  put fld 1 into tURL
  get url tURL
  put "Result:" && the result &cr& it into fld 2
end mouseUp
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: Exists, there is a, etc.

Post by rrBUSS9EE » Tue May 29, 2012 5:37 pm

sturgis wrote:a workaround might be to append "#" & the milliseconds to your url. This way the url will always appear to be fresh, and as long as there isn't a named anchor point in the page it should be a non-issue to include the #4351414 at the end of the url.
BRILLIANT!!! That works just fine.

Thanks.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Exists, there is a, etc.

Post by FourthWorld » Tue May 29, 2012 7:48 pm

sturgis wrote:Hmm. while it shouldn't be necessary, a workaround might be to append "#" & the milliseconds to your url. This way the url will always appear to be fresh, and as long as there isn't a named anchor point in the page it should be a non-issue to include the #4351414 at the end of the url.
Ingenious.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Exists, there is a, etc.

Post by sturgis » Tue May 29, 2012 7:51 pm

Think I'd seen it in the forums or on the list somewhere before, but since I can't remember exactly where so that I can give proper attribution...

Thanks!

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: Exists, there is a, etc.

Post by rrBUSS9EE » Wed May 30, 2012 1:47 pm

sturgis wrote:Think I'd seen it… somewhere before, but since I can't remember exactly where so that I can give proper attribution...
Nevertheless, if you ever find yourself in Camino, California the drinks are on me, as well as a round of golf (if you're so inclined).

Post Reply