|
|
<!DOCTYPE html>
|
|
|
<html lang="zh-Hans">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
|
|
|
<meta name="theme-color" content="#222">
|
|
|
<meta name="generator" content="Hexo 4.2.0">
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
|
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
|
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
|
|
|
<link rel="mask-icon" href="/images/logo.svg" color="#222">
|
|
|
<meta name="google-site-verification" content="2X6S9P7CAjXjVvw8YyQR8pCu-B0oEu7O9quLgxXuWyA">
|
|
|
<meta name="baidu-site-verification" content="dV8JGNzi0c">
|
|
|
<meta name="chinaz-site-verification" content="500A176AA29CFB31">
|
|
|
|
|
|
<script data-ad-client="ca-pub-7480618470784058" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
|
|
|
|
|
<link rel="stylesheet" href="/css/main.css">
|
|
|
|
|
|
<link rel="stylesheet" href="//fonts.loli.net/css?family=Lato:300,300italic,400,400italic,700,700italic|M+ 2p:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
|
|
|
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
|
|
|
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">
|
|
|
|
|
|
<script id="hexo-configurations">
|
|
|
var NexT = window.NexT || {};
|
|
|
var CONFIG = {"hostname":"nicksxs.me","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
|
|
|
</script>
|
|
|
|
|
|
<meta name="description" content="learn from zero,技术博客,Nicksxs,史学森">
|
|
|
<meta property="og:type" content="website">
|
|
|
<meta property="og:title" content="Nicksxs's Blog">
|
|
|
<meta property="og:url" content="https://nicksxs.me/index.html">
|
|
|
<meta property="og:site_name" content="Nicksxs's Blog">
|
|
|
<meta property="og:description" content="learn from zero,技术博客,Nicksxs,史学森">
|
|
|
<meta property="article:author" content="Nicksxs">
|
|
|
<meta property="article:tag" content="Nicksxs">
|
|
|
<meta property="article:tag" content="史学森">
|
|
|
<meta property="article:tag" content="米方方">
|
|
|
<meta property="article:tag" content="米方方的男朋友">
|
|
|
<meta property="article:tag" content="森哥">
|
|
|
<meta name="twitter:card" content="summary">
|
|
|
|
|
|
<link rel="canonical" href="https://nicksxs.me/">
|
|
|
|
|
|
|
|
|
<script id="page-configurations">
|
|
|
// https://hexo.io/docs/variables.html
|
|
|
CONFIG.page = {
|
|
|
sidebar: "",
|
|
|
isHome : true,
|
|
|
isPost : false,
|
|
|
lang : 'zh-Hans'
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<title>Nicksxs's Blog</title>
|
|
|
|
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-61358619-1"></script>
|
|
|
<script>
|
|
|
if (CONFIG.hostname === location.hostname) {
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
function gtag(){dataLayer.push(arguments);}
|
|
|
gtag('js', new Date());
|
|
|
gtag('config', 'UA-61358619-1');
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
var _hmt = _hmt || [];
|
|
|
(function() {
|
|
|
var hm = document.createElement("script");
|
|
|
hm.src = "https://hm.baidu.com/hm.js?20f33b3c0c0eff9b1522999c0015646d";
|
|
|
var s = document.getElementsByTagName("script")[0];
|
|
|
s.parentNode.insertBefore(hm, s);
|
|
|
})();
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<noscript>
|
|
|
<style>
|
|
|
.use-motion .brand,
|
|
|
.use-motion .menu-item,
|
|
|
.sidebar-inner,
|
|
|
.use-motion .post-block,
|
|
|
.use-motion .pagination,
|
|
|
.use-motion .comments,
|
|
|
.use-motion .post-header,
|
|
|
.use-motion .post-body,
|
|
|
.use-motion .collection-header { opacity: initial; }
|
|
|
|
|
|
.use-motion .site-title,
|
|
|
.use-motion .site-subtitle {
|
|
|
opacity: initial;
|
|
|
top: initial;
|
|
|
}
|
|
|
|
|
|
.use-motion .logo-line-before i { left: initial; }
|
|
|
.use-motion .logo-line-after i { right: initial; }
|
|
|
</style>
|
|
|
</noscript>
|
|
|
|
|
|
<link rel="alternate" href="/atom.xml" title="Nicksxs's Blog" type="application/atom+xml">
|
|
|
</head>
|
|
|
|
|
|
<body itemscope itemtype="http://schema.org/WebPage">
|
|
|
<div class="container use-motion">
|
|
|
<div class="headband"></div>
|
|
|
|
|
|
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
|
|
|
<div class="header-inner"><div class="site-brand-container">
|
|
|
<div class="site-nav-toggle">
|
|
|
<div class="toggle" aria-label="Toggle navigation bar">
|
|
|
<span class="toggle-line toggle-line-first"></span>
|
|
|
<span class="toggle-line toggle-line-middle"></span>
|
|
|
<span class="toggle-line toggle-line-last"></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="site-meta">
|
|
|
|
|
|
<a href="/" class="brand" rel="start">
|
|
|
<span class="logo-line-before"><i></i></span>
|
|
|
<h1 class="site-title">Nicksxs's Blog</h1>
|
|
|
<span class="logo-line-after"><i></i></span>
|
|
|
</a>
|
|
|
<p class="site-subtitle" itemprop="description">What hurts more, the pain of hard work or the pain of regret?</p>
|
|
|
</div>
|
|
|
|
|
|
<div class="site-nav-right">
|
|
|
<div class="toggle popup-trigger">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<nav class="site-nav">
|
|
|
<ul id="menu" class="main-menu menu">
|
|
|
<li class="menu-item menu-item-home">
|
|
|
|
|
|
<a href="/" rel="section"><i class="home fa-fw"></i>Home</a>
|
|
|
|
|
|
</li>
|
|
|
<li class="menu-item menu-item-about">
|
|
|
|
|
|
<a href="/about/" rel="section"><i class="about fa-fw"></i>About</a>
|
|
|
|
|
|
</li>
|
|
|
<li class="menu-item menu-item-tags">
|
|
|
|
|
|
<a href="/tags/" rel="section"><i class="tags fa-fw"></i>Tags</a>
|
|
|
|
|
|
</li>
|
|
|
<li class="menu-item menu-item-categories">
|
|
|
|
|
|
<a href="/categories/" rel="section"><i class="categories fa-fw"></i>Categories</a>
|
|
|
|
|
|
</li>
|
|
|
<li class="menu-item menu-item-archives">
|
|
|
|
|
|
<a href="/archives/" rel="section"><i class="archives fa-fw"></i>Archives</a>
|
|
|
|
|
|
</li>
|
|
|
<li class="menu-item menu-item-sitemap">
|
|
|
|
|
|
<a href="/sitemap.xml" rel="section"><i class="sitemap fa-fw"></i>Sitemap</a>
|
|
|
|
|
|
</li>
|
|
|
<li class="menu-item menu-item-commonweal">
|
|
|
|
|
|
<a href="/404/" rel="section"><i class="heartbeat fa-fw"></i>Commonweal 404</a>
|
|
|
|
|
|
</li>
|
|
|
</ul>
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
<div class="back-to-top">
|
|
|
<i class="fa fa-arrow-up"></i>
|
|
|
<span>0%</span>
|
|
|
</div>
|
|
|
|
|
|
<a href="https://github.com/nicksxs" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>
|
|
|
|
|
|
|
|
|
<main class="main">
|
|
|
<div class="main-inner">
|
|
|
<div class="content-wrap">
|
|
|
|
|
|
|
|
|
<div class="content index posts-expand">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-Hans">
|
|
|
<link itemprop="mainEntityOfPage" href="https://nicksxs.me/2021/03/31/2020-%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/">
|
|
|
|
|
|
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
<meta itemprop="image" content="/uploads/avatar.jpg">
|
|
|
<meta itemprop="name" content="Nicksxs">
|
|
|
<meta itemprop="description" content="learn from zero,技术博客,Nicksxs,史学森">
|
|
|
</span>
|
|
|
|
|
|
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
|
|
<meta itemprop="name" content="Nicksxs's Blog">
|
|
|
</span>
|
|
|
<header class="post-header">
|
|
|
<h2 class="post-title" itemprop="name headline">
|
|
|
|
|
|
<a href="/2021/03/31/2020-%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/" class="post-title-link" itemprop="url">2020 年终总结</a>
|
|
|
</h2>
|
|
|
|
|
|
<div class="post-meta">
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-calendar"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Posted on</span>
|
|
|
|
|
|
<time title="Created: 2021-03-31 23:37:28" itemprop="dateCreated datePublished" datetime="2021-03-31T23:37:28+08:00">2021-03-31</time>
|
|
|
</span>
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-calendar-check"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Edited on</span>
|
|
|
<time title="Modified: 2021-04-01 20:13:24" itemprop="dateModified" datetime="2021-04-01T20:13:24+08:00">2021-04-01</time>
|
|
|
</span>
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-folder"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">In</span>
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E7%94%9F%E6%B4%BB/" itemprop="url" rel="index"><span itemprop="name">生活</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E7%94%9F%E6%B4%BB/%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/" itemprop="url" rel="index"><span itemprop="name">年终总结</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E7%94%9F%E6%B4%BB/%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/2020/" itemprop="url" rel="index"><span itemprop="name">2020</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/" itemprop="url" rel="index"><span itemprop="name">年终总结</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/2020/" itemprop="url" rel="index"><span itemprop="name">2020</span></a>
|
|
|
</span>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
<span id="/2021/03/31/2020-%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/" class="post-meta-item leancloud_visitors" data-flag-title="2020 年终总结" title="Views">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="fa fa-eye"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Views: </span>
|
|
|
<span class="leancloud-visitors-count"></span>
|
|
|
</span>
|
|
|
|
|
|
<span class="post-meta-item">
|
|
|
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-comment"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Disqus: </span>
|
|
|
|
|
|
<a title="disqus" href="/2021/03/31/2020-%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/#disqus_thread" itemprop="discussionUrl">
|
|
|
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="2021/03/31/2020-年终总结/" itemprop="commentCount"></span>
|
|
|
</a>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="post-body" itemprop="articleBody">
|
|
|
|
|
|
|
|
|
<h2 id="拖更原因"><a href="#拖更原因" class="headerlink" title="拖更原因"></a>拖更原因</h2><p>这篇年终总结本来应该在农历过完年就出来的,结果是对没有受疫情影响的春节放假时间空闲情况预估太良好,虽然公司调了几天假,但是因为春节期间疫情状况比较好,本来酒店都不让接待聚餐什么的,后来统统放开,结果就是从初一到初六每天要不就是去亲戚家,要不就是去酒店饭店吃饭,计划很丰满,现实很骨感,时间感觉一下就没了,然后年后感觉有点犯懒了,所以才拖到现在。</p>
|
|
|
<h2 id="生活-健身跑步"><a href="#生活-健身跑步" class="headerlink" title="生活-健身跑步"></a>生活-健身跑步</h2><p>去年(19 年)的时候跑步突破了 300 公里,然后20 年给自己定了个 400 公里的目标,结果意料之中的没成功,原因可能疫情算一点吧,后面买了跑步机之后,基本周末回家都能跑一下,但是最后还是只跑了300 多公里,总的keep 记录跑量也没超过 1000 公里,所以跑步这个目标还是没成功的,不过还算是比去年多跑一点,这样也算后面好突破点,后面的目标就不定的太高了,每年能比前一年多一点就好,其实跑步已经从一种减肥方式变成一种习惯了,一周一次的跑步已经比较难有效减重了,但是对于保持精力和身体状态还是很有效和重要的,只是对于目前的体重还是要多减下去一些跑步才好,太重了对膝盖负担太大了,可惜还是时间呐,游泳骑车什么的都需要更苛刻的条件和时间,饮食呢控制起来比较难(贪吃<br>终于在 3 月底之前跑到了 1000 公里,迟了三个月,不过也总算达到了,只是体重控制还是不行,有试着走走楼梯,但是感觉对膝盖负担比较大,得再想想用什么方式</p>
|
|
|
<p><img data-src="https://gitee.com/nicksxs/images/raw/master/uPic/WechatIMG546-1.png" alt=""></p>
|
|
|
<h2 id="技术成长"><a href="#技术成长" class="headerlink" title="技术成长"></a>技术成长</h2><p>一直提不起笔来写这篇年终总结还有个比较大的原因是觉得20 年的成长不如预期,大小目标都没怎么完成,比如深入了解 jvm,是想能有些深入的见解,而不再是某些点的比较片面的理解,系统性的归纳总结也比较少,每个方向或多或少有些看法和理解,但是不全面,一些东西看过了也会忘记,需要温故而知新,比如 AQS 的内容,第一次读其实理解比较浅,后面就强迫自己去读,去写,才有了一些比之前更深入的理解,因为很多文章都是带有作者思路的引导,适不适合自己都要看是否能从他的思路把它看懂,有些就差别很大,这个跟看书也一样,有些书大众一致推荐,一般情况下大多是经典的好的,但是也有可能是不太适合自己的,可能有时候机缘巧合看到的反而让人茅塞顿开,在 todo 里已经积攒了好多的点和面需要去学习实践,一方面是自己懒,一方面是时间也相对偏少,看看 21 年能不能有所提升,加强“时间管理”,哈哈</p>
|
|
|
<p>技术上主要是看了 mysql 的 mvcc 相关内容,rocketmq 的,redis 的代码,还有 mybatis 等,其实每一个都能写很多,也有很多值得学习的,需要全面系统学习,之前想好好画一个思维导图,将整个技术体系都梳理下,还只做了一点点,方式也有点问题,应该从大到小,而不是深度优先,细节有很多,每一个方面都有自己比较熟悉擅长的,也有不太了解的,可以做一个评分,这个也是亟待改善的,希望今年能完成。</p>
|
|
|
<h2 id="博客"><a href="#博客" class="headerlink" title="博客"></a>博客</h2><p>博客方面 20 年一年整是写了 53 篇,差不多是一周一篇的节奏,这个还是不错的,虽然博客质量参差不齐,但是这个更新频率还是比较好的,并且也定了个潜规则,可以一周技术一周生活,这样能缓解水文的频率,提高些技术文章的质量,虽然结果并没有好多少,不过感觉还是可以这么坚持的,能提高一些技术文章的质量那就更好了</p>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="post-footer">
|
|
|
<div class="post-eof"></div>
|
|
|
</footer>
|
|
|
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-Hans">
|
|
|
<link itemprop="mainEntityOfPage" href="https://nicksxs.me/2021/03/28/%E8%81%8A%E8%81%8A-Linux-%E4%B8%8B%E7%9A%84-top-%E5%91%BD%E4%BB%A4/">
|
|
|
|
|
|
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
<meta itemprop="image" content="/uploads/avatar.jpg">
|
|
|
<meta itemprop="name" content="Nicksxs">
|
|
|
<meta itemprop="description" content="learn from zero,技术博客,Nicksxs,史学森">
|
|
|
</span>
|
|
|
|
|
|
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
|
|
<meta itemprop="name" content="Nicksxs's Blog">
|
|
|
</span>
|
|
|
<header class="post-header">
|
|
|
<h2 class="post-title" itemprop="name headline">
|
|
|
|
|
|
<a href="/2021/03/28/%E8%81%8A%E8%81%8A-Linux-%E4%B8%8B%E7%9A%84-top-%E5%91%BD%E4%BB%A4/" class="post-title-link" itemprop="url">聊聊 Linux 下的 top 命令</a>
|
|
|
</h2>
|
|
|
|
|
|
<div class="post-meta">
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-calendar"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Posted on</span>
|
|
|
|
|
|
<time title="Created: 2021-03-28 23:06:21" itemprop="dateCreated datePublished" datetime="2021-03-28T23:06:21+08:00">2021-03-28</time>
|
|
|
</span>
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-folder"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">In</span>
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/Linux/" itemprop="url" rel="index"><span itemprop="name">Linux</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/Linux/%E5%91%BD%E4%BB%A4/" itemprop="url" rel="index"><span itemprop="name">命令</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/Linux/%E5%91%BD%E4%BB%A4/top/" itemprop="url" rel="index"><span itemprop="name">top</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/" itemprop="url" rel="index"><span itemprop="name">小技巧</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/top/" itemprop="url" rel="index"><span itemprop="name">top</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/top/%E6%8E%92%E5%BA%8F/" itemprop="url" rel="index"><span itemprop="name">排序</span></a>
|
|
|
</span>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
<span id="/2021/03/28/%E8%81%8A%E8%81%8A-Linux-%E4%B8%8B%E7%9A%84-top-%E5%91%BD%E4%BB%A4/" class="post-meta-item leancloud_visitors" data-flag-title="聊聊 Linux 下的 top 命令" title="Views">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="fa fa-eye"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Views: </span>
|
|
|
<span class="leancloud-visitors-count"></span>
|
|
|
</span>
|
|
|
|
|
|
<span class="post-meta-item">
|
|
|
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-comment"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Disqus: </span>
|
|
|
|
|
|
<a title="disqus" href="/2021/03/28/%E8%81%8A%E8%81%8A-Linux-%E4%B8%8B%E7%9A%84-top-%E5%91%BD%E4%BB%A4/#disqus_thread" itemprop="discussionUrl">
|
|
|
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="2021/03/28/聊聊-Linux-下的-top-命令/" itemprop="commentCount"></span>
|
|
|
</a>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="post-body" itemprop="articleBody">
|
|
|
|
|
|
|
|
|
<p>top 命令在日常的 Linux 使用中,特别是做一些服务器的简单状态查看,排查故障都起了比较大的作用,但是由于这个命令看到的东西比较多,一般只会看部分,或者说像我这样就会比较片面地看一些信息,比如默认是进程维度的,可以在启动命令的时候加<code>-H</code>进入线程模式</p>
|
|
|
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">-H :Threads-mode operation</span><br><span class="line"> Instructs top to display individual threads. Without this command-line option a summation of all threads in each process is shown. Later</span><br><span class="line"> this can be changed with the `H' interactive command.</span><br></pre></td></tr></table></figure>
|
|
|
<p>这样就能用在 Java 中去 jstack 中找到对应的线程<br>其实还有比较重要的两个操作,<br>一个是在 top 启动状态下,按<code>c</code>键,这样能把比如说是一个 Java 进程,具体的进程命令显示出来<br>像这样<br>执行前是这样<br><img data-src="https://gitee.com/nicksxs/images/raw/master/uPic/LKn8Bs.png" alt=""><br>执行后是这样<br><img data-src="https://gitee.com/nicksxs/images/raw/master/uPic/1xD6VM.png" alt=""><br>第二个就是排序了</p>
|
|
|
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">SORTING of task window</span><br><span class="line"></span><br><span class="line"> For compatibility, this top supports most of the former top sort keys. Since this is primarily a service to former top users, these commands</span><br><span class="line"> do not appear on any help screen.</span><br><span class="line"> command sorted-field supported</span><br><span class="line"> A start time (non-display) No</span><br><span class="line"> M %MEM Yes</span><br><span class="line"> N PID Yes</span><br><span class="line"> P %CPU Yes</span><br><span class="line"> T TIME+ Yes</span><br><span class="line"></span><br><span class="line"> Before using any of the following sort provisions, top suggests that you temporarily turn on column highlighting using the `x' interactive com‐</span><br><span class="line"> mand. That will help ensure that the actual sort environment matches your intent.</span><br><span class="line"></span><br><span class="line"> The following interactive commands will only be honored when the current sort field is visible. The sort field might not be visible because:</span><br><span class="line"> 1) there is insufficient Screen Width</span><br><span class="line"> 2) the `f' interactive command turned it Off</span><br><span class="line"></span><br><span class="line"> < :Move-Sort-Field-Left</span><br><span class="line"> Moves the sort column to the left unless the current sort field is the first field being displayed.</span><br><span class="line"></span><br><span class="line"> > :Move-Sort-Field-Right</span><br><span class="line"> Moves the sort column to the right unless the current sort field is the last field being displayed.</span><br></pre></td></tr></table></figure>
|
|
|
<p>查看 man page 可以找到这一段,其实一般 man page 都是最细致的,只不过因为太多了,有时候懒得看,这里可以通过大写 <code>M</code> 和大写 <code>P</code> 分别按内存和 CPU 排序,下面还有两个小技巧,通过按 x 可以将当前活跃的排序列用不同颜色标出来,然后可以通过<code><</code>和<code>></code>直接左右移动排序列</p>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="post-footer">
|
|
|
<div class="post-eof"></div>
|
|
|
</footer>
|
|
|
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-Hans">
|
|
|
<link itemprop="mainEntityOfPage" href="https://nicksxs.me/2021/03/21/%E5%85%B3%E4%BA%8E%E5%85%AC%E5%85%B1%E4%BA%A4%E9%80%9A%E5%86%8D%E5%90%90%E4%B8%AA%E6%A7%BD/">
|
|
|
|
|
|
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
<meta itemprop="image" content="/uploads/avatar.jpg">
|
|
|
<meta itemprop="name" content="Nicksxs">
|
|
|
<meta itemprop="description" content="learn from zero,技术博客,Nicksxs,史学森">
|
|
|
</span>
|
|
|
|
|
|
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
|
|
<meta itemprop="name" content="Nicksxs's Blog">
|
|
|
</span>
|
|
|
<header class="post-header">
|
|
|
<h2 class="post-title" itemprop="name headline">
|
|
|
|
|
|
<a href="/2021/03/21/%E5%85%B3%E4%BA%8E%E5%85%AC%E5%85%B1%E4%BA%A4%E9%80%9A%E5%86%8D%E5%90%90%E4%B8%AA%E6%A7%BD/" class="post-title-link" itemprop="url">关于公共交通再吐个槽</a>
|
|
|
</h2>
|
|
|
|
|
|
<div class="post-meta">
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-calendar"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Posted on</span>
|
|
|
|
|
|
<time title="Created: 2021-03-21 23:23:40" itemprop="dateCreated datePublished" datetime="2021-03-21T23:23:40+08:00">2021-03-21</time>
|
|
|
</span>
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-folder"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">In</span>
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E7%94%9F%E6%B4%BB/" itemprop="url" rel="index"><span itemprop="name">生活</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/%E7%94%9F%E6%B4%BB/%E5%85%AC%E4%BA%A4/" itemprop="url" rel="index"><span itemprop="name">公交</span></a>
|
|
|
</span>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
<span id="/2021/03/21/%E5%85%B3%E4%BA%8E%E5%85%AC%E5%85%B1%E4%BA%A4%E9%80%9A%E5%86%8D%E5%90%90%E4%B8%AA%E6%A7%BD/" class="post-meta-item leancloud_visitors" data-flag-title="关于公共交通再吐个槽" title="Views">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="fa fa-eye"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Views: </span>
|
|
|
<span class="leancloud-visitors-count"></span>
|
|
|
</span>
|
|
|
|
|
|
<span class="post-meta-item">
|
|
|
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-comment"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Disqus: </span>
|
|
|
|
|
|
<a title="disqus" href="/2021/03/21/%E5%85%B3%E4%BA%8E%E5%85%AC%E5%85%B1%E4%BA%A4%E9%80%9A%E5%86%8D%E5%90%90%E4%B8%AA%E6%A7%BD/#disqus_thread" itemprop="discussionUrl">
|
|
|
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="2021/03/21/关于公共交通再吐个槽/" itemprop="commentCount"></span>
|
|
|
</a>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="post-body" itemprop="articleBody">
|
|
|
|
|
|
|
|
|
<p>事情源于周末来回家发生的两件事情,先是回去的时候从高铁下车要坐公交,现在算是有个比较好的临时候车点了,但是可能由于疫情好转,晚上都不用检查健康码就可以进候车点,但是上公交的时候还是需要看健康码,一般情况下从高铁下来的,各个地方的人都有,而且也不太清楚这边上公交车需要查验健康码,我的一个看法是候车的时候就应该放个横幅告示,或者再配合喇叭循环播放,请提前准备好健康码,上车前需要查验,因为像这周的情况,我乘坐的那辆车是间隔时间比较长,而且终点是工业开发区,可能是比较多外来务工人员的目的地,正好这部分人可能对于操作手机检验健康码这个事情不太熟悉,所以结果就是头上几个不知道怎么搞出来健康码,然后让几乎有满满一整车的人在后面堵着,司机又非常厌烦那些没有提前出示健康码的,有位乘客搞得久了点,还被误以为没刷卡买票,差点吵起来,其实公共交通或者高铁站负责的在公交指引路线上多写一句上车前需要查验健康码,可能就能改善比较多,还有就是那个积水的路,这个吐槽起来就一大坨了,整个绍兴像 dayuejin 一样到处都是破路。<br>第二个就是来杭州的时候,经过人行横道,远处车道的公交车停下来等我们了,为了少添麻烦总想快点穿过去,但是这时靠近我们的车道(晚上光线较暗,可见度不佳)有一辆从远处来的奥迪 A4 还是 A5 这种的车反而想加速冲过去,如果少看一下可能我已经残了,交规考的靠近人行道要减速好像基本都是个摆设了,杭州也只有公交车因为一些考核指标原因会主动礼让,人其实需要有同理心,虽然可能有些人是开车多于骑车走路的,但是总也不可能永远不穿人行道吧,甚至这些人可能还会在人行道红灯的时候走过去。这个事情不是吐槽公共交通的,只是也有些许关系,想起来还有一件事也是刚才来杭州的时候看到的,等公交的时候看到有辆路虎要加塞,而目标车道刚好是辆大货车,大货车看到按了喇叭,路虎犹豫了下还是挤进去了,可能是对路虎的扛撞性能非常自信吧,反正我是挺后怕的,这种级别的车,被撞了的话估计还是鸡蛋撞石头,吨位惯性在那,这里再延伸下,挺多开豪车的人好像都觉得这路上路权更大一些,谁谁都得让着他,可能实际吃亏的不多,所以越加巩固了这种思维,当真的碰到不管的可能就会明白了,路权这个事情在天朝也基本没啥人重视,也没想说个结论,就到这吧</p>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="post-footer">
|
|
|
<div class="post-eof"></div>
|
|
|
</footer>
|
|
|
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-Hans">
|
|
|
<link itemprop="mainEntityOfPage" href="https://nicksxs.me/2021/03/14/Leetcode-121-%E4%B9%B0%E5%8D%96%E8%82%A1%E7%A5%A8%E7%9A%84%E6%9C%80%E4%BD%B3%E6%97%B6%E6%9C%BA-Best-Time-to-Buy-and-Sell-Stock-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/">
|
|
|
|
|
|
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
<meta itemprop="image" content="/uploads/avatar.jpg">
|
|
|
<meta itemprop="name" content="Nicksxs">
|
|
|
<meta itemprop="description" content="learn from zero,技术博客,Nicksxs,史学森">
|
|
|
</span>
|
|
|
|
|
|
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
|
|
<meta itemprop="name" content="Nicksxs's Blog">
|
|
|
</span>
|
|
|
<header class="post-header">
|
|
|
<h2 class="post-title" itemprop="name headline">
|
|
|
|
|
|
<a href="/2021/03/14/Leetcode-121-%E4%B9%B0%E5%8D%96%E8%82%A1%E7%A5%A8%E7%9A%84%E6%9C%80%E4%BD%B3%E6%97%B6%E6%9C%BA-Best-Time-to-Buy-and-Sell-Stock-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/" class="post-title-link" itemprop="url">Leetcode 121 买卖股票的最佳时机(Best Time to Buy and Sell Stock) 题解分析</a>
|
|
|
</h2>
|
|
|
|
|
|
<div class="post-meta">
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-calendar"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Posted on</span>
|
|
|
|
|
|
<time title="Created: 2021-03-14 22:34:30" itemprop="dateCreated datePublished" datetime="2021-03-14T22:34:30+08:00">2021-03-14</time>
|
|
|
</span>
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-folder"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">In</span>
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/Java/" itemprop="url" rel="index"><span itemprop="name">Java</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/leetcode/" itemprop="url" rel="index"><span itemprop="name">leetcode</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/DP/" itemprop="url" rel="index"><span itemprop="name">DP</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/leetcode/java/" itemprop="url" rel="index"><span itemprop="name">java</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/leetcode/java/DP/" itemprop="url" rel="index"><span itemprop="name">DP</span></a>
|
|
|
</span>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
<span id="/2021/03/14/Leetcode-121-%E4%B9%B0%E5%8D%96%E8%82%A1%E7%A5%A8%E7%9A%84%E6%9C%80%E4%BD%B3%E6%97%B6%E6%9C%BA-Best-Time-to-Buy-and-Sell-Stock-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/" class="post-meta-item leancloud_visitors" data-flag-title="Leetcode 121 买卖股票的最佳时机(Best Time to Buy and Sell Stock) 题解分析" title="Views">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="fa fa-eye"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Views: </span>
|
|
|
<span class="leancloud-visitors-count"></span>
|
|
|
</span>
|
|
|
|
|
|
<span class="post-meta-item">
|
|
|
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-comment"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Disqus: </span>
|
|
|
|
|
|
<a title="disqus" href="/2021/03/14/Leetcode-121-%E4%B9%B0%E5%8D%96%E8%82%A1%E7%A5%A8%E7%9A%84%E6%9C%80%E4%BD%B3%E6%97%B6%E6%9C%BA-Best-Time-to-Buy-and-Sell-Stock-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/#disqus_thread" itemprop="discussionUrl">
|
|
|
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="2021/03/14/Leetcode-121-买卖股票的最佳时机-Best-Time-to-Buy-and-Sell-Stock-题解分析/" itemprop="commentCount"></span>
|
|
|
</a>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="post-body" itemprop="articleBody">
|
|
|
|
|
|
|
|
|
<h3 id="题目介绍"><a href="#题目介绍" class="headerlink" title="题目介绍"></a>题目介绍</h3><p>You are given an array <code>prices</code> where <code>prices[i]</code> is the price of a given stock on the i<sup>th</sup> day.</p>
|
|
|
<p>You want to maximize your profit by choosing a <strong>single day</strong> to buy one stock and choosing a <strong>different day in the future</strong> to sell that stock.</p>
|
|
|
<p>Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return <code>0</code>.</p>
|
|
|
<p>给定一个数组 <code>prices</code> ,它的第 <code>i</code> 个元素 <code>prices[i]</code> 表示一支给定股票第 <code>i</code> 天的价格。</p>
|
|
|
<p>你只能选择 <strong>某一天</strong> 买入这只股票,并选择在 <strong>未来的某一个不同的日子</strong> 卖出该股票。设计一个算法来计算你所能获取的最大利润。</p>
|
|
|
<p>返回你可以从这笔交易中获取的最大利润。如果你不能获取任何利润,返回 <code>0</code> 。</p>
|
|
|
<h3 id="简单分析"><a href="#简单分析" class="headerlink" title="简单分析"></a>简单分析</h3><p>其实这个跟二叉树的最长路径和有点类似,需要找到整体的最大收益,但是在迭代过程中需要一个当前的值</p>
|
|
|
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">int</span> maxSofar = <span class="number">0</span>;</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">maxProfit</span><span class="params">(<span class="keyword">int</span>[] prices)</span> </span>{</span><br><span class="line"> <span class="keyword">if</span> (prices.length <= <span class="number">1</span>) {</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">int</span> maxIn = prices[<span class="number">0</span>];</span><br><span class="line"> <span class="keyword">int</span> maxOut = prices[<span class="number">0</span>];</span><br><span class="line"> <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>; i < prices.length; i++) {</span><br><span class="line"> <span class="keyword">if</span> (maxIn > prices[i]) {</span><br><span class="line"> <span class="comment">// 当循环当前值小于之前的买入值时就当成买入值,同时卖出也要更新</span></span><br><span class="line"> maxIn = prices[i];</span><br><span class="line"> maxOut = prices[i];</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (prices[i] > maxOut) {</span><br><span class="line"> <span class="comment">// 表示一个可卖出点,即比买入值高时</span></span><br><span class="line"> maxOut = prices[i];</span><br><span class="line"> <span class="comment">// 需要设置一个历史值</span></span><br><span class="line"> maxSofar = Math.max(maxSofar, maxOut - maxIn);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> maxSofar;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
|
|
|
|
|
|
<h3 id="总结下"><a href="#总结下" class="headerlink" title="总结下"></a>总结下</h3><p>一开始看到 easy 就觉得是很简单,就没有 maxSofar ,但是一提交就出现问题了<br>对于<code>[2, 4, 1]</code>这种就会变成 0,所以还是需要一个历史值来存放历史最大值,这题有点动态规划的意思</p>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="post-footer">
|
|
|
<div class="post-eof"></div>
|
|
|
</footer>
|
|
|
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-Hans">
|
|
|
<link itemprop="mainEntityOfPage" href="https://nicksxs.me/2021/03/07/%E3%80%8A%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E7%AE%97%E6%B3%95%E6%89%8B%E5%86%8C%E8%AF%BB%E4%B9%A6%E3%80%8B%E7%AC%94%E8%AE%B0%E4%B9%8B%E6%95%B4%E7%90%86%E7%AE%97%E6%B3%95/">
|
|
|
|
|
|
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
<meta itemprop="image" content="/uploads/avatar.jpg">
|
|
|
<meta itemprop="name" content="Nicksxs">
|
|
|
<meta itemprop="description" content="learn from zero,技术博客,Nicksxs,史学森">
|
|
|
</span>
|
|
|
|
|
|
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
|
|
<meta itemprop="name" content="Nicksxs's Blog">
|
|
|
</span>
|
|
|
<header class="post-header">
|
|
|
<h2 class="post-title" itemprop="name headline">
|
|
|
|
|
|
<a href="/2021/03/07/%E3%80%8A%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E7%AE%97%E6%B3%95%E6%89%8B%E5%86%8C%E8%AF%BB%E4%B9%A6%E3%80%8B%E7%AC%94%E8%AE%B0%E4%B9%8B%E6%95%B4%E7%90%86%E7%AE%97%E6%B3%95/" class="post-title-link" itemprop="url">《垃圾回收算法手册读书》笔记之整理算法</a>
|
|
|
</h2>
|
|
|
|
|
|
<div class="post-meta">
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-calendar"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Posted on</span>
|
|
|
|
|
|
<time title="Created: 2021-03-07 20:37:06" itemprop="dateCreated datePublished" datetime="2021-03-07T20:37:06+08:00">2021-03-07</time>
|
|
|
</span>
|
|
|
<span class="post-meta-item">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-folder"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">In</span>
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/Java/" itemprop="url" rel="index"><span itemprop="name">Java</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/Java/gc/" itemprop="url" rel="index"><span itemprop="name">gc</span></a>
|
|
|
</span>
|
|
|
,
|
|
|
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
|
|
<a href="/categories/Java/gc/jvm/" itemprop="url" rel="index"><span itemprop="name">jvm</span></a>
|
|
|
</span>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
<span id="/2021/03/07/%E3%80%8A%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E7%AE%97%E6%B3%95%E6%89%8B%E5%86%8C%E8%AF%BB%E4%B9%A6%E3%80%8B%E7%AC%94%E8%AE%B0%E4%B9%8B%E6%95%B4%E7%90%86%E7%AE%97%E6%B3%95/" class="post-meta-item leancloud_visitors" data-flag-title="《垃圾回收算法手册读书》笔记之整理算法" title="Views">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="fa fa-eye"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Views: </span>
|
|
|
<span class="leancloud-visitors-count"></span>
|
|
|
</span>
|
|
|
|
|
|
<span class="post-meta-item">
|
|
|
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="far fa-comment"></i>
|
|
|
</span>
|
|
|
<span class="post-meta-item-text">Disqus: </span>
|
|
|
|
|
|
<a title="disqus" href="/2021/03/07/%E3%80%8A%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E7%AE%97%E6%B3%95%E6%89%8B%E5%86%8C%E8%AF%BB%E4%B9%A6%E3%80%8B%E7%AC%94%E8%AE%B0%E4%B9%8B%E6%95%B4%E7%90%86%E7%AE%97%E6%B3%95/#disqus_thread" itemprop="discussionUrl">
|
|
|
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="2021/03/07/《垃圾回收算法手册读书》笔记之整理算法/" itemprop="commentCount"></span>
|
|
|
</a>
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="post-body" itemprop="articleBody">
|
|
|
|
|
|
|
|
|
<p>最近看了下这本垃圾回收算法手册,看到了第三章的标记-整理回收算法,做个简单的读书笔记</p>
|
|
|
<h3 id="双指针整理算法"><a href="#双指针整理算法" class="headerlink" title="双指针整理算法"></a>双指针整理算法</h3><p>对于一块待整理区域,通过两个指针,free 在区域的起始端,scan 指针在区域的末端,free 指针从前往后知道找到空闲区域,scan 从后往前一直找到存活对象,当 free 指针未与 scan 指针交叉时,会给 scan 位置的对象特定位置标记上 free 的地址,即将要转移的地址,不过这里有个限制,这种整理算法一般会用于对象大小统一的情况,否则 free 指针扫描时还需要匹配scan 指针扫描到的存活对象的大小。<br><img data-src="https://gitee.com/nicksxs/images/raw/master/uPic/yLQlgj.png" alt=""></p>
|
|
|
<h3 id="Lisp-2-整理算法"><a href="#Lisp-2-整理算法" class="headerlink" title="Lisp 2 整理算法"></a>Lisp 2 整理算法</h3><p>需要三次完整遍历堆区域<br>第一遍是遍历后将计算出所有对象的最终地址(转发地址)<br>第二遍是使用转发地址更新赋值器线程根以及被标记对象中的引用,该操作将确保它们指向对象的新位置<br>第三次遍历是relocate最终将存活对象移动到其新的目标位置</p>
|
|
|
<h3 id="引线整理算法"><a href="#引线整理算法" class="headerlink" title="引线整理算法"></a>引线整理算法</h3><p>这个真的长见识了,<br><img data-src="https://gitee.com/nicksxs/images/raw/master/uPic/6yeA7n.png" alt=""><br>可以看到,原来是 A,B,C 对象引用了 N,这里会在第一次遍历的时候把这种引用反过来,让 N 的对象头部保存下 A 的地址,表示这类引用,然后在遍历到 B 的时候在链起来,到最后就会把所有引用了 N 对象的所有对象通过引线链起来,在第二次遍历的时候就把更新A,B,C 对象引用的 N 地址,并且移动 N 对象</p>
|
|
|
<h3 id="单次遍历算法"><a href="#单次遍历算法" class="headerlink" title="单次遍历算法"></a>单次遍历算法</h3><p>这个一直提到过位图的实现方式,<br><img data-src="https://gitee.com/nicksxs/images/raw/master/uPic/Jqtuzu.png" alt=""><br>可以看到在第一步会先通过位图标记,标记的方式是位图的每一位对应的堆内存的一个字(这里可能指的是 byte 吧),然后将一个存活对象的内存区域的第一个字跟最后一个字标记,这里如果在通过普通的方式就还需要一个地方在存转发地址,但是因为具体的位置可以通过位图算出来,也就不需要额外记录了</p>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="post-footer">
|
|
|
<div class="post-eof"></div>
|
|
|
</footer>
|
|
|
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<nav class="pagination">
|
|
|
<span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><span class="space">…</span><a class="page-number" href="/page/20/">20</a><a class="extend next" rel="next" href="/page/2/"><i class="fa fa-angle-right" aria-label="Next page"></i></a>
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
window.addEventListener('tabs:register', () => {
|
|
|
let { activeClass } = CONFIG.comments;
|
|
|
if (CONFIG.comments.storage) {
|
|
|
activeClass = localStorage.getItem('comments_active') || activeClass;
|
|
|
}
|
|
|
if (activeClass) {
|
|
|
let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
|
|
|
if (activeTab) {
|
|
|
activeTab.click();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
if (CONFIG.comments.storage) {
|
|
|
window.addEventListener('tabs:click', event => {
|
|
|
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
|
|
|
let commentClass = event.target.classList[1];
|
|
|
localStorage.setItem('comments_active', commentClass);
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="toggle sidebar-toggle">
|
|
|
<span class="toggle-line toggle-line-first"></span>
|
|
|
<span class="toggle-line toggle-line-middle"></span>
|
|
|
<span class="toggle-line toggle-line-last"></span>
|
|
|
</div>
|
|
|
|
|
|
<aside class="sidebar">
|
|
|
<div class="sidebar-inner">
|
|
|
|
|
|
<ul class="sidebar-nav motion-element">
|
|
|
<li class="sidebar-nav-toc">
|
|
|
Table of Contents
|
|
|
</li>
|
|
|
<li class="sidebar-nav-overview">
|
|
|
Overview
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
<!--noindex-->
|
|
|
<div class="post-toc-wrap sidebar-panel">
|
|
|
</div>
|
|
|
<!--/noindex-->
|
|
|
|
|
|
<div class="site-overview-wrap sidebar-panel">
|
|
|
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
<img class="site-author-image" itemprop="image" alt="Nicksxs"
|
|
|
src="/uploads/avatar.jpg">
|
|
|
<p class="site-author-name" itemprop="name">Nicksxs</p>
|
|
|
<div class="site-description" itemprop="description">learn from zero,技术博客,Nicksxs,史学森</div>
|
|
|
</div>
|
|
|
<div class="site-state-wrap motion-element">
|
|
|
<nav class="site-state">
|
|
|
<div class="site-state-item site-state-posts">
|
|
|
<a href="/archives/">
|
|
|
|
|
|
<span class="site-state-item-count">96</span>
|
|
|
<span class="site-state-item-name">posts</span>
|
|
|
</a>
|
|
|
</div>
|
|
|
<div class="site-state-item site-state-categories">
|
|
|
<a href="/categories/">
|
|
|
|
|
|
<span class="site-state-item-count">121</span>
|
|
|
<span class="site-state-item-name">categories</span></a>
|
|
|
</div>
|
|
|
<div class="site-state-item site-state-tags">
|
|
|
<a href="/tags/">
|
|
|
|
|
|
<span class="site-state-item-count">177</span>
|
|
|
<span class="site-state-item-name">tags</span></a>
|
|
|
</div>
|
|
|
</nav>
|
|
|
</div>
|
|
|
<div class="links-of-author motion-element">
|
|
|
<span class="links-of-author-item">
|
|
|
<a href="https://github.com/nicksxs" title="GitHub → https://github.com/nicksxs" rel="noopener" target="_blank"><i class="github fa-fw"></i>GitHub</a>
|
|
|
</span>
|
|
|
<span class="links-of-author-item">
|
|
|
<a href="mailto:nicksxs1202@gmail.com" title="E-Mail → mailto:nicksxs1202@gmail.com" rel="noopener" target="_blank"><i class="envelope fa-fw"></i>E-Mail</a>
|
|
|
</span>
|
|
|
<span class="links-of-author-item">
|
|
|
<a href="/atom.xml" title="RSS → /atom.xml"><i class="rss fa-fw"></i>RSS</a>
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="cc-license motion-element" itemprop="license">
|
|
|
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
|
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript" charset="utf-8" src="/js/tagcloud.js"></script>
|
|
|
<script type="text/javascript" charset="utf-8" src="/js/tagcanvas.js"></script>
|
|
|
<div class="widget-wrap">
|
|
|
<div id="myCanvasContainer" class="widget tagcloud">
|
|
|
<canvas width="250" height="250" id="resCanvas" style="width=100%">
|
|
|
<ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/2019/" rel="tag">2019</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/2020/" rel="tag">2020</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/2021/" rel="tag">2021</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/2PC/" rel="tag">2PC</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/3PC/" rel="tag">3PC</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/AOP/" rel="tag">AOP</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Adaptive/" rel="tag">Adaptive</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Apollo/" rel="tag">Apollo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Binary-Tree/" rel="tag">Binary Tree</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Broker/" rel="tag">Broker</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/" rel="tag">C</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/" rel="tag">C++</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Comparator/" rel="tag">Comparator</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/DFS/" rel="tag">DFS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/DP/" rel="tag">DP</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/DefaultMQPushConsumer/" rel="tag">DefaultMQPushConsumer</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Design-Patterns/" rel="tag">Design Patterns</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Distributed-Lock/" rel="tag">Distributed Lock</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Docker/" rel="tag">Docker</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Dockerfile/" rel="tag">Dockerfile</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Dubbo/" rel="tag">Dubbo</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Filter/" rel="tag">Filter</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/G1/" rel="tag">G1</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/GC/" rel="tag">GC</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Garbage-First-Collector/" rel="tag">Garbage-First Collector</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Gogs/" rel="tag">Gogs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Homebrew/" rel="tag">Homebrew</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Inorder-Traversal/" rel="tag">Inorder Traversal</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Interceptor/" rel="tag">Interceptor</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JMap/" rel="tag">JMap</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JPS/" rel="tag">JPS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JStack/" rel="tag">JStack</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JVM/" rel="tag">JVM</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Java/" rel="tag">Java</a><span class="tag-list-count">13</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Linked-List/" rel="tag">Linked List</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MQ/" rel="tag">MQ</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Mac/" rel="tag">Mac</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Maven/" rel="tag">Maven</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Mybatis/" rel="tag">Mybatis</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Mysql/" rel="tag">Mysql</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/NameServer/" rel="tag">NameServer</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/PHP/" rel="tag">PHP</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Preorder-Traversal/" rel="tag">Preorder Traversal</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RPC/" rel="tag">RPC</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Redis/" rel="tag">Redis</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RocketMQ/" rel="tag">RocketMQ</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SPI/" rel="tag">SPI</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Servlet/" rel="tag">Servlet</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Singleton/" rel="tag">Singleton</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Spring/" rel="tag">Spring</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Sql%E6%B3%A8%E5%85%A5/" rel="tag">Sql注入</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Stream/" rel="tag">Stream</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Thread-dump/" rel="tag">Thread dump</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Tomcat/" rel="tag">Tomcat</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Web/" rel="tag">Web</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Webhook/" rel="tag">Webhook</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/aqs/" rel="tag">aqs</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/await/" rel="tag">await</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/bloom-filter/" rel="tag">bloom filter</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/" rel="tag">c++</a><span class="tag-list-count">14</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cgroup/" rel="tag">cgroup</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cluster/" rel="tag">cluster</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/condition/" rel="tag">condition</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/docker/" rel="tag">docker</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/echo/" rel="tag">echo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/environment/" rel="tag">environment</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gap-lock/" rel="tag">gap lock</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gc/" rel="tag">gc</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/grep/" rel="tag">grep</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hadoop/" rel="tag">hadoop</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/icu4c/" rel="tag">icu4c</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/im/" rel="tag">im</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/is-not-null/" rel="tag">is not null</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/is-null/" rel="tag">is null</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/j-u-c/" rel="tag">j.u.c</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/" rel="tag">java</a><span class="tag-list-count">13</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jvm/" rel="tag">jvm</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/leetcode/" rel="tag">leetcode</a><span class="tag-list-count">22</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/leetcode-155/" rel="tag">leetcode 155</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linked-list/" rel="tag">linked list</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/" rel="tag">linux</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lock/" rel="tag">lock</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mfc/" rel="tag">mfc</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/min-stack/" rel="tag">min stack</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mq/" rel="tag">mq</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mvcc/" rel="tag">mvcc</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mysql/" rel="tag">mysql</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/namespace/" rel="tag">namespace</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/next-key-lock/" rel="tag">next-key lock</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/" rel="tag">nginx</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nullsfirst/" rel="tag">nullsfirst</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/openresty/" rel="tag">openresty</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/php/" rel="tag">php</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/procedure/" rel="tag">procedure</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/" rel="tag">python</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/read-view/" rel="tag">read view</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/redis/" rel="tag">redis</a><span class="tag-list-count">8</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/signal/" rel="tag">signal</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sort/" rel="tag">sort</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spark/" rel="tag">spark</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/" rel="tag">stack</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/string/" rel="tag">string</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/swoole/" rel="tag">swoole</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/top/" rel="tag">top</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/uname/" rel="tag">uname</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/unlock/" rel="tag">unlock</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/value/" rel="tag">value</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/websocket/" rel="tag">websocket</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zsh/" rel="tag">zsh</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%B8%89%E9%98%B6%E6%AE%B5%E6%8F%90%E4%BA%A4/" rel="tag">三阶段提交</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%B8%A4%E9%98%B6%E6%AE%B5%E6%8F%90%E4%BA%A4/" rel="tag">两阶段提交</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%B8%AD%E5%BA%8F/" rel="tag">中序</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%B8%AD%E9%97%B4%E4%BB%B6/" rel="tag">中间件</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%BA%8C%E5%8F%89%E6%A0%91/" rel="tag">二叉树</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%BA%92%E6%96%A5%E9%94%81/" rel="tag">互斥锁</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%81%A5%E5%BA%B7%E7%A0%81/" rel="tag">健康码</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%85%AC%E4%BA%A4/" rel="tag">公交</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%85%AC%E4%BA%A4%E8%BD%A6/" rel="tag">公交车</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%87%8F%E8%82%A5/" rel="tag">减肥</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/" rel="tag">分布式事务</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/" rel="tag">分布式锁</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%89%8A%E5%B3%B0%E5%A1%AB%E8%B0%B7/" rel="tag">削峰填谷</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%89%8D%E5%BA%8F/" rel="tag">前序</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%8A%A0%E5%A1%9E/" rel="tag">加塞</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%8D%95%E4%BE%8B/" rel="tag">单例</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%8D%9A%E5%AE%A2%EF%BC%8C%E6%96%87%E7%AB%A0/" rel="tag">博客,文章</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%8F%91%E8%A1%8C%E7%89%88/" rel="tag">发行版</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%8F%A3%E7%BD%A9/" rel="tag">口罩</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%90%90%E6%A7%BD/" rel="tag">吐槽</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6/" rel="tag">垃圾回收</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%9F%BA%E7%A1%80%E8%AE%BE%E6%96%BD/" rel="tag">基础设施</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%AE%B9%E9%94%99%E6%9C%BA%E5%88%B6/" rel="tag">容错机制</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%AF%84%E7%94%9F%E8%99%AB/" rel="tag">寄生虫</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B0%8F%E6%8A%80%E5%B7%A7/" rel="tag">小技巧</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B8%83%E9%9A%86%E8%BF%87%E6%BB%A4%E5%99%A8/" rel="tag">布隆过滤器</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B9%B2%E6%B4%BB/" rel="tag">干活</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B9%B4%E4%B8%AD%E6%80%BB%E7%BB%93/" rel="tag">年中总结</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93/" rel="tag">年终总结</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B9%B6%E5%8F%91/" rel="tag">并发</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B9%B8%E7%A6%8F%E4%BA%86%E5%90%97/" rel="tag">幸福了吗</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%B9%BB%E8%AF%BB/" rel="tag">幻读</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%BC%80%E8%BD%A6/" rel="tag">开车</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%BD%B1%E8%AF%84/" rel="tag">影评</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%89%93%E5%8D%A1/" rel="tag">打卡</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%8B%96%E6%9B%B4/" rel="tag">拖更</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%8E%92%E5%BA%8F/" rel="tag">排序</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/" rel="tag">数据结构</a><span class="tag-list-count">11</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%9C%80%E5%B0%8F%E6%A0%88/" rel="tag">最小栈</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%9D%80%E4%BA%BA%E8%AF%9B%E5%BF%83/" rel="tag">杀人诛心</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%9D%AD%E5%B7%9E/" rel="tag">杭州</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%A0%87%E8%AE%B0%E6%95%B4%E7%90%86/" rel="tag">标记整理</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%B3%A8%E8%A7%A3/" rel="tag">注解</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%B6%88%E6%81%AF%E9%98%9F%E5%88%97/" rel="tag">消息队列</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%BA%90%E7%A0%81/" rel="tag">源码</a><span class="tag-list-count">11</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/" rel="tag">源码解析</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%94%9F%E6%B4%BB/" rel="tag">生活</a><span class="tag-list-count">15</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%96%AB%E6%83%85/" rel="tag">疫情</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%B3%9F%E5%BF%83%E4%BA%8B/" rel="tag">糟心事</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%B4%A2%E5%BC%95/" rel="tag">索引</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BC%93%E5%AD%98/" rel="tag">缓存</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BC%93%E5%AD%98%E5%87%BB%E7%A9%BF/" rel="tag">缓存击穿</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BC%93%E5%AD%98%E7%A9%BF%E9%80%8F/" rel="tag">缓存穿透</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BC%93%E5%AD%98%E9%9B%AA%E5%B4%A9/" rel="tag">缓存雪崩</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BE%8E%E5%9B%BD/" rel="tag">美国</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%87%AA%E9%80%82%E5%BA%94%E6%8B%93%E5%B1%95/" rel="tag">自适应拓展</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%A7%84%E5%88%99/" rel="tag">规则</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" rel="tag">设计模式</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6/" rel="tag">读书</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%AF%BB%E5%90%8E%E6%84%9F/" rel="tag">读后感</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%B6%B3%E7%90%83/" rel="tag">足球</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%B7%91%E6%AD%A5/" rel="tag">跑步</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%B7%AF%E6%94%BF%E8%A7%84%E5%88%92/" rel="tag">路政规划</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%BD%AC%E4%B9%89/" rel="tag">转义</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%BF%90%E5%8A%A8/" rel="tag">运动</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E9%80%92%E5%BD%92/" rel="tag">递归</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E9%A2%98%E8%A7%A3/" rel="tag">题解</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E9%AB%98%E9%80%9F/" rel="tag">高速</a><span class="tag-list-count">1</span></li></ul>
|
|
|
</canvas>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="links-of-blogroll motion-element">
|
|
|
<div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
|
|
|
Links
|
|
|
</div>
|
|
|
<ul class="links-of-blogroll-list">
|
|
|
<li class="links-of-blogroll-item">
|
|
|
<a href="https://covermusic.cn/" title="https://covermusic.cn" rel="noopener" target="_blank">69伙伴</a>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
</aside>
|
|
|
<div id="sidebar-dimmer"></div>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</main>
|
|
|
|
|
|
<footer class="footer">
|
|
|
<div class="footer-inner">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="copyright">
|
|
|
|
|
|
©
|
|
|
<span itemprop="copyrightYear">2021</span>
|
|
|
<span class="with-love">
|
|
|
<i class="fa fa-heart"></i>
|
|
|
</span>
|
|
|
<span class="author" itemprop="copyrightHolder">Nicksxs</span>
|
|
|
</div>
|
|
|
<div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="busuanzi-count">
|
|
|
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
|
|
|
<span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="fa fa-user"></i>
|
|
|
</span>
|
|
|
<span class="site-uv" title="Total Visitors">
|
|
|
<span id="busuanzi_value_site_uv"></span>
|
|
|
</span>
|
|
|
</span>
|
|
|
<span class="post-meta-divider">|</span>
|
|
|
<span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
|
|
|
<span class="post-meta-item-icon">
|
|
|
<i class="fa fa-eye"></i>
|
|
|
</span>
|
|
|
<span class="site-pv" title="Total Views">
|
|
|
<span id="busuanzi_value_site_pv"></span>
|
|
|
</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
(function() {
|
|
|
function leancloudSelector(url) {
|
|
|
url = encodeURI(url);
|
|
|
return document.getElementById(url).querySelector('.leancloud-visitors-count');
|
|
|
}
|
|
|
|
|
|
function addCount(Counter) {
|
|
|
var visitors = document.querySelector('.leancloud_visitors');
|
|
|
var url = decodeURI(visitors.id);
|
|
|
var title = visitors.dataset.flagTitle;
|
|
|
|
|
|
Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url })))
|
|
|
.then(response => response.json())
|
|
|
.then(({ results }) => {
|
|
|
if (results.length > 0) {
|
|
|
var counter = results[0];
|
|
|
leancloudSelector(url).innerText = counter.time + 1;
|
|
|
Counter('put', '/classes/Counter/' + counter.objectId, { time: { '__op': 'Increment', 'amount': 1 } })
|
|
|
.catch(error => {
|
|
|
console.error('Failed to save visitor count', error);
|
|
|
});
|
|
|
} else {
|
|
|
leancloudSelector(url).innerText = 'Counter not initialized! More info at console err msg.';
|
|
|
console.error('ATTENTION! LeanCloud counter has security bug, see how to solve it here: https://github.com/theme-next/hexo-leancloud-counter-security. \n However, you can still use LeanCloud without security, by setting `security` option to `false`.');
|
|
|
|
|
|
}
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.error('LeanCloud Counter Error', error);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function showTime(Counter) {
|
|
|
var visitors = document.querySelectorAll('.leancloud_visitors');
|
|
|
var entries = [...visitors].map(element => {
|
|
|
return decodeURI(element.id);
|
|
|
});
|
|
|
|
|
|
Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url: { '$in': entries } })))
|
|
|
.then(response => response.json())
|
|
|
.then(({ results }) => {
|
|
|
for (let url of entries) {
|
|
|
let target = results.find(item => item.url === url);
|
|
|
leancloudSelector(url).innerText = target ? target.time : 0;
|
|
|
}
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.error('LeanCloud Counter Error', error);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
let { app_id, app_key, server_url } = {"enable":true,"app_id":"ysza182Vghlqjdt7QiwGLLJy-gzGzoHsz","app_key":"s9GDqbn7gnGGkusf66YRVccw","server_url":"https://leancloud.cn","security":true};
|
|
|
function fetchData(api_server) {
|
|
|
var Counter = (method, url, data) => {
|
|
|
return fetch(`${api_server}/1.1${url}`, {
|
|
|
method,
|
|
|
headers: {
|
|
|
'X-LC-Id' : app_id,
|
|
|
'X-LC-Key' : app_key,
|
|
|
'Content-Type': 'application/json',
|
|
|
},
|
|
|
body: JSON.stringify(data)
|
|
|
});
|
|
|
};
|
|
|
if (CONFIG.page.isPost) {
|
|
|
if (CONFIG.hostname !== location.hostname) return;
|
|
|
addCount(Counter);
|
|
|
} else if (document.querySelectorAll('.post-title-link').length >= 1) {
|
|
|
showTime(Counter);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`;
|
|
|
|
|
|
if (api_server) {
|
|
|
fetchData(api_server);
|
|
|
} else {
|
|
|
fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id)
|
|
|
.then(response => response.json())
|
|
|
.then(({ api_server }) => {
|
|
|
fetchData('https://' + api_server);
|
|
|
});
|
|
|
}
|
|
|
})();
|
|
|
</script>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</footer>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<script src="/lib/anime.min.js"></script>
|
|
|
<script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
|
|
|
<script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
|
|
|
<script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>
|
|
|
<script src="/lib/velocity/velocity.min.js"></script>
|
|
|
<script src="/lib/velocity/velocity.ui.min.js"></script>
|
|
|
|
|
|
<script src="/js/utils.js"></script>
|
|
|
|
|
|
<script src="/js/motion.js"></script>
|
|
|
|
|
|
|
|
|
<script src="/js/schemes/pisces.js"></script>
|
|
|
|
|
|
|
|
|
<script src="/js/next-boot.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
(function(){
|
|
|
var canonicalURL, curProtocol;
|
|
|
//Get the <link> tag
|
|
|
var x=document.getElementsByTagName("link");
|
|
|
//Find the last canonical URL
|
|
|
if(x.length > 0){
|
|
|
for (i=0;i<x.length;i++){
|
|
|
if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
|
|
|
canonicalURL=x[i].href;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//Get protocol
|
|
|
if (!canonicalURL){
|
|
|
curProtocol = window.location.protocol.split(':')[0];
|
|
|
}
|
|
|
else{
|
|
|
curProtocol = canonicalURL.split(':')[0];
|
|
|
}
|
|
|
//Get current URL if the canonical URL does not exist
|
|
|
if (!canonicalURL) canonicalURL = window.location.href;
|
|
|
//Assign script content. Replace current URL with the canonical URL
|
|
|
!function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
function loadCount() {
|
|
|
var d = document, s = d.createElement('script');
|
|
|
s.src = 'https://nicksxs.disqus.com/count.js';
|
|
|
s.id = 'dsq-count-scr';
|
|
|
(d.head || d.body).appendChild(s);
|
|
|
}
|
|
|
// defer loading until the whole page loading is completed
|
|
|
window.addEventListener('load', loadCount, false);
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
</html>
|