星期五, 7月 30, 2004

Office ADSL down..

不知道是什麼問題,突然就不通了(沒繳費?)。

首先猜是Netcard的問題(雖然我最近都猜錯)。

換下原server的netcard(駐寄ADS license card)。
啟動無效。linux一直採用舊IP設定。

也無法連到ADSL。(燈有閃)。

猜測是module driver的關係。

目前shutdown中。

a economic joke - eat shit to increase GDP

兩個聰明的經濟學天才青年,經常為了一些高深的經濟學理論爭辯不休。

一天飯後一起去散步,為了某個數學驗證的證明兩位傑出青年又爭執了起來,正在難分高下的時候,突然發現前面的草地上有一堆狗屎。

甲就對乙說:「如果你能把它吃下去,我願意出五千萬。」
五千萬的誘惑可真不小,吃還是不吃呢?

乙掏出紙筆,進行了精確的數學計算,很快得出了經濟學上的最佳報酬率解:『吃!』
於是甲損失了五千萬,當然,乙的這頓加菜餐吃的也並不輕鬆。

兩個人繼續散步,突然又發現另一堆狗屎,這時候乙開始劇烈的反胃,而甲也有點心疼剛才花掉的五千萬了。

於是乙對甲說:「你把它吃下去,我也給你五千萬。」於是,不同的計算方法,相同的計算結果--『吃!』

甲心滿意足的收回了五千萬,而乙似乎也找到了一點心理平衡。

可是突然間,天才們同時嚎啕大哭:鬧了半天我們什麼也沒有得到,卻白白的吃了兩堆狗屎!
他們怎麼也想不通,只好去請教他們的教授:一位著名的經濟學泰斗給他們解釋原因。
教授聽了兩位高足的故事,沒想到泰斗也嚎啕大哭起來。

好不容易等情緒穩定了一點,只見經濟學泰斗顫巍巍的舉起一根手指頭,無比激動地說:
「一億啊!~一億啊!~我親愛的同學,我代表國家感謝你們,你們僅僅吃了兩堆狗 屎,就為國家的GDP(國內生產毛額)貢獻了一億的產值!

(政府公佈的GDP背後通常有這種陷阱,因為光是買空賣空雖然增加數字但並無法增進百姓的真正福祉)
--------------------------------------------------
--from larry

星期四, 7月 29, 2004

NB COM Port

from App

-------------------------------------------------------------
東森的NOTEBOOK廣告:

「我們這台Notebook,可是有COM PORT跟Paraelle Port的唷」
「這個COM PORT可以連接到一些機械手臂、控制系統之類的」
「所以說這是商用機種才會有的高檔配備,現在的Notebook都沒有配備唷」

(略)
-------------------------------------------------------------

東森購物真是不錯,

Marketing : unreal request - over request

from "數位雜誌”
-------------------------------------
但過去一年TFT-LCD零組件缺貨的影響,導致產業鏈上存在多少假性需求,目前仍屬未知數。

舉例而言,因為缺料的心理預期,面板業下游可能向中游訂購120%,中游再向上訂 購120%,如此計算,上游所預期的需求量形同達到144%,一旦下游需求減少10%,下游需求與上游供給的差距,就不是僅有10%,而是50%;屆時零 組件供給過剩的問題將十分嚴重,但實際狀況如何,還要等第3季才能見真章。
------------------------------------



Boda event - about maketing.

from 數位時代雜誌
-------------------------------------------------------------


因為手機產業一片大好,相關零組件廠商跟著雞犬升天
,博達切入的砷化鎵領域,當時預期可望在手機零組件產業中,搶下重要的一席之地。可惜事與願違,
  1. 首先是手機產業景氣在2000年大幅逆轉,
  2. 而砷化鎵所應用的領域,如高頻通訊元件,因為用途太過侷限,在其他資訊產業需求緩步回升後,無法提供其他用途,
  3. 而砷化鎵產業卻因前波對景氣預期過度樂觀而大幅擴產,因此處於嚴重的供過於求,
但博達不願正視此一問題,就已經浮現初步的警訊。

-------------------------------------------------------------

第二點有點問題,高頻通訊原件還可以用在GPS,Wifi (BT?) 領域。應該不算”侷限”。
第三點是很普遍的,所有的Marketing人員作的forcast都是朝著Market成長的方向預測。依照forcast擴廠是應該的。

所以重點是在:
為什麼原本認為”一片大好”的手機產業,會在2000時逆轉?
有任何產業分析師在2000年前作出這樣的預測嗎?
反過來想
那麼當初認為會”一片大好”的理由是?有錯嗎?

.......

有任何Marketing的人作過這樣的研究?

再來
-------------------------------------------------------

再從財報問題來看,當砷化鎵產業陷入低迷,博達的營收卻能在籌資的「關鍵時刻」逆勢走揚,惟其他財務指標卻轉差,已經引起市場發出「貨出到哪裡去?」的質疑。

-------------------------------------------------------

誰知道當時砷化鉀產業陷入低迷?有任何指標或是判斷的方法?
舉個例子來說:
如何判斷目前”腳踏車產業”是處於”榮景”還是”低迷”?





Linux - maganize - Linux Focus

挺不錯的,免費線上閱讀,難度比LJ低一些。
進入後按English

NMAP - port scan

發現nmap滿好用的。

# nmap ip [or hostname]

就可以了。

download的位置在http://www.insecure.org/nmap/nmap_download.html

complain - meeting

要求開會時一定要準時到,不要在開會前還要一個一個的叫人。
要求之前應該要想想會造成這個結果的原因:
  1. 沒人理會這個會議。
  2. 忘記
  3. 故意躲避
  4. 因為'常常依照規定到會議室,可是卻發現會議取消貨延期,沒有通知。
第一項和第三項的可能性不大,如果是真的。光是要求也無法避免。
第二項用”會議提醒”功能可以避免。而目前大概大家都用這個功能了。
第四項,這就是常常遇到的情形,今天又遇到,通知10:10 NSC會議,
結果我到會議室卻是其他的會議。

其實這樣的情形已經遇到很多次了,所以才會忽略通知,反正如果真要開會,
開會後會有人來叫。

這就是真正的原因了。 ----至少是我的原因。

Receive PChome recipt - Camera

已經收到廠商(永準)的電話說沒貨,要我去退訂。
我當然不退,沒貨應該pchome要主動取消訂單。
過了1 week,還是沒取消。
昨天email去問還要等多久?
今天就收到發票了。
只不過廠商變成”亨翰”。

pchome上寫是7/26寄的。
那....是代表有貨?
可是pchome上又沒寫”送貨中”。
所以 ?

C700 CF Wifi no work - solved!

一直都是在網路初始化後-離線。
反覆測試都無法連線。
即使拿到AP旁邊都一樣。

後來將C700Reset厚OK。

Cable restart failed - ipshare's problem

重新開機Cable Modem和AP(IPShare)都沒用。
將Cable Modem接到pc上,pc ok。
接到AP上,AP取得到ip,但是ping不到外界,好像是route & gateway的問題。

最後
將AP作”回到出廠設定”,OK。
之後重新設定ESS-ID,WEP KEY (0+My Line2)。

OK。

應該是AP-Ipshare太爛了(baffolo,白白橢圓的那款)。

奇怪這款AP動作時,電視都會被干擾。
是所有AP都會這樣嗎?

星期三, 7月 28, 2004

News : Panasoinc becomes No.1

在一些低成本競爭對手蓄勢待發之際,中村明白松下若要繼續居於領先,需保持創新突破,因此所有新產品都須通過他所主持的一個四人委員會這關,中村強調:「若你的產品品質不能超越對手,就會陷入價格戰。」

---- from udn news

星期二, 7月 27, 2004

Watchdog : Stupid! forget the code is comment out!

因為James發現rail index的問題,所以修該bug在2.7_1,為了測試。
所以將未測試完的watchdog功能取消(comment掉)。

在作2.7_2 watchdog測試時,一直發生watchdog overflow的情況,
我到處加reset watchdog的動作(#define),還是一樣。

最後

找到原來是reset watchdog的動作的define被comment掉,當初沒把這部分的
code加回。

:( 浪費了一天...

星期一, 7月 26, 2004

what version you are ? xp - from china's site

你的Winxp是不是原版:
  在i386文件夹里有一个eula.txt,最后有一行EULAID,就是你的版本
  OEM:WX.2_PRO_OEM_TW(or.WX.2_PRE_OEM_TW)
  EVAL:WX.2_PRO_RVL_TW(or.WX.2_PRE_RAL_TW)
  RTL.:WX.4_PRO_RTL_TW
  中文正式版的版本是
  EULAID:WX.4_PRO_RTL_CN

  1.如果是WX.开头是正式版,WB.开头是测试版。

  2.如果有_PRE,是家庭版,_PRO是专业版。

  3._OEM,_RVL都是需要启动版,_RTL有免启动金钥,就可免启动。

  4.光碟标签并无意义,是制作光盘的人自己加加进去的。

  5.OEM.版的说明,中文版应是一半中文一半英文,如果全是英文,那就是来自英文的Corporate版(破解)

  6.EVAL(RVL)版的说明全是中文。

  忘记的补充
  1、winxp原版的文件都是2001-9-5 12:00,如果有一个不是,那么!特别是i386\eula.txt这个文件。
  2、CD.Label是WXPFPP_EN(英文),WXPFPP.cn(中文)
  3、还有其它一堆.OEM免激活、免激活正式版等等的,这些都是.利用.OEM、2600Fre.这些版本+Corpfiles.破解,再烧成可开机光盘的,看它们的CD.Label更是五花八门。
   4、目前看到免激活版都是某中文版+英文Corpfiles.做成免激活「Home.Made」企业版(或称大量授权版本),看安装序号便知: FCKGW-RHQQ2-YXRKT-8TG6W-2B7Q8。所以如果你有OEM+Corpfiles.版或是RVL@TW版的话,那就不用急着下载其 它版本,看看就好。

  (我认为)不管你用RVL@TW.or.OEM+Corpfiles.or.阿猫阿狗免激活可光盘开机版,用 起来都一样好用,前提是作者的功力不是太差,没有乱破解一通。除非你是完美主义者,不然我不认为用起来会和正式版有什么差别。当然,先不论微软会不会耍花 招来对付这些海盗的可能性。

WinXP简体中文零售版原版ISO镜像特征
  1、WinXP原版镜像文件大小505M。
  2、用WinISO、IsoBuster打开原版镜像,
  显示光盘容量524M,文件创建日期显示为2001-09-05 12:00。
  3、用WinRAR 3.0 打开原版镜像,文件创建日期显示为2001-09-05 20:00。
  4、用WinISO修改过的ISO镜像文件大小为524M,你再怎么弄也整不回505M,
  有时文件创建日期显示为2001-09-05 20:00。
  5、
  总目录数:120
  总文件数:6562
  总容量:549625236
  这三个数对上,100%是正版

Today's workrecord

8:00-11:00 AlarmList.xls , CxU/Web/RMS告警顯示列表

星期日, 7月 25, 2004

skype - register ok

checko 已經有人用了,只好用checko0

星期六, 7月 24, 2004

Hospital again.

又住院了,一樣的病因。
我們其實還好,最難過的還是病人自己。
世界上總是沒有十全十美的。
拿起起個東西放在懷裡,勢必就要丟掉一個東西。
選擇在自己。

星期五, 7月 23, 2004

cable ok! AP ok! wireless ok!

昨天10:00才來裝,裝到11:30,最後call了 一通電話,把我們的信號加強才順利的拿到IP。

星期四, 7月 22, 2004

ASUS anti-linux part -II

剛剛網站說ASUS已經回覆了。
不過應該沒效,因為國外的news還是沒報導ASUS已經悔改的新聞。


Today's workrecord

8:00-9:00 intelligent cxu, watchdog timer.
9:00-10:30 smart cxu schedule meeting, #12 download problem.
10:30-11:00 阿勝要2.3u-2.6的差異資料,要check 2.3u的hyperterminal board set是use還是present.
11:00 - 12:00 intelligent cxu, watchdog timer.
13:00-15:00 discuss India,Malaysia ACLCxU 殘留告警問題。

TODOs..

1.RMS/Web/CxU message list
2.CxU - watchdog function.
3.AC down, E2PROM reset bug .

Those one is not here .... No today

今天就休息一天,不介紹了。

星期三, 7月 21, 2004

Today's workrecord

Reading Mails - 8:00-8:50
DCPMM - Redraw data-flow chart 8:50-9:20, 10:20-12:00
Alice call - T Mobile frame error problam , Midas call - #24 修改LVDS , 9:20-10:20
check if At91 have Watchdog function 13:00-14:00
DCPMM - 繼續,填入各input file的source program 14:00- 14:30

DCPMM - New job, assigned by Baron

for some reason , redraw the data-flow chart,
because the origional drawing is too massy ?
anyway.
1. 整理,拉直這些線。
..畫完先交bxrxn,再決定下一步驟。

Some Setup about win2000. - to speed up

10) 最佳化檔案系統。在 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem 中,新增 DWORD 值,名稱為「ConfigFileAllocSize」,值為「000001f4(16進制),這樣可最 佳化檔案系統、提高系統性能。

11) 最佳化虛擬記憶體。將初始值設為您實體記憶體的 2.5 倍,虛擬記憶體是以檔案名稱 為 Pagefile.sys 的置換檔案儲存在硬碟上,Pagefile.sys 和 Windows 95/98 的 win386.swp 性質相同,應將該置換檔案儲存於速度最快的硬碟上。另外,在 HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/Session Manager/Memory Management 中設定 ClearPageFileAtShutdown 值為 1,也可提高性 能。如果您的記憶體大於或等於 128MB,還可進行以下兩個最佳化:

(1) 在 HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/Session Manager/Memory Management 中設定 DisablePagingExecutive 值為 1,表示系統正執 行的檔案被強制保留在記憶體中而非移入虛擬記憶體,這樣可提高程式執行的運行速 度。

(2) 在 HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/Session Manager/Memory Management 中設定 LargeSystemCache 值為 1,表示讓 Windows 2000 使用它的系統緩衝快取(如同 Win 9X 中的 Vcache),這會使磁碟輸入╱輸出性 能有巨大提高。

12) 打開 CPU 的 Level 2 Cache。如果你的 CPU 具有 Level 2 Cache,那麼在 Windows 2000 中打開它將有助於增強 CPU 的性能。打開登錄編輯程式,找到 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management,然後將「SecondLevelDataCache」的登錄值根據你的 CPU 設定正確數 值,注意要把右邊改為「十進制」(CPU 的 Cache 大小,電腦開機時會顯示)。


Those one is not here .... Dan


DAN Posted by Hello

星期二, 7月 20, 2004

The way to modify a released document

就是發一張ECN,說明要修改的document。
附上要修改的部分,給老闆們簽過就可以。

Today's workrecord

DCPMM 8:00-9:00
Release Hxs2.6_2 , translate to Eng 9:00-10:00
CMMI, peer review 10:00-12:00
Install Cygwin & Armtools to James and ChihSern's NB 13:00-14:00
Explaining the strcuture to Bxrxn 14:00-16:00
達友說明要 Alarm/Status在 CxU,RMS,Web顯示/不顯示的List。 16:00-16:30

