• <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++實(shí)例研究

            從0開(kāi)始

              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              104 隨筆 :: 0 文章 :: 20 評(píng)論 :: 0 Trackbacks

            2012年2月1日 #

                 摘要:   閱讀全文
            posted @ 2012-02-01 17:34 elprup 閱讀(1659) | 評(píng)論 (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) | 評(píng)論 (2)編輯 收藏

            2011年3月7日 #

            centos5.5+nginx0.8.54+mysql5.5.8+php5.3.5 最新詳細(xì)安裝手冊(cè)

            轉(zhuǎn)載自:http://ggt8702.com/?p=146

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

            系統(tǒng)準(zhǔn)備和依賴(lài)程序庫(kù)安裝
            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
            準(zhǔn)備用戶(hù)、目錄
            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一下你會(huì)看到有下面的文件: my-huge.cnf 【對(duì)應(yīng)1-2G內(nèi)存】、my-large.cnf 【對(duì)應(yīng)512M內(nèi)存】、my-medium.cnf 【對(duì)應(yīng)128M內(nèi)存】、my-small.cnf 【對(duì)應(yīng)64M或更低】,你可以查看這些文件,參照你的電腦配置,選擇一個(gè)文件

            cp my-xxx.cnf /etc/my.cnf
            你可以再編輯my.cnf,自己調(diào)整下參數(shù),也可以保持不變

            初始化和啟動(dòng)

            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
            按照提示設(shè)置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
            安裝擴(kuò)展

            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 ,在相應(yīng)位置添加下面兩行

            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要設(shè)好,其它選項(xiàng)可以自己調(diào)整

            [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,這里給個(gè)簡(jiǎn)單的例子

            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;
            #}
            }
            啟動(dòng)服務(wù)器
            /opt/nginx/sbin/nginx
            /opt/php/sbin/php-fpm
            好了,你可以試著從瀏覽器訪(fǎng)問(wèn)了。為了測(cè)試nginx和php是否協(xié)作正常,可以建一個(gè)test.php,內(nèi)容為 ,將它放到到/data/www目錄中,從瀏覽器訪(fǎng)問(wèn)http://your-server-ip-or-hostname/test.php,如果你能看到一個(gè)PHP的信息頁(yè)面就可以了。

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

            2010年11月28日 #

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

            2010年11月27日 #

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

            2010年11月22日 #

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

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

            2010年11月7日 #

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

            2010年11月4日 #

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

            2010年10月31日 #

                 摘要: 算法,包含的問(wèn)題很多。解決一個(gè)算法的過(guò)程,是一個(gè)工程的過(guò)程。不僅需要從數(shù)學(xué)角度,獲得抽象,獲得問(wèn)題可解性,以及復(fù)雜度的相關(guān)估計(jì),還需要用語(yǔ)言,庫(kù),系統(tǒng)調(diào)用將其實(shí)現(xiàn),這就需要一些積累的經(jīng)驗(yàn)。兩者共同決定著一個(gè)算法問(wèn)題的解決是否有效,是否優(yōu)雅,是否可維護(hù),是否易擴(kuò)展。  閱讀全文
            posted @ 2010-10-31 20:53 elprup 閱讀(476) | 評(píng)論 (0)編輯 收藏

            僅列出標(biāo)題  下一頁(yè)
            最新久久免费视频| 精品国产一区二区三区久久蜜臀| 精品久久久无码人妻中文字幕| 久久九九精品99国产精品| 国产精品久久久久天天影视| 中文字幕无码久久人妻| 国产精品久久影院| 久久综合亚洲鲁鲁五月天| 精品蜜臀久久久久99网站| 日本国产精品久久| 粉嫩小泬无遮挡久久久久久| 久久婷婷五月综合97色直播| 国产激情久久久久影院| 久久久久高潮毛片免费全部播放| 四虎亚洲国产成人久久精品| 99久久久精品免费观看国产| 精品一二三区久久aaa片| 久久久精品日本一区二区三区| 无码人妻精品一区二区三区久久| 久久久久国产精品麻豆AR影院| 国产精品久久自在自线观看| 狠狠综合久久综合88亚洲| 久久国产V一级毛多内射| 日韩一区二区久久久久久| 国产亚洲美女精品久久久2020| 一级做a爰片久久毛片看看| 久久国产精品一区| 精品久久久久国产免费| 曰曰摸天天摸人人看久久久| 99久久久精品| 久久99国产精一区二区三区| 国内精品久久人妻互换| 久久久久久亚洲Av无码精品专口| 亚洲日韩中文无码久久| 精品国产日韩久久亚洲| 久久久久人妻一区二区三区| 人妻无码精品久久亚瑟影视 | 久久精品国产亚洲5555| 91精品无码久久久久久五月天| 91精品国产乱码久久久久久| 91精品国产高清久久久久久io|