<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 53, 文章 - 0, 評論 - 3, 引用 - 0
    數據加載中……

    Tomcat Source Code Reading

    0. I am reading the source code of Tomcat 6.0.26. To pay off the effort,
    I documents some notes for record. Thanks for the articles about Tomcat
    source code, especially the book <<How Tomcat works>>.

    1. They are two concepts about server, one is called Server, which
    is for managing the Tomcat (start and stop); another is called Connector,
    which is the server to serve the application request. they are on the different
    ports. The server.xml clearly show the difference.

    <Server port="8005" shutdown="SHUTDOWN">
      <Service name="Catalina">
        <Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    although the server is the top level element, logically it should not be.
    Actually in code, Bootstrap starts the service first, which
    in turn start the Server and server's services.

    2. My focus in on Connector part. I care how the request is services by the
    Tomcat. Here are some key classes.

    Connector --> ProtocolHandler (HttpProtocol
                            and AjpProtocol)                       --> JIoEndPoint
                                                                               --> Handler(Http11ConnectionHandler
                                                                               and AjpConnectionHandler)
                                                      
                                                      
    3. Connector is most obervious class, but the entry point is not here.
    The sequence is like this.

    Connector.Acceptor.run()
    --> JioEndPoint.processSocke(Socket socket)
        -->SockeProcess.run()
            -->Http11ConnectorHandler.process(Socket socket)
                -->Http11Processor.process(Socket socket)
                    -->CoyoteAdapter.service(Request req, Response res)       

    The core logic is in method Http11Processor.process(Socket socket)                                                  

    CoyoteAdapter.service(Request req, Response res) bridges between Connector module and Container module.

    Any comments are welcome. I may continue the source code reading and dig deeper into it if time permit.


    posted @ 2010-03-30 17:11 InPractice 閱讀(607) | 評論 (0)編輯 收藏

    Navigate forth and back with ctrl+] and ctrl+t in Cscope

    It is handy to be able to navigate the source code with Ctrl + ] in Cscope, but I always forget how to navigate back and waste effort many times. So for record, Ctrl+t can navigate back in Cscope.

    One more time, Ctrl+] and Ctrl+t can navigate forth and back in Cscope.

    posted @ 2010-03-29 14:20 InPractice 閱讀(288) | 評論 (0)編輯 收藏

    Learning Notes of TCP/IP Illustated Volume 2

    How to read the source code in <<TCP/IP Illustrated Volume 2>>

    1. Get the source code, original link provided in the book is not available now.
    You may need to google it.

    2. install cscope and vi.

    3. refer to http://cscope.sourceforge.net/large_projects.html for the following steps.

    It will include all the source code of the whole OS, not only the kernel.
    find src -name '*.[ch]' > cscope.files

    we actually only care kernel source.
    find src/sys -name '*.[ch]' > cscope.files

    4.  wc cscope.files
     1613  1613 45585 cscope.files

    5. vim
    :help cscope
    then you can read the help details.

    6. if you run vim in the folder where cscope.out resides. then it will be loaded
    automaically.

    7. Try a few commands.
    :cs find g mbuf
    :cs find f vm.h

    They works. A good start.

    P.S. this book is quite old, if you know it well and can recommend some better alternative for learning TCP/IP, please post a comments, Thanks in advance.


    posted @ 2010-03-29 13:30 InPractice 閱讀(134) | 評論 (0)編輯 收藏

    童趣

    我兒子在彈鋼琴,他阿姨說,“哥哥就喜歡彈難的。”
    我外甥女說:“哥哥要彈男的。妹妹要彈女的。”

    posted @ 2010-03-26 14:41 InPractice 閱讀(108) | 評論 (0)編輯 收藏

    幼稚的關于尋找素數的猜測

    在高中的時候,知道了用篩法可以得到素數。當時我還有一個錯誤的關于尋找素數的猜測。
    以為用兩個素數相乘,其附近存在素數的幾率很高。比如, 7×11 = 77, 其附近有79,正好是素數。
    當時已經發現11×11=121。7×17=119;但是錯誤的理解為只有其中一個是平方或次冪時才成立。
    后來有了計算機,編程驗證了一下,發現有很多的反例。對當初的錯誤猜測羞赧不已。


    這個猜測雖然錯的離譜,但是和現在的素數理論,尤其是孿生素數還是很有關系的。現在已經知道,
    素數有無窮多個,但是素數在自然數中所占的比例逐漸趨近于零。

    因此孿生素數在自然數中的比例也是趨近于零的。現在還沒有證明孿生素數是否有無窮多個。

    這個猜測的樸素之處在于,任何兩個素數之乘積A,要么A是3n+2,要么A是3n+1;如果是3n+2,則只有A+2
    才有可能是素數;如果是3n+1,則只有A-2才有可能是素數。但是,事實上,這個猜測成立的比例非常的低。

    寫了一個程序驗證了一下。16位的整數中,大概只有 10% 能使假設成立。

    posted @ 2010-03-26 14:37 InPractice 閱讀(135) | 評論 (0)編輯 收藏

    在Proxy環境中使用GIT需要解決的問題.

    由于是在Proxy的網絡環境,MSYSGIT 的 git clone 總是失敗。需要配置如下環境變量。
    export http_proxy="http://<proxy domain name>:<port>"
    之后http協議git clone沒有任何問題。但是用git 協議仍舊有問題。

    之后發現git push 和 git pull 經常不能work。多次嘗試后發現用更全的命令行參數可以解決問題。
    過程如下。

    git pull --fail
    git pull origin --fail
    git pull  git@github.com:ueddieu/mmix.git --it works.

    It seems the Command line short cuts are lack of some user information, such as user name "git".
    (which is kind of strange at the first glance.)

    git push --fail
    git push origin --fail
    git push git@github.com:ueddieu/mmix.git master --it works.

    Anyway, now I can check in code smoothly. :)

    posted @ 2009-12-31 17:13 InPractice 閱讀(823) | 評論 (1)編輯 收藏

    Trouble caused by un-visible blank character

    There are a few cases in which the un-visible blank character will cause
    problem, but it is hard to detect since they are not visible.

    One famous case is the '\t' character used by Make file, it is used to mark
    the start of a command. If it is replace by blank space character, it does
    not work, but you can not see the difference if you only look at the make file.
    This kind of problem may get the newbies crazy.

    Last week, I have encounter a similar issue, which is also caused by unnecessary
     blank space.
     
    As you may know, '\' is used as line-continuation when you have a very long line, e.g.
    when you configure the class path for Java in a property file, you may have something like this.

    classpath=/lib/A.jar;/lib/B.jar;\
    /lib/C.jar;/lib/D.jar;\
    /lib/E.jar;/lib/log4j.jar;\
    /lib/F.jar;/lib/httpclient.jar;

    But if you add extra blank space after the '\', then you can not get the complete
    content of classpath. Because only when '\' is followed by a '\n' on Unix or '\r''\n'
    on Windows, it will work as line-continuation ; otherwise, e.g '\' is followed by
    ' ''\n', the line is complete after the '\n', the content after that will be the start of
    a new line.

    Fortunately, it is easy to check this kind of extra blank space by using vi in Unix.
    use command '$' to go to the end of line, if there is no extra blank space after '\',
    the current position should be '\', if there are any blank space after '\', the current position
    is after the '\'.
     

    posted @ 2009-07-01 11:48 InPractice 閱讀(177) | 評論 (0)編輯 收藏

    媽媽和兒子

    媽媽和兒子
    媽媽,你最近不吃魚,變笨了吧――2009.6.2

    兒子又要求錄音了。我們按著臺詞在dialog。
    “……”兒子
    “……,I like mangoes”媽媽
    “媽媽,我昨天剛教會你,又忘了?是I like watermelon。”
    “哦,媽媽現在記性不好了!”
    “是你這幾天不吃魚了吧,變笨了吧。明天多吃點!”

    媽媽你穿這衣服蠻可愛――2009-6-9晚
    兒子挑選的故事講完了。“好,ok,我們睡覺吧!”我說。
    “唉,媽媽,還沒錄音呢,我去拿mp3。”自從第一次提議給他錄音,兒子每天都要求我能做到。
    ……
    “……,媽媽,你蠻可愛的!……”錄音正起勁,兒子突然插了一句題外話。
    “什么?”我沒聽清。
    “你穿這衣服蠻可愛的!”兒子賊賊的笑著又重復了一遍。“因為你的衣服象小斑馬呀!”我終于明白。


    posted @ 2009-06-10 14:26 InPractice 閱讀(174) | 評論 (0)編輯 收藏

    安裝openldap遇到的一個小問題。

    我安裝openldap時主要是參考了http://hexstar.javaeye.com/blog/271912

    我遇到的一個新問題是執行ldapsearch報錯如下:
    can not find libdb-4.7.so.
    我的解決辦法是,建立符號鏈接/usr/lib/libdb-4.7.so, 后者指向/usr/local/BerkeleyDB/lib/libdb-4.7.so
    之后沒有遇到其他問題。

    posted @ 2009-05-29 10:33 InPractice 閱讀(133) | 評論 (0)編輯 收藏

    和兒子一起長大

    凡事都有其內在原因,即使是表面上毫無道理的行為,也有其內在的原因。今天再次認識到這個

    道理,還是因為今天早上和我兒子的一段插曲。

     

    今天早上,我兒子不肯起床,在床上哭鬧,不讓他媽媽去上班,要他媽媽陪他睡覺。

    他媽媽要趕班車,沒時間陪她,留我在家里。我陪他睡了一會,聊了十分鐘,才知道他是有原因

    的。

     

    昨天晚上,我和她媽媽都很累,我就說今天我們早點睡覺,和兒子一起睡好了。可是因為剛剛

    回上海,有很多事情要做,最后還是忙到十點半才睡。兒子就說爸爸說謊了。當然他可能還有

    其它的原因,比如想我們每天和他一起睡覺。

    posted @ 2009-02-03 15:46 InPractice 閱讀(98) | 評論 (0)編輯 收藏

    僅列出標題
    共6頁: 上一頁 1 2 3 4 5 6 下一頁 
    主站蜘蛛池模板: 国产精品小视频免费无限app | 91精品免费不卡在线观看| gogo全球高清大胆亚洲| 亚洲国产美女精品久久久| 好男人视频社区精品免费| 亚洲精品第一综合99久久| 午夜视频在线观看免费完整版| 亚洲综合色7777情网站777| 青青久在线视频免费观看| 亚洲熟女综合一区二区三区| 毛片免费观看视频| 亚洲av永久无码| 大胆亚洲人体视频| 久久九九久精品国产免费直播| 亚洲精品白浆高清久久久久久 | 久久精品国产亚洲AV麻豆网站 | 国产L精品国产亚洲区久久| selaoban在线视频免费精品| 亚洲熟伦熟女新五十路熟妇| 日韩精品无码免费专区网站| 色播亚洲视频在线观看| 无码日韩人妻av一区免费| 亚洲国产AV一区二区三区四区| 亚洲Av无码乱码在线观看性色 | 国产成人va亚洲电影| 亚洲精品美女久久久久99小说| 久草免费福利在线| 久久亚洲国产精品成人AV秋霞| 麻豆视频免费观看| 激情吃奶吻胸免费视频xxxx| 亚洲尤码不卡AV麻豆| 国拍在线精品视频免费观看 | 国产精品免费一区二区三区| 久久亚洲精品国产精品| 日本免费的一级v一片| 热99RE久久精品这里都是精品免费 | 亚洲av无码一区二区三区观看| 免费人成在线观看网站视频| 久久久久久一品道精品免费看| 亚洲人成色777777老人头| 国产国拍亚洲精品mv在线观看|