Cannot draw proper route for the google maps api for android v2 - google-maps-android-api-2

I am not able to draw the correct route between two places using the new version of the api?..After going through a lot of research I found that by using the polyline data out of the directions api will help me and indeed it did as I was able to draw it. But its avoiding slight turns by just adding a straight line.How can I draw a correct path?..

Try this,
final Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?" + "saddr=" + source_lat
+ "," + source_lon + "&daddr=" + destination_lat + ","+ destination_lat));
intent.setClassName("com.google.android.apps.maps",
"com.google.android.maps.MapsActivity");
((Activity) this).startActivity(intent);

Related

How to clear state in botkit 4 conversation

We have built a bot using botkit v4 and we are using it with Facebook messenger.
We want to clear the state on a specific facebook_postback.
I tried the following but nothing is working.
bot.controller.storage.delete(message.user)
I did not find any proper references in the documents as well. any help will be appreciated.
Ref: https://learn.microsoft.com/en-us/javascript/api/botbuilder-core/storage?view=botbuilder-ts-latest#delete-string---
Storage.delete method takes a list of identifiers, so correct syntax is
bot.controller.storage.delete([itemId]);
Also you need to discover correct format for itemId,
I have an example from websocket controller and it looks like this:
websocket/conversations/USERID-USERID/
The final syntax would look like this:
const itemId = 'facebook/conversations/' + message.user + '-' + message.user + '/';
await bot.controller.storage.delete([itemId]);

using $driver->send_modifier() call with Perl Selenium::Remote::Drive package

Has anyone had any luck using $driver->send_modifier() call with Perl Selenium::Remote::Drive package?
I am trying to perform an operation with the "ALT + $key", example: Alt + x
I am also facing issues with send_modifier, but a work around that i use for now is as follows.
use Selenium::Remote::WDKeys;
....
my $element = $driver->find_element_by_id('id_of_element_to_receive_alt_x');
$element->send_keys(KEYS->{'alt'}, 'x');
Hope this helps.

Is there any way to embed the GitHub Issue Tracker in a webpage?

I'd like to put it in the Progress section of my project's webpage. I tried using an iframe, and I tried using $.load(), but neither of these work.
Any ideas?
If you don't need all the feature from the native GitHub issues page, you could consider listing those issue to generate your own include/presentation.
See "possible to embed Github list of issues (with specific tag) on website?"
Kasper Souren proposes below in the comments the following fiddle:
var urlToGetAllOpenBugs = "https://api.github.com/repos/jquery/jquery/issues?state=open&labels=bug";
$(document).ready(function () {
$.getJSON(urlToGetAllOpenBugs, function (allIssues) {
$("div").append("found " + allIssues.length + " issues</br>");
$.each(allIssues, function (i, issue) {
$("div")
.append("<b>" + issue.number + " - " + issue.title + "</b></br>")
.append("created at: " + issue.created_at + "</br>")
.append(issue.body + "</br></br></br>");
});
});
});
Look at https://github.com/serverless/scope which is based on serverless configuration, uses Amazon DynamoDB framework and github webhook service to fetch issue stats (open, close, comment, labels, milestones, etc.) and pull requests. It's well documented and allows several configurations, including embedding to one's website. I have just tried it and works well so far!

Reading OSM Map (or other format) files to determine shortest distance from coordinate to path

