[Flashcoders] AIR: Application opened by someone else?
I was wondering if there is a framework for determining if an AIR application has been opened by more than one person on a network? I have a data file that the AIR application opens and allows editing for. Works great, however instances of the application all open the same data file. The chances are slim that more than one person will be accessing that single data file at a time, but I think I need to allow for detection and alert a user that someone else is also accessing the data therefore they could stomp on each other's changes. I was going to use a simple XML file and when the app loads, check a value in the XML. Each time someone opens the app, it checks the number and adds 1 to it writes to the XML. Each time the app (instance) is quit, it decrements the number until 0 (no one else is accessing). Not sure if this is a good approach or not since it's based solely on happening when one starts the application up and I was going to avoid polling the XML to see if it changed over time. So looking for an easy to implement solution to this problem. Perhaps my XML file thing is the way to go - not sure. Thanks for any insight, Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AIR: Application opened by someone else?
What you are mentioning sounds like the most logical course of action. You're basically implementing a 'lock' file within the application. The only issue with this approach is 'wedging' which can occur. If a user opens the application and their computer crashes, the file will be locked with no way to unlock without prompting the user to unlock. An approach to this is to add a timestamp to the lock and have the app refresh the timestamp every minute or so. Then if a timestamp is older than one minute (and change) you can be assured that the user with the lock is no longer working on the file. Peace C On Wed, Dec 2, 2009 at 7:43 AM, Eric E. Dolecki edole...@gmail.com wrote: I was wondering if there is a framework for determining if an AIR application has been opened by more than one person on a network? I have a data file that the AIR application opens and allows editing for. Works great, however instances of the application all open the same data file. The chances are slim that more than one person will be accessing that single data file at a time, but I think I need to allow for detection and alert a user that someone else is also accessing the data therefore they could stomp on each other's changes. I was going to use a simple XML file and when the app loads, check a value in the XML. Each time someone opens the app, it checks the number and adds 1 to it writes to the XML. Each time the app (instance) is quit, it decrements the number until 0 (no one else is accessing). Not sure if this is a good approach or not since it's based solely on happening when one starts the application up and I was going to avoid polling the XML to see if it changed over time. So looking for an easy to implement solution to this problem. Perhaps my XML file thing is the way to go - not sure. Thanks for any insight, Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AIR: Application opened by someone else?
Chris, That's an interesting idea about the hard crash/power loss interval stamping. That's a circumstance I didn't think about. Right now I am displaying the number of running instances (if more than 1) and warning the users in the UI about data stomping... I'm not locking the data at the moment but I could pretty easily. Since local computers could have differing clocks I could put the timestamp part of it in the script on the server. I'm handling all other circumstances to provide clean up with the app quits. event.preventDefault() rocks. Thanks for your reply, Eric On Wed, Dec 2, 2009 at 12:02 PM, Chris zomgfore...@gmail.com wrote: What you are mentioning sounds like the most logical course of action. You're basically implementing a 'lock' file within the application. The only issue with this approach is 'wedging' which can occur. If a user opens the application and their computer crashes, the file will be locked with no way to unlock without prompting the user to unlock. An approach to this is to add a timestamp to the lock and have the app refresh the timestamp every minute or so. Then if a timestamp is older than one minute (and change) you can be assured that the user with the lock is no longer working on the file. Peace C On Wed, Dec 2, 2009 at 7:43 AM, Eric E. Dolecki edole...@gmail.com wrote: I was wondering if there is a framework for determining if an AIR application has been opened by more than one person on a network? I have a data file that the AIR application opens and allows editing for. Works great, however instances of the application all open the same data file. The chances are slim that more than one person will be accessing that single data file at a time, but I think I need to allow for detection and alert a user that someone else is also accessing the data therefore they could stomp on each other's changes. I was going to use a simple XML file and when the app loads, check a value in the XML. Each time someone opens the app, it checks the number and adds 1 to it writes to the XML. Each time the app (instance) is quit, it decrements the number until 0 (no one else is accessing). Not sure if this is a good approach or not since it's based solely on happening when one starts the application up and I was going to avoid polling the XML to see if it changed over time. So looking for an easy to implement solution to this problem. Perhaps my XML file thing is the way to go - not sure. Thanks for any insight, Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders