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

Delete/re-create a shadow from the shadow

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

    Delete/re-create a shadow from the shadow

    Too many times clients have run into problems with shadow databases that only seem to be fully cured by deleting the shadow and re-creating it rather then simply refreshing it in the usual ways. For one thing, refreshing does not get rid any tables in the shadow that have been deleted in the master.

    Asking novice users to delete a shadow folder is asking for trouble, and without deleting it not all problems will be resolved, in my experience. Giving users access to the control panel to "create" a shadow is also not something I am fond of. Besides, creating and overwriting an existing shadow does not always get rid of whatever might be causing a problem with a shadow.

    So, I have finally succeeded in creating some scripts that from the shadow will close itself, open the master, delete all the files in the the shadow folder and then re-create the shadow from scratch. This may sound easy, but if you have ever tried it you most likely found all kinds of peculiar tweaks were needed to make it work reliably and without problems (e.g., the 2 second delay in one the scripts is essential).

    In addition to the two scripts that follow, I am going to attach a test database, which also has a script for making a shadow from a master (just using create_shadow2("database_name") won't work).

    Ray Lyons


    'Date Created: 26-Oct-2005 05:49:21 PM
    'Last Updated: 19-Jan-2006 08:14:57 PM
    'Created By : Ray Lyons
    'Updated By : Ray Lyons
    '******** Del_Re-Create Shadow script **********************************
    'Addin variables to communicate with the master DB to be opened here
    DIM aiv AS P
    DIM aiv.DelShadow AS P
    aiv = addin.variables()
    dim aiv.DelShadow.Create_shadow as L
    dim aiv.DelShadow.shadow_path as c

    'check to see if in master or shadow.
    dim Master_name as c
    Master_name=a5.Get_Master_Name() 'Here just using to get shadow folder
    'name and to check whether we are in
    'the master (="") or the shadow.
    If Master_name = ""
    ui_msg_box("STOP","You are NOT in a Shadow database."+crlf(2)+"You can only run this operation from a Shadow.",UI_STOP_SYMBOL+UI_OK)
    END
    End if

    'Routine to get shadow path to be deleted once shadow is closed & master opened.
    dim shadow_folder_name as c
    shadow_folder_name = file.filename_parse(Master_name,"n")
    aiv.DelShadow.shadow_path = a5.Get_Path() 'path for the shadowed DB--use in autoexec when coming back
    response = ui_msg_box("Shadow Path","Shadow DB Path = "+aiv.DelShadow.shadow_path+crlf(2)+"Shadow Database Name = "+Shadow_folder_name+crlf(2)+"Are you sure you want to delete and re-create Shadow Database?",UI_QUESTION_SYMBOL+UI_YES_NO)
    If response = UI_NO_SELECTED
    aiv.DelShadow.Create_shadow = .F. 'set fales so when master opens nothing is triggered.
    end
    else
    'current is a shadow, so close shadow, open Master and create a
    'shadow there using the aiv.DelShadow.Create_shadow as the trigger.
    aiv.DelShadow.Create_shadow = .T. 'set true so when master opens code will triger
    dim Master_name as c
    Master_name=a5.Get_Master_Name()
    Trimmed_path = alltrim(Master_Name)
    :a5.load(Trimmed_path)
    end if
    END
    '************************ END **************


    'Date Created: 18-Jan-2006 02:30:01 PM
    'Last Updated: 19-Jan-2006 08:36:07 PM
    'Created By : Ray Lyons
    'Updated By : Ray Lyons
    '*******************************Autoexec script ************************
    DIM aiv AS P
    DIM aiv.DelShadow AS P
    aiv = addin.variables()
    dim aiv.DelShadow.Create_shadow as L 'Used to trigger or not.
    dim aiv.DelShadow.shadow_path as c 'Used for deleting and re-creating the shadow.

    dim Master_Path as c
    Master_path=a5.Get_Master_Path()'If this ="", it is NOT shadowed
    If aiv.DelShadow.Create_shadow = .t. .AND. Master_path = "" 'currently in the Master, so delete & create shadow
    aiv.DelShadow.Create_shadow = .F. 'so shadow won't trigger this
    dim success_flag as L 'indicates whether anything was removed--not using now but may
    Success_Flag = DIR_REMOVE_RECURSE(aiv.DelShadow.shadow_path,.t.) '.t. suppresses warning
    DIM GLOBAL pDlg1 as {waitdialog}
    pDlg1.Create(1,"Message")
    pDlg1.Set_Title("Please Wait")
    pDlg1.Set_Message("Operation still processing.")
    pDlg1.Set_Bottom_Message("Only a few seconds left.")
    dim DBname as c
    DBname = file.filename_parse(a5.get_name(),"N")
    xbasic_wait_for_idle(2) 'Seems to need at least a 2 sec delay or A5 really gets screwed up
    pDlg1.Close()
    'next line is for v6 and above. Check docs for v5 version of it
    create_shadow2(aiv.DelShadow.shadow_path+"\\"+DBname,.t.)
    End if
    END
    '*************************** END *********************************


    #2
    OK, I give up: How does one get indents in pasted code to diplay?

    Ray

    Comment


      #3
      Use html [code] tags.

      http://msgboard.alphasoftware.com/alphaforum/faq.php?faq=vb_read_and_post#faq_vb_special_codes

      Comment


        #4
        You know, when one goes to the trouble of posting something like this that should be of help to others and no one even so much as responds with a simple �Thanks,� it raises a number of questions, one of which is, �Why bother going to the trouble?� Another might be, �Am I the Lone Ranger on this (i.e., no one else has ever had a need for this)?� The latter can�t possibly be true, can it?

        Also, I see there is a better answer to my question about displaying indents in posted code:

        http://msgboard.alphasoftware.com/al...ad.php?t=57348

        Ray

        Comment


          #5
          Ray,

          I know how you feel. Sometimes folks respond to my efforts to help by saying they aren't as good as they could have been.

          Can't speak for others concerning the non-response you received to your post. For me, this seemed like something that belongs over in the code archive. I plan to study it but haven't had the time so far.

          -- tom
          Last edited by Tom Cone Jr; 01-23-2006, 07:37 AM.

          Comment


            #6
            Ray,
            I just saw your contribution today, and thank you, I think it is very valuable. I would think it should be included in the newsletter for wider distribution. Why don't you send it to Bill or Jim?
            - Peter

            Comment


              #7
              Hi Peter, and thanks, as always, for the kind words. Although I am still not sure there is any need for wider distribution, I may offer it to Bill or Jim after I am more sure that it is reliable. I just today implemented it on some client networks, and although it works fine here in my office, what works fine here does not always work fine out in the real world. This may be especially tricky because there clearly are some timing issues that can cause serious problems. My delay in the code may need to be more than 2 seconds in other environments. We'll see what happens.

              Ray

              Comment


                #8
                I just arrived here (Using A5 v7 less than a week) and am just starting to learn so I don't completely understand what you are doing yet but keep it up... I will catch up and I appreciate people who take the time to post such examples.

                Thanks

                Mel

                Comment


                  #9
                  Hi Ray,

                  In the past, I have had the problem, where the shadow had to be deleted and recreated due to different problems, at different times.
                  I saw your post over the weekend, and could not respond till today.
                  Appreciate your programming expertise. This is definitely very useful.
                  As soon as I get a chance I will use it at this end.

                  Many Thanks Ed

                  Comment

                  Working...
                  X