header

WPF 配置菜单栏(Menu)

耗尽温柔 提交于 2020-03-03 10:18:32
WPF 配置菜单栏(Menu) 代码段: < Window x : Class = "WpfApp2.MainWindow" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns : x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns : d = "http://schemas.microsoft.com/expression/blend/2008" xmlns : mc = "http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns : local = "clr-namespace:WpfApp2" mc : Ignorable = "d" Title = "MainWindow" Height = "450" Width = "800" > < Grid > < DockPanel > < Menu DockPanel . Dock = "Top" > < MenuItem Header = "文件" > < MenuItem x : Name = "item_New" Header = "新建" InputGestureText = "Ctrl+N

nginx反向代理

不羁岁月 提交于 2020-03-03 06:14:46
user nginx; worker_processes auto; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; upstream www { server 192.168.1.125:81 weight=1 max_fails=2 fail_timeout=3;  

nginx 配置vue代理2种方式

房东的猫 提交于 2020-03-03 05:07:35
**方法一** 访问方式:http://域名 server { listen 8088; #端口号,自定义 server_name 域名; root 路径; index index.html; # Load configuration files for the default server block. location / { try_files $uri $uri/ @router; index index.html index.htm index.php; add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET'; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } location @router { rewrite ^.*$ /index.html last; } location /api/ { #vue前端所有接口都加上/api/前缀

IP头部之IHL

瘦欲@ 提交于 2020-03-03 02:43:42
参考RFC-791 Internet Header Format 箭头所指的位置就是IHL-Internet Header Length. 前提知识点: IP 头部每一行是32bit = 4B IP 头部头部最后一行是特殊添加的内容,有没有第6行视情况而定,所以说最短是5行 如果只是有5行,那么头部的总大小就是 4B * 5行 = 20 B 分析IHL字段: IHL是4位二进制 表示范围看似是二进制 0000 - 1111 , 十进制 0 - 15 问题来了, 长度可能是0嘛? 显然不会,前面说过最少是20B嘛 RFC这样解释: Internet Header Length is the length of the internet header in 32 bit words, and thus points to the beginning of the data. Note that the minimum value for a correct header is 5. 搜迪斯尼! 规定嘛, 这4个二进制位能表示最小的值是十进制5 ,也就是二进制的 0101 用来表示头儿总长度20B , 5 * 32bit / 8 = 20 B , 共5行 那么 1111 也就是15 可以表示的是? 15 * 32bit / 8 = 60B , 共15行 所有大小是 20B-60 B

CP="CAO PSA OUR" 用P3P header解决iframe跨域访问cookie

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-02 18:43:46
1、IE浏览器iframe跨域丢失Session问题 在开发中,我们经常会遇到使用Frame来工作,而且有时是为了跟其他网站集成,应用到多域的情况下,而Iframe是不能保存Session的因此,网上可以找到很多相关的文章,如果网站可以采用设置Web.Config中的配置: mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="40" /> 把cookieless="false"改成"true"就可以了但也同样有个小问题,就是如果页面中采用Javascript的window.location.href=''这样的方式来重定向的话,系统会认为这是另一个新的请求,产生一个新的SessionId,导致原Session同样的丢失所以对于重定向,还是使用Response.Redirect()为好 除了Ifrmae有丢Session问题外,frameset也有同样的问题Frameset的问题更不确定,是有时会丢,有时不会丢,这更认人头痛,在网上找到了一个方法,在页面page_onload里添加一语句: Response

Python爬虫第八课:让爬虫定时汇报

本秂侑毒 提交于 2020-03-02 17:30:25
我们来学习两个新的功能来增强爬虫程序的实用性: 首先是程序可以根据我们设定的时间自动爬取数据,即定时爬取; 然后程序可以把爬取到的数据结果以邮件的形式自动发送到我们的邮箱,也就是自动发送。 来做一个案例:每日更新天气预报情况,并发送邮件提醒 。由三个部分构成:爬取天气数据+发送邮件+定时 一、爬取天气数据 天气网站地址为:http://www.weather.com.cn/weather/101280101.shtml import requests from bs4 import BeautifulSoup # 请求头 headers = { 'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' } # url url = 'http://www.weather.com.cn/weather/101280101.shtml' # 获取数据 res_weather = requests . get ( url , headers = headers ) print ( res_weather . status_code ) print ( res_weather

解决apache静态资源跨域访问

房东的猫 提交于 2020-03-02 14:21:41
1.apache 1)在httpd.conf文件,找到#LoadModule headers_module modules/mod_headers.so,把#去掉 2)在vhosts.conf文件,找到域名配置,新增 Header set Access-Control-Allow-Origin * ,如下 <VirtualHost *:8081> DocumentRoot "D:\www\XXXX" ServerName www.test.cn ServerAlias Header set Access-Control-Allow-Origin * <Directory "D:\www\XXXX"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> 重启apache 来源: oschina 链接: https://my.oschina.net/berzhuan/blog/3185028

