SQLITE tables not operating concurrently - iphone

I am at a fix.. Please help me out.. I am new to IOS development and am developing a Shopping Cart Application in IOS.. My application consists some features like- Displays list of products, user can add some, edit their Quantities in detailViewController which will be updated in the db and can even delete them and at the end it gives the overall summary of the products bought, cost etc..
Each user has a login, it will validate the user name, password and allows the users etc..
Till to date everything was fine.. The database transactions are done using SQLITE.. But when I am trying to manipulate both the user and the products mdule together, the database manipulation of only one module works. ie, either the user login or the products manipulations works.. But not both.. Individually they are working fine...
But if i try to login by manipulating the db entries, add the products and try to edit them only either the user login manipulation in the db will work or the product manipulations.. Am at a fix..
Please tell me that Why am i encountering this problem and how can i debug it?? Thanks a million in advance.. Please help me out... Thanks

Related

How to Implement "Your contact just joined app" feature

I am building a mobile app (in flutter firebase, but the answer does not have to be firebase specific). And I would like to implement a feature that notifies users whenever anyone from their contact list joins the app. This seems like a very EXPENSIVE feature.
At the top of my head, I see a lambda/cloud function that is triggered everytime a user joins and then searches a database of users and their respective contacts for the existence of the new user's phone number. To me, this solution does not scale well for two reasons: if the number of total users is in the millions and the number of users joining simultaneously is a lot.
My better solution is to get the user's contacts upon joining and then searching a database of current users contacts for any of the phone numbers of the newly joined user.
Is there a solution better than the second one? If so, what is it? If the second solution is standard, what kind of backend storage mechanism provides the best search and retrieval time for a database of users and their respective contacts?
In the case of large users ill not do first solution because that may slow the sign up process instead i will creat a cron job that runs at a specific time or periodically it will get the list of the latest users signed up that day or that hour whatever you prefer then that cron will check the new user if related to any user in the databases and send a notification right away, or a better solution create a temporary table in a database in another server insert the notification informations into the other server, creat another cron job in the second server it will run at a specific time to sendthe notification

I have a MongoDB database and I want only a specific user accessing his private data

I have a MongoDB database, express and angular in the frontend.
I already have AUTH setup in a collection and another collection for storing Data.
Right now users can log in and save data, but the data that they save right now is global, meaning I could come and add 1) Learn MongoDB and the second user when they sign in sees the same thing.
I want users to be able to only see the data that he/she posts.
I have been browsing the internet for this specific tutorial but haven't found anything.
If someone could point me in the right direction and a little introduction on it, it would be very helpful.
At its core, this is very very simple. Say, you have a todo list application. So it has Users and Tasks. So the index page for Tasks has this code now (pseudocode ahead):
tasks = db.tasks.find()
render tasks
Naturally, all users see all tasks. What you need to change is now pass id of the logged-in user to the query:
tasks = db.tasks.find({user_id: current_user.id})
render tasks
That's it, now all users see only their own tasks. Do this for all other kinds of private data.

extension that give notification to the user about new site content

i have a news website that update once-twice in a day, and i want to develop something that will let my users know when there is new content in my website, it will popup them a notification, only one notification per each content its sound easy
the problem that i face is how i make it efficient in crossrider without every page reload make a call to the database?
how i doing it right now(not efficient)
i have in my server php file that post the id's of the last news, the crossrider read that file and for each id it call the crossrider db and check if that id exists if yes than the user has already recive a notification about that content and should not be notificated, and if its not exists than notify the user.
so as you can see every reload of a page the extension will make a call to my server and to the db server. any better way to build this? thank you
If I understand your query correctly, you can gain an immediate efficiency by calling the Crossrider db using appAPI.db.getList to obtain an array of all the database items (instead of calling the database for each id), and then process the ids against them.
I'm happy to look into other ways of improving the efficiency of your algorithm if you provide the extension id.

rails beta request signup with social media sharing reward

I would like to build a simple beta request signup page where the user is rewarded with an earlier reward when he is sharing the link to the application as much as possible.
A solution like this is seeable on
trenvy.com
User enters email
User gets unique link with his unique code
User shares this link on every signup its a +1 count on him
An admin method throws out the users emails which have shared the link and brought the most people in. I want to use this email list to use in CampaignMonitor.
Anyone knows what could be a good way to achieve this? Or someone wrote such a thing or knows a git repo that has this feature implemented as is to take a look at and learn?
I have already coded a unique code generator for the app that makes unique codes of 10 chars.
Now only this social media sharing is a bit unclear to me on how to approach this in rails, any ideas on that? thx!
Something like this can be achieved pretty easily in any framework, so I think I'll provide a general answer first, and if any specific gems occur to me, I'll mention them:
1) The unique code part is easy, it's just a parameter in a controller that checks the validity of the code — this would be a unique code that's added to the user model for ease of verification and created when the user first enters his email address.
2) Every time the link is visited, it's parsed by the controller and saves an event (don't just increment a field if you want maximum data out of the interaction, you could save IP for country of origin, time of the page hit, etc), just count the click events for that user for his +1s
3) Just write a quick admin site (i used twitter bootstrap for this recently) that lets you see the user's who've interacted with the system and sort by shares, and you can use the createsend gem to add them to whatever list you like.
There are no specific gems I can think of that'll speed this process up, Devise is overkill, you don't really need an activity monitor gem since you're not storing much info, definitely twitter_bootstrap for speeding up building the admin interface. Heroku lets you add an Sendgrid as a plugin, so you're covered there for mail sending.
Am i missing anything in your requirements? Seriously though this should be a 2-4 day dev effort, nothing fancy here.

iOS app - users updating wait time

I am building an iPhone app in which users (or employees) will be able to go to restaurants and update/give an estimate of the waiting time at that location. To do something like this, would it be most efficient to use an XML webpage and parse the data that is currently there and update that value with the user's input then reload the XML database? Obviously any user should be able to update the site so it needs to be done from a web-server.
Also, if anyone knows of a similar example for this, that would be spectacular!
Thanks for your help,
you can take a textfield in which you can fill the value and then send it onto the web server through XML or JSON web service and the other users can see the update from the web service.