I making a mobile app similar to facebook as a college project. Problem I am facing is say if I have 25 users and 24 users posted something on the site of which user1 made the first post. Now say the 25th user logs in after two days. Initially I was showing the feeds in FIFO order. But if I keep using FIFO, 25th user wont be able to see the last post unless he has undergone all the previous posts first. Same situation in LIFO. If we scale up the app, the problem statement would be huge as there would be some feeds which will never be seen. So how do I tackle this?
I thought of distributing users into groups and show the feeds within the groups first, and then to the neighbouring group and so on.
PS: I am using meteorjs for building the app.
So I have distributed the users into groups. I have attached a tag with every feed saying user from which group posted it.
Now I sort the feeds according to date-time at which they were created. Then I group them according to their user groups. Then I sort the feeds according to the no.of views (sorting within the group only).
Now I keep the sorted data as a list. To show the feeds to the user, I am trying to use trees. Say a user belonging to group 4 logs in. So I would use the group 4 data as node and create a binary tree. Then I would show all the feeds in the head first, then do a bfs traversal to show the feeds on the leaves.
Is there any other better method to make sure that every feed is seen atleast once by any user
So what I could think of is that you can divide the users into groups firstly. Then show the feeds from the same group. But show only new feeds here. Then show the feeds from neighbouring groups and move on. Then show the old feeds in the same manner.
Related
I am looking for a very quick solution to solve the following problem:
On a web server it should be possible that a user can vote there for another user. So one user can always vote for another. This happens by sending a POST /vote/:id. This vote must now move into a list from all already made votes of other users.
This list of the ranking of the already voted users, should then put the user with the most votes on place one. The one with the second most votes on place 2 and so on.
Currently I use Redis for this and save the selected user id in a hash for each user id.
My problem now is to find out in this ranking list of the elected users, to which place now one or more users must be moved, whenever a new election arrives.
How can I know on which number to place the user that has just been elected, out of all those already elected?
What is the fastest and most efficient solution for this?
Currently I was thinking of a Redis List that would then allow me to record the placement with the user id and then filter by that. But is a complexity of O(n).
I'm building a graphql schema through AWS AppSync and have a question regarding schema structure. My app will show users new posts and have them either join or pass on them. I'm trying to build in a way that I will only show users new posts and not repeat or at least not repeat for a certain amount of time. It's similar to swiping on tinder, they don't show you somebody again if you've already swiped on them. Does anybody have any ideas how to structure this in my schema. Do I need to store references to all of the seen posts in the user model or should I store each swipe as its own model and how should I structure the querying? I'd appreciate any advice on this.
Thanks!
Assuming a post has a creation time, you could keep track of the last (max created time) post they've seen, then display anything after that.
But think about what happens if they've been off the app for 5 minutes, or 5 days, or 5 weeks... depending on the volume of posts you anticipate they could quickly get behind and have to wade through too many older posts.
One thought would be to show the next oldest post, based derived from the creation time of the most recent post they viewed. Unless N number of posts were created since the last time they were online (a threshold you'd have to decide). Then start with displaying the N - Xth post (where X is 5, or 500, again depending on volume) until they're all caught up.
There are lots of ways you could program it, it all depends on your use case, you may want to take "popular" posts into account for example, those might be weighted above/before the other posts in their backlog.
Hope this helped.
I have been writing an Square Connect integration that rests on the fact that an item has one and only one ID, even when it is present in multiple locations. After testing with a subset of products on a separate Square account/App, things were working smoothly. I have now pointed the integration at the "real" Square account/App, using that account's credentials, which contains the same subset of products in addition to many others, and the integration is failing. It seems I have many items that now have a unique ID for each location. This means that a single item has multiple IDs. The item only displays once in the Square dashboard, but there are two unique IDs associated with it. In fact, I have one item that has two IDs, yet those IDs share a single variation ID.
I have also noticed two different formats of IDs, which from my research sounds like a variation due to information created pre- and post- a certain date.
Format 1: XXxXxXXX-xxXX-XxXx-XXX-XXXxxxxxxxXX
Format 2: XXXXXXXXXXXXXXXXXXXXXXXX
I suppose the first question is, is this normal behavior? And if not, any thoughts on what might be causing it and is there a way out of it?
There are some nuances to items with older accounts. Items were originally scoped to a location, which doesn't quite make sense with larger multi-location businesses. Internally we are migrating to a location independent item catalog, which should be invisible to you as an end user (save for the change in formats, like you mentioned) and depending on the date of your account it might have a mix of "old" and "new" item ids. It seems like you have basically a "new" location and an older one.
Basically in our current model you are only guaranteed that items will have unique ids within a location. We are working on new APIs that will allow you to manipulate items across locations more easily.
Lets say we have a website with posts.
The information we can get is:
post_time (from site launch)(doesn't change)
post_rating (changes over time)
number_of_comments (changes over time)
what would be a good formula in order for the website to keep fresh and good posts at the top without seeing the same post at the top again.
I figured I should give "weights" to each of the fields above, where
post_time will have the heaviest weight.
What kind of sorting does 9gag use for instance?
the difference between post_time can vary between 1 second and minutes/hours
edit:
Clarification:
I have a database where I keep all of this information, what I need
is a formula that will keep the posts page up to date and a user that logs now and in 20 minutes will see different posts.
Ok so the simplest way I found is as follows:
Add an additional DATE field to the Posts SQL table that is called top_date
Select from the posts table all highest ratings that has top_date NULL
update top_date of a wanted post with current time stamp
now the posts page will use DESC by top_date.
also there can be a function that will be called every few minutes that will
gather the top rating (RATING ONLY) posts without top_date and randomly choose
one to be updated.
If i was unclear feel free to ask any question here or in private message.
In Mailchimp is I click on a user I can see which group they belong to under the details tab but I can't see which segment they belong to. Is there a way to check which segment they are in?
Also is their a difference between customer groups & groups?
As some users are in a customer group (i.e. General, Wholesale, Retailer, Not Logged In) which are not in the list of groups we created under manage list.
There is no way to check what segment someone is in based on their profile. Segments are what you create to organize your subscribers. You can create segments based on group criteria to keep track of what user is in what segment, but you can't directly see each segment a subscriber is in. A subscriber can be in an infinite number of segments, and some segments can even be created on the fly when setting up a campaign.
I'm not sure I can answer the second part of the question. I don't think customer groups is something native to Mailchimp. Perhaps it's a merge tag you created? These would be used in signup forms and in the body of your emails.