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

Get a list of users, user_name(), currently connected to a database

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

    Get a list of users, user_name(), currently connected to a database

    I’ve been trying to do this for a couple of years now. I know that: A5_REGISTRATION_LICENSE_INUSE() function counts the number of users in .MUF and .RMUF files.

    I’m using Security. What I’m trying to do is to see the name of each user. I come close but my code keeps failing and what I see isn’t always correct. I try writing to a table, but if users exits the application without using the Exit button, their name isn’t removed from the table.

    The other issue is if a user roams and logs in from two different computers during the day, I really have 2 different logins for the same person.

    Anyone ever tried this before?
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    http://msgboard.alphasoftware.com/al...s-by-same-user

    Don't know if the video is still available, but someone will have it - or similar, Ron
    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


      #3
      Ted, that was Dr Peter Wayne's site which unfortunately is no longer running. I want to know the name of the user currently logged in. This is written to a table.
      If the user logs off using my shut down method, the exit key, they are removed from the list.

      My problem is that the users go home at night and never exit from their Alpha apps. This makes it difficult when maintaining the application. So I do a forced automatic shut down every night of those application left running. I specify the shut down time after which I have explicit access to the application.

      What I'm trying to figure out is how to update the table with the names of those who logged in. As all the apps are closing at the exact same time, the current time of the server, the table appears to be locked by the first user to update the table with the others failing to update the table. The apps are shut down, just the table is not being updated from the second user on.
      Alpha 5 Version 11
      AA Build 2999, Build 4269, Current Build
      DBF's and MySql
      Desktop, Web on the Desktop and WEB

      Ron Anusiewicz

      Comment


        #4
        Difficult one, Ron.

        Is there any way to attach a Timer to the open application - by user - and trigger A5.CLOSE() after a specified time?

        Example;
        Say the users stay until 18:00 hours. At 21:00 hours this fires and shuts their instance down.
        You could shut ALL instances down I imagine without actually stopping Alpha.

        If you are using A5_ForceCloseTables() then any open form with a table will prevent that happening to every table.​

        Edit, try this as a code block somewhere it won't mess anything up.

        'Date Created: 11-Jan-2023 01:12:02 PM
        'Last Updated: 11-Jan-2023 01:13:06 PM
        'Created By : Ted
        'Updated By : Ted
        dim cnt as N
        cnt = 1
        ui_modeless_dlg_box("{INTERVAL}",<<%dlg%
        {timer=increment}
        {interval=.05}
        {progress=50cnt}
        <close>;
        %dlg%,<<%code%
        if a_dlg_button = "increment" then
        cnt = cnt + 1
        if cnt = 100 then
        cnt = 1
        a5.Close()
        end if
        end if

        if a_dlg_button = "close" then
        ui_modeless_dlg_close("{INTERVAL}")
        end if
        %code%)​
        Last edited by Ted Giles; 01-11-2023, 09:16 AM.
        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


          #5
          The auto close is not the problem. I'm using script_schedule() to run my script which closes Alpha 5. My issue was to remove the user from the login table. I think I figured it out. I'll know better in a couple of days.
          Alpha 5 Version 11
          AA Build 2999, Build 4269, Current Build
          DBF's and MySql
          Desktop, Web on the Desktop and WEB

          Ron Anusiewicz

          Comment


            #6
            Then I really don't understand.
            If you close all open instances - and I'm presuming Shadow here - can you not just clear the login table?
            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


              #7
              Well, that's the easy way. I want to do it the hard way by having each instance log out. Damn your good!

              That's what happens when focus on a singular solution.
              Alpha 5 Version 11
              AA Build 2999, Build 4269, Current Build
              DBF's and MySql
              Desktop, Web on the Desktop and WEB

              Ron Anusiewicz

              Comment


                #8
                I do something similar using a specific directory to put a text file in for each user/session.
                That way I can see the list without using Alpha tables.

                I do assign a GUID to a global variable for each session so I can separately track multiple sign ins for a single user name.

                Tracks as many options as possible for normal disconnects.

                Set the status when logging in and record date time in the text.
                The file name gets a little long with username - GUID - Datetime - machine name - status, but is usable to id the user by only looking at the filename.
                Change the status when logging out and record date time in the text.

                Show open sessions using the file directory list showing open logins by filtering the list.

                As far as abends, I move the files to a saved directory to do the 'clean up'
                In your case, you could move the records to an archive table for 'clean up'

                ​Files that need to be cleaned up indicate that something may be wrong with the user disconnecting properly.

                And yes Ted is damn good...
                Last edited by Al Buchholz; 01-12-2023, 03:50 PM.
                Al Buchholz
                Bookwood Systems, LTD
                Weekly QReportBuilder Webinars Thursday 1 pm CST

                Occam's Razor - KISS
                Normalize till it hurts - De-normalize till it works.
                Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                When we triage a problem it is much easier to read sample systems than to read a mind.
                "Make it as simple as possible, but not simpler."
                Albert Einstein

                http://www.iadn.com/images/media/iadn_member.png

                Comment


                  #9
                  i do a couple things. i have an app version script that writes to the table when the use logs in. i use it to record the alpha version, program version, pc name, the folder the app is run from, log in date and time, logout date and time. it runs in the Autoexec and OnDatabasecCose scripts.
                  if they haven't logged out, i know who it is.


                  i also use the on timer event in a form to check between certain times of day and if they haven't accessed the form in 30 minutes, I close it
                  i also use the xdialog timer and interval commands to close and xdialog or exit alpha
                  Attached Files
                  You do not have permission to view this gallery.
                  This gallery has 1 photos.

                  Comment


                    #10
                    Maybe I'm not on track but I look at 1) Remote Desktop Server Manager to show the users logged into the server and 2) Task Manager to show users that have alpha open.
                    Attached Files
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      I don't have access to the server hence I wanted something that I as administrator could view from within the application.
                      What I have works most of the time. When my autoclose script runs, it does shut down all the instances of Alpha. The issue
                      is the code that updates the log has not been reliable and I can't figure out why. I'm writing to a table and it appears to be a problem.
                      I think Al recommended to write to a text file and that may be my next step if I decide to pursue this further. I've spent far to much time
                      on this.
                      Alpha 5 Version 11
                      AA Build 2999, Build 4269, Current Build
                      DBF's and MySql
                      Desktop, Web on the Desktop and WEB

                      Ron Anusiewicz

                      Comment


                        #12
                        i've never had an issue with my method. writing to my app version table when they log in and then writing to it on database close when they log out or just close it. if i have no logout timestamp, i know they never logged out, or the pc hung or restarted abnormally. i have the user name, the pc name , the alpha version, the app version, the folder the app was started from. everything i need. sometimes i see a user somehow ran the live version and not the shadow.

                        Comment


                          #13
                          if i have no logout timestamp, i know they never logged out,
                          Well that's what's happening to me, but only if the workstation was left connected and my auto shutdown code shuts down Alpha. Actually, there is usually one time stamp for a work station that was automatically shut down. The others have no time stamp. That's the part that baffles me. Why does the script only write to the table only one workstation when it should cover all connected work stations.

                          Below is my latest attempt. I Will upload this to the server tonight and try it Wednesday evening.

                          Code:
                          'Date Created: 22-Sep-2022 08:19:00 PM
                          'Last Updated: 14-Jan-2023 05:09:27 PM
                          'Created By  : Ron
                          'Updated By  : Ron
                          
                          'this script is called from the Function "Script_Schedule()"
                          
                          'vgAuto_Shut_Down_Delay is a global numeric value created when each workstation is logged in.
                          'This value is used to stagger the shutdown of each workstation by 5 seconds.
                          
                          sleep(vgAuto_Shut_Down_Delay)
                          
                          if Empty_Logged_in() = .T. then
                              xbasic_wait_for_idle(1)    
                          end if
                          
                          title = "Shutting Down Application"
                          ui_modeless_dlg_box(title,<<%dlg%
                          {xmargin=8,8}
                          {ymargin=2}
                          {font=Calibri,14}
                          Running Nightly Auto Shut Down Now
                          %dlg%)
                          
                          sleep(5)
                          
                          ui_modeless_dlg_close(title)
                          
                          'allow exit
                          vl_Can_Exit = .T.
                          :A5.close()
                          
                          END    '********************************************************
                          
                          
                          FUNCTION Empty_Logged_in as L ()
                              'changes the value of the field "active" from .T. to .F.
                              'enter the current date and time in the field "out"
                              Empty_Logged_in = .F.
                              dim et as P
                              et = table.open("logged_in",FILE_RW_SHARED)
                              query.order = "Active"
                              query.filter = "Active=.T."
                              query.options = "I"
                              et.query_create()
                              update.fields = 2
                              update.field1 = "ACTIVE"
                              update.expr1 = ".F."
                              update.field2 = "OUT"
                              update.expr2 = "time(\"MM/dd/yy 0h:0m\",now())"
                              et.update()
                              et.close()
                              Empty_Logged_in = .T.    
                          END FUNCTION  ​
                          Alpha 5 Version 11
                          AA Build 2999, Build 4269, Current Build
                          DBF's and MySql
                          Desktop, Web on the Desktop and WEB

                          Ron Anusiewicz

                          Comment


                            #14
                            Are you looping to see the status of which workstations are logged on/off somewhere else, Ron?
                            You may need to revisit the order in which you are running stuff.
                            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