-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex9.html
359 lines (310 loc) · 15.9 KB
/
index9.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>商伟的技术博客</title>
<meta name="description" content="">
<meta name="author" content="商伟">
<!-- HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="/theme/html5.js"></script>
<![endif]-->
<!-- Styles -->
<link href="/theme/bootstrap.min.css" rel="stylesheet">
<link href="/theme/local.css" rel="stylesheet">
<link href="/theme/pygments.css" rel="stylesheet">
<!-- Feeds -->
</head>
<body>
<div class="topbar">
<div class="topbar-inner">
<div class="container-fluid">
<a class="brand" href="/">商伟的技术博客</a>
<ul class="nav">
<li ><a href="/category/django.html">Django</a></li>
<li ><a href="/category/docker.html">Docker</a></li>
<li ><a href="/category/git.html">GIT</a></li>
<li ><a href="/category/javascript.html">JavaScript</a></li>
<li ><a href="/category/mongodb.html">Mongodb</a></li>
<li ><a href="/category/mysql.html">MySQL</a></li>
<li ><a href="/category/pa-chong.html">爬虫</a></li>
<li ><a href="/category/python.html">Python</a></li>
<li ><a href="/category/rabbitmq.html">RabbitMQ</a></li>
<li ><a href="/category/redis.html">redis</a></li>
<li ><a href="/category/shu-ju-jie-gou.html">数据结构</a></li>
<li ><a href="/category/sui-shou-bi-ji.html">随手笔记</a></li>
<li ><a href="/category/supervisor.html">Supervisor</a></li>
<li ><a href="/category/vue.html">VUE</a></li>
<li ><a href="/category/wang-luo.html">网络</a></li>
<li ><a href="/category/web.html">web</a></li>
<li ><a href="/category/xiao-cheng-xu.html">小程序</a></li>
<li ><a href="/category/xu-ni-huan-jing.html">虚拟环境</a></li>
</ul>
<p class="pull-right"><a href="/archives.html">[archives]</a> <a href="/tags.html">[tags]</a></p>
</div>
</div>
</div>
<div class="container-fluid">
<div class="sidebar">
<div class="well">
<h3>Blogroll</h3>
<ul>
<li><a href="http://getpelican.com/">Pelican</a></li>
<li><a href="http://python.org/">Python.org</a></li>
<li><a href="http://jinja.pocoo.org/">Jinja2</a></li>
</ul>
<div class="social">
<h3>Social</h3>
<ul>
<li><a href="https://lienze.tech/">老渔夫吃虾米</a></li>
</ul>
</div>
</div>
</div>
<div class="content">
<div class="page-header"><h1> 商伟的技术博客 </h1></div>
<div class='article'>
<h2>创建与使用虚拟环境</h2>
<div class="well small">Permalink: <a class="more" href="/创建与使用虚拟环境.html">1000-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/xu-ni-huan-jing.html">虚拟环境</a>
tags: <a href="/tag/xu-ni-huan-jing.html">虚拟环境</a> </div>
<div class="summary"><h2>创建与使用环境</h2>
<div class="highlight"><pre><span></span><span class="o">#</span> <span class="err">安装</span><span class="p">:</span>
<span class="n">pip</span> <span class="n">install</span> <span class="n">virtualenvwrapper</span><span class="o">-</span><span class="n">win</span>
</pre></div>
<div class="highlight"><pre><span></span><span class="o">#</span> <span class="err">常用命令</span><span class="p">:</span>
<span class="n">mkvirtualenv</span> <span class="n">envname</span> <span class="o">#</span> <span class="err">创建虚拟环境并自动切换到该环境下</span>
<span class="n">workon</span> <span class="n">envname</span> <span class="o">#</span> <span class="err">切换到某虚拟环境下</span>
<span class="n">pip</span> <span class="n">list</span> <span class="o">#</span> <span class="err">查看蓄奴环境下的安装包</span>
<span class="n">rmvirtualenv</span> <span class="n">envname</span> <span class="o">#</span> <span class="err">删除虚拟环境</span>
<span class="n">deactivate</span> <span class="o">#</span> <span class="err">退出虚拟环境</span>
<span class="n">lsvirtualenv</span> <span class="o">&</span> <span class="n">workon</span> <span class="o">#</span> <span class="err">列出所有常见的虚拟环境</span>
<span class="n">mkvirtualenv</span> <span class="c1">--python==C:\...\python.exe envname # 指定Python解释器创建虚拟环境</span>
</pre></div> <a class="btn primary xsmall" href="/创建与使用虚拟环境.html">more…</a>
</div>
</div>
<div class='article'>
<h2>初识MySQL</h2>
<div class="well small">Permalink: <a class="more" href="/初识MySQL.html">1000-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/mysql.html">MySQL</a>
tags: <a href="/tag/mysql.html">MySQL</a> </div>
<div class="summary"><h4>1.为什么学习数据库</h4>
<div class="highlight"><pre><span></span>数据的存储方式大致有内存存储, 文件存储, 数据库存储. 其中内存存储有断电消失的特性, 不适合永久保存数据. 文件存储不利于数据的查询有调用.所以采用数据库形式存储数据.
数据库具有以下优点:
1).持久化数据到本地
2).可以实现结构化查询, 方便管理数据
</pre></div>
<h4>2.数据库相关概念</h4>
<div class="highlight"><pre><span></span> (1).DB : 数据库, 英文全称为DataBase. 是存储数据的仓库, 其中保存了一系列有组织的数据.
(2).DBMS : 数据库管理系统, 英文全称为Database Management System. 数据库是通过DBMS常见和操作的容器.常见数据库管理系统 : MySQL, Oracle, DB2(适合处理海量数据), SQLServer
(3).SQL : 结构化查询语言(Structure Query Language), 专门用来与数据库通信的语言.
</pre></div>
<h4>3.SQL的优点:</h4>
<div class="highlight"><pre><span></span> (1).不是某个特定数据库供应商专有的语言, 几乎所有DBMS都支持SQL
(2).简单易学 …</pre></div> <a class="btn primary xsmall" href="/初识MySQL.html">more…</a>
</div>
</div>
<div class='article'>
<h2>如何安装mongodb</h2>
<div class="well small">Permalink: <a class="more" href="/如何安装mongodb.html">1000-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/mongodb.html">Mongodb</a>
tags: <a href="/tag/mongodb.html">Mongodb</a> </div>
<div class="summary"><h5>创建一个<code>/etc/yum.repos.d/mongodb-org-4.2.repo</code>文件,以便您可以使用<code>yum</code>以下命令直接安装MongoDB :</h5>
<div class="highlight"><pre><span></span>touch /etc/yum.repos.d/mongodb-org-4.2.repo
</pre></div>
<h5>编写</h5>
<div class="highlight"><pre><span></span>[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4 …</pre></div> <a class="btn primary xsmall" href="/如何安装mongodb.html">more…</a>
</div>
</div>
<div class='article'>
<h2>如何安装python3</h2>
<div class="well small">Permalink: <a class="more" href="/如何安装python3.html">1000-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/python.html">Python</a>
tags: <a href="/tag/python.html">Python</a> </div>
<div class="summary"><h5>CentOS7下安装python3</h5>
<p>yun安装</p>
<div class="highlight"><pre><span></span>yum install python3
# 下面的命令是用来解决找不到python.h
yum list |grep python3 |grep devel
yum install python3-devel.x86_64
</pre></div>
<p>1、安装pyhton3.7 的依赖包</p>
<div class="highlight"><pre><span></span>yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
</pre></div>
<p>2、下载python3.7的“源码”:</p>
<div class="highlight"><pre><span></span>wget https://www.python.org …</pre></div> <a class="btn primary xsmall" href="/如何安装python3.html">more…</a>
</div>
</div>
<div class='article'>
<h2>微信小程序发起请求</h2>
<div class="well small">Permalink: <a class="more" href="/微信小程序发起请求.html">1000-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/xiao-cheng-xu.html">小程序</a>
tags: <a href="/tag/xiao-cheng-xu.html">小程序</a> </div>
<div class="summary"><h4>发起请求</h4>
<h5>发起请求使用的是wx.request相当于axios或者ajax,发起的请求</h5>
<p>官方文档 <a href="https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html">https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html</a></p>
<h5>代码</h5>
<div class="highlight"><pre><span></span><button <span class="nv">bindtap</span><span class="o">=</span><span class="s1">'click'</span>>按钮1</button> <span class="c1">#点击按钮触发click事件</span>
</pre></div>
<div class="highlight"><pre><span></span> <span class="n">click</span><span class="p">:</span><span class="n">function</span><span class="p">(){</span>
<span class="n">var</span> <span class="n">thit</span> <span class="o">=</span> <span class="n">this</span>
<span class="n">wx</span><span class="o">.</span><span class="n">request</span><span class="p">({</span>
<span class="n">url</span><span class="p">:</span> <span class="s1">'http://127.0.0.1:8000/app01/a/'</span><span class="p">,</span> <span class="c1">#访问的路由</span>
<span class="n">data</span><span class="p">:{</span><span class="s1">'name'</span><span class="p">:</span><span class="s1">'shang'</span><span class="p">},</span> <span class="c1">#传参</span>
<span class="n">method</span><span class="p">:</span><span class="s2">"POST"</span><span class="p">,</span> <span class="c1">#提交方式</span>
<span class="n">header …</span></pre></div> <a class="btn primary xsmall" href="/微信小程序发起请求.html">more…</a>
</div>
</div>
<div class='article'>
<h2>网络</h2>
<div class="well small">Permalink: <a class="more" href="/网络.html">1000-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/wang-luo.html">网络</a>
tags: <a href="/tag/wang-luo.html">网络</a> </div>
<div class="summary"><h2>OSI七层协议</h2>
<table>
<thead>
<tr>
<th>-</th>
<th>-</th>
</tr>
</thead>
<tbody>
<tr>
<td>物理层</td>
<td></td>
</tr>
<tr>
<td>数据层</td>
<td>rarp、arp</td>
</tr>
<tr>
<td>网络层</td>
<td>ip、IPv4、IPv6</td>
</tr>
<tr>
<td>传输层</td>
<td>tcp、udp</td>
</tr>
<tr>
<td>会话层</td>
<td></td>
</tr>
<tr>
<td>表示层</td>
<td></td>
</tr>
<tr>
<td>应用层</td>
<td>Ftp、ssh、http</td>
</tr>
</tbody>
</table>
<h2>HTTP协议</h2>
<h3>无状态</h3>
<ul>
<li>没有记忆功能,服务器不知道客户端是什么状态</li>
<li>解决办法:session,cookie</li>
</ul>
<h3>无连接</h3>
<ul>
<li>每次链接只处理一个请求,然后断开链接</li>
<li>解决办法:</li>
<li>轮询</li>
<li>长轮询</li>
<li>websocket</li>
</ul>
<h2>轮询</h2>
<ul>
<li>客户端定时向服务器发起请求,服务器接到请求后马上返回响应信息并关闭连接。</li>
<li>优点:后端编写程序容易</li>
<li>缺点:请求中有大半是无用,浪费带宽和服务器资源。</li>
<li>适用于小型应用</li>
</ul>
<h2>长轮询</h2>
<ul>
<li>客户端向服务器发起请求,服务器接到请求后hold住连接,直到有新消息才返回响应信息并关闭连接,客户端处理完响应信息后再向服务器发送新的请求。</li>
<li>优点:在无消息的情况下不会频繁的请求。</li>
<li>缺点:服务器hold连接会消耗资源 …</li></ul> <a class="btn primary xsmall" href="/网络.html">more…</a>
</div>
</div>
<div class='article'>
<h2>软连接</h2>
<div class="well small">Permalink: <a class="more" href="/软链接.html">1000-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/sui-shou-bi-ji.html">随手笔记</a>
tags: <a href="/tag/sui-shou-bi-ji.html">随手笔记</a> </div>
<div class="summary"><div class="highlight"><pre><span></span>增加
ln-s 源文件 软连接名
修改
ln –snf 源文件 软连接
删除
只删除软连接
rm -rf 软连接名
只删除源文件
rm -rf 源文件
-r循环
-f强制
</pre></div> <a class="btn primary xsmall" href="/软链接.html">more…</a>
</div>
</div>
<div class='article'>
<h2>Python-链接WIFI</h2>
<div class="well small">Permalink: <a class="more" href="/Python-链接WIFI.html">0999-01-01 18:44:00+00:09</a>
by <a class="url fn" href="/author/shang-wei.html">商伟 </a>
in <a href="/category/python.html">Python</a>
tags: <a href="/tag/python.html">Python</a> </div>
<div class="summary"><h4>生成密码字段</h4>
<div class="highlight"><pre><span></span><span class="c1"># -*- coding: utf-8 -*-</span>
<span class="kn">import</span> <span class="nn">itertools</span> <span class="kn">as</span> <span class="nn">its</span>
<span class="c1"># 单个字符的集合</span>
<span class="n">words</span><span class="o">=</span><span class="s2">"0123456789"</span>
<span class="c1"># 每次任选一个字符,重复8次</span>
<span class="n">arrays</span> <span class="o">=</span> <span class="n">its</span><span class="o">.</span><span class="n">product</span><span class="p">(</span><span class="n">words</span><span class="p">,</span> <span class="n">repeat</span> <span class="o">=</span> <span class="mi">8</span><span class="p">)</span>
<span class="c1"># 写入txt文本文件</span>
<span class="n">dictionary</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"C:/Users/Administrator/Desktop/dictionary.txt"</span><span class="p">,</span><span class="s2">"a"</span><span class="p">)</span>
<span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">arrays</span><span class="p">:</span>
<span class="c1"># 一行密码</span>
<span class="n">dictionary</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">item</span><span class="p">))</span>
<span class="c1"># 换行</span>
<span class="n">dictionary</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
<span class="c1"># 关闭文件</span>
<span class="n">dictionary</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">print</span><span class="p">(</span><span class="s2">"[mission completion …</span></pre></div> <a class="btn primary xsmall" href="/Python-链接WIFI.html">more…</a>
</div>
</div>
<div class="pagination">
<ul>
<li class="prev"><a href="/index8.html">← Previous</a></li>
<li class=""><a href="/index.html">1</a></li>
<li class=""><a href="/index2.html">2</a></li>
<li class=""><a href="/index3.html">3</a></li>
<li class=""><a href="/index4.html">4</a></li>
<li class=""><a href="/index5.html">5</a></li>
<li class=""><a href="/index6.html">6</a></li>
<li class=""><a href="/index7.html">7</a></li>
<li class=""><a href="/index8.html">8</a></li>
<li class="active"><a href="/index9.html">9</a></li>
<li class="next disabled"><a href="#">→ Next</a></li>
</ul>
</div>
<footer>
<p>Powered by <a href="http://getpelican.com/">Pelican</a>. Theme based on <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>.</p>
<p>© 商伟</p>
</footer>
</div>
</div>
</body>
</html>