-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
380 lines (327 loc) · 48.3 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
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
<!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>kanojospear's Blog</title><meta name="author" content="Ruan"><meta name="copyright" content="Ruan"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="kanojospear's Blog">
<meta property="og:url" content="http://kanojospear.top/index.html">
<meta property="og:site_name" content="kanojospear's Blog">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/MrRuanCoder/BlogImage@main/Ruan.jfif">
<meta property="article:author" content="Ruan">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/MrRuanCoder/BlogImage@main/Ruan.jfif"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/MrRuanCoder/BlogImage@main/Ruan.jfif"><link rel="canonical" href="http://kanojospear.top/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//www.google-analytics.com" crossorigin=""/><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 async="async" src="https://www.googletagmanager.com/gtag/js?id=360968174"></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '360968174');
</script><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: undefined,
translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
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: false,
islazyload: false,
isAnchor: false,
percent: {
toc: true,
rightside: true,
}
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: 'kanojospear\'s Blog',
isPost: false,
isHome: true,
isHighlightShrink: false,
isToc: false,
postUpdate: '2023-05-26 17:05:11'
}</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,id = false) => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
if (id) link.id = id
link.onerror = reject
link.onload = link.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
link.onload = link.onreadystatechange = null
resolve()
}
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 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://cdn.jsdelivr.net/gh/MrRuanCoder/BlogImage@main/Ruan.jfif" 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">21</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">9</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</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> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</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> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/some/"><i class="fa-fw fa fa-car"></i><span> some</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</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/03/30/73dAfQKXJDqoSa5.jpg')"><nav id="nav"><span id="blog-info"><a href="/" title="kanojospear's Blog"><span class="site-name">kanojospear's Blog</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</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> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/some/"><i class="fa-fw fa fa-car"></i><span> some</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</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">kanojospear's Blog</h1><div id="site_social_icons"><a class="social-icon" href="https://github.com/MrRuanCoder" target="_blank" title="Github"><i class="fab fa-github fa-bounce"></i></a><a class="social-icon" href="mailto:[email protected]" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://discordapp.com/users/Spear" target="_blank" title="Discord"><i class="fa-brands fa-discord"></i></a><a class="social-icon" href="https://https://mastodon.online/@Mr_meeseeks" target="_blank" title="Mastodon"><i class="fa-brands fa-mastodon"></i></a><a class="social-icon" href="https://telegram.org/" target="_blank" title="Telegram"><i class="fa-brands fa-telegram"></i></a></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="post_cover left"><a href="/2023/05/20/%E5%8F%AF%E7%BB%B4%E6%8A%A4%E6%80%A7%E7%9A%84%E6%9E%84%E9%80%A0%E5%8E%9F%E5%88%99-SOLID/" title="可维护性的构造原则-SOLID"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="可维护性的构造原则-SOLID"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/05/20/%E5%8F%AF%E7%BB%B4%E6%8A%A4%E6%80%A7%E7%9A%84%E6%9E%84%E9%80%A0%E5%8E%9F%E5%88%99-SOLID/" title="可维护性的构造原则-SOLID">可维护性的构造原则-SOLID</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-05-20T15:30:22.000Z" title="发表于 2023-05-20 23:30:22">2023-05-20</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span></div><div class="content">可维护性的构造原则-SOLID
(SRP) The Single Responsibility Principle 单一责任原则
责任:变化的原因
不应该有多于1个原因让你的ADT发生变化,否则就拆分开
(OCP) The Open-Closed Principle 开放-封闭原则
对扩展性的开放
模块的行为应是可扩展的
从而该模块可表现出新的行为以满足需求的变化
对修改的封闭
但模块自身的代码是不应被修改的
扩展模块行为的一般途径是修改模块的内部实现
如果一个模块不能被修改,那么它通常被认为是具有固定的行为
关键的解决方案:抽象技术
(LSP) The Liskov Substitution Principle 里氏替换原则
子类型必须能够替换其基类型
派生类必须能够通过其基类的接口使用,客户端无需了解二者之间的差异
(ISP) The Interface Segregation Principle 接口聚合原则
不能强迫客户端依赖于它们不需要的接口:只提供必需的接口(聚合接口)
客户端不应依赖于它们不需要的方法
(DIP) The Dependency In ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/05/20/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E5%9B%9B%EF%BC%89/" title="软构随笔(四)"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/7.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="软构随笔(四)"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/05/20/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E5%9B%9B%EF%BC%89/" 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-05-20T06:07:30.000Z" title="发表于 2023-05-20 14:07:30">2023-05-20</time></span></div><div class="content">toString方法如果想要打印出数组的内容,请直接使用 System.out.println() 或使用 Arrays.toString() 方法。
总结起来,打印 char[] 数组会输出数组的内容而不是地址,可以直接使用 System.out.println() 方法或 Arrays.toString() 方法来打印数组的内容。
Arrays.toString() 是 Java 中的一个静态方法,位于 java.util.Arrays 类中。它用于将数组转换为字符串表示形式,方便打印数组内容或进行调试。
该方法有多个重载形式,可以用于打印不同类型的数组,包括基本数据类型和对象类型的数组。以下是常用的几种用法:
int[] intArray = {1, 2, 3, 4, 5};System.out.println(Arrays.toString(intArray));
输出[1, 2, 3, 4, 5]
Arrays.toString() 方法会遍历数组并将每个元素转换为字符串,并用逗号分隔它们。对于多维数组,需要使用 Arrays.deepToString() 方法来打 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/05/19/%E5%8D%8F%E5%8F%98-%E5%8F%8D%E5%8D%8F%E5%8F%98%E5%92%8C%E6%B3%9B%E5%9E%8B/" title="协变&反协变和泛型"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/5.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="协变&反协变和泛型"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/05/19/%E5%8D%8F%E5%8F%98-%E5%8F%8D%E5%8D%8F%E5%8F%98%E5%92%8C%E6%B3%9B%E5%9E%8B/" 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-05-19T14:36:06.000Z" title="发表于 2023-05-19 22:36:06">2023-05-19</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span></div><div class="content">协变 & 反协变父类型 → 子类型:
协变:返回值和异常不变或越来越具体逆变(反协变):参数类型要相反地变化,要不变或越来越抽象
在Java中,泛型类型参数具有不变性,意味着泛型类型的子类型关系与类型参数的子类型关系没有直接的对应关系。
具体来说,对于两个泛型类型 TypeA 和 TypeB ,即使 TypeA 是 TypeB 的子类型,但是 TypeA 和 TypeB 并不具有直接的子类型关系。
例如,假设有以下类定义:
12class TypeA<T> { ... }class TypeB<T> { ... }
虽然 TypeA 是 TypeB 的子类型,但是以下声明是不合法的:
1TypeA<Integer> a = new TypeB<Integer>(); // 错误
这是因为类型参数具有不变性,意味着 TypeA 和 TypeB 之间没有直接的子类型关系。在类型参数上存在子类型关系的情况下,也只能是协变或逆变的关系,需要使用通配符(?)或使用 extends 和 super ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/05/19/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E4%B8%89%EF%BC%89/" title="软构随笔(三)"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="软构随笔(三)"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/05/19/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E4%B8%89%EF%BC%89/" 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-05-19T13:55:28.000Z" title="发表于 2023-05-19 21:55:28">2023-05-19</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span></div><div class="content">Collections.unmodifiableList()Collections.unmodifiableList()是Java集合框架中的一个静态方法,用于创建一个不可修改(不可变)的列表。它接受一个现有的List实例作为参数,并返回一个只读的视图,该视图不能被修改或添加新元素。
当使用Collections.unmodifiableList()方法创建的不可修改列表时,任何对该列表进行修改的尝试都会导致UnsupportedOperationException异常的抛出。这是一种常见的用法,用于确保集合的不可变性,并防止对集合进行意外的修改。
123456List<String> list = new ArrayList<>();list.add("apple");list.add("banana");List<String> unmodifiableList = Collections.unmodifiableList(list);unmodifiableList.add("cherry&qu ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/05/16/JAVA%E9%AD%94%E6%B3%95%E5%80%BC/" title="JAVA魔法值"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/3.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JAVA魔法值"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/05/16/JAVA%E9%AD%94%E6%B3%95%E5%80%BC/" title="JAVA魔法值">JAVA魔法值</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-05-16T10:06:45.000Z" title="发表于 2023-05-16 18:06:45">2023-05-16</time></span></div><div class="content">魔法值概念魔法值,也叫做魔法数值、魔法数字,通常是指在代码编写时莫名出现的数字,无法直接判断数值代表的含义,必须通过联系代码上下文分析才可以明白,严重降低了代码的可读性。除数字之外,代码中作为key值的常量字符串也被认为是魔法值,尽管其表示含义比数值较为清晰,但是仍然会产生不规范问题。
为什么会出现魔法值在对数据的处理过程中,为了充分利用机器的存储性能,数据库存储时往往使用更加简单的数值来代表复杂的名词含义,如使用1、2、3、4等数值来代表状态信息,0、1来代表false和true等。由于数据库中存储的是数值数据,因此后端代码在与数据交互时,对数据进行验证同样需要使用数值进行判断,这就造成了后端代码中大量[魔法值]的存在。这种编写方式不会产生任何执行错误,代码也是简洁的,但是代码含义非常不直观、且review和后期维护成本是巨大的。
潜在危害除了代码阅读不直观外,魔法值还可能造成以下问题的发生:
数值使用不规范,多处使用不统一,修改时工作量大且容易遗漏
数值使用错误,程序不产生异常,但业务逻辑数据出现问题
常量字符串作为key时拼写错误,key值无对应value,导致数据异常或缓存无 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/05/15/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0%E4%B8%AD%E7%9A%84%E4%B8%83%E5%A4%A7%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" title="软件构造中的七大设计模式"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/2.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="软件构造中的七大设计模式"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/05/15/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0%E4%B8%AD%E7%9A%84%E4%B8%83%E5%A4%A7%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-05-15T07:57:12.000Z" title="发表于 2023-05-15 15:57:12">2023-05-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span></div><div class="content">七大设计模式:https://blog.csdn.net/weixin_51413374/article/details/125267801
Creational patterns创建型模式Factory Method pattern工厂方法模式 通常的创建类的实例的方式是采用new关键字,这需要我们知道要创建实例的类的名字,不过在一些特定情况下,例如client不知道/不确定/不关心要创建哪个具体类的实例(回忆在Lab2中创建Graph接口的实现类对象,client不关心这个Graph是怎样实现),或者不想在client代码中指明要创建的实例时,这样的方法就显得不那么合适。这时我们可以采用工厂方法来创建实例,定义一个用于创建对象的接口,让该接口的子类型来决定实例化哪一个类,从而使一个类的实例化延迟到其子类。
模式原理:
Item(需被创建实例相关):假设有一批item,类别相同但是有些许差异。那么我们可以构造一个Item接口,由各种具体的类ConcreteItemx实现。
Factory(工厂方法相关):为了实现工厂方法模式,我们构造一个I ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/04/30/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E4%BA%8C%EF%BC%89/" title="软构随笔(二)"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="软构随笔(二)"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/30/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E4%BA%8C%EF%BC%89/" 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-04-30T14:34:59.000Z" title="发表于 2023-04-30 22:34:59">2023-04-30</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span></div><div class="content">java中的堆与栈堆栈概述堆 ,优先队列(priority queue);普通的队列是一种先进先出的数据结构(FIFO—First-In/First-Out),元素在队列尾追加,而从队列头删除,(例如:乘车排队,先来的排在前面先上车,后来的就要排的后面后上车; 哎,哎,你怎么插队呢,学没学过队列);在优先队列中,元素被赋予优先级。当访问元素时,具有最高优先级的元素最先取出。优先队列具有最高级先出 (largest-in,first-out)的行为特征。
栈 ,先进后出(FILO—First-In/Last-Out)(例如:超市排队结账,大一点的超市收银台都是一段狭长的过道,本来下一个是你了,突然这个收银台说不结了,OK,栈形成了,排在前面的要后出去了)。
C/C++编译的程序占用的内存分配栈区(stack)由编译器自动分配释放,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。
堆区(heap)一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收 。 注意它与数据结构中的堆是两回事,分配方式倒是类似于链表 。
全局区(静态区)( ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/04/29/MSC2023%E5%B9%B4%E7%AC%AC%E5%8D%81%E4%B8%80%E5%B1%8A%E6%8D%89%E8%99%AB%E5%A4%A7%E8%B5%9B%E9%A2%98%E8%A7%A3/" title="MSC2023年第十一届捉虫大赛题解"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="MSC2023年第十一届捉虫大赛题解"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/29/MSC2023%E5%B9%B4%E7%AC%AC%E5%8D%81%E4%B8%80%E5%B1%8A%E6%8D%89%E8%99%AB%E5%A4%A7%E8%B5%9B%E9%A2%98%E8%A7%A3/" title="MSC2023年第十一届捉虫大赛题解">MSC2023年第十一届捉虫大赛题解</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-04-28T16:03:32.000Z" title="发表于 2023-04-29 00:03:32">2023-04-29</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/CTF/">CTF</a></span></div><div class="content">本次比赛采用CTF赛制,赛题如下:
签到题、使用指南点击即送
电子木鱼
你可通过用鼠标点击2000次获得flag,不过这样做很麻烦,当然用写脚本的方法
先按 F12 查看一下网站的实现代码,查看元素
我们发现这里有一个点击事件,以及提示 ==hit?size=1== ,说明在这种情况下所记下次数加一
所以我们可以python编写代码,直接访问2000次
12345678import requestsindex = "http://172.17.232.51:60180/hit?size=1"for i in range (0,2000): print(i) responce = requests.get(index).textprint(responce)
最后打印出flag
更简单的方法:直接把size后的数改为2000后加到链接上即可得到flag
HIT安全浏览器打开后提示“您的浏览器不符合规定,请用HIT安全浏览器打开”,明显需要伪造一些东西
可以用BurpSuite抓取数据包并且修改
抓包 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/04/17/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94(%E4%B8%80)/" title="软构随笔(一)"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/6.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="软构随笔(一)"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/17/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94(%E4%B8%80)/" 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-04-17T12:34:08.000Z" title="发表于 2023-04-17 20:34:08">2023-04-17</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/">软件构造</a></span></div><div class="content">静态方法Java中的静态方法是属于类而不是对象的方法。它们使用static关键字进行修饰,可以通过类名直接调用,而无需创建类的实例。静态方法在Java中有以下特点:
不依赖于类的实例:静态方法不需要通过对象来调用,而是直接通过类名调用。因此,它们不依赖于类的实例,不可以访问非静态的成员变量和非静态的方法,也不能使用this关键字。
全局可访问:静态方法可以在任何地方被访问,无需创建对象实例。可以通过类名直接调用,例如ClassName.staticMethod()。
无法被覆盖:静态方法是属于类而不是对象的,因此无法被子类覆盖。子类可以定义与父类中的静态方法同名的方法,但不会产生方法的覆盖现象。
可以访问静态成员:静态方法可以访问类的静态成员,包括静态变量和其他静态方法,无需创建对象实例。
适用于工具方法:静态方法通常用于工具方法,例如数学计算、日期处理、字符串处理等,这些方法不需要访问对象的状态,只需要对输入参数进行处理。
以下是一个示例,展示了Java中的静态方法的使用:
1234567891011121314151617181920212223public class MyCla ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/04/04/Javascript%E7%AE%AD%E5%A4%B4%E5%87%BD%E6%95%B0%E8%A1%A8%E8%BE%BE%E5%BC%8F/" title="Javascript箭头函数表达式"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Javascript箭头函数表达式"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/04/04/Javascript%E7%AE%AD%E5%A4%B4%E5%87%BD%E6%95%B0%E8%A1%A8%E8%BE%BE%E5%BC%8F/" title="Javascript箭头函数表达式">Javascript箭头函数表达式</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-04-04T11:10:24.000Z" title="发表于 2023-04-04 19:10:24">2023-04-04</time></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JS/">JS</a></span></div><div class="content">箭头函数表达式是一种比传统的函数定义更简洁的语法,它可以更轻松地定义匿名函数。以下是一些箭头函数表达式的举例:
1.一个简单的箭头函数,接受两个参数并返回它们的和:12const sum = (a, b) => a + b;console.log(sum(2, 3)); // 输出 5
2.如果函数只有一个参数,可以省略参数括号:123const square = x => x * x;console.log(square(4)); // 输出 16
3.如果函数体包含多个语句,则需要使用代码块将它们括起来,并且需要显式返回值:123456const getFullName = (firstName, lastName) => { const fullName = `${firstName} ${lastName}`; return fullName;};console.log(getFullName("John", "Doe")); // 输出 "J ...</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://cdn.jsdelivr.net/gh/MrRuanCoder/BlogImage@main/Ruan.jfif" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Ruan</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">21</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">9</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/MrRuanCoder"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/MrRuanCoder" target="_blank" title="Github"><i class="fab fa-github fa-bounce"></i></a><a class="social-icon" href="mailto:[email protected]" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://discordapp.com/users/Spear" target="_blank" title="Discord"><i class="fa-brands fa-discord"></i></a><a class="social-icon" href="https://https://mastodon.online/@Mr_meeseeks" target="_blank" title="Mastodon"><i class="fa-brands fa-mastodon"></i></a><a class="social-icon" href="https://telegram.org/" target="_blank" title="Telegram"><i class="fa-brands fa-telegram"></i></a></div></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">This is my Blog.(软件构造相关博客已归档于软件构造一栏中,请于分类中查看)</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"><a class="thumbnail" href="/2023/05/20/%E5%8F%AF%E7%BB%B4%E6%8A%A4%E6%80%A7%E7%9A%84%E6%9E%84%E9%80%A0%E5%8E%9F%E5%88%99-SOLID/" title="可维护性的构造原则-SOLID"><img src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="可维护性的构造原则-SOLID"/></a><div class="content"><a class="title" href="/2023/05/20/%E5%8F%AF%E7%BB%B4%E6%8A%A4%E6%80%A7%E7%9A%84%E6%9E%84%E9%80%A0%E5%8E%9F%E5%88%99-SOLID/" title="可维护性的构造原则-SOLID">可维护性的构造原则-SOLID</a><time datetime="2023-05-20T15:30:22.000Z" title="发表于 2023-05-20 23:30:22">2023-05-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/20/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E5%9B%9B%EF%BC%89/" title="软构随笔(四)"><img src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/7.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="软构随笔(四)"/></a><div class="content"><a class="title" href="/2023/05/20/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E5%9B%9B%EF%BC%89/" title="软构随笔(四)">软构随笔(四)</a><time datetime="2023-05-20T06:07:30.000Z" title="发表于 2023-05-20 14:07:30">2023-05-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/19/%E5%8D%8F%E5%8F%98-%E5%8F%8D%E5%8D%8F%E5%8F%98%E5%92%8C%E6%B3%9B%E5%9E%8B/" title="协变&反协变和泛型"><img src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/5.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="协变&反协变和泛型"/></a><div class="content"><a class="title" href="/2023/05/19/%E5%8D%8F%E5%8F%98-%E5%8F%8D%E5%8D%8F%E5%8F%98%E5%92%8C%E6%B3%9B%E5%9E%8B/" title="协变&反协变和泛型">协变&反协变和泛型</a><time datetime="2023-05-19T14:36:06.000Z" title="发表于 2023-05-19 22:36:06">2023-05-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/19/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E4%B8%89%EF%BC%89/" title="软构随笔(三)"><img src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="软构随笔(三)"/></a><div class="content"><a class="title" href="/2023/05/19/%E8%BD%AF%E6%9E%84%E9%9A%8F%E7%AC%94%EF%BC%88%E4%B8%89%EF%BC%89/" title="软构随笔(三)">软构随笔(三)</a><time datetime="2023-05-19T13:55:28.000Z" title="发表于 2023-05-19 21:55:28">2023-05-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/16/JAVA%E9%AD%94%E6%B3%95%E5%80%BC/" title="JAVA魔法值"><img src="https://cdn.jsdelivr.net/gh/LuckyZmj/LuckyBlog@master/themes/matery/source/medias/banner/3.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JAVA魔法值"/></a><div class="content"><a class="title" href="/2023/05/16/JAVA%E9%AD%94%E6%B3%95%E5%80%BC/" title="JAVA魔法值">JAVA魔法值</a><time datetime="2023-05-16T10:06:45.000Z" title="发表于 2023-05-16 18:06:45">2023-05-16</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/CTF/"><span class="card-category-list-name">CTF</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/Web%E5%90%8E%E7%AB%AF/"><span class="card-category-list-name">Web后端</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/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/"><span class="card-category-list-name">软件构造</span><span class="card-category-list-count">13</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/IDE/" style="font-size: 1.1em; color: #999">IDE</a> <a href="/tags/Java/" style="font-size: 1.37em; color: #99a4b2">Java</a> <a href="/tags/JUnit-Test/" style="font-size: 1.1em; color: #999">JUnit Test</a> <a href="/tags/%E8%BD%AF%E4%BB%B6%E6%9E%84%E9%80%A0/" style="font-size: 1.5em; color: #99a9bf">软件构造</a> <a href="/tags/Git/" style="font-size: 1.23em; color: #999ea6">Git</a> <a href="/tags/Java-Web/" style="font-size: 1.1em; color: #999">Java Web</a> <a href="/tags/Github/" style="font-size: 1.1em; color: #999">Github</a> <a href="/tags/JS/" style="font-size: 1.1em; color: #999">JS</a> <a href="/tags/object-Object/" style="font-size: 1.1em; color: #999">[object Object]</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/05/"><span class="card-archive-list-date">五月 2023</span><span class="card-archive-list-count">6</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/04/"><span class="card-archive-list-date">四月 2023</span><span class="card-archive-list-count">4</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">7</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">21</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2023-05-26T09:05:11.378Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">20.1k</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-05-26T09:05:11.388Z"><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/03/30/73dAfQKXJDqoSa5.jpg')"><div id="footer-wrap"><div class="copyright">©2020 - 2023 By Ruan</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 class="footer_custom_text">Hi! Welcome to Ruan's blog.</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="translateLink" type="button" title="简繁转换">繁</button><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="chat_btn" type="button" title="聊天"><i class="fas fa-sms"></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><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><div class="js-pjax"><script>(() => {
const $mermaidWrap = document.querySelectorAll('#article-container .mermaid-wrap')
if ($mermaidWrap.length) {
window.runMermaid = () => {
window.loadMermaid = true
const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'default'
Array.from($mermaidWrap).forEach((item, index) => {
const mermaidSrc = item.firstElementChild
const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
const mermaidID = 'mermaid-' + index
const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent
mermaid.mermaidAPI.render(mermaidID, mermaidDefinition, (svgCode) => {
mermaidSrc.insertAdjacentHTML('afterend', svgCode)
})
})
}
const loadMermaid = () => {
window.loadMermaid ? runMermaid() : getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(runMermaid)
}
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
}
})()</script></div><div class="aplayer no-destroy" data-id="8268465430" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="true"> </div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script>(function(d, w, c) {
w.ChatraID = 'KpaSQzvgj55Ci5A7J';
var s = d.createElement('script');
w[c] = w[c] || function() {
(w[c].q = w[c].q || []).push(arguments);
};
s.async = true;
s.src = 'https://call.chatra.io/chatra.js';
if (d.head) d.head.appendChild(s);
})(document, window, 'Chatra');
if (true) {
var chatBtnFn = () => {
var chatBtn = document.getElementById("chat_btn")
chatBtn.addEventListener("click", function(){
Chatra('openChat')
});
}
chatBtnFn()
} else {
if (true) {
function chatBtnHide () {
Chatra('hide')
}
function chatBtnShow () {
Chatra('show')
}
}
}</script><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: true,
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', '360968174', {'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>