-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
127 lines (98 loc) · 12.9 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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>hooy-blogs</title>
<link href="/atom.xml" rel="self"/>
<link href="http://melunar.github.io/"/>
<updated>2018-03-30T05:39:03.119Z</updated>
<id>http://melunar.github.io/</id>
<author>
<name>hooy</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>HTTP POST请求Request Payload和Form Data主体类型的区别</title>
<link href="http://melunar.github.io/2018/03/30/http-payload-form-data/"/>
<id>http://melunar.github.io/2018/03/30/http-payload-form-data/</id>
<published>2018-03-30T05:38:05.526Z</published>
<updated>2018-03-30T05:39:03.119Z</updated>
<content type="html"><![CDATA[<p><strong>看请求报文伪代码示例: </strong></p>
<figure class="highlight subunit"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">GET:</div><div class="line">Content-Type: application/json;charset=UTF<span class="string">-8</span></div><div class="line">query string parameters: a=1&id=4120f5cb<span class="string">-3133</span><span class="string">-45</span>f6<span class="string">-861</span>e<span class="string">-91</span>a6fb76d36b</div></pre></td></tr></table></figure>
<figure class="highlight fortran"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">POST:(非request body类型)</div><div class="line">Content-<span class="keyword">Type</span>:application/x-www-<span class="keyword">form</span>-urlencoded</div><div class="line"><span class="keyword">Form</span> <span class="keyword">Data</span>: loginName=hooy&password=MTIzNDU2&<span class="keyword">name</span>=<span class="number">23</span>&gender=<span class="number">0</span></div></pre></td></tr></table></figure>
<figure class="highlight groovy"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="string">POST:</span>(request body类型)</div><div class="line">Content-<span class="string">Type:</span>application/json;charset=UTF<span class="number">-8</span></div><div class="line">Request <span class="string">Payload:</span></div><div class="line">{<span class="string">"id"</span>:<span class="string">"4769aa96-28c2-11e8-81c3-f80f41fae84e"</span>,<span class="string">"abilities"</span>:[],<span class="string">"nodeTypes"</span>:[<span class="string">"camera"</span>]}</div></pre></td></tr></table></figure>
<blockquote>
<p>如果请求的Content-Type设置为application/x-www-form-urlencoded,那么这个Post请求被认为是HTTP POST表单请求,它的参数就是标准的querystring类型, 以key=value&key2=value2的形式发送和解析. 这也是之前post请求常用的方式, 毕竟表单提交的数据格式就是如此</p>
<p>其他情况如使用原生AJAX的POST请求如果不指定请求头Request Header,默认使用的Content-Type是text/plain;charset=UTF-8,参数出现在Request payload块, 参数也会以标准JSON的格式传输和解析。当然不同的框架有不同的默认方式, 具体接口形式可以调用相关headerSet方法来设置请求头.</p>
</blockquote>
]]></content>
<summary type="html">
<p><strong>看请求报文伪代码示例: </strong></p>
<figure class="highlight subunit"><table><tr><td class="gutter"><pre><div class="line">1</div><div clas
</summary>
<category term="HTTP" scheme="http://melunar.github.io/tags/HTTP/"/>
</entry>
<entry>
<title>提升编程水平</title>
<link href="http://melunar.github.io/2018/03/30/promote-code-ability/"/>
<id>http://melunar.github.io/2018/03/30/promote-code-ability/</id>
<published>2018-03-30T05:36:10.207Z</published>
<updated>2018-03-30T05:36:10.207Z</updated>
<content type="html"><![CDATA[<blockquote>
<p>编程水平的概念有点大,我们这里暂且不准确地约定编程水平是指代码正确性,代码的逻辑性以及代码可读性三个方面。根据多年的编程经验,总结一下提高编程水平的几个建议,偏颇之处,还请高手们评论中指正。</p>
</blockquote>
<p><strong>内容概要</strong></p>
<ol>
<li><p>提高代码的正确性</p>
</li>
<li><p>提高代码的逻辑性</p>
</li>
<li><p>提高代码的可读性</p>
</li>
</ol>
<h4 id="一、提高代码的正确性"><a href="#一、提高代码的正确性" class="headerlink" title="一、提高代码的正确性"></a>一、提高代码的正确性</h4><p>所谓代码的正确性是指程序在运行过程中,代码层面运行正常。也就是我们常说的代码健壮(代码健壮其实还包含业务层面)。</p>
<h5 id="关于编程手册"><a href="#关于编程手册" class="headerlink" title="关于编程手册"></a>关于编程手册</h5><p>通常,代码正确性反映工程师对一门语言的掌握程度,是一个日积月累的过程。这里建议多看编程手册,手册一般是一门语言最权威的教程,应当形成一种这样的习惯:</p>
<p>遇到问题,首先看手册;通过搜索、浏览专业网站或者请教同事解决问题后,要看手册进行验证。</p>
<p>这样长时间的积累,可以对这门语言深刻理解,写出的代码正确性肯定会大大提高。</p>
<h5 id="关于经典书籍。"><a href="#关于经典书籍。" class="headerlink" title="关于经典书籍。"></a>关于经典书籍。</h5><p>每一门语言都会有好多不错的书籍,我们称为经典书籍。通过各种方法,找到一种或几种不错的书籍,认真阅读,不为完成任务的而阅读,细细品味地阅读,求精读而不求多读。</p>
<p>要注意的是技术日新月异,选书的时候要慎重。</p>
<h5 id="关于网络上的技术文章"><a href="#关于网络上的技术文章" class="headerlink" title="关于网络上的技术文章"></a>关于网络上的技术文章</h5><p>网络上的技术性文章也是需要阅读的,但它不能代替书籍。因为,书籍是一个完整的体系,而技术快餐类的文章由于写作时间和篇幅等限制,可能会有偏颇,所以,对待网络上的技术文章,应当作为开阔眼界使用。</p>
<p>当然,这一点不是绝对的,这一点自己把握吧。</p>
<h4 id="二、提高代码的逻辑性"><a href="#二、提高代码的逻辑性" class="headerlink" title="二、提高代码的逻辑性"></a>二、提高代码的逻辑性</h4><p>这里有两点建议:</p>
<h5 id="多了解一些算法知识"><a href="#多了解一些算法知识" class="headerlink" title="多了解一些算法知识"></a>多了解一些算法知识</h5><p>随着编程时间的增长,算法的知识还是有用的。可能好多常用的算法,编程语言都提供了对应的函数帮助解决。但是有时候业务上的特殊要求,可能会让你实现一个高效算法来支持业务逻辑。如果对算法有比较深入的了解,利用算法的一些思想,写出的代码的逻辑性会更好些。</p>
<h5 id="多了解一些设计模式"><a href="#多了解一些设计模式" class="headerlink" title="多了解一些设计模式"></a>多了解一些设计模式</h5><p>设计模式不仅让代码更加有组织有纪律,同时也让代码的逻辑性大大增强。刚开始的时候,逼迫自己尝试使用设计模式,时间长了,会发现有坑也有利,在下次使用的时候再避免。</p>
<h4 id="三、提高代码的可读性"><a href="#三、提高代码的可读性" class="headerlink" title="三、提高代码的可读性"></a>三、提高代码的可读性</h4><h5 id="注释和命名"><a href="#注释和命名" class="headerlink" title="注释和命名"></a>注释和命名</h5><p>编程的时候,可能时间紧任务中,而且项目对注释或者命名没有强制要求,很多程序员就偷懒。结果就是坑别人,也可能坑自己。所以,注释一定要写,不管是否有要求。命名一定要规范,杜绝拼音,一定要用英文(拼音有时候有歧义)。注释和命名是一个程序员的逼格,不能偷懒。在多人项目中,建议偷偷学习一下同事的编码规范。</p>
<h5 id="逛逛GitHub学习"><a href="#逛逛GitHub学习" class="headerlink" title="逛逛GitHub学习"></a>逛逛GitHub学习</h5><p>遇到常用的功能,多去GitHub上逛逛,这是一个好习惯,避免重复造轮子,还能提高效率。但是,拿来主义也要看看别人的代码,你能读懂别人的代码,说明代码可读性强,那就学学呗。</p>
<h5 id="阅读接口示例代码"><a href="#阅读接口示例代码" class="headerlink" title="阅读接口示例代码"></a>阅读接口示例代码</h5><p>一些大的公司API都会有示例代码,这些代码是给好多程序员看的,代码肯定是经过多次review过才会作为示例代码(不然容易丢大公司的范儿),学习学习大公司的编码风格,为自己进入大公司做好准备。</p>
<p><img src="coding-simple.png" alt="code"></p>
<blockquote>
<p>结束语:提高编程水平,需要自己时刻有想提高的意识才行,提高编程水平就是经过坑坑洼洼,不断总结不断进步的过程。</p>
</blockquote>
]]></content>
<summary type="html">
<blockquote>
<p>编程水平的概念有点大,我们这里暂且不准确地约定编程水平是指代码正确性,代码的逻辑性以及代码可读性三个方面。根据多年的编程经验,总结一下提高编程水平的几个建议,偏颇之处,还请高手们评论中指正。</p>
</blockquote>
<p><strong
</summary>
<category term="编程" scheme="http://melunar.github.io/tags/%E7%BC%96%E7%A8%8B/"/>
</entry>
<entry>
<title>Hello World</title>
<link href="http://melunar.github.io/2017/03/06/hello-world/"/>
<id>http://melunar.github.io/2017/03/06/hello-world/</id>
<published>2017-03-06T01:25:24.418Z</published>
<updated>2017-03-06T01:25:24.418Z</updated>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="https://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="https://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"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo new <span class="string">"My New Post"</span></div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo server</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo generate</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo deploy</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>
]]></content>
<summary type="html">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="https://hexo.
</summary>
</entry>
</feed>