2009-11-19 聚會手記

上一週 || 下一週

本周人數:18

honkia:

覺得 firefox 越來越慢…
Rex: 因為網頁會越積越多,執行就變得越來越慢,可以裝 "PlacesCleaner" 收藏庫清潔工 ( Tsung, clyde 也推薦!! )

Openlab.Taipei 的介紹,
台北數位藝術節,

"唉,我是 x200 耶.."

someone: "資訊展嘛"
Thinker: "x200 耶,怎麼會有鬼影…"

yan:

最近在看 Unix System V/386 和 Linux char device 和 framebuffer 方面
又另外想到我們常用的一些終端機下的軟體(ex: vim、……), 除了擴充模組外, 另一方面就是提供的介面和熟悉的鍵盤控制(終端控制部份)
所以以下分享有一些 terminal 或 curses 還有 sysv 相關的東東

char device / framebuffer / curses

gitkeys 和 showkey 可以看到一些鍵盤掃描碼或是輸入的顯示字元

tput //初始化或查詢終端機的相關設定 ( define by terminfo )
stty -a // can show the the capability value

setterm 、 stty 和 tput 也可以設定終端機 (如反白、打密碼時不在螢幕顯示輸入的字元、…)
setterm -reverse [off]
stty [echo | -echo]
tput -rev

tty : teletype

tty 命令可以顯示目前的終端機種類 (可以在 Console 模式、X 下的 terminal、Console 下用 screen 輸入看看)
tty1 虛擬終端1
ttys1 序列埠終端1 (如 win 的 COM1)
ptyp0 主虛擬終端 Master PTY
ttyp0 從虛擬終端 Slave PTY
ptm - pty master <-> /dev/pts/N

wycc: terminfo 代替了 termcap, 再早一點有 termlib, termios 是比較底層的

General procedure for building a terminal description: // from UNIX system V-386 programmer's guide
1. Give the known names of the terminal.
2. Learn about, list, and define the known capabilities.
3. Compile the newly-created description.
4. Tet the entry for correst operation.
5. Go back to step 2, add more capabilities, and repeat, as necessary.

tic -v myterm.ti // translate the terminfo data base into the compiled formate
infocmp -I linux // print out terminfo description, (linux : terminal name, /lib/terminfo/l/linux)
infocmp -C linux // print out termcap description

captoinfo // convert a termcap desccription into a terminfo description

curse 會讀取 terminfo 的資料
strace -o tracefile xxx.php
看看 trace 檔可以看到, 有時我們在 curses 下需要獲得或控制終端機, 就會用到 terminfo

#!/usr/bin/php -q                                                                     
<?
        $ncurses = ncurses_init();

        $mainscreen = ncurses_newwin(0, 0, 0, 0); 

        ncurses_getmaxyx(&$mainscreen, $lines, $columns);

        for($i = 0; $i < $lines; $i++)
        {
                if(($i%10)+1 == 10) 
                {
                        ncurses_attron(NCURSES_A_REVERSE);
                        ncurses_mvaddstr($i, 0, ($i%10)+1);
                        ncurses_attroff(NCURSES_A_REVERSE);
                }
                else
                {
                        ncurses_mvaddstr($i, 0, ($i+1)%10);
                }
                ncurses_refresh();
        }

        for($i = 0; $i < $columns; $i++)
        {
                if(($i%10)+1 == 10)
                {
                        ncurses_attron(NCURSES_A_REVERSE);
                        ncurses_mvaddstr(0, $i, ($i+1)%10);
                        ncurses_attroff(NCURSES_A_REVERSE);
                }
                else
                {
                        ncurses_mvaddstr(0, $i, ($i+1)%10);
                }
                ncurses_refresh();
        }

        ncurses_getch();

        ncurses_end();
?>

curses 的運作與操作以後再補充 :)

IPC (message、semaphore、shared memory)

ipcs 可以用來看 ipc 的狀態, 提供 ipc 的 information

ftok 函式可以把 path 跟 project identifier 轉成 sysv 的 ipc key

semaphore

ipcs -s
ipcs -s -i semid

範例下次重新 demo

wycc:

terminfo 代替了 termcap, 再早一點有 termlib, termios 是比較底層的

Mat:

dbus c++ 是我目前用過最好用的 IPC library
dbus 開始學習時,會對專有名稱不好掌握。
可以先裝 d-feet 跟 python dbus 來試玩玩看,這樣可以協務嘗握 dbus 的行為跟設計方向
http://www.blogjava.net/zarra/archive/2008/07/11/214161.html

pct:

來分享一下 zsync, 就是比對遠方 server 檔案跟你的檔案有不同時,可以來 sync,
請參照影片,從遠端更新 ubuntu 9.10 iso

http://www.linuxjournal.com/video/updating-isos-zsync

除非特別註明,本頁內容採用以下授權方式: Creative Commons Attribution-ShareAlike 3.0 License