Forgot your password?
typodupeerror
Databases Programming Hardware

Data Locking In a Web Application? 283

Posted by timothy
from the get-offa-my-cloud dept.
An anonymous reader writes "We recently developed a multi-user application and deployed it to our users. This is a web-based application that used to be a Windows application which was written in Delphi using Paradox databases for the client database. In the Windows application, we used the ability in Paradox to lock records which would prevent users from editing the same data. However, in the web application we did not add in a locking facility for the data due to its disconnected nature (at least that's how I was shot down). Now our users are asking to have the locking back, as they are stepping on each others' edits from time to time. I have been assigned to look at best practices for web application locking of data, and figured I would post the question here to see what others have done or to get some pointers to locations for best practices on doing locking with in a web application. I have an idea of how to do this, but don't want to taint the responses so I'll leave it off for the time being."
This discussion has been archived. No new comments can be posted.

Data Locking In a Web Application?

Comments Filter:
  • Duct Tape (Score:5, Funny)

    by Anonymous Coward on Thursday September 24, 2009 @10:49PM (#29536219)

    Lots and lots of Duct Tape.

  • by Anonymous Coward on Thursday September 24, 2009 @10:54PM (#29536259)

    So that's what the song "Tainted Love" is really about! Who knew.

  • by larry bagina (561269) on Thursday September 24, 2009 @11:44PM (#29536541) Journal
    You could use an incrementing hash. Then you'd both be happy.
  • by ArcadeNut (85398) on Thursday September 24, 2009 @11:50PM (#29536579) Homepage

    Slashdot is hardly the right venue to get a good answer to this question (how the hell did it end up in the Hardware category?)

    Ok, so if Slashdot isn't the right venue to get an answer, should he ignore your answer?

  • by roman_mir (125474) on Friday September 25, 2009 @12:02AM (#29536631) Homepage Journal

    I just made a console a month ago that handled this problem as follows:

    Records that need to be processed are in 'pending' (unconfirmed actually) status, once any user clicks to select the record, it is timestamped and the user is 'locking' it. Actually the user is assigned to it and all other users see that this record is 'locked' by the first user who selected it.

    However, now anyone can open the details of the record and do the following: they will see a button 'Take the lock away from $user$', so they can take the lock away! But there is history of who took whose lock, so the problem will be solved outside of the applicaction if they take each other locks away.

    If the user locked a record he has a choice of 'save', 'save and release lock', 'release lock' buttons on the record details.

    The users are allowed taking the lock away from each other so the lock resolution is pushed into the real world and out of the app.

  • by cerberusss (660701) on Friday September 25, 2009 @03:42AM (#29537165) Homepage Journal

    Hard locks are probably not what you want in a stateless web app. (E.g. What happens if someone locks a record and then is hit by a bus?)

    There's a Firefox extension for that.

    In our company, users' pulses are tethered to the USB bus. The Firefox extension can then use this information. People spend hours in our time accounting system, which has a pessimistic locking scheme. The Firefox extension sends an 'unlock' when the user's pulse stops for whatever reason. We've had buses driving users over, we've had rabid squirrels, a janitor going postal, exploding Sony laptops and a manager doing the 'Godfather-baseball-bat-routine' on an unsuspecting employee. Our time accounting system runs great, we've never had a stray lock.

"A great many people think they are thinking when they are merely rearranging their prejudices." -- William James

Working...