1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
public static Map<String, String> getLatitudeLongitudeByAddress(String completeAddress) { try { String surl = "https://maps.googleapis.com/maps/api/geocode/json?address="+URLEncoder.encode(completeAddress, "UTF-8")+"&key="+API_KEY; URL url = new URL(surl); InputStream is = url.openConnection().getInputStream(); BufferedReader streamReader = new BufferedReader(new InputStreamReader(is, "UTF-8")); StringBuilder responseStrBuilder = new StringBuilder(); String inputStr; while ((inputStr = streamReader.readLine()) != null) responseStrBuilder.append(inputStr); JSONObject jo = new JSONObject(responseStrBuilder.toString()); JSONArray results = jo.getJSONArray("results"); String lat = null; String lng = null; String region = null; String province = null; String zip = null; Map<String, String> ret = new HashMap<String, String>(); if(results.length() > 0) { JSONObject jsonObject; jsonObject = results.getJSONObject(0); ret.put("lat", jsonObject.getJSONObject("geometry").getJSONObject("location").getString("lat")); ret.put("lng", jsonObject.getJSONObject("geometry").getJSONObject("location").getString("lng")); logger.info("LAT:"+lat+";LNG:"+lng); JSONArray ja = jsonObject.getJSONArray("address_components"); for(int l=0; l<ja.length(); l++) { JSONObject curjo = ja.getJSONObject(l); String type = curjo.getJSONArray("types").getString(0); String short_name = curjo.getString("short_name"); if(type.equals("postal_code")) { logger.info("POSTAL_CODE: "+short_name); ret.put("zip", short_name); } else if(type.equals("administrative_area_level_3")) { logger.info("CITY: "+short_name); ret.put("city", short_name); } else if(type.equals("administrative_area_level_2")) { logger.info("PROVINCE: "+short_name); ret.put("province", short_name); } else if(type.equals("administrative_area_level_1")) { logger.info("REGION: "+short_name); ret.put("region", short_name); } } return ret; } } catch (Exception e) { e.printStackTrace(); } return null; } |
Assuming that you know how to make a web server with TidHttpServer, but now you need to put your server in HTTPS, so to do that you need to add to your application the TIdServerIOHandlerSSLOpenSSL and set it as the IOHandler of your TidHTTpServer. IMG IOHANDLER Now you need a valid and unique certificate, to…
Read more
A new version of Remode Server is ready for Mac,Windows and Android!!! You can download the manger and have more information following this link: Remode server official page Whats new: – Extended the web interface, settings and the serail console is integrated in the the Web Admin page – Fixed a problem with camera on…
Read more
I found this procedure on Stackoverflow (http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication) that allow clear authentication saved in the browser for your site:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
function ClearAuthentication(LogOffPage) { var IsInternetExplorer = false; admin = 'n'; try { var agt=navigator.userAgent.toLowerCase(); if (agt.indexOf("msie") != -1) { IsInternetExplorer = true; } } catch(e) { IsInternetExplorer = false; }; if (IsInternetExplorer) { // Logoff Internet Explorer document.execCommand("ClearAuthenticationCache"); window.location = LogOffPage; } else { // Logoff every other browsers $.ajax({ username: 'unknown', password: 'WrongPassword', url: '/', type: 'GET', beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", "Basic AAAAAAAAAAAAAAAAAAA="); }, error: function(err) { //alert(window.location.protocol + '//xxxx:xxxx@' + window.location.host + ':' + window.location.port + LogOffPage); window.location = window.location.protocol + '//xxxx:xxxx@' + window.location.host + LogOffPage; window.location = window.location.protocol + '//' + window.location.host + LogOffPage; } }); } } |
i tried it on chrome and firefox and function as aspect:
1 |
<div class="rcbtn" id="rcdown" onclick="ClearAuthentication('/index.html')">Back to main page</div> |
From 13 September 2016 will be available the iOS10… also the iPhone7. for specific information you can visit the Apple link: https://developer.apple.com/ios/ In few words there are some news, most important for me are: 1) API/SDK to integrae “Siri” in your application 2) Proactive suggestions: iOS 10 introduces new ways to increase engagement with your…
Read more
http://blog.marcocantu.com/blog/2016-august-linux-25-delphi-coming.html