28 Dec

lubuntu’s panel keeps in top of all windows

I want the panel to stay in the back of other windows instead of hiding. There is such an option in the panel settings but seems not to be working.
I managed to do that by editing /home/me/.config/openbox/lubuntu-rc.xml
Add these lines just before the last line:

<application name="panel">
<skip_taskbar>yes</skip_taskbar>
<layer>above</layer>
</application>
<application name="panel" type="dock">
<layer>below</layer>
</application>
</applications>

Then restart lubuntu

27 Dec

Ubuntu: incorrect Chinese display

Ubuntu 16.04:Chinese characters display improperly. Old methods don’t work. We need some new methods.
For the system:
sudo vim /var/lib/locales/supported.d/zh-hans
add:
zh_CN.UTF-8 UTF-8
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN GB2312
zh_HK.UTF-8 UTF-8
zh_HK BIG5-HKSCS
zh_SG.UTF-8 UTF-8
zh_SG.GBK GBK
zh_SG GB2312
zh_TW.UTF-8 UTF-8
zh_TW.EUC-TW EUC-TW
zh_TW BIG5

to the file
(those lines were copied from /usr/share/i18n/SUPPORTED)

excecute:
sudo locale-gen

next: config vim:
sudo vi /etc/vim/vimrc
add:
let &termencoding=&encoding
set fileencodings=utf-8,gb18030,gbk,gb2312,big5

next: config gedit:
dconf-editor
in the tree, find:org/gnome/gedit/preferences/encodings
edit the value of candidate-encodings as [‘UTF-8’, ‘GB18030’, ‘GB2312’, ‘GBK’, ‘BIG5’, ‘CURRENT’, ‘UTF-16’]

14 Dec

Some problems about configuring pydev console in eclipse.

I’m planning to do some java coding now. So I installed eclipse which allows me to work with both python and java. However I was really annoyed at configuring the pydev console.
Firstly, I found I can not interact with the console if I run the script with “run” button. I must activate an interactive console to do some further interaction. But the pydev’s console behaves in an odd manner, at least, that’s how it seems to me.
The interactive console can not import modules right there in the same directory with the current working script. The solution is to add the project’s directory to pydev’s PYTHONPATH: right click project name –>PyDev–>set as source folder (add to PYTHONPATH).
Then comes the next problem. I have two similar projects. Both of them rely on a ui.py script of its own. To run these projects, I have to add their directory to Python path as described above. Then I ran project1, everything is fine. Then I ran project2, some error occured. It turns out that project2 called ui.py(1) insteat of its own ui.py. Obviously, the pythonpath configuration does not work in my situation. I have to try another solution, that is to add the projects’s directry to their external lib.
But I still can’t get my project to run correctly. This time, the console failed to find a xls file which was supposed to be read. I typed import os; print(os.getcwd()) to see the current working directory. It turns out that the interactive console was working under eclipse’s default working path rather than the project’s path. So, I have to edit the initial command of interactive console to force the console to change it’s working directory at start up. Go to Windows–>preferences–>Pydev–>interactive console–>initial command, change the initial interpreter commands to:

import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
import os
import inspect

__old_runfile = runfile

def runfile(file):
curpath = os.path.dirname(os.path.abspath(file))
os.chdir(curpath)
__old_runfile(file)

Now I can properly run my project. I have solved all the problems though, I think I will not use eclipse a lot on python coding. I’d still like to use spyder which is far more cute than eclipse especially in virtual environment. It really saved you a lot of time from configuring all these paths and resourses

13 Dec

Ubuntu booted into emergency mode

I booted my system this morning and found it was forced into an emergency mode like this:

img_20161214_082619

I found an answer on askubuntu.com which talked about unmounting some device. This remind me of what I did last night. I configured my /etc/fstab file last night to add windows partitions’ infomations there, as well as a Seagate portable disk. But now I am in my office without that Seagate disk. Could it be the missing device that caused the booting problem?

So I booted into a live USB to comment out the Seagate device information in fstab file and reboot the computer again. Now I can boot into my system without any problem!