-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
568 lines (287 loc) · 151 KB
/
atom.xml
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>CodeYu</title>
<link href="http://codeyu.com/atom.xml" rel="self"/>
<link href="http://codeyu.com/"/>
<updated>2025-04-12T03:50:10.344Z</updated>
<id>http://codeyu.com/</id>
<author>
<name>codeyu</name>
</author>
<generator uri="https://hexo.io/">Hexo</generator>
<entry>
<title>「~向き(むき)」与「~向け(むけ)」的用法区别</title>
<link href="http://codeyu.com/2025/04/12/muki-to-muke-difference/"/>
<id>http://codeyu.com/2025/04/12/muki-to-muke-difference/</id>
<published>2025-04-12T11:50:45.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>日语中的「~向き(むき)」和「~向け(むけ)」是两个看似相似但用法不同的语法形式。本文将帮助学习者理解它们的区别,掌握正确的使用场合。</p><h2 id="基本概念区别"><a class="header-anchor" href="#基本概念区别">¶</a>基本概念区别</h2><h3 id="「~向き-むき-」"><a class="header-anchor" href="#「~向き-むき-」">¶</a>「~向き(むき)」</h3><ul><li><strong>核心含义</strong>:表示某物/某人<strong>天生适合</strong>某种用途或环境</li><li><strong>关注点</strong>:强调事物本身的特点或性质使其适合某种用途</li><li><strong>特性</strong>:通常指事物固有的、难以改变的特性</li><li><strong>形式</strong>:可以用作「名词+向き」或「名词+向きだ/です」</li></ul><h3 id="「~向け-むけ-」"><a class="header-anchor" href="#「~向け-むけ-」">¶</a>「~向け(むけ)」</h3><ul><li><strong>核心含义</strong>:表示某物是<strong>专门为了</strong>某个对象/群体而设计、制作的</li><li><strong>关注点</strong>:强调制作或设计的意图和目标受众</li><li><strong>特性</strong>:通常指人为设计或安排的,有明确针对性的</li><li><strong>形式</strong>:可以用作「名词+向け」或「名词+向けだ/です」</li></ul><h2 id="详细用法解析"><a class="header-anchor" href="#详细用法解析">¶</a>详细用法解析</h2><h2 id="接续用法总结"><a class="header-anchor" href="#接续用法总结">¶</a>接续用法总结</h2><h3 id="「~向き-むき-」接续用法"><a class="header-anchor" href="#「~向き-むき-」接续用法">¶</a>「~向き(むき)」接续用法</h3><table><thead><tr><th>接续形式</th><th>用法说明</th><th>例句</th></tr></thead><tbody><tr><td>名词 + 向き</td><td>表示适合某类事物或人群</td><td>子供<strong>向き</strong>の本 (适合儿童的书)</td></tr><tr><td>名词 + 向きだ/です</td><td>表示事物适合某种用途(句尾)</td><td>この仕事は女性<strong>向きだ</strong>。(这份工作适合女性。)</td></tr><tr><td>名词 + 向きに + 动词</td><td>表示以适合…的方式做某事</td><td>初心者<strong>向きに</strong>説明する。(以适合初学者的方式说明。)</td></tr><tr><td>名词 + 向きの + 名词</td><td>修饰后接名词</td><td>夏<strong>向きの</strong>服装 (适合夏天的服装)</td></tr><tr><td>名词 + 向きではない</td><td>表示不适合某用途</td><td>この映画は子供<strong>向きではない</strong>。(这部电影不适合儿童。)</td></tr></tbody></table><h3 id="「~向け-むけ-」接续用法"><a class="header-anchor" href="#「~向け-むけ-」接续用法">¶</a>「~向け(むけ)」接续用法</h3><table><thead><tr><th>接续形式</th><th>用法说明</th><th>例句</th></tr></thead><tbody><tr><td>名词 + 向け</td><td>表示专为某对象设计</td><td>海外<strong>向け</strong>商品 (面向海外的商品)</td></tr><tr><td>名词 + 向けだ/です</td><td>表示事物是针对某对象(句尾)</td><td>このサービスは高齢者<strong>向けです</strong>。(这项服务是针对老年人的。)</td></tr><tr><td>名词 + 向けに + 动词</td><td>表示为了某对象而做某事</td><td>子供<strong>向けに</strong>開発する。(为儿童开发。)</td></tr><tr><td>名词 + 向けの + 名词</td><td>修饰后接名词</td><td>初心者<strong>向けの</strong>講座 (面向初学者的讲座)</td></tr><tr><td>名词 + 向けではない</td><td>表示不针对某对象</td><td>このゲームは子供<strong>向けではない</strong>。(这个游戏不是针对儿童的。)</td></tr></tbody></table><h3 id="「~向き-むき-」用法"><a class="header-anchor" href="#「~向き-むき-」用法">¶</a>「~向き(むき)」用法</h3><h4 id="1-表示适合性"><a class="header-anchor" href="#1-表示适合性">¶</a>1. 表示适合性</h4><p>「~向き」表示某事物由于其固有特性而自然适合某种用途、环境或人群。</p><p><strong>例句</strong>:</p><ul><li>この料理は子供<strong>向き</strong>だ。(这道菜适合孩子们吃。)</li><li>この本は初心者<strong>向き</strong>です。(这本书适合初学者。)</li><li>この仕事は几帳面な人<strong>向き</strong>です。(这份工作适合细心的人。)</li><li>夏<strong>向き</strong>の服装 (适合夏天的服装)</li></ul><h4 id="2-「~向きに」用法"><a class="header-anchor" href="#2-「~向きに」用法">¶</a>2. 「~向きに」用法</h4><p>表示"以适合…的方式"来改变或调整某事物。</p><p><strong>例句</strong>:</p><ul><li>このレシピを和食<strong>向きに</strong>アレンジしました。(我把这个菜谱改编得更适合日式料理。)</li><li>部屋を夏<strong>向きに</strong>模様替えしました。(我把房间重新装饰得更适合夏天。)</li><li>この文章を子供<strong>向きに</strong>書き直してください。(请把这篇文章重写得更适合儿童阅读。)</li></ul><h3 id="「~向け-むけ-」用法"><a class="header-anchor" href="#「~向け-むけ-」用法">¶</a>「~向け(むけ)」用法</h3><h4 id="1-表示目标对象"><a class="header-anchor" href="#1-表示目标对象">¶</a>1. 表示目标对象</h4><p>「~向け」表示某事物是专门为特定对象或群体制作、设计或准备的。</p><p><strong>例句</strong>:</p><ul><li>子供<strong>向け</strong>のテレビ番組 (专为儿童制作的电视节目)</li><li>海外市場<strong>向け</strong>の商品 (针对海外市场的商品)</li><li>初心者<strong>向け</strong>の説明書 (为初学者准备的说明书)</li><li>高齢者<strong>向け</strong>のサービス (面向老年人的服务)</li></ul><h4 id="2-「~向けに」用法"><a class="header-anchor" href="#2-「~向けに」用法">¶</a>2. 「~向けに」用法</h4><p>表示"为了…目标"而进行的准备、制作或开发活动。</p><p><strong>例句</strong>:</p><ul><li>海外市場<strong>向けに</strong>新商品を開発しています。(我们正在为海外市场开发新产品。)</li><li>初心者<strong>向けに</strong>詳しい説明書を作りました。(我们为初学者制作了详细的说明书。)</li><li>子供<strong>向けに</strong>特別なプログラムを用意しました。(我们为儿童准备了特别的节目。)</li></ul><h2 id="区别要点总结"><a class="header-anchor" href="#区别要点总结">¶</a>区别要点总结</h2><table><thead><tr><th>特点</th><th>「~向き(むき)」</th><th>「~向け(むけ)」</th></tr></thead><tbody><tr><td>重点</td><td>强调事物的自然适合性</td><td>强调专门为某对象设计</td></tr><tr><td>性质</td><td>侧重事物固有特性</td><td>侧重人为制作意图</td></tr><tr><td>场合</td><td>描述天生适合关系</td><td>描述专门针对关系</td></tr><tr><td>改变难度</td><td>相对难以改变的特性</td><td>可以根据目标调整</td></tr></tbody></table><h2 id="容易混淆的情况"><a class="header-anchor" href="#容易混淆的情况">¶</a>容易混淆的情况</h2><p>有时这两个表达可能看起来可以互换,但实际上有细微区别:</p><p><strong>例子对比</strong>:</p><ul><li>「子供向きの本」:内容自然适合孩子(可能不是专门为孩子写的,但由于内容简单有趣等特点自然适合孩子)</li><li>「子供向けの本」:专门为孩子设计制作的书(明确以儿童为目标受众)</li></ul><h2 id="记忆技巧"><a class="header-anchor" href="#记忆技巧">¶</a>记忆技巧</h2><p>为了更容易记住它们的区别,可以用以下记忆法:</p><ul><li>「<strong>向き</strong>」:想象一个"适合度指标"→某物<strong>自然适合</strong>某种用途(<strong>性质匹配</strong>)</li><li>「<strong>向け</strong>」:想象一个"目标箭头"→某物<strong>专门为</strong>某对象设计(<strong>目标定向</strong>)</li></ul><h2 id="常见使用场景对比"><a class="header-anchor" href="#常见使用场景对比">¶</a>常见使用场景对比</h2><table><thead><tr><th>场景</th><th>「~向き(むき)」例句</th><th>「~向け(むけ)」例句</th></tr></thead><tbody><tr><td>书籍</td><td>この小説は若者<strong>向き</strong>だ。<br>(这本小说适合年轻人。)</td><td>大学生<strong>向け</strong>の参考書<br>(针对大学生的参考书。)</td></tr><tr><td>产品</td><td>家庭用<strong>向き</strong>の商品<br>(适合家庭使用的商品。)</td><td>海外市場<strong>向け</strong>に開発された製品<br>(为海外市场开发的产品。)</td></tr><tr><td>教育</td><td>オンライン学習は独学<strong>向き</strong>の方法だ。<br>(在线学习是适合自学的方法。)</td><td>小学生<strong>向け</strong>の教材<br>(针对小学生的教材。)</td></tr><tr><td>职业</td><td>この仕事は几帳面な人<strong>向き</strong>です。<br>(这份工作适合细心的人。)</td><td>新入社員<strong>向け</strong>の研修<br>(针对新员工的培训。)</td></tr><tr><td>活动</td><td>室内<strong>向き</strong>の趣味<br>(适合室内的爱好。)</td><td>外国人観光客<strong>向け</strong>のツアー<br>(针对外国游客的旅行团。)</td></tr></tbody></table><h2 id="练习题"><a class="header-anchor" href="#练习题">¶</a>练习题</h2><p>尝试选择合适的形式填空:</p><ol><li>この映画は大人( )です。子供には少し難しいかもしれません。</li><li>来週の展示会は外国人( )に特別なガイドを準備しています。</li><li>このスマホは高齢者( )に開発された簡単な操作ができる機種です。</li><li>秋( )のファッションが店に並び始めました。</li><li>このゲームは女性( )にデザインされています。</li><li>小さな子供( )の食事を用意しましょう。</li><li>在宅勤務は集中力のある人( )の働き方です。</li><li>企業( )のセミナーを開催します。</li><li>この問題集は上級者( )です。</li><li>海外旅行( )に役立つ情報をまとめました。</li></ol><p><strong>答案</strong>:1. 向き 2. 向けに 3. 向けに 4. 向き 5. 向けに 6. 向け 7. 向き 8. 向け 9. 向き 10. 向きに</p><hr><p>通过理解「向き」和「向け」的核心区别,日语学习者可以更准确地表达"适合性"和"针对性"的概念,提高语言表达的精确度。</p>]]></content>
<summary type="html"><span id="more"></span>
<p>日语中的「~向き(むき)」和「~向け(むけ)」是两个看似相似但用法不同的语法形式。本文将帮助学习者理解它们的区别,掌握正确的使用场合。</p>
<h2 id="基本概念区别"><a class="header-anchor" </summary>
<category term="日语学习" scheme="http://codeyu.com/categories/%E6%97%A5%E8%AF%AD%E5%AD%A6%E4%B9%A0/"/>
<category term="日语" scheme="http://codeyu.com/tags/%E6%97%A5%E8%AF%AD/"/>
<category term="日语学习" scheme="http://codeyu.com/tags/%E6%97%A5%E8%AF%AD%E5%AD%A6%E4%B9%A0/"/>
<category term="日语语法" scheme="http://codeyu.com/tags/%E6%97%A5%E8%AF%AD%E8%AF%AD%E6%B3%95/"/>
<category term="日语用法区别" scheme="http://codeyu.com/tags/%E6%97%A5%E8%AF%AD%E7%94%A8%E6%B3%95%E5%8C%BA%E5%88%AB/"/>
</entry>
<entry>
<title>如何实现 ssh 无密码登录</title>
<link href="http://codeyu.com/2018/04/12/run-sudo-command-without-password-linux/"/>
<id>http://codeyu.com/2018/04/12/run-sudo-command-without-password-linux/</id>
<published>2018-04-12T00:18:38.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>背景:你使用 <code>jeffer</code> 用户名登录服务器 <code>some.server.cn</code></p><h2 id="步骤:"><a class="header-anchor" href="#步骤:">¶</a>步骤:</h2><ol><li><p>在 ~/.ssh 目录下 生成一对公私钥:</p><p><code>$ ssh-keygen -t rsa -f id_some_server</code></p></li><li><p>把公钥复制到服务器:</p><p><code>$ ssh-copy-id -i id_some_server.pub [email protected]</code></p></li><li><p>测试效果:</p><p><code>ssh [email protected]</code></p></li><li><p>若有多对公私钥,可能需要在 <code>config</code> 文件里配置下别名:</p> <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">Host some #别名</span><br><span class="line">HostName some.server.cn</span><br><span class="line">User jeffer</span><br><span class="line">PreferredAuthentications publickey</span><br><span class="line">IdentityFile ~/.ssh/id_some_server</span><br></pre></td></tr></table></figure></li><li><p>可以使用别名快速登录:</p><p><code>ssh some</code></p></li></ol><h2 id="常见问题"><a class="header-anchor" href="#常见问题">¶</a>常见问题</h2><ol><li><p>登录时若仍然需要密码,可能需要在服务器上设置 ssh 目录的权限:</p><p><code>$ chmod 700 ~/.ssh/authorized_keys</code></p></li></ol><p>以上。</p>]]></content>
<summary type="html"><span id="more"></span>
<p>背景:你使用 <code>jeffer</code> 用户名登录服务器 <code>some.server.cn</code></p>
<h2 id="步骤:"><a class="header-anchor" href="#</summary>
<category term="技术" scheme="http://codeyu.com/categories/%E6%8A%80%E6%9C%AF/"/>
<category term="Linux" scheme="http://codeyu.com/tags/Linux/"/>
</entry>
<entry>
<title>在 CentOS/RHEL 7/6 和 Fedora 26/25 系统里如何安装 Java 8</title>
<link href="http://codeyu.com/2017/09/29/install-java-8-on-centos-rhel-and-fedora/"/>
<id>http://codeyu.com/2017/09/29/install-java-8-on-centos-rhel-and-fedora/</id>
<published>2017-09-29T14:58:15.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>After a long wait, finally Java SE Development Kit 8 is available to download. JDK 8 has been released on Mar,18 2014 for general availability with the many featured enhancements. You can find all the enhancements in JDK 8 here.</p><p><img src="http://codeyu.qiniudn.com/linux-with-java.png" alt="Java on Linux"></p><p>This article will help you to Install JAVA 8 (JDK/JRE 8u144) or update on your system. Read the instruction carefully before downloading Java from Linux command line. To Install Java 8 in Ubuntu and LinuxMint read <a href="https://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/">This Article</a>.</p><h2 id="Step-1-–-Download-Latest-Java-Archive"><a class="header-anchor" href="#Step-1-–-Download-Latest-Java-Archive">¶</a>Step 1 – Download Latest Java Archive</h2><p>Download latest Java SE Development Kit 8 release from its official download page or use following commands to download from shell.</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># cd /opt/</span></span><br><span class="line"><span class="comment"># wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># tar xzf jdk-8u144-linux-x64.tar.gz</span></span><br></pre></td></tr></table></figure><h2 id="Step-2-–-Install-Java-8-with-Alternatives"><a class="header-anchor" href="#Step-2-–-Install-Java-8-with-Alternatives">¶</a>Step 2 – Install Java 8 with Alternatives</h2><p>After extracting archive file use alternatives command to install it. alternatives command is available in chkconfig package.</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># cd /opt/jdk1.8.0_144/</span></span><br><span class="line"><span class="comment"># alternatives --install /usr/bin/java java /opt/jdk1.8.0_144/bin/java 2</span></span><br><span class="line"><span class="comment"># alternatives --config java</span></span><br><span class="line"></span><br><span class="line">There are 3 programs <span class="built_in">which</span> provide <span class="string">'java'</span>.</span><br><span class="line"></span><br><span class="line"> Selection Command</span><br><span class="line">-----------------------------------------------</span><br><span class="line">* 1 /opt/jdk1.7.0_71/bin/java</span><br><span class="line"> + 2 /opt/jdk1.8.0_45/bin/java</span><br><span class="line"> 3 /opt/jdk1.8.0_91/bin/java</span><br><span class="line"> 4 /opt/jdk1.8.0_144/bin/java</span><br><span class="line"></span><br><span class="line">Enter to keep the current selection[+], or <span class="built_in">type</span> selection number: 4</span><br></pre></td></tr></table></figure><p>At this point JAVA 8 has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_144/bin/jar 2</span></span><br><span class="line"><span class="comment"># alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_144/bin/javac 2</span></span><br><span class="line"><span class="comment"># alternatives --set jar /opt/jdk1.8.0_144/bin/jar</span></span><br><span class="line"><span class="comment"># alternatives --set javac /opt/jdk1.8.0_144/bin/javac</span></span><br></pre></td></tr></table></figure><h2 id="Step-3-–-Check-Installed-Java-Version"><a class="header-anchor" href="#Step-3-–-Check-Installed-Java-Version">¶</a>Step 3 – Check Installed Java Version</h2><p>Check the installed Java version on your system using following command.</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">root@tecadmin ~# java -version</span><br><span class="line"></span><br><span class="line">java version <span class="string">"1.8.0_144"</span></span><br><span class="line">Java(TM) SE Runtime Environment (build 1.8.0_144-b01)</span><br><span class="line">Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)</span><br></pre></td></tr></table></figure><h2 id="Step-4-–-Setup-Java-Environment-Variables"><a class="header-anchor" href="#Step-4-–-Setup-Java-Environment-Variables">¶</a>Step 4 – Setup Java Environment Variables</h2><p>Most of Java based application’s uses environment variables to work. Set the Java environment variables using following commands</p><ul><li>Setup JAVA_HOME Variable</li></ul><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># export JAVA_HOME=/opt/jdk1.8.0_144</span></span><br></pre></td></tr></table></figure><ul><li>Setup JRE_HOME Variable</li></ul><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># export JRE_HOME=/opt/jdk1.8.0_144/jre</span></span><br></pre></td></tr></table></figure><ul><li>Setup PATH Variable</li></ul><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># export PATH=$PATH:/opt/jdk1.8.0_144/bin:/opt/jdk1.8.0_144/jre/bin</span></span><br></pre></td></tr></table></figure><p>Also put all above environment variables in /etc/environment file for auto loading on system boot.</p><blockquote><p>原文地址:<a href="https://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/">https://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/</a></p></blockquote><blockquote><p>Written with <a href="https://stackedit.io/">StackEdit</a>.</p></blockquote><!--stackedit_data:eyJoaXN0b3J5IjpbLTEwMTEwODQyMjZdfQ==-->]]></content>
<summary type="html"><span id="more"></span>
<p>After a long wait, finally Java SE Development Kit 8 is available to download. JDK 8 has been released on Mar,18 </summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="linux" scheme="http://codeyu.com/tags/linux/"/>
<category term="java" scheme="http://codeyu.com/tags/java/"/>
<category term="how-to" scheme="http://codeyu.com/tags/how-to/"/>
</entry>
<entry>
<title>Welcome to StackEdit!</title>
<link href="http://codeyu.com/2017/09/29/Welcome-to-StackEdit/"/>
<id>http://codeyu.com/2017/09/29/Welcome-to-StackEdit/</id>
<published>2017-09-29T10:56:15.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>Hey! I’m your first Markdown document in <strong>StackEdit</strong><sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. Don’t delete me, I’m here to help! I can be recovered anyway in the <strong>Utils</strong> tab of the <i class="icon-cog"></i> <strong>Settings</strong> dialog.</p><h2 id="Documents"><a class="header-anchor" href="#Documents">¶</a>Documents</h2><p>StackEdit stores your documents in your browser, which means all your documents are automatically saved locally and are accessible <strong>offline!</strong></p><blockquote><p><strong>Note:</strong></p></blockquote><blockquote><ul><li>StackEdit is accessible offline after the application has been loaded for the first time.</li><li>Your local documents are not shared between different browsers or computers.</li><li>Clearing your browser’s data may <strong>delete all your local documents!</strong> Make sure your documents are synchronized with <strong>Google Drive</strong> or <strong>Dropbox</strong> (check out the <a href="#synchronization"><i class="icon-refresh"></i> Synchronization</a> section).</li></ul></blockquote><h4 id="i-class-icon-file-i-Create-a-document"><a class="header-anchor" href="#i-class-icon-file-i-Create-a-document">¶</a><i class="icon-file"></i> Create a document</h4><p>The document panel is accessible using the <i class="icon-folder-open"></i> button in the navigation bar. You can create a new document by clicking <i class="icon-file"></i> <strong>New document</strong> in the document panel.</p><h4 id="i-class-icon-folder-open-i-Switch-to-another-document"><a class="header-anchor" href="#i-class-icon-folder-open-i-Switch-to-another-document">¶</a><i class="icon-folder-open"></i> Switch to another document</h4><p>All your local documents are listed in the document panel. You can switch from one to another by clicking a document in the list or you can toggle documents using <kbd>Ctrl+[</kbd> and <kbd>Ctrl+]</kbd>.</p><h4 id="i-class-icon-pencil-i-Rename-a-document"><a class="header-anchor" href="#i-class-icon-pencil-i-Rename-a-document">¶</a><i class="icon-pencil"></i> Rename a document</h4><p>You can rename the current document by clicking the document title in the navigation bar.</p><h4 id="i-class-icon-trash-i-Delete-a-document"><a class="header-anchor" href="#i-class-icon-trash-i-Delete-a-document">¶</a><i class="icon-trash"></i> Delete a document</h4><p>You can delete the current document by clicking <i class="icon-trash"></i> <strong>Delete document</strong> in the document panel.</p><h4 id="i-class-icon-hdd-i-Export-a-document"><a class="header-anchor" href="#i-class-icon-hdd-i-Export-a-document">¶</a><i class="icon-hdd"></i> Export a document</h4><p>You can save the current document to a file by clicking <i class="icon-hdd"></i> <strong>Export to disk</strong> from the <i class="icon-provider-stackedit"></i> menu panel.</p><blockquote><p><strong>Tip:</strong> Check out the <a href="#publish-a-document"><i class="icon-upload"></i> Publish a document</a> section for a description of the different output formats.</p></blockquote><h2 id="Synchronization"><a class="header-anchor" href="#Synchronization">¶</a>Synchronization</h2><p>StackEdit can be combined with <i class="icon-provider-gdrive"></i> <strong>Google Drive</strong> and <i class="icon-provider-dropbox"></i> <strong>Dropbox</strong> to have your documents saved in the <em>Cloud</em>. The synchronization mechanism takes care of uploading your modifications or downloading the latest version of your documents.</p><blockquote><p><strong>Note:</strong></p></blockquote><blockquote><ul><li>Full access to <strong>Google Drive</strong> or <strong>Dropbox</strong> is required to be able to import any document in StackEdit. Permission restrictions can be configured in the settings.</li><li>Imported documents are downloaded in your browser and are not transmitted to a server.</li><li>If you experience problems saving your documents on Google Drive, check and optionally disable browser extensions, such as Disconnect.</li></ul></blockquote><h4 id="i-class-icon-refresh-i-Open-a-document"><a class="header-anchor" href="#i-class-icon-refresh-i-Open-a-document">¶</a><i class="icon-refresh"></i> Open a document</h4><p>You can open a document from <i class="icon-provider-gdrive"></i> <strong>Google Drive</strong> or the <i class="icon-provider-dropbox"></i> <strong>Dropbox</strong> by opening the <i class="icon-refresh"></i> <strong>Synchronize</strong> sub-menu and by clicking <strong>Open from…</strong>. Once opened, any modification in your document will be automatically synchronized with the file in your <strong>Google Drive</strong> / <strong>Dropbox</strong> account.</p><h4 id="i-class-icon-refresh-i-Save-a-document"><a class="header-anchor" href="#i-class-icon-refresh-i-Save-a-document">¶</a><i class="icon-refresh"></i> Save a document</h4><p>You can save any document by opening the <i class="icon-refresh"></i> <strong>Synchronize</strong> sub-menu and by clicking <strong>Save on…</strong>. Even if your document is already synchronized with <strong>Google Drive</strong> or <strong>Dropbox</strong>, you can export it to a another location. StackEdit can synchronize one document with multiple locations and accounts.</p><h4 id="i-class-icon-refresh-i-Synchronize-a-document"><a class="header-anchor" href="#i-class-icon-refresh-i-Synchronize-a-document">¶</a><i class="icon-refresh"></i> Synchronize a document</h4><p>Once your document is linked to a <i class="icon-provider-gdrive"></i> <strong>Google Drive</strong> or a <i class="icon-provider-dropbox"></i> <strong>Dropbox</strong> file, StackEdit will periodically (every 3 minutes) synchronize it by downloading/uploading any modification. A merge will be performed if necessary and conflicts will be detected.</p><p>If you just have modified your document and you want to force the synchronization, click the <i class="icon-refresh"></i> button in the navigation bar.</p><blockquote><p><strong>Note:</strong> The <i class="icon-refresh"></i> button is disabled when you have no document to synchronize.</p></blockquote><h4 id="i-class-icon-refresh-i-Manage-document-synchronization"><a class="header-anchor" href="#i-class-icon-refresh-i-Manage-document-synchronization">¶</a><i class="icon-refresh"></i> Manage document synchronization</h4><p>Since one document can be synchronized with multiple locations, you can list and manage synchronized locations by clicking <i class="icon-refresh"></i> <strong>Manage synchronization</strong> in the <i class="icon-refresh"></i> <strong>Synchronize</strong> sub-menu. This will let you remove synchronization locations that are associated to your document.</p><blockquote><p><strong>Note:</strong> If you delete the file from <strong>Google Drive</strong> or from <strong>Dropbox</strong>, the document will no longer be synchronized with that location.</p></blockquote><h2 id="Publication"><a class="header-anchor" href="#Publication">¶</a>Publication</h2><p>Once you are happy with your document, you can publish it on different websites directly from StackEdit. As for now, StackEdit can publish on <strong>Blogger</strong>, <strong>Dropbox</strong>, <strong>Gist</strong>, <strong>GitHub</strong>, <strong>Google Drive</strong>, <strong>Tumblr</strong>, <strong>WordPress</strong> and on any SSH server.</p><h4 id="i-class-icon-upload-i-Publish-a-document"><a class="header-anchor" href="#i-class-icon-upload-i-Publish-a-document">¶</a><i class="icon-upload"></i> Publish a document</h4><p>You can publish your document by opening the <i class="icon-upload"></i> <strong>Publish</strong> sub-menu and by choosing a website. In the dialog box, you can choose the publication format:</p><ul><li>Markdown, to publish the Markdown text on a website that can interpret it (<strong>GitHub</strong> for instance),</li><li>HTML, to publish the document converted into HTML (on a blog for example),</li><li>Template, to have a full control of the output.</li></ul><blockquote><p><strong>Note:</strong> The default template is a simple webpage wrapping your document in HTML format. You can customize it in the <strong>Advanced</strong> tab of the <i class="icon-cog"></i> <strong>Settings</strong> dialog.</p></blockquote><h4 id="i-class-icon-upload-i-Update-a-publication"><a class="header-anchor" href="#i-class-icon-upload-i-Update-a-publication">¶</a><i class="icon-upload"></i> Update a publication</h4><p>After publishing, StackEdit will keep your document linked to that publication which makes it easy for you to update it. Once you have modified your document and you want to update your publication, click on the <i class="icon-upload"></i> button in the navigation bar.</p><blockquote><p><strong>Note:</strong> The <i class="icon-upload"></i> button is disabled when your document has not been published yet.</p></blockquote><h4 id="i-class-icon-upload-i-Manage-document-publication"><a class="header-anchor" href="#i-class-icon-upload-i-Manage-document-publication">¶</a><i class="icon-upload"></i> Manage document publication</h4><p>Since one document can be published on multiple locations, you can list and manage publish locations by clicking <i class="icon-upload"></i> <strong>Manage publication</strong> in the <i class="icon-provider-stackedit"></i> menu panel. This will let you remove publication locations that are associated to your document.</p><blockquote><p><strong>Note:</strong> If the file has been removed from the website or the blog, the document will no longer be published on that location.</p></blockquote><h2 id="Markdown-Extra"><a class="header-anchor" href="#Markdown-Extra">¶</a>Markdown Extra</h2><p>StackEdit supports <strong>Markdown Extra</strong>, which extends <strong>Markdown</strong> syntax with some nice features.</p><blockquote><p><strong>Tip:</strong> You can disable any <strong>Markdown Extra</strong> feature in the <strong>Extensions</strong> tab of the <i class="icon-cog"></i> <strong>Settings</strong> dialog.</p></blockquote><blockquote><p><strong>Note:</strong> You can find more information about <strong>Markdown</strong> syntax <a href="http://daringfireball.net/projects/markdown/syntax" title="Markdown">here</a> and <strong>Markdown Extra</strong> extension <a href="https://github.com/jmcmanus/pagedown-extra" title="Pagedown Extra">here</a>.</p></blockquote><h3 id="Tables"><a class="header-anchor" href="#Tables">¶</a>Tables</h3><p><strong>Markdown Extra</strong> has a special syntax for tables:</p><table><thead><tr><th>Item</th><th>Value</th></tr></thead><tbody><tr><td>Computer</td><td>$1600</td></tr><tr><td>Phone</td><td>$12</td></tr><tr><td>Pipe</td><td>$1</td></tr></tbody></table><p>You can specify column alignment with one or two colons:</p><table><thead><tr><th style="text-align:left">Item</th><th style="text-align:right">Value</th><th style="text-align:center">Qty</th></tr></thead><tbody><tr><td style="text-align:left">Computer</td><td style="text-align:right">$1600</td><td style="text-align:center">5</td></tr><tr><td style="text-align:left">Phone</td><td style="text-align:right">$12</td><td style="text-align:center">12</td></tr><tr><td style="text-align:left">Pipe</td><td style="text-align:right">$1</td><td style="text-align:center">234</td></tr></tbody></table><h3 id="Definition-Lists"><a class="header-anchor" href="#Definition-Lists">¶</a>Definition Lists</h3><p><strong>Markdown Extra</strong> has a special syntax for definition lists too:</p><p>Term 1<br>Term 2<br>: Definition A<br>: Definition B</p><p>Term 3</p><p>: Definition C</p><p>: Definition D</p><pre><code>> part of definition D</code></pre><h3 id="Fenced-code-blocks"><a class="header-anchor" href="#Fenced-code-blocks">¶</a>Fenced code blocks</h3><p>GitHub’s fenced code blocks are also supported with <strong>Highlight.js</strong> syntax highlighting:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">// Foo</span><br><span class="line">var bar = 0;</span><br></pre></td></tr></table></figure><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> foo = <span class="string">'bar'</span>; <span class="comment">// baz</span></span><br></pre></td></tr></table></figure><blockquote><p><strong>Tip:</strong> To use <strong>Prettify</strong> instead of <strong>Highlight.js</strong>, just configure the <strong>Markdown Extra</strong> extension in the <i class="icon-cog"></i> <strong>Settings</strong> dialog.</p></blockquote><blockquote><p><strong>Note:</strong> You can find more information:</p></blockquote><blockquote><ul><li>about <strong>Prettify</strong> syntax highlighting <a href="https://code.google.com/p/google-code-prettify/">here</a>,</li><li>about <strong>Highlight.js</strong> syntax highlighting <a href="http://highlightjs.org/">here</a>.</li></ul></blockquote><h3 id="Footnotes"><a class="header-anchor" href="#Footnotes">¶</a>Footnotes</h3><p>You can create footnotes like this<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>.</p><h3 id="SmartyPants"><a class="header-anchor" href="#SmartyPants">¶</a>SmartyPants</h3><p>SmartyPants converts ASCII punctuation characters into “smart” typographic punctuation HTML entities. For example:</p><table><thead><tr><th></th><th>ASCII</th><th>HTML</th></tr></thead><tbody><tr><td>Single backticks</td><td><code>'Isn't this fun?'</code></td><td>‘Isn’t this fun?’</td></tr><tr><td>Quotes</td><td><code>"Isn't this fun?"</code></td><td>“Isn’t this fun?”</td></tr><tr><td>Dashes</td><td><code>-- is en-dash, --- is em-dash</code></td><td>– is en-dash, — is em-dash</td></tr></tbody></table><h3 id="Table-of-contents"><a class="header-anchor" href="#Table-of-contents">¶</a>Table of contents</h3><p>You can insert a table of contents using the marker <code>[TOC]</code>:</p><p>[TOC]</p><h3 id="MathJax"><a class="header-anchor" href="#MathJax">¶</a>MathJax</h3><p>You can render <em>LaTeX</em> mathematical expressions using <strong>MathJax</strong>, as on <a href="http://math.stackexchange.com/">math.stackexchange.com</a>:</p><p>The <em>Gamma function</em> satisfying $\Gamma(n) = (n-1)!\quad\forall n\in\mathbb N$ is via the Euler integral</p><p>$$<br>\Gamma(z) = \int_0^\infty t<sup>{z-1}e</sup>{-t}dt,.<br>$$</p><blockquote><p><strong>Tip:</strong> To make sure mathematical expressions are rendered properly on your website, include <strong>MathJax</strong> into your template:</p></blockquote><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script></span><br></pre></td></tr></table></figure><blockquote><p><strong>Note:</strong> You can find more information about <strong>LaTeX</strong> mathematical expressions <a href="http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference">here</a>.</p></blockquote><h3 id="UML-diagrams"><a class="header-anchor" href="#UML-diagrams">¶</a>UML diagrams</h3><p>You can also render sequence diagrams like this:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Alice->Bob: Hello Bob, how are you?</span><br><span class="line">Note right of Bob: Bob thinks</span><br><span class="line">Bob-->Alice: I am good thanks!</span><br></pre></td></tr></table></figure><p>And flow charts like this:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">st=>start: Start</span><br><span class="line">e=>end</span><br><span class="line">op=>operation: My Operation</span><br><span class="line">cond=>condition: Yes or No?</span><br><span class="line"></span><br><span class="line">st->op->cond</span><br><span class="line">cond(yes)->e</span><br><span class="line">cond(no)->op</span><br></pre></td></tr></table></figure><blockquote><p><strong>Note:</strong> You can find more information:</p></blockquote><blockquote><ul><li>about <strong>Sequence diagrams</strong> syntax <a href="http://bramp.github.io/js-sequence-diagrams/">here</a>,</li><li>about <strong>Flow charts</strong> syntax <a href="http://adrai.github.io/flowchart.js/">here</a>.</li></ul></blockquote><h3 id="Support-StackEdit"><a class="header-anchor" href="#Support-StackEdit">¶</a>Support StackEdit</h3><p><a href="https://monetizejs.com/authorize?client_id=ESTHdCYOi18iLhhO&summary=true"><img src="https://cdn.monetizejs.com/resources/button-32.png" alt=""></a></p><!--stackedit_data:eyJoaXN0b3J5IjpbLTI1NDY2NTQzOF19--><hr class="footnotes-sep"><section class="footnotes"><ol class="footnotes-list"><li id="fn1" class="footnote-item"><p><a href="https://stackedit.io/">StackEdit</a> is a full-featured, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites. <a href="#fnref1" class="footnote-backref">↩︎</a></p></li><li id="fn2" class="footnote-item"><p>Here is the <em>text</em> of the <strong>footnote</strong>. <a href="#fnref2" class="footnote-backref">↩︎</a></p></li></ol></section>]]></content>
<summary type="html"><span id="more"></span>
<p>Hey! I’m your first Markdown document in <strong>StackEdit</strong><sup class="footnote-ref"><a href="#fn1" id="f</summary>
<category term="其他" scheme="http://codeyu.com/categories/%E5%85%B6%E4%BB%96/"/>
<category term="学习" scheme="http://codeyu.com/tags/%E5%AD%A6%E4%B9%A0/"/>
</entry>
<entry>
<title>用 Headless Chrome 进行测试自动化</title>
<link href="http://codeyu.com/2017/06/18/automated-testing-with-headless-chrome/"/>
<id>http://codeyu.com/2017/06/18/automated-testing-with-headless-chrome/</id>
<published>2017-06-18T21:42:22.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>如果你想用 Chrome 浏览器的 Headless 模式运行自动化测试,不用东奔西走。这篇文章就是教你怎么使用 Karma 和 Mocha+Chai 进行测试。</p><p><strong>你说的啥?</strong>(黑人问号)</p><p>Karma, Mocha, Chai, Headless Chrome, 你居然不知道???</p><p><a href="https://karma-runner.github.io/">Karma</a> 是一个测试套件,它适用于任何最受欢迎的测试框架(如 <a href="https://jasmine.github.io/">Jasmine</a>, <a href="https://mochajs.org/">Mocha</a>, <a href="https://qunitjs.com/">QUnit</a> 等).</p><p><a href="http://chaijs.com/">Chai</a> 是工作在 Node 和浏览器中的断言库,我们在浏览器中使用它。</p><p><a href="https://developers.google.com/web/updates/2017/04/headless-chrome">Headless Chrome</a> 是运行 chrome 浏览器的一种方式,它在没有用户界面的无头环境中运行。用 Headless Chrome 的好处之一是你的 JavaScript 测试代码的运行环境和你网站的用户是一样的(而不是直接在 Node 中测试) 。Headless Chrome 给你一个真正的浏览器环境但没有完整版 chrome 浏览器那样的内存开销。</p><h2 id="设置"><a class="header-anchor" href="#设置">¶</a>设置</h2><h3 id="安装"><a class="header-anchor" href="#安装">¶</a>安装</h3><p>用 yarn 安装 Karma,相关的插件,和测试工具:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">yarn add --dev karma karma-chrome-launcher karma-mocha karma-chai</span><br><span class="line">yarn add --dev mocha chai</span><br></pre></td></tr></table></figure><p>或者使用 npm:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm i --save-dev karma karma-chrome-launcher karma-mocha karma-chai</span><br><span class="line">npm i --save-dev mocha chai</span><br></pre></td></tr></table></figure><p>在这篇文章中我使用 Mocha 和 Chai,但如果你不想用,你可以选择任何你喜欢的可以在浏览器中使用的断言库。</p><h3 id="配置-Karma"><a class="header-anchor" href="#配置-Karma">¶</a>配置 Karma</h3><p>为了使用 ChromeHeadless 启动器,需创建 <code>karma.config.js</code> 文件。</p><p><strong>karma.conf.js</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">module.exports = function(config) {</span><br><span class="line"> config.set({</span><br><span class="line"> frameworks: ['mocha', 'chai'],</span><br><span class="line"> files: ['test/**/*.js'],</span><br><span class="line"> reporters: ['progress'],</span><br><span class="line"> port: 9876, // karma web server port</span><br><span class="line"> colors: true,</span><br><span class="line"> logLevel: config.LOG_INFO,</span><br><span class="line"> browsers: ['ChromeHeadless'],</span><br><span class="line"> autoWatch: false,</span><br><span class="line"> // singleRun: false, // Karma captures browsers, runs the tests and exits</span><br><span class="line"> concurrency: Infinity</span><br><span class="line"> })</span><br><span class="line">}</span><br></pre></td></tr></table></figure><aside class="note"><p>注意: 执行 <code> ./node_modules/karma/bin/ init karma.conf.js</code> 去生成 Karma 配置文件。</p></aside><h2 id="写一个测试"><a class="header-anchor" href="#写一个测试">¶</a>写一个测试</h2><p>在 <code> /test/test.js</code> 中写测试代码。</p><p><strong>/test/test.js</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">describe('Array', () => {</span><br><span class="line"> describe('#indexOf()', () => {</span><br><span class="line"> it('should return -1 when the value is not present', () => {</span><br><span class="line"> assert.equal(-1, [1,2,3].indexOf(4));</span><br><span class="line"> });</span><br><span class="line"> });</span><br><span class="line">});</span><br></pre></td></tr></table></figure><h2 id="执行你的测试"><a class="header-anchor" href="#执行你的测试">¶</a>执行你的测试</h2><p>为了根据我们的设置执行 Karma,需要在 <code>package.json</code> 文件中添加测试脚本命令:</p><p><strong>package.json</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">"scripts": {</span><br><span class="line"> "test": "karma start --single-run --browsers ChromeHeadless karma.conf.js"</span><br><span class="line">}</span><br></pre></td></tr></table></figure><p>当你执行测试命令(<code>npm test</code> 或 <code>yarn test</code>),Headless Chrome<br>将被激活运行并且输出结果到终端:<br><img src="https://github.com/codeyu/headless-karma-travis/blob/master/mac%20headless%20chrome%20test.png?raw=true" alt=""></p><aside class="caution"><p><strong>警告:</strong></p><p><strong>Chrome 59</strong> 的无头模式当前在 Mac 和 Linux 系统可用。</p><p><a href="https://bugs.chromium.org/p/chromium/issues/detail?id=686608">Windows 支持</a> 要等到 <strong>Chrome 60</strong>。</p><p>查看你的浏览器的版本,在地址栏输入: <code>chrome://version</code> 。</p></aside><h2 id="创建你自己的-Headless-Chrome-启动器"><a class="header-anchor" href="#创建你自己的-Headless-Chrome-启动器">¶</a>创建你自己的 Headless Chrome 启动器</h2><p>使用 <code>ChromeHeadless</code> 启动器在 Headless Chrome 上开箱即用,它包括合适的 Chrome 参数和固定的远程调试端口 <code>9222</code>。这挺不错的。</p><p>尽管如此,有时候你可能想要给 Chrome 传递个性化的参数或者改变启动器使用的远程调试端口。有鉴于此,可以扩展 <code>ChromeHeadless</code> 启动器创建 <code>customLaunchers</code> 配置项:</p><p><strong>karma.conf.js</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">module.exports = function(config) {</span><br><span class="line"> ...</span><br><span class="line"></span><br><span class="line"> config.set({</span><br><span class="line"> browsers: ['Chrome', 'ChromeHeadless', 'MyHeadlessChrome'],</span><br><span class="line"></span><br><span class="line"> customLaunchers: {</span><br><span class="line"> MyHeadlessChrome: {</span><br><span class="line"> base: 'ChromeHeadless',</span><br><span class="line"> flags: ['--disable-translate', '--disable-extensions', '--remote-debugging-port=9223']</span><br><span class="line"> }</span><br><span class="line"> },</span><br><span class="line"> }</span><br><span class="line">};</span><br></pre></td></tr></table></figure><h2 id="使用-Travis-CI-持续集成"><a class="header-anchor" href="#使用-Travis-CI-持续集成">¶</a>使用 Travis CI 持续集成</h2><p>在 Headless Chrome 配置 Karma 执行测试任务并不轻松。<br>不过使用 Travis 持续集成只需要几行代码!<br>为了在 Travis 中 执行测试命令,需要使用 <code>dist: trusty</code> 并且安装 稳定版 Chrome 插件:</p><p><strong>.travis.yml</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">language: node_js</span><br><span class="line">node_js:</span><br><span class="line"> - "7"</span><br><span class="line">dist: trusty # needs Ubuntu Trusty</span><br><span class="line">sudo: false # no need for virtualization.</span><br><span class="line">addons:</span><br><span class="line"> chrome: stable # have Travis install chrome stable.</span><br><span class="line">cache:</span><br><span class="line"> yarn: true</span><br><span class="line"> directories:</span><br><span class="line"> - node_modules</span><br><span class="line">install:</span><br><span class="line"> - yarn</span><br><span class="line">script:</span><br><span class="line"> - yarn test</span><br></pre></td></tr></table></figure><aside class="note"><p>注意:完整例子程序在 <a href="https://github.com/codeyu/headless-karma-travis">headless karma travis</a></p></aside><blockquote><p>原文地址: <a href="https://developers.google.com/web/updates/2017/06/headless-karma-mocha-chai">Automated testing with Headless Chrome</a></p></blockquote>]]></content>
<summary type="html"><span id="more"></span>
<p>如果你想用 Chrome 浏览器的 Headless 模式运行自动化测试,不用东奔西走。这篇文章就是教你怎么使用 Karma 和 Mocha+Chai 进行测试。</p>
<p><strong>你说的啥?</strong>(黑</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="chrome" scheme="http://codeyu.com/tags/chrome/"/>
<category term="node.js" scheme="http://codeyu.com/tags/node-js/"/>
<category term="test" scheme="http://codeyu.com/tags/test/"/>
</entry>
<entry>
<title>如何查找端口占用及杀掉进程</title>
<link href="http://codeyu.com/2017/06/17/how-find-a-port-and-kill-it/"/>
<id>http://codeyu.com/2017/06/17/how-find-a-port-and-kill-it/</id>
<published>2017-06-17T19:05:59.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><h3 id="Windows-系统"><a class="header-anchor" href="#Windows-系统">¶</a>Windows 系统</h3><p>有一天,我在 Windows 系统启动 Hadoop 服务时,弹出错误提示:10000 端口被占用。</p><p>那么,我们来看看如何找到占用 10000 端口的进程并杀掉它。</p><p>首先,以管理员身份运行 Powershell,在命令行输入:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">netstat -aon|findstr "10000"</span><br></pre></td></tr></table></figure><p>回车,显示如下:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">TCP 127.0.0.1:10000 0.0.0.0:0 LISTENING 13924</span><br></pre></td></tr></table></figure><p>上面的输出表示 进程ID为 <strong>13924</strong> 的进程占用了端口10000。</p><p>继续查找进程ID为 13924 的进程是什么程序:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tasklist|findstr "13924"</span><br></pre></td></tr></table></figure><p>回车,显示如下:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yundetectservice.exe 13924 Console 1 3,004 K</span><br></pre></td></tr></table></figure><p>找到了 <strong>yundetectservice.exe</strong> 这个程序。现在杀掉它:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">taskkill /IM yundetectservice.exe /F</span><br></pre></td></tr></table></figure><p>或者</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">taskkill /PID 13924 /F</span><br></pre></td></tr></table></figure><p>现在可以正常启动 Hadoop 服务了。</p><h3 id="Linux-系统"><a class="header-anchor" href="#Linux-系统">¶</a>Linux 系统</h3><p>那么,在 Linux 下如何操作呢?使用如下命令:</p><p>查找占用端口的进程:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">netstat -apn|grep <端口号></span><br></pre></td></tr></table></figure><p>或者(Mac 系统)</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">lsof –i:<端口号></span><br></pre></td></tr></table></figure><p>找到进程号后,使用下面的命令查找程序:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ps aux|grep <进程号></span><br></pre></td></tr></table></figure><p>杀掉进程有很多方法,如下两种:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kill -9 <进程号></span><br></pre></td></tr></table></figure><p>或</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">killall <进程名称></span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><span id="more"></span>
<h3 id="Windows-系统"><a class="header-anchor" href="#Windows-系统">¶</a>Windows 系统</h3>
<p>有一天,我在 Windows 系统启动 Hadoop 服</summary>
<category term="技术" scheme="http://codeyu.com/categories/%E6%8A%80%E6%9C%AF/"/>
<category term="windows" scheme="http://codeyu.com/tags/windows/"/>
<category term="linux" scheme="http://codeyu.com/tags/linux/"/>
</entry>
<entry>
<title>docker 命令速查表</title>
<link href="http://codeyu.com/2017/02/13/docker-cheat-sheet/"/>
<id>http://codeyu.com/2017/02/13/docker-cheat-sheet/</id>
<published>2017-02-13T22:46:38.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><table><thead><tr><th>命令</th><th>说明</th><th>参数</th><th>示例</th></tr></thead><tbody><tr><td><a href="https://docs.docker.com/engine/reference/commandline/build"><code>docker build</code></a></td><td>创建一个镜像</td><td></td><td></td></tr><tr><td><a href="https://docs.docker.com/engine/reference/commandline/create"><code>docker create</code></a></td><td>创建一个容器但是不启动</td><td></td><td></td></tr><tr><td><a href="https://docs.docker.com/engine/reference/commandline/rename/"><code>docker rename</code></a></td><td>重命名容器</td><td></td><td></td></tr><tr><td><a href="https://docs.docker.com/engine/reference/commandline/run"><code>docker run</code></a></td><td>启动一个容器</td><td></td><td></td></tr><tr><td><a href="https://docs.docker.com/engine/reference/commandline/rm"><code>docker rm</code></a></td><td>删除容器</td><td></td><td></td></tr><tr><td><a href="https://docs.docker.com/engine/reference/commandline/update/"><code>docker rmi</code></a></td><td>更新容器的配置</td><td></td><td></td></tr></tbody></table>]]></content>
<summary type="html"><span id="more"></span>
<table>
<thead>
<tr>
<th>命令</th>
<th>说明</th>
<th>参数</th>
<th>示例</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https:</summary>
<category term="技术" scheme="http://codeyu.com/categories/%E6%8A%80%E6%9C%AF/"/>
<category term="docker" scheme="http://codeyu.com/tags/docker/"/>
</entry>
<entry>
<title>2017,我的第一本英文原版书</title>
<link href="http://codeyu.com/2016/12/31/2017-first-Post/"/>
<id>http://codeyu.com/2016/12/31/2017-first-Post/</id>
<published>2016-12-31T22:54:15.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p><img src="http://oj3pzn0i5.bkt.clouddn.com/succeed_how_we_can_reach_our_goals.jpg" alt="succeed"></p><p>很多人都会在年末做年终总结,并给明年列个计划。比如去年12月底的我。</p><p>去年我订的其中一个目标是克服<a href="https://www.zhihu.com/question/29773433">社交恐惧</a>这种病,如果这是种病的话。</p><p>现在想想,不但没克服,反而有加重的趋势。我越来越喜欢一个人独处,宅在家里。唉,我恨我自己。</p><p>我还记得有个目标是读完好多本书,但。。。</p><p>买了成捆成捆的纸质书,下了n多n多的电子书,但完完全全,认认真真看完的却一本也没有,一本也没有,没有。。。〒_〒</p><p>是时候改变自己了,咦,2016年的年末好像也说过这种话(泪。。。</p><p>这次我要把2017年的目标记录在这篇文章里,在2017年的最后几天再过来看看,是我完成了计划,还是被狠狠打脸!</p><p>下面就是我2017年的目标清单</p><ul><li>[ ] 读 <a href="https://book.douban.com/subject/5934941/">Succeed:How We Can Reach Our Goals</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/26867512/">Homo Deus:A Brief History of Tomorrow</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/26754245/">The Gene:An Intimate History</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/1340758/">Harry Potter and the Sorcerer’s Stone</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/26337545/">The Go Programming Language</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/1088054/">TCP/IP详解 卷1:协议</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/1230413/">深入理解计算机系统</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/10746113/">HTTP权威指南</a></li><li>[ ] 读 <a href="https://book.douban.com/subject/1148282/">计算机程序的构造和解释</a></li><li>[ ] 看 <a href="http://open.163.com/special/opencourse/weijifen.html">麻省理工学院公开课:微积分重点</a></li><li>[ ] 看 <a href="http://v.163.com/special/sp/singlevariablecalculus.html">麻省理工学院公开课:单变量微积分</a></li><li>[ ] 看 <a href="http://open.163.com/special/opencourse/multivariable.html">麻省理工学院公开课:多变量微积分</a></li><li>[ ] 看 <a href="http://v.163.com/special/opencourse/daishu.html">麻省理工公开课:线性代数</a></li><li>[ ] 看 <a href="http://open.163.com/special/Khan/probability.html">可汗学院公开课:概率</a></li><li>[ ] 看 <a href="http://open.163.com/special/Khan/khstatistics.html">可汗学院公开课:统计学</a></li><li>[ ] 跑步不少于500公里</li><li>[ ] <a href="https://github.com/codeyu">github</a> 的 contribution 不少于1500次,不少于300天</li><li>[ ] 用 python 语言实现一个项目</li><li>[ ] 用 go 语言实现一个项目</li><li>[ ] 用 javascript 语言实现一个项目</li><li>[ ] 用 elixir 语言实现一个项目</li><li>[ ] 基于DiscuzNT, 用 .NET Core 重写一个<a href="https://github.com/codeyu/DiscuzCore">论坛</a></li><li>[ ] 实现一个游戏项目,语言不限</li><li>[ ] leetcode完成<a href="https://github.com/codeyu/LeetCode">前300题</a></li><li>[ ] 去国外旅游至少一次</li><li>[ ] 看不少于5部美剧</li><li>[ ] 看不少于5部日剧</li><li>[ ] 看不少于20部电影</li><li>[ ] 隐藏目标(完成后解锁,没完成删掉)</li></ul><p>总之,2017年依然是学习学习再学习。</p><p>看过了很多的鸡汤,明白了很多的道理,难道就过不好2017这一年?!</p><p>PS: 这篇文章本来是要再2016年完成的。。。。(逃</p>]]></content>
<summary type="html"><span id="more"></span>
<p><img src="http://oj3pzn0i5.bkt.clouddn.com/succeed_how_we_can_reach_our_goals.jpg" alt="succeed"></p>
<p>很多人都会在年末</summary>
<category term="其他" scheme="http://codeyu.com/categories/%E5%85%B6%E4%BB%96/"/>
<category term="计划" scheme="http://codeyu.com/tags/%E8%AE%A1%E5%88%92/"/>
<category term="奋斗" scheme="http://codeyu.com/tags/%E5%A5%8B%E6%96%97/"/>
<category term="学习" scheme="http://codeyu.com/tags/%E5%AD%A6%E4%B9%A0/"/>
</entry>
<entry>
<title>【Akka.NET 文档】Actors</title>
<link href="http://codeyu.com/2016/10/22/actors/"/>
<id>http://codeyu.com/2016/10/22/actors/</id>
<published>2016-10-22T15:49:28.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>The previous section about <a href="actorsystems">Actor Systems</a> explained how actors form hierarchies and are the smallest unit when building an application. This section looks at one such actor in isolation, explaining the concepts you encounter while implementing it. For a more in depth reference with all the details please refer to F# API or C# API.</p><p>An actor is a container for <a href="#state">State</a>, <a href="#behavior">Behavior</a>, a <a href="#mailbox">Mailbox</a>, <a href="#children">Children</a> and a <a href="#supervisor-strategy">Supervisor Strategy</a>. All of this is encapsulated behind an Actor Reference(<code>ActorRef</code>).</p><p><img src="http://oj3pzn0i5.bkt.clouddn.com/actor.png" alt="Actor"></p><h2 id="Actor-Reference"><a class="header-anchor" href="#Actor-Reference">¶</a>Actor Reference</h2><p>As detailed below, an actor object needs to be shielded from the outside in order to benefit from the actor model. Therefore, actors are represented to the outside using actor references, which are objects that can be passed around freely and without restriction. This split into inner and outer object enables transparency for all the desired operations: restarting an actor without needing to update references elsewhere, placing the actual actor object on remote hosts, sending messages to actors in completely different applications. But the most important aspect is that it is not possible to look inside an actor and get hold of its state from the outside, unless the actor unwisely publishes this information itself.</p><h2 id="State"><a class="header-anchor" href="#State">¶</a>State</h2><p>Actor objects will typically contain some variables which reflect possible states the actor may be in. This can be an explicit state machine (e.g. using the FSM module), or it could be a counter, set of listeners, pending requests, etc. These data are what make an actor valuable, and they must be protected from corruption by other actors. The good news is that <a href="http://Akka.NET">Akka.NET</a> actors conceptually each have their own light-weight thread, which is completely shielded from the rest of the system. This means that instead of having to synchronize access using locks you can just write your actor code without worrying about concurrency at all.</p><p>Behind the scenes <a href="http://Akka.NET">Akka.NET</a> will run sets of actors on sets of real threads, where typically many actors share one thread, and subsequent invocations of one actor may end up being processed on different threads. <a href="http://Akka.NET">Akka.NET</a> ensures that this implementation detail does not affect the single-threadedness of handling the actor’s state.</p><p>Because the internal state is vital to an actor’s operations, having inconsistent state is fatal. Thus, when the actor fails and is restarted by its supervisor, the state will be created from scratch, like upon first creating the actor. This is to enable the ability of self-healing of the system.</p><p>Optionally, an actor’s state can be automatically recovered to the state before a restart by persisting received messages and replaying them after restart (see Persistence).</p><h2 id="Behavior"><a class="header-anchor" href="#Behavior">¶</a>Behavior</h2><p>Every time a message is processed, it is matched against the current behavior of the actor. Behavior means a function which defines the actions to be taken in reaction to the message at that point in time, say forward a request if the client is authorized, deny it otherwise. This behavior may change over time, e.g. because different clients obtain authorization over time, or because the actor may go into an “out-of-service” mode and later come back. These changes are achieved by either encoding them in state variables which are read from the behavior logic, or the function itself may be swapped out at runtime, see the become and unbecome operations. However, the initial behavior defined during construction of the actor object is special in the sense that a restart of the actor will reset its behavior to this initial one.</p><h2 id="Mailbox"><a class="header-anchor" href="#Mailbox">¶</a>Mailbox</h2><p>An actor’s purpose is the processing of messages, and these messages were sent to the actor from other actors (or from outside the actor system). The piece which connects sender and receiver is the actor’s mailbox: each actor has exactly one mailbox to which all senders enqueue their messages. Enqueuing happens in the time-order of send operations, which means that messages sent from different actors may not have a defined order at runtime due to the apparent randomness of distributing actors across threads. Sending multiple messages to the same target from the same actor, on the other hand, will enqueue them in the same order.</p><p>There are different mailbox implementations to choose from, the default being a FIFO: the order of the messages processed by the actor matches the order in which they were enqueued. This is usually a good default, but applications may need to prioritize some messages over others. In this case, a priority mailbox will enqueue not always at the end but at a position as given by the message priority, which might even be at the front. While using such a queue, the order of messages processed will naturally be defined by the queue’s algorithm and in general not be FIFO.</p><p>An important feature in which <a href="http://Akka.NET">Akka.NET</a> differs from some other actor model implementations is that the current behavior must always handle the next dequeued message, there is no scanning the mailbox for the next matching one. Failure to handle a message will typically be treated as a failure, unless this behavior is overridden.</p><h2 id="Children"><a class="header-anchor" href="#Children">¶</a>Children</h2><p>Each actor is potentially a supervisor: if it creates children for delegating sub-tasks, it will automatically supervise them. The list of children is maintained within the actor’s context and the actor has access to it. Modifications to the list are done by creating (<code>Context.ActorOf(...)</code>) or stopping (<code>Context.Stop(child)</code>) children and these actions are reflected immediately. The actual creation and termination actions happen behind the scenes in an asynchronous way, so they do not “block” their supervisor.</p><h2 id="Supervisor-Strategy"><a class="header-anchor" href="#Supervisor-Strategy">¶</a>Supervisor Strategy</h2><p>The final piece of an actor is its strategy for handling faults of its children. Fault handling is then done transparently by Akka, applying one of the strategies described in Supervision and Monitoring for each incoming failure. As this strategy is fundamental to how an actor system is structured, it cannot be changed once an actor has been created.</p><p>Considering that there is only one such strategy for each actor, this means that if different strategies apply to the various children of an actor, the children should be grouped beneath intermediate supervisors with matching strategies, preferring once more the structuring of actor systems according to the splitting of tasks into sub-tasks.</p><h2 id="When-an-Actor-Terminates"><a class="header-anchor" href="#When-an-Actor-Terminates">¶</a>When an Actor Terminates</h2><p>Once an actor terminates, i.e. fails in a way which is not handled by a restart, stops itself or is stopped by its supervisor, it will free up its resources, draining all remaining messages from its mailbox into the system’s “dead letter mailbox” which will forward them to the <code>EventStream</code> as <code>DeadLetters</code>. The mailbox is then replaced within the actor reference with a system mailbox, redirecting all new messages to the <code>EventStream</code> as <code>DeadLetters</code>. This is done on a best effort basis, though, so do not rely on it in order to construct “guaranteed delivery”.</p><p>The reason for not just silently dumping the messages was inspired by our tests: we register the TestEventListener on the event bus to which the dead letters are forwarded, and that will log a warning for every dead letter received—this has been very helpful for deciphering test failures more quickly. It is conceivable that this feature may also be of use for other purposes.</p>]]></content>
<summary type="html"><span id="more"></span>
<p>The previous section about <a href="actorsystems">Actor Systems</a> explained how actors form hierarchies and are</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>【Akka.NET 文档】Actor 系统</title>
<link href="http://codeyu.com/2016/10/22/actorsystem/"/>
<id>http://codeyu.com/2016/10/22/actorsystem/</id>
<published>2016-10-22T15:46:41.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p><a href="actors">Actors</a> are objects which encapsulate state and behavior, they communicate exclusively by exchanging <a href="messages">messages</a> which are placed into the recipient’s mailbox. In a sense, actors are the most stringent form of object-oriented programming, but it serves better to view them as persons: while modeling a solution with actors, envision a group of people and assign sub-tasks to them, arrange their functions into an organizational structure and think about how to escalate failure (all with the benefit of not actually dealing with people, which means that we need not concern ourselves with their emotional state or moral issues). The result can then serve as a mental scaffolding for building the software implementation.</p><blockquote><p><strong>Note</strong><br/><br>An <code>ActorSystem</code> is a heavyweight structure that will allocate 1…N Threads, so create one per logical application.</p></blockquote><h2 id="Hierarchical-Structure"><a class="header-anchor" href="#Hierarchical-Structure">¶</a>Hierarchical Structure</h2><p>Like in an economic organization, actors naturally form hierarchies. One actor, which is to oversee a certain function in the program might want to split up its task into smaller, more manageable pieces. For this purpose it starts child actors which it supervises. While the details of supervision are explained here, we shall concentrate on the underlying concepts in this section. The only prerequisite is to know that each actor has exactly one supervisor, which is the actor that created it.</p><p>The quintessential feature of actor systems is that tasks are split up and delegated until they become small enough to be handled in one piece. In doing so, not only is the task itself clearly structured, but the resulting actors can be reasoned about in terms of which messages they should process, how they should react normally and how failure should be handled. If one actor does not have the means for dealing with a certain situation, it sends a corresponding failure message to its supervisor, asking for help. The recursive structure then allows to handle failure at the right level.</p><p><img src="http://oj3pzn0i5.bkt.clouddn.com/ErrorKernel.png" alt="ActorSystem hierarchy, illustrated using error kernel pattern"></p><p>Compare this to layered software design which easily devolves into defensive programming with the aim of not leaking any failure out: if the problem is communicated to the right person, a better solution can be found than if trying to keep everything “under the carpet”.</p><p>Now, the difficulty in designing such a system is how to decide who should supervise what. There is of course no single best solution, but there are a few guidelines which might be helpful:</p><ul><li>If one actor manages the work another actor is doing, e.g. by passing on sub-tasks, then the manager should supervise the child. The reason is that the manager knows which kind of failures are expected and how to handle them.</li><li>If one actor carries very important data (i.e. its state shall not be lost if avoidable), this actor should source out any possibly dangerous sub-tasks to children it supervises and handle failures of these children as appropriate. Depending on the nature of the requests, it may be best to create a new child for each request, which simplifies state management for collecting the replies. This is known as the “Error Kernel Pattern” from Erlang.</li><li>If one actor depends on another actor for carrying out its duty, it should watch that other actor’s liveness and act upon receiving a termination notice. This is different from supervision, as the watching party has no influence on the supervisor strategy, and it should be noted that a functional dependency alone is not a criterion for deciding where to place a certain child actor in the hierarchy.<br>There are of course always exceptions to these rules, but no matter whether you follow the rules or break them, you should always have a reason.</li></ul><h2 id="Configuration-Container"><a class="header-anchor" href="#Configuration-Container">¶</a>Configuration Container</h2><p>The actor system as a collaborating ensemble of actors is the natural unit for managing shared facilities like scheduling services, configuration, logging, etc. Several actor systems with different configuration may co-exist within the same runtime without problems, there is no global shared state within <a href="http://Akka.NET">Akka.NET</a> itself. Couple this with the transparent communication between actor systems—within one node or across a network connection—to see that actor systems themselves can be used as building blocks in a functional hierarchy.</p><h2 id="Actor-Best-Practices"><a class="header-anchor" href="#Actor-Best-Practices">¶</a>Actor Best Practices</h2><ol><li>Actors should be like nice co-workers: do their job efficiently without bothering everyone else needlessly and avoid hogging resources. Translated to programming this means to process events and generate responses (or more requests) in an event-driven manner. Actors should not block (i.e. passively wait while occupying a Thread) on some external entity—which might be a lock, a network socket, etc.—unless it is unavoidable; in the latter case see below.</li><li>Do not pass mutable objects between actors. In order to ensure that, prefer immutable messages. If the encapsulation of actors is broken by exposing their mutable state to the outside, you are back in normal .NET concurrency land with all the drawbacks.</li><li>Actors are made to be containers for behavior and state, embracing this means to not routinely send behavior within messages. One of the risks is to accidentally share mutable state between actors, and this violation of the actor model unfortunately breaks all the properties which make programming in actors such a nice experience.</li><li>Top-level actors are the innermost part of your Error Kernel, so create them sparingly and prefer truly hierarchical systems. This has benefits with respect to fault-handling (both considering the granularity of configuration and the performance) and it also reduces the strain on the guardian actor, which is a single point of contention if over-used.</li></ol><h2 id="Blocking-Needs-Careful-Management"><a class="header-anchor" href="#Blocking-Needs-Careful-Management">¶</a>Blocking Needs Careful Management</h2><p>In some cases it is unavoidable to do blocking operations, i.e. to put a thread to sleep for an indeterminate time, waiting for an external event to occur. Examples are legacy RDBMS drivers or messaging APIs, and the underlying reason is typically that (network) I/O occurs under the covers. When facing this, you may be tempted to just wrap the blocking call inside a Future and work with that instead, but this strategy is too simple: you are quite likely to find bottlenecks or run out of memory or threads when the application runs under increased load.</p><p>The non-exhaustive list of adequate solutions to the “blocking problem” includes the following suggestions:</p><ul><li>Do the blocking call within an actor (or a set of actors managed by a <a href="Routing">router</a>), making sure to configure a thread pool which is either dedicated for this purpose or sufficiently sized.</li><li>Do the blocking call within a Future, ensuring an upper bound on the number of such calls at any point in time (submitting an unbounded number of tasks of this nature will exhaust your memory or thread limits).</li><li>Do the blocking call within a Future, providing a thread pool with an upper limit on the number of threads which is appropriate for the hardware on which the application runs.</li><li>Dedicate a single thread to manage a set of blocking resources (e.g. a NIO selector driving multiple channels) and dispatch events as they occur as actor messages.</li></ul><p>The first possibility is especially well-suited for resources which are single-threaded in nature, like database handles which traditionally can only execute one outstanding query at a time and use internal synchronization to ensure this. A common pattern is to create a router for N actors, each of which wraps a single DB connection and handles queries as sent to the router. The number N must then be tuned for maximum throughput, which will vary depending on which DBMS is deployed on what hardware.</p><blockquote><p><strong>Note</strong><br/><br>Configuring thread pools is a task best delegated to Akka, simply configure in the application.conf and instantiate through an ActorSystem.</p></blockquote><h2 id="What-you-should-not-concern-yourself-with"><a class="header-anchor" href="#What-you-should-not-concern-yourself-with">¶</a>What you should not concern yourself with</h2><p>An actor system manages the resources it is configured to use in order to run the actors which it contains. There may be millions of actors within one such system, after all the mantra is to view them as abundant and they weigh in at an overhead of only roughly 300 bytes per instance. Naturally, the exact order in which messages are processed in large systems is not controllable by the application author, but this is also not intended. Take a step back and relax while <a href="http://Akka.NET">Akka.NET</a> does the heavy lifting under the hood.</p>]]></content>
<summary type="html"><span id="more"></span>
<p><a href="actors">Actors</a> are objects which encapsulate state and behavior, they communicate exclusively by exc</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>linux zsh 使用 sudo 执行 bash 脚本提示 command not found</title>
<link href="http://codeyu.com/2016/09/22/linux-zsh-shell-script-command-not-found/"/>
<id>http://codeyu.com/2016/09/22/linux-zsh-shell-script-command-not-found/</id>
<published>2016-09-22T21:58:03.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><h2 id="问"><a class="header-anchor" href="#问">¶</a>问<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup></h2><p>在 home 目录,我有一个脚本叫 <code>foo.sh</code>。我切换到此目录,执行 <code>./foo.sh</code>,发生一个错误:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">zsh: permission denied: ./foo.sh</span><br></pre></td></tr></table></figure><p>我用 <code>sudo ./foo.sh</code> 继续执行,发生另一个错误:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo: ./foo.sh: command not found</span><br></pre></td></tr></table></figure><p>什么情况?我该怎么做?</p><h2 id="答"><a class="header-anchor" href="#答">¶</a>答</h2><h3 id="permission-denied"><a class="header-anchor" href="#permission-denied">¶</a>permission denied</h3><p>为了运行一个脚本文件,此文件必须有<strong>一个可执行权限设置位</strong></p><p>为了完全理解 Linux 文件权限,通过<a href="http://www.gnu.org/software/coreutils/manual/html_node/File-permissions.html#File-permissions">这个文档</a>你可以学习 <code>chmod</code> 命令。<a href="http://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html">chmod</a>,change mode 的缩写形式,是改变文件权限设置的一个命令。</p><p>在你的系统运行 <code>man chmod</code> 或 <code>info chmod</code> 可以查看 chmod 的帮助说明。学习了解后,你就能看懂下面的命令输出的结果:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls -l foo.sh</span><br></pre></td></tr></table></figure><p>结果将列出 Owner,Group,Other(有时称之为“World”或“Other”)的 <strong>可读</strong>,<strong>可写</strong>,<strong>可执行</strong> 权限。</p><p>下面简单说下怎么去解决你遇到的 <strong>Permission Denied error</strong>。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">$ ls -l foo.sh # 查看 foo.sh 文件的权限</span><br><span class="line">-rw-r--r-- 1 rkielty users 0 2012-10-21 14:47 foo.sh </span><br><span class="line"> ^^^ </span><br><span class="line"> ^^^ | ^^^ ^^^^^^^ ^^^^^</span><br><span class="line"> | | | | | </span><br><span class="line">Owner| World | |</span><br><span class="line"> | | Name of</span><br><span class="line"> Group | Group</span><br><span class="line"> Name of </span><br><span class="line"> Owner </span><br></pre></td></tr></table></figure><p>上面的输出表明 Owner 有读和写权限,但 - 表示没有可执行权限(Group 和 World 只有读权限)。</p><p>现在用 <code>chmod</code> 命令修正之。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$ chmod +x foo.sh # owner 可以设置 foo.sh 的可执行权限</span><br><span class="line">$ ls -l foo.sh # 现在我们看到在 rw 后有个 x</span><br><span class="line">-rwxr-xr-x 1 rkielty users 0 2012-10-21 14:47 foo.sh</span><br><span class="line"> ^ ^ ^</span><br></pre></td></tr></table></figure><p>在 Linux 中,现在 <a href="http://foo.sh">foo.sh</a> 是可执行的。</p><h3 id="用-sudo-结果显示-Command-not-found"><a class="header-anchor" href="#用-sudo-结果显示-Command-not-found">¶</a>用 sudo 结果显示 Command not found</h3><p>当你在执行命令前用 <strong>sudo</strong> 实际上你是作为超级用户或 root 用户执行它。</p><p>root 用户找不到你的命令的原因可能是 root 的 <code>PATH</code> 环境变量不包括 <code>foo.sh</code> 文件所在的位置。因此你命令未找到。</p><p>PATH 环境变量包含一个搜索命令的目录列表。每个用户根据自己的情况设置 PATH 变量。执行下面的命令看看 PATH 变量里都有些什么:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">env | grep ^PATH</span><br></pre></td></tr></table></figure><p>下面是一些示例输出,首先作为一个普通用户运行上面的 env 命令,然后使用 sudo 作为 root 用户运行的:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">rkielty@rkielty-laptop:~$ env | grep ^PATH</span><br><span class="line">PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</span><br><span class="line"></span><br><span class="line">rkielty@rkielty-laptop:~$ sudo env | grep ^PATH</span><br><span class="line">[sudo] password for rkielty: </span><br><span class="line">PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin</span><br></pre></td></tr></table></figure><p>请注意:尽管相似,但非特权用户(rkielty)和 root 用户的 PATH 目录列表是不一样的。</p><p><a href="http://foo.sh">foo.sh</a> 所在的目录没有出现在 root 用户的 PATH 变量中,因此 <code>command not found</code> 错误出现了。</p><hr class="footnotes-sep"><section class="footnotes"><ol class="footnotes-list"><li id="fn1" class="footnote-item"><p>原文地址:<a href="http://stackoverflow.com/questions/12996397/command-not-found-when-using-sudo">Command not found when using sudo</a> <a href="#fnref1" class="footnote-backref">↩︎</a></p></li></ol></section>]]></content>
<summary type="html"><span id="more"></span>
<h2 id="问"><a class="header-anchor" href="#问">¶</a>问<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></su</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="linux" scheme="http://codeyu.com/tags/linux/"/>
<category term="bash" scheme="http://codeyu.com/tags/bash/"/>
</entry>
<entry>
<title>Ubuntu Trusty 14.04 Docker 安装教程</title>
<link href="http://codeyu.com/2016/09/22/install-docker-on-ubuntu/"/>
<id>http://codeyu.com/2016/09/22/install-docker-on-ubuntu/</id>
<published>2016-09-22T19:47:02.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><h3 id="准备"><a class="header-anchor" href="#准备">¶</a>准备</h3><p>docker 要求 64位 的 Linux 操作系统,并且 Linux 的内核 >= 3.10</p><ol><li>首先查看你的操作系统的内核版本:</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ uname -r</span><br></pre></td></tr></table></figure><ol start="2"><li>更新包管理器 <a href="http://wiki.ubuntu.com.cn/Apt%E5%92%8Cdpkg%E5%BF%AB%E9%80%9F%E5%8F%82%E8%80%83">APT快速参考</a></li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get update</span><br></pre></td></tr></table></figure><ol start="3"><li>安装推荐的包,这个包可以让 docker 使用 <a href="http://coolshell.cn/articles/17061.html">AUFS</a> 文件系统</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual</span><br></pre></td></tr></table></figure><ol start="4"><li>更新包管理器并且安装 apt-transport-https 和 ca-certificates</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get update</span><br><span class="line">$ sudo apt-get install apt-transport-https ca-certificates</span><br></pre></td></tr></table></figure><ol start="5"><li>添加新的 <a href="http://www.ruanyifeng.com/blog/2013/07/gpg.html">GPG</a> 键</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D</span><br></pre></td></tr></table></figure><ol start="6"><li>打开 <code>/etc/apt/sources.list.d/docker.list</code> 文件,清空内容(如果有)</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo vim /etc/apt/sources.list.d/docker.list</span><br></pre></td></tr></table></figure><ol start="7"><li>添加以下内容并保存退出(<code>!wq</code>)</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">deb https://apt.dockerproject.org/repo ubuntu-trusty main</span><br></pre></td></tr></table></figure><ol start="8"><li>更新 APT 包索引</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get update</span><br></pre></td></tr></table></figure><ol start="9"><li>清理旧的 docker repo 源</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get purge lxc-docker</span><br></pre></td></tr></table></figure><ol start="10"><li>验证 APT 是否从正确的 repo 拉取</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ apt-cache policy docker-engine</span><br></pre></td></tr></table></figure><h3 id="安装"><a class="header-anchor" href="#安装">¶</a>安装</h3><ol><li>更新 APT 包索引</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get update</span><br></pre></td></tr></table></figure><ol start="2"><li>安装 docker</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get install docker-engine</span><br></pre></td></tr></table></figure><ol start="3"><li>启动 docker 守护进程</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo service docker start</span><br></pre></td></tr></table></figure><ol start="4"><li>验证 docker 是否正确安装</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo docker run hello-world</span><br></pre></td></tr></table></figure><p>稍等片刻,如果你看到 <code>Hello from Docker!</code> 字样,恭喜你,安装成功:-)</p>]]></content>
<summary type="html"><span id="more"></span>
<h3 id="准备"><a class="header-anchor" href="#准备">¶</a>准备</h3>
<p>docker 要求 64位 的 Linux 操作系统,并且 Linux 的内核 &gt;= 3.10</</summary>
<category term="技术" scheme="http://codeyu.com/categories/%E6%8A%80%E6%9C%AF/"/>
<category term="docker" scheme="http://codeyu.com/tags/docker/"/>
<category term="ubuntu" scheme="http://codeyu.com/tags/ubuntu/"/>
</entry>
<entry>
<title>机器学习入门系列 1.在windows系统安装scikit-learn</title>
<link href="http://codeyu.com/2016/09/04/machine-learning-installing-scikit-learn-on-windows/"/>
<id>http://codeyu.com/2016/09/04/machine-learning-installing-scikit-learn-on-windows/</id>
<published>2016-09-04T22:56:50.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><h2 id="安装机器学习相关模块"><a class="header-anchor" href="#安装机器学习相关模块">¶</a>安装机器学习相关模块</h2><p>我们用python的<a href="http://scikit-learn.org/stable/index.html"><code>scikit-learn</code></a>模块来学习Machine Learning。</p><p>首先,到Python官网下载<a href="https://www.python.org/downloads/">Python</a>。我使用的是2.7.X系列的版本。32位或64位均可。我这里安装的是:<br><a href="https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi">python-2.7.11.msi</a></p><p><strong>注意:</strong> 安装的模块要和Python的位数保持一致。比如我这里使用32位的python。那么等下安装的各种模块也要使用32位的。否则会出现如下错误:</p><blockquote><p>xxx is not a supported wheel on this platform.</p></blockquote><p>安装后设置环境变量。比如我这里安装的路径是:<code>C:\Python27</code></p><p>依次打开:</p><blockquote><p>System->Advanced system settings -> Environment Variables…</p></blockquote><p>编辑 <code>PATH</code> 变量。在最后添加:</p><blockquote><p>;C:\Python27;C:\Python27\Scripts;</p></blockquote><p>下载python安装器 pip:<a href="https://pypi.python.org/pypi/pip">pip-8.1.2.tar.gz</a></p><p>解压到某个目录如<code>D:\pip</code>,在此处打开命令行。运行以下命令安装:</p><blockquote><p>D:\pip> python <a href="http://setup.py">setup.py</a> install</p></blockquote><p>然后到<a href="http://www.lfd.uci.edu/">这个网站</a>下载机器学习相关的模块:</p><ol><li><a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy">Numpy+MKL</a></li><li><a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy">Scipy</a></li><li><a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib">matplotlib</a></li><li><a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn">scikit-learn</a></li></ol><p>比如下载到 <code>D:\python_whl_file</code> 这个目录下。在此处打开命令行。依次运行以下命令安装:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">D:\python_whl_file>pip install numpy-1.11.1+mkl-cp27-cp27m-win32.whl</span><br><span class="line">D:\python_whl_file>pip install scipy-0.18.0-cp27-cp27m-win32.whl</span><br><span class="line">D:\python_whl_file>pip install matplotlib-1.5.2-cp27-cp27m-win32.whl</span><br><span class="line">D:\python_whl_file>pip install scikit_learn-0.17.1-cp27-cp27m-win32.whl</span><br></pre></td></tr></table></figure><p>所有的模块都 Successfully installed 后,就大功告成啦。</p><p>写到这里,我了解到其实并不用这么麻烦。只要下载<a href="https://www.continuum.io/downloads">Anaconda</a>这个数据分析集成包,<br>然后安装后就可拥有全部机器学习相关模块了😄</p><h2 id="测试机器学习相关模块"><a class="header-anchor" href="#测试机器学习相关模块">¶</a>测试机器学习相关模块</h2><p>安装后当然要测试下了。<br>首先试试scikit_learn这个包。<br>打开IDLE。输入以下代码:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> sklearn <span class="keyword">import</span> datasets</span><br><span class="line">iris = datasets.load_iris()</span><br><span class="line"><span class="built_in">print</span> iris.data</span><br></pre></td></tr></table></figure><p>保存为iris_data.py。在命令行里运行。<br>输出了一串二维矩阵:</p><p><img src="http://codeyu.qiniudn.com/iris_data.png" alt=""></p><p>不错。然后再结合matplotlib包试试。在IDLE里打开新文件,输入以下代码:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> sklearn <span class="keyword">import</span> datasets</span><br><span class="line"><span class="keyword">from</span> matplotlib <span class="keyword">import</span> pyplot <span class="keyword">as</span> plt</span><br><span class="line">iris = datasets.load_iris()</span><br><span class="line">x_index = <span class="number">0</span></span><br><span class="line">y_index = <span class="number">1</span></span><br><span class="line"> </span><br><span class="line">formatter = plt.FuncFormatter(<span class="keyword">lambda</span> i, *args: iris.target_names[<span class="built_in">int</span>(i)])</span><br><span class="line"> </span><br><span class="line">plt.scatter(iris.data[:, x_index], iris.data[:, y_index], c=iris.target)</span><br><span class="line">plt.colorbar(ticks=[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>], <span class="built_in">format</span>=formatter)</span><br><span class="line">plt.xlabel(iris.feature_names[x_index])</span><br><span class="line">plt.ylabel(iris.feature_names[y_index])</span><br><span class="line"> </span><br><span class="line">plt.show()</span><br></pre></td></tr></table></figure><p>保存为iris_figure.py在命令行里运行后,你将看到下图:</p><p><img src="http://codeyu.qiniudn.com/iris_figure.png" alt=""></p><p>OK。期待你的机器学习之旅吧!</p>]]></content>
<summary type="html"><span id="more"></span>
<h2 id="安装机器学习相关模块"><a class="header-anchor" href="#安装机器学习相关模块">¶</a>安装机器学习相关模块</h2>
<p>我们用python的<a href="http://sc</summary>
<category term="技术" scheme="http://codeyu.com/categories/%E6%8A%80%E6%9C%AF/"/>
<category term="python" scheme="http://codeyu.com/tags/python/"/>
<category term="机器学习" scheme="http://codeyu.com/tags/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/"/>
<category term="scikit-learn" scheme="http://codeyu.com/tags/scikit-learn/"/>
</entry>
<entry>
<title>【Akka.NET 文档】术语和概念</title>
<link href="http://codeyu.com/2016/09/04/Akka-NET-Terminology-and-Concepts/"/>
<id>http://codeyu.com/2016/09/04/Akka-NET-Terminology-and-Concepts/</id>
<published>2016-09-04T22:51:45.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>在这一章中,我们试图建立一个通用的术语来定义Akka.NET中并发,分布式系统等概念,作为讨论的基石。请注意, 其中很多术语并没有统一的定义。 我们只是在Akka.NET文档中来使用。</p><h2 id="并发-vs-并行"><a class="header-anchor" href="#并发-vs-并行">¶</a>并发 vs. 并行</h2><p>并发和并行是如影相随的概念。 并发意味着两个或两个以上的任务正在进行中,即使他们可能不会同时执行。例如,有的任务顺序执行,有的任务通过时间片的切换与其他任务交替执行。 而并行是真正的同时执行。</p><h4 id="并发(Concurrency)"><a class="header-anchor" href="#并发(Concurrency)">¶</a>并发(Concurrency)</h4><p><img src="http://codeyu.qiniudn.com/concurrency.png" alt="Concurrency"></p><h4 id="并行(Parallelism)"><a class="header-anchor" href="#并行(Parallelism)">¶</a>并行(Parallelism)</h4><p><img src="http://codeyu.qiniudn.com/parallelism.png" alt="Parallelism"></p><h2 id="异步-vs-同步"><a class="header-anchor" href="#异步-vs-同步">¶</a>异步 vs. 同步</h2><p>如果调用者在这个方法返回一个值或抛出一个异常后才能继续执行,则称之为同步调用。另一方面,异步调用允许调用者在方法完成之前就继续执行,等到这个方法完成后通过额外的机制来通知调用者(它可能是一个回调方法,一个Future方法,或发送一个消息)。</p><p>一个同步API可以使用阻塞来实现同步,但这不是必需的。一个CPU密集型的任务可能有类似的行为作为阻塞。在一般情况下,它优先使用异步API,因为它们保证系统能够继续执行。Actors天生就是异步的:一个Actor发送消息后会继续执行而不等结果。</p><h2 id="非阻塞-vs-阻塞"><a class="header-anchor" href="#非阻塞-vs-阻塞">¶</a>非阻塞 vs. 阻塞</h2><p>我们谈论阻塞(blocking),一个线程的延迟也许能无限期的延迟一些别的线程。比如一个线程通过互斥独占使用一个资源。如果这个线程无限期的持有这个资源 (如不小心写了个死循环) ,那别的(打算使用这个资源的)线程只能等到天荒地老而不能进行下去。相比之下,非阻塞(non-blocking)意味着没有线程能够无限期的延迟别人。</p><p>非阻塞操作比阻塞的好。因为包含阻塞操作的系统对整体的进度并不能有效的保证。</p><h2 id="死锁-vs-饥饿-vs-活锁(Live-lock)"><a class="header-anchor" href="#死锁-vs-饥饿-vs-活锁(Live-lock)">¶</a>死锁 vs. 饥饿 vs. 活锁(Live-lock)</h2><p>当几个参与者彼此等待对方达到一个特别的状态,以便能够继续进行,死锁产生了。 因为要达到一个特别的状态必须能够继续进行,要继续进行反过来又要达到特别的状态 (“两难”问题) ,所有受影响的子系统都会停摆。死锁和阻塞息息相关, 一个参与者线程能够无限期延迟其他线程的进行必然产生死锁。</p><p>在死锁的情况下,没有参与者能够继续进行, 而相比之下饥饿(Starvation )发生时, 有的参与者能继续进行,有的却不能。 典型的情况是 一个单纯的调度算法总是选择高优先级的任务,而忽略低优先级的。如果传入的高优先级的任务源源不断,那低优先级的任务将永远没机会完成。</p><p>活锁和死锁类似,没有参与者能取得进展。不同的是参与者不会僵在那里等待别人的进行,而是不断的改变其状态。 一个示例场景是当两个参与者有两个相同的资源实例可用。 他们每一个人都试图获取资源, 但他们也检查别人是否需要这个资源。 假如发现其他参与者已请求这个资源,他们尝试去获取另一个资源实例。 可能发生比较悲剧的情况是两个参与者被两个资源弹来弹去,都不能获取到它,总是被礼让给另一个。</p><h2 id="争用条件(Race-Condition)"><a class="header-anchor" href="#争用条件(Race-Condition)">¶</a>争用条件(Race Condition)</h2><p>假设一系列事件的顺序遭受外部非确定性因素的打乱时发生了争用条件。 当多个线程有一个共享的可变状态,并且线程对状态进行交替操作可能导致意想不到的行为,这时经常引起争用条件。虽然这是一个常见的情况,共享状态是没必要有争用条件。 一个例子是客户端发送无序数据包 (如 UDP 报文) P1, P2 到服务端。当数据包通过不同的网络路由传送, 服务端可能先接收到P2,再接收到P1。如果报文不包含发送顺序的信息,服务端是不可能知道P1和P2的顺序。 根据数据包的意义这可能会导致争用条件。</p><blockquote><p><strong>注意</strong></p><p><a href="http://Akka.NET">Akka.NET</a> 提供了对给定的一对 Actors 之间发送消息的唯一保证是,它们的顺序总是保持不变。 见 <a href="message-delivery-reliability">消息传递的可靠性</a></p></blockquote><h2 id="非阻塞担保-Progress-Conditions"><a class="header-anchor" href="#非阻塞担保-Progress-Conditions">¶</a>非阻塞担保 (Progress Conditions)</h2><p>正如前面几节讨论的阻塞是不受欢迎的几个原因, 包括死锁和系统吞吐量降低的危险。 在以下部分中,我们将讨论各种非阻塞特性的不同优点。</p><h3 id="Wait-freedom(无等待?)"><a class="header-anchor" href="#Wait-freedom(无等待?)">¶</a>Wait-freedom(无等待?)</h3><p>如果每次调用都保证在有限步骤内完成,那这个方法就是wait-free的。 如果一个方法是有界的wait-free,那么步骤的数量有一个有限的上限。</p><p>从这个定义来看,wait-free的方法永远不会阻塞,因此不会发生死锁。此外, 因为每个参与者能在有限步骤之后继续进行 (当调用完成), wait-free方法均是free of starvation。</p><h3 id="Lock-freedom(无锁)"><a class="header-anchor" href="#Lock-freedom(无锁)">¶</a>Lock-freedom(无锁)</h3><p>Lock-freedom 比 wait-freedom 有更弱的特性。 在 lock-free 调用的情况下, 一些无限的方法常常在有限的步骤完成。 这个定义意味着lock-free调用不发生死锁是可能的。另一方面, 保证一些调用在有限数量的步骤完成是不足于保证他们最终完成。换言之, lock-freedom 并不足于保证 lack of starvation.</p><h3 id="Obstruction-freedom(无阻碍)"><a class="header-anchor" href="#Obstruction-freedom(无阻碍)">¶</a>Obstruction-freedom(无阻碍)</h3><p>Obstruction-freedom 是这里讨论最弱的非阻塞担保特性。 一个方法被称为obstruction-free 是如果有一个时间点后它孤立执行 (别的线程没有步骤, 例如: 变成暂停), 它在有限的步骤完成。 所有 lock-free 对象是 obstruction-free 的, 但相反则不成立。</p><p>乐观并发控制(OCC)的方法通常是 obstruction-free。OCC的做法是每一位参与者都试着对共享对象执行操作,但如果一个参与者检测到与别人冲突, 则回滚修改,然后根据某种计划再次尝试。如果有一个时间点,这时只有一个参与者尝试,操作将成功。</p><h2 id="推荐文献"><a class="header-anchor" href="#推荐文献">¶</a>推荐文献</h2><ul><li>多核编程的艺术(The Art of Multiprocessor Programming), M. Herlihy and N Shavit, 2008. ISBN 978-0123705914</li><li>Java并发实战(Java Concurrency in Practice), B. Goetz, T. Peierls, J. Bloch, J. Bowbeer, D. Holmes and D. Lea, 2006. ISBN 978-0321349606</li></ul>]]></content>
<summary type="html"><span id="more"></span>
<p>在这一章中,我们试图建立一个通用的术语来定义Akka.NET中并发,分布式系统等概念,作为讨论的基石。请注意, 其中很多术语并没有统一的定义。 我们只是在Akka.NET文档中来使用。</p>
<h2 id="并发-vs-并行</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>【Akka.NET 文档】Akka.NET 用户和使用案例</title>
<link href="http://codeyu.com/2016/08/28/Akka-NET-Users-and-Use-Case/"/>
<id>http://codeyu.com/2016/08/28/Akka-NET-Users-and-Use-Case/</id>
<published>2016-08-28T15:09:58.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p><a href="http://Akka.NET">Akka.NET</a> 被很多行业的大型组织使用。如投资和商业银行,零售和社交媒体, 仿真,游戏和博彩,汽车和交通系统, 医疗保健, 数据分析等等。 任何有高吞吐量和低延迟需求的系统都可以选择使用 <a href="http://Akka.NET">Akka.NET</a>。</p><p><a href="http://Akka.NET">Akka.NET</a> 的使用案例有大量论述。 下面是一些实际生产用户的经验之谈:</p><h2 id="Akka-NET-用户"><a class="header-anchor" href="#Akka-NET-用户">¶</a><a href="http://Akka.NET">Akka.NET</a> 用户</h2><h4 id="交易处理-在线游戏-金融/银行-贸易-统计-博彩-社交媒体-通讯"><a class="header-anchor" href="#交易处理-在线游戏-金融/银行-贸易-统计-博彩-社交媒体-通讯">¶</a>交易处理 (在线游戏, 金融/银行, 贸易, 统计, 博彩, 社交媒体, 通讯)</h4><ul><li><a href="https://youtu.be/G3ZafPNI-hk?t=31m6s">CellularSales</a></li></ul><h4 id="后台服务-任何行业,任何应用"><a class="header-anchor" href="#后台服务-任何行业,任何应用">¶</a>后台服务 (任何行业,任何应用)</h4><p><a href="http://ivcbusinesssystems.com/">IVC 业务系统</a>:</p><blockquote><p>Sam Covington, IVC 业务系统: 我们用Akka.NET实现了一套内部的“Actor”系统,这使我们创新和提高生产力,不用重复发明轮子。这种微服务的后端是我们所有产品和服务的基础。我们用它在企业社交产品,和Livescan办公产品如客户指纹识别。</p></blockquote><h4 id="并发和并行-任何程序"><a class="header-anchor" href="#并发和并行-任何程序">¶</a>并发和并行 (任何程序)</h4><ul><li><a href="https://petabridge.com/blog/akkadotnet-goes-to-wall-street/">SNL Financial (McGraw Hill 子公司): Akka.NET 在华尔街的使用</a></li></ul><h4 id="模拟计算"><a class="header-anchor" href="#模拟计算">¶</a>模拟计算</h4><p>Master/Worker, Compute Grid, MapReduce 等等。</p><h4 id="批处理-任何领域"><a class="header-anchor" href="#批处理-任何领域">¶</a>批处理 (任何领域)</h4><p>Camel integration 通过批量数据源 Actors 分治批量工作任务</p><h4 id="通信-Hub-电信-Web-媒介-移动媒介"><a class="header-anchor" href="#通信-Hub-电信-Web-媒介-移动媒介">¶</a>通信 Hub (电信, Web 媒介, 移动媒介)</h4><ul><li><a href="https://youtu.be/G3ZafPNI-hk?t=6m16s">EventDay: 用Akka.NET 实现可扩展的会议和事件管理</a></li></ul><h4 id="游戏和博彩"><a class="header-anchor" href="#游戏和博彩">¶</a>游戏和博彩</h4><p>垂直扩展,水平扩展,容错性 / 高可用</p><h4 id="商业智能-数据挖掘-通用计算"><a class="header-anchor" href="#商业智能-数据挖掘-通用计算">¶</a>商业智能/数据挖掘/通用计算</h4><ul><li><a href="https://twitter.com/philiplaureano/status/735976018993778688">用Octopus发布系统和 Akka.NET 实现 Domain.au 的实时流处理 </a></li></ul><h4 id="物联网(IoT)"><a class="header-anchor" href="#物联网(IoT)">¶</a>物联网(IoT)</h4><ul><li><a href="https://youtu.be/YuY1ziEqifU?t=3m38s">Synchromatics: 用 Akka.NET 实现实时公共交通跟踪与分析</a></li></ul><h4 id="复杂事件处理(CEP)"><a class="header-anchor" href="#复杂事件处理(CEP)">¶</a>复杂事件处理(CEP)</h4><ul><li><a href="http://www.aaronstannard.com/markedup-akkadotnet/">MarkedUp 分析: 用分布式 Actor 系统和 Akka.NET 实现实时营销自动化</a></li></ul>]]></content>
<summary type="html"><span id="more"></span>
<p><a href="http://Akka.NET">Akka.NET</a> 被很多行业的大型组织使用。如投资和商业银行,零售和社交媒体, 仿真,游戏和博彩,汽车和交通系统, 医疗保健, 数据分析等等。 任何有高吞吐量和低延迟</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>【Akka.NET 文档】Azure 云服务部署场景</title>
<link href="http://codeyu.com/2016/08/27/Azure-PaaS-Deployment-Scenario/"/>
<id>http://codeyu.com/2016/08/27/Azure-PaaS-Deployment-Scenario/</id>
<published>2016-08-27T10:21:42.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>下面的示例假设您已经创建了一个新的包含一个空<code>Worker Role</code> 的Azure PaaS云服务。通过安装<a href="http://azure.microsoft.com/en-gb/downloads/">Azure .Net SDK</a>将云服务模版添加到Visual Studio。</p><p>在部署到云之前,可以在本地使用“Azure服务模拟器”对<code>Worker Role</code>的实现进行测试。 参考MSDN Azure 的文章 <a href="https://msdn.microsoft.com/en-us/library/azure/dn339018.aspx">“使用模拟器在本地调试和运行一个云服务”</a> 了解更多细节。</p><p>Azure PaaS <code>Worker Role</code>的实现和<a href="http://codeyu.com/2016/08/26/windows-service-deployment-scenario/">Windows Service 部署场景</a>的例子很相似。<br>开始使用 <a href="http://Akka.Net">Akka.Net</a> 的最快方式是创建一个简单的<code>Worker Role</code>,在它的 RunAsync() 方法里调用 top-level<br>user-actor,如下所示:</p><h4 id="WorkerRole-cs"><a class="header-anchor" href="#WorkerRole-cs">¶</a>WorkerRole.cs</h4><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">using</span> Akka.Actor;</span><br></pre></td></tr></table></figure><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">namespace</span> <span class="title">MyActorWorkerRole</span></span><br><span class="line">{</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">class</span> <span class="title">WorkerRole</span> : <span class="title">RoleEntryPoint</span></span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">readonly</span> CancellationTokenSource cancellationTokenSource = <span class="keyword">new</span> CancellationTokenSource();</span><br><span class="line"> <span class="keyword">private</span> <span class="keyword">readonly</span> ManualResetEvent runCompleteEvent = <span class="keyword">new</span> ManualResetEvent(<span class="literal">false</span>);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">private</span> ActorSystem _actorSystem;</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">override</span> <span class="built_in">bool</span> <span class="title">OnStart</span>()</span></span><br><span class="line"> {</span><br><span class="line"> <span class="comment">// Setup the Actor System</span></span><br><span class="line"> _actorSystem = ActorSystem.Create(<span class="string">"MySystem"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> (<span class="keyword">base</span>.OnStart());</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">override</span> <span class="keyword">void</span> <span class="title">OnStop</span>()</span></span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">this</span>.cancellationTokenSource.Cancel();</span><br><span class="line"> <span class="keyword">this</span>.runCompleteEvent.WaitOne();</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Shutdown the Actor System</span></span><br><span class="line"> _actorSystem.Shutdown();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">base</span>.OnStop();</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">override</span> <span class="keyword">void</span> <span class="title">Run</span>()</span></span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">try</span></span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">this</span>.RunAsync(<span class="keyword">this</span>.cancellationTokenSource.Token).Wait();</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">finally</span></span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">this</span>.runCompleteEvent.Set();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">private</span> <span class="keyword">async</span> Task <span class="title">RunAsync</span>(<span class="params">CancellationToken cancellationToken</span>)</span></span><br><span class="line"> {</span><br><span class="line"> <span class="comment">// Create an instance to the top-level user Actor</span></span><br><span class="line"> <span class="keyword">var</span> workerRoleActor = _actorSystem.ActorOf<WorkerRoleActor>(<span class="string">"WorkerRole"</span>);</span><br><span class="line"></span><br><span class="line"> <span class="comment">// Send a message to the Actor</span></span><br><span class="line"> workerRoleActor.Tell(<span class="keyword">new</span> WorkerRoleMessage(<span class="string">"Hello World!"</span>));</span><br><span class="line"></span><br><span class="line"> <span class="keyword">while</span> (!cancellationToken.IsCancellationRequested)</span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">await</span> Task.Delay(<span class="number">1000</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><span id="more"></span>
<p>下面的示例假设您已经创建了一个新的包含一个空<code>Worker Role</code> 的Azure PaaS云服务。通过安装<a href="http://azure.microsoft.com/en-gb/downl</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>【Akka.NET 文档】Windows Service 部署场景</title>
<link href="http://codeyu.com/2016/08/26/windows-service-deployment-scenario/"/>
<id>http://codeyu.com/2016/08/26/windows-service-deployment-scenario/</id>
<published>2016-08-26T23:25:36.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><p>对于Windows Service 的部署, 推荐使用<br><a href="http://topshelf.readthedocs.org/en/latest/index.html">TopShelf</a> 创建 Windows Service。它从根本上简化了Windows Service 的托管。</p><p>最快的方式入门TopShelf 是创建一个控制台程序,它长得像下面的样子:</p><h4 id="Program-cs"><a class="header-anchor" href="#Program-cs">¶</a>Program.cs</h4><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">using</span> Akka.Actor;</span><br><span class="line"><span class="keyword">using</span> Topshelf;</span><br></pre></td></tr></table></figure><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">class</span> <span class="title">Program</span></span><br><span class="line">{</span><br><span class="line"> <span class="function"><span class="keyword">static</span> <span class="keyword">void</span> <span class="title">Main</span>(<span class="params"><span class="built_in">string</span>[] <span class="keyword">args</span></span>)</span></span><br><span class="line"> {</span><br><span class="line"> HostFactory.Run(x =></span><br><span class="line"> {</span><br><span class="line"> x.Service<MyActorService>(s =></span><br><span class="line"> {</span><br><span class="line"> s.ConstructUsing(n => <span class="keyword">new</span> MyActorService());</span><br><span class="line"> s.WhenStarted(service => service.Start());</span><br><span class="line"> s.WhenStopped(service => service.Stop());</span><br><span class="line"> <span class="comment">//继续和重新启动指令也是可用的</span></span><br><span class="line"> });</span><br><span class="line"></span><br><span class="line"> x.RunAsLocalSystem();</span><br><span class="line"> x.UseAssemblyInfoForServiceInfo();</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag"><summary></span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> 这个类扮演你的应用程序和TopShelf之间的接头人</span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag"></summary></span></span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">MyActorService</span></span><br><span class="line">{</span><br><span class="line"> <span class="keyword">private</span> ActorSystem mySystem;</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">Start</span>()</span></span><br><span class="line"> {</span><br><span class="line"> <span class="comment">//this is where you setup your actor system and other things</span></span><br><span class="line"> mySystem = ActorSystem.Create(<span class="string">"MySystem"</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">async</span> <span class="keyword">void</span> <span class="title">Stop</span>()</span></span><br><span class="line"> {</span><br><span class="line"> <span class="comment">//this is where you stop your actor system</span></span><br><span class="line"> <span class="keyword">await</span> mySystem.Terminate();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><p>如你所见,上面这个例子是最简单的使用TopShelf 的方式。 不过也有其他与TopShelf集成的方式,给你更多的控制。</p><p>使用 Topshelf 安装非常简单,在命令行输入<code>myConsoleApp.exe install</code> 就行了。</p><p>更多选项和设置请参阅<a href="http://topshelf.readthedocs.org/en/latest/index.html">Topshelf 文档</a>.</p>]]></content>
<summary type="html"><span id="more"></span>
<p>对于Windows Service 的部署, 推荐使用<br>
<a href="http://topshelf.readthedocs.org/en/latest/index.html">TopShelf</a> 创建 Wi</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>【Akka.NET 文档】asp.net 部署场景</title>
<link href="http://codeyu.com/2016/08/21/asp-net-deployment-scenario/"/>
<id>http://codeyu.com/2016/08/21/asp-net-deployment-scenario/</id>
<published>2016-08-21T23:16:10.000Z</published>
<updated>2025-04-12T03:50:10.344Z</updated>
<content type="html"><![CDATA[<span id="more"></span><h3 id="创建ASP-NET-资源"><a class="header-anchor" href="#创建ASP-NET-资源">¶</a><a href="http://xn--ASP-th2el20d.NET">创建ASP.NET</a> 资源</h3><p>寄宿在ASP.NET应用中很容易。 首先,在 Global.asax 里设置下。</p><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">MvcApplication</span> : <span class="title">System.Web.HttpApplication</span></span><br><span class="line">{</span><br><span class="line"> <span class="keyword">protected</span> <span class="keyword">static</span> ActorSystem ActorSystem;</span><br><span class="line"> <span class="comment">//这里声明你的顶层 actor-refs</span></span><br><span class="line"> <span class="keyword">protected</span> <span class="keyword">static</span> IActorRef MyActor;</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">Application_Start</span>()</span></span><br><span class="line"> {</span><br><span class="line"> <span class="comment">//你的 mvc 配置。 在这之前或之后初始化你的Actor 系统都无所谓</span></span><br><span class="line"> ActorSystem = ActorSystem.Create(<span class="string">"app"</span>);</span><br><span class="line"> <span class="comment">//这里注册你的顶层 actors</span></span><br><span class="line"> MyActor = ActorSystem.ActorOf<MyActor>();</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><p>正如你所见,这里的要点是确保对<code>ActorSystem</code> 的静态引用。 这确保它不会意外的被垃圾回收,并且在Web 应用的开始和停止事件中得到创建和处理。</p><blockquote><p><strong>警告</strong><br><a href="http://xn--ASP-lp6ew3s3a06f205p.NET">尽管寄宿在ASP.NET</a> 应用里很容易。 <strong>忠告之语</strong>:当IIS 抽风时,你的App 所在的应用程序池(applicationpool)随之停止或启动。这意味着 <code>ActorSystem</code> 可能随时被中断。</p></blockquote><p>通常情况下,你在ASP.NET应用程序里面使用一个非常轻量级的<code>ActorSystem</code> ,并通过Akka.Remote/ Akka.Cluster把重型工作分流到一个单独的Windows 服务里。</p><h3 id="Controllers-和-Akka-NET-的交互"><a class="header-anchor" href="#Controllers-和-Akka-NET-的交互">¶</a>Controllers 和 <a href="http://Akka.NET">Akka.NET</a> 的交互</h3><p>下面的例子使用 Web API Controller:</p><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">SomeController</span> : <span class="title">ApiController</span></span><br><span class="line">{</span><br><span class="line"> <span class="comment">//使用异步Action</span></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">async</span> Task<SomeResult> <span class="title">Post</span>(<span class="params">SomeRequest someRequest</span>)</span></span><br><span class="line"> {</span><br><span class="line"> <span class="comment">//根据传入的参数,使用之前创建的Actor 发送一个消息</span></span><br><span class="line"> <span class="comment">//并且使用`Ask` 异步方法等待发送消息的结果</span></span><br><span class="line"> <span class="keyword">var</span> result = <span class="keyword">await</span> MvcApplication.MyActor.Ask<SomeResult>(<span class="keyword">new</span> SomeMessage(someRequest.SomeArg1,someRequest.SomeArg2));</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><span id="more"></span>
<h3 id="创建ASP-NET-资源"><a class="header-anchor" href="#创建ASP-NET-资源">¶</a><a href="http://xn--ASP-th2el20d.NET">创建ASP</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>【Akka.NET 文档】控制台程序部署场景</title>
<link href="http://codeyu.com/2016/08/21/Console-deployment-scenario/"/>
<id>http://codeyu.com/2016/08/21/Console-deployment-scenario/</id>
<published>2016-08-21T23:10:50.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<span id="more"></span><h2 id="控制台程序"><a class="header-anchor" href="#控制台程序">¶</a>控制台程序</h2><figure class="highlight pm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">PM> install-<span class="keyword">package</span> Akka</span><br><span class="line">PM> install-<span class="keyword">package</span> Akka.Remote</span><br></pre></td></tr></table></figure><figure class="highlight cs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">using</span> Akka;</span><br><span class="line"><span class="keyword">using</span> Akka.Actor;</span><br><span class="line"><span class="keyword">using</span> Akka.Configuration;</span><br><span class="line"></span><br><span class="line"><span class="keyword">namespace</span> <span class="title">Foo.Bar</span></span><br><span class="line">{</span><br><span class="line"> <span class="keyword">class</span> <span class="title">Program</span></span><br><span class="line"> {</span><br><span class="line"> <span class="function"><span class="keyword">static</span> <span class="keyword">void</span> <span class="title">Main</span>(<span class="params"><span class="built_in">string</span>[] <span class="keyword">args</span></span>)</span></span><br><span class="line"> {</span><br><span class="line"> <span class="comment">//配置远程路径为 localhost:8081</span></span><br><span class="line"> <span class="keyword">var</span> fluentConfig = FluentConfig.Begin()</span><br><span class="line"> .StartRemotingOn(<span class="string">"localhost"</span>, <span class="number">8081</span>)</span><br><span class="line"> .Build();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">using</span> (<span class="keyword">var</span> system = ActorSystem.Create(<span class="string">"my-actor-server"</span>, fluentConfig))</span><br><span class="line"> {</span><br><span class="line"> <span class="comment">//实例化两个服务</span></span><br><span class="line"> <span class="keyword">var</span> service1= system.ActorOf<Service1>(<span class="string">"service1"</span>);</span><br><span class="line"> <span class="keyword">var</span> service2 = system.ActorOf<Service2>(<span class="string">"service2"</span>);</span><br><span class="line"> Console.ReadKey();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><span id="more"></span>
<h2 id="控制台程序"><a class="header-anchor" href="#控制台程序">¶</a>控制台程序</h2>
<figure class="highlight pm"><table><tr><td cl</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
<entry>
<title>【Akka.NET 文档】约定成俗的Hello World</title>
<link href="http://codeyu.com/2016/08/20/The-Obligatory-Hello-World/"/>
<id>http://codeyu.com/2016/08/20/The-Obligatory-Hello-World/</id>
<published>2016-08-20T10:44:56.000Z</published>
<updated>2025-04-12T03:50:10.343Z</updated>
<content type="html"><![CDATA[<p>下面的例子演示怎么在C# 和F# 语言中定义和使用actors</p><h2 id="C-语言的Hello-World"><a class="header-anchor" href="#C-语言的Hello-World">¶</a>C# 语言的Hello World</h2><h4 id="定义一个消息:"><a class="header-anchor" href="#定义一个消息:">¶</a>定义一个消息:</h4><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// Create an (immutable) message type that your actor will respond to</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">Greet</span></span><br><span class="line">{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="title">Greet</span>(<span class="params"><span class="built_in">string</span> who</span>)</span></span><br><span class="line"> {</span><br><span class="line"> Who = who;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">public</span> <span class="built_in">string</span> Who { <span class="keyword">get</span>;<span class="keyword">private</span> <span class="keyword">set</span>; }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><h4 id="通过使用-ReceiveActor-API-定义你的actor"><a class="header-anchor" href="#通过使用-ReceiveActor-API-定义你的actor">¶</a>通过使用 <code>ReceiveActor</code> API 定义你的actor</h4><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// Create the actor class</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">GreetingActor</span> : <span class="title">ReceiveActor</span></span><br><span class="line">{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="title">GreetingActor</span>()</span></span><br><span class="line"> {</span><br><span class="line"> Receive<Greet>(greet => Console.WriteLine(<span class="string">"Hello {0}"</span>, greet.Who));</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><h4 id="…或者使用-TypedActor-API"><a class="header-anchor" href="#…或者使用-TypedActor-API">¶</a>…或者使用 <code>TypedActor</code> API</h4><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">GreetingActor</span> : <span class="title">TypedActor</span> , <span class="title">IHandle</span><<span class="title">Greet</span>></span><br><span class="line">{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">Handle</span>(<span class="params">Greet greet</span>)</span></span><br><span class="line"> {</span><br><span class="line"> Console.WriteLine(<span class="string">"Hello {0}!"</span>, greet.Who);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><h4 id="用法"><a class="header-anchor" href="#用法">¶</a>用法:</h4><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// Create a new actor system (a container for your actors)</span></span><br><span class="line"><span class="keyword">var</span> system = ActorSystem.Create(<span class="string">"MySystem"</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// Create your actor and get a reference to it.</span></span><br><span class="line"><span class="comment">// This will be an "IActorRef", which is not a reference to the actual actor</span></span><br><span class="line"><span class="comment">// instance but rather a client or proxy to it.</span></span><br><span class="line"><span class="keyword">var</span> greeter = system.ActorOf<GreetingActor>(<span class="string">"greeter"</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// Send a message to the actor.</span></span><br><span class="line">greeter.Tell(<span class="keyword">new</span> Greet(<span class="string">"World"</span>));</span><br><span class="line"></span><br><span class="line"><span class="comment">// This prevents the app from exiting</span></span><br><span class="line"><span class="comment">// before the async work is done.</span></span><br><span class="line">Console.ReadLine();</span><br></pre></td></tr></table></figure><p>参考:</p><ul><li><a href="http://api.getakka.net/docs/stable/html/6300028C.htm">Untyped actors</a></li><li><a href="http://api.getakka.net/docs/stable/html/DCCA8182.htm">Typed actors</a></li></ul><h2 id="F-语言的Hello-World"><a class="header-anchor" href="#F-语言的Hello-World">¶</a>F# 语言的Hello World</h2><figure class="highlight fsharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// Create an (immutable) message type that your actor will respond to</span></span><br><span class="line"><span class="keyword">type</span> <span class="title class_">Greet</span> <span class="operator">=</span> Greet <span class="keyword">of</span> <span class="type">string</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> system <span class="operator">=</span> ActorSystem.Create <span class="string">"MySystem"</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// Use F# computation expression with tail-recursive loop</span></span><br><span class="line"><span class="comment">// to create an actor message handler and return a reference</span></span><br><span class="line"><span class="keyword">let</span> greeter <span class="operator">=</span> spawn system <span class="string">"greeter"</span> <span class="operator"><|</span> <span class="keyword">fun</span> mailbox <span class="operator">-></span></span><br><span class="line"> <span class="keyword">let</span> <span class="keyword">rec</span> loop() <span class="operator">=</span> <span class="keyword">actor</span> {</span><br><span class="line"> <span class="keyword">let!</span> msg <span class="operator">=</span> mailbox.Receive()</span><br><span class="line"> <span class="keyword">match</span> msg <span class="keyword">with</span></span><br><span class="line"> <span class="operator">|</span> Greet who <span class="operator">-></span> <span class="built_in">printf</span> <span class="string">"Hello, %s!\n"</span> who</span><br><span class="line"> <span class="keyword">return!</span> loop() }</span><br><span class="line"> loop()</span><br><span class="line"></span><br><span class="line">greeter <span class="operator"><!</span> Greet <span class="string">"World"</span></span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><p>下面的例子演示怎么在C# 和F# 语言中定义和使用actors</p>
<h2 id="C-语言的Hello-World"><a class="header-anchor" href="#C-语言的Hello-World">¶</a>C# 语言的Hello World</h</summary>
<category term="翻译" scheme="http://codeyu.com/categories/%E7%BF%BB%E8%AF%91/"/>
<category term="Akka.NET" scheme="http://codeyu.com/tags/Akka-NET/"/>
</entry>
</feed>