咸鱼

咸鱼是以盐腌渍后,晒干的鱼

0%

Vert.x是一个基于 JVM、轻量级、高性能的应用平台,采用事件驱动的编程模型,底层使用的Netty作为通讯组件,为了降低使用门槛,屏蔽掉了许多底层netty相关的细节。

官网介绍:Vert.x™ Reactive applications on the JVM

历史背景

一位名叫 Tim Fox 的开发人员曾在 VMware 的 SpringSource 部门工作。在此期间,他领导开发了 Vert.x 项目。2012 年,Tim 跳槽到了 Red Hat 并希望能够继续从事该项目的开发,所以VMware和Redhat为此吵了一段时间,后来项目转移到Eclipse基金会。

快速创建项目

阅读全文 »

linux 下用for循环 ping 网段:10.0.1.*

1
for i in 10.0.1.{1..254}; do if ping -c 3 -w 3 $i &>/dev/null; then echo $i Find the target; fi; done

苹果设备现在拍照的文件都是 .heic 格式,文件占的存储空间确实更小了,但导出到Windows查看,打开图片所在文件夹就被会卡到不行,为了方便整理图片,可以考虑将图片批量转为 pngjpg等格式。
网上很多网站提供在线转换,这对于大量图片来说肯定不适用,而且个人图片还存在隐私问题,所以考虑用Python来做这个事情。

一、格式详解

HEIFHEIC 的介绍请看这篇文章:【HEIF/heic图片文件解析】
简单来说,HEIF 是一个容器的图片格式,当前包含的编码 HEVC(256) 和 H.264/MPEG-4 AVC
在苹果设备采用的HEIC就是 HEIF采用 HEVC编码的一种,文件后缀为 *.heic

二、库

如果想自己去提取HEIF文件中的图片,一定会使用到诺基亚的C++库【nokiatech/heif】,我们用Python也是要用到这个库,但我们不直接安装这个库。

阅读全文 »

PyCharm创建项目有几种选择,这里记录一下。

1. Previously configured interpereter


这是使用系统安装的Python的环境,pip依赖也是安装在系统的。
优点:使用现成的环境,方便快捷。特别是依赖,只要系统中使用过的库,无需重新下载安装。
缺点:各个项目的Python版本可能不一样,会和系统的Python版本冲突。

2. Virtualenv


Virtualenv虚拟环境为项目提供隔离的Python,解决了不同应用间多版本的冲突问题。这是在项目根目录下有一个venv目录,里面下载了你选择的Python版本,默认会安装 pipsetuptools
优点:不会有多版本的冲突问题。
缺点:项目中的虚拟环境存在一个Python版本,依赖也是安装在虚拟环境下,耗时更加长。要手动安装依赖。

阅读全文 »

有项目对AES对称加密有需求,使用Java使用Aes过程中有些坑是要注意一下的。

跨平台问题

AES是对称加密,利用秘钥,可以对内容加密和解密,于是我在PC开发电脑上尝试以下代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public static byte[] encrypt(String content, String password) {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128, new SecureRandom(password.getBytes()));
SecretKey secretKey = kgen.generateKey();
byte[] enCodeFormat = secretKey.getEncoded();
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");
byte[] byteContent = content.getBytes("utf-8");
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(byteContent);
}

public static byte[] decrypt(byte[] content, String password) {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128, new SecureRandom(password.getBytes()));
SecretKey secretKey = kgen.generateKey();
byte[] enCodeFormat = secretKey.getEncoded();
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(content);
}

这段代码在本机加密和解密都没问题,是正常的,但如果跨机器执行很大概率会解密失败,这是由于不同机器很大概率是安装了不同平台厂商的JDK和版本(特别是Android 平台)。

阅读全文 »

【2021-12-03】手贱在Win10的电脑管家上升级了Git至版本【2.34.0】,无意中发现无法执行clone命令克隆Gitlab上的仓库,Gitee、Github上的可以。

Gitlab版本信息:

GitLab 10.5.5
GitLab Shell 6.0.3
GitLab Workhorse v3.6.0
GitLab API v4
Ruby 2.3.6p384
Rails 4.2.10
postgresql 9.6.5

故障表现为:

