Clay 的技术空间

用进废退 | 艺不压身

前言

本教程只适用于 Centos7 安装搜狗输入法(v2.2.0.0108),支持的桌面环境是 GNOME。注:文章末尾附有搜狗输入法最终的运行效果图

系统环境

1
2
CentOS Linux release 7.6.1810 (Core)
Linux centos7.6 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

安装 Fcitx 输入法框架

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 关闭ibus输入法,绝对不能使用“yum remove ibus”命令卸载ibus, 否则会将桌面环境一同卸载掉
# mv /usr/bin/ibus-daemon /usr/bin/ibus-daemon.bak

# 安装fcitx
# yum install libQtWebKit* fcitx fcitx-libs fcitx-qt4 fcitx-qt5 fcitx-configtool fcitx-table fcitx-table-chinese

# 如果上面的fcitx-qt5因依赖关系无法安装,则可以安装qt5-qtbase来替代
# yum install qt5-qtbase

# 配置环境变量(主要是为了解决GTK/Qt程序无法切换输入法)
# vim /etc/profile
export XIM=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export QT4_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"

# 重启系统使环境变量生效,并关闭ibus
# reboot

# 查看fcitx的安装状态(使用普通用户身份运行),重点查看红色部分(错误)的日志信息
$ fcitx-diagnose
阅读全文 »

跨域

SpringBoot + Security 跨域

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
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

/**
* Web 安全配置
*/
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable().authorizeRequests().antMatchers("/**").permitAll();
}

/**
* 允许跨域
*
* @return
*/
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*");
corsConfiguration.addAllowedHeader("*");
corsConfiguration.addAllowedMethod("*");
corsConfiguration.setAllowCredentials(true);
source.registerCorsConfiguration("/**", corsConfiguration);
return new CorsFilter(source);
}

}
阅读全文 »

前言

本文主要介绍 Centos7 如何安装微信客户端、网易云音乐、百度网盘、TeamViewer、Rhythmbox 等桌面软件。

添加 YUM 源

添加 epel,nux-dextop,rpmfusion 源,可参考本站教程:Centos7 管理 YUM 源

electronic-wechat 微信客户端

electronic-wechat 是一款基于 Web 版微信开发的第三方微信客户端,自带消息防撇回功能。由于 Web 版的微信会限制新注册的微信账号登录,因此 electronic-wechat 同样不支持微信新账号登录。该项目由于各种原因已经停止维护,但并不影响正常使用,实测使用非常稳定。

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
# 进入安装目录
# cd /usr/local

# 下载已编译的安装包
$ wget https://github.com/kooritea/electronic-wechat/releases/download/v2.3.1/electronic-wechat-linux-x64-2.3.1.zip

# 解压文件
# unzip electronic-wechat-linux-x64-2.3.1.zip

# 删除文件
# rm -rf electronic-wechat-linux-x64-2.3.1.zip

# 文件授权
# chown -R peter:peter electronic-wechat-linux-x64

# 使用普通用户身份运行应用(可以使用快捷键ctrl + c退出程序)
$ ./electronic-wechat-linux-x64/electronic-wechat

# 创建应用菜单栏的快捷方式
# vim /usr/share/applications/electronic-wechat.desktop
[Desktop Entry]
Name=Electronic Wechat
Comment=Unofficial WeChat client built with React, MobX and Electron.
Exec=/usr/local/electronic-wechat-linux-x64/electronic-wechat %U
Icon=/usr/local/electronic-wechat-linux-x64/assets/icon.png
Terminal=false
Type=Application
Categories=Network;Chat;

# 导航到:应用程序 --> 互联网 --> Electronic Wechat,直接点击快捷方式启动应用,效果图如下
阅读全文 »

前言

本文主要介绍两款适用于 Centos7 的桌面壁纸应用,分别是 Komorebi 和 Wonderwall,其中 Komoreb 支持使用视频、网页作为桌面动态壁纸。

系统环境

1
2
CentOS Linux release 7.6.1810 (Core)
Linux centos7.6 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Komorebi 站点

Komorebi 介绍

Komorebi 是一款 Linux 动态壁纸应用,可以实现类似 Stream Wallpaper Engine 的效果,支持使用图片、视频、网页作为桌面壁纸。Komorebi 官方默认只支持 Debian/Ubuntu 系的 Linux 发行版,如果需要在 Centos7 上安装,则需要编译分支 Komorebi-Centos 的代码,手动安装编译构建生成的 RPM 包。

阅读全文 »

系统环境

1
2
CentOS Linux release 7.6.1810 (Core)
Linux centos7.6 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

