Get URL anomaly

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Get URL anomaly

Clarence Martin via use-livecode
Thanks to Charles Warwick I now understand that when using LC Indy versions, tsNet is automatically included both in standalones and the IDE. So, there should be no real difference between doing some simple ‘getting’ in either environment. Perhaps there isn’t, but I have run into an anomaly that I can’t understand.

As in some of my previous mails, I’m talking about having to retrieve a tiny text file from a server (and later put a modified version of it back, but let’s get one problem solved at a time) The whole thing is just a few lines of code:

 constant myFileOnTheServer = "www.myserver.comm/mytextfile.txt”

 put “http://“ & myFileOnTheServer into t1

 get URL t1

 if the result is empty then

    do stuff with ‘it’, where the text file is placed

   …

I can make this work in the IDE every time, and can verify that the text file is intact.

I can make it work in a standalone that does almost nothing more than the above, apart from filling in the odd field.

BUT in a more complex real app, the exact same code which works every time in the IDE returns an empty result (indicating ’no error’), but the file is not transferred (‘it’ is empty). Obviously I must have done something wrong, but it doesn’t appear to be the actual coding. Can it be a timing issue? Before the code is executed in my app, there is quite a bit of looking at local files on the hard disk (this is a desktop app), but I don’t see that this could have a bearing on the issue. I am logging everything, but I just can’t see what is going wrong.

It must be something I’m doing, but what?

TIA

Graham
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get URL anomaly

Clarence Martin via use-livecode
Hi Graham,


> On 5 Mar 2018, at 10:56 pm, Graham Samuel via use-livecode <[hidden email]> wrote:
>
> As in some of my previous mails, I’m talking about having to retrieve a tiny text file from a server (and later put a modified version of it back, but let’s get one problem solved at a time) The whole thing is just a few lines of code:
>
> constant myFileOnTheServer = "www.myserver.comm/mytextfile.txt”
>
> put “http://“ & myFileOnTheServer into t1
>
> get URL t1
>
> if the result is empty then
>
>    do stuff with ‘it’, where the text file is placed
>
>   …

I would recommend using:

put URL t1 into tData

The contents of ‘it’ can be changed by other commands, so if you are having issues in a more complex app, maybe something else is overwriting that value?

Cheers,

Charles

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get URL anomaly

Clarence Martin via use-livecode
Hi Charles - thanks for your help. I immediately tried your modification (use ‘put’ and avoid the variable ‘it’) but it made no difference. However, I think I have solved the problem:

I was relying on the Standalone Application Settings option ’search for required inclusions’. This did however not include something called ‘internet’, which presumably is not tsNet but something else. Anyway when I chose that option, the behaviour in the IDE and the standalone suddenly appeared the same. I don’t know why it worked in some simpler standalones used for testing - perhaps the LC search for inclusions was confused by something in my real app and not in the simpler ones. Without this inclusion, the ‘put’ (or ‘get’) apparently works - nothing in ‘the result’ - but no data is transferred. With the inclusion, data is transferred as expected.

If I can, I will report this as a bug, but it’s going to be tricky to demonstrate it in its original context.

If anyone else is reading this, have you had any negative experience with the ‘search for required inclusions’ feature of the LC Standalone settings?

Thanks again

Graham

> On 6 Mar 2018, at 08:50, Charles Warwick via use-livecode <[hidden email]> wrote:
>
> Hi Graham,
>
>
>> On 5 Mar 2018, at 10:56 pm, Graham Samuel via use-livecode <[hidden email]> wrote:
>>
>> As in some of my previous mails, I’m talking about having to retrieve a tiny text file from a server (and later put a modified version of it back, but let’s get one problem solved at a time) The whole thing is just a few lines of code:
>>
>> constant myFileOnTheServer = "www.myserver.comm/mytextfile.txt”
>>
>> put “http://“ & myFileOnTheServer into t1
>>
>> get URL t1
>>
>> if the result is empty then
>>
>>   do stuff with ‘it’, where the text file is placed
>>
>>  …
>
> I would recommend using:
>
> put URL t1 into tData
>
> The contents of ‘it’ can be changed by other commands, so if you are having issues in a more complex app, maybe something else is overwriting that value?
>
> Cheers,
>
> Charles
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get URL anomaly

Clarence Martin via use-livecode
On 3/6/18 8:56 AM, Graham Samuel via use-livecode wrote:
> I was relying on the Standalone Application Settings option ’search for required inclusions’.

I always use manual inclusions for that reason. As soon as I add a
feature to a project I also add it to the inclusions so I won't forget.

TSNet piggybacks on libURL ("internet") so that's why they're both
necessary.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get URL anomaly

Clarence Martin via use-livecode
Thanks Jacque - since TSNet is an enforced presence on all commercial versions of LC, I wonder why libURL isn’t automatically included even in apps that don’t appear to be using internet access. It’s a gotcha that is likely to bother people apart from me, IMHO. Maybe ‘search for inclusions’ should be deprecated.

Anyway thanks for the explanation.

Graham

> On 6 Mar 2018, at 22:30, J. Landman Gay via use-livecode <[hidden email]> wrote:
>
> On 3/6/18 8:56 AM, Graham Samuel via use-livecode wrote:
>> I was relying on the Standalone Application Settings option ’search for required inclusions’.
>
> I always use manual inclusions for that reason. As soon as I add a feature to a project I also add it to the inclusions so I won't forget.
>
> TSNet piggybacks on libURL ("internet") so that's why they're both necessary.
>
> --
> Jacqueline Landman Gay         |     [hidden email]
> HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get URL anomaly

Clarence Martin via use-livecode
On 3/6/18 4:08 PM, Graham Samuel via use-livecode wrote:
> since TSNet is an enforced presence on all commercial versions of LC, I wonder why libURL isn’t automatically included even in apps that don’t appear to be using internet access.

That seems entirely reasonable, you might want to write that up in the
QCC. The omission may have just been an oversight.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Get URL anomaly

Clarence Martin via use-livecode
In reply to this post by Clarence Martin via use-livecode
Lately I've found that to be iffy. I just manually select what I know I need.

Bob S


> On Mar 6, 2018, at 06:56 , Graham Samuel via use-livecode <[hidden email]> wrote:
>
> Hi Charles - thanks for your help. I immediately tried your modification (use ‘put’ and avoid the variable ‘it’) but it made no difference. However, I think I have solved the problem:
>
> I was relying on the Standalone Application Settings option ’search for required inclusions’.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode