pretty code

2008年10月15日 星期三

FLASH 概述

NAND FLASH

block > page > sector

1 page = xxx byte(data field) + xxx byte(oob-檢驗碼、訊息)

讀寫以 page 為單位
erase 以 block 為單位
//---------------------------------------------------------------------------------
新的 NOR Flash

page 中又有多個 sector

SLC 寫入以 sector
MLC 寫入以 page


NOR Flash 不允許有壞軌(bad blocks)
NAND Flash 第0軌以外可以允許有壞軌

快速關閉 Windows 服務

sc /?

將下列寫成批次檔,就可以不用進服務去改。
sc stop [sevice name]

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\[service name]

ex:ntrtscan (OfficeScanNT RealTime Scan)

2008年9月29日 星期一

Global 使用說明

1.下載 win32版本
http://www.geocities.com/jadoxa/global/index.html

2.切到 source code root 目錄下

3.set path=e:\Global\bin

4.執行 gtags ,會在 2 的目錄下產生相關檔案。

5.執行 htags 搭配相關參數,便能產生你要的網頁。

htags -s
會產生變數的參照,方便尋找變數的宣告位置。

htags -a
會產生函數的參照,方便尋找函數的呼叫位置。

小型專案可以考慮 htags -sna
大型專案建議使用 htags -na


`-v', `--verbose'
Verbose mode.

`-s', `--symbol'
Make anchors not only for object definitions and references but also other symbols.

`-a', `--alphabet'
Make an alphabetical function index which is suitable for a large project.

`-n', `--line-number'[=columns]
Print line numbers. By default, doesn't print line numbers. The default value of columns is 4.

`-o', `--other'
Pick up not only source files but also other files except for binary files.

`-h', `--func-header'[=position]
Insert function header for each function. By default, htags doesn't generates it. You can specify the position using position argument, which allows one of before, right and after. The default position is after.

`-T', `--table-flist'[=fields]
Generate file list using tag. The fields is used for field number in a line. The default is 5.

`-F', `--frame'
Use frame for each part of the contents.

`-f', `--form'
Support search form using CGI program. You need to set up a web server, and you cannot move the hypertext from the source directory.

2008年9月2日 星期二

makefile 概述



如果 make 後面不指定 makefile name(gnu make use -f)
則預設使用當前路徑下的 makefile。

如果 make 後面不加 target
則預設去找第一個(本例的 test)
故只會印出 Just Test 的字串。

一般來說會將 all 擺在第一個
也就是預設 make 是做 make all。

make all 的順序:
1. 先找 mytest 的 target。
2. 做 mytest 前必須要有 main.o, TestDef.o。
3. 找到 main.o 的 target。
4. 做該 target 的事。
5. 找到 TestDef.o 的 target。
6. 做該 target 的事。
7. 最後做 mytest 要做的事,編出 mytest 的執行檔。

一些符號的意義:

- 表示忽略錯誤
@ 表示不印出訊息

以下來自 "http://www.study-area.org/cyril/opentools/opentools/x1176.html"

%.o: %.c

%表示所有相對於後面先決條件的檔名的意思,他不是*,因為他有一對一的相對應關係,foo.o 就要找foo.c。

foo.o: foo.c foo.h

$@ -- foo.o
$* -- 這個只有在內隱規則中有用。表示樣式或副檔名規則中對應到的字串。
$< -- foo.c
$? -- 同一個規則的所有先決條件名,但是只有原始程式碼改過的比 obj 檔新才會符合,也就是比 target 還新的先決條件檔案。
$^-- 所有先決條件,但是有的 make 像 solaris make 可能不認得這個自動變數。

2008年6月27日 星期五

交易日誌格式

交易日期:

代碼:

張數:

交易類型:做多

買入價:

買入理由:

初始止損價:

目標:

賣出日期:

賣出價格: 

賣出理由:

結果:

錯誤一:

錯誤二:

錯誤三:

2008年6月19日 星期四

正峰工交易記錄

1538, +1, 27.75

購買原因

1.見 20080617 - 正峰工預測 該篇文章。

後記:

1538, -1, 28.7

賣出原因

1.對自己不是很有信心。
2.好久沒有勝的感覺,想先入袋為安。

-> +783。

結論:

1.這是一個失敗的交易,策略不正確贏錢也沒什麼好高興。
2.以後交易日誌必需寫清楚出場價格。
3.贏錢還是會覺得高興,需儘早消除這種感覺,金錢只是交易策略成功的附屬品,重點是交易策略的執行。

2008年6月18日 星期三

中序轉後序

陸續發了幾篇文章
都沒有跟程式有關的
剛好最近在看程式的書
裡面提到中序轉後序的做法
這是一個計算機裡面很重要的觀念
把他記錄起來以後才不會忘記

ex: (a+b-c+d*e*(f+g))*(h-i)/j

秘訣:從括號先做,遇到優先順序高的先做優先順序高的。

1. ab+
2. ab+c-
3. ab+c-de*
4. ab+c-de*fg+ (f+g的+)
5. ab+c-de*fg+* (e*(f+g)的*)
6. ab+c-de*fg+*+ (+d*e的+)
7. ab+c-de*fg+*+hi-
8. ab+c-de*fg+*+hi-* (*(h-i)的*)
9. ab+c-de*fg+*+hi-*j/