Oct 24, 2010

zenity 的 python wrap : PyZenity

Zenity 的相關範例可以參考 A COMPLETE ZENITY DIALOG EXAMPLES 2
PyZenity 其實一個 wrap 而已,執行時是 call popen(zenity),而使用起來跟 zenity 差不多。

Oct 4, 2010

Install Ubuntu 9.10 Karmic on Kohjinsha SX3 UMPC

去年夏天,天真的想說,買台 UMPC 來當電子書使用,到後來,還是賣掉了,最主要是因為,1.2公斤還是太重,以下是當時的筆記,剛整理時發現的,或許,有人會需要它 :).

1. Poulsbo (GMA500) Support in Karmic (9.10)1)
1)PPA-based (UbuntuMobile & Milone):
wget http://gma500re.altervista.org/scripts/poulsbo_ppa.sh && sh ./poulsbo_ppa.sh
or
2) FTP-based (no ppa repositories):
wget http://gma500re.altervista.org/scripts/poulsbo.sh && sh ./poulsbo.sh
2.  IM
http://vicamo.blogspot.com/2009/07/boshiamy-for-ibus.html
3.  pen screen
工人舍SH8安裝Ubuntu 9.04 netbook remix初步心得 
penmount Driver Download

call graph

前幾天在 chihchun's Channel 看到 $4 之前於 H4 分享的 Debug 技巧,讓我想起,很久以前 Jserv 也於它的 blog 分享 GCC 函式追蹤功能 主要是利用 "finstrument-functions" 的功能,當進出 function 時,執行以下二個函式
void __cyg_profile_func_enter (void *this_fn, void *call_site);
void __cyg_profile_func_exit  (void *this_fn, void *call_site);


先來個 example 試試看:
#include 

void __attribute__((__no_instrument_function__))
__cyg_profile_func_enter(void *this_func, void *call_site)
{
printf("Enter &%s:%p, called by %p \n", __FUNCTION__, this_func, call_site);
}

void __attribute__((__no_instrument_function__))
__cyg_profile_func_exit(void *this_func, void *call_site)
{
printf("Enter &%s:%p, called by %p \n", __FUNCTION__, this_func, call_site);
}

void a(void);
void b(void);

void b()
{
}

void a()
{
b();
}

int main(int argc, const char *argv[])
{
a();
return 0;
}



利用 j 的 Dot 語法,可以簡單的畫出 directed graph 語言感覺很像以前讀研究所時,寫 network simulation的腳本
digraph G {
node1;
node2;
node3;

node1 -> node2 [label="edge_1_2"];
node1 -> node3 [label="edge_1_3"];
node2 -> node3 [label="edge_2_3"];
}

Conver to JPG:
dot -Tjpg graph.dot -o graph.jpg
產生出來的圖



reference:
http://tarot.freeshell.org/leafpad/
http://blog.linux.org.tw/~jserv/archives/001870.html
http://www.ibm.com/developerworks/cn/linux/l-graphvis/
http://blog.linux.org.tw/~jserv/archives/001723.html

booting iso from grub2

1. Format a partition on the USB stick to some filesystem that's supported by GRUB 2 in the way you prefer to do that.
sudo mkfs.vfat /dev/sdd1

2. mount partition on the temp directory
sudo mkdir /media/flash_disk
sudo mount /dev/sdd1 /media/flash_disk/

3. Install GRUB 2 onto the USB stick.
sudo grub-install --no-floppy --root-directory=/media/flash_disk/ /dev/sdd

4. Edit /media/flash_disk/boot/grub/grub.cfg to point to the ISO files.
set timeout=10
set default=0

menuentry "Run Ubuntu Live 10.04" {
 loopback loop /ubuntu-10.04-desktop-i386.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-10.04-desktop-i386.iso splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "Ubuntu 10.4 Server i386" {
loopback loop /ubuntu-10.04-server-i386.iso
linux (loop)/install/vmlinuz --
initrd (loop)/install/initrd.gz
}

5. copy linux cdrom iso to /media/flash_disk
cp ubuntu-10.04-desktop-i386 /media/flash_disk/

6. booting by qemu
sudo /opt/bin/qemu -hda /dev/sdd -boot c -m 256 -localtime