Thursday, April 23, 2009

my kvm-12 reading git

git clone git@github.com:yulin724/my_kvm_reading.git

Configure git to ignore some files globally

1. Create a file ~/.gitignore
Add the following lines into it:
kvm-12/kvm-12.vpj
kvm-12/kvm-12.vpw
kvm-12/kvm-12.vpwhistu
kvm-12/kvm-12.vtg

2. git config --global core.excludesfile ~/.gitignore

Saturday, April 11, 2009

about library symbolic link

兼容性不仅是为了关联

这意味着您最终要链接的程序库最好与调用它的代码相兼容。使用静态链接的可执行文件,可以在某种程度上 保证不会发生任何改变。如果使用动态链接,就得不到这样的保证。

当出现新版本的程序库时会怎样?特别是新版本改变了某个给定函数的调用次序时,又会怎样?

版本号可以解决这个问题 —— 共享的程序库将拥有一个版本号。当一个程序链接到某个程序库时,程序中 会存储一个它计划支持的版本号。如果更改程序库,那么版本号就会不匹配,程序也就不会被链接到较 新版本的程序库。

不过,动态链接的可能优势之一在于修正缺陷。如果可以修正程序库中的缺陷,而且不必重新编译上千个程序,就 可以利用这一修正功能,这将是非常令人愉快的。有时,需要链接到某个较新的版本。

不幸的是,这会导致在某些情况下,您希望链接到较新的版本,而在另外一些情况下,您宁愿坚持使用较老的版本。 不过,有一个解决方案 —— 使用两类版本号:

  • 主版本号表明程序库版本之间的潜在不兼容性。
  • 次要版本号表明只是修正了缺陷。

这样,在大部分情形下,加载具有相同主版本号和更高次要版本号的程序库是安全的;而加载主版本号更高的程序是不安全的行为。

为了让用户(和程序员)不必追踪程序库版本号和更新,系统提供了大量的符号链接。 通常,其模式是:

libexample.so

将是一个指向

libexample.so.N

的链接,其中 N 是在系统中可以找到的最高的 版本号。

对受支持的每一个主版本号而言,

libexample.so.N

将是一个指向

libexample.so.N.M

的链接,其中 M 是最高的 次要 版本号。

这样,如果为链接器指定了 -lexample,那么它会去寻找 libexample.so,这是一个符号链接,指向某个指向最新版本的符号链接。 另一方面,当加载某个现有程序时,它将尝试去加载 libexample.so.N, 其中 N 是它先前链接的版本。各得其所!

Wednesday, February 18, 2009

python xml parser

ElementTree
http://effbot.org/zone/element.htm
http://infohost.nmt.edu/tcc/help/pubs/pylxml/class-ElementTree.html#ElementTree-find

ElementTree Tutorial PPT
http://www.amk.ca/talks/2006-02-07/

用ElementTree 解析和生成 XML - Lynn的读书笔记 - CSDNBlog
http://blog.csdn.net/likelynn/archive/2007/09/28/1804651.aspx

XML Parser Minidom
http://oreilly.com/catalog/pythonxml/chapter/ch01.html

Sunday, February 15, 2009

python gtk glade

A good blog:
http://www.learningpython.com/

python + glade tutorial
http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/
http://www.learningpython.com/2006/05/30/building-an-application-with-pygtk-and-glade/

Sunday, February 08, 2009

simple sqlite3 python-binding tutorial links

SQLite Tutorial
http://freshmeat.net/articles/view/1428/

python and sqllite : simplest example

A brief Python / SQLite example




my screenrc

Screenshot:
My screen rc file.
#caption always "%?%F%{-b 4w}%:%{-b bb}%? %H | %l | %m-%d %c |%?%F%{-b 4w}%?%L=%-Lw%45>%{-b w4}%n%f* %t%{-}%+Lw%-0<"
#caption always "%m-%d %c |%?%F%{-b 4w}%?%L=%-Lw%45>%{-b w4}%n%f* %t%{-}%+Lw%-0<"
vbell off
termcapinfo xterm ti@:te@

autodetach on # Autodetach session on hangup instead of terminating screen completely

startup_message off # Turn off the splash screen

defscrollback 99999 # Use a 30000-line scrollback buffer

