I building a similar check-in system like foursquare. I have a tables with list of locations with lat,lng. User on mobile will send a request to find location near their position with radius about 5km. How to achieve that? Are there any best practice model?
This is ideally done using a geospatial indexing system.
To make it easier on yourself, use a database with one of these built-in. MongoDB is a common example.
It allows you do perform this type of query in a similar way to other types of database queries without requiring a separate system to do the indexing (such as solr, or postgis).
See the documentation for more information:
http://www.mongodb.org/display/DOCS/Geospatial+Indexing
Related
I'm using neo4j enterprise edition, and I found neo4j have no user data access control strategy, such as on user can grant some data's read/write permission to other user?
I found this: https://neo4j.com/docs/operations-manual/3.4-preview/security/authentication-authorization/subgraph-access-control/
The title is "Subgraph access control" but the content is control procedure's execution permission. It look likes have no relation with subgraph's access control...
I also found some people said that writing code to implement interface SecurityRole can resolve the problem, I can't found more information about this, is this right?
Thanks!
Subgraph access control is about restricting a user's ability to access the graph so that they can only go through the procedures granted to them. The code in the procedures should encapsulate the kind of queries you want them to be able to use, so either the procedures contain the queries in full, or it allows queries but performs filtering at some level.
While this can work, it may not have the right granularity for what you're trying to do, and it is a somewhat clunky approach.
Additional work is being done to fill in those gaps.
In the upcoming Neo4j 3.4, you will have the ability to restrict access to properties of nodes, though this is across all nodes, not just nodes of certain labels, and it will rely on a blacklist that is defined in the neo4j.conf file, so (at this point) requiring a restart to change which roles are blacklisted from accessing certain properties (though you should be able to grant roles to users through procs as usual, no restart needed).
There's more work to be done on this of course, it's just a matter of feature prioritization, so richer options are likely to be introduced in later releases.
Our SQL Server database has a huge number of data in different tables (millions of records) and we are populating the data using paging in the UI. Data is dynamically added and updated. Now I am planning to implement realtime filtering/searching of the data. The UI will have a text box where user types search keyword and the rows in the grid should be refreshed based on the search string as a typeahead functionality. I am thinking to use azure search as one of the candidate for implementing this functionality. But we are not on cloud yet and I have to justify my team if we had to go through this route.
Are there any other products or methods that can help in achieving this? I am still doing research on this. But if anyone has already implemented a solution like this, I would like to know more about your recommendations.
I recently started using https://datatables.net, and it's been a good experience.
Otherwise, you'll probably have to roll your own solution that keeps track of page and filter criteria on the client side and makes Ajax calls whenever they're altered. Your endpoint would need to take the page and filter as parameters, perform the necessary query of the data, and return the desired records.
My rails application revolves around searching for 1 specific record given various filters. I'm trying to figure out what's the best way to keep track of search queries so in the future we can either do reporting or a dashboard. Basically I need insight into what users are looking for.
This is what a search query would look like:
http://localhost:3000/s?utf8=%E2%9C%93&location=New+York%2C+NY%2C+United+States&activity=Figure+Skating&start_time=Nov+13th+2015&end_time=Dec+25th+2015&period=morning&geolocation=%5B40.7127837%2C-74.00594130000002%5D
cleaner:
http://localhost:3000/s?utf8=%E2%9C%93&location=&activity=&start_time=&end_time=&geolocation=
You can add a hook in your search controller method that stores the params used in every search. Perhaps you can create a new model called Analytics, where every time someone searches for something the Analytics stores all the values of the search... that way you can have all the information stored in your db and you can analyze it.
The easiest way would be to track this via the Google Analytics:
https://support.google.com/analytics/answer/1012264?hl=en
so I developed a small Neo4j database with the aim of providing users with path-related information (shortest path from A to B and properties of individual sections of the path). My programming skills are very basic, but I want to make the database very user-friendly.
Basically, I would like to have a screen where users can choose start location and end location from dropdown lists, click a button, and the results (shortest path, distance of the path, properties of the path segments) will appear. For example, if this database had been made in MS Access, I would have made a form, where users could choose the locations, then click a control button which would have executed a query and produced results on a nice report.
Please note that all the nodes, relationships and queries are already in place. All I am looking for are some tips regarding the most user-friendly way of making the information accessible to the users.
Currently, all I can do is make the users install neo4j, run neo4j every time they need it, open the browser, run the cypher script and then edit the cypher script (write down strings as locations) and then execute the query. This makes it rather impractical for users and also I am worried that some user might corrupt the data,
I'd suggest making a web application using a web framework like Rails, especially if you're new to programming. You can use the neo4j gem for that to connect to your database and create models to access the data in a friendly way:
https://github.com/neo4jrb/neo4j
I'm one of the maintainers of that gem, so feel free to contact us if you have any questions:
neo4jrb#googlegroups.com
http://twitter.com/neo4jrb
Also, you might be interested in look at my newest project called meta model:
https://github.com/neo4jrb/meta_model
It's a Rails app that lets you define via the web app UI your database model (or at least part of it) and then browse/edit the objects via the web app. It's still very much preliminary, but I'd like to be able to things like what you're talking about (letting users examing data and the relationships between them in a user friendly way)
I general you would write an tiny (web/desktop/forms-)application that contains the form, takes the form values and issues the cypher requests with the form values as parameters.
The results can then be rendered as a table or chart or whatever.
You could even run this from Excel or Access with a Macro (using the Neo4j http endpoint).
Depending on your programming skills (which programming language can you write in) it can be anything. There is also a Neo4j .Net client (see http://neo4j.com/developer/dotnet).
And it's author Tatham Oddie showed a while ago how to do that with Excel
I need to keep track of the users lat/lng/city/country for my application with the following two requirements:
1) Get the users lat/lng/city/country automatically. (This is easy, I can use the ip or if they have a browser that supports geolocation, even better).
2) The user is allowed to customize this location (maybe the ip address lookup didn't give an accurate city). The location is a freeform text field (not a dropdown). When the user enters a new location it should be validated against available cities/countries. If it validates against any one of them, select it and then retrieve the latlng for the new location. (This is what I'm having trouble with)
Also to clarify, this is a Rails 3 app using MongoDB. I am looking for either a single API or database that would allow me to do both (1) and (2). Has anyone done anything similar? Looking for some ideas as to how others have done this.
Your question isn't entirely clear as to what problem you are having. In general terms, I would do it like this:
have a Location model that stores location name and coordinates
when the user enters a location, send an Ajax request to look it up
if it's found, set the location in the session
if it isn't found, return a list of similarly named locations (in case there was a typo) and let the user choose one or stick to their input
when they are done with the input, insert a new location if required and store User.location_id.
You could use Google's Geocoding API to look up the coordinates of unknown locations.
I would recommend the Geokit Gem, it does a very nice job of providing a front end for several Geocoding APIs. I highly recommend sticking with Yahoo or Google, just for sheer data integrity issues.
There is a rails plugin, that adds some nice helpers to Activerecord. At the moment the main project is not rails 3 compatible, but there is at least one fork that has updated for rails 3.