What architecture is best for multiple users editing the same database record? - django-rest-framework

I have a Django REST Application that has POST and GET endpoints for a record in database. It allows multiple users to POST data to it and GET from it. I can implement locking to make sure the records don't get overwritten and I can make sure the front-end pulls latest record first before users starts to write.
The problem comes when two users are editing the same thing simultaneously, I am looking for a solution as robust as Miro or Google Docs, where you can see the name of the user editing a line while you are also editing the same line.
Currently, its a simple Django REST app but is there anything out there that can help me make it more like Google Doc editing, as robust and truly realtime as it?
How are they managing such a thing in their architecture? What am I missing here?

Related

getStream - Flat Feed where multiple users can post

we are implementing stream in our application and so far we love the out of the box react components as well as the backend implementation stream ruby - this is our setup currently.
We are close to deploying a first MVP but found that it seems to be not possible to post activities to a flat feed from multiple users by default.
Our use case is that we have a group of people that want to post activities about a certain topic (think facebook groups). Therefore we create a feed for the object (lets say a company) and want each user to be able to post activities there. Our current workaround is to add the author id as additional data and add a custom header to a activity - obviously not the best solution as reactions won't work that way.
Looking around we found that this seems to not work out of the box see this issue and this question.
Is this a feature that is only available to paying customers or how can we activate it?
Thank you in advance!
When using Stream with React users can only post to their own user feed, this is a default permission policy that can be changed by Stream.
I suggest reaching to Stream support by email and ask to change the permission policy.

Mix Panel API web segmentation and personalisation

Hi I am interested in using Mix Panel on a web site to track customers events. I would like to know if there is any way to use the api to personalise the web site per customer, similar to segmentation for emails.
I would like to query the api for a singular customer asking whether they have achieved several events.
For example something like
If customer has clicked out and last visit greater than a month ago display a banner advert.
Mixpanel does not seem like a correct tool for the job you describe here.
While theoretically this might be possible (via Mixpanel's HTTP API), this will create unnecessary architectural complexity and add extra latency. If you need to customize your web site per user, store any user state in a database like MySQL or PostgreSQL. This will be both faster and easier.

Building A Social Network

So, I'm starting out building a social network web app. I'm looking into how to fit the parts of my stack together and I'm looking for some guidance about what various frameworks will allow me to do. My current stack idea is to have:
Firebase JSON API: serving user, post, comment, and all the other data
EmberFire: to plug that API into EmberJS
EmberJS: my front-end MVC (because I'm new to MVC and Ember seems the most accessible)
What I'm stumbling on at the moment is how I'm going to implement users with this stack. I've looked at basic authentication stuff but I haven't found anything that would allow me to allow certain actions and views for certain users and not others - the basics of a social network really.
Is it sensible to be doing this stuff in front-end MVC? If so what should I be using to do authentication/personalisation? If not, should I just be doing a PHP/SQL setup? I'd rather avoid that because my skills are all front-end.
If you are just getting started, Firebase is a great service to learn on due to their 'back end as a service' model - you will spend more time building/modeling your data and less time running/installing. Not that you won't want to learn more about that later, but it lets you focus on one piece at a time.
From an access perspective, JS/NoSQL vs PHP/MySQL isn't going to be the issue. They each have their own security requirements - it's more that PHP/MySQL has had more time to establish those rules. Additionally, Firebase being a hosted service has it's own set of requirements.
Firebase security rules are a little weird when you first look at them, but they begin to make some sense after you sit with them for a bit. The Firebase docs are actually a pretty great resource. https://www.firebase.com/docs/security/
Basically, if you use a Firebase 'login provider' it makes Firebase act as both a database and a authentication manager, and the combo helps keep users 'fenced' to where you want them. You can use data from other paths, variables, validation rules, etc. You can even make a 'custom login provider' if you need to integrate with an existing one.
Finally, on the client end, your view can respond to whatever Firebase returns - if a user does 'hack' their way through to a page they shouldn't be on client side, no data is returned anyways and no submitted information would be allowed because of the rules.

Twitter - how to get user's timeline

My app, in one of its parts, should reproduce the same behaviour as a web page, where you can find a section with a table of Twitter posts, I guess they are a user's timeline. I took a look at Twitter api's and I found a call which could return it, but, If I got it right, you are supposed to be authenticated with that user credentials. Is there a way to achieve it without being that user (thus without using that user's credentials)? If not we have to assume that web plugins have more flexibility than queries which return xml, or json? Which kind of approach fits best, considering the app needs to support iOS from 4.3 to 6.x? Does Twitter+Oauth provide more flexibility than direct Twitter api calls?
Hm, if you are looking to just display user's feed you can do it as simple as:
https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=reMakeIn&count=200
Where you change the screen_name to the desired user that you want to show the feeds for.
No need what so ever to use authentication for this.
Not sure if this is what you want to achieve, but I use this approach to show random user's tweet feed.

How do you acquire usage data from a webOS app and store that data remotely?

I am new to webOS development. I have one app in the app store and in the next update to the app I would like to be able to identify the age of users, their location, how long they use the app, which features they use the most/least and then store that data in a database. How do I do this? Many thanks in advance for your help.
Well, that's a pretty big question. Here's an outline of what to do, with some notes.
First, you're probably not going to be able to get age unless you ask the user directly and they tell you. Also, you're only going to get location if the application is location-aware and the user permits you to collect that data (when you install a location-aware application, it asks the user if they're okay with the fact that the application will be able to get their location).
As for how long they use the app and which features they use, that's easier. Depending on the granularity you need/want to capture, you can just record time stamps when a user starts and stops using a particular feature, such as when scene activate and deactivate methods fire. As long as you store feature name and timestamp, that should give you what you're looking for.
Then comes to question of collection. However you store it in the app, you have a couple of choices for how to get it out of the app. Unless you can get your users to just email the data to you, probably the easiest thing to do would be to create a web app (possibly with no user facing output, since you're just using it to collect data) using something like Google App Engine that gives you a URL you can send a POST request to using an HTTP request. Depending on how you set it up, it could do the request every time you collect a timestamp (bad for battery use, though), just occasionally, or only when the app is doing cleanup (possibly a problem if you don't get the request off in time).
I'd recommend taking a look online at how people do this type of thing in iPhone apps to get a good sense of how to do this type of thing. If you hit problems getting particular things to work, you can of course come here to StackOverflow with specific coding questions.

Resources