My App uses openstreetmap files to show waypoint (or coordinates) on a map.
Based on an Openstreet map file: how can I determine the shortest distance from a GPS coordinate to the (walking) path.
Can I read an OSM (map) or .osm file ... to access the paths?
There are some misconceptions. First, the OSM file is not the map file. The OSM file can be used to create a format to make map rendering fast e.g. mapsforge format does this.
With e.g. GraphHopper you import the OSM file like .pbf or .osm which then creates a graph which can be used for problems you described. Not exactly sure what problem you have though ;)
The following solution works:
Get the graphhopper project in your IDE.
Get the raw Openstreetmap data (.pbf) via this very nice provider.
Run this command in your (git) bash shell: ./graphhopper.sh -a import -i gelderland-latest.osm.pbf
Make a new (maven) project with this pom.xml file:
nl.xyz
graphhopper
1.0
system
${project.basedir}/libs/graphhopper-web-1.0-SNAPSHOT.jar
Copy generated graphhopper-web-1.0-SNAPSHOT.jar from the graphhopper project to the libs folder of your new project so it will be included in your path.
Copy the generated graphhopper data to a folder within your small project.
Create this simple demo:
public static void main(String[] args) {
private static String mapsFolder = "graphhopper-data/yourlocation-latest.osm-gh";
GraphHopper graphHopper = new GraphHopper().forMobile();
graphHopper.load(mapsFolder);
System.out.println("Found graph " + graphHopper.getGraphHopperStorage().toString() + ", nodes:" + graphHopper.getGraphHopperStorage().getNodes());
QueryResult queryResult = graphHopper.getLocationIndex().findClosest( 52.11111, 6.111111, EdgeFilter.ALL_EDGES);
double distance = queryResult.getQueryDistance();
System.out.println( "Shortest distance is: " + distance);
}
UPDATE: Using the JAR on Android may give a lot of compiler errors due to library version mismatchers. A better solution for getting this example run at Android, is using this dependency in your build.gradle:
implementation 'com.graphhopper:graphhopper-core:1.0-pre33'
Consequence is that you have to set the default routing profile. You can achieve via this change:
graphHopper = new GraphHopper().forMobile();
// Next line:
graphHopper.setProfiles( Collections.singletonList(new ProfileConfig("my_car").setVehicle("car").setWeighting("fastest")));
graphHopper.load(routingDataFolder);
I hope you enjoy this wonderful 'graphhopper' software!

Error in loading file with same name

I am using below script for uploading a file in alfresco but it refuses to create stating conflict.
"<?xml version='1.0' encoding='utf-8'?>\n" +
"<entry xmlns='http://www.w3.org/2005/Atom' xmlns:app=\"http://www.w3.org/2007/app\" xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\" xmlns:alf=\"http://www.alfresco.org\">\n" +
"<title>" + fileName + "</title>\n" +
"<summary>" + fileDescrption + "</summary>\n" +
"<author>" + author + "</author>\n" +
"<content type='" + mimeType.toString() + "'>" + encoder.encode(bytes) + "</content>\n" +
"<cmisra:object>\n"+
"<cmis:properties>\n" +
"<cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">\n"+
"<cmis:value>D:hs:doc</cmis:value>\n"+
"</cmis:propertyId>\n" +
"<cmis:propertyId propertyDefinitionId=\"cmis:versionable\">\n"+
"<cmis:value>TRUE</cmis:value>\n"+
"</cmis:propertyId>\n" +
"</cmis:properties>\n" +
"</cmisra:object>\n" +
"</entry>\n";
how can i enable versioning using cmis rest .
I agree with Gagravarr that you will save yourself a lot of time and frustration by using one of the libraries available at http://chemistry.apache.org or some other source.
However, the answer to your question is that it sounds like you are trying to create a new object with the same name in the same folder as an existing object. Alfresco does not allow this, hence the error.
Instead, what you need to do is update the existing object. You are using the AtomPub Binding so if what you want to do is update the content stream, you can do a PUT on the content stream's URL.
If instead you are trying to update the properties, you can do a PUT on the object's URL.
This will change the object without creating a new version. If you instead want to create a new version, you need to check out the object (POST the object to the checked out collection) which will return the Private Working Copy (PWC). You can then set the content stream and update the properties on the PWC as noted above, then you can do a checkin. This will create a new version.
Note that if Alfresco hands you a change token you need to hand it back when performing these kinds of updates or you will get an update conflict exception.
If you need specifics on how to do any of this, read the spec. If you want a friendly API to do this rather than dealing with low-level AtomPub XML, PUTs, POSTs, and DELETEs, then grab a CMIS library.