解密Navicat导出链接中的密码

<?php
namespace FatSmallTools;
class NavicatPassword
{
    protected $version = 0;
    protected $aesKey = 'libcckeylibcckey';
    protected $aesIv = 'libcciv libcciv ';
    protected $blowString = '3DC5CA39';
    protected $blowKey = null;
    protected $blowIv = null;
    public function __construct($version = 12)
    {
        $this->version = $version;
        $this->blowKey = sha1('3DC5CA39', true);
        $this->blowIv = hex2bin('d9c7c3c8870d64bd');
    }
    public function encrypt($string)
    {
        $result = FALSE;
        switch ($this->version) {
            case 11:
                $result = $this->encryptEleven($string);
                break;
            case 12:
                $result = $this->encryptTwelve($string);
                break;
            default:
                break;
        }
        return $result;
    }
    protected function encryptEleven($string)
    {
        $round = intval(floor(strlen($string) / 8));
        $leftLength = strlen($string) % 8;
        $result = '';
        $currentVector = $this->blowIv;
        for ($i = 0; $i < $round; $i  ) {
            $temp = $this->encryptBlock($this->xorBytes(substr($string, 8 * $i, 8), $currentVector));
            $currentVector = $this->xorBytes($currentVector, $temp);
            $result .= $temp;
        }
        if ($leftLength) {
            $currentVector = $this->encryptBlock($currentVector);
            $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
        }
        return strtoupper(bin2hex($result));
    }
    protected function encryptBlock($block)
    {
        return openssl_encrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING); 
    }
    protected function decryptBlock($block)
    {
        return openssl_decrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING); 
    }
    protected function xorBytes($str1, $str2)
    {
        $result = '';
        for ($i = 0; $i < strlen($str1); $i  ) {
            $result .= chr(ord($str1[$i]) ^ ord($str2[$i]));
        }
        return $result;
    }
    protected function encryptTwelve($string)
    {
        $result = openssl_encrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
        return strtoupper(bin2hex($result));
    }
    public function decrypt($string)
    {
        $result = FALSE;
        switch ($this->version) {
            case 11:
                $result = $this->decryptEleven($string);
                break;
            case 12:
                $result = $this->decryptTwelve($string);
                break;
            default:
                break;
        }
        return $result;
    }
    protected function decryptEleven($upperString)
    {
        $string = hex2bin(strtolower($upperString));
        $round = intval(floor(strlen($string) / 8));
        $leftLength = strlen($string) % 8;
        $result = '';
        $currentVector = $this->blowIv;
        for ($i = 0; $i < $round; $i  ) {
            $encryptedBlock = substr($string, 8 * $i, 8);
            $temp = $this->xorBytes($this->decryptBlock($encryptedBlock), $currentVector);
            $currentVector = $this->xorBytes($currentVector, $encryptedBlock);
            $result .= $temp;
        }
        if ($leftLength) {
            $currentVector = $this->encryptBlock($currentVector);
            $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
        }
        return $result;
    }
    protected function decryptTwelve($upperString)
    {
        $string = hex2bin(strtolower($upperString));
        return openssl_decrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
    }
}
use FatSmallToolsNavicatPassword;
//需要指定版本,11或12
$navicatPassword = new NavicatPassword(12);
//$navicatPassword = new NavicatPassword(11);
//解密
//$decode = $navicatPassword->decrypt('15057D7BA390');
$decode = $navicatPassword->decrypt('BD24FE2CDBD24FE2CDAA36A18B4AA36A18B4');
echo $decode."n";

注意代码需要修改一下使用。

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.util.Arrays;
 
/**
 * 以下程序均为ChatGPT生成
 * @Author: 木芒果
 */
public class NavicatPassword {
    public static void main(String[] args) throws Exception {
        NavicatPassword navicatPassword = new NavicatPassword();
 
        // 解密11版本及以前的密码
        //String decode = navicatPassword.decrypt("15057D7BA390", 11);
 
        // 解密12版本及以后的密码
        //String decode = navicatPassword.decrypt("15057D7BA390", 12);
        String decode = navicatPassword.decrypt("解密密码", 12);
        System.out.println(decode);
    }
 
    private static final String AES_KEY = "libcckeylibcckey";
    private static final String AES_IV = "libcciv libcciv ";
    private static final String BLOW_KEY = "3DC5CA39";
    private static final String BLOW_IV = "d9c7c3c8870d64bd";
 
    public static String encrypt(String plaintext, int version) throws Exception {
        switch (version) {
            case 11:
                return encryptEleven(plaintext);
            case 12:
                return encryptTwelve(plaintext);
            default:
                throw new IllegalArgumentException("Unsupported version");
        }
    }
 
    public static String decrypt(String ciphertext, int version) throws Exception {
        switch (version) {
            case 11:
                return decryptEleven(ciphertext);
            case 12:
                return decryptTwelve(ciphertext);
            default:
                throw new IllegalArgumentException("Unsupported version");
        }
    }
 
    private static String encryptEleven(String plaintext) throws Exception {
        byte[] iv = hexStringToByteArray(BLOW_IV);
        byte[] key = hashToBytes(BLOW_KEY);
 
        int round = plaintext.length() / 8;
        int leftLength = plaintext.length() % 8;
        StringBuilder result = new StringBuilder();
        byte[] currentVector = iv.clone();
 
        Cipher cipher = Cipher.getInstance("Blowfish/ECB/NoPadding");
        SecretKeySpec secretKeySpec = new SecretKeySpec(key, "Blowfish");
        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
 
        for (int i = 0; i < round; i++) {
            byte[] block = xorBytes(plaintext.substring(i * 8, (i + 1) * 8).getBytes(), currentVector);
            byte[] temp = cipher.doFinal(block);
            currentVector = xorBytes(currentVector, temp);
            result.append(bytesToHex(temp));
        }
 
        if (leftLength > 0) {
            currentVector = cipher.doFinal(currentVector);
            byte[] block = xorBytes(plaintext.substring(round * 8).getBytes(), currentVector);
            result.append(bytesToHex(block));
        }
 
        return result.toString().toUpperCase();
    }
 
    private static String encryptTwelve(String plaintext) throws Exception {
        byte[] iv = AES_IV.getBytes();
        byte[] key = AES_KEY.getBytes();
 
        Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
        SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
        IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
 
        byte[] result = cipher.doFinal(plaintext.getBytes());
        return bytesToHex(result).toUpperCase();
    }
 
    private static String decryptEleven(String ciphertext) throws Exception {
        byte[] iv = hexStringToByteArray(BLOW_IV);
        byte[] key = hashToBytes(BLOW_KEY);
        byte[] encrypted = hexStringToByteArray(ciphertext.toLowerCase());
 
        int round = encrypted.length / 8;
        int leftLength = encrypted.length % 8;
        StringBuilder result = new StringBuilder();
        byte[] currentVector = iv.clone();
 
        Cipher cipher = Cipher.getInstance("Blowfish/ECB/NoPadding");
        SecretKeySpec secretKeySpec = new SecretKeySpec(key, "Blowfish");
        cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
 
        for (int i = 0; i < round; i++) {
            byte[] block = Arrays.copyOfRange(encrypted, i * 8, (i + 1) * 8);
            byte[] temp = xorBytes(cipher.doFinal(block), currentVector);
            currentVector = xorBytes(currentVector, block);
            result.append(new String(temp));
        }
 
        if (leftLength > 0) {
            currentVector = cipher.doFinal(currentVector);
            byte[] block = Arrays.copyOfRange(encrypted, round * 8, round * 8 + leftLength);
            result.append(new String(xorBytes(block, currentVector)));
        }
 
        return result.toString();
    }
 
