location

Nginx使用入门

牧云@^-^@ 提交于 2019-12-04 05:04:22
现在互联网web项目一般离不开分布式,访问量大的情况下,单台服务器一般是扛不住大量负载访问的(如单台tomcat目前最多能抗住200-500的并发量),既然一台不行那就搭建多台,性能不够,数量来凑。那接下来访问就可能有问题了,难道需要用户准备多个ip地址或者访问地址吗,显然这是不友好的,这样一个管理多个服务器的中间服务器出现了,Nginx就是其中的代表,它是一款优秀的代理服务器,通过它可以实现负载均衡,动静分离等。 关于代理 学习Nginx之前,需要了解下代理的概念,包括代理,正向代理和反向代理,参考博文学习了下。 (1)代理,前面已经学习过了静态代理和动态代理,简单来说就是让一个中间人来处理幕后大佬的工作,如明星的助手,老板的秘书等就是代理。 (2)正向代理,如翻墙就是正向代理的例子,访问国外某个网站访问不了,那可以先访问国外某个可以访问的服务器,然后通过可以访问的服务器再访问那个不可以访问的服务器,这就是正向代理。正向代理中,用户很清楚要访问的服务器地址是什么,正向代理对服务器隐藏了真实用户,它只知道请求来自代理服务器。 (3)反向代理,一般跟分布式集群服务器挂钩,用户在访问真实服务器前先访问一个中间服务器,它提供统一的地址,通过内部均衡算法,将请求分发到背后集群中的某台服务器。反向代理对用户隐藏了真实服务器的信息,跟正向代理相反。 Nginx的安装 (1)nginx的安装

How to find location based on IP address in Excel

拟墨画扇 提交于 2019-12-04 04:58:51
I've got a spreadsheet of about 5000 user events associated with IPs, and I'm trying to use IP to determine location using just an Excel formula. The IPs in my log are structured as "dotted quads" (decimal notation). I figured VLOOKUP is the way to go here, so I downloaded WEBNet77's IPV4 IpToCountry database , which seems like a comprehensive and up-to-date resource (is there a better resource out there for this purpose?). The database includes about 140K rows of IP ranges, with the sheet structured like so: Colum labels A - G are, respectively: IP FROM, IP TO, REGISTRY, ASSIGNED, CTRY, CNTRY

iOS Waiting for Location Manager to Init

扶醉桌前 提交于 2019-12-04 04:57:21
I'm developing an iOS app based on the map and location tracking. When the user first boots the app it asks for permission to track location etc. just fine. The only problem is while it's doing that, I have code setting up the initial map view and other location-based variables before the user has clicked OK. I've found I can put these initiation steps after a while loop that waits for the user to change the location manager's permissions as below but this can't possibly be best practice, not to mention it leads to some strange behavior in the transition between the splash screen and the map:

RuntimeException in Gson parsing JSON: Failed to invoke protected java.lang.ClassLoader() with no args

≡放荡痞女 提交于 2019-12-04 04:45:58
I've inherited some code that saves our application state as JSON using Gson, and then reads it using fromJson . Gson gson = createGson(); gson.fromJson(objString, myClass); One of the fields being saved is a Location . Unfortunately, very occasionally the parsing of that saved data fails because my saved Location includes an mClassLoader in its mExtras, and the Gson library fails to create the ClassLoader with this error: RuntimeException: Failed to invoke protected java.lang.ClassLoader() with no args Does anybody know why a ClassLoader is being included in the extras for my Location, and

How to Detect Airplane Mode/ Flight Mode in IOS Swift

放肆的年华 提交于 2019-12-04 04:40:46
I need to detect weather IPhone is in Airplane mode or Not, i have done much research and i found no direct way to achieve that . My App has the functionality of Calling a Number and When an Iphone has Airplane mode he can't call. so I need to show him my custom Screen to Notify that Airplane mode is enable. it will be good if any one can explain how we can achieve it in an effective way. Here is another way to detect this mode like below, go Info.plist -> add this **Application uses Wi-Fi (Boolean) YES* To test: Kill your app -> turn on airplane mode -> open ur app: you should be able to see

nginx模块

