意外将hosts文件删除,将恢复方法记录
版本信息: Windows 10 专业版 1909
将C:\Windows\System32\drivers\etc\
目录下的lmhosts.sam
文件复制一份并重命名为hosts
即可。
意外将hosts文件删除,将恢复方法记录
版本信息: Windows 10 专业版 1909
将C:\Windows\System32\drivers\etc\
目录下的lmhosts.sam
文件复制一份并重命名为hosts
即可。
安装markdown-preview插件后,使用时无论是使用快捷键还是命令,都没有任何反馈
在vim命令行输入messages
输出以下出错信息( 部分):
......
[vim-node-rpc] rpc error: internal/modules/cjs/loader.js:883
[vim-node-rpc] rpc error: throw err;
[vim-node-rpc] rpc error: ^
[vim-node-rpc] rpc error:
[vim-node-rpc] rpc error: error: cannot find module 'tslib'
[vim-node-rpc] rpc error: require stack:
[vim-node-rpc] rpc error: - /users/dxm/.vim/bundle/markdown-preview.nvim/app/lib/app/index.js
[vim-node-rpc] rpc error: - /users/dxm/.vim/bundle/markdown-preview.nvim/app/index.js
......
可以看到是因为缺少tslib模块引起的错误,经查资料得知此模块用途超出我的知识范围qaq,
tslib是一个开源的程序,能够为触摸屏驱动获得的采样提供诸如滤波、去抖、校准等功能。-百度百科
所以去插件的Github仓库去碰碰运气,终于在一条issue下找到解决方法:
在插件目录下执行:
npm install
其他操作系统或许可以尝试诸如yarn install
等操作,当然,还是要根据出错信息 自己排查解决。
# vim /etc/my.cnf
添加skip-grant-tables
;
# systemctl restart mysqld.service
[root@cvm-3ibcdh728a225 html]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.34 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set authentication_string='your-new-passwd' where user='root';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges ;
Query OK, 0 rows affected (0.02 sec)
mysql> quit
Bye
# vim /etc/my.cnf
# systemctl restart mysqld.service
修改完成。
— end —
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>T</title>
<style>
.images-box {
padding: 0 0vw 2vw 0vw;
font-size: 0;
word-spacing: 0;
letter-spacing: 1vw;
line-height: 1vw;
}
.images-box a {
display: inline-block;
height: 30%;
width: 30%;
overflow: hidden;
text-decoration: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.images-box a:only-child {
height: initial;
width: initial;
max-width: 80%;
}
.images-box a:nth-child(1):nth-last-child(2) {
width: 45%;
height: 45%;
}
.images-box a:nth-child(2):nth-last-child(1) {
width: 45%;
height: 45%;
}
.images-box a:nth-child(1):nth-last-child(4) {
height: 45%;
width: 45%;
}
.images-box a:nth-child(2):nth-last-child(3) {
height: 45%;
width: 45%;
}
.images-box a:nth-child(3):nth-last-child(2) {
height: 45%;
width: 45%;
}
.images-box a:nth-child(4):nth-last-child(1) {
height: 45%;
width: 45%;
}
.images-box a img {
width: 100%;
height: 100%;
object-fit: cover;
}
</style>
</head>
<body>
<div class="images-box">
<a><img src="./1.jpg"></img></a>
<a><img src="./1.jpg"></img></a>
<a><img src="./1.jpg"></img></a>
...
</div>
</body>
</html>
#include<stdio.h>
int main(){
int x = 90;
int y = 100;
while(y > 0)
if(x > 100){
x = x - 10;
y--;
}
else x++;
}
x | y | 基础操作语句执行 |
---|---|---|
90 | 100 | 未执行 |
91 | 100 | 未执行 |
92 | 100 | 未执行 |
93 | 100 | 未执行 |
94 | 100 | 未执行 |
95 | 100 | 未执行 |
96 | 100 | 未执行 |
97 | 100 | 未执行 |
98 | 100 | 未执行 |
99 | 100 | 未执行 |
100 | 100 | 未执行 |
101 | 100 | 执行第一次 |
91 | 99 | 未执行 |
92 | 99 | 未执行 |
93 | 99 | 未执行 |
94 | 99 | 未执行 |
… | … | … |
x
总是从90~101
循环,y
从100
减小到0
,y
每减小1
,最内层循环执行1
次,共执行100
次; 所以时间复杂度为O(1)
;
1、打开Typora软件的主题目录(文件-偏好设置-外观-打开主题文件夹)
类似C:\Users\i\AppData\Roaming\Typora\themes
这种
2、在主题目录下新建文件,命名为base.user.css
,注意拓展名为css,没有显示拓展名的系统可能为txt
3、将以下代码写入base.user.css中
/** initialize css counter */
#write, .sidebar-content,.md-toc-content {
counter-reset: h1
}
#write h1, .outline-h1, .md-toc-item.md-toc-h1 {
counter-reset: h2
}
#write h2, .outline-h2, .md-toc-item.md-toc-h2 {
counter-reset: h3
}
#write h3, .outline-h3, .md-toc-item.md-toc-h3 {
counter-reset: h4
}
#write h4, .outline-h4, .md-toc-item.md-toc-h4 {
counter-reset: h5
}
#write h5, .outline-h5, .md-toc-item.md-toc-h5 {
counter-reset: h6
}
/** put counter result into headings */
#write h1:before,
h1.md-focus.md-heading:before,
.outline-h1>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h1>.md-toc-inner:before{
counter-increment: h1;
content: counter(h1) " "
}
#write h2:before,
h2.md-focus.md-heading:before,
.outline-h2>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h2>.md-toc-inner:before{
counter-increment: h2;
content: counter(h1) "." counter(h2) " "
}
#write h3:before,
h3.md-focus.md-heading:before,
.outline-h3>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h3>.md-toc-inner:before {
counter-increment: h3;
content: counter(h1) "." counter(h2) "." counter(h3) " "
}
#write h4:before,
h4.md-focus.md-heading:before,
.outline-h4>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h4>.md-toc-inner:before {
counter-increment: h4;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) " "
}
#write h5:before,
h5.md-focus.md-heading:before,
.outline-h5>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h5>.md-toc-inner:before {
counter-increment: h5;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " "
}
#write h6:before,
h6.md-focus.md-heading:before,
.outline-h6>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h6>.md-toc-inner:before {
counter-increment: h6;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) " "
}
/** override the default style for focused headings */
#write>h3.md-focus:before,
#write>h4.md-focus:before,
#write>h5.md-focus:before,
#write>h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.md-focus:before {
color: inherit;
border: inherit;
border-radius: inherit;
position: inherit;
left:initial;
float: none;
top:initial;
font-size: inherit;
padding-left: inherit;
padding-right: inherit;
vertical-align: inherit;
font-weight: inherit;
line-height: inherit;
}
4、重启软件,测试
—End—
position 属性用于表名元素的定位类型,数据类型表示用于设置相对于框的位置的2D空间中的坐标,该属性共有5个值:static
、relative
、fixed
、absolute
、sticky
.
CSS position
属性用于指定一个元素在文档中的定位方式。top
,right
,bottom
和 left
属性则决定了该元素的最终位置。
一个偏移量可以是一个相对值用以表示 %
(百分比),或是一个绝对的 length
(长度)值。正值是向右或向下的偏移,看适用于哪一个。负值则是在另外方向上的偏移。
[ [ left | center | right | top | bottom | <percentage> | <length> ] |
[ left | center | right | <percentage> | <length> ] [ top | center | bottom | <percentage> | <length> ] |
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]
静态定位是元素的默认属性,指定元素使用正常的布局行为,即元素在文档常规流中当前的布局位置。此时 top
, right
, bottom
, left
和 z-index
属性无效。
```css
.class {
position: static;
}
```
元素会被移出正常文档流,并不为元素预留空间,而是通过指定元素相对于屏幕视口(viewport)的位置来指定元素位置。元素的位置在屏幕滚动时不会改变。打印时,元素会出现在的每页的固定位置。fixed
属性会创建新的层叠上下文。当元素祖先的 transform
, perspective
或 filter
属性非 none
时,容器由视口改为该祖先。
元素的位置相对于浏览器窗口是固定位置,元素的位置与文档流无关,Fixed定位的元素和其他元素重叠。
.class {
position:fixed;
top:2px;
right:7px;
}
该关键字下,元素先放置在未添加定位时的位置,再在不改变页面布局的前提下调整元素位置(因此会在此元素未添加定位时所在位置留下空白)。position:relative 对 table-*-group, table-row, table-column, table-cell, table-caption 元素无效。
相对定位元素的定位是相对其正常位置,移动相对定位元素,但它原本所占的空间不会改变。
<div class="box" id="one">One</div>
<div class="box" id="two">Two</div>
<div class="box" id="three">Three</div>
<div class="box" id="four">Four</div>
.box {
display: inline-block;
width: 100px;
height: 100px;
background: red;
color: white;
}
#two {
position: relative;
top: 20px;
left: 20px;
background: blue;
}
元素会被移出正常文档流,并不为元素预留空间,通过指定元素相对于最近的非 static 定位祖先元素的偏移,来确定元素位置。绝对定位的元素可以设置外边距(margins),且不会与其他边距合并。
绝对定位的元素的位置相对于最近的已定位父元素,如果元素没有已定位的父元素,那么它的位置相对于<html>
,absolute 定位使元素的位置与文档流无关,因此不占据空间,absolute 定位的元素和其他元素重叠。
.class {
position:absolute;
left:70px;
top:80px;
}
粘性定位的元素是依赖于用户的滚动,在 position:relative 与 position:fixed 定位之间切换。
它的行为就像 position:relative; 而当页面滚动超出目标区域时,它的表现就像 position:fixed;,它会固定在目标位置。
元素定位表现为在跨越特定阈值前为相对定位,之后为固定定位。
这个特定阈值指的是 top, right, bottom 或 left 之一,换言之,指定 top, right, bottom 或 left 四个阈值其中之一,才可使粘性定位生效。否则其行为与相对定位相同。
元素根据正常文档流进行定位,然后相对它的最近滚动祖先(nearest scrolling ancestor)和 containing block (最近块级祖先 nearest block-level ancestor),包括table-related元素,基于top
, right
, bottom
, 和 left
的值进行偏移。偏移值不会影响任何其他元素的位置。
该值总是创建一个新的层叠上下文(stacking context)。注意,一个sticky元素会“固定”在离它最近的一个拥有“滚动机制”的祖先上(当该祖先的overflow
是 hidden
, scroll
, auto
, 或 overlay
时),即便这个祖先不是最近的真实可滚动祖先。这有效地抑制了任何“sticky”行为(详情见Github issue on W3C CSSWG)。
.calss {
position: sticky;
top: 10px;
}
1、大多数情况下,height
和width
被设定为auto的绝对定位元素,按其内容大小调整尺寸。但是,被绝对定位的元素可以通过指定top
和bottom
,保留height
未指定(即auto
),来填充可用的垂直空间。它们同样可以通过指定left
和 right
并将width
指定为auto
来填充可用的水平空间。
Lombok 是Java语言编程中可以使用的一种工具,它可用来帮助开发人员减少编写一些可以机械完成的代码,尤其是对于简单的 Java 对象(POJO)。它通过注解实现这一目的。
比如:
public class Mountain{
private String name;
private double longitude;
private String country;
}
要生成这个对象的 get、set方法,有参构造、无参构造器等,都可以通过简单的注解实现。
@Data // 只添加这一个注解
public class Mountain{
private String name;
private double longitude;
private String country;
}
只添加@Data
这一个注解,就可以自动生成该类的get、set、equals方法等
当然,也有@AllArgsConstructor,@NoArgsConstructor,@Getter,@Setter
等注解。
1、安装 IDEA 的 lombok plugin 插件
插件安装:File-Settings-Plugs-Browse repositories...
搜索安装即可
可能由于我的 IDEA 版本较旧,安装时搜索不到这个插件,可以到网上下载后安装
地址:https://plugins.jetbrains.com/plugin/6317-lombok/versions
2、引入maven依赖
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
<scope>provided</scope>
</dependency>
3、在需要添加相关方法的类上加相关注解
—End—
安装完新软件后,软件会写入注册表一些文件,鼠标右键新建文件列表就会出现好多不常用的文件类型,对于我来说,刚刚安装的 PowerDesigner 软件就会在鼠标右键新建列表写入很多新类型文件,但我不想使用,在我想使用鼠标右键新建一个 word 文档的时候,看到一列长长的文件类型瞬间有种大海捞针的感觉,十分头疼,于是打算“干掉”这群不速之客。
使用快捷键win
+ r
, 打开运行窗口,输入regedit
,打开注册表,在计算机\HKEY_CLASSES_ROOT\
下,会有很多以点开头的目录,这是文件的拓展名。类似下图就是 Microsoft Word 软件的文件拓展名之一.docx
,目录下的 ShellNew 就是今天的主角了。
ShellNew 文件夹的作用就是在鼠标右键的新建列表添加该类型的新建文件。所以我们只需要找到想要删除的文件类型,删除 ShellNew 文件夹即可。比如想要删除这个选项,
我们只需要查看这个文件的拓展名,不知道的话可以新建一个文件看一下
如果没有的话,你可能需要搜索一下如何显示文件拓展名的相关知识。
接下来,我们在注册表找到它
我们只需要删除 ShellNew文件夹即可。此时右键新建文件列表已经没有这个选项了。
—— End ——
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
//TODO:先使用PHP定义变量实现,后期使用自定义主题实现
$x=2;
/**
* archive2
* @package custom
*/
Typecho_Widget::widget('Widget_Stat')->to($stat);
?>
<?php $this->need('header.php'); ?>
<div id="content">
<section class="post">
<span class="archive-move-on"></span>
<?php
$all=($stat->publishedPostsNum);
//页数=向上取整(总归档数/每页文章数);
$pages=ceil($all/$x);
//echo '<p>'.$pages.'</p>';
$this->widget('Widget_Contents_Post_Recent',
'pageSize=10000')->to($archives);
//$year=0; $mon=0; $i=0; $j=0;
$output = '<span class="archive-page-counter">
<h2>目前共计 '.$stat->publishedPostsNum.' 篇日志。</h2><ul></span>';
$count=0;
$i=1;
while($archives->next()):
if($count%$x==0) {
if($count==0) {
$output.='<div id="archive page '.$i.'" class="archive" >';
} else if($count!=0) {
$output.='</div>';
$output.='<div id="archive page '.$i.'" c
lass="archive" style="display:none;">';
}
$i++;
}
$output .='<li><time class="post-time" itemprop="dateCreated"
content="'.date('Y-m-d',
$archives->created).'">'
.date('Y-m-d',$archives->created)
.'</time>'." "
.'<a class="post-title-link" href="'
.$archives->permalink
.'" itemprop="url"><span itemprop="name">'
. $archives->title .'</span></a></li>';
$count++;
endwhile;
$output.='</div>';
echo $output;
printNav($pages);
?>
</section>
</div>
<?php
function printNav($pages) {
$script='<script type=\'text/javascript\'>';
$output='<ol class="page-navigator" style="margin-left: 0px;">';
$script.='page1();';
for($i=1;$i<=$pages;$i++) {
$output.='<li id="page'.$i.'" >';
$script.='function page'.$i.'()
{var elems=document.getElementsByClassName("archive");
for(var i=0;i<elems.length;i+=1){elems[i].style.display="none";};
document.getElementById("archive page '.$i.'")
.style.display="inline";';
$script.='var current=document.getElementsByClassName("current");
for(var i=0;i<current.length;i+=1){current[i]
.setAttribute("class","")};';
$script.='document.getElementById("page'.$i.'")
.className="current";';
$output.='<a href="javascript:void(0)"
onclick="page'.$i.'()">'.$i.'</a></li>';
$script.='}';
}
$output.='</ol>';
$script.='</script>';
echo $output;
echo $script;
}
?>
<?php $this->need('footer.php'); ?>