May 22, 2014

Ubuntu下解决Chrome升级后界面中文乱码问题

Ubuntu版本:12.04 LTS

昨天Chrome升级到35后,包括书签,Tab,地址框,以及右键菜单中的中文都变成乱码。

尝试用用以下方法解决:

sudo ln -s ../conf.avail/69-language-selector-zh-cn.conf /etc/fonts/conf.d/69-language-selector-zh-cn.conf

不起作用,查看了该文件的内容,与参考链接给的模板文件不太一样。

删除链接文件,下载编辑模板文件,重命名为69-language-selector-zh-cn.conf,拷贝覆盖原文件。

重启Chrome,依然不起作用。

注销重新登录,无变化,晕啊。

今天早上又股沟了一下,原来需要把系统的字体改一下:

Settings Manager > Appearance > Fonts > Default Font

改成 WenQuanYi Micro Hei

重启Chrome,问题解决, 耶!哈哈哈。

其实把系统的语言支持设置为中文(排到第一位),也能解决此问题,但系统整个变成中文化环境,不适合工作需要。


参考链接:
https://code.google.com/p/chromium/issues/detail?id=335651

May 19, 2014

Upgrade to Ubuntu 14.04 failed on my 2012 late iMac

I should not click 'Yes' while it prompted 'A new version found, do you want to upgrade.'

The whole upgrade process seemed ok, only except some compile errors about out of memory with fontconf....

But at the end of upgrade, it reported the upgrade failed, and it could not roll back to the old 13.04.

I reboot the machine into ubuntu anyway, it brought up everything, and seems a new version already installed, only that the desktop resolution abit low.

But i wouldn't bother myself to figure that out, since I don't know what other potential issues there. Don't want to take any risk and put myself into a even worse situation.

So, after googling a little, I decided to give it a fresh installation with 14.04, for sake of it's a LTS version.

And shame that couldn't find image for mac on ubuntu official download site, finally found it from a forum:

http://cdimage.ubuntu.com/releases/trusty/release/ubuntu-14.04-desktop-amd64+mac.iso
(MD5: 0bc7243aacd5f80f8110dcf3165dffd0)

Downloading now, and hope no other issues with the installation upcoming...

May 12, 2014

Linux bash history with Page up / Page down

n linux you can configure the pgup/pgdown keys to navigate through commands you typed that begin with the string you just typed. Type "mysql" and then hit "Page up", and you will see nothing but mysql-related commands.
Unfortunately this has to be configured anew on every machine or server/vm I work on, and I always forget where this is configured (and it takes a while to find it in google), so I thought I should write it down.
------------
In /etc/inputrc, uncomment:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
Restart your shell or use Ctrl+X, Ctrl+R to tell it to re-read.
(thanks stackoverflow)
Yep, it's not ".bashrc" but "inputrc".
Not sure why this one is not hidden, but so it is.
You could try ~/.inputrc for a local, user-specific configuration.
Tried this in Ubuntu, and it works.

Add alias and color to git

edit your git config  /home/%youraccount%/.gitconfig as following

[alias]
   st = status
   ci = commit
   br = branch
   co = checkout
   df = diff
   lg = log -p
   lol = log --graph --decorate --pretty=oneline --abbrev-commit
   lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
   ls = ls-files
   meld = !/usr/local/bin/git-meld.pl
[merge]
   tool = meld
[mergetool]
   keepBackup = false
[merge "ours"]
   driver = true
[mct "review"]
   command = git meld
[color]
   ui = true
[color "diff"]
   whitespace = red reverse
[core]
   whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
[color]
   ui = auto
[color "branch"]
   current = yellow reverse
   local = yellow
   remote = green
[color "diff"]
   meta = yellow bold
   frag = magenta bold
   old = red bold
   new = green bold
[color "status"]
   added = yellow
   changed = green
   untracked = cyan
[user]
   name = Fan Deng
   email = leondeng@gmail.com
[diff]
   tool = meld

May 2, 2014

Screen brightness setting with Xfce on iMac, iMac Xfce 屏幕亮度调节

1. 键盘亮度调节支持
默认安装xfce后没有安装(xfce4-power-manager-plugins)的插件,在ububtu下面 apt-get install xfce4-power-manager-plugins安装后启动一下power manager工具即可通过键盘调节亮度

2. 屏幕亮度记忆
屏幕亮度不能保存,每次开机都回恢复到最亮的状态。
请教了Google后,在一个外文博客上发现了解决的方法。
首先要写一个调节屏幕亮度的脚本,只有一句:
echo 3 > /sys/class/backlight/acpi_video0/brightness
里面的“3”可以替换为1-10中任意数字,越大越亮。
把这个脚本保存起来,比如保存为~/brightness
把这个脚本移动到/usr/local/sbin/brightness,并增加运行的权限
chmod +x /usr/local/sbin/brightrness
接着,配置允许不输入密码就sudo运行这个脚本,运行visudo,增加下面这行:
# User privilege specification
syndim        ALL=NOPASSWD: /usr/local/sbin/brightness
将上面的syndim替换为用户名。
最后,打开Applications  > Xfce Settings  > Session and startup,将
sudo /usr/local/sbin/brightness
添加进去,重新启动,enjoy~
参考链接: