chrome0x80040508错误

http://www.google.com/support/installer/bin/answer.py?answer=126299

此处可以得到解决方案

Alternate Google Chrome installer分享 打印
If you’re having problems using the standard Google Chrome installer at http://www.google.com/chrome, you can try the alternate installer available from the link below to download the latest version of the browser.
This alternate installer doesn’t require network connectivity to install Google Chrome. Once installed, Google Chrome will attempt to automatically update whenever it detects that a newer version of the browser is available. However, your network configuration may prevent the browser from updating properly. We recommend that you bookmark this page and come back periodically to manually download newer versions of Google Chrome. That way, you can be sure to receive important security fixes and feature improvements. You can see if updates are available by visiting the Google Chrome releases blog.
Download the alternate Google Chrome installer »
After you download the file, open it to complete your installation. For additional help, please visit the Google Chrome Help Center.

Alternate Google Chrome installer分享 打印If you’re having problems using the standard Google Chrome installer at http://www.google.com/chrome, you can try the alternate installer available from the link below to download the latest version of the browser.
This alternate installer doesn’t require network connectivity to install Google Chrome. Once installed, Google Chrome will attempt to automatically update whenever it detects that a newer version of the browser is available. However, your network configuration may prevent the browser from updating properly. We recommend that you bookmark this page and come back periodically to manually download newer versions of Google Chrome. That way, you can be sure to receive important security fixes and feature improvements. You can see if updates are available by visiting the Google Chrome releases blog.
Download the alternate Google Chrome installer »
After you download the file, open it to complete your installation. For additional help, please visit the Google Chrome Help Center.

shell后台执行

nohup  bash  shell.sh  &

这个命令运行以后,中断当前的会话不会导致这个shell中断运行

本次测试可行

测试shell全文如下:


#!/bin/sh
clear
for i in `seq 1 80000`; do
wget   http://localhost/x850/book/fetch/fetch.php?y -O result.log
done

君生我未生 我生君已老

君生我未生,我生君已老。
君恨我生迟,我恨君生早。
君生我未生,我生君已老。
恨不生同时,日日与君好。
我生君未生,君生我已老。
我离君天涯,君隔我海角。
我生君未生,君生我已老。
化蝶去寻花,夜夜栖芳草。
此诗为唐代铜官窑瓷器题诗,作者可能是陶工自己创作或当时流行的里巷歌谣。
1974-1978年间出土于湖南长沙铜官窑窑址。见陈尚君辑校《全唐诗补编》下册,
《全唐诗续拾》卷五十六,无名氏五言诗,第1642页,中华书局,1992年10月版

ubuntu安装nginx时出现错误的解决办法

./configure的时候提示

<div id="_mcePaste">./configure: error: the HTTP rewrite module requires the PCRE library.</div>
<div id="_mcePaste">You can either disable the module by using --without-http_rewrite_module</div>
<div id="_mcePaste">option, or install the PCRE library into the system, or build the PCRE library</div>
<div id="_mcePaste">statically from the source with nginx by using --with-pcre=<path> option.</div>
./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.

解决办法: apt-get install libpcre3 libpcre3-dev

本次ubuntu10。04  +nging 0。8。51测试可用

vi

http的缓存及PHP对etag,last-Modified,expires的处理

第一次请求的时候发送的数据包如下

<div id="_mcePaste">(Request-Line)	GET /cache/index.php HTTP/1.1</div>
<div id="_mcePaste">Host	localhost</div>
<div id="_mcePaste">User-Agent	Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12</div>
<div id="_mcePaste">Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</div>
<div id="_mcePaste">Accept-Language	zh-cn,en-us;q=0.7,en;q=0.3</div>
<div id="_mcePaste">Accept-Encoding	gzip,deflate</div>
<div id="_mcePaste">Accept-Charset	GB2312,utf-8;q=0.7,*;q=0.7</div>
<div id="_mcePaste">Keep-Alive	115</div>
<div id="_mcePaste">Connection	keep-alive</div>
<div id="_mcePaste">Cookie	cataedit_0=1; cataedit_6=1; cataedit_10=1; cataedit_12=1; cataedit_23=1; cataedit_30=1</div>
(Request-Line)	GET /cache/index.php HTTP/1.1Host	localhostUser-Agent	Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language	zh-cn,en-us;q=0.7,en;q=0.3Accept-Encoding	gzip,deflateAccept-Charset	GB2312,utf-8;q=0.7,*;q=0.7Keep-Alive	115Connection	keep-aliveCookie	cataedit_0=1; cataedit_6=1; cataedit_10=1; cataedit_12=1; cataedit_23=1; cataedit_30=1

返回的数据包


(Status-Line)<span style="white-space: pre;"> </span>HTTP/1.1 200 OK

Date<span style="white-space: pre;"> </span>Thu, 02 Dec 2010 01:59:07 GMT

Server<span style="white-space: pre;"> </span>Apache/2.2.14 (Ubuntu)

X-Powered-By<span style="white-space: pre;"> </span>PHP/5.3.2-1ubuntu4

Etag<span style="white-space: pre;"> </span>cached

Vary<span style="white-space: pre;"> </span>Accept-Encoding

Content-Encoding<span style="white-space: pre;"> </span>gzip

Content-Length<span style="white-space: pre;"> </span>39

Keep-Alive<span style="white-space: pre;"> </span>timeout=15, max=99

Connection<span style="white-space: pre;"> </span>Keep-Alive

Content-Type<span style="white-space: pre;"> </span>text/html

缓存以后,浏览器发送的请求如下


(Request-Line)<span style="white-space: pre;"> </span>GET /cache/index.php HTTP/1.1

Host<span style="white-space: pre;"> </span>localhost

User-Agent<span style="white-space: pre;"> </span>Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12

