Author Archives: csslayer

最近的一个 Linux Intel 驱动问题和 Workaround

老实说一般我都不愿意写这种文章。因为这种文章基本上都是很有时效性的。但毕竟这个问题已经困扰了我好几个月,所以还是打算记录一下方便同样遇到问题的人。 具体表现是,开机正常,使用正常,但是如果放久了就会黑屏再也起不来。这时还能 ssh 进去,但是从 ssh 重启很大可能会等待很久。上游的 bug report 我也不好分辨到底是哪个,就随便列出几个我觉得相关的。 https://bugs.freedesktop.org/show_bug.cgi?id=102224 https://bugs.freedesktop.org/show_bug.cgi?id=102853 那么最后我的解决方案是什么呢……总之也是在某个 report 里面看到有人提到的方法。 在 /etc/modprobe.d/90-i915.conf 里面写上 options i915 enable_guc_loading=1 enable_guc_submission=1 disable_power_well=0 总之我加上这个参数之后好久都没有出过问题了。 顺带一提我正在使用的内核版本是 4.13.0 但是这个问题至少困扰我了好久好久大概从 4.9 之后升级了 BIOS 开始……

Posted in Linux | Tagged , , , | Leave a comment

一个关于 Pimpl 的小技巧

使用 Pimpl 很多时候是必须的,ABI 兼容的时候基本都要靠它。在 C++ 11 当中,通过 default member initializer 可以实现很多有趣的效果,加上宏的话很多时候可以利用来实现 Metadata 的效果,例如: #define PROPERTY(NAME) \ Property NAME{this, #NAME}; class Registry { friend class Property; public: int& getValueByName(const std::string &name) { return *values_[name]; } protected: void registerValue(const std::string name, int* … Continue reading

Posted in Linux | Tagged , , | Leave a comment

Shell script for Google TTS on Plasma desktop

My wife has extreme dry eye condition, so she want to avoid looking at the screen as much as possible. She asked me for a solution for Text-to-Speech on linux desktop. Basically her requirement is to press a key and … Continue reading

Posted in KDE | Tagged | 2 Comments

A new pinyin input method that might be slightly better than sunpinyin

What do I mean when I say “slightly better”? First of all, thanks to sunpinyin’s open-gram, I can use its data for free. So, on the pinyin side, libime IS using the exact same data from sunpinyin. So what’s the … Continue reading

Posted in fcitx development | Tagged , | 4 Comments

用 CMake target 来管理依赖库

虽然有越来越多的包提供 CMake config 了,时常还是需要手写一个。但是如果你还活在 cmake 2.8 的时代, 你可能浪费了很多的精力在不必要的地方。 简单来说,如果你还在写 include_directories,link_directories 来给你的依赖添加找头文件和库的目录,那么你大概已经 OUT 了。 比较现代的一种方式是,用 Target 来管理依赖的库的一切。最早我是从 Qt5 的 cmake 那里学到的。简单来说,就是通过 add_library([Library] [TYPE] IMPORTED]) 来把你依赖的库变成一个 cmake target。同时这个 target 就自带了 include_directories 的属性和 library 自身路径。 那么可以来看看一个我写的新 libintl 的例子:https://github.com/fcitx/fcitx5/blob/master/cmake/FindLibIntl.cmake 精髓就是在最后这里: if(LIBINTL_FOUND AND NOT TARGET … Continue reading

Posted in cmake | Tagged | Leave a comment