01 2013 档案
【转】Yii framework config 可以被配置的项目
摘要:转自:http://www.dedecms.cn/post_190.html<?php// 取消下行的注释,来定义一个路径别名// Yii::setPathOfAlias('local','path/to/local-folder');// 这是 Web 应用配置的主体部分。任何可写的// CWebApplication 属性可以在这里配置。return array( // protected 目录的基础路径 // 使用 Yii::app()->basePath 来访问 'basePath'=>dirname(__FILE__) 阅读全文
posted @ 2013-01-25 11:05 风在竹林 阅读(315) 评论(0) 推荐(0)
【转】Yii的url美化管理
摘要:转自:http://hudeyong926.iteye.com/blog/1297515test.com/nvku想生成test.com/nvku/'urlSuffix'=>'/',要更改URL格式,我们应该配置urlManager应用元件,以便createUrl可以自动切换到新格式和应用程序可以正确理解新的网址:'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'urlSuffix& 阅读全文
posted @ 2013-01-24 17:11 风在竹林 阅读(596) 评论(0) 推荐(0)
【转】shell循环,判断介绍,以及实例
摘要:转自:http://blog.51yip.com/shell/1132.htmlshell的循环主要有3种,for,while,untilshell的分支判断主要有2种,if,case一,for循环 #!/bin/bash for file in $(ls /tmp/test/mytest |grep sh) //for in格式是shell for的基本格式,根js的for in类似 do //循环开始你就把它当成{ echo $file done //循环结束你就把它当成} ... 阅读全文
posted @ 2013-01-15 10:41 风在竹林 阅读(213) 评论(0) 推荐(0)
【转】/usr/bin/python^M: bad interpreter: No such file
摘要:转自:http://hanbaobao2005.blog.51cto.com/647054/635256今天在WingIDE下写了个脚本,传到服务器执行后提示:-bash: /usr/bin/autocrorder: /usr/bin/python^M: bad interpreter: No such file or directory分析:这是不同系统编码格式引起的:在windows系统中编辑的.sh .py文件可能有不可见字符,所以在Linux系统下执行会报以上异常信息。一般是因为windows行结尾和linux行结尾标识不同造成的。解决:1)在windows下转换:利用一些编辑器如Ul 阅读全文
posted @ 2013-01-14 22:41 风在竹林 阅读(179) 评论(0) 推荐(0)
【转】通过文件锁实现,程序开始运行时,先判断文件是否存在,若存在则表明该程序已经在运行了,如果不存在就用open函数创建该文件,程序退出时关闭文件并删除文件
摘要:转自:http://blog.csdn.net/tanyouliang/article/details/6922135 通过文件锁实现,程序开始运行时,先判断文件是否存在,若存在则表明该程序已经在运行了,如果不存在就用open函数创建该文件,程序退出时关闭文件并删除文件。 #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> ... 阅读全文
posted @ 2013-01-14 01:04 风在竹林 阅读(307) 评论(0) 推荐(0)
【转】关于C execlp函数的理解
摘要:转自:http://bachue.is-programmer.com/posts/21611.htmlhttp://support.sas.com/documentation/onlinedoc/sasc/doc/lr2/execlp.htmexeclp(从PATH 环境变量中查找文件并执行)相关函数fork,execl,execle,execv,execve,execvp表头文件#include<unistd.h>定义函数int execlp(const char * file,const char * arg,……);函数说明execlp()会从PATH 环境变量所指的目录中查 阅读全文
posted @ 2013-01-14 01:00 风在竹林 阅读(1475) 评论(0) 推荐(0)
【转】Linux和Unix安全编程HOWTO——小心对其它资源的调用出口
摘要:转自:http://man.chinaunix.net/tech/secure_programs_howto_cn/c711.html限制调用出口为合法值要 保证调用其它程序的出口只允许每个参数的合法而且期望的值。听起来不难,但实现起来就难得多了,因为有很多库调用或命令会以潜在的令人惊异的方式调用低级 例程。例如,若干popen(3)和system(3)一类的系统调用通过调用命令shell来实现,也就是说,它们会受到shell转义字符的影响。同 样,execlp(3)和execvp(3)也可能会调用shell。很多指南建议在产生一个进程时完全避免使用popen(3)、system(3)、 ex 阅读全文
posted @ 2013-01-14 00:55 风在竹林 阅读(306) 评论(0) 推荐(0)
【转】MySQL时间函数的使用:查询本周、下周、本月、下个月份的数据
摘要:转自:http://www.myexception.cn/mysql/485349.htmlMySQL时间函数的使用:查询本周、上周、本月、上个月份的数据【转】/*今天*/select * from 表名 where to_days(时间字段) = to_days(now());/*昨天*/select * from 表名 where to_days(now())-to_days(时间字段) = 1;/*近7天*/select * from 表名 where date_sub(curdate(), interval 7 day) <= date(时间字段);/*查询距离当前现在6个月的数 阅读全文
posted @ 2013-01-10 14:36 风在竹林 阅读(582) 评论(0) 推荐(0)
【转】php 得到上周,本周,上月,本月,本季度,上季度
摘要:转自:http://www.the8m.com/blog/article/phpa/phpwek.html注意强大的strtotime()函数和mktime()函数。 <?php echo date("Ymd",strtotime("now")), "\n"; echo date("Ymd",strtotime("-1 week Monday")), "\n"; echo date("Ymd",strtotime("-1 week Sund 阅读全文
posted @ 2013-01-10 14:33 风在竹林 阅读(242) 评论(0) 推荐(0)
【转】Shell Script 变量中的路径解析,类似php的pathinfo()
摘要:转自:http://www.it165.net/os/html/201208/3143.html编写Shell 脚本时,如果变量的值是一个路径的话,我们可以轻易的解析路径path信息,就像php中的pathinfo一样,来获取当中的路径(dirname) 或档名(basename).变量结果说明${path}/usr/local/bin/emacs原本值${path#/*/}local/bin/emacs去除第一个资料夹${path##/*/}emacs只取档名(basname)${path%/*}/usr/local/bin只取路径(dirname)${path:15}emacs取第15个字 阅读全文
posted @ 2013-01-08 13:32 风在竹林 阅读(260) 评论(0) 推荐(0)
【转】使用PHP计算上一个月的今天
摘要:转自:http://www.phppan.com/2011/06/php-last-month-today/一日,遇到一个问题,求上一个月的今天。 最开始我们使用strtotime(”-1 month”) 函数求值,发现有一个问题,月长度不一样的月份的计算结果有误。 比如:2011-03-31,得到的结果是2011-03-03。我们先不追究什么问题,先看如何解决问题。 此时,想起PHP中有一个mktime函数,于是自己写了如下代码:echo date("Y-m-d H:i:s", mktime(date("G", $time), date("i 阅读全文
posted @ 2013-01-06 17:20 风在竹林 阅读(320) 评论(0) 推荐(0)
【转】MySQL里获取当前week、month、quarter的start_date/end_date
摘要:转自:http://hideto.iteye.com/blog/255816当前week的第一天: select date_sub(curdate(),INTERVAL WEEKDAY(curdate()) + 1 DAY)当前week的最后一天:select date_sub(curdate(),INTERVAL WEEKDAY(curdate()) - 5 DAY)前一week的第一天:select date_sub(curdate(),INTERVAL WEEKDAY(curdate()) + 8 DAY)前一week的最后一天:select date_sub(curdate(),INT 阅读全文
posted @ 2013-01-06 11:11 风在竹林 阅读(367) 评论(0) 推荐(0)
【转】MySQL关于日期记录
摘要:转自:http://blog.csdn.net/dreamboycx/article/details/8293636http://blog.csdn.net/flm_0722/article/details/4961758http://blog.csdn.net/chenhj1988918/article/details/7569221本日、本周和本月的SQL语句 $time = time()+8*3600;$nowtime = date("Y-m-d",$time);$weekfirst = strtotime('-1 week Monday');$mon 阅读全文
posted @ 2013-01-06 11:01 风在竹林 阅读(274) 评论(0) 推荐(0)
【转】使用setuptools简化Python模块的安装
摘要:转自:http://blog.ihipop.info/2010/10/1719.html如果说Perl用户 一定熟悉 CPAN,那么Python用户一定熟悉setuptools默认activePython已经集成了这个工具,如果没有,可以在这里下载http://pypi.python.org/pypi/setuptools#downloads用法:cd /d E:\Python26\Scriptseasy_install 模块名软件会自动联网下载安装,linux用法一样。更多知识,参见IBM知识库http://www.ibm.com/developerworks/cn/linux/l-cppe 阅读全文
posted @ 2013-01-05 10:53 风在竹林 阅读(361) 评论(0) 推荐(0)
【转】How to Find or Validate an Email Address
摘要:转自:http://www.regular-expressions.info/email.htmlHow to Find or Validate an Email AddressThe regular expression I receive the most feedback, not to mention "bug" reports on, is the one you'll find right on this site's home page: \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b . This reg 阅读全文
posted @ 2013-01-03 16:34 风在竹林 阅读(344) 评论(0) 推荐(0)