Usergrid - unfollowed group posts still visible in feed - usergrid

We are having problems while using the social graph features of Apache Usergrid (2.1). Here is a sample:
We have this scenario (sandbox rules are off):
We have group1, user1 and user2
User1 and user2 follows group1
User1 posts to group1 -> the post is visible in both user1's and user2's feed
User2 unfollows group1
The post in group1 is still visible in user2's feed
I do not know the internals of the usergrid feed system, but I assume that it is copying / caching the data that was visible to the user at some point of time. However, this usage conflicts with the social graph, if the user unfollows a user/group, the posts should be hidden from the user's feed.
Are there any methods for implementing this scenario correctly? Usergrid documentation does not tell anything about this.

Related

How to create userrole that have permission to create other users, like sub users of the headquarter?

I am working on a system build in ruby on rails. We using rails admin to display all data.
We will have 3 different types of clients, Client1 (carshop), client2 (Headquarters with many carshop, like fransice) client3 (Subcontractors)
Client 1, and client2 is basicly same type of client, but but client2 have a headquarter, and many carshops below as a chain.
The headquarter should be able to view all data from all the carshop that belong to headquarter, create user logins for each shops, but all shops is independent from 1 shop to another (The shops that belongs to the headquarters cant see each other data, like order historic)
Hope my question make sense to you.
Thank you in advange.
trying to create a user that have permission to create sub users that belongs to the users admin panel, but only can see data that the user have given permission to.

Get list of Google Business Reviews for any business?

Can I get a list of reviews from an arbitrary business?
It appears like you get a list of the reviews for a specific account and location.
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
However, you can only get a list of account for an authenticated user.
https://mybusiness.googleapis.com/v3/accounts
Is there an endpoint or way to list out the reviews for any business? I just need the number or reviews, and really don't want to have to look at screen scraping type solutions.
The Places API returns only 5 for a business, GMB API requires the user as you’ve mentioned to authenticate; there’s no official endpoint for getting all listed reviews unless you either scrape the data; like Yelp, Google didn’t make it available to pull all user contributed content such as reviews; alternatively you can create your own DB for some businesses and manually update by pulling reviews off a third party site (eg: ReviewsMaker.com) where you can copy data to a table and keep track, but there’s no other real-time solution other than using the GMB API (which is restricted only to authenticated users)

Microsoft Graph API - /me/people does not return desired result

I'm working on a project using Microsoft Graph API. This project uses /me/people to get data.
According to Microsoft: "Microsoft Graph applications can use the People API to retrieve the people who are most relevant to a user. Relevance is determined by the user’s communication and collaboration patterns and business relationships. People can be local contacts, contacts from social networking or from an organization’s directory, and people from recent communications (such as email and Skype)."
According to this, I think that the result can be confirmable.
For example, I have 3 users account: user1#tnv.onmicrosoft.com, user2#tnv.onmicrosoft.com, user3#tnv.onmicrosoft.com. I put them in the same AAD security group named AADTestGroup.
I expect that when user1 calls /me/people, the result contains user2 and user3. However, it does not returns as expected.
The questions are:
What am I missing here?
How could I organize user accounts in O365 to get confirmable result from /me/people?
How long does this function take to reflect changes from Office 365?
Being in the same security group isn't a relevant "communication and collaboration pattern" or "business relationship". Until you have sufficient activity between these users, they will not show up in the result. Try editing the same document, emailing each other, etc. and they will begin to show up.

Incremental searching only from your follower in twitter API

Is there a smart way using Twitter API to quickly incremental search twitter users only from your followers?
For example, there is user Alice who is followed from one million users. One day, Alice wanted to send a DM to another user which is one of her followers, but she only remembered that the name of him/her starts from the letter 'Bo'. So she wants to filter her one million users name with prefix 'Bo'.
How can Alice get all users using Twitter API, which name starts from 'Bo'?
Method 1. Call followers/ids 200 times and filter : Since followers/ids can get only 5,000 followers at a time, you should call followers/ids at least 200 times to get all one million followers. After that, you filter the users by name which starts from 'Bo'. This IS extremely slow because the filtering never starts until the 200 requests end. It's scalability is poor because it uses lots of memory to save and filter loaded follower list for each user.
Method 2. Call users/search many times and check if they're following me : Unfortunately, only the first 1,000 matches are available. Matches over 1,001 will never appear as your followers.
I want to know if there is a better way than this. The following 2 methods are too stupid.
P.S.
Lady Gaga seems to be followed by 28 million users. https://twitter.com/ladygaga

How do social networking websites compute friend updates?

Social networking website probably maintain tables for users, friends and events...
How do they use these tables to compute friends events in an efficient and scalable manner?
Many of the social networking sites like Twitter don't use an RDBMS at all but a Message Queue application. A lot of them start out with a already present application like RabbitMQ. Some of them get big enough they have to heavily customize or build their own. Twitter is in the process of doing this for the second time.
A message queue application works by holding messages from one service for one or more other services. For instance say service Frank is publishing messages to a queue foo. Joe and Jill are subscribed to Franks foo queue. the application will keep track of whether or not Joe or Jill have recieved the messages and once every subscriber to the queue has recieved the message it discards it. Frank fires messages and forgets about it. Joe and Jill ask for messages from foo and get whatever messages they haven't gotten yet. Joe and Jill do whatever they need to do with the message. Perhaps keeping it around perhaps not.
The message queue application guarantees that everyone who is supposed to get the message can and will get the message when they request them. The publisher can send the messages confident that subscriber can get them eventually. This has the benefit of being completely asynchronous and not requiring costly joins.
EDIT: I should mention also that usually the storage for these kind of things at high scale are heavily denormalized. So Joe and Jill may be storing a copy of the exact same message. This is considered ok because it helps the application scale to billions of users.
Other reading:
http://www.rabbitmq.com/
http://qpid.apache.org/
The mainstay data structure of social networking sites is the graph. On facebook the graph is undirected (When you're someone's friend, they're you're friend). On twitter the graph is directed (You follow someone, but they don't necessarily follow you).
The two popular ways to represent graphs are adjacency lists and adjacency matrices.
An adjacency list is simply a list of edges on the graph. Consider a user with an integer userid.
User1, User2
1 2
1 3
2 3
The undirected interpretation of these records is that user 1 is friends with users 2 and 3 and user 2 is also friends with user 3.
Representing this in a database table is trivial. It is the many to many relationship join table that we are familiar with. SQL queries to find friends of a particular user are quite easy to write.
Now that you know a particular user's friends, you just need to join those results to the updates table. This table contains all the user's updates indexed by user id.
As long as all these tables are properly indexed, you'd have a pretty easy time designing efficient queries to answer the questions you're interested in.
Travis wrote a great post on this ,
Activity Logs and Friend Feeds on Rails & pfeed
For the small scale doing a join on users.friends and users.events and query caching is probably fine but does slow down pretty quickly as friends and events grow. You could also try an event based model in which every time a user creates an event an entry is created in a join table (perhaps called "friends_events"). Thus whenever a user wants to see what events their friends have created they can simply do a join between their own id and the friends_events table and find out. In this way you avoid grabbing all a users with friends and then joining their friends with the events table.

Resources