ajax 设置Access-Control-Allow-Origin实现跨域访问

梦想的初衷 提交于 2020-03-02 14:02:34
ajax跨域访问是一个老问题了,解决方法很多,比较常用的是 JSONP 方法,JSONP方法是一种 非官方方法 ,而且这种方法只支持GET方式,不如POST方式安全。 即使使用jquery的jsonp方法,type设为POST,也会自动变为GET。 官方问题说明: “script”: Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, “_=[TIMESTAMP]“, to the URL unless the cache option is set to true. Note: This will turn POSTs into GETs for remote-domain requests. 如果跨域使用POST方式,可以使用创建一个隐藏的iframe来实现,与ajax上传图片原理一样,但这样会比较麻烦。 因此,通过设置 Access-Control-Allow-Origin 来实现跨域访问比较简单。 例如:客户端的域名是 www.client.com ,而请求的域名是 www.server.com 如果直接使用ajax访问,会有以下错误 XMLHttpRequest cannot

入门第四篇 :Nginx搭建图片服务器

久未见 提交于 2020-03-02 06:27:50
Nginx搭建图片服务器 Nginx下载地址:http://nginx.org/en/download.html 本例下载的是window版本nginx-1.6.1 以下是我本机操作说明: 下载完后,解压,并把它放到D:\tools\nginx-1.6.1,双击nginx.exe即可运行nginx。可通http://127.0.0.1访问到nginx欢迎界面 也可在cmd中通过命令进行启停启动nginx: start nginx //运行nginx nginx -s stop // 停止nginx nginx -s reload // 重新加载配置文件(如修改配置文件后,可通过该命令重新加载) nginx -s quit // 退出nginx nginx -v //可查nginx版本 在执行nginx命令时,出现了 windows nginx: [error] CreateFile() "logs/nginx.pid" failed 异常。原因是未指定 nginx.conf,指定该文件,启动命令如下: D:\tools\nginx-1.6.1>nginx -c D:\tools\nginx-1.6.1\conf\nginx.conf 接下来我们配置图片服务器: 1、在本地建了一个D:\resourcesfile\images文件夹,里面放了一张png测试图片。 2、配置nginx

Optimize Browser Caching(小记)

为君一笑 提交于 2020-03-02 02:20:12
(1)Cache-Control, 用来减少http请求 在server, response的header中,增加如下内容 response.setHeader("Cache-Control", "max-age=31536000,public"); 浏览器在收到此header后。将该url对应的内容缓存max-age(单位:秒)这么久,在这个时期内,刷新页面,浏览器将会使用本地缓存,不会发任何http请求 此时在DragonFlag上观察,可以清楚的看到no request made 注意:这里的刷新是指在地址栏按回车!而不是F5或Ctrl+F5!,每种浏览器对F5的处理都不相同,请看下表: http://stackoverflow.com/questions/385367/what-requests-do-browsers-f5-and-ctrl-f5-refreshes-generate 如果在request 的header中的使用了Cache-Control(比如强制刷新就会在request中产生该header),此时会覆盖response中的值。也就是说浏览器的设置可以改变server的response方式。 (2)Expires (用途和Cache-Control一样,减少http请求) (3)Last-Modified(用来减少数据传输,请求不会少:)