<?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>Cowoo's Tech Notes</title>
	<atom:link href="http://cowoo.net/tech/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://cowoo.net/tech</link>
	<description>Embrace the Internet</description>
	<lastBuildDate>Wed, 13 Jul 2011 21:03:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Linux下wget的不同处理</title>
		<link>http://cowoo.net/tech/?p=50</link>
		<comments>http://cowoo.net/tech/?p=50#comments</comments>
		<pubDate>Wed, 13 Jul 2011 21:03:00 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=50</guid>
		<description><![CDATA[今天在AWS上写抓数据的程序，移植了一个简单的程序过去。但是不管怎么跑，Eclipse里面都报错: &#34;dafdafaf字符串&#34;: Scheme missing 以前没见过这个错误。开始还以为是Java环境设置的问题，后来发现原来是Windows下和Linux下对字符串处理的不同造成的。 在Windows下，从Java里调用wget的时候，为了防止URL中的特殊字符作怪，我在前后加了一个引号 &#34;\http://cowoo.net/tech/?cat=12\&#34; 正是多加的这两个引号导致了上面那个错误。搜了一下发现，Linux下Java按照空格来解析命令行，所以URL会被当成一个整体。不会出现我所担心的问题。]]></description>
			<content:encoded><![CDATA[<p>今天在AWS上写抓数据的程序，移植了一个简单的程序过去。但是不管怎么跑，Eclipse里面都报错:</p>
<blockquote><p>&quot;dafdafaf字符串&quot;: Scheme missing</p>
</blockquote>
<p>以前没见过这个错误。开始还以为是Java环境设置的问题，后来发现原来是Windows下和Linux下对字符串处理的不同造成的。</p>
<p>在Windows下，从Java里调用wget的时候，为了防止URL中的特殊字符作怪，我在前后加了一个引号</p>
<blockquote><p>&quot;\http://cowoo.net/tech/?cat=12\&quot;</p>
</blockquote>
<p>正是多加的这两个引号导致了上面那个错误。搜了一下发现，Linux下Java按照空格来解析命令行，所以URL会被当成一个整体。不会出现我所担心的问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=50</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Capistrano发布WordPress主题</title>
		<link>http://cowoo.net/tech/?p=44</link>
		<comments>http://cowoo.net/tech/?p=44#comments</comments>
		<pubDate>Sun, 18 Jul 2010 18:18:04 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Deploy]]></category>
		<category><![CDATA[自动]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=44</guid>
		<description><![CDATA[以前写好的用Capistrano发布Wordpress的配置文件丢了，无奈重新写过。 看了Capistrano的文档，应该蛮简单的，结果还是折腾了半天。最后的配置文件如下(放这里备查，注意事项在注释里）： set :application, &#34;Productivelife.cn Theme&#34; set :repository,&#160; &#34;http://www.svnchina.com/svn/项目路径/&#34; # 文档里是svn+ssh://www.svnchina.com这样的，但是有的服务器可能不支持。 set :scm, :subversion set :scm_username, &#34;你的SVN用户名&#34; #这个要填才行 set :scm_password, &#34;你的SVN&#34; #仿佛这个也必须放在配置文件里 set :checkout, &#34;export&#34; set :deploy_to, &#34;/home/customer/wp_themes&#34; set :user, &#34;customer&#34; set :use_sudo, false role :web, &#34;productivelife.cn&#34;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 发布的时候先Setup： cap deploy:setup 然后再Check和Update： cap deploy:check cap deploy:update 因为不是Rails应用，所以不需要其他的命令。这里update里面包含了update_code和symlink，对我的wordpress主题来说够用了。]]></description>
			<content:encoded><![CDATA[<p>以前写好的用Capistrano发布Wordpress的配置文件丢了，无奈重新写过。</p>
<p>看了Capistrano的文档，应该蛮简单的，结果还是折腾了半天。最后的配置文件如下(放这里备查，注意事项在注释里）：</p>
<blockquote><p>set :application, &quot;Productivelife.cn Theme&quot;     <br />set :repository,&#160; &quot;<a href="http://www.svnchina.com/svn/项目路径/">http://www.svnchina.com/svn/项目路径/</a>&quot; </p>
<p># 文档里是svn+ssh://www.svnchina.com这样的，但是有的服务器可能不支持。</p>
<p>set :scm, :subversion     <br />set :scm_username, &quot;你的SVN用户名&quot; #这个要填才行      <br />set :scm_password, &quot;你的SVN&quot; #仿佛这个也必须放在配置文件里      <br />set :checkout, &quot;export&quot; </p>
<p>set :deploy_to, &quot;/home/customer/wp_themes&quot;     <br />set :user, &quot;customer&quot;      <br />set :use_sudo, false </p>
<p>role :web, &quot;productivelife.cn&quot;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
</blockquote>
<p>发布的时候先Setup：</p>
<blockquote><p>cap deploy:setup</p>
</blockquote>
<p>然后再Check和Update：</p>
<blockquote><p>cap deploy:check</p>
<p>cap deploy:update</p>
</blockquote>
<p>因为不是Rails应用，所以不需要其他的命令。这里update里面包含了update_code和symlink，对我的wordpress主题来说够用了。</p>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=44</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS纵向对齐技巧</title>
		<link>http://cowoo.net/tech/?p=42</link>
		<comments>http://cowoo.net/tech/?p=42#comments</comments>
		<pubDate>Fri, 16 Jul 2010 05:23:33 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[vertical align]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=42</guid>
		<description><![CDATA[今天做一个Calendar的小方块，里面的文字死活顶到最上面，后来找了一篇&#34;Vertical Centering With CSS&#34;，终于解决，就是把line-height设成100%。不过对于多行文字未测试。 &#60;div id=&#34;content&#34;&#62; &#160;&#160;&#160; Content here &#60;/div&#62; &#160; #content {height:100px; line-height:100px;}]]></description>
			<content:encoded><![CDATA[<p>今天做一个Calendar的小方块，里面的文字死活顶到最上面，后来找了一篇&quot;<a href="http://blog.themeforest.net/tutorials/vertical-centering-with-css/" target="_blank">Vertical Centering With CSS</a>&quot;，终于解决，就是把line-height设成100%。不过对于多行文字未测试。</p>
<blockquote><p>&lt;div id=&quot;content&quot;&gt;      <br />&#160;&#160;&#160; Content here       <br />&lt;/div&gt;</p>
<p>&#160;</p>
<p>#content {height:100px; line-height:100px;}</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=42</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Rails环境之外引用Active Support</title>
		<link>http://cowoo.net/tech/?p=41</link>
		<comments>http://cowoo.net/tech/?p=41#comments</comments>
		<pubDate>Fri, 27 Mar 2009 03:07:43 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[Ruby and Rails]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=41</guid>
		<description><![CDATA[比如要算360天之后的日期: require 'rubygems' require 'date' require 'active_support' puts Date.today.advance(:days =&#62; 360).to_s]]></description>
			<content:encoded><![CDATA[<p>比如要算360天之后的日期:</p>
<pre class="csharpcode">require <span class="str">'rubygems'</span>
require <span class="str">'date'</span>
require <span class="str">'active_support'</span>

puts Date.today.advance(:days =&gt; 360).to_s</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=41</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Git，Bluehost以及Capistrano</title>
		<link>http://cowoo.net/tech/?p=35</link>
		<comments>http://cowoo.net/tech/?p=35#comments</comments>
		<pubDate>Wed, 18 Feb 2009 02:05:48 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=35</guid>
		<description><![CDATA[昨天配置好了用GIT以及Capistrano在Bluehost上发布Rails应用的自动发布，感觉还不错，一点点记录如下： 1. Bluehost上的Rails是用的fcgi，不是Mongrel。所以要在.htaccess里面加上fcgi的handler： AddHandler fcgid-script .fcgi 以及 RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] 2. 正如这篇文章里所说，如果在Windows下开发，别忘了改首行： dispatch.fcgi和dispatch.rb（在publice目录下）的首行。 因为BlueHost下是虚拟的unix系统，所以要改成#!/usr/bin/ruby （如果在windows下开发的程序，用户常会忘了把首行改成unix下ruby的路径） 3. 如何在Bluehost上安装GIT？答案在这里。 &#160;&#160;&#160; 注意的是因为Bluehost的防火墙的原因，GitHub的URL无法访问，比如 git://github.com/bsag/tracks.git &#160;&#160;&#160; 就是无法访问的，不过可以把git改成http就ok了。 http://github.com/bsag/tracks.git 4. Capistrano基本上按照官网的文档一步一步走就OK了。要注意的是： &#160;&#160;&#160; 如果你在windows下开发而git又没有放到path里面的话，走到 cap deploy:update 这一部可能出现错误。在GIT Bash里面进行就不会出错了。另外，在deploy.rb里面要多写如下一些： set :branch, &#34;master&#34; #因为GITHub的原因 namespace :deploy do desc &#34;This is here to overide the original :restart&#34; task :restart, :roles =&#62; :app do # [...]]]></description>
			<content:encoded><![CDATA[<p>昨天配置好了用GIT以及<a href="http://www.capify.org/" target="_blank">Capistrano</a>在Bluehost上发布Rails应用的自动发布，感觉还不错，一点点记录如下：</p>
<p>1. Bluehost上的Rails是用的fcgi，不是Mongrel。所以要在.htaccess里面加上fcgi的handler：</p>
<blockquote><p>AddHandler fcgid-script .fcgi</p>
</blockquote>
<p>以及</p>
<blockquote><p>RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]</p>
</blockquote>
<p>2. 正如<a href="http://www.cnblogs.com/sinkzephyr/archive/2008/08/27/1277756.html" target="_blank">这篇文章</a>里所说，如果在Windows下开发，别忘了改首行：</p>
<blockquote><p>dispatch.fcgi和dispatch.rb（在publice目录下）的首行。</p>
<p>因为BlueHost下是虚拟的unix系统，所以要改成#!/usr/bin/ruby</p>
<p>（如果在windows下开发的程序，用户常会忘了把首行改成unix下ruby的路径）</p>
</blockquote>
<p>3. 如何在Bluehost上安装GIT？答案在<a href="http://bluehosthacks.com/howto/how-to-install-git" target="_blank">这里</a>。</p>
<p>&#160;&#160;&#160; 注意的是因为Bluehost的防火墙的原因，GitHub的URL无法访问，比如</p>
<blockquote><p><a href="git://github.com/bsag/tracks.git">git://github.com/bsag/tracks.git</a></p>
</blockquote>
<p>&#160;&#160;&#160; 就是无法访问的，不过可以把git改成http就ok了。</p>
<blockquote><p><a href="http://github.com/bsag/tracks.git">http://github.com/bsag/tracks.git</a></p>
</blockquote>
<p>4. Capistrano基本上按照官网的文档一步一步走就OK了。要注意的是：</p>
<p>&#160;&#160;&#160; 如果你在windows下开发而git又没有放到path里面的话，走到 cap deploy:update 这一部可能出现错误。在GIT Bash里面进行就不会出错了。另外，在deploy.rb里面要多写如下一些：</p>
<blockquote><pre class="csharpcode">set :branch, <span class="str">&quot;master&quot;</span>  #因为GITHub的原因

<span class="kwrd">namespace</span> :deploy <span class="kwrd">do</span>
  desc <span class="str">&quot;This is here to overide the original :restart&quot;</span>
  task :restart, :roles =&gt; :app <span class="kwrd">do</span>
    # <span class="kwrd">do</span> nothing but overide the <span class="kwrd">default</span>
    # Bluehost的fcgi模式不需要重启Mongrel
  end

  # 不想把database.yml放到scm中去</pre>
<pre class="csharpcode">  # 从Advanced Rails Recipes里面找到的。
  task :copy_database_configuration <span class="kwrd">do</span>
    production_db_config = <span class="str">&quot;~/rails/production.database.yml&quot;</span>
    run <span class="str">&quot;cp #{production_db_config} #{release_path}/config/database.yml&quot;</span>
  end
  after <span class="str">&quot;deploy:update_code&quot;</span> , <span class="str">&quot;deploy:copy_database_configuration&quot;</span>

  # 修改public和tmp两个目录的权限</pre>
<pre class="csharpcode">  #（好像Capistrano把log目录做了符号链接，所以没加log）
  task :change_dir_permissions <span class="kwrd">do</span>
    run <span class="str">&quot;chmod -R 755 #{release_path}/public&quot;</span>
    run <span class="str">&quot;chmod -R 755 #{release_path}/tmp&quot;</span>
  end
  after <span class="str">&quot;deploy:symlink&quot;</span>, <span class="str">&quot;deploy:change_dir_permissions&quot;</span>
end</pre>
</blockquote>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=35</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux统计目录下文件个数命令</title>
		<link>http://cowoo.net/tech/?p=34</link>
		<comments>http://cowoo.net/tech/?p=34#comments</comments>
		<pubDate>Fri, 13 Feb 2009 05:54:34 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=34</guid>
		<description><![CDATA[从快享转载： 查看某文件夹下文件的个数 ls -l &#124;grep &#34;^-&#34;&#124;wc -l 或 find ./company -type f &#124; wc -l 查看某文件夹下文件的个数，包括子文件夹里的。 ls -lR&#124;grep &#34;^-&#34;&#124;wc -l 查看某文件夹下文件夹的个数，包括子文件夹里的。 ls -lR&#124;grep &#34;^d&#34;&#124;wc -l 说明： ls -l 长列表输出该目录下文件信息(注意这里的文件，不同于一般的文件，可能是目录、链接、设备文件等) grep &#34;^-&#34; 这里将长列表输出信息过滤一部分，只保留一般文件，如果只保留目录就是 ^d wc -l 统计输出信息的行数，因为已经过滤得只剩一般文件了，所以统计结果就是一般文件信息的行数，又由于 一行信息对应一个文件，所以也就是文件的个数。]]></description>
			<content:encoded><![CDATA[<p>从<a href="http://www.quickshare.com.cn/statistics-document-the-number-of-linux " target="_blank">快享</a>转载：</p>
<blockquote><p>查看某文件夹下文件的个数      <br />ls -l |grep &quot;^-&quot;|wc -l       <br />或       <br />find ./company -type f | wc -l</p>
<p>查看某文件夹下文件的个数，包括子文件夹里的。       <br />ls -lR|grep &quot;^-&quot;|wc -l       <br />查看某文件夹下文件夹的个数，包括子文件夹里的。       <br />ls -lR|grep &quot;^d&quot;|wc -l</p>
<p>说明：       <br />ls -l       <br />长列表输出该目录下文件信息(注意这里的文件，不同于一般的文件，可能是目录、链接、设备文件等)       <br />grep &quot;^-&quot;       <br />这里将长列表输出信息过滤一部分，只保留一般文件，如果只保留目录就是 ^d       <br />wc -l       <br />统计输出信息的行数，因为已经过滤得只剩一般文件了，所以统计结果就是一般文件信息的行数，又由于       <br />一行信息对应一个文件，所以也就是文件的个数。</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=34</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git与GitHub</title>
		<link>http://cowoo.net/tech/?p=33</link>
		<comments>http://cowoo.net/tech/?p=33#comments</comments>
		<pubDate>Sun, 28 Dec 2008 01:48:06 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=33</guid>
		<description><![CDATA[最近发现一个开源的GTD Web应用，名字叫Tracks，用Ruby on Rails开发的。很感兴趣，于是想掺和一下。发现从1.7开始，这个项目的版本控制工具从SVN转到了Git，心想有点意思。于是查了一下相关的资料，算是有点了解了。 自从Rails从SVN转向了Git之后，Git仿佛成了Rails社区的一个风尚。Git是所谓的分布式版本控制系统，每一个人的本地都维护了一个完整的repository，以及分支。这样就可以在本地自由地建立分支，提交，而不用担心影响到其他人的工作。等本地的工作完成的差不多了，再提交到统一的主干中。更多原理见Why Git is Better than X 不过这东西嘛，见仁见智咯。如果集中开发，模块划分的好，CVS一样用起来没什么问题。 另外值得一提的就是GitHub了。InfoQ上有一篇文章介绍GitHub。使用流程基本是这样： 1. 看到一个好项目，fork出来。比如我看到bsag / tracks，就fork一份出来，相当于在我名下建立一个副本，即cowoo/tracks。 2. 安装了Git 的Windows版本之后，就可以把项目Clone到本地。 git clone git@github.com:cowoo/tracks.git 3. 进行一些修改，可以在本地Stage，Commit，建立分支等。 4. 提交到我在Github上的Clone。 git push master origin 5. 如果我觉得某个feature开发的不错，可以要求bsag把我的这个feature合并到主分支里面去。点那个&#8221;pull request&#8221;就可以了。不过俺还没有尝试过。 初次使用笔记。]]></description>
			<content:encoded><![CDATA[<p>最近发现一个开源的GTD Web应用，名字叫Tracks，用Ruby on Rails开发的。很感兴趣，于是想掺和一下。发现从1.7开始，这个项目的版本控制工具从SVN转到了<a href="http://git.or.cz/" target="_blank">Git</a>，心想有点意思。于是查了一下相关的资料，算是有点了解了。</p>
<p>自从<a href="http://weblog.rubyonrails.org/2008/4/2/rails-is-moving-from-svn-to-git" target="_blank">Rails从SVN转向了Git</a>之后，Git仿佛成了Rails社区的一个风尚。Git是所谓的分布式版本控制系统，每一个人的本地都维护了一个完整的repository，以及分支。这样就可以在本地自由地建立分支，提交，而不用担心影响到其他人的工作。等本地的工作完成的差不多了，再提交到统一的主干中。更多原理见<a href="http://zh-cn.whygitisbetterthanx.com/" target="_blank">Why Git is Better than X</a> <img src='http://cowoo.net/tech/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  不过这东西嘛，见仁见智咯。如果集中开发，模块划分的好，CVS一样用起来没什么问题。</p>
<p>另外值得一提的就是<a href="https://github.com/" target="_blank">GitHub</a>了。InfoQ上有一篇文章<a href="http://www.infoq.com/cn/news/2008/03/github-git-repository-hosting" target="_blank">介绍GitHub</a>。使用流程基本是这样：</p>
<p>1. 看到一个好项目，fork出来。比如我看到<a href="https://github.com/bsag">bsag</a> / <a href="https://github.com/bsag/tracks/tree"><strong>tracks</strong></a>，就fork一份出来，相当于在我名下建立一个副本，即<a href="http://github.com/cowoo/tracks/tree/master" target="_blank">cowoo/tracks</a>。</p>
<p>2. 安装了Git 的Windows版本之后，就可以把项目Clone到本地。</p>
<blockquote><p>git clone <a href="mailto:git@github.com:cowoo/tracks.git">git@github.com:cowoo/tracks.git</a></p>
</blockquote>
<p>3. 进行一些修改，可以在本地Stage，Commit，建立分支等。</p>
<p>4. 提交到我在Github上的Clone。</p>
<blockquote><p>git push master origin</p>
</blockquote>
<p>5. 如果我觉得某个feature开发的不错，可以要求bsag把我的这个feature合并到主分支里面去。点那个&#8221;pull request&#8221;就可以了。不过俺还没有尝试过。</p>
<p>初次使用笔记。</p>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=33</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>阅读笔记 12/24/2008</title>
		<link>http://cowoo.net/tech/?p=30</link>
		<comments>http://cowoo.net/tech/?p=30#comments</comments>
		<pubDate>Wed, 24 Dec 2008 01:50:23 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=30</guid>
		<description><![CDATA[订了不少Blog的RSS，但是怎么消费是一个问题。在Google Reader里加一个星标？感觉还是不够，那样只是有一个模糊的印象。那就写下来吧，边写边思考，也是不错的形式。 昨天ReadWriteWeb上有一个关于Ping.fm的报道，没仔细看。今天看到台湾的Mr6也在Blog上写了，发现不错。越来越多的SN确实是个让人头疼的问题，Ping.fm也算解决了问题，自然有人愿意使用。这也是中文社区的一个机会。 Zapproved这个网站帮助人们把结构化的问卷送到人们的信箱，算是Email的一个创新。最近各家在Email上的动作不小。Gmail不停的往Labs里面加东西，Yahoo准备开放Email插件。再加上一年之前看到的Xobni。大家以为没什么可做的Email领域其实还有很多可以挖掘的地方啊。比如腾讯最近的明信片服务就很可爱。 最近还看到一堆主机或者自称云计算的服务提供商，准备整理整理放到Cloud那个页面中去。]]></description>
			<content:encoded><![CDATA[<p>订了不少Blog的RSS，但是怎么消费是一个问题。在Google Reader里加一个星标？感觉还是不够，那样只是有一个模糊的印象。那就写下来吧，边写边思考，也是不错的形式。</p>
<p>昨天ReadWriteWeb上有一个<a href="http://www.readwriteweb.com/archives/pingfm_gets_backing.php" target="_blank">关于Ping.fm的报道</a>，没仔细看。今天看到台湾的Mr6也在Blog上<a href="http://mr6.cc/?p=2642" target="_blank">写了</a>，发现不错。越来越多的SN确实是个让人头疼的问题，Ping.fm也算解决了问题，自然有人愿意使用。这也是中文社区的一个机会。</p>
<p><a href="http://mr6.cc/?p=2635" target="_blank">Zapproved这个网站</a>帮助人们把结构化的问卷送到人们的信箱，算是Email的一个创新。最近各家在Email上的动作不小。Gmail不停的往Labs里面<a href="http://gmailblog.blogspot.com/" target="_blank">加东西</a>，Yahoo准备开放Email插件。再加上一年之前看到的<a href="http://www.xobni.com/" target="_blank">Xobni</a>。大家以为没什么可做的Email领域其实还有很多可以挖掘的地方啊。比如腾讯最近的明信片服务就很可爱。</p>
<p>最近还看到一堆主机或者自称云计算的服务提供商，准备整理整理放到Cloud那个页面中去。</p>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=30</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bluehost上部署Rails应用</title>
		<link>http://cowoo.net/tech/?p=26</link>
		<comments>http://cowoo.net/tech/?p=26#comments</comments>
		<pubDate>Tue, 23 Dec 2008 02:43:33 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=26</guid>
		<description><![CDATA[本来以前就部署过，不过每次相隔时间都比较长，于是每次都Google一遍，实在太浪费时间，还是自己记下来比较好。 主要参考的是Radiant这个用rails写的内容管理系统的wiki文章，讲如何在Bluehost上部署Radiant。我觉得关键有这么几点： 1. 修改.htaccess文件 把Handler那几行改成： # General Apache options AddHandler fcgid-script .fcgi # AddHandler cgi-script .cgi # Options +FollowSymLinks +ExecFCGI 2.修改dispatch.fcgi 加上这么几句： ENV['RAILS_ENV'] = 'production' ENV[&#34;GEM_HOME&#34;]= &#34;/home/[USER_NAME]/ruby/gems&#34; ENV[&#34;GEM_PATH&#34;]= &#34;/home/[USER_NAME]/ruby/gems:/usr/lib/ruby/gems/1.8&#34; 不过我觉得后面两句应该用处不大，是跟他前面的相呼应的，如果你用到一些自己安装的gems，就应该follow这篇文章。 3. 修改文件夹权限 我是把public，tmp和log三个文件夹的权限都变成了755。cd到rails应用根目录下，比如说rails/yourapp： chmod -R 755 public chmod -R 755 tmp chmod -R 755 log 4. 建立符号链接 把rails/yourapp/public链接到public_html里面的一个子目录： ln -s ~/radiant_app_folder_name/public ~/public_html/website_name 但是我这么弄了之后还是不行，后来找到Rails Google Group里面的讨论也有点用。正好我是要把应用作为账户的根目录使用，于是 [...]]]></description>
			<content:encoded><![CDATA[<p>本来以前就部署过，不过每次相隔时间都比较长，于是每次都Google一遍，实在太浪费时间，还是自己记下来比较好。</p>
<p>主要参考的是Radiant这个用rails写的内容管理系统的wiki文章，讲<a href="http://wiki.radiantcms.org/How_To_Deploy_on_Bluehost" target="_blank">如何在Bluehost上部署Radiant</a>。我觉得关键有这么几点：</p>
<p>1. 修改.htaccess文件</p>
<p>把Handler那几行改成：</p>
<blockquote><pre><code># General Apache options
AddHandler fcgid-script .fcgi
# AddHandler cgi-script .cgi
# Options +FollowSymLinks +ExecFCGI</code></pre>
</blockquote>
<p>2.修改dispatch.fcgi</p>
<p>加上这么几句：</p>
<blockquote>
<pre><code>ENV['RAILS_ENV'] = 'production'
ENV[&quot;GEM_HOME&quot;]= &quot;/home/[USER_NAME]/ruby/gems&quot;
ENV[&quot;GEM_PATH&quot;]= &quot;/home/[USER_NAME]/ruby/gems:/usr/lib/ruby/gems/1.8&quot; </code></pre>
</blockquote>
<p>不过我觉得后面两句应该用处不大，是跟他前面的相呼应的，如果你用到一些自己安装的gems，就应该follow这篇文章。</p>
<p>3. 修改文件夹权限</p>
<p>我是把public，tmp和log三个文件夹的权限都变成了755。cd到rails应用根目录下，比如说rails/yourapp：</p>
<blockquote>
<p>chmod -R 755 public<br />
    <br />chmod -R 755 tmp</p>
<p>chmod -R 755 log</p>
</blockquote>
<p>4. 建立符号链接</p>
<p>把rails/yourapp/public链接到public_html里面的一个子目录：</p>
<pre><code></code></pre>
<blockquote>
<pre><code>ln -s ~/radiant_app_folder_name/public ~/public_html/website_name</code></pre>
</blockquote>
<p>但是我这么弄了之后还是不行，后来找到Rails Google Group里面的<a href="http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/2023baa8da701d36" target="_blank">讨论</a>也有点用。正好我是要把应用作为账户的根目录使用，于是</p>
<blockquote>
<p>$ mv ~/public_html ~/original_public_html<br />
    <br />$ ln -s ~/rails-apps/myapp/public ~/public_html</p>
</blockquote>
<p>然后就可以访问了：<a href="http://www.flexgtd.com">http://www.flexgtd.com</a></p>
<p>值得说明一下的是，bluehost上cpanel里面那个ruby on rails的安装向导一点也不好用，不要用那个来部署。我被搞得晕头转向也没搞明白怎么弄，而且觉得它的灵活性太差。</p>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=26</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python 日期时间处理笔记</title>
		<link>http://cowoo.net/tech/?p=25</link>
		<comments>http://cowoo.net/tech/?p=25#comments</comments>
		<pubDate>Sat, 20 Dec 2008 06:44:15 +0000</pubDate>
		<dc:creator>cowoo</dc:creator>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://cowoo.net/tech/?p=25</guid>
		<description><![CDATA[昨天写到日期和时间的处理，需要输入日期和时间，存储到GAE的DataStore中。 GAE有三个与日期时间有关的Property： DateTimePropertyDatePropertyTimeProperty 这三个Property，其实最终都是以datetime.datetime存储，但是使用的时候又有一点不同。 Python中有很棒的解析字符串到时间对象的方法：time.strptime(string[, format])，这个方法会把字符串按照你想要的格式解析进来，放到一个时间对象中。返回值是一个struct_time。解析了之后还要存到GAE的DataStore对象中去，暂时找到了下面的方法： tDate = time.strptime(self.request.get(&#8216;getup_date&#8217;),&#8217;%m/%d/%Y&#8217;)record.recordDate = datetime.date(tDate.tm_year, tDate.tm_mon, tDate.tm_mday)tGetup = time.strptime(self.request.get(&#8216;getup_at&#8217;), &#8216;%H:%M&#8217;)record.getupAt = datetime.time(tGetup.tm_hour,tGetup.tm_min)tSleep = time.strptime(self.request.get(&#8216;sleep_at&#8217;), &#8216;%H:%M&#8217;)record.sleepAt = datetime.time(tSleep.tm_hour,tSleep.tm_min) 这样就能把12/20/2008这样的日期，以及07:30这样的时间存成想要的对象了。注意如果直接把解析的结果赋给TimeProperty和DateProperty的话会出错。 另外，time.strftime(formart[, t])能够很好的将时间日期对象换成你想要的格式。]]></description>
			<content:encoded><![CDATA[<p>昨天写到日期和时间的处理，需要输入日期和时间，存储到GAE的DataStore中。</p>
<p>GAE有三个与日期时间有关的Property：</p>
<blockquote><p><a href="http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#DateTimeProperty">DateTimeProperty</a><br /><a href="http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#DateProperty">DateProperty</a><br /><a href="http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#TimeProperty">TimeProperty</a></p>
</blockquote>
<p>这三个Property，其实最终都是以datetime.datetime存储，但是使用的时候又有一点不同。</p>
<p>Python中有很棒的解析字符串到时间对象的方法：<a href="http://docs.python.org/library/time.html#time.strptime" target="_blank">time.strptime</a>(<em>string</em>[, <em>format</em>]<big></big>)，这个方法会把字符串按照你想要的格式解析进来，放到一个时间对象中。返回值是一个struct_time。解析了之后还要存到GAE的DataStore对象中去，暂时找到了下面的方法：</p>
<blockquote><p>tDate = time.strptime(self.request.get(&#8216;getup_date&#8217;),&#8217;%m/%d/%Y&#8217;)<br />record.recordDate = datetime.date(tDate.tm_year, tDate.tm_mon, tDate.tm_mday)<br />tGetup = time.strptime(self.request.get(&#8216;getup_at&#8217;), &#8216;%H:%M&#8217;)<br />record.getupAt = datetime.time(tGetup.tm_hour,tGetup.tm_min)<br />tSleep = time.strptime(self.request.get(&#8216;sleep_at&#8217;), &#8216;%H:%M&#8217;)<br />record.sleepAt = datetime.time(tSleep.tm_hour,tSleep.tm_min)</p>
</blockquote>
<p>这样就能把12/20/2008这样的日期，以及07:30这样的时间存成想要的对象了。注意如果直接把解析的结果赋给TimeProperty和DateProperty的话会出错。
<p>另外，<a href="http://docs.python.org/library/time.html#time.strftime" target="_blank">time.strftime</a>(<em>formart</em>[,<em> t</em>])能够很好的将时间日期对象换成你想要的格式。  </p>
]]></content:encoded>
			<wfw:commentRss>http://cowoo.net/tech/?feed=rss2&#038;p=25</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