    private static String decryptTwelve(String ciphertext) throws Exception {
        byte[] iv = AES_IV.getBytes();
        byte[] key = AES_KEY.getBytes();
        byte[] encrypted = hexStringToByteArray(ciphertext.toLowerCase());
 
        Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
        SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
        IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
        cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
 
        byte[] result = cipher.doFinal(encrypted);
        return new String(result);
    }
 
    private static byte[] xorBytes(byte[] bytes1, byte[] bytes2) {
        byte[] result = new byte[bytes1.length];
        for (int i = 0; i < bytes1.length; i++) {
            result[i] = (byte) (bytes1[i] ^ bytes2[i]);
        }
        return result;
    }
 
    private static byte[] hexStringToByteArray(String s) {
        int len = s.length();
        byte[] data = new byte[len / 2];
        for (int i = 0; i < len; i += 2) {
            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
                    + Character.digit(s.charAt(i + 1), 16));
        }
        return data;
    }
 
    private static byte[] hashToBytes(String s) throws Exception {
        return MessageDigest.getInstance("SHA-1").digest(s.getBytes());
    }
 
    private static String bytesToHex(byte[] bytes) {
        StringBuilder result = new StringBuilder();
        for (byte b : bytes) {
            result.append(String.format("%02X", b));
        }
        return result.toString();
    }
}
Posted in 默认分类 | Comments Off on 解密Navicat导出链接中的密码

hosts文件恢复方法


意外将hosts文件删除,将恢复方法记录

版本信息: Windows 10 专业版 1909

C:\Windows\System32\drivers\etc\目录下的lmhosts.sam文件复制一份并重命名为hosts即可。

Posted in 默认分类 | Comments Off on hosts文件恢复方法

markdown-preview缺少tslib模块解决方案


环境

  • windows 10 1909
  • vim-vi improved 8.2 ms-windows 64-bit gui version

缘起

安装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等操作,当然,还是要根据出错信息 自己排查解决。

参考资料

  1. https://github.com/iamcco/markdown-preview.nvim/issues/305
  2. https://baike.baidu.com/item/tslib/722869?fr=aladdin
Posted in 默认分类 | Comments Off on markdown-preview缺少tslib模块解决方案

MySQL密码重置


修改 MySQL 配置文件以跳过密码登录

# vim /etc/my.cnf 

添加skip-grant-tables;

重启 MySQL 服务

# 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 

重启 MySQL

# systemctl restart mysqld.service

修改完成。

— end —

Posted in 默认分类 | Tagged | Comments Off on MySQL密码重置

一段自适应图片排版CSS

<!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>
Posted in 默认分类 | Tagged | Comments Off on 一段自适应图片排版CSS

时间复杂度分析之一

#include<stdio.h>
​
int main(){
    
    int x = 90;
    int y = 100;
    while(y > 0)
        if(x > 100){
            x = x - 10;
            y--;
        }
        else x++;
}
xy基础操作语句执行
90100未执行
91100未执行
92100未执行
93100未执行
94100未执行
95100未执行
96100未执行
97100未执行
98100未执行
99100未执行
100100未执行
101100执行第一次
9199未执行
9299未执行
9399未执行
9499未执行

x总是从90~101循环,y100减小到0y每减小1,最内层循环执行1次,共执行100次; 所以时间复杂度为O(1)

Posted in 默认分类 | Comments Off on 时间复杂度分析之一

Typora 自动显示序号

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—

Posted in 默认分类 | Comments Off on Typora 自动显示序号

关于CSS的定位属性 – Position


position 属性用于表名元素的定位类型,数据类型表示用于设置相对于框的位置的2D空间中的坐标,该属性共有5个值:staticrelativefixedabsolutesticky.

CSS position属性用于指定一个元素在文档中的定位方式。toprightbottomleft 属性则决定了该元素的最终位置。

一个偏移量可以是一个相对值用以表示 % (百分比),或是一个绝对的 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> ]? ]
              ]

1、 静态定位 – static

静态定位是元素的默认属性,指定元素使用正常的布局行为,即元素在文档常规流中当前的布局位置。此时 top, right, bottom, leftz-index属性无效。

```css
.class {
  position: static;
}
```

2、 固定定位 – fixed

元素会被移出正常文档流,并不为元素预留空间,而是通过指定元素相对于屏幕视口(viewport)的位置来指定元素位置。元素的位置在屏幕滚动时不会改变。打印时,元素会出现在的每页的固定位置。fixed 属性会创建新的层叠上下文。当元素祖先的 transform, perspectivefilter 属性非 none 时,容器由视口改为该祖先。

元素的位置相对于浏览器窗口是固定位置,元素的位置与文档流无关,Fixed定位的元素和其他元素重叠。

.class {
   position:fixed;
   top:2px;
   right:7px;
}

3、相对定位 – relative

该关键字下,元素先放置在未添加定位时的位置,再在不改变页面布局的前提下调整元素位置(因此会在此元素未添加定位时所在位置留下空白)。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;
}

4、绝对定位 – absolute

元素会被移出正常文档流,并不为元素预留空间,通过指定元素相对于最近的非 static 定位祖先元素的偏移,来确定元素位置。绝对定位的元素可以设置外边距(margins),且不会与其他边距合并。

绝对定位的元素的位置相对于最近的已定位父元素,如果元素没有已定位的父元素,那么它的位置相对于<html>,absolute 定位使元素的位置与文档流无关,因此不占据空间,absolute 定位的元素和其他元素重叠。

.class {
   position:absolute;
   left:70px;
   top:80px;
}

5、粘性定位 – sticky

粘性定位的元素是依赖于用户的滚动,在 position:relativeposition: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元素会“固定”在离它最近的一个拥有“滚动机制”的祖先上(当该祖先的overflowhidden, scroll, auto, 或 overlay时),即便这个祖先不是最近的真实可滚动祖先。这有效地抑制了任何“sticky”行为(详情见Github issue on W3C CSSWG)。

.calss {
   position: sticky;
   top: 10px;
}

说明

1、大多数情况下,heightwidth 被设定为auto的绝对定位元素,按其内容大小调整尺寸。但是,被绝对定位的元素可以通过指定topbottom ,保留height未指定(即auto),来填充可用的垂直空间。它们同样可以通过指定leftright并将width 指定为auto来填充可用的水平空间。

Posted in 默认分类 | Tagged | Comments Off on 关于CSS的定位属性 – Position

Lombok 安装使用


lombok 简介

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—

Posted in 默认分类 | Comments Off on Lombok 安装使用

删除鼠标右键新建文件列表项

一、缘起

安装完新软件后,软件会写入注册表一些文件,鼠标右键新建文件列表就会出现好多不常用的文件类型,对于我来说,刚刚安装的 PowerDesigner 软件就会在鼠标右键新建列表写入很多新类型文件,但我不想使用,在我想使用鼠标右键新建一个 word 文档的时候,看到一列长长的文件类型瞬间有种大海捞针的感觉,十分头疼,于是打算“干掉”这群不速之客。

二、解决方案

使用快捷键win + r, 打开运行窗口,输入regedit,打开注册表,在计算机\HKEY_CLASSES_ROOT\下,会有很多以点开头的目录,这是文件的拓展名。类似下图就是 Microsoft Word 软件的文件拓展名之一.docx,目录下的 ShellNew 就是今天的主角了。

ShellNew 文件夹的作用就是在鼠标右键的新建列表添加该类型的新建文件。所以我们只需要找到想要删除的文件类型,删除 ShellNew 文件夹即可。比如想要删除这个选项,

我们只需要查看这个文件的拓展名,不知道的话可以新建一个文件看一下

如果没有的话,你可能需要搜索一下如何显示文件拓展名的相关知识。

接下来,我们在注册表找到它

我们只需要删除 ShellNew文件夹即可。此时右键新建文件列表已经没有这个选项了。

—— End ——

Posted in 默认分类 | Comments Off on 删除鼠标右键新建文件列表项