安装依赖

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 安装epel源
# yum install epel-release

# 安装字体
# yum install liberation-mono-fonts

# 安装gnome菜单
# yum install gnome-menus

# 安装gnome个性化定制工具
# yum install gnome-tweak-tool

# 安装桌面管理器
# yum install gnome-shell

# 通过按下 Alt + F2 快捷键,然后输入 r 重启界面,导航到应用程序 --> 附件,可以看到多了一个优化工具
阅读全文 »

系统环境

1
2
CentOS Linux release 7.6.1810 (Core)
Linux centos7.6 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

检查显卡的识别状况

在执行下述所有步骤之前,必须确保当前系统已经正确识别到 NVIDIA 的显卡,否则在显卡没有被正常识别的情况下,执行后续的安装步骤都是徒劳的。此时可以执行以下命令,若可以输出相关信息,则说明显卡能被系统正常识别。否则请重新插拔显卡,或者检查主板是否需要跳线或者设置 BIOS 才能正确识别独立显卡。

1
# lspci | grep "NVIDIA"

安装软件依赖

1
# yum -y install gcc gcc-c++ wget

安装 NVIDIA 显卡检测工具

1
2
3
4
5
6
7
8
9
10
11
12
13
# 导入key
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

# 安装elrepo源
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

# 安装检测工具
# yum install nvidia-detect

# 检测显卡,正常情况下会输出最新且适用当前显卡的驱动程序的版本号信息
# nvidia-detect -v

# 提示:不建议使用rpmfusion安装Nvidia的显卡驱动,因为开源的显卡驱动在性能方面跟Nvidia官方的闭源显卡驱动有一定的差距
阅读全文 »

大纲

版本说明

软件版本描述
ElasticSearch7.4.2ElasticSearch 的版本
Curl7.29.0Curl 的版本

Mapping

Mapping 简介

Mapping 是用来定义文档(Document),以及它所包含的字段(Field)是如何存储和检索的,这类似创建 MySQL 数据库表时指定表的字段类型,主要作用如下:

  • 定义 Index 下的字段名
  • 定义字段类型,比如数值型、浮点型、布尔型等
  • 定义倒排索引相关的设置,比如是否索引、记录 Position 等
阅读全文 »

大纲

版本说明

软件版本描述
ElasticSearch7.4.2ElasticSearch 的版本
Curl7.29.0Curl 的版本

ElasticSearch 导入数据

学习 ES 的时候,往往需要大量的测试数据,建议导入 ES 官方 GitHub 仓库中的 JSON 数据文件,这样方便后续学习 ES 的复杂查询。首先将 ES 官方提供的 JSON 数据保存到 accounts.json 文件里,或者直接从本站下载 数据文件,然后执行以下命令批量导入数据。

1
curl -X POST -H 'Content-Type:application/json' http://127.0.0.1:9200/bank/account/_bulk --data-binary @accounts.json
阅读全文 »

大纲

版本说明

软件版本描述
ElasticSearch7.4.2ElasticSearch 的版本
Curl7.29.0Curl 的版本

ElasticSearch 介绍

ElasticSearch 概述

ElasticSearch 是基于 RESTful 标准的高扩展高可用的实时数据分析的全文搜索工具。它提供了一个分布式多用户能力的全文搜索引擎,基于 RESTful 接口。ElasticSearch 是在 Lucene 的基础上用 Java 开发的,并作为 Apache 许可条款下的开放源码发布,是当前流行的企业级搜索引擎。Elasticsearch 在云计算中,拥有实时搜索、稳定、可靠、快速、安装使用方便等优势。构建在全文检索开源软件 Lucene 之上的 Elasticsearch,不仅能对海量规模的数据完成分布式索引与检索,还能提供数据聚合分析的功能。

阅读全文 »

大纲

J2Cache 的 Gradle 配置

在项目中引入以下依赖后,需要根据项目具体的运行状况调整 Gradle 的依赖配置,以下配置使用到 SpringBoot。

1
2
3
compile 'net.oschina.j2cache:j2cache-core:2.7.6-release'
compile 'net.oschina.j2cache:j2cache-mybatis:2.7.0-release'
compile 'net.oschina.j2cache:j2cache-spring-boot2-starter:2.7.6-release'

MyBatis 使用 J2Cache

首先在 MyBatis 的全局配置文件中开启二级缓存,然后根据下面的两种情况进行配置(二选一)

1
2
3
4
<settings>
<!-- 开启二级缓存,默认false -->
<setting name="cacheEnabled" value="true"/>
</settings>
阅读全文 »