LiveCode Community for Windows has stopped working

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

lewis
Posts: 28
Joined: Mon Dec 14, 2009 7:39 am

LiveCode Community for Windows has stopped working

Post by lewis » Tue Feb 14, 2017 7:00 am

I am working on a stack with code which accesses URLs and then uses selected data from them. Until recently all was proceeding slowly but surely. Now I am concerned that some of my code may be causing problems as I get an error message window which forces a shutdown of LiveCode.
I include the image as an attachment.
errorMsg.png
Its heading is 'LiveCode Community for Windows'.
It states 'LiveCode Community for Windows has stopped working
'A problem caused the program to stop working correctly.
'Window will close the program and notify you if a solution is available.
The only available action is 'Close program'
(As I expected Windows has not provided any not
This prevents me from accessing my scripts in order to try to rectify whatever is wrong.
I really would like some help or advice with regard to this problem as I am a bit out of my depth here and have no idea as to how to proceed.

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: LiveCode Community for Windows has stopped working

Post by AxWald » Tue Feb 14, 2017 7:20 pm

Hi,

at first: Make a copy of your stack & save it in a safe place, to avoid even further damage! This way you always can make one more fresh copy & start your repairs from the beginning.

If LC crashes as soon as you start this stack, try this:
Open LC alone, not yet the stack! From the "development" menu, check both "suppress messages" and "suppress errors". Now open your stack, with a bit of luck it will load.

Now you can add a line "breakpoint" as first line of your preopenstack & openstack handler, take away both checkmarks from above, save & quit. Restarting now with your stack should throw you right into the debugger, where you'll have the unique opportunity to step through your code & watch LC crashing, live, in slow motion & color! ;-)

Or you check suspicious handlers, comment some out, debug a little - quite sure you'll find the culprit rather quickly. It all depends of when the stack crashes - what may have been the last action?

In any case, if all goes wrong, you can still open the stack in a text editor; you'll find all your code there, in plain text.

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9387
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: LiveCode Community for Windows has stopped working

Post by richmond62 » Tue Feb 14, 2017 8:03 pm

If you have access to computers running Linux and Mac OS it might not be a bad idea to try running
your stack on those platforms to work out whether your problem is specifically a Windows problem,
or a universal problem with your stack.

I don't know how you feel about posting your stack here . . .

lewis
Posts: 28
Joined: Mon Dec 14, 2009 7:39 am

Re: LiveCode Community for Windows has stopped working

Post by lewis » Fri Feb 24, 2017 6:42 am

Have worked on my code and thought all was going well. No more error messages "LiveCode Community for Windows has stopped working" as previously described. However after dozens of successful test runs I ran into this new error message
error-1.PNG
error-1.PNG (11.29 KiB) Viewed 8911 times
. This freezes up LiveCode for a while but eventually control is restored and I can successfully close down LiveCode (but I seem not to be able to resume testing until after restarting LiveCode. Some one will know what this error message means and probably what its causes are. I'd like to know too so I can work my way through or around it. Any ideas?

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

Re: LiveCode Community for Windows has stopped working

Post by Klaus » Fri Feb 24, 2017 12:11 pm

Hi Lewis,

please post your script(s).


Best

Klaus

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

Re: LiveCode Community for Windows has stopped working

Post by jacque » Fri Feb 24, 2017 7:40 pm

As Klaus said, we need to see the script or handler that causes this error. But one hint is that ulGetHttp is a libURL error, which means your script is setting up a situation where internet access is going in circles.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

lewis
Posts: 28
Joined: Mon Dec 14, 2009 7:39 am

Re: LiveCode Community for Windows has stopped working

Post by lewis » Sat Feb 25, 2017 1:29 pm

I will as soon as possible post the relevant script.
But unfortunately a problem with Windows 10 (64 bit) and LiveCode Community for Windows 8.1.2 has intervened. Windows hung while I was in the process of editing the script; a complete freeze requiring use of the restart button as task manager was not able to be run. Since the restart Win 10 has refused to open any .liveCode files. A momentarily appearing window indicates as best as I can make out that it can not associate these files with the application. I used Windows Control Panel 'Associate a file type or protocol with a program' but this did not work either. So I uninstalled LiveCode 8.1.2. and attempted to reinstall it only for Windows to inform me it was not a compatible application with Win 10. So I then installed LiveCode 8.1.3 which was allowed but with the same result - will not open any .liveCode files (with the same momentarily appearing window) and using the control panel 'Associate a file type or protocol with a program' made no difference.
I'm still working on this problem. Will probably post a plea for help on the Platform specific Windows forum.

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

Re: LiveCode Community for Windows has stopped working

Post by FourthWorld » Sun Feb 26, 2017 6:20 pm

lewis wrote:Will probably post a plea for help on the Platform specific Windows forum.
I can also move this thread to the Windows section of the forums. Let me know if there's a reason that I shouldn't, but it would be easy for me to do.

As for Win64 compatibility, most Win systems include support for 32-bit apps. There is a 64-native-compatible version of LC in the works right now, but in the meantime I've had good experiences running LC on stock Win 10 64-bit systems.

It seems the core issue now isn't so much that LC won't run, but that double-clicking files seems to have lost their association in Windows Explorer with the more recently-installed LC app, yes?

Ordinarily LC will present a dialog box when you first launch it on Windows asking it you want to set the Registry entry to assign .livecode to the version you're running. If you don't see this dialog perhaps you'll need to remove your preferences file.

On my system the LC prefs file is located at C:\Users\rg\AppData\Roaming\RunRev\Preferences

Try removing that and (fingers crossed) you should see the Registry prompt next time you launch LC.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

lewis
Posts: 28
Joined: Mon Dec 14, 2009 7:39 am

Re: LiveCode Community for Windows has stopped working

Post by lewis » Mon Feb 27, 2017 4:33 am

Thanks Richard et al.
I had already posted a new thread on the Platform specific Windows forum with the heading 'unable to open .livecode files'.
And AxWald has replied and solved my problems simply. (Its simple when you know how).
I will now try to get back to sorting out my coding and see if I can post something sensible for help on the
the script or handler that causes the ulGetHttp libURL error which probably as jacques said
"means my script is setting up a situation where internet access is going in circles".

lewis
Posts: 28
Joined: Mon Dec 14, 2009 7:39 am

Re: LiveCode Community for Windows has stopped working

Post by lewis » Wed Mar 01, 2017 8:10 am

Have done more work on script and have made a stack which encapsulates what was previously causing the error messages. I guess I can't upload the stack.
I attach/include the script for the handler 'makeList pSite' which gets the address from its line number 'pSite" in the list below
https://www.fantasticfiction.com/f/karin-fossum/
https://www.fantasticfiction.com/b/caryl-brahms/
https://www.fantasticfiction.com/b/james-lee-burke/
https://www.fantasticfiction.com/c/patricia-cornwell/
https://www.fantasticfiction.com/d/colin-dexter/
https://www.fantasticfiction.com/f/nicolas-freeling/
https://www.fantasticfiction.com/h/lott ... en-hammer/
https://www.fantasticfiction.com/h/reginald-hill/
https://www.fantasticfiction.com/i/michael-innes/
https://www.fantasticfiction.com/o/carol-oconnell/
https://www.fantasticfiction.com/q/ellery-queen/
https://www.fantasticfiction.com/a/margery-allingham/
https://www.fantasticfiction.com/b/samuel-bjork/
https://www.fantasticfiction.com/s/rex-stout/
https://www.fantasticfiction.com/v/jan- ... -wetering/
Here is script

Code: Select all

on makeList pSite
   put empty into fld "importedText"
   put empty into fld "bookDisplay"
   -- put fld "webSite" into tAddress
   put line pSite of fld "webSite" into tAddress
   put URL tAddress into tWebpage
   -- put line 115 of tWebpage into authName -- for separate processing not relevant here
   get line 120 of tWebpage -- line contains all the data I needx; extremely long line with many thousands of chars
   --  check address is correct and the coding will work (I hope)
   put "<div class=" & quote & "ff" & quote & ">" into tStart
   put offset(tStart,it) into tNum
   if tNum = 0 then
      put "bad address" into fld "importedText"
      exit makeList
   else
      if tNum<>1 then
         delete char 1 to tNum-1 of it
      end if
   end if
   --
   put empty into tWebpage -- maybe releases some memory
   --remove end part of line that I don't want
   put "<div class=" & quote & "ff1" & quote & ">" into tTarg
   replace tTarg with return & tTarg in it
   delete paragraph 2 of it
   -- remove as much more unwanted stuff as I reasonably can
   replace "<script>" with return & "<script>" in it
   replace "</script>" with "</script>" & return in it
   repeat with k = the number of lines of it down to 1
      if char 1 to 8 of line k of it = "<script>" then
         delete line k of it
      end if
   end repeat
   -- for some reason the web site uses <br/> not <br> as needed by liveCode htmlText
   replace "<br/>" with "<br>" & return in it
   -- 'return' used to see what's going on by putting 'it' into  fld "importedText" which is not reqd in final code
   -- I need to keep track of the 3 following  for some further coding in final implementation
   put "<div class=" & quote & "sectionhead" & quote & ">" into mTarg
   replace mTarg with return & mTarg in it
   --
   put "<div class=" & quote & "sectionright" & quote & ">" into nTarg
   replace nTarg with return & nTarg in it
   --
   put "<div class=" & quote & "sectionleft" & quote & ">" into oTarg
   replace oTarg with return & oTarg in it
   --  following eliminates a lot of nonrequired '<a href=...>" stuff and I think helps speed up  htmlText handler
   put "<br><a href=" into qTarg
   put "</a><a href=" into rTarg
   repeat with k = the number of lines of it down to 1
      put char 1 to 12 of line k of it into tComp
      if tComp = qTarg or tComp = rTarg  then
         delete line k of it
      end if
   end repeat
   --
   put it into fld "importedText" -- just so I can see it - make not visible in final or just don't do it
   --
   set the htmlText of fld "bookDisplay" to it
   replace "(" with " (" in fld "bookDisplay" -- somehow this turns green colour chars to black
   repeat with  i =  the number of lines of fld "bookDisplay" down to 1 -- eliminate empty lines
      if the number of words of line i of fld "bookDisplay" <1 then -- cos sometimes there are some spaces
         delete line i of fld "bookDisplay"
      end if
   end repeat
end makeList
There is a field with correct web site addresses. Clicking on a line in that field will start the program (and clear fields showing results) to get the list of books etc. for that author and put it in field "bookDisplay". The field "importedText" is just for me to see the result of my code when things don't work. The handler 'makeList" is on the card script. I still have a fair bit more to do but this was the step that was causing problems. Some addresses take more than 5 or 6 seconds to complete the list. Sometimes something seems to make the right hand field disappear for a while.
Anyway that's the best I can do for now. Any comments/suggestions would be welcome.

lewis
Posts: 28
Joined: Mon Dec 14, 2009 7:39 am

Re: LiveCode Community for Windows has stopped working

Post by lewis » Wed Mar 01, 2017 8:19 am

Oh I did mean to say that as a 78 year old completely self taught amateur (introduced to HyperCard some 30 years ago) I am quite embarrassed to be exposing my coding to public view which is why I worked hard to clean up and improve the problem code - so that what is in that last post is much cleaner and (hopefully) clearer than it was when I first posted this topic.

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: LiveCode Community for Windows has stopped working

Post by AxWald » Wed Mar 01, 2017 9:37 pm

Hi,

I realize you took on a really ambitious task!
Parsing web sites & extracting useful info is usually sheer horror. Those dreaded web designers & php coders seem completely alien to any logic & thoughtfulness, and finding any kind of reliable system in their output is most often futile.

But in your case it looks quite good. Anything interesting is in <div class="sectionleft"></div> brackets, and these are easy to extract. What's left is a bit offset-juggling, and the treatment of a few special cases.
I happened to have a similar project rotting on my HD - just recently I miserably failed to write a stack to extract the epub data of my local town library. FantasticFiction is interesting for me, looks like good data - so I had a look at it.

The result is in the stack attached. All important code is in the one button, I hope you can find some ideas.

It's to mention that I started with LC 9.0 (dp4); I had a look at your handler first (you're using "paragraph" and this doesn't work in my usual LC 6). When I started reworking my old code I soon crashed while waiting for a breakpoint to fire. No appearant reason, dunno what happened. But I had saved before.

So I continued with LC 8.1.2 (that ate the code without choking). Only to throw errors a bit later when doing a simple concatenation, for whatever reason: "Put stringA & stringB into StringC" - where all 3 strings showed valid values in the debugger.

So I tried to save the stack in "classic format" to go back to trusty LC 6.7.10 - got a corrupt stack, repeatetly ...

Copied the script out, made a new stack in 6.7.10, and finished it w/o any problems.

When done, I measured the stack in the 3 mentioned versions. Surprise, surprise:

Code: Select all

6.7.10: 8.1.2:  9dp4:
------------------
   50     286    283
     4      74      78
   18     216    233
     4      65      59
(4 random examples from your post, times in milliseconds, only processing time)

Quite devastating for the new LC products, IMHO. This is why I still use the "deprecated" old version, at least it works, and gives funky results. And save me some bleeding eyes ;-)

Hope you can make sense of my code, and find something that you can recycle.

Have fun!

Edit: Changed attachment description
Attachments
ff_Scraper.zip
a nasty hack - only download if you have a perverse fun with ugly code!
(2.46 KiB) Downloaded 188 times
Last edited by AxWald on Fri Mar 03, 2017 7:50 pm, edited 1 time in total.
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: LiveCode Community for Windows has stopped working

Post by AxWald » Fri Mar 03, 2017 7:48 pm

Hi,

just above I posted a demo stack that demonstrates how I'd attack Lewis' problem. Thinking about I came to the conclusion it's a really nasty hack, and will confuse Lewis more than help him.

Coincidentally I made, for another thread here, a function that extracts data between two given chunks, found a use for it in my work, and so took the time to finish & test it.

And then I realized that this is exactly what's needed here. So I rewrote my little demo. It's much nicer now, nearly readable, and even became faster. For whom it may concern, it's attached.

Interesting is that still the new LC versions are multitudes slower. Results for the first 4 links that Lewis provided:

Code: Select all

6.7.10:  14,  25,  42,  33
8.1.3:    84, 215, 301, 342
9 (dp5): 82, 211, 322, 337
Crazy, right? The "obsolete, deprecated" LC 6 beats the new versions by multitudes ;-)

