Skip to content

Moving from from standa lone app to networked multi-user app (from SBME to PPCS

Forums Forums SIMPOL Programming Moving from from standa lone app to networked multi-user app (from SBME to PPCS

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3475
    JD Kromkowski
    Participant

    I have had this conversation before like in 2013 and 2009 and probably earlier. I alway forget, so I am posting again for a refresher.

    I finally have a pretty stable application for my law office. I wrote it as a SBME application using the appframework model. I’ll be using 20 datasources (.sbm) each with one TABLE.

    I’ll have no more than 3 users at a time, although I may have as many as five machines on the networks, mixture of windows os. In addition, I have 4 network storage devices. Maybe there is already a FAQ on this if so please advise. If not perhaps this could serve as basis/starting point

    Q1. Where to store data? Right now, it seems like we are encouraged to store data in C:\Users\Public\Documents\SIMPOL MyApplication\

    This is on the machine where the application is being developed. That doesn’t seem like the right place to store data for multi-user application. Ideally, I’d think it would be stored on one of the NAS drives, which is always accessible to any machine on the network. Are there any issues storing the data in this location?

    Q1a. Code changes Are there places where we need to change code and how? It looks like in the sb_tables type, something need to be done. But it is unclear to me how exactly.

    string datapath ;// This is the location of the database files when running single-user
    string serveraddressport ;// This is the location of the ppcsserver with port in the format 127.0.0.1:4000
    boolean useppcs

    Should we use a constant for datapath and serveraddressport?

    Q2. Where to store the forms? In SB, I stored the forms locally to each machine. Basically, in my initialization routines I established a global FormDir$ based on the username. This is was because different work stations had different version of Windows running and different monitors and also I could set a main form for a user which limited access to certain things. The later not so much an issue now. Currently, following the practice of the examples, forms and reports get stored on the machine where the development takes places as follows:

    C:\SIMPOL\projects\tutorial\myapplication\bin

    This also does not seem to make sense in a multi-user application.

    Q2a. Multiple copies of forms local to each workstation? Or one copy of forms on a network accessible drive?
    My preference would be that each workstation would have form in C:\SIMPOL\forms\ directory?

    Q2b. How does code look or change? Right now,

    dirsep = getdirectorysepchar()
    cd = getcurrentdirectory()
    if iswindows_os()
    fname = “OfficeForm6.sxf”
    else
    // NA but fname = “OfficeForm6.sxf”
    end if

    How does getcurrentdirectory work on each workstation?

    Q3. How do I use simpolserver and write a correct ‘sample.cfg’ The readme.txt does a pretty good job but I’d really like to automat this and have it all run as part of the application. So a couple of follow ups. Are there any gotchas about what directories to use.

    Q3a. If there is no server per se on the network, I think the consensus the last time I asked was you could run simpolserver on any machine without much difference and so long as it was running everything would would on the other machines. Has anything changed?

    Q3b. I am really worried about data getting corrupted via using simpolserver. There was a warning some place and so I’m a little paranoid. A corrupted datasource and/or table could really be devastating. One table has nearly 70000 records another nearly 40000. This would be a massive problem. What a safe data-handling steps, do I need to take? Daily backups? Hourly?

    Q3c. Truthfully, I’d like to fully automate the process of having simpolserver running. Simpolserver has to be always be running, but what happens if the designated machine is off or goes off because of power? An unsophisticated user may be faced with this process. Since it doesn’t matter which machine runs simpolserver. Here is what I envisioned:

    My app would first check to see if server is running. Is this possible? If running, then it would continue as normal. If simpolserver is not running, then a function in the application would automatically start simpolserver on that machine.

    Right now, in Simpol Business, you either set the constant bUSEPPCS to .false or .true. What I am envisioning is this boolean gets set in the program. This presume a method to detect whether the server is running.

    Could I set it up this way, so that who’s ever first in office runs the server, if it is not already running?

    Q3d. Where are all the places for example in the Simpol Business example code that need to be changed to run as multi-user PPCS and what do the changes look like?

    #3476
    Michael
    Keymaster

    Hi John,

    Q1. Where to store data? Right now, it seems like we are encouraged to store data in C:\Users\Public\Documents\SIMPOL MyApplication\

    That is the correct location if you are creating an application to run on a PC that has multiple users, or one you are designing for distribution for individual users. If you are creating a network application then put the data someplace on the network (people do not need to be able to map the drive). The important issue is going to be, “Where do you run the server program?”. That program needs to run on a machine that is always on. The IP address of that machine should also not be allocated using DHCP, so that it won’t ever change.

    Q1a. Code changes Are there places where we need to change code and how? It looks like in the sb_tables type, something need to be done. But it is unclear to me how exactly.

    string datapath ;// This is the location of the database files when running single-user
    string serveraddressport ;// This is the location of the ppcsserver with port in the format 127.0.0.1:4000
    boolean useppcs

    Should we use a constant for datapath and serveraddressport?

    I tend to define these in an ini file and read that in the sbapplication.new(). As for changes to the sb_tables type, have a look at a very recent SIMPOL Business and you will see that it has been designed for both single-user and network.

    If you have been using type declarations like: sbme1table or sbme1record, you need to change to using the syntax:

    type(db1table) table
    type (db1record) r

    Q2. Where to store the forms?

    When preparing an application for deployment, you should determine your deployment strategy. You can just put the whole application, plus the required binaries, into a directory on a network location. Then everyone could run it from there. If you want it to be local (much more hassle if you are making changes), then just copy the directory down from the server to the local machine where you created the run time version. You should only distribute the *.smp, any forms, reports, quick reports, etc. plus any images files you may need, and the required binaries. For more information about which binaries (which you get from the SIMPOL\redist directory), see the Deploying SIMPOL Programs chapter in the Quick Start Guide.

    How does getcurrentdirectory work on each workstation?

    This returns the directory where the code is running from.

    Q3. How do I use simpolserver and write a correct ‘sample.cfg’ The readme.txt does a pretty good job but I’d really like to automat this and have it all run as part of the application. So a couple of follow ups. Are there any gotchas about what directories to use.

    Q3a. If there is no server per se on the network, I think the consensus the last time I asked was you could run simpolserver on any machine without much difference and so long as it was running everything would would on the other machines. Has anything changed?

    You can’t really automate this and make it part of the application. It is a database server and is separate from the application. You will only have one instance of this running in the network. You can run it on a desktop, but then that desktop will need to be on and the server will need to be running otherwise nobody will be able to work. Everyone will need to map the IP address and port number of the server machine.

    Q3b. I am really worried about data getting corrupted via using simpolserver. There was a warning some place and so I’m a little paranoid. A corrupted datasource and/or table could really be devastating. One table has nearly 70000 records another nearly 40000. This would be a massive problem. What a safe data-handling steps, do I need to take? Daily backups? Hourly?

    You needn’t worry overly much about the data-integrity. We have companies using the server (including our own company), and it is very reliable. What is important is to shutdown the PPCS server properly, but even then you shouldn’t get corruption. You can take daily backups if you have a lot of change, weekly if less so. I would do monthly backups and then weekly ones and at every monthly you can drop the weekly backups.

    Could I set it up this way, so that who’s ever first in office runs the server, if it is not already running?

    Not really. Only one machine should be hosting the data and it will be identified by its IP address. I can’t currently imagine an easy way for a user machine to run the server on the correct machine. The server can be set up to run as a service on most Windows systems. That means the machine only needs to be on, not necessarily logged in, in order to provide the PPCS service.

    Q3d. Where are all the places for example in the Simpol Business example code that need to be changed to run as multi-user PPCS and what do the changes look like?

    I suggest you look at the most recent version of SIMPOL Business. It was modified to run as either single-user or multi-user and also demonstrates how to incorporate labels and the newer version of graphic reports.

    Ciao, Neil

    #3477
    JD Kromkowski
    Participant

    So this code in Simpol Business has some issues for me.

    me.inifilename = datadir + sAPPNAME + “.ini”
    buf = openinifile(me.inifilename, sCRLF)
    s = “”
    getprivateprofilestring(sSYSTEM, sUSEPPCS, “F”, s, sEOLchar=sCRLF, sInifilecontent=buf)
    if s == “T”
    //So my ini looked like this but obvious you can have “.true” you have to have “T”
    //[System]
    //useppcs=.true <—- will fail
    //serveraddress=10.1.10.xx:4000 not really xx, but you get idea
    //

    useppcs = .true
    else
    useppcs = .false
    end if

    if useppcs
    serveraddressport = “”
    //
    // I don’t get the point of the ini, if you end up putting having to put the
    // the ip address in the actual code
    //
    //getprivateprofilestring(sSYSTEM, sSERVERADDRESS,”127.0.0.1:4000″, serveraddressport, sEOLchar=sCRLF, sInifilecontent=buf)

    // shouldn’t it be like this:
    getprivateprofilestring(sSYSTEM, sSERVERADDRESS, serveraddressport, serveraddressport, sEOLchar=sCRLF, sInifilecontent=buf)

    #3479
    Michael
    Keymaster

    The IP Address is there as a default value. If you place a value in the ini file then that overrides the default value. If you don’t want to have a default value, then you can use “”. As for the T|F, those are string equivalents for the boolean .true and .false. If you look at the defboolean display format it contains “T|F”. If you want to use .true and .false, go right ahead, just change the if statement to look like this:

    if s == ".true"
    ...
    end if

    As for the point of the ini file, it is so that you don’t have to change the source and recompile for things that are effectively data and which could change. Things like the PPCS server location.

    Ciao, Neil

    • This reply was modified 7 years, 1 month ago by Michael.
    #3481
    JD Kromkowski
    Participant

    I see how the code works now.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.