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

A new variable scope

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

    A new variable scope

    To borrow the words of Robert Kennedy:
    "Some people look at things and say why; I see things that never were and say why not!"

    Variables are accessible within their scope and when you get out of alpha, they all die. That goes for any variable in just about any software programming.

    So to suggest that you could make a variable survive after you get out of your program would sound like blasphemy to programming geeks and is bound to send you to the gallows.

    Not that I have a death wish, but what prompted this idea is couple of recent threads.

    So the question is: can you somehow retool or genetically engineer a variable to make it survive after you exist alpha?

    The answer is yes.

    Not only it will survive after you exit alpha, it will do so if you exit Windows, if you turn off the power to your machine, to the whole building or the entire neighborhood.
    How?
    As Jack Palace would say: "that's for you to figure out."

    Thought you might be interested in a little brainteaser..Will post the response shortly.

    #2
    Re: A new variable scope

    "application cookies," there're not just for Web servers/apps... we have been saving/restoring an application's "state," by "user/session" for 20+ years...
    "all things should be as simple as possible... but no simpler"

    Mike

    Comment


      #3
      Re: A new variable scope

      Text file in application directory. Update the text file with your variable and their values.
      Andrew

      Comment


        #4
        Re: A new variable scope

        There a more ways to do that, property file, ini file, etc.

        Code:
        'Adapted from the help file
        'Create a dot variable
        Dim a[1] as P
        a[1].name = "Fred"
        a[1].city = "Boston"
        a[1].age = 23
        a[].name = "Tom"
        a[..].city = "NY"
        a[..].age = 35
         
        'Show how the properties looks like
        ui_msg_box("Write properties to file",properties_enum(a[1],"R;O=p|v|t"))
         
        'Write 'm to disk
        file.From_property("c:\my_property.txt", a)
         
        'Delete the pointer var
        delete a
         
        dim b as P
        dim a[1] as P
        dim cc as C
         
        'Read the properties from the property file
        cc = file.to_property("c:\my_property.txt", b)
         
        'Show the property string
        ui_msg_box("Read property string from propertyfile",cc)
         
        'Convert them from propety string into a property var
        property_from_string(a, cc)
         
        'Show the property var
        ui_msg_box("Enum properties",properties_enum(a[1],"R;O=p|v|t"))
        Marcel

        I hear and I forget. I see and I remember. I do and I understand.
        ---- Confusius ----

        Comment


          #5
          Re: A new variable scope

          This has been covered multiple times on the board, but variable scope basically comes down to this
          • Local variables - persistent within the current function or script
          • Shared/Session variables - persistent through the current session (thread), typically a window in Alpha 5
          • Global variables - persistent until the database closes
          • Addin variables - persistent until the Alpha 5 window closes, even closing and opening other databases
          Any other variable value that you want persistent values to is just a matter of storing it in an ADB file, database, registry, Data dictionary, text file etc. in such a place and location that all desired Alpha 5 windows, users (on the same system), network users have a common access to it. It will be much slower than a typical value, as it is essentially file based, so minimize reads/writes where possible.

          In general, do not write to the Data dictionaries and Adb files as these are really for development, not dynamic usage. Windows Registry is also a bad idea, as it is cluttered enough, and there is always a risk of corrupting windows when writing to the registry if system should crash.

          Databases and Text files in the appropriate folders are the best way for Alpha 5
          Last edited by csda1; 12-10-2007, 04:00 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


            #6
            Re: A new variable scope

            Thanks to everyone responding.
            Yes, yes, yes.. you could do it in many different ways..

            So far we've got:
            application cookies (need more specifics) and
            save to a text file

            I will throw in another one:
            Save to a table...(I don't know if that's what Ira meant as well).

            BUT..

            It's much much easier than that..

            Comment


              #7
              Re: A new variable scope

              Not sure why you would want to add the complexity of a table into the fray. when a simple text file can handle the info for you.

              I believe that the table would need to provide a needed benefit prior to wanting to implement one in this fashion. Either I would need to take advantage of the tables ability to index/query or sort based on different fields. But All of that could be handled within an array just as easily.
              Andrew

              Comment


                #8
                Re: A new variable scope

                Andrew:
                This is not how I would do it, I am just throwing few more ideas along the line of what was suggested but that's not my way of doing it, none whatsoever.
                Last edited by G Gabriel; 12-10-2007, 05:08 PM.

                Comment


                  #9
                  Re: A new variable scope

                  O, ok.

                  How would you do it then? I figured sense you posed the question you wanted to know, but from your responses I am assuming that you already know how you would do it.
                  Andrew

                  Comment


                    #10
                    Re: A new variable scope

                    I guess I became known for these brainteasers that some find very annoying while others find very challanging and enlightening..

                    How about if we just let it ride a little longer for those who like a little challange and who like to figure things out on their own? can you bear with me a little longer?

                    Comment


                      #11
                      Re: A new variable scope

                      Hi Andrew,

                      Originally posted by aschone View Post
                      Not sure why you would want to add the complexity of a table into the fray. when a simple text file can handle the info for you.

                      I believe that the table would need to provide a needed benefit prior to wanting to implement one in this fashion. Either I would need to take advantage of the tables ability to index/query or sort based on different fields. But All of that could be handled within an array just as easily.

                      A table (I said database earlier, but meant it in the generic or Alpha Four terminology of a table/dbf file) is better if multiple users need to share the data. It takes care of the sharing issues. If you used a text file, then when suppose 1st 1 person reads, then another person. 1st person modifies file, and writes. 2nd person modifies files and writes. All of person 1's values are then lost. If, on the other hand, you are the only one using the file, then a text file is OK.

                      An array goes away the moment you leave Alpha Five. If you want it to still be there next time, it better be stored in something that doesn't go away.

                      Also, you could also store data in windows environment variables, but this memory space goes away when you shutdown windows, and also very often is not configured for sufficient space to hold much data in many (maybe most) computers.

                      Using Alpha 5 functions to save values in the database (ADB/ALB/ALM/ALX files) or Table/Set Dictionaries is a bad idea for the reasons outlined earlier.
                      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


                        #12
                        Re: A new variable scope

                        Originally posted by csda1 View Post
                        Hi Andrew,




                        A table (I said database earlier, but meant it in the generic or Alpha Four terminology of a table/dbf file) is better if multiple users need to share the data. It takes care of the sharing issues. If you used a text file, then when suppose 1st 1 person reads, then another person. 1st person modifies file, and writes. 2nd person modifies files and writes. All of person 1's values are then lost. If, on the other hand, you are the only one using the file, then a text file is OK.

                        An array goes away the moment you leave Alpha Five. If you want it to still be there next time, it better be stored in something that doesn't go away.

                        Also, you could also store data in windows environment variables, but this memory space goes away when you shutdown windows, and also very often is not configured for sufficient space to hold much data in many (maybe most) computers.

                        Using Alpha 5 functions to save values in the database (ADB/ALB/ALM/ALX files) or Table/Set Dictionaries is a bad idea for the reasons outlined earlier.
                        Very true on multiple users using the same text file. Seems to me though that a table would do the same thing. In either case you would need to distinguish which variable is assigned to which user. So the current user only modifies the variables assigned to them.

                        For the arrary I was only mentioning that for manipulation of the data. I wasn't very clear there. You can read the text file into an arrary, then use the arrary sorts to mimic the table sorts.

                        In the end, if you want the info to persist after a system reboot, you need to store it in a file. The question that I see truly being asked here is, what kind of file do you use.
                        Andrew

                        Comment


                          #13
                          Re: A new variable scope

                          I've been doing this with the registry for several years.

                          I have apps where the user jumps from one adb to another and the variables are retrieved in the autoexec.
                          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


                            #14
                            Re: A new variable scope

                            Originally posted by aschone View Post
                            The question that I see truly being asked here is, what kind of file do you use.
                            No, quite the opposite.
                            So far, all responses point in that direction. I intentionally skirted the above-mentioned suggestions to avoid any blood-shedding debates, but I guess it's unavoidable.

                            You cannot preserve a variable, because if you do, at least from a technical point of view, it�s no longer a variable. If it becomes part of the permanent records of a table or a database somewhere somehow, by definition, it is no longer a variable.

                            If you hire a temp then give her a full time job, she is no longer a temp.

                            Variables are meant to occupy a TEMPORARY placeholder for TEMPORARY usage. These placeholders are wiped out once you leave alpha.

                            So my question, stated differently is, how do you wipe out these placeholders, i.e. wipe out the variables, but yet preserve them?

                            It sure sounds like a schizophrenic exercise in dichotomy, doesn't it?

                            Comment


                              #15
                              Re: A new variable scope

                              So the question is: can you somehow retool or genetically engineer a variable to make it survive after you exist alpha?

                              The answer is yes.

                              Not only it will survive after you exit alpha, it will do so if you exit Windows, if you turn off the power to your machine, to the whole building or the entire neighborhood.
                              Gabe:

                              You now have me really confusedwith your last post.

                              I read some excellent suggestions in this post about where and how to store variables.

                              Are you still saying "the answer is yes or is the answer no"

                              Tom

                              Comment

                              Working...
                              X