location

BOM对象——Location

自作多情 提交于 2019-12-19 13:32:02
BOM对象——location <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript"> window.onload = function() { /* Location - 该对象封装了浏览器的地址栏信息 */ //获取按钮 var btn = document.getElementById("btn"); btn.onclick = function() { // 如果直接打印location,则可以获取到地址栏的信息(当前页面完整的路径) // console.log(location);? /* 如果直接将location属性改成一个完整路径或者相对路径则会跳转到该页面 */ // location="http://www.baidu.com"; /* assign - 用来跳转到其他页面,作痛和直接修改location一样 */ // location.assign("http://www.baidu.com"); /* reload(); 重新加载当前页面 如果在方法中传递一个true,强制清空缓存 */ // location.reload(true); /* replace(); - 可以使用一个新的页面替换当前页面

nginx学习之一

六眼飞鱼酱① 提交于 2019-12-19 12:56:52
一、介绍 Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为“engine X”, 是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/SMTP 代理服务器. 二、 Location语法 语法:location [=|~|~*|^~] /uri/ { … } 注: 1、~ 为区分大小写匹配 2、~* 为不区分大小写匹配 3、!~和!~*分别为区分大小写 不匹配 及不区分大小写 不匹配 示例一: location / { } 匹配任何查询,因为所有请求都以 / 开头。但是正则表达式规则将被优先和查询匹配。 示例二: location =/ {} 仅仅匹配/ 示例三: location ~* \.(gif|jpg|jpeg)$ { rewrite \.(gif|jpg)$ /logo.png; } 注:不区分大小写匹配任何以gif,jpg,jpeg结尾的文件 三、 ReWrite语法 last - 基本上都用这个Flag。 break - 中止Rewirte,不在继续匹配 redirect - 返回临时重定向的HTTP状态302 permanent - 返回永久重定向的HTTP状态301 1、下面是可以用来判断的表达式: -f和!-f用来判断是否存在文件 -d和!-d用来判断是否存在目录 -e和!-e用来判断是否存在文件或目录 -x和!

Nginx rewrite理论

北战南征 提交于 2019-12-19 12:25:54
Rewrite跳转场景 URL看起来更规范,合理 企业会将动态URL地址伪装成静态地址提供服务 网址换新域名后,让旧的访问跳转到新的域名上 服务端某些业务调整 Rewrite跳转实现 Rewrite实用场景 Nginx跳转需求的实现方式 使用rewrite进行匹配跳转 使用if匹配全局变量后跳转 使用location匹配再跳转 rewrite放在server{},if{},location{}段中 对域名或参数字符串 使用if全局变量匹配 使用proxy_pass反向代理 常用的正则表达式元字符 字符 说明 ^ 匹配输入字符串的起始位置 $ 匹配输入字符串的结束位置 * 匹配前面的字符零次或多次 + 匹配前面的字符一次或多次 ? 匹配前面的字符零次或一次 . 匹配除\n之外的任何单个字符,使用诸如"[.\n]"之类的模式,可匹配包括"\n"在内的任意字符 \d 匹配纯数字 [0-9] {n} 重复多次 {n,} 重复n次或更多次 [c] 匹配单个字符c [a-z] 匹配a-z小写字母的任意一个 [a-zA-Z] 匹配a-z小写字母或A-Z大写字母的任意一个 Rewrite命令 语法: rewrite <regex> <replacement> [flag]; 正则 跳转后的内容 rewrite支持的flag标记 flag标记说明: 标记 说明 last 相当于Apache的[L

audio recording in background on iOS

纵饮孤独 提交于 2019-12-19 11:46:18
问题 I have an application that uses location services in the background. Works fine. But what I want to do, at a certain point, is to check some audio levels while the application is in the background. For some reason it doesn't seem to work. When running in foreground, the function works fine, but when in the back ground, the audio recorder average and peak input is always -120.. This is what I use to do the trick (that doesn't seem to work apparently..) .... [recorder record]; if (levelTimer ==

How to track distance via GPS on Android?

风流意气都作罢 提交于 2019-12-19 11:05:54
问题 How would I go about tracking the distance a user travels? I don't necessarily care about storing waypoints, although that may be necessary to calculate distance anyway. So far, I am creating a LocationManager and regsitering an onLocationChanged listener, and then calculating the raw distance between two points when the listener fires. The problem here is that if I leave the app sit still on a desk for 10, 15 minutes, it will say I have traveled .5 miles. How should I go about checking for

activate tab based on the # hash in the url

瘦欲@ 提交于 2019-12-19 09:46:38
问题 Say i had a URL such as the one below...how can i activate the correct tab? http://domain.com/safety.php#tabOne Heres my HTML: <div id="tabsWrapper"> <div class="tabMenu"> <ul class="tabset"> <li><a class="tab active" href="#tabOne">Safety First</a></li> <li><a class="tab" href="#tabTwo">BS8848 & LoTC</a></li> <li><a class="tab" href="#tabThree">Know Before You Go</a></li> </ul> </div> <div id="tabbedContent"> <section class="contentTab" id="tabOne" style="display: block;">Content here<

Android network location takes hours to update location

為{幸葍}努か 提交于 2019-12-19 08:55:06
问题 In my android app I use the network provider to receive location updates in a location listener and sync them to my server. When testing, I'll take the device and drive a few hours away and com back the next day. The problem is the listener sometimes takes a few hours to give me an updated location. I'll leave point A and get to point B and it takes 3 hours for the device to report B as the new location. The same happens the next day going from point B back to A. It seems odd that it's

How to set “Types” in Google Place PlacePicker in Android?

孤街浪徒 提交于 2019-12-19 05:57:06
问题 In the new google places API, they come with a new feature called PlacePicker. It's a simple activity to select a place of the list/map of places they have. In the Places API we can give a types list, to receive only places of those specific types. I'm building an app that uses only "establishment" places. But this activity shows all the places, including a lot of places that i do not need (libraries, schools, gas ...) There is a way to set the types of the PlacePicker? Reading the API docs

How to draw at the current GPS location on MapView using MyLocationOverlay?

[亡魂溺海] 提交于 2019-12-19 04:57:22
问题 I'm trying to draw a custom gps-location icon. I'm using MapView and have created a class MyLocationArrow that extends MyLocationOverlay. I override drawMyLocation() and draw a point at 100,100. But this is the coordinates on screen. How do I get the screen-coordinates from the current GPS-location? 回答1: You can use android.graphics.Point toPixels(GeoPoint in, android.graphics.Point out) Converts the given GeoPoint to onscreen pixel coordinates, relative to the top-left of the MapView that

How to get the user's current location by code in iphone app?

☆樱花仙子☆ 提交于 2019-12-19 04:52:48
问题 I want to get the user's current location from my iPhone app. I want to show the user's current location like country name, latitude, longitude information in my app. And also i want to show the location in Google map also. I have tried Google search also, but can't get the exact answer. I have get the info that was to use CLLocationManager in my app to track the location. How do i use this? I have download one sample app from Apple Documents. Here is the link: https://developer.apple.com