Have fun!
Attachments
ff_Scraper v002.zip
demo of a web site scraper for this thread
(3.7 KiB) Downloaded 181 times
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

lewis
Posts: 28
Joined: Mon Dec 14, 2009 7:39 am

Re: LiveCode Community for Windows has stopped working

Post by lewis » Fri Mar 03, 2017 11:36 pm

Wow, you go too fast for me AxWald.
Just getting through checking out how to modify your first 'scraper' and the second makes its appearance.
Thanks for your take(s) on my little project.
I've enjoyed examining and understanding your code. I'm not in the least confused.

The following applies to scraper v. 01.

I had figured out how to use offset(target,container,charstoskip) in a repeat structure but you have to be so very careful and confident that you are getting the numbers and variables right to avoid troubles - so I haven't been all that game to use it - oh well I may as well give it a try. It was interesting to see that you were happy to stay with characters for a lot of the processing and not break it up into lines until later.

I noted that you were not using 'set the htmlText' at all but rather just extracting all the desired text from the relevant selected line (120) of the html code of the web site. Is this a major factor in the faster running times i.e. milliseconds rather than 5 or more seconds. But I have one little worry, that any special characters - of html code form &nnnn; - won't be 'translated' correctly.

I note also that you were maintaining/creating links (url type links? using 'linkText') so that clicking on a book title would take you to that specified web page. I do not want this particular functionality so I think I should be able to work out how to do the listing as per your method but in a simpler fashion. Similarly with image links, which once again I have no need for, so I will also need to work out how to eliminate these from the code.

