爆炸贝导演的《危机13小时》中的经典台词:
他战死在一个本不该去的地方,
He died in a place he didn’t need tobe,死于一场不明缘由的战役,
in a battle over something he doesn’t understand,死于一个对他来说毫无意义的国度。
in a country that meant nothind to hime.
影片改变自2012年9月11日美国驻利比亚大使史蒂文斯遇袭身亡。
同样值得推荐的电影《孤独的生还者》。


爆炸贝导演的《危机13小时》中的经典台词:
他战死在一个本不该去的地方,
He died in a place he didn’t need tobe,死于一场不明缘由的战役,
in a battle over something he doesn’t understand,死于一个对他来说毫无意义的国度。
in a country that meant nothind to hime.
影片改变自2012年9月11日美国驻利比亚大使史蒂文斯遇袭身亡。
同样值得推荐的电影《孤独的生还者》。


PHP self 指向定义的 class。
PHP static 指向运行的 class,一般只有子类覆盖父类的 static 成员或者方法时,在父类中使用 static 会访问到子类。
class ParentClass
{
public static function hello()
{
echo "ParentClass: hello\n";
}
public static function run()
{
self::hello();
static::hello();
}
}
class ChildClass extends ParentClass
{
public static function hello()
{
echo "ChildClass: hello\n";
}
}
ParentClass::run();
// 输出
"ParentClass: hello"
"ParentClass: hello"
ChildClass::run();
// 输出
"ParentClass: hello"
"ChildClass: hello"
PHP 安装,从官网下载源码压缩包,进行 configure 遇到几个错误:
./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-bz2 –with-curl –enable-ftp –enable-sockets –disable-ipv6 –with-gd –with-jpeg-dir=/usr/local –with-png-dir=/usr/local –with-freetype-dir=/usr/local –enable-gd-native-ttf –with-iconv-dir=/usr/local –enable-mbstring –enable-calendar –with-gettext –with-libxml-dir=/usr/local –with-zlib –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd –with-mysql=mysqlnd –enable-dom –enable-xml –with-libdir=lib64 –enable-pdo –enable-fpm
configure: error: Please reinstall the BZip2 distribution
解决方案
yum install bzip2
yum install bzip2-devel
bzip2 可能已经安装过,bzip2-devel 没有安装
configure: error: Please reinstall the libcurl distribution –
easy.h should be in <curl-dir>/include/curl/
解决方案
yum install curl-devel
configure: error: jpeglib.h not found
解决方案
yum install libjpeg
yum -y install libjpeg-devel
libjpeg 可能已经安装过,libjpeg-devel 没有安装
使用 root 登录 mysql 服务器
use mysql;
// 设置 root 支持来自任意客户端可以访问
update user set host = ‘%’ where user = ‘root’;
// 设置 root 支持来自内网 IP 192.168.* 可以访问
update user set host = ‘192.168%’ where user = ‘root’;
user 中可能有多条 root 记录,执行上述语句更新时,可以先查询出 host、user 列表(select host,user from mysql.user),执行 update 语句时增加一个 where 条件判断,只更新其中一个 host。
Linux开机启动,启动 mysql,log,web service 等,将执行脚本的命令放置在 /etc/rc.d/rc.local 中,系统启动之后自动执行。
比如在 rc.local 增加一行 /web/server/nginx, 用于启动 nginx 服务。
HTML 定义的一个字母标签列表
| 标签 | 说明 |
| a | 定义超链接 |
| b | 定义粗体文本 |
| i | 定义斜体文本 |
| p | 定义段落 |
| q | 定义简短的行内引用,区别于 <blockquote> 定义块引用 |
| s | 定义删除线文本,是 <strike> 的缩写,但在 HTML 4.01 不赞成使用这两个标签,推荐使用 <del> 替代,目前浏览器仍然支持 |
| u | 定义下划线文本,在 HTML 4.01 不赞成使用,目前浏览器仍然支持 |
采用SVN进行代码管理,在平时开发中常遇到代码提之后,查看提交日志,发现提交的comment跟实际功能不够贴切,想要优化。或者代码提交之后发现没有写comment,想要补充。
TortoiseGit 默认必须填写comment,TortoiseSVN没有限制,难免出现点击提交按钮时没有填写comment。
使用TortoiseSVN修改comment,大致遇到
ask the administrator to create a pre-revprop-change hook
这样的提示。
在 Linux 系统下:
完成设置,重新使用 TortoiseSVN 修改comment即可。
使用TortoiseSVN无法查看文件提交日志,在服务器执行 svn log wp-login.php 看到的信息是
svn: Item is not readable
此时修改 svnserve.conf 文件,将 anon-access = read 修改为 anon-access = none
# 修改前
anon-access = read
# 修改后
anon-access = none
再次执行 svn log wp-login.php 可以看到文件提交日志。
我的博客升级到 4.5.1 之后,网页标题的分隔符从中文竖线“|”变成了“-”,刚开始看着不太习惯,而且发现源代码中“–”被转义成了实体“–”,这样看着更不舒服。
于是尝试修改WordPress网页标题分隔符。
刚开始仍然想使用“|”作为分隔符,后来决定参考网页标题分隔符采取哪一种比较好。
关于标题分隔符的建议:http://jingyan.baidu.com/article/bad08e1eae3fbb09c851213c.html
发现腾讯和网易都采用“_”作为标题分隔符,于是也计划改成“_”。
WordPress似乎没有提供配置修改网页标题分隔符。
修改文件 wp-includes/general-template.php
// 第 1022 行 // 修改前 $sep = apply_filters( 'document_title_separator', '-' ); // 修改后 $sep = apply_filters( 'document_title_separator', '_' ); // 第 1038 行 // 修改前 $title = implode( " $sep ", array_filter( $title ) ); // 修改后 $title = implode( "$sep", array_filter( $title ) );
基于七牛SDK实现目录上传和同步
使用官方提供的PHP SDK实现,重新使用PHP实现目录同步,而不是使用官方提供的Windows 程序,主要是因为 qrsbox.exe 会同步目录下的所有文件,包括 .svn 文件和一些项目配置文件,如 .project
七牛的PHP SDK下载地址:http://developer.qiniu.com/code/v7/sdk/php.html
本次实现的源码有几个功能:
PHP脚本每次执行都会比较目录下的所有文件,以此判断是否需要同步。
同名不同内容文件上传时会提示文件已存在,先删除旧文件,再提交新文件。
没有实现的功能: