解决 ibus-rime 在 ubuntu 18.04 下中英文切换图标无变化问题

我忍受这个问题已经有快一个月了,今天打算花点时间把它解决掉。

经过一翻搜索,我发现已经有人在 ibus-rime 项目上报告了这个问题,也有人给出了解决方法。遗憾的是,那个解决方案有些含糊,我不知道需要对系统做哪些改变。

也许从源码安装能够解决问题?但我一开始走了弯路,没有认真安装文档中提到的所有依赖,毫无疑问的,编译到中间就因为缺这缺那失败了。后面我就老老实实的按照文档说明,先安装好所有的依赖,再执行 ./install.sh。然而我仍然可耻的失败了。我不知道原因....也许应该报个bug给作者。幸运的是,源码里还有一个 install-static.sh 脚本,我执行了这个脚本,结果顺利编译成功并安装。

现在我的五笔拼音也能够识别中英方式了(英文状态显示A,中文状态显示“五”),太开心了!

我是 ubuntu 18.04 (pop!os) Gnome 3 桌面,五笔拼音输入法

为方便同样用 ubuntu 18.04 的同学,我把编译前的准备工作和编译步骤列在下面:

1. 准备工作

sudo apt install cmake libboost-all-dev libibus-1.0-dev libnotify-dev libgoogle-glog-dev \
libkyotocabinet-dev libleveldb-dev libmarisa-dev libopencc-dev libyaml-cpp-dev

2. clone project and submodules:

git clone --recursive https://github.com/rime/ibus-rime.git
cd ibus-rime
# do this as normal user
./install-static.sh

3. 重启 ibus

ibus-damon -dxr 

Enjoy your favorite input method!

My favorite applications on Ubuntu

Awesome-Linux-Software
Awesome-Linux-Software Chinese

Currently, my laptop runs Pop! OS 18.04 (Ubuntu). Thanks my boss, he bought me a Windows laptop, so I have the chance to run Linux as my main OS. The following is a list of my favorite apps on my laptop.

mp3 player: Audacious

browser: Chromium

Markdown editor: Typora

Text editor: Geany

Quick view: gnome-sushi

Epub reader: Foliate

Console Dictionary: sdcv

Console tts: say (in gnustep-gui-runtime package)

hardware information: inxi

say alternative: gnustep-gui-runtime

apt-get install -y audacious chromium typora geany gnome-sushi foliate sdcv gnustep-gui-runtime inxi

3rd software

Jetbrains: Rider, Webstorm, Phpstorm, Pycharm

Telegram-desktop

will update the list when I remember... 😀

`git rm --cached ` is a worse choice than `git update-index --assume-unchanged `

There are 3 options, you probably want #3

  1. This will keep the local file for you, but will delete it for anyone else when they pull.

    git rm cached or git rm -r cached

  2. This is for optimization, like a folder with a large number of files, e.g. SDKs that probably won't ever change. It tells git to stop checking that huge folder every time for changes, locally, since it won't have any. The assume-unchanged index will be reset and file(s) overwritten if there are upstream changes to the file/folder (when you pull).

    git update-index --assume-unchanged

  3. This is to tell git you want your own independent version of the file or folder. For instance, you don't want to overwrite (or delete) production/staging config files.

    git update-index --skip-worktree

It's important to know that git update-index will not propagate with git, and each user will have to run it independently.

gnome3 how to alt tab windows on current workspace only?

gsettings set org.gnome.shell.app-switcher current-workspace-only true

status code versus error code

同事扔给我一张截图,显示errCode是5,说:

「已注册」的error code是5, errorCode 4开头的会到404页面, 5开头的会到505页面,

我们之前有通过的都是200

不不不

这个和 statusCode 是两码事儿
errCode 是业务错误代码
20x 40x 50x 是返回响应的状态码,通常是框架自动给的,若你的请求参数没有问题,系统通常都会返回状态码 200。但返回200并不意味着一切都对,在我们的项目中,状态码返回 200 并且 success 为 true 或者 errCode = 0才是真的没有问题

同事

哦,是这样,所以我们还是有statusCode

如果参数根本不符合约定,系统会立即拒绝你,那时候statusCode 会是 40x

如果参数都对,但后端的代码出了bug造成服务器不能正常返回,response会报 50x 表示前端没错,但服务器那边出问题了。
换言之如果是 20x,则你没错,我也没错,成功没有成功是业务逻辑的事情。
如果是 40x 意味着前端送过来的数据不符合后端要求,因此没有被进一步处理,而是被直接拒绝了
50x 表示前端送过来的东西没有大问题,但后端没有处理好出错了

同事

好的,那我明白了,我记错了,是statusCode才是指到505,404, 我以为都改成了errCode

所以 errCode 5 一定不能一杆子指到 505 页面去。

发现 50x 了去找后端工程师的麻烦一般不会错,如果 40x 了去找后端之前,最好先检查下自己的参数和出错信息

同事

status code 和 errCode 本质上是两个东西,errCode是返回数据的一部分

status code 是本次请求返回响应的状态码,可以理解为和返回数据是同一等级的

同事

那我们的error.response的数据结构有改变吗,我现在还是可以抓取到error.response.status,说明这部分应该是没有改的

这个是axios的约定,并不是后端能够决定的,我们结构的变化,只是response.data 结构的变化是 response.data 吧,我不是很确定,毕竟好久不写 axios 代码了

同事

是的,但是后来有加了一个data, 我们现在的结构变成这样的 [ Photo ]

对。后端只给了一个data键,图里的第一个data是 axios给的,需要注意的是,不同的框架给返回数据的键取的名字可能会不一样。如果不用axios而是用别的库,数据那一级的键的名字就很有可能不叫 data

同事

嗯嗯

话外音

我相信她这次真的搞明白了。哈。聊天记录稍加编辑就水了一篇博客,不过我相信它应该会对前端新人有所帮助。