修改Mac系统Dock显示隐藏时间

系统版本
# 先修改停留时间(后面数字为停留时间)如:
defaults write com.apple.dock autohide-delay -int 0      ##(时间设为最短)
defaults write com.apple.dock autohide-delay -int 0.5    ##(时间设为 0.5s)
defaults write com.apple.dock autohide-delay -int 10     ##(时间设为 10s)
#使设置生效
killall Dock
Posted in 默认分类 | Comments Off on 修改Mac系统Dock显示隐藏时间

关于博客程序更换的一点思考

最近把博客程序从Halo换到了WordPress,还记得第一次买学生机装的就是WordPress,还是逃不过真香定律啊,那时候觉得WordPress臃肿,而且设计的使用方式有点让我摸不着头脑,好多操作逻辑、操作流程不是很符合我的思考方式,现在觉得,是那时候是我见识的不够多。

古语有云:操千曲而后晓声,观千剑而后识器。直到现在,尝试过Hexo、Hugo、Jekyll、Typecho、ZBlog一众博客建站程序之后,突然觉得,WordPress才是最适合我的那一个。类似Hexo、Jekyll、Hugo这种静态博客在搭建上肯定要简单一些,部署方面可以选择GitHub、Gitee、Coding这种托管平台、不需要主机或者服务器的费用、但写完博客需要编译确实让我有点头疼、使用过Jekyll不需要部署的方案、使用的Hux大佬的主题、只需要简单的git push就好了,但是静态博客的评论也是一个问题,当然,也有会Disqus/Livere(来必力)/Valine、Gitment/Gitalk/utterances/Vssue等一众方案,但是我不是很喜欢这种嵌入式分离的结构,因为有的插件总是在主程序加载完成后再次渲染,就像代码的格式主题渲染一次后插件再次渲染,视觉上就是内容有替换的过程,WP也有这个问题。响应速度快是静态博客的一大优点,所以相对来说,Halo、WP、Zblog是比较慢一点的,当然只是相对来说。

博客文章内容的处理方式是我喜欢WP的另一个原因。不管是静态的Hexo、Jekyll,还是动态的Typecho、Halo,无一列外的选择了转化Markdown为HTML的方式展示文章,这就导致了我无法对图片进行很好的排版,WP的块编辑器很好的解决了这一问题。

删繁就简,回归本真。这次博客改版我去掉了上一版中很多内容,也是为了把中心放到文章内容上。归档页是很多博客的标配,但去掉了好像也真的无伤大雅,还有与之类似的标签页、分类页,当然看着满满的文章标题是很有成就感的,但这次我没有加归档页,而是考虑是否在侧边栏加入一个归档组件。相册页是很多博客都有的一个菜单,好的照片确实不错,但我好像没有什么拿得出手的照片,等有了再考虑这个吧。留言页,觉得这个大可不必,随便找一篇文章留言或者发邮件吧。日志或者说动态页,上一版Halo博客我用的很频繁,当作微信朋友圈或者QQ空间用了,简短的想法,又不至于发一篇文章,这个板块确实有其存在的意义,但我想放弃碎片化的输出,打算系统的整理自己的想法,互联网时代的垃圾内容已经够多了,我就尽量不再输出互联网垃圾了,再者说,人每天都会产生很多想法,但大多数没有实际意义,当然随时记录自己的想法是一个很好的习惯,但不必要发到这里,我还是选择其他方式。

WP的插件系统是很丰富的。装完之后我装了好几个插件:KaTeX,WP Fastest Cache、SyntaxHighlighter Evolved…不得不说这很方便,虽然我觉得使用插件丰富功能的方式比较排他,但这也是另一种组件化吧。就拿代码高亮插件来说,标记某一行或者某几行代码在静态博客是很难实现的一个功能,支持Latex也会使加载速度变慢,但WP插件很好的解决了这个问题。

对于主题来说,以前无尽的折腾主题,改颜色、改动画、各种魔改,而忘记了最重要的内容,我虽然知道这一点并努力避免,然而我依然不能很好的实践,这次我努力不陷入这个漩涡之中。这次没有黑暗模式,而且我突然觉得,黑色主题的时代虽然已经到来,但还不够成熟,我安装完博客看着文章的图片深思,诸如代码图片这种黑色格调的板块好像与博客格格不入、以前的Halo里面的主题也有这个问题,我曾想过深浅色模式使用不同的代码主题,但图片我怎么也不能很好的解决,虽然目前有一些处理方案,但我觉得可以等等。博客上传图片大小限制2M我决定保留,虽然有其他方案转换为webp格式,但转换也需要服务器资源啊。