One issue I noticed though is that your code does not give the numbers [ e.g. 1. , 2. , etc. ] to each book of the series , nor does it give the publication date [ e.g. (1945) ], where these are included in the html. Both of these items I do want so I will have to work on the code to extract these also.

I see that you replaced <br/> with 'CR' which I understand is a synonym for 'return'. In the dictionary is also 'CRLF' which I also tried; it seemed to work OK also. I'm not quite clear on the differences between these two but anyway I assume I should stay with 'return'.

I understand your function 'processGrp' is used for its "side effects' as I think they're called and does not return a value.

I certainly don't expect you to to do any work on the above. I'm sure I can (slow but steady) work out what I want.

All in all a considerable amount of work to keep me happy for some time - but now not until I've gone through scraper v. 02.

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: LiveCode Community for Windows has stopped working

Post by AxWald » Sat Mar 04, 2017 2:27 pm

Hi,

I'm happy you have use for my "finger exercise" :)

Just be sure to check the new version - it's much more clear, and reliable! The first version used a lot of ugly "work-arounds" due to quick& lazy coding ...

A few answers:
lewis wrote:... you were not using 'set the htmlText' at all ...
Yup. I wanted to have this usable for any kind of text. And, to be honest, I'd even have to lookup "htmlText" - I don't use this in my work.
I've seen a quirk in my v 0.0.2 already, "Samuel Bjørk" for instance comes as "Samuel Bj&#248;rk". So the output needs to be translated from html entities to standard text. Something for the "toDo" list :)
lewis wrote:I should be able to work out how to do the listing as per your method but in a simpler fashion
The new version stores any found chunks in properly named variables before formatting the output in the field. It's planned to create an array of it, for storage & later use. v 0.0.3 will write a table-like file containing all the data regarding the selected author.
(Actually this script works a lot better with my local epub library, so I'll keep on improving it - after all it's now only the basic structure of the page and the different tags that are different. And with my new version it's quite easy to adapt to this.)
lewis wrote:I noticed though is that your code does not give the numbers [...] nor does it give the publication date
The new version gives the years. And if you want the ordinal numbers, it's a little change in the processGrp function:

Code: Select all

   -- Replace this line (line 91 in the "processGrp" function):
   get inBeet(myLine,quote & ">","</a>",0)                                                      --  get Name
   
   -- with the following:
   if char 1 of myLine is a number then                                                   -- numbered entry
      get 0 & CR & line 2 of (inBeet(myLine,".","<a h",-3)) & line 2 of (inBeet(myLine,quote & ">","</a>",0)) 
   else                                                                                                     --  not numbered
      get inBeet(myLine,quote & ">","</a>",0)
   end if
This uses a quite esoteric side effect of the inBeet() function - it should work at least with 2-digit numbers and small fractional numbers, but I don't really understand it yet, right now ;-)
lewis wrote:I see that you replaced <br/> with 'CR' which I understand is a synonym for 'return'
Should be synonym, right. I use CR because "return" is also used in the function control structure, and it makes it easier to search for "function return lines" when I don't have to mess with "return" as synonym of the line feed constant.
lewis wrote:your function 'processGrp'
Could be a command handler, too. For some strange reason it's a habit of me to write anything using parameters as functions ;-)
Doesn't matter, as I see it both command & function handlers are internally equal, they only differ in the syntax of calling & returning data.

And I make a separate handler of it because it has a different task: The mouseUp handler grabs the data & makes handy portions of it, and the processGrp function just grabs one such portion, and works with it. Much more easy to debug, by the way :)

About the offset stuff & the use of chars:

A strict limitation on chars & offset should compile into very fast assembler code, equal to the use of regular expressions (just not _this_ esotheric), IMHO. This comes at the cost of heavy arithmetic used in the "charsToSkip" parameter and leads to code nearly unreadable & most difficult to maintain (again, just like regexp ;-) ).
So I encapsulated the nasty stuff in a rather simple function for v 0.0.2, and this makes it much more enjoyable.
lewis wrote:I certainly don't expect you to to do any work on the above.
For sure I'll do!
For one, I finally want to be able to filter those of the 23.383 epubs of my town library that are a.) available and b.) of interest for me, without clicking for hours through most poorly made web pages.

And, on the other hand, my "finger exercise" here not only provided fun & satisfaction, it additionally resulted in a fast & robust "inbetween search" function, a benefit for my private library stack. Some of my commercial products are marked already for an implementation. Win - win :)

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

Post Reply

Return to “Talking LiveCode”