zombie kr

#caption always "%{= KG} %Y-%m-%d %c |%?%F%{-b 4w}%?%L=%-Lw%45>%{-b w4}%n%f* %t%{-}%+Lw%-0<"
#caption always "%{= KG} %H |%?%F%{-b 4w}%?%L=%-Lw%45>%{-b w4}%n%f* %t%{-}%+Lw%-0<"

caption always "%{rw}%n%f %t %{wk} | %?%-Lw%?%{wb}[%n*%f %t]%?(%u)%?%{wk}%?%+Lw%? %{wk}"

hardstatus alwayslastline "%{+b kr}host: %{kw}%H %{kg} | %c | %{ky}%d.%m.%Y | %{kr}(load: %l)%-0=%{kw}"

#caption always "%{= wk} %{= KY} [%n]%t %{-} %= %{= KR} %l %{-} | %{= KG} %Y-%m-%d %{-} "
#hardstatus alwayslastline " %-Lw%{= Bw}%n%f %t%{-}%+Lw %=| %0c:%s"
#
activity              "activity in %n (%t) [%w:%s]~"

# ------------------------------------------------------------------------------
# SCREEN KEYBINDINGS
# ------------------------------------------------------------------------------

# Remove some stupid / dangerous key bindings
#bind ^k
#bind L
#bind ^\
# Make them better
#bind \\ quit
#bind K kill
#bind I login on
#bind O login off
#bind } history

# An example of a "screen scraper" which will launch urlview on the current
# screen window
#
#bind ^B eval "hardcopy_append off" "hardcopy -h $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview"

# k1 is f1; ie f1 jumps to window 1
#bindkey -k k4  quit
bindkey -k k5  next
bindkey -k k4  prev
bindkey -k k6  select 4
bindkey -k k7  select 5
bindkey -k k8  quit

# Using tab to move around regions gets annoying.  These help.
bind ^j focus down
bind ^k focus up
bind ^h focus top
bind ^l focus bottom

#Remove Ctrl+k, Ctrl+a k, then bind ctrl+a,shift+k to 'kill' command 
#Remove Ctrl+s, Ctrl+a s, Ctrl+a S bind
bind ^k
bind k
bind K kill
bind ^s
bind s
bind S

# ------------------------------------------------------------------------------
# caption description:
# ------------------------------------------------------------------------------
#
# caption always "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H%?%F%{+u wb}%? %L=%-Lw%45>%{+b by}%n%f* %t%{-}%+Lw%-0<"
# Anything I don't describe is treated literally.
# %?          - Start of a conditional statement.
#  %F         - Use this part of the statement if the window has focus (i.e. it
#               is the only window or the currently active one).
#  %{-b bc}   - Turn off bold, blue foreground, cyan background.
# %:          - else
#  %{-b bb}   - Turn off bold, blue foreground, blue background (this obscures
#               the text on non-focused windows and just gives a blue line).
# %?          - End conditional statement.
#  %C         - time (hh:mm, leading space) in 12 hour format
#  %D         - Three-letter day-of-week appreviation
#  %M         - Three-letter month appreviation
#  %d         - Day of the month
#  %H         - hostname
#  %?         - Start of conditional statement.
#   %F        - Use this part of the statement if the window has focus.
#   %{+u wb}  - underlined, white foreground, blue background
#  %?         - End conditional (if not focused, text remaind blue on blue).
#    %L=      - truncation/padding point.  With the 'L' qualifier, basically
#               just acts as a reference point.  Further truncation/padding is
#               done relative to here, not the beginning of the string
#    %-Lw     - window list up to but not including the current window (-),
#               show window flags (L)
#    %45>     - truncation/padding marker; place this point about 45% of the
#               way into the display area (45)
#    %{+b by} - add bold (still underlined from before), blue foreground,
#               yellow background
#      %n     - number of the current window
#      %f     - flags for current window
#      %t     - title of current window
#    %{-}     - undo last color change (so now we're back to underlined white
#               on blue)  (technically, this is a pop; a second invocation
#               would drop things back to unadorned blue on cyan)
#    %+Lw     - window list from the next window on (-), show window flags (L)
#    %-0<     - truncation/padding point.  Place this point zero spaces (0)
#               from the right margin (-).