Author: jpuyy

  • windows显示当前目录下文件和文件夹的绝对路径

    执行下面脚本

    @echo on
    @echo > txt.txt
    @echo ========输出当前目录下的文件夹 >> txt.txt
    @for /d %%i in (*.*) do @echo %~dp0%%%i>> txt.txt
    
    @echo ========输出当前目录下的文件 >> txt.txt
    @for %%c in (*.*) do @echo %~dp0%%%c>> txt.txt
    @pause;

    会在txt.txt中出现

    ========输出当前目录下的文件夹
    F:\剧集\法证先锋III
    F:\剧集\法证先锋粤语大结局抢先版
    F:\剧集\美剧
    ========输出当前目录下的文件
    F:\剧集\txt.txt
    F:\剧集\xx.bat

  • ubuntu下PAC Manager使用

    windows下面经常用Secure CRT来多标签连SSH

    linux下面用PAC Manager也是想当的顺手

    支持rsa加密的key来连接

    下载地址:http://sourceforge.net/projects/pacmanager/

    怎么生成key,看之前的ssh的key的生成

    在PAC Manager使用key的认证会提示说

    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    
    Permissions 0440 for '/home/jpuyy/Dropbox/key/xxxxx' are too open.
    It is recommended that your private key files are NOT accessible
    by others.
    This private key will be ignored.

    这样的话它是希望权限规定的越死越好,那么把文件弄成400,即只允许用户的读权限,其它一律不许

    chmod 400 xxx

    这样就可以了

    :)EOT

  • mysql启动失败

    /usr/sbin/mysqld status

    提示

    lc-messages-dir=/usr/share/mysql

    http://www.dotdeb.org/2011/11/01/mysql-5-5-is-finally-here/ 给出了解决方法

    在my.cnf中注释掉就可以了

    "The mysql-common package will be upgraded to version 5.5.17. It’s no
    big deal, it only contains retro-compatible configuration files."
    Wrong. The my.cnf delivered by mysql-common-5.5 contains the
    lc-messages-dir setting, which MySQL Server 5.1 cannot understand
    and will fail to start.To everyone who upgraded mysql-common to 5.5,
    but left mysql-server unchanged: Comment out the lc-messages-dir
    setting in my.cnf OR YOUR MYSQL SERVER WILL FAIL TO START.
    
     Best regards,
     Tobias
  • jQuery笔记

    所有jQuery位于下面函数中,为了防止文档在完全加载(就绪)之前运行 jQuery 代码

    $(document).ready(function(){
    
    --- jQuery functions go here ----
    
    });

    jQuery 有元素选择器和属性选择器

     

  • 不是觉得百来块的书贵么

    买到一包假南京烟

    十一块五浪费了

    不是觉得百来块的书贵么

    抽十来包烟,就能买一本,还觉得贵么?

  • 安装php5扩展模块eaccelerator

    首先下载eaccelerator最新版

    wget http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2

    网上的教程说要有/usr/local/php/bin/phpize,但是我的vps上的php是apt-get的没有怎么办?

    搜索得知要安装php5-dev才会有phpize,还要安装autoconf,automake

    apt-get install php5-dev autoconf automake

    安装到最后提示了

    update-alternatives: using /usr/bin/php-config5 to provide /usr/bin/php-config (php-config) in auto mode.
    update-alternatives: using /usr/bin/phpize5 to provide /usr/bin/phpize (phpize) in auto mode.

    既然给了上面的提示,就用带5的

    准备工作差不多了开始安装

    tar jxvf eaccelerator-0.9.6.1.tar.bz2
    cd eaccelerator-0.9.6.1
    /usr/bin/phpize5
    ./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-config5
    make
    make install

    提示说 Installing shared extensions:     /usr/lib/php5/20090626+lfs/

    这样创建缓存目录

    mkdir /tmp/eaccelerator
    chmod 777 /tmp/eaccelerator

    这时编辑/etc/php5/fpm/php.ini在最后加入如下代码

    配置项更具体准确的含义来自:https://eaccelerator.net/wiki/Settings

    vim /etc/php5/fpm/php.ini
    [eaccelerator]
    zend_extension="/usr/lib/php5/20090626+lfs/eaccelerator.so"
    eaccelerator.shm_size="32"
    eaccelerator.cache_dir="/tmp/eaccelerator"
    eaccelerator.enable="1"
    eaccelerator.optimizer="1"
    eaccelerator.check_mtime="1"
    eaccelerator.debug="0"
    eaccelerator.filter=""
    eaccelerator.shm_max="0"
    eaccelerator.shm_ttl="300"
    eaccelerator.shm_prune_period="120"
    eaccelerator.shm_only="0"
    eaccelerator.compress="1"
    eaccelerator.compress_level="9"

    重启下php5-fpm

    /etc/init.d/php5-fpm restart

    如何检测呢,搞一个phpinfo();

    eAccelerator 这一节的描述

    这时进到/tmp/eaccelerator会发现有不少的目录

    收获:

    有空的话还是要不怕麻烦编译安装,这样对程序会更熟悉

    不要从不靠谱的网上直接复制配置文件,复制过来的双引号全是中文的

    续:

    按wiki里面说的我查看了下最大共享大小

    cat /proc/sys/kernel/shmmax

    得到33554432

    用expr除了两次:

    expr 33554432 \/ 1024
     32768
     expr 32768 \/ 1024
     32

    而这样按配置设置64,php5-fpm就不能重启成功

    比如想弄成64,则

    echo 67108864 > /proc/sys/kernel/shmmax

    效果如何?

    不会测试,网上人说的是ea的作用就是让缓存里php文件不需要再次编译,这一点我觉得有可能吧