有人穷途末路,夕阳西下,有人崭新起点,旭日东升。

崭新起点
2023.4.29 图
Posted in 默认分类 | Tagged | 2 Comments

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

Posted in 默认分类 | 1 Comment

MySQL数据库连接报错

解决方法

在数据库连接后面加

?useUnicode=true&useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useAffectedRows=true&allowMultiQueries=true

如果是xml文件,加

?useUnicode=true&useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useAffectedRows=true&allowMultiQueries=true

报错信息

12-Nov-2022 21:09:13.324 INFO [http-nio-8080-exec-4] com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl.info {dataSource-1} inited
Sat Nov 12 21:09:13 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
12-Nov-2022 21:09:13.471 SEVERE [Druid-ConnectionPool-Create-1225724397] com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl.error create connection SQLException, url: jdbc:mysql://127.0.0.1:3306/test, errorCode 0, state 08S01
 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
​
The last packet successfully received from the server was 79 milliseconds ago.  The last packet sent successfully to the server was 75 milliseconds ago.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
    at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:201)
    at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4912)
    at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1663)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1224)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2190)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2221)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2016)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1657)
    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1723)
    at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2838)
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
    at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)
    at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:103)
    at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:437)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:415)
    at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:186)
    ... 18 more
​
......
12-Nov-2022 21:09:18.848 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
Disconnected from server
Posted in 问题解决, 默认分类 | Tagged | Comments Off on MySQL数据库连接报错

Spotlight 使用

(留坑,待填…)

在 Mac 上使用“聚焦”搜索

“聚焦”可以帮助你快速找到 Mac 上的 App、文稿、电子邮件和其他项目。借助 Siri 建议,你还可以获取新闻、体育赛事比分、天气状况和股票价格等信息。“聚焦”甚至可以为你进行计算和转换。

唤出搜索框:按下 Command-空格键

你可以将“聚焦”窗口拖到桌面上的任意位置。

在“聚焦”中进行计算和转换

你可以在“聚焦”搜索栏中输入数学表达式、金额、温度或度量单位,搜索栏中会立即显示转换或计算结果。

  • 计算:输入数学表达式,如 956*23.94 或 2020/15。
  • 货币转换:输入金额,如 100 美元、100 日元或“300 克朗转换成欧元”。
  • 温度转换:输入温度,如 98.8F、32C 或“340K 转换成华氏度”。
  • 单位转换:输入度量单位,例如 25 磅、54 码、23 英石或“32 英尺转换成米”。

Mac 上的“聚焦”键盘快捷键 :

快捷键功能
command + b使用浏览器搜索
command + r打开文件所在文件夹
输入kind:pdf fileName搜索指定类型文件
Spotlight快捷使用
Posted in 默认分类 | Comments Off on Spotlight 使用

关闭ReportCrash进程

Mac OS 系统CPU长期占用过高,是一个叫ReportCrash的进程,没有查到关于它的过多资料,先关闭,有问题再启动,做备忘。

禁用:

launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist

打开:

launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist
Posted in 默认分类 | Comments Off on 关闭ReportCrash进程

Mac下Vue项目无法使用80端口

80端口

Vue项目使用默认的8080端口正常启动,可在启动命令指定了80端口后,竟然莫名其妙的在1024端口启动,多次尝试依然在1024端口,我以为是系统80端口被占用,查看了一下并没有。

但是Docker的Nginx服务器是可以正常使用的。

nginx的80端口
正常访问

查资料说MacOS的1024以下端口使用需要root权限,试了一下确实可以用。

80端口

另外,如果80端口被占用,会使用下一个端口81,而不是1024.

Posted in 问题解决, 默认分类 | Comments Off on Mac下Vue项目无法使用80端口

使用jar文件手动安装到Maven仓库

不知道最近怎么回事,Docker镜像下载不下来,Maven依赖也下载不下来,手动下载一个jar文件安装到仓库。

mvn install:install-file -Dfile=jar包的路径 -DgroupId=gruopId中的内容 -DartifactId=actifactId的内容 -Dversion=version的内容 -Dpackaging=jar

如:

➜  ~ mvn install:install-file -Dfile=/Users/admin/Downloads/mybatis-plus-generator-3.3.2.jar -DgroupId=com.baomidou -DartifactId=mybatis-plus-generator -Dversion=3.3.2 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /Users/admin/Downloads/mybatis-plus-generator-3.3.2.jar to /Users/admin/.m2/repository/com/baomidou/mybatis-plus-generator/3.3.2/mybatis-plus-generator-3.3.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.169 s
[INFO] Finished at: 2022-11-02T21:07:44+08:00
[INFO] ------------------------------------------------------------------------
Posted in 默认分类 | Tagged | Comments Off on 使用jar文件手动安装到Maven仓库

