Program Deployment

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Program Deployment

Post by SkinnyKenny » Thu Nov 12, 2020 4:23 am

Hello all,
So I have finished a small Windows program to use at work. My question is, what are my options for deploying it so that multiple users have access to it. The standalone essentially needs to be saved remotely and called from a server (I assume) so that any changes will sync when another user opens the program. Does this make any sense? I am just confused on where my program needs to reside in order to save the .livecode and other files needed to run the program.

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Program Deployment

Post by mrcoollion » Thu Nov 12, 2020 9:59 am

That question is not easy to answer. It depends on what the application does and if it needs to save data.

If the application does not do anything with data (save data) you could just place it on a share where all users can access it.
If it does save user-specific data you must have built the application in such a way that it can cope with multiple users changing data. E.g. use a database. Simplest version is using a SQLite DB.
If the data is user-specific and only for this user applicable you could let the application set up and save the data in subfolders of the shared folder (share) that have the username for each specific user.

- Paul -

SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Re: Program Deployment

Post by SkinnyKenny » Thu Nov 12, 2020 1:34 pm

Hi Paul,
Thank you for your response. Overall, my program uses sqlLite to manage the databases and works nicely. I would need the database files and stack files to reside remotely and called when the user opens the program to update the datagrids. My standalone has a "splash.exe" and the main application saves when closed keeping it in the state it was last used. The ".livecode" stack and the sqlLite database files need to reside outside the users PC in order for multiple users with different PC's to use it. Think of it like this....Google Doc's shares a word file among multiple users. I can open a shared doc and make changes, and anyone using that same document will see those changes since it is in the cloud.

Another way I have been thinking of accomplishing this would be having the program sit on an FTP server. The installer would create a launcher.exe to the desktop or wherever. As the program runs, it would call the main application files from the FTP server when needed and save back to the FTP server to keep any relevant changes current. If another user is using the program, it would always use the most up to date stack files and DB files. Do you think this is a viable option?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9838
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Program Deployment

Post by FourthWorld » Thu Nov 12, 2020 5:07 pm

If concurrent editing possible?

If so, how would you handle the scenario in which two users each download the data in one state, but each make changes to the data the other doesn't have?

Would the last person to upload overwrite the changes made by the first?

This is a classic groupware problem.

Explicit check out/check in is one solution, but that requires ongoing connection to the server.

And if ongoing server connection is a practical requirement for this app, the most common solution is to not use sqlite locally, but a multi-user DB on the server.

And even then there are questions about how to resolve conflicts.

So granularity of change is a factor. With the entire DB replicated on every client, any change to any data invalidates any other change. But with a multi-user DB, record locking at least allows two users to edit different records with no risk of conflict.

Can you tell us more about the workflow (number of users, frequency and scope of changes, etc)?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Re: Program Deployment

Post by SkinnyKenny » Fri Nov 13, 2020 4:10 am

Hi Richard.
So to give a little background of how the program works. I manage an EMS service with 3 other management level employees that would be using this program. Overall, the program tracks and logs narcotics used by the paramedics. We are tracking expiration dates and usages of said narcotics. Every shift, the shift commander logs each narcotic tag that is assigned to each ambulance and then puts that info into a database for later review by the FDA. One entry is normally needed for each 12 hour shift unless a narcotic tag is broken for drug administration. After each use, a new narcotic tag is issued and logged into the database with the pertinent information needed to account for the usage. The idea of any two users needing to make a change at the same time is nill to none. That being said, what I need to do is query the server when the program loads and pull the most recent database file into the datagrid. In addition, the stack that tracks expiration dates of the narcotics needs to be stored remotely so that will be current as well. If we were using a single PC to run the program that would be fine, but we are using our issued laptops so the program would have to be hosted remotely in order for everything to be sync'd to its current last used state. I really feel like this could be done by calling the needed files from a server and only having the launch icon on the desktop that calls the necessary files to run it. Does this help?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9838
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Program Deployment

Post by FourthWorld » Fri Nov 13, 2020 8:07 am

I'm assuming in that work context you can expect some periods without connectivity, is that correct?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Re: Program Deployment

Post by SkinnyKenny » Fri Nov 13, 2020 9:02 am

Yes. Actually it is only being used once if not maybe two times a shift.

SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Re: Program Deployment

Post by SkinnyKenny » Fri Nov 13, 2020 9:08 am

I have been playing around with some lessons tonight regarding SFPT commands and have the "upload" figured out. I can't seem to figure out how to download a file from the FTP server thus far. The lessons don't cover in full what I am trying to accomplish so if you have any sample scripts to point me towards that would be great. I seem to get hung up on the tsNetGetFile line. I just don't quite know what I am doing here. I have been looking into the "libURLDownloadToFile" command, but again I am having trouble understanding this.

Code: Select all

on mouseUp pMouseButton
   -- Store the SFTP server details in some variables
   put "ftps://myhost.org:1373" into tSFTPServer
   put "/Test/splashTest.livecode" into tSFTPFileToDownload
   
   put specialFolderPath("documents") & slash & "splashTest.livecode" into tLocalPath
   
   -- The tSettings array can be used to provide additional configuration details, in this case
   -- the username and password to use when downloading the file via SFTP
   put "USER" into tSettings["username"]
   put "PASS" into tSettings["password"]
   
   -- Note that when using tsNetGetFile we must specify a connection ID (any arbitrary value) and a handler to 
   -- call when the transfer is completed, in this case we want it to call "tsNetGetFileFinished".
   put tsNetGetFile("mySFTPdownload", tLocalPath, tSFTPServer & tSFTPFileToDownload, tHeaders, "tsNetGetFileFinished", tSettings) into tResult
   
   -- If tResult contains anything at this point, there is an error in the parameters sent to the tsNetGet call.
   if tResult is not empty then
      -- Inform the user of the error
      put "Error in tsNetGetFile call:" && tResult into field "Status"
   else
      -- tResult must be empty at this point, so let the user know the call has been successful.
      put "tsNetGetFile has been issued, awaiting response" into field "Status"
   end if
end mouseUp

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9838
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Program Deployment

Post by FourthWorld » Fri Nov 13, 2020 3:33 pm

What is the size of the file?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Program Deployment

Post by mrcoollion » Fri Nov 13, 2020 3:40 pm

Maybe a stupid idea but I have read that some LC developers have used dropbox as a place for sharing data between users. Maybe putting the SQLite file in a dropbox share would be possible?

- Paul -

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”