• <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>

            c++實例研究

            從0開始

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              104 隨筆 :: 0 文章 :: 20 評論 :: 0 Trackbacks

            2012年2月1日 #

                 摘要:   閱讀全文
            posted @ 2012-02-01 17:34 elprup 閱讀(1659) | 評論 (0)編輯 收藏

            2011年6月26日 #

            neighbor = [ [], # 0 for null 
                         [2,4,5,6,8], # node1
                         [1,3,4,5,6,7,9],
                         [
            2,4,5,6,8],
                         [
            1,2,3,4,7,8,9],
                         [
            1,2,3,4,6,7,8,9], # node 5
                         [1,2,3,5,7,8,9],
                         [
            2,4,5,6,7],
                         [
            1,3,4,5,6,7,9],
                         [
            2,4,5,6,8] ] # node 9

            def step(trace, current):
                nblist 
            = neighbor[current]
                avail 
            = list(set(nblist) - set(trace))
                c 
            = 0
                
            for i in avail:
                    newtrace 
            = trace + [i]
                    c 
            = c + 1 + step(newtrace, i)
                
            return c
                
            def main():
                
            return step([1], 1* 4 + step([2], 2* 4 + step([5], 5)
                
            if __name__ == '__main__':
                
            print main()
            posted @ 2011-06-26 23:25 elprup 閱讀(1860) | 評論 (2)編輯 收藏

            2011年3月7日 #

            centos5.5+nginx0.8.54+mysql5.5.8+php5.3.5 最新詳細安裝手冊

            2011年2月20日admin沒有評論

            轉載自:http://ggt8702.com/?p=146

            本篇參考http://hi.baidu.com/%D3%CE%CF%B7%B3%C8%D7%D3/blog/item/a8f35f34f684db5f241f14e8.html,做了些整理和修改。本篇中nginx、mysql、php都會被安裝在/opt/目錄下,它們的配置文件和日志等都在它們的安裝目錄下;mysql的數據庫數據放在/data/mysql下,網站數據放在/data/www下。

            系統準備和依賴程序庫安裝
            yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
            yum -y update
            下載安裝包
            cd /tmp/
            wget http://nginx.org/download/nginx-0.8.54.tar.gz
            wget http://www.php.net/get/php-5.3.5.tar.gz/from/this/mirror
            wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.8.tar.gz/from/http://mysql.he.net/
            wget “http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0″
            wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
            wget “http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0″
            wget http://pecl.php.net/get/memcache-2.2.6.tgz
            wget “http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0″
            wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.11.tar.gz
            wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
            wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
            wget http://ftp.gnu.org/gnu/bison/bison-2.4.3.tar.gz
            安裝libiconv、libmcrypt、libltdl、mhash、mcrypt
            cd /tmp/
            tar zxvf libiconv-1.13.1.tar.gz
            cd libiconv-1.13.1/
            ./configure –prefix=/usr/local
            make
            make install
            cd /tmp/
            tar zxvf libmcrypt-2.5.8.tar.gz
            cd libmcrypt-2.5.8/
            ./configure
            make
            make install
            /sbin/ldconfig
            cd libltdl/
            ./configure –enable-ltdl-install
            make
            make install
            cd /tmp/
            tar zxvf mhash-0.9.9.9.tar.gz
            cd mhash-0.9.9.9/
            ./configure
            make
            make install
            ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
            ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
            ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
            ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
            ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
            ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
            ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
            ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
            ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
            ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
            cd /tmp/
            tar zxvf mcrypt-2.6.8.tar.gz
            cd mcrypt-2.6.8/
            /sbin/ldconfig
            ./configure
            make
            make install
            安裝cmake
            cd /tmp/
            tar zxvf cmake-2.8.3.tar.gz
            cd cmake-2.8.3/
            ./configure –prefix=/usr
            gmake
            gmake install
            cd ../
            tar zxvf bison-2.4.3.tar.gz
            cd cd bison-2.4.3
            ./configure
            make
            make install
            準備用戶、目錄
            groupadd mysql
            useradd -g mysql mysql
            groupadd www
            useradd -g www www
            mkdir -p /data/mysql
            chown -R mysql:mysql /data/mysql
            mkdir -p /data/www
            chown -R www:www /data/www
            安裝mysql
            編譯

            cd /tmp/
            tar zxvf mysql-5.5.8.tar.gz
            cd mysql-5.5.8
            cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DSYSCONFDIR=/etc/ -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=on
            make
            make install
            ln -s /opt/mysql/lib/lib* /usr/lib/
            配置

            /opt/mysql/scripts/mysql_install_db –basedir=/opt/mysql/ –datadir=/data/mysql –user=mysql
            cd /opt/mysql/support-files
            ls一下你會看到有下面的文件: my-huge.cnf 【對應1-2G內存】、my-large.cnf 【對應512M內存】、my-medium.cnf 【對應128M內存】、my-small.cnf 【對應64M或更低】,你可以查看這些文件,參照你的電腦配置,選擇一個文件

            cp my-xxx.cnf /etc/my.cnf
            你可以再編輯my.cnf,自己調整下參數,也可以保持不變

            初始化和啟動

            cp /opt/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
            chkconfig –add mysqld
            chkconfig mysqld on
            /etc/rc.d/init.d/mysqld start
            cd /opt/mysql/
            bin/mysql_secure_installation
            按照提示設置root密碼等

            安裝php
            編譯

            cd /tmp/
            tar zxvf php-5.3.5.tar.gz
            cd php-5.3.5
            ./configure –prefix=/opt/php –with-config-file-path=/opt/php/etc –with-mysql=/opt/mysql –with-mysqli=/opt/mysql/bin/mysql_config –with-iconv-dir=/usr/local –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –disable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –enable-fpm –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-ldap –with-ldap-sasl –with-xmlrpc –enable-zip –enable-soap
            mkdir /opt/mysql/include/mysql
            ln -s /opt/mysql/include/* /opt/mysql/include/mysql/
            make ZEND_EXTRA_LIBS=’-liconv’
            make install
            cp php.ini-production /opt/php/etc/php.ini
            安裝擴展

            cd /tmp/
            tar zxvf memcache-2.2.6.tgz
            cd memcache-2.2.6
            /opt/php/bin/phpize
            ./configure –with-php-config=/opt/php/bin/php-config
            make
            make install

            cd /tmp/
            tar jxvf eaccelerator-0.9.6.1.tar.bz2
            cd eaccelerator-0.9.6.1/
            /opt/php/bin/phpize
            ./configure –enable-eaccelerator=shared –with-php-config=/opt/php/bin/php-config
            make
            make install
            vi /opt/php/etc/php.ini
            配置eaccelerator,在文件末尾添加

            [eaccelerator]
            zend_extension=”/opt/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so”
            eaccelerator.shm_size=”64″
            eaccelerator.cache_dir=”/tmp/eaccelerator”
            eaccelerator.enable=”1″
            eaccelerator.optimizer=”1″
            eaccelerator.check_mtime=”1″
            eaccelerator.debug=”0″
            eaccelerator.log_file = “/opt/php/var/log/eaccelerator_log”
            eaccelerator.filter=”"
            eaccelerator.shm_max=”0″
            eaccelerator.shm_ttl=”3600″
            eaccelerator.shm_prune_period=”3600″
            eaccelerator.shm_only=”0″
            eaccelerator.compress=”1″
            eaccelerator.compress_level=”9″
            mkdir -p /tmp/eaccelerator
            配置memcache,在文件中搜索extension_dir、extension ,在相應位置添加下面兩行

            extension_dir = “/opt/php/lib/php/extensions/no-debug-non-zts-20090626/”
            extension = “memcache.so”
            配置php-fpm

            cp /opt/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf
            vi /opt/php/etc/php-fpm.conf
            幾處修改,user/group要設好,其它選項可以自己調整

            [global]
            pid = run/php-fpm.pid
            error_log = log/php-fpm.log
            emergency_restart_threshold = 10
            emergency_restart_interval = 1m
            process_control_timeout = 5s
            [www]
            user = www
            group = www
            安裝nginx
            安裝pcre

            cd /tmp/
            tar zxvf pcre-8.11.tar.gz
            cd pcre-8.11/
            ./configure
            make && make install
            編譯

            cd /tmp/
            tar zxvf nginx-0.8.54.tar.gz
            cd nginx-0.8.54/
            ./configure –user=www –group=www –prefix=/opt/nginx –with-http_stub_status_module –with-http_ssl_module
            make && make install
            配置

            編輯/opt/nginx/conf/nginx.conf,這里給個簡單的例子

            view source

            print?

            user www www;
            worker_processes 1;

            error_log logs/error.log;
            #error_log logs/error.log notice;
            #error_log logs/error.log info;

            pid logs/nginx.pid;

            events {
            use epoll;
            worker_connections 1024;
            }

            http {
            include mime.types;
            default_type application/octet-stream;

            #log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
            # ‘$status $body_bytes_sent “$http_referer” ‘
            # ‘”$http_user_agent” “$http_x_forwarded_for”‘;

            #access_log logs/access.log main;

            sendfile on;
            tcp_nopush on;
            tcp_nodelay on;

            #keepalive_timeout 0;
            keepalive_timeout 60;

            gzip on;
            gzip_min_length 1k;
            gzip_buffers 4 16k;
            gzip_comp_level 2;
            gzip_types text/plain application/x-javascript text/css application/xml;

            server {
            listen 80;
            server_name localhost;

            #charset koi8-r;

            #access_log logs/host.access.log main;

            location / {
            root /data/www;
            index index.html index.htm index.php;
            }

            #error_page 404 /404.html;

            # redirect server error pages to the static page /50x.html
            #
            error_page 500 502 503 504 /50x.html;
            location = /50x.html {
            root html;
            }

            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            # proxy_pass http://127.0.0.1;
            #}

            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            location ~ \.php$ {
            root html;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
            include fastcgi_params;
            }

            # deny access to .htaccess files, if Apache’s document root
            # concurs with nginx’s one
            #
            #location ~ /\.ht {
            # deny all;
            #location ~ /\.ht {
            # deny all;
            #}
            }
            啟動服務器
            /opt/nginx/sbin/nginx
            /opt/php/sbin/php-fpm
            好了,你可以試著從瀏覽器訪問了。為了測試nginx和php是否協作正常,可以建一個test.php,內容為 ,將它放到到/data/www目錄中,從瀏覽器訪問http://your-server-ip-or-hostname/test.php,如果你能看到一個PHP的信息頁面就可以了。

            posted @ 2011-03-07 08:39 elprup 閱讀(960) | 評論 (0)編輯 收藏

            2010年11月28日 #

                 摘要:   閱讀全文
            posted @ 2010-11-28 14:33 elprup 閱讀(524) | 評論 (0)編輯 收藏

            2010年11月27日 #

                 摘要:   閱讀全文
            posted @ 2010-11-27 11:05 elprup 閱讀(544) | 評論 (1)編輯 收藏

            2010年11月22日 #

            http://www.webwareforpython.org/
            待編輯
            posted @ 2010-11-22 22:03 elprup 閱讀(209) | 評論 (0)編輯 收藏

            http://www.cheetahtemplate.org/
            中文含義:印度豹
            posted @ 2010-11-22 21:56 elprup 閱讀(248) | 評論 (0)編輯 收藏

            2010年11月7日 #

                 摘要:   閱讀全文
            posted @ 2010-11-07 08:36 elprup 閱讀(7344) | 評論 (0)編輯 收藏

            2010年11月4日 #

                 摘要: 網上許多解決方法都忽略了apache需要有setting.py的可執行權限這個  閱讀全文
            posted @ 2010-11-04 13:16 elprup 閱讀(1762) | 評論 (1)編輯 收藏

            2010年10月31日 #

                 摘要: 算法,包含的問題很多。解決一個算法的過程,是一個工程的過程。不僅需要從數學角度,獲得抽象,獲得問題可解性,以及復雜度的相關估計,還需要用語言,庫,系統調用將其實現,這就需要一些積累的經驗。兩者共同決定著一個算法問題的解決是否有效,是否優雅,是否可維護,是否易擴展。  閱讀全文
            posted @ 2010-10-31 20:53 elprup 閱讀(475) | 評論 (0)編輯 收藏

            僅列出標題  下一頁
            国产精品久久成人影院| 老司机午夜网站国内精品久久久久久久久 | 久久亚洲AV无码精品色午夜| 办公室久久精品| 伊人伊成久久人综合网777| 亚洲午夜无码久久久久| 国产精品一区二区久久不卡 | 久久久久亚洲AV无码去区首| 久久综合视频网站| 99久久免费国产精精品| 久久久精品日本一区二区三区| 一级做a爰片久久毛片看看| 99久久无色码中文字幕| 久久久久亚洲国产| 91精品观看91久久久久久| 欧美黑人激情性久久| 国产亚州精品女人久久久久久 | 91精品国产91久久久久久| 无夜精品久久久久久| 色偷偷88欧美精品久久久| 久久亚洲私人国产精品| 久久国产成人午夜aⅴ影院| 久久精品无码专区免费青青| 青青青青久久精品国产h久久精品五福影院1421 | 久久亚洲国产午夜精品理论片| 色青青草原桃花久久综合| 大蕉久久伊人中文字幕| aaa级精品久久久国产片| 99久久国产精品免费一区二区| 精品久久久久中文字幕一区| 99久久精品国产高清一区二区| 久久婷婷色综合一区二区| 久久亚洲高清综合| 久久本道久久综合伊人| 国産精品久久久久久久| 91精品国产乱码久久久久久| 久久精品国产网红主播| 漂亮人妻被黑人久久精品| 久久久久亚洲AV无码网站| 久久久久99精品成人片直播| 久久99亚洲网美利坚合众国|