-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.xml
863 lines (808 loc) · 336 KB
/
search.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
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
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title><![CDATA[Oracle无法登陆:ORA-00020]]></title>
<url>http://huangming.github.io/2016-12-27-oracle-ora00020.html</url>
<content type="html"><![CDATA[<p>转自:<a href="http://blog.itpub.net/22621861/viewspace-1280235/" target="_blank" rel="external">http://blog.itpub.net/22621861/viewspace-1280235/</a></p>
<p>登录Oracle数据库,结果报ORA-00020: maximum number of processes (%s) exceeded错误。</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="operator"><span class="keyword">select</span> username,<span class="keyword">count</span>(sid) <span class="keyword">from</span> v$<span class="keyword">session</span> <span class="keyword">group</span> <span class="keyword">by</span> username;</span></span><br><span class="line">USERNAME COUNT(SID)</span><br><span class="line"><span class="comment">------------------------------ ----------</span></span><br><span class="line"> 21</span><br><span class="line">SYSMAN 124</span><br><span class="line">SYS 1</span><br></pre></td></tr></table></figure>
<p>发现SYSMAN用户有大量会话数,后发现SYSMAN主要用的PROGRAM是OMS。</p>
<p>查阅OMS相关信息,得知其是由Enterprise Management产生的。</p>
<p>关闭EM,CMD下执行:</p>
<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">emctl stop dbconsole</span><br></pre></td></tr></table></figure>
<p>确保下次启动默认不启动EM,需要在Windows服务中关闭OracleDBConsoleORCL服务的自动启动。</p>
]]></content>
</entry>
<entry>
<title><![CDATA[Windows下用Nginx部署DokuWiki]]></title>
<url>http://huangming.github.io/2016-12-17-dokuwiki-nginx.html</url>
<content type="html"><![CDATA[<p><a href="https://www.dokuwiki.org/dokuwiki#" target="_blank" rel="external">DokuWiki</a> 是一个使用,用途多样的开源 Wiki 软件,并且不需要数据库。部署Dokuwiki需要一个支持PHP的Webserver。通过nginx+php可以简单部署使用。<br><a href="http://nginx.org/en/" target="_blank" rel="external">Nginx</a> (“engine x”) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。<br>本文环境:<code>windows10 64位</code>+<code>nginx1.11.7</code>+<code>php-5.6.29-Win32-VC11-x64</code></p>
<h2 id="下载解压软件">下载解压软件</h2><p>用到的软件均是绿色版,不用安装解压即可使用: </p>
<ul>
<li><a href="http://windows.php.net/downloads/releases/php-5.6.29-Win32-VC11-x64.zip" target="_blank" rel="external">php-5.6.29-Win32-VC11-x64.zip</a> 解压到 <code>E:\OneDrive\www\php</code></li>
<li><a href="http://nginx.org/download/nginx-1.11.7.zip" target="_blank" rel="external">nginx-1.11.7.zip</a> 解压到 <code>E:\OneDrive\www\nginx-1.11.7</code></li>
<li><a href="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" target="_blank" rel="external">DokuWiki</a> 解压到 <code>E:\OneDrive\www\dokuwiki</code></li>
<li><a href="http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip" target="_blank" rel="external">RunHiddenConsole</a>(此程序用于隐藏nginx运行的窗口) 解压到 <code>E:\OneDrive\www\RunHiddenConsole.exe</code></li>
</ul>
<a id="more"></a>
<h2 id="修改PHP配置">修改PHP配置</h2><p>将php.ini-dist或php.ini-development配置文件重命名为php.ini(该文件中分号开始行为注释内容),然后做如下设置:</p>
<ol>
<li><p>extension_dir = “C:/php5/ext”</p>
</li>
<li><p>取消下列设置的注释:</p>
</li>
</ol>
<p> extension=php_curl.dll<br> extension=php_gd2.dll<br> extension=php_mbstring.dll<br> extension=php_mysql.dll<br> extension=php_pdo_mysql.dll<br> extension=php_pdo_odbc.dll<br> extension=php_xmlrpc.dll</p>
<ol>
<li><p>配置Session功能:</p>
<p> 在使用session功能时,必须配置session文件在服务器上的保存目录,否则无法使用session,在Windows 7上新建一个可读写的目录文件夹,此目录最好独立于WEB主程序目录之外,在D盘根目录上建立了phpsessiontmp目录,然后在php.ini配置文件中找到 ;session.save_path = “/tmp” 改成 session.save_path = “D:/phpsessiontmp”</p>
</li>
<li><p>配置PHP的文件上传功能</p>
<p> 同session一样,在使用PHP文件上传功能时,我们必须要指定一个临时文件夹以完成文件上传功能,否则文件上传功能会失败,我们仍然需要在Windows 7上建立一个可读写的目录文件夹,此处我在D盘根目录上建立了phpfileuploadtmp目录,然后在php.ini配置文件中找到 ;upload_tmp_dir = 改成 upload_tmp_dir = “D:/phpfileuploadtmp”</p>
</li>
<li><p>修改date.timezone</p>
</li>
</ol>
<p>;date.timezone = 改成 date.timezone = Asia/Shanghai</p>
<h2 id="修改Nginx配置">修改Nginx配置</h2><p><a href="https://www.dokuwiki.org/install:nginx" target="_blank" rel="external">DokuWiki with nginx on Windows</a> 有关于nginx的配置内容。<br>修改 <code>E:\OneDrive\www\nginx-1.11.1\conf\nginx.conf</code> 文件:<br><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">#E:\OneDrive\www\nginx-1.11.1\conf\nginx.conf #user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { location ~ ^/dokuwiki/.*\.php { root E:/OneDrive/www;	 fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME E:/OneDrive/www$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; include fastcgi_params; } # serve static files location ~ ^/dokuwiki/lib/ { root E:/OneDrive/www;		 expires 30d; } location ~ ^/dokuwiki/conf/ { deny all; } location ~ ^/dokuwiki/data/ { deny all; } location ~ /\.ht { deny all; } } }</span><br></pre></td></tr></table></figure></p>
<h2 id="编写启动批处理">编写启动批处理</h2><p><a href="https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/" target="_blank" rel="external">这里</a>有关于NGINX 跟 PHP 在 Windows 平台通过 FastCGI 对接的例子,此页面也有 RunHiddenConsole 的下载</p>
<figure class="highlight bat"><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="comment">REM E:\OneDrive\www\php.bat</span></span><br><span class="line"><span class="keyword">ECHO</span> Starting PHP FastCGI...</span><br><span class="line"><span class="keyword">set</span> <span class="built_in">PATH</span>=E:\OneDrive\www\PHP;<span class="envvar">%PATH%</span></span><br><span class="line">RunHiddenConsole.exe E:\OneDrive\www\php\php-cgi.exe -b <span class="number">127</span>.<span class="number">0</span>.<span class="number">0</span>.<span class="number">1</span>:<span class="number">9000</span></span><br><span class="line"><span class="keyword">ECHO</span> Starting nginx...</span><br><span class="line"><span class="built_in">cd</span> /d E:\OneDrive\www\nginx-<span class="number">1</span>.<span class="number">11</span>.<span class="number">1</span> && <span class="built_in">start</span> nginx.exe</span><br></pre></td></tr></table></figure>
<h2 id="运行">运行</h2><p>双击 <code>E:\OneDrive\www\php.bat</code> 会看到命令行一闪而过。<br>打开浏览器,访问 </p>
<ul>
<li><a href="http://127.0.0.1/dokuwiki/install.php" target="_blank" rel="external">http://127.0.0.1/dokuwiki/install.php</a></li>
<li><a href="http://127.0.0.1/dokuwiki/doku.php" target="_blank" rel="external">http://127.0.0.1/dokuwiki/doku.php</a></li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[无意翻到当年的云笔记]]></title>
<url>http://huangming.github.io/2016-12-03-cloud-notes-2012.html</url>
<content type="html"><![CDATA[<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>学校举办一次中国象棋比赛,有10名同学参加,比赛采用单循环赛制,每名同学都要与其他9名同学比赛一局。比赛规则,每局棋胜者得2分,负者得0分,平局两人各得1分,比赛结束后,10名同学的得分各不相同,已知:(1)比赛第一名与第二名都是一局都没有输过;(2)前两名的得分总和比第三名多20分;(3)第四名的得分与最后四名的得分和相等。那么,排名第五名的同学的得分是?<br>A.8分 B,9分 C.10分 D.11分</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>年度最爱电影。穆赫兰道影评是两个极端,抛去其他人的看法,自己坚持看完这部冗长的电影,而且还不知所云,只是强迫自己记住其中内容,等看完影评后用记忆串联起整部片子的时候,我深深地呼了一口气。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【心理技巧:如何让人喜欢你】1、出门照照镜子,给自己一个自信的微笑;2、善于发现别人优点;3、赞美;4、主动、付出,别陪着人冷场;5、接受别人递过来的零食;6、多请人帮你小忙;7、用心倾听,不打断对方的话;8、说话有力,能感受到自己声音的感染力;9、说话之前,先考虑对方的感觉。</p>
<a id="more"></a>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【艺术治疗:让这些电影治愈你】1、缺乏学习动力:《幸福终点站》、《风雨哈佛路》;2、对爱失望:《偷天情缘》、《初恋50次 》;3、自卑失落:《阿甘正传》、《肖申克的救赎》;4、失败或绝望:《铁权男人》、《迫在眉梢》、《伊丽莎白镇》;5、厌倦生活:《在世界的转角遇见爱》、《搏击俱乐部》。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【心理技巧:让你心情变好的10个小方法】1、每天拍几张照片;2、看场快乐的电影;3、在周末的清晨做白日梦;4、给朋友寄卡片;5、在水边散步;6、偶尔吃一顿大餐;7、每星期坚持做一次锻炼;8、一边喝咖啡,一边读小说;9、一边打电话,一边信手涂鸦;10、一边洗澡,一边唱歌。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【心理技巧:平息愤怒的7个方法】1、语速降低2/3,音量降低2/3;2、闭上眼睛,可以快速浇灭怒火;3、转转脖子,缓解僵硬;4、拥抱自己,用双臂紧紧拥抱一下自己;5、闻闻植物,离绿色植物10厘米左右,深呼吸5次;6、自我解嘲;7、击掌、跺脚,两三分钟即可</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>英国颁布的《儿童10大宣言》:1平安成长比成功更重要;2背心、裤衩覆盖的地方不许别人摸;3生命第一,财产第二;4小秘密要告诉妈妈;5不喝陌生人的饮料,不吃陌生人的糖果;6不与陌生人说话;7遇到危险可以打破玻璃,破坏家具;8遇到危险可以自己先跑;9不保守坏人的秘密;10坏人可以骗</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【那些简单的小幸福,你拥有过几个?】1爸妈疼你;2被人背过;3得过第1名;4笑到肚子痛;5有人为你哭过;6买到喜欢的衣服;7半夜有人短信给你;8和蜜友煲电话粥;9生病有过人照顾你;10生日凌晨有人发短信祝福;11在车站有过人接;12和心爱的一起走路到腿疼;13有好事就有人第1想到你</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【9个增加自信的小技巧】1、挑前面的位子坐; 2、练习正视别人; 3、把你走路的速度加快25%; 4、练习当众发言; 5、咧嘴大笑;6、怯场时,不妨道出真情,即能平静下来; 7、用对自己用肯定的语气,消除自卑感;8、发现自己薄弱环节并逐步提高;9、培养兴趣,做自己能做、喜欢的事。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【你经常说“随便”吗?】习惯说“随便”是一种从众的心理,这看似洒脱的通用语,但却透出漠然,甚至是忍耐的意味。人们会反感“随便”,是因为社会倡导交流沟通、各抒己见、团队合作,而常说“随便”的人让人觉得不愿意与人合作、工作不努力、没有主见,这样的形象不太受人欢迎</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【测试:你是向日葵族吗?】1善于发现微小幸福。2没有太大野心。3对负面情绪不敏感。4生活标准较低。5选择喜欢的职业。6抗压力耐打击.7.感恩的心态。8张弛有度的生活节奏。9相互赞美。10充满热情。11适当健忘。12善于自嘲。13适当的精神胜利法。14嘴角习惯性上扬15度。15拥有丰富的内涵。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【心理学家给恋爱中男女的6条建议】1、不要轻易说出“分手”两个字。2、不要因为你很生气而不接电话。3、不要相互猜忌,请彼此绝对信任。4、不要小肚鸡肠,请你能够宽容对待彼此。5、不要互揭伤疤,因为那样除了疼痛以外毫无意义。6、不要过于理智。你有哪些需要反思?</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【80后的10个小悲哀】1.每天凌晨才睡;2.觉不够睡钱不够花;3.手机24小时开机;4.平时起不来,周末睡不着;5.狂想去远方旅游,却只能在近郊瞎晃;6.怀疑自己抑郁;7.感觉自己亚健康,只能亚下去;8.想些不着边际的事;9.不知道自己是成熟还是世故;10.以前认为特鄙视的事变得能接受</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【你逼过自己吗?】逼自己经常会逼出许多意想不到的奇迹,正如背水一战,会反败为胜,奋力一搏,会出师告捷;逼过自己之后,我们可能会发现自己身上竟蕴藏着丰富的潜力,使自己脱颖而出,锋芒尽露;我们还可能在逼过自己之后,沉浸于事有所成的激动之中,面对自己的辉煌战果,俨然开天辟地的英雄。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【你有“晚睡强迫症”吗?】 无视疲惫的身体,还要继续熬夜打游戏、上网、看书、看电影、聚会……没什么事可做时却不愿睡觉,非要熬到凌晨一两点才上床,这正是“晚睡强迫症”的典型表现。这样的童鞋请举手~</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【那些我们毕业后发现的事情】1.学生时代结束了;2.就算是很多年不联系也依然想念着的人是存在的;3.好人有好报是句假话;4.做不了恋人就做陌生人原来是真的;5.爱说真话的人越来越少了;6.话越来越少,也越来越不爱笑了;7.哭是不需要理由的;8.能让我快乐的做个傻瓜的人越来越少了。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>【心理成熟标准发布】 1.不再盲目跟风;2.不再犹豫不定;3.合理安排时间;4.开始关注新闻国事;5.开始养生;6.在爱情、友情、亲情之间,首先想到亲情;7.不再用哭闹来解决问题;8.重视身边的朋友;9.让周围的人快乐;10.在得失方面变得大度;11.学着尊重每个人;12.自信地生活;13.淡忘仇恨。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>你在不理我,我就成包子了,而且是天津最出名的那个</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>小李到机场接出差归来的妻子。<br>妻子见丈夫愁眉苦脸的,就说:“你看那边那对夫妻,有说有笑,多开心啊。”<br>小李叹了口气,说:“那个丈夫是来送妻子的。”</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>1.小米一家晚上回家要过一座桥,只有一根蜡烛且这根蜡烛只能燃烧30秒,<br>雷军过桥需要1秒,小米手机过桥需要3秒,小米MIUI过桥需要6秒,小米论坛过桥需要8秒,米聊过桥需要12秒。<br>一次最多只能同时两人过桥,<br>请问怎么样小米一家才能安全过桥?</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>三只母老虎各自带着自己的孩子小老虎过河(共有三只大老虎和三只小老虎,可用A、B、C代表三只大老虎、用a、b、c代表三只小老虎,并对应各自的母子关系)<br>河上只有一只船(他们只能划船过河)<br>这只船每次只能载两只老虎过河(不论大小)<br>三只大老虎都会划船,三只小老虎只有一只会划船(此处设定a会划船)<br>注意 —- 三只小老虎不能离开自己的母亲和别的大老虎在一起(或相遇),否则就会被别的大老虎吃掉<br>问 这六只老虎怎样过河<br>1.ac过去,a回来<br>2.ab过去,a回来<br>3.BC过去,Bb回来<br>4.Aa过去,Cc回来<br>5.CB过去,a回来<br>6.ab过去,a回来<br>7.ac过去</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>我空有一身泡妞的本事,可惜自己是个妞。</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>火车座位靠窗<br>给正在外面漂的大家提个醒:只要是个位数 0 ,5, 4, 9的火车票全是靠近窗户的。0 5是三人座靠窗的;4 9是两人座靠窗的。个位数是2 7 3 8是靠近过道的,2 7是三人座靠过道,3 8二人座靠过道的。剩的两个数就是三人座中间的。绝对真实!</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>哥, 你是为了看起来高才带着脑袋的吗?—-秘密花园<br>如果爱需要用语言表达,那么哑巴怎么相爱—-比悲伤更悲伤的故事 权相宇<br>喜欢上你不在我的计划当中,只是刚好发生<br>找个好男人结婚吧,和你结婚不行吗?我不是好男人—-权相宇主演</p>
<p>Create: Sat Nov 24 2012 07:09:37 GMT+0800 (中国标准时间)Link<br>有十二个乒乓球特征相同,其中只有一个重量异常,现在要求用一部没有砝码的天平称三次,将那个重量异常的球找出来。<br>分3份ABC称,每份4个:<br>a.此时AB两边平衡,那么AB正常,异类在第三份C中。从第三份C中取两个C1C2跟正常2个的称:<br> a.1如果平衡,那么异类在第三份剩下的C3C4中,再取C3跟正常的称,如平衡那么异类就是C4,如不平衡,异类就是C3.<br> a.2如果C1C2偏下/偏上,再取C1跟正常的称,如果平衡那么C2是异类,如不平衡,那么异类就是C2.<br>b.此时A下B上,那么C正常。再取A1A2B1B2跟A3B3C1C2称:<br> b1如果平衡,那么异类在A4B4中,简单;<br> b2若A1A2B1B2偏上,则异类在A3B1B2中,再取A3B1跟C1C2测,平衡则异类是B2,A3B1上异类是B1,A3B1下异类是A3;<br> b3若A1A2B1B2偏下,异类在A1A2B3中,再取A1B3跟C1C2称如果A1B3偏上那么异类B3如果偏下异类A1<br>c.此时A上B下,与步骤b同理可测。</p>
<p>Create: Tue Dec 04 2012 00:14:41 GMT+0800 (中国标准时间)Link<br>李广射石,弓虽强,石更硬。 楼主自宫,七刀切,土里埋</p>
]]></content>
</entry>
<entry>
<title><![CDATA[oracle自动备份同步]]></title>
<url>http://huangming.github.io/2016-08-18-oracle-auto-backup-and-restore.html</url>
<content type="html"><![CDATA[<p>oracle的简单导入导出工具一般有 <code>exp/imp</code> 跟 <code>expdp/impdp</code>。</p>
<ul>
<li>exp无法导出空表结构</li>
<li>exp可以导出long类型的数据,expdp不可以。long类型现在在慢慢被淘汰中。</li>
<li>exp是客户端工具,expdp是服务器端工具,expdp还可以并发,exp不可以</li>
</ul>
<p>使用exp导出而不是expdp的情况是无法直接访问数据库主机,也无法在建立dblink,这个时候只能使用exp导出。大部分情况还是用 expdp/impdp。exp无法导出空表不注意的话是很麻烦的,曾经做同步就因为这个原因导致应用无法使用,虽然网上也有一些解决办法,但是都需要对源库做一些变更,这对生产服务器来说还是很麻烦的,毕竟操作了就有风险要负责任。下面是用expdp/impdp自动同步生产跟测试库的范例。</p>
<h2 id="环境">环境</h2><p>源库跟目的库的Oracle大版本要一致,并且数据库SID要一样。<br>本文测试环境:</p>
<ul>
<li>源库操作系统 <code>windows server 2008 R2 x64</code><br>源库数据库版本 <code>11g Enterprise Edition Release 11.2.0.1.0 - 64bit</code></li>
<li>目的库操作系统 <code>win7 x64</code> <code>win10 x64</code> <code>windows server 2008 R2 x64</code> 均测试成功<br>目的库数据库版本 <code>11g Enterprise Edition Release 11.2.0.1.0 - 64bit</code></li>
</ul>
<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"><span class="operator"><span class="keyword">select</span> banner <span class="keyword">from</span> sys.v_$<span class="keyword">version</span>;</span></span><br></pre></td></tr></table></figure>
<a id="more"></a>
<h2 id="源库导出">源库导出</h2><p>在源库机器(假定SID名为ORCL)执行以下操作:</p>
<h3 id="1-_打开CMD,用sysdba登录数据库。">1. 打开CMD,用sysdba登录数据库。</h3><p>有些操作系统安装了不止一个数据库实例,为了确保操作的是源库,在CMD命令行中先执行一次<code>set ORACLE_SID=ORCL</code>:<br> <figure class="highlight bash"><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="built_in">set</span> ORACLE_SID=ORCL</span><br><span class="line">sqlplus / as sysdba</span><br></pre></td></tr></table></figure></p>
<p>先检查一下登录的数据库:<br> <figure class="highlight bash"><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">SQL> select instance_name from v<span class="variable">$instance</span>;</span><br><span class="line">INSTANCE_NAME</span><br><span class="line">----------------</span><br><span class="line">orcl</span><br></pre></td></tr></table></figure></p>
<h3 id="2-_新建directory(首次导出才要)。">2. 新建directory(首次导出才要)。</h3><pre><code><span class="comment"><figure class="highlight bash"><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">SQL> create directory dump_dir as <span class="string">'D:\dump'</span>; </span><br><span class="line">SQL> grant all on directory dump_dir to <span class="built_in">test</span>; </span><br><span class="line">SQL> select * from dba_directories;</span><br></pre></td></tr></table></figure></span>
</code></pre><h3 id="3-_执行导出操作。">3. 执行导出操作。</h3><p>此操作再CMD中执行,不是登录到SQLPLUS里面。可用<code>Ctrl+C</code>退出SQLPLUS。<br> <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">expdp system/manager@ORCL directory=dump_dir dumpfile=expdp_orcl_full.dmp logfile=expdp_orcl_full.log FULL=y;</span><br></pre></td></tr></table></figure></p>
<p>导出完成后,在<code>D:\dump</code>里面就能看到文件了,然后拷贝到目标机器的<code>director</code>路径里面。</p>
<h2 id="目的库导入">目的库导入</h2><p>首次导入同源库导出1、2步骤操作,这里省略。<br>因为目的库已经有各种用户对象了,不确定这些已存在对象会不会影响导入结果,所以这边先进行删除对象操作,然后再进行导入操作,最后重新编译一下一些存储过程等。</p>
<h3 id="1-删除对象">1.删除对象</h3><p>先创建删除对象的脚本,CMD下执行:<br> <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">sqlplus system/manager@ORCL @d:\orcl_build_drop_sql.sql</span><br></pre></td></tr></table></figure></p>
<p>其中,<code>orcl_build_drop_sql.sql</code> 如下:<br> <figure class="highlight bash"><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></pre></td><td class="code"><pre><span class="line">-- d:\orcl_build_drop_sql.sql</span><br><span class="line"><span class="built_in">set</span> feedback off heading off verify off trimspool off </span><br><span class="line"><span class="built_in">set</span> pagesize <span class="number">0</span> linesize <span class="number">100</span> </span><br><span class="line">define v_spool =<span class="string">'d:\orcl_drop_objects.sql'</span> </span><br><span class="line">spool &v_spool </span><br><span class="line"> SELECT <span class="string">'DROP PACKAGE BODY '</span>|| OWNER ||<span class="string">'.'</span>|| OBJECT_NAME ||<span class="string">';'</span> FROM ALL_OBJECTS WHERE OBJECT_TYPE=<span class="string">'PACKAGE BODY'</span> AND OWNER IN ((<span class="string">'DBUSER1'</span>,<span class="string">'DBUSER2'</span>))</span><br><span class="line"> union all</span><br><span class="line"> SELECT <span class="string">'DROP PACKAGE '</span>|| OWNER ||<span class="string">'.'</span>|| OBJECT_NAME ||<span class="string">';'</span> FROM ALL_OBJECTS WHERE OBJECT_TYPE=<span class="string">'PACKAGE'</span> AND OWNER IN ((<span class="string">'DBUSER1'</span>,<span class="string">'DBUSER2'</span>))</span><br><span class="line"> union all</span><br><span class="line"> SELECT <span class="string">'DROP PROCEDURE '</span>|| OWNER ||<span class="string">'.'</span>|| OBJECT_NAME ||<span class="string">';'</span> FROM ALL_OBJECTS WHERE OBJECT_TYPE=<span class="string">'PROCEDURE'</span> AND OWNER IN ((<span class="string">'DBUSER1'</span>,<span class="string">'DBUSER2'</span>))</span><br><span class="line"> union all</span><br><span class="line"> SELECT <span class="string">'DROP FUNCTION '</span>|| OWNER ||<span class="string">'.'</span>|| OBJECT_NAME ||<span class="string">';'</span> FROM ALL_OBJECTS WHERE OBJECT_TYPE=<span class="string">'FUNCTION'</span> AND OWNER IN ((<span class="string">'DBUSER1'</span>,<span class="string">'DBUSER2'</span>))</span><br><span class="line"> union all</span><br><span class="line"> SELECT <span class="string">'DROP SEQUENCE '</span>|| SEQUENCE_OWNER ||<span class="string">'.'</span>|| SEQUENCE_NAME ||<span class="string">';'</span> FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER IN ((<span class="string">'DBUSER1'</span>,<span class="string">'DBUSER2'</span>))</span><br><span class="line"> union all</span><br><span class="line"> SELECT <span class="string">'DROP VIEW '</span>|| OWNER ||<span class="string">'.'</span>|| VIEW_NAME ||<span class="string">';'</span> FROM ALL_VIEWS WHERE OWNER IN ((<span class="string">'DBUSER1'</span>,<span class="string">'DBUSER2'</span>))</span><br><span class="line"> union all</span><br><span class="line"> SELECT <span class="string">'DROP TABLE '</span>|| OWNER ||<span class="string">'.'</span>|| TABLE_NAME ||<span class="string">' CASCADE CONSTRAINTS PURGE;'</span> FROM ALL_TABLES WHERE OWNER IN ((<span class="string">'DBUSER1'</span>,<span class="string">'DBUSER2'</span>))</span><br><span class="line"> union all</span><br><span class="line"> SELECT <span class="string">'exit '</span> from dual;</span><br><span class="line"></span><br><span class="line">spool off </span><br><span class="line"></span><br><span class="line"><span class="built_in">exit</span></span><br></pre></td></tr></table></figure></p>
<p>创建的删除脚本在 <code>d:\orcl_build_drop_sql.sql</code>,在CMD中执行脚本删除对象:<br> <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">sqlplus system/krcs@KRCS @d:\krcs_drop_objects.sql</span><br></pre></td></tr></table></figure></p>
<h3 id="2-导入操作">2.导入操作</h3><p>执行导入操作:<br> <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">impdp system/manager@ORCL directory=dump_dir dumpfile=expdp_orcl_full.dmp logfile=impdp_orcl_full.log FULL=y;</span><br></pre></td></tr></table></figure></p>
<h3 id="3-重新编译无效对象">3.重新编译无效对象</h3><p>oracle自带脚本<code>$ORACLE_HOME/rdbms/admin/utlrp.sql</code>可重新编译无效对象。<br> <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">sqlplus system/krcs@KRCS @D:\app\Administrator\product\<span class="number">11.2</span>.<span class="number">0</span>\dbhome_1\RDBMS\ADMIN\utlrp.sql</span><br></pre></td></tr></table></figure></p>
<h2 id="汇总所有操作写成批处理自动执行">汇总所有操作写成批处理自动执行</h2><h3 id="1-源库定时导出并发送">1.源库定时导出并发送</h3><p>在源库机器新建一个任务计划,每天执行以下批处理。</p>
<figure class="highlight bash"><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><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br></pre></td><td class="code"><pre><span class="line">@<span class="built_in">echo</span> off </span><br><span class="line">color <span class="number">0</span>b & cls </span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 设置备份文件存放文件夹... </span><br><span class="line">echo.</span><br><span class="line"><span class="built_in">set</span> <span class="string">"localexpdpdir=d:\dump"</span> </span><br><span class="line">:: 备份服务器</span><br><span class="line"><span class="built_in">set</span> <span class="string">"bk_server=\\192.168.1.1\g$"</span> </span><br><span class="line"><span class="built_in">set</span> <span class="string">"bk_server_full=\\192.168.1.1\g$\数据"</span></span><br><span class="line">:: 测试服务器<span class="number">1</span></span><br><span class="line"><span class="built_in">set</span> <span class="string">"bk_server2=\\192.168.1.2\e$\data"</span></span><br><span class="line">:: 测试服务器<span class="number">2</span></span><br><span class="line"><span class="built_in">set</span> <span class="string">"bk_server3=\\192.168.1.3\c$\temp"</span></span><br><span class="line"> </span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 是否存在<span class="number">2</span>天前备份文件,若存在则删除... </span><br><span class="line">echo.</span><br><span class="line">forfiles /p %localexpdpdir% /d -<span class="number">2</span> /c <span class="string">"cmd /c echo deleting @file ... && del /f /q /a @path"</span></span><br><span class="line"> </span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 设置备份文件名</span><br><span class="line">echo.</span><br><span class="line"><span class="built_in">set</span> name=%date:~<span class="number">0</span>,<span class="number">4</span>%%date:~<span class="number">5</span>,<span class="number">2</span>%%date:~<span class="number">8</span>,<span class="number">2</span>%</span><br><span class="line"><span class="built_in">set</span> name=%name%</span><br><span class="line">::<span class="built_in">set</span> name=<span class="number">20161210</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 是否存在同名文件,若存在则删除同名文件... </span><br><span class="line">echo.</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] ===========================================================</span><br><span class="line">echo.</span><br><span class="line"><span class="keyword">if</span> exist %localexpdpdir%\orcl_full_%name%.dmp del %localexpdpdir%\orcl_full_%name%.dmp</span><br><span class="line"><span class="keyword">if</span> exist %localexpdpdir%\orcl_%name%.dmp del %localexpdpdir%\orcl_%name%.dmp</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 开始备份..... </span><br><span class="line">echo.</span><br><span class="line">::select * from dba_directories;</span><br><span class="line">:: 备份两种,一种全库,一种按部分用户</span><br><span class="line">expdp system/manager@orcl directory=dump_dir dumpfile=orcl_%name%.dmp logfile=orcl_%name%.log schemas=dbuser1,dbuser2</span><br><span class="line">expdp system/manager@orcl directory=dump_dir dumpfile=orcl_full_%name%.dmp logfile=orcl_full_%name%.log FULL=y</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 备份完毕!</span><br><span class="line">echo.</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] ===========================================================</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 拷贝备份到<span class="number">192.168</span>.<span class="number">1.1</span></span><br><span class="line">echo.</span><br><span class="line">net use O: /del</span><br><span class="line">net use O: \\<span class="number">192.168</span>.<span class="number">1.1</span>\g$ <span class="string">"psw****"</span> /user:<span class="string">"Administrator"</span></span><br><span class="line"></span><br><span class="line">:: 每周二拷贝全量备份,其余日期拷贝选定用户的备份,减少备份服务器的空间压力</span><br><span class="line"><span class="keyword">if</span> <span class="string">"%date:~13%"</span>==<span class="string">"二"</span> (</span><br><span class="line">copy %localexpdpdir%\orcl_full_%name%.dmp %bk_server_full%\orcl_full_%name%.dmp /y</span><br><span class="line">) <span class="keyword">else</span> (</span><br><span class="line">copy %localexpdpdir%\orcl_%name%.dmp %bk_server%\orcl_%name%.dmp /y</span><br><span class="line">)</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 删除备份服务器上<span class="number">31</span>天前的全量备份</span><br><span class="line">echo.</span><br><span class="line">forfiles /p <span class="string">"o:"</span> /d -<span class="number">31</span> /c <span class="string">"cmd /c echo deleting @file ... && del /f /q /a @path"</span></span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 删除备份服务器上<span class="number">7</span>天前的选定用户数据的备份</span><br><span class="line">echo.</span><br><span class="line">forfiles /p <span class="string">"o:\数据"</span> /d -<span class="number">7</span> /c <span class="string">"cmd /c echo deleting @file ... && del /f /q /a @path"</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] ===========================================================</span><br><span class="line"></span><br><span class="line">::<span class="built_in">echo</span> 拷贝备份到<span class="number">192.168</span>.<span class="number">1.2</span></span><br><span class="line">::net use O: /del</span><br><span class="line">::net use O: \\<span class="number">192.101</span>.<span class="number">1.2</span>\e$\data <span class="string">"psw****"</span> /user:<span class="string">"Administrator"</span></span><br><span class="line">::</span><br><span class="line">::copy %localexpdpdir%\orcl_full_%name%.dmp %bk_server2%\orcl_full_%name%.dmp /y</span><br><span class="line">::<span class="built_in">echo</span> 删除备份服务器上<span class="number">2</span>天前的备份</span><br><span class="line">::forfiles /p <span class="string">"o:\" /d -2 /c "</span>cmd /c <span class="built_in">echo</span> deleting @file ... && del /f /q /a @path<span class="string">"</span><br><span class="line"></span><br><span class="line">echo [%date:~0,10% %time%] ===========================================================</span><br><span class="line"></span><br><span class="line">echo [%date:~0,10% %time%] 拷贝备份到192.168.1.3</span><br><span class="line">echo.</span><br><span class="line">net use O: /del</span><br><span class="line">net use O: \\192.168.1.3\c$\temp "</span>psw****<span class="string">" /user:"</span>Administrator<span class="string">"</span><br><span class="line"></span><br><span class="line">echo [%date:~0,10% %time%] 删除备份服务器192.168.1.3上2天前的备份</span><br><span class="line">echo.</span><br><span class="line">forfiles /p "</span>o:\<span class="string">" /d -2 /c "</span>cmd /c <span class="built_in">echo</span> deleting @file ... && del /f /q /a @path<span class="string">"</span><br><span class="line">copy %localexpdpdir%\orcl_full_%name%.dmp %bk_server3%\orcl_full_%name%.dmp /y</span><br><span class="line">echo [%date:~0,10% %time%] 拷贝备份到192.168.1.3完成</span><br><span class="line">echo.</span><br><span class="line">echo [%date:~0,10% %time%] ===========================================================</span><br><span class="line">echo [%date:~0,10% %time%] 结束</span><br><span class="line"></span><br><span class="line">goto :eof</span><br><span class="line"></span><br><span class="line">::rem 计算指定天数之前的日期</span><br><span class="line">::set DaysAgo=5</span><br><span class="line">::rem 假设系统日期的格式为yyyy-mm-dd</span><br><span class="line">::call :DateToDays %date:~0,4% %date:~5,2% %date:~8,2% PassDays</span><br><span class="line">::set /a PassDays-=%DaysAgo%</span><br><span class="line">::call :DaysToDate %PassDays% DstYear DstMonth DstDay</span><br><span class="line">::set DstDate=%DstYear%%DstMonth%%DstDay%</span><br><span class="line">::echo %DaysAgo%天的日期是%DstDate%</span><br><span class="line">::pause</span><br><span class="line">::goto :eof</span><br><span class="line"></span><br><span class="line">:DateToDays %yy% %mm% %dd% days</span><br><span class="line">setlocal ENABLEEXTENSIONS</span><br><span class="line">set yy=%1&set mm=%2&set dd=%3</span><br><span class="line">if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)</span><br><span class="line">set /a dd=100%dd%%%100,mm=100%mm%%%100</span><br><span class="line">set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2</span><br><span class="line">set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633</span><br><span class="line">endlocal&set %4=%j%&goto :EOF</span><br><span class="line"></span><br><span class="line">:DaysToDate %days% yy mm dd</span><br><span class="line">setlocal ENABLEEXTENSIONS</span><br><span class="line">set /a a=%1+2472632,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a</span><br><span class="line">set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5</span><br><span class="line">set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10</span><br><span class="line">(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)</span><br><span class="line">endlocal&set %2=%yy%&set %3=%mm%&set %4=%dd%&goto :EOF</span></span><br></pre></td></tr></table></figure>
<h3 id="2-目的库定时导入">2.目的库定时导入</h3><p>在目的库机器新建一个任务计划,每天执行以下批处理(执行时间在源库的定时时间延后2小时)。</p>
<figure class="highlight bash"><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><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br></pre></td><td class="code"><pre><span class="line">@<span class="built_in">echo</span> off </span><br><span class="line">color <span class="number">0</span>b & cls </span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 设置导入路径... </span><br><span class="line">echo.</span><br><span class="line"><span class="built_in">set</span> <span class="string">"localexpdpdir=c:\temp"</span></span><br><span class="line"><span class="built_in">echo</span> %localexpdpdir%</span><br><span class="line">echo.</span><br><span class="line"></span><br><span class="line">::<span class="built_in">set</span> <span class="string">"localexpdpdir=Z:\orcl系统备份\data"</span></span><br><span class="line">::<span class="built_in">set</span> <span class="string">"localexpdpdir=Y:"</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 设置导入文件名</span><br><span class="line">echo.</span><br><span class="line"><span class="built_in">set</span> name=%date:~<span class="number">0</span>,<span class="number">4</span>%%date:~<span class="number">5</span>,<span class="number">2</span>%%date:~<span class="number">8</span>,<span class="number">2</span>%</span><br><span class="line"><span class="built_in">set</span> name=%name%</span><br><span class="line">::<span class="built_in">set</span> name=<span class="number">20161215</span></span><br><span class="line"></span><br><span class="line">:: 前一日</span><br><span class="line">::call :DateToDays %date:~<span class="number">0</span>,<span class="number">4</span>% %date:~<span class="number">5</span>,<span class="number">2</span>% %date:~<span class="number">8</span>,<span class="number">2</span>% PassDays</span><br><span class="line">::<span class="built_in">set</span> /a PassDays-=<span class="number">1</span></span><br><span class="line">::call :DaysToDate %PassDays% DstYear DstMonth DstDay</span><br><span class="line">::<span class="built_in">set</span> name=%DstYear%%DstMonth%%DstDay%</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> %name%</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] work begin......</span><br><span class="line">echo.</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> exist %localexpdpdir%\orcl_full_%name%.dmp (</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 存在%localexpdpdir%\orcl_full_%name%.dmp</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 创建删除对象脚本.....</span><br><span class="line">echo.</span><br><span class="line">sqlplus system/manager@orcl @d:\orcl_build_drop_sql.sql</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 开始删除对象.....</span><br><span class="line">echo.</span><br><span class="line">sqlplus system/manager@orcl @d:\orcl_drop_objects.sql</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 开始导入.....</span><br><span class="line">impdp system/manager@orcl directory=dump_dir dumpfile=<span class="string">'orcl_full_%name%.dmp'</span> logfile=<span class="string">'orcl_full_%name%.log'</span> TABLE_EXISTS_ACTION=SKIP schemas=dbuser1,dbuser2</span><br><span class="line">echo.</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 重新编译无效对象.....</span><br><span class="line">echo.</span><br><span class="line">sqlplus system/manager@orcl @D:\app\Administrator\product\<span class="number">11.2</span>.<span class="number">0</span>\dbhome_1\RDBMS\ADMIN\utlrp.sql</span><br><span class="line">)</span><br><span class="line">::del %localexpdpdir%\sipfbak%name%.dmp)</span><br><span class="line"><span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 导入结束。</span><br><span class="line">echo.</span><br><span class="line"></span><br><span class="line">::pause</span><br><span class="line"></span><br><span class="line">:: 删除T-<span class="number">2</span>日备份</span><br><span class="line">call :DateToDays %date:~<span class="number">0</span>,<span class="number">4</span>% %date:~<span class="number">5</span>,<span class="number">2</span>% %date:~<span class="number">8</span>,<span class="number">2</span>% PassDays</span><br><span class="line"><span class="built_in">set</span> /a PassDays-=<span class="number">2</span></span><br><span class="line">call :DaysToDate %PassDays% DstYear DstMonth DstDay</span><br><span class="line"><span class="built_in">set</span> aYesDate=%DstYear%%DstMonth%%DstDay%</span><br><span class="line"><span class="keyword">if</span> exist %localexpdpdir%\orcl_full_%aYesDate%.dmp (</span><br><span class="line"> <span class="built_in">echo</span> [%date:~<span class="number">0</span>,<span class="number">10</span>% %time%] 删除过期文件orcl_full_%aYesDate%.dmp</span><br><span class="line"> del %localexpdpdir%\orcl_full_%aYesDate%.dmp</span><br><span class="line">)</span><br><span class="line"></span><br><span class="line">:DateToDays %yy% %mm% %dd% days</span><br><span class="line">setlocal ENABLEEXTENSIONS</span><br><span class="line"><span class="built_in">set</span> yy=%<span class="number">1</span>&<span class="built_in">set</span> mm=%<span class="number">2</span>&<span class="built_in">set</span> dd=%<span class="number">3</span></span><br><span class="line"><span class="keyword">if</span> <span class="number">1</span>%yy% LSS <span class="number">200</span> <span class="keyword">if</span> <span class="number">1</span>%yy% LSS <span class="number">170</span> (<span class="built_in">set</span> yy=<span class="number">20</span>%yy%) <span class="keyword">else</span> (<span class="built_in">set</span> yy=<span class="number">19</span>%yy%)</span><br><span class="line"><span class="built_in">set</span> /a dd=<span class="number">100</span>%dd%%%<span class="number">100</span>,mm=<span class="number">100</span>%mm%%%<span class="number">100</span></span><br><span class="line"><span class="built_in">set</span> /a z=<span class="number">14</span>-mm,z/=<span class="number">12</span>,y=yy+<span class="number">4800</span>-z,m=mm+<span class="number">12</span>*z-<span class="number">3</span>,j=<span class="number">153</span>*m+<span class="number">2</span></span><br><span class="line"><span class="built_in">set</span> /a j=j/<span class="number">5</span>+dd+y*<span class="number">365</span>+y/<span class="number">4</span>-y/<span class="number">100</span>+y/<span class="number">400</span>-<span class="number">2472633</span></span><br><span class="line">endlocal&<span class="built_in">set</span> %<span class="number">4</span>=%j%&goto :EOF</span><br><span class="line"> </span><br><span class="line">:DaysToDate %days% yy mm dd</span><br><span class="line">setlocal ENABLEEXTENSIONS</span><br><span class="line"><span class="built_in">set</span> /a a=%<span class="number">1</span>+<span class="number">2472632</span>,b=<span class="number">4</span>*a+<span class="number">3</span>,b/=<span class="number">146097</span>,c=-b*<span class="number">146097</span>,c/=<span class="number">4</span>,c+=a</span><br><span class="line"><span class="built_in">set</span> /a d=<span class="number">4</span>*c+<span class="number">3</span>,d/=<span class="number">1461</span>,e=-<span class="number">1461</span>*d,e/=<span class="number">4</span>,e+=c,m=<span class="number">5</span>*e+<span class="number">2</span>,m/=<span class="number">153</span>,dd=<span class="number">153</span>*m+<span class="number">2</span>,dd/=<span class="number">5</span></span><br><span class="line"><span class="built_in">set</span> /a dd=-dd+e+<span class="number">1</span>,mm=-m/<span class="number">10</span>,mm*=<span class="number">12</span>,mm+=m+<span class="number">3</span>,yy=b*<span class="number">100</span>+d-<span class="number">4800</span>+m/<span class="number">10</span></span><br><span class="line">(<span class="keyword">if</span> %mm% LSS <span class="number">10</span> <span class="built_in">set</span> mm=<span class="number">0</span>%mm%)&(<span class="keyword">if</span> %dd% LSS <span class="number">10</span> <span class="built_in">set</span> dd=<span class="number">0</span>%dd%)</span><br><span class="line">endlocal&<span class="built_in">set</span> %<span class="number">2</span>=%yy%&<span class="built_in">set</span> %<span class="number">3</span>=%mm%&<span class="built_in">set</span> %<span class="number">4</span>=%dd%&goto :EOF</span><br></pre></td></tr></table></figure>
]]></content>
</entry>
<entry>
<title><![CDATA[Python爬虫正则表达式抓取糗百笑话]]></title>
<url>http://huangming.github.io/2016-08-06-python-zhengze-pachong-qiubai.html</url>
<content type="html"><![CDATA[<p>很多人对正则表达式很头痛,其实写正则表达式是有套路的,看完这篇文章保证你会写任何html上的内容抓取的正则。<br>为确保代码的正确性,此文约定环境为python3,如果在python2运行,可能要做一些调整。</p>
<a id="more"></a>
<h2 id="从网上获取整个html">从网上获取整个html</h2><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><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></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> urllib.parse</span><br><span class="line"><span class="keyword">import</span> urllib.request</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">QSBK</span>:</span></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self)</span>:</span></span><br><span class="line"> self.page = <span class="number">1</span></span><br><span class="line"> <span class="comment"># 记录访问的页码</span></span><br><span class="line"> self.user_agent = <span class="string">'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'</span></span><br><span class="line"> </span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">get_stories</span><span class="params">(self)</span>:</span></span><br><span class="line"> url = <span class="string">"http://www.qiushibaike.com/hot/page/"</span>+str(self.page) </span><br><span class="line"> <span class="comment">#构建请求的url </span></span><br><span class="line"> req = urllib.request.Request(url)</span><br><span class="line"> req.add_header(<span class="string">'User-Agent'</span>, self.user_agent)</span><br><span class="line"> response = urllib.request.urlopen(req)</span><br><span class="line"> the_page = response.read().decode(<span class="string">"utf-8"</span>)</span><br><span class="line"> <span class="keyword">return</span> the_page</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> qb = QSBK()</span><br><span class="line"> <span class="comment"># print(qb.get_stories()) 此处会报一个编码错误的error,应该是在html的后面有</span></span><br><span class="line"> <span class="comment"># 个别编码不一样的原因,用下面这个可以截取前面的部分,正常看到内容</span></span><br><span class="line"> print(qb.get_stories()[:<span class="number">5000</span>])</span><br></pre></td></tr></table></figure>
<h2 id="编写正则表达式">编写正则表达式</h2><p>为了写出正则表达式,我们总结了糗百的段子规律:以<code><div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag</code>开头,然后有好多空行啦,html的 <code><div></code> 块啦,然后<code><div\sclass="content"></code>接着可能有几行空行或者没空行,接着就是我们要的段子,再接着是空行加<code></div></code>结束段子。在匹配到开头到段子内容之间有很多内容,我们如果想要用一些正则忽略他们的内容进行匹配就必须用到<code>.*</code>的多行匹配re.S。</p>
<p>这里用到了正则表达式的 <code>re.findall(pattern, string[, flags])</code> 大家可以先去搜索一下这个东西大概浏览一下,特别注意一下 <code>flags=re.X</code> 和 <code>flags=re.S</code> 的意义,这里了利用这两个flags能写出很好看很容易理解的正则表达式:</p>
<ul>
<li>re.S:DOTALL<br>使 “.” 特殊字符完全匹配任何字符,包括换行;没有这个标志, “.” 匹配除了换行外的任何字符。</li>
<li>re.X:VERBOSE<br>该标志通过给予你更灵活的格式以便你将正则表达式写得更易于理解。当该标志被指定时,在 RE 字符串中的空白符被忽略,除非该空白符在字符类中或在反斜杠之後;这可以让你更清晰地组织和缩进 RE。它也可以允许你将注释写入 RE,这些注释会被引擎忽略;注释用 “#”号 来标识,不过该符号不能在字符串或反斜杠之後。</li>
</ul>
<p>抓取到内容后就是编写正则表达式匹配内容了,这里先另外起程序写出正确的正则表达式再加进上面代码里面。</p>
<p>先选用一段html作为范例教大家怎么写正则。</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><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></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> re</span><br><span class="line">html = <span class="string">'''<div class="article block untagged mb15" id='qiushi_tag_117188488'></span><br><span class="line"></span><br><span class="line"><div class="author clearfix"></span><br><span class="line"><a href="/users/29552012/" target="_blank" rel="nofollow"></span><br><span class="line"><img src="http://pic.qiushibaike.com/system/avtnew/2955/29552012/medium/20150723232021.jpg" alt="invictusmaneo"/></span><br><span class="line"></a></span><br><span class="line"><a href="/users/29552012/" target="_blank" title="invictusmaneo"></span><br><span class="line"><h2>invictusmaneo</h2></span><br><span class="line"></a></span><br><span class="line"></div></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><div class="content"></span><br><span class="line"></span><br><span class="line">昨天在食堂打菜 给人碰了一下 菜汤泼裤子上了 当时愁的 心说油渍多难洗啊 吃完饭 看了眼裤子 连个印子都没了 菜里根本就没油啊!!! 是我想太多了..</span><br><span class="line"></span><br><span class="line"></div></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><div class="stats"></span><br><span class="line"><span class="stats-vote"><i class="number">7152</i> 好笑</span></span><br><span class="line"><span class="stats-comments">'''</span></span><br><span class="line">pattern = <span class="string">'''<div class="article block untagged mb15" id='qiushi_tag_117192587'>'''</span></span><br><span class="line">myItems = re.findall(pattern,html,re.S|re.X)</span><br><span class="line">print(myItems)</span><br></pre></td></tr></table></figure>
<h3 id="1-空格">1.空格</h3><p>我们先拿一小段试试能不能匹配,发现匹配不了。匹配不了的时候不用慌,我们把匹配内容再缩小: <code>pattern='''<div'''</code> 发现是能匹配的,而 <code>pattern='''<div class'''</code> 匹配不了,这时候稍微想一下就知道,这个空格出问题了,然后再浏览一下python正则的博文或者直接百度搜索,就知道空格应该用 <code>\s</code>,然后我们把整行的空格全替换掉:<br><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag_117192587'>'''</span></span><br></pre></td></tr></table></figure></p>
<p>运行后,结果能匹配到。然后我们继续研究关于多行匹配的</p>
<h3 id="2-多行">2.多行</h3><p>先试试匹配两行连续的。记得先把空格替换成 <code>\s</code></p>
<figure class="highlight python"><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">pattern = <span class="string">'''<div\sclass="author\sclearfix"></span><br><span class="line"><a\shref="/users/27990908/"\starget="_blank"\srel="nofollow">'''</span></span><br></pre></td></tr></table></figure>
<p>发现是匹配不了的,这时候就要想了,有可能换行要特殊处理的,搜一下百度,我们试试 <code>\n</code> 代替换行。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="author\sclearfix">\n<a\shref="/users/27990908/"\starget="_blank"\srel="nofollow">'''</span></span><br></pre></td></tr></table></figure>
<p>试了下,结果空的,说明不对,然后再试一下写两行的:</p>
<figure class="highlight python"><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">pattern = <span class="string">'''<div\sclass="author\sclearfix">\n</span><br><span class="line"><a\shref="/users/27990908/"\starget="_blank"\srel="nofollow">'''</span></span><br></pre></td></tr></table></figure>
<p>结果还是空的,说明这个换行是匹配失败了,因为单独两行的分别去匹配是可以匹配到的,加个换行就不行了。此时再想一想,还有什么地方关于这个<code>\n</code>容易出问题的?很容易想到<code>\</code>可能会出问题。我们再试试<code>\\n</code>:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="author\sclearfix">\\n<a\shref="/users/27990908/"\starget="_blank"\srel="nofollow">'''</span></span><br></pre></td></tr></table></figure>
<p>发现是能匹配到结果的。因为用了<code>re.X</code>,我们再试试换写成两行的:</p>
<figure class="highlight python"><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">pattern = <span class="string">'''<div\sclass="author\sclearfix">\\n</span><br><span class="line"> <a\shref="/users/27990908/"\starget="_blank"\srel="nofollow">'''</span></span><br></pre></td></tr></table></figure>
<p>这个也是能匹配的。证明用了<code>re.X</code>确实对于空格和换行等于没效果的。</p>
<h3 id="3-分组">3.分组</h3><p>上面所有匹配到的都是在 <code>pattern</code> 的全部内容,我们最终要的只是笑话的部分,所以必然会有一个筛选的东西。通过大概的搜索浏览 <code>python正则</code> 可以知道括号分组能从匹配结果中只返回分组内容。例如:</p>
<figure class="highlight python"><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">pattern = <span class="string">'''<div\sclass="author\sclearfix">\\n</span><br><span class="line"> <a\shref="/users/27990908/"\starget="_blank"\srel="(nofollow)">'''</span></span><br></pre></td></tr></table></figure>
<p>运行后得到 <code>nofollow</code>。所以我们只要把<code>pattern</code>一直写下去,写到笑话那里,然后把内容用括号括起来就可以得到笑话内容了。另外,因为每段笑话前后结构大体相同,但是还是有细节是不一样的,所以还要处理一些不一样的东西。不然像上面的<code>pattern</code>就只能匹配到一个结果,也就是说如果是笑话也只能匹配到一个。很容易,我们就能观察到时那串数字<code>27990908</code>不一样。此时我们可以用<code>\d+</code>代替,以匹配所有的数字。</p>
<h3 id="4-贪婪、非贪婪匹配">4.贪婪、非贪婪匹配</h3><p>我们继续写开始的<code>pattern</code>:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag_\d+'>'''</span></span><br></pre></td></tr></table></figure>
<p>此时,能匹配到开头了,但是接下来有一大段内容,我们不想关注他是什么,我们只想关注到段子那里。我们尝试用 <code>.*</code>、<code>\w*</code>之类的写法: </p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag_\d+'>.*<div\sclass="content">'''</span></span><br></pre></td></tr></table></figure>
<p>运行发现,只有一段笑话的话是可以匹配到的,但是整个html有很多段的时候,他直接匹配到最后一个笑话的<code><div\sclass="content"></code>!为了解决问题,我们搜索一下<code>python正则 尽可能少匹配</code>,很容易得到<code>贪婪</code>、<code>非贪婪</code>这两个词:</p>
<figure class="highlight 1c"><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">Python里数量词默认是贪婪的(在少数语言里也可能是默认非贪婪),总是尝试匹配尽可能多的字符;</span><br><span class="line">非贪婪则相反,总是尝试匹配尽可能少的字符。在<span class="string">"*"</span>,<span class="string">"?"</span>,<span class="string">"+"</span>,<span class="string">"{m,n}"</span>后面加上?,使贪婪变成非贪婪</span><br></pre></td></tr></table></figure>
<p>然后我们得到新的pattern:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag_\d+'>.*?<div\sclass="content">\\n*(.*?)\\n*</div>'''</span></span><br></pre></td></tr></table></figure>
<p>此时运行后发现已经能抓到大部分段子了,但是依然存在一些垃圾信息抓多了的。然后观察一下html会发现,这些垃圾信息是属于带图片的段子的文本部分,因为少了图片看起来就很奇怪。所以我们要继续改进pattern,使其不匹配带图片的段子。要想实现这个就必须找出文本跟图片段子的区别。</p>
<p>很容易我们就能发现,在文本段子后面,只有文本的段子是直接就<code><div class="stats"></code>,然后几行后是有<code><div class="single-clear"></div></code> 的,而有图片的段子在到达<code><div class="stats"></code>之前是多了好几个html标记的,其中一个是<code><img></code>标记。我们只要把pattrtn继续写下去,就能只匹配文本的段子了:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag_\d+'>.*?<div\sclass="content">\\n*([^(?:</div>)]*?)\\n*</div>\\n*<div\sclass="stats">'''</span></span><br></pre></td></tr></table></figure>
<p>运行发现,垃圾信息依然存在</p>
<figure class="highlight stata"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">['昨天在食堂打菜 给人碰了一下 菜汤泼裤子上了 当时愁的 心说油渍多难洗啊 吃完饭 看了眼裤子 连个印子都没了 菜里根本就没油啊!!! 是我想太多了..', '12345\<span class="keyword">n</span>\<span class="keyword">n</span></div>\<span class="keyword">n</span>\<span class="keyword">n</span>\<span class="keyword">n</span>\<span class="keyword">n</span><div <span class="keyword">class</span>=<span class="string">"thumb"</span>>\<span class="keyword">n</span>\<span class="keyword">n</span><a href=<span class="string">"/article/117193665"</span> target=<span class="string">"_blank"</span>>\<span class="keyword">n</span><img src=<span class="string">"http://pic.qiushibaike.com/system/pictures/11719/117193665/medium/app117193665.jpg"</span> alt=<span class="string">"糗事#117193665"</span> />\<span class="keyword">n</span></a>', '家里有个两岁的小暖男,大热天他经常问他爸爸:冷吗?然后帮他爸爸把电风扇关了,把被子盖上,每天乐此不疲。']</span><br></pre></td></tr></table></figure>
<p>仔细分析我们的pattern和那个多余的垃圾信息,发现确实是能匹配到的,那个垃圾信息完全符合pattern开头中间结尾的所有内容。关键点就在于在 <code><div class="content"></code> 跟 <code></div></code> 之间的才是真正的段子。我们虽然对段子用了<code>(.*?)</code>非贪婪匹配,但是因为加了后面结尾的条件,所以匹配会在满足结尾的条件下去用非贪婪匹配,所以得到了上面的结果。这时候非贪婪就不够用了,我们要自己给他实现非贪婪匹配。既然是段子结尾接着是<code></div></code>,那么我们只要限制段子的内容不能是<code></div></code>就能让他抓取到正确的段子了。</p>
<p>搜索一下 <code>python正则 否定</code> 就能得到<code>^</code>在python正则里边是否定的意思。但是网上的例子大部分都是只有一个字符的,我们想要实现<code>不是</div></code>要怎么写呢?答案是 <code>[^(</div>)]*</code> 至于为什么这样,写起来太啰嗦,能理解的理解,不能理解的记住规则就可以了。如果纠结于括号会想到分组,可以用<code>[^(?:</div>)]*</code>,分组括号里面用<code>?:</code>表示这个分组的内容不会被当作返回结果,分组只作为一个整体的作用。</p>
<p>最终,我们得到了能完全匹配到自己想要的段子的正则,然后可以利用<code>re.X</code>的特性,让正则更美观易懂一些:</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></pre></td><td class="code"><pre><span class="line">pattern = <span class="string">'''<div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag_\d+'> # 这里匹配开头</span><br><span class="line"> .*? # 这里匹配开头到段子前标记之间的内容,注意要用非贪婪匹配?</span><br><span class="line"> <div\sclass="content">\\n* # 这里是段子开始的标记,包括段子前的空行</span><br><span class="line"> ([^(?:</div>)]*?) # 这里是段子内容,最外边的括号是分组,里边的只是整体作用</span><br><span class="line"> \\n*</div> # 这里是段子结束的标记,包括段子后的空行</span><br><span class="line"> \\n*</span><br><span class="line"> <div\sclass="stats"> # 只匹配不含图片的段子。</span><br><span class="line">'''</span></span><br></pre></td></tr></table></figure>
<h2 id="最终结果">最终结果</h2><p>因为糗事百科网页可能会变化,这段代码在写这篇文章的时候是能得到预期结果的,如果不能得到预期结果,请自行修正。</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><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></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> urllib.parse</span><br><span class="line"><span class="keyword">import</span> urllib.request</span><br><span class="line"><span class="keyword">import</span> re</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">QSBK</span>:</span></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self)</span>:</span></span><br><span class="line"> self.page = <span class="number">1</span></span><br><span class="line"> <span class="comment"># 记录访问的页码</span></span><br><span class="line"> self.user_agent = <span class="string">'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'</span></span><br><span class="line"> self.stories = []</span><br><span class="line"> <span class="comment"># 存储段子</span></span><br><span class="line"> </span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">get_stories</span><span class="params">(self)</span>:</span></span><br><span class="line"> url = <span class="string">"http://www.qiushibaike.com/hot/page/"</span>+str(self.page) </span><br><span class="line"> <span class="comment">#构建请求的url </span></span><br><span class="line"> req = urllib.request.Request(url)</span><br><span class="line"> req.add_header(<span class="string">'User-Agent'</span>, self.user_agent)</span><br><span class="line"> response = urllib.request.urlopen(req)</span><br><span class="line"> the_page = response.read().decode(<span class="string">"utf-8"</span>)</span><br><span class="line"> <span class="comment"># print(the_page)</span></span><br><span class="line"> pattern = <span class="string">'''<div\sclass="article\sblock\suntagged\smb15"\sid='qiushi_tag_\d+'> # 这里匹配开头</span><br><span class="line"> .*? # 这里匹配开头到段子前标记之间的内容,注意要用非贪婪匹配?</span><br><span class="line"> <div\sclass="content">\\n* # 这里是段子开始的标记,包括段子前的空行</span><br><span class="line"> ([^(?:</div>)]*?) # 这里是段子内容,最外边的括号是分组,里边的只是整体作用</span><br><span class="line"> \\n*</div> # 这里是段子结束的标记,包括段子后的空行</span><br><span class="line"> \\n*</span><br><span class="line"> <div\sclass="stats"> # 只匹配不含图片的段子。</span><br><span class="line"> '''</span></span><br><span class="line"> myItems = re.findall(pattern,the_page,re.S|re.X)</span><br><span class="line"> <span class="comment"># print(len(myItems))</span></span><br><span class="line"> <span class="keyword">for</span> item <span class="keyword">in</span> myItems: </span><br><span class="line"> self.stories.append(item)</span><br><span class="line"> self.page += <span class="number">1</span></span><br><span class="line"> print(self.stories)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">haha</span><span class="params">(self)</span>:</span></span><br><span class="line"> <span class="keyword">if</span> len(self.stories)<<span class="number">2</span>:</span><br><span class="line"> self.get_stories()</span><br><span class="line"> <span class="keyword">return</span> self.stories.pop()[<span class="number">1</span>]</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> qb = QSBK()</span><br><span class="line"> print(qb.haha())</span><br></pre></td></tr></table></figure>
<p>只要掌握了上面的1234,基本的网页正则匹配都没什么问题了。</p>
]]></content>
</entry>
<entry>
<title><![CDATA[SSH通过SCP命令上传文件夹到linux系统的vps]]></title>
<url>http://huangming.github.io/2016-06-25-ssh-upload-dir-to-linux-vps-by-scp.html</url>
<content type="html"><![CDATA[<h2 id="环境">环境</h2><p>mingw2.0.3</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></pre></td><td class="code"><pre><span class="line">$ scp -P <span class="number">26443</span> -r /E/OneDrive/GitRepository/ItChat_old root@<span class="number">23.105</span>.<span class="number">203</span>.**:~/ItChat</span><br><span class="line">root@<span class="number">23.105</span>.<span class="number">203</span>.**<span class="string">'s password:</span><br><span class="line">config 100% 397 0.4KB/s 00:00</span><br><span class="line">description 100% 73 0.1KB/s 00:00</span><br><span class="line">HEAD 100% 24 0.0KB/s 00:00</span><br><span class="line">applypatch-msg.sample 100% 478 0.5KB/s 00:00</span><br><span class="line">commit-msg.sample 100% 896 0.9KB/s 00:00</span><br><span class="line">post-update.sample 100% 189 0.2KB/s 00:00</span></span><br></pre></td></tr></table></figure>
]]></content>
</entry>
<entry>
<title><![CDATA[Python调用dll动态链接库操作excel]]></title>
<url>http://huangming.github.io/2016-05-31-python-excel.html</url>
<content type="html"><![CDATA[<p>这是一篇Python调用动态链接库的标准示范。</p>
<h2 id="原理">原理</h2><p>其实不管什么语言调用dll的流程都是一样的:先注册dll到操作系统,然后获取到初始化的dll对象,然后就可以调用dll的各种api接口了。</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><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">register</span><span class="params">()</span>:</span></span><br><span class="line"> <span class="string">'''注册插件</span><br><span class="line"> '''</span></span><br><span class="line"> pythoncom.CoInitialize()</span><br><span class="line"> command = <span class="string">"regsvr32 /s atl.dll"</span></span><br><span class="line"> os.system(command)</span><br><span class="line"> <span class="keyword">try</span>:</span><br><span class="line"> lx = win32com.client.Dispatch(<span class="string">'Lazy.LxjExcel'</span>)</span><br><span class="line"> <span class="keyword">except</span> pywintypes.com_error:</span><br><span class="line"> command = <span class="string">'regsvr32 /s LazyOffice.dll'</span></span><br><span class="line"> <span class="keyword">if</span> os.system(command) == <span class="number">0</span>:</span><br><span class="line"> lx = win32com.client.Dispatch(<span class="string">'Lazy.LxjExcel'</span>)</span><br><span class="line"> <span class="keyword">return</span> lx</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> self.log.error(<span class="string">'regsver32 error'</span>)</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> <span class="keyword">return</span> lx</span><br></pre></td></tr></table></figure>
<p>这段代码是python调用dll的标准代码。别的dll也可以用这个调用。其中<code>LazyOffice.dll</code>是操作excel的dll文件,<code>Lazy.LxjExcel</code>是初始化的操作excel的对象,该对象由dll的编写作者提供。</p>
<p>然后就能通过返回的lx调用这个dll内部封装的接口啦:<code>lx.ExcelOpen(path, visual)</code></p>
<a id="more"></a>
<h2 id="封装">封装</h2><p>环境:<code>win7</code> <code>python3</code> <code>python2</code>,如果操作系统注册dll插件失败,可先手动注册成功后再运行程序调用。</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><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><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#!/usr/bin/env python</span></span><br><span class="line"><span class="comment"># -*- coding: utf-8 -*-</span></span><br><span class="line"><span class="comment"># Last Update:</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> win32com.client</span><br><span class="line"><span class="keyword">import</span> pywintypes</span><br><span class="line"><span class="keyword">import</span> pythoncom</span><br><span class="line"><span class="keyword">import</span> os</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">GoodString</span><span class="params">(value)</span>:</span></span><br><span class="line"> <span class="string">"""</span><br><span class="line"> >>> GoodString(2)</span><br><span class="line"> '2'</span><br><span class="line"> """</span></span><br><span class="line"> <span class="keyword">try</span>:</span><br><span class="line"> <span class="keyword">return</span> str(value)</span><br><span class="line"> <span class="keyword">except</span> UnicodeEncodeError:</span><br><span class="line"> <span class="keyword">return</span> value</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Lxsoft</span><span class="params">()</span>:</span></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self, log, path=<span class="string">''</span>)</span>:</span></span><br><span class="line"> self.log = log</span><br><span class="line"> self.lx = self.__registerLxsoft()</span><br><span class="line"> self.InitExcel()</span><br><span class="line"> <span class="keyword">if</span> path:</span><br><span class="line"> self.Open(path)</span><br><span class="line"> self.SheetIndex()</span><br><span class="line"> self.SheetCount()</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__registerLxsoft</span><span class="params">(self)</span>:</span></span><br><span class="line"> <span class="string">'''注册插件</span><br><span class="line"> '''</span></span><br><span class="line"> pythoncom.CoInitialize()</span><br><span class="line"> command = <span class="string">"regsvr32 /s atl.dll"</span></span><br><span class="line"> os.system(command)</span><br><span class="line"> <span class="keyword">try</span>:</span><br><span class="line"> lx = win32com.client.Dispatch(<span class="string">'Lazy.LxjExcel'</span>)</span><br><span class="line"> <span class="keyword">except</span> pywintypes.com_error:</span><br><span class="line"> command = <span class="string">'regsvr32 /s LazyOffice.dll'</span></span><br><span class="line"> <span class="keyword">if</span> os.system(command) == <span class="number">0</span>:</span><br><span class="line"> lx = win32com.client.Dispatch(<span class="string">'Lazy.LxjExcel'</span>)</span><br><span class="line"> <span class="comment"># assert(dm.Ver == '2.1138')</span></span><br><span class="line"> <span class="keyword">return</span> lx</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> self.log.error(<span class="string">'regsver32 error'</span>)</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> <span class="keyword">return</span> lx</span><br><span class="line"> </span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">InitExcel</span><span class="params">(self)</span>:</span></span><br><span class="line"> self.path = <span class="string">''</span></span><br><span class="line"> self.maxsheet = <span class="number">1</span></span><br><span class="line"> self.index = <span class="number">1</span></span><br><span class="line"> self.sindex = <span class="number">1</span></span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__del__</span><span class="params">(self)</span>:</span></span><br><span class="line"> self.Close()</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__Trueindex</span><span class="params">(self, index)</span>:</span></span><br><span class="line"> <span class="keyword">if</span> index == <span class="string">''</span>:</span><br><span class="line"> <span class="keyword">return</span> self.index</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> <span class="keyword">return</span> index</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Open</span><span class="params">(self, path, visual=<span class="number">0</span>)</span>:</span></span><br><span class="line"> <span class="comment"># visual:1可见,0不可见 opencd:打开密码(如果存在)</span></span><br><span class="line"> <span class="comment"># writecd:写入密码 flag:只读方式打开</span></span><br><span class="line"> self.path = path</span><br><span class="line"> self.index = self.lx.ExcelOpen(path, visual)</span><br><span class="line"> <span class="keyword">return</span> self.index</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Close</span><span class="params">(self, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> <span class="keyword">return</span> self.lx.ExcelClose(index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">SheetIndex</span><span class="params">(self, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 获取当前标签页序号</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.sindex = self.lx.SheetIndex(index)</span><br><span class="line"> <span class="keyword">return</span> self.sindex</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">SheetName</span><span class="params">(self, Sindex, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 获取标签页序号(或名称)为Sindex的标签名称(或索引)</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> <span class="keyword">return</span> self.lx.SheetGetName(Sindex, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">SheetCount</span><span class="params">(self, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 获取标签页总数</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.maxsheet = self.lx.SheetCount(index)</span><br><span class="line"> <span class="keyword">return</span> self.maxsheet</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">SheetAdd</span><span class="params">(self, Sindex, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 在第Sindex个标签页之前新建一个标签</span></span><br><span class="line"> <span class="comment"># 如果Sindex是字符串,则在最后新建一个名叫Sindex的标签</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.log.debug(<span class="string">u'新建标签: '</span>+GoodString(Sindex))</span><br><span class="line"> <span class="keyword">return</span> self.lx.SheetAdd(Sindex, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">SheetRename</span><span class="params">(self, Sindex, name, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># Sindex可为序号或者名称</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> <span class="keyword">return</span> self.lx.SheetRename(Sindex, name, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">SheetDel</span><span class="params">(self, Sindex, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.log.debug(<span class="string">u'删除标签: '</span>+GoodString(Sindex))</span><br><span class="line"> <span class="keyword">return</span> self.lx.SheetDel(Sindex, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Write</span><span class="params">(self, Sindex, x, y, string, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># Write(1,3,2,"内容",Index)向单元格(3,2)即'B3'写入内容</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.log.debug(<span class="string">u'向单元格(%s,%s)写入内容: %s'</span> % (GoodString(x),GoodString(y),GoodString(string)))</span><br><span class="line"> <span class="keyword">return</span> self.lx.ExcelWrite(Sindex, x, y, string, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Read</span><span class="params">(self, Sindex, x, y, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> string = self.lx.ExcelRead(Sindex, x, y, index)[<span class="number">0</span>]</span><br><span class="line"> self.log.debug(<span class="string">u'读取单元格(%s,%s): %s'</span> % (GoodString(x),GoodString(y),GoodString(string)))</span><br><span class="line"> <span class="keyword">return</span> string</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">differ</span><span class="params">(self, Sindex, x1, y1, x2, y2, index1=<span class="string">''</span>, index2=<span class="string">''</span>)</span>:</span></span><br><span class="line"> index1 = self.__Trueindex(index1)</span><br><span class="line"> index2 = self.__Trueindex(index2)</span><br><span class="line"> <span class="keyword">return</span> int(self.Read(Sindex, x1, y1, index1)) - int(self.Read(Sindex, x2, y2, index2))</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Cells</span><span class="params">(self, tab1, action, tab2, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 如设置tab2为负数,将只进行复制</span></span><br><span class="line"> <span class="comment"># 如设置tab2为0,将在所有标签页后面新建一个被复制的表</span></span><br><span class="line"> <span class="comment"># 将工作表第1个标签页整表复制到第3个标签页:self.lx.ExcelCells(1, u"复制", 3, Index)</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.log.debug(<span class="string">u'表%s %s -> %s'</span> % (GoodString(tab1),action,GoodString(tab2)))</span><br><span class="line"> <span class="keyword">return</span> self.lx.ExcelCells(tab1, action, tab2, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Rows</span><span class="params">(self, tab, row1, action, row2, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 如设置row2为负数,将只进行复制</span></span><br><span class="line"> <span class="comment"># 复制第1个标签页第2行到第8行:self.lx.ExcelRows(1, 2, u"复制", 8, Index)</span></span><br><span class="line"> <span class="comment"># 第2行模糊查找1:self.lx.ExcelRows(1, 2, u"模糊查找", 1, Index)</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.log.debug(<span class="string">u'行%s %s -> %s'</span> % (GoodString(row1),action,GoodString(row2)))</span><br><span class="line"> <span class="keyword">return</span> self.lx.ExcelRows(tab, row1, action, row2, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Columns</span><span class="params">(self, tab, col1, action, col2, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 如设置col2为负数,将只进行复制</span></span><br><span class="line"> <span class="comment"># 复制第1个标签页第3列到第6列:self.lx.ExcelColumns(1, 3, u"复制", 6, Index)</span></span><br><span class="line"> <span class="comment"># 第3列模糊查找1:self.lx.ExcelColumns(1,3, u"模糊查找", 1, Index)</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.log.debug(<span class="string">u'列%s %s -> %s'</span> % (GoodString(col1),action,GoodString(col2)))</span><br><span class="line"> <span class="keyword">return</span> self.lx.ExcelColumns(tab, col1, action, col2, index)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">Range</span><span class="params">(self, tab, ranges, action, destination, index=<span class="string">''</span>)</span>:</span></span><br><span class="line"> <span class="comment"># 如设置destination为负数,将只进行复制</span></span><br><span class="line"> <span class="comment"># 复制第1个标签页"B2:C5"区域:self.lx.ExcelRange(1, "B2:C5", "复制", -1, Index)</span></span><br><span class="line"> <span class="comment"># 区域C2:E5模糊查找1:self.lx.ExcelRange(1, "C2:E5",u"模糊查找", 1, Index)</span></span><br><span class="line"> index = self.__Trueindex(index)</span><br><span class="line"> self.log.debug(<span class="string">u'区域%s %s -> %s'</span> % (GoodString(tab),action,GoodString(destination)))</span><br><span class="line"> <span class="keyword">return</span> self.lx.ExcelRange(tab, ranges, action, destination, index)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> <span class="keyword">import</span> log</span><br><span class="line"> <span class="keyword">import</span> time</span><br><span class="line"> path = <span class="string">'F:\\test.xls'</span></span><br><span class="line"> mylog = log.Log()</span><br><span class="line"> lx = Lxsoft(mylog, path)</span><br><span class="line"> <span class="comment"># print int(lx.Read(lx.SheetCount(), 5, 7))==int(time.strftime("%Y%m%d"))</span></span><br><span class="line"> <span class="comment"># a = lx.Read(lx.maxsheet, 5, 7)</span></span><br><span class="line"> a = lx.SheetCount()</span><br><span class="line"> print(lx.Columns(a, <span class="number">7</span>, <span class="string">u"模糊查找"</span>, <span class="string">"20150722"</span>)[<span class="number">0</span>][<span class="number">0</span>])</span><br><span class="line"> <span class="comment"># lx.Cells(lx.SheetCount(), 5, u"字体颜色", 3)</span></span><br><span class="line"> <span class="comment"># print lx.differ(lx.maxsheet, 17, 7, 17, 3)</span></span><br><span class="line"> <span class="comment"># print a</span></span><br><span class="line"> <span class="comment"># lx.Write(lx.maxsheet, 5, 7, "20150709")</span></span><br><span class="line"> <span class="comment"># lx.Cells(80, u"复制", 0, index)</span></span><br><span class="line"> lx.Close()</span><br><span class="line"> <span class="comment"># lx = Lxsoft(config.log)</span></span><br><span class="line"> <span class="comment"># index = lx.Open(path, 0)</span></span><br><span class="line"> <span class="comment"># lx.Close(index)</span></span><br></pre></td></tr></table></figure>
<h2 id="其他">其他</h2><ul>
<li><p><a href="http://huangming.work/2016-05-29-python-log.html" target="_blank" rel="external">log模块</a></p>
</li>
<li><p><a href="https://github.com/huangming/python_dll_excel/blob/master/%E6%87%92%E4%BA%BA%E5%8A%9E%E5%85%AC%E6%8F%92%E4%BB%B6%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3.CHM" target="_blank" rel="external">动态链接库接口文档</a></p>
</li>
<li><p><a href="https://github.com/huangming/python_dll_excel" target="_blank" rel="external">GithubRepository</a></p>
</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[Python logging 模块封装]]></title>
<url>http://huangming.github.io/2016-05-29-python-log.html</url>
<content type="html"><![CDATA[<p>python自带的记录日志模块 <a href="https://docs.python.org/3/library/logging.html#module-logging" target="_blank" rel="external">logging</a> 非常强大,但是每次写程序都要写很多东西来配置使用,体验不怎么友好,花时间封装在一个文件里面,用的时候直接调用,并且提供配置接口保留其强大的功能还是非常有必要的。</p>
<h2 id="logging介绍">logging介绍</h2><p>Python的logging模块提供了通用的日志系统,可以方便第三方模块或者是应用使用。这个模块提供不同的日志级别,并可以采用不同的方式记录日志,比如文件,HTTP GET/POST,SMTP,Socket等,甚至可以自己实现具体的日志记录方式。</p>
<p>logging模块与log4j的机制是一样的,只是具体的实现细节不同。模块提供logger,handler,filter,formatter。</p>
<ul>
<li>logger:提供日志接口,供应用代码使用。</li>
<li>handler:将日志记录(log record)发送到合适的目的地(destination),比如文件,socket,cmd等。一个logger对象可以通过addHandler方法添加0到多个handler,每个handler又可以定义不同日志级别,以实现日志分级过滤显示。每个handler还可以单独设置自己的formatter格式。</li>
<li>filter:提供一种优雅的方式决定一个日志记录是否发送到handler。</li>
<li>formatter:指定日志记录输出的具体格式。</li>
</ul>
<p>与log4j类似,logger,handler和日志消息的调用可以有具体的日志级别(Level),只有在日志消息的级别大于logger和handler的级别才会呈现。</p>
<p>默认的日志级别设置为<code>WARNING</code>(日志级别等级<code>CRITICAL</code> > <code>ERROR</code> > <code>WARNING</code> > <code>INFO</code> > <code>DEBUG</code> > <code>NOTSET</code>), 小于WARNING级别的日志都不输出, 大于等于WARNING级别的日志都会输出。<br><a id="more"></a><br>更多可以自己搜索一下。</p>
<h2 id="封装成log-py">封装成log.py</h2><p>源码在github上有:<a href="https://github.com/huangming/python_log" target="_blank" rel="external">python_log</a></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><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><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#!/usr/bin/env python</span></span><br><span class="line"><span class="comment"># -*- coding: utf-8 -*-</span></span><br><span class="line"><span class="comment"># Last Update: 2015/06/30 10:53:52</span></span><br><span class="line"><span class="comment"># file mylog.py</span></span><br><span class="line">__author__ = <span class="string">"Mingo <[email protected]>"</span></span><br><span class="line">__status__ = <span class="string">"Development"</span></span><br><span class="line"> </span><br><span class="line">__all__ = [<span class="string">'set_logger'</span>, <span class="string">'debug'</span>, <span class="string">'info'</span>, <span class="string">'warning'</span>, <span class="string">'error'</span>,</span><br><span class="line"> <span class="string">'critical'</span>, <span class="string">'exception'</span>]</span><br><span class="line"> </span><br><span class="line"><span class="keyword">import</span> os</span><br><span class="line"><span class="keyword">import</span> sys</span><br><span class="line"><span class="keyword">import</span> traceback</span><br><span class="line"><span class="keyword">import</span> logging</span><br><span class="line"><span class="keyword">import</span> logging.handlers</span><br><span class="line"> </span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">ColoredFormatter</span><span class="params">(logging.Formatter)</span>:</span></span><br><span class="line"> <span class="string">'''A colorful formatter.'''</span></span><br><span class="line"> </span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self, fmt = None, datefmt = None)</span>:</span></span><br><span class="line"> logging.Formatter.__init__(self, fmt, datefmt)</span><br><span class="line"> </span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">format</span><span class="params">(self, record)</span>:</span></span><br><span class="line"> <span class="comment"># Color escape string</span></span><br><span class="line"> COLOR_RED=<span class="string">'\033[1;31m'</span></span><br><span class="line"> COLOR_GREEN=<span class="string">'\033[1;32m'</span></span><br><span class="line"> COLOR_YELLOW=<span class="string">'\033[1;33m'</span></span><br><span class="line"> COLOR_BLUE=<span class="string">'\033[1;34m'</span></span><br><span class="line"> COLOR_PURPLE=<span class="string">'\033[1;35m'</span></span><br><span class="line"> COLOR_CYAN=<span class="string">'\033[1;36m'</span></span><br><span class="line"> COLOR_GRAY=<span class="string">'\033[1;37m'</span></span><br><span class="line"> COLOR_WHITE=<span class="string">'\033[1;38m'</span></span><br><span class="line"> COLOR_RESET=<span class="string">'\033[1;0m'</span></span><br><span class="line"> <span class="comment"># Define log color</span></span><br><span class="line"> LOG_COLORS = {</span><br><span class="line"> <span class="string">'DEBUG'</span>: <span class="string">'%s'</span>,</span><br><span class="line"> <span class="string">'INFO'</span>: COLOR_GREEN + <span class="string">'%s'</span> + COLOR_RESET,</span><br><span class="line"> <span class="string">'WARNING'</span>: COLOR_YELLOW + <span class="string">'%s'</span> + COLOR_RESET,</span><br><span class="line"> <span class="string">'ERROR'</span>: COLOR_RED + <span class="string">'%s'</span> + COLOR_RESET,</span><br><span class="line"> <span class="string">'CRITICAL'</span>: COLOR_RED + <span class="string">'%s'</span> + COLOR_RESET,</span><br><span class="line"> <span class="string">'EXCEPTION'</span>: COLOR_RED + <span class="string">'%s'</span> + COLOR_RESET,</span><br><span class="line"> }</span><br><span class="line"> level_name = record.levelname</span><br><span class="line"> msg = logging.Formatter.format(self, record)</span><br><span class="line"> <span class="keyword">return</span> LOG_COLORS.get(level_name, <span class="string">'%s'</span>) % msg</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Log</span><span class="params">()</span>:</span></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self, filename = None, mode = <span class="string">'a'</span>,</span><br><span class="line"> cmdlevel=<span class="string">'DEBUG'</span>,</span><br><span class="line"> filelevel=<span class="string">'INFO'</span>,</span><br><span class="line"> cmdfmt = <span class="string">'[%(asctime)s] %(filename)s line:%(lineno)d %(levelname)-8s%(message)s'</span>,</span><br><span class="line"> filefmt = <span class="string">'[%(asctime)s] %(levelname)-8s%(message)s'</span>,</span><br><span class="line"> cmddatefmt = <span class="string">'%H:%M:%S'</span>,</span><br><span class="line"> filedatefmt = <span class="string">'%Y-%m-%d %H:%M:%S'</span>,</span><br><span class="line"> backup_count = <span class="number">0</span>, limit = <span class="number">20480</span>, when = None, colorful = False)</span>:</span></span><br><span class="line"> self.filename = filename</span><br><span class="line"> <span class="keyword">if</span> self.filename <span class="keyword">is</span> <span class="keyword">None</span>:</span><br><span class="line"> self.filename = getattr(sys.modules[<span class="string">'__main__'</span>], <span class="string">'__file__'</span>, <span class="string">'log.py'</span>)</span><br><span class="line"> self.filename = os.path.basename(self.filename.replace(<span class="string">'.py'</span>, <span class="string">'.log'</span>))</span><br><span class="line"> <span class="comment">#self.filename = os.path.join('/tmp', self.filename)</span></span><br><span class="line"> self.mode = mode</span><br><span class="line"> self.cmdlevel = cmdlevel</span><br><span class="line"> self.filelevel = filelevel</span><br><span class="line"> <span class="keyword">if</span> isinstance(self.cmdlevel, str):</span><br><span class="line"> self.cmdlevel = getattr(logging, self.cmdlevel.upper(), logging.DEBUG)</span><br><span class="line"> <span class="keyword">if</span> isinstance(self.filelevel, str):</span><br><span class="line"> self.filelevel = getattr(logging, self.filelevel.upper(), logging.DEBUG)</span><br><span class="line"> self.filefmt = filefmt</span><br><span class="line"> self.cmdfmt = cmdfmt</span><br><span class="line"> self.filedatefmt = filedatefmt</span><br><span class="line"> self.cmddatefmt = cmddatefmt</span><br><span class="line"> self.backup_count = backup_count</span><br><span class="line"> self.limit = limit</span><br><span class="line"> self.when = when</span><br><span class="line"> self.colorful = colorful</span><br><span class="line"> self.logger = <span class="keyword">None</span></span><br><span class="line"> self.streamhandler = <span class="keyword">None</span></span><br><span class="line"> self.filehandler = <span class="keyword">None</span></span><br><span class="line"> <span class="keyword">if</span> self.cmdlevel > <span class="number">10</span>:</span><br><span class="line"> self.filefmt = <span class="string">'[%(asctime)s] %(levelname)-8s%(message)s'</span></span><br><span class="line"> self.cmdfmt = <span class="string">'[%(asctime)s] %(levelname)-8s%(message)s'</span></span><br><span class="line"> self.cmddatefmt = <span class="string">'%Y-%m-%d %H:%M:%S'</span></span><br><span class="line"> self.set_logger(cmdlevel = self.cmdlevel)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">init_logger</span><span class="params">(self)</span>:</span></span><br><span class="line"> <span class="string">'''Reload the logger.'''</span></span><br><span class="line"> <span class="keyword">if</span> self.logger <span class="keyword">is</span> <span class="keyword">None</span>:</span><br><span class="line"> self.logger = logging.getLogger()</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> logging.shutdown()</span><br><span class="line"> self.logger.handlers = []</span><br><span class="line"> self.streamhandler = <span class="keyword">None</span></span><br><span class="line"> self.filehandler = <span class="keyword">None</span></span><br><span class="line"> self.logger.setLevel(logging.DEBUG)</span><br><span class="line"> </span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">add_streamhandler</span><span class="params">(self)</span>:</span></span><br><span class="line"> <span class="string">'''Add a stream handler to the logger.'''</span></span><br><span class="line"> self.streamhandler = logging.StreamHandler()</span><br><span class="line"> self.streamhandler.setLevel(self.cmdlevel)</span><br><span class="line"> <span class="keyword">if</span> self.colorful:</span><br><span class="line"> formatter = ColoredFormatter(self.cmdfmt, self.cmddatefmt)</span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> formatter = logging.Formatter(self.cmdfmt, self.cmddatefmt,)</span><br><span class="line"> self.streamhandler.setFormatter(formatter)</span><br><span class="line"> self.logger.addHandler(self.streamhandler)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">add_filehandler</span><span class="params">(self)</span>:</span></span><br><span class="line"> <span class="string">'''Add a file handler to the logger.'''</span></span><br><span class="line"> <span class="comment"># Choose the filehandler based on the passed arguments</span></span><br><span class="line"> <span class="keyword">if</span> self.backup_count == <span class="number">0</span>: <span class="comment"># Use FileHandler</span></span><br><span class="line"> self.filehandler = logging.FileHandler(self.filename, self.mode)</span><br><span class="line"> <span class="keyword">elif</span> self.when <span class="keyword">is</span> <span class="keyword">None</span>: <span class="comment"># Use RotatingFileHandler</span></span><br><span class="line"> self.filehandler = logging.handlers.RotatingFileHandler(self.filename,</span><br><span class="line"> self.mode, self.limit, self.backup_count)</span><br><span class="line"> <span class="keyword">else</span>: <span class="comment"># Use TimedRotatingFileHandler</span></span><br><span class="line"> self.filehandler = logging.handlers.TimedRotatingFileHandler(self.filename,</span><br><span class="line"> self.when, <span class="number">1</span>, self.backup_count)</span><br><span class="line"> self.filehandler.setLevel(self.filelevel)</span><br><span class="line"> formatter = logging.Formatter(self.filefmt, self.filedatefmt,)</span><br><span class="line"> self.filehandler.setFormatter(formatter)</span><br><span class="line"> self.logger.addHandler(self.filehandler)</span><br><span class="line"> </span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">set_logger</span><span class="params">(self, **kwargs)</span>:</span></span><br><span class="line"> <span class="string">'''Configure the logger.'''</span></span><br><span class="line"> keys = [<span class="string">'mode'</span>,<span class="string">'cmdlevel'</span>,<span class="string">'filelevel'</span>,<span class="string">'filefmt'</span>,<span class="string">'cmdfmt'</span>,\</span><br><span class="line"> <span class="string">'filedatefmt'</span>,<span class="string">'cmddatefmt'</span>,<span class="string">'backup_count'</span>,<span class="string">'limit'</span>,\</span><br><span class="line"> <span class="string">'when'</span>,<span class="string">'colorful'</span>]</span><br><span class="line"> <span class="keyword">for</span> (key, value) <span class="keyword">in</span> kwargs.items():</span><br><span class="line"> <span class="keyword">if</span> <span class="keyword">not</span> (key <span class="keyword">in</span> keys):</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">False</span></span><br><span class="line"> setattr(self, key, value)</span><br><span class="line"> <span class="keyword">if</span> isinstance(self.cmdlevel, str):</span><br><span class="line"> self.cmdlevel = getattr(logging, self.cmdlevel.upper(), logging.DEBUG)</span><br><span class="line"> <span class="keyword">if</span> isinstance(self.filelevel, str):</span><br><span class="line"> self.filelevel = getattr(logging, self.filelevel.upper(), logging.DEBUG)</span><br><span class="line"> <span class="keyword">if</span> <span class="keyword">not</span> <span class="string">"cmdfmt"</span> <span class="keyword">in</span> kwargs:</span><br><span class="line"> self.filefmt=<span class="string">'[%(asctime)s] %(filename)s line:%(lineno)d %(levelname)-8s%(message)s'</span></span><br><span class="line"> self.filedatefmt = <span class="string">'%Y-%m-%d %H:%M:%S'</span></span><br><span class="line"> self.cmdfmt=<span class="string">'[%(asctime)s] %(filename)s line:%(lineno)d %(levelname)-8s%(message)s'</span></span><br><span class="line"> self.cmddatefmt = <span class="string">'%H:%M:%S'</span></span><br><span class="line"> <span class="keyword">if</span> self.cmdlevel > <span class="number">10</span>:</span><br><span class="line"> self.filefmt = <span class="string">'[%(asctime)s] %(levelname)-8s%(message)s'</span></span><br><span class="line"> self.cmdfmt = <span class="string">'[%(asctime)s] %(levelname)-8s%(message)s'</span></span><br><span class="line"> self.cmddatefmt = <span class="string">'%Y-%m-%d %H:%M:%S'</span></span><br><span class="line"> self.init_logger()</span><br><span class="line"> self.add_streamhandler()</span><br><span class="line"> self.add_filehandler()</span><br><span class="line"> <span class="comment"># Import the common log functions for convenient</span></span><br><span class="line"> self.import_log_funcs()</span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">True</span></span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">import_log_funcs</span><span class="params">(self)</span>:</span></span><br><span class="line"> <span class="string">'''Import the common log functions from the logger to the class'''</span></span><br><span class="line"> log_funcs = [<span class="string">'debug'</span>, <span class="string">'info'</span>, <span class="string">'warning'</span>, <span class="string">'error'</span>, <span class="string">'critical'</span>,</span><br><span class="line"> <span class="string">'exception'</span>]</span><br><span class="line"> <span class="keyword">for</span> func_name <span class="keyword">in</span> log_funcs:</span><br><span class="line"> func = getattr(self.logger, func_name)</span><br><span class="line"> setattr(self, func_name, func)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">trace</span><span class="params">(self)</span>:</span></span><br><span class="line"> info = sys.exc_info()</span><br><span class="line"> <span class="keyword">for</span> file, lineno, function, text <span class="keyword">in</span> traceback.extract_tb(info[<span class="number">2</span>]):</span><br><span class="line"> self.error(<span class="string">'%s line:%s in %s:%s'</span> % (file, lineno, function, text))</span><br><span class="line"> self.error(<span class="string">'%s: %s'</span> % info[:<span class="number">2</span>])</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">'__main__'</span>:</span><br><span class="line"> log = Log(cmdlevel=<span class="string">'info'</span>)</span><br><span class="line"> <span class="comment"># log = Log(cmdlevel='debug')</span></span><br><span class="line"> log.set_logger(cmdlevel=<span class="string">'debug'</span>)</span><br><span class="line"> log.debug(<span class="string">'debug'</span>)</span><br><span class="line"> log.info(<span class="string">'debug%s'</span> % <span class="string">'haha'</span>)</span><br><span class="line"> log.error((<span class="number">1</span>,<span class="number">2</span>))</span><br><span class="line"> log.error(<span class="string">'debug'</span>)</span><br><span class="line"> log.info({<span class="string">'a'</span>:<span class="number">1</span>,<span class="string">'b'</span>:<span class="number">2</span>})</span><br><span class="line"> os.system(<span class="string">"pause"</span>)</span><br><span class="line"> <span class="class"><span class="keyword">class</span> <span class="title">A</span><span class="params">()</span>:</span></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self, log)</span>:</span></span><br><span class="line"> self.log = log</span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">a</span><span class="params">(self,a)</span>:</span></span><br><span class="line"> self.log.info(a)</span><br><span class="line"> <span class="class"><span class="keyword">class</span> <span class="title">B</span><span class="params">()</span>:</span></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">__init__</span><span class="params">(self, log)</span>:</span></span><br><span class="line"> self.log = log</span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">b</span><span class="params">(self,a)</span>:</span></span><br><span class="line"> self.log.info(a)</span><br><span class="line"> a = A(log)</span><br><span class="line"> a.a(<span class="string">"test a"</span>)</span><br><span class="line"> b = B(log)</span><br><span class="line"> b.b(<span class="number">5</span>)</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">def</span> <span class="title">fun</span><span class="params">(a)</span>:</span></span><br><span class="line"> <span class="keyword">return</span> <span class="number">10</span>/a</span><br><span class="line"> <span class="keyword">try</span>:</span><br><span class="line"> a = fun(<span class="number">0</span>)</span><br><span class="line"> <span class="keyword">except</span>:</span><br><span class="line"> log.trace()</span><br></pre></td></tr></table></figure>
<h2 id="例子">例子</h2><p>用的时候把log.py丢到工程目录然后import进来初始化一个Log对象即可。</p>
<p>如果全部使用默认配置(具体值请看Log类的init函数):<br><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></pre></td><td class="code"><pre><span class="line"><span class="comment"># tmp.py</span></span><br><span class="line"><span class="keyword">import</span> log</span><br><span class="line">log = log.Log()</span><br><span class="line">log.debug(<span class="string">'hello, world'</span>)</span><br><span class="line">log.info(<span class="string">'hello, world'</span>)</span><br><span class="line">log.error(<span class="string">'hello, world'</span>)</span><br><span class="line">log.critical(<span class="string">'hello, world'</span>)</span><br></pre></td></tr></table></figure></p>
<p>得到结果:<br>在命令行跟文件里面分别记录运行日志,命令行呈现大于DEBUG级别的记录,文件记录大于INFO级别的记录。文件名跟主程序的py名字一样,这里是<code>tmp.log</code>。里面内容:<br><figure class="highlight bash"><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="number">2016</span>-<span class="number">05</span>-<span class="number">29</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">05</span>] tmp.py line:<span class="number">6</span> INFO hello, world</span><br><span class="line">[<span class="number">2016</span>-<span class="number">05</span>-<span class="number">29</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">05</span>] tmp.py line:<span class="number">7</span> ERROR hello, world</span><br><span class="line">[<span class="number">2016</span>-<span class="number">05</span>-<span class="number">29</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">05</span>] tmp.py line:<span class="number">8</span> CRITICALhello, world</span><br><span class="line">[<span class="number">2016</span>-<span class="number">05</span>-<span class="number">29</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">49</span>] tmp.py line:<span class="number">6</span> INFO hello, world</span><br><span class="line">[<span class="number">2016</span>-<span class="number">05</span>-<span class="number">29</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">49</span>] tmp.py line:<span class="number">7</span> ERROR hello, world</span><br><span class="line">[<span class="number">2016</span>-<span class="number">05</span>-<span class="number">29</span> <span class="number">17</span>:<span class="number">17</span>:<span class="number">49</span>] tmp.py line:<span class="number">8</span> CRITICALhello, world</span><br></pre></td></tr></table></figure></p>
<p>cmd显示运行结果:<br><figure class="highlight bash"><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="number">17</span>:<span class="number">17</span>:<span class="number">05</span>] tmp.py line:<span class="number">5</span> DEBUG hello, world</span><br><span class="line">[<span class="number">17</span>:<span class="number">17</span>:<span class="number">05</span>] tmp.py line:<span class="number">6</span> INFO hello, world</span><br><span class="line">[<span class="number">17</span>:<span class="number">17</span>:<span class="number">05</span>] tmp.py line:<span class="number">7</span> ERROR hello, world</span><br><span class="line">[<span class="number">17</span>:<span class="number">17</span>:<span class="number">05</span>] tmp.py line:<span class="number">8</span> CRITICALhello, world</span><br><span class="line">Hit any key to close this window...</span><br></pre></td></tr></table></figure></p>
<p>里面的内容符合对文件跟cmd的level级别筛选规则,显示的格式也分别符合<code>Log类</code>init默认初始化参数的formatter设置的规则。</p>
<p>如果要更改设置,直接调用<code>log.set_logger</code>就可以了。一般来说很少会有更改设置的情况,都是直接初始化就一直用到结束。有一种情况就是给出一个可以调整log level的级别的配置接口。这样程序运行的过程中,遇到bug用户可以调整日志级别,然后把debug日志记录获取到发给开发人员分析。</p>
<p>另外,封装的log.py比原来的logging模块多了一个trace接口。可以打印exception的详细信息。具体用法可以看封装的文件里边的例子。</p>
<h2 id="其他">其他</h2><h3 id="1-_formatter配置">1. formatter配置</h3><p>下面是formatter用到的匹配规则,其中asctime还可以进一步配置:命令行通过<code>cmddatefmt</code>、文件日志通过<code>filedatefmt</code>,具体写法可参照Log类的初始化函数。<br><figure class="highlight gherkin"><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></pre></td><td class="code"><pre><span class="line">+---------------------+-----------------------------------------------------------------------------</span><br><span class="line">|<span class="string"> %(name)s </span>|<span class="string"> Logger的名字 </span><br><span class="line"></span>|<span class="string"> %(levelno)s </span>|<span class="string"> 数字形式的日志级别 </span><br><span class="line"></span>|<span class="string"> %(levelname)s </span>|<span class="string"> 文本形式的日志级别 </span><br><span class="line"></span>|<span class="string"> %(pathname)s </span>|<span class="string"> 调用日志输出函数的模块的完整路径名,可能没有 </span><br><span class="line"></span>|<span class="string"> %(filename)s </span>|<span class="string"> 调用日志输出函数的模块的文件名 </span><br><span class="line"></span>|<span class="string"> %(module)s </span>|<span class="string"> 调用日志输出函数的模块名 </span><br><span class="line"></span>|<span class="string"> %(funcName)s </span>|<span class="string"> 调用日志输出函数的函数名 </span><br><span class="line"></span>|<span class="string"> %(lineno)d </span>|<span class="string"> 调用日志输出函数的语句所在的代码行 </span><br><span class="line"></span>|<span class="string"> %(created)f </span>|<span class="string"> 当前时间,用UNIX标准的表示时间的浮 点数表示 </span><br><span class="line"></span>|<span class="string"> %(relativeCreated)d </span>|<span class="string"> 输出日志信息时的,自Logger创建以 来的毫秒数 </span><br><span class="line"></span>|<span class="string"> %(asctime)s </span>|<span class="string"> 字符串形式的当前时间。默认格式是 “2003-07-08 16:49:45,896”。逗号后面的是毫秒</span><br><span class="line"></span>|<span class="string"> %(thread)d </span>|<span class="string"> 线程ID。可能没有 </span><br><span class="line"></span>|<span class="string"> %(threadName)s </span>|<span class="string"> 线程名。可能没有 </span><br><span class="line"></span>|<span class="string"> %(process)d </span>|<span class="string"> 进程ID。可能没有 </span><br><span class="line"></span>|<span class="string"> %(message)s </span>|<span class="string"> 用户输出的消息 </span><br><span class="line">+---------------------+-----------------------------------------------------------------------------</span></span><br></pre></td></tr></table></figure></p>
<h3 id="2-_Use_set_logger_to_change_settings">2. Use set_logger to change settings</h3><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><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Change limit size in bytes of default rotating action</span></span><br><span class="line">log.set_logger(limit = <span class="number">10240</span>) <span class="comment"># 10M</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Use time-rotated file handler, each day has a different log file, see</span></span><br><span class="line"><span class="comment"># logging.handlers.TimedRotatingFileHandler for more help about 'when'</span></span><br><span class="line">log.set_logger(when = <span class="string">'D'</span>, limit = <span class="number">1</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Use normal file handler (not rotated)</span></span><br><span class="line">log.set_logger(backup_count = <span class="number">0</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># File log level set to INFO, and stdout log level set to DEBUG</span></span><br><span class="line">log.set_logger(cmdlevel = <span class="string">'DEBUG'</span>, filelevel = <span class="string">'INFO'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Change default log file name and log mode</span></span><br><span class="line">log.set_logger(filename = <span class="string">'yyy.log'</span>, mode = <span class="string">'w'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Change default log formatter</span></span><br><span class="line">log.set_logger(cmdfmt = <span class="string">'[%(levelname)s] %(message)s'</span>)</span><br></pre></td></tr></table></figure>
]]></content>
</entry>
<entry>
<title><![CDATA[Oracle收缩临时表空间]]></title>
<url>http://huangming.github.io/2016-05-25-oracle-rebuild-temp-tablespace.html</url>
<content type="html"><![CDATA[<figure class="highlight bash"><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">SQL> alter tablespace temp shrink space;</span><br><span class="line">表空间已更改。</span><br></pre></td></tr></table></figure>
]]></content>
</entry>
<entry>
<title><![CDATA[Oracle冷备与恢复]]></title>
<url>http://huangming.github.io/2016-05-21-oracle-cold-backup.html</url>
<content type="html"><![CDATA[<p>冷备恢复是oracle最快捷方便安全的恢复、拷贝方式。他只有一个缺点:冷备的时候要关闭源库。冷备特别适合搭建跟生产一致的测试环境。</p>
<h2 id="环境">环境</h2><p>源库跟目的库的Oracle大版本要一致,并且数据库SID要一样。<br>本文测试环境:</p>
<ul>
<li>源库操作系统 <code>windows server 2008 R2 x64</code><br>源库数据库版本 <code>11g Enterprise Edition Release 11.2.0.1.0 - 64bit</code></li>
<li>目的库操作系统 <code>win7 x64</code> <code>win10 x64</code> <code>windows server 2008 R2 x64</code> 均测试成功<br>目的库数据库版本 <code>11g Enterprise Edition Release 11.2.0.1.0 - 64bit</code></li>
</ul>
<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"><span class="operator"><span class="keyword">select</span> banner <span class="keyword">from</span> sys.v_$<span class="keyword">version</span>;</span></span><br></pre></td></tr></table></figure>
<a id="more"></a>
<h2 id="冷备">冷备</h2><p>在源库(假定SID名为ORCL)执行以下操作:</p>
<h3 id="1-_打开CMD,用sysdba登录数据库。">1. 打开CMD,用sysdba登录数据库。</h3><p>有些操作系统安装了不止一个数据库实例,为了确保操作的是源库,在CMD命令行中先执行一次<code>set ORACLE_SID=ORCL</code>:<br> <figure class="highlight bash"><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="built_in">set</span> ORACLE_SID=ORCL</span><br><span class="line">sqlplus / as sysdba</span><br></pre></td></tr></table></figure></p>
<p>先检查一下登录的数据库:<br> <figure class="highlight bash"><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">SQL> select instance_name from v<span class="variable">$instance</span>;</span><br><span class="line">INSTANCE_NAME</span><br><span class="line">----------------</span><br><span class="line">orcl</span><br></pre></td></tr></table></figure></p>
<h3 id="2-_查找并记下各物理文件路径">2. 查找并记下各物理文件路径</h3><p>总共有控制文件、参数文件、数据文件、密码文件、redolog文件<br>可在SQL*PLUS 也可在 Pl/SQL 里边查看:</p>
<ul>
<li><p>控制文件(可不拷贝)</p>
<figure class="highlight bash"><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">SQL> <span class="built_in">set</span> line <span class="number">200</span></span><br><span class="line">SQL> columnn NAME format a60</span><br><span class="line">SQL> select * from V<span class="variable">$CONTROLFILE</span>;</span><br><span class="line">STATUS NAME IS_ BLOCK_SIZE FILE_SIZE_BLKS</span><br><span class="line">------- ------------------------------------------------------------ --- ---------- --------------</span><br><span class="line"> D:\APP\ADMINISTRATOR\ORADATA\ORCL\CONTROL01.CTL NO <span class="number">16384</span> <span class="number">636</span></span><br><span class="line"> D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\CONTROL02.CTL NO <span class="number">16384</span> <span class="number">636</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>参数文件(如果没有可不拷贝) </p>
<figure class="highlight bash"><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">SQL> show parameter spfile</span><br><span class="line">NAME TYPE VALUE</span><br><span class="line">------------------------------------ ----------- ------------------------------</span><br><span class="line">spfile string</span><br></pre></td></tr></table></figure>
</li>
<li><p>密码文件<br>一般在如下路径,以<code>PWD+SID.ora</code>命名。可直接拷贝整个<code>database</code>文件夹(上面的参数文件一般也在这里)。</p>
<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">D:\app\Administrator\product\<span class="number">11.2</span>.<span class="number">0</span>\dbhome_1\database\PWDorcl.ora</span><br></pre></td></tr></table></figure>
</li>
<li><p>重做日志文件</p>
<figure class="highlight bash"><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">SQL> select * from V<span class="variable">$LOGFILE</span>;</span><br><span class="line"> GROUP<span class="comment"># STATUS TYPE MEMBER IS_</span></span><br><span class="line">---------- ------- ------- ------------------------------------------------------------ ---</span><br><span class="line"> <span class="number">2</span> ONLINE D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG NO</span><br><span class="line"> <span class="number">1</span> ONLINE D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG NO</span><br><span class="line"> <span class="number">3</span> ONLINE D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG NO</span><br></pre></td></tr></table></figure>
</li>
<li><p>数据文件</p>
<figure class="highlight bash"><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">SQL> select name from V<span class="variable">$DATAFILE</span>;</span><br><span class="line">NAME</span><br><span class="line">------------------------------------------------------------</span><br><span class="line">D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF</span><br><span class="line">D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF</span><br><span class="line">D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF</span><br><span class="line">D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF</span><br><span class="line">D:\APP\ADMINISTRATOR\ORADATA\ORCL\ORCL.DBF</span><br><span class="line">已选择<span class="number">5</span>行。</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="3-_然后关闭数据库,并拷贝物理文件。">3. 然后关闭数据库,并拷贝物理文件。</h3><figure class="highlight bash"><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">SQL> shutdown immediate;</span><br><span class="line">数据库已经关闭。</span><br><span class="line">已经卸载数据库。</span><br><span class="line">ORACLE 例程已经关闭。</span><br></pre></td></tr></table></figure>
<h3 id="4-_拷贝完文件后备份重建控制文件脚本">4. 拷贝完文件后备份重建控制文件脚本</h3><figure class="highlight bash"><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">SQL> startup mount;</span><br><span class="line">ORACLE 例程已经启动。</span><br><span class="line">Total System Global Area <span class="number">3423965184</span> bytes</span><br><span class="line">Fixed Size <span class="number">2180544</span> bytes</span><br><span class="line">Variable Size <span class="number">1862273600</span> bytes</span><br><span class="line">Database Buffers <span class="number">1543503872</span> bytes</span><br><span class="line">Redo Buffers <span class="number">16007168</span> bytes</span><br><span class="line">数据库装载完毕。</span><br><span class="line">SQL> alter database backup controlfile to trace as <span class="string">'d:\controlfile.sql'</span>;</span><br><span class="line">数据库已更改。</span><br></pre></td></tr></table></figure>
<p><code>d:\controlfile.sql</code>为建立控制文件的脚本。</p>
<h3 id="5-_重新启动数据库">5. 重新启动数据库</h3><figure class="highlight bash"><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">SQL> shutdown abort;</span><br><span class="line">ORACLE 例程已经关闭。</span><br><span class="line">SQL> startup;</span><br><span class="line">ORACLE 例程已经启动。</span><br><span class="line">Total System Global Area <span class="number">3423965184</span> bytes</span><br><span class="line">Fixed Size <span class="number">2180544</span> bytes</span><br><span class="line">Variable Size <span class="number">1862273600</span> bytes</span><br><span class="line">Database Buffers <span class="number">1543503872</span> bytes</span><br><span class="line">Redo Buffers <span class="number">16007168</span> bytes</span><br><span class="line">数据库装载完毕。</span><br><span class="line">数据库已经打开。</span><br></pre></td></tr></table></figure>
<p>如果有问题可直接通过系统服务重启对应的服务</p>
<h2 id="恢复、拷贝">恢复、拷贝</h2><p>这里只讨论控制文件丢失的情况下的恢复还有拷贝搭建一模一样的测试库的情况。</p>
<p>如果目的库不存在,先新建一个同名目的库(可用<code>Database Configuration Assistant</code>)。建立的时候注意一下字符集还有存储位置(跟源库一样选所有数据库文件使用公共位置)即可。以下操作均在目的库执行:</p>
<h3 id="1-_创建参数化文件">1. 创建参数化文件</h3><p> 打开CMD并用sqlplus以sysdba身份登陆ORCL(方法如上节)<br> <figure class="highlight bash"><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">SQL> Create pfile from spfile;</span><br><span class="line">文件已创建。</span><br></pre></td></tr></table></figure></p>
<p>创建结果在<code>product\11.2.0\dbhome_1\database\INIT+DBNAME.ORA</code> 这里是<code>INITorcl.ORA</code></p>
<h3 id="2-_关闭实例并重命名spfile">2. 关闭实例并重命名spfile</h3><figure class="highlight bash"><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">SQL> shutdown immediate;</span><br><span class="line">数据库已经关闭。</span><br><span class="line">已经卸载数据库。</span><br><span class="line">ORACLE 例程已经关闭。</span><br></pre></td></tr></table></figure>
<p>此处将<code>D:\app\Administrator\product\11.2.0\dbhome_1\database\SPFILEORCL.ORA</code>重命名为<br><code>D:\app\Administrator\product\11.2.0\dbhome_1\database\SPFILEORCL.ORA.20160525.bak</code></p>
<h3 id="3-_将数据文件、密码文件、redolog文件拷贝到目的库对应路径">3. 将数据文件、密码文件、redolog文件拷贝到目的库对应路径</h3><p>我实际测试的时候<code>win7</code>跟<code>win2008</code>路径是跟源库一模一样的,<code>win10</code>跟源库对比路径的磁盘位置不一样。</p>
<h3 id="4-_重建控制文件">4. 重建控制文件</h3><p>先修改备份的控制文件。备份的控制文件里边有两种重建脚本。这里选<code>NORESETLOGS case</code>。<br>什么时候用另一个不太清楚,实际测试的时候第二种失败了。应该跟源库的<code>ARCHIVELOG</code>设置有关。<br>选好后把别的都删除,<red><strong>特别是空行一定要删除</strong></red>!路径有修改的,可以改成目的库的路径,例如我测试的时候数据库在H盘,所以d全部变成h了。<br>修改后的内容如下:<br> <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><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></pre></td><td class="code"><pre><span class="line">STARTUP NOMOUNT</span><br><span class="line"><span class="operator"><span class="keyword">CREATE</span> CONTROLFILE REUSE <span class="keyword">DATABASE</span> <span class="string">"ORCL"</span> NORESETLOGS NOARCHIVELOG</span><br><span class="line"> MAXLOGFILES <span class="number">16</span></span><br><span class="line"> MAXLOGMEMBERS <span class="number">3</span></span><br><span class="line"> MAXDATAFILES <span class="number">100</span></span><br><span class="line"> MAXINSTANCES <span class="number">8</span></span><br><span class="line"> MAXLOGHISTORY <span class="number">292</span></span><br><span class="line"><span class="keyword">LOGFILE</span></span><br><span class="line"> <span class="keyword">GROUP</span> <span class="number">1</span> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG'</span> <span class="keyword">SIZE</span> <span class="number">50</span>M BLOCKSIZE <span class="number">512</span>,</span><br><span class="line"> <span class="keyword">GROUP</span> <span class="number">2</span> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG'</span> <span class="keyword">SIZE</span> <span class="number">50</span>M BLOCKSIZE <span class="number">512</span>,</span><br><span class="line"> <span class="keyword">GROUP</span> <span class="number">3</span> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG'</span> <span class="keyword">SIZE</span> <span class="number">50</span>M BLOCKSIZE <span class="number">512</span></span><br><span class="line"><span class="comment">-- STANDBY LOGFILE</span></span><br><span class="line">DATAFILE</span><br><span class="line"> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF'</span>,</span><br><span class="line"> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF'</span>,</span><br><span class="line"> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF'</span>,</span><br><span class="line"> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF'</span>,</span><br><span class="line"> <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\ORCL.DBF'</span></span><br><span class="line"><span class="built_in">CHARACTER</span> <span class="keyword">SET</span> ZHS16GBK</span><br><span class="line">;</span></span><br></pre></td></tr></table></figure></p>
<p>把修改后的文件放到目的库所在系统某路径,这里测试的时候放到了<code>d:\</code>,然后在sqlplus以<code>nomount</code>模式启动数据库执行这个脚本:<br> <figure class="highlight bash"><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">SQL> STARTUP NOMOUNT;</span><br><span class="line">ORACLE 例程已经启动。</span><br><span class="line">Total System Global Area <span class="number">3423965184</span> bytes</span><br><span class="line">Fixed Size <span class="number">2180544</span> bytes</span><br><span class="line">Variable Size <span class="number">1862273600</span> bytes</span><br><span class="line">Database Buffers <span class="number">1543503872</span> bytes</span><br><span class="line">Redo Buffers <span class="number">16007168</span> bytes</span><br><span class="line">SQL> @d:\controlfile.sql;</span><br><span class="line">SQL> @d:\CONTROLFILE_KRCS.SQL</span><br><span class="line">ORA-<span class="number">01081</span>: ????????? ORACLE - ??????</span><br><span class="line">控制文件已创建。</span><br></pre></td></tr></table></figure></p>
<p>那个<code>ora-01081</code>可以不用管他,出现的原因是本身已经<code>STARTUP NOMOUNT</code>,脚本里边又执行了一次。<br>此处报01503、01565之类的错的话检查脚本中的datafile在对应路径是否存在,路径对不上的话改对它。<br>重建控制文件后执行一次恢复:<br> <figure class="highlight bash"><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">SQL> recover database;</span><br><span class="line">ORA-<span class="number">00283</span>: ????????????????????</span><br><span class="line">ORA-<span class="number">00264</span>: ??????????</span><br></pre></td></tr></table></figure></p>
<p>如果弹出ORA-00264错误,表示数据库是一致的,不需要恢复</p>
<p>接着打开数据库<br> <figure class="highlight bash"><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">SQL> alter database open;</span><br><span class="line">数据库已更改。</span><br></pre></td></tr></table></figure></p>
<p>如果无报错表示数据迁移、恢复成功。</p>
<h3 id="5-_最后把临时表空间重建一下">5. 最后把临时表空间重建一下</h3><p>重建语句可以在原来备份的重建控制文件脚本里边找。<br> <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="operator"><span class="keyword">ALTER</span> <span class="keyword">TABLESPACE</span> TEMP <span class="keyword">ADD</span> TEMPFILE <span class="string">'D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF'</span> REUSE;</span></span><br></pre></td></tr></table></figure></p>
]]></content>
</entry>
<entry>
<title><![CDATA[Hexo怎么优雅地插入图片]]></title>
<url>http://huangming.github.io/2016-05-02-hexo-img-solution.html</url>
<content type="html"><![CDATA[<p>发现懒得更新博客的一个很大原因是,写一个图文博文实在是有点麻烦。这两天研究了下如何优雅的在写<a href="http://hexo.io" target="_blank" rel="external">hexo</a>博客的时候优雅地插入图片。</p>
<h2 id="环境">环境</h2><p>我的环境:<code>win10</code> <code>gvim7.4</code> <code>hexo3.1.1</code>, 此方案对环境无要求。 </p>
<p>用<a href="http://www.vim.org/" target="_blank" rel="external">gvim</a> 编写markdown。</p>
<h2 id="开始">开始</h2><h3 id="最终结果">最终结果</h3><ul>
<li>在执行 <code>hexo new [layout] <title></code> 后,自动在一个设定的目录创建以 <code><title></code> 命名的子目录,然后把文章用到的截图全部放到这个文件夹。通过工具自动同步到图床。图床的存储路径必须满足统一前缀。例如,我的截图是 <code>youpath/title/name.png</code> ,上传到图床后,网络路径必须是 <code>http://yoursite/title/name.png</code> 类型。</li>
<li>在gvim写作的时候,每次保存会自动转换:<ol>
<li><code>![pic4](4.png)</code> 替换为 <code>![pic4](http://yoursite/title/4.png)</code></li>
<li><code>![pic4][4]</code> 自动在文章末尾增加 <code>![4](http://yoursite/title/4.png)</code></li>
</ol>
</li>
</ul>
<a id="more"></a>
<h3 id="vim配置">vim配置</h3><p>vim配置很简单,在你的配置文件vimrc里面添加下面的内容即可(网址请改为自己的图床,这里我用的是七牛图床)。</p>
<figure class="highlight"><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></pre></td><td class="code"><pre><span class="line">autocmd! BufWritePost *.md,*.mkd,*.markdown :silent!call Insertimg()<CR></span><br><span class="line">function! Insertimg()</span><br><span class="line"> " 转换![name](num)</span><br><span class="line"> :%s#\(!\[[^\]]*\](\)\(\w\{,10}\))#\=submatch(1).'http://7xsj4f.com2.z0.glb.clouddn.com/'.expand("%:r").'/'.submatch(2).'.png)'#</span><br><span class="line"> </span><br><span class="line"> " 转换 ![name][num]</span><br><span class="line"> let lnum = 1</span><br><span class="line"> let lst = []</span><br><span class="line"> while lnum <= line("$")</span><br><span class="line"> let line = getline(lnum)</span><br><span class="line"> call substitute(line, '\(!\[[^\]]*\]\[\)\(\d\{,2}\)\]', '\=add(lst, submatch(2))', 'g')</span><br><span class="line"> let lnum += 1</span><br><span class="line"> endwhile</span><br><span class="line"> let unduplst=sort(filter(copy(lst),'index(lst, v:val, v:key+1)==-1'))</span><br><span class="line"> let line = getline(line("$"))</span><br><span class="line"> let flag = matchstr(line,'\[\d\+\]: http:')</span><br><span class="line"> :ks</span><br><span class="line"> while flag != ''</span><br><span class="line"> exe "normal G"</span><br><span class="line"> exe "normal dd"</span><br><span class="line"> let line = getline(line("$"))</span><br><span class="line"> let flag = matchstr(line,'\[\d\+\]: http:')</span><br><span class="line"> endwhile</span><br><span class="line"> exe "normal 's"</span><br><span class="line"></span><br><span class="line"> for name in unduplst</span><br><span class="line"> if len(name)>0</span><br><span class="line"> call append(line("$"), "[".name."]: http://7xsj4f.com2.z0.glb.clouddn.com/".expand("%:r")."/".name.".png")</span><br><span class="line"> endif</span><br><span class="line"> endfor</span><br><span class="line"> :w</span><br><span class="line">endfunction</span><br></pre></td></tr></table></figure>
<h3 id="hexo_配置">hexo 配置</h3><p>这个配置起来有点小麻烦,要改hexo的一个模块代码。文件路径在<code>yourpath\hexo\node_modules\hexo\lib\hexo\post.js</code> 更改内容:</p>
<figure class="highlight js"><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">@@ -<span class="number">63</span>,<span class="number">7</span> +<span class="number">63</span>,<span class="number">7</span> @@ Post.prototype.create = <span class="function"><span class="keyword">function</span>(<span class="params">data, replace, callback</span>) </span>{</span><br><span class="line"> <span class="comment">// Write content to file</span></span><br><span class="line"> fs.writeFile(path, content),</span><br><span class="line"> <span class="comment">// Create asset folder</span></span><br><span class="line">- createAssetFolder(path, config.post_asset_folder)</span><br><span class="line">+ createAssetFolder(pathFn.resolve(config.post_asset_folder,pathFn.basename(path)), config.post_asset_folder)</span><br><span class="line"> ]).then(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</span><br><span class="line"> ctx.emit(<span class="string">'new'</span>, result);</span><br><span class="line"> }).thenReturn(result);</span><br><span class="line">@@ -<span class="number">213</span>,<span class="number">7</span> +<span class="number">213</span>,<span class="number">7</span> @@ Post.prototype.publish = <span class="function"><span class="keyword">function</span>(<span class="params">data, replace, callback</span>) </span>{</span><br><span class="line"> <span class="comment">// Remove the original draft file</span></span><br><span class="line"> <span class="keyword">return</span> fs.unlink(src);</span><br><span class="line"> }).then(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{</span><br><span class="line">- <span class="keyword">if</span> (!config.post_asset_folder) <span class="keyword">return</span>;</span><br><span class="line">+ <span class="keyword">if</span> (config.post_asset_folder !== <span class="literal">true</span>) <span class="keyword">return</span>;</span><br></pre></td></tr></table></figure>
<p>然后在 <code>yourpath\hexo\_config.yml</code> 中配置 <code>post_asset_folder</code> 路径,路径可随意:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">post_asset_folder: .\static\images\</span><br></pre></td></tr></table></figure>
<p>当每次用 <code>hexo new [layout] <title></code> 命令的时候就会自动在配置的路径生成一个跟 <code>title</code> 同名的文件夹。并且此文件夹内的内容不会上传到github。</p>
<h3 id="自动同步到图床">自动同步到图床</h3><ul>
<li><a href="https://github.com/beyondskyway/QiniuSync" target="_blank" rel="external">QiniuSync</a></li>
<li><a href="https://github.com/tiann/markdown-img-upload" target="_blank" rel="external">markdown-img-upload</a></li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[羁绊]]></title>
<url>http://huangming.github.io/2015-09-28-juban.html</url>
<content type="html"><![CDATA[<p>距离上一篇日志,已经间隔四年之久。当初年少轻狂的我厌恶喧嚣的QQ,乐此不疲的翻墙出去看外面的世界,听外面的人聊天。在当时看来,朋友已经成为一种羁绊,想要远离一切,独自去行走,寻找人存在更深的意义,当然更多的是——去追寻所谓的自由。于是渐渐疏离,斩断羁绊。我像是一条鼠目寸光的蛇,可怜兮兮地维护着身边看的到的友谊却又冷血地斩断上一个窝点的羁绊。<br><a id="more"></a><br>直到我静下心来发现自己力不从心没有想象中的充满战斗力的时候,我才知道,以前之所以能那么拼,是因为有你们的羁绊,即使不说话,即使不在身边,一样充满斗志,因为若有若无的感觉得到,有你们在一起。上天就是这么残酷,让人直到失去后才懂得珍惜。</p>
<p>我不停地提醒着身边的人去找朋友玩,因为我后悔了,很早开始就已经后悔了,只是没有如今这么强烈而已。</p>
<p>我知道时间是把杀猪刀,也许很多人都已经变了很多,特别是面临人到中年。也许我们已经找不到共同的话题了,也许我们都忙着各自的责任与担当,但是我还想试着找回这些羁绊,就像以前一样,即使不说话,即使不在身边,能够感觉到大家在一起。</p>
<p>感觉身上的一道枷锁打开了,也许羁绊与自由本就是一体的。</p>
]]></content>
</entry>
<entry>
<title><![CDATA[Hello World]]></title>
<url>http://huangming.github.io/2015-07-10-hello-world.html</url>
<content type="html"><![CDATA[<p>Welcome to <a href="http://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="http://hexo.io/docs/" target="_blank" rel="external">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="http://hexo.io/docs/troubleshooting.html" target="_blank" rel="external">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="external">GitHub</a>.</p>
<h2 id="Quick_Start">Quick Start</h2><h3 id="Create_a_new_post">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="http://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p>
<h3 id="Run_server">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="http://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p>
<h3 id="Generate_static_files">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="http://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p>
<h3 id="Deploy_to_remote_sites">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="http://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>
]]></content>
</entry>
<entry>
<title><![CDATA[我的vimrc]]></title>
<url>http://huangming.github.io/2012-04-25-vimrc.html</url>
<content type="html"><![CDATA[<p> 系统:windows 7 vim版本:7.4<a id="more"></a><br><figure class="highlight"><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><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br><span class="line">371</span><br><span class="line">372</span><br><span class="line">373</span><br><span class="line">374</span><br><span class="line">375</span><br><span class="line">376</span><br><span class="line">377</span><br><span class="line">378</span><br><span class="line">379</span><br><span class="line">380</span><br><span class="line">381</span><br><span class="line">382</span><br><span class="line">383</span><br><span class="line">384</span><br><span class="line">385</span><br><span class="line">386</span><br><span class="line">387</span><br><span class="line">388</span><br><span class="line">389</span><br><span class="line">390</span><br><span class="line">391</span><br><span class="line">392</span><br><span class="line">393</span><br><span class="line">394</span><br><span class="line">395</span><br><span class="line">396</span><br><span class="line">397</span><br><span class="line">398</span><br><span class="line">399</span><br><span class="line">400</span><br><span class="line">401</span><br><span class="line">402</span><br><span class="line">403</span><br><span class="line">404</span><br><span class="line">405</span><br><span class="line">406</span><br><span class="line">407</span><br><span class="line">408</span><br><span class="line">409</span><br><span class="line">410</span><br><span class="line">411</span><br><span class="line">412</span><br><span class="line">413</span><br><span class="line">414</span><br><span class="line">415</span><br><span class="line">416</span><br><span class="line">417</span><br><span class="line">418</span><br><span class="line">419</span><br><span class="line">420</span><br><span class="line">421</span><br><span class="line">422</span><br><span class="line">423</span><br><span class="line">424</span><br><span class="line">425</span><br><span class="line">426</span><br><span class="line">427</span><br><span class="line">428</span><br><span class="line">429</span><br><span class="line">430</span><br><span class="line">431</span><br><span class="line">432</span><br><span class="line">433</span><br><span class="line">434</span><br><span class="line">435</span><br><span class="line">436</span><br><span class="line">437</span><br><span class="line">438</span><br><span class="line">439</span><br><span class="line">440</span><br><span class="line">441</span><br><span class="line">442</span><br><span class="line">443</span><br><span class="line">444</span><br><span class="line">445</span><br><span class="line">446</span><br><span class="line">447</span><br><span class="line">448</span><br><span class="line">449</span><br><span class="line">450</span><br><span class="line">451</span><br><span class="line">452</span><br><span class="line">453</span><br><span class="line">454</span><br><span class="line">455</span><br><span class="line">456</span><br><span class="line">457</span><br><span class="line">458</span><br><span class="line">459</span><br><span class="line">460</span><br><span class="line">461</span><br><span class="line">462</span><br><span class="line">463</span><br><span class="line">464</span><br><span class="line">465</span><br><span class="line">466</span><br><span class="line">467</span><br><span class="line">468</span><br><span class="line">469</span><br><span class="line">470</span><br><span class="line">471</span><br><span class="line">472</span><br><span class="line">473</span><br><span class="line">474</span><br><span class="line">475</span><br><span class="line">476</span><br><span class="line">477</span><br><span class="line">478</span><br><span class="line">479</span><br><span class="line">480</span><br><span class="line">481</span><br><span class="line">482</span><br><span class="line">483</span><br><span class="line">484</span><br><span class="line">485</span><br><span class="line">486</span><br><span class="line">487</span><br><span class="line">488</span><br><span class="line">489</span><br><span class="line">490</span><br><span class="line">491</span><br><span class="line">492</span><br><span class="line">493</span><br><span class="line">494</span><br><span class="line">495</span><br><span class="line">496</span><br><span class="line">497</span><br><span class="line">498</span><br><span class="line">499</span><br><span class="line">500</span><br><span class="line">501</span><br><span class="line">502</span><br><span class="line">503</span><br><span class="line">504</span><br><span class="line">505</span><br><span class="line">506</span><br><span class="line">507</span><br><span class="line">508</span><br><span class="line">509</span><br><span class="line">510</span><br><span class="line">511</span><br><span class="line">512</span><br><span class="line">513</span><br><span class="line">514</span><br><span class="line">515</span><br><span class="line">516</span><br><span class="line">517</span><br><span class="line">518</span><br><span class="line">519</span><br><span class="line">520</span><br><span class="line">521</span><br><span class="line">522</span><br><span class="line">523</span><br><span class="line">524</span><br><span class="line">525</span><br><span class="line">526</span><br><span class="line">527</span><br><span class="line">528</span><br><span class="line">529</span><br><span class="line">530</span><br><span class="line">531</span><br><span class="line">532</span><br><span class="line">533</span><br><span class="line">534</span><br><span class="line">535</span><br><span class="line">536</span><br><span class="line">537</span><br><span class="line">538</span><br><span class="line">539</span><br><span class="line">540</span><br><span class="line">541</span><br><span class="line">542</span><br><span class="line">543</span><br><span class="line">544</span><br><span class="line">545</span><br><span class="line">546</span><br><span class="line">547</span><br><span class="line">548</span><br><span class="line">549</span><br><span class="line">550</span><br><span class="line">551</span><br><span class="line">552</span><br><span class="line">553</span><br><span class="line">554</span><br><span class="line">555</span><br><span class="line">556</span><br><span class="line">557</span><br><span class="line">558</span><br><span class="line">559</span><br><span class="line">560</span><br><span class="line">561</span><br><span class="line">562</span><br><span class="line">563</span><br><span class="line">564</span><br><span class="line">565</span><br><span class="line">566</span><br><span class="line">567</span><br><span class="line">568</span><br><span class="line">569</span><br><span class="line">570</span><br><span class="line">571</span><br><span class="line">572</span><br><span class="line">573</span><br><span class="line">574</span><br><span class="line">575</span><br><span class="line">576</span><br><span class="line">577</span><br><span class="line">578</span><br><span class="line">579</span><br><span class="line">580</span><br><span class="line">581</span><br><span class="line">582</span><br><span class="line">583</span><br><span class="line">584</span><br><span class="line">585</span><br><span class="line">586</span><br><span class="line">587</span><br><span class="line">588</span><br><span class="line">589</span><br><span class="line">590</span><br><span class="line">591</span><br><span class="line">592</span><br><span class="line">593</span><br><span class="line">594</span><br><span class="line">595</span><br><span class="line">596</span><br><span class="line">597</span><br><span class="line">598</span><br><span class="line">599</span><br><span class="line">600</span><br><span class="line">601</span><br><span class="line">602</span><br><span class="line">603</span><br><span class="line">604</span><br><span class="line">605</span><br><span class="line">606</span><br><span class="line">607</span><br><span class="line">608</span><br><span class="line">609</span><br><span class="line">610</span><br><span class="line">611</span><br><span class="line">612</span><br><span class="line">613</span><br><span class="line">614</span><br><span class="line">615</span><br><span class="line">616</span><br><span class="line">617</span><br><span class="line">618</span><br><span class="line">619</span><br><span class="line">620</span><br><span class="line">621</span><br><span class="line">622</span><br><span class="line">623</span><br><span class="line">624</span><br><span class="line">625</span><br><span class="line">626</span><br><span class="line">627</span><br><span class="line">628</span><br><span class="line">629</span><br><span class="line">630</span><br><span class="line">631</span><br><span class="line">632</span><br><span class="line">633</span><br><span class="line">634</span><br><span class="line">635</span><br><span class="line">636</span><br><span class="line">637</span><br><span class="line">638</span><br><span class="line">639</span><br><span class="line">640</span><br><span class="line">641</span><br><span class="line">642</span><br><span class="line">643</span><br><span class="line">644</span><br><span class="line">645</span><br><span class="line">646</span><br><span class="line">647</span><br><span class="line">648</span><br><span class="line">649</span><br><span class="line">650</span><br><span class="line">651</span><br><span class="line">652</span><br><span class="line">653</span><br><span class="line">654</span><br><span class="line">655</span><br><span class="line">656</span><br><span class="line">657</span><br><span class="line">658</span><br><span class="line">659</span><br><span class="line">660</span><br><span class="line">661</span><br><span class="line">662</span><br><span class="line">663</span><br><span class="line">664</span><br><span class="line">665</span><br><span class="line">666</span><br><span class="line">667</span><br><span class="line">668</span><br><span class="line">669</span><br><span class="line">670</span><br><span class="line">671</span><br><span class="line">672</span><br><span class="line">673</span><br><span class="line">674</span><br><span class="line">675</span><br><span class="line">676</span><br><span class="line">677</span><br><span class="line">678</span><br><span class="line">679</span><br><span class="line">680</span><br><span class="line">681</span><br><span class="line">682</span><br><span class="line">683</span><br><span class="line">684</span><br><span class="line">685</span><br><span class="line">686</span><br><span class="line">687</span><br><span class="line">688</span><br><span class="line">689</span><br><span class="line">690</span><br><span class="line">691</span><br><span class="line">692</span><br><span class="line">693</span><br><span class="line">694</span><br><span class="line">695</span><br><span class="line">696</span><br><span class="line">697</span><br><span class="line">698</span><br><span class="line">699</span><br><span class="line">700</span><br><span class="line">701</span><br><span class="line">702</span><br><span class="line">703</span><br><span class="line">704</span><br><span class="line">705</span><br><span class="line">706</span><br><span class="line">707</span><br><span class="line">708</span><br><span class="line">709</span><br><span class="line">710</span><br><span class="line">711</span><br><span class="line">712</span><br><span class="line">713</span><br><span class="line">714</span><br><span class="line">715</span><br><span class="line">716</span><br><span class="line">717</span><br><span class="line">718</span><br><span class="line">719</span><br><span class="line">720</span><br><span class="line">721</span><br><span class="line">722</span><br><span class="line">723</span><br><span class="line">724</span><br><span class="line">725</span><br><span class="line">726</span><br><span class="line">727</span><br><span class="line">728</span><br><span class="line">729</span><br><span class="line">730</span><br><span class="line">731</span><br><span class="line">732</span><br><span class="line">733</span><br><span class="line">734</span><br><span class="line">735</span><br><span class="line">736</span><br><span class="line">737</span><br><span class="line">738</span><br><span class="line">739</span><br><span class="line">740</span><br><span class="line">741</span><br><span class="line">742</span><br><span class="line">743</span><br><span class="line">744</span><br><span class="line">745</span><br><span class="line">746</span><br><span class="line">747</span><br><span class="line">748</span><br><span class="line">749</span><br><span class="line">750</span><br><span class="line">751</span><br><span class="line">752</span><br><span class="line">753</span><br><span class="line">754</span><br><span class="line">755</span><br><span class="line">756</span><br><span class="line">757</span><br></pre></td><td class="code"><pre><span class="line">"===========================================================================</span><br><span class="line">" Filename: vimrc</span><br><span class="line">" Author: HM</span><br><span class="line">" Email: wangbandi#gmail.com</span><br><span class="line">" Homepage: http://huangming.github.io</span><br><span class="line">" Created: 2015.03.30</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><br><span class="line">" Plugin</span><br><span class="line">" _________________________</span><br><span class="line">"</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Vundle</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">set nocompatible " be iMproved, required</span><br><span class="line">filetype off " required</span><br><span class="line"></span><br><span class="line">" set the runtime path to include Vundle and initialize</span><br><span class="line">set rtp+=~/vimfiles/bundle/Vundle.vim</span><br><span class="line">" alternatively, pass a path where Vundle should install plugins</span><br><span class="line">call vundle#begin('~/vimfiles/bundle')</span><br><span class="line"></span><br><span class="line">" let Vundle manage Vundle, required</span><br><span class="line">Plugin 'gmarik/Vundle.vim'</span><br><span class="line"></span><br><span class="line">" Plugin 'Shougo/vimproc'</span><br><span class="line">" Plugin 'Shougo/vimshell.vim'</span><br><span class="line"></span><br><span class="line">Plugin 'bufexplorer.zip'</span><br><span class="line">let g:bufExplorerSplitBelow=1 </span><br><span class="line">Plugin 'scrooloose/nerdtree'</span><br><span class="line">Plugin 'jistr/vim-nerdtree-tabs'</span><br><span class="line">if executable('ctags')</span><br><span class="line"> Plugin 'majutsushi/tagbar'</span><br><span class="line">endif</span><br><span class="line">if executable('git')</span><br><span class="line"> Plugin 'tpope/vim-fugitive'</span><br><span class="line">endif</span><br><span class="line">Plugin 'tpope/vim-surround'</span><br><span class="line">Plugin 'tpope/vim-unimpaired'</span><br><span class="line">Plugin 'Align'</span><br><span class="line">Plugin 'tpope/vim-commentary'</span><br><span class="line">autocmd FileType vim set commentstring=\"\ %s</span><br><span class="line">autocmd FileType vbnet set commentstring=\'\ %s</span><br><span class="line">Plugin 'vim-scripts/VisIncr'</span><br><span class="line">Plugin 'drmingdrmer/xptemplate'</span><br><span class="line">Plugin 'Shougo/neocomplcache.vim'</span><br><span class="line"></span><br><span class="line">Plugin 'calendar.vim'</span><br><span class="line">Plugin 'Stormherz/tablify'</span><br><span class="line">Plugin 'vimwiki'</span><br><span class="line">Plugin 'yianwillis/vimcdoc'</span><br><span class="line">Plugin 'huangming/myvimplugin'</span><br><span class="line"></span><br><span class="line">Plugin 'VOoM'</span><br><span class="line">" Plugin 'vim-scripts/txt.vim--xu'</span><br><span class="line">Plugin 'ap/vim-css-color'</span><br><span class="line">Plugin 'nathanaelkane/vim-indent-guides'</span><br><span class="line"> let g:indent_guides_enable_on_vim_startup = 1</span><br><span class="line">Plugin 'michaeljsmith/vim-indent-object'</span><br><span class="line"> let g:indentobject_meaningful_indentation = ["haml", "sass", "python", "yaml", "markdown", "vbnet"]</span><br><span class="line"></span><br><span class="line">Plugin 'scrooloose/syntastic'</span><br><span class="line">" let g:syntastic_python_checkers = ['pylint']</span><br><span class="line">let g:syntastic_python_checkers = ['python']</span><br><span class="line">let g:syntastic_enable_python_checker = 1</span><br><span class="line">set statusline+=%#warningmsg#</span><br><span class="line">set statusline+=%{SyntasticStatuslineFlag()}</span><br><span class="line">set statusline+=%*</span><br><span class="line">let g:syntastic_always_populate_loc_list = 1</span><br><span class="line">let g:syntastic_auto_loc_list = 1</span><br><span class="line">let g:syntastic_check_on_open = 1</span><br><span class="line">let g:syntastic_check_on_wq = 0</span><br><span class="line"></span><br><span class="line">if has('gui_running')</span><br><span class="line"> Plugin 'Lokaltog/vim-powerline'</span><br><span class="line">endif</span><br><span class="line">Plugin 'Color-Scheme-Explorer'</span><br><span class="line">Plugin 'baskerville/bubblegum'</span><br><span class="line">Plugin 'altercation/vim-colors-solarized'</span><br><span class="line">Plugin 'chriskempson/vim-tomorrow-theme'</span><br><span class="line">Plugin 'tomasr/molokai'</span><br><span class="line"></span><br><span class="line">" Git plugin not hosted on GitHub</span><br><span class="line">" Plugin 'git://git.wincent.com/command-t.git'</span><br><span class="line"></span><br><span class="line">" git repos on your local machine ( .e. when working on your own plugin)</span><br><span class="line">" Plugin 'file:///home/gmarik/path/to/plugin'</span><br><span class="line"></span><br><span class="line">" The sparkup vim script is in a subdirectory of this repo called vim.</span><br><span class="line">" Pass the path to set the runtimepath properly.</span><br><span class="line">" Plugin 'rstacruz/sparkup', {'rtpa': 'vim/'}</span><br><span class="line"></span><br><span class="line">" Avoid a name conflict with L9</span><br><span class="line">" Plugin 'user/L9', {'name': 'newL9'}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">" non github repos</span><br><span class="line">call vundle#end()</span><br><span class="line">filetype plugin indent on " required!</span><br><span class="line"> "</span><br><span class="line"> " Brief help</span><br><span class="line"> " :PluginList - list configured bundles</span><br><span class="line"> " :PluginInstall(!) - install(update) bundles</span><br><span class="line"> " :PluginSearch(!) foo - search(or refresh cache first) for foo</span><br><span class="line"> " :PluginClean(!) - confirm(or auto-approve) removal of unused bundles</span><br><span class="line"> "</span><br><span class="line"> " see :h vundle for more details or wiki for FAQ</span><br><span class="line"> " NOTE: comments after Plugin command are not allowed..</span><br><span class="line"></span><br><span class="line">" _________________________</span><br><span class="line">"</span><br><span class="line">" General settings</span><br><span class="line">" _________________________</span><br><span class="line">"</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => General settings</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">set fileencodings=utf-8,chinese,ucs-bom</span><br><span class="line">set encoding=utf-8</span><br><span class="line">set fileencoding=utf-8</span><br><span class="line">" set ambiwidth=double</span><br><span class="line">set termencoding=utf-8</span><br><span class="line">"vim 提示信息乱码解决方法 </span><br><span class="line">"language messages zh_CN.UTF-8 </span><br><span class="line">if has("win32") </span><br><span class="line"> set termencoding=chinese </span><br><span class="line"> language message zh_CN.UTF-8 </span><br><span class="line">endif </span><br><span class="line"></span><br><span class="line">set history=100</span><br><span class="line">syntax on</span><br><span class="line">set cursorline</span><br><span class="line">set scrolloff=5</span><br><span class="line">set cmdheight=2</span><br><span class="line">set report=0</span><br><span class="line">set helplang=cn</span><br><span class="line">"set t_Co=256</span><br><span class="line">" set background=light</span><br><span class="line">set bsdir=buffer</span><br><span class="line">set nocompatible</span><br><span class="line">set autochdir</span><br><span class="line">set listchars=tab:>\ ,eol:$,extends:>,precedes:< " Unprintable chars mapping </span><br><span class="line">set showbreak=->\ \ \ </span><br><span class="line">set wildignore=.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc</span><br><span class="line">set showcmd</span><br><span class="line">set shortmess=at " Avoids 'hit enter'</span><br><span class="line">au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif</span><br><span class="line">let mapleader=',' " Change the mapleader</span><br><span class="line">let maplocalleader='\' " Change the maplocalleader</span><br><span class="line"></span><br><span class="line">"--------------------------------------------------------------------------</span><br><span class="line">" => Colorscheme</span><br><span class="line">"--------------------------------------------------------------------------</span><br><span class="line">"colorscheme solarized</span><br><span class="line">exec 'colorscheme '.["bubblegum-256-light","solarized","Tomorrow","molokai","bubblegum-256-dark","molokai"][strftime("%S")%6] </span><br><span class="line"></span><br><span class="line">"--------------------------------------------------------------------------</span><br><span class="line">" => Status bar</span><br><span class="line">"--------------------------------------------------------------------------</span><br><span class="line">" Only have cursorline in current window and in normal window</span><br><span class="line">autocmd WinLeave * set nocursorline</span><br><span class="line">autocmd WinEnter * set cursorline</span><br><span class="line">auto InsertEnter * set nocursorline</span><br><span class="line">auto InsertLeave * set cursorline</span><br><span class="line">set laststatus=1</span><br><span class="line"></span><br><span class="line">"set statusline+=%{fugitive#head()}</span><br><span class="line">set ruler " bottom status bar</span><br><span class="line">" set rulerformat=%45(%=\:b%n%m%r\ %Y\ %{fugitive#head()}\ %l,%c%V\ %P%)</span><br><span class="line">set rulerformat=%25(%n%m%r:\ %Y\ [%l,%v]\ %p%%%)</span><br><span class="line">highlight StatusLine guifg=SlateBlue guibg=Yellow</span><br><span class="line">highlight StatusLineNC guifg=Gray guibg=White</span><br><span class="line">if version >= 700 " change color when enter inser motion</span><br><span class="line"> au InsertEnter * hi StatusLine guibg=#818D2d guifg=#FCFCFC gui=none</span><br><span class="line"> au InsertLeave * hi StatusLine guibg=Yellow guifg=SlateBlue gui=none</span><br><span class="line">endif</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Gui settings</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">if has("gui_running")</span><br><span class="line"> "au GUIEnter * simalt ~x " maximun window</span><br><span class="line"> set guioptions-=m " menu bar</span><br><span class="line"> set guioptions-=T " tools bar</span><br><span class="line"> "set guioptions-=L " left scroll bar</span><br><span class="line"> set guioptions-=r " right scroll bar</span><br><span class="line"> "set guioptions-=b " bottom scroll bar</span><br><span class="line"> set showtabline=0 " tab bar</span><br><span class="line">endif</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Pos and size when start</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" winpos 350 150</span><br><span class="line">" winpos 250 200</span><br><span class="line">" set lines=25</span><br><span class="line">" set columns=85</span><br><span class="line">winpos 200 150</span><br><span class="line">set lines=30</span><br><span class="line">set columns=100</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Font</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">if has('gui_running')</span><br><span class="line"> if has("win32")</span><br><span class="line"> " set guifont=Lucida\ Console:h11:cANSI</span><br><span class="line"> set guifont=Yahei_Mono:h12.5</span><br><span class="line"> endif</span><br><span class="line">endif</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Tag label</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">set guitablabel=%m%N:%t\[%{tabpagewinnr(v:lnum)}\]</span><br><span class="line">set tabline=%!MyTabLine()</span><br><span class="line">function! MyTabLine()</span><br><span class="line"> let s=''</span><br><span class="line"> let t=tabpagenr() " The index of current page</span><br><span class="line"> let i=1</span><br><span class="line"> while i<=tabpagenr('$') " From the first page</span><br><span class="line"> let buflist=tabpagebuflist(i)</span><br><span class="line"> let winnr=tabpagewinnr(i)</span><br><span class="line"> let s.=(i==t?'%#TabLineSel#':'%#TabLine#')</span><br><span class="line"> let s.='%'.i.'T'</span><br><span class="line"> let s.=' '</span><br><span class="line"> let bufnr=buflist[winnr - 1]</span><br><span class="line"> let file=bufname(bufnr)</span><br><span class="line"> let m=''</span><br><span class="line"> if getbufvar(bufnr, "&modified")</span><br><span class="line"> let m='[+]'</span><br><span class="line"> endif</span><br><span class="line"> if file=~'\/.'</span><br><span class="line"> let file=substitute(file,'.*\/\ze.','','')</span><br><span class="line"> endif</span><br><span class="line"> if file==''</span><br><span class="line"> let file='[No Name]'</span><br><span class="line"> endif</span><br><span class="line"> let s.=m</span><br><span class="line"> let s.=i.':'</span><br><span class="line"> let s.=file</span><br><span class="line"> let s.='['.winnr.']'</span><br><span class="line"> let s.=' '</span><br><span class="line"> let i=i+1</span><br><span class="line"> endwhile</span><br><span class="line"> let s.='%T%#TabLineFill#%='</span><br><span class="line"> let s.=(tabpagenr('$')>1?'%999XX':'X')</span><br><span class="line"> return s</span><br><span class="line"> endfunction</span><br><span class="line">" Set up tab tooltips with every buffer name</span><br><span class="line">set guitabtooltip=%F</span><br><span class="line"></span><br><span class="line">" Alt+n</span><br><span class="line">if has("gui_running")</span><br><span class="line"> :map <silent> <C-S> :if expand("%") == ""<CR>:browse confirm w<CR>:else<CR>:confirm w<CR>:endif<CR></span><br><span class="line"> noremap <M-1> 1gt</span><br><span class="line"> noremap <M-2> 2gt</span><br><span class="line"> noremap <M-3> 3gt</span><br><span class="line"> noremap <M-4> 4gt</span><br><span class="line"> noremap <M-5> 5gt</span><br><span class="line"> noremap <M-6> 6gt</span><br><span class="line"> noremap <M-7> 7gt</span><br><span class="line"> noremap <M-8> 8gt</span><br><span class="line"> noremap <M-9> 9gt</span><br><span class="line"> noremap <M-0> 10gt</span><br><span class="line"> noremap <C-TAB> gt</span><br><span class="line"> noremap <C-F4> <ESC>:bd<CR></span><br><span class="line"> noremap tx <ESC>:bd<CR></span><br><span class="line">endif</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => File settings</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">set confirm " confirm when quit file</span><br><span class="line">set autoread " update file when it change external</span><br><span class="line">set backspace=indent,eol,start</span><br><span class="line">"set shortmess=atI " dont display tips when start</span><br><span class="line">" Set directories</span><br><span class="line">"set noswapfile</span><br><span class="line"></span><br><span class="line">set backup " Set backup</span><br><span class="line">" set undofile " Set undo</span><br><span class="line">" Set directories</span><br><span class="line">set backupdir=~/vimfiles/tmp/backup " backups</span><br><span class="line">set directory=~/vimfiles/tmp/swap " swap files</span><br><span class="line">set viewdir=~/vimfiles/tmp/view " view files</span><br><span class="line">set undodir=~/vimfiles/tmp/undo " undo files</span><br><span class="line"></span><br><span class="line">autocmd BufWinLeave *.* silent! mkview " Make Vim save view (state)(folds,cursor,etc)</span><br><span class="line">autocmd BufWinEnter *.* silent! loadview " Make Vim load view(state)(folds,cursor,etc)</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => File format and Typesetting</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">"set nowrap</span><br><span class="line">set virtualedit=insert " help virtualedit!</span><br><span class="line">set formatoptions=tcrqn " auto format</span><br><span class="line">set textwidth=10000 " the max column,auto wrap when eceeding</span><br><span class="line">set matchtime=5 " highlights time for Maching braces</span><br><span class="line">set showmatch " highlights for maching braces</span><br><span class="line">set nolinebreak " dont break on words</span><br><span class="line">set cindent " indent on c style</span><br><span class="line">set tabstop=4</span><br><span class="line">set shiftwidth=4</span><br><span class="line">set expandtab</span><br><span class="line">set modeline " autoload indent line setting</span><br><span class="line">au BufNewFile,BufReadPost *.html setl shiftwidth=2 tabstop=2 softtabstop=2 expandtab</span><br><span class="line">"au BufRead,BufNewFile *.css set ft=css syntax=css3</span><br><span class="line">"自动插入modeline</span><br><span class="line">func! AppendModeline()</span><br><span class="line"> let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d :",</span><br><span class="line"> \ &tabstop, &shiftwidth, &textwidth)</span><br><span class="line"> let l:modeline = substitute(&commentstring, "%s", l:modeline, "")</span><br><span class="line"> call append(line("$"), l:modeline)</span><br><span class="line">endfunc</span><br><span class="line">"按\ml,自动插入modeline</span><br><span class="line">nnoremap <silent> <Leader>ml :call AppendModeline()<CR></span><br><span class="line">" au BufWritePre *.Q ks|:silent %s/^scriptstart\s*=\s*\zs\d\+$/\=submatch(1).line('.')/|'s</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Auto completion</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">inoremap <C-]> <C-X><C-]></span><br><span class="line">inoremap <C-F> <C-X><C-F></span><br><span class="line">set complete+=]</span><br><span class="line">" line CTRL-X CTRL-L</span><br><span class="line">" keyword CTRL-X CTRL-N</span><br><span class="line">" dict CTRL-X CTRL-K</span><br><span class="line">" synonyms dict CTRL-X CTRL-T</span><br><span class="line">" key words CTRL-X CTRL-I</span><br><span class="line">" tags CTRL-X CTRL-]</span><br><span class="line">" file name CTRL-X CTRL-F</span><br><span class="line">" definitions CTRL-X CTRL-D</span><br><span class="line">" vim command CTRL-X CTRL-V</span><br><span class="line">" custom CTRL-X CTRL-U</span><br><span class="line">" spelling suggestions CTRL-X CTRL-S </span><br><span class="line">set wildmenu " command line auto-complete</span><br><span class="line">set completeopt=longest,menuone </span><br><span class="line">set wildmode=list:longest,full " Use powerful wildmenu</span><br><span class="line">set ic " ignore case</span><br><span class="line">set iskeyword+=.,_,$,@,%,#,- " about dict complete</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Search and replace</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">set hlsearch</span><br><span class="line">set incsearch " enter '/b' you can find the word begin with b</span><br><span class="line">set gdefault " replace all the lines match</span><br><span class="line">set ignorecase " ignore case</span><br><span class="line"></span><br><span class="line">" Open a Quickfix window for the last search.</span><br><span class="line">nnoremap <silent> <leader>? :execute 'vimgrep /'.@/.'/g %'<CR>:copen<CR></span><br><span class="line"></span><br><span class="line">" Highlight word </span><br><span class="line">highlight InterestingWord ctermbg=yellow guibg=yellow ctermfg=black guifg=#000000</span><br><span class="line">highlight InterestingWord1 ctermbg=green guibg=green ctermfg=black guifg=#000000</span><br><span class="line">highlight InterestingWord2 ctermbg=blue guibg=blue ctermfg=black guifg=#000000</span><br><span class="line">highlight InterestingWord3 ctermbg=red guibg=red ctermfg=white guifg=#FFFFFF</span><br><span class="line">nnoremap <silent> <leader>hh :execute 'match InterestingWord1 /\<<c-r><c-w>\>/'<cr></span><br><span class="line">nnoremap <silent> <leader>h1 :execute 'match InterestingWord1 /\<<c-r><c-w>\>/'<cr></span><br><span class="line">nnoremap <silent> <leader>h2 :execute '2match InterestingWord2 /\<<c-r><c-w>\>/'<cr></span><br><span class="line">nnoremap <silent> <leader>h3 :execute '3match InterestingWord3 /\<<c-r><c-w>\>/'<cr></span><br><span class="line"></span><br><span class="line">"-------------------------------------------------</span><br><span class="line">" => Fold Related</span><br><span class="line">"-------------------------------------------------</span><br><span class="line"></span><br><span class="line">set foldenable</span><br><span class="line">"set foldopen = "all"</span><br><span class="line">set foldmethod=syntax</span><br><span class="line">set foldcolumn=0</span><br><span class="line">setlocal foldlevel=0</span><br><span class="line">set foldlevelstart=99 " dont fold when open file</span><br><span class="line"></span><br><span class="line">" Space to toggle and create folds.</span><br><span class="line">nnoremap <silent><Space> @=(foldlevel('.')?'za':"\<Space>")<CR></span><br><span class="line">vnoremap <Space> zf</span><br><span class="line"></span><br><span class="line">" Set foldtext</span><br><span class="line">function! MyFoldText()</span><br><span class="line"> let line=getline(v:foldstart)</span><br><span class="line"> let nucolwidth=&foldcolumn+&number*&numberwidth</span><br><span class="line"> let windowwidth=winwidth(0)-nucolwidth-3</span><br><span class="line"> let foldedlinecount=v:foldend-v:foldstart+1</span><br><span class="line"> let onetab=strpart(' ', 0, &tabstop)</span><br><span class="line"> let line=substitute(line, '\t', onetab, 'g')</span><br><span class="line"> let line=strpart(line, 0, windowwidth-2-len(foldedlinecount))</span><br><span class="line"> let fillcharcount=windowwidth-len(line)-len(foldedlinecount)</span><br><span class="line"> return line.'…'.repeat(" ",fillcharcount).foldedlinecount.'…'.' '</span><br><span class="line">endfunction</span><br><span class="line">set foldtext=MyFoldText()</span><br><span class="line">"--------------------------------------------------------------------------</span><br><span class="line">" => Special file style</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">au BufRead,BufNewFile {Gemfile,Rakefile,Capfile,*.rake,config.ru} set ft=ruby</span><br><span class="line">au BufRead,BufNewFile {*.md,*.mkd,*.markdown} set ft=markdown</span><br><span class="line">au BufRead,BufNewFile {*.txt} set ft=txt</span><br><span class="line">au BufRead,BufNewFile {*.tabl} set nowrap</span><br><span class="line">"function! CtagsUpdata()</span><br><span class="line">" let s:pwd = $PWD</span><br><span class="line">" call system( 'cd ' . g:projecthome . ' && ctags -R' )</span><br><span class="line">" call system( 'cd ' . s:pwd ) | execute 'cd ' . s:pwd</span><br><span class="line">" execute 'set tags=' . g:default_tag</span><br><span class="line">" execute 'set tags+=' . g:projecthome . 'tags'</span><br><span class="line">" args *.c</span><br><span class="line">" argdo set ff=unix | update</span><br><span class="line">"endfunction</span><br><span class="line">"autocmd BufNewFile *.Q 0r ~/.vim/template/skeleton.q "</span><br><span class="line">"noremap <F12> : !ctags --langdef=vbnet --langmap=Asp:*.Q.<cr></span><br><span class="line">"noremap <C-F12> : argg tags\|argdo set fenc=utf-8\|update<cr></span><br><span class="line">set tags=./tags,tags</span><br><span class="line"></span><br><span class="line">" Python section</span><br><span class="line">" Run the current buffer in python - ie. on leader+space</span><br><span class="line">autocmd FileType python set textwidth=79 " PEP-8 Friendly</span><br><span class="line">" New Python file template</span><br><span class="line">autocmd bufnewfile *.py call setline(1,'#!/usr/bin/env python') |</span><br><span class="line"> \ call setline(2,'#coding:utf-8') |</span><br><span class="line"> \ call setline(3,"#Created Time: ".strftime("%c")) |</span><br><span class="line"> \ call setline(4,'#author: Cactus') |</span><br><span class="line"> \ call setline(5,'') |</span><br><span class="line"> \ call setline(6,'') |</span><br><span class="line"> \ exe "normal G"</span><br><span class="line"></span><br><span class="line">" Markdown</span><br><span class="line">augroup ft_markdown</span><br><span class="line"> autocmd!</span><br><span class="line"> " Use <localLeader>1/2/3/4/5/6 to add headings</span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>1 I# <ESC></span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>2 I## <ESC></span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>3 I### <ESC></span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>4 I#### <ESC></span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>5 I##### <ESC></span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>6 I###### <ESC></span><br><span class="line"> " Use <LocalLeader>b to add blockquotes in normal and visual mode</span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>b I> <ESC></span><br><span class="line"> autocmd Filetype markdown vnoremap <buffer> <localLeader>b :s/^/> /<CR></span><br><span class="line"> " Use <localLeader>ul and <localLeader>ol to add list symbols in visual mode</span><br><span class="line"> autocmd Filetype markdown vnoremap <buffer> <localLeader>ul :s/^/* /<CR></span><br><span class="line"> autocmd Filetype markdown vnoremap <buffer> <LocalLeader>ol :s/^/\=(line(".")-line("'<")+1).'. '/<CR></span><br><span class="line"> " Use <localLeader>e1/2/3 to add emphasis symbols</span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>e1 I*<ESC>A*<ESC></span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>e2 I**<ESC>A**<ESC></span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <localLeader>e3 I***<ESC>A***<ESC></span><br><span class="line"> " Use <Leader>P to preview markdown file in browser</span><br><span class="line"> autocmd Filetype markdown nnoremap <buffer> <Leader>P :MarkdownPreview<CR></span><br><span class="line">augroup END</span><br><span class="line"></span><br><span class="line">"--------------------------------------------------------------------------</span><br><span class="line">" => Key map</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line"></span><br><span class="line">" clear highlight after search</span><br><span class="line">noremap <silent><Leader>/ :nohls<CR></span><br><span class="line"></span><br><span class="line">" Use sane regexes</span><br><span class="line">nnoremap / /\v</span><br><span class="line">vnoremap / /\v</span><br><span class="line">cnoremap s/ s/\v</span><br><span class="line">nnoremap ? ?\v</span><br><span class="line">vnoremap ? ?\v</span><br><span class="line">cnoremap s? s?\v</span><br><span class="line"></span><br><span class="line">" Keep search matches in the middle of the window</span><br><span class="line">nnoremap n nzzzv</span><br><span class="line">nnoremap N Nzzzv</span><br><span class="line">nnoremap * *zzzv</span><br><span class="line">nnoremap # #zzzv</span><br><span class="line">nnoremap g* g*zzzv</span><br><span class="line">nnoremap g# g#zzzv</span><br><span class="line"></span><br><span class="line">" Visual search mappings</span><br><span class="line">function! s:VSetSearch()</span><br><span class="line"> let temp=@@</span><br><span class="line"> normal! gvy</span><br><span class="line"> let @/='\V'.substitute(escape(@@, '\'), '\n', '\\n', 'g')</span><br><span class="line"> let @@=temp</span><br><span class="line">endfunction</span><br><span class="line">vnoremap * :<C-U>call <SID>VSetSearch()<CR>//<CR></span><br><span class="line">vnoremap # :<C-U>call <SID>VSetSearch()<CR>??<CR></span><br><span class="line"></span><br><span class="line">nmap wv <C-w>v " vertical spilt window</span><br><span class="line">nmap wc <C-w>c " colse the current window</span><br><span class="line">nmap ws <C-w>s " spilt window horizontally</span><br><span class="line"></span><br><span class="line">" Begining & End of line in Normal mode</span><br><span class="line">noremap H ^</span><br><span class="line">noremap L g_</span><br><span class="line"></span><br><span class="line">" Redesign moving keys in insert mode</span><br><span class="line">"inoremap <C-K> <Up></span><br><span class="line">"inoremap <C-J> <Down></span><br><span class="line">inoremap <C-H> <Left></span><br><span class="line">inoremap <C-L> <Right></span><br><span class="line"></span><br><span class="line">" Make j and k work the way you expect</span><br><span class="line">nnoremap j gj</span><br><span class="line">nnoremap k gk</span><br><span class="line">vnoremap j gj</span><br><span class="line">vnoremap k gk</span><br><span class="line"></span><br><span class="line">" Same when jumping around</span><br><span class="line">nnoremap g; g;zz</span><br><span class="line">nnoremap g, g,zz</span><br><span class="line"></span><br><span class="line">" Navigation between windows</span><br><span class="line">nnoremap <C-H> <C-W>h</span><br><span class="line">nnoremap <C-J> <C-W>j</span><br><span class="line">nnoremap <C-K> <C-W>k</span><br><span class="line">nnoremap <C-L> <C-W>l</span><br><span class="line">nnoremap <C-O> <C-W>o</span><br><span class="line"></span><br><span class="line">" Reselect visual block after indent/outdent</span><br><span class="line">vnoremap < <gv</span><br><span class="line">vnoremap > >gv</span><br><span class="line"></span><br><span class="line">" Copy paste system clipboard</span><br><span class="line">map <leader>y "+y</span><br><span class="line">map <leader>p "+p</span><br><span class="line">map <leader>P "+P</span><br><span class="line">imap <c-v> <c-r>+</span><br><span class="line">" 把||之间的运行结果输出到剪切板</span><br><span class="line">" 把||之间的行数内容复制到剪切板</span><br><span class="line">nmap ,cn :redir @+\|\|redir END<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left></span><br><span class="line">nmap ,cm :silent redir @+\|for i in []\|echo getline(i)\|endfor\|redir END<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left></span><br><span class="line"></span><br><span class="line">" Quit help easily</span><br><span class="line">function! QuitWithQ()</span><br><span class="line"> if &buftype == 'help'</span><br><span class="line"> nnoremap <buffer> <silent> q :q<cr></span><br><span class="line"> endif</span><br><span class="line">endfunction</span><br><span class="line">autocmd FileType help exe QuitWithQ()</span><br><span class="line"></span><br><span class="line">" Easy buffer navigation</span><br><span class="line">noremap <leader>bp :bprevious<cr></span><br><span class="line">noremap <leader>bn :bnext<cr></span><br><span class="line"></span><br><span class="line">nmap gx yiw/^(def)\s+<C-R>"<CR> </span><br><span class="line"></span><br><span class="line">" Quick editing </span><br><span class="line">nnoremap <Leader>ev :tabedit $MYVIMRC<CR></span><br><span class="line">nnoremap <silent> <LocalLeader>rs :source $MYVIMRC<CR></span><br><span class="line">map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/</span><br><span class="line"></span><br><span class="line">" When vimrc is edited, reload it</span><br><span class="line">autocmd! BufWritePost _vimrc source $MYVIMRC</span><br><span class="line"></span><br><span class="line">" better ESC</span><br><span class="line">inoremap jk <Esc></span><br><span class="line">inoremap jkl <Esc>:</span><br><span class="line">nmap ; :</span><br><span class="line">" automatically leave insert mode after 4 seconds of inaction</span><br><span class="line">au CursorHoldI * stopinsert</span><br><span class="line">set ut=4000</span><br><span class="line">set nu</span><br><span class="line">nmap <leader>n :call NumberToggle()<CR></span><br><span class="line">function! NumberToggle()</span><br><span class="line"> if(&relativenumber == 1)</span><br><span class="line"> set number</span><br><span class="line"> elseif(&number == 1)</span><br><span class="line"> set nonumber</span><br><span class="line"> else</span><br><span class="line"> set relativenumber</span><br><span class="line"> endif</span><br><span class="line">endfunction </span><br><span class="line"></span><br><span class="line"></span><br><span class="line">" Fast saving and closing current buffer without closing windows displaying the buffer</span><br><span class="line">nmap <leader>wq :w!<cr>:bdelete<cr></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Complie and run program</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" 通过log文件打印错误/调试内容 </span><br><span class="line">"function QfMakeConv()</span><br><span class="line">" let qflist = getqflist()</span><br><span class="line">" for i in qflist</span><br><span class="line">" let i.text = iconv(i.text, "cp936", "utf-8")</span><br><span class="line">" endfor</span><br><span class="line">" call setqflist(qflist)</span><br><span class="line">"endfunction</span><br><span class="line">"au QuickfixCmdPost make call QfMakeConv()</span><br><span class="line"></span><br><span class="line">" map <F9> :call CompileRunQ()<CR></span><br><span class="line">" func! CompileRunQ()</span><br><span class="line">" set errorformat=%f,第%l行:%m</span><br><span class="line">" " let &errorformat=iconv("%f第%l行%m", "utf-8", &enc)</span><br><span class="line">" exec "cexpr[]"</span><br><span class="line">" exec "caddf E:\\Dropbox\\tmp\\tmp.txt"</span><br><span class="line">" exec "copen"</span><br><span class="line">" " call QfMakeConv()</span><br><span class="line">" endfunc</span><br><span class="line"></span><br><span class="line">func! CheckPythonSyntax()</span><br><span class="line"> " w</span><br><span class="line"> let mp = &makeprg</span><br><span class="line"> let ef = &errorformat</span><br><span class="line"> let exeFile = expand("%:t")</span><br><span class="line"> setlocal makeprg=python\ -u</span><br><span class="line"> set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m</span><br><span class="line"> silent make %</span><br><span class="line"> cw</span><br><span class="line"> let &makeprg = mp</span><br><span class="line"> let &errorformat = ef</span><br><span class="line">endfunction</span><br><span class="line">au FileType python map <F5> :call CheckPythonSyntax()<CR></span><br><span class="line"></span><br><span class="line">"--------------------------------------------------</span><br><span class="line">" => Tagbar</span><br><span class="line">"--------------------------------------------------</span><br><span class="line">nnoremap <Leader>t :TagbarToggle<CR></span><br><span class="line">"let g:tagbar_ctags_bin='ctags'</span><br><span class="line">let g:tagbar_autofocus=1</span><br><span class="line">let g:tagbar_expand=1</span><br><span class="line">let g:tagbar_foldlevel=2</span><br><span class="line">let g:tagbar_ironchars=['?', '?']</span><br><span class="line">let g:tagbar_autoshowtag=1</span><br><span class="line">let g:tagbar_width = 30</span><br><span class="line"></span><br><span class="line">"--------------------------------------------------</span><br><span class="line">" => NERD_tree</span><br><span class="line">"--------------------------------------------------</span><br><span class="line">nnoremap <Leader>d :NERDTreeTabsToggle<CR></span><br><span class="line">nnoremap <Leader>f :NERDTreeFind<CR></span><br><span class="line">let NERDTreeChDirMode=2</span><br><span class="line">let NERDTreeShowBookmarks=1</span><br><span class="line">let NERDTreeShowHidden=1</span><br><span class="line">let NERDTreeShowLineNumbers=0</span><br><span class="line">let NERDTreeDirArrows=0</span><br><span class="line">let g:nerdtree_tabs_open_on_gui_startup=0 "(default: 1)Open NERDTree on gvim/macvim startup</span><br><span class="line">let g:nerdtree_tabs_open_on_console_startup=0 "(default: 0)Open NERDTree on console vim startup</span><br><span class="line"></span><br><span class="line">"--------------------------------------------------</span><br><span class="line">" => fugitive</span><br><span class="line">"--------------------------------------------------</span><br><span class="line">if executable('git')</span><br><span class="line"> nnoremap <silent> <leader>gs :Gstatus<CR></span><br><span class="line"> nnoremap <silent> <leader>gd :Gdiff<CR></span><br><span class="line"> nnoremap <silent> <leader>gc :Gcommit<CR></span><br><span class="line"> nnoremap <silent> <leader>gb :Gblame<CR></span><br><span class="line"> nnoremap <silent> <leader>gl :Glog<CR></span><br><span class="line"> nnoremap <silent> <leader>gp :Git push<CR></span><br><span class="line">" Automatically remove fugitive buffers</span><br><span class="line">autocmd BufReadPost fugitive://* set bufhidden=delete</span><br><span class="line">endif</span><br><span class="line"></span><br><span class="line">"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">" set jedi</span><br><span class="line">"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">"let g:jedi#goto_command = "<leader>d"</span><br><span class="line">let g:jedi#goto_assignments_command = "<leader>g"</span><br><span class="line">let g:jedi#goto_definitions_command = "<leader>d"</span><br><span class="line">let g:jedi#documentation_command = "K"</span><br><span class="line">let g:jedi#usages_command = "<leader>n"</span><br><span class="line">let g:jedi#completions_command = "<C-Space>"</span><br><span class="line">let g:jedi#rename_command = "<leader>rname"</span><br><span class="line"></span><br><span class="line">"--------------------------------------------------------</span><br><span class="line">" => xptemplate.vim设置</span><br><span class="line">"--------------------------------------------------------</span><br><span class="line">"let g:xptemplate_brace_complete = 1</span><br><span class="line">let g:xptemplate_brace_complete = '([''"'</span><br><span class="line">" if nothing matched in xpt, try c-p </span><br><span class="line">let g:xptemplate_fallback = '<C-p>'</span><br><span class="line"> </span><br><span class="line">" avoid key conflict</span><br><span class="line">"let g:SuperTabMappingForward = '<Plug>supertabKey'</span><br><span class="line"></span><br><span class="line">" if nothing matched in xpt, try supertab</span><br><span class="line">"let g:xptemplate_fallback = '<Plug>supertabKey'</span><br><span class="line"></span><br><span class="line">" xpt uses <Tab> as trigger key</span><br><span class="line">let g:xptemplate_key = '<Tab>'</span><br><span class="line"></span><br><span class="line">"let g:xptemplate_always_show_pum=1 </span><br><span class="line">" use <tab>/<S-tab> to navigate through popup menu //NOT necessary. </span><br><span class="line">let g:xptemplate_pum_tab_nav = 1</span><br><span class="line">let g:xptemplate_nav_cancel = '<C-c>'</span><br><span class="line">" xpt triggers only when you typed whole name of a snippet. //NOT necessary. </span><br><span class="line">let g:xptemplate_minimal_prefix = 'full'</span><br><span class="line">inoremap <expr> <CR> pumvisible() ? "\<C-Y><c-r>=XPTemplateStart(0)<cr>" : "\<CR>"</span><br><span class="line">inoremap <expr> <C-n> pumvisible() ? '<C-n>' : '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'</span><br><span class="line">snoremap <expr> <C-p> pumvisible() ? '<C-n>' : '<C-p><C-r>=pumvisible() ? "\<lt>Up>" : ""<CR>'</span><br><span class="line"></span><br><span class="line">"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">" => Omni complete functions</span><br><span class="line">"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""</span><br><span class="line">"autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete</span><br><span class="line">autocmd FileType css set omnifunc=csscomplete#CompleteCSS</span><br><span class="line">autocmd FileType html set omnifunc=htmlcomplete#CompleteTags</span><br><span class="line">autocmd FileType python set omnifunc=pythoncomplete#Complete</span><br><span class="line">autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags</span><br><span class="line">autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS</span><br><span class="line">"autocmd FileType vbnet set omnifunc=javascriptcomplete#CompleteJ</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => surround.vim</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">xmap <Leader>sa <Plug>Vsurround</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Calendar</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">"let g:calendar_diary='/home/cactus/dev/diary'</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => VimWiki</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">let g:vimwiki_use_mouse = 1</span><br><span class="line">let g:vimwiki_camel_case = 0</span><br><span class="line">let g:vimwiki_hl_cb_checked = 1</span><br><span class="line">let g:vimwiki_CJK_length = 1</span><br><span class="line">let g:vimwiki_ext2syntax = {'.md': 'markdown',</span><br><span class="line"> \ '.mkd': 'markdown',</span><br><span class="line"> \ '.wiki': 'media'}</span><br><span class="line">let g:vimwiki_valid_html_tags ='b,i,s,u,sub,sup,kbd,br,hr,div'</span><br><span class="line"> let wiki_1 = {}</span><br><span class="line">" let wiki_1.index = 'VimWiki-@HM'</span><br><span class="line"> let wiki_1.path = '~/vimwiki/'</span><br><span class="line"> let wiki_1.path_html = '~/vimwiki/html'</span><br><span class="line"> let wiki_1.template_path = '~/vimwiki/template/'</span><br><span class="line"> let wiki_1.template_default = 'template1'</span><br><span class="line"> let wiki_1.template_ext = '.html'</span><br><span class="line"> let wiki_1.nested_syntaxes = {'python': 'python', 'c++': 'cpp'}</span><br><span class="line">" let wiki_1.syntax = 'markdown'</span><br><span class="line">" let wiki_1.ext = '.md'</span><br><span class="line"> let g:vimwiki_list = [wiki_1]</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => Grep</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">nnoremap <silent> <F3> :Grep<CR></span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => vim-indent-guides</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">let g:indent_guides_start_level=2</span><br><span class="line">let g:indent_guides_guide_size=1</span><br><span class="line">"nmap <silent> <Leader>ig <Plug>IndentGuidesToggle</span><br><span class="line"></span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">" => vim-powerline</span><br><span class="line">"---------------------------------------------------------------------------</span><br><span class="line">"let g:Powerline_symbols = 'fancy'</span><br><span class="line">set t_Co=256</span><br><span class="line">"let g:Powerline_symbols = 'unicode'</span><br><span class="line"></span><br><span class="line">" vim: set ts=4 sw=4 tw=10000 :</span><br></pre></td></tr></table></figure></p>
]]></content>
</entry>
<entry>
<title><![CDATA[QQ空间日记迁移声明]]></title>
<url>http://huangming.github.io/2012-03-11-qq-kongjian-qianyi.html</url>
<content type="html"><![CDATA[<h2>关于起因</h2>
<p>近半个月了,终于将这个博客弄的差不多了。最起码文章的排版格式还有各种高亮已经设定好。因为<a href="http://403169989.qzone.qq.com/" target="_blank" rel="external">QQ空间</a>已经好久没去维护了(qq空间蛋疼的各种不给力)今天突发奇想想把自己以前写的日记弄过来,多少可以回忆下以前的单纯与青涩。<br><a id="more"></a></p>
<h2>关于评论和留言</h2>
<p>经过整理才发现,以前真的是身在福中不知福。有那么多朋友一直关心我,支持我。而我没有好好去经营这份缘分,时间这把杀猪刀终于体现出了它的残忍。不知道现在还能挽回多少呢?不管如何,记录下这些,是我铭记一生的幸福。朋友们的评论都直接记录在文章后面了,等有时间再把<a href="http://403169989.qzone.qq.com/#!app=334&url=http%3A%2F%2Fcnc.qzs.qq.com%2Fqzone%2Fmsgboard%2Fmsgbcanvas.html%23uin%3D403169989%26pfid%3D2%26qz_ver%3D6%26appcanvas%3D0%26qz_style%3Dv6%2F88%26params%3D%26canvastype%3D" target="_blank" rel="external">留言板</a>和<a href="http://403169989.qzone.qq.com/#!app=311&url=http%3A%2F%2Fcnc.qzs.qq.com%2Fqzone%2Fapp%2Fmood_v6%2Fhtml%2Fprofile.html" target="_blank" rel="external">说说</a>里面的内容搬过来。</p>
<h2>关于内容</h2>
<p>迁移日记里面最晚的是2010年8月6日的,大部分都是09年以前的(我的高中时代)。10年8月6日后到现在都没再写日记。即是说10年8月6日以前的文章都是QQ空间迁移过来的。</p>
<h2 id="最后">最后</h2><p>不得不说,高中到大学,特别是高二高三那段时间,我变化真的好大。或许是叫做成长吧。只是这成长也太令人恐惧了。我已经好久好久没像以前一样去逛别人空间博客了,也好久没占朋友口头便宜了。。。现在面临踏入社会,那心思就更加提不起来了。可能也是我性格比较保守吧,现在就继续任性一下了,希望等安稳下来的时候一切有改变吧。<br>感觉自己一直像只笼子里的鸟或者说井底的蛙。虽然有各种枷锁,但都一直小打小闹。嗯,还没找到我自己的生命的意义~~觉得我适合做个和尚,当然是好吃好睡又好色的那种<img src="/images/e120.gif" alt=""></p>
]]></content>
</entry>
<entry>
<title><![CDATA[象棋人格]]></title>
<url>http://huangming.github.io/2009-04-12-xiangqi-renge.html</url>
<content type="html"><![CDATA[<p>今天学院举办了一场象棋棋王争霸赛,我报名参赛了。第一轮对手有事没来弃权直接进局。第二轮跟一个人下的时候我一开始就主动进攻,很快就占据主动,死死压住对手。到中局的时候,他开始晃脚做小动作了。我知道他被我压的焦躁起来了(其实,我已经进入一个更严重的状态)。对这个我有经验,离成功不远了呢。我下棋一直是这样,喜欢一开始就主动攻击,占据有力形势。而且,下棋的时候思考很少,利用的是瞬间智慧的闪光,没走一步用的时间嘟是很少的。走完一步就开始悠闲地看对手或者周围的景物。我喜欢那种悠闲地看对手认真思考的感觉。好像真的就一切嘟掌握在我手中,好像对手被我控制牵着鼻子走。就在我吃着棒棒糖看手上的纹路的时候(对手每次嘟思考很久让我等的花儿嘟谢了),对手一招炮打堵头士让我无语。就这样,一步就让我那么好的局势白费了。认输!多么简单的一步棋,甚至初学者嘟可以看出来的一步棋!被我忽略。。<br><a id="more"></a><br>很早以前我就知道自己有这样的毛病,总是在最辉煌最悠闲的时候,摔一个菜鸟嘟不会摔得跤,然后就直接满盘皆输。多年下棋嘟是这样。从概率学的角度看,这已经足够说明一个人的性格对所做事情的影响以及一个人的性格决定了他能有多大成就。其实象棋真的能够反映一个人的人品。从而能间接反映出他的人生路程。 </p>
<p>决定棋手成才的,除了智力因素外,还有非智力因素,其中气质对棋手的成功率影响较大。心理学把人的气质分为胆汁质、多血质、粘液质和抑郁质四种类型,但纯属单一类型的人是极少的,绝大多数人都以某一类型为主又兼其他类型的混合型。 </p>
<p>胆汁质的人精力旺盛、态度直率、激动暴躁,行动敏捷但欠精确,兴奋时热情埋头工作,失望时情绪顿时沮丧。表现在下棋时则勇于进攻,大刀阔斧,敢拼敢杀,喜欢弃子入局,但决策时往往不顾防御,所以在打比赛时,胜局虽多而败局难免,总成绩往往不够理想,成绩起伏较大。棋手中王嘉良和于幼华可以说是这一类的代表(貌似我也是,只是失败的时候我不会顿时沮丧。这也是值得安慰的一个好性格)。 </p>
<p>多血质的人机智灵活,善于交际,很易适应新的环境,工作能力强。但办事重兴趣,不够耐心,注意力不够持久。下棋时应变能力强,战术机动灵活,着法精巧动人,但在互缠局势中缺乏耐心,有时分散精力而出漏着。“十连冠”胡荣华可以说是这一类的代表(我也有这点倾向)。 </p>
<p>粘液质的人处事冷静,自制力较强,工作上专心致志埋头苦干,有恒心有耐力,有条理有规律。但对新鲜事物反应慢而不够灵活,有惰性。下棋时稳健细腻,思维严密,三思而后行,擅长下残棋作持久战。但顾虑较多,冲击力不足,在比赛中输棋较少而和棋较多,虽然也会影响总成绩,但成绩总是较为稳定。许银川是这一类棋手的代表。 </p>
<p>抑郁质的人沉静、含蓄,细心谨慎,但孤僻多愁,优柔寡断。下棋时胆小慎微,缺乏进取精神,对胜负患得患失。 </p>
<p>从象棋运动的特点看,棋手应能承受较长时间紧张比赛的高强度脑力负担,沉着冷静地对待局势的起落,灵活机动地应付棋局的千变万化,巧妙应变各种难题。所以棋手的气质以粘液质、多血质等类型较理想,胆汁质次之,抑郁质则不适合下棋。 </p>
<p>有时候通过下棋从侧面还可以看出一个人的心理近况。心理平静了,下棋考虑的比较远一些;如果心情比较浮躁,考虑将欠佳。 </p>
<p>急躁的人,往往不假思索,便急于出招。稳重的人,往往全盘敲定,步步紧逼显得阵法齐整,从容不度。性格孤傲的人,大都大刀阔斧,奉长驱直入之术。 性格刚毅的人,往往临危不慌,效于迂回挺进之功。暴戾的人,则不讲求战略战术,囿于硬拼死磨,有兑子险进之虞。自信的人,以持久耐战著称,系坚守寡进这策。</p>
<p>我的性格真的不是很好呢。只是要改变一个人真的不容易呢。已经20年了呢。经过这么多年的沉淀,已经根深蒂固了。也许,只有在生死考验下,人才能彻底的改变人格。以前听过好多大难不死然后整个人性格变的完全不一样的例子。所以,我也喜欢看恐怖片。既然现实中找不到或者不敢找机会经历生死考验,那么让恐怖片吓吓也可能改变性格呢~</p>
<p>既然知道不要就要彻底的改变它。我要从每个细节开始,只要在生活中注意没个瞬间,我相信我能改变自己。</p>
<p>讨厌需要长时间的耐力才能看出效果的事,这也是我的性格弱点呢。每次学点什么学了一会儿没什么进步就放弃。很多东西嘟是要经过长时间的积累,就像性格。我相信,我会成功,也许要经过很长很长时间。</p>
<p>但是,值得。 </p>
]]></content>
</entry>
<entry>
<title><![CDATA[天秤座]]></title>
<url>http://huangming.github.io/2009-02-21-tian-cheng-zuo.html</url>
<content type="html"><![CDATA[<p><strong>天平座的爱情</strong> 天平在爱情方面是一个为别人而活的星座。天平的被动更是让很多天平们错过了自己的真爱。天平不懂得拒绝,天平面对一个自己明明不喜欢的人,只要那人能主动积极一点,那天平是不会拒绝的,因为天平觉得拒绝会伤害你。为了不伤害你,天平只有牺牲自己。或者,天平会为你对他哪怕是一句关心的话而感动,就为了感谢你这句关心的话而和你在一起,因为天平永远都是追求平衡的,他认为你付出了哪怕是一句关心的话他就应该回报你,而不是真的因为爱你才和你在一起。(感动不等于爱)而且天平将“责任“二字看得太重,却又未认识到“责任“的真正精髓所在,以至于用了一种对自己极其残酷的方式给“责任“下着定义。天平不爱对方,却要坚持对对方不离不弃。这是一个力求公平的天平的善良抉择,更是一个近乎愚蠢的抉择。这是天平的悲哀。只能说天平懂得负责任,却真的不理解“责任“。可是懂得负责也变成了一种错误吗?天平认为责任比爱情重要,却未想过幸福也同样重要。你完全有理由责备天平,但是在你责备天平的同时可曾想过其实最可悲的正是天平。天平的要求真的不高,只是需要有人理解自己而已。但是,谁又能理解天平呢?<br><a id="more"></a><br>还有一点,天平在爱情方面确实是比较优柔寡断犹豫不决,这点必须承认。但是天平为什么会这样?因为天平想的事很多想的很远,天平觉得如果要爱一个人就要让对方快乐。这里说的“快乐“包括很多,比如说有没有足够的经济能力来维持平时和你在一起时的花销,能不能让你每天都开心,自己的朋友和父母会接受你吗?你的父母朋友能接受自己吗?甚至可能会想到结婚以后你们孩子的模样漂亮吗?。。。。。等等,还有许多问题!你说天平能不犹豫吗?天平是出了名的12个星座最懒的,如果不是因为爱你天平根本懒的考虑那么多!如果天平一旦确定你就是他深爱的人并且确定了你们的恋爱关系以后,那么这时候天平追求完美的一面就展现出来了。</p>
<p>这时的天平满脑子就是想如何做到最好让你觉得自己是世界上最幸福的人。和天平恋爱过的人应该都知道这一点吧,刚和天平恋爱时的感觉简直太完美了,一些只有在电影和小说里面出现的情景会经常出现在你们身上,你会感觉现在的你真的就是世界上最幸福的人。这时的天平只要每天能看到深爱的人开心一笑就算付出在大的代价也愿意!由于刚恋爱时的天平表现的太完美了,以至于对方已经习惯了天平的这种完美表现,这在对方的心理已经是对天平的一种标准,所以天平只要稍稍表现的不够以前好,对方就会不习惯,就会觉得天平不爱她了!可是,这个世界上谁也不可能永远都做的这么好,天平也不能,虽然这时天平依然深爱着对方!对方的抱怨让天平觉得自己很委屈,自己付出了那么多对方却还不满足,还说自己不够好,所以天平就会觉得自己的付出不值得,到最后当然就只剩下分手!</p>
<p>在这里给所有天平朋友一个忠告,细水常流,平平淡淡才是真,不可能每一天都是完美的!烟花确实绚烂,但是注定短暂!这里在特别说一下天平男。天平男花心吗?也许吧。但是所谓天平男的花心又和其他人不同,最原则性的不同在于天平男的花心跟爱情本身不关。所谓天平男的花心应该理解为是一种博爱。天平男认为世界上一切事物都是美好的,而女人更是这个美丽世界中的一个个艺术品。所以女人是要用来好好呵护的,与爱无关!这是天平男一种怜香惜玉的本质。这种本质是天平与生俱来的,是根深蒂固的。天平真正意义上爱一个人时是和那种怜香惜玉的爱是有本质上的区别的。天平真正爱上一个人时,天平在心中会把爱人奉为自己的女神,不仅有爱,更多的是一种尊敬甚至崇拜!反过来说,天平面对自己真正深爱的人时内心会有那么一点小小的自卑。这里的自卑不是平时大家所说的因某种缺陷自卑,这种自卑是相对于“完美“二字来说的。大家也许会怀疑,自信又自恋的天平也会自卑?是的,因为天平面对爱人的时候总希望自己做到完美,但是天平不明白完美只是一种传说一种境界,世界上没有人是完美的,天平也不能,所以这时天平就会产生自卑感。要求完美的天平对自己的不完美很不满意,觉得自己配不上心爱的人,所以很多天平宁愿选择放弃(其实天平在对方心目中天平已经很好了,只是当天平深爱一个人时鲜前昱=羌?。但是放弃不等于不爱。天平对自己深爱的人是一辈子都不会忘的。放弃对天平来说另一种爱,天平会永远把深爱的人深深埋在心里的某个角落默默的为对方祈祷祝福!天平不是因为寂寞才会爱上一个人,天平是因为爱上一个人才寂寞! </p>
<p>天平对于自己内心真正的想法很少对人倾诉,因为天平深知沉默才能坚强。所以,除了天平自己之外没有人能真正了解天平,除非你来生有幸作为一个天平时用生命来体会一次。。。。。。不管是谁对谁错,一切的过错都由天平背负着,任由人们误会,任由人们无端的指责甚至漫骂,天平只是轻描淡写的一笑而过,在人前永远保持着优雅的微笑。一切是命中注定,无需多言,我们即然是天秤,太懂得去分析事情的轻与重,善与恶,真与假了。所以说对于本身也是一种负罪吧。因为都看透了。对于真不真心,懂的人自然了解,不懂的人也不想再多说,因为我们是天秤,骄傲的天平!传说中有位骑士名叫天平,英俊,迷人,优雅,高贵。。。。。。黑夜中,西风吹过; 白马上,骑士仰望星空; 手中有剑,心中有爱,骑士正在为他心爱的人祈祷平安幸福!夜,还是那么黑。路,还有那么远。人,还那么寂寞!拍拍身上的灰尘,振作疲惫的精神,抚平疼痛的伤口,远方也许尽是坎坷路,骑士却仍然微笑着上路了—- 虽然心碎了无痕,依旧白马啸西风!</p>
<p><strong>关于天平的友情和人际关系</strong> “朋友“二字对于天平有多重要是一般人不能理解的。这么说吧,天平把友情看的重要。因为天平是一个特别害怕孤独的星座,天平不会享受孤独。每个天平都有轻微的抑郁症,孤独就是诱发天平抑郁症的罪魁祸首!而抑郁症的最大特点就是厌世,这绝不是危言耸听,孤独就是能让天平产生厌世的感觉。天平是活在人群中的人,只有在人群中天平才能找到自我的位置发挥自我的价值。所以天平总是希望自己的朋友多些在多些。对于自己不喜欢的人,天平虽不愿把他当做朋友但还是希望对方能把自己当成朋友,但凡是天平认识的人天平绝不会轻易得罪。为了维持这种和谐的关系,天平不的不圆滑一点虚伪一点,见人说人话见鬼说鬼话。其实天平真的很累的。绝大多数的时候,天平的朋友受到伤害和委屈了,天平总是第一时间出现在朋友旁边安慰和关心朋友,给朋友以最大的鼓励,但是当天平受伤时却很少得到这样的待遇。换句话说,天平的朋友看上去虽然很多,但是知心朋友却很少,能了解天平内心的更始微乎其微。天平对每个朋友都很好,而且都是一样的好,以至于大家都不知道天平对谁是真心真意对谁是虚情假意。天平一生都致力于创造一个自己心目中理想的和谐的美丽新世界,在那个世界中没有明争暗斗,没有尔虞我诈,大家都是好朋友,所有人都互相关心,互相照顾。总之,天平对朋友是最无私的,宁愿天下人负我,我不负天下人是天平对于与朋友关系的最好的一句话概括。如果你有朋友是天平的话,那么你应该感到幸运!</p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/710137381" target="_blank" rel="external">难为水</a><time>2009-03-17 21:53:56</time> </li>
<li>奈吾是天平痤…你信不信命的.?..有时真的很难说…</li>
<li><a href="http://user.qzone.qq.com/869308831" target="_blank" rel="external">西西</a><time>2009-05-02 09:01:49</time> </li>
<li>是天平座的?我在想那我是不是应该感到幸运呢?好吧,勉强算是吧!<img src="/images/e120.gif" alt=""></li>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2009-05-02 23:11:00</time></li>
<li>嗯~很典型的天平。不过也有说天平很虚伪的<del>各有优缺点啦</del>大家嘟很幸运啦 十二分之一得几率嘛~~ 神是很公平哒。</li>
<li><a href="http://user.qzone.qq.com/869308831" target="_blank" rel="external">西西</a><time>2009-05-03 00:13:00</time> </li>
<li>其实我只看了最后几句而已,没研究过这些东西,不懂<img src="/images/e120.gif" alt=""></li>
<li><a href="http://user.qzone.qq.com/260136976" target="_blank" rel="external">‘守望者</a><time>2009-10-22 07:16:10</time> </li>
<li>嗯,我赞同。真有这么傻,这么好。</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[我的十年感言]]></title>
<url>http://huangming.github.io/2008-12-01-10-nian-ganyan.html</url>
<content type="html"><![CDATA[<p><code>回忆1998年</code><br> 今年我十岁了,终于到了二位数年龄~好感动~~</p>
<p><code>回忆1999年</code><br> 今年11岁,11代表着光棍,孤独的岁月开始~~</p>
<p><code>回忆2000年</code><br> 今年是龙年,属龙的我注定飞黄腾达哈~~骗你的…小学数学竞赛拿奖了呗</p>
<p><code>回忆2001年</code><br> 今年?不知道有什么了,好像开始学会乐观吧~~</p>
<p><code>回忆2002年</code><br> 貌似我入团了呢 ~ 跟一大帮朋友瞎混~ 最开心的是那次野炊了~自己做的饭菜好好吃 ~</p>
<p><code>回忆2003年</code><br> 初二了吧,貌似是,额,貌似没什么。。。想想看。有了,玩封神榜的游戏通关了~~~哈哈,那纣王挺难打的</p>
<p><code>回忆2004年</code><br> 初三了呢,最开心的事是特招考试成功了,不用再去参加中考~~呵呵。。不过快中考的时候出水豆了~555,刚开始没去看医生,结果挺严重的~~~虽然快中考了,同学还是抽空来看我,好感动~</p>
<p><code>回忆2005年</code><br> 今年是高一呢,在城里读书,些许兴奋~~~最开心的是101宿舍里的打打闹闹啦 ~ 遗憾的是拍的同学的几张裸照曝光了,冲洗不了~~~还记得中段或期终后整个宿舍的在网吧通宵~那时候好可爱耶~让人暴汗的是那次随便在班群上找个人来骂,他也跟我斗嘴,结果后来知道是老师来的,瀑布汗~~嘿嘿,还记得一次跟粉仔通宵上网再回来数学竞赛,结果还拿奖了~</p>
<p><code>回忆2006年</code><br> 高二,额。。。开始T毽球~~让人气愤的是技术一直很烂~不是运动的料,不过经常去玩轮滑,觉得还不错~~心情不好就去轮滑~还学会了折很多纸东西~~貌似高二的成绩也一直很好~开始喜欢看书了~~</p>
<p><code>回忆2007年</code><br> 高三,是最郁闷的一年,整天混混沌沌,幻想,还是看小说好~~~放学后很多同学一起跑步,放松自己,还有T毽球,虽然技术不好,老被当同学的笑料,还是感觉蛮开心的~高考没考好,考外省了,决定重读~~</p>
<p><code>回忆2008年</code><br> 考中大了呗~~~来到中大,开阔了眼界啊~自己真的很渺小耶~就拿轮滑来说,走到这里简直就是菜鸟~~他们的技术真的不错~还有很多要学习的~~~很多很多东西都要自己找条件去学习~</p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/552311925" target="_blank" rel="external">D.E.M</a><time>2008-12-02 20:31:12</time> </li>
<li>呵呵。你的十年经历就被你几句话说完啦?不过你说的有些事我也知道耶。五年级数学竞赛第一名,初三特招考试成功,出水痘,但后来还有来上课。高一数学竞赛得奖。有一次我去一中看到那里贴的通知。高三结束后考了个外省重点,但你把通知书撕啦,去重读。最后考出了对你来说还不错的成绩。进入中大。之后关于你的事,我这个朋友就不知道啦。因为你呀,肯定重学习,重色轻友。害我伤肝伤心伤肺伤脾伤肾呀。 </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[o(∩_∩)o]]></title>
<url>http://huangming.github.io/2008-10-03-jintian-tianqi-bucuo.html</url>
<content type="html"><![CDATA[<p>今天天气真的不错~!~~~!!! </p>
]]></content>
</entry>
<entry>
<title><![CDATA[有个脑筋急转弯的题目,给大家震荡一下大脑]]></title>
<url>http://huangming.github.io/2008-09-27-naojing-jizhuanwan.html</url>
<content type="html"><![CDATA[<p>一天有个年轻人来到王老板的店里买了一件礼物这件礼物成本是18元,标价是21元。结果是这个年轻人掏出100元要买这 件礼物。 王老板当时没有零钱,用那100元向街坊换了100元的零钱,找给年轻人79元。但是街坊後来发现那100元是假钞 ,王老板无奈还了街坊100元。王老板在这次交易中到底损失了多少钱 ?</p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/415116400" target="_blank" rel="external">柔情♂丘比特</a><time>2008-11-04 21:44:11</time></li>
<li>197</li>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2008-11-25 00:16:08</time></li>
<li>不知道是你打错还是算错的……太像答案了。。。。 </li>
<li><a href="http://user.qzone.qq.com/415116400" target="_blank" rel="external">柔情♂丘比特</a><time>2009-03-19 15:32:20</time></li>
<li>靠,真实答案到底是多少?</li>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2009-3-21 00:00:21</time></li>
<li>街坊没损失也没赚,买家赚了79+21的商品=100但是3元是利润来的,所以按照推理店家损失97</li>
<li>或者,算现金,店家进货-18+街坊100-买家79-街坊100=97</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[偷看本主公洗澡的下场]]></title>
<url>http://huangming.github.io/2008-09-26-toukan-ben-zhugong-xizao.html</url>
<content type="html"><![CDATA[<p>某日,张飞偷看刘备洗澡,被罚扫厕所1个月 </p>
<p>注:凡是把”主公”看成”公主”的必须回帖!! </p>
<p>大家愿赌服输啊,凡是看错的自觉回帖啊 </p>
<p>面壁去!!! </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/552311925" target="_blank" rel="external">蓝水晶之泪</a><time>2008-10-24 20:04:37</time></li>
<li>你自己才该去面壁吧。难道你想偷看公主洗澡?哈哈哈哈 </li>
<li><a href="http://user.qzone.qq.com/415116400" target="_blank" rel="external">柔情♂丘比特</a><time>2008-11-04 18:38:14</time></li>
<li>操,我看你写这个就是为了让大家回帖,攒人气用的,太无耻了</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[阳光路18号@王虹莲]]></title>
<url>http://huangming.github.io/2008-06-20-yangguanglu18hao.html</url>
<content type="html"><![CDATA[<p>新婚后不到一个月,他就出去打工了。他们山村的男人几乎出去谋活路,山上的东西实在是不能养活他们。她在家里,种地、养猪、赡养老人,等看他从远方寄来的信和钱。每个月,他都会给家里寄来钱,或多或少。她似孩子一样,快乐地跑到储蓄所存起来,舍不得花掉一分钱。</p>
<p>他们的文化不高,仅仅能写一封信。他的字丑陋,可是好她喜欢,那字里行间,满是牵挂和惦念。她也回信,羞涩的表达着惦记,每一瓣心花里,全是那个黑黑瘦瘦的男子。</p>
<p>他的地址她早就背下来了――阳光路十七号。阳光路,多好听的名字。在那个繁华的大城市,这一条路一定是铺满了金灿灿的阳光。何况,他在来信中说,阳光路是一条非常漂亮的路,绿荫蔽日,碎石铺就,这里条件相当好,住的是有阳台的那种房子,虽然是打工,可并觉得苦于是她的想象就更加完美,问,那阳台上有杜鹃花吗?有水仙花吗?那围墙上有表藤爬满了吗?这种幻想让她对外面世界充满好感。所以,等待阳光路十七路的来信成了她最大的快乐。</p>
<p>她喜欢听他描述外面的世界,那些红白相同的房子,那些穿着漂亮衣服的女孩子,那悠扬的钢琴声,他还谈起麦当劳,说,什么时候来了,我带你去吃。<br><a id="more"></a><br>但是那年的春节,他却没有回来。他说,公司组织去海南旅游,机会难得,还是明年再回来吧。她逢人便说,我们家男人去海南旅游了,公司组织的。好像海南是国外一样。存折上的钱越来越多了,他和他说,明年你回来,他们一起盖个新房子吧。他们在信上度划是那么美好,盖个新房子,买几只小猪崽,再种点玉米,生一个小孩子。想着想着,她就会甜密地笑。</p>
<p>他离开家快两年了,她想他想得快发疯。于是她准备动身去找他,想给他一个惊喜。</p>
<p>坐了三天三夜的火车,她达到那那个城市。那真是一个美丽的的大都市,她一下子就晕了,如果不是警察帮助,她简直分不清东南西北。</p>
<p>她把写着阳光路十七号的纸条给警察。警察说,很远的地方,在郊区呢,离城市还有两小时的车程。</p>
<p>她呆住,以为听错了,他明明说是在市中心啊。坐了两个小时的车程,她又打听这个地方,有人指给她说,往前走,那边搭的简易棚子就是。</p>
<p>她终于看到一个破牌子上写着――阳光路十七号。那是一个简陋的木牌子,上面有水泥和白灰。她也看到了那些简陋的房子,真是红白相间,红的砖,上面画着白线。而刚才路过那些漂亮的小区时,她也的确看到了带露台的房子,听到钢琴声,那那都是别人的快乐。旁边的人说,这片大楼快盖完了,这片简陋的房子也快拆除了,这帮农民工也应该回家了,他们在这干了快两年,为了挣钱都舍不得回家,可春节时老板跑了,连路费都没给他们留。</p>
<p>站在那排简陋的房子前面,她哭了。</p>
<p>没有去找他,她又坐了三天三夜的火车回了家。</p>
<p>回家后她写信给他:我想你了,回家吧。</p>
<p>一个月后,他带着大包小包回了家,当然,还带着一份不再新鲜的麦当劳快餐。</p>
<p>她让他吃,他说,你吃,我在外面总吃。他含着眼泪吃完那个叫汉堡的东西,然后说,不好吃,不如红薯粥好喝呢,怪不得你说吃腻了。</p>
<p>整整一夜,他给她讲外面的世界,一直说阳光路十七号,她听着,在黑暗中流下眼泪。最后,她握住他的手因为有你,那条路应该叫阳光路。</p>
<p>她一直没有说,她去过阳光路十七号。那是她一个幸福而心酸的秘密 </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2008-06-22 10:08:01</time></li>
<li>唉,到网上找来拷贝的时候米看,嘟不是原版的咯,删了好多,味道嘟米了.最好找原版的看下.我第一次读这篇文章是在零七暑假.那次我哭了.第二次是在复读的时候,偶然翻出以前抄下的看看.看后眼里朦胧,终于米有滴下一滴眼泪.第三次是在考完整理书籍的时候,那次读后只是心里酸酸的,居然一点眼泪嘟米.这次在网上找来拷贝后看看,删了很多词的,一点感觉也米了.看来对我来说,感情真的是无法重复的.再也找不回第一次的感觉了.就像听歌.我米有永远喜欢的歌,嘟是听过几个月就讨厌了的.真不明白有的人因为一点小小的感动,一段短暂的别离就泪眼朦胧.让人又羡又妒 … </li>
<li><a href="http://user.qzone.qq.com/415116400" target="_blank" rel="external">柔情♂丘比特</a><time>2008-11-04 21:41:30</time></li>
<li>要是你能永远对一件事感动的话,我一定会努力为你做一件,以后你就会永远感动了,然后不论有什么要求你都不能拒绝了,爽! </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[终于...]]></title>
<url>http://huangming.github.io/2008-06-15-zhongyu.html</url>
<content type="html"><![CDATA[<p>终于结束了呢 </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2008-06-19 11:02:03</time></li>
<li><img src="/images/e142.gif" alt="">休息一下啦</li>
<li><a href="http://user.qzone.qq.com/530263866" target="_blank" rel="external">蓝吟儿</a><time>2008-07-05 01:10:40</time></li>
<li>呵呵!是啊!终于收获了!很替你开心!</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[梅质,第一次摔倒,还那么惨]]></title>
<url>http://huangming.github.io/2008-03-13-meizhi.html</url>
<content type="html"><![CDATA[<p>时间过得可真快…离高考就天了.一直以来都过得挺顺,让我自信十足,梅质却让我再次心寒.</p>
<p>十题英语的完型填空居然“只”钅昔了八题;四题语文的文言文做对了一题;物理五题计算题最后结果全是错的…很多根本不能原谅的错误,让所有的努力化为乌有..</p>
<p>不知什么时候起开始在意自已的分数,很计较.也许,在踽踽独行的寂寞中,分数是最好的也是唯一的安慰.有了在意的东西,我才更有追求的动力.我不想承认有了付出不一定有收获,所以,我拼命地抓着综合科,我不希望付出那么多还输给别人.结果,梅质的综合科简单得让米有付出的人一样神气.在八十多天的日子中我还能做些什厶呢?也许是虐待自已更惨吧…忍下去!</p>
<p>仔细想一下,很多东西都是性格和思维习惯决定了的.他们能稳住那么高分是因为他们本身有一种王者的气质雅士的气度,有了那些就是高一个档次的人,当然不同咯.要想赢别人,就要从各方面积累,使自已高一个档次,做个王者雅士.我开始学会微笑,向每个路过的纯真的孩子慈祥的老人微笑,向小鸟微笑向月亮微笑…那是一种不同的感觉..</p>
<p>微笑 0o。</p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2008-03-18 00:03:51</time></li>
<li>加油!我们相信你,不要只看到分数啊,这不是你的风格嘛,要看到自己的进步</li>
<li><a href="http://user.qzone.qq.com/158241518" target="_blank" rel="external">Joaquin~~~唫</a><time>2008-03-21 08:37:31</time></li>
<li>哥们…. 加油….. </li>
<li><a href="http://user.qzone.qq.com/710137381" target="_blank" rel="external">难为水</a><time>2008-04-09 17:10:01</time></li>
<li>加油!! </li>
<li><a href="http://user.qzone.qq.com/821254857" target="_blank" rel="external">绿光牧帝</a><time>2008-04-19 12:44:39</time></li>
<li>明哥,好久没联系啦,看了你的文章,想起我们一起奋斗的日子,很怀念啊!!真的</li>
<li>没关系的,我以前的状态你也知道的,经常大起大落,所以还是要保持良好的心态,要相信自己啊!</li>
<li>加油啊!!兄弟我在大学城等你哦!!</li>
<li>另外,严重警告:不需再填什么长安大学···这些外省的啦</li>
<li>最后唠叨一句:“胜利掌握在最后的那一刻把握!相信你能抓住那一瞬间爆发!因为你是我的老同桌啊,呵呵呵!” </li>
<li><a href="http://user.qzone.qq.com/370904740" target="_blank" rel="external">核果龙</a><time>2008-04-19 13:17:32</time></li>
<li>不要放弃啊,成败就在这五天的事了,努力能否得到收获就看你的心理素质了,相信我,我看好你!!</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[路漫漫兮]]></title>
<url>http://huangming.github.io/2008-02-27-lu-manman-xi.html</url>
<content type="html"><![CDATA[<p>第一次学校质检分数出来了:610.一个让人喜让人忧的分数.黄牛的居然是640多.偶把所有的失误分嘟加上也才630多…不知他怎么变那么牛的?唉,米办法了,只有英语追上去才行.现在到百日冲刺了,偶的英语还那么多空白…还好拉,理科综合快做完了,能挤出时间攻英语..</p>
<p>640哼,路漫漫兮偶猛追! </p>
]]></content>
</entry>
<entry>
<title><![CDATA[无奈…]]></title>
<url>http://huangming.github.io/2008-02-25-wu-nai.html</url>
<content type="html"><![CDATA[<p>今天换座位,老规矩,抽签.上次偶同桌抽到中间那组倒数第二桌,一起郁闷了一个多月…嘿嘿,这回看偶的..拆开签:33号!偶班六十六个人,三十三号意味着最后一张桌靠墙还要经常开关门的那个…看到偶同桌一个眼皮乱跳+嘴角抽搐…偶也只能一个劲地冲他傻笑…这世界…哈..哈..哈哈..哈 </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/369826825" target="_blank" rel="external">花田错</a><time>2008-02-25 18:17:36</time></li>
<li>哈哈…你也傻啊! </li>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2008-03-08 10:29:10</time></li>
<li><img src="/images/e120.gif" alt=""></li>
<li><a href="http://user.qzone.qq.com/370904740" target="_blank" rel="external">核果龙</a><time>2008-04-19 13:22:31</time></li>
<li>座位不代表什么,只要有实力,在哪里坐都是一样的,是金子总会发光嘛!!! </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[Just for fun]]></title>
<url>http://huangming.github.io/2008-02-22-fun.html</url>
<content type="html"><![CDATA[<p>生物课上,老师刚讲到多倍体育种的运用. 一生特激动,想抢风头,破囗而出:“无皮西瓜!”</p>
<p>两秒的沉默后全班暴笑 </p>
]]></content>
</entry>
<entry>
<title><![CDATA[矛盾世界]]></title>
<url>http://huangming.github.io/2008-02-19-maodun-shijie.html</url>
<content type="html"><![CDATA[<p>半年又不知不觉间流走了.在半年的改造自己中,发现,原来去年的我有多么傻多么俗…作个勇士还真不容易,今年的我依然重复着去年假日起床后吃午饭的习惯,偷懒总是有借口的,就像那句话说的,前进的理由只有一条,而后退的理由却有几百条,有的人宁愿用几百条理由证明自己不是懦夫,却不能用一条理由证明自己是个勇士. </p>
<p>我还是喜欢把人支解成物性的潜意识和人性的意识.当意识与潜意识矛盾的时候,不知道哪个才是真我?例如,《读者》中的一个故事,讲到一对恩爱的夫妻,某天家里煤气爆炸,丈夫急忙跳出窗户,然后才想到屋里还有娇妻.虽然,那次事故没对妻子造成伤害,但是,妻子还是毅然离开了丈夫.丈夫本能地跳出窗外,这本就是潜意识的作用,妻子与丈夫离异,说明妻子认为丈夫的本我是潜意识,那才是他的真面目.只是,也许她不知道,在丈夫的心里,或许她才是整个世界,在事故发生的瞬间,意识还没来得及反应时,潜意识已经控制了他的动作.…亦或许只能说,一个意识与潜意识不统一的人,他只能是个悲剧,为潜意识的种种对立的风格行为后悔.…不禁对前人的“读圣贤书”怀疑起来.读了那么多的书,意识多么高尚,在某些时刻,控制人的依然是潜意识,依然是个悲剧.或或许,是我把意识与潜意识完全对立起来而忽略了他们之间的联系,一种潜移默化的影响.在灵魂高尚化的同时,或许我们的潜意识也正在一点一滴地成长,只是速度慢得让人感觉不到而已. </p>
<p>…或许我对朋友的定义太苛克了点.当我发现我一直推心置腹的朋友在骗我或利用我时,我会冷笑,笑自已傻,把别人当朋友他却不一定当你是他朋友.有人说,当你对一个人生气的时候,说明你还在乎你们之间的感情.只是不明白,他们为什么就没有成人之美的胸怀?别人的嘟吸收过来,自己的却死死藏着不让人发现.这让人产生一种傻子被人利用的感觉.无意间发现朋友的另一面,让人想起,只是无意间!那么还有多少个无意间等着呢?于是,交朋友变得更难了.突然间就问自己了,为什么交朋友呢?为了人生路好走?如果有的人偏偏就一帆风顺不用拼搏的人生呢?亦或是为了安慰寂寞的心?那如果超然若陶潜者以大自然为友又何来寂寞?回答这问题又牵出一根本性的问题:人赤裸裸的老到这世界上又赤裸裸的离开到底为了什么?有人说为了快乐的活每一天。那么,为什么又要上学,工作,赚钱,为什么要给自己这些伤人劳心的东西?抑或是为了别人活的更好?又有多少人真正做到?大多数人始终是自私的,他不可能把自己的一切嘟捐赠给别人。或许那句叫人满意些:活着就是为了活着。我不知道是不是在逃避,只是一朝被蛇咬十年怕井绳,我真的米办法忘记自己是个‘傻子’…… 也只有半年了,该换个环境生活了…… 努力! </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/491419942" target="_blank" rel="external">雨衫</a><time>2008-02-20 13:40:25</time></li>
<li><p>朋友才是陪伴你一生的人<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="bullet">- </span>朋友才让你知道更多</span><br></pre></td></tr></table></figure></p>
</li>
<li><p>加油~~~</p>
</li>
<li><a href="http://user.qzone.qq.com/821254857" target="_blank" rel="external">倔强的小嘴</a><time>2008-06-25 01:17:59</time></li>
<li>鬼仔里,加油啊!! </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[各位 对不起]]></title>
<url>http://huangming.github.io/2007-09-30-gewei-duibuqi.html</url>
<content type="html"><![CDATA[<p>各位关心我和我关心的朋友,对不起了……不是我不想和你们联系……只是我不想我好不容易沉淀下的心再次活跃,那对我的埋头苦干不好,我需要宁静,需要一个人孤独的世界…… </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/491419942" target="_blank" rel="external">雨衫</a><time>2008-02-18 13:37:36</time></li>
<li>我无语<del>只是想说,二班是我们大家的,想想我们</del>~ </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[写给所有崇拜范仲淹的人]]></title>
<url>http://huangming.github.io/2007-08-18-fan-zhong-yan.html</url>
<content type="html"><![CDATA[<p>…当心中美好的憧憬与愿望同现实的无情与残酷发生猛烈的撞击时,身心就变得那般无力,那般无奈,那般脆弱,那般不堪一击。昔日的理想如同明日黄花,往日的激情恍若流水,一去不复返了。于是,就逐渐颓废,悲观,怨天尤人,仰或是安于现状,得过且过,再或是被生活与岁月磨得无棱无角,看惯了平庸,习惯了世俗.…人就在这已经逝去和即将逝去的日子里迷失了自己的希望和方向…… </p>
<p>下午在图书馆读了黎阳的《激情人生》,回到家里,躺在床上,听着音乐,想了很久很久… </p>
<p>复读与否,我想了很久,现在,我发现了自己一个很严重的问题。我在堕落!是的,我一直在堕落,一直在随波逐流。这次高考的失败,不能说是运气不好,是我没拼搏!一直以来,我总说范仲淹真伟大,他的乐观是我们该真正追求的。现在我要说,范仲淹胆小鬼!他害了我三年!他让我堕落了三年!每次考试失败我都能乐观去接受,于是,我不在乎成绩了,不再那么努力了,就像黎阳说的那样,一次又一次的后退让我迷失了自己,让范仲淹磨光了我的棱角… </p>
<p>我要重拾我的激情,去感受拼搏的滋味!如果我去长大的话,我想我会一直堕落下去…万劫不复!是的,我选择重读,不是因为长大不好,也不是因为怕以后回广东找不到工作,而是,我真的不能再堕落了!今天,我撕毁了录取通知书!看着那些碎片,痛快! </p>
<p>或许,拼搏了一年,我的结果不好,那是命运对我的不公!也许,我会心碎,但我不会向命运低头的!我不需要范仲淹的乐观!我的人生只需要坚强与激情!反抗命运的不公!</p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2007-08-18 21:16:33</time></li>
<li>小岚子,我知道是命运让你去了广工,能感觉到你的高三的我没经历过的苦涩,相信你能在广工找到你自己的价值…我会努力尝试地域式高三的,以前一直嘲笑那些生活只剩下埋头苦读的学生,现在才发现,那些才是充实的…… </li>
<li><a href="http://user.qzone.qq.com/491419942" target="_blank" rel="external">雨衫</a><time>2007-08-19 09:22:10</time></li>
<li>不知说啥好,本以为你不会去重读,但看你那么苦闷,也不好说什么。或许重读是另一个开始,另一个解结问题题的捷径。望你在另一个境界中找到你的梦想,等着你的好消息! </li>
<li><a href="http://user.qzone.qq.com/530263866" target="_blank" rel="external">蓝吟儿</a><time>2007-08-19 12:49:39</time></li>
<li>既然选择了,就好好地加油,让自己无悔吧!! </li>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-19 22:51:12</time></li>
<li>知道吗,当我看着这篇文章的时候,你的空间正放着《诀别诗》,那种感觉真有点………………唉!真的不知是伤心还是怎么的(因为在我的应象中你从没有像这段时间那样苦恼,那样迷茫,你总是那么乐观,唉!),总之很难说清。我知道不应该那样,我能想象你当时撕掉通书时的情景,作为一个外人是会心痛的,但我知道那张通知书中没有倾注你的全部,所以当你撕掉它时会有一丝快感,我也知道你那是破釜沉舟之举。或许我应该为你高兴,你在人生的一个重要的十字路口看清了自己,看得出你下了很大的决心去重读,去改变自己。能够想象那将是一场苦战,但我知道你能行,比起我自己,我更加相信你。不过我希望你保留一些乐观,这也是必要的,或许在关键时候它能让你看清很多问题,在迷茫苦恼的时候不如换个角度去看,把自己解脱出来,毕竟苦读还是不值得提倡的,还是快乐地去读吧。虽然是重读,但只要你用心,还是会发现很多问题的(切身体会哦)。</li>
<li>在这里我特别想告诉你的是:虽然我们上大学去了,请不要把我们隔离,(从你的留言中我能看出你有这种倾向)我们是朋友,是朋友就应该有苦同当,千万不要重走我的路了。你要记得我们会为你加油,为你祈祷,为你祝福的。让我们相约在大学城吧!!一定哦,除非你溜到北大或清华去,不然饶不了你,<img src="/images/e112.gif" alt=""></li>
<li>加油吧,我的朋友期待你的好消息。</li>
<li>唠叨了那么多,希望你没被口水淹死<img src="/images/e113.gif" alt=""></li>
<li>留言:无悔人生</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[什么啊,不会的就别说啊]]></title>
<url>http://huangming.github.io/2007-08-17-buhui-jiu-bie-luanshuo.html</url>
<content type="html"><![CDATA[<p>偶真的真的崩溃了…<br>该不该重读啊?就在偶决定重读的时候,在教务处办理手续,整个教务处的老大都叫偶别重读 干嘛啊?偶的亲戚又都说偶该重读,谁说的真谁说的假啊?都说的那么有道理的样子,拜托拉,不会的就别乱说啊还都那么有理 因为没带准考证,学校的补课又过几天快完了,所以又给了偶煎熬的时间…<br>是的,他们说什么都和偶无关,只要偶想怎样就怎样,可偶真的不会选啊,在他们的意见下,我一次又一次的改变决定…<br>优柔寡断…<br>最讨厌的这个<br>想死 </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-17 09:56:48</time></li>
<li>回去睡它一天一夜,把什么都忘记,吃饱肚子,然后散散步,放心吧船到桥头自然直 </li>
<li><a href="http://user.qzone.qq.com/370904740" target="_blank" rel="external">核果龙</a><time>2008-04-19 13:26:50</time></li>
<li>现在不是讨论这个问题的时候,一年的努力你想付诸东流吗?坚持点!!! </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[诀别诗]]></title>
<url>http://huangming.github.io/2007-08-15-jue-bie-shi.html</url>
<content type="html"><![CDATA[<p>出鞘剑杀气荡<br>风起无月的战场<br>千军万马独身闯<br>一身是胆好儿郎<br>儿女情<br>前世帐<br>你的笑,活着怎么忘<br>美人泪断人肠<br>这能取人性命是胭脂烫<br>绝别诗<br>两三行<br>写在三月春雨的路上<br>若还能打着伞走在你的身旁<br>绝别诗<br>两三行<br>谁来为我黄泉路上唱<br>若我能死在你身旁<br>也不枉来人世走这趟</p>
<p>难到就这样,与所有的都分开了?有点怅惘,好像偶的所有都失去了…… </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-16 21:37:42</time> </li>
<li>是《少年杨家将》的主题曲吗? </li>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2007-08-17 08:41:17</time> </li>
<li>你别老想电视 是先有这歌再有电视剧的 </li>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-17 09:50:44</time> </li>
<li>彼此彼此,你不也一样,哼,还来教训我<img src="/images/e116.gif" alt=""></li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[偶的去处,雾都]]></title>
<url>http://huangming.github.io/2007-08-10-ou-de-quchu-wudu.html</url>
<content type="html"><![CDATA[<p>最近听人说,重点线的重读不用加费,爸妈又想偶去重读,理由是,长大太远,还外省,以后回来都可能很不好找工作…可重读呢?万一还是那样偶就荒废了一年了,所有的选择,都是那么迷茫的,象通向雾都..所有的都只是可能,人生太多可能,要偶选择,简单又复杂,都是一样的迷茫,突然想到,为什么那么徘徊?为什么要计较好不好找到工作?一大片桃花林中,一条溪流旁,一座很大的逍遥草庐,草庐内置一间藏经阁,草庐侧一鸡舍,旁边一菜地,加上一贤惠的妻子,一条狗,一条猫….那就是偶的梦..多么简单..为什么偶又开始忧郁?仔细想想,偶知道了….所有的都只是偶的父母在担心,是他们在愁..而偶担心的..只是怕他们为偶但心..偶只怕,4年一过,他们会为偶的工作和生活操劳…他们会着急..他们会忧郁..他们会….. </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/530263866" target="_blank" rel="external">蓝吟儿</a><time>2007-08-10 15:59:32</time> </li>
<li>恩,好无奈哦.不过不可以灰心哦!冷静思考后再做出最佳选择吧.我相信你一定可以处理好的.加油!! </li>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-11 15:01:59</time> </li>
<li>真是一个难选的岔路口,只可惜我不能给你什么好的建议,就像蓝颖儿说的那样吧,冷静思考后再作出最佳选择,不管怎样我们都支持你哦。</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[《玉层金鼎》]]></title>
<url>http://huangming.github.io/2007-08-09-yu-ceng-jin-ding.html</url>
<content type="html"><![CDATA[<p>谁能破文天祥的《玉层金鼎》?</p>
<p><img src="/source/yucengjinding.JPG" alt=""></p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-17 10:01:21</time> </li>
<li>干脆和棋啦,现在讲究和谐社会哦 </li>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2007-08-17 15:57:00</time> </li>
<li>你弟弟会哦 偶教他的~~ </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[校服的裙摆]]></title>
<url>http://huangming.github.io/2007-08-09-xiaofu-de-qunbai.html</url>
<content type="html"><![CDATA[<p>今天看了《校服的裙摆》,伊蓝,一个坚强的女孩,好像自己的性格,让偶讨厌的角色.偶不知道那是叫坚强还是理智或是….冷血.这样真的不喜欢,就象鹅卵石,无棱无角,没一点特点,叫做性格的东西…好想象张飞一样冲动点,让人一提起偶就能记得猛张飞这词,像别人人一样遇事能大发脾气,能放声痛哭,能有自己的野心,自己的私心… </p>
]]></content>
</entry>
<entry>
<title><![CDATA[今天流水帐~]]></title>
<url>http://huangming.github.io/2007-07-30-jintian-liushui-zhang.html</url>
<content type="html"><![CDATA[<p>昨天问了WQW HQQ的电话,给了他点话,今天和他一起午饭~好久没和他联系了`嘿嘿,他还是那样<del>吃完饭回学校遇初3的学生~汗……半年前翻老照片就不知道他什么名,现在还没想起</del> 一起说了些不着边的大话,回来时在那街上遇一青年,死盯偶看,偶汗……回眸一看,他背后那店名,**发室,再想想自己长的不能再长的头发…,原来看上偶以为生意来了…… </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-17 10:08:37</time> </li>
<li>初看还真以为你有吸引力哦,没想到<img src="/images/e113.gif" alt="">看上你的头发了<img src="/images/e112.gif" alt=""></li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[偶回来了哦~~]]></title>
<url>http://huangming.github.io/2007-07-29-ou-huilai-le.html</url>
<content type="html"><![CDATA[<p>好久没上网了,刚上就遇她了,吓我一跳,就圈了她两相片嘛,那么凶<del>!嘿嘿偶也不是好惹的 随口编了个事吓吓她 ,看她那么着急,那样子一定很可爱呵~是不是太狠了点?要偶删相片?偶才没那么苯</del>好不容易弄的<del>她,真不懂</del>不知道整天在想些啥?肯定在网上被GG骗来骗去的咯~5555偶可不敢写她的名<del>除非偶不想活了~不能留下证据</del>嘿嘿@>_< </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/491419942" target="_blank" rel="external">雨衫</a><time>2007-08-15 12:16:02</time> </li>
<li>嘿嘿!说我坏话,你找死啊!!你若再敢拿我的照片发来发去的,我定不饶你!!!<img src="/images/e111.gif" alt=""><img src="/images/e138.gif" alt=""></li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[海鸣威]]></title>
<url>http://huangming.github.io/2007-07-28-hai-ming-wei.html</url>
<content type="html"><![CDATA[<p>海鸣威,知道吗?我说的是一个老外~《老旧照片 卷十》里面说到了他,色狼一个,离过4次婚,女朋友不计其数~我讨厌这样的人……仗着一张花花脸,甩了一个又一个,从来就不会满足不会负责任……是不是忌妒啊?可能吧~为什么他那么坏却能得到更多呢?还是女人天生就喜欢坏男孩?不懂…… </p>
]]></content>
</entry>
<entry>
<title><![CDATA[(转) 我来过我很乖]]></title>
<url>http://huangming.github.io/2007-07-08-wo-laiguo-henguai.html</url>
<content type="html"><![CDATA[<p>有一个美丽的小女孩,她的名字叫做佘艳,她有一双亮晶晶的大眼睛,她有一颗透亮的童心。她是一个孤儿,她在这个世界上只活了8年,她留在这个世界上最后的话是“我来过我很乖”。她希望死在秋天,纤瘦的身体就像一朵花自然开谢的过程。在遍地黄花堆积,落叶空中旋舞时候,她会看见横空远行雁儿们。她自愿放弃治疗,把全世界华人捐给她的54万元救命钱分成了7份,把生命当成希望的蛋糕分别给了7个正徘徊在生死线的小朋友。 </p>
<p>我自愿放弃治疗 </p>
<p>她一出生就不知亲生父母,她只有收养她的“爸爸”。 </p>
<p>1996年11月30日,那是当年农历10月20日,因为“爸爸”佘仕友在永兴镇沈家冲一座小桥旁的草丛中发现被冻得奄奄一息的这个新生婴儿时,发现她的胸口处插着一张小纸片,上面写着:“10月20日晚上12点。”<br><a id="more"></a><br>家住四川省双流县三星镇云崖村二组的佘仕友当时30岁,因为家里穷一直找不到对象,如果要收养这个孩子,恐怕就更没人愿意嫁进家门了。看着怀中小猫一样嘤嘤哭泣的婴儿,佘仕友几次放下又抱起,转身走又回头,这个小生命已经浑身冰冷哭声微弱,再没人管只怕随时就没命了!咬咬牙,他再次抱起婴儿,叹了一口气:“我吃什么,你就跟我吃什么吧。” </p>
<p>佘仕友给孩子取名叫佘艳,因为她是秋天丰收季节出生的孩子。单身汉当起了爸爸,没有母乳,也买不起奶粉,就只好喂米汤,所以佘艳从小体弱多病,但是非常乖巧懂事。春去春又回,如同苦藤上的一朵小花,佘艳一天天长大了,出奇得聪明乖巧,乡邻都说捡来的娃娃智商高,都喜欢她。尽管从小就多病,在爸爸的担惊受怕中,佘艳慢慢地长大了。 </p>
<p>命苦的孩子的确不一般,从5岁起,她就懂得帮爸爸分担家务,洗衣、煮饭、割草她样样做得好,她知道自己跟别家的孩子不一样,别家的孩子有爸爸有妈妈,自己的家里只有她和爸爸,这个家得靠她和爸爸一起来支撑,她要很乖很乖,不让爸爸多一点点忧心生一点点气。 </p>
<p>上小学了,佘艳知道自己要好学上进要考第一名,不识字的爸爸在村里也会脸上有光,她从没让爸爸失望过。她给爸爸唱歌,把学校里发生的趣事一样一样讲给爸爸听,把获得的每一朵小红花仔仔细细贴在墙上,偶尔还会调皮地出道题目考倒爸爸……每当看到爸爸脸上的笑容,她会暗自满足:“虽然不能像别的孩子一样也有妈妈,但是能跟爸爸这样快乐地生活下去,也很幸福了。” </p>
<p>2005年5月开始,她经常流鼻血。有一天早晨,佘艳正欲洗脸,突然发现一盆清水变得红红的,一看,是鼻子里的血正向下滴,不管采用什么措施,都止不住。实在没办法,佘仕友带她去乡卫生院打针,可小小的针眼也出血不止,她的腿上还出现大量“红点点”,医生说,“赶快到大医院去看!”来到成都大医院,可正值会诊高峰,她排不上轮次。独自坐在长椅上按住鼻子,鼻血像两条线直往下掉,染红了地板。他觉得不好意思,只好端起一个便盆接血,不到10分钟,盆子里的血就盛了一半。 </p>
<p>医生见状,连忙带孩子去检查。检查后,医生马上给他开了病危通知单。他得了“急性白血病”! </p>
<p>这种病的医疗费是非常昂贵的,费用一般需要30万元!佘仕友懵了。看着病床上的女儿,他没法想太多,他只有一个念头:救女儿!借遍了亲戚朋友,东拼西凑的钱不过杯水车薪,距离30万实在太远,他决定卖掉家里唯一还能换钱的土坯房。可是因为房子太过破旧,一时找不到买主。 </p>
<p>看着父亲那双忧郁的眼睛和日渐消瘦的脸,佘艳总有一种酸楚的感觉。一次,佘艳拉着爸爸的手,话还未出口眼泪却冒了出来:“爸爸,我想死……” </p>
<p>父亲一双惊愕的眼睛看着她:“你才8岁,为啥要死?”</p>
<p>“我是捡来的娃娃,大家都说我命贱,害不起这病,让我出院吧……” </p>
<p>6月18日,8岁的佘艳代替不识字的爸爸,在自己的病历本上一笔一画地签字:“自愿放弃对佘艳的治疗。” </p>
<p>当天回家后,从小到大没有跟爸爸提过任何要求的佘艳,这时向爸爸提出两个要求:她想穿一件新衣服,再照一张相片,她对爸爸解释说:“以后我不在了,如果你想我了,就可以看看照片上的我。” </p>
<p>第二天,爸爸叫上姑姑陪着佘艳来到镇上,花30元给佘艳买了两套新衣服,佘艳自己选了一套粉红色的短袖短裤,姑姑给她选了一套白色红点的裙子,她试穿上身就舍不得脱下来。三人来到照相馆,佘艳穿着粉红色的新衣服,双手比着V字手势,努力地微笑,最后还是忍不住掉下泪来。 </p>
<p>她已经不能上学了,她长时间背着书包站在村前的小路上,目光总是湿漉漉的。 </p>
<p>如果不是《成都晚报》的一个叫傅艳的记者,佘艳将像一片悄然滑落的树叶一样,静静地从风中飘下来。 </p>
<p>记者阿姨从医院方面得知了情况,写了一篇报道,详尽叙说佘艳的故事。旋即,《8岁女孩乖巧安排后事》的故事在蓉城传开了,成都被感动了,互联网也被感动了,无数市民为这位可怜的女孩心痛不已,从成都到全国乃至全世界,现实世界与互联网空间联动,所有爱心人士开始为这个弱小的生命捐款,“和谐社会”成为每个人心中的最强音。短短10天时间,来自全球华人捐助的善款就已经超过56万元,手术费用足够了,小佘艳的生命之火被大家的爱心再次点燃!宣布募捐活动结束之后,仍然源源不断收到全球各地的捐款。所有的钱都到位了,医生也尽自己最大努力,一个接一个的治疗难关也如愿地一一闯过!大家沉着地微笑着等待成功的那一天!有网友如是写道:“佘艳,我亲爱的孩子!我希望你能健康的离开医院;我祈祷你能顺利的回到学校;我盼望你能平安的长大成人;我幻想我能高兴的陪你出嫁。佘艳,我亲爱的孩子……” </p>
<p>6月21日,放弃治疗回家等待死神的佘艳被重新接到成都,住进了市儿童医院。钱有了,卑微的生命有了延续下去的希望和理由。 </p>
<p>佘艳接受了难以忍受的化疗。玻璃门内,佘艳躺在病床上输液,床头旁边放着一把椅子,椅子上放一个塑料盆,她不时要侧身呕吐。小女孩的坚强令所有人吃惊。她的主治医生徐鸣介绍,化疗阶段胃肠道反应强烈,佘艳刚开始时经常一吐就是大半盆,可她“连吭都没吭一声”。刚入院时做骨髓穿刺检查,针头从胸骨刺入,她“没哭,没叫,眼泪都没流,动都不动一下”。 </p>
<p>佘艳从出生到死亡,没有得到一丝母爱的关照。当徐鸣医生提出:“佘艳,给我当女儿吧!”佘艳眼睛一闪,泪珠儿一下就涌了出来。第二天,当徐鸣医生来到她床前的时候,佘艳竟羞羞答答地叫了一声:“徐妈妈。”徐鸣开始一愣,继而笑逐颜开,甜甜地回了一声:“女儿乖。” </p>
<p>所有的人都期待奇迹发生,所有的人都在盼望佘艳重生的那一刻。很多市民来到医院看望佘艳,网上很多网民都在问候这位可怜的孩子,她的生命让陌生的世界撒满了光明。 </p>
<p>那段时间,病房里堆满了鲜花和水果,到处弥漫着醉人的芬芳。 </p>
<p>两个月化疗,佘艳陆续闯过了9次“鬼门关”,感染性休克、败血症、溶血、消化道大出血……每次都逢凶化吉。由省内甚至国内权威儿童血液病专家共同会诊确定的化疗方案,效果很好,“白血病”本身已经被完全控制了!所有人都在企盼着佘艳康复的好消息。 </p>
<p>但是,化疗药物使用后可能引起的并发症非常可怕。而与别的很多白血病孩子比较,佘艳的体质差很多。经此手术后她的体质更差了。 </p>
<p>8月20日清晨,她问傅艳:“阿姨,你告诉我,他们为什么要给我捐款?” </p>
<p>“因为,他们都是善良人。” </p>
<p>“阿姨,我也做善良人。” </p>
<p>“你自然是善良人。善良的人要相互帮助,就会变得更加善良。” </p>
<p>佘艳从枕头下摸出一个数学作业本,递给傅艳:“阿姨,这是我的遗书……” </p>
<p>傅艳大惊,连忙打开一看,果然是小佘艳安排的后事。这是一个年仅8岁的垂危孩子,趴在病床上用铅笔写了三页纸的《遗书》。由于孩子太小,有些字还不会写,且有个别错别字。看得出整篇文章并不是一气呵成写完的,分成了六段。开头是“傅艳阿姨”,结尾是“傅艳阿姨再见”,整篇文章“傅艳阿姨”或“傅阿姨”共出现7次,还有9次简称记者为“阿姨”。这16个称呼后面,全部是关于她离世后的“拜托”,以及她想通过记者向全社会关心她的人表达“感谢”与“再见”。 </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2007-07-08 11:55:44</time> </li>
<li>感动,原来世上真有本性至善的人…一直以为,人都是有兽性的自私,好胜…君子绅士只是理智克制下的产物…没想到…</li>
<li><a href="http://user.qzone.qq.com/530263866" target="_blank" rel="external">蓝吟儿</a><time>2007-08-03 12:31:38</time> </li>
<li>未涉社会的小女孩的坚强和善良让人感动,甘愿做未婚爸爸的余仕友让人感动,陌生的市民的善举让人感动.这所有的感动让我对我们社会大家庭的未来充满了信心.只要人人都献出一点爱,世界将变成美好的人间!!</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[(转) 写给那些高考落榜的孩子]]></title>
<url>http://huangming.github.io/2007-07-08-gaokao-luobang.html</url>
<content type="html"><![CDATA[<p>今年的高考已经过去几天了,高考的你由最初因为解放的放松到现在为了成绩的紧张,不久之后高考成绩也公布了,在公布之前,你有没有想到自己可能会落榜?其实不能说得太肯定,若是落榜了,该怎么办呢?请先看看我的个人看法吧!我不知道我是否有权利来点评,但我至少知道言论是自由的,请你看下去吧.</p>
<p>现在的很多高考生都因为高考落榜而一是想不开,什么自残啊,寻短见啊什么的!网络,电视,报纸,杂志常常能看到关于这方面的报道.其实我妈妈也蛮担心我姐姐的,她跟我姐姐说过”成绩怎样就怎样,你要想想都已经考过了,无论怎样都不要想不开”. 高考落榜就像在过独木桥的时候不小心掉了进去,你不能怪谁,不是独木桥的原因,而是你自己太不小心了.而受伤的你还必须爬起来,一步一步往上爬,还要边爬边疗伤. </p>
<p>一.论成败,人生豪迈,大不了从头再来. 一次的失败,不代表就永远失败.站起来吧,重新背上你的书包,走向那熟悉的校园,重读一年高三,做一个高四学生,从头来过.你去看一下镜子,镜子的你已经中因为沮丧而变得人老面黄,好像一朵枯萎的黄花,想想以前那张稚气的脸,现在在哪呢?在路过哪里的时候丢失了呢?其实没有丢失,知识你戴上了面具,看不到原来那张脸,要摘掉面具,你只能做的是重新找回自信,只要你找到了自信,面具就自然会摘下来,那张年轻稚气的脸就又出现.第一次失败,不代表下一次就成功,你可能在这一年的高考再次落榜.只有你努力的,才有可能成功.</p>
<p>二.读书不是唯一的出路,不能在一棵树上吊死. 落榜了,就注定自己毁了吗?回答是NO的.你这次落榜了,可以重读高三,但如果再次落榜,甚至再几次落榜,那只能说你跟大学没有缘分,其实是你在读书这方面没有天赋.每个人都有每个人的优点和缺点,强势和弱点,你没有读书的天赋,不代表你就不能干其他的事,你可以试着画画,弹琴.在读初三的时候,我们政治老师曾经给我们上了一节和创业有关的课,她说过”读书不是唯一的出路,不能在一棵树上吊死.”,这句话我深深记住了,我很佩服她,她的看法其实很先进,从来不像其他老师一样要求我们一定要怎么样怎么样,她告诉我们不读书也可以创业. 没想到从她那里听到的话可以用在这里.其实考生们,如果你静下心来想想,自己在哪方面最行,发展你的优势,你的强势.你想不相信真的丑小鸭也有变成白天鹅的时候,其实那篇文章蛮夸张的,鸭子能变成鹅!也许只有合理利用自己的优势,才能在这样一个社会变白天鹅,虽然你不感兴趣,但是至少不会饿死!其实我就对读书不感兴趣,但我却是很有读书的天赋,所以我一直不敢辍学.我妈妈说过,可以学其他的,但文化至少要会一些.是啊,虽然你可以选择你的优势,但基本的文化就不能没有.在以前,我总是认为如果一个人没有把书读好,就一定没有出路,但其实这种想法是大错特错. 周杰伦在读书的时候成绩超烂,但是在音乐这方面却是很行,他写作业是很潦草,但是却把乐谱抄得很整齐,他高考落榜了,但是他却走音乐的路线红了,要是当年他没有落榜,可能就没有这样的成就,没有这样红.总之,还是那句话:读书不是唯一的出路,不能在一棵树上吊死.”</p>
<p>说了这么多,只希望各位落榜的考生能重新找回自信,找到自己该走的道路.前途是光明的,道路是曲折的.祝你成功! </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2007-07-08 13:46:31</time></li>
<li>可以看看~我是不重读了…</li>
<li><a href="http://user.qzone.qq.com/491419942" target="_blank" rel="external">雨衫</a><time>2007-08-15 11:49:28</time> </li>
<li>我也不重读!!!!</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[(转)别因寂寞爱上网络任何人]]></title>
<url>http://huangming.github.io/2007-07-08-bie-yinwei-jimo.html</url>
<content type="html"><![CDATA[<p>别因寂寞爱上谁,有时想想,寂寞真可怕。它会改变一个人的看法,它会去伤害很多人。网络等于寂寞?谁都无法找到答案。在网络中,我们可以随时的说出爱,说出感觉。网络爱情能维持多久?我曾经问过朋友,他给我的回答是那么的贴切。保质期最多三个月。因为过了三个月,如果还在一起,是因为彼此没找到更好的,所以无法离开。是因为彼此的习惯,习惯了彼此的陪伴,而不想再去寂寞的一个人生活。寂寞时的感情,只想要有人陪伴的感情,能维持多久呢?能爱多久呢?</p>
<p>《爱 》 一直以来都认为爱是唯一,因为感情都是自私的,不可能和别人分享。看多了三角恋爱,最后受伤害的却是三个人。无奈的爱,谁能去说什么呢?爱不应该是随便说出口,随便承诺的。如果在三天前你可以爱别人,三天后你可以爱上另一个人,这真的是爱吗?也许是我不懂得什么是爱。并不是因为要为一个人伤心多久才算是爱,可是如果忘记一个人这么容易,那么世界上就没有那么多痛苦和悲哀了。昨天的我,怀疑感情,不知道怎样的感情才算是爱,而今天,我却知道,只能坚定自己的想法走下去。我并不是要刻意的去悲伤,刻意的去记住什么,只不过,我不想因为寂寞爱上谁。 《习惯》 当习惯成自然,当习惯成了生活不可缺少的一部分。当你们彼此成为习惯,是否就证明你们彼此分不开了呢?网络中,习惯占据了感情。网络中,相处久了,认识久了,难免有不可割舍的感情,不可磨灭的习惯。可是,就因为这些习惯,我们就要一直陷入网络吗?因为习惯就必须去爱上某一个人吗?当一切成为习惯时,当你习惯了别人的关心时,当你无法再独自一个人面对时,是不是一切都难以改变。必须去爱上它呢?其实习惯可以改变,一切都只是时间的问题。时间久了,你们之间有了习惯。同意的时间久了,你们之间也会没任何依赖的。时间决定了彼此之间的依赖、习惯、爱。其实,不能放开的是一直的宠爱,一直的陪伴,你害怕一个人面对孤独,面对没人宠爱的日子。</p>
<p>《真实》 什么是真实的?网络、现实?通过冰冷的显示器,通过冰冷电话线。所知道的,所听说的,都是真实的吗?有时,连自己亲眼看见的都未必是真实的,何况是网络呢?凭感觉?有时候感觉也会骗人的。所以,相信自己,别让自己因为寂寞而去刻意的去信什么。有人告诉我,其实网络和现实一样,一样的复杂,只要做到淡然。那么你就会快乐点。是的,现在的我懂得怎样去淡然的看待一切。我不能接受的,我可以不用去理会,我可以不用去在乎。如果是朋友,我会祝福,如果不是,那么我会当用陌生的眼光去淡然一笑。不管怎样的真实,怎样的不真实,我只想真心的去对待每一个人。问心无愧,是最快乐的。没有欺骗,没有利诱的感情,是最纯真的,我希望自己一直拥有这些且。因为懂得,所以珍惜。 当爱变成习惯,这不是你想要的。是呀,当爱变成习惯了,那么一切的一切都没任何意义了。在虚幻的网络中,让我们好好珍惜自己,珍惜自己的感情,为值得付出的付出,我们都要没任何权利去伤害别人,去争取什么。因为一切都只是网络而已。何必在虚幻的世界中去伤害什么呢? 即使再多的诺言,也无法阻止现实和网络的区别;即使再多的山盟海誓,也无法阻止现实和网络的距离,那么,请你好好珍爱自己,珍惜自己现实的感情。因为我们没必要为不值得的事,不值得的人去努力什么。争取幸福,是相对于现实的。 </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2007-07-08 13:19:22</time></li>
<li>喂,就你了,看后看你还成天泡网不?</li>
<li><a href="http://user.qzone.qq.com/307759489" target="_blank" rel="external">超古伯</a><time>2007-07-08 17:08:07</time></li>
<li>经过多年的实践检验,这篇文章还是相当有道理的````</li>
<li><a href="http://user.qzone.qq.com/403169989" target="_blank" rel="external">仙人掌</a>(博主)<time>2007-07-10 10:09:34</time> </li>
<li>本来就是嘛~~ </li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[~~五百次的回眸~盈风~]]></title>
<url>http://huangming.github.io/2007-07-04-wubaici-huimou.html</url>
<content type="html"><![CDATA[<p>……有些时候,身边经过的人也许正是我们苦苦等待的灵魂伴侣。更多的时候,我们选择观望,宁愿错过也不愿冒险。我们的感情易守难攻。大家都熟悉游戏规则:积极不一定能赢,保守或许不可能得到,但至少不会失去,比如自己的心。……盲目的爱情就像飞蛾扑火,明知道死路一条,还是控制不住渴求接近…… 有时候爱情就是这么莫名其妙。明知道坚持不会有结果,也会无数次质问自己为何不能干脆利落一了百了,可如果处理感情都能像做外科手术那样,世上便不会有如此多的痴男怨女。……这一夜,我喜欢的你不愿意放弃旧爱,而喜欢我的他告诉我他不得不放弃。爱情,从来不会风平浪静。……二○○一年,我们经历了各自的悲欢离合。同样的一分钟,也许地球上处处上演着相同的生离死别。生老病死,还有意外,让我们在痛苦中不得不学会接受。……生活中太多的阴差阳错,我们无能为力。比如我和你,相遇已太晚。………爱情是含笑饮毒酒。千般苦万般怨,抵不过心甘情愿四个字。……喜欢上了盈风的《五百次的回眸》……忧郁的文字,似曾相识的感悟,让人震惊的对白……</p>
<p>不过可能是男生的缘故吧,后面男生的记忆更让我的心有触电的感觉~~ </p>
]]></content>
</entry>
<entry>
<title><![CDATA[缘分VS承诺]]></title>
<url>http://huangming.github.io/2007-06-30-yuanfen-chengnuo.html</url>
<content type="html"><![CDATA[<p>假如我们的相遇也叫缘分的话,兴许这个城市每天都要上演有缘无分的故事了。最美好的承诺,是一生一次,给自己最爱的人。可现实并非童话,时间、空间让诺言不堪一击。很残酷,却更符合人生。如果我们有幸遇到这样的人,除了祝福对方的承诺天长地久,不必再做其他。诺言来之不易,要守住承诺更是难上加难,有了这样的人,会不会让我们对爱情多了一点希望?飞走的鸟叫作承诺…… </p>
]]></content>
</entry>
<entry>
<title><![CDATA[这到底是?]]></title>
<url>http://huangming.github.io/2007-06-30-dao-di-zenme-le.html</url>
<content type="html"><![CDATA[<p>很奇怪~考砸了感觉还这么好,不知道是范仲淹的不以物喜不以己悲还是孔乙己的精神胜利法~~有时觉着人真的很虚伪,自己总是找些理由安慰自己小人的想法,其实事实自己就是小人。永远把自己看得太高~~或许这是人的本性~人本来就是动物嘛,就应该有动物的通性。只是,人有理智,好好色恶恶臭人之本性,就因为有理智才有所谓的君子绅士。这世上不知有没本性就完美的人?如能结交这样一位知己也不错了~~ </p>
]]></content>
</entry>
<entry>
<title><![CDATA[高考~分数]]></title>
<url>http://huangming.github.io/2007-06-29-gao-kao-fen-shu.html</url>
<content type="html"><![CDATA[<p>高考分数来了,汗…… 以前的搭档都考得很好~我不知道我是什么感觉了,说不清了。可能有些嫉妒吧~~ 不过想想也算了~反正都是自己选择的<del>当初就认为人生难得~应该好好享受青春~没认真干!也值得安慰了 毕竟还有认真了没考上的</del>其实怎样都无所谓嘛~认真了,没考上只能说运气背~~自己又没错……搞不懂他们,为什么沮丧。弄得我也跟着…… </p>
]]></content>
</entry>
<entry>
<title><![CDATA[搬家咯]]></title>
<url>http://huangming.github.io/2007-06-26-ban-jia.html</url>
<content type="html"><![CDATA[<p>放假那么久无聊死了,搬到城里就是好<del>图书馆,网吧,溜冰场随便逛</del>~爽呵 </p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-17 10:22:16</time></li>
<li>羡慕</li>
</ul>
]]></content>
</entry>
<entry>
<title><![CDATA[假日~无聊~~想上课啊]]></title>
<url>http://huangming.github.io/2007-06-24-jia-ri-wu-liao.html</url>
<content type="html"><![CDATA[<p>高考就这样过了,放假后不是想象中的狂放不羁,而是漫无边际的孤独,空虚~怀念大家一起谈天说地的日子~~朋友真不能少啊!</p>
<h2 id="评论:">评论:</h2><ul>
<li><a href="http://user.qzone.qq.com/347123766" target="_blank" rel="external">小岚子</a><time>2007-08-17 10:21:40</time></li>
<li>有同感哦</li>
</ul>
]]></content>
</entry>
</search>