<?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>Caibaohua&#039;s blog</title>
	<atom:link href="http://caibaohua.com/feed" rel="self" type="application/rss+xml" />
	<link>http://caibaohua.com</link>
	<description>生活随笔</description>
	<lastBuildDate>Fri, 02 Jul 2010 05:20:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Nginx给图片加上访问时间限制</title>
		<link>http://caibaohua.com/archives/27</link>
		<comments>http://caibaohua.com/archives/27#comments</comments>
		<pubDate>Fri, 02 Jul 2010 05:20:02 +0000</pubDate>
		<dc:creator>caibaohua</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://caibaohua.com/?p=27</guid>
		<description><![CDATA[基本原理 ngx_http_secure_download_module的wiki. PHP $prefix = "image"; $timeToHex = sprintf('%X',(time() + 3600));  //过期一小时 $privateStr = long2ip(ip2long($_SERVER['REMOTE_ADDR']));　//不同IP不能访问 $imagePathToMd5 = md5('/'.$prefix.'/'.$imagePath.'/'.$privateStr.'/'.$timeToHex); //生成唯一标示 return sprintf('%s/%s/%s/%s', $prefix, $imagePath, $imagePathToMd5, $timeToHex); //返回图片url]]></description>
			<content:encoded><![CDATA[<p><strong>基本原理</strong></p>
<p>ngx_http_secure_download_module的<a title="wiki" href="http://wiki.nginx.org/NginxHttpSecureDownload" target="_blank">wiki</a>.</p>
<p><strong>PHP</strong></p>
<pre class="brush: php">
$prefix = "image";
$timeToHex = sprintf('%X',(time() + 3600));  //过期一小时
$privateStr = long2ip(ip2long($_SERVER['REMOTE_ADDR']));　//不同IP不能访问
$imagePathToMd5 = md5('/'.$prefix.'/'.$imagePath.'/'.$privateStr.'/'.$timeToHex); //生成唯一标示
return sprintf('%s/%s/%s/%s', $prefix, $imagePath, $imagePathToMd5, $timeToHex); //返回图片url
</pre>
]]></content:encoded>
			<wfw:commentRss>http://caibaohua.com/archives/27/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chris的广告征选</title>
		<link>http://caibaohua.com/archives/21</link>
		<comments>http://caibaohua.com/archives/21#comments</comments>
		<pubDate>Thu, 10 Jun 2010 04:37:41 +0000</pubDate>
		<dc:creator>caibaohua</dc:creator>
				<category><![CDATA[随便写写]]></category>
		<category><![CDATA[chris]]></category>

		<guid isPermaLink="false">http://caibaohua.com/?p=21</guid>
		<description><![CDATA[照片： 视屏:]]></description>
			<content:encoded><![CDATA[<p>照片：</p>
<p><a href="http://caibaohua.com/wp-content/uploads/2010/06/10.5.002.jpg" target="_blank"><img class="alignnone size-medium wp-image-24" title="照片" src="http://caibaohua.com/wp-content/uploads/2010/06/10.5.002-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>视屏:</p>
<p><embed src='http://player.youku.com/player.php/sid/XMTgwMzMzMDY0/v.swf' quality='high' width='480' height='400' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash'></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://caibaohua.com/archives/21/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby 二分叉查询</title>
		<link>http://caibaohua.com/archives/13</link>
		<comments>http://caibaohua.com/archives/13#comments</comments>
		<pubDate>Sat, 24 Apr 2010 15:04:58 +0000</pubDate>
		<dc:creator>caibaohua</dc:creator>
				<category><![CDATA[随便写写]]></category>
		<category><![CDATA[binary search]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://caibaohua.com/?p=13</guid>
		<description><![CDATA[class BinarySearch attr_accessor :needle, :haystack def initialize(needle, haystack) @needle = needle @haystack = haystack end def in min = 0 max = @haystack.size - 1 while min]]></description>
			<content:encoded><![CDATA[<pre class="brush: ruby">
class BinarySearch
  attr_accessor :needle, :haystack

  def initialize(needle, haystack)
    @needle = needle
    @haystack = haystack
  end

  def in
    min = 0
    max = @haystack.size - 1
    while min <= max
      mid = min + ((max-min)/2)
      if @needle == @haystack[mid]
        return true
      else
        if @needle < @haystack[mid]
          max = mid -1
        else
          min = mid + 1
        end
      end
    end
    return false
  end
end

require "test/unit"
class TestBinarySearch < Test::Unit::TestCase
  def testSearch
    search = BinarySearch.new(7, [1,2,5,7,9,10])
    assert_equal(true, search.in)
  end
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://caibaohua.com/archives/13/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>读书笔记（一）</title>
		<link>http://caibaohua.com/archives/7</link>
		<comments>http://caibaohua.com/archives/7#comments</comments>
		<pubDate>Mon, 12 Apr 2010 14:59:56 +0000</pubDate>
		<dc:creator>caibaohua</dc:creator>
				<category><![CDATA[读书笔记]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://caibaohua.com/?p=7</guid>
		<description><![CDATA[重构第一步 为即将修改的代码建立一组可靠的测试环境 。 第一个案例 Extract Method &#8211; 提炼函数，把过长的代码分割成较小块的代码放入合适的class内 。 Move Method &#8211; 搬移函数，把代码拷贝到比较适应的class内。 Replace Temp with Query  &#8211; 用查询式替换临时变量，从而去除临时变量。 运用多态取代条件逻辑 Replace Type Code with State/Strategy &#8211; 用State/Strategy代替型代码，步骤： 使用Self Encapsulate Field, 封装type code (get/set)。 为type code新建class, 并且以type code命名，即state object。 新建sub classes继承state object。 使用Move Method，调成代码至合适的类中。 使用Replace Conditional with Polymorphism，去除switch]]></description>
			<content:encoded><![CDATA[<p><strong>重构第一步</strong></p>
<p>为即将修改的代码建立一组可靠的测试环境 。</p>
<p><strong>第一个案例</strong></p>
<p>Extract Method &#8211; 提炼函数，把过长的代码分割成较小块的代码放入合适的class内 。</p>
<p>Move Method &#8211; 搬移函数，把代码拷贝到比较适应的class内。</p>
<p>Replace Temp with Query  &#8211; 用查询式替换临时变量，从而去除临时变量。</p>
<p><strong>运用多态取代条件逻辑</strong></p>
<p>Replace Type Code with State/Strategy &#8211; 用State/Strategy代替型代码，步骤：</p>
<ul>
<li>使用Self Encapsulate Field, 封装type code (get/set)。</li>
<li>为type code新建class, 并且以type code命名，即state object。</li>
<li>新建sub classes继承state object。</li>
<li>使用Move Method，调成代码至合适的类中。</li>
<li>使用Replace Conditional with Polymorphism，去除switch</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://caibaohua.com/archives/7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2010不好的开头</title>
		<link>http://caibaohua.com/archives/5</link>
		<comments>http://caibaohua.com/archives/5#comments</comments>
		<pubDate>Fri, 15 Jan 2010 05:19:25 +0000</pubDate>
		<dc:creator>caibaohua</dc:creator>
				<category><![CDATA[随便写写]]></category>

		<guid isPermaLink="false">http://caibaohua.com/archives/5</guid>
		<description><![CDATA[月初得了感冒至今咳嗽不止，感觉身体大不如以前。一直在阅读的某杂志主编，由于个人身体状况不得不离开他喜欢的岗位。 13号，带了好几年的眼镜摔坏了。下午笔记本和咖啡接触了，后果直接不能开机。 有些人为了看了场电影开始疯狂。 有些人已经用不同的方式开始悼念goolge。 我们的网络真的是开放的吗？]]></description>
			<content:encoded><![CDATA[<p>月初得了感冒至今咳嗽不止，感觉身体大不如以前。一直在阅读的某杂志主编，由于个人身体状况不得不离开他喜欢的岗位。<br />
13号，带了好几年的眼镜摔坏了。下午笔记本和咖啡接触了，后果直接不能开机。<br />
有些人为了看了场电影开始疯狂。<br />
有些人已经用不同的方式开始悼念goolge。<br />
我们的网络真的是开放的吗？</p>
]]></content:encoded>
			<wfw:commentRss>http://caibaohua.com/archives/5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>忘记备份博客数据，杯具啊！</title>
		<link>http://caibaohua.com/archives/1</link>
		<comments>http://caibaohua.com/archives/1#comments</comments>
		<pubDate>Wed, 30 Dec 2009 10:26:51 +0000</pubDate>
		<dc:creator>caibaohua</dc:creator>
				<category><![CDATA[随便写写]]></category>

		<guid isPermaLink="false">http://caibaohua.com/?p=1</guid>
		<description><![CDATA[Dreamhost虚拟主机服务过期，mysql数据都没有来得及备份。暂时借用同事的虚拟主机一用，原来才发现Dreamhost的速度原来如此之慢，而且又不便宜。 唉，又要重头开始新的blog。（话说这是第几次重头开始啊。。。） 明天就是2009年最后的一天了，疯狂的shopping night。希望能买到穿得下的衣服。]]></description>
			<content:encoded><![CDATA[<p>Dreamhost虚拟主机服务过期，mysql数据都没有来得及备份。暂时借用同事的虚拟主机一用，原来才发现Dreamhost的速度原来如此之慢，而且又不便宜。</p>
<p>唉，又要重头开始新的blog。（话说这是第几次重头开始啊。。。）</p>
<p>明天就是2009年最后的一天了，疯狂的shopping night。希望能买到穿得下的衣服。</p>
]]></content:encoded>
			<wfw:commentRss>http://caibaohua.com/archives/1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
