漢辰攻略

          The palest ink is better than the best memory.

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            8 Posts :: 1 Stories :: 3 Comments :: 0 Trackbacks

          2008年7月28日 #

        1. C-j: Insert a new line with the same indentation level as the current line
        2. RET: Insert a new line with the same indentation level as the current line
        3. C-M-a: Go to the beginning of the current function or class
        4. C-M-e: Go to the end of the current function or class
        5. C-M-h: Mark the current function or class for copying, etc.
        6. C-M-x: Execute the current function or class
        7. C-c C-b: Submit a bug report
        8. C-c C-c: Execute the buffer (i.e., the file being displayed)
        9. C-c C-d: Trace the stack of the process being executed
        10. C-c C-h: Get context-based help
        11. C-c TAB: Indent a highlighted (or marked) region
        12. C-c C-k: Mark a block of text. Using this at the head of a class or function definition will mark the entire block.
        13. C-c C-l: Shift the region to the left. If the cursor is in the middle of a region, the lower half of the region will shift.
        14. C-c RET: Execute the current file, opening a new window to show the output.
        15. C-c C-n: Jump to the next statement.
        16. C-c C-p: Jump to the previous statement.
        17. C-c C-r: Shift the region to the right. If the cursor is in the middle of a region, the lower half of the region will shift.
        18. C-c C-s: Execute a Python command.
        19. C-c C-t: Toggle shells
        20. C-c C-u: Go up one block
        21. C-c C-v: List the version of the Python mode
        22. C-c C-w: Run PyChecker
        23. C-c !: Open the Python interactive shell
        24. C-c #: Comment the highlighted (marked) region
        25. C-c :: Check the indentation off-set
        26. C-c <: Shift the region to the left
        27. C-c >: Shift the region to the right
        28. C-c ?: Show Python mode documentation
        29. C-c |: Execute the highlighted (marked) part of the current program.
        30. posted @ 2008-11-12 14:11 漢辰 閱讀(1071) | 評論 (0)編輯 收藏

          --XX:+DoEscapeAnalysis, off by default
          如果一個對象的所有引用都是限于某一局部范圍,去掉對象上的鎖
          --XX:+UseBiasedLocking, on by default
          對多次取鎖的操作,比如循環(huán),不釋放Lease即使鎖已被釋放,避免費時的取Lease操作 (最有效)
          --XX:+EliminateLocks, on by default
          如果一段代碼經(jīng)常性的加鎖和解鎖,在解鎖與下次加鎖之間又沒干什么事情,則可以將多次加加鎖解鎖操作合并成一對。也稱為Lock Coarsening (鎖粗化)

          http://www.infoq.com/articles/java-threading-optimizations-p1
          posted @ 2008-10-30 15:33 漢辰 閱讀(672) | 評論 (0)編輯 收藏

          python 有str object 和 unicode object 兩種字符串, 都可以存放字符的字節(jié)編碼,但是他們是不同的type,這一點很重要,也是為什么會有encode 和decode。

          encode 和 decode在pyhton 中的意義可表示為

                                                                            encode
                                                        unicode -------------------------> str
                                                        unicode <--------------------------str
                                                                            decode
          幾種常用法:
          str_string.decode('codec') 是把str_string轉(zhuǎn)換為unicode_string, codec是源str_string的編碼方式
          unicode_string.encode('codec') 是把unicode_string 轉(zhuǎn)換為str_string,codec是目標(biāo)str_string的編碼方式
          str_string.decode('from_codec').encode('to_codec') 可實現(xiàn)不同編碼的str_string之間的轉(zhuǎn)換
          比如:

          >>> t='長城'
          >>> t
          '\xb3\xa4\xb3\xc7'
          >>> t.decode('gb2312').encode('utf-8')
          '\xe9\x95\xbf\xe5\x9f\x8e'

          str_string.encode('codec') 是先調(diào)用系統(tǒng)的缺省codec去把str_string轉(zhuǎn)換為unicode_string,然后用encode的參數(shù)codec去轉(zhuǎn)換為最終的str_string. 相當(dāng)于str_string.decode('sys_codec').encode('codec')。

          unicode_string.decode('codec') 基本沒有意義,unicode 在python里只用一種unicode編碼,UTF16或者UTF32(編譯python時就已經(jīng)確定),沒有編碼轉(zhuǎn)換的需要。 

          注:缺省codec在site-packages下的sitecustomize.py文件中指定,比如

          import sys
          sys.setdefaultencoding(
          'utf-8')



           

          posted @ 2008-09-09 15:49 漢辰 閱讀(13138) | 評論 (1)編輯 收藏

          慕名Emacs是很久的事了,上個周末Google了一天終于把它在Windows下的中文化問題初步解決了。

          網(wǎng)上講述Emacs中文問題的帖子很多,不過很多是過時的或不完整的,并以Linux下居多。很多.emacs設(shè)置看起來發(fā)生了作用,但是在我的機器上不是顯示方塊,就是半個中文字符。前者懷疑未配置好Emacs使其無法讀取系統(tǒng)字體,后者懷疑字符寬度設(shè)置還有問題,苦于無暇深究。

          最后找到一篇Emacs 中文化指南[http://17xie.com/read-103809.html],講述了在Windows下使用了X11的BDF字體配置Emacs的過程,下載安裝了intlfont,改了相應(yīng)的emacs設(shè)置,Bingo!!!,一試就通。不過字庫還是GB2312的,想把Mule-GBK 和BDF 字體配置在一起,未成功。

          貼張圖慶賀一下
          posted @ 2008-07-28 13:47 漢辰 閱讀(941) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 长垣县| 锡林郭勒盟| 会同县| 洛宁县| 岳普湖县| 巩义市| 武平县| 蓬溪县| 遂宁市| 皋兰县| 武定县| 会昌县| 玉树县| 丹东市| 依兰县| 西乡县| 谷城县| 沽源县| 鱼台县| 麻阳| 三门峡市| 岳普湖县| 边坝县| 秦皇岛市| 兰考县| 嘉峪关市| 海林市| 德州市| 和平县| 高台县| 宜兰县| 巴里| 南安市| 紫金县| 习水县| 贺州市| 辰溪县| 灯塔市| 宽甸| 广东省| 无棣县|