1
2
3
4
5
6
7
8
9
10
11
12
$ git clone git@192.168.0.186:kevin/test.git
Cloning into 'INNC'...
git@192.168.0.186's password:
Permission denied, please try again.
git@192.168.0.186's password:
Permission denied, please try again.
git@192.168.0.186's password:
git@192.168.0.186: Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
阅读全文 »

在Ubuntu桌面版中安装IDEA,Jetbrains只提供 tar.gz 格式包,解压即可使用,但需要执行 idea.sh ,没有快捷方式对桌面系统很不友好。

我们可以手动编辑一个快捷方式,在桌面创建一个名为 idea.desktop的文件,假如我们解压目录地址为 /usr/local 内容为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[Desktop Entry]

Version=2021.2.2

Type=Application

Name=IDEA

Comment=IntelliJ IDEA

Exec=sh /usr/local/idea/bin/idea.sh

Terminal=false

Icon=/usr/local/idea/bin/idea.png

Terminal=false

Encoding=UTF-8

Categories=Development;

还需要给这个文件赋予运行权限:

1
$ sudo chmod +x idea.desktop
阅读全文 »

部署一个简单的 Springboot Web 项目在阿里云ESC公网,web容器由Tomcat切换为Undertow。

1. 异常信息

跑一段时间后,在日志中经常出现一些其他域名相关的奇怪异常,而且很难复现。如下:

以下只贴出带有域名的异常,其实IP的异常居多

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

2021-09-30 09:14:02.935 ERROR 18684 --- [ XNIO-1 I/O-1] io.undertow.request :
UT005071: Undertow request failed HttpServerExchange{ CONNECT www.baidu.com:443}

java.lang.IllegalArgumentException: UT000068: Servlet path match failed
at io.undertow.servlet.handlers.ServletPathMatchesData.getServletHandlerByPath(ServletPathMatchesData.java:83) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:88) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:146) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:129) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:466) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]



2021-10-02 01:57:00.626 ERROR 18684 --- [ XNIO-1 I/O-1] io.undertow.request :
UT005071: Undertow request failed HttpServerExchange{ GET ab2h}

java.lang.IllegalArgumentException: UT000068: Servlet path match failed
at io.undertow.servlet.handlers.ServletPathMatchesData.getServletHandlerByPath(ServletPathMatchesData.java:83) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:88) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:146) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:561) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]


2021-10-10 22:14:39.423 ERROR 18684 --- [ XNIO-1 I/O-1] io.undertow.request :
UT005071: Undertow request failed HttpServerExchange{ CONNECT www.sogo.com:443}

java.lang.IllegalArgumentException: UT000068: Servlet path match failed
at io.undertow.servlet.handlers.ServletPathMatchesData.getServletHandlerByPath(ServletPathMatchesData.java:83) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:88) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:146) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:129) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:466) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]


2021-10-11 19:53:54.083 ERROR 10473 --- [ XNIO-2 I/O-2] io.undertow.request :
UT005071: Undertow request failed HttpServerExchange{ CONNECT hotmail-com.olc.protection.outlook.com:25}

java.lang.IllegalArgumentException: UT000068: Servlet path match failed
at io.undertow.servlet.handlers.ServletPathMatchesData.getServletHandlerByPath(ServletPathMatchesData.java:83) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:88) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:146) ~[undertow-servlet-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.handlers.accesslog.AccessLogHandler.handleRequest(AccessLogHandler.java:148) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57) ~[undertow-core-2.0.29.Final.jar!/:2.0.29.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[xnio-api-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:129) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:466) ~[xnio-nio-3.3.8.Final.jar!/:3.3.8.Final]
阅读全文 »

【DB Browser for SQLite】是一个可视化SQLlite数据库管理工具,其主要实现了高质量、可视化、免费开源、设计与编辑与SQLite兼容的数据库文件。

现在国内免费的流程图画图软件网页版的居多,如 ProcessOn 、 GitMind 、DrawIO 等。现在发现一个新的选择,IDEA上的PlantUML是一个开源的插件,可以使用代码来画图。

Visio是商业软件 ,MasterMind 和 XMind 可以长期免费试用,只是导出文件有水印。

安装方法很简单,在插件市场上直接搜索安装。

创建一个PlantUML文件,选择图形类型,新文件会有示例代码

