I'm developing this really important squirrel application.
There is a wizard where squirrels are added to the database.
So say there are three screens to this wizard:
1.Squirrel name details
2.Height and weight
3.Nut storage
What I'm wanting to do is save the results of the wizard when all details have been added at step 3.
The users however are wanting this "Save to continue later" button. So on screens 1 and 2 they want to be able to save the data they've entered so far and come back and complete it later.
The problem with this is the squirrels height and weight are mandatory field so I would have to make them nullable in the database to be able to save at step 1.
What would be the best way of dealing with this?
I could:
Make the fields nullable and have something like a pending
completion flag on the squirrel table in the database.
Not such a big fan of this it seems to go against best practises.
Somehow store the incomplete squirrels somewhere else until they are
fully complete and ready to be saved to the database.
Not sure of where the incomplete squirrels could be stored.
There's bound to be other options too.
Anyone have any good suggestions?
The isValidated flag in the database seems a good approach. You could enrich the record at each step adding more and more columns and at the last step when the user finishes the wizard set the flag to true to indicate that the user has finished editing this record. The width and height columns might indeed have to be made nullable in the database because until the transaction is fully complete, they can contain null values.
Depending on how big your data is going to be you could use HTML5 Storage. Would mean you would only need to call the database when your pushing your data up which in turn should improve performance as everything is happening client-side.
Related
Dremio provides a really nice GUI to download and save data generated after your query run.
However, I want to save my query (instead of query result) in dremio so that I can anytime (in future) refer the query that I wrote. Is there a way to achieve this?
Really appreciate the help!
Although this is an old post, I thought it might be helpful to provide a solution. What you are describing can be solved with a key functionality of Dremio. Instead of going through the difficulty of searching for your old query; I would have suggested creating a VDS (Virtual Data Set) by way of the UI. After a successful run of your query you can save it
Dremio Save Dataset Button as a VDS.
After selecting the save button you will be asked where you wish to save it; you can either save it to your default directory or a named Space you have created previously Dremio VDS Save Dialog.
You can query against this new VDS as though it was an actual table. Any changes made to the VDS will be saved in a history - utilizing the breadcrumb trail on the right side of the UI one can navigate to prior versions.
You can now further accelerate this query through creation of a Dremio Reflection...but that goes beyond the scope of your question ;)
In the left upper corner, you should look for Jobs menu:
We have the requirement that users, after terminating the input of a form, can only see the data; only authorized users can modify the data.
For this purpose we use the following permissions and it works smoothly:
Now raised a second requirement.
The users wish the possibility to finish the input of the form in a second moment, so that they don't have to fill in the form entirely after pressing the new button, before they can push the save button.
Because some forms are large and maybe they are in a hurry to catch the bus, or maybe for some answer they have to ask someone else not contactable at the moment.
The idea was to add the save-draft button.
The first save-draft is OK; the message is "Draft saved successfully!".
But the second save complains:
It seems that the permissions don't differentiate between save and draft-save, so that also after a draft-save the form data is read-only.
Which possibilities I have to achive this two goals?
Many thanks.
The save-draft process is very much like the regular save (save-final process), except that it lets users save data even if the value of some fields is invalid. So, indeed, from the perspective of the permissions, save-final and save-draft are the same.
What you would really need is the ability for:
A process to save the stage of the form along with the data. In your case, the stage could be "work in progress" or "submitted".
The permissions to be able to depend on that stage, so you can say "users can edit their own data if the stage is work in progress, but can only view it if the stage is submitted".
You can do #1 right now using a hidden field and an xf:setvalue() action. But you can't do #2. For that, you would need the workflow feature to be implemented (see RFE #2256), which we hope to be able to complete in 2018. So, you guessed it, the good news is that this is coming, but the bad news is, at least as I write these lines, that it isn't implemented yet.
I am having a task to Auto Save data after every 5 minutes which is filled in more than one forms however I dont want to save the data in the actual dataset. The main aim of auto save is as there are many fields on the form and the user has typed in details spending his valuable time and during this time if the server goes down then the application would crash thereby loosing the data typed in.
If the application has crashed then next time when the connection takes place then a message should pop up saying "Do you want to recover the lost changes?"
once clicked yes then the auto saved form should be shown.
Just a side note my application is working on datasnap model.
Any suggetions how to go about this really appreciated.
Not sure if this is an option, but perhaps you could deploy the application with a lightweight database (such as SQLite or NexusDB)? If you have a lot of forms with a lot of fields/data, this would make a drafts based solution quite easy to implement.
The idea would be to have a "drafts" table in your local database which is a flat table that will contain and hold all of the data that you want to persist until the transactions are committed to the server database.
Save the data in the forms to this local drafts table (as the user enters them in or on a periodic basis). Once the transactions in the forms are committed to the server database, you can delete the draft record from the local drafts table.
If the app crashes and the user signs back on, you will be able to check the local drafts table and pull the data that you need back into the screen fairly quickly and easily.
Hope this helps.
I'm developing a webapp that allows the editing of records. There is a possibility that two users could be working on the same screen at a time and I want to minimise the damage done, if they both click save.
If User1 requests the page and then makes changes to the Address, Telephone and Contact Details, but before he clicks Save, User2 requests the same page.
User1 then clicks save and the whole model is updated using TryUpdateModel(), if User2 simply appends some detail to the Notes field, when he saves, the TryUpdateModel() method will overwrite the new details User1 saved, with the old details.
I've considered storing the original values for all the model's properties in a hidden form field, and then writing a custom TryUpdateModel to only update the properties that have changed, but this feels a little too like the Viewstate we've all been more than happy to leave behind by moving to MVC.
Is there a pattern for dealing with this problem that I'm not aware of?
How would you handle it?
Update: In answer to the comments below, I'm using Entity Framework.
Anthony
Unless you have any particular requirements for what happens in this case (e.g. lock the record, which of course requires some functionality to undo the lock in the event that the user decides not to make a change) I'd suggest the normal approach is an optimistic lock:
Each update you perform should check that the record hasn't changed in the meantime.
So:
Put an integer "version" property or a guid / rowversion on the record.
Ensure this is contained in a hidden field in the html and is therefore returned with any submit;
When you perform the update, ensure that the (database) record's version/guid/rowversion still matches the value that was in the hidden field [and add 1 to the "version" integer when you do the update if you've decided to go with that manual approach.]
A similar approach is obviously to use a date/time stamp on the record, but don't do that because, to within the accuracy of your system clock, it's flawed.
[I suggest you'll find fuller explanations of the whole approach elsewhere. Certainly if you were to google for information on NHibernate's Version functionality...]
Locking modification of a page while one user is working on it is an option. This is done in some wiki software like dokuwiki. In that case it will usually use some javascript to free the lock after 5-10 minutes of inactivity so others can update it.
Another option might be storing all revisions in a database so when two users submit, both copies are saved and still exist. From there on, all you'd need to do is merge the two.
You usually don't handle this. If two users happen to edit a document at the same time and commit their updates, one of them wins and the other looses.
Resources lockout can be done with stateful desktop applications, but with web applications any lockout scheme you try to implement may only minimize the damage but not prevent it.
Don't try to write an absolutely perfect and secure application. It's already good as it is. Just use it, probably the situation won't come up at all.
If you use LINQ to SQL as your ORM it can handle the issues around changed values using the conflicts collection. However, essentially I'd agree with Mastermind's comment.
I am developing a gallery which allows users to post photos, comments, vote and do many other tasks.
Now I think that it is correct to allow users to unsubscribe and remove all their data if they want to. However it is difficult to allow such a thing because you run the risk to break your application (e.g. what should I do when a comment has many replies? what should I do with pages that have many revisions by different users?).
Photos can be easily removed, but for other data (i.e. comments, revisions...) I thought that there are three possibilities:
assign it to the admin
assign it to a user called "removed-user"
mantain the current associations (i.e. the user ID) and only rename user's data (e.g. assign a new username such as "removed-user-24" and a non-existent e-mail such as "noreply-removed-user-24#mysite.com"
What are the best practices to follow when we allow users to remove their accounts? How do you implement them (particularly in Rails)?
I've typically solved this type of problem by having an active flag on user, and simply setting active to false when the user is deleted. That way I maintain referential integrity throughout the system even if a user is "deleted". In the business layer I always validate a user is active before allowing them to perform operations. I also filter inactive users when retrieving data.
The usual thing to do is instead of deleting them from a database, add a boolean flag field and have it be true for valid users and false for invalid users. You will have to add code to filter on the flag. You should also remove all relevant data from the user that you can. The primary purpose of this flag is to keep the links intact. It is a variant of the renaming the user's data, but the flag will be easier to check.
Ideally in a system you would not want to "hard delete" data. The best way I know of and that we have implemented in past is "soft delete". Maintain a status column in all your data tables which ideally refers to the fact whether the row is active or not. Any row when created is "Active" by default; however as entries are deleted; they are made inactive.
All select queries which display data on screen filter results for only "active records". This way you get following advantages:
1. Data Recovery is possible.
2. You can have a scheduled task on database level, which can take care of hard deletes of once in a way; if really needed. (Like a SQL procedure or something)
3. You can have an admin screen to be able to decide which accounts, entries etc you'd really want to mark for deletion
4. A temperory disabling of account can also be implemented with same solution.
In prod environments where I have worked on, a hard delete is a strict No-No. Infact audits are maintained for deletes also. But if application is really small; it'd be upto user.
I would still suggest a "virtual delete" or a "soft delete" with periodic cleanup on db level; which will be faster efficient and optimized way of cleaning up.
I generally don't like to delete anything and instead opt to mark records as deleted/unpublished using states (with AASM i.e. acts as state machine).
I prefer states and events to just using flags as you can use events to update attributes and send emails etc. in one foul swoop. Then check states to decide what to do later on.
HTH.
I would recommend putting in a delete date field that contains the date/time the user unsubscribed - not only to the user record, but to all information related to that user. The app should check the field prior to displaying anything. You can then run a hard delete for all records 30 days (your choice of time) after the delete date. This will allow the information not to be shown (you will probably need to update the app in a few places), time to allow the user to re-subscribe (accidental or rethinking) and a scheduled process to delete old data. I would remove ALL information about the member and any related comments about the member or their prior published data (photos, etc.)
I am sure it changing lot since update with Data Protection and GDPR, etc.
the reason I found this page as I was looking for advice because of new Apply policy on account deletion requirements extended https://developer.apple.com/news/?id=i71db0mv
We are using Ruby on Rails right now. Your answers seem a little outdated? or not or still useful right now
I was thinking something like that
create a new table “old_user_table” with old user_id , First name, Second name, email, and booking slug.
It will allow keep all users who did previous booking. And deleted their user ID in the app. We need to keep all records for booking for audit purpose in the last 5 years in the app.
the user setup with this app, the user but never booking, then the user will not transfer to “old_user_table” cos the user never booking.
Does it make sense? something like that?