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 9 years ago.
Improve this question
I'm making an app and need to store several collections which refer to each other and I want to use JSON.
A little background info. the app will allow the user to create a plan/map of a garden, dividing it into different areas for each category. Then plants can be chosen for each category to grow in that area of the garden. Based on the idea that you can rotate the categories each year to a different part of the garden.
I have the following collections:
categories (in this case type of vegetables/ fruit)
plants (refer to a category)
spaces which contain an array plant ID's
So what would be best practice? store these in 3 separate files or in one?
Would there be a significant speed difference (on mobile devices perhaps?)
I apologize if this was asked before, I tried searching, but couldn't find what I was looking for.
Related
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
I'm trying to plan out a simple web app. A user is presented with a question that has two or three possible answers. Depending on their answer, they're taken to another question.
i.e.
ChoiceC
ChoiceA ---> Question 2 ---> ChoiceD
Question 1 -->
ChoiceB ---> Question 3 ---> ChoiceE
ChoiceF
This seems to me a like a tree, where each question and answer is a node, and depending on what path you go down, you're exposed to a specific set of other questions/answers.
I'm trying to figure out how to implement this with reusable React components. I could potentially create a component for each question, but that doesn't seem like good practice. Does anyone have any experience building these sorts of 'choose-your-own-adventure' style questionnaires?
You can use a map that saves for every answer what the next question is.
In your case an entry could be [ChoiceA, Question2]. In your program you can then story a variable current_question that gets updated based on your map.
This solution may only be insufficient if the same answer can arise in different contexts and lead to different outcomes. In this case maybe should be a question/answer-pair that determines what comes next.
If you really want to overkill your problem, you can implement a directed labeled graph. The questions would be the nodes in this case and the edge-labels are your answers which lead to the next question/node.
The most pragmatic solution would of course be to don't use a datastructure at all and just stack if-else. This is not scalable though.
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 4 years ago.
Improve this question
I want to know that in order to make a dynamic search application which looks through all the collections and gives the users the ability to use facets, collection facets, pagination, sorting etc what should be the right approach?
I found two functions for this: search:search, and cts:search. Which matches my needs best?
search:search is built on top of cts:search (as well as other APIs). They’re designed to work together. You should start with search:search, though. It is designed specifically for your faceted search use case and includes many conveniences and best practices that might not be obvious with the lower-level APIs, for example, concurrent facet resolution and pagination. If you need to do something more sophisticated than what search:search provides out-of-the-box, you can call out to other libraries.
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 4 years ago.
Improve this question
I need help with creating a survey app. My idea is for the app to display questions and have users click buttons to answer. At the end, the app should show each user which user had answers closest to theirs. I need help with the following things:
*How to set up the questions and buttons for the answers
*How to compare all the answers and show each user at the end
*How to make it so there is a separate url for each survey being taken
Answering any of these questions would be very helpful.
For grouping the participants by how close their answers are, you could use the k-means clustering algorithm, of which there's already a JavaScript implementation you could use.
Well, I don't see where Socket.io fits, other than that you could use Survey.js Library to help you build the interface, store the data in the same format, JSON, in MongoDB. There you can group like here, returning the documents data of same value.
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 6 years ago.
Improve this question
I have two raster with x points on it like this:
I have this data from each raster in a array like this:
[
[200,330],
[500,800]
]
How can i compare this data to figure out how many percent as equal this both grids to each other?
My idea is to generate a hash and compare this both hashes, but i don't have an idea how can i do this.
This idea comes from audio fingerprinting.
I will do this in swift or javascript.
Thanks you for each thought!
What you are looking for is to compute the similarity between two vectors.
In your case the vector looks like: [[x1,y1], [x2,y2], ...,[xn, yn]]
I would recommend Cosine Similarity.
The implementation is pretty straight forward, regardless the programming language.
(There are existing implementation of Cosine Similarity out there, for example In JavaScript)
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 9 years ago.
Improve this question
We are going to display a list of 25-entries on a webpage out of (at least) 5000 entries in the database. The entries should be sortable and you should be able to filter the results according to their names.
In my world, you send a request to the server asking for 25 entries that matches your criterion. However my colleague suggested a different approach; to ask for all 5000 entries and then sort and filter them with JavaScript.
I think that's stupid, but I'm afraid I'm missing something. What would you say are the pros and cons of this two approaches?
Or use AJAX, returning HTML, for the next/ prev paging. That could give you a nice solution.
Then you don't have the white screen, the UI tends to appear more slick & responsive, you can write a nice (clean & simple) server handler & your colleague can be happy writing some JQuery & AJAX.
It keeps the app scalable, to any number of rows, and the UI is more slick & responsive.. which was perhaps the point of the JS idea.