-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
10925 lines (10925 loc) · 948 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
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
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN"><title type="text">悠闲の小屋</title><subtitle type="html">一个极简主题的博客。</subtitle><updated>2024-07-05T03:04:55+00:00</updated><id>https://keepjolly.com/</id><link rel="alternate" type="text/html" href="https://keepjolly.com/"/><link rel="self" type="application/atom+xml" href="https://keepjolly.com/atom.xml"/><author><name>Rurouni</name><uri>https://keepjolly.com/</uri><email>[email protected]</email></author><rights>在保留本文作者及本文链接的前提下,非商业用途随意转载分享(我会高强度自搜的喔👊)。</rights><generator uri="https://gohugo.io/" version="0.128.2">Hugo</generator><entry><title type="text">腾讯云关闭数据万象相关服务</title><link rel="alternate" type="text/html" href="https://keepjolly.com/posts/life/oss-high-cost/"/><id>https://keepjolly.com/posts/life/oss-high-cost/</id><updated>2024-07-05T03:04:50+00:00</updated><published>2024-05-03T14:53:49+08:00</published><author><name>Rurouni</name><uri>https://keepjolly.com/</uri><email>[email protected]</email></author><rights>在保留本文作者及本文链接的前提下,非商业用途随意转载分享(我会高强度自搜的喔👊)。</rights><summary type="html">前情提要:最近两个月腾讯云的消费突然激增了300倍的消费(0.01→3.21¥) 预告……</summary><content type="html"><blockquote>
<p>前情提要:最近两个月腾讯云的消费突然激增了300倍的消费(0.01→3.21¥)
预告:最近再整篇大的,关于qt面试总结,看我找工作情况择日发布吧</p>
</blockquote>
<h2 id="查看消费来源">查看消费来源</h2>
<ol>
<li>首先在网站上登陆你的账号,然后进入费用界面</li>
<li>选择费用账单→账单查看→选择按产品汇总的&quot;查看更多&quot;,从中找到最高消费的服务</li>
<li>选择对应的存储桶id,最后就能找到高消费的来源</li>
<li>本文是由于开启了盲水印服务,导致消费激增。(笑死,都没人看,还防盗)</li>
</ol>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/05/20240503151121.png?imageMogr2/format/webp%7C&amp;imageSlim" alt="Snipaste_2024-05-03_15-07-27.png"></p>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/05/20240503151141.png?imageMogr2/format/webp%7C&amp;imageSlim" alt="Snipaste_2024-05-03_15-08-39.png"></p>
<h2 id="解决方案">解决方案</h2>
<ol>
<li>询问GPT</li>
<li>获得Python代码</li>
<li>修改后上传至服务器,就不会使用该服务了(标题党嫌疑,哈哈哈)</li>
<li>注意,数据万象这个服务一旦开启就无法关闭,只能通过修改路径接口,停止使用对应服务即可</li>
</ol>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">os</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">re</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">modify_md_files</span><span class="p">(</span><span class="n">folder_path</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># 遍历文件夹及其子文件夹</span>
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">root</span><span class="p">,</span> <span class="n">dirs</span><span class="p">,</span> <span class="n">files</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">folder_path</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">file_name</span> <span class="ow">in</span> <span class="n">files</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">file_name</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s1">&#39;.md&#39;</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">file_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="n">file_name</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># 读取文件内容</span>
</span></span><span class="line"><span class="cl"> <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">file_path</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s1">&#39;utf-8&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">file</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">content</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># 使用正则表达式匹配图片路径并替换</span>
</span></span><span class="line"><span class="cl"> <span class="n">modified_content</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;!\[.*?\]\((.*?)\?watermark.*?\)&#39;</span><span class="p">,</span> <span class="sa">r</span><span class="s1">&#39;![image](\1)&#39;</span><span class="p">,</span> <span class="n">content</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">modified_content</span> <span class="o">!=</span> <span class="n">content</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">&#34;Modified:&#34;</span><span class="p">,</span> <span class="n">file_path</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># 写入修改后的内容</span>
</span></span><span class="line"><span class="cl"> <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">file_path</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s1">&#39;utf-8&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">file</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">modified_content</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">folder_path</span> <span class="o">=</span> <span class="sa">r</span><span class="s1">&#39;content&#39;</span>
</span></span><span class="line"><span class="cl"><span class="n">modify_md_files</span><span class="p">(</span><span class="n">folder_path</span><span class="p">)</span>
</span></span></code></pre></td></tr></table>
</div>
</div></content><category scheme="https://keepjolly.com/posts/" term="posts" label="posts"/><category scheme="https://keepjolly.com/posts/life/" term="life" label="life"/><category scheme="https://keepjolly.com/tags/others/" term="Others" label="Others"/></entry><entry><title type="text">hexo博客美化</title><link rel="alternate" type="text/html" href="https://keepjolly.com/posts/other/hexo-custom/"/><id>https://keepjolly.com/posts/other/hexo-custom/</id><updated>2024-07-05T03:04:50+00:00</updated><published>2024-04-01T09:31:54+08:00</published><author><name>Rurouni</name><uri>https://keepjolly.com/</uri><email>[email protected]</email></author><rights>在保留本文作者及本文链接的前提下,非商业用途随意转载分享(我会高强度自搜的喔👊)。</rights><summary type="html">记录一些我没用到但是butterfly上是true的选项 Page Front-matter PFM 1 2 3 4 5 6 7 8 9 10 11……</summary><content type="html"><p>记录一些我没用到但是<a href="https://butterfly.js.org">butterfly</a>上是true的选项</p>
<h2 id="page-front-matter">Page Front-matter</h2>
<p><a href="https://butterfly.js.org/posts/dc584b87/#Front-matter">PFM</a></p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">---
</span></span><span class="line"><span class="cl">title: # 【必需】页面标题
</span></span><span class="line"><span class="cl">date: #【必需】页面创建日期
</span></span><span class="line"><span class="cl">updated:
</span></span><span class="line"><span class="cl">type: # 【必需】标签、分类和友情链接三个页面需要配置
</span></span><span class="line"><span class="cl">comments:
</span></span><span class="line"><span class="cl">description:
</span></span><span class="line"><span class="cl">keywords:
</span></span><span class="line"><span class="cl">top_img:
</span></span><span class="line"><span class="cl">mathjax:
</span></span><span class="line"><span class="cl">katex:
</span></span><span class="line"><span class="cl">aside:
</span></span><span class="line"><span class="cl">aplayer:
</span></span><span class="line"><span class="cl">highlight_shrink:
</span></span><span class="line"><span class="cl">---
</span></span></code></pre></td></tr></table>
</div>
</div><p><strong>updated 【可选】页面更新日期</strong><br /><strong>description 【可选】页面描述</strong><br />keywords 【可选】页面关键字<br /><strong>comments 【可选】显示页面评论模块 (默认 true)</strong><br />top_img 【可选】页面顶部图片<br />mathjax 【可选】显示mathjax (当设置mathjax的per_page: false时,才需要配置,默认 false)<br />katex 【可选】显示katex (当设置katex的per_page: false时,才需要配置,默认 false)<br />aside 【可选】显示侧边栏 (默认 true)<br />aplayer 【可选】在需要的页面加载aplayer的js和css,请参考文章下面的音乐 配置<br />highlight_shrink 【可选】配置代码框是否展开 (true/false) (默认为设置中highlight_shrink的配置)</p>
<h2 id="post-front-matter">Post Front-matter</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span><span class="lnt">24
</span><span class="lnt">25
</span><span class="lnt">26
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">---
</span></span><span class="line"><span class="cl">title:
</span></span><span class="line"><span class="cl">date:
</span></span><span class="line"><span class="cl">updated:
</span></span><span class="line"><span class="cl">tags:
</span></span><span class="line"><span class="cl">categories:
</span></span><span class="line"><span class="cl">keywords:
</span></span><span class="line"><span class="cl">description:
</span></span><span class="line"><span class="cl">top_img:
</span></span><span class="line"><span class="cl">comments:
</span></span><span class="line"><span class="cl">cover:
</span></span><span class="line"><span class="cl">toc:
</span></span><span class="line"><span class="cl">toc_number:
</span></span><span class="line"><span class="cl">toc_style_simple:
</span></span><span class="line"><span class="cl">copyright:
</span></span><span class="line"><span class="cl">copyright_author:
</span></span><span class="line"><span class="cl">copyright_author_href:
</span></span><span class="line"><span class="cl">copyright_url:
</span></span><span class="line"><span class="cl">copyright_info:
</span></span><span class="line"><span class="cl">mathjax:
</span></span><span class="line"><span class="cl">katex:
</span></span><span class="line"><span class="cl">aplayer:
</span></span><span class="line"><span class="cl">highlight_shrink:
</span></span><span class="line"><span class="cl">aside:
</span></span><span class="line"><span class="cl">abcjs:
</span></span><span class="line"><span class="cl">---
</span></span></code></pre></td></tr></table>
</div>
</div><p>title 【必需】文章标题<br />date 【必需】文章创建日期<br />updated 【可选】文章更新日期<br /><strong>tags 【可选】文章标签</strong><br /><strong>categories 【可选】文章分类</strong><br />keywords 【可选】文章关键字<br /><strong>description 【可选】文章描述</strong><br /><strong>top_img 【可选】文章顶部图片</strong><br />cover 【可选】文章缩略图(如果没有设置top_img,文章页顶部将显示缩略图,可设为false/图片地址/留空)<br /><strong>comments 【可选】显示文章评论模块(默认 true)</strong><br />toc 【可选】显示文章TOC(默认为设置中toc的enable配置)<br />toc_number 【可选】显示toc_number(默认为设置中toc的number配置)<br />toc_style_simple 【可选】显示 toc 简洁模式<br />copyright 【可选】显示文章版权模块(默认为设置中post_copyright的enable配置)<br />copyright_author 【可选】文章版权模块的文章作者<br />copyright_author_href 【可选】文章版权模块的文章作者链接<br />copyright_url 【可选】文章版权模块的文章连结链接<br />copyright_info 【可选】文章版权模块的版权声明文字<br />mathjax 【可选】显示mathjax(当设置 mathjax 的 per_page: false 时,才需要配置,默认 false )<br />katex 【可选】显示 katex (当设置 katex 的 per_page: false 时,才需要配置,默认 false )<br />aplayer 【可选】在需要的页面加载 aplayer 的 js 和 css,请参考文章下面的音乐 配置<br />highlight_shrink 【可选】配置代码框是否展开(true/false)(默认为设置中 highlight_shrink 的配置)<br />aside 【可选】显示侧边栏 (默认 true)<br />abcjs 【可选】加载 abcjs (当设置 abcjs 的 per_page: false 时,才需要配置,默认 false )</p>
<h2 id="图库">图库</h2>
<p><a href="https://butterfly.js.org/posts/dc584b87/#%E5%9C%96%E5%BA%AB">https://butterfly.js.org/posts/dc584b87/#%E5%9C%96%E5%BA%AB</a></p>
<h2 id="网址同步">网址同步</h2>
<p>因为我是从halo迁移过来,原主题的front-matter信息跟hexo不一致,多了一个url属性,表明文件路径</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl"><span class="gh"># URL
</span></span></span><span class="line"><span class="cl"><span class="gh"></span><span class="gu">## Set your site url here. For example, if you use GitHub Page, set url as &#39;https://username.github.io/project&#39;
</span></span></span><span class="line"><span class="cl"><span class="gu"></span><span class="gh"># https://blog.csdn.net/qq_45020818/article/details/126892843 https://hexo.io/zh-cn/docs/permalinks
</span></span></span><span class="line"><span class="cl"><span class="gh"></span>url: http://yoursite.com
</span></span><span class="line"><span class="cl"><span class="gh"># 除了下列变量外,您还可使用 Front-matter 中的**所有**属性。
</span></span></span><span class="line"><span class="cl"><span class="gh"># **.html**防止下载当前网页
</span></span></span><span class="line"><span class="cl"><span class="gh"></span>permalink: :url.html
</span></span><span class="line"><span class="cl">permalink_defaults:
</span></span><span class="line"><span class="cl">pretty_urls:
</span></span><span class="line"><span class="cl"> trailing_index: true # Set to false to remove trailing &#39;index.html&#39; from permalinks
</span></span><span class="line"><span class="cl"> trailing_html: false # Set to false to remove trailing &#39;.html&#39; from permalinks
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="gh"># 旧网址的front-matter
</span></span></span><span class="line"><span class="cl"><span class="gh"></span>---
</span></span><span class="line"><span class="cl">title: 三维重建之路上
</span></span><span class="line"><span class="cl">date: 2023-03-26 09:07:02.96
</span></span><span class="line"><span class="cl">updated: 2023-03-26 09:41:47.726
</span></span><span class="line"><span class="cl">url: /archives/three-d-reconstruction-1
</span></span><span class="line"><span class="cl">categories:
</span></span><span class="line"><span class="cl"><span class="k">-</span> 笔记
</span></span><span class="line"><span class="cl">tags:
</span></span><span class="line"><span class="cl"><span class="k">-</span> 三维重建
</span></span><span class="line"><span class="cl">---
</span></span></code></pre></td></tr></table>
</div>
</div><p><a href="https://blog.csdn.net/Likianta/article/details/79343427">参考博客,文中还附加了类别中英文转换,个人感觉网址应该不会重名就没设了</a></p>
<h2 id="注意事项">注意事项</h2>
<h3 id="配置algolia不显示在页面上">配置algolia不显示在页面上</h3>
<p>在_config.butterfly.yml里已经放入algolia配置选项,不要重新在最底部复制,否则出错,并且配置的时候文档里需要什么,都得配置上去,我没加adminApiKey导致生成失败,我还以为加入环境变量就可以了。</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">algolia:
</span></span><span class="line"><span class="cl">appId: &#34;Z7A3XW4R2I&#34; #must
</span></span><span class="line"><span class="cl">apiKey: &#34;12db1ad54372045549ef465881c17e743&#34; #must
</span></span><span class="line"><span class="cl">adminApiKey: &#34;40321c7c207e7f73b63a19aa24c4761b&#34; #must
</span></span><span class="line"><span class="cl">chunkSize: 5000
</span></span><span class="line"><span class="cl">indexName: &#34;my-hexo-blog&#34;
</span></span><span class="line"><span class="cl">fields:
</span></span><span class="line"><span class="cl">- content:strip:truncate,0,500
</span></span><span class="line"><span class="cl">- excerpt:strip
</span></span><span class="line"><span class="cl">- gallery
</span></span><span class="line"><span class="cl">- permalink
</span></span><span class="line"><span class="cl">- photos
</span></span><span class="line"><span class="cl">- slug
</span></span><span class="line"><span class="cl">- tags
</span></span><span class="line"><span class="cl">- title
</span></span></code></pre></td></tr></table>
</div>
</div></content><category scheme="https://keepjolly.com/posts/" term="posts" label="posts"/><category scheme="https://keepjolly.com/posts/other/" term="other" label="other"/><category scheme="https://keepjolly.com/tags/blog/" term="Blog" label="Blog"/><category scheme="https://keepjolly.com/tags/hugo/" term="Hugo" label="Hugo"/></entry><entry><title type="text">毕业论文格式小技巧</title><link rel="alternate" type="text/html" href="https://keepjolly.com/posts/create/graduation-thesis-format-tips/"/><id>https://keepjolly.com/posts/create/graduation-thesis-format-tips/</id><updated>2024-07-05T03:04:50+00:00</updated><published>2024-03-31T23:51:27+08:00</published><author><name>Rurouni</name><uri>https://keepjolly.com/</uri><email>[email protected]</email></author><rights>在保留本文作者及本文链接的前提下,非商业用途随意转载分享(我会高强度自搜的喔👊)。</rights><summary type="html">题注和章节号设置:通过使用多级列表与标题样式链接,并调整编号格式和样式,可以实现章节号和题注的正确显示。目录格式:虽然手动修改目录格式可以临时解决中英文前导符不一致的问题,但需要每次更新目录后手动调整。论文打勾样式:直接复制或选择其他符号作为勾选样式,虽然存在样式不一致的问题,但可以作为临时解决方案。图表样式更新域后不变:通过手动删除题注之间的空格并重新应用格式,可以保持更新后的样式一致。批量更新域:通过打印预览和使用快捷键可以快速更新文档中的所有域,确保引用和格式的正确性。查看多余空格,换行等:启用显示编辑标记功能,帮助识别并清理文档中的多余空格和换行。插入高清图片:推荐使用SVG或PNG格式以保持图片清晰度,同时注意调整图片的PPI设置以优化打印效果。表格续表:通过插入文本框并对其进行样式调整,可以手动创建续表,确保表格在跨页时的连续性和格式一致性。分割符与页表页码:正确使用分节符和页码设置,以实现封面、目录和正文的页码分别设置,保持文档结构的清晰和专业。</summary><content type="html"><h2 id="题注的章节号设置">题注的章节号设置</h2>
<ul>
<li>问题:题注或页码中不含章节编号。请使用“开始”选项卡上的“多级列表”按钮,然后选择链接到标题样式的编号方案。</li>
<li>前因:从师兄复制过来的样式不对,将每个标题都新建了一个样式并且应用到标题中(见图1中的1.1,1.1.1),不是默认的标题x(见图1中的最右上角)</li>
<li>方案:
<ol>
<li>首先将<strong>光标移动</strong>到你的<strong>标题1</strong>旁,使当前多级列表为你设置的样式。</li>
<li>点击“开始”选项卡上的“多级列表”按钮。(见图1)</li>
<li>点击弹出框内的“更多”,点击右侧的“将级别链接到样式”下拉框,选择<strong>标题1</strong>.</li>
<li>(可选)并且调整左侧的“输入编号的格式”,为编号1左侧加入“第”,右侧加入“章”,实现<strong>第 x 章</strong>的效果,注意1不能删除。(见图2)</li>
<li>调整你的标题1的样式为学校要求的格式,如黑体三号,行距1.5。(如果遇到没有标题2,见<a href="https://jingyan.baidu.com/article/0a52e3f409073dbf63ed7261.html">此处</a>)(见图3)</li>
<li>至此,你的标题格式已设置好,并且题注已经链接到标题1的样式,此时就可以插入带有章节号的题注了(见图4,注意<strong>先居中图片</strong>,题注就会自动居中)</li>
<li>修改题注样式为学校要求的格式,如中文宋体小四加粗、英文新罗马,使每次插入题注一致(见图5,注意如果对齐设置的是居中,题注框中的文字预览部分可能看不见字,见<a href="https://zhuanlan.zhihu.com/p/429981201">此处</a>)</li>
<li>一些小提醒:如果仍出现上述问题,需要<strong>手动再应用</strong>一下标题1到原来的标题上;题注中序号和标题之间需要加个小空格</li>
</ol>
</li>
<li>图片:
<ul>
<li>
<p>图1</p>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331142358.png?imageMogr2/format/webp%7C" alt="image"></p>
</li>
<li>
<p>图2</p>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331150722.png?imageMogr2/format/webp%7C" alt="image"></p>
</li>
<li>
<p>图3</p>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331143140.png?imageMogr2/format/webp%7C" alt="image"></p>
</li>
<li>
<p>图4</p>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331143853.png?imageMogr2/format/webp%7C" alt="image"></p>
</li>
<li>
<p>图5</p>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331151436.png?imageMogr2/format/webp%7C" alt="image"></p>
</li>
</ul>
</li>
<li>参考链接
<ul>
<li><a href="https://blog.csdn.net/m0_67401935/article/details/123374185">word报错</a></li>
</ul>
</li>
</ul>
<h2 id="目录格式统一">目录格式统一</h2>
<ul>
<li>问题:目录每次刷新目录,都会出现中英文混杂,导致前导符样式不一致</li>
<li>方案:
<ul>
<li><strong>全选</strong>目录,右键弹出菜单栏,<strong>修改</strong>为宋体,小四</li>
<li>缺点:无法自动更新,每次刷新目录需要手动,暂无更好的解决方案</li>
</ul>
</li>
<li>图片:
<ul>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331162049.png?imageMogr2/format/webp%7C" alt="image"></li>
</ul>
</li>
</ul>
<h2 id="论文打勾样式">论文打勾样式</h2>
<ul>
<li>方案:
<ul>
<li>直接复制☑即可,但是跟不打勾的样式不一致,无法解决</li>
<li>其他打勾样式:<a href="https://zhuanlan.zhihu.com/p/94069754">word方框(□)中打钩(√)的5种方法</a></li>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331162619.png?imageMogr2/format/webp%7C" alt="image"></li>
</ul>
</li>
</ul>
<h2 id="图表样式更新域后不变">图表样式更新域后不变</h2>
<ul>
<li>问题:正文中交叉引用图表后,样式设置为正文样式,但是更新域代码后又变为题注样式。</li>
<li>前因:正文中交叉引用图标后,“图”和“1.1”之间带空格,想删去,保持统一,但是打印预览后,样式不对</li>
<li>方案:
<ul>
<li><strong>手动删除所有</strong>题注之间的空格,或者设置创建题注时,自动删除(见<a href="https://www.zhihu.com/question/265711826/answer/297445133">此处</a>)</li>
<li>然后重新应用格式刷即可(ctrl+shift+c / ctrl+shift+v)</li>
<li>(可选)检查是否选上“更新时保留原格式”</li>
<li>主要原因是题注和引用的内容不一致:“图 1.1”≠“图1.1”,导致每次更新域会重新应用原题注样式</li>
</ul>
</li>
<li>图片
<ul>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331164229.png?imageMogr2/format/webp%7C" alt="image"></li>
</ul>
</li>
</ul>
<h2 id="批量更新域">批量更新域</h2>
<ul>
<li>方案:
<ul>
<li>文件-&gt;打印,或者搜索栏搜索“打印预览”</li>
<li>CTRL+A 然后 F9</li>
<li>小提示:这也是出现格式问题最大的地方,如果你的引用没有设置好,不再检查一下的话,很容易就会<strong>样式不对</strong>,直接打回延毕!🤪</li>
</ul>
</li>
<li>图片:
<ul>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331170519.png?imageMogr2/format/webp%7C" alt="image"></li>
</ul>
</li>
</ul>
<h2 id="查看多余空格换行等">查看多余空格,换行等</h2>
<ul>
<li>方案:
<ul>
<li>CTRL+*,启用显示编辑标记</li>
<li>选择上图中的互指箭头</li>
<li>效果为空格<strong>以·表示</strong></li>
</ul>
</li>
</ul>
<h2 id="插入高清图片">插入高清图片</h2>
<ul>
<li>方案:
<ul>
<li>一种是使用visio画图,直接粘贴复制到word中,不推荐drawio</li>
<li>一种是将visio或者excel做的图导出为svg(推荐,但是可能会出现显示不全的问题,或者文字被压缩)</li>
<li>截图的图片、上述不行的图片<strong>转成png</strong>(次推荐,但相对来说不清晰)</li>
<li>保存为emf文件(可能会稍微清晰,但是个人感觉效果不好)</li>
<li><a href="https://zhuanlan.zhihu.com/p/378424275">设置ppi</a></li>
</ul>
</li>
</ul>
<h2 id="表格续表">表格续表</h2>
<ul>
<li>方案:
<ol>
<li>插入文本框,布局选项设置为固定,并且紧密型环绕</li>
<li>选中文本框,右键弹出样式框,修改边框为”无轮廓“,然后”设置为默认文本框“</li>
<li>交叉引用出表编号,再加入(续),设置文字样式,最后居中</li>
<li>tips:手动加入续表(样式最一致,但比较麻烦,适合终稿再修改,精致党可选🤗)</li>
</ol>
</li>
<li>图片:
<ul>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/04/20240401095613.png?imageMogr2/format/webp%7C" alt="image"></li>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331173433.png?imageMogr2/format/webp%7C" alt="image"></li>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331173612.png?imageMogr2/format/webp%7C" alt="image"></li>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331174059.png?imageMogr2/format/webp%7C" alt="image"></li>
</ul>
</li>
<li>参考链接:<a href="https://blog.csdn.net/qq_42191914/article/details/106083395">表格跨页续表</a></li>
</ul>
<h2 id="分割符与页表页码">分割符与页表页码</h2>
<ul>
<li>问题:摘要的中英文页码为罗马数字,正文的是数字;并且目录不带页码</li>
<li>前因:分隔符直接用快捷键SHIFT+ENTER,插入的是分节符,而不是分节符(下一页)</li>
<li>方案:
<ol>
<li>在英文摘要<strong>最后插入</strong>”分节符(下一页)”</li>
<li>双击<strong>目录第一页</strong>的页眉部分,在页眉和页脚栏处取消“链接到前一节”</li>
<li>设置中英文摘要为罗马数字,将<strong>中文摘要</strong>取消“链接到前一节”</li>
<li>删除封面的页码</li>
<li>tips:取消链接到前一节,就可以防止前一节的页码继承到当前节,就可以解决当前页号不对或者删除前一节的页号导致当前节的页号一起消失。</li>
</ol>
</li>
<li>图片:
<ul>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331233137.png?imageMogr2/format/webp%7C" alt="image"></li>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331233427.png?imageMogr2/format/webp%7C" alt="image"></li>
<li><img src="https://pic.keepjolly.com/halo/blog/2024/03/20240331233845.png?imageMogr2/format/webp%7C" alt="image">
其他方法:<a href="https://zhuanlan.zhihu.com/p/61108448">封面、目录、正文设置不同页码步骤教学</a></li>
</ul>
</li>
</ul>
<h2 id="修改表格中公式间距问题">修改表格中公式间距问题</h2>
<ul>
<li>问题:表格中插入公式,导致每行的间距不一致,并且正文部分插入公式也会修改行间距。</li>
<li>前因:答辩老师指出需要修改</li>
<li>方案:
<ol>
<li>选中对应文字</li>
<li>搜索<code>段落设置</code> 或者右键找到<code>段落</code></li>
<li>修改<code>如果定义了文档网格,则对齐到网格</code> 为false</li>
</ol>
</li>
<li>参考连接:<a href="https://blog.csdn.net/sinat_33425327/article/details/106654940">Word中插入公式后行距变大的解决办法</a></li>
</ul></content><category scheme="https://keepjolly.com/posts/" term="posts" label="posts"/><category scheme="https://keepjolly.com/posts/create/" term="create" label="create"/><category scheme="https://keepjolly.com/tags/others/" term="Others" label="Others"/></entry><entry><title type="text">colmap 安装</title><link rel="alternate" type="text/html" href="https://keepjolly.com/posts/tech/colmap-install/"/><id>https://keepjolly.com/posts/tech/colmap-install/</id><updated>2024-07-05T03:04:50+00:00</updated><published>2024-01-17T23:07:42+08:00</published><author><name>Rurouni</name><uri>https://keepjolly.com/</uri><email>[email protected]</email></author><rights>在保留本文作者及本文链接的前提下,非商业用途随意转载分享(我会高强度自搜的喔👊)。</rights><summary type="html">预准备 环境: Ubuntu 18.04 cuda11.3 gcc7.5 qt5.14.2 不必一致 安装教程 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 sudo apt-get……</summary><content type="html"><h2 id="预准备">预准备</h2>
<p>环境:</p>
<ul>
<li>Ubuntu 18.04</li>
<li>cuda11.3</li>
<li>gcc7.5</li>
<li>qt5.14.2</li>
<li>不必一致
<a href="https://colmap.github.io/install.html">安装教程</a></li>
</ul>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt-get install <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> git <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> cmake <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> ninja-build <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> build-essential <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libboost-program-options-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libboost-filesystem-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libboost-graph-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libboost-system-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libeigen3-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libflann-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libfreeimage-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libmetis-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libgoogle-glog-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libgtest-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libsqlite3-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libglew-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> qtbase5-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libqt5opengl5-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libcgal-dev <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> libceres-dev
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="安装colmap">安装colmap</h2>
<p><a href="https://github.com/colmap/colmap/issues/2148">参考</a></p>
<ul>
<li>colmap新版本没有dev环境</li>
</ul>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span><span class="lnt">8
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git clone --branch 3.8 https://github.com/colmap/colmap.git --single-branch
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> colmap <span class="o">&amp;&amp;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> mkdir build <span class="o">&amp;&amp;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="nb">cd</span> build <span class="o">&amp;&amp;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> sudo cmake .. -DCMAKE_CUDA_ARCHITECTURES<span class="o">=</span>native <span class="o">&amp;&amp;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> sudo make -j<span class="k">$(</span>nproc<span class="k">)</span> <span class="o">&amp;&amp;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> sudo make install
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="遇到的错误">遇到的错误</h2>
<ul>
<li>/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.14.2` not found
<ul>
<li><a href="https://github.com/colmap/colmap/issues/153">https://github.com/colmap/colmap/issues/153</a></li>
</ul>
</li>
</ul>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">set<span class="o">(</span>Qt5_CMAKE_DIR <span class="s2">&#34;/path/to/your/qt/lib/cmake&#34;</span><span class="o">)</span>
</span></span><span class="line"><span class="cl">set<span class="o">(</span>Qt5Core_DIR <span class="si">${</span><span class="nv">Qt5_CMAKE_DIR</span><span class="si">}</span>/Qt5Core<span class="o">)</span>
</span></span><span class="line"><span class="cl">set<span class="o">(</span>Qt5OpenGL_DIR <span class="si">${</span><span class="nv">Qt5_CMAKE_DIR</span><span class="si">}</span>/Qt5OpenGL<span class="o">)</span>
</span></span></code></pre></td></tr></table>
</div>
</div><ul>
<li>No CMAKE_CUDA_COMPILER could be found
<ul>
<li>sudo vim /etc/environment</li>
<li>add &quot;CUDACXX=/usr/local/cuda/bin/nvcc&quot;</li>
<li>path to your cuda</li>
<li><a href="https://github.com/jetsonhacks/buildLibrealsense2TX/issues/13">https://github.com/jetsonhacks/buildLibrealsense2TX/issues/13</a></li>
</ul>
</li>
</ul></content><category scheme="https://keepjolly.com/posts/" term="posts" label="posts"/><category scheme="https://keepjolly.com/posts/tech/" term="tech" label="tech"/><category scheme="https://keepjolly.com/tags/install/" term="Install" label="Install"/></entry><entry><title type="text">面试之计算机网络-5</title><link rel="alternate" type="text/html" href="https://keepjolly.com/posts/other/interview-network-5/"/><id>https://keepjolly.com/posts/other/interview-network-5/</id><updated>2024-07-05T03:04:50+00:00</updated><published>2024-01-13T21:57:33+08:00</published><summary type="html">对于FIN_WAIT_2,CLOSE_WAIT状态和TIME_WAIT状态?你知道多……</summary><content type="html"><h2 id="对于fin_wait_2close_wait状态和time_wait状态你知道多少">对于FIN_WAIT_2,CLOSE_WAIT状态和TIME_WAIT状态?你知道多少?</h2>
<ul>
<li>
<p>FIN_WAIT_2:</p>
<ul>
<li>
<p>半关闭状态。</p>
</li>
<li>
<p>发送断开请求一方还有接收数据能力,但已经没有发送数据能力。</p>
</li>
</ul>
</li>
<li>
<p>CLOSE_WAIT状态:</p>
<ul>
<li>
<p>被动关闭连接一方接收到FIN包会立即回应ACK包表示已接收到断开请求。</p>
</li>
<li>
<p>被动关闭连接一方如果还有剩余数据要发送就会进入CLOSE_WAIT状态。</p>
</li>
</ul>
</li>
<li>
<p>TIME_WAIT状态:</p>
<ul>
<li>又叫2MSL等待状态。</li>
<li>为了使被动关闭的一方正确的关闭,以及防止历史数据出现在新连接中。</li>
</ul>
</li>
</ul>
<h2 id="你了解流量控制原理吗">你了解流量控制原理吗?</h2>
<ul>
<li>流量控制就是让「发送方」根据「接收方」的实际接收能力控制发送的数据量。</li>
</ul>
<p>如何控制:
接收方每次收到数据包,可以在发送ACK报文时,同时告诉发送方自己的<strong>接收窗口大小还剩余多少</strong>是空闲的。</p>
<p>发送方收到之后,便会<strong>调整发送窗口的大小</strong>,当发送方收到接收窗口的大小为0时,发送方就会停止发送数据,并且同时<strong>开启一个定时器</strong>,每隔一段时间就发个探测报文询问接收方。如果可以,接收方就告诉他此时接受窗口的大小;如果接受窗口大小还是为0,则发送方再次刷新启动定时器。</p>
<blockquote>
<p>一般情况下接收窗口 &gt;= 发送窗口。
<a href="https://blog.csdn.net/weixin_43901865/article/details/113106417">https://blog.csdn.net/weixin_43901865/article/details/113106417</a></p>
</blockquote>
<h2 id="建立tcp服务器的各个系统调用过程是怎样的">建立TCP服务器的各个系统调用过程是怎样的?</h2>
<p><img src="http://oss.interviewguide.cn/img/202205220023934.png" alt=""></p>
<p><img src="http://oss.interviewguide.cn/img/202205220023348.png" alt=""></p>
<ul>
<li>
<p>服务器:</p>
<ul>
<li>
<p>创建socket -&gt; int socket(int domain, int type, int protocol);</p>
<ul>
<li>
<p>domain:协议域,决定了socket的地址类型,IPv4为AF_INET。</p>
</li>
<li>
<p>type:指定socket类型,SOCK_STREAM为TCP连接,SOCK_DGRAM为UDP连接。</p>
</li>
<li>
<p>protocol:指定协议。IPPROTO_TCP表示TCP协议,为0时自动选择type默认协议。</p>
</li>
</ul>
</li>
<li>
<p>绑定socket和端口号 -&gt; int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);</p>
<ul>
<li>
<p>sockfd:socket返回的套接字描述符,类似于文件描述符fd。</p>
</li>
<li>
<p>addr:有个sockaddr类型数据的指针,指向的是被绑定结构变量。</p>
</li>
<li>
<p>addrlen:地址长度。</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span><span class="lnt">8
</span><span class="lnt">9
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-cpp" data-lang="cpp"><span class="line"><span class="cl"><span class="c1">// IPv4的sockaddr地址结构
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="k">struct</span> <span class="nc">sockaddr_in</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">sa_family_t</span> <span class="n">sin_family</span><span class="p">;</span> <span class="c1">// 协议类型,AF_INET
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">in_port_t</span> <span class="n">sin_port</span><span class="p">;</span> <span class="c1">// 端口号
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="k">struct</span> <span class="nc">in_addr</span> <span class="n">sin_addr</span><span class="p">;</span> <span class="c1">// IP地址
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="p">};</span>
</span></span><span class="line"><span class="cl"><span class="k">struct</span> <span class="nc">in_addr</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">uint32_t</span> <span class="n">s_addr</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><ul>
<li>
<p>监听端口号 -&gt; int listen(int sockfd, int backlog);</p>
<ul>
<li>
<p>sockfd:要监听的sock描述字。</p>
</li>
<li>
<p>backlog:socket可以排队的最大连接数。</p>
</li>
</ul>
</li>
<li>
<p>接收用户请求 -&gt; int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);</p>
<ul>
<li>
<p>sockfd:服务器socket描述字。</p>
</li>
<li>
<p>addr:指向客户端地址结构指针。</p>
</li>
<li>
<p>addrlen:协议地址长度。</p>
</li>
<li>
<p>注:一旦accept某个客户机请求成功将返回一个全新的描述符用于标识具体客户的TCP连接。</p>
</li>
</ul>
</li>
<li>
<p>从socket中读取字符 -&gt; ssize_t read(int fd, void *buf, size_t count);</p>
<ul>
<li>
<p>fd:连接描述字。</p>
</li>
<li>
<p>buf:缓冲区buf。</p>
</li>
<li>
<p>count:缓冲区长度。</p>
</li>
<li>
<p>注:大于0表示读取的字节数,返回0表示文件读取结束,小于0表示发生错误。</p>
</li>
</ul>
</li>
<li>
<p>关闭socket -&gt; int close(int fd);</p>
<ul>
<li>
<p>fd:accept返回的连接描述字,每个连接有一个,生命周期为连接周期。</p>
</li>
<li>
<p>注:sockfd是监听描述字,一个服务器只有一个,用于监听是否有连接;fd是连接描述字,用于每个连接的操作。</p>
</li>
</ul>
</li>
<li>
<p>客户机:</p>
<ul>
<li>
<p>创建socket -&gt; int socket(int domain, int type, int protocol);</p>
</li>
<li>
<p>连接指定计算机 -&gt; int connect(int sockfd, struct sockaddr* addr, socklen_t addrlen);</p>
<ul>
<li>
<p>sockfd客户端的sock描述字。</p>
</li>
<li>
<p>addr:服务器的地址。</p>
</li>
<li>
<p>addrlen:socket地址长度。</p>
</li>
</ul>
</li>
<li>
<p>向socket写入信息 -&gt; ssize_t write(int fd, const void *buf, size_t count);</p>
<ul>
<li>
<p>fd、buf、count:同read中意义。</p>
</li>
<li>
<p>大于0表示写了部分或全部数据,小于0表示出错。</p>
</li>
</ul>
</li>
<li>
<p>关闭socket -&gt; int close(int fd);</p>
<ul>
<li>fd:同服务器端fd。</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="tcp-协议如何保证可靠传输">TCP 协议如何保证可靠传输?</h2>
<ul>
<li>
<p>建立连接(标志位):通信前确认通信实体存在。</p>
</li>
<li>
<p>序号机制(序号、确认号):确保了数据是按序、完整到达。</p>
</li>
<li>
<p>数据校验(校验和):CRC校验全部数据。</p>
</li>
<li>
<p>超时重传(定时器):保证因链路故障未能到达数据能够被多次重发。</p>
</li>
<li>
<p>流量控制:发送方根据接受方的实际接受能力控制发送的数据量。</p>
</li>
<li>
<p>拥塞控制:当网络拥塞时,通过拥塞窗口,减少数据的发送,防止包丢失。</p>
</li>
</ul>
<h2 id="udp是什么">UDP是什么?</h2>
<p>提供<strong>无连接</strong>的,尽最大努力的数据传输服务(<strong>不保证数据传输的可靠性</strong>)。UDP头部只有8个字节,包含源和目标端口号,包长度和校验和,各占16位。</p>
<h2 id="tcp和udp的区别">TCP和UDP的区别</h2>
<p><img src="https://pic.keepjolly.com/halo/blog/2024/01/20240113210155.png?imageMogr2/format/webp%7C" alt="image">
<img src="https://pic.keepjolly.com/halo/blog/2024/01/20240113210158.png?imageMogr2/format/webp%7C" alt="image"></p>
<ol>
<li>
<p>连接</p>
<ul>
<li>TCP 是面向连接的传输层协议,传输数据前先要建立连接。</li>
<li>UDP 是面向报文的传输层协议,即刻传输数据。</li>
</ul>
</li>
<li>
<p>服务对象</p>
<ul>
<li>TCP 是一对一的两点服务,即一条连接只有两个端点。</li>
<li>UDP 支持一对一、一对多、多对多的交互通信</li>
</ul>
</li>
<li>
<p>可靠性</p>
<ul>
<li>TCP 是可靠交付数据的~~,数据可以无差错、不丢失、不重复、按序到达~~。</li>
<li>UDP 是尽最大努力交付,不保证可靠交付数据。拓展:但是我们可以基于 UDP 传输协议实现一个可靠的传输协议,比如 QUIC 协议,具体可以参见这篇文章:<a href="https://xiaolincoding.com/network/3_tcp/quic.html">如何基于 UDP 协议实现可靠传输?(opens new window)</a></li>
</ul>
</li>
<li>
<p>拥塞控制、流量控制</p>
<ul>
<li>TCP 有拥塞控制和流量控制机制,保证数据传输的安全性。</li>
<li>UDP 则没有,即使网络非常拥堵了,也不会影响 UDP 的发送速率。</li>
</ul>
</li>
<li>
<p>首部开销</p>
<ul>
<li>TCP 首部长度较长,会有一定的开销,首部在没有使用「选项」字段时是 <code>20</code> 个字节,如果使用了「选项」字段则会变长(最大60字节)。</li>
<li>UDP 首部只有 8 个字节,并且是固定不变的,开销较小。</li>
</ul>
</li>
<li>
<p>传输方式</p>
<ul>
<li>TCP 是流式传输,没有边界</li>
<li>UDP 是一个包一个包的发送,是有边界的</li>
</ul>
</li>
<li>
<p>分片不同</p>
<ul>
<li>TCP 的数据大小如果大于 MSS 大小,则会在传输层进行分片,目标主机收到后,在传输层组装 TCP 数据包。</li>
<li>UDP 的数据大小如果大于 MTU 大小,则会在网络层进行分片,目标主机收到后,在网络层组装完数据,接着再传给传输层。</li>
</ul>
</li>
</ol>
<h2 id="补充题封包和拆包你听说过吗它是基于tcp还是udp的">补充题:封包和拆包你听说过吗?它是基于TCP还是UDP的?</h2>
<p>封包和拆包都是基于TCP的概念。因为TCP是无边界的流传输,所以需要对TCP进行封包和拆包,确保发送和接收的数据不粘连。</p>
<ul>
<li>封包:封包就是在发送数据报的时候为每个TCP数据包加上一个包头,包含该数据包的总长度。</li>
<li>拆包:接收方接收到报文后提取包头中的长度信息进行截取。</li>
</ul>
<h2 id="udp的特点有哪些附赠tcp的特点">UDP的特点有哪些(附赠TCP的特点)?</h2>
<ul>
<li>UDP是<strong>无连接的</strong>,<strong>面向报文</strong>的;</li>
<li>UDP使用<strong>尽最大努力交付</strong>,即不保证可靠交付,因此主机不需要维持复杂的链接状态(这里面有许多参数);</li>
<li>UDP<strong>没有拥塞控制</strong>,因此网络出现拥塞不会使源主机的发送速率降低(对实时应用很有用,如IP电话,实时视频会议等);</li>
<li>UDP<strong>支持一对一、一对多、多对多</strong>的交互通信;</li>
<li>UDP的<strong>首部开销小</strong>,只有8个字节</li>
</ul>
<p>那么,再说一次TCP的特点:</p>
<ul>
<li><strong>TCP是面向连接的</strong>。(就好像打电话一样,通话前需要先拨号建立连接,通话结束后要挂机释放连接);</li>
<li>每一条TCP连接只能有两个端点,每一条TCP连接只能是点对点的(<strong>一对一</strong>);</li>
<li>TCP<strong>提供可靠交付的服务</strong>。通过TCP连接传送的数据,无差错、不丢失、不重复、并且按序到达;</li>
<li>TCP<strong>提供全双工通信</strong>。TCP允许通信双方的应用进程在任何时候都能发送数据。TCP连接的两端都设有发送缓存和接收缓存,用来临时存放双方通信的数据;</li>
<li><strong>面向字节流</strong>。TCP中的“流”(stream)指的是流入进程或从进程流出的字节序列。“面向字节流”的含义是:虽然应用程序和TCP的交互是一次一个数据块(大小不等),但TCP把应用程序交下来的数据仅仅看成是一连串的无结构的字节流。</li>
</ul>
<h2 id="tcp对应的应用层协议">TCP对应的应用层协议</h2>
<p>FTP:定义了文件传输协议,使用21端口.
Telnet:它是一种用于远程登陆的端口,23端口
SMTP:定义了简单邮件传送协议,服务器开放的是25号端口。
POP3:它是和SMTP对应,POP3用于接收邮件,110端口。</p>
<h2 id="udp对应的应用层协议">UDP对应的应用层协议</h2>
<p>DNS:用于域名解析服务,用的是53号端口
SNMP:简单网络管理协议,使用161号端口
TFTP(Trival File Transfer Protocal):简单文件传输协议,69</p>
<h2 id="数据链路层常见协议可以说一下吗">数据链路层常见协议?可以说一下吗?</h2>
<table>
<thead>
<tr>
<th>协议</th>
<th>名称</th>
<th>作用</th>
</tr>
</thead>
<tbody>
<tr>
<td>ARP</td>
<td>地址解析协议</td>
<td>根据IP地址获取物理地址</td>
</tr>
<tr>
<td>RARP</td>
<td>反向地址转换协议</td>
<td>根据物理地址获取IP地址</td>
</tr>
<tr>
<td>PPP</td>
<td>点对点协议</td>
<td>主要是用来通过拨号或专线方式建立点对点连接发送数据</td>
</tr>
</tbody>
</table>
<h2 id="ping命令基于什么协议原理是什么">Ping命令基于什么协议?原理是什么?</h2>
<p>ping是基于网络层的ICMP协议实现的。通过向对方发送一个<strong>ICMP回送请求报文</strong>,如果对方主机可达的话会收到该报文,并响应一个<strong>ICMP回送回答报文</strong>。</p>
<p>扩展:ICMP报文的介绍。ICMP报文分为两个种类:</p>
<ol>
<li>ICMP差错报告报文,常见的有
<ol>
<li>终点不可达</li>
<li>时间超过</li>
<li>参数问题</li>
<li>改变路由</li>
</ol>
</li>
<li>ICMP询问报文
<ol>
<li>回送请求和回答:向特定主机发出<strong>回送请求报文</strong>,收到回送请求报文的主机响应<strong>回送回答报文</strong>。</li>
<li>时间戳请求和回答:询问对方当前的时间,返回的是一个32位的时间戳。</li>
</ol>
</li>
</ol>
<h2 id="在进行udp编程的时候一次发送多少bytes好">在进行UDP编程的时候,一次发送多少bytes好?</h2>
<p>最好的情况下是数据链路层限制的MTU大小-IP层头部20字节-UDP包头部8字节的数据量进行发送,如以太网可以发送1472字节的数据。在进行Internet的UDP编程时,最好将UDP的数据长度控件在548字节(576-8-20)以内。因为UDP是不可靠的协议,应该尽量防止数据包在数据链路层分片。
<a href="https://taifua.com/udp-512bytes-limit.html">https://taifua.com/udp-512bytes-limit.html</a></p>
<h2 id="tcp-利用滑动窗口实现流量控制的机制">TCP 利用滑动窗口实现流量控制的机制?</h2>
<p>参考82
<img src="https://pic.keepjolly.com/halo/blog/2024/01/20240113210144.png?imageMogr2/format/webp%7C" alt="image">
<img src="https://pic.keepjolly.com/halo/blog/2024/01/20240113210148.png?imageMogr2/format/webp%7C" alt="image">
<a href="https://xiaolincoding.com/network/3_tcp/tcp_feature.html#%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3">https://xiaolincoding.com/network/3_tcp/tcp_feature.html#%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3</a></p>
<h2 id="可以解释一下rtortt和超时重传分别是什么吗">可以解释一下RTO,RTT和超时重传分别是什么吗?</h2>
<ul>
<li>
<p>超时重传:发送端发送报文后若长时间未收到确认的报文则需要重发该报文。
<del>可能有以下几种情况:发送的数据没能到达接收端,所以对方没有响应。接收端接收到数据,但是ACK报文在返回过程中丢失。接收端拒绝或丢弃数据。</del></p>
</li>
<li>
<p>RTO(Retransmission Time Out):重传超时时间,即从数据发送时刻算起,超过这个时间便执行重传。</p>
<ul>
<li>
<p>通常每次重传RTO是前一次重传间隔的两倍,计量单位通常是RTT。例:1RTT,2RTT,4RTT,8RTT......</p>
</li>
<li>
<p>重传次数到达上限之后停止重传。</p>
</li>
</ul>
</li>
<li>
<p>RTT(Round Trip Time):一个连接的往返时间,即数据发送时刻到接收到确认的时刻的差值。</p>
</li>
</ul>
<h2 id="拥塞控制原理听说过吗">拥塞控制原理听说过吗?</h2>
<ul>
<li>拥塞控制目的是防止数据过多注入到网络中导致网络资源(路由器、交换机等)过载。</li>
<li>TCP拥塞控制算法:
<ul>
<li>慢开始 &amp; 拥塞避免:先试探网络拥塞程度再逐渐增大拥塞窗口,呈指数增加,直到达到阀值ssthresh,这部分是慢开始过程。达到阀值后每次以 1/拥塞窗口 增长拥塞窗口大小,呈线性增加,当发生拥塞,进行超时重传或者快速重传+快速恢复。</li>
<li>最终拥塞窗口会收敛于稳定值。</li>
</ul>
</li>
</ul>
<h2 id="如何区分流量控制和拥塞控制">如何区分流量控制和拥塞控制?</h2>
<ul>
<li>
<p>流量控制属于通信双方协商;拥塞控制用于控制网络中的拥塞情况。</p>
</li>
<li>
<p>流量控制需要通信双方各维护一个发送窗、一个接收窗,对任意一方,接收窗大小<strong>由自身决定</strong>,发送窗大小由接收方响应的TCP报文段中窗口值确定;拥塞控制的拥塞窗口大小变化由试探性发送一定数据量数据探查网络状况后而<strong>自适应调整</strong>。</p>
</li>
<li>
<p>实际最终发送窗口 = min{流控发送窗口,拥塞窗口}。</p>
</li>
</ul>
<h2 id="常见的http状态码有哪些">常见的HTTP状态码有哪些?</h2>
<p><img src="https://cdn.xiaolincoding.com/gh/xiaolincoder/ImageHost/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/HTTP/6-%E4%BA%94%E5%A4%A7%E7%B1%BBHTTP%E7%8A%B6%E6%80%81%E7%A0%81.png" alt="五大类 HTTP 状态码"></p>
<p><code>1xx</code> 类状态码属于<strong>提示信息</strong>,是协议处理中的一种中间状态,实际用到的比较少。</p>
<p><code>2xx</code> 类状态码表示服务器<strong>成功</strong>处理了客户端的请求,也是我们最愿意看到的状态。</p>
<ul>
<li>
<p>「<strong>200 OK</strong>」是最常见的成功状态码,表示一切正常。如果是非 <code>HEAD</code> 请求,服务器返回的响应头都会有 body 数据。</p>
</li>
<li>
<p>「<strong>204 No Content</strong>」也是常见的成功状态码,与 200 OK 基本相同,但响应头没有 body 数据。</p>
</li>
<li>
<p>「<strong>206 Partial Content</strong>」是应用于 HTTP 分块下载或断点续传,表示响应返回的 body 数据并不是资源的全部,而是其中的一部分,也是服务器处理成功的状态。</p>
</li>
</ul>
<p><code>3xx</code> 类状态码表示客户端请求的资源发生了变动,需要客户端用新的 URL 重新发送请求获取资源,也就是<strong>重定向</strong>。</p>
<ul>
<li>
<p>「<strong>301 Moved Permanently</strong>」表示永久重定向,说明请求的资源已经不存在了,需改用新的 URL 再次访问。</p>
</li>
<li>
<p>「<strong>302 Found</strong>」表示临时重定向,说明请求的资源还在,但暂时需要用另一个 URL 来访问。</p>
</li>
</ul>
<p>301 和 302 都会在响应头里使用字段 <code>Location</code>,指明后续要跳转的 URL,浏览器会自动重定向新的 URL。</p>
<ul>
<li>「<strong>304 Not Modified</strong>」不具有跳转的含义,表示资源未修改,重定向已存在的缓冲文件,也称缓存重定向,也就是告诉客户端可以继续使用缓存资源,用于缓存控制。</li>
</ul>
<p><code>4xx</code> 类状态码表示客户端发送的<strong>报文有误</strong>,服务器无法处理,也就是错误码的含义。</p>
<ul>
<li>
<p>「<strong>400 Bad Request</strong>」表示客户端请求的报文有错误,但只是个笼统的错误。</p>
</li>