Re: Secure connection to server

2020-12-28 Thread Neville Smythe via use-livecode
I have now moved all my code from php to LiveCode server as the middle-ware.

Firstly it appears that the LiveCode post operation does reuse authentication 
credentials to an https connection as long as calls are made within a single 
script. In my case the first call typically takes slightly more than 1 second, 
subsequent calls in the same script take under half a second.

This is still not adequate to conduct a conversation with the remote database, 
as was possible when connecting directly, but at least in my case I can get 
away with just two calls from clients to server: first “tell me the current 
status of all this stuff”, second “please update the db using this stuff”. It 
means packing and unpacking “stuff” into large files at each end, but LC is so 
easy and efficient at text processing that was not difficult. Indeed as usual 
with refactoring, I found a number of code improvements.

The remaining really slow operation involves managing the mail distribution 
lists. DreamHost is still using Mailman 2.x, so that the only way to get the 
current list of subscribers is to scrape the admin web pages. There is a well 
known subscriberlist.py python script to do this but it is painfully slow. When 
used directly (insecurely) from the client, this took 10 seconds or so to 
gather 175 subscribers. Transferring this to the server side with lc 
authentication in-between, it now takes 14 to 15 seconds; I’m not sure why it 
is more that 2 seconds slower but it is what it is. I have rewritten this as an 
lc script, which shaves a couple of seconds off; to be fair the python script 
is doing rather more than my lc script as it is much more generic. And on the 
other hand I can understand what my script is doing, whereas the python script 
is rather opaque (to me).

So overall I am very happy with LC server. And I have a new toy to play with 
for the New Year.

Neville

> On 16 Dec 2020, at 11:32 am, Neville Smythe  
> wrote:
> 
> A little while ago in this forum we were alerted to the fact that LC direct 
> connection to a remote database not using SSL was a security hole. This also 
> applies to managing Mailman lists on a remote server.
> 
> After a steep (re-)learning curve with the various technologies, I now have a 
> working method in place for both mysql and Mailman connections, using php as 
> middleware and posting via curl in a shell script. But it is sooo slooow.
> 
> Direct connection downloaded an sql query in a fraction of a second. It now 
> takes over a second. This is acceptable (barely) for an isolated call,  but I 
> sometimes need to make a sequence of posts. As I understand it, the slowness 
> is due to the time required to establish the secure connection, not an LC 
> problem. For example establishing an ssh connection in Terminal is even 
> slower; but once established an ssh session is super fast. Similarly curl 
> will reuse authentication credentials within a shell session, so I aggregate 
> as many calls as I can with a single shell script before using 
> shell(myscript), and this definitely helps.
> 
> What I would like to do however is use LC server as the middleware: I could 
> then process the required data on the server side; I could not contemplate 
> using php to do this. I suspect the LC post command uses curl under the hood, 
> but I also suspect each post call would create its own session. I don’t think 
> it is possible to establish a single session to talk sequentially to 
> lcserver; if so this would be too slow. Am I correct? 
> 
> Actually I guess I could  just use my present method using curl and shell() 
> instead of post, but addressed to an .lc script instead of .php?
> 
> Or is there a whole better way to do what I want? 
> 
> Neville Smythe
> 
> 


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


Re: Livecode Builder - passing lcs string to C functions

2020-12-28 Thread Trevor DeVore via use-livecode
On Mon, Dec 28, 2020 at 7:02 AM Dan Brown via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Hi I'm stuck trying to find examples of passing lcs strings to a C function
> via pointer and it's driving me mad! I can retrieve char * pointers from C
> functions, convert to string and pass back to lcs but haven't come across
> any easy to grok examples of sending data to C. Any guidance would be
> appreciated


I've used MCStringConvertToBytes to convert strings to a value you can pass
in as const char*. I have a hunspell example you can reference.

Here is a link to the Hunspell_spell definition:

https://github.com/hunspell/hunspell/blob/8a2fdfe5a6bb1cbafc04b0c8486abcefd17ad903/src/hunspell/hunspell.h#L69

```
LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle* pHunspell, const
char*);
```

Here is a link to the LCB code that passes a UTF8 string to Hunspell_spell:

https://github.com/trevordevore/lc-hunspell/blob/master/hunspell.lcb#L150

Here is a link to the MCStringConvertToBytes definition in the LCB file:

https://github.com/trevordevore/lc-hunspell/blob/master/hunspell.lcb#L19

-- 
Trevor DeVore
ScreenSteps
www.screensteps.com
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Ali or Monte - MimeEncodeAsMIMEMultipartDocument