Minota just call - x20 is out of stock !

And she wants me to cancel the order.(by myself).

ok,,, father doesn't like this one anyway.

(酸不陶)

News Asus Anti-Linux

from http://www.mozillaquest.com/Linux04/Asus_Sucks_Story-01.html
想不到ASUS還蠻有個性的,直接了當的說 ASUS不支援Open Source。
其實ASUS也有一些產品使用Linux,像AP 什麼550的,他還真的照規定 將source code放在網站上。
以前的版子在Linux上也沒問題,不知道為什麼這次這麼特殊。

文章寫的蠻有趣的,他還call到台灣ASUS的客服,結果聽了10 min的音樂。

主要是ASUS的版子的網卡沒作VPD (ASUS cost down 的方法 ?),所以linux沒辦法動作。

VPD

1) VPD (vital product data) is information about a device that is stored on a computer's hard disk (or the device itself) that allows the device to be administered at a system or network level. Typical VPD information includes a product model number, a unique serial number, product release level, maintenance level, and other information specific to the device type. Vital product data can also include user-defined information, such as the building and department location of the device. The collection and use of vital product data allows the status of a network or computer system to be understood and service provided more quickly.

2) VPD (Visual Parts Database) is a service from TEC Engineering in which a photographic database is created of a company's products and product parts.

3) VPD is also an abbreviation for "virtual printer device."

大概是用來儲存網卡的製造商資料(ID)。不作這個功能大概可以省掉幾個memory chip吧。
Delux版的board連這個都要省,ASUS的獲利大概已經降低了。

VPD好像是PCI 2.2的規範。

Those one is not here .... Barry.


... forget his name ... Posted by Hello

星期一, 7月 19, 2004

Some Emacs sites..

最近EmacsWiki好像蠻有名的,
emacs wiki org

System temp directory ..

7 -zip使用system temp folder作為解壓縮工作目錄。
所以當7-zip down機時,要自己找到目錄。
否則,HD空間就永遠站住了

C:\Documents and Settings\xxxxx\LocalSettings\Temp\7zOp5F3E\Firmware_1.7.5.6_GPL.tar.gz

Today's workrecord

發行2.6_2 8:00-8:30, 9:00-10:00
rpsoft2000 server down 8:30-9:00
ACDown-Rcv : E2PROM reset (?) modify (?) problem - 這個不知道要搞多久...
11:30 -12:00
DCPMM 10:00-11:30,13:00-15:30,14:30-17:30
AutoTest : 15:30-16:30

Those one is not here .... Derek


derek Posted by Hello

星期日, 7月 18, 2004

lunch in TESCO ....

TESCO的美食街真的是很差,
大概只有三商巧福和Macd可以吃。

今天去吃了”和風?",超難吃。
豆芽2是生的,湯是冷的,連雞丁都不熱。

而且還要等好久。
*櫃檯也沒零錢。

看來”零錢”應該當作是一種指標。

星期六, 7月 17, 2004

Fedora ...

花399買了Fedora code 2,結果 這裡 有電子書下載,
ok,至少有cdrom,結果 沒辦法裝,detect 到hd後就停了!

安裝redhat 9 : 進入圖形安裝畫面,lcd變成一片白。
安裝fedora core 1和 2,run到hd detection complete後就停了。

看來我的nb真的和linux不合。
或是...我該試試Debian ?


我是因為將win2000裝載ntfs,需要新的grub作dualboot,所以才選這些distribuion。

some links

http://www.computerdiy.com.tw/modules/news/

明日世界購物 ...東西沒有比角便宜

網路文學經典製造機

星期五, 7月 16, 2004

oh,,not title - default by Hello


Don't know where this is from .. Posted by Hello

原來用hello send picture是不會加入blog title,要自己再edit才行。

(這個title就是後來加的)

Today's workrecord

