2/14/2020

Lock removal of schematic / symbol in Cadence database

Change directory to the path of the Cadence library.
Issue the command below:

find . -name "*.oa.cdslck" -exec rm -f {} \;

1/16/2018

Using sed to extract the netlist of a specific subcircuit


sed -n "/^\.SUBCKT ZLSABIAS_M\b/,/^\.ENDS/p" zl64k4at.cir > netlist.ZLSABIAS_M

-n tells sed to suppress the automatic printing of the pattern space.

This above sed script dumps the lines between the patterns 
   ".SUBCKT ZLSABIAS_M" at the begging of lines (using \b to match a word boundary), and 
   ".ENDS" at the beginning of lines 
of the netlist file zl64k4at.cir to file
netlist.ZLSABIAS_M. 

1/09/2018

Change (or set) the title of an xterm in csh alias


# alias stitle 'set title=\!*; echo -n "\033]0;${title}\007"'
alias stitle 'echo -n "\033]0;\!:1\007"'

Additional notes:

   !! is the whole command line
   !* is all the arguments of the command
   !:1 is the first argument of the command
   !:2 is the second argument of the command (, and so forth)
   !$ is the last argument of the command

12/29/2017

Windows 7 讓系統不進入休眠

選擇
控制台 系統安全性 電源選項


 
然後 mouse click on 「儲存變更

3/02/2016

讓電子書中黏在一起的對話分開



  有些電子書由於排版格式不佳,難以閱讀。有時候,書中的對話句子會黏 () 在一起,讓一段文字變得太長。可以用以下 regular expression routine 對段落加以調整。
Part 1: Calibre recursively 執行以下的 find-and-replace routine:



將單一字串中一句結束 (即以 , , , … 或下引號 (”) 任何一個特殊字作為區別字元) 之後,立刻用上引號後再接任何字串這樣的 pattern 上引號為分界,拆為兩段。
其中 "calibre 2" 代表某種 style class,可用任何其他的 class 的名字取代。

Part 2: Calibre recursively 執行以下的 find-and-replace routine:





將單一字串中一句結束 (以。”, ”, …” 作為區別,即以特殊標點符號再加上下引號兩個字元一起作為區別字元) 之後,後面跟著一個字元以上的任何字串這樣的 pattern ,以特殊標點符號再加上引號為分界,拆為兩段。


8/19/2015

將中文電子書 (epub 格式) 編排成豎版



/* 豎體排版 */
html {
        writing-mode: vertical-rl;
        -webkit-writing-mode: vertical-rl;
        -epub-writing-mode: vertical-rl;
        -epub-line-break: strict;
        line-break: strict;
        -epub-word-break: normal;
        word-break: normal;
}
body中下邊距縮進一個字元,避免行尾最後的一個標點會被吃掉(即會無法顯示)
body {
         word-break: normal;
         margin: 0;
         margin-left: 0%;
         margin-right: 0%;
         margin-top: 1.5%;
         margin-bottom: 1em;
         text-align: left;
}
製作電子書目錄,可以通過編輯TOCncx來更改目錄資訊,並生成html目錄,也可以連結到CSS樣式表中。

I. 元數據編輯器中,語言一欄可以是「中文」或者「中文-臺灣」。這裡有一些特別不同之處。
如果是使用預設字體不添加自訂字體時,豎排電子書建議將語言設定為「中文-臺灣」,在content.opf檔中,屬性為zh-TW。這樣做的好處是,橫排標點會自動轉換為豎排標點,無需要將原始檔中的橫排標點進行轉換,並且標點會自動置中,看起來比較美觀。但也有一個缺點,在Kindle閱讀器上,只會顯示「宋體」和「黑體」兩種字體選項,也不能使用自訂字體樣式。
II. 如果需要添加添加自訂字體時,可以設定為語言設定為「中文」,content.opf檔中屬性為zh,好處是完整利用到Kindle閱讀器的四種字體和自訂字體,缺點是需要先行轉換橫排標點為豎排,且標點可能無法居中對齊。
III. 模仿古籍書從右往左翻,在content.opf 檔案中編輯,,加上page-progression-direction="rtl"的內容,變成

添加KindleGen轉換時識別豎排的屬性。在content.opf文件中添加,,

支援日語垂直渲染和多種頁面書寫模式。可以使用元標籤,在 OPF 檔中指定值(例如:)。有效值有 horizontal-lrvertical-lrhorizontal-rlvertical-rl
Enabled support for JP vertical rendering and multiple writing modes. Values can be specified in OPF files using meta tags (ex: ). The valid values are horizontal-lr, vertical-lr, horizontal-rl, vertical-rl.
並且難以用CSS來定義邊距。使用了這個屬性後,文檔左右邊距會使用預設值,上下邊距可以自行調整(CSS屬性:margin-topmargin-bottom)。

檢查EPUB檔有沒有報錯,如果有錯,可以將錯誤的網頁另存為xhtml,上傳到 The W3C Markup Validation Service 進行驗證和修改。

EPUB檔拖到Kindle Previewer進行轉換和查看效果,如果有不滿意的地方,再回到EPUB當中修改。

正式輸出MOBI文檔。方法有兩種:
I.          通過命令列視窗使用KindleGen加上相關參數轉換成MOBI檔,或者通過Kindle Previewer得出轉換的檔(但檔比較大,kindlegen 默認會把轉換原始檔案即epub檔添加到生成的 mobi 裡面)。
II.        使用sigil外掛程式kindlegen,把參數設定好(外掛程式設置C:\Users\用戶名\AppData\Local\sigil- ebook\sigil\plugins\kindlegen\kindlegen.ini),就能得到比較滿意的AZW3文件。

最後可以把製作完成的AZW3檔放到Kindle閱讀器上,與原書或PDF進一步查看效果和校對有關的錯誤。