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

application timeout

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

  • application timeout

    I have a group of 5 research nurses who key data into a database. I periodically do updates to the code or forms as bugs emerge. However, I have a difficult time with this because I seem to constantly get a "File in use" message. Everyone is generally gone, so I can't see who left their files open. The database is stored on a network server which I don't have access to, so I can't see who might have left files open.

    I would like to set a timer so that if there was no activity from a particular user, if would log off that user and close all tables which they might have open. Do anyone else do this or know of a solution?

    Thank you!
    Dave
    David A. Volgas, MD

  • #2
    Re: application timeout

    Oddly enough this question has come up before now. If you search for

    logoff

    you'll find some suggestions (avoid the application server threads).
    There can be only one.

    Comment


    • #3
      Re: application timeout

      OK, that was fun. I haven't tried this, always meant to. So here is an example.
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


      • #4
        Re: application timeout

        The method that I have used is to have a main menu that the user is unable to close unless they formally exit the application. Put an ontimer event that checks the value of text file (you can use a table, but that's just more files) every minute (or 5-minutes) in the main menu. I use a 1 or 0 value in the text file for on or off. The text file is located in the same folder as the data files. Change the value of the text file to 0, and the ontimer fires next time around shutting down all open workstations (i.e. apps). I use a script on a button to run the 1 or 0 value in the text file. You can code it so admin can still get in if it is a 0. etc etc etc
        Peter
        AlphaBase Solutions, LLC

        [email protected]
        https://www.alphabasesolutions.com


        Comment


        • #5
          Re: application timeout

          Originally posted by Peter.Greulich View Post
          The method that I have used is to have a main menu that the user is unable to close unless they formally exit the application. Put an ontimer event that checks the value of text file (you can use a table, but that's just more files) every minute (or 5-minutes) in the main menu. I use a 1 or 0 value in the text file for on or off. The text file is located in the same folder as the data files. Change the value of the text file to 0, and the ontimer fires next time around shutting down all open workstations (i.e. apps). I use a script on a button to run the 1 or 0 value in the text file. You can code it so admin can still get in if it is a 0. etc etc etc
          What do you do if they left a regular, modal xdialog open?

          Comment


          • #6
            Re: application timeout

            Hi Cal,

            Originally posted by CALocklin View Post
            What do you do if they left a regular, modal xdialog open?
            Form OnTimer Events occur no matter whether Modal "C" code (ala UI_MSG_BOX() ) or Modal XDialog boxes are open

            XDialog OnTimer Events do not occur if a Modal "C" dialog box is open, but will for pretty much everything else. Because of this, I tend to use XDialog replacements for Modal "C" dialog box code

            I don't know about forms used as Dialogs, as I seldom have ever used them.

            As for Main Menu forms, I don't depend on them. Instead, I will open up a form with a timer event that is hidden that serves no other purpose if I have to deal with modal "C" code interrupting my timer events. The problem is, unfortunately, is that form is tied to a table, something I'd rather not do.

            It is possible to close modal Xdialog boxes from other event code that is triggered (use UI_MODELESS_DIALOG_CLOSE() ), and I believe that it is also true for Modal "C" dialog boxes, but I actually haven't tried. I do know that I can close the database with Modal "C" dialog boxes open.
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


            • #7
              Re: application timeout

              To answer the question: how to close a database if the user left a modal xdlg open? Though not responsive to the main question of the thread :
              Put {timer} {interval} in the xdlg.
              This implies re-engineering all your modal xdlg's.

              Comment


              • #8
                Re: application timeout

                In scenarios like this I set a timer on each relevant screen

                and then have a function to do an orderly close of all screens and close a5

                Code:
                'Date Created: 02-Aug-2007 09:55:50 PM
                'Last Updated: 30-Nov-2009 10:08:16 AM
                'Created By  : Administrator
                'Updated By  : martin cole
                FUNCTION ShutDownAll AS L()
                 on error goto errors
                 temp=""
                 loop: 
                 temp=a5.Form_Enum(2) 'get a list of all forms in the app
                 for i=1 to w_count(temp,crlf())
                  fname=word(temp,i,crlf())
                  if is_object(fname)
                   if fname="Menu_master"
                    :Menu_master.code.canexit="" 'override canexit setting
                   else
                    if eval(trim(fname) + ".mode_get()") <> "view"
                     eval(trim(fname) + ".activate()")
                     sys_send_keys("{esc}") 'this cancels possible pop-ups
                     sys_send_keys("{esc}") 'this cancels the current entry/edit
                     xbasic_wait_for_idle() 
                     if is_object(fname) 'may be closed here from esc
                      eval(":" + trim(fname) + ".cancel()")
                      eval(":" + trim(fname) + ".close()")   
                     end if 
                     goto next1 
                    end if 
                    eval(":" + trim(fname) + ".cancel()")
                    eval(":" + trim(fname) + ".close()")   
                   end if
                  end if 
                  next1: 
                 next
                 a5_close_all_windows()
                 temp=a5_list_open_windows()
                 for i=1 to w_count(temp,crlf())
                  eval(word(temp,i,crlf()) + ".cancel()")  
                  eval(word(temp,i,crlf()) + ".close()")
                 next
                 sleep(1/3)
                 if a5_is_runtime() .and. a5.Get_Master_Path()="" 'terminal services machine
                  if api_getmachinename()="martin"
                   msgbox("trapped restart")
                  else
                   sys_shell("shutdown /L")
                  end if 
                 end if 
                 a5.close()
                 end
                 errors:
                 err_msg = error_text_get(error_code_get())
                 line = error_line_number_get()
                 script = error_script_get()
                 ui_msg_box("Error", err_msg+" Error occurred at line "+alltrim(str(line,4,0))+ " in script: "+script)
                 end
                END FUNCTION
                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


                • #9
                  Re: application timeout

                  Thank you so much for all the input. I think, however, that my problem is that as I develop, I will have a script which aborts and leaves a file open. Presumably, a5_close and a5_forceclose_all will not handle things like that and I will have to go to the server OS and shut it down from there.

                  Is there any housekeeping function built into A5 which would let an administrator close all open files no matter which machine is running them? I don't know about "industrial strength" databases like Oracle, but I would bet there is some sort of housekeeping fundtion that could do that.

                  If there isn't, based on the interest I am seeing here, perhaps that should be in the wish list.

                  Dave
                  David A. Volgas, MD

                  Comment


                  • #10
                    Re: application timeout

                    Originally posted by davidv43 View Post
                    Is there any housekeeping function built into A5 which would let an administrator close all open files no matter which machine is running them?
                    Not that I know of, but there are these two local functions:

                    A5_close_all_windows(.t.)

                    A5_ForceCloseTables()
                    ''The A5_ForceCloseTables() function closes all tables that do not have an open window.
                    Peter
                    AlphaBase Solutions, LLC

                    [email protected]
                    https://www.alphabasesolutions.com


                    Comment


                    • #11
                      Re: application timeout

                      Originally posted by G Gabriel View Post
                      To answer the question: how to close a database if the user left a modal xdlg open? Though not responsive to the main question of the thread :
                      Put {timer} {interval} in the xdlg.
                      This implies re-engineering all your modal xdlg's.
                      That's exactly what I've found. I was curious to see if someone else found a better method because this really is a bit complicated. I did implement this for one customer and I agree - "re-engineering all your modal xdialogs" is a very appropriate statement. My final implementation involved (a) many hours to work out all the issues and (b) 2 scripts and 8 functions of about 150-200 lines each. And, even after getting that done, all the xdialogs had to be modified and, in some cases, additional code had to be added after the xdialog was closed to handle the situation where nobody was around to finish the rest of the actions. (Sometimes many other things can happen after closing an xdialog - or a "dialog" form for that matter - and that may not be desirable in a forced shutdown situation.)

                      Yes, the form timer event runs but there is no separate command to close a modal xdialog - it has to be done from within the xdialog itself. I could have converted all my modal xdialogs to modeless EXCEPT that would allow users to create all kinds of problems and that cannot be allowed to happen in a production manufacturing environment.

                      (I'm not sure why you feel this isn't relative to the original question. The question was about shutting down an application if the user leaves it open and the user could easily leave a modal xdialog open.)

                      Comment


                      • #12
                        Re: application timeout

                        Originally posted by CALocklin View Post
                        (I'm not sure why you feel this isn't relative to the original question. The question was about shutting down an application if the user leaves it open and the user could easily leave a modal xdialog open.)
                        The question is relevant. My response is limited to the question but not to the main question of the thread for which I do not have a good answer.

                        My thinking is that Windows for instance has Screen saver. Perhaps if you can use this feature or implement it somehow, you could close alpha via VB instead of putting ontimer events on our forms and modify all your modal xdlg's, none of which is a good idea. More to the point, if the objective is to be able to access the table:
                        1-Can you terminate the connection somehow without shutting the application on the user's machine? I don't know.
                        2-Perhaps you could do your development on a duplicate DB and overwrite the original one when not in user. Is that a good or a practical idea? Maybe.

                        Comment


                        • #13
                          Re: application timeout

                          David,


                          Can you actually shut down the application? Or do you need to keep it going?

                          If you can shut it down. Here is one that Dr. Wayne put on his web site(been awhile now), that I modified to use way back, and it comes in very handy. I have 10-15 users, and the process lets me shut down, and keep users out till I get things done, with warning messages.

                          http://www.learn alpha.com/ShutDownN...ownNetwork.htm

                          Regards

                          Ed

                          Comment


                          • #14
                            Re: application timeout

                            Ed,
                            I can shut the application down. I would do the update at night. However, I think what has happened is that sometimes, a new bug in my code is found which crashes that script, but leaves a table open.

                            Does a5_close truly close all tables, even those "orphans"?

                            Dave
                            David A. Volgas, MD

                            Comment


                            • #15
                              Re: application timeout

                              Hi Cal,

                              Originally posted by CALocklin View Post
                              Yes, the form timer event runs but there is no separate command to close a modal xdialog - it has to be done from within the xdialog itself. I could have converted all my modal xdialogs to modeless EXCEPT that would allow users to create all kinds of problems and that cannot be allowed to happen in a production manufacturing environment.
                              That's not correct.

                              Any Xdialog (as opposed to dialog which I use for "C" code modal dialog boxes of Alpha), modal or modeless can be closed with UI_MODELESS_DLG_CLOSE(dialogtitle), no matter who or where it was invoked from, including another XDialog's timer event (and maybe a watch command xdialog event but I've never tested it) or a form's timer event.

                              FYI, every modal and modeless XDialog functions work on any modal or modeless dialog box, despite their name. I don't believe there is any exception, but if you find one let me know.

                              I very often will create a hidden Xdialog with a timer event to do things (e.g. CSDA Code Utility, CSDA Screen Capture), including closing dialogs down. But those "C" code modal dialog boxes are real pains, as they halt Xdialog timer events until they close. So that is why I replace all dialog code with XDialog equivalents if it is all in my code. For Utilities, as you well know, we have no control of other's code, so one must plan for the worst. In that case, I open a default form and keep it hidden, dynamically add a timer event (which just calls a function), and do it there (more code, LESS FUN! :) - probably neg 3 flags!)
                              Last edited by csda1; 02-05-2010, 03:49 PM.
                              Regards,

                              Ira J. Perlow
                              Computer Systems Design


                              CSDA A5 Products
                              New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                              CSDA Barcode Functions

                              CSDA Code Utility
                              CSDA Screen Capture


                              Comment

                              Working...
                              X