Accept<span style="white-space: pre;"> </span>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language<span style="white-space: pre;"> </span>zh-cn,en-us;q=0.7,en;q=0.3

Accept-Encoding<span style="white-space: pre;"> </span>gzip,deflate

Accept-Charset<span style="white-space: pre;"> </span>GB2312,utf-8;q=0.7,*;q=0.7

Keep-Alive<span style="white-space: pre;"> </span>115

Connection<span style="white-space: pre;"> </span>keep-alive

Cookie<span style="white-space: pre;"> </span>cataedit_0=1; cataedit_6=1; cataedit_10=1; cataedit_12=1; cataedit_23=1; cataedit_30=1

If-None-Match<span style="white-space: pre;"> </span>cached

Server返回的请求如下

<div id="_mcePaste">(Status-Line)	HTTP/1.1 304 Not Modified</div>
<div id="_mcePaste">Date	Thu, 02 Dec 2010 01:59:18 GMT</div>
<div id="_mcePaste">Server	Apache/2.2.14 (Ubuntu)</div>
<div id="_mcePaste">Connection	Keep-Alive</div>
<div id="_mcePaste">Keep-Alive	timeout=15, max=98</div>
<div id="_mcePaste">Etag	cached</div>
<div id="_mcePaste">Vary	Accept-Encoding</div>
(Status-Line)	HTTP/1.1 304 Not ModifiedDate	Thu, 02 Dec 2010 01:59:18 GMTServer	Apache/2.2.14 (Ubuntu)Connection	Keep-AliveKeep-Alive	timeout=15, max=98Etag	cachedVary	Accept-Encoding

主要区别在于请求的数据在已经缓存之后,也就是If-None-Match这个被设置之后,在发送的数据中多了一行

If-None-Match<span style="white-space: pre;"> </span>cached

而返回的数据也由200状态变成了304

PHP设置及检查此标识位的代码如下:


function cache() {

$etag = "cached";

if ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag) {

header('Etag:' . $etag, true, 304);

exit;

}

else

header('Etag:' . $etag);

}

另外与缓存相关的还有Last-Modified和expires,前者与etag相似,所不同的是标识不同,前者是http的编辑时间,后者是一个标识,相对来说后者较为灵活。

最后一个就是expires标识,这个默认在apache中不会开启,需要手动启用,

另外在含有SSI的服务器中的Last-Modified有不同的生成方法

本文参考了《构建高性能WEB站点》一书

某B2C图书采集程序改进

首先file_get_contents获取源码,然后用DOM  之类的各种方法解析,分解成各种块,然后分类存放到数据库里面

然后就可以采集了,我所遇到的问题是,开了N 个线程采集的时候,出现了重复采集的情况,就是一个页面采集了多次并且多次入库,造成数据库记录数目比页面个数多许多,出现的原因是查询上一个已经入库的ID 之后,在第一个采集的页面返回并且入库之前,又有新的线程来访问,并且获取了相同的需要采集的ID ,造成了重复采集。

问题很快解决了,方案很有效,但是不是很完美,因为数据库压力稍微有一些增大,即查询数据库中需要采集的下一个ID 的同时,插入一条数据占用数据库,这样下一个线程在采集的时候就不会再次采集这个ID 了,插入数据的这个线程在采集完成后,再更新数据库,采集完成。

ini_set memory limit

转自教主那里

http://www.neatstudio.com/show-1216-1.shtml

用法: int_set(“memory_limit”,”512M”);

如果你ini_set(“memory_limit”, *)返回了false,不妨检查下, 是否开启了安全模式(手册中没有述及)..

一句话, 记录下:在安全模式下不能使用ini_set的指令:

XML/HTML代码
1. max_execution_time
2. memory_limit
3. child_terminate

–EOF–

附:上文说的ini_set的问题,可以查看一下手册的Chapter 9. Runtime Configuration之How to change configuration settings。

风雪之隅的这个问题其实很常见,但却不会影响系统运行,无非是设置返回false了而己,但我说的是set_time_limit(),这个函数事实上也不会在safe_mode里运行,而且如果你开启了error_reporting(7)后,系统好象是直接无法访问【单位的网站就因为这个而导致程序出错】,由于我仅仅加了这一行,所以我在这行下面加上exit()后才发现safe_mode下,无法set_time_limit。其实这就是上面所说的ini_set中不能使用的max_execution_time。但问题是set_time_limit会有出错信息,而ini_set仅仅返回false。。这是两个不同的概念。

因此,如果你的服务器开启了safe_mode,你一定要看手册的这一章节:Functions restricted/disabled by safe mode。否则遇到问题,你会很头疼的。有的服务器喜欢在上传后直接把文件改到某个用户组,甚至改UID,如果这样,那move_upload_files就不能使用了。当然这种情况很少见,只是需要注意一下。

还有一些函数,也不再能够被使用。多看看手册,真好。

一个get参数控制是否自动刷新当前页面

if(isset ($_GET['y'])){
echo '<meta http-equiv="refresh" content="1" />';
}

带 ?y 参数则自动刷新当前页,不带则不自动刷新

PHP程序迁移常用SHELL

1。mysql 导入和导出

mysqldump导出的sql文件:mysqldump -p dbname > dbname.sql

mysql导入:mysql -p dbname < dbname.sql

2。打包文件

zip -r   abc.zip  /var/www/www.shuaizhu.com/*

将 后面目录下的所有文件打包到当前路径下的abc.zip文件中

解压文件  unzip abc.zip

3。linux主机之间相互传递文件

scp abc.zip  root@8.8.8.8:/var/www/

将当前目录下的abc.zip这个文件通过scp命令复制到 8。8。8。8这个主机下的 /var/www目录下,需要输入密码