-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
745 lines (475 loc) · 69.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
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
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
<meta charset="utf-8">
<title>抬头望天、放肆地微笑😊</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta property="og:type" content="website">
<meta property="og:title" content="抬头望天、放肆地微笑😊">
<meta property="og:url" content="https://zhangzhenling.github.io/index.html">
<meta property="og:site_name" content="抬头望天、放肆地微笑😊">
<meta property="og:locale" content="en">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="抬头望天、放肆地微笑😊">
<link rel="alternate" href="/atom.xml" title="抬头望天、放肆地微笑😊" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo">抬头望天、放肆地微笑😊</a>
</h1>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/archives">Archives</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Search"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="https://zhangzhenling.github.io"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main">
<article id="post-oracle数据迁移之数据泵" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/10/17/oracle数据迁移之数据泵/" class="article-date">
<time datetime="2019-10-17T11:58:34.000Z" itemprop="datePublished">2019-10-17</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/10/17/oracle数据迁移之数据泵/">oracle数据迁移之数据泵</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h1 id="oracle数据迁移-——-数据泵的使用"><a href="#oracle数据迁移-——-数据泵的使用" class="headerlink" title="oracle数据迁移 —— 数据泵的使用"></a>oracle数据迁移 —— 数据泵的使用</h1><h2 id="导出数据库脚本"><a href="#导出数据库脚本" class="headerlink" title="导出数据库脚本"></a>导出数据库脚本</h2><ol>
<li><p>登录数据库,输入命令:<br>sqlplus sys as sysdba</p>
</li>
<li><p>创建目录路径,输入命令:</p>
<figure class="highlight sql"><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">create</span> <span class="keyword">directory</span> data_dir <span class="keyword">as</span> E:\orcl\<span class="keyword">data</span><span class="string">';</span></span><br><span class="line"><span class="string">--使用 select * from dba_directories; 可查询用户创建的目录</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>为oracle用户授予访问目录的权限,输入命令:</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">grant</span> <span class="keyword">read</span>,write <span class="keyword">on</span> <span class="keyword">directory</span> data_dir <span class="keyword">to</span> pm52; <span class="comment">--用户名:pm52</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>导出数据库脚本(在cmd下执行)</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">expdp pm52/sa@mapletr directory=data_dir dumpfile=pm52.dmp log=pm52.log</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="导入数据库脚本"><a href="#导入数据库脚本" class="headerlink" title="导入数据库脚本"></a>导入数据库脚本</h2><ol>
<li><p>登录sysdba</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sqlplus sys@orcl/sa as sysdba</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建表空间</p>
<figure class="highlight sql"><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="keyword">create</span> <span class="keyword">tablespace</span> MTR_DATA <span class="keyword">datafile</span> <span class="string">'C:\oradata\orcl\MTR_DATA.dbf'</span> <span class="keyword">size</span> <span class="number">2000</span>m <span class="keyword">autoextend</span> <span class="keyword">on</span> <span class="keyword">next</span> <span class="number">200</span>m;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">tablespace</span> PM_DATA <span class="keyword">datafile</span> <span class="string">'C:\oradata\orcl\PM_DATA.dbf'</span> <span class="keyword">size</span> <span class="number">2000</span>m <span class="keyword">autoextend</span> <span class="keyword">on</span> <span class="keyword">next</span> <span class="number">200</span>m;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">tablespace</span> MTR_LOB <span class="keyword">datafile</span> <span class="string">'C:\oradata\orcl\MTR_LOB.dbf'</span> <span class="keyword">size</span> <span class="number">2000</span>m <span class="keyword">autoextend</span> <span class="keyword">on</span> <span class="keyword">next</span> <span class="number">200</span>m;</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">tablespace</span> MTR_IDX <span class="keyword">datafile</span> <span class="string">'C:\oradata\orcl\MTR_IDX.dbf'</span> <span class="keyword">size</span> <span class="number">2000</span>m <span class="keyword">autoextend</span> <span class="keyword">on</span> <span class="keyword">next</span> <span class="number">200</span>m;</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建用户</p>
<figure class="highlight sql"><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"><span class="keyword">create</span> <span class="keyword">user</span> PM52 <span class="keyword">identified</span> <span class="keyword">by</span> <span class="string">"sa"</span> <span class="keyword">default</span> <span class="keyword">tablespace</span> PM_DATA <span class="keyword">temporary</span></span><br><span class="line"><span class="keyword">tablespace</span> TEMP;</span><br><span class="line"></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">connect</span>,<span class="keyword">resource</span>,dba,ctxapp <span class="keyword">to</span> PM52;</span><br><span class="line"></span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">select</span> <span class="keyword">any</span> <span class="keyword">table</span>,<span class="keyword">delete</span> <span class="keyword">any</span> <span class="keyword">table</span>,<span class="keyword">update</span> <span class="keyword">any</span> <span class="keyword">table</span>,<span class="keyword">insert</span> <span class="keyword">any</span> <span class="keyword">table</span>,<span class="keyword">create</span> <span class="keyword">view</span> <span class="keyword">to</span> PM52;</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建目录,并授权</p>
<figure class="highlight sql"><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">create</span> <span class="keyword">directory</span> dir <span class="keyword">as</span> <span class="string">'c:\db'</span>;</span><br><span class="line"><span class="keyword">grant</span> <span class="keyword">read</span>,write <span class="keyword">on</span> <span class="keyword">directory</span> dir <span class="keyword">to</span> PM52;</span><br></pre></td></tr></table></figure>
</li>
<li><p>导入数据库</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">impdp PM52/sa@orcl directory=dir remap_schema=PM52:PM52 dumpfile=PM52.DMP logfile=PM52.log;</span><br></pre></td></tr></table></figure>
</li>
<li><p>编译未通过的函数、视图、同义词</p>
<figure class="highlight sql"><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">var aa varchar2(500);</span><br><span class="line"><span class="keyword">begin</span> </span><br><span class="line">P_Compiledbobj(<span class="number">1</span>,<span class="string">'PM52'</span>,:aa);</span><br><span class="line"><span class="keyword">end</span>;</span><br><span class="line">/</span><br><span class="line">print aa;</span><br></pre></td></tr></table></figure>
</li>
<li><p>多个表空间的问题</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">impdp PM52/sa@orcl directory=dir remap_schema=PM52:PM52 dumpfile=PM52.DMP logfile=PM52.log remap_tablespace='(PM_DATA:PM_DATA,PM_LOB:PM_LOB,PM_IDX:PM_IDX)';</span><br></pre></td></tr></table></figure></li>
</ol>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2019/10/17/oracle数据迁移之数据泵/" data-id="ck2343m9g00391rifanez9v1c" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/oracle/">oracle</a></li></ul>
</footer>
</div>
</article>
<article id="post-hello-world" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/10/10/hello-world/" class="article-date">
<time datetime="2019-10-09T16:00:00.000Z" itemprop="datePublished">2019-10-10</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/10/10/hello-world/">Hello World</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
owner: 'zhangzhenling',
repo: 'zhangzhenling.github.io',
oauth: {
client_id: '742c0b99cb707795d0ad',
client_secret: '8fb40ba25255594e76b08d725ccb1ea73c50317b',
},
})
gitment.render('container')
</script>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2019/10/10/hello-world/" data-id="ck2343m9f00351rif99iqx7ed" class="article-share-link">Share</a>
</footer>
</div>
</article>
<article id="post-C#集合IEnumerable的扩展" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/09/05/C#集合IEnumerable的扩展/" class="article-date">
<time datetime="2019-09-04T16:00:00.000Z" itemprop="datePublished">2019-09-05</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/资源分享/">资源分享</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/09/05/C#集合IEnumerable的扩展/">C#集合IEnumerable的扩展</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<ul>
<li>根据某些个字段进行去重<figure class="highlight c#"><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">static</span> IEnumerable<TSource> DistinctBy<TSource, TKey> (<span class="keyword">this</span> IEnumerable<TSource> source, Func<TSource, TKey> keySelector)</span><br><span class="line">{</span><br><span class="line"> HashSet<TKey> seenKeys = <span class="keyword">new</span> HashSet<TKey>();</span><br><span class="line"> <span class="keyword">foreach</span> (TSource element <span class="keyword">in</span> source)</span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">if</span> (seenKeys.Add(keySelector(element)))</span><br><span class="line"> {</span><br><span class="line"> <span class="keyword">yield</span> <span class="keyword">return</span> element;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</li>
</ul>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2019/09/05/C#集合IEnumerable的扩展/" data-id="ck2343m9e00331rifoo0ut99o" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/美好的生活从这里开始/">美好的生活从这里开始</a></li></ul>
</footer>
</div>
</article>
<article id="post-前端text树形文本转树形json" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/03/27/前端text树形文本转树形json/" class="article-date">
<time datetime="2019-03-26T16:00:00.000Z" itemprop="datePublished">2019-03-27</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/资源分享/">资源分享</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/03/27/前端text树形文本转树形json/">前端text树形文本转树形json</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<figure class="highlight html"><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></pre></td><td class="code"><pre><span class="line"><span class="meta"><!DOCTYPE html></span></span><br><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"Content-Type"</span> <span class="attr">content</span>=<span class="string">"text/html; charset=utf-8"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span><span class="tag"></<span class="name">title</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">script</span> <span class="attr">src</span>=<span class="string">"/js/jquery.js"</span>></span><span class="tag"></<span class="name">script</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span> /></span></span><br><span class="line"><span class="tag"></<span class="name">head</span>></span></span><br><span class="line"><span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">textarea</span> <span class="attr">id</span>=<span class="string">"txtarea"</span> <span class="attr">rows</span>=<span class="string">"6"</span>></span><span class="tag"></<span class="name">textarea</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">input</span> <span class="attr">type</span>=<span class="string">"button"</span> <span class="attr">onclick</span>=<span class="string">"convertToJson()"</span> <span class="attr">value</span>=<span class="string">"转换"</span> /></span></span><br><span class="line"> <span class="tag"><<span class="name">textarea</span> <span class="attr">id</span>=<span class="string">"txtarearesult"</span> <span class="attr">rows</span>=<span class="string">"6"</span>></span><span class="tag"></<span class="name">textarea</span>></span></span><br><span class="line"><span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br><span class="line"><span class="tag"><<span class="name">script</span>></span></span><br><span class="line"><span class="javascript"> <span class="function"><span class="keyword">function</span> <span class="title">convertToJson</span>(<span class="params"></span>) </span>{</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> val = $(<span class="string">"#txtarea"</span>).val();</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> lines = val.split(<span class="string">'\n'</span>);</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> preNode = {};</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> resultJson = [];</span></span><br><span class="line"><span class="javascript"> <span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i < lines.length; i++) {</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> line = lines[i];</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> lastIndex = line.lastIndexOf(<span class="string">"+"</span>);</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> text = line.substr(lastIndex + <span class="number">1</span>, line.length);</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> currentNode = { <span class="attr">text</span>: text, <span class="attr">value</span>: text, <span class="attr">level</span>: lastIndex, <span class="attr">children</span>: [] };</span></span><br><span class="line"><span class="javascript"> <span class="keyword">if</span> (lastIndex == <span class="number">-1</span>) {</span></span><br><span class="line"> resultJson.push(currentNode);</span><br><span class="line"><span class="javascript"> } <span class="keyword">else</span> <span class="keyword">if</span> (lastIndex > preNode.level) {</span></span><br><span class="line"> preNode.children.push(currentNode);</span><br><span class="line"><span class="javascript"> } <span class="keyword">else</span> {</span></span><br><span class="line"><span class="javascript"> <span class="keyword">var</span> node = getNodeBylevel(resultJson, lastIndex - <span class="number">1</span>);</span></span><br><span class="line"><span class="javascript"> <span class="keyword">if</span> (node) {</span></span><br><span class="line"> node.children.push(currentNode);</span><br><span class="line"><span class="javascript"> } <span class="keyword">else</span> {</span></span><br><span class="line"> resultJson.push(currentNode);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> preNode = currentNode;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"><span class="javascript"> $(<span class="string">"#txtarearesult"</span>).val(<span class="built_in">JSON</span>.stringify(resultJson));</span></span><br><span class="line"><span class="javascript"> <span class="comment">//alert(val);</span></span></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"><span class="javascript"> <span class="function"><span class="keyword">function</span> <span class="title">getNodeBylevel</span>(<span class="params">nodes, level</span>) </span>{</span></span><br><span class="line"><span class="javascript"> <span class="keyword">if</span> (nodes && nodes[<span class="number">0</span>].level == level) {</span></span><br><span class="line"><span class="javascript"> <span class="keyword">return</span> nodes[nodes.length - <span class="number">1</span>];</span></span><br><span class="line"><span class="javascript"> } <span class="keyword">else</span> {</span></span><br><span class="line"><span class="javascript"> <span class="keyword">return</span> getNodeBylevel(nodes[nodes.length - <span class="number">1</span>].children, level);</span></span><br><span class="line"> }</span><br><span class="line"> };</span><br><span class="line"><span class="tag"></<span class="name">script</span>></span></span><br></pre></td></tr></table></figure>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2019/03/27/前端text树形文本转树形json/" data-id="ck2343m9c002z1riftao75i3x" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/美好的生活从这里开始/">美好的生活从这里开始</a></li></ul>
</footer>
</div>
</article>
<article id="post-资源分享" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2019/03/01/资源分享/" class="article-date">
<time datetime="2019-02-28T16:00:00.000Z" itemprop="datePublished">2019-03-01</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/资源分享/">资源分享</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2019/03/01/资源分享/">快乐学习,资源共享</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<ul>
<li><a href="http://blog.163.com/ch0602120131@126/" target="_blank" rel="noopener">优美的歌曲,整理博客</a></li>
<li><a href="http://www.liu16.com/g.html" target="_blank" rel="noopener">Google代理服务器</a></li>
<li><a href="https://www.iplaysoft.com/syncthing.html" target="_blank" rel="noopener">免费开源的文件夹同步神器,可以进行局域网内电脑资源同步</a></li>
<li><a href="http://69.28.91.10/" target="_blank" rel="noopener">浏览器vpn代理</a></li>
<li><a href="https://www.iplaysoft.com/wol.html" target="_blank" rel="noopener">WOL 网络唤醒远程开机设置方法教程 + 多款软件下载!(手机远程开启电脑)</a></li>
</ul>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2019/03/01/资源分享/" data-id="ck2343m9c002x1rifwvd3p3qn" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/美好的生活从这里开始/">美好的生活从这里开始</a></li></ul>
</footer>
</div>
</article>
<article id="post-python-blog" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2018/11/20/python-blog/" class="article-date">
<time datetime="2018-11-19T16:00:00.000Z" itemprop="datePublished">2018-11-20</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/Python/">Python</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2018/11/20/python-blog/">Python系统学习指南</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h2 id="Python系统学习指南"><a href="#Python系统学习指南" class="headerlink" title="Python系统学习指南"></a>Python系统学习指南</h2><h3 id="1、系统学习python的博客"><a href="#1、系统学习python的博客" class="headerlink" title="1、系统学习python的博客"></a>1、<a href="https://www.cnblogs.com/adc8868/archive/2016/05.html" target="_blank" rel="noopener">系统学习python的博客</a></h3><ul>
<li>简述:由浅入深,从简单语法到复杂功能实现</li>
</ul>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2018/11/20/python-blog/" data-id="ck2343m9a002t1rifxg2t8wce" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Python/">Python</a></li></ul>
</footer>
</div>
</article>
<article id="post-C#大文件上传" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2018/11/07/C#大文件上传/" class="article-date">
<time datetime="2018-11-06T16:00:00.000Z" itemprop="datePublished">2018-11-07</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/C/">C#</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2018/11/07/C#大文件上传/">C#大文件上传</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<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><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">string</span> <span class="title">MyUploader</span> (<span class="params"><span class="keyword">string</span> strFileToUpload, <span class="keyword">string</span> strUrl, Action<<span class="keyword">double</span>, <span class="keyword">double</span>> uploading</span>)</span> {</span><br><span class="line"> <span class="keyword">string</span> strFileFormName = <span class="string">"file"</span>;</span><br><span class="line"> Uri oUri = <span class="keyword">new</span> Uri (strUrl);</span><br><span class="line"> <span class="keyword">string</span> strBoundary = <span class="string">"----------"</span> + DateTime.Now.Ticks.ToString (<span class="string">"x"</span>);</span><br><span class="line"> <span class="comment">// The trailing boundary</span></span><br><span class="line"> <span class="keyword">string</span> <span class="keyword">byte</span>[] boundaryBytes = Encoding.ASCII.GetBytes (<span class="string">"\r\n--"</span> + strBoundary + <span class="string">"--\r\n"</span>);</span><br><span class="line"> <span class="comment">//**注意此处的 strBoundary后的换行前加上--,不然会异常** </span></span><br><span class="line"> <span class="comment">// The post message header </span></span><br><span class="line"> StringBuilder sb = <span class="keyword">new</span> StringBuilder ();</span><br><span class="line"> sb.Append (<span class="string">"--"</span>);</span><br><span class="line"> sb.Append (strBoundary);</span><br><span class="line"> sb.Append (<span class="string">"\r\n"</span>);</span><br><span class="line"> sb.Append (<span class="string">"Content-Disposition: form-data; name=\""</span>);</span><br><span class="line"> sb.Append (strFileFormName);</span><br><span class="line"> sb.Append (<span class="string">"\"; filename=\""</span>);</span><br><span class="line"> sb.Append (Path.GetFileName (strFileToUpload));</span><br><span class="line"> sb.Append (<span class="string">"\""</span>);</span><br><span class="line"> sb.Append (<span class="string">"\r\n"</span>);</span><br><span class="line"> sb.Append (<span class="string">"Content-Type: "</span>);</span><br><span class="line"> sb.Append (<span class="string">"application/octet-stream"</span>);</span><br><span class="line"> sb.Append (<span class="string">"\r\n"</span>);</span><br><span class="line"> sb.Append (<span class="string">"\r\n"</span>);</span><br><span class="line"> <span class="keyword">string</span> strPostHeader = sb.ToString ();</span><br><span class="line"> <span class="keyword">byte</span>[] postHeaderBytes = Encoding.UTF8.GetBytes (strPostHeader);</span><br><span class="line"> <span class="comment">// The WebRequest </span></span><br><span class="line"> HttpWebRequest oWebrequest = (HttpWebRequest) WebRequest.Create (oUri);</span><br><span class="line"> oWebrequest.ContentType = <span class="string">"multipart/form-data; boundary="</span> + strBoundary;</span><br><span class="line"> oWebrequest.Method = <span class="string">"POST"</span>;</span><br><span class="line"> <span class="comment">// This is important, otherwise the whole file will be read to memory anyway... </span></span><br><span class="line"> oWebrequest.AllowWriteStreamBuffering = <span class="literal">false</span>;</span><br><span class="line"> <span class="comment">// Get a FileStream and set the final properties of the WebRequest</span></span><br><span class="line"> FileStream oFileStream = <span class="keyword">new</span> FileStream (strFileToUpload, FileMode.Open, FileAccess.Read);</span><br><span class="line"> <span class="keyword">long</span> length = postHeaderBytes.Length + oFileStream.Length + boundaryBytes.Length;</span><br><span class="line"> oWebrequest.ContentLength = length;</span><br><span class="line"> Stream oRequestStream = oWebrequest.GetRequestStream ();</span><br><span class="line"> <span class="comment">// Write the post header </span></span><br><span class="line"> oRequestStream.Write (postHeaderBytes, <span class="number">0</span>, postHeaderBytes.Length);</span><br><span class="line"> <span class="comment">// Stream the file contents in small pieces (4096 bytes, max).</span></span><br><span class="line"> <span class="keyword">byte</span>[] buffer = <span class="keyword">new</span> Byte[<span class="keyword">checked</span> ((<span class="keyword">uint</span>) Math.Min (<span class="number">4096</span>, (<span class="keyword">int</span>) oFileStream.Length))];</span><br><span class="line"> <span class="keyword">int</span> bytesRead = <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">double</span> size = <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">while</span> ((bytesRead = oFileStream.Read (buffer, <span class="number">0</span>, buffer.Length)) != <span class="number">0</span>) { oRequestStream.Write (buffer, <span class="number">0</span>, bytesRead); size += bytesRead; <span class="keyword">if</span> (uploading != <span class="literal">null</span>) uploading (length, size); }</span><br><span class="line"> oFileStream.Close ();</span><br><span class="line"> <span class="comment">// Add the trailing boundary </span></span><br><span class="line"> oRequestStream.Write (boundaryBytes, <span class="number">0</span>, boundaryBytes.Length);</span><br><span class="line"> WebResponse oWResponse = oWebrequest.GetResponse ();</span><br><span class="line"> Stream s = oWResponse.GetResponseStream ();</span><br><span class="line"> StreamReader sr = <span class="keyword">new</span> StreamReader (s);</span><br><span class="line"> String sReturnString = sr.ReadToEnd ();</span><br><span class="line"> <span class="comment">// Clean up </span></span><br><span class="line"> oFileStream.Close ();</span><br><span class="line"> oRequestStream.Close ();</span><br><span class="line"> s.Close ();</span><br><span class="line"> sr.Close ();</span><br><span class="line"> <span class="keyword">return</span> sReturnString;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<hr>
<p>原文:<a href="https://blog.csdn.net/u012790747/article/details/46052519" target="_blank" rel="noopener">https://blog.csdn.net/u012790747/article/details/46052519</a> </p>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2018/11/07/C#大文件上传/" data-id="ck2343m97002o1rif1kdzua1i" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/C/">C#</a></li></ul>
</footer>
</div>
</article>
<article id="post-文件流" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2018/11/07/文件流/" class="article-date">
<time datetime="2018-11-06T16:00:00.000Z" itemprop="datePublished">2018-11-07</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/C/">C#</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2018/11/07/文件流/">C#文件流</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>一、文件流</p>
<p>FileStream类主要用于读写磁盘文件。常用于向磁盘存储数据或读取配置文件。</p>
<p>读取文件:</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></pre></td><td class="code"><pre><span class="line"><span class="comment">//文件流:读取</span></span><br><span class="line">FileStream fileStream = File.Open(<span class="string">@"D:\test.txt"</span>, FileMode.Open);<span class="comment">//初始化文件流</span></span><br><span class="line"><span class="keyword">byte</span>[] array = <span class="keyword">new</span> <span class="keyword">byte</span>[fileStream.Length];<span class="comment">//初始化字节数组,用来暂存读取到的字节</span></span><br><span class="line">fileStream.Read(array, <span class="number">0</span>, array.Length);<span class="comment">//读取流中数据,写入到字节数组中</span></span><br><span class="line">fileStream.Close(); <span class="comment">//关闭流</span></span><br><span class="line"><span class="keyword">string</span> str = Encoding.Default.GetString(array);<span class="comment">//将字节数组内容转化为字符串</span></span><br><span class="line">Response.Write(str);</span><br></pre></td></tr></table></figure>
<p>写入文件:</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></pre></td><td class="code"><pre><span class="line"><span class="comment">//文件流:写入</span></span><br><span class="line">FileStream fileStream = File.Open(<span class="string">@"D:\test.txt"</span>,FileMode.Append);<span class="comment">//初始化文件流</span></span><br><span class="line"><span class="keyword">byte</span>[] array = Encoding.Default.GetBytes(<span class="string">"哈哈123abc"</span>);<span class="comment">//给字节数组赋值</span></span><br><span class="line">fileStream.Write(array, <span class="number">0</span>, array.Length);<span class="comment">//将字节数组写入文件流</span></span><br><span class="line">fileStream.Close();<span class="comment">//关闭流</span></span><br></pre></td></tr></table></figure>
<p>二、网络流</p>
<p>NetWorkStream类是专门用来处理服务器与客户端通信的流。它在网络编程中经常使用,主要是用来处理类似Socket、TcpClient和TcpListener这些类中得到的流。</p>
<p>单的TCP同步方式,服务器与客户端通信:</p>
<p>服务器</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">TcpListener lis=<span class="keyword">new</span> TcpListener(<span class="number">5000</span>); <span class="comment">//服务器监听</span></span><br><span class="line">lis.Start();<span class="comment">//启动</span></span><br><span class="line">Socket sock=lis.AcceptSocket();<span class="comment">//阻塞,直到有客户端连接</span></span><br><span class="line"></span><br><span class="line">NetworkStream networkStream = <span class="keyword">new</span> NetworkStream(sock);<span class="comment">//得到Socket中的流</span></span><br><span class="line"><span class="keyword">if</span> (netStream.DataAvailable) <span class="comment">//如果客户端发送了消息</span></span><br><span class="line">{</span><br><span class="line"> <span class="keyword">byte</span>[] data = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">1024</span>]; <span class="comment">//定义一个字节数组,用来存放接收的数据</span></span><br><span class="line"> <span class="keyword">int</span> len = netStream.Read(data, <span class="number">0</span>, data.Length); <span class="comment">//从位置开始,读取到字节数组末尾</span></span><br><span class="line"> <span class="keyword">string</span> line = Encoding.Default.GetString(data, <span class="number">0</span>, len); <span class="comment">//把收到的字节转换为字符串</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>客户端</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></pre></td><td class="code"><pre><span class="line">TcpClient client = <span class="keyword">new</span> TcpClient();<span class="comment">//客户端tcp对象</span></span><br><span class="line">client.Connect(<span class="string">"127.0.0.1"</span>, <span class="number">5000</span>);<span class="comment">//连接服务器</span></span><br><span class="line">NetworkStream myStream = client.GetStream();<span class="comment">//得到网络流</span></span><br><span class="line"> </span><br><span class="line"><span class="keyword">byte</span>[] data = Encoding.Default.GetBytes(<span class="string">"Hi,你好"</span>); <span class="comment">//首先把输入的字符串消息转换为字节</span></span><br><span class="line">myStream .Write(data, <span class="number">0</span>, data.Length); <span class="comment">//向myStream 里写入数据</span></span><br><span class="line">myStream .Flush(); <span class="comment">//刷新流中的数据</span></span><br><span class="line">myStream .Close();</span><br></pre></td></tr></table></figure>
<p>三、内存流</p>
<p>MemoryStream类主要用于操作内存中的数据。比如说网络中传输数据时可以用流的形式,当我们收到这些流数据时就可以声明MemoryStream类来存储并且处理它们。</p>
<p>MemoryStream操作字符串:</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></pre></td><td class="code"><pre><span class="line"><span class="keyword">string</span> str = <span class="string">"Hi!你好!"</span>;</span><br><span class="line"><span class="keyword">byte</span>[] array = Encoding.UTF8.GetBytes(str);<span class="comment">//将字符串转化为字节数组</span></span><br><span class="line">MemoryStream memory = <span class="keyword">new</span> MemoryStream(array);<span class="comment">//初始化MemoryStream类</span></span><br><span class="line"><span class="keyword">byte</span>[] arrayNew = memory.ToArray();<span class="comment">//将内存中的数据转换为字节数组</span></span><br><span class="line"><span class="keyword">string</span> strNew = Encoding.UTF8.GetString(arrayNew);<span class="comment">//将字节数组转换为字符串</span></span><br></pre></td></tr></table></figure>
<p> 四、StreamReader/StreamWriter</p>
<p>StreamReader/StreamWriter主要用来处理流数据。它们分别提供了高效的流读取/写入功能。</p>
<p>读取:</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></pre></td><td class="code"><pre><span class="line"><span class="comment">//StreamReader 读取</span></span><br><span class="line">StreamReader reader = <span class="keyword">new</span> StreamReader(<span class="string">@"D:\test.txt"</span>,Encoding.Default);<span class="comment">//初始化读取 设置编码格式,否则中文会乱码</span></span><br><span class="line"><span class="keyword">string</span> readStr = reader.ReadLine();<span class="comment">//从流中读取一行 reader.ReadToEnd()读取全部</span></span><br><span class="line">reader.Close();<span class="comment">//关闭流</span></span><br></pre></td></tr></table></figure>
<p>写入:</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></pre></td><td class="code"><pre><span class="line"><span class="comment">//StreamWriter 写入</span></span><br><span class="line">StreamWriter writer = <span class="keyword">new</span> StreamWriter(<span class="string">@"D:\test1.txt"</span>);<span class="comment">//初始化写入</span></span><br><span class="line">writer.WriteLine(<span class="string">"Hi 你好123"</span>);<span class="comment">//写入一行</span></span><br><span class="line">writer.Close();</span><br></pre></td></tr></table></figure>
<p>五、TextReader/TextWriter</p>
<p>TextReader/TextWriter类主要用来处理流数据。它们分别提供了高效的文本流读取/写入功能。</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="comment">//TextReader/Writer读写</span></span><br><span class="line">TextReader textReader = <span class="keyword">new</span> StringReader(<span class="string">"Hi 你好"</span>);<span class="comment">//初始化读取流</span></span><br><span class="line">TextWriter textWriter = <span class="keyword">new</span> StringWriter();<span class="comment">//初始化写入流</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">char</span>[] c=<span class="keyword">new</span> <span class="keyword">char</span>[<span class="number">4096</span>];</span><br><span class="line"><span class="keyword">int</span> chars = <span class="number">0</span>;</span><br><span class="line"><span class="keyword">while</span> ((chars = textReader.Read(c, <span class="number">0</span>, <span class="number">4096</span>)) > <span class="number">0</span>)<span class="comment">//把流中数据写入到字符数组中 读取流中数据</span></span><br><span class="line">{</span><br><span class="line"> textWriter.Write(c, <span class="number">0</span>, <span class="number">4096</span>);<span class="comment">//从字符数组中读取流</span></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">string</span> str= textWriter.ToString();<span class="comment">//将流中数据写到字符串中</span></span><br><span class="line">textReader.Close();<span class="comment">//关闭流</span></span><br><span class="line">textWriter.Close();</span><br></pre></td></tr></table></figure>
<p>注意事项:</p>
<p>1.流使用后必须要关闭。</p>
<p>2.把流中数据加载到内存时要考虑内存溢出等问题。</p>
<p>文章来源>><a href="https://www.cnblogs.com/Johnny_Z/archive/2011/09/12/2174148.html" target="_blank" rel="noopener">https://www.cnblogs.com/Johnny_Z/archive/2011/09/12/2174148.html</a></p>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2018/11/07/文件流/" data-id="ck2343m99002r1rifs7c2hz7h" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/C/">C#</a></li></ul>
</footer>
</div>
</article>
<article id="post-docker的使用" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2018/09/29/docker的使用/" class="article-date">
<time datetime="2018-09-28T16:00:00.000Z" itemprop="datePublished">2018-09-29</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/docker/">docker</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2018/09/29/docker的使用/">docker学习使用</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>1、Docker的安装步骤:</p>
<ul>
<li>在bios中打开电脑的虚拟化功能</li>
<li>从系统的 “启用或关闭Windows功能”,启用Hyper-V功能</li>
<li>安装Docker</li>
</ul>
<p>2、在项目文件夹创建文件 Dockerfile【注意文件名字】,添加以下内容:</p>
<figure class="highlight plain"><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></pre></td><td class="code"><pre><span class="line">#添加基础镜像</span><br><span class="line">FROM microsoft/dotnet:2.1-aspnetcore-runtime</span><br><span class="line">#容器中系统的工作空间</span><br><span class="line">WORKDIR /app</span><br><span class="line">#拷贝当前文件夹下的文件到容器中系统的工作空间</span><br><span class="line">COPY . /app </span><br><span class="line">#设置Docker容器对外暴露的端口</span><br><span class="line">EXPOSE 80</span><br><span class="line">#容器中使用 ["dotnet","系统启动的dll"] 来运行应用程序</span><br><span class="line">#使用ENTRYPOINT ["dotnet","系统启动的dll"]</span><br><span class="line">#或使用 CMD ["dotnet","系统启动的dll"]</span><br><span class="line">ENTRYPOINT ["dotnet", "mapletr.dll"]</span><br></pre></td></tr></table></figure>
<p>3、执行生成镜像命令。<br>docker build -t mapletr:1.0.0 .<br>注意镜像名称后边的 . (mapletr:1.0.0是标识镜像名称和版本信息)<br>此时将下载Asp.Net Core 2.1-aspnetcore-runtime 基础镜像,并运行Dockerfile中的后续指令</p>
<p>4、创建并启动容器<br>docker run –name mapletr -p 80:80 mapletr</p>
<p>5、停止容器<br>docker stop mapletr</p>
<p>6、重启容器<br>docker start mapletr</p>
<p>7、删除容器(先停止,才能删除)<br>docker rm mapletr</p>
<p>8、导出镜像<br>docker export mapletr>d:/mapletr.tar</p>
<p>9、导入镜像<br>docker import -mapletr<d:/mapletr.tar</p>
<p>10、保存镜像<br>docker save -o d:/mapletr1.tar mapletr</p>
<p>11、加载镜像<br>docker load -i d:/mapletr1.tar</p>
<p>12、查看所有的镜像<br>docker images</p>
<p>13、查看所有的容器<br>docker ps -a</p>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2018/09/29/docker的使用/" data-id="ck2343m96002l1rifngr52x8t" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/docker/">docker</a></li></ul>
</footer>
</div>
</article>
<article id="post-netcore使用技巧" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2018/09/13/netcore使用技巧/" class="article-date">
<time datetime="2018-09-12T16:00:00.000Z" itemprop="datePublished">2018-09-13</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/netcore/">netcore</a>
</div>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2018/09/13/netcore使用技巧/">netcore使用</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<ul>
<li><a href="https://packagesearch.azurewebsites.net/" target="_blank" rel="noopener">packagesearch工具</a>,可以快速定位某个API在哪个Nuget包中</li>
<li>修改工程文件csproj可以使项目支持多个目标框架<figure class="highlight c#"><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"><Project Sdk=<span class="string">"Microsoft.NET.Sdk"</span>></span><br><span class="line"> <PropertyGroup></span><br><span class="line"> <TargetFrameworks>netstandard1<span class="number">.4</span>;netcoreapp1<span class="number">.0</span>;net45</TargetFrameworks></span><br><span class="line"> </PropertyGroup></span><br><span class="line"></Project></span><br></pre></td></tr></table></figure>
</li>
</ul>
<hr>
<p>以下是常见的条件编译符号列表:<br>**<br>.NET Framework 2.0 –> NET20<br>.NET Framework 3.5 –> NET35<br>.NET Framework 4.0 –> NET40<br>.NET Framework 4.5 –> NET45<br>.NET Framework 4.5.1 –> NET451<br>.NET Framework 4.5.2 –> NET452<br>.NET Framework 4.6 –> NET46<br>.NET Framework 4.6.1 –> NET461<br>.NET Framework 4.6.2 –> NET462<br>.NET Standard 1.0 –> NETSTANDARD1_0<br>.NET Standard 1.1 –> NETSTANDARD1_1<br>.NET Standard 1.2 –> NETSTANDARD1_2<br>.NET Standard 1.3 –> NETSTANDARD1_3<br>.NET Standard 1.4 –> NETSTANDARD1_4<br>.NET Standard 1.5 –> NETSTANDARD1_5<br>.NET Standard 1.6 –> NETSTANDARD1_6</p>
</div>
<footer class="article-footer">
<a data-url="https://zhangzhenling.github.io/2018/09/13/netcore使用技巧/" data-id="ck2343m94002j1rifb9jhmraz" class="article-share-link">Share</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/netcore/">netcore</a></li></ul>
</footer>
</div>
</article>
<nav id="page-nav">
<span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="page-number" href="/page/3/">3</a><span class="space">…</span><a class="page-number" href="/page/5/">5</a><a class="extend next" rel="next" href="/page/2/">Next »</a>
</nav>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Categories</h3>
<div class="widget">
<ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Angular/">Angular</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/C/">C#</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Js高级内容/">Js高级内容</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/MVC/">MVC</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Markdown/">Markdown</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Python/">Python</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Ubuntu/">Ubuntu</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/docker/">docker</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/javascript/">javascript</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/mongodb/">mongodb</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/netcore/">netcore</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/nginx/">nginx</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/silverlight/">silverlight</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/回到当初/">回到当初</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/当然我在扯淡/">当然我在扯淡</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/数据库/">数据库</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/牛人博客/">牛人博客</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/资源分享/">资源分享</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Tags</h3>
<div class="widget">
<ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Angular/">Angular</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/">C#</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Js高级内容/">Js高级内容</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MVC/">MVC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Markdown/">Markdown</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Oracle/">Oracle</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Python/">Python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Ubuntu/">Ubuntu</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/docker/">docker</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mongodb/">mongodb</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netcore/">netcore</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/">nginx</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/oracle/">oracle</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/silverlight/">silverlight</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/会峰网/">会峰网</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/前端学习/">前端学习</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/博客/">博客</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/开博客啦/">开博客啦</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/数据库/">数据库</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/牛逼一点/">牛逼一点</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/美好的生活从这里开始/">美好的生活从这里开始</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Tag Cloud</h3>
<div class="widget tagcloud">
<a href="/tags/Angular/" style="font-size: 10px;">Angular</a> <a href="/tags/C/" style="font-size: 17.5px;">C#</a> <a href="/tags/Js高级内容/" style="font-size: 10px;">Js高级内容</a> <a href="/tags/MVC/" style="font-size: 12.5px;">MVC</a> <a href="/tags/Markdown/" style="font-size: 10px;">Markdown</a> <a href="/tags/Oracle/" style="font-size: 10px;">Oracle</a> <a href="/tags/Python/" style="font-size: 10px;">Python</a> <a href="/tags/Ubuntu/" style="font-size: 17.5px;">Ubuntu</a> <a href="/tags/docker/" style="font-size: 10px;">docker</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/mongodb/" style="font-size: 10px;">mongodb</a> <a href="/tags/netcore/" style="font-size: 10px;">netcore</a> <a href="/tags/nginx/" style="font-size: 10px;">nginx</a> <a href="/tags/oracle/" style="font-size: 10px;">oracle</a> <a href="/tags/silverlight/" style="font-size: 10px;">silverlight</a> <a href="/tags/会峰网/" style="font-size: 10px;">会峰网</a> <a href="/tags/前端学习/" style="font-size: 10px;">前端学习</a> <a href="/tags/博客/" style="font-size: 10px;">博客</a> <a href="/tags/开博客啦/" style="font-size: 20px;">开博客啦</a> <a href="/tags/数据库/" style="font-size: 10px;">数据库</a> <a href="/tags/牛逼一点/" style="font-size: 10px;">牛逼一点</a> <a href="/tags/美好的生活从这里开始/" style="font-size: 15px;">美好的生活从这里开始</a>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Archives</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">October 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">September 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">March 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/11/">November 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/09/">September 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/08/">August 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">June 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/05/">May 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/03/">March 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/">February 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/06/">June 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/">May 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/">March 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/02/">February 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/06/">June 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">December 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">Recent Posts</h3>
<div class="widget">
<ul>
<li>
<a href="/2019/10/17/oracle数据迁移之数据泵/">oracle数据迁移之数据泵</a>
</li>
<li>
<a href="/2019/10/10/hello-world/">Hello World</a>
</li>
<li>
<a href="/2019/09/05/C#集合IEnumerable的扩展/">C#集合IEnumerable的扩展</a>
</li>
<li>
<a href="/2019/03/27/前端text树形文本转树形json/">前端text树形文本转树形json</a>
</li>
<li>
<a href="/2019/03/01/资源分享/">快乐学习,资源共享</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2019 张振岭<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/archives" class="mobile-nav-link">Archives</a>
</nav>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>