Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Problem summary:
We are developing an App and want to give our users an easily memorable ID to share items in a fast fashion.
Problem detailed:
We are currently uniquily identifying items by the automatically generated ID's from MongoDB. Unique ID's in MongoDB are long and hard to remember. We would like to give our users easily memorable ID's to easily share items with other users.
For example an element in the App needs to be worked on, telling a colleague to go to ourapp.com/a7wefweg43tr is a pain in the ass, what we would like is to in addition to the unique id to technically identify the element within the app a more human readable / memorable unique id for sharability. (Very similar to what Jira is offering (AA-0001, etc.)
Are there best practices on how to implement this / any JS libraries that would do the job ?
If you can have a central service that you would call out to to generate unique IDs, do that and in this service implement any pattern for ID generation you like. MongoDB IDs are designed to be generated by non-communicating clients in a manner that is as collision-free as possible.
human-readable and technical unique are on the opposite end of the same road ... why not let the creator of the ticket type in a human-designed short-tag, check if already existing and provide a slightly extended version if already used. like account-creation in online-games.
if no context between item and id is needed ... put in a dictionary of common-words, create a new random tripple of these words, check if already existing, repeat if already used. easy to memorize and tell by phone. like the military spelling alpha-zulu-tango
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Me and my friends have been enjoying the game among us, as most of you have as well. We had a lot of free time and made a IRL version that was really fun but could be even better with the help of a program that does the following (Before reading these I want to express that I don't need answers to every little detail but just want a direction to follow or a tool to help me achieve these functions) .
has the ability to create and and join lobbies based off a code given (kinda like among us).
can randomly pick 2 people out of the amount joined and assign them the imposter role.
can distribute a togglable amount of tasks per player(tasks being just like strings of text for those who haven't played). Now the issue I have is I could make all these features in unity, (except the lobby system at the moment) but there's no good way to get everyone the app on their iPhone.
So my question is this, where do I go to create all these features?, especially the lobby system. I Know I've asked a lot, but I would greatly appreciate feed back and answers to help me learn how to create a website like this. Thank you all so much for reading and I look forward to seeing responses.
For #1, what you're looking for is a web socket. There are lots of good articles online that will explain what a web socket is in depth, but web sockets are commonly used for chatrooms or any scenario where the server wants to push updates to one or more clients.
If you're wanting to make this a web project, I'd recommend using socket.io, which you can use as a javascript library.
For #2 and 3, you can also construct the logic using javascript. Try studying OOP (object oriented programming) - you could assign different data attributes indicating imposter or not and the togglable tasks assigned per person.
You could use socket.io, phaser and node.js. They all look like good tools for creating a multiplayer online game
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Basically my application will allow you to publish news while it will handle a system of likes and dislikes
I will use the mongodb database.
Basically I will have a collection that will contain news and an attribute called likes, and another called dislikes. Both will store an array and this array will be filled with json objects with the users who have registered a like or dislike respectively.
when a user makes a request to the news list I will return the news and two attributes like: true / false, dislike: true / false according to the user making the request.
is this the best way? how does facebook do it?
Thanks a lot
As a general rule of thumb:
If you don't need the usernames of the users liking the posts, just store the like and dislike counts as integers in an object.
If you need the usernames, store all the users who liked and the users who dislike in separate arrays.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am building a single page app.
The app has a list of 7000 ports stored in a MongoDB database.
I need to be able to search for those ports with autocomplete on the search.
Should I Ajax the autocomplete results ?
OR
Should I retrieve the whole collection of ports, store it in a variable, plug my autocomplete on this array ?
What's the best practice ?
What's the smartest performance wise ?
Because you said the list can grow I would not load the whole list into your app. This could lead to performance issues if your list becomes too big.
I would solve this problem in this way:
Make a route on your webservice, which returns lets say the top 10-20 results matching your search.
On input send a GET request to your endpoint.
To improve performance you could cache the list in an in-memory database like Redis to avoid slow database-access on every request.
Best practice and smartest performance wise is to:
Send the search string to an API resource, example:
/autocomplete?search=portname1
Retrieve the autocomplete results and visualize them
You can use existing JS libraries for autocomplete (avoid discovering the hot water)
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
So this is all more theoretical since I am sorta planning ahead here but I have a generic Parse User class that I am trying to impliment a sort of search function so one user could search for his friends user.
My initial plan was to use the Parse Query contains method to find all the users who contain 'xxx' characters in their name. However.. I noticed that parse noted this would be slow with a large database.. ideally my hope for the app would be to have thousands of users. I Know that can sound a bit ambitious but that is what I am thinking.
Is parse just not the right platform for this?
I had thought about downloading all the user objects and then using local code to filter through them quickly but that surely couldn't be faster.
Would love to hear your guys thoughts!
Your idea could work, but it could be slow. You can do some things to make it a bit faster, but contains is always going to be slow for the server to do. If you can change to 'begins with' instead of contains that will be faster. Exact matches should be faster again.
If you limit the search results that would help. So, as the user types, don't make any request to the server until 3 characters have been typed, and set the query limit to 5 results. Ideally also add a timer so if the user types a fourth character within 1 second the request isn't made. If the request is made and another character is typed cancel the current request before making a new one.
As more characters are typed in you could extend the limit to get more results.
Definitely don't download everything and search locally. Your users should also only really be accessible to cloud code because it can use the master key (your users should have an ACL which denies access to other users).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have more than a million chat records of data in the format of
chat_message
city
timestamp
Now, we need to check for keywords related to travel like "travel" or "accomodation" or "hotels" etc. Let us say we have gathered around 15 keywords related to travel.
Requirement is to mine the chat message related to travel using the keywords. how?
Solution I can think of - Have an array of travel related keywords. Then scan through all the messages for each keyword(some string matching algo).
I think the solution is pretty brute force, any more ideas on a more efficient algo to search, or set up of the chat-records or/and keywords?
You mileage may vary.
If your host language is JavaScript, I recommend you to use some full-text search engine, such as lunrjs.It requires pre-processing your raw data, for example, tokenization, stemming and indexing. And then you can search data more conveniently.
Still, your data set is quite large, at least for browsers(since you are using JavaScript). If you are going to implement this on client side, many details other than algorithm need to be taken into consideration. Memory allocation, data transferring, not to list.
However, if you are on server side, more mature solutions like ElasticSearch worth your consideration.