Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Infinite Loop - I Made A Big Mistake

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Infinite Loop - I Made A Big Mistake

    Hello fellow Alphaholics,

    I did something very very stupid just now... Opened a new script, got right into the groove of coding and banged out about 300 lines of code.

    I realized I had not saved the script since I started it so when I went to go click "save" my brain went blank and I went right to "Run" and ran the script... Turns out there is an infinite loop in a while statement (completely forgot to .fetch_next()) and now I am desperately trying to figure out a way to stop the running script so I can save all of my work.

    I have tried ctrl+break but no luck and I even found an old post that said "look in the help file for 'Halt Script'" but it looks like that feature was taken out.

    Can anyone save me from my own stupidity?

    #2
    If you find it, share it with everyone as you are certainly not the first to do that.
    For my own sanity, I have started copying new code into notepad++ simply because
    everything is saved (even if you didn't want it saved). It has saved me from memory dumps
    as well as those horrible time when Alpha (I still prefer to use v11 on a XP vm) runs into
    a memory conflict and closes unexpectedly.
    Gregg
    https://paiza.io is a great site to test and share sql code

    Comment


      #3
      Whatever happened to A5halt.exe? If I have any memory at all, I remember it would allow you to stop a looped script without the need to hit task manager->end task.

      Comment


        #4
        Originally posted by CraigSchumacker View Post
        Whatever happened to A5halt.exe? If I have any memory at all, I remember it would allow you to stop a looped script without the need to hit task manager->end task.
        From my frantic research looking throughout the forum on this, it seems like it was removed as I would assume that's what was launched with the old View->Settings...->Preferences->Running Scripts, which is gone too.

        Comment


          #5
          There is so much about this that rings past trauma for me. So I made a UDF named - UDF_probe() - I place at the start of all my developing UDF scripts that probes when the script is run whether the script exits in the library - a5.UDF_enum(2), and if not, know the need is to save the script before going foward.
          Mike W
          __________________________
          "I rebel in at least small things to express to the world that I have not completely surrendered"

          Comment


            #6
            David,

            Assuming you are talking about a desktop application: The windows task manager can shut down Alpha Five when a script gets caught in a loop such as you describe. Ctrl-Shiift-ESC opens the task manager. Select Alpha Five, and "end task".

            -- tom

            Comment


              #7
              Well I left my script running all night to see if, by magic, it would have halted by the morning. Sadly it did not. So I hit CTRL+ALT+DELETE and saluted my ship and she was lost out to sea....

              Mike, that's actually an awesome idea. Does it work on previously saved scripts that you add lines too? (noted by the * that it hasn't been saved after a change)

              Comment


                #8
                I am sorry for the loss you must feel. There's nothing I dread more than running code, and seeing that 'Not Responding' grayed screen.

                Other code editors I write in force you to save the script before you can run it from the editor.

                It would be nice if saving was automated, and a 10 layer rollback was available as with desktop forms and reports. (Restore Prior Version)

                There are other places, too, where rollbacks would be nice. For example, rollbacks are available for desktop forms, but I don't think any web components have a rollback.

                I usually 'Save As" each change as NAMEOFSCRIPT1, NAMEOFUX2, etc. After I get to a stable point, I delete the copies.

                I also keep a folder sync copying to an attached USB drive, and run routine daily backups.

                Comment


                  #9
                  Just to add some completeness to this, the following is the code I have at the top of all UDF scripts that gets the name of the script. It holds until a call to another script inside the script happens. But can be manually returned by manually adding the return line after a subscript call.

                  Code:
                  'CURRENT SCRIPT NAME
                  dim module as P
                  dim exe as P
                  dim shared vscript_now as C 'shared
                  
                  module = type::xbasicmodule.get_current()
                  exe = module.executable()
                  vscript_now = exe.name() 'vscript_now changes with nested UDF calls
                  
                  dim vudfhere as C 'local
                  vudfhere=vscript_now 'udfhere stays in this parent script
                  'vscript_now=vudfhere 'this line reverts the vscript now back to parent script name
                  Having access to a variable that holds the current running script is invaluable to me. I have all dialogs I build, which is very, very many,
                  have a very tiny button in the bottom right corner that when pushed, if user is me, opens a reporting dialog with the name of the current running UDF and gives me the option to open the UDF in the script editor for editing. Hugely powerful, can't live without dev functionality in this boy's dev world.
                  Last edited by Mike Wilson; 05-06-2021, 09:39 PM.
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    I think we all missed the most basic solution to this, which is to write functions.
                    Unless there is a trick I don't know about, stand alone functions must be saved
                    before they can be called. I know this unfortunately does not apply to functions
                    buried in the xbasic section of a component.

                    Along the lines of what mike does, I found that most of my functions have the
                    same basic layout, and that I often have functions calling other functions which
                    makes it difficult to keep track of where I'm at when trying to debug the mess.
                    So I created a nice little utility (available at http://a5.wisux.com/aadesigner/functiondesigner.a5w )

                    The only problem is the error handling for functions in xbasic sections of components must
                    have unique labels.
                    Gregg
                    https://paiza.io is a great site to test and share sql code

                    Comment


                      #11
                      David,
                      I use WHATS RUNNING - a DT app which I find invaluable.
                      You can start and stop processes so it may be lighter than killing the whole application.
                      See our Hybrid Option here;
                      https://hybridapps.example-software.com/


                      Apologies to anyone I haven't managed to upset yet.
                      You are held in a queue and I will get to you soon.

                      Comment


                        #12
                        end the program with the windows' taskmanager
                        open alpha (but not your app)
                        find your app and hold down ctrl-shift and click to open it
                        you will have options to open and display the controlpanel, not open any forms, not run the autoexe, etc
                        now, just edit the code that is in error and fix it
                        Cole Custom Programming - Terrell, Texas
                        972 524 8714
                        [email protected]

                        ____________________
                        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                        Comment


                          #13
                          I get the impression that the code wasn't saved, Martin, ellse your plan would work.
                          Killing the instance would have aslo deleted the unsaved script, I believe.
                          See our Hybrid Option here;
                          https://hybridapps.example-software.com/


                          Apologies to anyone I haven't managed to upset yet.
                          You are held in a queue and I will get to you soon.

                          Comment

                          Working...
                          X