a = 0
b = 1
all:
ifeq ($(time),10)
exit
else
@echo $a $b
@make time=$$((time + 1 )) c=$(a) a=$(b) b=$$(($(a)+$(b)))
endif
這是在看 GNU makefile 的 manual 裡的conditional statement 部份就順手寫的,還可以再精巧嗎? try try try
2011年4月26日 星期二
2011年4月11日 星期一
Java Auto Complete in vim
為了得到Java快速開發的好處,往往會借重eclipse的自動完成的功能,但是eclipse的冗長開啟時間是很讓人抓狂的,所以就找了一下這個工具,來讓vim 也有java 自動完成的功能。
http://www.vim.org/scripts/script.php?script_id=1785
安裝的方式很簡單,就是 unzip thezipfile -d ~/.vim 就結束了。
裝完後不免俗的要在 .vimrc 上 加上Java 相關的 auto command.
之後就是 ctrl-x ctrl+u 的 omni completion 了。
希望不要像clang completion 一般,有大檔案過慢的問題。
http://www.vim.org/scripts/script.php?script_id=1785
安裝的方式很簡單,就是 unzip thezipfile -d ~/.vim 就結束了。
裝完後不免俗的要在 .vimrc 上 加上Java 相關的 auto command.
" Java auto complete
" url -- http://www.vim.org/scripts/script.php?script_id=1785
if has("autocmd")
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
endif
" end of Java auto complete
之後就是 ctrl-x ctrl+u 的 omni completion 了。
希望不要像clang completion 一般,有大檔案過慢的問題。
2010年3月4日 星期四
Building qemu-kvm
KVM is integrated into linux kernel, It may help virtualizaion of QEMU( QEMU is emulation only ).
the first step is install the kernel module and get the qemu-kvm source code( a modified qemu )
if lack of libpic , install the pciutil
then make to get the qemu
the first step is install the kernel module and get the qemu-kvm source code( a modified qemu )
1. modprobe kvm
2. modprobe kvm-intel
3. step into the source code of qemu-kvm, ./configure --target-list=i386-softmmu
if lack of libpic , install the pciutil
then make to get the qemu
2010年2月12日 星期五
2010年2月4日 星期四
2010年2月3日 星期三
Today I see two python pitfalls
The first one is in the com.lang.python google group article:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/fe6430e7980e2a96?hl=en#
if brief . the python import statement may search module in current path first, and files in the same module has very weak relation such as the followiing example that email.py was used in two place and python finds the wrong one
bash$ touch email.py
bash$ python
...
>>> import smtplib
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.5/smtplib.py", line 46, in
import email.Utils
ImportError: No module named Utils
the second is about generator expression, the variable in the clause is not evaluated or stored immediately and may lead a lot of error. To avoid this, list comprehension or closure are the solutions.
http://yz.mit.edu/wp/2010/01/14/bitten-by-python-scoping/
As I use python much, I always can find something strange as I use it :<
http://groups.google.com/group/comp.lang.python/browse_thread/thread/fe6430e7980e2a96?hl=en#
if brief . the python import statement may search module in current path first, and files in the same module has very weak relation such as the followiing example that email.py was used in two place and python finds the wrong one
bash$ touch email.py
bash$ python
...
>>> import smtplib
Traceback (most recent call last):
File "
File "/usr/lib/python2.5/smtplib.py", line 46, in
import email.Utils
ImportError: No module named Utils
the second is about generator expression, the variable in the clause is not evaluated or stored immediately and may lead a lot of error. To avoid this, list comprehension or closure are the solutions.
http://yz.mit.edu/wp/2010/01/14/bitten-by-python-scoping/
As I use python much, I always can find something strange as I use it :<
2010年2月2日 星期二
Use hdaps in X200S in opensuse11.2
Follow the following links , The idea is clear
http://www.thinkwiki.org/wiki/Tp_smapi#Installation_on_openSUSE
http://forums.opensuse.org/hardware/laptop/417254-tp_smapi-lenovo-thinkpad-t400-t500-w500-step-step.html#post2005932
The main idea is search the build package in opensuse website , just search tp_smapi and hdapsd. with them , we can perform these commands to turn hard disk protection.
modprobe tp_smapi
modprobe hdaps
/etc/init.d/hdaps restart
check by
smartctl -a /dev/sda | grep Load_Cycle
http://www.thinkwiki.org/wiki/Tp_smapi#Installation_on_openSUSE
http://forums.opensuse.org/hardware/laptop/417254-tp_smapi-lenovo-thinkpad-t400-t500-w500-step-step.html#post2005932
The main idea is search the build package in opensuse website , just search tp_smapi and hdapsd. with them , we can perform these commands to turn hard disk protection.
modprobe tp_smapi
modprobe hdaps
/etc/init.d/hdaps restart
check by
smartctl -a /dev/sda | grep Load_Cycle
訂閱:
文章 (Atom)