支持的类型挺多的,这里截图我关注的几个类型,效果还不错:

阅读全文 »

一、简介

Excalidraw是一款非常轻量的开源在线白板工具,手绘风格。可以直接在浏览器打开,轻松绘制具有手绘风格的图形。

二、在线或独立部署

Excalidraw 在线使用,很方便。
也可以本地部署,支持docker。

工作界面
工作界面

阅读全文 »

介绍

MinIO 是在 GNU Affero General Public License v3.0 下发布的高性能对象存储。 兼容 Amazon S3 云存储服务接口。

由于兼容S3,后期数据量大不想自己维护,可以很方便的切换到其他的对象存储云服务(如:Amazon S3 、阿里OSS、 腾讯云等)

部署

MinIO不但支持分布式部署,还提供了与k8s、etcd、docker等容器化技术深度集成方案。
但是单机的MinIO服务器最适合早期开发和评估,这里也是已部署单机为例。

阅读全文 »

升级了Android Studio创建了一个新的新项目,添加aar库出现各种找不到库的问题。
版本信息如下:

1
2
3
4
5
6
Android Studio Arctic Fox | 2020.3.1
Build #AI-203.7717.56.2031.7583922, built on July 27, 2021
Runtime version: 11.0.10+0-b96-7249189 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation

下面记录一下变动:

  1. repositories变动
    /project/build.gradle 内的 allprojects 节点移动到了 /project/settings.gradle,内容如下:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
    google()
    mavenCentral()
    jcenter() // Warning: this repository is going to shut down soon
    flatDir {
    dirs 'libs'
    }
    }
    }
  2. libs目录变动
    从以上flatDir配置看到,’libs’ 就是当前目录下的 libs 目录
    libs目录默认由 /project/module/libs 改为 /project/libs
    不设置flatDir,项目构建时会提示错误。

阅读全文 »

2021年09月14 JDK 17 发布。这是 JDK 11 后的第二个长期支持版本( 2029年9月到期 )。

根据最新发布的“Oracle No-Fee Terms and Conditions”(NFTC)许可,撤回了 2018 年制定的要对 Oracle JDK 收取商用费用的决定,并且不影响 Oracle OpenJDK 的发行。

新特性: http://openjdk.java.net/projects/jdk/17/

  • 306: Restore Always-Strict Floating-Point Semantics
  • 356: Enhanced Pseudo-Random Number Generators
  • 382: New macOS Rendering Pipeline
  • 391: macOS/AArch64 Port
  • 398: Deprecate the Applet API for Removal
  • 403: Strongly Encapsulate JDK Internals JDK
  • 406: Pattern Matching for switch (Preview)
  • 407: Remove RMI Activation
  • 409: Sealed Classes
  • 410: Remove the Experimental AOT and JIT Compiler
  • 411: Deprecate the Security Manager for Removal
  • 412: Foreign Function & Memory API (Incubator)
  • 414: Vector API (Second Incubator)
  • 415: Context-Specific Deserialization Filters

中文

阅读全文 »

一、位运算

左移1位

1
2
3
4
5
//java:
int a = num << 1;

//kotlin
val a: Int = num shl 1

右移1位

1
2
3
4
5
//java:
int a = num >> 1;

//kotlin
val a: Int = num shr 1
阅读全文 »

数据库工具最好不要用破解的,连接生产环境的数据库风险还是很大的。

免费的多平台数据库工具【DBeaver】,功能很强大,支持多种SQL数据库。

版本21.2.0.202108310918

DBeaver是Java开发的,所以支持Windows、Linux、MacOS多平台,提供安装包和免安装的压缩包。

DBeaver有社区免费版和企业收费版本,社区版只有基础功能,企业版拥有更多的功能:

阅读全文 »

听说微软在10月05日开始推送Win11,而有些网友目前已经被推送Win11更新,更新之后都翻了车,不得不重装系统。吓得我赶紧禁止一下Win10上的自动更新。一直以来我是不管Win10,让自己更新、重启,所以系统补丁一直保持最新,但是这次升级Win11跨版本的还是要慎重一点。

  1. 快捷键 Win + R ,输入 services.msc
  2. 找到 windows update
  3. 双击,改为 禁用