-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.xml
230 lines (230 loc) · 31.5 KB
/
index.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
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tomial's Blog</title><link>https://tomial.github.io/</link><description>Recent content on Tomial's Blog</description><generator>Hugo</generator><language>zh-cn</language><copyright>© Tomial</copyright><lastBuildDate>Thu, 26 Dec 2024 14:47:13 +0800</lastBuildDate><atom:link href="https://tomial.github.io/index.xml" rel="self" type="application/rss+xml"/><item><title>Rack</title><link>https://tomial.github.io/posts/rack/</link><pubDate>Thu, 26 Dec 2024 14:47:13 +0800</pubDate><guid>https://tomial.github.io/posts/rack/</guid><description><p>Rack既是一个规范,也是一个实现这个规范的Ruby库。</p></description></item><item><title>goroutine控制:WaitGroup解析</title><link>https://tomial.github.io/posts/goroutine/waitgroup/</link><pubDate>Thu, 29 Feb 2024 17:14:53 +0800</pubDate><guid>https://tomial.github.io/posts/goroutine/waitgroup/</guid><description><p>WaitGroup是Go经常使用的并发控制工具,它非常适合等待一组goroutine结束的场景</p></description></item><item><title>DNS</title><link>https://tomial.github.io/posts/dns/</link><pubDate>Fri, 02 Feb 2024 13:54:56 +0800</pubDate><guid>https://tomial.github.io/posts/dns/</guid><description><p>关于域名系统(Domain Name System)的笔记</p></description></item><item><title>Go Error Handling(1)</title><link>https://tomial.github.io/posts/go-error-handling-1/</link><pubDate>Fri, 12 Jan 2024 14:26:22 +0800</pubDate><guid>https://tomial.github.io/posts/go-error-handling-1/</guid><description><p>Go没有异常这类机制,与其他语言中的错误处理不太一样,而是用<code>error</code>这个built-in类型来表示错误。</p></description></item><item><title>redlock-rb: redis分布式锁的ruby实现分析</title><link>https://tomial.github.io/posts/redlock-rb/</link><pubDate>Tue, 09 Jan 2024 13:30:01 +0800</pubDate><guid>https://tomial.github.io/posts/redlock-rb/</guid><description><p>redis的文档中提供了一个由redis作者antirez实现的分布式锁:<a href="https://github.com/antirez/redlock-rb">redlock-rb</a></p></description></item><item><title>关于我</title><link>https://tomial.github.io/about/</link><pubDate>Fri, 05 Jan 2024 00:00:00 +0000</pubDate><guid>https://tomial.github.io/about/</guid><description><p>本博客主题为基于<a href="https://github.com/catppuccin/catppuccin">catppuccin</a>主题魔改的<a href="https://github.com/tomial/archie">archie</a></p>
<p>中文字体:<a href="https://github.com/lxgw/LxgwNeoXiHei">霞鹜新晰黑</a></p>
<p>代码字体:<a href="https://indestructibletype.com/Drafting/">Drafting* Mono</a></p>
<p>个人项目:</p>
<ul>
<li><a href="https://github.com/tomial/go-db">go-db</a>:一个用于学习的简单B+树数据库</li>
<li>goj: gf + React + Docker 实现的OJ系统
<ul>
<li><a href="https://github.com/tomial/goj-judger">judger</a></li>
<li><a href="https://github.com/tomial/goj-server">server</a></li>
<li><a href="https://github.com/tomial/goj-front">front</a></li>
</ul>
</li>
<li>PR: <a href="https://github.com/neovim/neovim/pull/19286">https://github.com/neovim/neovim/pull/19286</a></li>
</ul>
<p>正在学习:</p>
<p><a href="https://learnopengl.com/">LearnOpenGL</a></p>
<p><a href="https://github.com/mit-pdos/xv6-riscv">xv6-riscv</a></p>
<p><a href="https://godotengine.org/">godot</a></p></description></item><item><title>Docker bind Mounts和volume及tmpfs对比</title><link>https://tomial.github.io/posts/docker-bind-mounts%E5%92%8Cvolume%E5%8F%8Atmpfs%E5%AF%B9%E6%AF%94/</link><pubDate>Sat, 10 Apr 2021 17:37:28 +0800</pubDate><guid>https://tomial.github.io/posts/docker-bind-mounts%E5%92%8Cvolume%E5%8F%8Atmpfs%E5%AF%B9%E6%AF%94/</guid><description><p>本文总结了 bind Mounts 和 volume 及 tmpfs 三种 Docker 管理容器数据方式的区别</p></description></item><item><title>Docker Security总结</title><link>https://tomial.github.io/posts/docker-security%E6%80%BB%E7%BB%93/</link><pubDate>Tue, 06 Apr 2021 15:35:27 +0800</pubDate><guid>https://tomial.github.io/posts/docker-security%E6%80%BB%E7%BB%93/</guid><description><p>本文总结了 Docker 安全性相关的内容,主要来自 Docker 官方文档 <a href="https://docs.docker.com/engine/security/">Docker security</a> 一文。</p></description></item><item><title>Shell常用工具总结</title><link>https://tomial.github.io/posts/shell%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E6%80%BB%E7%BB%93/</link><pubDate>Sun, 28 Mar 2021 12:47:04 +0800</pubDate><guid>https://tomial.github.io/posts/shell%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7%E6%80%BB%E7%BB%93/</guid><description><p>这篇文章用来记录一些 Shell 的技巧及好用的工具</p></description></item><item><title>Go Cli工具详解(get,install,clean等)</title><link>https://tomial.github.io/posts/go-cli%E5%B7%A5%E5%85%B7%E8%AF%A6%E8%A7%A3getinstallclean%E7%AD%89/</link><pubDate>Fri, 19 Mar 2021 18:55:05 +0800</pubDate><guid>https://tomial.github.io/posts/go-cli%E5%B7%A5%E5%85%B7%E8%AF%A6%E8%A7%A3getinstallclean%E7%AD%89/</guid><description><p>本文总结了 Go 1.16 后 Go 命令行工具使用需要注意的地方</p></description></item><item><title>Hugo使用Github Action自动部署博客到Github Pages</title><link>https://tomial.github.io/posts/hugo%E4%BD%BF%E7%94%A8github-action%E8%87%AA%E5%8A%A8%E9%83%A8%E7%BD%B2%E5%8D%9A%E5%AE%A2%E5%88%B0github-pages/</link><pubDate>Thu, 11 Mar 2021 15:51:47 +0800</pubDate><guid>https://tomial.github.io/posts/hugo%E4%BD%BF%E7%94%A8github-action%E8%87%AA%E5%8A%A8%E9%83%A8%E7%BD%B2%E5%8D%9A%E5%AE%A2%E5%88%B0github-pages/</guid><description><p>github actions提供了免费的CI/CD功能,能够响应github repo的事件执行一系列自动化的操作。</p></description></item><item><title>Git Submodule使用总结</title><link>https://tomial.github.io/posts/git-submodule%E4%BD%BF%E7%94%A8%E6%80%BB%E7%BB%93/</link><pubDate>Wed, 10 Mar 2021 17:41:08 +0800</pubDate><guid>https://tomial.github.io/posts/git-submodule%E4%BD%BF%E7%94%A8%E6%80%BB%E7%BB%93/</guid><description><p>我在将博客源码上传到Github时遇到这样一个问题:</p></description></item><item><title>使用vsftpd建立FTP服务器</title><link>https://tomial.github.io/posts/%E4%BD%BF%E7%94%A8vsftpd%E5%BB%BA%E7%AB%8Bftp%E6%9C%8D%E5%8A%A1%E5%99%A8/</link><pubDate>Tue, 23 Jun 2020 18:10:45 +0000</pubDate><guid>https://tomial.github.io/posts/%E4%BD%BF%E7%94%A8vsftpd%E5%BB%BA%E7%AB%8Bftp%E6%9C%8D%E5%8A%A1%E5%99%A8/</guid><description><p>VSFTPD是一个FTP服务器软件,官网的介绍是:</p>
<blockquote>
<p><strong>Probably the most secure and fastest FTP server for UNIX-like systems.</strong></p>
</blockquote>
<p>一般在Linux建立FTP服务器都用他,首先要安装vsftpd:</p>
<p>debian系:</p></description></item><item><title>@NotNull和nullable的区别</title><link>https://tomial.github.io/posts/notnull%E5%92%8Cnullable%E7%9A%84%E5%8C%BA%E5%88%AB/</link><pubDate>Sun, 07 Jun 2020 17:02:34 +0000</pubDate><guid>https://tomial.github.io/posts/notnull%E5%92%8Cnullable%E7%9A%84%E5%8C%BA%E5%88%AB/</guid><description><h2 id="notnull">@NotNull</h2>
<p>@NotNull是Bean Validation规范里面定义的一个注解,不仅可以用在实体(Entity)类中,还可以用在别的bean验证Null值。</p></description></item><item><title>Spring Overview</title><link>https://tomial.github.io/posts/spring-overview/</link><pubDate>Sat, 16 May 2020 10:51:43 +0000</pubDate><guid>https://tomial.github.io/posts/spring-overview/</guid><description><h1 id="spring-overview">Spring Overview</h1>
<h2 id="spring这个词指的是什么">Spring这个词指的是什么?</h2>
<p>Spring一词既可以指<code>Spring Framework</code>这个Spring系列的起源框架,也可以指Spring这整个体系。<code>Spring Framework</code> 提供了许多模块供不同的应用选择,比如基于<code>Servlet</code>的<code>Spring MVC</code>,又或是与之平行关系的<code>Spring WebFlux</code></p></description></item><item><title>为什么Arrays.asList()返回的列表不能增加元素</title><link>https://tomial.github.io/posts/%E4%B8%BA%E4%BB%80%E4%B9%88arrays.aslist%E8%BF%94%E5%9B%9E%E7%9A%84%E5%88%97%E8%A1%A8%E4%B8%8D%E8%83%BD%E5%A2%9E%E5%8A%A0%E5%85%83%E7%B4%A0/</link><pubDate>Fri, 10 Apr 2020 17:49:32 +0000</pubDate><guid>https://tomial.github.io/posts/%E4%B8%BA%E4%BB%80%E4%B9%88arrays.aslist%E8%BF%94%E5%9B%9E%E7%9A%84%E5%88%97%E8%A1%A8%E4%B8%8D%E8%83%BD%E5%A2%9E%E5%8A%A0%E5%85%83%E7%B4%A0/</guid><description><div class="highlight"><div style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f849c">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f849c">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f849c">3
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>String<span style="color:#89dceb;font-weight:bold">[]</span> arr <span style="color:#89dceb;font-weight:bold">=</span> {<span style="color:#a6e3a1">&#34;A&#34;</span>, <span style="color:#a6e3a1">&#34;B&#34;</span>};
</span></span><span style="display:flex;"><span>List<span style="color:#89dceb;font-weight:bold">&lt;</span>String<span style="color:#89dceb;font-weight:bold">&gt;</span> list <span style="color:#89dceb;font-weight:bold">=</span> Arrays.<span style="color:#89b4fa">asList</span>(arr);
</span></span><span style="display:flex;"><span>list.<span style="color:#89b4fa">add</span>(<span style="color:#a6e3a1">&#34;C&#34;</span>); <span style="color:#6c7086;font-style:italic">//java.lang.UnsupportedOperationException</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>如果调用<code>Arrays.asList()</code>方法返回列表的add方法会抛出异常,这是什么原因呢?</p>
<p>在<code>asList</code>方法源码可以看到</p></description></item><item><title>bcrypt加密及Salts,Peppers的使用</title><link>https://tomial.github.io/posts/bcrypt%E5%8A%A0%E5%AF%86%E5%8F%8Asalts-peppers%E7%9A%84%E4%BD%BF%E7%94%A8/</link><pubDate>Sat, 07 Dec 2019 12:46:26 +0000</pubDate><guid>https://tomial.github.io/posts/bcrypt%E5%8A%A0%E5%AF%86%E5%8F%8Asalts-peppers%E7%9A%84%E4%BD%BF%E7%94%A8/</guid><description/></item><item><title>HTML初学总结</title><link>https://tomial.github.io/posts/html%E5%88%9D%E5%AD%A6%E6%80%BB%E7%BB%93/</link><pubDate>Mon, 25 Nov 2019 23:20:21 +0000</pubDate><guid>https://tomial.github.io/posts/html%E5%88%9D%E5%AD%A6%E6%80%BB%E7%BB%93/</guid><description><p>HTML全称是超文本标记语言( HyperText Markup Language ),是创建网页必备的标记语言。</p>
<p>HTML开头经常使用一个标签指定HTML的版本,这个标签告诉浏览器该HTML文件的版本是什么,比如HTML5的标签为:</p></description></item><item><title>JavaBean和Serializable,Mbeans</title><link>https://tomial.github.io/posts/javabean%E5%92%8Cserializable-mbeans/</link><pubDate>Mon, 25 Nov 2019 23:15:45 +0000</pubDate><guid>https://tomial.github.io/posts/javabean%E5%92%8Cserializable-mbeans/</guid><description><h2 id="java-bean">Java Bean</h2>
<p>JavaBean简单来说是一种约定俗成的标准。</p>
<ol>
<li>
<p>所有的属性都是<code>private</code>的</p>
</li>
<li>
<p>有一个<code>public</code>的无参构造函数</p>
</li>
<li>
<p>实现了<code>Serializable</code>接口</p>
</li>
</ol>
<p>可以看出,JavaBean就是一种惯例,按照要求实现的类就是一个JavaBean。</p></description></item><item><title>UDP检验和</title><link>https://tomial.github.io/posts/udp%E6%A3%80%E9%AA%8C%E5%92%8C/</link><pubDate>Tue, 12 Nov 2019 16:10:43 +0000</pubDate><guid>https://tomial.github.io/posts/udp%E6%A3%80%E9%AA%8C%E5%92%8C/</guid><description><h2 id="udp检验和">UDP检验和</h2>
<p>UDP 检验和提供了差错检测的功能,可以让接收方检测所接收到的UDP报文段是否存在错误。但要注意,<strong>UDP虽然提供了差错检验的功能,但对差错恢复无能为力。</strong></p></description></item><item><title>跟着官方Guide学习Spring Boot(一):Accessing-data-mysql</title><link>https://tomial.github.io/posts/%E8%B7%9F%E7%9D%80%E5%AE%98%E6%96%B9guide%E5%AD%A6%E4%B9%A0spring-boot-%E4%B8%80-accessing-data-mysql/</link><pubDate>Sun, 20 Oct 2019 20:18:22 +0000</pubDate><guid>https://tomial.github.io/posts/%E8%B7%9F%E7%9D%80%E5%AE%98%E6%96%B9guide%E5%AD%A6%E4%B9%A0spring-boot-%E4%B8%80-accessing-data-mysql/</guid><description><p>官网地址:<a href="https://spring.io/guides/gs/accessing-data-mysql/">Accessing data with MySQL</a></p>
<p>本期Guide需要:</p>
<ul>
<li>MySQL5.6或以上版本</li>
<li>一个文本编辑器/IDE</li>
<li>JDK1.8或以上版本</li>
<li>Gradle 4+或 Maven 3.2+</li>
</ul>
<h2 id="使用spring-initializr开始">使用Spring Initializr开始</h2>
<p>在Spring Initializr中选择以下依赖项:</p></description></item><item><title>如何理解REST/RESTful API</title><link>https://tomial.github.io/posts/%E5%A6%82%E4%BD%95%E7%90%86%E8%A7%A3rest-restful-api/</link><pubDate>Mon, 07 Oct 2019 22:37:50 +0000</pubDate><guid>https://tomial.github.io/posts/%E5%A6%82%E4%BD%95%E7%90%86%E8%A7%A3rest-restful-api/</guid><description><h2 id="什么是restrestful">什么是REST/RESTful?</h2>
<p>REST起源于Roy Fielding在2000年发表的<a href="https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation.pdf">博士论文</a></p>
<p>REST的意思是<strong>RE</strong>presentational <strong>S</strong>tate <strong>T</strong>ransfer,中文意思为<strong>表现层状态转移</strong>。</p></description></item><item><title>pacman、aur与yaourt的关系</title><link>https://tomial.github.io/posts/pacmanaur%E4%B8%8Eyaourt%E7%9A%84%E5%85%B3%E7%B3%BB/</link><pubDate>Wed, 25 Sep 2019 11:36:52 +0000</pubDate><guid>https://tomial.github.io/posts/pacmanaur%E4%B8%8Eyaourt%E7%9A%84%E5%85%B3%E7%B3%BB/</guid><description><h2 id="pacman">PACMAN</h2>
<p>Pacman在Arch wiki的说明如下:</p>
<blockquote>
<p>pacman软件包管理器是 Arch Linux 的一大亮点。它将一个简单的二进制包格式和易用的构建系统结合了起来(参见makepkg和ABS)。不管软件包是来自官方的 Arch 库还是用户自己创建,pacman 都能方便地管理。</p></description></item><item><title>Vim常用命令总结</title><link>https://tomial.github.io/posts/vim%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E6%80%BB%E7%BB%93/</link><pubDate>Wed, 14 Aug 2019 12:00:01 +0000</pubDate><guid>https://tomial.github.io/posts/vim%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E6%80%BB%E7%BB%93/</guid><description><p><code>&lt;C-[&gt;</code>:返回普通模式</p>
<p><code>&lt;C-a&gt;</code>:使数字加一</p>
<p><code>&lt;C-x&gt;</code>:使数字减一</p>
<p><code>{n}&lt;C-a&gt;</code>使数字加n</p>
<p><code>{n}&lt;C-x&gt;</code>:使数字减n</p></description></item><item><title>更高效的取余运算</title><link>https://tomial.github.io/posts/%E6%9B%B4%E9%AB%98%E6%95%88%E7%9A%84%E5%8F%96%E4%BD%99%E8%BF%90%E7%AE%97/</link><pubDate>Mon, 12 Aug 2019 12:30:57 +0000</pubDate><guid>https://tomial.github.io/posts/%E6%9B%B4%E9%AB%98%E6%95%88%E7%9A%84%E5%8F%96%E4%BD%99%E8%BF%90%E7%AE%97/</guid><description><p>平常的取余一般用<code>%</code>运算符,在学习<code>ArrayDeque</code>时发现其使用了另一种取余方法:</p>
<p><code>elements[head = (head - 1) &amp; (elements.length - 1)] = e;</code></p>
<p>其中<code>head</code>是该双向队列的头部下标,这段代码既可以解决下标为负的情况又可以起到取余的作用,其中<code>(head - 1) &amp; (elements.length - 1)</code>起到了对<code>elements.length</code> 取余的作用。</p></description></item><item><title>为什么Java中数组是协变的而泛型不是?</title><link>https://tomial.github.io/posts/%E4%B8%BA%E4%BB%80%E4%B9%88java%E4%B8%AD%E6%95%B0%E7%BB%84%E6%98%AF%E5%8D%8F%E5%8F%98%E7%9A%84%E8%80%8C%E6%B3%9B%E5%9E%8B%E4%B8%8D%E6%98%AF/</link><pubDate>Sat, 10 Aug 2019 18:15:14 +0000</pubDate><guid>https://tomial.github.io/posts/%E4%B8%BA%E4%BB%80%E4%B9%88java%E4%B8%AD%E6%95%B0%E7%BB%84%E6%98%AF%E5%8D%8F%E5%8F%98%E7%9A%84%E8%80%8C%E6%B3%9B%E5%9E%8B%E4%B8%8D%E6%98%AF/</guid><description><h3 id="什么是协变">什么是协变?</h3>
<p>Effective Java中写到:</p>
<p>1.数组和泛型有两个主要的不同点。第一个是数组是协变的(covariant),而泛型是不变的(invariant)。</p>
<p>2.协变简单来说就是如果<code>X</code>是<code>Y</code>的子类型则<code>X[]</code>也是 <code>Y[]</code>的子类型。因为数组是协变的,<code>String</code>是<code>Object</code>的子类型,故:</p></description></item><item><title>ICPC Asia Urumqi 2017 B.The Difference</title><link>https://tomial.github.io/posts/icpc-asia-urumqi-2017-b-the-difference/</link><pubDate>Fri, 09 Aug 2019 17:21:45 +0000</pubDate><guid>https://tomial.github.io/posts/icpc-asia-urumqi-2017-b-the-difference/</guid><description><p>Alice was always good at math. Her only weak points were multiplication and subtraction. To help her with that, Bob presented her with the following problem.</p>
<p>He gave her four positive integers. Alice can change their order optionally. Her task is to find an order, denoted by <code>A1,A2,A3</code> and <code>A4</code>, with the maximum value of <code>A1×A2 − A3×A4</code>.</p>
<h3 id="input">Input</h3>
<p>The input contains several test cases and the first line provides an integer <code>t(1 ≤ t ≤ 100)</code>indicating the number of cases.</p></description></item><item><title>ICPC Asia Urumqi 2017 G.The Mountain</title><link>https://tomial.github.io/posts/icpc-asia-urumqi-2017-g-the-mountain/</link><pubDate>Fri, 09 Aug 2019 16:58:08 +0000</pubDate><guid>https://tomial.github.io/posts/icpc-asia-urumqi-2017-g-the-mountain/</guid><description><p>All as we know, a mountain is a large landform that stretches above the surrounding land in a limited area. If we as the tourists take a picture of a distant mountain and print it out, the image on the surface of paper will be in the shape of a particular polygon.</p>
<p>From mathematics angle we can describe the range of the mountain in the picture as a list of distinct points, denoted by<code> (x1,y1)</code> to <code>(xn,yn)</code>. The first point is at the original point of the coordinate system and the last point is lying on the <code>x-axis</code>. All points else have positive <code>y</code> coordinates and incremental <code>x </code>coordinates. Specifically, all <code>x</code> coordinates satisfy <code>0=x1&lt;x2&lt;x3&lt;...&lt;xn</code>. All <code>y</code> coordinates are positive except the first and the last points whose <code>y</code> coordinates are zeroes.</p></description></item><item><title>Leecode.1.Two Sum (两数之和)</title><link>https://tomial.github.io/posts/leecode-1-two-sum/</link><pubDate>Tue, 06 Aug 2019 18:03:48 +0000</pubDate><guid>https://tomial.github.io/posts/leecode-1-two-sum/</guid><description><h2 id="题目描述">题目描述:</h2>
<blockquote>
<p>LeetCode第一题,两数之和</p>
<p>Given an array of integers, return <code>indices</code> of the two numbers such that they add up to a specific target.</p>
<p>You may assume that each input would have <code>exactly</code> one solution, and you may not use the same element twice.</p>
</blockquote>
<p><strong>Example:</strong></p>
<blockquote>
<p>Given nums = [2, 7, 11, 15], target = 9,</p>
<p>Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].</p></description></item><item><title>LeetCode-1128-Number of Equivalent Domino Pairs(等价多米诺骨牌对的数量)</title><link>https://tomial.github.io/posts/leetcode-1128-number-of-equivalent-domino-pairs/</link><pubDate>Thu, 01 Aug 2019 23:35:00 +0000</pubDate><guid>https://tomial.github.io/posts/leetcode-1128-number-of-equivalent-domino-pairs/</guid><description><h2 id="题目描述">题目描述:</h2>
<blockquote>
<p>Given a list of <code>dominoes</code>, <code>dominoes[i] = [a, b]</code> is equivalent to <code>dominoes[j] = [c, d]</code> if and only if either<code> (a==c and b==d)</code>, or <code>(a==d and b==c)</code> - that is, one domino can be rotated to be equal to another domino.</p>
<p>Return the number of pairs <code>(i, j) </code>for which <code>0 &lt;= i &lt; j &lt; dominoes.length</code>, and <code>dominoes[i]</code> is equivalent to <code>dominoes[j]</code>.</p>
</blockquote>
<h2 id="example-1"><strong>Example 1:</strong></h2>
<pre tabindex="0"><code>Input: dominoes = [[1,2],[2,1],[3,4],[5,6]]
Output: 1
</code></pre><p><strong>Constraints:</strong></p></description></item><item><title>Java中的二进制</title><link>https://tomial.github.io/posts/java%E4%B8%AD%E7%9A%84%E4%BA%8C%E8%BF%9B%E5%88%B6/</link><pubDate>Wed, 15 May 2019 23:20:33 +0000</pubDate><guid>https://tomial.github.io/posts/java%E4%B8%AD%E7%9A%84%E4%BA%8C%E8%BF%9B%E5%88%B6/</guid><description><p>Java SE 7之后可以使用二进制来定义<code>byte,short,int,long</code>这些整型变量。要使用二进制来表示整形,需要在数字开头带上<code>0b</code>或者<code>0B</code>,如下所示:</p></description></item><item><title>Java8的Lambda表达式与类型检查、推断及限制</title><link>https://tomial.github.io/posts/java8%E7%9A%84lambda%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%B8%8E%E7%B1%BB%E5%9E%8B%E6%A3%80%E6%9F%A5%E6%8E%A8%E6%96%AD%E5%8F%8A%E9%99%90%E5%88%B6/</link><pubDate>Tue, 23 Apr 2019 22:12:15 +0000</pubDate><guid>https://tomial.github.io/posts/java8%E7%9A%84lambda%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%B8%8E%E7%B1%BB%E5%9E%8B%E6%A3%80%E6%9F%A5%E6%8E%A8%E6%96%AD%E5%8F%8A%E9%99%90%E5%88%B6/</guid><description><p>为了全面了解Lambda表达式,我们应该知道Lambda的实际类型是什么。</p>
<h2 id="类型检查">类型检查</h2>
<pre><code>Lambda的类型**是从使用Lambda的上下文推断出来的**。上下文(即`接受它传递的方法参数`或`变量`)所需要的类型称为`目标类型`。下面的例子说明了Lambda表达式工作时**类型检查**的过程:
</code></pre>
<div class="highlight"><div style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f849c">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f849c">2
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>List<span style="color:#89dceb;font-weight:bold">&lt;</span>Apple<span style="color:#89dceb;font-weight:bold">&gt;</span> heavierThan150g <span style="color:#89dceb;font-weight:bold">=</span>
</span></span><span style="display:flex;"><span> filter(inventory, (Apple a) <span style="color:#89dceb;font-weight:bold">-&gt;</span> a.<span style="color:#89b4fa">getWeight</span>() <span style="color:#89dceb;font-weight:bold">&gt;</span> 150);
</span></span></code></pre></td></tr></table>
</div>
</div><ol>
<li>
<p>使用Lambda的<strong>上下文所需的目标类型</strong>是什么?</p></description></item><item><title>Iterable和Iterator</title><link>https://tomial.github.io/posts/iterable%E5%92%8Citerator/</link><pubDate>Tue, 09 Apr 2019 22:27:12 +0000</pubDate><guid>https://tomial.github.io/posts/iterable%E5%92%8Citerator/</guid><description><h2 id="iterator和iterable的内部实现">Iterator和Iterable的内部实现</h2>
<p><code>iterator</code>为Java中的迭代器对象,是<strong>能够对List这样的集合进行迭代遍历的底层依赖</strong>。而<code>iterable</code>接口里<code>定义了返回iterator的方法,相当于对iterator的封装,实现了iterable接口的类可以支持for each循环。</code></p></description></item><item><title>Java正则表达式匹配模式及实例</title><link>https://tomial.github.io/posts/java%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%8C%B9%E9%85%8D%E6%A8%A1%E5%BC%8F%E5%8F%8A%E5%AE%9E%E4%BE%8B/</link><pubDate>Tue, 09 Apr 2019 01:08:58 +0000</pubDate><guid>https://tomial.github.io/posts/java%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E5%8C%B9%E9%85%8D%E6%A8%A1%E5%BC%8F%E5%8F%8A%E5%AE%9E%E4%BE%8B/</guid><description><table>
<thead>
<tr>
<th style="text-align: center">正则表达式</th>
<th style="text-align: center">匹配</th>
<th style="text-align: center">示例</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center"><code>x</code></td>
<td style="text-align: center">单个字符</td>
<td style="text-align: center">Java匹配<code>Java</code></td>
</tr>
<tr>
<td style="text-align: center"><code>.</code></td>
<td style="text-align: center">任意单个字符</td>
<td style="text-align: center">Java匹配<code>J..a</code></td>
</tr>
<tr>
<td style="text-align: center">(ab|cd)</td>
<td style="text-align: center">ab或cd</td>
<td style="text-align: center">ten匹配t(en|im)</td>
</tr>
<tr>
<td style="text-align: center"><code>[abc]</code></td>
<td style="text-align: center">a或b或c</td>
<td style="text-align: center">Java匹配<code>J[abc]va</code></td>
</tr>
<tr>
<td style="text-align: center"><code>[^abc]</code></td>
<td style="text-align: center">abc外的字符</td>
<td style="text-align: center">Java匹配<code>J[^efg]va</code></td>
</tr>
<tr>
<td style="text-align: center"><code>[a-z]</code></td>
<td style="text-align: center">a-z的任意字符</td>
<td style="text-align: center">Java匹配<code>[A-Z]av[a-z]</code></td>
</tr>
<tr>
<td style="text-align: center"><code>[^a-z]</code></td>
<td style="text-align: center">除a-z的任意字符</td>
<td style="text-align: center">Java匹配<code>Jav[^b-z]</code></td>
</tr>
<tr>
<td style="text-align: center"><code>[a-e[m-p]]</code></td>
<td style="text-align: center">a到e或m到p</td>
<td style="text-align: center">Java匹配 <code>[A-G[I-M]]av[a-d]</code></td>
</tr>
<tr>
<td style="text-align: center"><code>[a-e&amp;&amp;[c-p]]</code></td>
<td style="text-align: center">a到e与c到p的交集</td>
<td style="text-align: center">Java匹配 <code>[A-P&amp;&amp;[I-M]]av[a-d]</code></td>
</tr>
<tr>
<td style="text-align: center"><code>\d</code></td>
<td style="text-align: center">一个数字</td>
<td style="text-align: center">123 匹配<code>\\d</code></td>
</tr>
<tr>
<td style="text-align: center"><code>\D</code></td>
<td style="text-align: center">一个非数字</td>
<td style="text-align: center">$Java匹配<code>[\\D][\\D]ava</code></td>
</tr>
<tr>
<td style="text-align: center"><code>w</code></td>
<td style="text-align: center">单词字符</td>
<td style="text-align: center">Java1匹配 <code>[\\w]ava[\\w]</code></td>
</tr>
<tr>
<td style="text-align: center"><code>W</code></td>
<td style="text-align: center">非单词字符</td>
<td style="text-align: center">$Java匹配<code>[\\W][\\w]ava</code></td>
</tr>
<tr>
<td style="text-align: center"><code>s</code></td>
<td style="text-align: center">空白字符</td>
<td style="text-align: center">Java 2匹配<code>Java\\s2</code></td>
</tr>
<tr>
<td style="text-align: center"><code>p*</code></td>
<td style="text-align: center">p模式出现0次或任意多次(贪婪匹配)</td>
<td style="text-align: center">aaaaab匹配<code>a*b</code></td>
</tr>
<tr>
<td style="text-align: center"><code>p+</code></td>
<td style="text-align: center">p模式出现1次或任意多次</td>
<td style="text-align: center">a匹配<code>a+b*</code>, able匹配<code>(ab)+.*</code></td>
</tr>
<tr>
<td style="text-align: center"><code>p?</code></td>
<td style="text-align: center">p出现0或1次(非贪婪匹配,尽量少地匹配)</td>
<td style="text-align: center">Java匹配<code>J?Java</code>和<code>J?ava</code></td>
</tr>
<tr>
<td style="text-align: center"><code>p{n}</code></td>
<td style="text-align: center">p正好出现n次</td>
<td style="text-align: center">aaaa匹配<code>a{4}</code></td>
</tr>
<tr>
<td style="text-align: center"><code>p{n,}</code></td>
<td style="text-align: center">p至少出现n次</td>
<td style="text-align: center">aaaa匹配<code>a{1,}</code>,a不匹配<code>a{2,}</code></td>
</tr>
<tr>
<td style="text-align: center"><code>p{n,m}</code></td>
<td style="text-align: center">p出现次数在n到m次之间</td>
<td style="text-align: center">aaaa匹配<code>a{1,9}</code>,abb不匹配<code>a{2,9}bb</code></td>
</tr>
</tbody>
</table>
<ul>
<li>
<p><code>matches(regex:String) : boolean</code> : 如果字符串匹配模式,返回true</p></description></item></channel></rss>