DCPMM - 規劃程式,寫程式細節,預估天數,writi doc 8:00-9:00,11:00- 12:00,13:30-14:00
DCPMM - chad要relayout,discuss motherboard修改事項 10:30-11:00
DCPMM - 規格說明 (to Tina) 13:00-13:30
Intelligent CxU - Hxs 7200 - IB問題討論 9:00-9:30
Intelligent CxU - Malaysia SxR ACL SD Error message 9:30-10:30
Intelligent CxU - Verizone PPT, QE pass, MCS是否可用 (<> RMS 說明 - Yoko (<30min)

wooh! I can post pitcures!


this is .....my 2dn trial Posted by Hello
Abouve is posted by "Hello" site.
I can post mine...
no,, just trying.. Posted by Hello

New Blog Funtion !!

今天login發現Create的內容變了(again)
有 font - This is Arial , Lucita
bold, ident, color,
- center-
-right aligment
  1. item1
  2. item2
and .. upload image ! - no work!



星期四, 7月 15, 2004

Today's workrecord

雜事- Hds3000, 24V system QE 評估問題,自動化問題,加入UPS 8:00 - 10:00
7200 IB tolerance value discuss (黃少君) 10:00 - 10:30
RMS 說明 (yoko) 10:30-11:00
T Mobile Shelf debug (Neil) 11:00 - 11:30
DCPMM - data flow 1:00 - 5:00

Canble Modem Installation --- Failed

因為信號太弱了,使用的是Motorola的Cable Modem,
即使是在一樓信號都不夠。(難怪家裡第四台看不清楚)

要拉明線,從車庫分出來,再拉到窗戶。
所以要鑽洞--4分,一個鑽車庫,一個鑽窗戶(大概會走冷氣孔)。


有點麻煩--那還是請ADSL試試。
如果不行再鑽動call cable Modem來。

星期三, 7月 14, 2004

Today's workrecord

上午幾乎都在作Pxcx2 DCPMM Spec Reading (Writting),
下午幾乎都在作Pxcx2 DCPMM Spec Discussing。

DCE Wang-Wei 問#2 COM2問題,兩次,合計約1 Hr.

公司斷電2 次,recover合計1 Hr (Recover Server)

Pxcx2 target board斷電後GMT Fuse燒斷,tftp no work,
recover約30min

Dell PC - sock

DELL的PC真是超濫,用自己BIOS,卻常常找不到HD。
BIOS開機超慢。
主機板也不是標準大小。要換也不行,

版子品質也不好,用不久就有怪聲(fan),
接著就壞,一斷電就開不起來,找不到HD。

真麻煩,

從Dell跟MS可以知道產品品質並不是取得市場的主要因素,
策略才是。

星期二, 7月 13, 2004

T Mobil gateway reset problem

不知為何,TMobile gate會自動reset。
只有在和SxR通訊時才會,沒有SxR就不會。
測試將所有AI偵測部分停掉,485部分只送heartbeat和收opdata. - t6.

Today's workrecord

1.reading Pxcx2's DCPMM spec - 8:00-9:00
2.Yoko about RMS - 9:00-10:00
3.TMobile Reset problem - 10:00 11:30, 14:30-15:00
4.reading Pxcx2's DCPMM spec -11:30-12:00, 13:40-14:30. 15:00-17:30
5.DCE - Wang-Wei : 電總協議source code 說明 13:00 - 13:40

星期一, 7月 12, 2004

Books - suggested by Tsai

蔡康永獨家推薦必看書

˙最近積極推薦書

《地球少年的一天》

作者:日本共同通信社

你如何度過屬於自己的一天?你的一天是歡喜或是悲哀?你了解自己的生活和想法嗎?是否有自己的夢想和希望?知不知道其他三十餘國不同種族的孩子在做什麼?

˙每看必開心的書

《傳染》

作者:吉田戰車

外行人看它是無厘頭的漫畫,內行人卻覺得它具深層意識,既好看又好笑,蔡康永逢人就推薦喔!

˙每看必振奮的書

《夢是唯一的現實——費里尼自傳》

作者:C. Chandler

譯者:黃翠華

比起他的夢,費里尼的現實人生甚至更見精采,這本書是作者花了十四年的時間與費里尼對話的成果,費里尼天南地北,隨興而至,揭露了他外在與私下的不同面貌。

˙最精彩的推理書

《別告訴左手》

作者:渡邊容子

˙江戶川亂步賞作品〈日本推理小說的諾貝爾獎〉

八木因為舊日情人的妻子被殺,而背上殺人嫌疑,為洗刷冤屈,她決定主動出擊。同棟公寓的小光棍、熱心的偵探、可疑的窈窕女子……誰才是兇手?這和左手又有什麼關係?兇案如滾雪球般引出更大陰謀。

˙最經典的武俠書

《黑暗元素三部曲》(限量典藏版)

作者:菲力普.普曼

˙1996年英國衛報童書獎、1996年卡內基獎、1996年英國書卷獎年度童書獎

當代西方暢銷奇幻作品,企圖宏大,格局複雜,層次豐富,童心與陰謀交織對映,熱鬧趣味中流露詭譎陰暗面,許多評論已將此作品與《魔戒》、《納尼亞魔法王國》相提並論。

小女孩萊拉父母雙亡,充沛的好奇心讓她捲入一樁陰謀,拯救世界的重大任務因而落在她的肩上,隨著冒險與探索,她發現更多訝異甚至駭人的事實……

˙每看必感動的書

《失落的一角》

作者:謝爾.希爾弗斯坦

譯者:鍾文音

他缺了一角,他非常不快樂,他動身去找他那失落的一角……謝爾以簡鍊生動的線條和文字,闡述一則有關「完美」和「缺陷」的寓言。

˙最動人的愛情書

《布魯克林孤兒》

作者:強納森‧列瑟

譯者:嚴韻

萊諾從小患有罕見的妥瑞症,這個病症會使他產生狂吠、數數、拍打等過度異常行為。一件謀殺案發生,萊諾這個連溝通都有困難的「怪胎」,為了捍衛朋友,卻成了解開迷團的關鍵人物……

˙最難忘的科幻書

《華氏451度》

作者:布萊柏雷

譯者:于而彥

未來世界裡,知識被視為動亂根源,閱讀變成犯罪行為,政府下令焚毀所有的書籍,人們只能依賴政府掌控的電視牆吸收資訊。「消防員」的職責也不再是救火,而是扮演偵查與焚毀書籍的角色……

˙絕不錯過的好書

《小即是美:一本把人當回事的經濟學著作》

作者:修馬克

譯者:李華夏

書中有篇專門討論核能問題,作者修馬克在最後一句強調:「這意味著在處理人類經濟事務的同時卻不把人當一回事。」而這本書就是一本「把人當一回事」的經濟學著作。

˙逢人就推薦的書

《種樹的男人》

作者:讓‧紀沃諾

譯者:金恆鑣

一個愛樹的人,以他的雙手、無比的毅力,默默在法國南部的普洛旺斯地區,種植了三十四個年頭的樹,讓原本的荒山苦地,變成生意盎然的樂園。

圖片提供/野葡萄文學誌

Cable Modem : 7/14 to setup

Prepare :
1.my ID copy - 2 faces
2.900 NT - Cable Modem 押金(記得索取收據)
3.準備電腦。

7/14 6:00 - 800 來裝。

其實有綁約。一年。

ToDos - for today

1.DCPMM New Spec - 排schedule
1.1 Reading
1.2 Analyize
1.3 Architechure
1.4 Program Skeleton

2.DCDC-Shelf -2 shelf problem
2.1 Describe problem
2.2 Check DCDC side program's behave
2.3 Confirm the error-behave (if 2.1,2.2 not consistant, use Monitor)
2.4 Fix Codes

3.Try if BRUB could boot NTFS win2k
3.1 Install win2k in NTFS (Takes about 2 hrs)
3.2 Install Redhat 9.1 (Takes about 4 hrs)
3.3 Result (OK, Redhat9.1 GRUB could boot NTFS win2k!)

4.Linux Driver - lesson 2.

5.New Version - Engineering Load (taks about 2 hrs)
5.1 Send Demo to all
5.2 Explaining the data
5.3 collect everyone's data


TODOs- about hyperteminal release docuemt

要加上一頁封面,上面有Change History

星期六, 7月 10, 2004

No so Lucky! my turn is 10:00 this time

今天去看中醫,剛到時還覺得不錯,沒人。
到了拿藥時才知道原因-原來太晚到,大家都看完了。
我的拿藥時間是10:00。

所以晚上8:58開車過去,回來時是10:50。
要不是陸上開7,80的擋路車太多,其實可以更快的。
(下次要把這些車紀錄下來)

Even in the Mission to Mars..

軟體的進度總是最慢的,即使是在NASA的火星計劃。
NG的專輯,當Rover都已經在到火星的路途上,
他的software部分卻還沒完全完成,
只具備了一種功能:通訊,下載程式。
JPL的software engineer將在rover三個月的旅程中完成。
.
Rover: 128M DRAM, 3M Flash.

星期四, 7月 08, 2004

CVS Server for Windows

http://www.cvsnt.org/wiki/
.

TODOs.. pxcx2 can new protocol

這些是PxcxII要的SxR資料,要儲存在SxR上,
目前CxU不用顯示,所以只要定出protocol就可以,
讓CAN有Read/Write這些資料的能力。

Your Japanese Name

輸入中文名,他會幫你取個日文名子。
...這是從PIL看到的

星期三, 7月 07, 2004

Building Linux Module - "Module should never use kernel-headers....."

嘗試第一個Module : hello.o
在make時出現Compile Error:
#error Modules should never use kernel-headers system-headers.......
查Google,要我檢查include path有沒有問題,
include path是: /usr/src/linux/include
果然,/usr/src裡面只有redhat目錄。
拿出CDROM-II,rpm -i kernel-source-... 後
查安裝目錄是/usr/src/linux-2.4
所以要修改make file。
之後.....
OK!

Some Notes about SPI

SPI的TX和RX是同時動作的,CLK是拿來作二者同步的依據。

也就是說,當使用3 wire (SDI/SDO/SCK)的連線時。
Master端(CLK Generator)在送出一個byte的資料時,
Slave也可同時藉由這個CLK將信號送出。
所以Master在送出資料後,同時自己也收到Slave送來的資料。

從另一方面來看,
當Master要向Slave讀取資料時,也要藉由”送出資料”的方式,
讓SCK有CLK產生,好讓Slave取得資料。

所以一般來說,Master/Slave對於資料(command)的內容,
是採用 自行決定 的方式。

例如:
Write Command : 0x01, Data1, Data2
Read Command : 0x80, Data1, Data2

由於Master要對TXBUF作寫入動作,SCK才會有CLK輸出。
所以不論是Write還是Read,Master要對TX作兩次寫入動作。
只不過在作Read時,第二個Byte的資料會被Slave端忽略。

Slave端要實作一個State Machine,紀錄是否收到過Read Command,或是已經傳送的部分。
如果上次收到了Read Command (0x80),或是還沒傳送完,在收到TX command時,要忽略Master
送來的data,繼續作Rely的動作。

Slave 的Interrupt Code:


void spiint(void)
{
static int readcmd=0;
static int rplyi=0;
char dummy;
if(readcmd) {
dummy=RXBUF; // 讀入RXBUF,但是沒有用,因為是Master送的dummy command
TXBUF=RplyData[rplyi++];
if(rplyi>=2) {
rplyi=readcmd=0;
}
}else{
if(RXBUF==0x80) {
readcmd=1;
TXBUF=RplyData[rplyi++];
}else{
作收的部分..
}
}

A New 3.3v IO CAN Transiver.

Latest CAN transceiver IC combines true 3.3V I/O with excellent EMC performance and green packaging

Pocatello, Idaho - June 28, 2004 - AMI Semiconductor (NASDAQ: AMIS), a designer and manufacturer of state-of-the-art integrated mixed-signal and structured digital products for the automotive, medical and industrial sectors, has expanded its family of Controller Area Network (CAN) ICs with a high-speed CAN transceiver that combines true 3.3V or 5.0V logic interfaces, excellent EMC performance and a new environmentally friendly package. The AMIS-30663 provides the interface between a CAN controller and the physical bus, and will simplify the design and reduce the component count of 12V and 24V automotive and industrial applications requiring CAN communication at rates up to 1Mbaud.

Fully compatible with the ISO 11898-2 standard, the AMIS-30663 provides differential signalling capability to the CAN bus via the transmit and receive pins of the CAN controller. The IC provides designers with the option of 3.3V or 5V logic level interfaces, ensuring compatibility with both existing applications and emerging lower voltage designs. Carefully matched output signals eliminate the need for a common-mode choke by minimizing electromagnetic emission (EME), while the wide common-mode voltage range of the receiver inputs (±35V) ensures high electromagnetic susceptibility (EMS).

Designed to minimize the need for external components, the AMIS-30663 features a variety of built-in capabilities, including a time-out function that prevents bus lines being driven to a permanent dominant state – a situation that can lead to the blocking of all network communication. Built-in protection includes current-limiting circuitry to protect the transmitter output stage from damage caused by an accidental short-circuit to either positive or negative supply voltage. A thermal protection circuit protects the IC from damage by switching off the transmitter when the junction temperature exceeds 160ºC. The transceiver withstands all voltage transients associated with the automotive environment.

“Industrial and automotive OEMs are looking to simplify design, reduce component count and drive costs down. As a result, there are growing demands for peripheral ICs to operate with the same low voltage supplies used by modern microcontroller, memory and logic devices,” stated Bob Klosterboer, vice president of AMI Semiconductor’s Integrated Mixed-Signal Products. “By offering true 3.3V and 5.5V interface options, the AMIS-30663 CAN transceiver can work with existing applications while eliminating the need for the CAN controller to have a 5V-tolerant interface in lower voltage designs. In addition, the excellent EMC performance of the device, coupled with integrated protection functionality, will help designers to simplify circuit layout and reduce the number of components required to implement a complete solution.”

The AMIS-30663 is available now and is supplied in AMI Semiconductor’s SO-8 ‘green’ package, and is priced at $0.73/unit in quantities of 5K units.

SPI Salve down again !

上次在採用一個一個byte read/write後,PIC SPI Slave似乎可以動作,但是在整合了其他的SPI device (RTC)後,又不行了。
.......
Alice將read RTC的command加入rc中,
啟動後,pic的DO又維持在High,無法動作了!
.......
猜測這會不會是ICE2000的問題,因為一但進入這個狀況,光是resetart ICE並不能解決問題,
一定要重開所有的電源才行。

BTW,發現一個PIC的forume http://forum.microchip.com/
要註冊,註冊的n/pass mail在gmail裡。

星期二, 7月 06, 2004

2 Things about MCF5272 : CSBR,CSOR & Memory Expand-IO

CSBR CSOR Setup
在設定CSBR,CSOR時,要先設定CSOR,再設定CSBR。
因為CSBR有Enable Bit,所以要在該CS所有相關設定都設完後才能Enable,
否則會當機。

Memory Expand IO
使用Memory Map IO時,因為設定該Region是8 bit寬,所以要用
*(unsigned volatile char*)0x50002000 = 0xFF;

寫入,
如果用其他type,例如
*(unsigned volatile long*)0x50002000 = 0xFF;

則CPU會連續寫入4次(一次一個byte)所以結果會是最後一個byte的data。
如果要用long,要注意data的byte order。以M5272為例,是BigEndian.
CPLD將D24-D31拉到D-type上,所以要
*(unsigned volatile long*)0x50002000 = 0xFF000000;


其實為了避免麻煩,還是用char type來作比較好。

Require for Manufacturing..Displaying All Settings

為了將系統所有參數設定作為系統規格書的一部份。
CxU必須增加:
在hyperterminal中將所有SYSCFG和Parameter setting內容列出的功能。
目的在方便將所有系統設定列出。

*簡而言之,所有save在EEPROM的變數都要列出。

Spec Change AGAIN!

原Project負責人退休,
Boass等於去幫他們作交接。(一對三)
由於原負責人作業不甚透明,
所以無其他人了解內容。
所以等於重新提案,spec改變甚多。
有些有點”天馬行空”。

星期一, 7月 05, 2004

CMMI TODOs

1.架CVS,checkin DCPMM和一些recently modified source (and docs ?)
2.CM : 一樣,有request 和bug 都要作CM ( document的CM )。

星期日, 7月 04, 2004

spidermnan-2, not so good like 1.

特效反而比較差了,沒有第一集看了會頭暈的感覺。
打鬥場面也很少,
反派選八爪博士是一個敗筆,因為對打時四隻手輝來輝去的紙覺得一團亂,看不清楚。
還有就是蜘蛛人出場時間太短,還有一半時間沒戴頭套。
核融合產稱的高熱如果在水里應該會瞬間汽化所有的河水。

全篇沒有”氣勢”的場面,所以在佳里看DVD應該就可以了。

所謂第三集的伏筆大概就是他的朋友繼承父志,成為綠魔怪吧。
因為他發現了他爸的裝備--glider和藥劑。

PatorLabor - 7/6 Ch18 11:00

機動警察要演囉,
7/6起,晚上6:00和11:00。
東森戲劇(18)。

gmail can't use zaurus Netfront

login 話面沒有login的box,所以不能login.
真是諷刺,用linux系統的公司竟然做出IE專門的罔頁

Blog with ZAURUS

Seems ok, Netfront works peefeck on blogspot.

星期六, 7月 03, 2004

MUJI in NY.NY - nothing worth buying..

結果無印良品不是在101,是在旁邊的NY.NY 二樓(和微風)。
去逛了 一下,可能是店很小,沒什麼東西。
內容有點像IKEA和生活工廠的綜合體,
不過東西爆貴的。
沒什麼東西可買,最後買了泡麵和蝦餅。

不過我對他的紙質腳柱很有興趣,還有書架式CD音響。
可惜現在CD player不吃mp3的話,有點廢物。

about taipei yoyo card & Taoyuan Tai-mall

悠遊Card剩25圓,停車一小時30圓,結果不給出,要加值後才能出來。
還好停車管理處可以加值(雖然他沒標示有這項服務)。

下午6:00到台茂吃晚餐,美食街竟然沒位子。
去那裡這麼多次,每次都只是小貓兩三隻,想不到會有今天。
(一直到8:00都還很多人,天呀,是景氣復甦了?)

星期五, 7月 02, 2004

Emacs - GDB

用Emacs執行gdb
在Emacs裡用ESC-x gdb 執行gdb。
同樣,第一次執行會出現command edit prompt,讓你修改執行gdb的command。
default是"gdb",可以修改成"gdb hello"。
啟動後,會自動開啟另一個Windows,顯示目前執行的source code位置。
原來的Windows就用來下gdb的command。
例如在gdb window下以下command..
break main : 在main設break point。
run : 執行程式。
程式會在main停下,這時候下面的source code Window就會顯示出main附近的sourc code,並且在
main的前面會有一個" => "符號。
隨著
step : step into
next : step over
Source code Windows的"=>"會停在不同的地方,同時顯示出附近的source code。

Emacs - Compile & correct compile error

要先寫好makefile
ESC-x compile : 執行"make" command.

第一次執行時可以edit command,例如
default是 "make -k",可以改成"make all"

執行make後,會自動開啟另一個Window,show compile result。
這時候可以要Emacs分析compile result...
Ctrl-x ` :分析compiler message
Emacs會自動將游標移到compile的error處。讓你修改。

反覆執行 Ctrl-x `,修改。直到Ctrl-x `顯示"no more errors"
執行Ctrl-s Save修改後的source code。
再執行ESC-x compile,作make,如果有錯,再用Ctrl-x `修改
------------------------------------------------------------
***最簡單的makefile就是
all:
gcc -o hello hello.c

Emacs -- Windows

Ctrl-x 2 : 開啟令一個Window
Ctrl-x o : 到另一個Window
Ctrl-x 1 : 關閉其他所有Window

Emacs - forground/backgroud

在Emacs編輯到一半,可以用
Ctrl-z

將Emacs放到背景,這樣就可以執行一些shell command。
之後,在shell中用
fg

將Emacs叫回來

emacs sites..

要試試Emacs,才能在沒有X的時候有比較好的gdb配套IDE。
$ emacs filename

Ctrl-x : x 代表要下command
File
Ctrl-x Ctrl-f : 代表 File , open file or new file
可以輸入'.'作為檔名,Emacs會列出目前目錄下所有檔案,用up/down選擇,enter後就可以開啟。
Ctrl-x Ctrl-s : 代表 Save
Ctrl-x Ctrl-c : 代表 Close
移動

Ctrl-a : 到行頭
Ctrl-e : 到行尾
Ctrl-b : 退後一個
Ctrl-f : 前進一個
Ctrl-n : 到下一行
Ctrl-p : 到上一行

剪貼

Ctrl-b : 刪除游標字元
Ctrl-k : 刪除游標到行尾的字元
所以刪除一行通常是先Ctrl-e跳到最前,再Ctrl-k刪掉整行
Ctrl-y : 把buffer裡的字貼到目前位置(yank!)
Ctrl-@ : 標記開始(Ctrl-Space也是,但是會和注音輸入混淆)
Ctrl-w : 標記結束,cut到buffer
ESC-w : 標記結束,copy到buffer
所以一般是用Ctrl-@,ESC-w 將要co的region mark起來(或是用Ctrl-w將要剪的地方剪下),再用Ctrl-y貼到要貼的地方

其他

Ctrl-v : 到下一頁
Ctrl-o : 把游標後的字放到下一行(斷行)
Ctrl-l : 畫面重劃
Ctrl-s : 向下尋找
Ctrl-r : 向上尋找

UNDO
Ctrl-g : 按錯命令,例如ESC,Ctrl後,用這個命令可以undo
Ctrl-_ : Undo上一個動作

Buffer
Ctrl-x k : Close this file (buffer)
Ctrl-x Ctrl-b : List all buffer

Emacs - more details - sites.

Emacs 的基本編輯指令

前面的四個章節已經把 EMACS 的環境與架構做了扼要的介紹,現在開始討論 EMACS 做為編輯器(editor)所能提供的服務。

如何載入檔案與儲存檔案

使用編輯器最基本的需求,就是要能載入檔案以便編輯。現在就先來看看 EMACS 是如何處理檔案的載入。
EMACS 載入檔案的方法很簡單,只要在鍵入 "Ctrl-x Ctrl-f" 之後,再利用 minibuffer 輸入所要編輯的檔名即可。檔名的輸入可以與 completion 相互搭配。
鍵入 ``Ctrl-x Ctrl-f'' 命令之後,在 mininbuffer 處輸入已存在硬碟的檔案, EMACS 會執行如下的過程:

1. 產生一個新的緩衝區。
2. 將所欲編輯檔案的內容,拷貝至緩衝區內。
3. 將緩衝區的內容顯示出來,以便編輯。

這整個事件的過程,在 EMACS 的編輯系統中稱為「訪問檔案」( visiting file )。雖然載入檔案的方法很簡單,但仍有幾件事情值得討論的,現說明如下:

* 鍵入 ``Ctrl-x Ctrl-f'' 後, echo area 會顯示目前緩衝區的目錄,此時若編輯檔案的目錄與 echo area 所顯示的目錄相同,可逕在其後輸入檔名即可。
* 若檔案所在的目錄與目前緩衝區的目錄不同,輸入檔名的方法有如下幾種:
o 檔案在同一個機器上的做法:
+ 無視 echo area 所顯示的目錄,由使用者重新輸入檔名。
+ 鍵入新檔名的方法,是在 echo area 顯示目錄的最後方鍵入 ``/'' ,``/'' 代表, 忽略``/'' 之前面的路徑,新的路徑從 ``的路徑必須鍵入絕對路徑(absolute file name)。現舉一實例說明。 Find file: ~/work/emacs/emacs.tex 所要編輯的檔案在 ~/work/doc/text.tex 此時輸入正確檔名的做法如下所示: Find file:~/work/emacs/emacs.tex//~/work/doc/text.tex 以 EMACS 提供的刪除功能,將不必要的字刪除之後,
再輸入正確的資料. 除非顯示的目錄與所欲編輯的目錄相差無幾,使用刪除的方法才有意義,否則不如放棄所顯示目錄,重新開始新的生涯才是正途。至於如何刪字,會在 5.2.5 一節中說明,此處就不贅言。 所欲編輯的檔案,不在目前所在的機器上的做法,如下所示:前已述及 EMACS 可以 FTP 的方式來編輯遠方的檔案,但 EMACS 是如何以 FTP 的方法來編輯遠方旳檔案呢?想要編輯遠方的檔案,只要給予正確的語法, EMACS 就會根據其語法來決定是否要使用 FTP 來編輯此檔案了。其語法很簡單,只有 /host:filename 而已。如何來使用其語法呢?由其語法可知,其語法是由四組元素所組成的字串,包括二組子字串(host 和 filename)以及二個符號(/ 和 :)。在 minibuffer 處輸入 / 後,緊接給予檔案所在的機器名稱(host),在其後立即給予 ``:'' ,在 ``:'' 後則輸入所欲編輯檔案,整個訪問檔案的過程就完成。注意此四組資料間,不可以留有任何的的空白。現舉一實例子來說明之。 Find file:~/work/emacs.tex//hsko@gate.sinica.edu.tw:~/work/text.tex 鍵入 ``Ctrl-x Ctrl-f'' 當 echo area 顯示出目前緩衝區
o o 的目錄後,只給予 RET 而別無它物時, EMACS 以目前緩衝區所使用的檔案為預設檔案。 鍵入 ``Ctrl-x Ctrl-f'' 後,突然改變心意,想知此目錄以外其它目錄的檔名,除了使用 ``Ctrl-x d''(使用目錄的編輯指令-dired)指令外,還可以利用現有的目錄名稱來得到想要的訊息。其作法是直接修改 echo area 所顯示的目錄,直到所要的目錄出現後,鍵入 RET,此時會另開啟一個視窗來顯示出此目錄下的所有檔名。若想操作這些檔案,其操作方式與運作 Dired 的方式相同。若對 Dired 的印象已經模楜的人,請參閱 3.2 節 。
以上是介紹檔名的輸入方式。在編輯資料的同時,是否可以輕易查得目前所在的目錄?" Meta-x pwd" 指令可以滿足這種需求。鍵入 " Meta-x pwd" 後, EMACS 會假借 echo area將目前所在的目錄顯示出來。
以上談的都是 EMACS 輸入檔案的方式,但 EMACS 又是如何為其緩衝區命名的呢?其實使用者並不需要為緩衝區命名,因為 EMACS 會自動給予緩衝區合適的名稱。EMACS 為緩衝區的命名,可以從 mode line上得知。
EMACS 命名緩衝區的方式是根據所鍵入的檔案名稱而來,它捨棄了所有的目錄名稱只保留編輯檔案的檔名。所以若全名為 ``/user/work/emacs.tex'' 的檔案,其緩衝區的名稱則為 ``emacs.tex'' 。 除了將檔案從硬碟直接載入緩衝區外,在編輯檔案的同時,有時需要參考其它的檔案,甚至需要引進其它的檔案到目前所使用的緩衝區內。 EMACS 的 `` Ctrl-x i'' 指令,就是讓使用者能隨時引進其它的檔案到目前的緩衝區內。 ``Ctrl-x i'' 的 `` i'' 是 insert 的意思,相信瞭解意思後,對於該指令應有較深刻的印象,否則怎有知已知彼,百戰百勝之說呢? 以下是 EMACS 有關檔案載入指令的整理:
o Ctrl-x Ctrl-f(find-file)
o Ctrl-x i(insert-file)
o Meta-x pwd
文件編輯完後,最重要的事情就是要能將其保留下來。以下就來談談文件儲存的方法。檔案儲存不外乎將緩衝區的內容以原名或易名存回磁碟;此儲存方式可以選擇一次存一個檔案或一次存數個檔案;最後的考量是存完檔案後是否要直接離開 EMACS。 下面就來看看EMACS 所提供的相關指令。
o 存檔但不離開 EMACS
+ Ctrl-x Ctrl-s(save-buffer
+ 將目前緩衝區的內容,存回磁碟中。存回的檔案名稱與緩衝區 的名稱相同 。此指令只對目前所使用的緩衝區做存檔的動作。若緩衝區 的內容未有任何的變動則 echo area 會顯示如下的文字: (No changes need to be saved) Ctrl-x Ctrl-w(write-file)
此指令與上一個指令相似,不同之處在於可以使用與緩衝區 不同的檔案名稱存檔。。換言之,可另行指定存回磁碟的檔名。 鍵入 ``Ctrl-x Ctrl-w'' 後, echo area 會顯示出目前 緩衝區所在的目錄, 此時,使用者可根據需要輸入檔名。若不輸入任何檔名只鍵入 RET , 系統仍會將緩衝區內的資料存回原先訪問的檔案中。此指令 也只對目前所使用的緩衝區做存檔的動作。

+ Ctrl-x s(save-some-buffers)
此指令可用來儲存所有被修改過的緩衝區。使用此指令時, echo area 除了顯示 檔案名稱外,還會在檔名之後出現 (y, n, !, ., q, C-r or C-h) 這些訊息是提供給使用者做參考的。現在就告訴使用者這些 訊息所代表的意義。
1. y
2. 同意對 echo area 所顯示的緩衝區存檔,進一步 徵詢其它檔案是否存檔的意見。 n
3. 放棄對 echo area 所顯示的緩衝區存檔,但徵詢 其它檔案是否 存檔的意見。 !
4. 同意對 echo area 所顯示的緩衝區存檔且一併 對其它的緩衝區存檔,此時不再一一徵詢其它檔案是否 存檔的意見。 .
5. 同意對 echo area 所顯示的緩衝區存檔,但放棄 對其它未存檔的緩衝區存檔,且直接離開此存檔的狀態。 q
6. 離開存檔的狀態而不執行任何存檔的動作。 C-r
7. 可以此指令流灠目前所要儲存的檔案內容,當離開此流灠 狀態即回復存檔的模式,系統會再度詢問與存檔有關的訊息。 C-h
對於以上的選項若有不明白的地方,可以此功能查閱其意思。 存檔後直接離開 EMACS
o Ctrl-x Ctrl-c(save-buffers-kill-emacs) 此指令容許用者在決定是否將緩衝區的內容存檔後,立即 離開 EMACS。此指令實際上是先執行 ``save-some-buufers'' 的動作再離開 EMACS。 討論完了載入與儲存檔案的功能之後,相信已經迫不急待想要知道如何編輯一份心目中想要的文件。現在就是介紹如何編輯檔案的時候了。

Emacs 的基礎編輯指令

編輯器做些什麼事呢?現在先談談編輯器的基本功能,至於編輯器的進階功能則在下一章討論。此處所談的基本或進階的功能,所指的都是 EMACS 可以提供的功能,所區分的基本和進階也只是為了討論上的方便而已。
所謂的編輯器就是用來編輯文件的器具。一張紙與一支筆,就可以滿足文件的編輯,這也是最簡單且最原始的編輯器。將紙筆產生文件的動作以電腦來代步,就是電子編輯器(以下簡稱編輯器)主要的功能,也是本文所要討論的編輯器。
文件的編輯不外乎文件的鍵入、游標的移動、文件的搬移與刪除以及文件資料的找尋與取代等等。現將 EMACS 可提供的基本編輯功能簡列如下,其詳細的用法會在以下的各節中一一敘及。 EMACS 所能提供的基本編輯功能如下:

* 字元輸入與顯示在螢幕上的方式
o 字元的顯示方式,可使用插入法(insert)或覆蓋(overwrite)的方法。
o 除了一般的字元(ASCII Character)外,還可以顯示特殊字元
o (Special Character)以及任何八進位超過 200 的字元。 文件在螢幕上所能顯示的範圍。
* point(cursor) 的移動方式(move point)
o point 能左右移動一個或數個字元(character)

o point 能左右移動一個或數個字(word)

o point 能移至一列的開頭或結尾

o point 能上下移動一列或數列(line)

o point 的設定,使游標能上下移動至指定的欄位

o point 的移動能以頁為單位(page)

o point 能至螢幕的前端或尾端

o point 能移至緩衝區的前端或尾端

* 顯示緩衝區大小與 point 所在的位置
* 刪除螢幕上所顯示的文件
o 向左或向右刪除一個字元(character)

o 向左或向右刪除一個字(word)

o 刪除游標所在位置以後的所有文件

o 刪除一個區塊的文件(region)

o 刪除的文件可以再使用(yank)

* 文件的搬移與拷貝(move and copy)

編輯器具備以上的功能,就可以編輯出想要的文件。現在就來看看如何在EMACS 所提供的編輯環境,來編輯出想要的文件。

在 Emacs 中如何加入與顯示文件

EMACS 允許輸入文件時,將資料直接輸入在 point 所在位置的正前方,此方法稱為 insert mode;或將輸入的資料以覆蓋的方式取代 point 所在位置的字元,此方法則稱為 overwrite mode。現舉一實例來說明 insert mode 與 overwrite mode 的異同。

* 字串 food, point 所在位置為 d 處,此時的狀態為 insert mode。
* 在 point 所在的 d 處鍵入 t ,原字串變為 footd。 字串 food, point 所在位置為 d 處,此時的狀態為 overwrite mode。 在 point 所在的 d 處鍵入 t ,原字串變為 foot。

EMACS 對輸入模式的預設值是 insert mode,若想將模式轉換成 overwrite mode,指令 `` Meta-x overwrite-mode RET'' 可滿足此一需求。若想恢復 insert mode,只需再使用一次 `` Meta-x overwrite-mode RET''就可以了 。當輸入模式轉為 overwrite mode 時,螢幕下方的 mode line 會顯示 ``Ovwrt'' 的訊息,用以提示目前是使用 overwrite 的模式。指令 `` Meta-x overwrite-mode''是用來轉換 insert mode 與 overwrite mode

。在此前提下,原為 insert mode ,經轉換則為 overwrite mode。反之,若原為 overwrite mode 則轉換成 insert mode。
EMACS 的 overwrite mode 只針對從鍵盤輸入的文件有效,若文件不是從鍵盤輸入,而是以別的方式產生的,則一律失去 overwrite的效用。例如,拷貝而來的文件或以 `` Ctrl-x i'' 得來的文件, EMACS 一律使用insert mode。
除了 insert 與 overwrite 的顯示方法外, EMACS 還允許使用者輸入一些從鍵盤上無法輸入的字,那就是一些控制碼和八進位超過 200 的字元。要輸入這些特殊的文字時,只要在這些字的前方加上 `` Ctrl-q''即可。例如,要輸入分頁碼(formfeed ,ASCII Ctrl-L, octal code 014),則輸入 ``Ctrl-q Ctrl-l'' 即可。此時螢幕會出現 C此時螢幕會出現 ^L 的符號。當輸入文件的長度,超過 EMACS 視窗寬度所能顯示的範圍,EMACS 對此情形的處理如下所示:

* 若文件太長需要換列時,在換列處鍵入 RET ,其後的文字會自動轉到下一列且以第一個欄位為新列的起始點。若其後沒有文件而鍵入 RET ,游標會會停在下一列的第一個欄位。
* 不理會文件是否會超過視窗的寬度,也就是不鍵入 RET 而繼續輸入文字。 EMACS 會自動在視窗的最後加上 ``\'' ,而將其餘的文字移至下一列;若下一列還是無法顯示出所有的文字,會在此列的最後再加上一個 ``~續將多餘的文字移至下一列。 EMACS 就是不斷重複如此的動作,直到所有的文字都能完全顯示出來為止。所代表的意思與鍵入RET 並不相同。鍵入 RET 表示重新使用一個新列;不鍵入 RET 而令 EMACS 自動加入所產生的文件,仍代表著同一列,只是這一列太長, EMACS 無法以其視窗的寬度來一次窮盡,必須分為數次來表示。
* 不鍵入 RET ,也不使 EMACS 自動產生 ,而使超過螢幕寬度的部份暫時隱藏起來。EMACS 處理這種情形,是在視窗的最後加上一個 ``$'' 。 ``$'' 表示其後的內容在視窗上暫時看不到,但仍安在緩衝區內。EMACS 的基本預設是自動加入 ``\''。要使多餘的文字隱藏起來,必須設定 ``truncate-lines'' 變數的值為正值。變數設定的方法請參考 4.4 節。 4.4 節曾談過一個視窗可以分成左右二個小視窗,此視窗可以做水平的捲動,此情形下的視窗在處理太長的列時,就是將 truncate-line 變數的值設成正值,使超過寬度的文件隱藏起來。

前面所談的都是「文字」的插入方式,但如何插入一個「非文字」的空白列呢?在編輯的過程中,若想在某列之前加入一個新列,只需將游標移至此列的最前端,隨後再按下 RET 即可。此時 EMACS 會在游標所在處的前一列,加入一空白列。 EMACS 為何要將空白列加在游標之前而不是游標之後呢?因為將空白列加在游標之前,有一個最大好處,就是可以很輕易的在緩衝區的最前端加入一個空白列。此時所鍵入的 ``RET'' ,代表著 newline 。若不鍵入 RET, 也可以使用 EMACS 所提供的 Hotkey ,也就是 Ctrl-j (tex-terminate-paragraph) 來獲得新的一列。

point的移動

文字的鍵入及顯示是編輯過程不可或缺的。除此之外,移動游標到適當的位置,也是編輯過程不可缺的功能。現在就來看看在 EMACS 下如何移動 point 或可稱為如何移動游標。移動 point 也就是移動游標,因為 point 是透過游標來顯示的。所以在本文會將游標與 point 交互使用。 游標移動不外乎以固定的單位,將其做上下左右的移動。此固定的單位可能是字元(character)、字(word)、列(line)或頁(page)。現在就來看看如何將游標以這些單位來移動。

* 左右移動一或數個「字元」(character)
o Ctrl-f(forward-char)
游標往前(右)移動一個字元。

o Ctrl-u n Ctrl-f
(Ctrl-u n Meta-x forward-char) 游標往前(右)移動 n 個字元。

o Ctrl-b(backward-char)
游標往回(左)移動一個字元。

o Ctrl-u n Ctrl-b (Ctrl-u n Meta-x backward-char)
游標往回(左)移動 n 個字元。

* 游標左右移動一或數個「字」(word)
o Meta-f(forward-word)
游標往前(右)移動一個字。

o Ctrl-u n Meta-f (Ctrl-u n Meta-x forward-word)
游標往前(右)移動 n 個字。

o Meta-b (backward-word)
游標往回(左)移動一個字。

o Ctrl-u n Meta-b (Ctrl-u n Meta-x backward-word)
游標往回(左)移動 n 個字。

* 游標移至一列的「最前端」或「最尾端」
o Ctrl-a (beginning-of-line)
游標移至一列的最前端。

o Ctrl-e (end-of-line)
游標移至一列的最尾端。

* 游標上下移動「一列」或「數列」(line)
o Ctrl-n (next-line)游標向下移動一列。
o 下移一列的游標其所在的水平位置,與移動前的水平位置 相同。若游標在文件的最後一列時, Ctrl-n 會自創新列再 移到此新列的第一個欄位。 Ctrl-u n Ctrl-n(Ctrl-u n Meta-x next-line)游標向下移動 n 列。
o Ctrl-p (previous-line)游標向上移動一列。
上移一列的游標其所在的水平位置,與移動前的水平位置相同。 若游標已在文件的第一列時,再使用 `` Ctrl-p'' 時 echo area 會顯示如下的訊息: Beginning of buffer

o Ctrl-u n Ctrl-p (Ctrl-u n Meta-x previous-line) 游標向上移動 n 列。
* 上下捲動緩衝區
o Ctrl-v(scroll-up)
向上捲動緩衝區,且將目前視窗所顯示的最後二列,做為 捲動後的前二列, point 出現在視窗上的第一列。 EMACS 如此做只是讓使用者 有一個承先啟後的感覺罷了。

o Ctrl-u n Ctrl-v
緩衝區向上捲動 n 列。 數字 n 若小於目前 point 在此視窗所在位置的列數,捲動後的 point 位置,仍留在捲動前的同一列上;否則 point 移至視窗 的第一列。

o Meta-v(scroll-down)
向下捲動緩衝區,且將目前視窗上的前二列做為捲動後的後 二列,此時的 point 出現在螢幕的最後一列。

o Ctrl-u n Ctrl-v
緩衝區向下捲動 n 列, 若數字 n 小於point 在此視窗以下的列 數,捲動後的 point 位置,仍留在捲動前的同一列處。否則 point 移至視窗的最後一列。

* 左右捲動緩衝區
o Ctrl-x <(scroll-left) 緩衝區向左捲動。
o Ctrl-x >(scroll-right) 緩衝區向右捲動。
* 游標移至緩衝區的前端尾端
o Meta <(beginning-of-buffer)
o 將游標移至緩衝區的最前端, point 也移至視窗的第一列。 Meta >(end-of-buffer)
將游標移至緩衝區的最尾端, point 也移至視窗的最後一列。 頁數的移動
* 還記得討論 `` Ctrl-q'' (quoted-insert) 時,提過分頁的控制碼。有了分頁的設定,自然會有以頁數做為移動游標的單位了。
o Ctrl-x [ (backward-page)
o 將 point 移至上一頁分頁指標(^L)之後且緊鄰 ^L。 若point 已緊鄰在 ^L 之後了,則會略過此 F在 ^L 之後了, 則會略過此 ^L 到上一個 ^L 之後。 Ctrl-x ] (forward-page)
o 將 point 移至下一頁分頁指標(^L)之後且緊鄰 ^L。若point 已緊鄰在 ^L 之後了,則會略過此 F在 ^L 之後了, 則會略過此 ^L 到下一個 ^L 之後。 Ctrl-x Ctrl-p (mark-page)
以頁為單位做上記號之後,再配合其它的指令對此頁做處理。 此指令類似mark region(5.4 節會討論其意思)。例如 Ctrl-x Ctrl-p Ctrl-w 是將游標所在的那一頁刪掉。此指令可以配合 numeric arguments(5.3 節會討論其意思)使用。

除了以移動游標的方法來游走緩衝區外, EMACS 還提供一個可以直接將游標移到指定的行列。所要到達的目的地,不論是以字元數或列數為移動的單位,其起算點都是以緩衝區的第一列第一個欄位為起算的標準。以下就是此方法的介紹。

* Meta-x goto-char RET
* 鍵入此指令後再按下 RET ,echo area 會出現 ``游標移動的總字元數即可。再一次的提醒各位,字元的 計算是以緩衝區的第一列的第一個字元為起算點。例如, 在 ``Goto char:'' 給予 100 的數字,則游標會從緩衝區的 第一字元移動到第 100 個字元。 Meta-x goto-line RET 鍵入此指令再按下 RET 後,echo area 會出現 ``, 在其後輸入想要游標移動的列數即可。再一次的提醒各位, 列數的計算是以緩衝區的第一列為起算列。例如,在 ``Goto line:'' 給予 100 的數字,則游標會從緩衝區的第一列開始往下移動 10 列。

何謂數值引數

在上一小節 point 移動一文中不斷的看到 Ctrl-u n ,它是什麼呢?它是 EMACS 的數值引數(numeric argument),但數值引數又是什麼的呢?
數值引數適用於所有 EMACS 的指令。它的用途可分成 以下數類:

* 對某一指令做重複執行的動作
o 用法: Ctrl-u n command 或
o Meta- n command 說明:
+ n 代表重複的次數; command 代表要重複執行的指令。
+ 若鍵盤提供 Meta 鍵(個人電腦可以使用 ESC 鍵),則 Meta 鍵是使用數值引數最方便的方法。
+ n 若為負值的數字,則表示以反方向運行指令。
o 例子:
+ n 為正值
+ Ctrl-u 5 Ctrl-f 或 Meta-5 Ctrl-f 表示游標往前(右)移動 5 個字元。 n 負值
Ctrl-u -5 Ctrl-f 或 Meta-5 Ctrl-f 表示游標往回(左)移動 5 個字元。 重複動作四次
o o 用法:
o 說明:
+ Ctrl-u 後面所接的不是數字而是字元,它代表著一個 Ctrl-u 重複指令的動作為一個四的倍數。換言之,一個 Ctrl-u 執行 四次,二個 Ctrl-u 則執行 16 次,以此類推。
o 例子:
+ Ctrl-u Ctrl-f
+ 表示游標往前移動 4 個字元。 Ctrl-u Ctrl-u Ctrl-f
表示游標往前移動 16 個字元。 利用引數變數自動鍵入相同的「字元」
*
o 用法: Ctrl-u n char 或
o Meta- n char 說明:省略 n 與否,代表不同的意義
+ Ctrl-u 後緊接著數字與字元,表示重複字元 n 次。
+ Ctrl-u 後面不接數字而緊接字元,表示重複字元四次。
o 例子:
+ Ctrl-u 10 r 或 Meta-10 r 則螢幕上出現 10 個 r。
+ Ctrl-u r 或 Meta-4 r 則螢幕上出現 4 個 r。
* 使用引數變數自動產生相同的「數字」的方法
o 用法: Ctrl-u n Ctrl-u n 或 Meta- n Ctrl-u n
o 說明: Ctrl-u 後面有二個 n ,第一個 n 表重複的次數, 第二個 n 表重複的數字。第二個 n 之前一定要再給予一次 Ctrl-u,若不給第二個 Ctrl-u ,系統會以為重複 nn 次。
o 例子: Ctrl-u 5 Ctrl-u 4 或 Meta-5 Ctrl-u 4 螢幕上出現 5 個 4。 Ctrl-u 5 4 ,則系統以為重複 54 次。

數值引數的用途很廣,且適用任何一個 EMACS 的指令,當需要重複執行某一指令的動作時別忘了它。有人說電腦最強大的功能之一,就是能不厭其煩的執行重複的事情。以下有關 EMACS 指令的介紹,不再特別強調 numeric arguments,但並不表示它就此而消失了,因為數值引數適合所有的指令,所以沒有必要每次都重複強調。只需記得,需要時可隨時使用 numeric arguments。

如何得到與 point 有關的訊息

前面談過 EMACS 移動 point 的方法,現在介紹探知 point 位置的方法。point 所在的欄位、列數與頁數等訊息,可從整個或部份的緩衝區而得知。現在就開始討論 point 位置。

* Meta-x what-page
* 告知 point 所在的頁數與列數。若緩衝區沒有以分頁(^L)符號分頁,則 point 所在的頁數永遠為第一頁。 若 point 在第一頁的第 200 列,其顯示的訊息如下: Page 1, line 200 Ctrl-x l (count-lines-page)
* `` Meta-x what-page'' 用來告知 point 所在位置的頁數與列數,但無法從中得知此頁的總列數。若想知道某一頁的總列數,必需靠 Ctrl-x l 來得知。此指令除了得知某頁的總列數外,同時還知道 point 所在位置之前與之後的尚有的列數。使用此指令時, echo area 會出現如下的訊息: Page has 23 lines(20 + 4) echo area 出現的第一個數字為總列數,括號內的二個數字分別代表point 所在處之前與之後的列數。括號內的兩個數是以point 為分界點而得來的。所以當 point 不出現在某一列的第一個欄位時,括號內二個列數的總和會比總列數多出一列,因為 point 所在的列被重複計算了兩次. 此指令在決定如何分頁時可以幫上大忙,因為可以輕易得知 point 前後的列數。 Meta-x what-line
* 告知 point 在緩衝區的列數。若此時 point 在第 200 列, 則 echo area 會出現如下的訊息: Ctrl-x =
* 指出游標所在欄位的字元資料。這些資料包括字元的八進位碼、字元所在的位置佔整個緩衝區的比例(此比例以字元為基本單位)以及字元所在的欄位。例如以此指令來得知此 ``a'' 字元的資料, echo area 會出現如下的資訊: Char: a (0141) point=23905 of 38784 (62) column 19 臨時想知某一字元的八進位,也不妨試試此法。 Meta-=
* 用來得知某特定區域( region)的總列數與總字元數。至於如何設定區域會在 5.3 節討論。以此指令得知的結果如下所示: Region has 200 lines, 2000 characters Meta-x line-number-mode
以上所討論的指令,只在使用指令時才會顯示想要的訊息, 訊息的出現是無法長存的。 基於此,EMACS 提供了一個可使 訊息永久存在 line 的方法,那就是使用 `` Meta-x line-number-mode''。 此指令可以在 mode line 上顯示 point 所在的列數,直到離開 此狀態或離開此視窗才會消失。若想使每次進入EMACS 都能 顯示列數,最好的方法是在 ``.emacs'' 檔加上如下的敘述: (setq line-number-mode t) 如此一來,只要進入 EMACS , mode line 會自動將列數顯現出來。 至於自動顯示欄位的方法,目前的 EMACS 尚未提供此服務。

文件的刪減

修改文件不外乎將原有的文件刪除後,再加入新的內容;或將現有的資料做重新的排列組合。現先討論文件的刪除部份,文件的重組就留待 5.4 節再進行討論。
EMACS 中的刪除有兩種形式,一種是指文件的 killing,另一種則指文件的deletion。在 EMACS 中所謂的 killing 是指將文件從目前的緩衝區移到一個稱為kill-ring kill-ring 為一個變數的地方去。文件在緩衝區中是消失了,但卻儲存在 kill-ring ,variable這一個變數中。 EMACS 可以有許多的緩衝區,但卻只有一個 kill-ring 的儲存變數。也就是說,多個緩衝區彼此共享一個 kill-ring,而且也只有一個 kill-ring。 EMACS 所設計共享的 killing-ring 的用意是讓被遺棄的文件可以找回,而且各緩衝區彼此也可借由 killing-ring 來建立一個互通的管道。所謂的互通就是把甲緩衝區的東西給乙,反之,也可把乙緩衝區的東西給甲。此模式在 EMACS 中就是透過 killing-ring 來完成。因此,想從甲緩衝區中得到某些文件給乙緩衝區,只要將甲緩衝區的文件放入 kill-ring 中,乙緩衝區就可以至此共享的 kill-ring 中將文件取出。如此一來,就可以共享資源了。
另一種模式的刪除,在 EMACS 中稱為 deletion。此種刪除,並不將刪除後的資料放入 kill-ring 中,而是將刪除的文件遺棄。此種情形的刪除是無法失物復得的。以 deletion 刪除的資料,可以鍵入

Ctrl-x u(undo) 來找回。使用一次 `` Ctrl-x u,恢復前一個指令的景象;使用二次 Ctrl-x u,則恢復前二個指令的容貌,如此周而復始的使用 Ctrl-x u ,可恢復更改前的全貌。至於 `` Ctrl-x u'' 更詳細的說明會在 5.5 節進一步討論。
前已說過,不放入 kill-ring 的指令稱為 deletion 的指令。 EMACS 刪除字元、空白字元以及空白列的指令都不放入 kill-ring 中的。具體說來就是, Ctrl-d、 DEL、 Meta-\、 Meta-SPC 與 Ctrl-x Ctrl-o 等指令。 現就為各位說明這些指令。
文件的修改不是重組資料就是刪減與新增資料,新增資料已論述過了,而重組資料即將在 5.4 節登埸,現在就開始談文件的刪減。刪除文件也不外乎刪除一個字元、一個字、一行或一個區塊;刪除的方向可以選擇左右刪除的方式。現在就來看看如何以 EMACS 所提供的指令,來做刪除的工作。此處將刪減的指令分成 deletion 和 killing而大類。

* 屬於 deletion 的指令集
o 刪除「字元」(character)的方法
+ Ctrl-d(delete-char)
+ 刪除 point 所在位置的字元。 DEL(delete-backward-char)
刪除 point 之前的字元。 此指令與 Ctrl-d 為最基本的刪除指令,只要耐心夠,任何 的刪除都可以此二個指令完成。 刪除 spaces 和 tabs 的方法
o
+ Meta-\(delete-horizontal-space)
+ 輸入資料時,常會不自覺的輸入無意的空白(space)和 tab 。 當合併上下列而為一列時,也常會出現 space 或 tab 從中作梗。 為此 EMACS 提供了 Meta-\ 的指令,讓使用者可以很容易 將不必要的 space 和 tab 刪除。當然其它的刪除指令,也可以 將不需要的 space 和 tab 刪除,此指令只是更方便刪除 space 和 tab 而已。 Meta-\ 可刪除 point 前後所有的 space 和 tab 。 例如:abc def g,此時的游標在 f 與 g 之間。 鍵入了 Meta-\ 其結果如下所示: abc defg Meta-SPC(just-one-space)
刪除 point 前後的 space 和 tab 時,若希望留下一個 space 或 tab 做為彼此的分隔,就必須使用 `` Meta-SPC'' 來完成了。 例如:abc def g,此時的游標在 f 與 g 之間。 鍵入了 `` Meta-SPC 其結果如下所示: abc def g 屬於 killing的指令
*
o 刪除「字」(word)的方法
+ Meta-d(kill-word)
+ 此指令往前(右)刪除 point 所在位置的字。 其所刪除字的範圍端賴 point 所在的位置而有不同。 若point 在一個字的第一個字元,則會刪除此字;若 point 在此字的 其它位置,則刪除 point 所在位置及其之後的所有字元,包括 point 所在位 置的字元。 例(一): This is a test. 游標若在 test 這個字的 t 處,使用此指令的結果如下: This is a . 例(二): This is a test. 游標若在 test 這個字的 e 處,使用此指令的結果如下: This is a t. 若想刪除一個以上的字,可以使用 numeric argument 。 Meta-DEL(backward-kill-word)
此指令往回刪除 point 所在位置的字。 其所刪除字的範圍端賴 point 所在的位置而有不同。 若 point 在一個字的第一個字元,則會刪除此字之前的字; 若 point 在此字的其它位置,則刪除 point 之前的所有字元,但不包括 point 所在 位置的字元。 例(一): This is a test. 游標若在 test 這個字的 t 處,使用此指令的結果如下: This is test. 例(二): This is a test. 游標若在 test 這個字的 e 處,使用此指令的結果如下: This is a est. 同樣的,回想一下 numeric argument 吧。
o 刪除列的方法
+ Ctrl-k(kill-line)
+ 刪除列的指令。所刪除列的範圍,以 point 所在的位置為 準則, 以 point 所在位置為起始點,以此列的結束為終點。 被刪除掉的文件會在視窗上留下一空白,若想將空白列也一併刪除, 必需再使用一次 Ctrl-k。此時的 Ctrl-k 是用來刪除換列指令 的控制碼。 Ctrl-x Ctrl-o(delete-blank-lines)
編輯的過程中會不經意的加入許多空白列,此種情形常發生在 緩衝區的最尾端。每按下一個 RET ,就輸入了一個新列,但在緩衝區 的尾端按下 RET ,此時所加入的新列並不易為人查覺。此指令可以 將point所在位置「前後」的空白列刪除只留下一列。當然並非 一定要以此指令來刪除空白, Ctrl-k 自然也可以用來刪除空白列, 也可以將空白列以刪除區塊的方式刪除之,提供此指令只是方便滿足 使用者的需求而已。 刪除區塊的方法
o
*Ctrl-w (Kill-region) EMACS 允許刪除某一特定的區塊。要刪除區塊,必需先標示區塊, 此標示的動作稱為 mark\。如何標示區塊,就是下一節的主題。

EMACS 對於被 killing而刪除的資料,都是放在 kill-ring 中。 kill-ring 其實只是一個變數而已,所有 killing刪除掉的文件,就是此變數的值。其已述及查閱變數值的方法,現不厭其煩的再論述一次:

1. 鍵入 ``Ctrl-h v'' 後, echo area 處會出現:
2. 在 Describe variable:後輸入變數的名稱, EMACS 會另開一個 視窗來顯示此變數的值。此時所要鍵入的變數名為 ``kill-ring''

此節討論 EMACS 編輯的基本指令,有了這些指令之後,編輯的工作就不是難事了。接下來各節則討論其它的編輯功能。

何謂 Yanking

將 kill ring 的內容取出的動作,稱為 yank。 yank 除了可 yank 最新 killing 的資料,也可 yank 早先 killing的內容。現在就以二種不同的 yank 做為討論的對象。 將最新 killing的文件從 kill-ring中取出的方法很簡單,只要使用 `` Ctrl-y'' 即可。 但在 yank 時,一定要確保在 killing-ring 中存有被刪除的資料。 想要 yank 最新 killing之前的文件,就較為複雜了。所謂的較為複雜,只是多了一個移動指向 kill-ring 變數值的程序而已。因為 yank 指令所要yank 的內容,全視指標指向 kill-ring 的位置而定。此指標一般都是指向最新放入的文件。若想 yank 其它的內容,就必需先移動指標了。
移動 kill-ring 指標的方法是使用 `` Meta-y'' (yank-pop),但在使用 `` Meta-y'' 之前,一定要先使用 `` Ctrl-y''。 換言之, `` Meta-y'' 的使用,一定要緊跟在 `` Ctrl-y'' 之後。
`` Meta-y'' 的運作是將指向 kill-ring 入口的指標,向前移動,再將`` Ctrl-y'' yank 出來的資料 ,以此時指標指向的文件取而代之。這就是為何使用 `` Meta-y'' 指令之前,一定要先執行 `` Ctrl-y''。 以 `` Meta-y'' 來移動指標,並不會影響 kill-ring 變數值的內容次序。

如何在文件中做上標記

前面有些指令是專門運作區塊的,如 `` Ctrl-x Ctrl-p'' 與 `` Ctrl-w'' 等等。但什麼是區塊呢? EMACS 所言的區塊,是指從標記( mark)處到 point 所在位置間的範圍,此範圍就是區塊( region)了。換言之,區塊的範圍是指,標記所在位置之後(包括標記所在位置本身)到 point之前(不包括 point 所在的位置)的所有文件。知道區塊的定義後,接下來就介紹如何定義區塊了。
既然區塊是指從標記處到 point的範圍,自然設定區塊也意味著設定標記和 point。設定 point的方法很簡單,只要移動 point至目的地即可。此時的 point代表著區塊範圍的終點。至於設定標記的方法也不難,只要在想要設定標記的地方,輸入以下的任一個指令即可。

* Ctrl-@ (set-mark-command)
* Ctrl-SPC (set-mark-command)

所以設定區塊的步驟如下所示:

1. 設定區塊的始位置,也就是所謂的標記( mark)。
2. 可使用 `` Ctrl-@'' 或 `` Ctrl-SPC'' 任一個指令來設定標記。 設定區塊的終結位置,也就是移動游標至區塊的尾端。

在標記與 point之間的範圍就是所謂的區塊。
為何會提供二個設定標記的 Hotkey 呢? Hotkey 是用來連結 EMACS 的命令, EMACS 會將常用的命令給予一個 Hotkey 與之連結。此連結的Hotkey,常會受所使用的終端機而不同。因此有的終端機可以使用 `` Ctrl-@'',但有的終端機則必需使用 `` Ctrl-SPC''。更甚者,有的終端機卻二者都無法使用,例如筆者以個人電腦模擬成的終端機,卻必需鍵入 `` Ctrl-2'' 才能達到設定標記的效果。 EMACS 可以允許使用者重新設定所使用的 Hotkey ,但這已經超過本文討論的範圍。如果無法使用以上任何一個 Hotkey ,就使用命令

`` ESC-x set-mark-command''。

使用 EMACS 的指令( command)永遠可以達到目的的。
EMACS 的 point,是透過視窗上的游標來顯示的。 text-only 視窗只有一個游標,所無法同時表示標記及 point。若想觀測區塊的來龍去脈,可以 `` Ctrl-x Ctrl-x''

(exchange-point-and-mark)

將標記與point做交換,從交換的過程可以觀察標記與 point的位置。 `` Ctrl-x Ctrl-x'' 所能做的事,只互換標記與 point而已。
那些指令是使用在區塊上呢?以下指令就是適用在區塊上的。有些是曾經提過的,有些是將要談及的,有些可只能只是列舉出來並不會在本文中被討論。

* Ctrl-w(kill-region)
* Ctrl-x r s(copy-to-register)
* Ctrl-x Ctrl-p(mark-page)
* Ctrl-x Ctrl-l(downcase-region)
* Ctrl-x Ctrl-u(upcase-region)
* Meta-x fill-region
* Meta-x print-region

接下來討論與編輯有切身關係的搬移與拷貝。

文件的移動與拷貝

變換文件在緩衝區出現的位置稱為搬移(在緩衝區的其它地方重複出現稱為拷貝( Copy)。
前已論及放於 kill-ring 的文件,可在需要時拿出來使用,此動作稱為 yank\indexyank 。使用 yank 的方法很簡單,只要鍵入 ``Ctrl-x y''即可。使用此方法可將某特定區塊的文件做「搬移」的動作,只是所需的步驟比較煩瑣而已。首先將要搬移的文件重複以 `` Ctrl-x k'' 的指令,將其放入 kill-ring 中,再將 point 移至文件欲搬移的位置,以 `` Ctrl-y'' 將其 yank 出來。
「拷貝」一個區塊的方法與「搬移」一個區塊的方法累同,唯一不同是要執行二次 yank 。第一次使用 yank,是將刪除的原文件再放回被刪除的位置,第二次使用 yank 是做拷貝的動作,也就是將 kill-ring 的文件放入要拷貝的地方。
以上的方法當然可以用來做搬移和拷貝之用,但如要搬移和拷貝的文件有數十甚至數百數千列,豈不要重複 `` Ctrl-k'' 的動作數十甚至數百數千次。因為 `` Ctrl-k'' 基本上是刪除列的指令,當然刪除列的指令,可以配合 numeric argument。但在使用數值引數之前還必需確定所欲搬移或拷貝的確實列數,如此一來豈不使事情愈來愈複雜呢?所以,要搬移與拷貝文件最好的方法,就是使用標記與區塊。下面所談的是針對區塊的搬移與拷貝的方法。
不論搬移或拷貝,只要觸及區塊的使用,首要之事就是先把區塊標示出。區塊定好之後,要搬移就以 `` Ctrl-w'', 將整個區塊刪除之後,再以 `` Ctrl-y'' 將其 yank 出來。要拷貝則以 `` Meta-w'' 將區塊的內容拷貝一份放在 kill-ring 中,爾後再以 `` Ctrl-y'' 將其 yank 出來。現說明搬移與拷貝的實際操作過程。

* 不設定區塊,以刪列的方式,將文件一列列先刪除後,再 yank 出來。 此法可搬移與拷貝 kill-ring 內的文件。
1. 重複執行 `` Ctrl-k''(刪除文件,可使用 numeric argument)
2. Ctrl-y(將放置在 kill ring 中的文件,yank 至緩衝區內。)
o 若做搬移的動作,只需使用一次 yank。
o 若做拷貝的動作,則要使用二次的 yank。
* 以設定區塊的方式,「搬移」區塊的文字。
1. Ctrl-@(設標記,也就是設定區塊的起始值)
2. 移動游標以便設定 point的位置(設定區塊的終點)
3. Ctrl-w(刪除所標示的區塊)
4. 移動游標至要搬移的位置(確定文件搬移處)
5. Ctrl-y(將放置在 kill ring 中的文件,yank 至緩衝區內。)
* 以設定區塊的方式,「拷貝」區塊的文字。
1. Ctrl-@(設標記 (mark))
2. 移動游標以設定 point的位置(設定區塊的終點)
3. Meta-w(不刪除標示區塊的內容,將此內容拷貝至 kill-ring 中)
4. 移動游標至要拷貝的位置(確定文件拷貝處)
5. Ctrl-y(將放置在 kill-ring 中的文件,
yank 至緩衝區內。)

為了更清楚搬移與拷貝後的真實結果,現舉實例來說明。
實例:現有二段文件,第一段文字是做搬移與拷貝用的,第二段文字是用來接收搬移後的文字。 第一段:標記設在第一列的 A 處,而 point設在 B 的地方。 1111111111A22222222222 3333333333333333333333 4444444444444444444444 55555B5555555555555555 第二段: point在 Y 處 00000Y0000000000000000 0000000000000000000000 0000000000000000000000 結果一、將第一段的文件搬移至第二段,搬移後的游標仍在 Y 處。 1111111111B5555555555555555 00000A22222222222 3333333333333333333333 4444444444444444444444 55555Y0000000000000000 0000000000000000000000 0000000000000000000000 結果二、將第一段的文件拷貝至第二段,搬移後的游標仍在 Y 處。 1111111111A22222222222 3333333333333333333333 4444444444444444444444 55555B5555555555555555 00000A22222222222 3333333333333333333333 4444444444444444444444 55555Y0000000000000000 0000000000000000000000 0000000000000000000000 執行搬移與拷貝的動作時, EMACS 所採取的一律是 insert-mode。此時,即使設定為覆蓋( overwrite-mode),覆蓋的效果也會暫時失效。
區塊的範圍以標記(mark)為起始值,以 point所在位置之前的字元做結束。所以,從以上的實例可以很清礎的看到,搬移或拷貝之後的文件會包括標記所在的字元,但不會包含 point所在的字元。搬移或拷貝的文件會出現在 point之前,原先所有的文件會向後移動,此時的 point仍在移動前的字元處。
區塊是以標記為開始而以 point為終點所構成的。標記與 point所在的列,可能包含所在列的一部分,其它區塊所包含的列都是完整的一列。若搬移或拷貝的範圍,為文件中某一個長方形的區域,那該如何來設定其範圍呢?設定好的範圍又該如何來操作呢? EMACS 對於這種形狀的區域有其它的處理方式,稱為長方形的區塊 ( rectangle region)。
設定長方形( Rectangle)的方法與設定區塊( Region)的方法是一樣的,只是在理解上有所不同。長方形設定的方法,也是設定二個標記,此兩個標記位於長方形相對的兩個直角上。所以,設定了左上角,另一個標記一定要設在右下角;反之,如果設定了右上角,另一個標記就一定要在左下角了。。此所設好的長方形, EMACS 稱為 rectangle 。 長方形與區塊的設定方法是一樣,所以單從設定標記與 point的方式,是無法辨識二者的差別的。要知是使用區塊或長方形,只有等到使用運作於此範圍的指令時才會知道。 若是以刪除長方形的指令將長方形的區塊刪除時,此時刪除掉的長方形文件並不放在 一般的 kill-ring 中,而是放於別的地方。因為刪除長方形的運作方式與刪除區塊的方式不同,所以將長方形刪除後的內容,與放置區塊刪除後的內容分隔,以便管理。 長方形運作的種類與區塊運作的種類累同,可分為二大類,一類為刪除與插入,另一類則專門用來處理空白。 刪除長方形可以採取摒棄的方式( Ctrl-x r d)或將其儲存於某處( Ctrl-x r k),以利事後的 yank ( Ctrl-x r y) (yank-rectangle)。刪除掉的長方形資料的保存,只能保留最新刪除的資料,所以只有最新刪除掉的長方形資料,才可以被 yank 出來。
長方形區塊的運作種類,除了能將資料做刪除與搬移外,還可以在文件的某處加入固定區域的空白。因為從事編輯時,常需要在某一區域加入一些空白( Ctrl-x r o)(open-rectangle)。例如在文件加上空白做為邊緣(margin);製作圖表時留些空白;或將某一區域的文件以空白取代( Meta-x clear-rectangle)等等。長方形的運作與區塊的運作最大不同處在於,無法直接做拷貝的動作,若要拷貝必需先刪除後再執行二次的 yank。現在就說明長方形區域的用法。

* 長方形區域的 yank 方法
1. Ctrl-@(設定長方形區域的第一個對角)
2. 移動 point至第二個對角處(設定長方區域的第二個對角)
3. Ctrl-x r k(kill-rectangle)
4. 刪除設定好的長方形,以便 yank 使用。 移動 point到要 yank 的地方。
5. Ctrl-x r y(yank-rectangle)
將刪除的長方形,從儲存處取出。
* 永遠刪除長方形的內容
1. Ctrl-@(設定長方形區域的第一個對角)
2. 移動 point至第二個對角處(設定長方區域的第二個對角)
3. Ctrl-x r d(delete-rectangle)
刪除設定好的長方形區域。此刪除不會儲存在某一定地方。換言之, 一旦摒棄此區域,就無法將其喚回,除非使用 undo 的指令。 在長方形區域內插入空白,原文件向前(右)移動。
*
1. Ctrl-@(設定長方形區域的第一個對角)
2. 移動 point(設定長方區域第二個對角)
3. Ctrl-x r o(open-rectangle)
填入空白在設定好的長方形區域內。此時區塊內的文字會自動往右 移動。使用 overwrite mode,原有的文件也不會被加入的空白覆蓋。 將設定的長方形區域以空白覆蓋
*
1. Ctrl-@(設定長方形區域的第一個對角)
2. 移動 point至第二個對角處(設定長方區域第二個對角)
3. Meta-x clear-rectangle
將此長方形區塊內的文件以空白取代。 在設定的長方形區域內填充某一類型的字串。
* 此方法常可用在程式的撰寫或測試上。例如,測試 ``.emacs'' 程式時,常因測試的過程中,需要將設定做增減的工夫, 使用此方法可以隨時將測試條件做增減。
1. Ctrl-@(設定要填充字串的起點)
2. 移動 point至第二個對角處(設定要填充字串的終點)
3. 鍵入 Meta-x string-rectangle RET ,此時 echo area 會出現
String rectangle: 利用 minibuffer 鍵入要填充的字串,即可將字串填入長方形區內。 值得注意的是,此時長方形的寬度由字串的寬度來決定, Ctrl-@ 與 point只用來決定長方形的長度。

何謂 Undo

在 EMACS 中想要將已經做過的動作放棄,以恢復舊觀。 EMACS 將其稱為 undo,以下就介紹如何 undo:

* Ctrl-x u(undo)
* Ctrl-\_ (undo)

以上兩個 Hotkey 都是用來執行 undo 的指令。 提供二個 Hotkey,是因為有些鍵盤並無明顯使用 `` Ctrl-\_'' 的方法,為了瀰補無法以一個字元達到 undo 效果的鍵盤,故另行提供 `` Ctrl-x u'' 給無法使用 `` Ctrl-\_'' 的使用者。
EMACS 所提供的 undo,可以連續恢復最近使用過的指令。 undo 的順序是最新使用過的指令最先被 undo ,第二次使用 undo 則恢復第二新的指令,任何指令的輸入(除了 undo 本身之外)都會使指令輸入的順序 重整, 這也同時影響 undo 的順序。
使用 undo 有一個限制,就是 undo 只能 undo 對緩衝區內容造成改變的指令。對於只是改變游標動作的指令,是無法以 undo 來恢復舊觀。若所有修改過內容的指令,都以 undo 恢復原狀後,再一次使用 undo 的指令,echo area 會出現如下的訊息: no furter undo information 當使用了 undo 之後,還想要在 redo 這個已被 undo 的動作時,有一個技巧可以達成如此的效果。

1. 首先鍵入一個不會改變緩衝區內容的指令(如游標移動的指令),使原來
2. 存放指令的順序因新指令的加入而改變。 再使用一次 undo 的指令,就可以達到 redo 的效果了。

# 現舉一實例來說明此 > 視窗上現有的資料為: This is a test. 如下為所執行的一連串指令,括號內表示所用過的指令:

1. 執行四次 DEL ,視窗顯示如下的訊息:
2. This is a 所使用的指令集如下: DEL DEL DEL DEL 將游標至字元 ``i'' 處,視窗顯示的訊息並無改變:
3. This is a 所使用的指令集如下: DEL DEL DEL DEL 鍵入 Meta-d,視窗顯示如下的訊息:
4. This a 所使用的指令集如下: DEL DEL DEL DEL Meta-d 鍵入 Ctrl-x u,視窗顯示如下的訊:
5. This is a 此時恢復最新被使用過指令 ``Meta-d'' 前的狀況 (Ctrl-x u 不為恢復的對象),也就是步驟二的情形。 此時使用的過指令集如下: DEL DEL DEL DEL Meta-d Ctrl-x u 鍵入 Ctrl-f,視窗仍出現與先前相同的訊息:
6. This is a 所使用的指令集則增加如下: DEL DEL DEL DEL Meta-d Ctrl-x u Ctrl-f 此時可以 Ctrl-x u 恢復第一次 undo 前的狀況, 即步驟三的狀況。視窗出現:
This a 因為記錄指令歷史的指標,此時己在第二個 Ctrl-x u 處,但 Ctrl-x u Ctrl-f 均不在 undo 的行列中,所以此時可以再恢 復一次 Meta-d 前的狀況。 所使用的指令集如下: DEL DEL DEL DEL Meta-d Ctrl-x u Ctrl-f Ctrl-x u

一般而言,每一個使用過的編輯指令都有一個與之相對應的 undo 記錄。每一個 undo 的記錄,都只對目前的緩衝區有效。有的指令需要一個以上的 undo 記錄來完成 undo 的動作;有的指令會先匯集一群 undo 的記錄,當使用 undo 時,會將此匯集的結果一次展現出來。例如,單一字元運作的指令,若每次使用 undo ,只恢復一個字元則非常的不經濟,所以遇到此種情形,以集合體的方式處理是比較合理的作法。

回主選單

Weird Behave : PIC 18 READ PORTD is not the value as I write..

TRISD = 0; // output
PORTD = 0xFF; // set all pin high
regd = PORTD; // !!!! regd=0xF0, not 0xFF !!!

TRISD =0xFF ; // input
regs = PORTD; // read gain! , still the same !

Max提出的問題。
其實program成input後,PORTD讀到的是PortD後面接541的內容,雖然541 is not enabled !
用電表量PortD0-3,都是high,所以讀取內容與port狀態不符。

Problem Pending !

Tina's Class:

1.TP 系統概述。 -- Steven
2.Micro Controller概述。 -- Charles
3.Compiler-Assembler-Link & Execution。 -- Charles
4.Demo board電路講解。-- Steven
5.Install MPLAB & ICE。 -- Max
6.PIC 解說 - PIO部分`.
7.Program - DO - LED Flash1 設法讓一顆LED亮滅。
7.1 ICE & MPLAB解說,說明debug的方法。
8.Program - DO -霹靂燈。
9.Program - DI - Dip SW detection.
10.Program - DI - use Dip Sw to control the LED
11.Program - AD - Read one AD Channnel
12.Program - AD - use AD to control the LED
13.Program - PWM - ?
14.Program - PWM - map AD in to PWM.
15.Program - PWM - function generator.
16.PIC 解說 - Interrupt部分
17.Program - INT - AD interrput
18.PIC 解說 - RS232部分
19.Program - RS232 - TX, send 'A' out.
20.Program - RS232 - TX, send "Hello" out.
21.Program - RS232 - RX, use ICE to see the RX data

TODOs.. Tony Wu

Tony Wu want the AutoCL algorithm。
Hi Symeon,

I just rang you, but probably you left already.

The deviation range of the battery charging current for this system(MxS1800) is probably within +-5A because the tolerance of each rectifier currect is about 0.5A and there are 10 rectifiers maximally in the system. If the battery charing current is within the set value +-5A, the controller will keep the command as it is, otherwise the system may not be stable.

I'll discuss with engineer to see how we can minimize the deviation by revising the program if you think this is not acceptable.

Tomorrow Friday I'll be not in the office the whole day. You can reach me on my mobile which is +31 6 247 06 117.

Best regards,

Tony Wu

還有一件事忘了。

Typhone : Mindulle is... not comming.

都已經登陸了,這裡的天氣還是陽光照耀。
昨天台中還有焚風,氣溫破紀錄39.9 C。
======================================
中央氣象局 颱風警報單
發布時間:民國93年7月2日7時15分

警報種類:海上陸上颱風警報
颱 風 強 度 及 編 號:輕度颱風,編號第7號(國際命名:MINDULLE,中文譯名:敏督利)
警報報數:第 29-2 報
中心氣壓:980 百帕
目前時間:2 日 7 時
中心位置:北緯 25.0 度,東經 121.6 度,即在宜蘭的北北西方約30公里之處。
暴風半徑:七級風暴風半徑 200 公里,十級風暴風半徑 - 公里。
預 測 速 度 及 方 向:以每小時15公里速度,向北北東轉東北進行。
近 中 心 最 大 風 速:每秒28公尺(約每小時100公里),相當於10級風。
瞬 間 之 最 大 陣 風:每秒35公尺(約每小時130公里),相當於12級風。
預測時間:3 日 5 時
預測位置:北緯 27.7 度,東經 123.3 度,即在宜蘭的北北東方約370公里之海面上。
颱風動態:根據最新氣象資料顯示,颱風中心目前位於宜蘭北北西方處,繼續向北北東移動,未來有轉向東北且其強度有繼續減弱的趨勢。預計此颱風中心將於上午由台灣北部沿海一帶進入台灣北部海面。
警 戒 區 域 及 事 項:
陸上:宜蘭、基隆、台北、桃園、花蓮、台東、蘭嶼及綠島地區應嚴加戒備並防豪雨及強風。恆春半島、屏東、高雄、台南、南投及新竹地區亦應戒備。
海上:台灣北部海面、台灣東北部海面、台灣海峽及台灣東南部海面航行作業船隻應嚴加戒備。
注  意  事  項 :
1、苗栗、嘉義及中部地區亦有發生大雨或豪雨的機會,請注意。各山區應防坍方、落石、土石流;河川下游慎防山洪爆發及河水暴漲;低漥地區嚴防淹水。目前適逢大潮期間,民眾應注意並避免到海邊活動。
2、自6月30日0時至7月2日5時止各地出現較大累積雨量如下:
花蓮縣玉里645毫米、
台東縣成功477毫米、
屏東縣墾丁273毫米、
宜蘭縣太平山230毫米、
台北縣桶後163毫米。
出現較大陣風地區如下:
蘭嶼15級、花蓮13級、彭佳嶼13級、蘇澳11級、大武11級、成功11級。
========================================================

星期四, 7月 01, 2004

More on GMail

1.所有的mail會在All Mail。
2.所有的mail以”label"來標記。
3.Inbox也算是一個label,不過是特殊的label,永遠存在。新收到的Mail都會標記為inbox。
4.Archieve也是一個label,不過特殊的是Archieve的Mail不顯示,也沒有一個顯示出所有Archieve的Label。要看到Archieved Mail,只有到All Mail。
5.每一封Mail可以有多個label。

Konica-Minota X20 , Buy or not ?

4888 pchome.
200M
3X
Webcam.

要買?

Gmail Cannot display correct chinese characters on subjects..

從url寄的mail的中文主旨沒辦法正確顯示。
由url轉寄的mail就可以。

IBM Jikes Java Compiler -- Fast ARM-native Java compiler

Release Name: Rel 2

Notes: Repackaged Jikes java compiler for the Zaurus. Compiler now stripped to ~3MB, with license and installation + usage docs. Added Note: Amend the usage docs to reflect my new email address: JeffreyRFox@msn.com

--------------------------------------------------------------------------------

Changes: Rel 2 has all the functionality of Rel 1 at 1/4 the footprint. New docs make the process of installation clearer and gives usage notes on jikes and other onboard java compiler solutions for the Zaurus.

Description: Jikes is a java compiler in a single program file. It has been donated to the Open Source Communitee, and here compiled for the ARM/Linux architecture. Its advantage verses other compiler options for the Zaurus -- namely the Kopi and Sun's Javac java based compilers is speed of compilation, and lower memory required while compiling.. The resulting class files produced by all of these compilers are nearly identical.

Caveats: Sometimes there are differences between the output of the defferent compilers and it does count.

The Kopi Java Compiler Suite

The Kopi Java Compiler Suite
Release Name: Rel 1.1

Notes:
This is the Kopi java compiler package -- an "everything you need" for the development of java programs onboard the Zaurus; that is, everything that you need outside of the built in Intent java virtual machine and a good editor or the Qtopia text editor or vi. Here is the enclosed and updated/corrected Readme.txt:

Hey, I've packaged up here an open source GPL'd java compiler named Kopi together with the necessary "classes" file (this one from the author of the guavac java compiler) to make, together with an editor and the Insignia Jeode system on board the Z, the smallest java development system you are likely to find anywhere. And it works pretty well, and is particularly good for java beginner noodling and small java projects of the sort that you might want to enter on the Z's keyboard, and compile and run right on the PDA.
Installation:

Move the kjc-suite.jar and the gclasses.zip file over to the Zaurus by any means, and put them either on a flash card or on the ram disk, at, say /home/root. For example, I use the Z's ftp server (at port 4242) to put these files on my compact flash card at /mnt/cf. The Kopi.htm file could go too -- it describes the Kopi tools and how to envoke them and you can view it with the Opera browser on the Z.
Compiling a java program:

You can now create a java program with your favorite onboard editor -- the Qt text editor will do. For example:

class Hello{
public static void main(String[] args){
System.out.println("Hello Dogface!");
}
}

Then compile the program from the terminal app like this (all on one line, the prompt is already there):

bash-2.05# evm -cp /mnt/cf/kjc-suite.jar at.dms.kjc.Main -C/mnt/cf/gclasses.zip Hello.java

If it compiles without error, a new file, "Hello.class" will have been created, and you can then execute your new program with:

bash-2.05# evm Hello

and get the message that you've been waiting for all this time.
Caveats:

Well, a few things are missing and there are some minor problems with this solution, to wit:

1) You will not be able to compile a very large program in a single file this way -- there just isn't enough free memory on the Z. The limit is unknown, but I have had trouble at about 150k (with ROM 1.02). This is not usually a problem since if you typed 150k on the Z's keyboard, you would already be dead.

2) The class file is a "stubbed" file -- it only has in it the bare necessities and does not look at all like the thing you get from Sun in the jkd1.1.8 classes.zip file. So sometimes you can't compile something someone wrote long ago -- but that is the usual story with Java, despite the hype. I have run in to the occational missing constant. (Actually I have discovered that Kopi agrees with Jikes, the compiler from IBM, and that the javac compiler takes liberties.)

3) If you want the classes (timer stuff, mainly) that is in that part of personal java not in java 1.1.8, then you will have to get the pj.jar file from the appropriate place and presumably change the compiler argument from "-C/mnt/cf/gclasses.zip" to "-C/mnt/cf/gclasses.zip:/mnt/cf/pj.jar" or some such.

4) The compiler does not agree with Sun on everything in the java language -- for example, it thinks the 'default' clause should be after all 'case' clauses in the 'switch' statement. It will barf sometimes, but usually you will not think to fool it so.
Credits:

Well, the Kopi group has done a great job. Look for their site on the web. There is another fellow maintaining a separate compiler thread called Kopisusu, but I haven't tried it.

The gclasses file is from the guavac java compiler -- also on the web. There are other, similar, class files around. They solve the problem of the Sun file being 9 MB or so, and I can't stand that. There is one connected with the Kaffee project; and I guess I could make one the hard way, but this will do, and I thank he who made it. (But see below for other possibilities.)

Good luck java programmers!

Jeffrey R. Fox
JeffreyRFox@msn.com
distribution #2
12/10/03

P.S. A shell program ('jcc') to launch the compiler might contain the single line:

evm -cp /mnt/cf/kjc-suite.jar at.dms.jkc.Main -C/mnt/cf/gclasses.zip $@

Then

bash-2.05# . jcc Hello.java

compiles.

Using either Jikes or Kopi requires a "class library" in order to resolve references to the insignia Personal Java classes onboard the Zaurus. I have found no way to use the onboard core.jar and awt.jar file for this purpose. The simple and smallest solution is the included gclasses.zip. But another solution is to get the class library "rt.jar" from Sun's jre1.1.8 (i. e., the "java runtime environment 1.1.8" distribution package). I can't pack this for you without violating Sun's license, but all you have to do is go to:

http://java.sun.com/products/jdk/1.1/jre/download-jre-windows.html

and download the jre (we use 1.1.8 because that most closely matches the support on the Zaurus). (You could download the Solaris jre if you are using Linux on your PC.) Install it on your PC -- you only need one file ("rt.jar") -- ditch the rest 'cause it's way out of date.

More Notes: Using the real deal -- Sun's javac

You can also compile directly with Sun's javac on the Z, though jikes is both much faster (~10 times) and a little smaller (4.3 MB verses 4.8 MB for the minimal package). (Kopi is much smaller.) To use javac, you will need to download and install (on your PC) Sun's jdk1.1.8 development package, and then move the classes.zip file (and nothing else, unless you want to try the examples) from the lib directory to the Zaurus. To compile using javac, use:

evm -cp /mnt/cf/classes.zip sun.tools.javac.Main yourapp.java

This classes.zip file is almost 9 MB but it can be compressed -- do this with WinZip or with the JAR utility in the jdk (read the JAR doc) on your desktop before moving it to the Zaurus. The result is about 4.8 MB, and it works the same way.

Speaking of JAR, the classes.zip file has the functionality of JAR too (that is, of zip and unzip):

evm -cp /mnt/cf/classes.zip sun.tools.jar.Main

and there are other development tools in there too.

So now you know almost everything I have discovered so far. Kopi will work with rt.jar too, and that makes a little bit better compiler than it is with the enclosed, stubbed, classes.zip from the guavac distribution, but as packaged it works about as well as it is going to, which is fine for all but the most demanding of usage. Jikes seems to be the most memory efficient, but is too picky to be used with the stubbed classes.zip from guavac.

Install Instructions for ZGCC: GNU compiler collection on Zaurus

BLOG當抄寫簿好像也不錯。

Install Instructions for ZGCC: GNU compiler collection on Zaurus
First draft, February 15th, 2002
Updated March 15, 2003
Completely Revised for Release 2, November 4, 2003
Corrected with symbolic links for libc, libm Nov. 21, 2004 (thanks to respondent Uwe Koch)

Distribution version: 2.0

tracking GCC version 2.95.2

Hosting web site: http://community.zaurus.com
What it is:
Program development tools including all files necessary to do C and C++ language compiles, and to build complete Qt/E applications for the GUI built into the Zaurus PDAs and other devices (including make and the GDB debugger, and the moc and tmake Qt tools).
What is new in Release 2:
Releases 1 and 1.1 were based on gcc 2.95.1 to match the cross-compiling system distributed by Sharp and Trolltech, making presumably the most compatible system available. This release was built using gcc 2.95.2, with most components coming from the Debian Woody ARM distribution, to reduce storage (via smaller compiler executables and static libraries) and memory requirements to better fit the realities of the Zaurus, its built-in dynamic libraries, my personal needs, and my own "embedded system on-board compiling, debugging, and testing is good" mantra.

And this release adds the ability to design, compile, and test GPL'd Qt and Qtopia applications in ways that are arguably better, resource cheaper, and more convenient than any of the cross-compiler systems available. This Qt compilation system, based on the exploratory work of Jim Murff (via his "QtOntheZ" article), provides the Trolltech "moc" slot/signal precompiler, the Trolltech "tmake" project makefile builder (together with my custom template file), and the appropriate include files.

Finally, the GDB debugger and a number of other utilities have been added to make a more complete system.

The install has been simplified - zgcc is no longer required to live in the /usr directory hierarchy, and the problems with very many compiler related files showing up in the Qt "Documents" view is finally solved.

When stored on SD/MMC in its cramfs distribution format, it can be as small as 8 MBytes.

There are very few PDA based compiler systems with these abilities. This distribution has little that is Zaurus specific to it, however, and can probably be installed and used on a number of arm-linux devices with libc.so.6 support -- installation on Ipaq + linux would be an interesting test.

Limitations:

* only dynamic linking to the shared libraries in the Zaurus is directly supported - static libraries, with the exception of the C++ library, are not provided in order to save space.
* No Qt GUI design tool is included, and the use of the 'tmake' Qt makefile building tool will require the separate installation of a perl interpreter.
* GNU autoconfig/automake is not presently included, however the configure scripts of many GNU packages will run unaltered on this system.

Why:
Well, I want to do onboard C/C++ development and I can, and I also want to share. This system solves the problem of development for the Z without having a separate PC Linux + cross compiler setup.

Requirements:

You will need to have some version of the console or terminal application installed -- the newest version of embeddedKonsole from one of the Zaurus program archives (such as www.zauruszone.com) is a good choice, but the terminal application built in to the 5000D and available on the CD included with other ZaurUS Models will suffice.

You will need about 23 Mbyte of storage for the full, uncompressed compiler system, or about 8 Mbytes of storage (on Ramdisk or SD/MMC) if you use the system in the mountable compressed cramfs volumes in which I am putting the distribution (the files "zgcc2Bin.cramfs" and "zgcc2Inc.cramfs"). The separate documentation cramfs volume (zgcc2Doc.cramfs) requires another 15 Mbytes uncompressed, or about 5 Mbytes if mounted compressed. You may, of course, opt to remove the Qt and/or the C++ capabilities to save space; C++ programmers will certainly regard the separate C compiler as superfluous.

Performance:
The compiler runs at about 1/3 to 1/4 as fast as x86 Linux on a 366 MHz Pentium II. The performance of the resulting executables shows a similar performance ratio (with no floating point code). This is a fast compiler, and this setup is capable of building large progams. (The test machine is a 206 mhz 5000D.)

Issues:
You must have sufficiant space in /tmp to hold the intermediate files during the compile. If you set up a very large swap file, use a ROM configuration with little available Ramdisk space, or fill up your Ramdisk with installed apps, this may be a problem. (See, however, the use of the TMPDIR environmental variable in the gcc documentation.)

The compiler, although involving a large executables, does not appear to have particularly problematical memory usage, and could, if you were pressed for executable memory, be used without starting the Qt GUI.

Compilation of Qt projects will severly tax the free execution RAM on Zaurii such as the 5000D -- the use of a ROM image with the largest executable memory partition is recommended.

Caveats:
Well, I have been able to build quite a few large C, C++ and Qt applications using these tools. My system is a 5000D with a 256 Mb Viking CF card in VFAT format and a 64 Mb Lexar SD card in ext2 format. Zgcc has been run extensively from the CF card uncompressed, and also from the SD card in the compressed cramfs format. I know that the C++ compiler has some issues with respect to exception handling accross C calls to shared libs -- see the docs/README.bugs file -- and I do little STL or template based programming, so there may be issues there. Further, the pared libc.so on the Zaurus is not the libc that the tools were built against, so there may be glitches left to uncover. I did leave out the standard configuration files for "make" and a lot of unnecessary other fluff that you may depend on -- you will need to find those things elsewhere and add it back in. The executables and libraries have been stripped of debugging info, and that may injure your use of GDB.

The "include" files were plucked from the cross-compiler distribution, but that means that they are not completely compatible with the more exacting C syntax rules of the new compiler. I have already corrected one such glitch and there may be more. If you run accross one of my hacks -- they are obvious and usually marked with "foxd" in a comment -- you may need to change something to get a compile.

License:
Go to www.gnu.org (or look in the included docs) to review the appropriate license for the compiler suite. I believe this distribution is in complience, but could stand correction if someone knows better. The Qt license has recently changed to be the GPL license for the header files I believe -- see http://www.trolltech.com for information on the status of the Qt/E Free SDK license if you wish to distribute Qt applications built usng the Qt tools and headers distributed here. To build your very own commercial Qt applications and make a fortune, you will at least need to buy the Qtopia commercial SDK (~$200) from Trolltech.

Installation overview:

One of the primary design goals of this release is improved management of the large number of files, reduction of large static storage requirements, and simplification of the configuration with respect to the situation in earlier releases. Specifically:

* By using mountable cramfs volume images, two-thirds of the uncompressed size of the full zgcc system can be saved without any loss of functionality.
* By using gcc's environmental variables to signal to the compiler the appropriate places to search for executables, libraries and include files, it becomes possible to avoid linking them into the /usr hierarchy they would usually inhabit.
* By hiding the root directories of the compiler by the common means of prefixing the directory names with a period -- e. g. "/mnt/card/.zgcc" and "/mnt/card/.include" -- the Qt document discovery method will not see the profusion of files associated with the compiler.

Option 1 -- Install the cramfs volumes:

Put the zgcc2Bin.cramfs and zgcc2Inc.cramfs files on your SD/MMC media (as, say, /mnt/card/zgcc2Bin.cramfs and /mnt/card/zgcc2Inc.bin), or, if you have room in Ramdisk, as, say, /home/QtPalmtop/share/zgcc2Bin.cramfs, etc.

Create subdirectories to be your mount points in the same place -- e. g.

mkdir /mnt/card/.zgcc

and

mkdir /mnt/card/.include

(Using subdirectories starting with a dot will prevent the Qt document-centric infrastucture and the Qt Filemanager from seeing them.)

Write a script (in your $PATH) to mount your volumes -- e. g. "mntzgcc.sh" containing:

mount -t cramfs /mnt/card/zgcc2Bin.cramfs /mnt/card/.zgcc -o loop
mount -t cramfs /mnt/card/zgcc2Inc.cramfs /mnt/card/.include -o loop

Running this script from the console command line with

source mntzgcc.sh

should successfully mount the volumes and make all of the compilers files visible via "ls /mnt/card/.zgcc", "ls /mnt/card/.include", etc.

Note that the Zaurus has only two loop devices (/dev/loop0 and /dev/loop1) set up in its default configuration. You can set up more -- use the command

mknod /dev/loop2 b 7 2

to make /dev/loop2 and

mknod /dev/loop[n] b 7 [n]

for the general case (up to n = 7, the presumed max). These will stick around until a reboot.

Option 2 -- Uncompressed Install:

To set up standard uncompressed directories, and presuming you have the necessary space (23+ meg), first mount as above from some convenient place in your system -- that could be a CF card temporarily for this operation. Once mounted, copy the contents from the mounted directories to your chosen install directories. For example to unpack "/mnt/cf/tmp/zgcc2Bin.cramfs" to "/mnt/cf/.zgcc" do

mkdir ztmp
mount -t cramfs /mnt/cf/tmp/zgcc2Bin.cramfs ztmp -o loop
mkdir /mnt/cf/.zgcc
cp -R ztmp/* /mnt/cf/.zgcc
umount ztmp
rm -r ztmp

And then do the same type of operation on zgcc2Inc.cramfs. After verifying that the contents of a cramfs volume have been correctly copied, you may, of course, delete the cramfs file.

Configuring the Compiler:

Now we need another script -- which should be launched by ~/.profile whenever bash starts. I call this script zgcc.sh (a copy of this script is in the "bin" directory for your reference) and it contains:

export GCC_EXEC_PREFIX=/mnt/card/.zgcc/lib/gcc-lib/arm-linux/2.95.2/
export COMPILER_PATH=/mnt/card/.zgcc/bin:/mnt/card/.zgcc/lib/gcc-lib/arm-linux/2.95.2/
export CPATH=/mnt/card/.include/
export LIBRARY_PATH=/mnt/card/.zgcc/lib/:/mnt/card/.zgcc/lib/gcc-lib/arm-linux/2.95.2/:/lib/:/home/QtPalmtop/lib/
export CPLUS_INCLUDE_PATH=/mnt/card/.include/g++-3/
PATH=/mnt/card/.zgcc/bin:$PATH
export PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/card/.zgcc/lib
export LD_LIBRARY_PATH
TMAKEPATH="/mnt/card/.zgcc/tmake/lib/sharp-onboard/"
export TMAKEPATH
ln -sf /lib/libc.so.6 /usr/lib/libc.so
ln -sf /lib/libm.so.6 /usr/lib/libm.so
ln -sf /mnt/card/.zgcc/bin/libstdc++-3-libc6.1-2-2.10.0.so /home/QtPalmtop/lib/libstdc++-libc6.2-2.so.3

This script could be run either manually preceding your compile, or by placing a line like

source zgcc.sh

in your ~/.profile script. I have it in my ~/.bashrc, which is in turn called by my ~/.profile. Its purpose is to allow the compiler stages and the "tmake" and "moc" tools to find their libraries, companion programs, and include files.

You are now ready to compile -- for example, with a file "foo.c" containing:

#include
#include
int main ()
{
double x = 123.456;
printf("sin(%f) = %f\n",x,sin(x));
}

compile with

gcc -o foo -lm foo.c

and execute (if it compiles without problems):


./foo

The 'make' utility is also included.
Configuring for Qt/E compilation:
If you want to compile Qt GUI applications, you have another choice to make. You can get the full benefit of the automated build process provided by Trolltech's tmake utility only if you install a version of the perl interpreter since tmake is a perl script. The present alternative is to make your Makfiles manually -- and I will give you some tips on that in a moment.

I have perl 5.6.1 installed and it looks like the whole thing is about 5 megs. -- sheesh. Well this is something we can hope to get fixed since Trolltech has already seen the light and made a new utilty -- qmake -- that is C++ based and could be statically compiled for our use.

Anyway, once you have a perl 5.x installed, you may need to edit both the first line of the tmake executable to point to your perl installation, and the tmake/lib/sharp-onboard/tmake.conf file to point to your Qt include files. If you are using the cramfs volumes, then editing also involves moving these file elsewhere (since the cramfs volumes are read-only). The TMAKEPATH environmental variable must point to the sharp-onboard directory whither you put it. You need only edit the tmake.conf file if you put the base of the Qt include files somewhere other than /mnt/card/.include/Qtopia. (Note that the Qt/E include files are in a subdirectory named "qte".)

The Trolltech utility "moc" also requires configuration, again because I have not succeded in compiling it specifically for our environment. The version I have included is dynamically linked against something called "libstdc++-libc6.2-2.so.3", which I don't have and will not work linked to a dynamic version of the static C++ library that I have chosen for the C++ compiler, so I have placed another apparently compatible dynamic library in the bin directory and the last line of the zgcc.sh script above forms the necessary symbolic link so that "moc" can find this library. This another kludge that we can hope to remove later.

I have included a simple Qt demo application in the "tmake/example" directory so that you can test your setup. Before you start playing around with it, copy this directory off to your work area. If you have installed perl, you should be able to use tmake to build your Makefile, and then compile:

perl /mnt/card/.zgcc/bin/tmake hello.pro>Makefile

or, if the first line of the tmake script points to your perl installation,


tmake hello.pro > Makefile

then

make
./hello

This test should confirm, on a succesful build of the executable "hello", all of the Qt and C++ settings.

If you wish to dispense with perl and tmake, you must make your Qt application makefiles manually. The Makefile in the tmake/example directory may serve as a template. The key ingredient that distinguishes Qt makefiles from those of standard C++ compilation is the appearence of the Q_OBJECT macro in a header or source file and the subsequent call to the "moc" preprocessor in the makefile to generate code for the signal/slot callback construct. Each file containing the macro must be processed by moc, and the resultant output files then compiled by g++. In the example, hello.h contains the macro, moc produces moc_hello.cpp, which is then compiled and linked into the executable.
Concluding remarks:
It's still too big damn big. Off of the full uncompressed install at about 23 Mb, you could do the following:

If you do not care to compile in the pure "C" of the default GNU C compiler (one can compile most C programs with the C++ compiler) you could pitch the gcc, c89 and cc1 programs saving 2 meg.

If you are not interested in Qt programming, delete the .include/Qtopia include file directory, moc and the supporting libstdc++-3-libc6.1-2-2.10.0.so shared library, and everything to do with tmake. This would save approximately 3Mb.

If you only want C programming capabilities, you could dump all of the Qt pieces and then cull the include/g++-3 directory, the g++ and cc1plus executables, and the libstdc++.a static library. That would save maybe 8 Mb in all.

Finally, you could take an axe to all those include files that surely are never used, but you would have to know what you are doing.

Note: several other packagers have made cramfs images for SD/MMC cards, but no cramfs volumes appear to work on CF cards because of unforgiving nature of the "unmount on suspend" behaviour of the Zaurus. My cramfs volumes suffer the same flaw -- if you need to put zgcc on a CF card then it should be uncompressed as detailed below. (I do hope a reader of this document can suggest an acceptable solution to this problem.)
Changing the contents of a cramfs volume:
Changing the contents of the cramfs volumes -- either to correct or add/remove funtionality -- will require that you uncompress first since these volumes are "read only" when mounted. I have added a copy of the "mkcramfs" program so that you can make new cramfs volumes. As an example of the syntax, I used a command like

mkcramfs /mmt/cf/.zgcc zgcc2Bin.cramfs

to make the cramfs mountable file "zgcc2Bin.cramfs" from the "/mnt/cf/.zgcc" directory. (Note: I fear that the advertised "insert file" capability of this version of "mkcramfs" is missleadingly documented or broken.)
To Do:

There will always be glitches to fix and utilities to add -- find my revision control system (RCS) elsewhere, and perhaps I will put out a build of "ctags" some time -- but the addition of a graphical design tool is probably what is needed most. This is a tool -- Qt Designer being an example -- that lets you precisly and graphically place widgets in a form so that your application windows have a polished "designed" look. There are several third party open source tools that could be ported to the Z.

If anyone can come up with a useful design tool, or merely compile qmake or moc properly for the Z, I will put together a new release with appropriate credit given.
Postscript:

Hey, this might not work do to my goof or yours so email me with your results and problems and suggestions and brickbats (Nerf only). I am really an unrecalcitrant Forth programmer, and will not be able to help you with the trickeries of C++ or Qt. I put the HTML version of Bruce Eckels' Thinking in C++ in my flash card and read along using Opera until the memory gives out.

Cheers,

Jeffrey R. Fox

Manitou Springs, CO

JeffreyRFox@msn.com

or, if that fails, JRFox@Adelphia.net

SPI not work !

當初計劃使用SPI作Main CPU & AD CPU的介面。
結果clk無法匹配起來。
M5272..... : 66M,slowest - 129k
PIC16C773. : 16M, ?

網誌存檔