Hexo 博客中添加 Algolia 搜索功能
Hexo 博客中添加 Algolia 搜索功能安装algolia的github地址:https://github.com/LouisBarranqueiro/hexo-algoliasearch
在hexo目录执行安装algolia
npm install hexo-algoliasearch --save
创建 Algolia 账户并获取 API KeyAlgolia官网:https://www.algolia.com
首先创建账户,借助便利的魔法我直接谷歌登陆,然后如图
拿到这三个就成功了,然后还要创建一个索引
配置 Hexo 插件在 Hexo 根目录下,打开 _config.yml 文件并添加以下配置:
# Algolia Searchalgolia: applicationID: 'applicationId' apiKey: 'apiKey' adminApiKey: "adminApiKey" chunkSize: 5000 indexName: "创建的索引名称" fie ...
Hexo + ButterFly主题魔改
先开个坑,东西太多了慢慢整理…
忘光了,不整理了哈哈
资源网站
记录一些资源网站Static Badge-静态图标用于生成一些小标签,比如博客网站底部的标签
https://shields.io/badges
Simple Icons-icon图标icon图标资源网站
https://simpleicons.org/
try-with-resources
try-with-resources写法 采用try-with-resources写法,当try中代码执行结束(正常结束/异常结束)之后就会调用try()括号中对象的close()方法来关闭资源,虽然表面上来看try-with-resources写法更加优雅
因为实现了autoCLoseAble接口,再try代码块结束后,connection的close方法会自动调用
// 假设dataSource可用try{ try(Connection conn = dataSource.getConnection()) { ... String sql = "select * from ..."; try(PreparedStatement statement = conn.prepareStatement(sql)) { ... } }} catch(...) { ...} finally { ...}在执行完后,conn和其中使用的statement等资源 ...
spring+jdbcTemplate操作数据库
spring+jdbcTemplate操作数据库(mysql)// 初始化数据源org.springframework.jdbc.datasource.DriverManagerDataSource dataSource = new org.springframework.jdbc.datasource.DriverManagerDataSource();dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");dataSource.setUrl("jdbc:mysql://localhost:3306/zyappdata_db");dataSource.setUsername("root");dataSource.setPassword("root");// jdbcTemplate操作数据库org.springframework.jdbc.core.JdbcTemplate jdbcTemplate = new org.springframewo ...
使用jdbcTemplate时,插入数据后获取自增的id
使用jdbcTemplate时,插入数据后获取自增的id(mysql)两种写法
Connection connection = null;PreparedStatement ps = null;ResultSet generatedKeys = null;connection = dataSource.getConnection();// 准备插入数据的SQL语句,同时指定返回自动生成的主键String mSql = "INSERT INTO your_table_name (view_name, view_desc, database_id, version, creator_account, create_time) VALUES (?, ?, ?, ?, ?, ?)";ps = connection.prepareStatement(mSql, Statement.RETURN_GENERATED_KEYS);ps.setString(1, viewName);ps.setString(2, viewDesc);ps.setString(3, database ...
JS将信息拼接并复制到剪切板
let copyStr = '';// 版本号const version = '...';// 更新时间const updateTime = '...';// 编辑备注const editDesc = '...';// 脚本const editScript = '...';copyStr = `版本号:${version};\n更新时间:${updateTime};\n编辑备注:${editDesc};\n更新脚本:\n${editScript}`;// 创建输入元素const input = document.createElement('textarea');document.body.appendChild(input);input.value = copyStr;input.select();// 复制到剪切板if (document.execCommand('copy& ...
JS原生获取当前时间并格式化为yyyy-MM-dd HH:mm:ss
// js获取当前时间并格式化const currentDate = new Date();const year = currentDate.getFullYear();const month = String(currentDate.getMonth() + 1).padStart(2, '0');const day = String(currentDate.getDate()).padStart(2, '0');const hours = String(currentDate.getHours()).padStart(2, '0');const minutes = String(currentDate.getMinutes()).padStart(2, '0');const seconds = String(currentDate.getSeconds()).padStart(2, '0');console.log(`${year}-${month ...
记录当前可用docker数据源
docker源不可控因素不能连接了,目前只能临时找还没下架的源拉取镜像vim /etc/docker/daemon.json
ICUhttps://dockerhub.icu/
sudo systemctl daemon-reload #重启daemon进程sudo systemctl restart docker #重启docker
sqlserver:sqljdbc4下载失败问题
sqlserver:sqljdbc4下载失败问题出现Cannot resolve com.microsoft.sqlserver:sqljdbc4:4.0
解决办法一:直接换代码<dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>6.2.0.jre8</version> <scope>test</scope></dependency>
解决办法二:手动下载
进入jar包目录执行:
mvn install:install-file -Dfile=sqljdbc4-4.0.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jarmvn install:install-file -Dfile=“jar包的 ...