2020-12-28 Thread Sean Cole (Pi) via use-livecode
Hi all,

The dictionary, as usual, is a bit lacking in regards to the Mime Library.
For MimeEncodeAsMIMEMultipartDocument we have parameters but no idea what
the values (enum) for them could or should be.

pContentA: How do we pre-encode parts including headers?

pMultipartType: What MultiPart types are there?

pParamA: What kind of parameters does ParamA take?

There is a lesson that has a single use-case instance but it does not cover
all attachment or part types so we are still left guessing. Perhaps this is
where either Monte or Ali who coded this could help us out. (
https://github.com/livecode/livecode/blob/38790fc428ff5fc3dc769b3a9cde5733bcf209a2/extensions/script-libraries/mime/mime.livecodescript
)

I'm trying to attach a pdf to an email and have bcc addresses too.

Thanks

Sean Cole
*Pi Digital *
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Advice setting up a new project

2020-12-28 Thread JeeJeeStudio via use-livecode
If you've already written it in Python, then maybe it's more convenient 
for you to use BeeWare so you could deploy your Python app with a GUI to 
web and any other platform.


Check beeware.org

I would not use HTML5 from LC, it's far from usefull for a website or 
webapplication.


Else i would use html + php or html + lc-server if you are able to 
instal lc-server on your server.



Op 28-12-2020 om 11:46 schreef Erik Beugelaar via use-livecode:

Hello All,

  


First of all I hope you all had a nice Xmas despite of all the Covid
limitations.

  


I have written in Python some crawlers in Scrapy. They are now executed via
the command terminal and are working fine however they are written with
fixed parameters and I want to make it more flexible.

  


So, I am planning to make a GUI written in LiveCode (if possible) that is
able to act as a layer over a HTML page in Chrome so the user can click on
an element in the webpage so I can read the underlying data.

It's a bit how ColorZilla is picking up a color from an HTML page.

  


I think I will use Trevor's platform for the creation of the application but
my main question is: are there examples or design patterns to implement the
point and click mechanism?

  


I know that Hermann who sadly passed away from us did a lot of amazing work
with LiveCode HTML5 but I want to develop it with my current Indy
subscription. I am aware or the Url() command.

  


Any clues will be appreciated.

  


Thanks in advance,

Erik

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


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


Re: Livecode Builder - passing lcs string to C functions

2020-12-28 Thread John Balgenorth via use-livecode
Basically you just use a shell  command to execute the c code
and  pass arguments to  the c program right after you call the
code  in the shell command.

I  wrote and example and posted it a few years ago  but I do
not have access to my old email  files at the moment but you
might still  be able to  find it by searching the list.

I would be interested in seeing how you are doing it if you
ever want to post the code for others to use.

JB


> On Dec 28, 2020, at 5:02 AM, Dan Brown via use-livecode 
>  wrote:
> 
> Hi I'm stuck trying to find examples of passing lcs strings to a C function
> via pointer and it's driving me mad! I can retrieve char * pointers from C
> functions, convert to string and pass back to lcs but haven't come across
> any easy to grok examples of sending data to C. Any guidance would be
> appreciated
> 
> Thanks
> 
> Dan
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

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


Livecode Builder - passing lcs string to C functions

2020-12-28 Thread Dan Brown via use-livecode
Hi I'm stuck trying to find examples of passing lcs strings to a C function
via pointer and it's driving me mad! I can retrieve char * pointers from C
functions, convert to string and pass back to lcs but haven't come across
any easy to grok examples of sending data to C. Any guidance would be
appreciated

Thanks

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


Advice setting up a new project

2020-12-28 Thread Erik Beugelaar via use-livecode
Hello All,

 

First of all I hope you all had a nice Xmas despite of all the Covid
limitations.

 

I have written in Python some crawlers in Scrapy. They are now executed via
the command terminal and are working fine however they are written with
fixed parameters and I want to make it more flexible.

 

So, I am planning to make a GUI written in LiveCode (if possible) that is
able to act as a layer over a HTML page in Chrome so the user can click on
an element in the webpage so I can read the underlying data.

It's a bit how ColorZilla is picking up a color from an HTML page.

 

I think I will use Trevor's platform for the creation of the application but
my main question is: are there examples or design patterns to implement the
point and click mechanism?

 

I know that Hermann who sadly passed away from us did a lot of amazing work
with LiveCode HTML5 but I want to develop it with my current Indy
subscription. I am aware or the Url() command.

 

Any clues will be appreciated.

 

Thanks in advance,

Erik

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