location

Redirect User to different Website Based on Location (IP Address)

旧城冷巷雨未停 提交于 2019-11-30 04:01:37
How to redirect user visiting my sites to location specific sites using the IP Address. I have 3 location specific sites. 1. Europe. 2. US. 3. Asia. In short I wanted to find the location of the client using his IP Address. The solution needs to use Google APIs. I got the solution using "google.loader.ClientLocation" here is the code for that if somebody needs it. Check this JSFiddle http://jsfiddle.net/kvishnudev/7Ut65/1/ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Get web visitor's location<

How can whatsapp know country code upon first run on iphone

我与影子孤独终老i 提交于 2019-11-30 03:39:42
When I first install whatsapp on iphone, when I open it, the first screen already knows my sim cards location and shows the country code. How does whatsapp know this ? As apple rejects all the apps that use sim card info programmatically. in your .h file you need to: #import <CoreTelephony/CTCarrier.h> #import <CoreTelephony/CTTelephonyNetworkInfo.h> And this function will get the country code: -(NSString*)getCountryDialingCode { NSDictionary *dialingCodes = [[NSDictionary alloc]initWithObjectsAndKeys: @"972", @"IL", @"93", @"AF", @"355", @"AL", @"213", @"DZ", @"1", @"AS", @"376", @"AD", @"244

前端开发掌握nginx常用功能之server&location匹配规则

不想你离开。 提交于 2019-11-30 03:09:56
nginx主要是公司运维同学必须掌握的知识,涉及到反向代理、负载均衡等服务器配置。前端开发尤其是纯前端开发来说对nginx接触的并不多,但是在一些情况下,nginx还是需要前端自己来搞;例如我们公司的开发环境和测试环境,虽然qa可以帮助搞定配置,但是每新增一个前端模块或者模块nginx配置经常变更都求着qa搞,麻烦别人还不如自己来搞,这样更能理解自己的需求。这些都需要前端开发对nginx有所理解,下面我们来说说nginx最基础的server和location匹配规则。 1. server匹配规则 nginx的 server 块可以配置多个,那么一个请求该匹配那个server块呢,这主要是根据server块的 server_name 和 listen 来决定的。其中 server_name 仅仅检查请求的“Host”头以决定该请求应由哪个虚拟主机来处理。 先看一个例子: server { listen 8001; server_name *.net; } server { listen 8001; server_name baidu.net; } server { listen 8001; server_name baidu.*; } 通过测试,发现 相同listen端口 的情况下,多个server的匹配顺序如下: 完全匹配优先级最高,匹配则终止 通配符在前的优先级其次 ,如*

IllegalArgumentException: provider doesn't exisit: null on Maps V1

妖精的绣舞 提交于 2019-11-30 03:04:07
I'm using Google Maps API V1. I have this error : java.lang.IllegalArgumentException: provider doesn't exisit: null This is my code : locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); String provider = locationManager.getBestProvider(criteria, true); if (provider != null) { startTime = System.currentTimeMillis(); geoLocTimeOutTask = new GeoLocTimeOutTask(); geoLocTimeOutTask.execute(); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener

Finding City and Zip Code for a Location

强颜欢笑 提交于 2019-11-30 02:31:21
Given a latitude and longitude, what is the easiest way to find the name of the city and the US zip code of that location. (This is similar to https://stackoverflow.com/questions/23572/latitude-longitude-database , except I want to convert in the opposite direction.) Related question: Get street address at lat/long pair This is the web service to call. http://developer.yahoo.com/search/local/V2/localSearch.html This site has ok web services, but not exactly what you're asking for here. http://www.usps.com/webtools/ Any of the online services mentioned and their competitors offer "reverse

Spring Boot应用上传文件时报错

假装没事ソ 提交于 2019-11-30 02:20:50
问题描述 Spring Boot应用(使用默认的嵌入式Tomcat)在上传文件时,偶尔会出现上传失败的情况,后台报错日志信息如下:“The temporary upload location is not valid”。 原因追踪 这个问题的根本原因是Tomcat的文件上传机制引起的! Tomcat在处理文件上传时,会将客户端上传的文件写入临时目录,这个临时目录默认在/tmp路径下,如:“/tmp/tomcat.6574404581312272268.18333/work/Tomcat/localhost/ROOT”。 而操作系统对于/tmp目录会不定时进行清理,如果正好因为操作系统的清理导致对应的临时目录被删除,客户端再上传文件时就会报错:“The temporary upload location is not valid”。 实际上,追踪一下源码会发现,如果不明确设置Tomcat的文件上传临时目录,默认读取的是Servlet上下文对象的属性“javax.servlet.context.tempdir”值,如下源码: org.apache.catalina.connector.Request private void parseParts(boolean explicit) { //... MultipartConfigElement mce = this.getWrapper

linux集群架构-网站的搭建

喜欢而已 提交于 2019-11-30 02:03:48
1.nginx开启目录浏览,提供下载功能 默认情况下,网站返回index指定的主页,但如果该网站不存在主页,则会将请求交给autoindex模块,如果开启autoindex模块,则提供一个下载页面,如果没有开启autoindex,则会报错403 [root@web01 centos]# cat /etc/nginx/conf.d/mirror.oldxu.com.conf server { listen 80; server_name mirror.oldxu.com; charset utf8; #字符集 location / { root /code; index index.html; autoindex on; #开启目录索引,提供下载 autoindex_exact_size off; #以人性化方式显示大小 autoindex_localtime on; #与本地时间保持一致 } } 2.nginx实现访问控制,基于来源ip控制,基于用户名密码控制 例一:允许特定的IP访问,其他全部拒绝 [root@web01 ~]# cat /etc/nginx/conf.d/mirror.oldxu.com.conf server { listen 80; server_name mirror.oldxu.com; root /code; charset utf8;

Unbelievably inaccurate GPS points. What is the reason?

半腔热情 提交于 2019-11-30 01:47:45
问题 I have developed an application for Android, for storing user's GPS location. One of my customers gave me his device and I noticed that sometimes the accuracy of the device is really bad and unbelievable. Sometimes the device returns points about 200 kilometers away from the actual location. You can see this in the following GPS location samples for that device. You see that two points are about 200 km away from the real location. The device is Samsung SM-T111 with Android 4.2.2, and I only

How to get speed in android app using Location or accelerometer or some other way

Deadly 提交于 2019-11-30 00:59:32
I am working on app and try to get the speed and distance travelled by the user. I have used Google Play services location class to get the speed but it always returns me 0.0 value and not at all reliable. I wan accurate speed and distance travelled at real time. I have installed GPS Speedometer app on my device and its so perfect that even if i am walking then it gives me the speed. I want to get the same thing. I am confused in how to get speed, using location or using accelerometer or is there any other way to do it? My code is available on this link :- Drawing route on Google Maps using

is there another site like freegeoip.net [closed]

淺唱寂寞╮ 提交于 2019-11-30 00:07:53
is this site not working any more as i cant get it to work, it used to work. is there any RELIABLE service like it http://freegeoip.net/ You can also checkout: http://geoip.nekudo.com/ I just started this as an alternative to freegeoip. Is's completely free and open-source so you can also setup your own copy if you like. To setup your own instance this is what you have to to: Pull the sourcecode from the github repsitory and put it on your server. Run "composer install" to load all dependencies. (Install composer if you don't have it yet) Download a copy of the GeoLite2 database and put it