哪一天 哪一天 我有吃有穿有住有钱 不再流浪 流浪

Windows下Apache报错:通常每个套接字地址(协议/网络地址/端口)只允许使用一次

刚才sanp在windows平台下配置apache
报了如下一个错误:

(OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

导致这个问题的原因如下:

1: 可能是本机同时安装了IIS,占用了80端口,关闭IIS重启Apache
2: 可能是本机开着迅雷或者其他软件占用了80端口,试着关闭相关软件

sanp是因为本机开着迅雷导致这个问题, 关闭了就正常了.

Linux下批量删除.svn文件

用这个命令就可以了

find . -type d -name “.svn”|xargs rm -rf

[Ubuntu]perl: warning: Please check that your locale settings

From: http://bookmarks.honewatson.com/2009/05/30/perl-warning-please-check-that-your-locale-settings-ubuntu/

The fix (change to whatever language or version of english you’re using eg en_GB):

apt-get install language-pack-en-base


export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

If you get the following warning below for apt-get or dpkg in ubuntu:

perl: warning: Please check that your locale settings ubuntu

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = “en_US.UTF-8″,
LC_ALL = “en_US.UTF-8″,
LANG = “en_US.UTF-8″
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

如何去掉点击链接时出现的虚线框

把css写成如下即可
firefox和ie下点击链接时就不会出现虚线框啦

<style>
a {
outline: none; /* firefox */
hide-focus: expression(this.hideFocus = true); /* ie */
}
</style>
<a href=”#”>Click Me</a>

XCHM中文乱码如何解决?

我的xchm打开chm文件时

中文内容是可以显示的

但是目录列表里如果有中文, 则显示乱码

网上搜索了一下. 应该是xchm中文支持不是很好.

推荐安装chmsee

ubuntu 下 sudo apt-get install chmsee 即可

这个可以完美支持中文chm.

php-pdo-’SQLSTATE[HY093]: Invalid parameter number: no parameters were bound’

当你遇到这个错误的时候
请检查你的php版本
这是一个php的bug
版本低于php 5.2.9的pdo会报这个错误
将php升级至php 5.2.9以上即可
或者sql查询不要使用pdo

Dreamhost Cli下如何切换成php5?

现在新的Dreamhost用户的web环境使用的应该都是php5环境了

但是命令行模式下仍然使用的是php4的环境

如果你的脚本需要在php5环境下才能执行

用下面的方法强制使用php5即可

/usr/local/php5/bin/php test.php

php正则判断中文字符

$str = “中国”;

//if (preg_match(“/^[".chr(0xa1)."-".chr(0xff)."]+$/”, $str)) { //只能在GB2312情况下使用
if (preg_match(“/^[\x7f-\xff]+$/”, $str)) { //兼容gb2312,utf-8
echo “正确输入”;
} else {
echo “错误输入”;
}

编码表

双字节字符编码范围

1. GBK (GB2312/GB18030)
\x00-\xff GBK双字节编码范围
\x20-\x7f ASCII
\xa1-\xff 中文 gb2312
\x80-\xff 中文 gbk

2. UTF-8 (Unicode)

\u4e00-\u9fa5 (中文)
\x3130-\x318F (韩文
\xAC00-\xD7A3 (韩文)
\u0800-\u4e00 (日文)

原文链接 http://www.web1357.cn/post/php_regex_chinese.html

header Content-Type类型列表

$mimetypes = array(

‘ez’ => ‘application/andrew-inset’,

‘hqx’ => ‘application/mac-binhex40′,

‘cpt’ => ‘application/mac-compactpro’,

‘doc’ => ‘application/msword’,

‘bin’ => ‘application/octet-stream’,

‘dms’ => ‘application/octet-stream’,

‘lha’ => ‘application/octet-stream’,

‘lzh’ => ‘application/octet-stream’,

‘exe’ => ‘application/octet-stream’,

‘class’ => ‘application/octet-stream’,

’so’ => ‘application/octet-stream’,

‘dll’ => ‘application/octet-stream’,

‘oda’ => ‘application/oda’,

‘pdf’ => ‘application/pdf’,

‘ai’ => ‘application/postscript’,

‘eps’ => ‘application/postscript’,

‘ps’ => ‘application/postscript’,

’smi’ => ‘application/smil’,

’smil’ => ‘application/smil’,

‘mif’ => ‘application/vnd.mif’,

‘xls’ => ‘application/vnd.ms-excel’,

‘ppt’ => ‘application/vnd.ms-powerpoint’,

‘wbxml’ => ‘application/vnd.wap.wbxml’,

‘wmlc’ => ‘application/vnd.wap.wmlc’,

‘wmlsc’ => ‘application/vnd.wap.wmlscriptc’,

‘bcpio’ => ‘application/x-bcpio’,

‘vcd’ => ‘application/x-cdlink’,

‘pgn’ => ‘application/x-chess-pgn’,

‘cpio’ => ‘application/x-cpio’,

‘csh’ => ‘application/x-csh’,

‘dcr’ => ‘application/x-director’,

‘dir’ => ‘application/x-director’,

‘dxr’ => ‘application/x-director’,

‘dvi’ => ‘application/x-dvi’,

’spl’ => ‘application/x-futuresplash’,

‘gtar’ => ‘application/x-gtar’,

‘hdf’ => ‘application/x-hdf’,

‘js’ => ‘application/x-javascript’,

’skp’ => ‘application/x-koan’,

’skd’ => ‘application/x-koan’,

’skt’ => ‘application/x-koan’,

’skm’ => ‘application/x-koan’,

‘latex’ => ‘application/x-latex’,

‘nc’ => ‘application/x-netcdf’,

‘cdf’ => ‘application/x-netcdf’,

’sh’ => ‘application/x-sh’,

’shar’ => ‘application/x-shar’,

’swf’ => ‘application/x-shockwave-flash’,

’sit’ => ‘application/x-stuffit’,

’sv4cpio’ => ‘application/x-sv4cpio’,

’sv4crc’ => ‘application/x-sv4crc’,

‘tar’ => ‘application/x-tar’,

‘tcl’ => ‘application/x-tcl’,

‘tex’ => ‘application/x-tex’,

‘texinfo’ => ‘application/x-texinfo’,

‘texi’ => ‘application/x-texinfo’,

‘t’ => ‘application/x-troff’,

‘tr’ => ‘application/x-troff’,

‘roff’ => ‘application/x-troff’,

‘man’ => ‘application/x-troff-man’,

‘me’ => ‘application/x-troff-me’,

‘ms’ => ‘application/x-troff-ms’,

‘ustar’ => ‘application/x-ustar’,

’src’ => ‘application/x-wais-source’,

‘xhtml’ => ‘application/xhtml+xml’,

‘xht’ => ‘application/xhtml+xml’,

‘zip’ => ‘application/zip’,

‘au’ => ‘audio/basic’,

’snd’ => ‘audio/basic’,

‘mid’ => ‘audio/midi’,

‘midi’ => ‘audio/midi’,

‘kar’ => ‘audio/midi’,

‘mpga’ => ‘audio/mpeg’,

‘mp2′ => ‘audio/mpeg’,

‘mp3′ => ‘audio/mpeg’,

‘aif’ => ‘audio/x-aiff’,

‘aiff’ => ‘audio/x-aiff’,

‘aifc’ => ‘audio/x-aiff’,

‘m3u’ => ‘audio/x-mpegurl’,

‘ram’ => ‘audio/x-pn-realaudio’,

‘rm’ => ‘audio/x-pn-realaudio’,

‘rpm’ => ‘audio/x-pn-realaudio-plugin’,

‘ra’ => ‘audio/x-realaudio’,

‘wav’ => ‘audio/x-wav’,

‘pdb’ => ‘chemical/x-pdb’,

‘xyz’ => ‘chemical/x-xyz’,

‘bmp’ => ‘image/bmp’,

‘gif’ => ‘image/gif’,

‘ief’ => ‘image/ief’,

‘jpeg’ => ‘image/jpeg’,

‘jpg’ => ‘image/jpeg’,

‘jpe’ => ‘image/jpeg’,

‘png’ => ‘image/png’,

‘tiff’ => ‘image/tiff’,

‘tif’ => ‘image/tiff’,

‘djvu’ => ‘image/vnd.djvu’,

‘djv’ => ‘image/vnd.djvu’,

‘wbmp’ => ‘image/vnd.wap.wbmp’,

‘ras’ => ‘image/x-cmu-raster’,

‘pnm’ => ‘image/x-portable-anymap’,

‘pbm’ => ‘image/x-portable-bitmap’,

‘pgm’ => ‘image/x-portable-graymap’,

‘ppm’ => ‘image/x-portable-pixmap’,

‘rgb’ => ‘image/x-rgb’,

‘xbm’ => ‘image/x-xbitmap’,

‘xpm’ => ‘image/x-xpixmap’,

‘xwd’ => ‘image/x-xwindowdump’,

‘igs’ => ‘model/iges’,

‘iges’ => ‘model/iges’,

‘msh’ => ‘model/mesh’,

‘mesh’ => ‘model/mesh’,

’silo’ => ‘model/mesh’,

‘wrl’ => ‘model/vrml’,

‘vrml’ => ‘model/vrml’,

‘css’ => ‘text/css’,

‘html’ => ‘text/html’,

‘htm’ => ‘text/html’,

‘asc’ => ‘text/plain’,

‘txt’ => ‘text/plain’,

‘rtx’ => ‘text/richtext’,

‘rtf’ => ‘text/rtf’,

’sgml’ => ‘text/sgml’,

’sgm’ => ‘text/sgml’,

‘tsv’ => ‘text/tab-separated-values’,

‘wml’ => ‘text/vnd.wap.wml’,

‘wmls’ => ‘text/vnd.wap.wmlscript’,

‘etx’ => ‘text/x-setext’,

‘xsl’ => ‘text/xml’,

‘xml’ => ‘text/xml’,

‘mpeg’ => ‘video/mpeg’,

‘mpg’ => ‘video/mpeg’,

‘mpe’ => ‘video/mpeg’,

‘qt’ => ‘video/quicktime’,

‘mov’ => ‘video/quicktime’,

‘mxu’ => ‘video/vnd.mpegurl’,

‘avi’ => ‘video/x-msvideo’,

‘movie’ => ‘video/x-sgi-movie’,

‘ice’ => ‘x-conference/x-cooltalk’,

);

譬如想输出为txt文本类型的下载文件
可以这样

echo 'test';
header ("Content-type: text/plain");
header('Content-Disposition: attachment; filename="test.txt"');
?>

如何快速勾引蜘蛛

想更快速的勾引蜘蛛上你的站吗?
秘诀就是自动提交sitemap
经验证,精力最旺盛乃google spider.
提交一次,google蜘蛛就来一次.

$url = urlencode('http://domain.com/sitemap');

$ping_google = file_get_contents("http://www.google.com/webmasters/sitemaps/ping?sitemap=$url");

$ping_live = file_get_contents("http://webmaster.live.com/ping.aspx?siteMap=$url");

$ping_yahoo = file_get_contents("http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=url");
?>

每天sitemap更新后自动执行即可

返回顶部