Q:
Retrieve user location from Phone number?
I have a list of phone numbers and would like to have the users location based on the phone number they provide. Is there a way of doing this?
A:
There is no API to get the users location.
However, it is always possible to brute force get the user's location by storing all the street address of the country and looking up the ips of the phones. This approach is less reliable but easier.
The phone book is the only useful source of ips that you can get that's reliable and trusted by the user. There are definitely other methods but I doubt they are highly reliable.
Q:
Shortest path between two points in a 3D Grid
Given a 3D grid of cells, how do I find the shortest path between any two cells in the grid.
Note that paths are allowed to make a U-turn, go backwards, etc.
I've found this video that has an implementation of it, but it's still too slow for my needs.
I've also found a way to use depth-first search to find the shortest path between two points, but I can't see how I can turn it into a 3D grid.
A nice article on the subject:
That article uses Dijkstra's shortest path algorithm, which I have implemented previously.
The article is more or less what you want, although it uses a naive breadth first search approach which can lead to performance problems, especially for grids of any more than a couple of layers.
var parse = require('../');
var test = require('tape');
test('short -k=v', function (t) {
t.plan(1);
var argv = parse([ '-b=123' ]);
t.deepEqual(argv, { b: 123, _: [] });
});
test('multi short -k=v', function (t) {
var argv = parse([ '-a=whatever', '-b=robots' ]);
Related links:
Comentários