-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
348 lines (294 loc) · 36.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><title>WelCome! - [object Object]</title><meta name="author" content="Frank Ho"><meta name="copyright" content="Frank Ho"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="往者不可谏,来者犹可追">
<meta property="og:type" content="website">
<meta property="og:title" content="WelCome!">
<meta property="og:url" content="https://frankho-hwc.github.io/index.html">
<meta property="og:site_name" content="WelCome!">
<meta property="og:description" content="往者不可谏,来者犹可追">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://s2.loli.net/2023/02/16/T4hlktvjrpAV2Sd.jpg">
<meta property="article:author" content="Frank Ho">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://s2.loli.net/2023/02/16/T4hlktvjrpAV2Sd.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://frankho-hwc.github.io/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: {"path":"/search.xml","preload":true,"languages":{"hits_empty":"找不到您查询的内容:${query}"}},
translate: undefined,
noticeOutdate: undefined,
highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: false,
post: false
},
runtime: '',
date_suffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: undefined,
lightbox: 'fancybox',
Snackbar: undefined,
source: {
justifiedGallery: {
js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
}
},
isPhotoFigcaption: true,
islazyload: false,
isAnchor: false,
percent: {
toc: true,
rightside: false,
}
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: 'WelCome!',
isPost: false,
isHome: true,
isHighlightShrink: true,
isToc: false,
postUpdate: '2023-06-19 23:18:22'
}</script><noscript><style type="text/css">
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#recent-posts time,
#post-meta time {
display: inline !important
}
</style></noscript><script>(win=>{
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
}
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
win.getCSS = url => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
link.onload = () => resolve()
link.onerror = () => reject()
document.head.appendChild(link)
})
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
}
}
const t = saveToLocal.get('theme')
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
const detectApple = () => {
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
})(window)</script><meta name="generator" content="Hexo 5.4.2"><link rel="alternate" href="/atom.xml" title="WelCome!" type="application/atom+xml">
</head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://s2.loli.net/2023/02/16/T4hlktvjrpAV2Sd.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">25</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">16</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-heartbeat"></i><span> 清单</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('https://s2.loli.net/2023/02/17/PHzC6iA4EDK3c5L.jpg')"><nav id="nav"><span id="blog-info"><a href="/" title="WelCome!"><span class="site-name">WelCome!</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-heartbeat"></i><span> 清单</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">WelCome!</h1><div id="site-subtitle"><span id="subtitle"></span></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/06/19/%E7%94%A8PPT%E7%94%BB%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C%E5%9B%BE/" title="用PPT画神经网络图">用PPT画神经网络图</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-06-19T02:27:47.000Z" title="发表于 2023-06-19 10:27:47">2023-06-19</time></span></div><div class="content">前言 最近一直在忙着把毕业设计改成一篇会议投出去,其中需要画网络结构图,我在网上找了很多画图的方法,同时也问了老师,最后还是觉得PPT是最合适的画图工具。但是网上关于PPT画神经网络图的帖子和视频讲解较少,所以自己写一篇记录一下:
网络block首先是网络的block,具体步骤如下
先新建一个白色的空白页
然后点击插入->形状->基本形状->立方体
然后就是拖出来后,点击形状格式->设置形状格式->三维旋转,进而设置旋转角度
我这里给出一个具体的值(因为这个值不好找):X 120 Y 50 Z 0 设置出来的效果如下图所示
如果是要设置对称的另一半(例如U-Net),就进行这样的设置:X 60 Y 50 Z 0,效果如图所示:
连接线则使用插入->形状->线条->任意多边形。选择好后可以自己进行连线,然后弄好后需要修改,则可以右键编辑顶点来操作
element-wise addition 和 element-wise multiplication 就从插入 -> 符号内进行寻找即可
图片插入图片作为网络inp ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/06/13/%E4%B8%AA%E4%BA%BA%E6%9D%82%E6%83%B3-I/" title="个人杂想(I)">个人杂想(I)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-06-13T03:45:29.000Z" title="发表于 2023-06-13 11:45:29">2023-06-13</time></span></div><div class="content"> 自从开始弄毕设有进展之后,我已经两个多月没有更新blog了。写blog是个好习惯,应该要好好保持。本来是要在四月底弄完公务员面试的时候就该写一篇的,由于太懒了加上毕设要截稿了就作罢了。现在就补上这一篇吧。我觉得这个阶段是最值得大写特写的,因为我觉得我心态的彻底转变也差不多就是从这个时候开始的吧。
首先是看到自己进面的消息,第一反应那自然是高兴,毕竟证明自己也不是特别差劲。然后就是开始准备材料回家面试了。回去的那天是4月10号,当时先回的崂山盖章,崂山的樱花谢得真快,真是感慨,我都要毕业了。 然后就跑去中山公园,那边樱花还是开的挺灿烂的。游人如织,繁花似锦,似乎这几年就没有发生过啥一般。由于时间关系,我草草地拍了几张就走人了,并未作过多停留。
回家之后,我就开始准备交材料,拿面试通知书,一切都是顺其自然。万幸的是,当时还是有两个好兄弟在家里,就分别都找出来聊了聊天,聊了聊未来的打算。在小城市,能有好友跟你聊天也算是一种幸运了,毕竟小城市并不是年轻人的归宿吧。接下来就是准备面试的面试班了,这是改变我心态最关键的地方吧。
一开始,刚进这个培 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/26/%E4%B8%80%E7%82%B9%E6%84%9F%E6%83%B3/" title="一点感想">一点感想</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-26T07:28:23.000Z" title="发表于 2023-03-26 15:28:23">2023-03-26</time></span></div><div class="content"> 转眼间三月就要过去了,离毕业也不过三个月了。这一个月来,我投了几十家公司,也就几家公司给了笔试。然后公务员成绩到现在也没有消息。毕设我本人又不想混,但是不混嘛又进展不顺。这段时间日子煎熬,到现在考研的也开始陆陆续续上岸了。大家都进入了下一个阶段,只有我在这前不着村后不着店,踟蹰不前。但是时间又过得很快,一天一下就过去了,觉得自己啥也没干。现在就两个字,心累。
我觉得自己并不菜,但是现实证明我现在能力确实不怎么样,也没有人来点拨,只有自己一个在这迷宫里走走停停。能力不足就算了,关键是我什么都想要,什么都抓不住。耐心也慢慢地消磨殆尽了,越来越觉得自己等不起,越来越觉得需要一次成功来给自己一颗定心丸。可就是等不到这个时刻。
上面是2023年3/26/15:28:23所写,现在这部分是3/26/21:35所写,搞笑的是,我的省考出分了,分数令人满意——135.64分。以我的薄见应该是进面了。其实我并不是很想当公务员,但是上天给了我这个机会,我还是要抓住的。如果上了公务员,我还是要考研,我还是要去追求我的梦想,而不是如井底之蛙拘于一地。最主要是不能沾沾自 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/26/%E4%B8%80%E4%BA%9B%E9%A2%98%E7%9B%AE/" title="一些题目">一些题目</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-26T02:18:11.000Z" title="发表于 2023-03-26 10:18:11">2023-03-26</time></span></div><div class="content">请问如下程序输出结果int main(int argc, char * argv[]){ int a[] = { 1,2,3,4,5 }; int* ptr = (int*)(&a + 1); printf("%d,%d", *(a + 1), *(ptr - 1)); return 0;}
答案 2,5
int (*p) [5] = &a;p是一个指针,它指向的是一个包含5个int元素的数组!!
那么执行p+1后,p的偏移量相当于 p + sizeof(int) * 5 !!
而程序中强制将指针p转换成一个int* 那么 p -1 其实就是 p - sizeof(int)所以,p -1 指向了数组中得最后一个元素,也就是 5
[(44条消息) int a5]={1,2,3,4,5}; int p=(int)(&a+1); printf(“%d”,*(p-1));_str[5] = (1,2,3,4,5)&a+1_匡夆的博客-CSDN博客
在天龙手游里有 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/22/%E6%98%A5%E6%8B%9B%E5%AF%84%E5%BD%95/" title="春招寄录">春招寄录</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-22T13:12:24.000Z" title="发表于 2023-03-22 21:12:24">2023-03-22</time></span></div><div class="content">前言这是本人春招记录帖子,各位可以吸取教训
自我介绍本人考研难民,无项目无实习,竞赛只有一些参与奖,绩点50%以内,可以说拉中之拉。以下就是我的春招经历
优博讯这个是我随便投的一家公司,我以为他们家开发用的是c++。结果他们家hr打电话说他们是java客户端和底层硬件的。然后约了个时间进行hr面。
这是我第一次面试,虽然只是hr面。这次面试持续了15min不到。这个hr一开始还让我等了一会才开始面的。首先面试没让我自我介绍,我有点意外。她问了这么几个问题
我的竞赛是否是个人赛
我的英语口语水平
然后问我是不是考研失利,是否准备调剂
看了下籍贯,然后问为什么去深圳发展(他们家就在深圳)?有没有亲戚朋友在深圳?
问了能不能接受出差
问了下学习成绩情况,说我成绩不是很好(废话,要不然早保研了,还在这跟你bb),为什么会成绩这么差,然后你的学习能力怎么样
我的校园经历
最后她说完之后有对hr提问的环节
我提了两个问题
薪资待遇
我提了16-18k。hr回答,不包吃住,但是有一定房补
晋升途径
公司重视校招生,有培养途径。技术岗只能晋升高级技术岗。然后可以有转岗,但是需要进行面试
总 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/21/webserver%E9%9D%A2%E7%BB%8F/" title="webserver面经">webserver面经</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-21T03:03:22.000Z" title="发表于 2023-03-21 11:03:22">2023-03-21</time></span></div><div class="content"></div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/21/KL%E6%95%A3%E5%BA%A6/" title="KL散度">KL散度</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-21T02:48:22.000Z" title="发表于 2023-03-21 10:48:22">2023-03-21</time></span></div><div class="content">前置知识信息熵
什么是信息熵,信息熵就是编码信息平均需要的比特量。$$H(x) = -\sum_{i=1}^np(x_i)\log(p(x_i))$$其中$p(x_i)$表示随机事件$x_i$的概率
KL散度(Kullback-Leibler)KL散度,又称相对熵。可以用来描述两个概率分布P和Q的差异和相似性,用$D_{KL}(P||Q)$表示$$D_{KL}(P||Q) = \sum_{i = 1}^Np(x_i)(\log p(x_i) - \log q(x_i))$$或者写成如下形式$$D_{KL}(P||Q) = \sum_{i = 1}^Np(x_i)\log(\frac{p(x_i)}{q(x_i)})$$很显然,KL散度越小,说明概率$p$和$q$就越接近,那么估计的概率分布与真实的概率分布就越接近
KL 散度可以帮助我们选择最优的参数,比如$p(x)$ 是我们需要估计的一个未知的分布,我们无法直接得知 $p ( x )$ 的分布,不过我们可以建立一个分布 $q(x | \theta)$ 去估计 $p(x)$,为 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/20/Webserver%E9%97%AE%E9%A2%98%E6%B1%87%E6%80%BB/" title="Webserver问题汇总">Webserver问题汇总</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-20T03:07:51.000Z" title="发表于 2023-03-20 11:07:51">2023-03-20</time></span></div><div class="content"></div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/13/I-O%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8/" title="I/O多路复用">I/O多路复用</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-13T02:50:09.000Z" title="发表于 2023-03-13 10:50:09">2023-03-13</time></span></div><div class="content">什么是I/O复用单线程或单进程同时监测若干个文件描述符是否可以执行IO操作的能力。
I/O复用解决什么问题I/O复用是为了解决
I/O模型阻塞I/O阻塞I/O意味着当我们发起一次IO操作后一直等待成功或失败之后才返回,在这期间程序不能做其它的事情。阻塞IO操作只能对单个文件描述符进行操作。
非阻塞I/O非阻塞I/O一般发生在一个for循环中,因为每次IO操作要么是成功的,要么是阻塞的。当发生阻塞的时候,会返回错误EWOULDBLOCK/EAGAIN,然后再根据需求进行下一次for循环操作。这是一种轮询的操作方式,会浪费很多CPU资源。
I/O多路复用IO多路复用在linux系统中可由select,poll,epoll函数完成。下面具体介绍这三种复用方式。
信号驱动I/O开启套接字信号驱动I/O功能,通过 sigaction 系统调⽤安装⼀个信号处理函数,该系统函数⽴即返回,不阻塞;数据报准备好后,内核为该进程产⽣⼀个 SIGIO 信号递交给进程;可以在信号处理函 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="/2023/03/11/%E5%B8%B8%E8%A7%81%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" title="常见设计模式">常见设计模式</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-11T08:55:52.000Z" title="发表于 2023-03-11 16:55:52">2023-03-11</time></span></div><div class="content">设计模式设计模式分类设计模式分为三类:
创造型模式:单例模式、⼯⼚模式、建造者模式、原型模式
结构型模式:适配器模式、桥接模式、外观模式、组合模式、装饰模式、享元模式、代理模式
⾏为型模式:责任链模式、命令模式、解释器模式、迭代器模式、中介者模式、备忘录模式、观察者模式、状态模式、策略模式、模板⽅法模式、访问者模式。
单例模式性质单例模式是指在整个系统生命周期内,保证一个类只能产生一个实例,确保该类的唯一性。
注意:
1、单例类只能有一个实例。
2、单例类必须自己创建自己的唯一实例。
3、单例类必须给所有其他对象提供这一实例。
意图:保证一个类仅有一个实例,并提供一个访问它的全局访问点。
主要解决:一个全局使用的类频繁地创建与销毁。
何时使用:当您想控制实例数目,节省系统资源的时候。
如何解决:判断系统是否已经有这个单例,如果有则返回,如果没有则创建。
关键代码:构造函数是私有的。
应用例子:
一个班级只有一个班主任
有些设备管理器只能设计为单例模式,如一台电脑有两个打印机,但是输出的时候只能有一台打印机打印文件。
优点
在内存里只有一个实例,减少了内存的开销,尤其是频 ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/#content-inner">2</a><a class="page-number" href="/page/3/#content-inner">3</a><a class="extend next" rel="next" href="/page/2/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://s2.loli.net/2023/02/16/T4hlktvjrpAV2Sd.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Frank Ho</div><div class="author-info__description">往者不可谏,来者犹可追</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">25</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">16</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/FrankHo-Hwc"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">frankho的个人博客,欢迎调戏</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/06/19/%E7%94%A8PPT%E7%94%BB%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C%E5%9B%BE/" title="用PPT画神经网络图">用PPT画神经网络图</a><time datetime="2023-06-19T02:27:47.000Z" title="发表于 2023-06-19 10:27:47">2023-06-19</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/06/13/%E4%B8%AA%E4%BA%BA%E6%9D%82%E6%83%B3-I/" title="个人杂想(I)">个人杂想(I)</a><time datetime="2023-06-13T03:45:29.000Z" title="发表于 2023-06-13 11:45:29">2023-06-13</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/26/%E4%B8%80%E7%82%B9%E6%84%9F%E6%83%B3/" title="一点感想">一点感想</a><time datetime="2023-03-26T07:28:23.000Z" title="发表于 2023-03-26 15:28:23">2023-03-26</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/26/%E4%B8%80%E4%BA%9B%E9%A2%98%E7%9B%AE/" title="一些题目">一些题目</a><time datetime="2023-03-26T02:18:11.000Z" title="发表于 2023-03-26 10:18:11">2023-03-26</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/03/22/%E6%98%A5%E6%8B%9B%E5%AF%84%E5%BD%95/" title="春招寄录">春招寄录</a><time datetime="2023-03-22T13:12:24.000Z" title="发表于 2023-03-22 21:12:24">2023-03-22</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
<i class="fas fa-folder-open"></i>
<span>分类</span>
</div>
<ul class="card-category-list" id="aside-cat-list">
<li class="card-category-list-item "><a class="card-category-list-link" href="/categories/exp/"><span class="card-category-list-name">exp</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E6%9D%82%E8%A8%80/"><span class="card-category-list-name">杂言</span><span class="card-category-list-count">1</span></a></li>
</ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89/" style="font-size: 1.39em; color: rgb(195, 72, 9)">计算机视觉</a><a href="/tags/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/" style="font-size: 1.45em; color: rgb(182, 172, 192)">深度学习</a><a href="/tags/%E4%BD%8E%E4%BA%AE%E5%9B%BE%E5%83%8F%E5%A2%9E%E5%BC%BA/" style="font-size: 1.21em; color: rgb(61, 136, 37)">低亮图像增强</a><a href="/tags/%E7%BA%BF%E6%80%A7%E4%BB%A3%E6%95%B0/" style="font-size: 1.15em; color: rgb(27, 161, 107)">线性代数</a><a href="/tags/c/" style="font-size: 1.33em; color: rgb(144, 97, 77)">c++</a><a href="/tags/%E5%B7%A5%E4%BD%9C/" style="font-size: 1.39em; color: rgb(30, 40, 59)">工作</a><a href="/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" style="font-size: 1.15em; color: rgb(123, 186, 177)">网络编程</a><a href="/tags/java%E5%AD%A6%E4%B9%A0/" style="font-size: 1.21em; color: rgb(66, 53, 44)">java学习</a><a href="/tags/C/" style="font-size: 1.15em; color: rgb(81, 165, 19)">C++</a><a href="/tags/%E8%87%AA%E7%84%B6%E8%AF%AD%E8%A8%80%E5%A4%84%E7%90%86/" style="font-size: 1.15em; color: rgb(89, 46, 114)">自然语言处理</a><a href="/tags/%E7%A2%8E%E7%A2%8E%E5%BF%B5/" style="font-size: 1.27em; color: rgb(179, 121, 12)">碎碎念</a><a href="/tags/%E6%9D%82%E8%A8%80/" style="font-size: 1.15em; color: rgb(166, 109, 110)">-杂言</a><a href="/tags/%E8%80%83%E7%A0%94/" style="font-size: 1.15em; color: rgb(71, 27, 188)">考研</a><a href="/tags/%E4%BA%BA%E7%94%9F/" style="font-size: 1.15em; color: rgb(157, 159, 175)">人生</a><a href="/tags/%E5%AE%9E%E9%AA%8C/" style="font-size: 1.15em; color: rgb(195, 151, 101)">实验</a><a href="/tags/%E7%A7%91%E7%A0%94/" style="font-size: 1.15em; color: rgb(180, 20, 194)">科研</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/06/"><span class="card-archive-list-date">六月 2023</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/03/"><span class="card-archive-list-date">三月 2023</span><span class="card-archive-list-count">19</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/02/"><span class="card-archive-list-date">二月 2023</span><span class="card-archive-list-count">4</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">25</div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">35k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-06-19T15:18:22.309Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://s2.loli.net/2023/02/17/PHzC6iA4EDK3c5L.jpg')"><div id="footer-wrap"><div class="copyright">©2020 - 2023 By Frank Ho</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span> 数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>window.typedJSFn = {
init: (str) => {
window.typed = new Typed('#subtitle', Object.assign({
strings: str,
startDelay: 300,
typeSpeed: 150,
loop: true,
backSpeed: 50,
}, ))
},
run: (subtitleType) => {
if (true) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
}
} else {
subtitleType()
}
}
}
</script><script>function subtitleType () {
if (true) {
typedJSFn.init(["往者不可谏,来者犹可追"])
} else {
document.getElementById("subtitle").innerHTML = '往者不可谏,来者犹可追'
}
}
typedJSFn.run(subtitleType)</script></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]
var pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: pjaxSelectors,
cacheBust: false,
analytics: false,
scrollRestoration: false
})
document.addEventListener('pjax:send', function () {
// removeEventListener scroll
window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
window.scrollCollect && window.removeEventListener('scroll', scrollCollect)
document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
typeof typed === 'object' && typed.destroy()
//reset readmode
const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
typeof disqusjs === 'object' && disqusjs.destroy()
})
document.addEventListener('pjax:complete', function () {
window.refreshFn()
document.querySelectorAll('script[data-pjax]').forEach(item => {
const newScript = document.createElement('script')
const content = item.text || item.textContent || item.innerHTML || ""
Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
newScript.appendChild(document.createTextNode(content))
item.parentNode.replaceChild(newScript, item)
})
GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
typeof chatBtnFn === 'function' && chatBtnFn()
typeof panguInit === 'function' && panguInit()
// google analytics
typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});
// baidu analytics
typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
// prismjs
typeof Prism === 'object' && Prism.highlightAll()
})
document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) {
pjax.loadUrl('/404.html')
}
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>