private function callNominatim($dLat, $dLon, $iZoom) {
if ($iZoom<10)
$iZoom=12;
$request_url= sprintf("http://nominatim.openstreetmap.org/reverse?format=json&lat=%.6F&lon=%.6F&zoom=%01d&addressdetails=1",$dLat,$dLon,$iZoom);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
def to_dicts(element):
obj = {'tag': element.tag,
'attrs': element.attrs,
'childs': [to_dicts(child) for child in element]}
return obj
void quickSort(int arr[], int p, int r)
{
if (p < r) {
int q = partition(arr, p, r);
quickSort(arr, p, q);
quickSort(arr, q + 1, r);
}
}
int main()
{
for (int n = 2; n <= 10; ++n) {
int arr[10];
for (int i = 0; i < n; ++i)
arr[i] = i;
printf("n = %d\n", n);
do {
int sort[10];
memcpy(sort, arr, sizeof(arr));
quickSort(sort, 0, n);
for (int i = 1; i < n; ++i)
if (sort[i] < sort[i - 1])
printf("!\n");
} while (std::next_permutation(arr, arr + n));
}
return 0;
}