<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>马丁博客</title>
	<atom:link href="http://www.blags.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blags.org</link>
	<description>专注lamp的技术博客</description>
	<lastBuildDate>Sat, 05 Nov 2011 02:25:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://www.blags.org/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.blags.org/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed/&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>linux locate 快速查找命令介绍</title>
		<link>http://www.blags.org/linux-locate/</link>
		<comments>http://www.blags.org/linux-locate/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 03:34:14 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[locate]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=701</guid>
		<description><![CDATA[时间过得好快，一转眼一年又快到过年了，很久没有和大家分享了，工作实在太忙了。
使用linux的人都会知道find查找命令。
下面有关于find的使用说明 ：linux 查找命令大全。
下面给大家介绍一个快速查找工具locate，支持正则。
一般linux系统都会默认安装。没有默认安装也不要着急。
ubuntu：sudo apt-get install locate;
centos：yum -y install mlocate;
工作原理:通过定时任务定时生成文件名相关的数据文件（一般会存放在【/var/lib/mlocate/mlocate.db】），当然定时任务不会很实时,这个会导致刚刚安装的软件找不到，这时候大家需要使用（updatedb）来更新locate数据文件。

使用方法：locate xx(要查找的文件名) -l num（要显示的行数）。当然这个文件名在系统中出现太多，就需要用到-l这个参数。不然等着刷屏吧。
正则使用参数：-r, &#8211;regexp REGEXP
Search for a basic regexp REGEXP.  No PATTERNs  are  allowed  ifthis  option  is used, but this option can be specified multiple
times.
更多使用方法：man locate；
http://linux.about.com/od/commands/l/blcmdl1_locate.htm
]]></description>
			<content:encoded><![CDATA[<p>时间过得好快，一转眼一年又快到过年了，很久没有和大家分享了，工作实在太忙了。</p>
<p>使用<a href="http://www.blags.org/tags/linux/"target="_self"title="linux" >linux</a>的人都会知道find查找命令。</p>
<p>下面有关于find的使用说明 ：<span style="line-height: 28px;"><a title="文章链接: linux 查找命令大全" rel="bookmark" href="http://www.blags.org/linux-find-command-daquan/">linux 查找命令大全。</a></span></p>
<p><span style="line-height: 28px;">下面给大家介绍一个快速查找工具locate，支持正则。</span></p>
<p><span style="line-height: 28px;">一般linux系统都会默认安装。没有默认安装也不要着急。</span></p>
<p><span style="line-height: 28px;"><a href="http://www.blags.org/tags/ubuntu/"title="ubuntu" >ubuntu</a>：sudo apt-get install locate;</span></p>
<p><span style="line-height: 28px;"><a href="http://www.blags.org/tags/centos/"title="centos 系统" >centos</a>：yum -y install mlocate;</span></p>
<p><span style="line-height: 28px;">工作原理:通过定时任务定时生成文件名相关的数据文件（一般会存放在【/var/lib/mlocate/mlocate.db】），当然定时任务不会很实时,这个会导致刚刚安装的软件找不到，这时候大家需要使用（updatedb）来更新locate数据文件。<br />
</span></p>
<p><span style="line-height: 28px;">使用方法：locate xx(要查找的文件名) -l num（要显示的行数）。当然这个文件名在系统中出现太多，就需要用到-l这个参数。不然等着刷屏吧。</span></p>
<p><span style="line-height: 28px;">正则使用参数：-</span>r, &#8211;regexp REGEXP</p>
<div id="_mcePaste">Search for a basic regexp REGEXP.  No PATTERNs  are  allowed  ifthis  option  is used, but this option can be specified multiple</div>
<div id="_mcePaste">times.</div>
<p>更多使用方法：man locate；</p>
<p><a href="http://linux.about.com/od/commands/l/blcmdl1_locate.htm">http://linux.about.com/od/commands/l/blcmdl1_locate.htm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/linux-locate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>zabbix mysql全面监控</title>
		<link>http://www.blags.org/zabbix-mysql-comprehensive-monitoring/</link>
		<comments>http://www.blags.org/zabbix-mysql-comprehensive-monitoring/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 15:27:06 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[zabbix]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=697</guid>
		<description><![CDATA[背景：多台服务器管理，出现问题时只能跑到指定机器上查看日志信息。而cpu，mem使用情况在日志里面只能凭个人经验来判断是cpu，还是mem或者io出现问题，导致机器出现故障。而zabbix可以保存这些时间段，机器各项的信息从而能快速定位问题。]]></description>
			<content:encoded><![CDATA[<p>背景：多台服务器管理，出现问题时只能跑到指定机器上查看日志信息。</p>
<p>而cpu，mem使用情况在日志里面只能凭个人经验来判断是cpu，还是mem或者io出现问题，导致机器出现故障。而zabbix可以保存这些时间段，机器各项的信息从而能快速定位问题。</p>
<p>zabbix：包含了系统常用的监控，同时还可以自定义选项来监控（exp：访问量、在线）。扩展起来非常方便，所以就选择了zabbix。</p>
<p>对<a href="http://www.blags.org/tags/linux/"target="_self"title="linux" >linux</a>来说基本很大一部分机器都装有<a href="http://www.blags.org/tags/mysql/"title="mysql" >mysql</a>。同时官网也提供了php的监控方法（采用的时候zabbix_sender进行推送），但是这样每个机器就得装php才能监控，可是想想不用php也完全能完成（shell）。于是就自己写了监控脚本和大家大奖分享下。</p>
<p>具体思路：</p>
<ol>
<li>采集mysql自身的运行信息

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p697code1'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6971"><td class="code" id="p697code1"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">show</span> global <span style="color: #993333; font-weight: bold;">status</span>；</pre></td></tr></table></div>

</li>
<li>讲打印出来的mysql运行信息保存至临时文件（exp：/tmp/zabbix_mysql_%M.log）.<br />
这里很多人会问为什么要保存至文件呢，而不是直接返回呢？<br />
&lt;1&gt;.为了保证mysql取值时，不会频繁的进行数据库连接查询，而zabbix获取数据有事周期性的（本人使用的是60s/次）。所以本人使用分钟来生成文件，分钟内都取同一个文件。<br />
&lt;2&gt;.为了保证各项数据取到没有时间差。保证生成的线条一致性。</li>
</ol>
<p>好了废话不多说，下面是she脚本。</p>
<ol>
<li>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p697code2'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6972"><td class="code" id="p697code2"><pre class="shell" style="font-family:monospace;">#!/bin/sh
dateM=`date &quot;+%M&quot;`;
fileName='/tmp/zabbix_mysql_status_'$dateM&quot;.log&quot;;
if [ ! -f $fileName ]; then
	rm -f /tmp/zabbix_mysql_status*;
	mysql -uroot -p$1 -e 'show global status;' &amp;gt; $fileName;
fi;
if [  -f $fileName ]; then
	cat $fileName | grep -w &quot;$2&quot; | awk 'BEGIN {FS=&quot; &quot;} {print $2}'
fi;</pre></td></tr></table></div>

</li>
</ol>
<p>usage:</p>
<ol>
<li>复制以上内容保存到/usr/bin/zabbix_mysql.sh（或者<a href="#zabbix_mysql">直接下载</a>）.</li>
<li>赋予执行去权限（chmod +x /usr/bin/zabbix_mysql.sh）</li>
<li>里面有两个参数 $1：表示root密码，$2：监控项。<br />
exp:zabbix_mysql.sh rootpass Com_select（启动mysql的总查询次数）</li>
</ol>
<p>mysql status 介绍：<br />
<a href="http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html">http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html</a></p>
<p>效果图：</p>
<div id="attachment_698" class="wp-caption alignnone" style="width: 310px"><a href="http://www.blags.org/wp-content/Upload/zabbix-mysql.png"><img class="size-medium wp-image-698" title="zabbix mysql" src="http://www.blags.org/wp-content/Upload/zabbix-mysql-300x78.png" alt="zabbix mysql" width="300" height="78" /></a><p class="wp-caption-text">zabbix mysql</p></div>
<p>附件：<br />
<a name="zabbix_mysql"></a><br />
<a href="http://www.blags.org/wp-content/Upload/zabbix_mysql.sh.zip">zabbix mysql shell</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/zabbix-mysql-comprehensive-monitoring/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>wordpress 评论改进</title>
		<link>http://www.blags.org/wordpress-comments-to-improve/</link>
		<comments>http://www.blags.org/wordpress-comments-to-improve/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 15:54:40 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=685</guid>
		<description><![CDATA[wordpress 有强大的反垃圾评论插件akismet，也有各种各样的优秀评论插件。但是插件太多往往影响速度。而wordpress的评论只是提交了并不会自动返回，需要用户自己点击后退进行返回，严重影响用户体验。]]></description>
			<content:encoded><![CDATA[<p>wordpress 有强大的反垃圾评论插件akismet，也有各种各样的优秀评论插件。但是插件太多往往影响速度。而wordpress的评论只是提交了并不会自动返回，需要用户自己点击后退进行返回，严重影响用户体验。</p>
<p>本文就简单给大家介绍本人的评论优化方案。</p>
<ul>
<li>方案一</li>
</ul>
<p>餐用ajax提交，固然是体验最好的一种，采用ajax就必须在每个页面添加一段js固然会占用页面加载时间。</p>
<ul>
<li>方案二</li>
</ul>
<p>在<a href="http://www.blags.org/wp-comments-post.php">/wp-comments-post.php</a> 进行修改，方法比较简单。</p>
<ol>
<li>找到根目录下/wp-includes/functions.php</li>
<li>找到wp_die()方法。</li>
<li>将

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p685code3'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6853"><td class="code" id="p685code3"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wp_locale</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'rtl'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$wp_locale</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>text_direction <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$text_direction</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'rtl'</span><span style="color: #339933;">;</span>
<span style="color: #339933;">........</span>
	<a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">#之间</span></pre></td></tr></table></div>

<p>的内容替换成如下：</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p685code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6854"><td class="code" id="p685code4"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html xmlns<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'language_attributes'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> language_attributes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #339933;">/&gt;</span>
        <span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$title</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$admin_dir</span>; ?&gt;css/install.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'rtl'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$text_direction</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        <span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$admin_dir</span>; ?&gt;css/install-rtl.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">var</span> n<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'三'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'二'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'一'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>function $<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">return</span> document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>setInterval<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">var</span> t<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Number<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'t'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>$<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>innerHTML<span style="color: #339933;">=</span>n<span style="color: #009900;">&#91;</span>t<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>t<span style="color: #339933;">=</span>t<span style="color: #339933;">==</span><span style="color: #cc66cc;">3</span>?<span style="color: #cc66cc;">3</span><span style="color: #339933;">:</span>t<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>$<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'t'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>value<span style="color: #339933;">=</span>t<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>setTimeout<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>history<span style="color: #339933;">.</span>back<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;error-page&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;t&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>table width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;700&quot;</span> border<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> cellspacing<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;&lt;</span>td rowspan<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;125&quot;</span><span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">&gt;&lt;</span>img border<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/logo.jpg&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;马丁博客&quot;</span><span style="color: #339933;">&gt;&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;&lt;</span>td style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;font-size:13px;&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$message</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;&lt;/</span>tr<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;&lt;</span>td style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;font-size:11px;&quot;</span><span style="color: #339933;">&gt;</span>页面在 <span style="color: #339933;">&lt;</span>span id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;d&quot;</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;color:red&quot;</span><span style="color: #339933;">&gt;</span>四<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span> 秒后自动返回<span style="color: #339933;">,</span>如果你的浏览器没响应请 <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:history.back();&quot;</span><span style="color: #339933;">&gt;</span>点击此处<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> 返回继续<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;&lt;/</span>tr<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;&lt;</span>td style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;font-size:11px;&quot;</span><span style="color: #339933;">&gt;</span>Page automatically after a few seconds to <span style="color: #b1b100;">return</span><span style="color: #339933;">,</span> <span style="color: #b1b100;">if</span> your browser did not respond to <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:history.back();&quot;</span><span style="color: #339933;">&gt;</span>Click here<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> to <span style="color: #b1b100;">return</span> to continue<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;&lt;/</span>tr<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;/</span>table<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

</li>
</ol>
<p>下面是效果图：</p>
<div id="attachment_687" class="wp-caption alignnone" style="width: 310px"><a href="http://www.blags.org/wp-content/Upload/wordpress-comment.png"><img src="http://www.blags.org/wp-content/Upload/wordpress-comment-300x66.png" alt="wordpress-comment" title="wordpress-comment" width="300" height="66" class="size-medium wp-image-687" /></a><p class="wp-caption-text">wordpress-comment</p></div>
<div style="display:none">ad6bc206</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/wordpress-comments-to-improve/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>google +1加载慢解决办法</title>
		<link>http://www.blags.org/google-plusone-slow-loading-solution/</link>
		<comments>http://www.blags.org/google-plusone-slow-loading-solution/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 16:54:59 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[WEB]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google+1]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=681</guid>
		<description><![CDATA[使用google+1一段时间了，发现不是很稳定，一段时间能用一段时间不能用，在国内加载速度有时间奇慢，和gmail一样。
期待改善。]]></description>
			<content:encoded><![CDATA[<p>使用google+1一段时间了，发现不是很稳定，一段时间能用一段时间不能用，在国内加载速度有时间奇慢，和gmail一样。<br />
期待改善。</p>
<h4>google +1介绍：</h4>
<p><span> Google +1 is yet another attempt to make Google more social. It&#8217;s Google&#8217;s version of the Facebook &#8220;likes&#8221;, a simple feature that&#8217;s very powerful because it&#8217;s part of a social network.</span></p>
<p>既然想使用它，就得想办法改善它，不让他影响网页的加载。</p>
<p>本人的做法是 &#8211; 采用异步加载:</p>
<p>将要加载的内容放在网页&lt;/body&gt;结束符之前位置，来保证网页顺利加载。</p>
<p>采用js加载js的办法进行js加载，就不会影响网页的加载了。</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p681code5'); return false;">View Code</a> JS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6815"><td class="code" id="p681code5"><pre class="js" style="font-family:monospace;">document.write('&lt;script type=&quot;text/javascript&quot; src=&quot;https://apis.google.com/js/plusone.js&quot;&gt;&lt;\/script&gt;');</pre></td></tr></table></div>

<p>在需要的地方加上g:plusone标签：</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p681code6'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6816"><td class="code" id="p681code6"><pre class="html" style="font-family:monospace;">&lt;g:plusone count=&quot;false&quot; href=&quot;http://www.blags.org&quot;&gt;&lt;/g:plusone&gt;</pre></td></tr></table></div>

<p>获取地址:</p>
<p><a title="google+1" href="http://www.google.com/intl/zh-CN/+1/button/index.html">http://www.google.com/intl/zh-CN/+1/button/index.html</a><br />
<a title="google+1代码获取" href="http://www.google.com/intl/zh-CN/webmasters/+1/button/index.html">http://www.google.com/intl/zh-CN/webmasters/+1/button/index.html</a></p>
<div id="attachment_692" class="wp-caption alignnone" style="width: 310px"><a href="http://www.blags.org/wp-content/Upload/google-plus.gif"><img src="http://www.blags.org/wp-content/Upload/google-plus-300x154.jpg" alt="google-plus" title="google-plus" width="300" height="154" class="size-medium wp-image-692" /></a><p class="wp-caption-text">google-plus</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/google-plusone-slow-loading-solution/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php 安全问题</title>
		<link>http://www.blags.org/php-security-issue/</link>
		<comments>http://www.blags.org/php-security-issue/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 04:01:07 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[后台]]></category>
		<category><![CDATA[安全]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=674</guid>
		<description><![CDATA[做web开发，相信搭建都知道一些安全基本知识，&#8221;千万不能相信客户端数据&#8220;。而php又是一种弱类型语言。很多人在开发过程中忽略了类型转换，参数过滤直接量成不可估量的后果。
不使用过滤函数可能出现以下情况：

数据库被(sql)注入。直接可以导致你的系统崩溃，系统数据丢失，用户信息丢失。
网站被挂马，遇到文件处理则可以将你的网站文件删除。

另外值得一提的是很多人认为开启php安全模式就万事大吉了。其实不然，很多注入者往往绕过正面，进行侧面进攻。

使用 0&#215;7e,0&#215;27等(ASCII码)字符串来充当引号，而php又无法过滤。
注入的一般方式都是在参数里面加入很多mysql sql语法，去获取敏感数据信息。

exp：

View Code SQLand&#40;select 1 from&#40;select count&#40;*&#41;,concat&#40;&#40;select &#40;select &#40;select concat&#40;0x7e,0x27,phpcms_member.username,0x27,0x7e&#41; from phpcms_member limit 0,1&#41;&#41; from information_schema.tables limit 0,1&#41;,floor&#40;rand&#40;0&#41;*2&#41;&#41;x from information_schema.tables group by x&#41;a&#41; and 1=1

mysql information_schema.tables 所有用户都可见可查，能查出所有表结构信息，数据库信息。
php开源系统很多，很多开源系统大家知道数据结构，已级敏感信息表。(这里当然也包括不法分子)
这里指的敏感信息：往往是一些用户信息，管理端信息。现在md5的穷举一直在进行着。很多的md5加密之后的密码仍然能被解密成明文。
很多系统都做了相应的安全提升。
下面介绍以下常见手段：

使用过滤函数，php filter 安全过滤函数.
md5(  md5(&#8216;用户密码&#8217;) . &#8216;私钥&#8217; ) 得出加密结果。
常用的php开源系统后台一定要修改目录名。很多系统后台直接使用admin作为后台入口。
不要将phpmyadmin等数据库操作软件安置在网站可见目录。

等等。。之所以这样是由于现在大量存在扫描工具去扫描这样的管理端。
下面是惊心的一张图
]]></description>
			<content:encoded><![CDATA[<p>做web开发，相信搭建都知道一些安全基本知识，&#8221;<span style="color: #ff0000;">千万不能相信客户端数据</span>&#8220;。而php又是一种弱类型语言。很多人在开发过程中忽略了类型转换，参数过滤直接量成不可估量的后果。</p>
<p>不使用过滤函数可能出现以下情况：</p>
<ul>
<li>数据库被(sql)注入。直接可以导致你的系统崩溃，系统数据丢失，用户信息丢失。</li>
<li>网站被挂马，遇到文件处理则可以将你的网站文件删除。</li>
</ul>
<p>另外值得一提的是很多人认为开启php安全模式就万事大吉了。其实不然，很多注入者往往绕过正面，进行侧面进攻。</p>
<ul>
<li>使用 <span style="color: #ff0000;">0&#215;7e,0&#215;27</span>等(<span style="color: #ff0000;">ASCII码</span>)字符串来充当引号，而php又无法过滤。</li>
<li>注入的一般方式都是在参数里面加入很多<a href="http://www.blags.org/tags/mysql/"title="mysql" >mysql</a> sql语法，去获取敏感数据信息。</li>
</ul>
<p>exp：</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p674code8'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6748"><td class="code" id="p674code8"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">and</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">select</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">from</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">select</span> count<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>concat<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">select</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">select</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">select</span> concat<span style="color: #66cc66;">&#40;</span>0x7e<span style="color: #66cc66;">,</span>0x27<span style="color: #66cc66;">,</span>phpcms_member<span style="color: #66cc66;">.</span>username<span style="color: #66cc66;">,</span>0x27<span style="color: #66cc66;">,</span>0x7e<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">from</span> phpcms_member <span style="color: #993333; font-weight: bold;">limit</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">from</span> information_schema<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">tables</span> <span style="color: #993333; font-weight: bold;">limit</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>floor<span style="color: #66cc66;">&#40;</span>rand<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>x <span style="color: #993333; font-weight: bold;">from</span> information_schema<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">tables</span> <span style="color: #993333; font-weight: bold;">group</span> <span style="color: #993333; font-weight: bold;">by</span> x<span style="color: #66cc66;">&#41;</span>a<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">and</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">1</span></pre></td></tr></table></div>

<p>mysql information_schema.tables 所有用户都可见可查，能查出所有表结构信息，数据库信息。</p>
<p>php开源系统很多，很多开源系统大家知道数据结构，已级敏感信息表。(<span style="color: #ff0000;">这里当然也包括不法分子</span>)</p>
<p>这里指的敏感信息：往往是一些用户信息，管理端信息。现在<span style="color: #ff0000;">md5的穷举</span>一直在进行着。很多的md5加密之后的密码仍然能被解密成明文。</p>
<p>很多系统都做了相应的安全提升。</p>
<p>下面介绍以下常见手段：</p>
<ul>
<li>使用过滤函数，<a title="php filter 安全过滤函数" href="http://www.blags.org/php-security-filter-function/">php filter 安全过滤函数</a>.</li>
<li>md5(  md5(&#8216;用户密码&#8217;) . &#8216;私钥&#8217; ) 得出加密结果。</li>
<li>常用的php开源系统后台一定要修改目录名。很多系统后台直接使用<span style="color: #ff0000;">admin</span>作为后台入口。</li>
<li>不要将phpmyadmin等数据库操作软件安置在网站可见目录。</li>
</ul>
<p>等等。。之所以这样是由于现在大量存在扫描工具去扫描这样的管理端。</p>
<p>下面是惊心的一张图</p>
<div id="attachment_675" class="wp-caption alignnone" style="width: 310px"><a href="http://www.blags.org/wp-content/Upload/mysql-zhu-ru.png"><img src="http://www.blags.org/wp-content/Upload/mysql-zhu-ru-300x223.png" alt="mysql 注入" title="mysql 注入" width="300" height="223" class="size-medium wp-image-675" /></a><p class="wp-caption-text">mysql 注入</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/php-security-issue/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php filter 安全过滤函数</title>
		<link>http://www.blags.org/php-security-filter-function/</link>
		<comments>http://www.blags.org/php-security-filter-function/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 03:59:30 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[filter]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=676</guid>
		<description><![CDATA[php 利用filter 扩展编写的参数处理静态类,欢迎使用。
希望大家看得开心，用得放心。]]></description>
			<content:encoded><![CDATA[<p>php 利用filter 扩展编写的参数处理静态类,欢迎使用。<br />
希望大家看得开心，用得放心。</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p676code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6769"><td class="code" id="p676code9"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * @参数验证函数
 * @method:
 * @license http://www.blags.org/
 * @created:2011年07月02日 11时00分
 * @copyright 1997-2011 The Martin Group
 * @author Martin &lt;martin@blags.org&gt; 
 * */</span>
abstract <span style="color: #000000; font-weight: bold;">class</span> CFilter
<span style="color: #009900;">&#123;</span>
	<span style="color: #009933; font-style: italic;">/**
	 * 类型
	 * @var array
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000088;">$varType</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'GET'</span>	<span style="color: #339933;">=&gt;</span> INPUT_GET<span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'POST'</span>	<span style="color: #339933;">=&gt;</span> INPUT_POST<span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'COOKIE'</span><span style="color: #339933;">=&gt;</span> INPUT_COOKIE<span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'SERVER'</span><span style="color: #339933;">=&gt;</span> INPUT_SERVER<span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'ENV'</span>	<span style="color: #339933;">=&gt;</span> INPUT_ENV
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000088;">$filterType</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'STRING'</span>	<span style="color: #339933;">=&gt;</span>	FILTER_SANITIZE_STRING<span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'INT'</span>		<span style="color: #339933;">=&gt;</span>	FILTER_VALIDATE_INT<span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'BOOLEAN'</span>	<span style="color: #339933;">=&gt;</span>	FILTER_VALIDATE_BOOLEAN<span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'FLOAT'</span>		<span style="color: #339933;">=&gt;</span>	FILTER_VALIDATE_FLOAT<span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'REGEXP'</span>	<span style="color: #339933;">=&gt;</span>	FILTER_VALIDATE_REGEXP<span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'URL'</span>		<span style="color: #339933;">=&gt;</span>	FILTER_VALIDATE_URL<span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'EMAIL'</span>		<span style="color: #339933;">=&gt;</span>	FILTER_VALIDATE_EMAIL<span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'IP'</span>		<span style="color: #339933;">=&gt;</span>	FILTER_VALIDATE_IP<span style="color: #339933;">,</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 支持过滤列表
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> static <span style="color: #000000; font-weight: bold;">function</span> lists<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/filter_list"><span style="color: #990000;">filter_list</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 验证类型
	 * @param string $type
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> filterType<span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$filter_list</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">lists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/array_search"><span style="color: #990000;">array_search</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span><span style="color: #000088;">$filter_list</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span> ? <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 
	 * @param $setVarType
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> static <span style="color: #000000; font-weight: bold;">function</span> getVarType<span style="color: #009900;">&#40;</span><span style="color: #000088;">$setVarType</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$setVarType</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtoupper"><span style="color: #990000;">strtoupper</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$setVarType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$varType</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$setVarType</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$varType</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$setVarType</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 
	 * @param string $setFilterType
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> static <span style="color: #000000; font-weight: bold;">function</span> getFilterType<span style="color: #009900;">&#40;</span><span style="color: #000088;">$setFilterType</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$setFilterType</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtoupper"><span style="color: #990000;">strtoupper</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$setFilterType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$filterType</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$setFilterType</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$filterType</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$setFilterType</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 检测参数是否存在
	 * @param string $setVarType
	 * @param string $varName
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> VarExists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$setVarType</span><span style="color: #339933;">,</span><span style="color: #000088;">$varName</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$FilterVarType</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">getVarType</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$setVarType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_null"><span style="color: #990000;">is_null</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$FilterVarType</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/filter_has_var"><span style="color: #990000;">filter_has_var</span></a><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$varType</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$FilterVarType</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$varName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 
	 * @param string $setVarType
	 * @param string $varName
	 * @param string $filterType
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> FilterInput<span style="color: #009900;">&#40;</span><span style="color: #000088;">$setVarType</span><span style="color: #339933;">,</span> <span style="color: #000088;">$varName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filterType</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'INT'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$FilterVarType</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">getVarType</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$setVarType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$filterType</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">getFilterType</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filterType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_null"><span style="color: #990000;">is_null</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$FilterVarType</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/is_null"><span style="color: #990000;">is_null</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filterType</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/filter_input"><span style="color: #990000;">filter_input</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$FilterVarType</span><span style="color: #339933;">,</span> <span style="color: #000088;">$varName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filterType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 验证变量
	 * @param string $var
	 * @param string $filterType
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> FilterVar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #000088;">$filterType</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$filterType</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">getFilterType</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filterType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/filter_var"><span style="color: #990000;">filter_var</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filterType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 字符串
	 * @param string $var
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> String<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">FilterVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'STRING'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Int<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">FilterVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'INT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Boolean<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">FilterVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'INT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Float<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">FilterVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'FLOAT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * 
	 * @param string $var
	 * @param array $option array(&quot;options&quot;=&gt;array(&quot;regexp&quot;=&gt;&quot;/^M(.*)/&quot;))
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Regexp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$filterType</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">getFilterType</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filterType</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <a href="http://www.php.net/filter_var"><span style="color: #990000;">filter_var</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filterType</span><span style="color: #339933;">,</span> <span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">FilterVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'URL'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">FilterVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'EMAIL'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Ip<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">FilterVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'IP'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>参考地址：<a href="http://www.php.net/manual/en/book.filter.php">http://www.php.net/manual/en/book.filter.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/php-security-filter-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql 数据导入导出方法</title>
		<link>http://www.blags.org/mysql-data-import-and-export-methods/</link>
		<comments>http://www.blags.org/mysql-data-import-and-export-methods/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 16:55:15 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=669</guid>
		<description><![CDATA[众所周知mysql的数据导出方法，可以使用到mysqldump这个命令,其中如果导出指定格式的数据困扰了我。
比如到处数据用逗号(&#8216;)，竖线(&#124;)隔开的数据。很多人会说使用用

mysql -uUser -pPwd dbName -e &#8220;$sql&#8221; 进行导出。
其中$sql使用 SELECT * FROM `TABLENAME` WHERE xxx INTO OUTFILE &#8220;指定文件路劲&#8221; FIELDS TERMINATED BY &#8221;&#124;&#8220;

这种往往很多会报没有权限之类的莫名其妙的错误。
错误一

View Code ERRORERROR 1045 (28000) at line 1: Access denied for user 'qinghua'@'localhost' (using password: YES)

错误二

View Code ERRORERROR 1 (HY000) at line 1: Can't create/write to file '/home/martin/outfile' (Errcode: 13)

错误一是由于普通用户没有执行权限，错误二是由于没有权限穿件文件&#8221;aa&#8221;。
正确的做应该是

View Code SHELLmysql -uqinghua -p123456 qinghua --e &#34;select <a href="http://www.blags.org/mysql-data-import-and-export-methods/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>众所周知<a href="http://www.blags.org/tags/mysql/"title="mysql" >mysql</a>的数据导出方法，可以使用到mysqldump这个命令,其中如果导出指定格式的数据困扰了我。</p>
<p>比如到处数据用逗号(&#8216;)，竖线(|)隔开的数据。很多人会说使用用</p>
<ul>
<li>mysql -uUser -pPwd dbName -e &#8220;$sql&#8221; 进行导出。<br />
其中$sql使用 SELECT * FROM `TABLENAME` WHERE xxx INTO OUTFILE &#8220;指定文件路劲&#8221; FIELDS TERMINATED BY &#8221;<span style="color: #ff0000;">|</span>&#8220;</li>
</ul>
<p>这种往往很多会报没有权限之类的莫名其妙的错误。</p>
<p>错误一</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p669code14'); return false;">View Code</a> ERROR</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p66914"><td class="code" id="p669code14"><pre class="error" style="font-family:monospace;">ERROR 1045 (28000) at line 1: Access denied for user 'qinghua'@'localhost' (using password: YES)</pre></td></tr></table></div>

<p>错误二</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p669code15'); return false;">View Code</a> ERROR</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p66915"><td class="code" id="p669code15"><pre class="error" style="font-family:monospace;">ERROR 1 (HY000) at line 1: Can't create/write to file '/home/martin/outfile' (Errcode: 13)</pre></td></tr></table></div>

<p><span style="color: #ff0000;">错误一是由于普通用户没有执行权限，错误二是由于没有权限穿件文件&#8221;aa&#8221;。</span><br />
正确的做应该是</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p669code16'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p66916"><td class="code" id="p669code16"><pre class="shell" style="font-family:monospace;">mysql -uqinghua -p123456 qinghua --e &quot;select * from qinghua.user where 1 into outfile 'outfile' FIELDS TERMINATED BY'|'&quot;</pre></td></tr></table></div>

<p>这样它穿件的文件会出现在mysql datadir目录对应的数据库文件夹内。</p>
<p>如果想把文件创建到指定目录内。那你一定得赋予改目录mysql写入权限。</p>
<p>一般的做法是</p>
<p>mkdir -p /home/martin/outdata;<br />
chown mysql.mysql /home/martin/outdata;</p>
<p>sudo chmod 777 /home/martin/outdata;</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p669code17'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p66917"><td class="code" id="p669code17"><pre class="shell" style="font-family:monospace;">mysql -uqinghua -p123456 qinghua --e &quot;select * from qinghua.user where 1 into outfile '/home/martin/outdata/outfile' FIELDS TERMINATED BY'|'&quot;</pre></td></tr></table></div>

<p>mysqldump参数介绍：</p>
<ul>
<li>&#8211;w 设定导出的条件。</li>
<li>&#8211;no-create-db 导出时不到出穿件数据库。</li>
<li>&#8211;no-create-info 不创建表结构。</li>
<li>&#8211;xml 导出xml格式文件。</li>
<li>&#8211;skip-add-drop-table 不创建删除表结构语句。</li>
</ul>
<p>mysql数据导入一般使用 mysql -uUser -pPwd dbName &lt; xxx.sql，或者使用source进行导入。</p>
<p>参考地址：</p>
<p><a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html">http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html</a></p>
<p><a href="http://dev.mysql.com/doc/refman/5.1/zh/replication.html">http://dev.mysql.com/doc/refman/5.1/zh/replication.html</a> 生成二进制日志，进行双机热备。</p>
<p>错误：</p>
<div id="attachment_690" class="wp-caption alignnone" style="width: 309px"><a href="http://www.blags.org/wp-content/Upload/mysql-output1.png"><img src="http://www.blags.org/wp-content/Upload/mysql-output1.png" alt="mysql output" title="mysql output" width="299" height="71" class="size-full wp-image-690" /></a><p class="wp-caption-text">mysql output</p></div>
<p>结果：<br />
<div id="attachment_691" class="wp-caption alignnone" style="width: 310px"><a href="http://www.blags.org/wp-content/Upload/mysql-out2.jpg"><img src="http://www.blags.org/wp-content/Upload/mysql-out2.jpg" alt="mysql result" title="mysql result" width="300" height="183" class="size-full wp-image-691" /></a><p class="wp-caption-text">mysql result</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/mysql-data-import-and-export-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress 热门文章插件</title>
		<link>http://www.blags.org/wordpress-pop-article-plugin/</link>
		<comments>http://www.blags.org/wordpress-pop-article-plugin/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 16:48:47 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[热门文章]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=663</guid>
		<description><![CDATA[一个blog没有文章导航，会使得访客的跳出率大大升高。所以决定写一个文章汇总插件。已经折腾出来了。由于时间仓促。写得比较烂。后续会慢慢改善使之。使用了memcache,当然也可以使用wp_cache_get,wp_cache_set函数来使用您主机所使用的缓存，不过要做下修改。
具体使用方法是。

将文件下载本地解压，上传至您主题目录。
添加页面的时候选择模板使用pop-article就行了。

wordpress 热门文章插件
后期慢慢改善。
效果：见本站 热门文章 热评文章。
效果图：

]]></description>
			<content:encoded><![CDATA[<p>一个blog没有文章导航，会使得访客的跳出率大大升高。所以决定写一个文章汇总插件。已经折腾出来了。由于时间仓促。写得比较烂。后续会慢慢改善使之。使用了memcache,当然也可以使用wp_cache_get,wp_cache_set函数来使用您主机所使用的缓存，不过要做下修改。</p>
<p>具体使用方法是。</p>
<ol>
<li>将文件下载本地解压，上传至您主题目录。</li>
<li>添加页面的时候选择模板使用pop-article就行了。</li>
</ol>
<p><a title="wordpress 热门文章插件" href="http://www.blags.org/wp-content/Upload/pop.zip">wordpress 热门文章插件</a></p>
<p>后期慢慢改善。</p>
<p>效果：见本站 <a href="http://www.blags.org/popular-articles/">热门文章</a> <a href="http://www.blags.org/popular-articles/comment/">热评文章</a>。</p>
<p>效果图：</p>
<p><a href="http://www.blags.org/wp-content/Upload/a61.gif"><img src="http://www.blags.org/wp-content/Upload/a61.gif" alt="" title="a6" width="300" height="178" class="alignnone size-full wp-image-689" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/wordpress-pop-article-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>linux httpd 启动错误</title>
		<link>http://www.blags.org/linux-httpd-start-error/</link>
		<comments>http://www.blags.org/linux-httpd-start-error/#comments</comments>
		<pubDate>Mon, 09 May 2011 11:31:01 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=661</guid>
		<description><![CDATA[搭建了无数lamp环境今天碰到了新问题，apache说文件不存在，可是文件明明存在，又可以涨知识了。]]></description>
			<content:encoded><![CDATA[<p>搭建了无数lamp环境今天碰到了新问题，apache说文件不存在，可是文件明明存在，又可以涨知识了。<br />
错误信息：<br />
[root@xxx ~]# service httpd restart<br />
Stopping httpd:                                            [FAILED]<br />
Starting httpd: Warning: DocumentRoot [/home/martin] does not exist[  OK  ]<br />
原来以为是权限问题，可以修改了权限之后发现还是找不到文件,真是郁闷。<br />
后来经过打开apache错误日志后才知道。<br />
[root@xxx httpd]# tail -f logs/error_log<br />
[Mon May 09 10:46:40 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)<br />
[Mon May 09 10:46:40 2011] [notice] Digest: generating secret for digest authentication &#8230;<br />
[Mon May 09 10:46:40 2011] [notice] Digest: done<br />
[Mon May 09 10:46:40 2011] [notice] Apache/2.2.3 (<a href="http://www.blags.org/tags/centos/"title="centos 系统" >CentOS</a>) configured &#8212; resuming normal operations<br />
[Mon May 09 10:48:15 2011] [notice] caught SIGTERM, shutting down<br />
<span style="color: red;">[Mon May 09 10:49:29 2011] [notice] SE<a href="http://www.blags.org/tags/linux/"target="_self"title="linux" >Linux</a> policy enabled; httpd running as context root:system_r:httpd_t:s0</span><br />
[Mon May 09 10:49:29 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)<br />
[Mon May 09 10:49:29 2011] [notice] Digest: generating secret for digest authentication &#8230;<br />
[Mon May 09 10:49:29 2011] [notice] Digest: done<br />
[Mon May 09 10:49:30 2011] [notice] Apache/2.2.3 (CentOS) configured &#8212; resuming normal operations<br />
[Mon May 09 10:53:53 2011] [notice] caught SIGTERM, shutting down<br />
[Mon May 09 10:53:53 2011] [notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t:s0<br />
[Mon May 09 10:53:53 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)<br />
[Mon May 09 10:53:53 2011] [notice] Digest: generating secret for digest authentication &#8230;<br />
[Mon May 09 10:53:53 2011] [notice] Digest: done<br />
[Mon May 09 10:53:53 2011] [notice] Apache/2.2.3 (CentOS) configured &#8212; resuming normal operations</p>
<p>其实这是因为这些系统里激活了SELinux，而用户的apache配置与SELinux的配置策略有抵触产生的，需要设置SELinux文件属性。<br />
可以通过 ls -Z /dir来查看SELinux策略属性<br />
exp:</p>
<p>[root@xxx ~]# ls -Z /root/<br />
-rw&#8212;&#8212;-  root root system_u:object_r:user_home_t    anaconda-ks.cfg<br />
-rw-r&#8211;r&#8211;  root root root:object_r:user_home_t        install.log<br />
-rw-r&#8211;r&#8211;  root root root:object_r:user_home_t        install.log.syslog<br />
其中的“user_home_t”就是SELinux策略属性，而需要httpd能访问必须要是“httpd_user_content_t”属性。<br />
执行一下命令修改你的目录属性<br />
chcon -R -t httpd_user_content_t /dir/ #将/dir目录下所有文件属性设置成 “httpd_user_content_t”<br />
接下来重启httpd<br />
[root@xxx httpd]# service httpd restart<br />
Stopping httpd:                                            [  OK  ]<br />
Starting httpd:                                            [  OK  ]<br />
大功告成。<br />
得到一个结论，一般碰到莫名其妙的问题一定要先看错误日志，linux下大部分软件都有自己的日志，这样定位起来问题才会不花冤枉时间。</p>
<p>当然也可以去禁止掉SELinux。<br />
1.立即关闭SELinux。setenforce 0;#重启失效<br />
2.修改配置文件 <a href="http://www.blags.org/tags/vim/"title="vim" >vim</a> /etc/selinux/config；把SELINUX修改成&#8221;enforcing&#8221;&#8212;&gt;&#8221;disable&#8221;；</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/linux-httpd-start-error/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ubuntu 性能优化</title>
		<link>http://www.blags.org/performance-optimization-ubuntu/</link>
		<comments>http://www.blags.org/performance-optimization-ubuntu/#comments</comments>
		<pubDate>Wed, 04 May 2011 03:59:49 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix&Linux]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=660</guid>
		<description><![CDATA[前言：最近安装了不少东西，感觉ubuntu速度明显变慢了，整理了一些速度优化的方法，希望对大家有用。

删除不必要的包。

View Code SHELLsudo deborphan &#124; xargs sudo apt-get -y remove --purge;
sudo apt-get autoclean;


减少对swap的使用，

View Code SHELLsudo sysctl vm.swappiness=10;#修改swap大小。

在/etc/sysctl.conf 配置文件中，添加：

View Code SHELLvm.swappiness=10;#到文件的末尾,保证重启也有效。



]]></description>
			<content:encoded><![CDATA[<p>前言：最近安装了不少东西，感觉<a href="http://www.blags.org/tags/ubuntu/"title="ubuntu" >ubuntu</a>速度明显变慢了，整理了一些速度优化的方法，希望对大家有用。</p>
<ul>
<li>删除不必要的包。

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p660code21'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p66021"><td class="code" id="p660code21"><pre class="shell" style="font-family:monospace;">sudo deborphan | xargs sudo apt-get -y remove --purge;
sudo apt-get autoclean;</pre></td></tr></table></div>

</li>
<li>减少对swap的使用，

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p660code22'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p66022"><td class="code" id="p660code22"><pre class="shell" style="font-family:monospace;">sudo sysctl vm.swappiness=10;#修改swap大小。</pre></td></tr></table></div>

<p>在/etc/sysctl.conf 配置文件中，添加：</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p660code23'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p66023"><td class="code" id="p660code23"><pre class="shell" style="font-family:monospace;">vm.swappiness=10;#到文件的末尾,保证重启也有效。</pre></td></tr></table></div>

</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/performance-optimization-ubuntu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>linux 之间ssh无密码登录</title>
		<link>http://www.blags.org/ssh-without-password-between-linux/</link>
		<comments>http://www.blags.org/ssh-without-password-between-linux/#comments</comments>
		<pubDate>Sun, 24 Apr 2011 12:58:57 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[smbmount]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sshfs]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=656</guid>
		<description><![CDATA[环境：本机器:ubuntu 9.04,服务器centos5.x系列。
最近为了工作需要，开机启动将服务器的文件挂载到自己的工作区，
一开始采用smbmount进行挂载，建立项目进行开发。挂载里面的文件，每次保存时都会提示你文件已经修改需要你刷新整个项目，太麻烦了。都不敢随便保存。不实时保存容易出现的问题大家可想而知。 
Samba是为大家在windows和linux进行文件共享量身定制的。但是对于linux而言就不尽人意了。

smbmount 挂载可以直接在参数上面输入用户名和密码。当然开机挂载很容易了,命令如下:
sudo /etc/rc.local;
smbmount //ip:/xxx /mnt/ -o user%pwd;

以上方式不推荐使用。
那么linux之间挂载采用什么方式呢 &#8212;&#8212; 有以下两种 nfs,sshfs。本人再用的是sshfs。
具体挂载命令如下。

安装 :sudo apt-get install sshfs;
sudo sshfs user@ip-address:/remote/directory /www/workspaces;
开机自动挂载
sudo /etc/rc.local;
 在exit 0 之前加上：
su martin -c 'sshfs user@ip-address:/remote/directory /www/workspaces;&#8217;#martin拥有私钥的用户
但是这个中间需要输入密码。下面讲以下ssh无密码登录.


适用情景：


觉得输入密码烦躁的时候。
不得不从其他服务器scp文件的时候。

下面M表示本机,S表示服务器（或者目的ip）

首先在M运行ssh-keygen -t rsa;#dsa表示加密类型，exp:dsa,rsa
然后回车知道结束。
cd ~/.ssh/;ls -l;会看见有下面几个文件
其中id_rsa 是私钥。id_rsa.pub是公钥。
将M中ssh生成的公钥复制下来。
接下来进如ssh 链接上S机器。
将公钥内容复制到S机器。
vi ~/.ssh/authorized_keys;
在S机器将文件authorized_keys赋予600权限。
chmod 600 ~/.ssh/authorized_keys;
多个用户可以将自己机器内生成的公钥在authorized_keys下面复制进去。

这样就完成了。
vi /var/log/secure;可以看到登录记录。
卸载，方法使用umount /xxx就行。
出现错误

 Agent admitted failure to sign using the key.
则需要在M机器上将私钥添加进来
ssh-add .ssh/id_rsa;

]]></description>
			<content:encoded><![CDATA[<p>环境：本机器:<a href="http://www.blags.org/tags/ubuntu/"title="ubuntu" >ubuntu</a> 9.04,服务器<a href="http://www.blags.org/tags/centos/"title="centos 系统" >centos</a>5.x系列。</p>
<p>最近为了工作需要，开机启动将服务器的文件挂载到自己的工作区，</p>
<p>一开始采用smbmount进行挂载，建立项目进行开发。挂载里面的文件，每次保存时都会提示你文件已经修改需要你刷新整个项目，太麻烦了。都不敢随便保存。不实时保存容易出现的问题大家可想而知。<em> </em></p>
<p><em>Samba</em>是为大家在windows和<a href="http://www.blags.org/tags/linux/"target="_self"title="linux" >linux</a>进行文件共享量身定制的。但是对于linux而言就不尽人意了。</p>
<ol>
<li>smbmount 挂载可以直接在参数上面输入用户名和密码。当然开机挂载很容易了,命令如下:</li>
<li>sudo /etc/rc.local;<br />
smbmount //ip:/xxx /mnt/ -o user%pwd;</li>
</ol>
<p>以上方式不推荐使用。</p>
<p>那么linux之间挂载采用什么方式呢 &#8212;&#8212; 有以下两种 nfs,sshfs。本人再用的是sshfs。</p>
<p>具体挂载命令如下。</p>
<ol>
<li>安装 :sudo apt-get install sshfs;</li>
<li><code>sudo</code> <code>sshfs user@ip-address:</code><code>/remote/directory</code> <code>/www/</code>workspaces;</li>
<li>开机自动挂载<br />
sudo /etc/rc.local;</li>
<li> 在exit 0 之前加上：<code><br />
su martin -c 'sshfs <span style="color: #ff0000;">user@ip-address</span>:</code><code>/remote/directory</code> <code>/www/</code>workspaces;&#8217;#<span style="color: #ff0000;">martin拥有私钥的用户</span></li>
<li>但是这个中间需要输入密码。下面讲以下ssh无密码登录.</li>
</ol>
<div>
<div>适用情景：</div>
</div>
<ul>
<li>觉得输入密码烦躁的时候。</li>
<li>不得不从其他服务器scp文件的时候。</li>
</ul>
<p><span style="color: #ff0000;">下面M表示本机,S表示服务器（或者目的ip）</span></p>
<ol>
<li>首先在M运行ssh-keygen -t rsa;#dsa表示加密类型，exp:dsa,rsa<br />
然后回车知道结束。</li>
<li>cd ~/.ssh/;ls -l;会看见有下面几个文件
<div id="attachment_693" class="wp-caption alignnone" style="width: 310px"><a href="http://www.blags.org/wp-content/Upload/a5.png"><img class="size-medium wp-image-693" title="ssh use public key" src="http://www.blags.org/wp-content/Upload/a5-300x46.jpg" alt="ssh use public key" width="300" height="46" /></a><p class="wp-caption-text">ssh use public key</p></div>
<p>其中id_rsa 是私钥。id_rsa.pub是公钥。<br />
将M中ssh生成的公钥复制下来。</li>
<li>接下来进如ssh 链接上S机器。<br />
将公钥内容复制到S机器。<br />
vi ~/.ssh/authorized_keys;</li>
<li>在S机器将文件authorized_keys赋予600权限。<br />
<span style="color: #ff0000;">chmod 600 ~/.ssh/authorized_keys;</span><br />
多个用户可以将自己机器内生成的公钥在authorized_keys下面复制进去。</li>
</ol>
<p>这样就完成了。</p>
<p>vi /var/log/secure;可以看到登录记录。</p>
<div id="attachment_694" class="wp-caption alignnone" style="width: 310px"><a href="http://www.blags.org/wp-content/Upload/a6.png"><img class="size-medium wp-image-694" title="ssh use public key" src="http://www.blags.org/wp-content/Upload/a6-300x54.jpg" alt="ssh use public key" width="300" height="54" /></a><p class="wp-caption-text">ssh use public key</p></div>
<p>卸载，方法使用umount /xxx就行。</p>
<p>出现错误</p>
<ol>
<li> Agent admitted failure to sign using the key.<br />
则需要在M机器上将私钥添加进来<br />
ssh-add .ssh/id_rsa;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/ssh-without-password-between-linux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>mysql 字符串处理函数</title>
		<link>http://www.blags.org/mysql-string-handling-functions/</link>
		<comments>http://www.blags.org/mysql-string-handling-functions/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 05:20:52 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[substring]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=652</guid>
		<description><![CDATA[起因：最近需要用到mysql的字符串处理函数，一开始打算从数据库里面读取出来再采用php进行处理，后来一想干嘛非得借助别的语言呢，难道mysql真的不能完成以上工作吗。
环境:目标字段为一个text类型，存储的是一个json_encode过的对象,长度不一。需要将里面的某一个属性查询出来。
Exp:{&#8220;name&#8221;:&#8221;martin&#8221;,&#8221;age&#8221;:&#8221;25&#8243;,&#8221;Time&#8221;:&#8221;1299899245&#8243;,&#8221;status&#8221;:1} 取出Time属性。
初试：想采用mysql正则表达式去匹配其中的属性。
上网看了mysql正则表达式一章：http://dev.mysql.com/doc/refman/5.1/zh/regexp.html
发现只能匹配到某个字符存在与否。当然也可能我看得不够仔细。
再试：想采用mysql字符串处理函数，进行匹配。结果ok。
用到的函数 SUBSTRING、SUBSTING_INDEX、LENGTH、FROM_UNXITIME。

设置变量

View Code MYSQLset  @str = '{&#34;name&#34;:&#34;martin&#34;,&#34;age&#34;:&#34;25&#34;,&#34;Time&#34;:&#34;1299899245&#34;,&#34;status&#34;:1}';


获取目标字符所在位置。

View Code MYSQLSELECT LENGTH&#40;SUBSTRING&#40; @str,'&#34;,&#34;status',1 &#41;&#41;;


使用SUBSTRING进行截取目标字符串

View Code MYSQLSELECT SUBSTRING_INDEX&#40; @str ,  LENGTH&#40;SUBSTRING&#40; @str,'&#34;,&#34;status',1 &#41;&#41; , 10 &#41;;


时间转换

View Code MYSQLSELECT FROM_UNIXTIME&#40; SUBSTRING&#40; @str ,  LENGTH&#40;SUBSTRING_INDEX&#40; @str,'&#34;,&#34;status',1 &#41;&#41; -9, 10 &#41;&#41;;




以上就完成了上述任务。还有更好的方法欢迎大家留言。
]]></description>
			<content:encoded><![CDATA[<p>起因：最近需要用到<a href="http://www.blags.org/tags/mysql/"title="mysql" >mysql</a>的字符串处理函数，一开始打算从数据库里面读取出来再采用php进行处理，后来一想干嘛非得借助别的语言呢，难道mysql真的不能完成以上工作吗。</p>
<p>环境:目标字段为一个text类型，存储的是一个json_encode过的对象,长度不一。需要将里面的某一个属性查询出来。</p>
<p>Exp:<span style="color: #ff0000;">{&#8220;name&#8221;:&#8221;martin&#8221;,&#8221;age&#8221;:&#8221;25&#8243;,&#8221;Time&#8221;:&#8221;1299899245&#8243;,&#8221;status&#8221;:1} </span>取出Time属性。</p>
<p>初试：想采用mysql正则表达式去匹配其中的属性。</p>
<p>上网看了mysql正则表达式一章：<a href="http://dev.mysql.com/doc/refman/5.1/zh/regexp.html">http://dev.mysql.com/doc/refman/5.1/zh/regexp.html</a></p>
<p>发现只能匹配到某个字符存在与否。当然也可能我看得不够仔细。</p>
<p>再试：想采用mysql字符串处理函数，进行匹配。结果ok。</p>
<p>用到的函数 SUBSTRING、SUBSTING_INDEX、LENGTH、FROM_UNXITIME。</p>
<ol>
<li>设置变量

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p652code28'); return false;">View Code</a> MYSQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p65228"><td class="code" id="p652code28"><pre class="mysql" style="font-family:monospace;"><a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=SET"><span style="color: #990099; font-weight: bold;">set</span></a>  @str <span style="color: #CC0099;">=</span> <span style="color: #008000;">'{&quot;name&quot;:&quot;martin&quot;,&quot;age&quot;:&quot;25&quot;,&quot;Time&quot;:&quot;1299899245&quot;,&quot;status&quot;:1}'</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

</li>
<li>获取目标字符所在位置。

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p652code29'); return false;">View Code</a> MYSQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p65229"><td class="code" id="p652code29"><pre class="mysql" style="font-family:monospace;"><a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=SELECT"><span style="color: #990099; font-weight: bold;">SELECT</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">LENGTH</span></a><span style="color: #FF00FF;">&#40;</span><a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">SUBSTRING</span></a><span style="color: #FF00FF;">&#40;</span> @str<span style="color: #000033;">,</span><span style="color: #008000;">'&quot;,&quot;status'</span><span style="color: #000033;">,</span><span style="color: #008080;">1</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

</li>
<li>使用SUBSTRING进行截取目标字符串

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p652code30'); return false;">View Code</a> MYSQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p65230"><td class="code" id="p652code30"><pre class="mysql" style="font-family:monospace;"><a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=SELECT"><span style="color: #990099; font-weight: bold;">SELECT</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">SUBSTRING_INDEX</span></a><span style="color: #FF00FF;">&#40;</span> @str <span style="color: #000033;">,</span>  <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">LENGTH</span></a><span style="color: #FF00FF;">&#40;</span><a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">SUBSTRING</span></a><span style="color: #FF00FF;">&#40;</span> @str<span style="color: #000033;">,</span><span style="color: #008000;">'&quot;,&quot;status'</span><span style="color: #000033;">,</span><span style="color: #008080;">1</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #000033;">,</span> <span style="color: #008080;">10</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

</li>
<li>时间转换

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p652code31'); return false;">View Code</a> MYSQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p65231"><td class="code" id="p652code31"><pre class="mysql" style="font-family:monospace;"><a href="http://search.mysql.com/search?site=refman-%35%31&amp;q=SELECT"><span style="color: #990099; font-weight: bold;">SELECT</span></a> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/date-and-time-functions.html"><span style="color: #000099;">FROM_UNIXTIME</span></a><span style="color: #FF00FF;">&#40;</span> <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">SUBSTRING</span></a><span style="color: #FF00FF;">&#40;</span> @str <span style="color: #000033;">,</span>  <a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">LENGTH</span></a><span style="color: #FF00FF;">&#40;</span><a href="http://dev.mysql.com/doc/refman/%35%2E%31/en/string-functions.html"><span style="color: #000099;">SUBSTRING_INDEX</span></a><span style="color: #FF00FF;">&#40;</span> @str<span style="color: #000033;">,</span><span style="color: #008000;">'&quot;,&quot;status'</span><span style="color: #000033;">,</span><span style="color: #008080;">1</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099;">-</span><span style="color: #008080;">9</span><span style="color: #000033;">,</span> <span style="color: #008080;">10</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

</li>
</ol>
<p><a href="http://www.blags.org/wp-content/Upload/a.jpg"><img class="alignnone size-medium wp-image-654" title="a" src="http://www.blags.org/wp-content/Upload/a-300x13.jpg" alt="" width="300" height="13" /></a></p>
<p>以上就完成了上述任务。还有更好的方法欢迎大家留言。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/mysql-string-handling-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>vim 删除快捷键</title>
		<link>http://www.blags.org/vim-remove-a-shortcut/</link>
		<comments>http://www.blags.org/vim-remove-a-shortcut/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 10:53:14 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[开发工具]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[VIM]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=650</guid>
		<description><![CDATA[ 以前感觉vim删除操作挺麻烦,后来才发现有这么多快捷删除键,看样子使用得还是不够深入噢。
:%s/r//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%s/^(.*)n1/1$/ 删除重复行
:g/s*^$/d 删除所有空行 ：这个好用有没有人用过还有其他的方法吗？
:g!/^dd/d 删除不含字符串&#8216;dd&#8216;的行
:v/^dd/d 同上 （译释：v ==&#38;nbspg!，就是不匹配！）
:g/str1/,/str2/d 删除所有第一个含str1到第一个含str2之间的行
:v/./.,/./-1join 压缩空行
:g/^$/,/./-j 压缩空行
ndw 或&#38;nbspndW 删除光标处开始及其后的&#38;nbspn-1 个字符。
d0 删至行首。
d$ 删至行尾。
ndd 删除当前行及其后&#38;nbspn-1 行。
x 或&#38;nbspX 删除一个字符。
Ctrl+u 删除输入方式下所输入的文本。
^R 恢复u的操作
J 把下一行合并到当前行尾
V 选择一行
^V 按下^V后即可进行矩形的选择了
aw 选择单词
iw 内部单词(无空格)
as 选择句子
is 选择句子(无空格)
ap 选择段落
ip 选择段落(无空格)
D 删除到行尾
x,y 删除与复制包含高亮区
dl 删除当前字符（与x命令功能相同）
d0 删除到某一行的开始位置
d^ 删除到某一行的第一个字符位置（不包括空格或TAB字符）
dw 删除到某个单词的结尾位置
d3w 删除到第三个单词的结尾位置
db 删除到某个单词的开始位置
dW 删除到某个以空格作为分隔符的单词的结尾位置
dB 删除到某个以空格作为分隔符的单词的开始位置
d7B 删除到前面7个以空格作为分隔符的单词的开始位置
d） 删除到某个语句的结尾位置
d4） 删除到第四个语句的结尾位置
d（ 删除到某个语句的开始位置
d） 删除到某个段落的结尾位置
d{ 删除到某个段落的开始位置
d7{ 删除到当前段落起始位置之前的第7个段落位置
dd 删除当前行
d/text 删除从文本中出现“text”中所指定字样的位置，
一直向前直到下一个该字样所出现的位置（但不包括该字样）之间的内容
dfc 删除从文本中出现字符“c”的位置，一直向前直到下一个该字符所出现的位置（包括该字符）之间的内容
dtc 删除当前行直到下一个字符“c”所出现位置之间的内容
D 删除到某一行的结尾
d$ 删除到某一行的结尾
5dd 删除从当前行所开始的5行内容
dL 删除直到屏幕上最后一行的内容
dH 删除直到屏幕上第一行的内容
dG 删除直到工作缓存区结尾的内容
d1G 删除直到工作缓存区开始的内容
]]></description>
			<content:encoded><![CDATA[<p><span> 以前感觉<a href="http://www.blags.org/tags/vim/"title="vim" >vim</a>删除操作挺麻烦,后来才发现有这么多快捷删除键,看样子使用得还是不够深入噢。</span></p>
<p><span>:%s/r//g 删除DOS方式的回车^M<br />
:%s= *$== 删除行尾空白</span></p>
<p>:%s/^(.*)n1/1$/ 删除重复行</p>
<p>:g/s*^$/d 删除所有空行 ：这个好用有没有人用过还有其他的方法吗？<br />
:g!/^dd/d 删除不含字符串<em>&#8216;</em>dd<em>&#8216;</em>的行<br />
:v/^dd/d 同上 （译释：v ==&amp;nbspg!，就是不匹配！）</p>
<p>:g/str1/,/str2/d 删除所有第一个含str1到第一个含str2之间的行</p>
<p>:v/./.,/./-1join 压缩空行<br />
:g/^$/,/./-j 压缩空行</p>
<p>ndw 或&amp;nbspndW 删除光标处开始及其后的&amp;nbspn-1 个字符。<br />
d0 删至行首。<br />
d$ 删至行尾。<br />
ndd 删除当前行及其后&amp;nbspn-1 行。<br />
x 或&amp;nbspX 删除一个字符。<br />
Ctrl+u 删除输入方式下所输入的文本。<br />
^R 恢复u的操作<br />
J 把下一行合并到当前行尾<br />
V 选择一行<br />
^V 按下^V后即可进行矩形的选择了<br />
aw 选择单词<br />
iw 内部单词(无空格)<br />
as 选择句子<br />
is 选择句子(无空格)<br />
ap 选择段落<br />
ip 选择段落(无空格)<br />
D 删除到行尾<br />
x,y 删除与复制包含高亮区</p>
<p>dl 删除当前字符（与x命令功能相同）<br />
d0 删除到某一行的开始位置<br />
d^ 删除到某一行的第一个字符位置（不包括空格或TAB字符）<br />
dw 删除到某个单词的结尾位置<br />
d3w 删除到第三个单词的结尾位置<br />
db 删除到某个单词的开始位置<br />
dW 删除到某个以空格作为分隔符的单词的结尾位置<br />
dB 删除到某个以空格作为分隔符的单词的开始位置<br />
d7B 删除到前面7个以空格作为分隔符的单词的开始位置<br />
d） 删除到某个语句的结尾位置<br />
d4） 删除到第四个语句的结尾位置<br />
d（ 删除到某个语句的开始位置<br />
d） 删除到某个段落的结尾位置<br />
d{ 删除到某个段落的开始位置<br />
d7{ 删除到当前段落起始位置之前的第7个段落位置<br />
dd 删除当前行<br />
d/text 删除从文本中出现“text”中所指定字样的位置，<br />
一直向前直到下一个该字样所出现的位置（但不包括该字样）之间的内容<br />
dfc 删除从文本中出现字符“c”的位置，一直向前直到下一个该字符所出现的位置（包括该字符）之间的内容<br />
dtc 删除当前行直到下一个字符“c”所出现位置之间的内容<br />
D 删除到某一行的结尾<br />
d$ 删除到某一行的结尾<br />
5dd 删除从当前行所开始的5行内容<br />
dL 删除直到屏幕上最后一行的内容<br />
dH 删除直到屏幕上第一行的内容<br />
dG 删除直到工作缓存区结尾的内容<br />
d1G 删除直到工作缓存区开始的内容</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/vim-remove-a-shortcut/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ubuntu 短密码设置</title>
		<link>http://www.blags.org/short-password-settings-ubuntu/</link>
		<comments>http://www.blags.org/short-password-settings-ubuntu/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 10:49:51 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[passwd]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=649</guid>
		<description><![CDATA[年终了，写篇小文章。相信对ubuntu爱好者有用。
起因：相信很多ubuntu用户都有遇到过相同的问题。sudo的时候会需要填写用户的密码，去处理需要较高权限的操作。
密码设置长了自然感觉到很繁琐。（对安全要求较高的用户不建议）。
linux 修改密码的方式很简单。passwd username 输入当前密码就可以进行新密码设置。
ubuntu 近期几个版本都对用户密码复杂程度进行了控制，不安全的密码不能通过。（小于六位）
下面介绍以下设置短密码的方法。

sudo passwd username 进行设置就ok拉。(加上sudo就可以设置较短的密码)。
当然也可以sudo su 进去root,然后直接passwd martin进行密码设置。

另外:ubuntu 支持密码找回。
由于最近比较忙。记录以下知识点，下次补上。
linux 管道使用。
linux crontab 定时任务。
php 系统日志处理。
php 高并发解决方案。
mysql 建索引介绍。
]]></description>
			<content:encoded><![CDATA[<p>年终了，写篇小文章。相信对<a href="http://www.blags.org/tags/ubuntu/"title="ubuntu" >ubuntu</a>爱好者有用。</p>
<p>起因：相信很多ubuntu用户都有遇到过相同的问题。sudo的时候会需要填写用户的密码，去处理需要较高权限的操作。</p>
<p>密码设置长了自然感觉到很繁琐。（<span style="color: #ff0000;">对安全要求较高的用户不建议</span>）。</p>
<p><a href="http://www.blags.org/tags/linux/"target="_self"title="linux" >linux</a> 修改密码的方式很简单。passwd username 输入当前密码就可以进行新密码设置。</p>
<p>ubuntu 近期几个版本都对用户密码复杂程度进行了控制，不安全的密码不能通过。（小于六位）</p>
<p>下面介绍以下设置短密码的方法。</p>
<ol>
<li>sudo passwd username 进行设置就ok拉。(加上sudo就可以设置较短的密码)。</li>
<li>当然也可以sudo su 进去root,然后直接passwd martin进行密码设置。</li>
</ol>
<p>另外:ubuntu 支持密码找回。</p>
<p>由于最近比较忙。记录以下知识点，下次补上。</p>
<p>linux 管道使用。</p>
<p>linux crontab 定时任务。</p>
<p>php 系统日志处理。</p>
<p>php 高并发解决方案。</p>
<p><a href="http://www.blags.org/tags/mysql/"title="mysql" >mysql</a> 建索引介绍。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/short-password-settings-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>linux awk 使用</title>
		<link>http://www.blags.org/linux-awk-use-method/</link>
		<comments>http://www.blags.org/linux-awk-use-method/#comments</comments>
		<pubDate>Sat, 27 Nov 2010 08:17:00 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=647</guid>
		<description><![CDATA[最近换了新的环境，上班时间忙，很长一段时间没有写文章了。把最近了解到的一些新知识记录一下。
管道命令：“&#124;” 符号。Example：grep &#8216;xxx.php&#8217; -r /www/ &#124; grep &#8216;function xxx&#8217; &#124; grep -v svn (可以理解为筛选条件).
清空文件：&#8221;&#62; aa.txt&#8221;,&#8221;echo &#8221; &#62; aa.txt&#8221;
awk语言的最基本功能是在文件或字符串中基于指定规则浏览和抽取信息,非常实用。例如一些linux日志文件。
Example:cat xxx.log &#124; grep &#8216;xxx&#8217; &#124; awk &#8216;FS=&#8221;/&#8221; if($1&#62;100){print $3}&#8217;
常用环境变量
变量    描述

 $n    :   当前记录的第n个字段，字段间由FS分隔。
$0   :   完整的输入记录。
ARGC   :   命令行参数的数目。
ARGIND   :   命令行中当前文件的位置(从0开始算)。
ARGV   :   包含命令行参数的数组。
CONVFMT   :   数字转换格式(默认值为%.6g)
ENVIRON   :   环境变量关联数组。
ERRNO   :   最后一个系统错误的描述。
FIELDWIDTHS   :   字段宽度列表(用空格键分隔)。
FILENAME   :   当前文件名。
FNR   :   同NR，但相对于当前文件。
FS   :   字段分隔符(默认是任何空格)。
IGNORECASE   :   如果为真，则进行忽略大小写的匹配。
NF <a href="http://www.blags.org/linux-awk-use-method/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>最近换了新的环境，上班时间忙，很长一段时间没有写文章了。把最近了解到的一些新知识记录一下。</p>
<p>管道命令：“|” 符号。Example：grep &#8216;xxx.php&#8217; -r /www/ | grep &#8216;function xxx&#8217; | grep -v svn (可以理解为筛选条件).</p>
<p>清空文件：&#8221;&gt; aa.txt&#8221;,&#8221;echo &#8221; &gt; aa.txt&#8221;</p>
<p>awk语言的最基本功能是在文件或字符串中基于指定规则浏览和抽取信息,非常实用。例如一些<a href="http://www.blags.org/tags/linux/"target="_self"title="linux" >linux</a>日志文件。</p>
<p>Example:cat xxx.log | grep &#8216;xxx&#8217; | awk &#8216;FS=&#8221;/&#8221; if($1&gt;100){print $3}&#8217;</p>
<p>常用环境变量</p>
<p>变量    描述</p>
<ul>
<li> $n    :   当前记录的第n个字段，字段间由FS分隔。</li>
<li>$0   :   完整的输入记录。</li>
<li>ARGC   :   命令行参数的数目。</li>
<li>ARGIND   :   命令行中当前文件的位置(从0开始算)。</li>
<li>ARGV   :   包含命令行参数的数组。</li>
<li>CONVFMT   :   数字转换格式(默认值为%.6g)</li>
<li>ENVIRON   :   环境变量关联数组。</li>
<li>ERRNO   :   最后一个系统错误的描述。</li>
<li>FIELDWIDTHS   :   字段宽度列表(用空格键分隔)。</li>
<li>FILENAME   :   当前文件名。</li>
<li>FNR   :   同NR，但相对于当前文件。</li>
<li>FS   :   字段分隔符(默认是任何空格)。</li>
<li>IGNORECASE   :   如果为真，则进行忽略大小写的匹配。</li>
<li>NF   :   当前记录中的字段数。</li>
<li>NR   :   当前记录数。</li>
<li>OFMT   :   数字的输出格式(默认值是%.6g)。</li>
<li>OFS   :   输出字段分隔符(默认值是一个空格)。</li>
<li>ORS   :   输出记录分隔符(默认值是一个换行符)。</li>
<li>RLENGTH   :   由match函数所匹配的字符串的长度。</li>
<li>RS   :   记录分隔符(默认是一个换行符)。</li>
<li>RSTART   :   由match函数所匹配的字符串的第一个位置。</li>
</ul>
<p>SUBSEP   :   数组下标分隔符(默认值是\034)。</p>
<p>详细介绍：<a href="http://www.askapache.com/awk/awk-tutorial.html">http://www.askapache.com/awk/awk-tutorial.html</a>[en]</p>
<p><a href="http://man.lupaworld.com/content/manage/ringkee/awk.htm">http://man.lupaworld.com/content/manage/ringkee/awk.htm</a>[zh]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/linux-awk-use-method/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>centos 安装配置 openssl webmin</title>
		<link>http://www.blags.org/centos-install-configure-openssl-webmin/</link>
		<comments>http://www.blags.org/centos-install-configure-openssl-webmin/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 23:59:48 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[webmin]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=639</guid>
		<description><![CDATA[经过几个小时的摸索，终于将最新版本的webmin安装好了。
现在与大家分享自己的过程。
因为需要远程管理，所以连接的安全将首先考虑：
1：安装 OpenSSL软件
我本身就装了，版本号：0.9.7a
你可以按如下命令安装
wget http://www.openssl.org/source/openssl-0.9.7a.tar.gz
tar zxvf openssl-0.9.7a.tar.gz
cd openssl-0.9.7a
./configure
make
make install
2：安装NetSSLeay perl模块
我按装的版本号：1.30
你可以按如下命令安装
wget http://search.cpan.org/CPAN/authors/id/F/FL/FLORA/Net_SSLeay.pm-1.30.tar.gz
tar zxvf Net_SSLeay.pm-1.30.tar.gz
cd Net_SSLeay.pm-1.30
perl Makefile.PL
make install
3：安装webmin软件
我按装的版本号：1.30（以下连接2006/9/20更新，官方9/16升级为1.30）
你可以按如下命令安装
wget http://puzzle.dl.sourceforge.net/sourceforge/webadmin/webmin-1.300-1.noarch.rpm
rpm -Uvh webmin-1.300-1.noarch.rpm
编辑防火墙配置文件
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 10000 -j ACCEPT &#8212;插入
保存后重起防火墙
/etc/rc.d/init.d/iptables restart
设置与系统一起自动启动
chkconfig webmin on
重新启动WEBMIN服务
/etc/rc.d/init.d/webmin restart
在浏览器输入：http://你的域名或者IP:10000/
为了安全一般修改默认的端口&#8221;10000&#8243;-&#62;&#8221;xxxx&#8221;,需要关闭webmin可以禁止掉该端口.
出现登陆画面后，输入你的root帐号密码就进入了。
附图：

webmin


]]></description>
			<content:encoded><![CDATA[<p>经过几个小时的摸索，终于将最新版本的<a href="http://www.blags.org/tags/webmin/"title="webmin" >webmin</a>安装好了。<br />
现在与大家分享自己的过程。</p>
<p>因为需要远程管理，所以连接的安全将首先考虑：</p>
<p>1：安装 OpenSSL软件<br />
我本身就装了，版本号：0.9.7a<br />
你可以按如下命令安装<br />
wget http://www.openssl.org/source/openssl-0.9.7a.tar.gz<br />
tar zxvf openssl-0.9.7a.tar.gz<br />
cd openssl-0.9.7a<br />
./configure<br />
make<br />
make install</p>
<p>2：安装NetSSLeay <a href="http://www.blags.org/tags/Perl/"title="Perl" >perl</a>模块<br />
我按装的版本号：1.30<br />
你可以按如下命令安装<br />
wget http://search.cpan.org/CPAN/authors/id/F/FL/FLORA/Net_SSLeay.pm-1.30.tar.gz<br />
tar zxvf Net_SSLeay.pm-1.30.tar.gz<br />
cd Net_SSLeay.pm-1.30<br />
perl Makefile.PL<br />
make install</p>
<p>3：安装webmin软件<br />
我按装的版本号：1.30（以下连接2006/9/20更新，官方9/16升级为1.30）<br />
你可以按如下命令安装<br />
wget http://puzzle.dl.sourceforge.net/sourceforge/webadmin/webmin-1.300-1.noarch.rpm<br />
rpm -Uvh webmin-1.300-1.noarch.rpm</p>
<p>编辑防火墙配置文件<br />
vi /etc/sysconfig/iptables</p>
<p>-A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 443 -j ACCEPT<br />
-A RH-Firewall-1-INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 10000 -j ACCEPT &#8212;插入</p>
<p>保存后重起防火墙<br />
/etc/rc.d/init.d/iptables restart</p>
<p>设置与系统一起自动启动<br />
chkconfig webmin on</p>
<p>重新启动WEBMIN服务<br />
/etc/rc.d/init.d/webmin restart</p>
<p>在浏览器输入：http://你的域名或者IP:10000/</p>
<p>为了安全一般修改默认的端口&#8221;10000&#8243;-&gt;&#8221;xxxx&#8221;,需要关闭webmin可以禁止掉该端口.</p>
<p>出现登陆画面后，输入你的root帐号密码就进入了。</p>
<p>附图：</p>
<div id="attachment_640" class="wp-caption alignnone" style="width: 269px"></p>
<div class="mceTemp">
<dl id="attachment_695" class="wp-caption alignnone" style="width: 269px;">
<dt class="wp-caption-dt"><a href="http://www.blags.org/wp-content/Upload/webmin1.jpg"><img class="size-full wp-image-695" title="webmin" src="http://www.blags.org/wp-content/Upload/webmin1.jpg" alt="webmin" width="259" height="194" /></a><p class="wp-caption-text">webmin</p></div>
</dt>
<dd class="wp-caption-dd">webmin</dd>
</dl>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/centos-install-configure-openssl-webmin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>magento 性能优化</title>
		<link>http://www.blags.org/magento-performance-optimization/</link>
		<comments>http://www.blags.org/magento-performance-optimization/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 09:54:34 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Unix&Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php 开源项目]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=635</guid>
		<description><![CDATA[前言:
&#160;&#160;&#160;&#160;&#160;Magento 是一个开源电子商务系统，尤其以扩展性高著称，但是很高的扩展性往往是牺牲了速度为代价的，虽然现在magento为速度提升做了很多工作，但是还是没能达到人们对速度的要求。既然如此还是很自然的选择了它，它的速度让很多客户无法接受，最近忙碌于magento性能优化。
&#160;&#160;&#160;&#160;&#160;经过优化后，速度上了几个台阶，觉得能让大部分人都接受了，据本人目测最少快了(7-8倍)。
参考结合了前辈的经验总结了如下很重要的几点:
1) Magento Caching. Magento 自身cache
Goto Magento Admin -&#62; System -&#62; Cache Management
- Tick the following items:
&#8211; Configuration
&#8211; Layouts
&#8211; Block HTML output
&#8211; Translations
2) MySQL Cache Size 设置
query_cache_size=128M
innodb_buffer_pool_size=64M
innodb_additional_mem_pool=16M
4) Enabling Gzipping 启用gzip压缩
.htaccess
php_flag zlib.output_compression on
AddHandler application/x-httpd-php5 .css
修改 .htaccess mod_deflate 配置
本人配置如下:

View Code PHP    # Insert filter on all content
    SetOutputFilter DEFLATE
    # <a href="http://www.blags.org/magento-performance-optimization/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>前言:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.blags.org/tags/magento/"title="magento" >Magento</a> 是一个开源电子商务系统，尤其以扩展性高著称，但是很高的扩展性往往是牺牲了速度为代价的，虽然现在magento为速度提升做了很多工作，但是还是没能达到人们对速度的要求。既然如此还是很自然的选择了它，它的速度让很多客户无法接受，最近忙碌于magento性能优化。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;经过优化后，速度上了几个台阶，觉得能让大部分人都接受了，据本人目测最少快了(7-8倍)。</p>
<p>参考结合了前辈的经验总结了如下很重要的几点:<br />
1) Magento Caching. Magento 自身cache<br />
Goto Magento Admin -&gt; System -&gt; Cache Management<br />
- Tick the following items:<br />
&#8211; Configuration<br />
&#8211; Layouts<br />
&#8211; Block HTML output<br />
&#8211; Translations</p>
<p>2) <a href="http://www.blags.org/tags/mysql/"title="mysql" >MySQL</a> Cache Size 设置<br />
query_cache_size=128M<br />
innodb_buffer_pool_size=64M<br />
innodb_additional_mem_pool=16M</p>
<p>4) Enabling Gzipping 启用gzip压缩<br />
.ht<a href="http://www.blags.org/tags/access/"title="access数据库" >access</a><br />
php_flag zlib.output_compression on<br />
AddHandler application/x-httpd-php5 .css</p>
<p>修改 .htaccess mod_deflate 配置<br />
本人配置如下:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p635code33'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p63533"><td class="code" id="p635code33"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;"># Insert filter on all content
</span>    SetOutputFilter DEFLATE
    <span style="color: #666666; font-style: italic;"># Insert filter on selected content types only
</span>    <span style="color: #666666; font-style: italic;">#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
</span>
    <span style="color: #666666; font-style: italic;"># Netscape 4.x has some problems...
</span>    BrowserMatch ^Mozilla<span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span> gzip<span style="color: #339933;">-</span>only<span style="color: #339933;">-</span>text<span style="color: #339933;">/</span>html
&nbsp;
    <span style="color: #666666; font-style: italic;"># Netscape 4.06-4.08 have some more problems
</span>    BrowserMatch ^Mozilla<span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span>\<span style="color:#800080;">.0</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">678</span><span style="color: #009900;">&#93;</span> no<span style="color: #339933;">-</span>gzip
&nbsp;
    <span style="color: #666666; font-style: italic;"># MSIE masquerades as Netscape, but it is fine
</span>    BrowserMatch \bMSIE <span style="color: #339933;">!</span>no<span style="color: #339933;">-</span>gzip <span style="color: #339933;">!</span>gzip<span style="color: #339933;">-</span>only<span style="color: #339933;">-</span>text<span style="color: #339933;">/</span>html
&nbsp;
    <span style="color: #666666; font-style: italic;"># Don't compress images
</span>    SetEnvIfNoCase Request_URI \<span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span>?<span style="color: #339933;">:</span>gif<span style="color: #339933;">|</span>jpe?g<span style="color: #339933;">|</span>png<span style="color: #009900;">&#41;</span>$ no<span style="color: #339933;">-</span>gzip dont<span style="color: #339933;">-</span>vary
&nbsp;
    <span style="color: #666666; font-style: italic;"># Make sure proxies don't deliver the wrong content
</span>    <a href="http://www.php.net/header"><span style="color: #990000;">Header</span></a> append Vary User<span style="color: #339933;">-</span>Agent env<span style="color: #339933;">=!</span>dont<span style="color: #339933;">-</span>vary</pre></td></tr></table></div>

<p>5) Install Fooman Speedster 安装该插件</p>
<p>6) Install APC or Xcache 安装apc机器码缓存</p>
<p>&lt;cache&gt;<br />
&lt;backend&gt;apc&lt;/backend&gt;<br />
&lt;prefix&gt;alphanumeric&lt;/prefix&gt;<br />
&lt;/cache&gt;<br />
添加到 app/etc/local.xml &lt;global&gt;&lt;/global&gt; 之间.</p>
<p>7) 设置apache 开启 KeepAlive</p>
<p>KeepAlive ＝ On (KeepAlive 配置指令决定当处理完用户发起的 HTTP 请求后是否立即关闭 TCP 连接，如果 KeepAlive 设置为On，那么用户完成一次访问后，不会立即断开连接，如果还有请求，那么会继续在这一次 TCP 连接中完成，而不用重复建立新的 TCP 连接和关闭TCP 连接，可以提高用户访问速度。);</p>
<p>LoadModule deflate_module     modules/mod_deflate.so #开启mod_deflate</p>
<p>参考地址:<a href="http://www.magentocommerce.com/wiki/groups/168/optimising_your_web_stack_performance_for_magento" target="_blank"></a></p>
<p><a href="http://www.magentocommerce.com/wiki/groups/168/optimising_your_web_stack_performance_for_magento" target="_blank">http://www.magentocommerce.com/wiki/groups/168/optimising_your_web_stack_performance_for_magento</a></p>
<p><a href="http://www.magentocommerce.com/boards/viewthread/36225/">http://www.magentocommerce.com/boards/viewthread/36225/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/magento-performance-optimization/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>php 程序员</title>
		<link>http://www.blags.org/php-programmer/</link>
		<comments>http://www.blags.org/php-programmer/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 07:22:13 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[工作]]></category>
		<category><![CDATA[面试]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=634</guid>
		<description><![CDATA[最近去了tencent，xunlei等互联网名企面试，总结一下:

如果想进入这类企业进行底层开发的话必须对互联网各方面的技术原理了解的很清楚，例如apache实现原理。语言方面既然是php开发自然对c/c++要求比较高。往往需要自己写php扩展。使用mysql自然想很多常见的，性能瓶颈要能有很好的解决方案。mysql 插件编写，apache模块编写。联系起来结合点还是要会c。
倘若是做中间层和前端工作则要求对css，javascript要求比较高。当然对web的一系列实现原理也是要非常熟悉的。
对新技术要比较敏感，才能证明你有很好的学习能力和使用能力。
努力提高自己的英文口语，和阅读能力。往往很多新技术都是老外想出来的。等有了中文版也许这个技术已经不是那么新了。

相信我们很多人都只是了解到中间的皮毛而已，对于技术原理。这类型的东西了解甚少。值得注意的一点，正则这个东西在他们严重也是很重要的。
想成为一位合格的php程序员（高级）,必须符合如下条件。
◆ 文件目录处理函数包80％以上的函数的功能的灵活运用。
◆ 日期时间函数中的80％以上的函数的功能的灵活运用
◆ 数学函数库中的100％的内容。
◆ 网络库中的60％以上的内容，对各个函数的功能比较熟悉。
◆ 字符串处理函数下的60％以上的内容，特别是各种处理函数。
◆ 正则表达式函数下的90%以上的内容，特别是各种正则处理
◆  一些安全库下的40％以上的内容，如果对于安全没有接触的话根本就不可能掌握PHP
◆ XML处理，熟悉SAX、DOM以及JDOM的优缺点并且能够使用其中的一种完成XML的解析及内容处理。
◆ 图形图像函数库下的80%以上的内容，特别是一些图像生成和处理
◆ MySQL 数据库函数下的90%以上的内容，特别是处理各种数据的函数
◆ 数组处理函数下的90%以上的内容，特别是各种操作处理函数
◆  其它PEAR，PECL，和一些扩展类库中的80%以上的内容，特别是一些常用的类的处理
◆  针对不同的需求，查找不同的函数库。
◆  测试：必须熟悉使用phpunit编写测试用例完成代码的自动测试。
◆  管理：必须熟悉使用xinc, phing等完成工程管理的常用任务，例如工程编译、生成phpdoc、生成、版本控制、自动测试。
◆  排错：应该可以根据异常信息比较快速的定位问题的原因和大致位置。
◆  思想：必须掌握OOP的主要要求，这样使用PHP开发的系统才能是真正的PHP系统。
◆  规范：编写的代码必须符合流行的编码规范，这样程序的可读性才比较好。
◆  博学：掌握OOA、OOD、YiiFramework 、Zendframework、cakephp、symfony、模板技术等流行技术，掌握软件架构设计思想、搜索引擎优化、缓存系统设计、网站负载均衡、系统性能调优等实用技术。
◆ 多去看别人写的代码，php优秀的框架很多，很多人在认知上就有一个错误。认为自己能用一个框架开发一个系统了就认为自己已经熟悉这个框架了，其实会使用他并没有什么一个框架基本都有用户手册，一看基本都会使用了，要想自己技术上面提升，建议多看看这些框架的实现原理（设计模式）。
]]></description>
			<content:encoded><![CDATA[<p>最近去了tencent，xunlei等互联网名企面试，总结一下:</p>
<ol>
<li>如果想进入这类企业进行底层开发的话必须对互联网各方面的技术原理了解的很清楚，例如apache实现原理。语言方面既然是php开发自然对c/c++要求比较高。往往需要自己写php扩展。使用<a href="http://www.blags.org/tags/mysql/"title="mysql" >mysql</a>自然想很多常见的，性能瓶颈要能有很好的解决方案。mysql 插件编写，apache模块编写。联系起来结合点还是要会c。</li>
<li>倘若是做中间层和前端工作则要求对css，<a href="http://www.blags.org/tags/javascript/"title="javascript" >javascript</a>要求比较高。当然对web的一系列实现原理也是要非常熟悉的。</li>
<li>对新技术要比较敏感，才能证明你有很好的学习能力和使用能力。</li>
<li>努力提高自己的英文口语，和阅读能力。往往很多新技术都是老外想出来的。等有了中文版也许这个技术已经不是那么新了。</li>
</ol>
<p>相信我们很多人都只是了解到中间的皮毛而已，对于技术原理。这类型的东西了解甚少。值得注意的一点，正则这个东西在他们严重也是很重要的。</p>
<p>想成为一位合格的php程序员（高级）,必须符合如下条件。</p>
<p>◆ 文件目录处理函数包80％以上的函数的功能的灵活运用。<br />
◆ 日期时间函数中的80％以上的函数的功能的灵活运用<br />
◆ 数学函数库中的100％的内容。<br />
◆ 网络库中的60％以上的内容，对各个函数的功能比较熟悉。<br />
◆ 字符串处理函数下的60％以上的内容，特别是各种处理函数。<br />
◆ 正则表达式函数下的90%以上的内容，特别是各种正则处理<br />
◆  一些安全库下的40％以上的内容，如果对于安全没有接触的话根本就不可能掌握PHP<br />
◆ XML处理，熟悉SAX、DOM以及JDOM的优缺点并且能够使用其中的一种完成XML的解析及内容处理。<br />
◆ 图形图像函数库下的80%以上的内容，特别是一些图像生成和处理<br />
◆ MySQL 数据库函数下的90%以上的内容，特别是处理各种数据的函数<br />
◆ 数组处理函数下的90%以上的内容，特别是各种操作处理函数<br />
◆  其它PEAR，PECL，和一些扩展类库中的80%以上的内容，特别是一些常用的类的处理<br />
◆  针对不同的需求，查找不同的函数库。<br />
◆  测试：必须熟悉使用phpunit编写测试用例完成代码的自动测试。<br />
◆  管理：必须熟悉使用xinc, phing等完成工程管理的常用任务，例如工程编译、生成phpdoc、生成、版本控制、自动测试。<br />
◆  排错：应该可以根据异常信息比较快速的定位问题的原因和大致位置。<br />
◆  思想：必须掌握OOP的主要要求，这样使用PHP开发的系统才能是真正的PHP系统。<br />
◆  规范：编写的代码必须符合流行的编码规范，这样程序的可读性才比较好。<br />
◆  博学：掌握OOA、OOD、YiiFramework 、Zendframework、cakephp、symfony、模板技术等流行技术，掌握软件架构设计思想、搜索引擎优化、缓存系统设计、网站负载均衡、系统性能调优等实用技术。</p>
<p>◆ 多去看别人写的代码，php优秀的框架很多，很多人在认知上就有一个错误。认为自己能用一个框架开发一个系统了就认为自己已经熟悉这个框架了，其实会使用他并没有什么一个框架基本都有用户手册，一看基本都会使用了，要想自己技术上面提升，建议多看看这些框架的实现原理（设计模式）。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/php-programmer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HTTP 状态代码</title>
		<link>http://www.blags.org/http-status-code/</link>
		<comments>http://www.blags.org/http-status-code/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 08:39:57 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[WEB]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[状态码]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=633</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;如果向您的服务器发出了某项请求要求显示您网站上的某个网页（例如，当用户通过浏览器访问您的网页或在 Googlebot 抓取该网页时），那么，您的服务器会返回 HTTP 状态代码以响应该请求。
此状态代码提供了有关请求状态的信息，且为 Googlebot 提供了有关您网站和请求的网页的信息。
一些常见的状态代码为：

200 &#8211; 服务器成功返回网页
404 &#8211; 请求的网页不存在
503 &#8211; 服务器暂时不可用

以下提供了 HTTP 状态代码的完整列表。点击链接可了解详细信息。您也可以访问有关 HTTP 状态代码的 W3C 页来了解详细信息。
1xx（临时响应）
用于表示临时响应并需要请求者执行操作才能继续的状态代码。



代码
说明


100（继续）
请求者应当继续提出请求。服务器返回此代码则意味着，服务器已收到了请求的第一部分，现正在等待接收其余部分。


101（切换协议）
请求者已要求服务器切换协议，服务器已确认并准备进行切换。



2xx（成功）
用于表示服务器已成功处理了请求的状态代码。



代码
说明


200（成功）
服务器已成功处理了请求。通常，这表示服务器提供了请求的网页。如果您的 robots.txt 文件显示为此状态，那么，这表示 Googlebot 已成功检索到该文件。


201（已创建）
请求成功且服务器已创建了新的资源。


202（已接受）
服务器已接受了请求，但尚未对其进行处理。


203（非授权信息）
服务器已成功处理了请求，但返回了可能来自另一来源的信息。


204（无内容）
服务器成功处理了请求，但未返回任何内容。


205（重置内容）
服务器成功处理了请求，但未返回任何内容。与 204 响应不同，此响应要求请求者重置文档视图（例如清除表单内容以输入新内容）。


206（部分内容）
服务器成功处理了部分 GET 请求。



3xx（已重定向）
要完成请求，您需要进一步进行操作。通常，这些状态代码是永远重定向的。Google 建议您在每次请求时使用的重定向要少于 5 个。您可以使用网站管理员工具来查看 Googlebot 在抓取您已重定向的网页时是否会遇到问题。



代码
说明


300（多种选择）
服务器根据请求可执行多种操作。服务器可根据请求者 (User agent) 来选择一项操作，或提供操作列表供请求者选择。


301（永久移动）
请求的网页已被永久移动到新位置。服务器返回此响应（作为对 GET 或 HEAD 请求的响应）时，会自动将请求者转到新位置。您应使用此代码通知 Googlebot 某个网页或网站已被永久移动到新位置。


302（临时移动）
服务器目前正从不同位置的网页响应请求，但请求者应继续使用原有位置来进行以后的请求。此代码与响应 GET 和 HEAD 请求的 301 代码类似，会自动将请求者转到不同的位置。但由于 Googlebot 会继续抓取原有位置并将其编入索引，因此您不应使用此代码来通知 Googlebot 某个页面或网站已被移动。


303（查看其他位置）
当请求者应对不同的位置进行单独的 GET 请求以检索响应时，服务器会返回此代码。对于除 HEAD 请求之外的所有请求，服务器会自动转到其他位置。


304（未修改）
自从上次请求后，请求的网页未被修改过。服务器返回此响应时，不会返回网页内容。
如果网页自请求者上次请求后再也没有更改过，您应当将服务器配置为返回此响应（称为 <a href="http://www.blags.org/http-status-code/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;如果向您的服务器发出了某项请求要求显示您网站上的某个网页（例如，当用户通过浏览器访问您的网页或在 Googlebot 抓取该网页时），那么，您的服务器会返回 HTTP 状态代码以响应该请求。</p>
<p>此状态代码提供了有关请求状态的信息，且为 Googlebot 提供了有关您网站和请求的网页的信息。</p>
<p>一些常见的状态代码为：</p>
<ul>
<li><strong>200</strong> &#8211; 服务器成功返回网页</li>
<li><strong>404</strong> &#8211; 请求的网页不存在</li>
<li><strong>503</strong> &#8211; 服务器暂时不可用</li>
</ul>
<p>以下提供了 HTTP 状态代码的完整列表。点击链接可了解详细信息。您也可以访问<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">有关 HTTP 状态代码的 W3C 页来了解详细信息</a>。</p>
<p><strong>1xx</strong><strong>（临时响应）</strong><br />
用于表示临时响应并需要请求者执行操作才能继续的状态代码。</p>
<table border="1" cellspacing="1" cellpadding="1" summary="1xx status codes indicating a provisional response">
<tbody>
<tr>
<th scope="col">代码</th>
<th scope="col">说明</th>
</tr>
<tr>
<td>100（继续）</td>
<td>请求者应当继续提出请求。服务器返回此代码则意味着，服务器已收到了请求的第一部分，现正在等待接收其余部分。</td>
</tr>
<tr>
<td>101（切换协议）</td>
<td>请求者已要求服务器切换协议，服务器已确认并准备进行切换。</td>
</tr>
</tbody>
</table>
<p><strong>2xx</strong><strong>（成功）</strong></p>
<p>用于表示服务器已成功处理了请求的状态代码。</p>
<table border="1" cellspacing="1" cellpadding="1" summary="2xx status codes indicating successful requests">
<tbody>
<tr>
<th scope="col">代码</th>
<th scope="col">说明</th>
</tr>
<tr>
<td>200（成功）</td>
<td>服务器已成功处理了请求。通常，这表示服务器提供了请求的网页。如果您的 robots.txt 文件显示为此状态，那么，这表示 Googlebot 已成功检索到该文件。</td>
</tr>
<tr>
<td>201（已创建）</td>
<td>请求成功且服务器已创建了新的资源。</td>
</tr>
<tr>
<td>202（已接受）</td>
<td>服务器已接受了请求，但尚未对其进行处理。</td>
</tr>
<tr>
<td>203（非授权信息）</td>
<td>服务器已成功处理了请求，但返回了可能来自另一来源的信息。</td>
</tr>
<tr>
<td>204（无内容）</td>
<td>服务器成功处理了请求，但未返回任何内容。</td>
</tr>
<tr>
<td>205（重置内容）</td>
<td>服务器成功处理了请求，但未返回任何内容。与 204 响应不同，此响应要求请求者重置文档视图（例如清除表单内容以输入新内容）。</td>
</tr>
<tr>
<td>206（部分内容）</td>
<td>服务器成功处理了部分 GET 请求。</td>
</tr>
</tbody>
</table>
<p><strong>3xx</strong><strong>（已重定向）</strong><br />
要完成请求，您需要进一步进行操作。通常，这些状态代码是永远重定向的。Google 建议您在每次请求时使用的重定向要少于 5 个。您可以使用网站管理员工具来查看 Googlebot 在抓取您已重定向的网页时是否会遇到问题。</p>
<table border="1" cellspacing="1" cellpadding="1" summary="3xx status codes requiring further action">
<tbody>
<tr>
<th scope="col">代码</th>
<th scope="col">说明</th>
</tr>
<tr>
<td>300（多种选择）</td>
<td>服务器根据请求可执行多种操作。服务器可根据请求者 (User agent) 来选择一项操作，或提供操作列表供请求者选择。</td>
</tr>
<tr>
<td>301（永久移动）</td>
<td>请求的网页已被永久移动到新位置。服务器返回此响应（作为对 GET 或 HEAD 请求的响应）时，会自动将请求者转到新位置。您应使用此代码通知 Googlebot 某个网页或网站已被永久移动到新位置。</td>
</tr>
<tr>
<td>302（临时移动）</td>
<td>服务器目前正从不同位置的网页响应请求，但请求者应继续使用原有位置来进行以后的请求。此代码与响应 GET 和 HEAD 请求的 301 代码类似，会自动将请求者转到不同的位置。但由于 Googlebot 会继续抓取原有位置并将其编入索引，因此您不应使用此代码来通知 Googlebot 某个页面或网站已被移动。</td>
</tr>
<tr>
<td>303（查看其他位置）</td>
<td>当请求者应对不同的位置进行单独的 GET 请求以检索响应时，服务器会返回此代码。对于除 HEAD 请求之外的所有请求，服务器会自动转到其他位置。</td>
</tr>
<tr>
<td>304（未修改）</td>
<td>自从上次请求后，请求的网页未被修改过。服务器返回此响应时，不会返回网页内容。</p>
<p>如果网页自请求者上次请求后再也没有更改过，您应当将服务器配置为返回此响应（称为 If-Modified-Since HTTP 标头）。由于服务器可以告诉 Googlebot 自从上次抓取后网页没有更改过，因此可节省带宽和开销</p>
<p>。</td>
</tr>
<tr>
<td>305（使用代理）</td>
<td>请求者只能使用代理访问请求的网页。如果服务器返回此响应，那么，服务器还会指明请求者应当使用的代理。</td>
</tr>
<tr>
<td>307（临时重定向）</td>
<td>服务器目前正从不同位置的网页响应请求，但请求者应继续使用原有位置来进行以后的请求。此代码与响应 GET 和 HEAD 请求的 301 代码类似，会自动将请求者转到不同的位置。但由于 Googlebot 会继续抓取原有位置并将其编入索引，因此您不应使用此代码来通知 Googlebot 某个页面或网站已被移动。</td>
</tr>
</tbody>
</table>
<p><strong>4xx（请求错误）</strong><br />
这些状态代码表示，请求可能出错，已妨碍了服务器对请求的处理。</p>
<table border="1" cellspacing="1" cellpadding="1" summary="4xx status codes indicating that the server could not process the request">
<tbody>
<tr>
<th scope="col">代码</th>
<th scope="col">说明</th>
</tr>
<tr>
<td>400（错误请求）</td>
<td>服务器不理解请求的语法。</td>
</tr>
<tr>
<td>401（未授权）</td>
<td>请求要求进行身份验证。登录后，服务器可能会返回对页面的此响应。</td>
</tr>
<tr>
<td>403（已禁止）</td>
<td>服务器拒绝请求。如果在 Googlebot 尝试抓取您网站上的有效网页时显示此状态代码（您可在 Google 网站管理员工具中<strong>诊断</strong>下的<strong>网络抓取</strong>页面上看到此状态代码），那么，这可能是您的服务器或主机拒绝 Googlebot 对其进行访问。</td>
</tr>
<tr>
<td>404（未找到）</td>
<td>服务器找不到请求的网页。例如，如果请求是针对服务器上不存在的网页进行的，那么，服务器通常会返回此代码。</p>
<p>如果您的网站上没有 robots.txt 文件，那么，这是正确的状态。然而，如果您有 robots.txt 文件而又发现了此状态，那么，这说明您的 robots.txt 文件可能是命名错误或位于错误的位置。（该文件应当位于顶级域名上，且应当名为 robots.txt）。</p>
<p>如果您在 Googlebot 尝试抓取的网址上发现此状态（位于&#8221;诊断&#8221;标签的 HTTP 错误页上），那么，这表示 Googlebot 所追踪的可能是另一网页中的无效链接（旧链接或输入有误的链接）。</td>
</tr>
<tr>
<td>405（方法禁用）</td>
<td>禁用请求中所指定的方法。</td>
</tr>
<tr>
<td>406（不接受）</td>
<td>无法使用请求的内容特性来响应请求的网页。</td>
</tr>
<tr>
<td>407（需要代理授权）</td>
<td>此状态代码与 401（未授权）类似，但却指定了请求者应当使用代理进行授权。如果服务器返回此响应，那么，服务器还会指明请求者应当使用的代理。</td>
</tr>
<tr>
<td>408（请求超时）</td>
<td>服务器等候请求时超时。</td>
</tr>
<tr>
<td>409（冲突）</td>
<td>服务器在完成请求时发生冲突。服务器必须包含有关响应中所发生的冲突的信息。服务器在响应与前一个请求相冲突的 PUT 请求时可能会返回此代码，同时会提供两个请求的差异列表。</td>
</tr>
<tr>
<td>410（已删除）</td>
<td>如果请求的资源已被永久删除，那么，服务器会返回此响应。该代码与 404（未找到）代码类似，但在资源以前有但现在已经不复存在的情况下，有时会替代 404 代码出现。如果资源已被永久删除，那么，您应当使用 301 代码指定该资源的新位置。</td>
</tr>
<tr>
<td>411（需要有效长度）</td>
<td>服务器不会接受包含无效内容长度标头字段的请求。</td>
</tr>
<tr>
<td>412（未满足前提条件）</td>
<td>服务器未满足请求者在请求中设置的其中一个前提条件。</td>
</tr>
<tr>
<td>413（请求实体过大）</td>
<td>服务器无法处理请求，因为请求实体过大，已超出服务器的处理能力。</td>
</tr>
<tr>
<td>414（请求的 URI 过长）</td>
<td>请求的 URI（通常为网址）过长，服务器无法进行处理。</td>
</tr>
<tr>
<td>415（不支持的媒体类型）</td>
<td>请求的格式不受请求页面的支持。</td>
</tr>
<tr>
<td>416（请求范围不符合要求）</td>
<td>如果请求是针对网页的无效范围进行的，那么，服务器会返回此状态代码。</td>
</tr>
<tr>
<td>417（未满足期望值）</td>
<td>服务器未满足&#8221;期望&#8221;请求标头字段的要求。</td>
</tr>
</tbody>
</table>
<p><strong>5xx</strong><strong>（服务器错误）</strong><br />
这些状态代码表示，服务器在尝试处理请求时发生内部错误。这些错误可能是服务器本身的错误，而不是请求出错。</p>
<table border="1" cellspacing="1" cellpadding="1" summary="5xx status codes indicating that the server had an internal error">
<tbody>
<tr>
<th scope="col">代码</th>
<th scope="col">说明</th>
</tr>
<tr>
<td>500（服务器内部错误）</td>
<td>服务器遇到错误，无法完成请求。</td>
</tr>
<tr>
<td>501（尚未实施）</td>
<td>服务器不具备完成请求的功能。例如，当服务器无法识别请求方法时，服务器可能会返回此代码。</td>
</tr>
<tr>
<td>502（错误网关）</td>
<td>服务器作为网关或代理，从上游服务器收到了无效的响应。</td>
</tr>
<tr>
<td>503（服务不可用）</td>
<td>目前无法使用服务器（由于超载或进行停机维护）。通常，这只是一种暂时的状态。</td>
</tr>
<tr>
<td>504（网关超时）</td>
<td>服务器作为网关或代理，未及时从上游服务器接收请求。</td>
</tr>
<tr>
<td>505（HTTP 版本不受支持）</td>
<td>服务器不支持请求中所使用的 HTTP 协议版本。</td>
</tr>
</tbody>
</table>
<p>基础知识不能忘记阿。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/http-status-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql myisam innodb 区别</title>
		<link>http://www.blags.org/mysql-myisam-innodb-difference/</link>
		<comments>http://www.blags.org/mysql-myisam-innodb-difference/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 16:36:35 +0000</pubDate>
		<dc:creator>马丁博客</dc:creator>
				<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[MyIsam]]></category>
		<category><![CDATA[Tencent]]></category>

		<guid isPermaLink="false">http://www.blags.org/?p=632</guid>
		<description><![CDATA[最近连续接到了两次tencent的电话面试，当然不是同一个部门。都涉及到了一个mysql的基础知识问题。为了防止第三次打电话来,备注下。^^。
题目1：讲讲你对mysql myisam，innodb的认识。然后你认为他们的区别在那里?为什么?
答：这两个是mysql主要存储引擎。
简要介绍来自官网。
简要介绍:MyIsam
MyISAM是 默认存储引擎。它基于更老的ISAM代码，但有很多有用的扩展。（注意MySQL 5.1不支持ISAM）。
每个MyISAM在磁盘上存储成三个文件。第一个文件的名字以表的名字开始，扩展名指出文件类型。.frm文件存储表定义。数据文件的扩展名为.MYD (MYData)。索引文件的扩展名是.MYI (MYIndex)。
简要介绍:InnoDB
InnoDB给MySQL提供 了具有提交，回滚和崩溃恢复能力的事务安全（ACID兼容）存储引擎。InnoDB锁定在行级并且也在SELECT语句提供一个Oracle风格一致的非锁定读。这些特色增加 了多用户部署和性能。没有在InnoDB中扩大锁定的需要，因为在InnoDB中行级锁定适合非常小的空间。InnoDB也支持FOREIGN KEY强制。在SQL查询中，你可以自由地将InnoDB类型的表与其它MySQL的表的类型混合起来，甚至在同一个查询中也可以混合。
InnoDB是为处理巨大数据量时的最大性能设计。它的CPU效率可能是任何其它基于磁盘的关系数据库引擎所不能匹敌的。
InnoDB存储引擎被完全与MySQL服务器整合，InnoDB存储引擎为在主内存中缓存数据和索引而维持它自己的缓冲池。InnoDB存储它的表＆索引在一个表空间中，表空间可以包含数个文件（或原始磁盘分区）。这与MyISAM表不同，比如在MyISAM表中每个表被存在分离的文件中。InnoDB 表可以是任何尺寸，即使在文件尺寸被限制为2GB的操作系统上。
InnoDB默认地被包含在MySQL二进制分发中。Windows Essentials installer使InnoDB成为Windows上MySQL的 默认表。
InnoDB被用来在众多需要高性能的大型数据库站点上产生。著名的Internet新闻站点Slashdot.org运行在InnoDB上。Mytrix, Inc.在InnoDB上存储超过1TB的数据，还有一些其它站点在InnoDB上处理平均每秒800次插入/更新的负荷。
简单概括几点如下:

通过不上不难看出，MyIsam InnoDB的用途，Myisam主要适用于中小型数据量。InnoDB引擎适用于大数据量。上面已经讲得很清楚拉。著名的开源电子商务系统[magento]就是采用InnoDB创建。
MyIsam写入速度比InnoDB快。
在使用InnoDB时候需要对my.cnf进行配置以保证mysql达到最大效率。详细可以查看官网[inndo性能调节]：http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html#innodb-tuning。

其中有很多人在网上发表了关于mysql MyIsam 和 InnoDB在存贮和读取方面的差异。暂时还没有做过度研究。
基本测试都是基于使用［事务］和不使用［事务］，进行对比。mysql对于［非事务表］速度会比较块。
原因：待查证。
猜测：设定了 innodb_flush_log_at_trx_commit 如果设置为1的话，那么每次插入数据的时候都会自动提交，导致性能急剧下降，应该是跟刷新日志有关系，设置为0效率能够看到明显提升，当然，同样你可以SQL中提交[SET AUTOCOMMIT = 0]来设置达到好的性能。另外，还听说通过设置innodb_buffer_pool_size能够提升InnoDB的性能。
通过上面的分析，在我们采用mysql存储引擎的时候要按需分配。针对不同的存储引擎要采用不同的数据设计。
题目2：开发过程中，遇到糟糕的sql语句你是怎么解决的。
答：使用mysql的［EXPLAIN］对sql进行解释。因该还有更多好方法。
mysql 常见问题可以查看：http://www.blags.org/mysql-error-daquan-and-solutions/
mysql存储引擎的介绍 ：http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html
以上如有不足之处，请大家帮忙补充,thk。
]]></description>
			<content:encoded><![CDATA[<p>最近连续接到了两次tencent的电话面试，当然不是同一个部门。都涉及到了一个<a href="http://www.blags.org/tags/mysql/"title="mysql" >mysql</a>的基础知识问题。为了防止第三次打电话来,备注下。^^。</p>
<p>题目1：讲讲你对mysql myisam，innodb的认识。然后你认为他们的区别在那里?为什么?</p>
<p>答：这两个是mysql主要存储引擎。</p>
<p>简要介绍来自官网。</p>
<p>简要介绍:<span style="color: #ff0000;">MyIsam</span></p>
<p>MyISAM是 默认存储引擎。它基于更老的ISAM代码，但有很多有用的扩展。（注意MySQL 5.1不支持ISAM）。</p>
<p>每个MyISAM在磁盘上存储成三个文件。第一个文件的名字以表的名字开始，扩展名指出文件类型。.frm文件存储表定义。数据文件的扩展名为.MYD (MYData)。索引文件的扩展名是.MYI (MYIndex)。</p>
<p>简要介绍:<span style="color: #ff0000;">InnoDB</span></p>
<p>InnoDB给MySQL提供 了具有提交，回滚和崩溃恢复能力的事务安全（ACID兼容）存储引擎。InnoDB锁定在行级并且也在SELECT语句提供一个Oracle风格一致的非锁定读。这些特色增加 了多用户部署和性能。没有在InnoDB中扩大锁定的需要，因为在InnoDB中行级锁定适合非常小的空间。InnoDB也支持FOREIGN KEY强制。在SQL查询中，你可以自由地将InnoDB类型的表与其它MySQL的表的类型混合起来，甚至在同一个查询中也可以混合。</p>
<p><span style="color: #ff0000;">InnoDB是为处理巨大数据量时的最大性能设计</span>。它的CPU效率可能是任何其它基于磁盘的关系数据库引擎所不能匹敌的。</p>
<p>InnoDB存储引擎被完全与MySQL服务器整合，InnoDB存储引擎为在主内存中缓存数据和索引而维持它自己的缓冲池。InnoDB存储它的表＆索引在一个表空间中，表空间可以包含数个文件（或原始磁盘分区）。这与MyISAM表不同，比如在MyISAM表中每个表被存在分离的文件中。InnoDB 表可以是任何尺寸，即使在文件尺寸被限制为2GB的操作系统上。</p>
<p>InnoDB默认地被包含在MySQL二进制分发中。Windows Essentials installer使InnoDB成为Windows上MySQL的 默认表。</p>
<p>InnoDB被用来在众多需要高性能的大型数据库站点上产生。著名的Internet新闻站点Slashdot.org运行在InnoDB上。Mytrix, Inc.在InnoDB上存储超过1TB的数据，还有一些其它站点在InnoDB上处理平均每秒800次插入/更新的负荷。</p>
<p>简单概括几点如下:</p>
<ol>
<li>通过不上不难看出，MyIsam InnoDB的用途，Myisam主要适用于中小型数据量。InnoDB引擎适用于大数据量。上面已经讲得很清楚拉。著名的开源电子商务系统[<a href="http://www.blags.org/tags/magento/"title="magento" >magento</a>]就是采用InnoDB创建。</li>
<li>MyIsam写入速度比InnoDB快。</li>
<li>在使用InnoDB时候需要对my.cnf进行配置以保证mysql达到最大效率。详细可以查看官网[inndo性能调节]：<a href="http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html#innodb-tuning">http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html#innodb-tuning</a>。</li>
</ol>
<p>其中有很多人在网上发表了关于mysql MyIsam 和 InnoDB在存贮和读取方面的差异。暂时还没有做过度研究。</p>
<p>基本测试都是基于使用［事务］和不使用［事务］，进行对比。mysql对于［非事务表］速度会比较块。</p>
<p>原因：待查证。</p>
<p>猜测：设定了 innodb_flush_log_at_trx_commit 如果设置为1的话，那么每次插入数据的时候都会自动提交，导致性能急剧下降，应该是跟刷新日志有关系，设置为0效率能够看到明显提升，当然，同样你可以SQL中提交[SET AUTOCOMMIT = 0]来设置达到好的性能。另外，还听说通过设置innodb_buffer_pool_size能够提升InnoDB的性能。</p>
<p>通过上面的分析，在我们采用mysql存储引擎的时候要按需分配。针对不同的存储引擎要采用不同的数据设计。</p>
<p>题目2：开发过程中，遇到糟糕的sql语句你是怎么解决的。</p>
<p>答：使用mysql的［EXPLAIN］对sql进行解释。因该还有更多好方法。</p>
<p>mysql 常见问题可以查看：<a href="http://www.blags.org/mysql-error-daquan-and-solutions/">http://www.blags.org/mysql-error-daquan-and-solutions/</a></p>
<p>mysql存储引擎的介绍 ：<a href="http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html">http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html</a></p>
<p>以上如有不足之处，请大家帮忙补充,thk。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blags.org/mysql-myisam-innodb-difference/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

