• 网页禁止右键和复制

    2013-01-16 17:00:14 39657 0 技术文章
    <SCRIPT LANGUAGE=javascript>
    function click() {
    alert('Forbidden') }
    function mdown() {
    if (event.button==2) {alert('Forbidden') }}
    function CtrlKeyDown(){
    if (event.ctrlKey) {alert('Forbidden') }}
    document.onkeydown=CtrlKeyDown;
    document.onselectstart=click;
    document.onmousedown=mdown;
    </SCRIPT>
    
    • 睡五分钟等于六钟头的方法(熬夜必看)

      2012-10-21 07:29:55 28989 0 生活随笔
      • Nginx 使用 htpasswd 生成密码认证

        2012-10-08 10:26:58 28586 0 技术文章

        安装 httpd-tools

        yum install -y httpd-tools
        

        htpasswd 命令需要先安装 httpd-tools

        修改 nginx.conf

        # xxx.cuiliang.com
        server {
            listen       80;
            server_name  xxx.cuiliang.com;
            auth_basic "密码提示语";
            auth_basic_user_file /usr/local/nginx/conf/htpasswd.users;
        
            location / {
                //...
            }
        }
        

        使用 htpasswd 生成密码

        htpasswd -b /usr/local/nginx/conf/htpasswd.users
        

        输入密码,再次确认密码,提示成功,OK!

        重启 nginx

        /usr/local/nginx/sbin/nginx -s reload
        

        重启生效

      • 2012-09-13 16:57:38 3402 0 未分类
        • 《沁园春 房》二则

          2012-08-30 16:50:01 22088 2 生活随笔
          • WordPress 如何控制每页显示的条数

            2012-08-08 21:31:10 24072 2 技术文章

            进入 wordpress 后台 设置 > 阅读 > 修改博客页面最多显示几篇文章 Feeds 同步最新几篇文章 在这里修改就可以了!

            • Yii Framework 应用通过 UCenter 整合 discuz 视频教程

              2012-02-15 21:47:58 21314 1 技术文章

              这一讲主要讲了 Yii 应用和 discuz 通过 UCenter 实现了双向同步,有些代码写的也不是很严密,我只是给大家起个抛砖引玉的作用,大家如果有什么好的建议,欢迎讨论。提供程序源码及高清视频下载地址:

              Yii Framework 应用通过 UCenter 整合 discuz 视频教程

            • PHP 比较两个数组的值是否相等

              2011-06-28 21:04:00 25434 0 技术文章
              function compareArray() {
                  $arr1 = array('a', 'b', 'c', 'd');
                  $arr2 = array('d', 'c', 'b', 'a');
                  sort($arr1);
                  sort($arr2);
                  return $arr1 == $arr2;
              }
              
              • 新的 crontab 文件在 EOF 之前缺少换行符

                2011-02-26 21:25:00 3251 0 未分类

                crontab 启动报错:

                new crontab file is missing newline before EOF, can't install.
                Starting periodic command scheduler: cron.
                

                编辑现有的 crontab 文件:

                crontab -e
                

                确保在文件末尾添加一个空行(换行符)。你可以直接在编辑器中将光标移到文件的最后一行,然后按 Enter 键添加一个新的空行。

                保存并退出编辑器。

                如果你想通过命令行方式添加换行符,可以使用如下命令:

                crontab -l | sed -e '$a\' | crontab -
                

                这个命令做了以下几件事:

                • crontab -l 列出当前的 crontab 条目。
                • sed -e '$a\' 在文件末尾添加一个空行。
                • crontab - 通过标准输入将修改后的内容重新安装到 crontab 中。

                完成后,重新启动 cron 服务:

                sudo service cron restart  # 对于基于 Debian 的系统
                

                或者

                sudo systemctl restart crond  # 对于基于 RedHat 的系统
                

                这样应该就可以解决问题了。

                • Linux 中 grep 命令实现“或”条件

                  2011-02-12 12:34:00 26876 0 技术文章

                  \| 符号法

                  # grep 'cui\|liang'
                  

                  使用多个 -e 参数

                  # grep -e cui -e liang
                  

                  使用扩展 -E

                  # grep -E "cui|liang"
                  
                • CentOS 中 yum update 与 yum upgrade 的区别

                  2010-12-23 12:31:10 26933 0 技术文章

                  在 CentOS 系统中,yum upgradeyum update 都会将系统包更新到最新版本。

                  通过 man yum 查询到的帮助信息如下:

                  update

                  If  run  without any packages, update will update every currently installed package.  If one or more packages or package globs are specified, Yum will only update the listed packages.  While updating packages, yum will ensure
                  that all dependencies are satisfied. (See Specifying package names for more information) If the packages or globs specified match to packages which are not currently installed then update will not install them.  update  oper-
                  ates on groups, files, provides and filelists just like the "install" command.
                  
                  If the main obsoletes configure option is true (default) or the --obsoletes flag is present yum will include package obsoletes in its calculations - this makes it better for distro-version changes, for example: upgrading from
                  somelinux 8.0 to somelinux 9.
                  
                  Note that "update" works on installed packages first, and only if there are no matches does it look for available packages. The difference is most noticeable when you do "update foo-1-2" which will act exactly as "update foo"
                  if foo-1-2 is installed. You can use the "update-to" if you’d prefer that nothing happen in the above case.
                  

                  upgrade

                  Is the same as the update command with the --obsoletes flag set. See update for more details.
                  

                  唯一不同是:yum upgrade 会删除旧版本的 package,而 yum update 则会保留。注意!如果你的某些软件依赖旧版本的 package,请使用 yum update

                • HTTP状态码 : HTTP Status Code

                  2010-12-03 11:12:30 27187 0 技术文章

                  常见的状态码:

                  HTTP: Status 200 – 服务器成功返回网页 HTTP: Status 404 – 请求的网页不存在 HTTP: Status 503 – 服务不可用

                • 执行yiic命令提示'php.exe'不是内部或外部命令...的解决方法

                  2010-09-21 20:20:39 3378 0 技术文章

                  这个问题困扰我好久,解决的方法是把 php.exe 这个目录加入系统环境变量,这样就不会提示这样的错误了!

                  还有个问题就是每次执行 yiic 命令时要把 yiic 的全路径打出来才行,比如我的 Yii 框架在 e:/htdocs 里面,我每次执行的时候都要

                  > e:/htdocs/yii/yiic webapp yiiblog
                  

                  我们可以把 yiic 也加入系统环境变量,加入以下代码:

                  C:\php;E:\htdocs\yii\framework\
                  

                  此时我们执行 yiic 再不用打全路径了,这样方便多了。

                  > yiic webapp yiiblog
                  
                  • 关于

                    2009-09-26 22:29:26 22265 0 未分类

                    这里是 关于 页面,是一个 WordPress 页面样例,您可以编辑本页面,写上您和网站的信息以便读者了解您。您可以创建任意多的页面或者子页面,并在 WordPress 里管理所有这些。

                    • 博客正式开通了

                      2009-09-26 12:49:14 33053 0 未分类

                      自即日起,我的博客正式开通了!欢迎热爱生活以及爱好和研究 PHP 的朋友光临!