人們日常所犯的最大的錯誤,是對陌生人太客氣,而對最親密的人太苛刻,把這個壞習慣改過來,天下太平。
posted @
2010-10-11 18:00 Klarke 閱讀(63) |
評論 (0) |
編輯 收藏
“勝利往往來自于再堅持一下之后”。有時候,好像已經走到了絕境,以為再也沒有希望了,但是如果再堅持一下,再堅持一下,往往就看到了勝利的曙光。
posted @
2010-09-28 12:20 Klarke 閱讀(137) |
評論 (0) |
編輯 收藏
1.量詞:
一個量化元字符是由一個元字符后面緊接著一個簡單的量詞組成,如果沒有量詞,就只匹配這個元字符,量詞如下:
*
匹配0個或多個元字符的序列
+
匹配1個或多個元字符的序列
?
匹配0個或1個元字符的序列
{m}
嚴格匹配m個元字符的序列
{m,}
匹配m個或多個元字符的序列
{m,n}
匹配m個到n個元字符的序列
*? +? ?? {m}? {m,}? {m,n}?
非貪婪量詞,與貪婪量詞匹配的方式相同,但是非貪婪兩次只匹配最少能匹配到的序列,而貪婪匹配需要匹配最多能匹配的序列。
使用{和}的形式需要受限,m和n必須是無符號整數,取值在0到255之間。
2.元字符:
元字符是以下幾種形式:
(re) 將一個元字符括起來(re是任意正則表達式)。
(?:re) 與上面相同,但是不報告(不捕獲括號的配置)
() 匹配一個空字符串
(?:) 與上面相同,但是不報告
[chars] 一個中括號表達式,匹配任何一個chars中的字符。
. 匹配任意一個字符
\k 匹配非字母和數字字符
\c 匹配escape項目中所羅列的字符
{ 當后面不是數字時,匹配"{",當后面跟著數字時,是一個量詞范圍的開始(只支持AREs)
x 當x是一個字符時就匹配這個字符
約束 在特定的條件下約束匹配一個空字符串,約束的后面不能是量詞,簡單的約束如下,其它的在ESCAPES之后介紹:
^ 在字符串的開頭匹配
$ 在字符串的結尾匹配
(?=re) 向前肯定,匹配任何以re開始的子字符串。
(?!re) 向前否定,匹配任何不以re開始的子字符串。
向前約束可能不包含向后,所有的括號都不捕獲。
一個正則表達式不能夠以"\"結尾。
posted @
2010-09-26 17:46 Klarke 閱讀(139) |
評論 (0) |
編輯 收藏
The regexp Command
The regexp command provides direct access to the regular expression matcher. Not only does it tell you whether a string matches a pattern, it can also extract one or more matching substrings. The return value is 1 if some part of the string matches the pattern; it is 0 otherwise. Its syntax is:
regexp ?flags? pattern string ?match sub1 sub2...?
The flags are described in Table 11-6:
Table 11-6. Options to the regexp command
-nocase
|
Lowercase characters in pattern can match either lowercase or uppercase letters in string.
|
-indices
|
The match variables each contain a pair of numbers that are in indices delimiting the match within string. Otherwise, the matching string itself is copied into the match variables.
|
-expanded
|
The pattern uses the expanded syntax discussed on page 154.
|
-line
|
The same as specifying both -lineanchor and -linestop.
|
-lineanchor
|
Change the behavior of ^ and $ so they are line-oriented as discussed on page 153.
|
-linestop
|
Change matching so that . and character classes do not match newlines as discussed on page 153.
|
-about
|
Useful for debugging. It returns information about the pattern instead of trying to match it against the input.
|
--
|
Signals the end of the options. You must use this if your pattern begins with -.
|
The pattern argument is a regular expression as described earlier. If string matches pattern, then regexp stores the results of the match in the variables provided. These match variables are optional. If present, match is set to the part of the string that matched the pattern. The remaining variables are set to the substrings of string that matched the corresponding subpatterns in pattern. The correspondence is based on the order of left parentheses in the pattern to avoid ambiguities that can arise from nested subpatterns.
Example 11-2 uses regexp to pick the hostname out of the DISPLAY environment variable, which has the form:
hostname:display.screen
Example 11-2 Using regular expressions to parse a string
set env(DISPLAY) sage:0.1
regexp {([^:]*):} $env(DISPLAY) match host
=> 1
set match
=> sage:
set host
=> sage
The pattern involves a complementary set, [^:], to match anything except a colon. It uses repetition, *, to repeat that zero or more times. It groups that part into a subexpression with parentheses. The literal colon ensures that the DISPLAY value matches the format we expect. The part of the string that matches the complete pattern is stored into the match variable. The part that matches the subpattern is stored into host. The whole pattern has been grouped with braces to quote the square brackets. Without braces it would be:
regexp (\[^:\]*): $env(DISPLAY) match host
With advanced regular expressions the nongreedy quantifier *? can replace the complementary set:
regexp (.*?): $env(DISPLAY) match host
This is quite a powerful statement, and it is efficient. If we had only had the string command to work with, we would have needed to resort to the following, which takes roughly twice as long to interpret:
set i [string first : $env(DISPLAY)]
if {$i >= 0} {
set host [string range $env(DISPLAY) 0 [expr $i-1]]
}
A Pattern to Match URLs
Example 11-3 demonstrates a pattern with several subpatterns that extract the different parts of a URL. There are lots of subpatterns, and you can determine which match variable is associated with which subpattern by counting the left parenthesis. The pattern will be discussed in more detail after the example:
Example 11-3 A pattern to match URLs
set url http://www.beedub.com:80/index.html
regexp {([^:]+)://([^:/]+)(:([0-9]+))?(/.*)} $url \
match protocol server x port path
=> 1
set match
=> http://www.beedub.com:80/index.html
set protocol
=> http
set server
=> www.beedub.com
set x
=> :80
set port
=> 80
set path
=> /index.html
Let's look at the pattern one piece at a time. The first part looks for the protocol, which is separated by a colon from the rest of the URL. The first part of the pattern is one or more characters that are not a colon, followed by a colon. This matches the http: part of the URL:
[^:]+:
Using nongreedy +? quantifier, you could also write that as:
.+?:
The next part of the pattern looks for the server name, which comes after two slashes. The server name is followed either by a colon and a port number, or by a slash. The pattern uses a complementary set that specifies one or more characters that are not a colon or a slash. This matches the //www.beedub.com part of the URL:
//[^:/]+
The port number is optional, so a subpattern is delimited with parentheses and followed by a question mark. An additional set of parentheses are added to capture the port number without the leading colon. This matches the :80 part of the URL:
(:([0-9]+))?
The last part of the pattern is everything else, starting with a slash. This matches the /index.html part of the URL:
/.*
|
Use subpatterns to parse strings.
|
To make this pattern really useful, we delimit several subpatterns with parentheses:
([^:]+)://([^:/]+)(:([0-9]+))?(/.*)
These parentheses do not change the way the pattern matches. Only the optional port number really needs the parentheses in this example. However, the regexp command gives us access to the strings that match these subpatterns. In one step regexp can test for a valid URL and divide it into the protocol part, the server, the port, and the trailing path.
The parentheses around the port number include the : before the digits. We've used a dummy variable that gets the : and the port number, and another match variable that just gets the port number. By using noncapturing parentheses in advanced regular expressions, we can eliminate the unused match variable. We can also replace both complementary character sets with a nongreedy .+? match. Example 11-4 shows this variation:
Example 11-4 An advanced regular expression to match URLs
set url http://www.beedub.com:80/book/
regexp {(.+?)://(.+?)(?::([0-9]+))?(/.*)$} $url \
match protocol server port path
=> 1
set match
=> http://www.beedub.com:80/book/
set protocol
=> http
set server
=> www.beedub.com
set port
=> 80
set path
=> /book/
Bugs When Mixing Greedy and Non-Greedy Quantifiers
If you have a regular expression pattern that uses both greedy and non-greedy quantifiers, then you can quickly run into trouble. The problem is that in complex cases there can be ambiguous ways to resolve the quantifiers. Unfortunately, what happens in practice is that Tcl tends to make all the quantifiers either greedy, or all of them non-greedy. Example 11-4 has a $ at the end to force the last greedy term to go to the end of the string. In theory, the greediness of the last subpattern should match all the characters out to the end of the string. In practice, Tcl makes all the quantifiers non-greedy, so the anchor is necessary to force the pattern to match to the end of the string.
Sample Regular Expressions
The table in this section lists regular expressions as you would use them in Tcl commands. Most are quoted with curly braces to turn off the special meaning of square brackets and dollar signs. Other patterns are grouped with double quotes and use backslash quoting because the patterns include backslash sequences like \n and \t. In Tcl 8.0 and earlier, these must be substituted by Tcl before the regexp command is called. In these cases, the equivalent advanced regular expression is also shown.
Table 11-7. Sample regular expressions
{^[yY]}
|
Begins with y or Y, as in a Yes answer.
|
{^(yes|YES|Yes)$}
|
Exactly "yes", "Yes", or "YES".
|
{^[^ \t:\]+:}
|
Begins with colon-delimited field that has no spaces or tabs.
|
{^\S+?:}
|
Same as above, using \S for "not space".
|
"^\[ \t]*$"
|
A string of all spaces or tabs.
|
{(?n)^\s*$}
|
A blank line using newline sensitive mode.
|
"(\n|^)\[^\n\]*(\n|$)"
|
A blank line, the hard way.
|
{^[A-Za-z]+$}
|
Only letters.
|
{^[[:alpha:]]+$}
|
Only letters, the Unicode way.
|
{[A-Za-z0-9_]+}
|
Letters, digits, and the underscore.
|
{\w+}
|
Letters, digits, and the underscore using \w.
|
{[][${}\\]}
|
The set of Tcl special characters: ] [ $ { } \
|
"\[^\n\]*\n"
|
Everything up to a newline.
|
{.*?\n}
|
Everything up to a newline using nongreedy *?
|
{\.}
|
A period.
|
{[][$^?+*()|\\]}
|
The set of regular expression special characters:
] [ $ ^ ? + * ( ) | \
|
<H1>(.*?)</H1>
|
An H1 HTML tag. The subpattern matches the string between the tags.
|
<!--.*?-->
|
HTML comments.
|
{[0-9a-hA-H][0-9a-hA-H]}
|
2 hex digits.
|
{[[:xdigit:]]{2}}
|
2 hex digits, using advanced regular expressions.
|
{\d{1,3}}
|
1 to 3 digits, using advanced regular expressions.
|
posted @
2010-09-26 17:22 Klarke 閱讀(494) |
評論 (0) |
編輯 收藏
RC:Release Candidate
Candidate是候選人的意思,用在軟件上就是候選版本。Release.Candidate.就是發行候選版本。和Beta版最大的差別在于Beta階段會一直加入新的功能,但是到了RC版本,幾乎就不會加入新的功能了,而主要著重于除錯!
RTM:Release to Manufacture
是給工廠大量壓片的版本,內容跟正式版是一樣的,不過RTM.也有出120天評估版。但是說RTM.是測試版是錯的。正式在零售商店上架前,是不是需要一段時間來壓片,包裝、配銷呢?所以程序代碼必須在正式發行前一段時間就要完成,這個完成的程序代碼叫做Final.Code,這次Windows.XP開發完成,外國媒體用WindowsXP.goes.gold來稱呼。程序代碼開發完成之后,要將母片送到工廠大量壓片,這個版本就叫做RTM版。所以說,RTM版的程序碼一定和正式版一 樣。但是和正式版也有不一樣的地方:例如正式版中的OEM不能升級安裝,升級版要全新安裝的話會檢查舊版操作系統光盤等,這些就是RTM和正式版不同的地方,但是它們的主要程序代碼都是一樣的。
posted @
2010-09-25 10:44 Klarke 閱讀(139) |
評論 (0) |
編輯 收藏
1.Update your .cshrc to source the p4.cshrc
setenv P4SITE sjc
source /icd/socesrc/bin/p4.cshrc
2.Present yourself
p4 user
3.Login (need to be done on each site)
p4 login -a
4.Check basic commands
p4 info
p4 help
p4 help client
5.Launch the P4 GUI
p4v
feco -11.1 edi11.1
http://quark
posted @
2010-09-20 10:56 Klarke 閱讀(155) |
評論 (0) |
編輯 收藏
-
TCL內建命令
字符串操作
- append - 在變量后添加變量
- binary - 從二進制字符串中插入或釋放數值
- format - 使用sprintf的風格格式化一個字符串
- re_syntax - Tcl正則表達式語法
- regexp - 對正則表達式匹配器直接存取字符串
- regsub - 基于正則表達式的模式匹配完成替換
- scan - 使用指定的sscanf風格轉換解析字符串
- string - 操作字符串
- subst - 完成反斜線、命令和變量替換
-
- concat - 將多個列表合并成一個列表
- join - 把列表元素合并成一個字符串
- lappend - 將元素添加到列表末尾
- lassign - 將列表元素賦值給變量
- lindex - 從列表中獲得一個元素
- linsert - 向列表插入一個元素
- list - 創建一個列表
- llength - 計算列表的元素個數
- lrange - 返回列表中的一個或者多個臨近的元素
- lrepeat - 使用重復的元素構造一個列表
- lreplace - 在一個列表中使用新的元素替代其它元素
- lreverse - 反轉列表元素的順序
- lsearch - 在列表中尋找特定元素
- lset - 修改列表中的一個元素
- lsort - 給列表中的元素排序
- split - 將字符串分解成Tcl列表
-
-
-
- dict - 操作字典
-
-
- expr - 求一個數學表達式的值
- mathfunc - Tcl數學表達式的數學函數
- mathop - Tcl命令的數學操作符
-
-
- after - 設置將來執行的命令
- break - 中斷循環
- catch - 返回異常錯誤
- continue - 進入下一個循環
- error - 產生一個錯誤
- eval - 調用一個Tcl腳本
- for - 'For' 循環
- foreach - 反復循環操作一個或多個列表的每個元素
- if - 執行一個條件腳本
- return - 從進程中返回或者返回一個值
- switch - 根據一個特定的值,指定幾個腳本中的一個
- update - 處理掛起的時間和空閑回調
- uplevel - 在不同的堆棧層中執行一個腳本
- vwait - 一直等待直到一個變量被修改為止
- while - 重復的執行腳本直到條件不匹配
-
-
- apply - 申請一個匿名函數
- array - 處理數組變量
- global - 存取全局變量
- incr - 增加變量的值
- namespace - 創建和操作命令和變量的上下文
- proc - 創建一個Tcl過程
- rename - 重新命名或者刪除一個命令
- set - 讀寫變量
- trace - 監視變量存取、命令用法和執行
- unset - 刪除變量
- upvar - 在不同的堆棧層中創建一個變量的鏈接
- variable - 創建和初始化一個名字空間變量
-
輸入和輸出
-
- chan - 讀寫和操作I/O通道
- close - 關閉一個打開的I/O通道
- eof - 檢查文件是否結束
- fblocked - 測試I/O通道是否將數據準備好
- fconfigure - 設置和查詢I/O通道的屬性
- fcopy - 把一個I/O通道數據復制到另外一個I/O通道
- file - 操作文件名和屬性
- fileevent - 在I/O通道準備好處理讀寫事件時執行一個腳本
- flush - 清空緩存輸出I/O通道數據
- gets - 從I/O通道中讀取一行
- open - 打開一個文件或命令管道
- puts - 向I/O通道寫入數據
- read - 從I/O通道讀出數據
- refchan - 反射I/O通道的命令句柄API,版本1
- seek - 設置I/O通道的存取偏移量
- socket - 打開一條TCP網絡連接
- tell - 返回I/O通道的當前存取偏移量
-
-
- load - 裝載機器代碼和初始化新命令
- loadTk - 裝載TK到一個安全解釋器
- package - 裝載包和包的版本控制
- pkg::create - 為給出包描述構造是個適當的'package ifneeded'命令
- pkg_mkIndex - 為自動裝載的包創建一個索引
- source - 將一個文件或者資源作為Tcl腳本運行
- tm - 方便的查找和裝載Tcl模塊
- unload - 卸載機器代碼
-
-
- bgerror - 調用命令處理后臺錯誤
- history - 操作歷史命令列表
- info - 返回Tcl解釋器的狀態信息
- interp - 創建并操作Tcl解釋器
- memory - 控制Tcl內存調試能力
- unknown - 處理未知命令
-
-
- encoding - 編碼處理
- http - 客戶端執行的HTTP/1.0協議
- msgcat - Tcl消息目錄
- platform. - 系統支持的編碼和相關應用程序
- platform.:shell - 系統支持的編碼和相關應用程序
-
-
- cd - 改變工作目錄
- clock - 獲取和操作日期與時間
- exec - 調用子過程
- exit - 退出應用程序
- glob - 返回模式匹配的文件名
- pid - 獲得進程ID
- pwd - 返回當前工作目錄的絕對路徑
- time - 計算一個腳本的執行時間
-
-
- dde - 執行一個動態數據交換命令
- registry - 操作windows注冊表
posted @
2010-09-19 10:55 Klarke 閱讀(2075) |
評論 (0) |
編輯 收藏
sequential-mode
parallel-mode
autoTrial
user-set option combination FPS: FloorPLanSynthesis
posted @
2010-09-14 11:15 Klarke 閱讀(109) |
評論 (0) |
編輯 收藏
SA: Simulated Annealing
MCP: Min-Cut Placement
FDP: Force Directed Placement
posted @
2010-09-14 11:09 Klarke 閱讀(151) |
評論 (0) |
編輯 收藏
EDI: Encounter Digital Implementation
CTS: Clock Tree Synthesis
WNS: Worst Negative Slack
TNS: Total Negative Slack
ECO: Engineering Change Order
Reassembly:
STA sign-off: Static Timing Analysis
DRC sign-off: Design Rule Checking
DRV sign-off: Design Rule Verification
LVS sign-off: Layout Versus Schematic-Electronic Circut Verification
OCV: Open Circut Voltage
IPO: In Place Optimization
FCPA: Foreign Corrupt Practices Act
NUMA: Non Uniform Memory Access
MIB: Mixed Interface Bloblet
LSF: Load Sharing Facility
Silicon Signoff and Verification (SSV)
Encounter Timing System (ETS)
Encounter Power System (EPS)
Physical Verification System (PVS)
posted @
2010-09-14 11:07 Klarke 閱讀(345) |
評論 (0) |
編輯 收藏