#Create your own map with OpenStreetMap
This is some note of me playing with OpenStreetMap and creating an Android app that renders the map drawn.
##Draw a map
###Get GPS trace
If you want to draw your own map, OpenStreetMap
#Create your own map with OpenStreetMap
This is some note of me playing with OpenStreetMap and creating an Android app that renders the map drawn.
##Draw a map
###Get GPS trace
If you want to draw your own map, OpenStreetMap
//http://www.geeksforgeeks.org/sorted-array-to-balanced-bst/ | |
//is the better solution(return created node, instead of a separated | |
//insert operation). | |
//Note here int mid = (int)Math.floor(n / 2); is used to get the middle | |
//node instead of int mid = (start + end) / 2;, resulting right middle | |
//node is selected when there is even number of nodes in the array. | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; |
function all(promises) { | |
return new Promise(function(success, fail) { | |
// Your code here. | |
function promiseThen(i) { | |
return promises[i].then(function(res) { | |
//we should return the res here. | |
//push into results here won't work, since | |
//promises here settles at different time | |
//and elements in results will be out of order. | |
return res; |
//Ref: | |
//https://developers.google.com/web/fundamentals/getting-started/primers/promises | |
function requestAuthor(type) { | |
return new Promise(function(resolve, reject) { | |
var req = new XMLHttpRequest(); | |
req.open("GET", "http://eloquentjavascript.net/author", true); | |
req.setRequestHeader("accept", type); | |
req.onload = function() { | |
if(req.status == 200) { |
var playerSprites = document.createElement("img"); | |
var extraCanvas = document.createElement("canvas"); | |
var extraCx = extraCanvas.getContext("2d"); | |
playerSprites.src = "img/player.png"; | |
playerSprites.addEventListener("load", function(event) { | |
var width = playerSprites.width; | |
var height = playerSprites.height; | |
extraCx.scale(-1, 1); | |
extraCx.translate(-width, 0); |
<!doctype html> | |
<style> | |
.trail { /* className for the trail elements */ | |
position: absolute; | |
height: 6px; width: 6px; | |
border-radius: 3px; | |
background: teal; | |
} | |
body { |
/* | |
* Copyright (C) 2010 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
//bionic/libc/stdio/stdio.c | |
int | |
__sread(void *cookie, char *buf, int n) | |
{ | |
FILE *fp = cookie; | |
int ret; | |
ret = TEMP_FAILURE_RETRY(read(fp->_file, buf, n)); | |
/* if the read succeeded, update the current offset */ | |
if (ret >= 0) |
#!/usr/bin/python | |
''' | |
Copyright 2009, The Android Open Source Project | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |