From jbv at souslelogo.com Sun Feb 2 14:14:57 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Sun, 02 Feb 2025 14:14:57 -0500 Subject: Best way to base64encode a jpeg file ? Message-ID: <829be9080c24e2a5ae5fb7478c4d1066@souslelogo.com> Hi list, I need to base64encode a serie of jpeg files to include the code in a curl request. What is the best way to do that ? Do I need to import each file into an image control and base64encode the "text" of the image ? Thank you, jbv From alex at tweedly.net Sun Feb 2 19:44:45 2025 From: alex at tweedly.net (Alex Tweedly) Date: Mon, 3 Feb 2025 00:44:45 +0000 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <829be9080c24e2a5ae5fb7478c4d1066@souslelogo.com> References: <829be9080c24e2a5ae5fb7478c4d1066@souslelogo.com> Message-ID: <0cbef31f-dfad-40e2-9ad1-6f406254eb17@tweedly.net> Why not just something like repeat for each line L in tFilePathNames     put url ("binfile:" & L) into tmp     put base64encode(tmp) after tWhatever end repeat Alex. On 02/02/2025 19:14, jbv via use-livecode wrote: > Hi list, > > I need to base64encode a serie of jpeg files to include > the code in a curl request. > What is the best way to do that ? > Do I need to import each file into an image control and > base64encode the "text" of the image ? > > Thank you, > jbv > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From ambassador at fourthworld.com Sun Feb 2 21:10:58 2025 From: ambassador at fourthworld.com (Richard Gaskin) Date: Mon, 03 Feb 2025 02:10:58 +0000 Subject: Best way to base64encode a jpeg file ? Message-ID: <34ae27543c1fa3f5dba848dec746e5eb51cc41d3@fourthworld.com> jbv wrote: > I need to base64encode a serie of jpeg files to include > the code in a curl request. > What is the best way to do that ? Depends. What's on the receiving end, and what options does it support? -- Richard Gaskin FourthWorld.com From jbv at souslelogo.com Mon Feb 3 03:25:54 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Mon, 03 Feb 2025 03:25:54 -0500 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <34ae27543c1fa3f5dba848dec746e5eb51cc41d3@fourthworld.com> References: <34ae27543c1fa3f5dba848dec746e5eb51cc41d3@fourthworld.com> Message-ID: <039f0da859345f629184bc4a4fa69ff8@souslelogo.com> Le 2025-02-02 21:10, Richard Gaskin via use-livecode a crit : > jbv wrote: > >> I need to base64encode a serie of jpeg files to include >> the code in a curl request. >> What is the best way to do that ? > > Depends. What's on the receiving end, and what options does it > support? > Actually, my question was not about the serie of files, but rather how to base64encode the relevant data of each jpeg file. I tried to open a file and encode it, but it was rejected in the curl request, so I assumed that unnecessary extra data had been added. The idea of importing the files into an image control came from this forum post : https://forums.livecode.com/viewtopic.php?t=24274 in which someone suggested this : put the text of image "thumbnail" into temp put base64encode(temp) into image_base64 The syntax of the multimodal curl I am using is as follow : {"type": "image_url", "image_url": "data:image/jpeg;base64,ENCODED_IMAGE_HERE"} Thanks, jbv From jbv at souslelogo.com Mon Feb 3 04:11:30 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Mon, 03 Feb 2025 04:11:30 -0500 Subject: Interacting locally with LC and AI models Message-ID: <09ded88ef4de0dcbb293c7d7967d0d6c@souslelogo.com> Hi list, Someone asked me privately, so I thought that maybe others would be interested in a simple way to interact between LC and AI models locally on their machine. The method uses Ollama, which is available for Mac, Win and Linux : https://ollama.com 1- Download and install Ollama (plenty of tutorials on youtube) 2- run Ollama via Terminal (on Mac) : ollama serve 3- load a model via Terminal (from HuggingFace for instance) : ollama run llama3.2:1b 4- in a livecode stack, create a field with the following content : curl -X POST http://localhost:11434/api/generate \ -H "Content-Type: application/json" \ -d '{ "model": "llama3.2:1b", "prompt": "What is the capital of France ?", "stream": false }' 5- create a button with the following script : on mouseup put field 1 into tcurl put shell(tcurl) end mouseup 6- the answer from the model displays in the message box in json format. This works great on machines with a GPU and at least 16 Gb of RAM. The more RAM, the bigger the models that can be used. Enjoy, jbv From bobsneidar at iotecdigital.com Mon Feb 3 11:07:26 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Mon, 3 Feb 2025 16:07:26 +0000 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <039f0da859345f629184bc4a4fa69ff8@souslelogo.com> References: <34ae27543c1fa3f5dba848dec746e5eb51cc41d3@fourthworld.com> <039f0da859345f629184bc4a4fa69ff8@souslelogo.com> Message-ID: <1A43F3B2-FAE7-407E-A658-55EA9BDED09F@iotecdigital.com> I heard that the base64encode puts a carriage return at a certain interval of characters (not sure how many). Bob S > On Feb 3, 2025, at 12:25 AM, jbv via use-livecode wrote: > > Le 2025-02-02 21:10, Richard Gaskin via use-livecode a écrit : >> jbv wrote: >>> I need to base64encode a serie of jpeg files to include >>> the code in a curl request. >>> What is the best way to do that ? >> Depends. What's on the receiving end, and what options does it support? > > Actually, my question was not about the serie of files, but rather how > to base64encode the relevant data of each jpeg file. > I tried to open a file and encode it, but it was rejected in the curl > request, so I assumed that unnecessary extra data had been added. > The idea of importing the files into an image control came from this > forum post : https://forums.livecode.com/viewtopic.php?t=24274 > in which someone suggested this : > put the text of image "thumbnail" into temp > put base64encode(temp) into image_base64 > > The syntax of the multimodal curl I am using is as follow : > {"type": "image_url", "image_url": "data:image/jpeg;base64,ENCODED_IMAGE_HERE"} > > Thanks, > jbv > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From jbv at souslelogo.com Mon Feb 3 11:19:38 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Mon, 03 Feb 2025 11:19:38 -0500 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <1A43F3B2-FAE7-407E-A658-55EA9BDED09F@iotecdigital.com> References: <34ae27543c1fa3f5dba848dec746e5eb51cc41d3@fourthworld.com> <039f0da859345f629184bc4a4fa69ff8@souslelogo.com> <1A43F3B2-FAE7-407E-A658-55EA9BDED09F@iotecdigital.com> Message-ID: <62bcea2d8d892196a7365a270368bce6@souslelogo.com> Le 2025-02-03 11:07, Bob Sneidar via use-livecode a crit : > I heard that the base64encode puts a carriage return at a certain > interval of characters (not sure how many). > > Bob S Yes, that's true, but even when I removed the returns it didn't work. From ambassador at fourthworld.com Mon Feb 3 19:00:51 2025 From: ambassador at fourthworld.com (Richard Gaskin) Date: Tue, 04 Feb 2025 00:00:51 +0000 Subject: Best way to base64encode a jpeg file ? Message-ID: jbv wrote: > Le 2025-02-02 21:10, Richard Gaskin via use-livecode a écrit : >> jbv wrote: >> >>> I need to base64encode a serie of jpeg files to include >>> the code in a curl request. >>> What is the best way to do that ? >> >> Depends. What's on the receiving end, and what options does it >> support? >> > > Actually, my question was not about the serie of files, but rather > how to base64encode the relevant data of each jpeg file. You'd already done that. It did't solve it. Now we need to find out why. Learning what the receiver expects will help us meet its expectations. -- Richard Gaskin FourthWorld.com From Neville.Smythe at optusnet.com.au Mon Feb 3 21:34:16 2025 From: Neville.Smythe at optusnet.com.au (Neville Smythe) Date: Tue, 4 Feb 2025 13:34:16 +1100 Subject: use-livecode Digest, Vol 257, Issue 1 Message-ID: <048EAAFC-53D2-4F60-8B10-58873E6432EC@optusnet.com.au> Urlencode(base64encode(stuff))??? I dont think you want to remove the line feeds, but encode them for http transmission $@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%? Neville Smythe Director, International Go Federation VicePresident, Australian Go Association Inc. > On 4 Feb 2025, at 4:01 am, use-livecode-request at lists.runrev.com wrote: > Send use-livecode mailing list submissions to > use-livecode at lists.runrev.com > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.runrev.com/mailman/listinfo/use-livecode > or, via email, send a message with subject or body 'help' to > use-livecode-request at lists.runrev.com > > You can reach the person managing the list at > use-livecode-owner at lists.runrev.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of use-livecode digest..." > > > you can find the archives for this list at: > > http://lists.runrev.com/pipermail/use-livecode/ > > and search them using this link: > > https://www.mail-archive.com/use-livecode at lists.runrev.com/ > > > Today's Topics: > > 1. Best way to base64encode a jpeg file ? (jbv at souslelogo.com) > 2. Re: Best way to base64encode a jpeg file ? (Alex Tweedly) > 3. Re: Best way to base64encode a jpeg file ? (Richard Gaskin) > 4. Re: Best way to base64encode a jpeg file ? (jbv at souslelogo.com) > 5. Interacting locally with LC and AI models (jbv at souslelogo.com) > 6. Re: Best way to base64encode a jpeg file ? (Bob Sneidar) > 7. Re: Best way to base64encode a jpeg file ? (jbv at souslelogo.com) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 02 Feb 2025 14:14:57 -0500 > From: jbv at souslelogo.com > To: How to use LiveCode > Subject: Best way to base64encode a jpeg file ? > Message-ID: <829be9080c24e2a5ae5fb7478c4d1066 at souslelogo.com> > Content-Type: text/plain; charset=US-ASCII; format=flowed > > Hi list, > > I need to base64encode a serie of jpeg files to include > the code in a curl request. > What is the best way to do that ? > Do I need to import each file into an image control and > base64encode the "text" of the image ? > > Thank you, > jbv > > > > ------------------------------ > > Message: 2 > Date: Mon, 3 Feb 2025 00:44:45 +0000 > From: Alex Tweedly > To: use-livecode at lists.runrev.com > Subject: Re: Best way to base64encode a jpeg file ? > Message-ID: <0cbef31f-dfad-40e2-9ad1-6f406254eb17 at tweedly.net> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Why not just something like > > repeat for each line L in tFilePathNames > > ??? put url ("binfile:" & L) into tmp > > ??? put base64encode(tmp) after tWhatever > > end repeat > > Alex. > > On 02/02/2025 19:14, jbv via use-livecode wrote: >> Hi list, >> >> I need to base64encode a serie of jpeg files to include >> the code in a curl request. >> What is the best way to do that ? >> Do I need to import each file into an image control and >> base64encode the "text" of the image ? >> >> Thank you, >> jbv >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode at lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > > > ------------------------------ > > Message: 3 > Date: Mon, 03 Feb 2025 02:10:58 +0000 > From: "Richard Gaskin" > To: use-livecode at lists.runrev.com > Subject: Re: Best way to base64encode a jpeg file ? > Message-ID: <34ae27543c1fa3f5dba848dec746e5eb51cc41d3 at fourthworld.com> > Content-Type: text/plain; charset="utf-8" > > jbv wrote: > >> I need to base64encode a serie of jpeg files to include >> the code in a curl request. >> What is the best way to do that ? > > Depends. What's on the receiving end, and what options does it support? > > -- > Richard Gaskin > FourthWorld.com > > > > ------------------------------ > > Message: 4 > Date: Mon, 03 Feb 2025 03:25:54 -0500 > From: jbv at souslelogo.com > To: How to use LiveCode > Subject: Re: Best way to base64encode a jpeg file ? > Message-ID: <039f0da859345f629184bc4a4fa69ff8 at souslelogo.com> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Le 2025-02-02 21:10, Richard Gaskin via use-livecode a ?crit?: >> jbv wrote: >> >>> I need to base64encode a serie of jpeg files to include >>> the code in a curl request. >>> What is the best way to do that ? >> >> Depends. What's on the receiving end, and what options does it >> support? > > Actually, my question was not about the serie of files, but rather how > to base64encode the relevant data of each jpeg file. > I tried to open a file and encode it, but it was rejected in the curl > request, so I assumed that unnecessary extra data had been added. > The idea of importing the files into an image control came from this > forum post : https://forums.livecode.com/viewtopic.php?t=24274 > in which someone suggested this : > put the text of image "thumbnail" into temp > put base64encode(temp) into image_base64 > > The syntax of the multimodal curl I am using is as follow : > {"type": "image_url", "image_url": > "data:image/jpeg;base64,ENCODED_IMAGE_HERE"} > > Thanks, > jbv > > > > ------------------------------ > > Message: 5 > Date: Mon, 03 Feb 2025 04:11:30 -0500 > From: jbv at souslelogo.com > To: How to use LiveCode > Subject: Interacting locally with LC and AI models > Message-ID: <09ded88ef4de0dcbb293c7d7967d0d6c at souslelogo.com> > Content-Type: text/plain; charset=US-ASCII; format=flowed > > Hi list, > > Someone asked me privately, so I thought that maybe others > would be interested in a simple way to interact between LC > and AI models locally on their machine. > > The method uses Ollama, which is available for Mac, Win and > Linux : https://ollama.com > > 1- Download and install Ollama (plenty of tutorials on youtube) > > 2- run Ollama via Terminal (on Mac) : > ollama serve > > 3- load a model via Terminal (from HuggingFace for instance) : > ollama run llama3.2:1b > > 4- in a livecode stack, create a field with the following content : > curl -X POST http://localhost:11434/api/generate \ > -H "Content-Type: application/json" \ > -d '{ > "model": "llama3.2:1b", > "prompt": "What is the capital of France ?", > "stream": false > }' > > 5- create a button with the following script : > on mouseup > put field 1 into tcurl > put shell(tcurl) > end mouseup > > 6- the answer from the model displays in the message box in json format. > > This works great on machines with a GPU and at least 16 Gb of RAM. > The more RAM, the bigger the models that can be used. > > Enjoy, > jbv > > > > ------------------------------ > > Message: 6 > Date: Mon, 3 Feb 2025 16:07:26 +0000 > From: Bob Sneidar > To: How to use LiveCode > Subject: Re: Best way to base64encode a jpeg file ? > Message-ID: <1A43F3B2-FAE7-407E-A658-55EA9BDED09F at iotecdigital.com> > Content-Type: text/plain; charset="utf-8" > > I heard that the base64encode puts a carriage return at a certain interval of characters (not sure how many). > > Bob S > > >> On Feb 3, 2025, at 12:25 AM, jbv via use-livecode wrote: >> >> Le 2025-02-02 21:10, Richard Gaskin via use-livecode a ?crit : >>> jbv wrote: >>>> I need to base64encode a serie of jpeg files to include >>>> the code in a curl request. >>>> What is the best way to do that ? >>> Depends. What's on the receiving end, and what options does it support? >> >> Actually, my question was not about the serie of files, but rather how >> to base64encode the relevant data of each jpeg file. >> I tried to open a file and encode it, but it was rejected in the curl >> request, so I assumed that unnecessary extra data had been added. >> The idea of importing the files into an image control came from this >> forum post : https://forums.livecode.com/viewtopic.php?t=24274 >> in which someone suggested this : >> put the text of image "thumbnail" into temp >> put base64encode(temp) into image_base64 >> >> The syntax of the multimodal curl I am using is as follow : >> {"type": "image_url", "image_url": "data:image/jpeg;base64,ENCODED_IMAGE_HERE"} >> >> Thanks, >> jbv >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode at lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > > ------------------------------ > > Message: 7 > Date: Mon, 03 Feb 2025 11:19:38 -0500 > From: jbv at souslelogo.com > To: How to use LiveCode > Subject: Re: Best way to base64encode a jpeg file ? > Message-ID: <62bcea2d8d892196a7365a270368bce6 at souslelogo.com> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Le 2025-02-03 11:07, Bob Sneidar via use-livecode a ?crit?: >> I heard that the base64encode puts a carriage return at a certain >> interval of characters (not sure how many). >> >> Bob S > > Yes, that's true, but even when I removed the returns it didn't work. > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > http://lists.runrev.com/mailman/listinfo/use-livecode > > > ------------------------------ > > End of use-livecode Digest, Vol 257, Issue 1 > ******************************************** From jbv at souslelogo.com Tue Feb 4 13:29:42 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Tue, 04 Feb 2025 13:29:42 -0500 Subject: Best way to base64encode a jpeg file ? In-Reply-To: References: Message-ID: <21df5ad3f600d303070ab693e6f4b7a5@souslelogo.com> I am stuck. No matter what I try, I always get the same error : "url" field must be a base64 encoded image So I'm back to my very first question : how to base64encode a jpeg file in LC to be used in a regular multimodal json curl request... Le 2025-02-03 19:00, Richard Gaskin via use-livecode a crit : > > You'd already done that. It did't solve it. Now we need to find out > why. > > Learning what the receiver expects will help us meet its expectations. > > -- > Richard Gaskin > FourthWorld.com > From ambassador at fourthworld.com Tue Feb 4 14:36:04 2025 From: ambassador at fourthworld.com (Richard Gaskin) Date: Tue, 04 Feb 2025 19:36:04 +0000 Subject: Best way to base64encode a jpeg file ? Message-ID: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> You're already reading the file as binary, and you're already encoding it with Base64. You've addressed the basics well. But we see the issue lies in a murkier place. Without the complete relevant code and the API spec, anything offered here would be just a guess. So let's guess: are you sending data from one image file, or several, in this test? If multiple, how does the reciever parse them? What headers are you using? What headers are expected? What are the other modes available in this "multimodal" API? What encodings are used, and what are expected? Is the error coming from the server or LC? If the server, what is the error number? If LC, what line is the debugger pointing to, and may we see that line? Are you using POST? Are the POST delimiters appropriate? The range of things that aren't the solution is vast. It's always simpler to diagnose code that doesn't meet expectations when we can see the code and the expectations. On this list we have the collective experience of a great many professionals who've been building networked applications for decades. We'd like to help. The more information we have, the more that helps us help. -- Richard Gaskin FourthWorld.com jbv wrote: > I am stuck. > No matter what I try, I always get the same error : > "url" field must be a base64 encoded image > > So I'm back to my very first question : how to base64encode > a jpeg file in LC to be used in a regular multimodal json > curl request... > >> Le 2025-02-03 19:00, Richard Gaskin via use-livecode a écrit : >> >>> You'd already done that. It did't solve it. Now we need to find out >>> why. >>> >>> Learning what the receiver expects will help us meet its expectations. >>> >>> -- >>> Richard Gaskin >>> FourthWorld.com >> From mark at canelasoftware.com Tue Feb 4 21:53:45 2025 From: mark at canelasoftware.com (Mark Talluto) Date: Tue, 4 Feb 2025 18:53:45 -0800 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> Message-ID: <4330FA92-0757-4950-AA7C-311038782FCD@canelasoftware.com> Further to Richard’s suggestions, please provide a link to the docs for the service. We can check out the API and see precisely what is going on. Best regards, Mark Talluto appli.io livecloud.io nursenotes.net canelasoftware.com > On Feb 4, 2025, at 11:36 AM, Richard Gaskin via use-livecode wrote: > > You're already reading the file as binary, and you're already encoding it with Base64. You've addressed the basics well. But we see the issue lies in a murkier place. > > Without the complete relevant code and the API spec, anything offered here would be just a guess. > > So let's guess: are you sending data from one image file, or several, in this test? If multiple, how does the reciever parse them? What headers are you using? What headers are expected? What are the other modes available in this "multimodal" API? What encodings are used, and what are expected? Is the error coming from the server or LC? If the server, what is the error number? If LC, what line is the debugger pointing to, and may we see that line? Are you using POST? Are the POST delimiters appropriate? > > The range of things that aren't the solution is vast. It's always simpler to diagnose code that doesn't meet expectations when we can see the code and the expectations. > > On this list we have the collective experience of a great many professionals who've been building networked applications for decades. We'd like to help. The more information we have, the more that helps us help. > > -- > Richard Gaskin > FourthWorld.com > > > > jbv wrote: > >> I am stuck. >> No matter what I try, I always get the same error : >> "url" field must be a base64 encoded image >> >> So I'm back to my very first question : how to base64encode >> a jpeg file in LC to be used in a regular multimodal json >> curl request... >> >>> Le 2025-02-03 19:00, Richard Gaskin via use-livecode a écrit : >>> >>>> You'd already done that. It did't solve it. Now we need to find out >>>> why. >>>> >>>> Learning what the receiver expects will help us meet its expectations. >>>> >>>> -- >>>> Richard Gaskin >>>> FourthWorld.com >>> > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From jbv at souslelogo.com Wed Feb 5 04:22:25 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Wed, 05 Feb 2025 04:22:25 -0500 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> Message-ID: <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> Richard & Mark, Thank you both for your suggestions. I actually made some progress, as there were 2 different issues : 1- the syntax of the multimodal json curl must be {"type" : "image_url", "image_url" : {"url": "data:image/jpeg;base64,{_BASE64_}"}} instead of {"type" : "image_url", "image_url" : {"url": "data:image/jpeg;base64 {_BASE64_}"}} I found the tip in an obscure blog post from early 2023. Even the latest ChatGPT-4o3 missed the point. 2- I still have a problem with the base64 encoding of a jpeg file in LC. Long story short, I am trying to send a curl request to a vision AI model running with LM studio. I tried several models that didn't give much details in the error messages, except for "bad request" or "data must be base64 encoded jpeg". But the last one I tried returned : {"error":"Input buffer has corrupt header: VipsJpeg: Corrupt JPEG data: 13 extraneous bytes before marker 0x8e\nVipsJpeg: Unsupported marker type 0x8e"} Here is my code for base64 encoding : put URL ("file:" & "myfile.jpg") into timagedata put base64encode(timagedata) into tBase64Image replace return with "" in tBase64Image Thanks, jbv From monte.goulding at livecode.com Wed Feb 5 04:35:38 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Wed, 5 Feb 2025 20:35:38 +1100 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> Message-ID: Hi jbv > Here is my code for base64 encoding : > put URL ("file:" & "myfile.jpg") into timagedata Use `binfile:` here instead of `file:` so the engine doesn’t treat the data as native text and fiddle with it > put base64encode(timagedata) into tBase64Image > replace return with "" in tBase64Image You need url safe base64 encoding so you need: local tEncoded put base64Encode(pData) into tEncoded replace return with empty in tEncoded replace "+" with "-" in tEncoded replace "/" with "_" in tEncoded replace "=" with empty in tEncoded > > Thanks, > jbv > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From rdimola at evergreeninfo.net Wed Feb 5 08:43:23 2025 From: rdimola at evergreeninfo.net (Ralph DiMola) Date: Wed, 5 Feb 2025 08:43:23 -0500 Subject: Best way to base64encode a jpeg file ? In-Reply-To: References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> Message-ID: <000f01db77d3$f0f870a0$d2e951e0$@net> I can see getting rid of extraneous CRs or LFs but aren’t "+","/" and "=" part of the encoding and corrupt the base 64 data stream? Or am I missing something? Ralph DiMola IT Director Evergreen Information Services rdimola at evergreeninfo.net -----Original Message----- From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Monte Goulding via use-livecode Sent: Wednesday, February 05, 2025 4:36 AM To: How to use LiveCode Cc: Monte Goulding Subject: Re: Best way to base64encode a jpeg file ? Hi jbv > Here is my code for base64 encoding : > put URL ("file:" & "myfile.jpg") into timagedata Use `binfile:` here instead of `file:` so the engine doesn’t treat the data as native text and fiddle with it > put base64encode(timagedata) into tBase64Image replace return with > "" in tBase64Image You need url safe base64 encoding so you need: local tEncoded put base64Encode(pData) into tEncoded replace return with empty in tEncoded replace "+" with "-" in tEncoded replace "/" with "_" in tEncoded replace "=" with empty in tEncoded > > Thanks, > jbv > > _______________________________________________ > use-livecode mailing list > use-livecode at 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 at lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Wed Feb 5 16:51:30 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Wed, 5 Feb 2025 21:51:30 +0000 Subject: Best way to base64encode a jpeg file ? In-Reply-To: References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> Message-ID: <472271FE-3CD6-4728-A934-90A29B60A9CD@iotecdigital.com> I’m curious whether or not this solution worked… Bob S > On Feb 5, 2025, at 1:35 AM, Monte Goulding via use-livecode wrote: > > Hi jbv > >> Here is my code for base64 encoding : >> put URL ("file:" & "myfile.jpg") into timagedata > > Use `binfile:` here instead of `file:` so the engine doesn’t treat the data as native text and fiddle with it > >> put base64encode(timagedata) into tBase64Image >> replace return with "" in tBase64Image > > You need url safe base64 encoding so you need: > > local tEncoded > put base64Encode(pData) into tEncoded > replace return with empty in tEncoded > replace "+" with "-" in tEncoded > replace "/" with "_" in tEncoded > replace "=" with empty in tEncoded > >> >> Thanks, >> jbv >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode at 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 at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From hakan at exformedia.se Thu Feb 6 04:03:02 2025 From: hakan at exformedia.se (=?utf-8?Q?H=C3=A5kan_Liljegren?=) Date: Thu, 6 Feb 2025 10:03:02 +0100 Subject: Interacting locally with LC and AI models In-Reply-To: <09ded88ef4de0dcbb293c7d7967d0d6c@souslelogo.com> References: <09ded88ef4de0dcbb293c7d7967d0d6c@souslelogo.com> Message-ID: You can also use a function and use the “post to url function”, built-in in LiveCode, like this without any need for curl: function ProcessOllamaText pText put pText into tArr["prompt"] put “You are a grumpy wizard, that doesn’t want to be disturbed as you rather want to create new spells" into tArr["system"] put "gemma2:27b" into tArr["model"] put false into tArr["stream"] put arrayToJSON(tArr) into tJSON post tJSON to "http://localhost:11434/api/generate" put it into tJSON put jsonToArray(tJSON) into tRespArr put tRespArr["response"] into tResult replace "\n" with return in tResult return tResult end ProcessOllamaText The tArr[“system”] is the system prompt and tArr[“model”] is the model you run. The system prompt is not needed, but are fun to tweak and test with. If you don’t set stream to false you will get a lot of responses back (usually one response / word). They start to arrive a lot quicker but then you need to handle that in another way, and would also need an asynchronous way of reading the data. You need to have Ollama running as of steps 1-3 in jbv’s description (and of course if you run Ollama run llama3:2:1b then that should be your “model” above. But then you can call it like this put ProcessOllamaText( “Is there a way to create a spell that transforms people into frogs?”) :-Håkan > On 3 Feb 2025, at 10:11, jbv via use-livecode wrote: > > Hi list, > > Someone asked me privately, so I thought that maybe others > would be interested in a simple way to interact between LC > and AI models locally on their machine. > > The method uses Ollama, which is available for Mac, Win and > Linux : https://ollama.com > > 1- Download and install Ollama (plenty of tutorials on youtube) > > 2- run Ollama via Terminal (on Mac) : > ollama serve > > 3- load a model via Terminal (from HuggingFace for instance) : > ollama run llama3.2:1b > > 4- in a livecode stack, create a field with the following content : > curl -X POST http://localhost:11434/api/generate \ > -H "Content-Type: application/json" \ > -d '{ > "model": "llama3.2:1b", > "prompt": "What is the capital of France ?", > "stream": false > }' > > 5- create a button with the following script : > on mouseup > put field 1 into tcurl > put shell(tcurl) > end mouseup > > 6- the answer from the model displays in the message box in json format. > > This works great on machines with a GPU and at least 16 Gb of RAM. > The more RAM, the bigger the models that can be used. > > Enjoy, > jbv > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From jbv at souslelogo.com Thu Feb 6 08:50:43 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Thu, 06 Feb 2025 08:50:43 -0500 Subject: Best way to base64encode a jpeg file ? In-Reply-To: References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> Message-ID: <382db4a143d80cdb6e1107a718f77434@souslelogo.com> Hi Monte, It works ! Thank you very much ! jbv Le 2025-02-05 04:35, Monte Goulding via use-livecode a crit : > Hi jbv > >> Here is my code for base64 encoding : >> put URL ("file:" & "myfile.jpg") into timagedata > > Use `binfile:` here instead of `file:` so the engine doesnt treat the > data as native text and fiddle with it > >> put base64encode(timagedata) into tBase64Image >> replace return with "" in tBase64Image > > You need url safe base64 encoding so you need: > > local tEncoded > put base64Encode(pData) into tEncoded > replace return with empty in tEncoded > replace "+" with "-" in tEncoded > replace "/" with "_" in tEncoded > replace "=" with empty in tEncoded > >> From bobsneidar at iotecdigital.com Thu Feb 6 11:04:42 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Thu, 6 Feb 2025 16:04:42 +0000 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <382db4a143d80cdb6e1107a718f77434@souslelogo.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> <382db4a143d80cdb6e1107a718f77434@souslelogo.com> Message-ID: Well then that is now a function in my conversions library: function urlSafeBase64 pData replace return with empty in pData replace "+" with "-" in pData replace "/" with "_" in pData replace "=" with empty in pData return pData end urlSafeBase64 Bob S > On Feb 6, 2025, at 5:50 AM, jbv via use-livecode wrote: > > Hi Monte, > > It works ! Thank you very much ! > > jbv > > Le 2025-02-05 04:35, Monte Goulding via use-livecode a écrit : >> Hi jbv >>> Here is my code for base64 encoding : >>> put URL ("file:" & "myfile.jpg") into timagedata >> Use `binfile:` here instead of `file:` so the engine doesn’t treat the data as native text and fiddle with it >>> put base64encode(timagedata) into tBase64Image >>> replace return with "" in tBase64Image >> You need url safe base64 encoding so you need: >> local tEncoded >> put base64Encode(pData) into tEncoded >> replace return with empty in tEncoded >> replace "+" with "-" in tEncoded >> replace "/" with "_" in tEncoded >> replace "=" with empty in tEncoded > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Thu Feb 6 11:28:55 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Thu, 6 Feb 2025 16:28:55 +0000 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <000f01db77d3$f0f870a0$d2e951e0$@net> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> <000f01db77d3$f0f870a0$d2e951e0$@net> Message-ID: <2F6DFBFE-B994-43E3-BB8A-B239AC759E85@iotecdigital.com> I don’t see any of those characters on base64encoded strings. Bob S > On Feb 5, 2025, at 5:43 AM, Ralph DiMola via use-livecode wrote: > > I can see getting rid of extraneous CRs or LFs but aren’t "+","/" and "=" part of the encoding and corrupt the base 64 data stream? Or am I missing something? > > Ralph DiMola > IT Director > Evergreen Information Services > rdimola at evergreeninfo.net > > -----Original Message----- > From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Monte Goulding via use-livecode > Sent: Wednesday, February 05, 2025 4:36 AM > To: How to use LiveCode > Cc: Monte Goulding > Subject: Re: Best way to base64encode a jpeg file ? > > Hi jbv > >> Here is my code for base64 encoding : >> put URL ("file:" & "myfile.jpg") into timagedata > > Use `binfile:` here instead of `file:` so the engine doesn’t treat the data as native text and fiddle with it > >> put base64encode(timagedata) into tBase64Image replace return with >> "" in tBase64Image > > You need url safe base64 encoding so you need: > > local tEncoded > put base64Encode(pData) into tEncoded > replace return with empty in tEncoded > replace "+" with "-" in tEncoded > replace "/" with "_" in tEncoded > replace "=" with empty in tEncoded > >> >> Thanks, >> jbv >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode at 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 at 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 at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From monte.goulding at livecode.com Thu Feb 6 16:51:22 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Fri, 7 Feb 2025 08:51:22 +1100 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <2F6DFBFE-B994-43E3-BB8A-B239AC759E85@iotecdigital.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> <000f01db77d3$f0f870a0$d2e951e0$@net> <2F6DFBFE-B994-43E3-BB8A-B239AC759E85@iotecdigital.com> Message-ID: <63F89922-31EE-44BE-8E69-745917AC77F1@livecode.com> Hi Bob > On 7 Feb 2025, at 3:28 AM, Bob Sneidar via use-livecode wrote: > > I don’t see any of those characters on base64encoded strings. They definitely can be int there. Se RFC 4648 section 4 and 5 encoding tables for reference. https://datatracker.ietf.org/doc/html/rfc4648#section-5 Cheers Monte From bobsneidar at iotecdigital.com Thu Feb 6 17:54:38 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Thu, 6 Feb 2025 22:54:38 +0000 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <63F89922-31EE-44BE-8E69-745917AC77F1@livecode.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> <000f01db77d3$f0f870a0$d2e951e0$@net> <2F6DFBFE-B994-43E3-BB8A-B239AC759E85@iotecdigital.com> <63F89922-31EE-44BE-8E69-745917AC77F1@livecode.com> Message-ID: <17672D63-BBF8-4C17-A429-5EB2DA5C8BE8@iotecdigital.com> Hi Monte. Are you saying a base64encode string CAN contain the characters you listed? I’m talking about dash, underscore and equal. Or is that reference saying that plus and minus (dash) are interchangeable, along with the slash and underscore respectively? Bob S > On Feb 6, 2025, at 1:51 PM, Monte Goulding via use-livecode wrote: > > Hi Bob > >> On 7 Feb 2025, at 3:28 AM, Bob Sneidar via use-livecode wrote: >> >> I don’t see any of those characters on base64encoded strings. > > > They definitely can be int there. Se RFC 4648 section 4 and 5 encoding tables for reference. > > https://datatracker.ietf.org/doc/html/rfc4648#section-5 > > Cheers > > Monte > > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From monte.goulding at livecode.com Thu Feb 6 18:23:16 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Fri, 7 Feb 2025 10:23:16 +1100 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <17672D63-BBF8-4C17-A429-5EB2DA5C8BE8@iotecdigital.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> <000f01db77d3$f0f870a0$d2e951e0$@net> <2F6DFBFE-B994-43E3-BB8A-B239AC759E85@iotecdigital.com> <63F89922-31EE-44BE-8E69-745917AC77F1@livecode.com> <17672D63-BBF8-4C17-A429-5EB2DA5C8BE8@iotecdigital.com> Message-ID: <9C74E3E8-89F4-4FB7-BC2A-9B3C88A01B38@livecode.com> > On 7 Feb 2025, at 9:54 AM, Bob Sneidar via use-livecode wrote: > > Hi Monte. > > Are you saying a base64encode string CAN contain the characters you listed? I’m talking about dash, underscore and equal. Or is that reference saying that plus and minus (dash) are interchangeable, along with the slash and underscore respectively? Hi Bob I’ll add some comments to the function to explain function urlSafeBase64 pData local tEncoded put base64Encode(pData) into tEncoded // The engine’s base64Encode function formats the result as required for // base 64 Content-Transfer-Encoding as discussed in RFC 4648 // section 3.1 and has linefeeds at 76 characters so remove replace return with empty in tEncoded // The engine’s base64Encode encodes using the alphabet in RFC 4648 // section 4 and needs to be mapped to the alphabet in section 5 replace "+" with "-" in pData replace "/" with "_" in pData // = is used to pad base 64 encoded data and in many circumstances is not // required. This could be an option on this function because it is valid in // url safe base 64 as long is it is percent encoded after replace "=" with empty in tEncoded return tEncoded end urlSafeBase64 > > Bob S > > >> On Feb 6, 2025, at 1:51 PM, Monte Goulding via use-livecode wrote: >> >> Hi Bob >> >>> On 7 Feb 2025, at 3:28 AM, Bob Sneidar via use-livecode wrote: >>> >>> I don’t see any of those characters on base64encoded strings. >> >> >> They definitely can be int there. Se RFC 4648 section 4 and 5 encoding tables for reference. >> >> https://datatracker.ietf.org/doc/html/rfc4648#section-5 >> >> Cheers >> >> Monte >> >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode at 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 at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From monte.goulding at livecode.com Thu Feb 6 18:24:13 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Fri, 7 Feb 2025 10:24:13 +1100 Subject: Best way to base64encode a jpeg file ? In-Reply-To: <9C74E3E8-89F4-4FB7-BC2A-9B3C88A01B38@livecode.com> References: <39338428d9da811b9041bc703933a4d037277a02@fourthworld.com> <3565f1f0824e54c981253c9ecf9028b4@souslelogo.com> <000f01db77d3$f0f870a0$d2e951e0$@net> <2F6DFBFE-B994-43E3-BB8A-B239AC759E85@iotecdigital.com> <63F89922-31EE-44BE-8E69-745917AC77F1@livecode.com> <17672D63-BBF8-4C17-A429-5EB2DA5C8BE8@iotecdigital.com> <9C74E3E8-89F4-4FB7-BC2A-9B3C88A01B38@livecode.com> Message-ID: <039C6167-5965-48CE-83DA-5E60064BCA66@livecode.com> Whoops that should be: function urlSafeBase64 pData local tEncoded put base64Encode(pData) into tEncoded // The engine’s base64Encode function formats the result as required for // base 64 Content-Transfer-Encoding as discussed in RFC 4648 // section 3.1 and has linefeeds at 76 characters so remove replace return with empty in tEncoded // The engine’s base64Encode encodes using the alphabet in RFC 4648 // section 4 and needs to be mapped to the alphabet in section 5 replace "+" with "-" in tEncoded replace "/" with "_" in tEncoded // = is used to pad base 64 encoded data and in many circumstances is not // required. This could be an option on this function because it is valid in // url safe base 64 as long is it is percent encoded after replace "=" with empty in tEncoded return tEncoded end urlSafeBase64 From curry at pair.com Mon Feb 10 15:44:49 2025 From: curry at pair.com (Curry Kenworthy) Date: Mon, 10 Feb 2025 15:44:49 -0500 Subject: WordLib 2.4 release for LiveCode 9/10+ Message-ID: <08c345e5-e50c-4475-a312-8b74f86604dc@pair.com> I'm happy to announce: WordLib 2.4.0.0 release for LiveCode 6-10+. Changes: - fixes for LC 10's arbitrary code changes. Download/Try: http://curryk.com/WordLib-24000.zip Buy here: https://livecodeaddons.com/buy-wordlib or with VAT: https://payhip.com/CurryKSoftware (Don't use LC store at this time; old version.) Info: https://livecodeaddons.com/wordlib.html Still recuperating from illness - comments may be delayed. Other addon updates depending on health and WordLib sales! Best wishes, Curry Kenworthy WordLib: Import MS Word and OpenOffice files in LiveCode! "Dominate documents with WordLib and LC" https://livecodeaddons.com/ From jbv at souslelogo.com Tue Feb 11 09:41:10 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Tue, 11 Feb 2025 09:41:10 -0500 Subject: Closing a tab in a browser widget Message-ID: <4b8a37f6869a770339927bb755656a39@souslelogo.com> Hi list, Is it possible to close a tab of a website displayed inside a browser widget ? I am on Mac and I know this can be done using AppleScript, but is there an LC-only solution ? Thank you in advance. jbv From tom at makeshyft.com Tue Feb 11 19:20:13 2025 From: tom at makeshyft.com (Tom Glod) Date: Tue, 11 Feb 2025 19:20:13 -0500 Subject: Closing a tab in a browser widget In-Reply-To: <4b8a37f6869a770339927bb755656a39@souslelogo.com> References: <4b8a37f6869a770339927bb755656a39@souslelogo.com> Message-ID: Hi jbv, there are no tabs that i know of in our browser widget, each tab would be its own widget ...... you can delete or hide the widget to achieve this effect. On Tue, Feb 11, 2025 at 9:42 AM jbv via use-livecode < use-livecode at lists.runrev.com> wrote: > Hi list, > > Is it possible to close a tab of a website displayed > inside a browser widget ? > I am on Mac and I know this can be done using AppleScript, > but is there an LC-only solution ? > > Thank you in advance. > jbv > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > From bobsneidar at iotecdigital.com Tue Feb 18 16:28:06 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Tue, 18 Feb 2025 21:28:06 +0000 Subject: Encoding Arrays with File Paths Message-ID: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> Hi all. I think I have uncovered an issue with encoding / decoding arrays where some array elements are file paths. I’m thinking that the forweard slashes are interfering with the decoding process. I think this because the arrayEncoded data has the actual paths still intact in the data stream. I can work around this by base64encoding / decoding any elements with file paths, but I want to make sure that the array encoding process does in fact have issues with certain characters, and if it does what are those characters? Is there a list of them? Can I delimit them? Bob S From monte.goulding at livecode.com Tue Feb 18 17:06:23 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Wed, 19 Feb 2025 09:06:23 +1100 Subject: Encoding Arrays with File Paths In-Reply-To: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> Message-ID: <2EC78C6C-D1C9-4E6C-B839-C406AF336649@livecode.com> Hi Bob I strongly suspect a mis-diagnosis here. If you have your paths in an array then do `put arrayDecode(arrayEncode(myArray)) into myArray` do you still see a problem? If you do please report a bug as there is a lot of code that relies on arrayEncode/decode round tripping with no issues. Cheers Monte > On 19 Feb 2025, at 8:28 AM, Bob Sneidar via use-livecode wrote: > > Hi all. > > I think I have uncovered an issue with encoding / decoding arrays where some array elements are file paths. I’m thinking that the forweard slashes are interfering with the decoding process. I think this because the arrayEncoded data has the actual paths still intact in the data stream. > > I can work around this by base64encoding / decoding any elements with file paths, but I want to make sure that the array encoding process does in fact have issues with certain characters, and if it does what are those characters? Is there a list of them? Can I delimit them? > > Bob S > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Tue Feb 18 17:09:44 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Tue, 18 Feb 2025 22:09:44 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> Message-ID: <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> Okay I don’t think I am having an issue with arrayEncode. I think I am having an issue where arrayEncoding with MacOS is failing to arrayDecode in Windows and vis versa. Bob S > On Feb 18, 2025, at 1:28 PM, Bob Sneidar via use-livecode wrote: > > Hi all. > > I think I have uncovered an issue with encoding / decoding arrays where some array elements are file paths. I’m thinking that the forweard slashes are interfering with the decoding process. I think this because the arrayEncoded data has the actual paths still intact in the data stream. > > I can work around this by base64encoding / decoding any elements with file paths, but I want to make sure that the array encoding process does in fact have issues with certain characters, and if it does what are those characters? Is there a list of them? Can I delimit them? > > Bob S > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From monte.goulding at livecode.com Tue Feb 18 17:15:25 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Wed, 19 Feb 2025 09:15:25 +1100 Subject: Encoding Arrays with File Paths In-Reply-To: <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> Message-ID: > On 19 Feb 2025, at 9:09 AM, Bob Sneidar via use-livecode wrote: > > Okay I don’t think I am having an issue with arrayEncode. I think I am having an issue where arrayEncoding with MacOS is failing to arrayDecode in Windows and vis versa. The result of arrayEncode is a binary string so you need to ensure it is not treated as text either writing it out or reading it in. For example if reading or writing to disk use a `binfile:` url or binary mode on open file. Cheers Monte From bobsneidar at iotecdigital.com Tue Feb 18 17:39:38 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Tue, 18 Feb 2025 22:39:38 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> Message-ID: Thanks Monte. Here is what I am doing: I have a numbered array. Element 0 has a key called operation which simply has a string with one of several possible values. Then I have elements 1 to n with a number of different elements, most are simple strings, but one key is the binary file data of a file that has been encrypted using LC’s built in library. Before I send the file over a socket, I base64encode it. I verified that the base64encoded string on the receiving end matches the one on the sending end. Curiously however I cannot even arrayDecode right after I arrayEncode and have it work so something is getting corrupted by the array encode / decode functions. I think what I will have to do is start commenting out different elements to see which one is the issue. It may well be the file data. Bob S > On Feb 18, 2025, at 2:15 PM, Monte Goulding via use-livecode wrote: > > > >> On 19 Feb 2025, at 9:09 AM, Bob Sneidar via use-livecode wrote: >> >> Okay I don’t think I am having an issue with arrayEncode. I think I am having an issue where arrayEncoding with MacOS is failing to arrayDecode in Windows and vis versa. > > The result of arrayEncode is a binary string so you need to ensure it is not treated as text either writing it out or reading it in. For example if reading or writing to disk use a `binfile:` url or binary mode on open file. > > Cheers > > Monte > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From monte.goulding at livecode.com Tue Feb 18 17:45:08 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Wed, 19 Feb 2025 09:45:08 +1100 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> Message-ID: > On 19 Feb 2025, at 9:39 AM, Bob Sneidar via use-livecode wrote: > > but one key is the binary file data of a file that has been encrypted using LC’s built in library. Are you using this as the key or element value? I think keys are always treated as text. It has been quite one time since I’ve been poking the engine in a meaningful way though so I might be forgetting that. Cheers Monte From bobsneidar at iotecdigital.com Tue Feb 18 18:18:07 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Tue, 18 Feb 2025 23:18:07 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> Message-ID: <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> The structure looks like the following: Sly File Agent API Structure of payload sent [0] [profile] [n] [data] [datemodified] [extpath] [filecategory] [fileid] [filename] [filepath] [operation] [saveaction] [version] [n+1]… The problem is definitely the binary data stored in the [n] [“data”] key. If I immediately decrypt the data in the key on the MacOS the data is correct. But when I decrypt the exact same data on the Windows OS I get a bad decrypt error. So to be perfectly clear, I create the above array, I iterate through each key from 1 to n, encrypting and overwriting the information in the [“data”] key. I then arrayEncode the entire array, then base64encode everythign before transmitting it over the wire. I reverse the process on the receiving side. It seems to work if I send non-binary data in the [“data”] key but if the data is binary, it fails. I do not think arrayEncode / decode likes to work with binary data. Bob S > On Feb 18, 2025, at 2:45 PM, Monte Goulding via use-livecode wrote: > > > >> On 19 Feb 2025, at 9:39 AM, Bob Sneidar via use-livecode wrote: >> >> but one key is the binary file data of a file that has been encrypted using LC’s built in library. > > Are you using this as the key or element value? I think keys are always treated as text. It has been quite one time since I’ve been poking the engine in a meaningful way though so I might be forgetting that. > > Cheers > > Monte > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From monte.goulding at livecode.com Tue Feb 18 18:29:18 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Wed, 19 Feb 2025 10:29:18 +1100 Subject: Encoding Arrays with File Paths In-Reply-To: <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> Message-ID: Ah ok so just checked the docs on the array encode version added in LC 7 and found: ``` If present, and >= "7.0" then the array is encoded in such a way as to preserve unicode in keys and values, as well as NUL chars in keys and values ``` So try `arrayEncode(array, “7.0")` > On 19 Feb 2025, at 10:18 AM, Bob Sneidar via use-livecode wrote: > > The structure looks like the following: > > Sly File Agent API > Structure of payload sent > > [0] > [profile] > [n] > [data] > [datemodified] > [extpath] > [filecategory] > [fileid] > [filename] > [filepath] > [operation] > [saveaction] > [version] > [n+1]… > > The problem is definitely the binary data stored in the [n] [“data”] key. If I immediately decrypt the data in the key on the MacOS the data is correct. But when I decrypt the exact same data on the Windows OS I get a bad decrypt error. > > So to be perfectly clear, I create the above array, I iterate through each key from 1 to n, encrypting and overwriting the information in the [“data”] key. I then arrayEncode the entire array, then base64encode everythign before transmitting it over the wire. > > I reverse the process on the receiving side. It seems to work if I send non-binary data in the [“data”] key but if the data is binary, it fails. I do not think arrayEncode / decode likes to work with binary data. > > Bob S > > >> On Feb 18, 2025, at 2:45 PM, Monte Goulding via use-livecode wrote: >> >> >> >>> On 19 Feb 2025, at 9:39 AM, Bob Sneidar via use-livecode wrote: >>> >>> but one key is the binary file data of a file that has been encrypted using LC’s built in library. >> >> Are you using this as the key or element value? I think keys are always treated as text. It has been quite one time since I’ve been poking the engine in a meaningful way though so I might be forgetting that. >> >> Cheers >> >> Monte >> _______________________________________________ >> use-livecode mailing list >> use-livecode at 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 at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Tue Feb 18 19:07:56 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Wed, 19 Feb 2025 00:07:56 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> Message-ID: <07C69334-80A4-4AC9-A7DB-26B6B4F2A85B@iotecdigital.com> Ahah! Okay I can do that, but I also determined that if I base64encode the encrypted data before putting it into the [n] [“data”] key then reverse on the other end, it works as well. Same idea, different technique. Bob S > On Feb 18, 2025, at 3:29 PM, Monte Goulding via use-livecode wrote: > > Ah ok so just checked the docs on the array encode version added in LC 7 and found: > ``` > If present, and >= "7.0" then the array is encoded in such a way as to preserve unicode in keys and values, as well as NUL chars in keys and values > ``` > > So try `arrayEncode(array, “7.0")` > >> On 19 Feb 2025, at 10:18 AM, Bob Sneidar via use-livecode wrote: >> >> The structure looks like the following: >> >> Sly File Agent API >> Structure of payload sent >> >> [0] >> [profile] >> [n] >> [data] >> [datemodified] >> [extpath] >> [filecategory] >> [fileid] >> [filename] >> [filepath] >> [operation] >> [saveaction] >> [version] >> [n+1]… >> >> The problem is definitely the binary data stored in the [n] [“data”] key. If I immediately decrypt the data in the key on the MacOS the data is correct. But when I decrypt the exact same data on the Windows OS I get a bad decrypt error. >> >> So to be perfectly clear, I create the above array, I iterate through each key from 1 to n, encrypting and overwriting the information in the [“data”] key. I then arrayEncode the entire array, then base64encode everythign before transmitting it over the wire. >> >> I reverse the process on the receiving side. It seems to work if I send non-binary data in the [“data”] key but if the data is binary, it fails. I do not think arrayEncode / decode likes to work with binary data. >> >> Bob S >> >> >>> On Feb 18, 2025, at 2:45 PM, Monte Goulding via use-livecode wrote: >>> >>> >>> >>>> On 19 Feb 2025, at 9:39 AM, Bob Sneidar via use-livecode wrote: >>>> >>>> but one key is the binary file data of a file that has been encrypted using LC’s built in library. >>> >>> Are you using this as the key or element value? I think keys are always treated as text. It has been quite one time since I’ve been poking the engine in a meaningful way though so I might be forgetting that. >>> >>> Cheers >>> >>> Monte >>> _______________________________________________ >>> use-livecode mailing list >>> use-livecode at 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 at 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 at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Wed Feb 19 11:01:47 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Wed, 19 Feb 2025 16:01:47 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> Message-ID: <44B07518-DBD1-429D-83A8-62FB80CB22A9@iotecdigital.com> Hi Monte. I did try your versioning solution but I am still having issues on the receiving end. Given your understanding of what I am trying to do here, how would you “package” the data so that it can be sent over the wire (socket communications)? The idea is to send an array with different key value pairs, but the file data needs to be encrypted for security. I’m not sure I should even be using base64encoding. There is something in the arrayEncode dictionary entry that says I should be using URLEncode before sending data over the wire. I tried that but the receiving end got an empty string. Bob S > On Feb 18, 2025, at 3:29 PM, Monte Goulding via use-livecode wrote: > > Ah ok so just checked the docs on the array encode version added in LC 7 and found: > ``` > If present, and >= "7.0" then the array is encoded in such a way as to preserve unicode in keys and values, as well as NUL chars in keys and values > ``` > > So try `arrayEncode(array, “7.0")` > >> On 19 Feb 2025, at 10:18 AM, Bob Sneidar via use-livecode wrote: >> >> The structure looks like the following: >> >> Sly File Agent API >> Structure of payload sent >> >> [0] >> [profile] >> [n] >> [data] >> [datemodified] >> [extpath] >> [filecategory] >> [fileid] >> [filename] >> [filepath] >> [operation] >> [saveaction] >> [version] >> [n+1]… >> >> The problem is definitely the binary data stored in the [n] [“data”] key. If I immediately decrypt the data in the key on the MacOS the data is correct. But when I decrypt the exact same data on the Windows OS I get a bad decrypt error. >> >> So to be perfectly clear, I create the above array, I iterate through each key from 1 to n, encrypting and overwriting the information in the [“data”] key. I then arrayEncode the entire array, then base64encode everythign before transmitting it over the wire. >> >> I reverse the process on the receiving side. It seems to work if I send non-binary data in the [“data”] key but if the data is binary, it fails. I do not think arrayEncode / decode likes to work with binary data. >> >> Bob S >> >> >>> On Feb 18, 2025, at 2:45 PM, Monte Goulding via use-livecode wrote: >>> >>> >>> >>>> On 19 Feb 2025, at 9:39 AM, Bob Sneidar via use-livecode wrote: >>>> >>>> but one key is the binary file data of a file that has been encrypted using LC’s built in library. >>> >>> Are you using this as the key or element value? I think keys are always treated as text. It has been quite one time since I’ve been poking the engine in a meaningful way though so I might be forgetting that. >>> >>> Cheers >>> >>> Monte >>> _______________________________________________ >>> use-livecode mailing list >>> use-livecode at 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 at 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 at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From mark.rauterkus at gmail.com Wed Feb 19 11:27:54 2025 From: mark.rauterkus at gmail.com (Mark Rauterkus) Date: Wed, 19 Feb 2025 11:27:54 -0500 Subject: This AI stuff is taking off and I see next to nothing from LC In-Reply-To: References: Message-ID: Hi, There is so much happening and is any of it happening with this tool? Am I in the wrong place to see what others are doing with AI and LiveCode? Pointers welcome. -- Ta. Mark Rauterkus *Mark.Rauterkus at gmail.com * From cszasz at mac.com Wed Feb 19 12:48:18 2025 From: cszasz at mac.com (Charles Szasz) Date: Wed, 19 Feb 2025 10:48:18 -0700 Subject: This AI stuff is taking off and I see next to nothing from LC Message-ID: <34D32B9C-AA7E-4C1F-8975-5360C26C1A3C@mac.com> I have been working on my AI app since 2023. I added AI to my app in September of 2023. As AI changes, there has been ia lot of changes made in my app. I have to mention that LiveCode assistance has been instrumental in getting AI added to my app. I have been slowed by my stroke, which I suffered near the end of2021. Since my app is a report writer, my app required a lot of changes. Sent from my iPad From jbv at souslelogo.com Wed Feb 19 13:17:40 2025 From: jbv at souslelogo.com (jbv at souslelogo.com) Date: Wed, 19 Feb 2025 13:17:40 -0500 Subject: This AI stuff is taking off and I see next to nothing from LC In-Reply-To: References: Message-ID: <3ff329a26e08e2a0508f38a5d7a2af30@souslelogo.com> Hi, I am doing a lot of things as a hobbyist with LC and IA, either locally or on a vps with ollama, and also with the OpenAI API. That includes embedding, vision, syntaxic trees of sentences, etc. A few days ago, I have posted on this forum the code I use to interact with ollama via curl requests. jbv Le 2025-02-19 11:27, Mark Rauterkus via use-livecode a crit : > Hi, > > There is so much happening and is any of it happening with this tool? > > Am I in the wrong place to see what others are doing with AI and > LiveCode? > > Pointers welcome. > From mkoob at rogers.com Wed Feb 19 15:43:28 2025 From: mkoob at rogers.com (Martin Koob) Date: Wed, 19 Feb 2025 15:43:28 -0500 Subject: This AI stuff is taking off and I see next to nothing from LC In-Reply-To: References: Message-ID: Hi Mark In the there was a webinar on Jan 24, 2025 with updates on the progress on LiveCode Create. https://livecode.com/create-progress-the-three-ds/ Create Progress - the Three D's livecode.com AI was not one of the topics covered in the webinar but in the discussion afterwards there was a question on it. There were a number of questions that they did not get to during the webinar so the responses were included on the same page as the webinar video above. The one regarding AI is here. [Question] Paul A: Will AI be integrated and if yes how? [Answer] AI is already working in some areas, it can provide assistance with your code in the Code Editor for example. We are working on a feature to describe your project interface and have AI automatically build it. So there is work being done on it. It is not in DP5 as far as I know. I don’t remember if there was any mention of parts of the AI feature set being included in DP6. If you need it earlier try contacting support and explain your use case and ask if you can get access to those features. They are willing to lift the limit of 1 project per workspace on a case by case basis so I don’t know whether that is possible with how AI is implemented but won’t hurt to ask. Best regards, Martin Koob > On Feb 19, 2025, at 11:27 AM, Mark Rauterkus via use-livecode wrote: > > Hi, > > There is so much happening and is any of it happening with this tool? > > Am I in the wrong place to see what others are doing with AI and LiveCode? > > Pointers welcome. > > > -- > Ta. > > > Mark Rauterkus *Mark.Rauterkus at gmail.com * > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Wed Feb 19 20:17:49 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Thu, 20 Feb 2025 01:17:49 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <44B07518-DBD1-429D-83A8-62FB80CB22A9@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <44B07518-DBD1-429D-83A8-62FB80CB22A9@iotecdigital.com> Message-ID: <9D036125-88AA-4482-817E-7DDB9AC5847C@iotecdigital.com> I have narrowed down the issue to the fact that the array I am trying to arrayDecode has a lot of data in the [n] [“data”] key. Without that data, the array decodes file. With it I get an error. I even tried base64encoding it first before putting it in the array key, but that does not seem to help. I may be running up on some kind of limit to array keys. Small UTF8 text files transfer no problem. Large binary files, BIG problem. (And yes I am using open file for binary read.) If I do not put the data in an array key, but rather send the data by itself, then it decrypts successfully on the other end, so I think what I am going to have to do is send the array first without file data, then recursively send each file after encrypting and base64encoding. Oh well. Lessons learned. Bob S > On Feb 19, 2025, at 8:01 AM, Bob Sneidar via use-livecode wrote: > > Hi Monte. I did try your versioning solution but I am still having issues on the receiving end. Given your understanding of what I am trying to do here, how would you “package” the data so that it can be sent over the wire (socket communications)? The idea is to send an array with different key value pairs, but the file data needs to be encrypted for security. > > I’m not sure I should even be using base64encoding. There is something in the arrayEncode dictionary entry that says I should be using URLEncode before sending data over the wire. I tried that but the receiving end got an empty string. > > Bob S > > >> On Feb 18, 2025, at 3:29 PM, Monte Goulding via use-livecode wrote: >> >> Ah ok so just checked the docs on the array encode version added in LC 7 and found: >> ``` >> If present, and >= "7.0" then the array is encoded in such a way as to preserve unicode in keys and values, as well as NUL chars in keys and values >> ``` >> >> So try `arrayEncode(array, “7.0")` >> From monte.goulding at livecode.com Wed Feb 19 21:02:41 2025 From: monte.goulding at livecode.com (Monte Goulding) Date: Thu, 20 Feb 2025 13:02:41 +1100 Subject: Encoding Arrays with File Paths In-Reply-To: <9D036125-88AA-4482-817E-7DDB9AC5847C@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <44B07518-DBD1-429D-83A8-62FB80CB22A9@iotecdigital.com> <9D036125-88AA-4482-817E-7DDB9AC5847C@iotecdigital.com> Message-ID: <62A3CD1D-9056-4B99-AD0F-B4501A135E94@livecode.com> > On 20 Feb 2025, at 12:17 PM, Bob Sneidar via use-livecode wrote: > > I have narrowed down the issue to the fact that the array I am trying to arrayDecode has a lot of data in the [n] [“data”] key. Without that data, the array decodes file. With it I get an error. I even tried base64encoding it first before putting it in the array key, but that does not seem to help. I may be running up on some kind of limit to array keys. Small UTF8 text files transfer no problem. Large binary files, BIG problem. (And yes I am using open file for binary read.) > > If I do not put the data in an array key, but rather send the data by itself, then it decrypts successfully on the other end, so I think what I am going to have to do is send the array first without file data, then recursively send each file after encrypting and base64encoding. It sounds like it’s time for a bug report Bob. If you can create a stack that demonstrates the issue it would be good to get it resolved. Cheers Monte From mark at livecode.com Wed Feb 19 23:45:29 2025 From: mark at livecode.com (Mark Waddingham) Date: Thu, 20 Feb 2025 04:45:29 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> Message-ID: On 2025-02-18 23:18, Bob Sneidar via use-livecode wrote: > The structure looks like the following: > > I reverse the process on the receiving side. It seems to work if I send > non-binary data in the [data] key but if the data is binary, it > fails. I do not think arrayEncode / decode likes to work with binary > data. I think the problem here is with encrypt/decrypt - there is an anomaly in that although the operations morally work on binary strings, their internal signatures (in the engine) take and return normal strings. This doesn't make any difference if you are saving the data to a binary file or working on the same platform - but it does make a difference if you store the value in something which records the difference between strings and binary strings - like arrayEncode. If you put `byte 1 to -1 of tEncryptedData into tArray["key"]` then it should solve the problem as the engine won't be doing any (native) encoding translation when you pass the data to decrypt on a different platform. Warmest Regards, Mark. -- Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ LiveCode: Build Amazing Things From bobsneidar at iotecdigital.com Thu Feb 20 11:14:43 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Thu, 20 Feb 2025 16:14:43 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> Message-ID: Thanks Mark I will try that. Good timing too as I was just about to refactor the whole library. :-) Bob S > On Feb 19, 2025, at 8:45 PM, Mark Waddingham via use-livecode wrote: > > On 2025-02-18 23:18, Bob Sneidar via use-livecode wrote: >> The structure looks like the following: >> I reverse the process on the receiving side. It seems to work if I send non-binary data in the [“data”] key but if the data is binary, it fails. I do not think arrayEncode / decode likes to work with binary data. > > I think the problem here is with encrypt/decrypt - there is an anomaly in that although the operations morally work on binary strings, their internal signatures (in the engine) take and return normal strings. > > This doesn't make any difference if you are saving the data to a binary file or working on the same platform - but it does make a difference if you store the value in something which records the difference between strings and binary strings - like arrayEncode. > > If you put `byte 1 to -1 of tEncryptedData into tArray["key"]` then it should solve the problem as the engine won't be doing any (native) encoding translation when you pass the data to decrypt on a different platform. > > Warmest Regards, > > Mark. > > -- > Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ > LiveCode: Build Amazing Things > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Thu Feb 20 11:34:37 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Thu, 20 Feb 2025 16:34:37 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> Message-ID: Thanks Mark. Nice try but no cookie. I will file a bug report shortly. The error I am geting with arrayDecode is: 672,49,1 465,49,1 I am sure that is a reference to the code in the library that encodes and decodes arrays. I haven’t gotten to the decryption bit yet. Bob S aka The Bug Man :-) > On Feb 19, 2025, at 8:45 PM, Mark Waddingham via use-livecode wrote: > > On 2025-02-18 23:18, Bob Sneidar via use-livecode wrote: >> The structure looks like the following: >> I reverse the process on the receiving side. It seems to work if I send non-binary data in the [“data”] key but if the data is binary, it fails. I do not think arrayEncode / decode likes to work with binary data. > > I think the problem here is with encrypt/decrypt - there is an anomaly in that although the operations morally work on binary strings, their internal signatures (in the engine) take and return normal strings. > > This doesn't make any difference if you are saving the data to a binary file or working on the same platform - but it does make a difference if you store the value in something which records the difference between strings and binary strings - like arrayEncode. > > If you put `byte 1 to -1 of tEncryptedData into tArray["key"]` then it should solve the problem as the engine won't be doing any (native) encoding translation when you pass the data to decrypt on a different platform. > > Warmest Regards, > > Mark. > > -- > Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ > LiveCode: Build Amazing Things > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From bobsneidar at iotecdigital.com Thu Feb 20 13:21:50 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Thu, 20 Feb 2025 18:21:50 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> Message-ID: <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> Bug #24655 submitted. Bob S > On Feb 20, 2025, at 8:34 AM, Bob Sneidar wrote: > > Thanks Mark. > > Nice try but no cookie. I will file a bug report shortly. The error I am geting with arrayDecode is: > > 672,49,1 > 465,49,1 > > I am sure that is a reference to the code in the library that encodes and decodes arrays. I haven’t gotten to the decryption bit yet. > > Bob S aka The Bug Man :-) > > >> On Feb 19, 2025, at 8:45 PM, Mark Waddingham via use-livecode wrote: >> >> On 2025-02-18 23:18, Bob Sneidar via use-livecode wrote: >>> The structure looks like the following: >>> I reverse the process on the receiving side. It seems to work if I send non-binary data in the [“data”] key but if the data is binary, it fails. I do not think arrayEncode / decode likes to work with binary data. >> >> I think the problem here is with encrypt/decrypt - there is an anomaly in that although the operations morally work on binary strings, their internal signatures (in the engine) take and return normal strings. >> >> This doesn't make any difference if you are saving the data to a binary file or working on the same platform - but it does make a difference if you store the value in something which records the difference between strings and binary strings - like arrayEncode. >> >> If you put `byte 1 to -1 of tEncryptedData into tArray["key"]` then it should solve the problem as the engine won't be doing any (native) encoding translation when you pass the data to decrypt on a different platform. >> >> Warmest Regards, >> >> Mark. >> >> -- >> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ >> LiveCode: Build Amazing Things >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode at lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > From mark at livecode.com Fri Feb 21 00:28:40 2025 From: mark at livecode.com (Mark Waddingham) Date: Fri, 21 Feb 2025 05:28:40 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> Message-ID: <5f5713817a10a514523d41eed1c47648@livecode.com> On 2025-02-20 18:21, Bob Sneidar via use-livecode wrote: > Bug #24655 submitted. Looks like an incorrect use / invalid assumption about sockets to me ;) I've replied to the bug report but it looks like you are assuming that sending X bytes in one send command from the client can be read by one read command in the server... This isn't unfortunately how things work... TCP/IP packets are only 4k usually and can take a while (relatively) speaking to go from one machine to the other. The engine on either end insulates the low-level details a bit in that it has a read/write queue (at the system level sockets have a sread/write data buffer but only some small multiple of 4Kb) but you still need to manage data size somehow. Specifically, tell the server how much data its going to get first, and then have the server read that exact amount of data. Anyway, hopefully tweaking that will make it work for the much larger file as well as the smaller one :) Warmest Regards, Mark. -- Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ LiveCode: Build Amazing Things From bobsneidar at iotecdigital.com Fri Feb 21 11:25:24 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Fri, 21 Feb 2025 16:25:24 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <5f5713817a10a514523d41eed1c47648@livecode.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> <5f5713817a10a514523d41eed1c47648@livecode.com> Message-ID: <49120F7C-1567-4A1C-8ED8-4898B0B006E5@iotecdigital.com> Yes and I replied to the ticket. The base64encoded data received is the same as that which was sent, so I do not think data length is the issue. Also if I send the file data just by itself without putting it into an array, the file arrives at the server intact and can be base64Decoded and decrypted and saved to disk with no issues. Further if I run the server on a MacOS device it works fine. I think that read from socket with messages will continue to read until it encounters an EOF, and THEN it will generate the message. It would be a pretty poor implementation to send the message in the middle of receiving data! The issue is that the arrayDecode on Windows is not producing the same result as arrayDecode on MacOS. I really think that Monte was on to it with the way that arrayDecode handles binary data. Anyway as I mentioned in the bug report, I will probably send the files separately from the array to break up the payload. Bob S > On Feb 20, 2025, at 9:28 PM, Mark Waddingham via use-livecode wrote: > > On 2025-02-20 18:21, Bob Sneidar via use-livecode wrote: >> Bug #24655 submitted. > > Looks like an incorrect use / invalid assumption about sockets to me ;) > > I've replied to the bug report but it looks like you are assuming that sending X bytes in one send command from the client can be read by one read command in the server... > > This isn't unfortunately how things work... TCP/IP packets are only 4k usually and can take a while (relatively) speaking to go from one machine to the other. > > The engine on either end insulates the low-level details a bit in that it has a read/write queue (at the system level sockets have a sread/write data buffer but only some small multiple of 4Kb) but you still need to manage data size somehow. > > Specifically, tell the server how much data its going to get first, and then have the server read that exact amount of data. > > Anyway, hopefully tweaking that will make it work for the much larger file as well as the smaller one :) > > Warmest Regards, > > Mark. > > -- > Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ > LiveCode: Build Amazing Things > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From mark at livecode.com Mon Feb 24 03:40:58 2025 From: mark at livecode.com (Mark Waddingham) Date: Mon, 24 Feb 2025 08:40:58 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <49120F7C-1567-4A1C-8ED8-4898B0B006E5@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> <5f5713817a10a514523d41eed1c47648@livecode.com> <49120F7C-1567-4A1C-8ED8-4898B0B006E5@iotecdigital.com> Message-ID: On 2025-02-21 16:25, Bob Sneidar via use-livecode wrote: > Yes and I replied to the ticket. The base64encoded data received is the > same as that which was sent, so I do not think data length is the > issue. Also if I send the file data just by itself without putting it > into an array, the file arrives at the server intact and can be > base64Decoded and decrypted and saved to disk with no issues. Further > if I run the server on a MacOS device it works fine. It wasn't for me - for the 970kb file it didn't send all the data - only about 100kb got across to the server with the current implementation (how much is entirely machine/network dependent as its entirely timing based - this was a macOS host with a Windows 11 VM). However, when I tweaked the script to send an 8 byte (decimal) length first, read that in the server and then 'read for' that length in bytes, it worked fine (the method described in the bug report). > I think that read from socket with messages will continue to read until > it encounters an EOF, and THEN it will generate the message. It would > be a pretty poor implementation to send the message in the middle of > receiving data! It does not - it reads until there is no more data immediately available (i.e. the data which has accumulated in the socket since the last time it was read) and sends a message with that. In general socket protocols use delimiters or lengths so that the receiver knows how much data to expect - and the 'read until' and 'read for' commands allow this. Reading what is available is still useful though - as it allows data to be processed in chunks as it arrives. Warmest Regards, Mark. -- Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ LiveCode: Build Amazing Things From patrick.roza at gmail.com Mon Feb 24 11:03:43 2025 From: patrick.roza at gmail.com (Patrick Roza) Date: Mon, 24 Feb 2025 11:03:43 -0500 Subject: Problems with Android setup Message-ID: Hi, I have been using LiveCode on and off for 10 years. A few years break due to health. I remember having problems with this before. Tried to follow this tutorial and failed. https://lessons.livecode.com/m/2571/l/625198-livecode-and-android-studio Information here is very old and to me not complete. The main problem is a lack of detail where needed. When you click the link to get java is my first issue as you land on the page for java 8 sdk. Many different downloads available but which is the right one? Android studio not so bad other than the screen captures are out of date in the lesson. However in LiveCode setting when selecting the root of android studio it indicated it is not valid. Not sure on this one as android studio appears to run fine on it's own. If anyone knows a link to better instruction please share. Using LiveCode 10.0 Windows 10 Thanks From bobsneidar at iotecdigital.com Mon Feb 24 19:35:37 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Tue, 25 Feb 2025 00:35:37 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> <5f5713817a10a514523d41eed1c47648@livecode.com> <49120F7C-1567-4A1C-8ED8-4898B0B006E5@iotecdigital.com> Message-ID: <450A9A66-B00D-4039-8EDD-E204D7CCD8C1@iotecdigital.com> Okay I verified in my actual code. This is problematic if I don’t know how much data is actually going to be sent. I ended up with roughly 138,000 bytes before it choked. I supposed I could start with 128k chunks then dial it down if it’s too much. I wish I know what the limiting factors are because this has to work over the internet. Bob S > On Feb 24, 2025, at 12:40 AM, Mark Waddingham via use-livecode wrote: > > On 2025-02-21 16:25, Bob Sneidar via use-livecode wrote: >> Yes and I replied to the ticket. The base64encoded data received is the same as that which was sent, so I do not think data length is the issue. Also if I send the file data just by itself without putting it into an array, the file arrives at the server intact and can be base64Decoded and decrypted and saved to disk with no issues. Further if I run the server on a MacOS device it works fine. > > It wasn't for me - for the 970kb file it didn't send all the data - only about 100kb got across to the server with the current implementation (how much is entirely machine/network dependent as its entirely timing based - this was a macOS host with a Windows 11 VM). > > However, when I tweaked the script to send an 8 byte (decimal) length first, read that in the server and then 'read for' that length in bytes, it worked fine (the method described in the bug report). > >> I think that read from socket with messages will continue to read until it encounters an EOF, and THEN it will generate the message. It would be a pretty poor implementation to send the message in the middle of receiving data! > > It does not - it reads until there is no more data immediately available (i.e. the data which has accumulated in the socket since the last time it was read) and sends a message with that. > > In general socket protocols use delimiters or lengths so that the receiver knows how much data to expect - and the 'read until' and 'read for' commands allow this. > > Reading what is available is still useful though - as it allows data to be processed in chunks as it arrives. > > Warmest Regards, > > Mark. > > -- > Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/ > LiveCode: Build Amazing Things > > _______________________________________________ > use-livecode mailing list > use-livecode at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode From alex at tweedly.net Mon Feb 24 20:21:12 2025 From: alex at tweedly.net (Alex Tweedly) Date: Tue, 25 Feb 2025 01:21:12 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <450A9A66-B00D-4039-8EDD-E204D7CCD8C1@iotecdigital.com> References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> <5f5713817a10a514523d41eed1c47648@livecode.com> <49120F7C-1567-4A1C-8ED8-4898B0B006E5@iotecdigital.com> <450A9A66-B00D-4039-8EDD-E204D7CCD8C1@iotecdigital.com> Message-ID: On 25/02/2025 00:35, Bob Sneidar via use-livecode wrote: > Okay I verified in my actual code. This is problematic if I dont know how much data is actually going to be sent. I ended up with roughly 138,000 bytes before it choked. I supposed I could start with 128k chunks then dial it down if its too much. I wish I know what the limiting factors are because this has to work over the internet. No, please don't start down the path of "dialling down"; the point at which it will fail is highly variable dependent on network conditions. Your easiest and safest way (or at least, the one I find easiest) is to use the length + data approach. If you don't know the total amount when you are about to start sending, then you simply package up what you *do* know as a length+data, and use a special case check to know when everything has been sent. For example, if you were going to send a folder-full of files, you could do something like: put the files into tFiles repeat for each line L in tFiles    put L & CR & URL ("binfile:" & L) into tData    put format("%012d", the number of bytes in tData) into tLength    write tLength & tData to socket tWhateverSocketYouLike end repeat -- and send an indicator that we are done  - file name + data cannot be zero-length put format("%012d", 0) into tLength write tLength to socket tWhateverSocketYouLike and read it as on readalltherestofthedata     read from tWhichSocketYouAreUsing for 12  with gotALength   -- read the length end readalltherestofthedata on gotALength pSocket, pData    if pData = 0 then       dispatch "alldone"    else       read from tWhichSocketYouAreUsing for pData  with gotFileData   -- read the file name and data    end if end gotALength on gotFileData pSocket, pData    put line 1 of pData into tFileName    put line 2 to -1 of pData into tData    dispatch "processafile" with tFileName, tData    readalltherestofthedata end gotFileData (Obviously, the above has been typed into an email - beware typos, etc.) Alex. P.S> yes, you could do ""%12d" rather than "%012d" - but if I ever finish up debugging it, I find the leading zeros a useful reminder that it's a fixed length integer. And I'm assuming that 12 digits is easily big enough for any file you are going to send :-) From bobsneidar at iotecdigital.com Tue Feb 25 11:18:29 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Tue, 25 Feb 2025 16:18:29 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: <3C8118C0-A62C-4544-A100-7B6734AD73EC@iotecdigital.com> <64A29E49-B7A6-4C2F-AF18-A25447571ED4@iotecdigital.com> <31581450-278B-4662-B3E7-C9C1CAF863D5@iotecdigital.com> <9672B8C6-32BA-4A3D-9F13-4C97B25422CF@iotecdigital.com> <5f5713817a10a514523d41eed1c47648@livecode.com> <49120F7C-1567-4A1C-8ED8-4898B0B006E5@iotecdigital.com> <450A9A66-B00D-4039-8EDD-E204D7CCD8C1@iotecdigital.com> Message-ID: <0EBB4C1F-3908-4945-84C7-E8F7BEC41390@iotecdigital.com> I played around with this last night, and determined that the length does not have to be sent, the receiving process can simply keep reading for n characters, appending the data to a low level file in a repeat loop until the it variable is empty. I tried this and the entire payload was received. I think the advantage to this method is that I do not have to worry about file size, as any file can be transferred using this method, whereas otherwise a file can theoretically be large enough to overwhelm the sender or receiver. Bob S On Feb 24, 2025, at 5:21 PM, Alex Tweedly via use-livecode wrote: On 25/02/2025 00:35, Bob Sneidar via use-livecode wrote: Okay I verified in my actual code. This is problematic if I don’t know how much data is actually going to be sent. I ended up with roughly 138,000 bytes before it choked. I supposed I could start with 128k chunks then dial it down if it’s too much. I wish I know what the limiting factors are because this has to work over the internet. No, please don't start down the path of "dialling down"; the point at which it will fail is highly variable dependent on network conditions. Your easiest and safest way (or at least, the one I find easiest) is to use the length + data approach. If you don't know the total amount when you are about to start sending, then you simply package up what you *do* know as a length+data, and use a special case check to know when everything has been sent. From ambassador at fourthworld.com Tue Feb 25 13:03:35 2025 From: ambassador at fourthworld.com (Richard Gaskin) Date: Tue, 25 Feb 2025 18:03:35 +0000 Subject: Encoding Arrays with File Paths Message-ID: Bob Sneidar wrote: > I played around with this last night, and determined that the length does > not have to be sent, the receiving process can simply keep reading for n > characters, appending the data to a low level file in a repeat loop until > the it variable is empty. I tried this and the entire payload was received. > > I think the advantage to this method is that I do not have to worry about > file size, as any file can be transferred using this method, whereas > otherwise a file can theoretically be large enough to overwhelm the sender > or receiver. I hope Mark Waddinghham will correct me if I'm wrong on this, but I believe the looped chunking you're scripting is effectively what happens automatically when you write the whole data. I would be reluctant to rely on a handful of tests alone, and it never hurts to wear both belt and suspenders. I'm assuming HTTP 1.1 added a requirement for specifying payload length for good reason. If I understand the protocol well enough, you're already sending metadata (for the file name), yes? What's a few more bytes in that header to add payload size? This excercise raises a question: rather than invent another protocol, why not use HTTP? Saves dev time, eliminates the need to write and maintain documentation for a custom protocol, leverages existing robust tooling, allows for integration with other packages as customer needs evolve, and stakeholders often get to buy-in faster where open standards are employed. -- Richard Gaskin FourthWorld.com From stephen at barncard.com Tue Feb 25 13:57:21 2025 From: stephen at barncard.com (Stephen Barncard) Date: Tue, 25 Feb 2025 10:57:21 -0800 Subject: Low-code dev tools checklist, Red Flags, LC Options to consider In-Reply-To: <19496b5f230.276f.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> References: <19496b5f230.276f.5e131b4e58299f54a9f0b9c05d4f07f9@hyperactivesw.com> Message-ID: Hi! -- Stephen Barncard - Sebastopol Ca. USA - mixstream.org On Thu, Jan 23, 2025 at 21:09 J. Landman Gay via use-livecode < use-livecode at lists.runrev.com> wrote: > Anyone who cut their teeth on HyperCard is old now. > > -- > Jacqueline Landman Gay | jacque at hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > On January 23, 2025 2:14:17 PM Mike Kerner via use-livecode > wrote: > > > i mean, i'm kinda old, which is how i remember the dates. > > that, and my first job out of B-school was a combination > > hypercard/supercard/4d nerd. > > come to think of it, i think 4dv2 was 1990, and, at that time, flowcharts > > were optional. > > > > On Thu, Jan 23, 2025 at 3:07 PM Mike Kerner > > wrote: > > > >> dude, 4d hasn't used flowcharts since around 1992, and at that time, it > >> was optional (instead of coding methods like you would usually expect) > >> you are O-L-D. > >> > >> On Thu, Jan 23, 2025 at 11:12 AM Bob Sneidar via use-livecode < > >> use-livecode at lists.runrev.com> wrote: > >> > >>> Yeah we used to have 4th Dimension at a place I worked at many, MANY > >>> years ago. The whole flow chart paradigm kinda lost me. > >>> > >>> Bob S > >>> > >>> > >>> > On Jan 23, 2025, at 6:01 AM, Mike Kerner via use-livecode < > >>> use-livecode at lists.runrev.com> wrote: > >>> > > >>> > correct, the client framework is running js. the client side of your > >>> > project is low/no, so many of the actions you are invoking are > inserted > >>> to > >>> > the widget via a menu. if the widget property editor does not get you > >>> what > >>> > you want, you are writing CSS. > >>> > the server code (where a lot of the action is taking place) is > written > >>> in > >>> > an updated version of 4d's newer ORDA language. > >>> > if you remember 4d, it is procedural. the newer syntax is OO, with an > >>> ORM. > >>> > qodly takes that paradigm a step further and makes the syntax more > >>> > modern/JS'y. > >>> > _______________________________________________ > >>> > use-livecode mailing list > >>> > use-livecode at 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 at lists.runrev.com > >>> Please visit this url to subscribe, unsubscribe and manage your > >>> subscription preferences: > >>> http://lists.runrev.com/mailman/listinfo/use-livecode > >>> > >> > >> > >> -- > >> On the first day, God created the heavens and the Earth > >> On the second day, God created the oceans. > >> On the third day, God put the animals on hold for a few hours, > >> and did a little diving. > >> And God said, "This is good." > >> > > > > > > -- > > On the first day, God created the heavens and the Earth > > On the second day, God created the oceans. > > On the third day, God put the animals on hold for a few hours, > > and did a little diving. > > And God said, "This is good." > > _______________________________________________ > > use-livecode mailing list > > use-livecode at 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 at lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > From bobsneidar at iotecdigital.com Tue Feb 25 14:49:12 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Tue, 25 Feb 2025 19:49:12 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: Message-ID: <40A0BB8C-0CD9-45D0-86D5-3F51F1FD5D98@iotecdigital.com> Because I developed my own encryption API which uses AES256 but has a couple tricks. SSL certs will not suffice, and the whole point to having my own encryption technique is so that I can avoid SSL certs and the process of registering them and installing them. Because I am encrypting the file data before sending, I have to base64encode the data before sending over the wire, unless someone has a better suggestion for how to format the data in an internet friendly way. Also I don’t really have any experience in setting up web servers, and since I am developing this for the company I work for, they will likely not want this running on a different server than they already use which is MS SQL, and probably won’t want it running on their mission critical servers either. After going back and forth with Mark, I see that I am going to have to break the data up anyway, so I am going to send an array first which has all the information I need to control the server side (things like versioning, extended paths, workflow stuff etc.) and then send each file separately using whatever method works best. I am not averse to sending the file size first. Bob S On Feb 25, 2025, at 10:03 AM, Richard Gaskin via use-livecode wrote: This excercise raises a question: rather than invent another protocol, why not use HTTP? Saves dev time, eliminates the need to write and maintain documentation for a custom protocol, leverages existing robust tooling, allows for integration with other packages as customer needs evolve, and stakeholders often get to buy-in faster where open standards are employed. -- Richard Gaskin FourthWorld.com From alex at tweedly.net Tue Feb 25 20:07:06 2025 From: alex at tweedly.net (Alex Tweedly) Date: Wed, 26 Feb 2025 01:07:06 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <40A0BB8C-0CD9-45D0-86D5-3F51F1FD5D98@iotecdigital.com> References: <40A0BB8C-0CD9-45D0-86D5-3F51F1FD5D98@iotecdigital.com> Message-ID: <9af56a42-14f9-4438-b187-9b74644f9e23@tweedly.net> On 25/02/2025 19:49, Bob Sneidar via use-livecode wrote: > > > Because I developed my own encryption API which uses AES256 but has a couple tricks. SSL certs will not suffice, and the whole point to having my own encryption technique is so that I can avoid SSL certs and the process of registering them and installing them. OK > Because I am encrypting the file data before sending, I have to base64encode the data before sending over the wire, Um, no. > unless someone has a better suggestion for how to format the data in an internet friendly way. There's no need. You're sending over a TCP socket, not HTTP - so there's no need for an "internet friendly" encoding - you can send arbitrary binary data (since you have effectively length+data - even if the length is sent separately). No need for base64encode or anything like that. > Also I dont really have any experience in setting up web servers, and since I am developing this for the company I work for, they will likely not want this running on a different server than they already use which is MS SQL, and probably wont want it running on their mission critical servers either. > > After going back and forth with Mark, I see that I am going to have to break the data up anyway, so I am going to send an array first which has all the information I need to control the server side (things like versioning, extended paths, workflow stuff etc.) and then send each file separately using whatever method works best. I am not averse to sending the file size first. > On Feb 25, 2025, at 10:03 AM, Richard Gaskin via use-livecode wrote: > > This excercise raises a question: rather than invent another protocol, why not use HTTP? Usually, because HTTP is quite decidedly a client-server protocol. If you have a peer-peer protocol need, then you have to bend HTTP out of shape :-) Or, because the server already has an HTTP server running on it under some IT dept's control, and you're not allowed to hook into it. Or, because in the event of a breakdown in the firewall, a mal-intentioned outsider could more easily circumvent your protections. A "private" protocol is an extra level of defence (assuming you do it right). Or, just because it's more interesting :-) > Saves dev time, eliminates the need to write and maintain documentation for a custom protocol, leverages existing robust tooling, allows for integration with other packages as customer needs evolve, and stakeholders often get to buy-in faster where open standards are employed. Alex. From ambassador at fourthworld.com Wed Feb 26 00:10:39 2025 From: ambassador at fourthworld.com (Richard Gaskin) Date: Wed, 26 Feb 2025 05:10:39 +0000 Subject: Encoding Arrays with File Paths Message-ID: <4ce089b8aac1f74ab041ed2b9c4b9beeca3f55e6@fourthworld.com> Alex Tweedly wrote: > Richard wrote: >> This excercise raises a question: rather than invent another protocol, >> why not use HTTP? > > > Usually, because HTTP is quite decidedly a client-server protocol. > If you have a peer-peer protocol need, then you have to bend HTTP > out of shape :-) Sockets work by having a listening and a caller. Having both on both sides is P2P. What "bending" of HTTP is needed over any similar protocol, like the one being designed here? > Or, because in the event of a breakdown in the firewall, a > mal-intentioned outsider could more easily circumvent your protections. That would also be a concern with P2P, where ports must be opened. And that's also one of the reasons much of the P2P buzz of the early part of this century faded as cloud rose: well maintained firewalls can make devices unreachable. Skype is a good example. Originally designed as P2P with a client-server fallback when blocked by a firewall, it's mostly used via client-server these days. > Or, just because it's more interesting :-) Learning is always a valid reason. I've built and thrown away a good many sytems over the decades, for custom protocols to network DBs and a couple of half-baked CMSes. I don't regret the time invested. Tho these days I tend to use standard tooling where available for the case at hand, the time spent with home-grown experiments gave me a deeper understanding of the problem space, allowing me to use standards a bit better than if I'd come in cold. -- Richard Gaskin FourthWorld.com From bobsneidar at iotecdigital.com Wed Feb 26 11:10:03 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Wed, 26 Feb 2025 16:10:03 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <9af56a42-14f9-4438-b187-9b74644f9e23@tweedly.net> References: <40A0BB8C-0CD9-45D0-86D5-3F51F1FD5D98@iotecdigital.com> <9af56a42-14f9-4438-b187-9b74644f9e23@tweedly.net> Message-ID: <91DD52AD-5293-470E-9460-A7E3B48AE77E@iotecdigital.com> I was having issues sending the encrypted data raw, but that may actually have been the issue I am now encountering, with the timing. I’ll try without base64encoding. Bob S On Feb 25, 2025, at 5:07 PM, Alex Tweedly via use-livecode wrote: Because I am encrypting the file data before sending, I have to base64encode the data before sending over the wire, Um, no. unless someone has a better suggestion for how to format the data in an internet friendly way. There's no need. You're sending over a TCP socket, not HTTP - so there's no need for an "internet friendly" encoding - you can send arbitrary binary data (since you have effectively length+data - even if the length is sent separately). No need for base64encode or anything like that. From bobsneidar at iotecdigital.com Wed Feb 26 11:12:15 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Wed, 26 Feb 2025 16:12:15 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: <4ce089b8aac1f74ab041ed2b9c4b9beeca3f55e6@fourthworld.com> References: <4ce089b8aac1f74ab041ed2b9c4b9beeca3f55e6@fourthworld.com> Message-ID: <6A896B33-37CF-4430-81A5-D79AC8C8CEDE@iotecdigital.com> Sockets are by nature a 2 way communication. After I write to a socket I can read from that socket and get back whatever the receiver returns. In fact the whole premise of what I am foing depends on it. Bob S On Feb 25, 2025, at 9:10 PM, Richard Gaskin via use-livecode wrote: This excercise raises a question: rather than invent another protocol, why not use HTTP? Usually, because HTTP is quite decidedly a client-server protocol. If you have a peer-peer protocol need, then you have to bend HTTP out of shape :-) Sockets work by having a listening and a caller. Having both on both sides is P2P. From ambassador at fourthworld.com Wed Feb 26 14:02:10 2025 From: ambassador at fourthworld.com (Richard Gaskin) Date: Wed, 26 Feb 2025 19:02:10 +0000 Subject: Encoding Arrays with File Paths Message-ID: Bob Sneidar wrote: > Sockets are by nature a 2 way communication. After I write to a socket > I can read from that socket and get back whatever the receiver returns. > In fact the whole premise of what I am doing depends on it. Yes, the socket connection is birectional, but establishing that connection requires two roles: someone has to dial the number (client), and someone else has to be sitting by the phone ready to pick up (server). Both roles can be present on both sides, creating a system of peers. But a firewall will make reaching the listening app difficult, and a good firewall will make reaching that app impossible unless host-specific forwarding configurations are set up. My most persuasive conversations on that with the IT staff at various orgs over the years have only reinforced my respect for the seriousness they bring to their work (in other words, when asked to have the org's firewall altered to support a departmental ad hoc usage, the answer is roundly "no"). P2P systems often rely on methods like STUN (Session Traversal Utilities for NAT) or IRC's older CTCP (Client-to-Client Protocol) to use an outgoing connection bidirectionally, ultimately letting the firewall do its thing while still allowing an app to be reachable. But STUN and others like it still require a server on a network reachable by all parties (usually the Internet) to broker that re-routing. I'm reading up on STUN now to handle some integrations with a VOIP app, and so far I can't recommend attempting to script a replacement for that complex method. And on some networks which use CGN (Carrier-Grade NAT, such as T-Mobile uses for their popular home Internet product), even STUN can become problematic. If anyone here has LC code for a home-grown STUN-like system I'd be grateful to read it. Bonus if it needs no server to mediate the connection. -- Richard Gaskin FourthWorld.com From bobsneidar at iotecdigital.com Wed Feb 26 16:53:57 2025 From: bobsneidar at iotecdigital.com (Bob Sneidar) Date: Wed, 26 Feb 2025 21:53:57 +0000 Subject: Encoding Arrays with File Paths In-Reply-To: References: Message-ID: <0FE4600F-33AE-4D1E-9F6E-EFBB8100567E@iotecdigital.com> When I encounter customer with such restrictions, I use my mobile hotspot for internet. I service a great many customers onsite in the LA area, and it’s been my experience that very few of them block traffic originating from within their own network. Health agencies and contractors are of course among them, and Government Contractors also have to enforce certain security restrictions depending on the information they have access to, in which case they typically also have Port Security, where if I plug my laptop into their network it will disable the port because I am not on the access list. So there is always going to be security issues, and I can always get around them. Bob S On Feb 26, 2025, at 11:02 AM, Richard Gaskin via use-livecode wrote: Bob Sneidar wrote: Sockets are by nature a 2 way communication. After I write to a socket I can read from that socket and get back whatever the receiver returns. In fact the whole premise of what I am doing depends on it. Yes, the socket connection is birectional, but establishing that connection requires two roles: someone has to dial the number (client), and someone else has to be sitting by the phone ready to pick up (server). Both roles can be present on both sides, creating a system of peers. But a firewall will make reaching the listening app difficult, and a good firewall will make reaching that app impossible unless host-specific forwarding configurations are set up. My most persuasive conversations on that with the IT staff at various orgs over the years have only reinforced my respect for the seriousness they bring to their work (in other words, when asked to have the org's firewall altered to support a departmental ad hoc usage, the answer is roundly "no"). From klaus at major-k.de Fri Feb 28 06:40:40 2025 From: klaus at major-k.de (Klaus major-k) Date: Fri, 28 Feb 2025 12:40:40 +0100 Subject: answer "bla bla" in LC serverscript Message-ID: <559ADC3F-CA47-415C-8C9B-D0AD32B7D0B8@major-k.de> Hi friends, according to the dictionary - answer "bla bla" - does not work in a .LC serverscript. OK, the dialog stacks are not present. :-) How can I show a system dialog to the user in that case? I'm afraid I'm not too familiar with html/Javascript and I need to inform the user to fill all neccessary field in a webform if he/she didn't. Thanks for any hint! Best Klaus -- Klaus Major https://www.major-k.de https://www.major-k.de/bass klaus at major-k.de From klaus at major-k.de Fri Feb 28 10:49:51 2025 From: klaus at major-k.de (Klaus major-k) Date: Fri, 28 Feb 2025 16:49:51 +0100 Subject: answer "bla bla" in LC serverscript In-Reply-To: <559ADC3F-CA47-415C-8C9B-D0AD32B7D0B8@major-k.de> References: <559ADC3F-CA47-415C-8C9B-D0AD32B7D0B8@major-k.de> Message-ID: <25C619CD-FFA9-4E01-89C2-88077DA45660@major-k.de> Hi all, > Am 28.02.2025 um 12:40 schrieb Klaus major-k via use-livecode : > > Hi friends, > > according to the dictionary - answer "bla bla" - does not work > in a .LC serverscript. OK, the dialog stacks are not present. :-) > > How can I show a system dialog to the user in that case? > I'm afraid I'm not too familiar with html/Javascript and I need > to inform the user to fill all neccessary field in a webform if > he/she didn't. well, I found "alter("whatever...") but this is obviously not supported by LC server. Or I did not add it to the LC script correctly? I want to do something like this: ---------------------------------------- ... html header... Klaus wrote: > How can I show a system dialog to the user in that case? > I'm afraid I'm not too familiar with html/Javascript and I need > to inform the user to fill all neccessary field in a webform if > he/she didn't. Good news: web tech has grown up a lot over the years. Much of what used to require JavaScript is now handled more easily in CSS and HTML. In recent HTML versions, a form's input element has a lot more attributes than in the olden days: https://www.w3schools.com/tags/tag_input.asp The one you're looking for here is the "required" attribute - you can explore how it prevents form submission unless a field is filled in here: https://www.w3schools.com/tags/att_input_required.asp If a field requires a specific pattern to the input data, you can use Regex to define that in the input element's "pattern" attribute: https://www.w3schools.com/tags/att_input_pattern.asp If you're looking to brush up on newer HTML and CSS features, Kevin Powell's channel is among my faves, worth watching a least a few of his vids to see how things on the web have been evolving lately: https://www.youtube.com/@KevinPowell/videos -- Richard Gaskin FourthWorld.com From klaus at major-k.de Fri Feb 28 14:14:38 2025 From: klaus at major-k.de (Klaus major-k) Date: Fri, 28 Feb 2025 20:14:38 +0100 Subject: answer "bla bla" in LC serverscript In-Reply-To: <325da0036dfbfb8ab87ded78dae8e8677351dab2@fourthworld.com> References: <325da0036dfbfb8ab87ded78dae8e8677351dab2@fourthworld.com> Message-ID: <862F51F0-3FC8-4E9D-810E-0329B9EB5582@major-k.de> Wonderful, thank you, Richard! :-) > Am 28.02.2025 um 19:59 schrieb Richard Gaskin via use-livecode : > > Klaus wrote: >> How can I show a system dialog to the user in that case? >> I'm afraid I'm not too familiar with html/Javascript and I need >> to inform the user to fill all neccessary field in a webform if >> he/she didn't. > Good news: web tech has grown up a lot over the years. Much of what used to require JavaScript is now handled more easily in CSS and HTML. > In recent HTML versions, a form's input element has a lot more attributes than in the olden days: > https://www.w3schools.com/tags/tag_input.asp > The one you're looking for here is the "required" attribute - you can explore how it prevents form submission unless a field is filled in here: > https://www.w3schools.com/tags/att_input_required.asp > If a field requires a specific pattern to the input data, you can use Regex to define that in the input element's "pattern" attribute: > https://www.w3schools.com/tags/att_input_pattern.asp > If you're looking to brush up on newer HTML and CSS features, Kevin Powell's channel is among my faves, worth watching a least a few of his vids to see how things on the web have been evolving lately: > https://www.youtube.com/@KevinPowell/videos > > -- > Richard Gaskin > FourthWorld.com -- Klaus Major https://www.major-k.de https://www.major-k.de/bass klaus at major-k.de