微笑、不失礼 提交于 2019-12-04 04:15:57
if指令 格式: if (条件判断) { 具体的rewrite规则 } 条件举例 条件判断语句由Nginx内置变量、逻辑判断符号和目标字符串三部分组成。 其中,内置变量是Nginx固定的非自定义的变量,如,$request_method, $request_uri等。 逻辑判断符号,有=, !=, ~, ~*, !~, !~* !表示相反的意思,~为匹配符号,它右侧为正则表达式,区分大小写,而~*为不区分大小写匹配。 目标字符串可以是正则表达式,通常不用加引号,但表达式中有特殊符号时,比如空格、花括号、分号等,需要用单引号引起来。 示例1 if ($request_method = POST) //当请求的方法为POST时,直接返回405状态码 { return 405; //在该示例中并未用到rewrite规则,if中支持用return指令。 } 示例2 if ($http_user_agent ~ MSIE) //user_agent带有MSIE字符的请求,直接返回403状态码 { return 403; } 如果想同时限制多个user_agent,还可以写成这样 if ($http_user_agent ~ "MSIE|firefox|spider") { return 403; } 示例3 if(!-f $request_filename) //当请求的文件不存在

Requesting single location update, AVD crashes

喜夏-厌秋 提交于 2019-12-04 03:51:38
问题 I'm trying to request a single location update using the new LocationManager.requestSingleUpdate() method, but once the device gets an update from the GPS the OS crashes and seems to try to reboot. At least I get the usual Android boot screen, but it never finishes booting. I've tried running the code on a 2.3, 2.3.1, 2.3.3 and 2.2 AVD, with the same result on all. ***** Update ***** I tried an old location based app that I have made, and that is running just fine on a few hundred units, and

How to zoom to fit in WP7 Bing Maps control using LocationCollection?

假如想象 提交于 2019-12-04 03:41:15
How can I zoom the Microsoft.Phone.Controls.Maps.Map control to the correct zoom level on Windows Phone 7? I have a LocationCollection of GeoCoordinates and I calculated the Center myself, but now how do I calculate the correct zoom level to fit the LocationCollection? P.S. Is there an out of the box method to calculate the center of GeoCoordinates so I don't have to calculate it myself? EDIT: I've found another fine solution: http://4mkmobile.com/2010/09/quick-tip-position-a-map-based-on-a-collection-of-pushpins/ map.SetView(LocationRect.CreateLocationRect(points)); You can use the following

Apache Config - Exclude Location from Authentication

微笑、不失礼 提交于 2019-12-04 03:05:30
问题 I have a web application that is being protected by a Shibboleth authentication module. My current config is as below <Location /MyApp> AuthType shibboleth ShibUseHeaders On ShibRequestSetting requireSession 1 require shibboleth </Location> The shibboleth is an authentication module that provides SSO capability and the current flow directs the user to an Identity Provider for the user to enter the login credentials. I want to be able to open up a specific URL so that the URL gets bypassed by

nginx指定文件路径有两种方式root和alias

坚强是说给别人听的谎言 提交于 2019-12-04 03:01:56
背景 一直没明白这个配置啥意思,反正凑合用吧,不过老凑合总不是个事,没搞明白更容易忘,别人问还答不上来。反正也很简单,就搞明白点记下来。 知识点 root实例: location ^~ /t/ { root /www/root/html/; }如果一个请求的URI是/t/a.html时,web服务器将会返回服务器上的/www/root/html/t/a.html的文件。 alias实例: location ^~ /t/ { alias /www/root/html/new_t/; } 如果一个请求的URI是/t/a.html时,web服务器将会返回服务器上的/www/root/html/new_t/a.html的文件。注意这里是new_t,因为alias会把location后面配置的路径丢弃掉,把当前匹配到的目录指向到指定的目录。 注意: 1. 使用alias时,目录名后面一定要加"/"。 3. alias在使用正则匹配时,必须捕捉要匹配的内容并在指定的内容处使用。 4. alias只能位于location块中。(root可以不放在location中) 一直没明白这个配置啥意思,反正凑合用吧,不过老凑合总不是个事,没搞明白更容易忘,别人问还答不上来。反正也很简单,就搞明白点记下来。 知识点 root实例: location ^~ /t/ { root /www/root/html/