whoru

学习、分享、交流、沉淀

环境:NodeJS v8+

安装依赖

1
2
3
4
# jspdf 是主依赖,其它两个可根据情况选择;
# jspdf-autotable 用于绘制表格;
# jspdf-autotext 用于添加文本,实现自动换行等;
npm i --save jspdf jspdf-autotable jspdf-autotext

引入依赖和初始化

1
2
3
4
5
6
7
8
9
10
11
12
13
// 推荐这种引入方式
import jsPDF from 'jspdf';
// 虽然官方仓库写的是这种,但实际使用过程中却遇到了一些问题,自己可以测试一下
// 比如提示某些方法不存在等
// import { jsPDF } from "jspdf";

// 初始化示例,这里用的是横向A4纸,并且开启压缩
// 构造参数说明如下
// orientation?: "p" | "portrait" | "l" | "landscape",
// unit?: "pt" | "px" | "in" | "mm" | "cm" | "ex" | "em" | "pc",
// format?: string | number[],
// compressPdf?: boolean
const pdfDoc = new jsPDF('l', 'mm', [ 210, 297 ], true);
阅读全文 »

安装

1
➜  ~ npm i nrm -g

使用

1
2
3
4
5
6
7
8
9
10
11
12
# 查看 nrm 内置的几个 npm 源
➜ ~ nrm ls
npm ---------- https://registry.npmjs.org/
yarn --------- https://registry.yarnpkg.com/
tencent ------ https://mirrors.cloud.tencent.com/npm/
cnpm --------- https://r.cnpmjs.org/
* taobao ------- https://registry.npmmirror.com/
npmMirror ---- https://skimdb.npmjs.com/registry/

# 切换源
➜ ~ nrm use cnpm
Registry has been set to: http://r.cnpmjs.org/

❗️JD-GUI 有点老了,已经很久没更新,推荐另一款:https://github.com/skylot/jadx


JD-GUI 是一款大家耳熟能详的 Java 反编译工具,可以方便的将编译好的 .class 文件反编译为 .java 源码文件,用于开发调试、源码学习等。

官网地址:http://java-decompiler.github.io

Git 地址:https://github.com/java-decompiler/jd-gui

下载地址

当前最新版本:v1.6.6 @ Dec 25, 2019

阅读全文 »

由于前一段时间公司项目需求,参与了把 MySQL 数据库迁移到 PostgreSQL 数据库的工作,本文主要记录常用语法的转换规则,待补充完善。

数据库版本:

  • MySQL 8.0.x
  • PostgreSQL 15.0.x

基本规则

引号、反引号

在 PostgreSQL 中,单引号 AS 'col1' 和反引号 `` 都不支持,要么去掉,要么用双引号代替。

在 Java 的 MyBitis xml 文件中,如果返回结果是 Map 结构,并且返回字段用 AS 转为驼峰,则必须用双引号包起来,否则返回后会转换为小写,如

1
2
3
4
5
<select id="getWaitAuditPurchaseReturn" resultType="java.util.Map">
select
coalesce(count(1),0) as "waitAuditNum",
min(prepared_bill_time) as "preparedBillMintime"
...

WHERE 中字段值的大小写与实际数据不一致

1
2
3
4
5
6
-- 这样在 MySQL 可以正常查询出来结果,但是在 PostgreSQL 中查询不到
-- 表中存的实践数据是大写的 MATERIAL_USE_TYPE
select id from system_user_privilege where tableAlias.privilege_type = 'material_use_type'

-- 可以用 UPPER 或 LOWER 函数处理一下
select id from system_user_privilege where tableAlias.privilege_type = UPPER('material_use_type')
阅读全文 »

Docker 是一款针对程序开发人员和系统管理员来开发、部署、运行应用的一款虚拟化平台。它可以让你像使用集装箱一样快速的组合成应用,并且可以像运输标准集装箱一样

Vagrant 是另一款虚拟化工具,与 Docker 的区别参见这里。

阅读全文 »