Thursday, January 24, 2008

[Note] What every programmer should know about memory, Part 1

從lwn看來的, 先記下來, 再慢慢研究!!
here

Tuesday, September 25, 2007

[Invest] US Stock

I've just finished the first transaction in US stock market.
CTDC 200 shares
Buy 5.75 (9/12)
Sell 7.30 (9/25)
Gain $296, 25.58%

It's still a long way to get used to US stock market. Always see chances pass by but don't catch it. Cheers!!

Tuesday, August 14, 2007

[misc] My GC Progress Tracker

8/14/2007: Card received. No more H/B US Visa needed.
8/8/2007: I-485 approved.
2/6/2007: I-140 approved via premium processing.
1/26/2007: My birthday. I-140 & I-485 filed concurrently.
12/8/2006: My lawyer received LC approval mail.
12/6/2006: PERM filed.
12/5/2006: Finalized PERM filing.
11/30/2006: Draft PERM filing (ETA Form 9089).
8/1/2006: Started posting ADs.
7/20/2006: Signed contract to start GC process.
3/27/2006: Consulted GC process with lawyer (Domino Wang).

Friday, June 15, 2007

[Link] 今日連結 (6-15-2007)

When small is career beautiful
-- 一個值得深入研究的topic, 簡言之, 公司size是個key, 但組成的人員才是關鍵中的關鍵.
-- Mr. 6 提供的感想.

Thursday, June 14, 2007

[Link] 今日連結 (6-14-2007)

避免cross-compile的陷阱:
Avoiding libtool minefields when cross-compiling

Format My Source Code for Blogging
-- A javascript web application application that will format source code text into html for inserting into your blog.
-- 插入source code 就全靠它了!

[Linux] 945GM + ATI 9250 PCI card = upto 4 displays

這兩天又有客戶想要我們Linux support, what a free rider!
言歸正傳, 今次的主題是945GM(CRT, LVDS) + AIT 9250 PCI(CRT, DVI), 在xorg 下要輸出Quad Displays (謎之音, 為何不用4, 要用quad!? 客倌不覺得這樣比較炫嗎?)

首先, 要先檢查是不是所有的vga 都有認到, 抄傢伙 "lspci"
frodo@frodo-desktop:~$ lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1e.2 Multimedia audio controller: Intel Corporation 82801G (ICH7 Family) AC'97 Audio Controller (rev 02)
00:1f.0 ISA bridge: Intel Corporation 82801GHM (ICH7-M DH) LPC Interface Bridge (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) Serial ATA Storage Controller IDE (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
01:06.0 VGA compatible controller: ATI Technologies Inc RV280 [Radeon 9200 PRO] (rev 01)
01:06.1 Display controller: ATI Technologies Inc RV280 [Radeon 9200 PRO] (Secondary) (rev 01)
01:08.0 Ethernet controller: Intel Corporation 82801G (ICH7 Family) LAN Controller (rev 01)



報告, 在"00:02.0" "01:06.0" 發現有不明vga 出没, 所以就順手記下這些位置.

正式動工了! 拿xorg.conf 來開刀吧!
首先是945GM 部分:
Section "Device"
Identifier "945GM"
Driver "i810"
BusID "PCI:0:2:0"
Option "MonitorLayout" "CRT,LFP"
Screen 0
EndSection

Section "Device"
Identifier "945GM-1"
Driver "i810"
BusID "PCI:0:2:0"
Screen 1
EndSection



再來處理ATI:
Section "Device"
Identifier "ati"
Driver "radeon"
BusID "PCI:1:6:0"
Option "CRT,TMDS"
Screen 2
EndSection

Section "Device"
Identifier "ati-1"
Driver "radeon"
BusID "PCI:1:6:0"
Option "CRT,TMDS"
Screen 3
EndSection



設定Monitor type
Section "Monitor"
Identifier "Acer AL1711"
Option "DPMS"
EndSection

Section "Monitor"
Identifier "Acer AL1711-1"
Option "DPMS"
EndSection
Section "Monitor"
Identifier "Acer AL1711-2"
Option "DPMS"
EndSection

Section "Monitor"
Identifier "Acer AL1711-3"
Option "DPMS"
EndSection



設定Screen,
Section "Screen"
Identifier "Screen0"
Device "945GM"
Monitor "Acer AL1711"
DefaultDepth 24
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "945GM-1"
Monitor "Acer AL1711-1"
DefaultDepth 24
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen2"
Device "ati"
Monitor "Acer AL1711-2"
DefaultDepth 24
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen3"
Device "ati-1"
Monitor "Acer AL1711-3"
DefaultDepth 24
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "832x624" "800x600" "720x400" "640x480"
EndSubSection
EndSection



最後是ServerLayout,
Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
Screen 2 "Screen1" RightOf "Screen1"
Screen 3 "Screen1" RightOf "Screen2"
Option "Xinerama" "on"
Option "Clone" "off"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "stylus" "SendCoreEvents"
InputDevice "cursor" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
EndSection


這樣就大功告成了, 只是我現在手邊只有兩個monitor, 下次再拿兩個來指揮艇組合.

Thursday, June 07, 2007

如何整盜用wifi 的鄰居

這實在太黯然太銷魂了, 使用iptables+perl script 來惡搞content,
筆記ing, 剛好手邊有一台Linux+AP, 學起來下次試試.
Upside-Down-Ternet

Thursday, May 17, 2007

[Linux] Suspend/Resume over LAN & USB

前幾天有個客戶需要Suspend to RAM (S3) 和 Resume over LAN & USB 的功能, 就小玩 了一下!
Platform: 945G + Celeron D 352, 2GB RAM, GigaLAN
OS: Fedora Core 4 (2.6.11-1) & 2.6.21.1

Step1. BIOS:
-- 在BIOS 中要把wakeup 的device 都打開, 這個LAN 是PCIE的, 所以也要特別設一下.
-- 將Suspend Mode 設為 [S3] Suspend to RAM

Step2. Linux:
-- /proc/acpi/wakeup 中, 把USB 和 PCIE 都設為wakeup trigger sources

Step3. 準備來睡 (枕頭咧?)
-- 我將 suspend 和 resume 的過程寫成一個script
#!/bin/bash
touch /suspending
#unload USB drivers
rmmod ehci-hcd
rmmod uhci-hcd

#store clock
/sbin/hwclock --adjust

#save video state
vbetool vbestate save > video-state

#Put system into sleep
echo 3 > /proc/acpi/sleep

#Prepare wakeup, resuming
#restore video state
vbetool vbestate restore



Wake on LAN
Wake onUSB

因為FC4 的kernel 無法由USB wakeup, 所以直上最新release (2.6.21.1)的kernel.