nseslo ---> lesson (='.'=)

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: nseslo ---> lesson (='.'=)

Post by bogs » Wed Aug 22, 2018 2:37 pm

Actually, I did just think of a possible solution. Since it works for Klaus on the Mac, and Linux says the information is not compressed, perhaps Klaus would decompress the cust. prop. to a text file, and we could alter the code to just read it from there (assuming of course that this is the actual problem, I'm betting it is).
Image

Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: nseslo ---> lesson (='.'=)

Post by Mariasole » Wed Aug 22, 2018 3:01 pm

Dear friends!
That many colored petals of fragrant flowers fall on you!

I started from the analysis of Bogs and its code.
And in fact the list of words that I expected, is loaded as in the picture that I attach.

So it seems that in fact the word list is stored inside the stack in a compressed manner, but Windows can not decompress it correctly. Instead the Mac (Klaus) seems to have no problems).

Now, Klaus, which opens and uses the stack without problems, can it make a port for Win bypassing the decompression problem? Maybe by providing us with a list of words in an external txt?

And then a question to increase my LC culture. :D
But inside the stack where this list (uAllWords) is kept? :shock:
I do not see this variable in the variable list! :o

How do I "hide" a compressed text file inside the stack and how can you recall it?
Sorry, maybe it's something stupid !!!! :roll:

Grazie a tutti gentili signori!
(='.'=)
Attachments
anagram_.jpg
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nseslo ---> lesson (='.'=)

Post by Klaus » Wed Aug 22, 2018 3:16 pm

Hi friends,

I put a TXT file of the uncompressed wordlist into my dropbox (2.7 MB):
https://www.dropbox.com/s/b7lcyqsd8sazx ... w.txt?dl=0
Will delete it again later this evening (it is 4:15 PM over here in germany)...

Best

Klaus

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: nseslo ---> lesson (='.'=)

Post by Lagi Pittas » Wed Aug 22, 2018 3:38 pm

Hi All,

Looks like the original author uses a zip file format (sit/stuffit) that is automatically known by LC/Mac because there is no "uncompress" code" that I can see.

Lagi

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nseslo ---> lesson (='.'=)

Post by Klaus » Wed Aug 22, 2018 3:48 pm

Hi Lagi,

nope, see here, it is called "decompress":

Code: Select all

on preOpenCard
  -- Fetch the compressed list of words and decompress it
  local tWords
  put decompress(the uAllWords of this stack) into tWords
  ...
Not sure, but i think LC uses GZ for its de-/compress routines.

Best

Klaus

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: nseslo ---> lesson (='.'=)

Post by bogs » Wed Aug 22, 2018 3:53 pm

That makes sense Lagi. Thanks for the plain text, Klaus!
Mariasole wrote:
Wed Aug 22, 2018 3:01 pm
And then a question to increase my LC culture. :D
But inside the stack where this list (uAllWords) is kept? :shock:
It is in a custom property, as seen here
Selection_003.png
Word list...
IF I knew exactly how it was compressed, I would have given it a run through unar, but without knowing which extension to use, I'd only be guessing at the result. Klaus has graciously remedied this issue for us :D
How do I "hide" a compressed text file inside the stack and how can you recall it?
Sorry, maybe it's something stupid !!!! :roll:
You don't have to hide it, I suspect it was compressed simply to reduce the size. If you study the lines of the preOpenCard handler, the author is simply decompressing the contents of the custom property into the tWords variable.

Decompress through Lc didn't work on non-Macs most likely due to this (was the first thing I tried), but it *did* work on Klaus's mac of course.
Image

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: nseslo ---> lesson (='.'=)

Post by Lagi Pittas » Wed Aug 22, 2018 3:59 pm

Hi Klaus,

I was looking for something like unZip or unArc or unSit so we could tell what they used. Windows has built in Zip support so should uncompresss GZip - but obviously not. Linux certainly should.

Lagi

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nseslo ---> lesson (='.'=)

Post by Klaus » Wed Aug 22, 2018 4:05 pm

GZip is built into LC -> de-/compress!
So it should work on all platforms, if does not, then it is a bug!

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: nseslo ---> lesson (='.'=)

Post by bogs » Wed Aug 22, 2018 4:16 pm

Gz would work if it had been initially compressed anywhere but on a Mac heh. On linux, .sit can be unzipped with unar. I don't know of a windows equivalent, sorry.

On to the fun!
1. download Klaus's file
2. save it as whatever you want, I used 'wordFinder.text"
3. modify the line in preOpenCard from 'decompress' to

Code: Select all

put url("file:wordFinder.text") into tWords
4. the file path has to be added. If your in the IDE, you can paste it to documents which I believe is the default folder, otherwise set up the path for the URL command.

Alternately, you can create a different custom property and put the text from the file in that, or stuff it in a field that is hidden, or etc etc etc. For me, the text file worked just fine.
Selection_004.png
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: nseslo ---> lesson (='.'=)

Post by jacque » Wed Aug 22, 2018 10:38 pm

It was compressed using the built-in "compress" function in LC:

Code: Select all

on preOpenCard
  -- Fetch the compressed list of words and decompress it
  local tWords
  put decompress(the uAllWords of this stack) into tWords
  put compress(tWords) into tGZ
  get tGZ = the uAllWords of this stack -- TRUE
However, it's non-compliant somehow. I saved the custom property to a file on disk, and tried to open it in BBEdit, which auto-extracts compressed files. BBEdit threw an error. But it does decompress fine in LC on my Mac just as it did for Klaus.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: nseslo ---> lesson (='.'=)

Post by FourthWorld » Thu Aug 23, 2018 2:51 am

Does BBEdit handle gzip, or just Zip?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nseslo ---> lesson (='.'=)

Post by Klaus » Thu Aug 23, 2018 10:45 am

Since the uAllWord has surely been compressed inside of LC with teh compress command LC,
then we have a bug here. LC (Mac) should be compatible with LC (Win), right?

Anyone created a bugreport?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: nseslo ---> lesson (='.'=)

Post by FourthWorld » Thu Aug 23, 2018 11:01 am

I would if I could reproduce it. I use LC-generated gzip files regularly in Mac, Win, and Linux, and have always been able to open them with other gzip-savvy apps.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: nseslo ---> lesson (='.'=)

Post by Klaus » Thu Aug 23, 2018 11:22 am

So you could open that namely stack without problems on Windows?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: nseslo ---> lesson (='.'=)

Post by FourthWorld » Thu Aug 23, 2018 11:57 am

Hadn't tried it. I'd only tried what I'd written.

Since then I hunted back in this thread to find the stack, and it opens but the compressed data does appear to be corrupted.

To clarify, if the bug report is against LC's gzip functionality, I can't reproduce that.

If the report is against the that one property in the tutorial stack, I can reproduce that.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”