how to delete saved info without using #Scheduled - notifications

A notification is sent to the user in the system and it is saved in the database. How can I delete this saved message after the user has seen it for some time? Without using #Scheduled

Related

How to backup and restore an SQLite database?

I have an app built using React-Native and Expo's Managed workflow. I'm using Expo SDK 45. I'm managing the db using 'expo-sqlite'.
I need to provide the user the capability of backing up and restoring a local SQLite database.
My attempt was to use 'expo-file-system' and 'expo-sharing' to allow the user to save a copy of the database to the location of their choosing. This was done successfully.
My issue is in the user restoring the database. What I'm trying:
const importedFile = await DocumentPicker.getDocumentAsync();
await FileSystem.copyAsync({ "from": importedFile.uri, "to": FileSystem.documentDirectory + 'SQLite/tempDB.db' });
I then verify tempDB.db to ensure the structure is correct, i.e. the user isn't trying to import a wrong file.
I now have 2 issues:
If the user tries importing another database, I can delete the current tempDB.db but when the new one is imported, any attempt to access the new database fails with error Error code 10: disk I/O error. It seems that perhaps the system still believes it has an open connection to the deleted database.
If I overwrite the actual app database with the imported one, again there is no connection and nothing loads.
If I manually restart the app, all database connections are opened with the new files and everything works.
So, is there a better way to attempt this backup/restore functionality or is there a way to force the user to restart the app?

Why do we say that in dynamic web-pages we can't make any changes?

When we enter our credentials, the mail box opens which is sent from the server. But we are able to manipulate it like deleting messages, or moving messages from one folder to another.
And next time we re-login it is in the same status, although the page again came from the server.
It means that the changes we made were saved on the server.
Then why do we say that we can't make changes to dynamic web-pages sent by the server to the client ?
I'm not sure if I understood your question right.
When you move E-Mails in another folder or do something else on the website, your changes will take effect on the server not on your client. So you don't really change the dynamic web-page, you change content properties on the server. For example a Message could have an ID and then theres a Table which will Map Messages by Id to Folders. When you move a Message to another Folder, Database Entries on the server will be updated.

OpenPop.NET save to database or save file

I'm using OpenPop.NET to retrieve emails from client. My idea is to have a service that's working on the background to keep storing new recieved mail from time to time instead of geting it from the client when the user tries to check it, because: performance.
So my question here is: is it a better idea to store the emails info to the database or save it to file as in the OpenPop example
I was thinking the better would be a database solution, because Message-ID is not unique this way i could open email details using my own IDMessage. But this is my first time working with recieving emails and am not sure if there's any motive that i shouldn't do it this way. So i'm open to opinions and advices.

Allowing data to be stored for a client who isn't logged in using Meteor Auth and then saving on login

I have a simple form that captures data from the user. It is just a single field and a date stamp for tracking weight on a daily basis.
I am using the Meteor authorisation package. When a user is logged in I just save UserID into the list and then filter the collection for that User ID.
This is fine if I force users to login before they use the system.
But I would like to allow users to try the system first. So they might save 3 or 4 lines of data and then decide to create an account and save. In the short term I would like to just save the data from that current session (so if they shut their browser down without having saved, their data is lost). In Phase 2 I would like the data to persist so that if they don't save but come back the next day in the same browser they can still decide to save their data against a permanent account.
I am currently thinking of saving the uuid instead of the standard Meteor.userId for temporary users and then just replace this value with their new Meteor.UseriD. Longer term saving a random number as the user ID and saving this data to a persistent client cache and then overwriting with their Meteor.UserID when they create an account.
But I am a newbie and would like to know if there is a more elegant way of achieving these two goals:
1) Allowing the user to record some data, that only they can see. Then saving this when they choose to create an account.
2) Allowing the user to record some data, that persists across sessions. Then saving that data when they choose to create an account.
If you are using the meteorite package manager you can use the accounts-anonymous plugin https://github.com/tmeasday/meteor-accounts-anonymous
It is only two small files so you could also just added directly to your project.
And then once logged in transefer the user info over.

Attaching a file to a post

Ok,
So, I have a social networking website where users can share a post and now i am implementing attachment feature so that users can attach files to the post. I use uploadify in order to upload files to the server. So, my current logic is, when user browses the file and clicks attach as in the attached image, the files are uploaded to a temporary directory in the server and when the post is actually shared, the files are moved to correct upload directory and database is updated accordingly. But my logic goes wrong when the user click attach, so, his files are uploaded to the server, and he quits the application without actually sharing the post. So, those files will be on the server unnecessarily. How can I modify my logic to preven this from happening?
Maybe you can add a flag in database like "shared" defaults to 0 when the user clicks the share button you can run an update setting it to 1.
Add a cronjob getting all uploads with "shared" = 0 and timestamp > 1 day :)
You would need to use CRON task to execute a script that checks if files are associated with any published/saved content. If not it deletes them from your filesystem.