localhost

一文彻底搞懂Cookie、Session、Token到底是什么

久未见 提交于 2019-12-06 08:35:18
> 笔者文笔功力尚浅,如有不妥,请慷慨指出,必定感激不尽 Cookie 洛:大爷,楼上322住的是马冬梅家吧? 大爷:马都什么? 夏洛:马冬梅。 大爷:什么都没啊? 夏洛:马冬梅啊。 大爷:马什么没? 夏洛:行,大爷你先凉快着吧。 在了解这三个概念之前我们先要了解HTTP是无状态的Web服务器,什么是无状态呢?就像上面夏洛特烦恼中经典的一幕对话一样,一次对话完成后下一次对话完全不知道上一次对话发生了什么。如果在Web服务器中只是用来管理静态文件还好说,对方是谁并不重要,把文件从磁盘中读取出来发出去即可。但是随着网络的不断发展,比如电商中的购物车只有记住了用户的身份才能够执行接下来的一系列动作。所以此时就需要我们无状态的服务器记住一些事情。 那么Web服务器是如何记住一些事情呢?既然Web服务器记不住东西,那么我们就在外部想办法记住,相当于服务器给每个客户端都贴上了一个小纸条。上面记录了服务器给我们返回的一些信息。然后服务器看到这张小纸条就知道我们是谁了。那么 Cookie 是谁产生的呢?Cookies是由服务器产生的。接下来我们描述一下 Cookie 产生的过程 浏览器第一次访问服务端时,服务器此时肯定不知道他的身份,所以创建一个独特的身份标识数据,格式为 key=value ,放入到 Set-Cookie 字段里,随着响应报文发给浏览器。 浏览器看到有 Set-Cookie

ExtJS 4.2 系列教程(2):bootstrap.js加载

