I have a model class 'Shop' with a related database table. The table is large and we are changing the way the clients load the data.
Up until now, mobile clients would just retrieve the whole table and reload the list in app, but now developers started to work with local memory, so they would not have to reload all records every time.
So from them I expect to get a timestamp of when a user has last logged in and check if any records have been added/updated after that and return the new/updated data, but I just do not know where to start from.
Related
In react application I used a form to inserted data and with express JS I post this data to mongo db.
when people is logged in the can insert data using form. and there is a page where user can view and delete their inserted data. Problem is how can I load data that was inserted by specific user?
When any user log in and user insert data also store user_id with
every entry. Now get data from DB by using current user logged in
user_id and display that specific data on front end. That's it.
Comment below for any query.
Thanks
I need to do the following tasks in CakePHP 3:
Logout users manually
Limit the number of sessions to one per user
I'm using database sessions to accomplish that. Is it possible to save additional data in sessions table? If yes, could you give me an example please?
The session database model is a cake model like all the other models, which means you can interact with it, in the same way, by adding new columns to that table and/or deleting sessions if needed. Use the model object to update delete entities in that table (I assume you're talking about cakephp 3.x)
Limiting the number of sessions to one per user can be tricky as sessions are created even if a user is not logged in. So you will have "user-less" sessions in your database as well.
Suggested way to tackle this
When a user logs in, get the current session ID and find the row in the session table that needs to be updated to include the username
At this time you may also want to delete the other rows that have the same user name, effectively destroying all the other sessions for this user.
I'm trying to get the current logged (in my app) user in every winform of my app, but I don't know how to differentiate between multiple logged users in the app.
I have an ActiveUsers SQL Table with SessionID and UserID to identify a single user.
Also how can I close the session (delete the userid from the ActiveUsers table) if the app is terminated abnormally?
Any help?
Edit: The app is composed of several winforms and is intended to run in multiple Pcs at the same time. Users are created in the application and stored in SC_User table with UserID as PK. The ActiveUsers table has UserID as FK and SessionID as PK. What i want is to get the UserID of the user using the applicattion in any winform and use it to for example change the app language preference of the that user. For a single user i insert the UserID in the ActiveUsers when login and delete when logoff.
Keeping application-wide data is quite easy. All you have to do is add either a static (shared in vb.net) class or a singleton class to your project and store the application-wide data there. (Extra read: differences between singleton and static)
As for the second question, You don't really have a way to know if the client is closed without proper logout. What you do in these cases is implement a keep-alive mechanism.
A simple implementation would be to add another column to your session table to keep track off the time stamp when the logged in user was last active (usually a timer inside that static/singleton class will be in charge of updating this column every x time, and once the difference between this column and the current datetime is big enough, you can safely assume that the application is closed without proper logout.
You can even run a scheduled job on your sql server to delete the records on the session table where the application is closed without proper logout if you want to.
I have a C# .net 4.5 website where users select certain data fields and then they get generated and the user can download the data.
There is a new feature management wants me to add that will allow users to select any field even if there are fields that do not go together and when the user submits this job I have to split out the fields and generate however many jobs it takes to create them.
Without having to change my entire back end process I wanted to store the users selections in a data table in memory and when they submit I can loop through the table and submit the jobs accordingly.
What would be the best way to have a data table that will be alive during the entire user session? Should I create it as a session variable? The user can come back and add or remove from it at anytime while on the site.
Thank you
We would like to keep Salesforce synced with data from our organization's back-end. The organizational data gets updated by nightly batch processes, so "real-time" syncing to Salesforce isn't in view. We intend to refresh Salesforce nightly, after our batch processes complete.
We will have somewhere around 1 million records in Salesforce (some are Accounts, some are Contacts, and some belong to custom objects).
We want the refresh to be efficient, so it would be nice to send only updated records to Salesforce. One thought is to use Salesforce's Bulk API to first get all records, then compare to our data, and only send updated records to Salesforce. But this might be an expensive GET.
Another thought is to just send all 1 million records through the Bulk API as upserts to Salesforce - as a "full refresh".
What we'd like to avoid is the burden/complexity of keeping track of what's in Salesforce ourselves (i.e. tables that attempt to reflect what's in Salesforce, so that we can determine the changes to send to Salesforce).