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

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

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

    隨筆 - 53, 文章 - 0, 評(píng)論 - 3, 引用 - 0
    數(shù)據(jù)加載中……

    2008年11月19日

    java.sql.BatchUpdateException: IO Error: Connection reset

    during analysis of "IO Error: Connection reset", many articles mentioned that it could be caused by java security code (accessing /dev/random) used in JDBC connection. However it is not the root cause in my case. In my environment, Java already use /dev/urandom. 1. $JAVA_HOME/jre/lib/security/java.security securerandom.source=file:/dev/./urandom 2. check with strace. only -Djava.security.egd=file:/dev/../dev/urandom will trigger system call (read on /dev/urandom) all other other path format like below are OK. -Djava.security.egd=file:/dev/./urandom -Djava.security.egd=file:///dev/urandom 3. Keep checking the retropy size, I have never seen it is exhaused. while [ 1 ]; do cat /proc/sys/kernel/random/entropy_avail sleep 1 done usually the avail is in the range from 1000 to 3000. so far, there is no clue about the root cause of "IO Error: Connection reset".

    posted @ 2017-02-20 09:28 InPractice 閱讀(1312) | 評(píng)論 (0)編輯 收藏

    Lessons learned - Oracle GI and Database Installation on SUSE 12

    I encountered many issue during installation of Oracle Grid Infrastructure(GI) and Database; with the help of ariticle and documents found through Google search engine, I finally made it. for records, here is the details issues encountered and solutions applied. Major issues were encountered during GI installation. Pre-installation tasks. Issue 1: swapspace is not big enough; (1.3.1 Verify System Requirements) grep MemTotal /proc/meminfo 264G grep SwapTotal /proc/meminfo 2G during OS installation, I take default option and swap space is only 2G. Oracle recommend to have more than 16G swap space in case of more that 32G RAM. dd if=/dev/zero of=/home/swapfile bs=1024 count=33554432 33554432+0 records in 33554432+0 records out 34359738368 bytes (34 GB) copied mkswap /home/swapfile mkswap /home/swapfile chmod 0600 /home/swapfile lessons learned: setup swap space properly according to DB requirement when installing OS. Issue 2: cannot find oracleasm-kmp-default from Oracle site. (1.3.6 Prepare Storage for Oracle Automatic Storage Management) install oracleasmlib and oracleasm-support is easy, just download them from Oracle and install them; Originally oracleasm kernel is provided by Oracle, but now I cannot find it from Oracle; finally I realized that oracleasm kernel is now provided by OS vendor; In my case, it should be installed from SUSE disk; a. to get its name oracleasm-kmp-default zypper se oracle b. map dvd and install zypper in oracleasm-kmp-default rpm -qa|grep oracleasm oracleasm-kmp-default-2.0.8_k3.12.49_11-3.20.x86_64 oracleasm-support-2.1.8-1.SLE12.x86_64 oracleasmlib-2.0.12-1.SLE12.x86_64 asm configure -i asm createdisk DATA /dev/<...> asm listdisks --DATA ls /dev/oracleasm/disks Installation tasks: Issue 3: always failed due to user equivalence check after starting installer OUI with user oracle. however if I manully check with runcluvfy, no issue found at all. ./runcluvfy.sh stage -pre crsinst -n , -verbose I worked around it by using another user to replace user oracle. but it triggered next issue. Issue 4: cannot see ASM disks in OUI. no matter how I change the disk dicovery path. the disk list is empty. but I can find disk manully. /usr/sbin/oracleasm-discover 'ORCL:*' Discovered disk: ORCL:DATA Root cause is that the ASM is configured and created with user oracle. and I aming installing GI with different user other than oracle; so I cannot see the Disk created. change owner of disk device file solved the issue. ls /dev/oracleasm/disks chown /dev/oracleasm/disks -R Issue 5: root.sh execution failed. Failed to create keys in the OLR, rc = 127, Message: clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory fixed the issue with command below: zypper in libcap1 ohasd failed to start Failed to start the Clusterware. Last 20 lines of the alert log follow: 2016-07-24 23:10:28.502: [client(1119)]CRS-2101:The OLR was formatted using version 3. I found a good document from SUSE, Oracle RAC 11.2.0.4.0 on SUSE Linux Enterprise Server 12 - x86_64, it make it clear that SUSE 12 is supported by Oracle GI 11.2.0.4, it also mentioned Patch 18370031. "During the Oracle Grid Infrastructure installation, you must apply patch 18370031 before configuring the software that is installed. " The patch 18370031 is actually mentioned in "Oracle quick installation guide on Linux", but not mentioned in "Oracle quick installation guide on Linux". I majored followed up with later one and missed Patch 18370031. issue disappeared after I installed the patch 18370031. ./OPatch/opatch napply -oh -local /18370031 Errors in file : ORA-27091: unable to queue I/O ORA-15081: failed to submit an I/O operation to a disk ORA-06512: at line 4 solved by change owner of disk DATA related file ls -l /dev/oracleasm/iid chown on folder /dev/oracleasm/iid and some .* hidden file. Issue during DB installation Issue 6: report error: in invoking target 'agent nmhs' vi $ORACLE_HOME/sysman/lib/ins_emagent.mk Search for the line $(MK_EMAGENT_NMECTL) Change it to: $(MK_EMAGENT_NMECTL) -lnnz11 refer to https://community.oracle.com/thread/1093616?tstart=0

    posted @ 2016-07-28 16:55 InPractice 閱讀(269) | 評(píng)論 (0)編輯 收藏

    卸載Ubuntu需要注意的地方

    很多年前裝了UbuntuWindows的雙系統(tǒng),最近因?yàn)橛辛藢iT(mén)的電腦來(lái)裝Ubuntu,所以把原先電腦上的Ubuntu卸載了,結(jié)果系統(tǒng)不能引導(dǎo)了。因?yàn)?/span>GRUB的原理是控制權(quán)從MBRUbuntu系統(tǒng)盤(pán),然后Ubuntu系統(tǒng)盤(pán)再提供對(duì)windows的引導(dǎo)。現(xiàn)在Ubuntu系統(tǒng)被卸載了。這個(gè)啟動(dòng)的鏈條也就斷了。

    這個(gè)問(wèn)題本身不難解決,借了一個(gè)
    Windows安裝盤(pán),恢復(fù)一下MBR即可。但是這個(gè)需要windows系統(tǒng)的Administrator密碼。而我的系統(tǒng)不是我裝的,我根本不知道這個(gè)密碼。

    有的帖子提到破解
    Administrator密碼,試了一下,覺(jué)得太麻煩了。因?yàn)殡娔X上有數(shù)據(jù),也不能重裝。 

    最后的解決方案是在原先的
    Ubuntu分區(qū)上安裝一個(gè)新的Windows。這樣變成了windows的雙系統(tǒng)。安裝完重啟之后可以進(jìn)入任何一個(gè)系統(tǒng)(新的或者舊的Windows)。安裝的過(guò)程中MBR被自動(dòng)更新了。再下來(lái)就改一下老系統(tǒng)的Administrator密碼,刪除掉多于的Windows新系統(tǒng)即可。

    posted @ 2011-04-11 18:19 InPractice 閱讀(650) | 評(píng)論 (1)編輯 收藏

    使用GMail的困惑

    用Gmail的時(shí)候不小心點(diǎn)了"存檔"按鈕,一封重要的郵件就此消失了好幾天,今天才機(jī)緣巧合找到。

    在網(wǎng)絡(luò)上查到的解釋是:
            存檔會(huì)將郵件從收件箱移至所有郵件,這樣您不必刪除郵件就可以整理收件箱。

    難以理解,坦率地說(shuō),這個(gè)功能對(duì)我來(lái)說(shuō)是徒增煩惱??磥?lái)任何工具都需要你去適應(yīng),磨合。

    posted @ 2011-02-11 11:02 InPractice 閱讀(255) | 評(píng)論 (0)編輯 收藏

    華容道游戲的解決

    最近買(mǎi)了一個(gè)叫做“華容道”的玩具給兒子晚。這個(gè)游戲雖然號(hào)稱是中國(guó)四大古典智力游戲之一。其實(shí)不過(guò)百年歷史,而且是從國(guó)外引進(jìn)的。不過(guò)本地化做得非常好,也算是創(chuàng)造性地吸收國(guó)外文明。

    手工解決這個(gè)游戲有點(diǎn)難度,當(dāng)然已經(jīng)有人給出了解法;不過(guò)我還是自己用編程的方式解決了一遍。發(fā)現(xiàn)自己在這方面的編程還是比較弱。大部分時(shí)間花在了調(diào)試上。

    剛開(kāi)始是用的深度優(yōu)先搜索。大致知道了答案應(yīng)該長(zhǎng)什么樣。后來(lái)改進(jìn)為廣度優(yōu)先搜索,得到了最優(yōu)的解法。還有一個(gè)就是原先只考慮每次最多移動(dòng)一格。后來(lái)發(fā)現(xiàn)傳統(tǒng)的定義是一個(gè)塊的所有連續(xù)移動(dòng)都算作一步。相應(yīng)地修改了實(shí)現(xiàn)算法。

    最難的是做界面。為了調(diào)試,隨便寫(xiě)了個(gè)Applet。但是給我兒子玩,就覺(jué)得拿不出手了。



    posted @ 2010-08-16 13:49 InPractice 閱讀(337) | 評(píng)論 (0)編輯 收藏

    Meta Information

    Just use this blog to share some meta information.


      
    git://github.com/ueddieu/mmix.git
    http://github.com/ueddieu/mmix.git

    posted @ 2010-06-05 06:44 InPractice 閱讀(195) | 評(píng)論 (0)編輯 收藏

    Notes on Gentoo Installation

    After two weeks' struggle, I have successfully installed Gentoo, a popular GNU/Linux Distribution. For Records, the obstacles I encountered are listed below. (but I can not remember the solution exactly)

    0. failed to emerge gpm when I install the links package. If I recall correctly, it is resolved by install gpm manually

    1. I encounter issue when I install glib 2.22.5. no update-desktop-database. which is in dev-util/desktop-file-utils. When I try to emerge it, there is a circular dependency on glib. no solution and I forget How I resolve the problem.

    2. later after I install glib, with ~amd64 keyword I can install gpm-1.20.6, but it conflicts with the manually inatalled gpm. I remove the conflicted file and emerge successfully.

    3. Failed to emerge tiff. edit packages.keywords to add the following. / ~amd64 I am able to use latest tiff in beta-version, which is unstable and masked out.

    4. later atk-1.28.0 failed to emerge. edit /etc/make.conf with the following. FEATURES="-stricter". then emerge successfully with only some complain. with out this seting. the warining from GCC will cause that emerge fail.

    5. when I run emerge --update system actually gcc will be upgraded from 4.3.4 to 4.4.3. but it failed because of compilation warning, again. add "-stricter" into Features variable in /etc/make.conf work around it.


    6. The installation takes a long time, the KDE itself take more than 10 hours. There is still a lot of improvement space! Anyway, it is nice to be able to use it daily.

    posted @ 2010-06-03 16:33 InPractice 閱讀(351) | 評(píng)論 (0)編輯 收藏

    為SVN客戶端設(shè)置Proxy

    在C:\Documents and Settings\<user_name>\Application Data\Subversion\servers文件中加入
    all=*.*

    [all]
    http-proxy-host = ***.**.com
    http-proxy-port = 8080

    這里的all映射到所有的Server。

    網(wǎng)絡(luò)環(huán)境的復(fù)雜給我們的工作帶來(lái)了一些影響。就拿Proxy的設(shè)置來(lái)說(shuō),本來(lái)理想的情況是在全局做一個(gè)設(shè)置就可以了,但是事實(shí)上我們要為每個(gè)程序做設(shè)置,而且語(yǔ)法還不一樣。

    posted @ 2010-04-21 17:00 InPractice 閱讀(771) | 評(píng)論 (0)編輯 收藏

    小心一些太過(guò)智能的工具,比如Word。

    今天從word文檔中拷貝腳本到命令行執(zhí)行。沒(méi)有想到的是Word自動(dòng)加入了空格,導(dǎo)致執(zhí)行失敗。具體如下。
    call ttGridCreate('$TT_GRID');
    被word變成了
    call ttGridCreate(' $TT_GRID');
    這個(gè)空格可不容易被發(fā)現(xiàn),尤其你不是腳本作者的時(shí)候。提高警惕!

    posted @ 2010-04-13 16:13 InPractice 閱讀(253) | 評(píng)論 (0)編輯 收藏

    訪問(wèn)Java對(duì)象屬性的性能模型。

    今天做了一個(gè)簡(jiǎn)單的性能測(cè)試。比較訪問(wèn)Java對(duì)象屬性的各種方法的性能差異。
    1. 直接訪問(wèn)對(duì)象的屬性。
    2. 用方法訪問(wèn)對(duì)象的屬性。
    3. 用Map來(lái)存儲(chǔ)和訪問(wèn)。
    4. 反射-Field 訪問(wèn)。
    5. 反射-Method訪問(wèn)。

    重復(fù)100次,結(jié)果如下(單位為納秒)。
     * 100 field access, 14,806<br/>
     * 100 method access, 20,393<br/>
     * 100 map access, 66,489<br/>
     * 100 reflection field access, 620,190<br/>
     * 100 reflection method access, 1,832,356<br/>
    重復(fù)100000次,結(jié)果如下(單位為納秒)。
     *100000 field access, 2,938,362
     *100000 method access, 3,039,772
     *100000 map access, 10,784,052
     *100000 reflection field access, 144,489,034
     *100000 reflection method access, 37,525,719 <br/>
     
    由結(jié)果可見(jiàn):
    1。getter/setter 的性能已經(jīng)接近直接屬性訪問(wèn)(大約慢50%),沒(méi)有必要擔(dān)心getter/setter的性能而采用直接屬性訪問(wèn)。
    2。用Map代替POJO的代價(jià)大約是比getter/setter慢三倍。
    3。反射訪問(wèn)比getter/setter慢50到150倍。慎用。追求動(dòng)態(tài)性的時(shí)候也要注意不菲的性能代價(jià)。
    4。注意重復(fù)次數(shù)增加到100000次,方法訪問(wèn)和屬性訪問(wèn)的差距縮??;更有意思的是,反射的Method訪問(wèn)比Field訪問(wèn)快四倍。這主要是JIT的作用。

    該測(cè)試結(jié)果和原先的猜想基本符合。但是性能評(píng)估很容易得到片面的結(jié)論,如果有錯(cuò)誤的地方,請(qǐng)大家不吝指正。謝謝。

    posted @ 2010-04-09 15:57 InPractice 閱讀(343) | 評(píng)論 (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 閱讀(616) | 評(píng)論 (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 閱讀(292) | 評(píng)論 (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 閱讀(138) | 評(píng)論 (0)編輯 收藏

    童趣

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

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

    幼稚的關(guān)于尋找素?cái)?shù)的猜測(cè)

    在高中的時(shí)候,知道了用篩法可以得到素?cái)?shù)。當(dāng)時(shí)我還有一個(gè)錯(cuò)誤的關(guān)于尋找素?cái)?shù)的猜測(cè)。
    以為用兩個(gè)素?cái)?shù)相乘,其附近存在素?cái)?shù)的幾率很高。比如, 7×11 = 77, 其附近有79,正好是素?cái)?shù)。
    當(dāng)時(shí)已經(jīng)發(fā)現(xiàn)11×11=121。7×17=119;但是錯(cuò)誤的理解為只有其中一個(gè)是平方或次冪時(shí)才成立。
    后來(lái)有了計(jì)算機(jī),編程驗(yàn)證了一下,發(fā)現(xiàn)有很多的反例。對(duì)當(dāng)初的錯(cuò)誤猜測(cè)羞赧不已。


    這個(gè)猜測(cè)雖然錯(cuò)的離譜,但是和現(xiàn)在的素?cái)?shù)理論,尤其是孿生素?cái)?shù)還是很有關(guān)系的。現(xiàn)在已經(jīng)知道,
    素?cái)?shù)有無(wú)窮多個(gè),但是素?cái)?shù)在自然數(shù)中所占的比例逐漸趨近于零。

    因此孿生素?cái)?shù)在自然數(shù)中的比例也是趨近于零的。現(xiàn)在還沒(méi)有證明孿生素?cái)?shù)是否有無(wú)窮多個(gè)。

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

    寫(xiě)了一個(gè)程序驗(yàn)證了一下。16位的整數(shù)中,大概只有 10% 能使假設(shè)成立。

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

    在Proxy環(huán)境中使用GIT需要解決的問(wèn)題.

    由于是在Proxy的網(wǎng)絡(luò)環(huán)境,MSYSGIT 的 git clone 總是失敗。需要配置如下環(huán)境變量。
    export http_proxy="http://<proxy domain name>:<port>"
    之后http協(xié)議git clone沒(méi)有任何問(wèn)題。但是用git 協(xié)議仍舊有問(wèn)題。

    之后發(fā)現(xiàn)git push 和 git pull 經(jīng)常不能work。多次嘗試后發(fā)現(xiàn)用更全的命令行參數(shù)可以解決問(wèn)題。
    過(guò)程如下。

    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 閱讀(828) | 評(píng)論 (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 閱讀(180) | 評(píng)論 (0)編輯 收藏

    媽媽和兒子

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

    兒子又要求錄音了。我們按著臺(tái)詞在dialog。
    “……”兒子
    “……,I like mangoes”媽媽
    “媽媽,我昨天剛教會(huì)你,又忘了?是I like watermelon。”
    “哦,媽媽現(xiàn)在記性不好了!”
    “是你這幾天不吃魚(yú)了吧,變笨了吧。明天多吃點(diǎn)!”

    媽媽你穿這衣服蠻可愛(ài)――2009-6-9晚
    兒子挑選的故事講完了。“好,ok,我們睡覺(jué)吧!”我說(shuō)。
    “唉,媽媽,還沒(méi)錄音呢,我去拿mp3。”自從第一次提議給他錄音,兒子每天都要求我能做到。
    ……
    “……,媽媽,你蠻可愛(ài)的!……”錄音正起勁,兒子突然插了一句題外話。
    “什么?”我沒(méi)聽(tīng)清。
    “你穿這衣服蠻可愛(ài)的!”兒子賊賊的笑著又重復(fù)了一遍。“因?yàn)槟愕囊路笮“唏R呀!”我終于明白。


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

    安裝openldap遇到的一個(gè)小問(wèn)題。

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

    我遇到的一個(gè)新問(wèn)題是執(zhí)行l(wèi)dapsearch報(bào)錯(cuò)如下:
    can not find libdb-4.7.so.
    我的解決辦法是,建立符號(hào)鏈接/usr/lib/libdb-4.7.so, 后者指向/usr/local/BerkeleyDB/lib/libdb-4.7.so
    之后沒(méi)有遇到其他問(wèn)題。

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

    和兒子一起長(zhǎng)大

    凡事都有其內(nèi)在原因,即使是表面上毫無(wú)道理的行為,也有其內(nèi)在的原因。今天再次認(rèn)識(shí)到這個(gè)

    道理,還是因?yàn)榻裉煸缟虾臀覂鹤拥囊欢尾迩?/span>

     

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

    他媽媽要趕班車,沒(méi)時(shí)間陪她,留我在家里。我陪他睡了一會(huì),聊了十分鐘,才知道他是有原因

    的。

     

    昨天晚上,我和她媽媽都很累,我就說(shuō)今天我們?cè)琰c(diǎn)睡覺(jué),和兒子一起睡好了??墒且?yàn)閯倓?/span>

    回上海,有很多事情要做,最后還是忙到十點(diǎn)半才睡。兒子就說(shuō)爸爸說(shuō)謊了。當(dāng)然他可能還有

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

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

    The analysis of MOR(MXOR) instruction implementation in MMIXWare

    The analysis of MOR(MXOR) instruction implementation in MMIXWare
     
     -- A stupid way to understand the source code.
     
     the implementation of MOR(MXOR) is in file: mmix-arith.w
     436 octa bool_mult(y,z,xor)
     437   octa y,z; /* the operands */
     438   bool xor; /* do we do xor instead of or? */
     439 {
     440   octa o,x;
     441   register tetra a,b,c;
     442   register int k;
     443   for (k=0,o=y,x=zero_octa;o.h||o.l;k++,o=shift_right(o,8,1))
     444     if (o.l&0xff) {
     445       a=((z.h>>k)&0x01010101)*0xff;
     446       b=((z.l>>k)&0x01010101)*0xff;
     447       c=(o.l&0xff)*0x01010101;
     448       if (xor) x.h^=a&c, x.l^=b&c;
     449       else x.h|=a&c, x.l|=b&c;
     450     }
     451   return x;
     452 }
     
     It takes me several hours to understand the details.
     
     If we treat each octabyte as a matrix, each row corresponds to a byte, then
     y MOR z = z (matrix_mulitiply) y
     
     For a=((z.h>>k)&0x01010101)*0xff;
     (z.h>>k)&0x01010101 will get the four last bit in (z.h>>k). depends on the bit in last row,
     ((z.h>>k)&0x01010101)*0xff will expand the bit (either 0 or 1) into the whole row.
     e.g.
                 ff
     *     0x01010101   
     ---------------
     =           ff
               ff
             ff
           ff
     ----------------
     =    ffffffff      
    (depending on the last bit in each row of z, the result could be #ff00ff00. #ff0000ff, etc.)

    similarily, b=((z.l>>k)&0x01010101)*0xff; will expand the last bit in each byte into the
    whole byte.

    over all, after these two step, the z becomes the replication of it's last row, since k vary
    from 0 to 7, it will loop on all the rows actually.


     For c=(o.l&0xff)*0x01010101, it will get the last byte in o.l and populate it to other three byte.
     since it will not only or/xor h but also l. it is not necessary populate it to o.h.
     
     one example,
     let (z.h>>k)&0x01010101 = 0x01000101, then a= 0xff00ffff;
     let (z.l>>k)&0x01010101 = 0x01010001, then b= 0xffff00ff;
     let (o.l&0xff)=0xuv, then c= 0xuvuvuvuv;
      then a&c=0xuv00uvuv;
             b&c=0xuvuv00uv;
           
     consider the elements [i,j] in result x.  in this round, what value was accumalated in by operation
     or(xor).
     it is the jth bit in last byte of o.l & ith bit in last column of z.(do not consider looping now.)
     in this round, the 64 combination of i and j, contirbute the value to the 64 bits in z.
     
     Noticed that o loop on y from last byte to first byte. There are 8 loop/rounds, in another round.
     say kth round.
     the elements[i,j] will accumuate the jth bit in last (k + 1)th row & the jth bit in last (k+1)th
     column.
     that means the jth column in y multiply the ith row in z. it conform to the definiton for
     z matrix_multiply y.
     
     
             
           
           
     

    posted @ 2009-01-16 10:54 InPractice 閱讀(277) | 評(píng)論 (0)編輯 收藏

    九連環(huán)游戲和數(shù)學(xué)

    游戲和數(shù)學(xué)有密切的聯(lián)系。最近在玩九連環(huán),感受更深。

    之所以開(kāi)始玩九連環(huán),是因?yàn)樵诟叩录{的書(shū)中提到了格雷碼和九連環(huán)的關(guān)系。為了理解生成格雷碼的算法,特意買(mǎi)了九連環(huán)來(lái)玩。畢竟書(shū)上的
    描述沒(méi)有實(shí)際玩起來(lái)那么容易理解。

    通過(guò)這個(gè)游戲,我不僅會(huì)解九連環(huán)了,而且掌握的生成格雷碼的一種算法。

    posted @ 2009-01-13 19:59 InPractice 閱讀(403) | 評(píng)論 (0)編輯 收藏

    A piece of beautiful and trick bitwise operation code.

    A detailed reading process of a piece of beautiful and trick bitwise operation code.
     
    The following code is from MMIXWare, it is used to implement the Wyde difference between two octabyte.
     
         in file: "mmix-arith.w"
         423 tetra wyde_diff(y,z)
         424   tetra y,z;
         425 {
         426   register tetra a=((y>>16)-(z>>16))&0x10000;
         427   register tetra b=((y&0xffff)-(z&0xffff))&0x10000;
         428   return y-(z^((y^z)&(b-a-(b>>16))));
         429 }
     
    It is hard to understand it without any thinking or verification, here is the process I used
    to check the correctness of this algorithm.

    let y = 0xuuuuvvvv;
         z = 0xccccdddd; (please note the [c]s may be different hex number.)
        
    then y>>16 = 0x0000uuuu;
         z>>16 = 0x0000cccc;
         
    then ((y>>16)-(z>>16)) = 0x1111gggg if #uuuu < #cccc or
         ((y>>16)-(z>>16)) = 0x0000gggg if #uuuu >= #cccc   

    so variable a = 0x00010000 if #uuuu < #cccc or
       variable a = 0x00000000 if #uuuu >= #cccc
      
    similarly, we can get
       variable b = 0x00010000 if #vvvv < #dddd or
       variable b = 0x00000000 if #vvvv >= #dddd

    for (b-a-(b>>16)))), there are four different result depending on the relation between a and b.
    when #uuuu >= #cccc and #vvvv >= #dddd, (b-a-(b>>16)))) = 0x00000000;
    when #uuuu >= #cccc and #vvvv < #dddd, (b-a-(b>>16)))) = 0x00001111;
    when #uuuu < #cccc and #vvvv >= #dddd, (b-a-(b>>16)))) = 0x11110000;
    when #uuuu < #cccc and #vvvv < #dddd, (b-a-(b>>16)))) = 0x11111111;
    You can see that >= map to #0000 and < map to #1111

    for y-(z^((y^z)&(b-a-(b>>16)))), when (b-a-(b>>16)))) is 0x00000000, z^((y^z)&(b-a-(b>>16))) is
    z^((y^z)& 0) = z^0=z, so y-(z^((y^z)&(b-a-(b>>16))))=y-z.
    similarily, when (b-a-(b>>16)))) is 0x11111111, z^((y^z)&(b-a-(b>>16))) is
    z^((y^z)& 1) = z^(y^z)=y, so y-(z^((y^z)&(b-a-(b>>16))))=0.

    when (b-a-(b>>16)))) is 0x11110000 or 0x11110000, we can treat the y and z as two separate wydes.
    each wyde in the result is correct.

    You may think it is a little stupid to verify such kind of details. but for my point of view,
    without such detailed analysis, I can not understand the algorithm in the code. with the hard
    work like this, I successfully understand it. The pleasure deserve the effort.
     
    I am wondering how can the author discover such a genius algorithm.


    posted @ 2009-01-06 16:04 InPractice 閱讀(213) | 評(píng)論 (0)編輯 收藏

    兒子的夢(mèng)話

    昨天晚上,瑞瑞睡到十二點(diǎn)的時(shí)候,爬出被子,躺在外面。結(jié)果咳嗽得很厲害,吐了好幾口。吃了枇杷膏很快就睡著了。

    沒(méi)過(guò)一會(huì),他就開(kāi)始做惡夢(mèng)了。下面是他的夢(mèng)話:
    “爸爸的手不見(jiàn)了”
    “爸爸掉下去了”
    “我親愛(ài)的爸爸不見(jiàn)了,我可怎么辦阿”

    估計(jì)是最近洪恩的GOGO學(xué)英語(yǔ)的DVD看多了。

    posted @ 2008-11-19 10:34 InPractice 閱讀(108) | 評(píng)論 (0)編輯 收藏

    主站蜘蛛池模板: 亚洲一区二区三区国产精华液| 亚洲av永久中文无码精品综合| 亚洲免费网站观看视频| 四虎永久在线精品免费一区二区| 亚洲欧洲国产精品香蕉网| 日韩精品成人无码专区免费| a毛片在线看片免费| 日韩精品亚洲专区在线影视| 亚洲国产成人私人影院| 又粗又黄又猛又爽大片免费 | 亚洲一区精品伊人久久伊人 | 特级毛片免费观看视频| 亚洲色偷偷av男人的天堂| 国产国拍精品亚洲AV片| 国产精品麻豆免费版| 精品久久久久成人码免费动漫| baoyu777永久免费视频| 99久久国产精品免费一区二区| 美女一级毛片免费观看| 一道本不卡免费视频| 羞羞视频免费网站入口| 午夜成人无码福利免费视频| 国产精品偷伦视频免费观看了| 国产精品亚洲专区无码唯爱网| 美女被暴羞羞免费视频| 色视频在线观看免费| 国产裸体美女永久免费无遮挡| 无人视频在线观看免费播放影院| 亚洲人成网站色7799| 亚洲人成网站在线观看播放动漫| 亚洲AV无码乱码在线观看裸奔 | 在线免费观看亚洲| 青青青国产手机频在线免费观看| 亚洲免费日韩无码系列| 国产羞羞的视频在线观看免费| A国产一区二区免费入口| 女人体1963午夜免费视频| 99re视频精品全部免费| 免费h视频在线观看| 国产在线jyzzjyzz免费麻豆| 免费成人福利视频|