• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            colorful

            zc qq:1337220912

             

            virtualbox 安裝 64位centos

            前前后后差不多一天的時間,終于搞好了.

            virtualbox 的無縫模式那真是一個cool, 帥呆了.
            還是總結一下吧,免得下次又忘了.

            ----------------------------------------------------------
            virtualbox 上安裝64位操作系統(tǒng),要滿足三個條件 1 cpu是64位 2 cpu支持虛擬化(支持的話,可在bios里設置開啟) 3:安裝的系統(tǒng)為64位
            vmware 也要注意這個問題

            ----------------------------------------------------------
            centos 圖形安裝界面需 628M以上內存,

            ----------------------------------------------------------
            我的 CentOS6.3 裝在虛擬機里,在線升級后,突然不能進入桌面了,現象是進度條變成灰白,而啟動的服務過程則在 Starting certmonger: [OK] 這里停止。
            解決辦法很簡單,使用 SSH 連入系統(tǒng),或使用 Ctrl + Alt + Fx 進入虛擬終端,然后執(zhí)行下面的命令:
                # mv /etc/X11/xorg.conf /etc/X11/old_xorg.conf
            接著重啟系統(tǒng),桌面回來了。

            ----------------------------------------------------------
            在安裝VBoxAddition 失敗的情況, 用下面方法可以解決。 但正解安裝后菜單上的無縫模式還是灰的,重裝重啟了N次還是灰的,后來資料上看到要通過 /etc/X11/xorg.conf來設置分辯率, 就照著設置了一下,結果重啟后又卡在Starting certmonger那里,于是用上面的方法 mv了一下。然后重啟。我去!!!!!無縫模式就不灰了.....
            ps: 后來我又重新裝了個centos6.2的, 安裝好VBoxAddition 后重啟就可以無縫模式了,不需要設置xorg.conf

            ----------------------------------------------------------
            VBoxAddition 安裝失敗的解決方法
            http://blog.csdn.net/lidongtang/article/details/8479900

            CentOS6.3是安裝在VirtualBox虛擬機上,安裝好以后最好再將VBoxAdditions增強功能裝上,主要目的是能夠在虛擬機和宿主機之間能夠共享文件。


            1. 更新內核。CentOS 6.3對應的kernel默認為2.6.32-279.el6.i686:

            # uname -r 
            2.6.32-279.el6.i686

            安裝增強功能需要kernel-devel包,必須保證kernel-devel和kernel版本的一致。查看軟件源中kernel-devel的版本:

            復制代碼
            # yum info kernel-devel
            Loaded plugins: fastestmirror, refresh-packagekit, security
            Loading mirror speeds from cached hostfile
            * base: mirrors.163.com
            * extras: mirrors.163.com
            * updates: mirrors.163.com
            Available Packages
            Name : kernel-devel
            Arch : i686
            Version : 2.6.32
            Release : 279.19.1.el6
            Size : 7.6 M
            Repo : updates
            Summary : Development package for building kernel modules to match the
            : kernel
            URL : http://www.kernel.org/
            License : GPLv2
            Description : This package provides kernel headers and makefiles sufficient to
            : build modules against the kernel package.

            復制代碼

            當前的kernel-devel版本是2.6.32-279.19.1.e16。因此,必須升級kernel:

            # yum update kernel

            升級完后必須重啟系統(tǒng),新的kernel才能被使用。

             

            2. 安裝kernel-devel和gcc。

            # yum install kernel-devel gcc gcc-c++

             

            3. 安裝增強功能。進入增強功能光盤根目錄,執(zhí)行Linux下的安裝命令:

            復制代碼
            # ./VBoxLinuxAdditions.run
            Verifying archive integrity... All good.
            Uncompressing VirtualBox 4.2.4 Guest Additions for Linux..........
            VirtualBox Guest Additions installer
            Removing installed version 4.2.4 of VirtualBox Guest Additions...
            Removing existing VirtualBox non-DKMS kernel modules[確定]
            Building the VirtualBox Guest Additions kernel modules
            Building the main Guest Additions module[確定]
            Building the shared folder support module[確定]
            Building the OpenGL support module[確定]
            Doing non-kernel setup of the Guest Additions[確定]
            Starting the VirtualBox Guest Additions [確定]
            Installing the Window System drivers
            Installing X.Org Server 1.10 modules[確定]
            Setting up the Window System to use the Guest Additions[確定]
            You may need to restart the hal service and the Window System (or just restart
            the guest system) to enable the Guest Additions.


            Installing graphics libraries and desktop services components[確定]

            復制代碼

            posted @ 2013-07-03 18:42 多彩人生 閱讀(4833) | 評論 (0)編輯 收藏

            RedHat/CentOS安裝五筆輸入法

            使用centos 倉庫里的 ibus,我的 CenOS6.3 自帶了 ibus 包。打開 System – preferences – Input Method 配置 ibus 開機自啟動。

            要安裝五筆需要安裝一個 ibus-table-wubi 包

            yum install ibus libusb ibus-libs ibus-table-wubi

            安裝好后注銷一下系統(tǒng),讓ibus讀取新的配置,然后就可以在ibus的設置界面添加wubi了

            右擊桌面右上角的輸入法圖標,選擇 Preferences,切換到 Input Method 選項卡,在 Select a input method 下拉菜單里添加五筆輸入法即可。

            posted @ 2013-07-02 17:12 多彩人生 閱讀(2701) | 評論 (0)編輯 收藏

            centos使用yum安裝gcc

            yum -y install gcc
            yum -y install gcc-c++ 
            yum install make
            -- 或者
            yum groupinstall "Development Tools"
            -- 或者
            yum install gcc gcc-c++ kernel-devel

            posted @ 2013-07-02 17:11 多彩人生 閱讀(2905) | 評論 (0)編輯 收藏

            Linux靜態(tài)庫和動態(tài)庫

            庫從本質上來說是一種可執(zhí)行代碼的二進制格式,可以被載入內存中執(zhí)行。庫分靜態(tài)庫和動態(tài)庫兩種。 

            靜態(tài)庫和動態(tài)庫的區(qū)別

            1. 靜態(tài)函數庫

                這類庫的名字一般是libxxx.a;利用靜態(tài)函數庫編譯成的文件比較大,因為整個 函數庫的所有數據都會被整合進目標代碼中,他的優(yōu)點就顯而易見了,即編譯后的執(zhí)行程序不需要外部的函數庫支持,因為所有使用的函數都已經被編譯進去了。當 然這也會成為他的缺點,因為如果靜態(tài)函數庫改變了,那么你的程序必須重新編譯。

            2. 動態(tài)函數庫

                這類庫的名字一般是libxxx.so;相對于靜態(tài)函數庫,動態(tài)函數庫在編譯的時候 并沒有被編譯進目標代碼中,你的程序執(zhí)行到相關函數時才調用該函數庫里的相應函數,因此動態(tài)函數庫所產生的可執(zhí)行文件比較小。由于函數庫沒有被整合進你的 程序,而是程序運行時動態(tài)的申請并調用,所以程序的運行環(huán)境中必須提供相應的庫。動態(tài)函數庫的改變并不影響你的程序,所以動態(tài)函數庫的升級比較方便。
            linux系統(tǒng)有幾個重要的目錄存放相應的函數庫,如/lib /usr/lib。

            靜態(tài)庫的使用

            靜態(tài)庫的操作工具:gcc和ar 命令。 

            編寫及使用靜態(tài)庫 

            (1)設計庫源碼 pr1.c 和 pr2.c 

            [root@billstone make_lib]# cat pr1.c 

            void print1() 

                            printf("This is the first lib src!\n"); 

            [root@billstone make_lib]# cat pr2.c 

            void print2() 

                            printf("This is the second src lib!\n"); 

                   (2)  編譯.c 文件 

            [bill@billstone make_lib]$ cc -O -c pr1.c pr2.c 

            [bill@billstone make_lib]$ ls -l pr*.o 

            -rw-rw-r--        1 bill          bill                    804    4 月  15 11:11 pr1.o 

            -rw-rw-r--        1 bill          bill                    804    4 月  15 11:11 pr2.o 

            (3)  鏈接靜態(tài)庫 

                為了在編譯程序中正確找到庫文件,靜態(tài)庫必須按照 lib[name].a 的規(guī)則命名,如下例中[name]=pr. 

            [bill@billstone make_lib]$ ar -rsv libpr.a pr1.o pr2.o 

            a - pr1.o 

            a - pr2.o 

            [bill@billstone make_lib]$ ls -l *.a 

            -rw-rw-r--        1 bill          bill                  1822    4 月  15 11:12 libpr.a 

            [bill@billstone make_lib]$ ar -t libpr.a 

            pr1.o 

            pr2.o 

            (4)  調用庫函數代碼 main.c 

            [bill@billstone make_lib]$ cat main.c 

            int main() 

                            print1(); 

                            print2(); 

                            return 0; 

            (5)  編譯鏈接選項 

                -L 及-l 參數放在后面.其中,-L 加載庫文件路徑,-l 指明庫文件名字. 

            [bill@billstone make_lib]$ gcc -o main main.c -L./ -lpr 

            [bill@billstone make_lib]$ ls -l main* 

            -rwxrwxr-x        1 bill          bill                11805    4 月  15 11:17 main 

            -rw-rw-r--        1 bill          bill                      50    4 月  15 11:15 main.c 

            (6)執(zhí)行目標程序 

            [bill@billstone make_lib]$ ./main 

            This is the first lib src! 

            This is the second src lib! 

            [bill@billstone make_lib]$ 

            動態(tài)庫的使用

            編寫動態(tài)庫 

            (1)設計庫代碼 

            [bill@billstone make_lib]$ cat pr1.c 

            int p = 2; 

            void print(){ 

                            printf("This is the first dll src!\n"); 

            [bill@billstone make_lib]$   

            (2)生成動態(tài)庫 

            [bill@billstone make_lib]$ gcc -O -fpic -shared -o dl.so pr1.c 

            [bill@billstone make_lib]$ ls -l *.so 

            -rwxrwxr-x        1 bill          bill                  6592    4 月  15 15:19 dl.so 

            [bill@billstone make_lib]$ 

            動態(tài)庫的隱式調用 

              在編譯調用庫函數代碼時指明動態(tài)庫的位置及名字,  看下面實例 

            [bill@billstone make_lib]$ cat main.c 

            int main() 

                            print(); 

                            return 0; 

            [bill@billstone make_lib]$ gcc -o tdl main.c ./dl.so 

            [bill@billstone make_lib]$ ./tdl 

            This is the first dll src! 

            [bill@billstone make_lib]$ 

            當動態(tài)庫的位置活名字發(fā)生改變時,  程序將無法正常運行;  而動態(tài)庫取代靜態(tài)庫的好處之一則是通過更新動態(tài)庫而隨時升級庫的內容. 

            動態(tài)庫的顯式調用 

              顯式調用動態(tài)庫需要四個函數的支持,  函數 dlopen 打開動態(tài)庫,  函數 dlsym 獲取動態(tài)庫中對象基址,  函數 dlerror 獲取顯式動態(tài)庫操作中的錯誤信息,  函數 doclose 關閉動態(tài)庫.

            [bill@billstone make_lib]$ cat main.c 

            #include <dlfcn.h> 

            int main() 

                            void *pHandle; 

                            void (*pFunc)();                                                    //  指向函數的指針 

                            int *p; 

                            pHandle = dlopen("./d1.so", RTLD_NOW);                  //  打開動態(tài)庫 

                            if(!pHandle){ 

                                            printf("Can't find d1.so \n"); 

                                            exit(1); 

                            } 

                            pFunc = (void (*)())dlsym(pHandle, "print");                //  獲取庫函數 print 的地址 

                            if(pFunc) 

                                            pFunc(); 

                            else 

                                            printf("Can't find function print\n"); 

                            p = (int *)dlsym(pHandle, "p");                                      //  獲取庫變量 p 的地址 

                            if(p) 

                                            printf("p = %d\n", *p); 

                            else 

                                            printf("Can't find int p\n"); 

                            dlclose(pHandle);                                                                //  關閉動態(tài)庫 

                            return 0; 

            [bill@billstone make_lib]$ gcc -o tds main.c –ld1 –L.

            此 時還不能立即./tds,因為在動態(tài)函數庫使用時,會查找/usr/lib、/lib目錄下的動態(tài)函數庫,而此時我們生成的庫不在里邊。 這個時候有好幾種方法可以讓他成功運行: 最直接最簡單的方法就是把libstr_out.so拉到/usr/lib或/lib中去。 還有一種方法 export LD_LIBRARY_PATH=$(pwd) 另外還可以在/etc/ld.so.conf文件里加入我們生成的庫的目錄,然后/sbin/ldconfig。 /etc/ld.so.conf是非常重要的一個目錄,里面存放的是鏈接器和加載器搜索共享庫時要檢查的目錄,默認是從/usr/lib /lib中讀取的,所以想要順利運行,我們也可以把我們庫的目錄加入到這個文件中并執(zhí)行/sbin/ldconfig 。另外還有個文件需要了解/etc/ld.so.cache,里面保存了常用的動態(tài)函數庫,且會先把他們加載到內存中,因為內存的訪問速度遠遠大于硬盤的 訪問速度,這樣可以提高軟件加載動態(tài)函數庫的速度了。

            庫依賴的查看

            使用ldd命令來查看執(zhí)行文件依賴于哪些庫。

            該命令用于判斷某個可執(zhí)行的 binary 檔案含有什么動態(tài)函式庫。
            [root@test root]# ldd [-vdr] [filename]
            參數說明:
            --version  打印ldd的版本號
            -v --verbose  打印所有信息,例如包括符號的版本信息
            -d --data-relocs  執(zhí)行符號重部署,并報告缺少的目標對象(只對ELF格式適用)
            -r --function-relocs  對目標對象和函數執(zhí)行重新部署,并報告缺少的目標對象和函數(只對ELF格式適用)
            --help 用法信息。

            如果命令行中給定的庫名字包含'/',這個程序的libc5版本將使用它作為庫名字;否則它將在標準位置搜索庫。運行一個當前目錄下的共享庫,加前綴"./"。

            posted @ 2013-07-01 17:59 多彩人生 閱讀(303) | 評論 (0)編輯 收藏

            vi 查找不包含[的行

            v/[

            posted @ 2013-06-28 17:41 多彩人生 閱讀(783) | 評論 (0)編輯 收藏

            Visual Studio的Output窗口自動滾動行為控制

            在使用Visual Studio調試程序察看log輸出時,在剛開始Debug時,Output窗口是默認自動滾動的。但是如果調整了Output窗口大小,或者在Output窗口中使用鼠標或者鍵盤操作進行了導航,則自動滾動將停止。如何恢復自動滾動呢?之前沒注意到這個問題,翻了翻MSDN,發(fā)現了個快捷鍵盤操作:Ctrl+END。使用該快捷鍵操作,就可以恢復Output窗口的自動滾動。

            posted @ 2013-06-27 11:42 多彩人生 閱讀(398) | 評論 (0)編輯 收藏

            給PostgreSQL添加MySQL的unix_timestamp與from_unixtime函數

            MySQL的2個常用函數unix_timestamp()與from_unixtime PostgreSQL并不提供,但通過PostgreSQL強大的擴展性可以輕松的解決問題。
            話說遠在天邊,盡在眼前,文檔看仔細,問題迎仞解。PostgreSQL 題供extract與date_part取epoch即可

            unix_timestamp() = round(date_part('epoch',now()))
            from_unixtime(int) = to_timestamp(int)

            添加函數unix_timestamp()
            CREATE FUNCTION unix_timestamp() RETURNS integer AS $$
            SELECT (date_part('epoch',now()))::integer;
            $$ LANGUAGE SQL IMMUTABLE;

            添加函數from_unixtime()
            CREATE FUNCTION from_unixtime(int) RETURNS timestamp AS $$
            SELECT to_timestamp($1)::timestamp;
            $$ LANGUAGE SQL IMMUTABLE;

            posted @ 2013-06-25 13:50 多彩人生 閱讀(1831) | 評論 (0)編輯 收藏

            bat 設置標題

            @echo off
            titil haha
            pause

            posted @ 2013-06-25 10:59 多彩人生 閱讀(542) | 評論 (0)編輯 收藏

            Batch命令關閉指定標題欄的應用程序窗口

            應用場景:
            當前用戶會話中打開了多個窗口,需要關閉其中某個標題欄包含指定內容的窗口。比如,打開了多個Java應用程序,而只想關閉Apache JMeter。注:這里的關閉是指通過taskkill殺死相應的進程。

            腳本:
            @echo off
            for /f "tokens=2,10,11 delims= " %%l in ('tasklist /v') do (
             
               echo "%%l - %%m"
                if "%%m%%n" == "Apache JMeter" taskkill /f /PID %%m
                if "%%m" == "PACS.jmx" taskkill /f /PID %%l
            )

            說明:
            1. tasklist /v 會將當前運行的進程的詳細信息打印出來,其中包含“窗口標題”。
            2. for /f "tokens=2,10,11 delims= " 將tasklist /v打印出的每條記錄通過空格分組并提出其中的第2,10,和11項
            ------下面是個有應用體會--------------------
            1. 2, 10, 11, 會自動賦給 %%l, %%m, %%n變量
            2. 我覺得正確代碼是:
            @echo off
            for /f "tokens=2,10 delims= "%%l in ('tasklist /v') do (
                if "%%m" == "要關閉的應用程序的標題" taskkill /f /PID %%l
            )

            posted @ 2013-06-25 10:57 多彩人生 閱讀(922) | 評論 (0)編輯 收藏

            c++取整

             

               1、直接賦值給整數變量。如:
                int i = 2.5; 或 i = (int) 2.5;
                這種方法采用的是舍去小數部分
                2、C/C++中的整數除法運算符“/”本身就有取整功能(int / int),而下面介紹的取整函數返回值是double。整數除法對正數的取整是舍去小數部分,可以用于你的問題。但是整數除法對負數的取整結果和使用的C編譯器有關。
                3、使用floor函數。floor(x)返回的是小于或等于x的最大整數。如:
                floor(2.5) = 2
                floor(-2.5) = -3
                4、使用ceil函數。ceil(x)返回的是大于x的最小整數。如:
                ceil(2.5) = 3
                ceil(-2.5) = -2
                floor()是向負無窮大舍入,floor(-2.5) = -3;ceil()是向正無窮大舍入,ceil(-2.5) = -2。floor函數可以用于你的問題

            posted @ 2013-06-24 10:46 多彩人生 閱讀(7033) | 評論 (0)編輯 收藏

            僅列出標題
            共25頁: First 6 7 8 9 10 11 12 13 14 Last 

            導航

            統(tǒng)計

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            波多野结衣久久| 欧美精品福利视频一区二区三区久久久精品| 国产精品亚洲美女久久久| 色综合合久久天天综合绕视看| 久久国产精品免费一区二区三区| 精品久久综合1区2区3区激情| 伊色综合久久之综合久久| 色婷婷综合久久久中文字幕| 久久精品国产影库免费看| 久久天天躁狠狠躁夜夜2020一| 国产亚洲欧美成人久久片| 亚洲?V乱码久久精品蜜桃| 韩国三级大全久久网站| 久久精品日日躁夜夜躁欧美| 久久精品国产99国产精偷| 精品久久久无码21p发布| 国产精品日韩深夜福利久久| 久久天天躁狠狠躁夜夜96流白浆| 午夜精品久久久久| 久久影视综合亚洲| 99久久精品国产一区二区三区 | 九九99精品久久久久久| 女人高潮久久久叫人喷水| 国产三级精品久久| 97久久久精品综合88久久| 欧美黑人激情性久久| 99久久无色码中文字幕人妻| 亚洲人成网站999久久久综合| 亚洲国产二区三区久久| 国产欧美一区二区久久| 国产精品女同久久久久电影院| 亚洲va中文字幕无码久久| 久久精品中文无码资源站| 久久精品人妻中文系列| 中文字幕久久精品| 精品国产99久久久久久麻豆| 久久久久亚洲av成人网人人软件| 久久久国产打桩机| 久久国产精品无码HDAV| www久久久天天com| 精品国产婷婷久久久|