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

Opt_net function for V5

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

    Opt_net function for V5

    Here's a new network optimize routine, Opt_net_v5(), updated for A5v5. The attached zip file contains both the full script and an AEX file that can be added to your A5v5\Addins_installed folder to make the routine available to every A5 application on your computer. (If you want to use the AEX file on a workstation computer, copy the file to the Addins_installed folder on that computer as well. On runtime versions, you may need to create the Addins_installed folder.)

    As I'm sure many of you are aware, version 5 has significantly improved the network optimize and network refresh routines so that, among other things, new or modified tables are automatically included in the optimize. This makes the need for additional routines like the one that was developed for version 4 (and this one) obsolete for many users. However, there are a couple features in this new version that will benefit some users.

    BACKGROUND: For those who are new to Alpha, the refresh optimize in version 4 did not copy new (or modified?) tables to the workstation so a special routine was developed by Ira Perlow and me to solve the issue. Briefly, this routine switched the user to the server version of the application and then started a full optimize. This feature is no longer necessary in version 5 due to the improvements added by Alpha Software.

    WHAT THIS FUNCTION DOES:
    There are two basic advantages to using the attached routine:

    1. The routine allows the developer to put the Network Optimize routine on one button that can be used from either the server or the workstation without requiring the user to decide whether to run a full optimize or a refresh optimize. It checks the value of A5.get_master_path() to see if the user is in a network optimized database and runs the appropriate optimize routine.

    2. The routine copies additional files from the server to the workstation. Under the assumption that all .AEX files and all .AL* files in the application directory are either "attached compiled libraries" or simple "attached libraries" required by the application, all of these files are automatically copied to the workstation. In addition, like the option that was included in the version 4 Opt_Net() or Opt_2step() routines, you can create a list of additional files to be copied by listing each filename in a text file called A5Support.amq. (The .amq extension is just to keep mildly curious users from opening an obvious text file and modifying it.)

    #2
    RE: Opt_net function for V5 - Update

    When I posted the original script a couple days ago, I forgot that my test db still had the old v4 setup I used for checking the version number. With the new method that v5 uses, the update warning method needed to be updated too. (I also added a minor update to the Opt_net_v5() function as described below.)

    The update required three new functions (total of four now) so it got rather complicated. I have simply included them in the attached .aex file which can be copied to your A5v5\Addins_installed folder to make them accessible by any application running on your computer. If anyone really wants the code, send me an e-mail at [email protected]

    Only one of the new functions actually needs to be called by the user. The new function that you would call to determine the need for an update is Opt_update_needed(). I numbered the various 'version combinations' that can be returned just to give more options to developers. You now have the ability to create any special messages, warnings, or actions that might be applicable. (As I said in the first posting, these functions provide more power than will be needed by many users.) The results returned are:
    0 = No update available - current application version is same as (or higher than) the server version.
    1 = Update optional - Integer same but decimal increased AND version check in MASTER db set to 'integer only'. As the developer, this gives you the option to inform users of minor updates.
    2 = Update needed - Integer higher AND version check in MASTER db set to 'integer only'.
    3 = Update needed - Local version is lower than the master version and the check is set to 'entire number'.
    These next three can be used for error warnings if you want to. Typically they would be directed at the developer (you).
    7 = Currently in the shadowed database but version in master db has NEVER been set.
    8 = Current database not a shadowed database and version NEVER set.
    9 = Current database not a shadowed database but version has been set at least once. (This is normal so there's not really much reason for a warning. It could be used to inform developer that current db is not shadowed??)

    As mentioned at the beginning, I made a small change to the Opt_net_v5() function. This change makes the completion message optional. If you include .T. as an argument to the function, Opt_net_v5(.T.), a 'standard' completion message will be shown. Otherwise, you can provide your own as shown in the sample script at the end of this message. (I was surprised to find that the message from the original script is displayed even after Opt_net_v5() runs.) Here's the 'standard' message:
    "WORKSTATION UPDATE COMPLETE"
    "The local workstation application has been updated to the same version as the server."
    "CLICK 'OK' TO CONTINUE."

    A sample script for using these two functions is included at the end of this message. The script would typically be placed in the OnActivate event of the Run On Load form and I would expect that many people will modify or even remove many of the messages. The script is provided only as an example.

    Of course, it would still be a good idea to put a simple button on a menu form for starting Opt_net_v5() if for no other reason than because providing that button means that users can run the full optimize from the workstation without getting access to the control panel! Just start A5 directly (not the app) then use File/Open Database to open the server version and, finally, click the Optimize button that calls Opt_net_v5().

    NOTE: To use these functions, you must still set the version number in the 'main' database and set the check method (full number or integer only) there as well. However, when using these functions to check update status, set the actions to "Do Nothing" because the actions are now controlled by your script.

    Two supporting functions have been added that may be of use to developers for other purposes:

    Opt_version_local():
    Returns a pointer which contains the values of version_number, outofdate_flag, and check_portion for the local database. Values are all 0 if the version has never been set. HINT: Use Opt_version_master() to determine if this is a shadowed database.

    From the Interactive window:
    ?opt_version_local()
    = check_portion = 1.000000
    outofdate_flag = 1.000000
    version_number = 1.500000

    Opt_version_master():
    Returns a pointer which contains the values of version_number, outofdate_flag, and check_portion for the master database. Values are all 0 if the version has never been set. Values are all 9 if the current database is not a shadowed database (a5.get_master_path()="").

    From the Interactive window:
    ?opt_version_master()
    = check_portion = 9.000000
    outofdate_flag = 9.000000
    version_number = 9.000000


    Sample script for use in OnActivate event of Run-on-Load form with Opt_net_v5() and Opt_update_needed():
    Code:
    DIM resp as N
    DIM update_numb as N
    update_numb = opt_update_needed()
    SELECT 
       CASE update_numb = 1
          'Version number decimal has been updated but user has chosen to 
          'ask for updates only when the integer is updated.
          'REM OUT THIS SECTION TO TOTALLY IGNORE MINOR UPDATES.
          resp = ui_msg_box( "*** INFORMATION ***", "A minor application update \
    has been installed on the server. Updating your workstation is \
    optional."+chr(13)+chr(13)+"DO YOU WANT TO UPDATE NOW?",\
          ui_question_symbol+ui_yes_no+ui_second_button_default )
          IF resp = ui_yes_selected
             Opt_net_v5(.F.)
             ui_msg_box( "UPDATE COMPLETE", "" )
          END IF
       CASE update_numb = 2
          'Version number integer has been updated and user has chosen to ask for updates 
          'when the integer is updated.
          resp = ui_msg_box( "*** UPDATE REQUIRED ***", "An application update \
    has been installed on the server and you should update as soon as \
    possible."+chr(13)+chr(13)+"BEGIN UPDATE NOW?", ui_question_symbol+ui_yes_no )
          IF resp = ui_yes_selected
             Opt_net_v5(.F.)
             ui_msg_box( "UPDATE COMPLETE", "" )
          END IF
       CASE update_numb = 3
          'Version number has been updated and user has chosen to ask for updates 
          'whenever any part of the version number is updated.
          resp = ui_msg_box( "*** UPDATE REQUIRED ***", "An application update \
    has been installed on the server and you should update as soon as \
    possible."+chr(13)+chr(13)+"BEGIN UPDATE NOW?", ui_question_symbol+ui_yes_no )
          IF resp = ui_yes_selected
             Opt_net_v5(.F.)
             ui_msg_box( "UPDATE COMPLETE", "" )
          END IF
       CASE update_numb = 7
          'Currently in the shadowed database but version in master db has NOT been set.
          ui_msg_box( "*** WARNING ***", "This application has been designed to notify \
    users when new updates are installed on the server but the version of the server \
    application has never been set."+chr(13)+chr(13)+"PLEASE NOTIFY YOUR SYSTEM\ ADMINISTRATOR.", ui_attention_symbol )
       CASE update_numb = 8
          'Currently in the main database but version number has NOT been set.
          ui_msg_box( "*** DEVELOPER WARNING ***", "This application has been designed to \
    notify users when new updates are installed on the server but the version number of this \
    application has never been set."+chr(13)+chr(13)+"PLEASE SET THE VERSION NUMBER.",\ ui_attention_symbol )
       CASE update_numb = 9
          'Currently in the main database and the version number IS set.
          'Not really much to do here unless you want to warn the user every time the 
          'main application (not shadowed) is started.
          'resp = ui_msg_box( "*** INFORMATION ***", "You are running this application directly \
    from the main (not shadowed) database.", ui_attention_symbol )
       CASE ELSE
          'This section added as info only.
          'Update_numb must be 0, program is running from a shadowed 
          'database but there is nothing to be updated.
    END SELECT
    
    END
    A REALLY SHORT VERSION THAT FORCES OPTIMIZE WHEN A NEW VERSION IS AVAILABLE:
    Code:
    update_numb = opt_update_needed()
    IF update_numb = 2 .or. update_numb = 3
       Opt_net_v5()
    END IF

    Comment


      #3
      RE: Opt_net function for V5 - Update

      Darn - "Use HTML" doesn't work properly in the code archive. Let's try just the text again the 'normal' way...

      When I posted the original script a couple days ago, I forgot that my test db still had the old v4 setup I used for checking the version number. With the new method that v5 uses, the update warning method needed to be updated too. (I also added a minor update to the Opt_net_v5() function as described below.)

      The update required three new functions (total of four now) so it got rather complicated. I have simply included them in the attached .aex file which can be copied to your A5v5\Addins_installed folder to make them accessible by any application running on your computer. If anyone really wants the code, send me an e-mail at [email protected]

      Only one of the new functions actually needs to be called by the user. The new function that you would call to determine the need for an update is Opt_update_needed(). I numbered the various 'version combinations' that can be returned just to give more options to developers. You now have the ability to create any special messages, warnings, or actions that might be applicable. (As I said in the first posting, these functions provide more power than will be needed by many users.) The results returned are:
      0 = No update available - current application version is same as (or higher than) the server version.
      1 = Update optional - Integer same but decimal increased AND version check in MASTER db set to 'integer only'. As the developer, this gives you the option to inform users of minor updates.
      2 = Update needed - Integer higher AND version check in MASTER db set to 'integer only'.
      3 = Update needed - Local version is lower than the master version and the check is set to 'entire number'.
      These next three can be used for error warnings if you want to. Typically they would be directed at the developer (you).
      7 = Currently in the shadowed database but version in master db has NEVER been set.
      8 = Current database not a shadowed database and version NEVER set.
      9 = Current database not a shadowed database but version has been set at least once. (This is normal so there's not really much reason for a warning. It could be used to inform developer that current db is not shadowed??)

      As mentioned at the beginning, I made a small change to the Opt_net_v5() function. This change makes the completion message optional. If you include .T. as an argument to the function, Opt_net_v5(.T.), a 'standard' completion message will be shown. Otherwise, you can provide your own as shown in the sample script at the end of this message. (I was surprised to find that the message from the original script is displayed even after Opt_net_v5() runs.) Here's the 'standard' message:
      "WORKSTATION UPDATE COMPLETE"
      "The local workstation application has been updated to the same version as the server."
      "CLICK 'OK' TO CONTINUE."

      A sample script for using these two functions is included at the end of this message. The script would typically be placed in the OnActivate event of the Run On Load form and I would expect that many people will modify or even remove many of the messages. The script is provided only as an example.

      Of course, it would still be a good idea to put a simple button on a menu form for starting Opt_net_v5() if for no other reason than because providing that button means that users can run the full optimize from the workstation without getting access to the control panel! Just start A5 directly (not the app) then use File/Open Database to open the server version and, finally, click the Optimize button that calls Opt_net_v5().

      NOTE: To use these functions, you must still set the version number in the 'main' database and set the check method (full number or integer only) there as well. However, when using these functions to check update status, set the actions to "Do Nothing" because the actions are now controlled by your script.

      Two supporting functions have been added that may be of use to developers for other purposes:

      Opt_version_local():
      Returns a pointer which contains the values of version_number, outofdate_flag, and check_portion for the local database. Values are all 0 if the version has never been set. HINT: Use Opt_version_master() to determine if this is a shadowed database.

      From the Interactive window:
      ?opt_version_local()
      = check_portion = 1.000000
      outofdate_flag = 1.000000
      version_number = 1.500000

      Opt_version_master():
      Returns a pointer which contains the values of version_number, outofdate_flag, and check_portion for the master database. Values are all 0 if the version has never been set. Values are all 9 if the current database is not a shadowed database (a5.get_master_path()="").

      From the Interactive window:
      ?opt_version_master()
      = check_portion = 9.000000
      outofdate_flag = 9.000000
      version_number = 9.000000


      Sample script for use in OnActivate event of Run-on-Load form with Opt_net_v5() and Opt_update_needed():
      Code:
      DIM resp as N
      DIM update_numb as N
      update_numb = opt_update_needed()
      SELECT 
         CASE update_numb = 1
            'Version number decimal has been updated but user has chosen to 
            'ask for updates only when the integer is updated.
            'REM OUT THIS SECTION TO TOTALLY IGNORE MINOR UPDATES.
            resp = ui_msg_box( "*** INFORMATION ***", "A minor application update \
      has been installed on the server. Updating your workstation is \
      optional."+chr(13)+chr(13)+"DO YOU WANT TO UPDATE NOW?",\
            ui_question_symbol+ui_yes_no+ui_second_button_default )
            IF resp = ui_yes_selected
               Opt_net_v5(.F.)
               ui_msg_box( "UPDATE COMPLETE", "" )
            END IF
         CASE update_numb = 2
            'Version number integer has been updated and user has chosen to ask for updates 
            'when the integer is updated.
            resp = ui_msg_box( "*** UPDATE REQUIRED ***", "An application update \
      has been installed on the server and you should update as soon as \
      possible."+chr(13)+chr(13)+"BEGIN UPDATE NOW?", ui_question_symbol+ui_yes_no )
            IF resp = ui_yes_selected
               Opt_net_v5(.F.)
               ui_msg_box( "UPDATE COMPLETE", "" )
            END IF
         CASE update_numb = 3
            'Version number has been updated and user has chosen to ask for updates 
            'whenever any part of the version number is updated.
            resp = ui_msg_box( "*** UPDATE REQUIRED ***", "An application update \
      has been installed on the server and you should update as soon as \
      possible."+chr(13)+chr(13)+"BEGIN UPDATE NOW?", ui_question_symbol+ui_yes_no )
            IF resp = ui_yes_selected
               Opt_net_v5(.F.)
               ui_msg_box( "UPDATE COMPLETE", "" )
            END IF
         CASE update_numb = 7
            'Currently in the shadowed database but version in master db has NOT been set.
            ui_msg_box( "*** WARNING ***", "This application has been designed to notify \
      users when new updates are installed on the server but the version of the server \
      application has never been set."+chr(13)+chr(13)+"PLEASE NOTIFY YOUR SYSTEM\ ADMINISTRATOR.", ui_attention_symbol )
         CASE update_numb = 8
            'Currently in the main database but version number has NOT been set.
            ui_msg_box( "*** DEVELOPER WARNING ***", "This application has been designed to \
      notify users when new updates are installed on the server but the version number of this \
      application has never been set."+chr(13)+chr(13)+"PLEASE SET THE VERSION NUMBER.",\ ui_attention_symbol )
         CASE update_numb = 9
            'Currently in the main database and the version number IS set.
            'Not really much to do here unless you want to warn the user every time the 
            'main application (not shadowed) is started.
            'resp = ui_msg_box( "*** INFORMATION ***", "You are running this application directly \
      from the main (not shadowed) database.", ui_attention_symbol )
         CASE ELSE
            'This section added as info only.
            'Update_numb must be 0, program is running from a shadowed 
            'database but there is nothing to be updated.
      END SELECT
      
      END
      A REALLY SHORT VERSION THAT FORCES OPTIMIZE WHEN A NEW VERSION IS AVAILABLE:

      update_numb = opt_update_needed()
      IF update_numb = 2 .or. update_numb = 3
      Opt_net_v5()
      END IF

      Comment


        #4
        RE: Opt_net function for V5 - Update

        Well, the code still isn't very readable but you can cut and paste it to your Xbasic code editor and then choose Code/Format/Entire Text. This will make it very readable.

        Comment


          #5
          RE: Opt_net function for V5

          I updated this to version 1.04 which is mostly a better 'activation' script which now includes a simple change to implement the "Do Nothing, Ask, or Force" options that are in the built-in routine. I also removed a superfluous UI_MSG_BOX() warning from the version in the .aex file that was used for development and never removed.

          Rather than doing a lot of re-typing (especially since nobody else seems to be using it so far!), you can see the changes and download the .aex file at www.aimsdc.net/Tips_Funcs/Opt_net_v5.htm

          Comment


            #6
            RE: Opt_net function for V5

            I still get the feeling nobody else is using this but I find it extremely useful and just added an update that others may find useful as well:

            New Option! Added Jan. 20, 2004: This function now optionally removes the .adblock file when running an optimize. The default will automatically remove the file and continue with the optimize. This was chosen as the default because so many users seem to feel that the "lock-out" is not required. By setting the second argument, "Ask_remove_lock", to .T., the function will prompt to remove the lock file or cancel the operation.

            From the information on my web page:
            "If the only purpose is to allow the initial optimize from a server version, add an OnInit routine to the main menu that hides the button when the database is shadowed.... Another possibility would be to show the button whenever the .adblock file exists on the server. This would allow the user to force an update if the lock file has been left due to a crash before a previous optimize was completed."

            As in my last post, rather than doing a lot of re-typing you can see the changes and download the install file at www.aimsdc.net/Tips_Funcs/Opt_net_v5.htm

            Comment


              #7
              RE: Opt_net function for V5

              One note about something I discovered yesterday - the hard way...

              Setting the CanExit event to "Cancel()" will cause any optimize function which is run from a button on a form to crash. This includes the A5 built-in functions "Refresh_shadow()" and "Create_shadow()".

              In fact, doing this can create a real mess - if you don't have a backup, you could end up in serious trouble. (Yes, I had a backup.) If the main menu needs to be protected, then you must run a routine to close all forms before running any optimize function.

              Comment

              Working...
              X