不问归期 提交于 2019-12-06 08:15:24
通过上一篇DEMO的运行结果截图,我们可以看出,在index.jsp页面上,我们只是引入bootstrap.js这个文件,页面加载时候bootstrap.js会帮助我们自动判断加载ext-all-*.js的文件。 那么它是怎么确定要引用哪个ExtJS文件的呢?我们的目录中有分别有三个文件: ext-all-debug.js:用于调试时引用 ext-all-dev.js:用于开发时引用 ext-all.js:在发布时引用 我们可以查看bootstrap.js的源代码一探究竟: /** * Load the library located at the same path with this file * * Will automatically load ext-all-dev.js if any of these conditions is true: * - Current hostname is localhost * - Current hostname is an IP v4 address * - Current protocol is "file:" * * Will load ext-all.js (minified) otherwise */ 从文件注释可以知道信息: /** * 加载本文件相同路径中的库 * * 满足以下条件将自动加载 ext-all-dev.js

Python LocationValueError: No host specified

一曲冷凌霜 提交于 2019-12-06 07:57:37
My python can't connect to the Internet since last time my Windows updated. When I pip something , error goes like if host.startswith('['): AttributeError: 'NoneType' object has no attribute 'startswith' It is just that I can't pip anything on the Internet, anything. And then I thought maybe something went wrong with my system, so I tried checking if "requests" worked correctly. But hosts error goes like r = requests.get('http://www.baidu.com') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "D:\Program Files (x86)\Anaconda3\lib\site-packages\requests\api.py", line

DriverManager no suitable driver mysql

有些话、适合烂在心里 提交于 2019-12-06 07:35:30
We're having some trouble finding out why we are getting an error message when creating a connection with DriverManager. Here is our code package Databank; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.List; public class Connectie_Databank { //Eigenschappen databank private String connectieString = ""; private Connection connectie = null; private PreparedStatement prepStatement = null; private Statement statement = null; private ResultSet inhoudQuery = null; //Inloggegevens

Not able to receive UDP/IPv6 packets on secondary interface

爱⌒轻易说出口 提交于 2019-12-06 07:28:22
问题 I have the following C code for UDP server which would bind to the ipv6 address of the secondary interface tap0. context_t * new_context(const struct sockaddr *listen_addr, size_t addr_size) { context_t *c = malloc( sizeof( context_t ) ); time_t now; int reuse = 1; if (!listen_addr) { fprintf(stderr, "no listen address specified\n"); return NULL; } srand( getpid() ^ time(&now) ); if ( !c ) { perror("init: malloc:"); return NULL; } memset(c, 0, sizeof( context_t ) ); c->sockfd = socket(listen

Can I run an Angular 6 project on WAMP Server?

隐身守侯 提交于 2019-12-06 07:06:59
问题 I am a PHP developer and also I have developed Angular 6 apps using Node.js backend. But, currently I am working on a project which should run an Angular 6 app with a PHP 7 back-end. The reason is that, the API was written in PHP. I wish to develop my Angular app in WAMP server default directory. wamp64/www/my_project So my questions are, Will the Angular 6 app run? Because it needs another server and normally it is http://localhost:4200/. Would there any server (localhost) collisions? If it

Kafka 集群管理

老子叫甜甜 提交于 2019-12-06 07:03:40
后台和停止kafka服务 注意事项: 生产环境推荐使用 -daemon 参数后台启动kafka,然后搭配使用 nohup 和 & 如果不想使用 kafka-server-stop.sh 关闭一台机器上的所有kafka broker,还可以使用另一种方式,首先 jps 查看kafka的pid,然后运行 ps ax | grep -i 'kafka/Kafka' | grep java | grep -v grep | awk '${print $1}' 自行寻找Kafka的PID ,最后运行 kill -s TERM $PID 关闭broker。 Topic管理/命令行脚本 创建topic 自动分区分配 bin/kafka-topics.sh --create --zookeeper localhost:2181 --partitions 6 --replication-factor 3 --topic topic-manager-test --config delete.retention.ms=259200000 最后一个参数是日志存留天数3天 手动分配分区 bin/kafka-topics.sh --create --zookeeper localhost:2181 --topic topic-manager-test2 --replica-assignment 0:1,1:2

Performance of local domain vs localhost

自作多情 提交于 2019-12-06 07:03:30
问题 Is there a performance difference between TCP connections to: localhost / 127.0.0.1 a domain which resolves to the local machine Or more specifically, do the latter connections go through the loopback device, or over the actual network? The reason I'm asking is I'm thinking about changing database settings in many PHP apps so they use a full domain instead of localhost. That way we could more easily move the database to a different server, if the need arises. 回答1: This is implementation and

利用 Rize 来进行 UI 测试或 E2E 测试

一笑奈何 提交于 2019-12-06 06:59:23
之前我曾经在 《Rize - 一个可以让你简单、优雅地使用 puppeteer 的 Node.js 库》 一文简单介绍过 Rize 这个库。当时仅仅是介绍这个库本身,关于如何使用,我没有给太多的指导。 这篇文章讲的是如何使用 Rize 来做 UI 测试或 E2E 测试。 在正式开始之前,先给可能没了解过 Rize 的同学做个简单的介绍:Rize 是一个提供了相对顶层并且可链式调用的 API 的库,可与 puppeteer 一起使用。目前开源在 GitHub,地址是 https://github.com/g-plane/rize ,欢迎大家前往 GitHub 给个 star。 安装 首先是安装 Rize 和 puppeteer。 如果您使用 Yarn: $ yarn add --dev rize puppeteer 如果您使用 npm: $ npm install --save-dev rize puppeteer 考虑到国内的网络原因,您可能需要使用国内的 Chromium 镜像: 对于 Linux 或 macOS 用户: PUPPETEER_DOWNLOAD_HOST=https://storage.googleapis.com.cnpmjs.org yarn add --dev puppeteer rize Windows 用户: SET PUPPETEER_DOWNLOAD

Connecting to localhost/index.php through my smart phone [closed]

百般思念 提交于 2019-12-06 05:56:52
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I want to connect to my localhost using my smart phone through WiFi. I got my IP via www.whatismyip.com , and got my smart phone to connect to my laptop successfully. However, when I type localhost as the web address in the browser of my phone, nothing shows up. How can I access localhost/index.php page through my smart phone? use your laptop wifi connection ip instead of localhost like 192.168.50.2. Are you sure