Mac系统Postman安装Interceptor Bridge问题

问题描述

查看网站的接口时为了方便可以使用Postman的Interceptor功能,它可以直接捕获浏览器的请求和Cookie等信息,顺利的使用这个功能需要完成几个部分的安装:

  1. Postman客户端,网页端不能使用;
  2. 浏览器插件Postman Interceptor
  3. Interceptor Bridge

安装前两项的时候没有什么问题,Interceptor Bridge 在Linux和Win系统上也很顺利,但在Mac系统上需要自己安装Node环境。

问题解决

我确信自己一定在系统安装了Node,但是多次打开Postman软件依然让我下载Node,于是我去Postman官网看到这样一段话:

If you’re on Windows or Linux, Postman will take care of everything for you. If you’re on macOS, you’ll be prompted to install NodeJS if it’s not already installed on your computer. If the option to download doesn’t appear, you can manually download and install with the following links: macOS, Linux, or Windows.

于是我开始手动安装Interceptor Bridge ,却发现还有没有用。于是继续看网站,下面有这样一段描述:

If you are unable to use the integration after completing the guided installation, you’ll want to ? check the following items:

  • [macOS] Node is properly installed – Node is installed and available at /usr/local/node or /usr/local/bin/node, or you have the environment variable NVM_BIN set.

原来是这样,Postman判断系统是否安装Node的依据是/usr/local/node/usr/local/bin/node目录下是否存在Node安装文件,而不是环境变量,我的Node为了能统一管理是使用Mac系统的包管理器Homebrew安装的,它的目录在/opt/homebrew/opt/node@14/bin/node,这也是我在其他地方能正常使用Node命令,Postman找不到Node的根本原因。

于是我考虑解决方法,我可以把Homebrew版的Node卸载,使用安装包方式安装,我确信它会出现在/usr/local/node/usr/local/bin/node目录下,但我不想这样,于是我做了一个链接(link):

ln /opt/homebrew/opt/node@14/bin/node /usr/local/bin/node

于是问题解决了。

思考

包管理工具解决了软件统一安装,版本控制等问题,但也存在其他问题,守恒定律体现在各个地方,提升了便捷性的同时也降低了通用性,这种解决方法的问题是,在更换Node版本或者其他改动的时候,链接会失效。希望失效的时候系统给我一个友好的报错,让我能准确的定位问题,不然我只能在这里找到答案了。

参考文献

Posted in 问题解决, 默认分类 | Comments Off on Mac系统Postman安装Interceptor Bridge问题

try…finally…&return

public static void main(String[] args) {
        int result = m();
        System.out.println(result); 
    }
​
    private static int m() {
        int i = 100;
        try {
            return i;
        } finally {
            i++;
        }
    }
}

IntelliJ IDEA反编译的结果:

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
​
package com.example.exception;
​
public class ExceptionTest15 {
    public ExceptionTest15() {
    }
​
    public static void main(String[] args) {
        int result = m();
        System.out.println(result);
    }
​
    private static int m() {
        byte i = 100;
​
        byte var1;
        try {
            var1 = i;
        } finally {
            int var5 = i + 1;
        }
​
        return var1;
    }
}

jad反编译的结果:

// jadx decompiler
public class ExceptionTest15 {
    public static void main(String[] args) {
        int result = m();
        System.out.println(result);
    }
​
    private static int m() {
        try {
            int i = 100 + 1;
            return 100;
        } catch (Throwable th) {
            int i2 = 100 + 1;
            throw th;
        }
    }
}
​
public static void main(String[] args) {
        int result = m();
        System.out.println(result); // 100
    }
​
    /*
     * 结果是 100
     * Java语法规则(有一些规则是不能破坏的)
     *   Java中有这样一条规则:
     *       Java方法体中的代码必须是自上而下顺序依次逐行执行。
     *   Java中还有这样一条规则:
     *       return语句一旦执行,整个方法就执行结束。
     * */
    private static int m() {
        int i = 100;
        try {
            //  这行代码出现在int = 100;的下面,所以最终结果一定是100。
            // return必须保证最后执行。一旦执行,整个方法结束。
            return i;
        } finally {
            i++;
        }
    }
}
Posted in 默认分类 | Comments Off on try…finally…&return