再谈同名 Cookie 优先级问题技术
关于同名 Cookie 在秃域名和二级域名下优先级的问题。
先看看根域名带点和不带点的问题。比如设置了同名 Cookie 在域名 .lmlphp.com 和 lmlphp.com 下,当访问跟域名 lmlphp.com 时,浏览器将两个同名 Cookie 都会发给服务器,哪个优先级更高看哪个放在前面,而在我之前的测试结果里面认为 .lmlphp.com 优先级更高,现在认为是错的。猜测,没有实验过。
下面看真实的测试。
二级域名 blog.lmlphp.com 和 .lmlphp.com 分别设置了 Cookie "LBLOGUSS"。请求二级域名发出的 Header 头 Cookie 内容:
Cookie:UM_distinctid=15b0b9348e3d9-0e113a11eeb39a-317f0158-100200-15b0b9348e5d6; LBLOGUSS=2_1497048432_083ef83241f27343c7cd8e975494763a0a4bfb24; LBLOGUSS=15_1497928608_f666d8527a54b0355ffd407e27f58a318968c772; LBLOGSID=euef9scusfgom5r2rpd73s85b0; a6014_pages=1; a6014_times=37; CNZZDATA1253286891=1916695458-1490971098-%7C1496411346; Hm_lvt_611d0ab5726828d7f68896cec0aefbf6=1496160084,1496265782,1496274079,1496442120; Hm_lpvt_611d0ab5726828d7f68896cec0aefbf6=1496444472; _ga=GA1.2.106199550.1490547854; _gid=GA1.2.2119853286.1496442120
Excel 高级功能查找两列不同项技术
Excel 高级功能,使用 IF 和 COUNTIF 函数快速找出两列中的不同项,一张图就看明白了。
第一项输入公式之后,右下角下拉,就全都找出来了。C:C 代表整个 C 列,A2 代表坐标,A 列的第二个。
是不是看一眼就明白了。
JavaScript try catch 语句技术
在 js 中,很少人使用 try catch 语言,其实偶尔还是需要的。
常用的场景,比如使用 JSON.parse() 时。
try { throw new Error("Whoops"); } catch (e) { if (e instanceof EvalError) { console.log(e.name + ': ' + e.message); } else if (e instanceof RangeError) { console.log(e.name + ': ' + e.message); } }
git pull 误操作后如何恢复技术
习惯使用 git pull 不是无缘无故的,因为它确实好用,能更新整个项目所有分支。
但是,如果出错了,或者本身已经是最新的代码,误操作导致代码被污染怎么办?
$ git reflog feature-20170415 72f5ce3 feature-20170415@{0}: pull origin feature-20170415: Merge made by the 'recursive' strategy. 22a886b feature-20170415@{1}: rebase -i (finish): refs/heads/feature-20170415 onto a9ba6a4f760a9126f87ad49a0fd6c34834157df4 faa0e73 feature-20170415@{2}: commit: . a9ba6a4 feature-20170415@{3}: rebase -i (finish): refs/heads/feature-20170415 onto 44102be15065bdf270a153a73a900642636a6a54 91f59b6 feature-20170415@{4}: commit: . 44102be feature-20170415@{5}: commit: . 723f02a feature-20170415@{6}: branch: Created from HEAD
spring boot jpa 多个数据源配置技术
spring boot jpa 多数据源的配置,对于新手来讲还是不简单的,网上的很多资料都已经过时并且不靠谱。
application.properties 配置参考:
spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html spring.thymeleaf.mode=LEGACYHTML5 spring.thymeleaf.cache=false spring.http.encoding.charset=utf8 spring.datasource.url=jdbc:mysql://192.168.1.250:3306/main?useUnicode=true&characterEncoding=utf-8 spring.datasource.username=root spring.datasource.password= spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.sql-script-encoding=utf-8 spring.datasource.maximum-pool-size=100 spring.datasource.max-idle=10 spring.datasource.max-wait=10000 spring.datasource.min-idle=5 spring.datasource.initial-size=5 spring.datasource.validation-query=SELECT 1 spring.datasource.test-on-borrow=false spring.datasource.test-while-idle=true spring.datasource.time-between-eviction-runs-millis=18800 bar.datasource.url=jdbc:mysql://192.168.1.250:3306/project bar.datasource.username=root bar.datasource.password= bar.datasource.driver-class-name=com.mysql.jdbc.Driver bar.datasource.sql-script-encoding=utf-8