<?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>其实我是一个程序员 &#187; Ruby</title>
	<atom:link href="http://liubin.nanshapo.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://liubin.nanshapo.com</link>
	<description>编程是一种乐趣</description>
	<lastBuildDate>Thu, 08 Dec 2011 12:31:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>undefined method `^&#8217; for &#8220;6&#8243;:String</title>
		<link>http://liubin.nanshapo.com/2009/11/24/undefined-method-for-6string/</link>
		<comments>http://liubin.nanshapo.com/2009/11/24/undefined-method-for-6string/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 11:04:13 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=217</guid>
		<description><![CDATA[Rails 2.3.4 Ruby 1.9.1 脚手架刚生成都出错。 原来是个BUG： https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234]]></description>
			<content:encoded><![CDATA[<p>Rails 2.3.4<br />
Ruby 1.9.1<br />
脚手架刚生成都出错。<br />
原来是个BUG：<br />
<a href="https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234">https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2009/11/24/undefined-method-for-6string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ROMA开源</title>
		<link>http://liubin.nanshapo.com/2009/10/24/roma%e5%bc%80%e6%ba%90/</link>
		<comments>http://liubin.nanshapo.com/2009/10/24/roma%e5%bc%80%e6%ba%90/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 12:52:04 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[roma]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=215</guid>
		<description><![CDATA[ROMA是日本乐天（和yahoo并列的网络店铺）公司用Ruby开发的分散型KeyValue存储结构结构。 目前乐天公司的产品“乐天市场”，“乐天旅游”中用来存储用户浏览信息。 ROMA的源代码主页可见http://github.com/roma/roma/ RUBY作者松本幸弘是乐天公司的特别研究员。]]></description>
			<content:encoded><![CDATA[<p>ROMA是日本乐天（和yahoo并列的网络店铺）公司用Ruby开发的分散型KeyValue存储结构结构。<br />
目前乐天公司的产品“乐天市场”，“乐天旅游”中用来存储用户浏览信息。<br />
ROMA的源代码主页可见<a href="http://github.com/roma/roma/">http://github.com/roma/roma/</a><br />
RUBY作者松本幸弘是乐天公司的特别研究员。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2009/10/24/roma%e5%bc%80%e6%ba%90/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>明天开始</title>
		<link>http://liubin.nanshapo.com/2008/05/31/%e6%98%8e%e5%a4%a9%e5%bc%80%e5%a7%8b/</link>
		<comments>http://liubin.nanshapo.com/2008/05/31/%e6%98%8e%e5%a4%a9%e5%bc%80%e5%a7%8b/#comments</comments>
		<pubDate>Fri, 30 May 2008 17:10:38 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>
<category>php</category><category>smarty</category>
		<guid isPermaLink="false">http://liubin.nanshapo.com/2008/05/31/%e6%98%8e%e5%a4%a9%e5%bc%80%e5%a7%8b/</guid>
		<description><![CDATA[这几天主要考察了一下，主要想的都差不多了。明天开始就可以编码了，应该。 今天装了PEAR：：Log 自己也想了2种多语言支持的方法，一个是用smarty的注册方法，一个是修饰子 注册方法的使用为： {getMessage id=&#8221;some message&#8221;  name=&#8221;asdf &#8220;   mail= &#8220;hotmail&#8221;} 而语言定义文件为 &#8220;some message&#8221;=&#62; &#8220;hello {name}, mail to {hotmail}&#8221; 取出的字符串当然会被asdf等实际传递的字符串替换。]]></description>
			<content:encoded><![CDATA[<p>这几天主要考察了一下，主要想的都差不多了。明天开始就可以编码了，应该。</p>
<p>今天装了PEAR：：Log</p>
<p>自己也想了2种多语言支持的方法，一个是用smarty的注册方法，一个是修饰子</p>
<p>注册方法的使用为：</p>
<p>{getMessage id=&#8221;some message&#8221;  name=&#8221;asdf &#8220;   mail= &#8220;hotmail&#8221;}</p>
<p>而语言定义文件为</p>
<p>&#8220;some message&#8221;=&gt; &#8220;hello {name}, mail to {hotmail}&#8221;</p>
<p>取出的字符串当然会被asdf等实际传递的字符串替换。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2008/05/31/%e6%98%8e%e5%a4%a9%e5%bc%80%e5%a7%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>曼联夺冠</title>
		<link>http://liubin.nanshapo.com/2008/05/11/%e6%9b%bc%e8%81%94%e5%a4%ba%e5%86%a0/</link>
		<comments>http://liubin.nanshapo.com/2008/05/11/%e6%9b%bc%e8%81%94%e5%a4%ba%e5%86%a0/#comments</comments>
		<pubDate>Sun, 11 May 2008 15:50:38 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>
<category>足球</category><category>曼联</category>
		<guid isPermaLink="false">http://liubin.nanshapo.com/2008/05/11/%e6%9b%bc%e8%81%94%e5%a4%ba%e5%86%a0/</guid>
		<description><![CDATA[一边看一遍玩，竟然发现是英超最后一轮了。 曼联夺冠了。 昨天去踢球了，现在还是浑身疼痛，自行车都不能骑了。]]></description>
			<content:encoded><![CDATA[<p>一边看一遍玩，竟然发现是英超最后一轮了。<br />
曼联夺冠了。<br />
昨天去踢球了，现在还是浑身疼痛，自行车都不能骑了。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2008/05/11/%e6%9b%bc%e8%81%94%e5%a4%ba%e5%86%a0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LuRuJu 将jude的模型当成Rails的model类使用</title>
		<link>http://liubin.nanshapo.com/2008/03/27/luruju_intro/</link>
		<comments>http://liubin.nanshapo.com/2008/03/27/luruju_intro/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 03:15:52 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
<category>luruju</category><category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://liubin.nanshapo.com/2008/03/27/luruju_intro/</guid>
		<description><![CDATA[LuRuJu是Lube between Ruby and JUDE的缩写，它的目的就是无缝链接ror程序和jude的模型 特点包括： 1.配置简单，只需要把jude文件放到RAILS_ROOT/app/model下即可。Jude模型会作为mvc的m来被使用。目前实现了类之间的1对1，1对n关联。也支持类之间的继承关系。 2.不需要再维护migrate文件，只需运行 lor:db:create就可以了。表的定义使用jude文件中的定义。 3.可以往model里追加Ruby代码来扩种业务逻辑等 4.和config.cache_classes联动，不需要重启rails就可以修改jude文件并使之有效。 5.即可以用jruby，也可以用cruby 这个软件的作者是野村周平，文档 多是日文，不过看代码应该能看的差不多。 主页是 http://luruju.com/]]></description>
			<content:encoded><![CDATA[<p><a href="http://luruju.com/">LuRuJu</a>是Lube between Ruby and JUDE的缩写，它的目的就是无缝链接ror程序和jude的模型<br />
特点包括：<br />
1.配置简单，只需要把jude文件放到RAILS_ROOT/app/model下即可。Jude模型会作为mvc的m来被使用。目前实现了类之间的1对1，1对n关联。也支持类之间的继承关系。<br />
2.不需要再维护migrate文件，只需运行<br />
lor:db:create就可以了。表的定义使用jude文件中的定义。<br />
3.可以往model里追加Ruby代码来扩种业务逻辑等<br />
4.和config.cache_classes联动，不需要重启rails就可以修改jude文件并使之有效。<br />
5.即可以用jruby，也可以用cruby</p>
<p>这个软件的作者是野村周平，文档 多是日文，不过看代码应该能看的差不多。<br />
主页是 <a href="http://luruju.com/">http://luruju.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2008/03/27/luruju_intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用Ruby抓取网页通过ActiveRecord存到数据库</title>
		<link>http://liubin.nanshapo.com/2008/03/07/mini_ruby_spider/</link>
		<comments>http://liubin.nanshapo.com/2008/03/07/mini_ruby_spider/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 01:45:44 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>
<category>activerecord</category><category>ar</category><category>hpricot</category><category>rails</category><category>ruby</category>
		<guid isPermaLink="false">http://liubin.nanshapo.com/2008/03/07/mini_ruby_spider/</guid>
		<description><![CDATA[用Ruby抓取网页通过ActiveRecord存到数据库 工作内容：抓取指定网页的规则的连接地址的内容，并取得其网页中指定部分的内容存到数据库。 技术点1：抓取并分析网页 采用hpricot，其主页可见（http://code.whytheluckystiff.net/hpricot/）。Hpricot is a very flexible HTML parser。 doc = Hpricot(open(url)) 这个就是去的url的内容，返回一个doc，这个是Element类的实例对象。也可以认为是一个DOM。 可以对这个对象进行查找，修改等操作，具体见hpricot主页的文档。 技术点2：编码转换 网页可能为gbk编码，也可能为gb2312编码。 数据库为mysql，UTF-8编码，以防万一，在建立数据库连接之后，执行下列语句： ActiveRecord::Base.connection.execute &#8216;SET NAMES UTF8&#8242; 把mysql客户端的编码也设为UTF8，以防出现乱码。 然后用Iconv转换抓取的数据： ar_object.some_text = Iconv.new(&#8220;UTF-8//IGNORE&#8221;,&#8221;gb2312&#8243;).iconv(gb2312_data ) 这个就是把gb2312的数据转换为utf-8了。 另外，不知道不进行上面转换，而直接实用gb2312编码的数据，在建立数据库客户端连接之后，执行 ActiveRecord::Base.connection.execute &#8216;SET NAMES GB2312&#8242; 是不是也可以呢，没试过。]]></description>
			<content:encoded><![CDATA[<p>用Ruby抓取网页通过ActiveRecord存到数据库</p>
<p>工作内容：抓取指定网页的规则的连接地址的内容，并取得其网页中指定部分的内容存到数据库。</p>
<p>技术点1：抓取并分析网页<br />
 采用hpricot，其主页可见（<a href="http://code.whytheluckystiff.net/hpricot/">http://code.whytheluckystiff.net/hpricot/</a>）。Hpricot is a very flexible HTML parser。<br />
doc = Hpricot(open(url))<br />
这个就是去的url的内容，返回一个doc，这个是Element类的实例对象。也可以认为是一个DOM。<br />
可以对这个对象进行查找，修改等操作，具体见hpricot主页的文档。<br />
技术点2：编码转换<br />
 网页可能为gbk编码，也可能为gb2312编码。<br />
 数据库为mysql，UTF-8编码，以防万一，在建立数据库连接之后，执行下列语句：<br />
ActiveRecord::Base.connection.execute &#8216;SET NAMES UTF8&#8242;<br />
 把mysql客户端的编码也设为UTF8，以防出现乱码。<br />
 然后用Iconv转换抓取的数据：</p>
<p>ar_object.some_text = Iconv.new(&#8220;UTF-8//IGNORE&#8221;,&#8221;gb2312&#8243;).iconv(gb2312_data )<br />
这个就是把gb2312的数据转换为utf-8了。<br />
另外，不知道不进行上面转换，而直接实用gb2312编码的数据，在建立数据库客户端连接之后，执行<br />
ActiveRecord::Base.connection.execute &#8216;SET NAMES GB2312&#8242;<br />
是不是也可以呢，没试过。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2008/03/07/mini_ruby_spider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyKaigi2008要到茨城去</title>
		<link>http://liubin.nanshapo.com/2008/02/28/rubykaigi2008%e8%a6%81%e5%88%b0%e8%8c%a8%e5%9f%8e%e5%8e%bb/</link>
		<comments>http://liubin.nanshapo.com/2008/02/28/rubykaigi2008%e8%a6%81%e5%88%b0%e8%8c%a8%e5%9f%8e%e5%8e%bb/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 08:56:28 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/2008/02/28/rubykaigi2008%e8%a6%81%e5%88%b0%e8%8c%a8%e5%9f%8e%e5%8e%bb/</guid>
		<description><![CDATA[从秋叶原过去单程要1000多块的车费。 贵，没钱！]]></description>
			<content:encoded><![CDATA[<p>从秋叶原过去单程要1000多块的车费。<br />
贵，没钱！</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2008/02/28/rubykaigi2008%e8%a6%81%e5%88%b0%e8%8c%a8%e5%9f%8e%e5%8e%bb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyConf 2007 agenda</title>
		<link>http://liubin.nanshapo.com/2007/09/07/rubyconf-2007-agenda/</link>
		<comments>http://liubin.nanshapo.com/2007/09/07/rubyconf-2007-agenda/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 00:24:14 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>
<category>ruby</category>
		<guid isPermaLink="false">http://liubin.nanshapo.com/2007/09/07/rubyconf-2007-agenda/</guid>
		<description><![CDATA[RubyConf 2007 November 2-4, 2007 Charlotte, North Carolina http://www.rubyconf.org/agenda.html]]></description>
			<content:encoded><![CDATA[<p>RubyConf 2007<br />
November 2-4, 2007<br />
Charlotte, North Carolina<br />
<a href="http://www.rubyconf.org/agenda.html" target="_blank">http://www.rubyconf.org/agenda.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2007/09/07/rubyconf-2007-agenda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby也要搞认证考试了</title>
		<link>http://liubin.nanshapo.com/2007/08/30/ruby_certification_test/</link>
		<comments>http://liubin.nanshapo.com/2007/08/30/ruby_certification_test/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 11:50:41 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>
<category>ruby</category>
		<guid isPermaLink="false">http://liubin.nanshapo.com/2007/08/30/ruby_certification_test/</guid>
		<description><![CDATA[今年10月在东京和Matz在住的松江，明年2月开始开始网络版的考试，有英语和日语。 Matz和他们公司的另两个人组成了一个Ruby Association LLC （http://www.ruby-assn.org/index.html.en），当然，并没有辞职，这个公司是个LLC，主要为了帮助Ruby发展而建立的。这个认证也是由Ruby Association主办的。]]></description>
			<content:encoded><![CDATA[<p>今年10月在东京和Matz在住的松江，明年2月开始开始网络版的考试，有英语和日语。<br />
Matz和他们公司的另两个人组成了一个Ruby Association LLC （<a href="http://www.ruby-assn.org/index.html.en">http://www.ruby-assn.org/index.html.en</a>），当然，并没有辞职，这个公司是个LLC，主要为了帮助Ruby发展而建立的。这个认证也是由Ruby Association主办的。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2007/08/30/ruby_certification_test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>与病毒斗，真累</title>
		<link>http://liubin.nanshapo.com/2007/08/25/anti_virus/</link>
		<comments>http://liubin.nanshapo.com/2007/08/25/anti_virus/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 13:15:56 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Ruby]]></category>
<category>病毒</category>
		<guid isPermaLink="false">http://liubin.nanshapo.com/2007/08/25/anti_virus/</guid>
		<description><![CDATA[昨天双击d盘，没反应，右键一看第一个是auto，好像又中了那个病毒了。而且是不到1年之内的第三次了。以前还算顺利，杀这个病毒。这次就惨了。 查看进程，启动选项，很正常，删掉autorun.inf和那个pagefile两个文件，当时是没事，这时候，如果再从桌面或者开始菜单启动任何程序，这两个文件都会被重建。 重启，报explorer.exe错误，金山的个人防火墙也没了（没启动），查看explorer这个文件，好像没什么问题。启动防火墙，突然报explorer要访问网络，我靠你一资源浏览器干什么新潮访问个鸟啊，一旦允许，立刻金山报了无数病毒，多是窃取密码的木马。Win32.Troj.Lyloader.a.14848 Win32.Troj.PswrobT.gl.90112 Win32.PSWTroj.WOW.sa.153088 等。 地点都是 \Local Settings\Temp 名字是1.exe,2.exe,3.exe之类的。 鸟人，查看一下网络状况，一个连到了74.222.148.2 一个222.73.15.76。一个美国，一个上海（SB那个上海人和gaj）。端口都是80，肯定有问题。 用IceSword看了一下Explorer加载的模块，发现了两个dll比较差劲 一个在ie的plugins，叫做newtemp.dll，而且是隐藏文件，一个是cnsmin.dll。 在文件系统里查找，最近几天的dll，果然就这几个文件，还有一个kulionzx.dll，好像也是病毒。从注册表里找到这些，都删掉，重启之后目前一切正常。 至此虽然告一段落，但是为什么会中毒，毒源还没找到，每天上的网站也都是固定的几个，也不怎么乱下软件。其中一个原因是可以肯定的，就是windows，至于为什么windows的病毒这么多？原因也是很多的，比如windows系统很复杂，说他复杂过linux毫不过分，普通的人很难完全精通掌握系统复杂层次的东西，当然，他们的安全防范的设计估计也挺差，不至于因为大家都用管理员账户就可以这么容易感染病毒吧，比如那个注册表，怎么那么容易被改写？难道真是因为用户都变成傻瓜了。]]></description>
			<content:encoded><![CDATA[<p>昨天双击d盘，没反应，右键一看第一个是auto，好像又中了那个病毒了。而且是不到1年之内的第三次了。以前还算顺利，杀这个病毒。这次就惨了。<br />
查看进程，启动选项，很正常，删掉autorun.inf和那个pagefile两个文件，当时是没事，这时候，如果再从桌面或者开始菜单启动任何程序，这两个文件都会被重建。<br />
重启，报explorer.exe错误，金山的个人防火墙也没了（没启动），查看explorer这个文件，好像没什么问题。启动防火墙，突然报explorer要访问网络，我靠你一资源浏览器干什么新潮访问个鸟啊，一旦允许，立刻金山报了无数病毒，多是窃取密码的木马。Win32.Troj.Lyloader.a.14848<br />
Win32.Troj.PswrobT.gl.90112<br />
Win32.PSWTroj.WOW.sa.153088<br />
等。<br />
地点都是<br />
\Local Settings\Temp<br />
名字是1.exe,2.exe,3.exe之类的。<br />
鸟人，查看一下网络状况，一个连到了74.222.148.2 一个222.73.15.76。一个美国，一个上海（SB那个上海人和gaj）。端口都是80，肯定有问题。<br />
用IceSword看了一下Explorer加载的模块，发现了两个dll比较差劲<br />
一个在ie的plugins，叫做newtemp.dll，而且是隐藏文件，一个是cnsmin.dll。<br />
在文件系统里查找，最近几天的dll，果然就这几个文件，还有一个kulionzx.dll，好像也是病毒。从注册表里找到这些，都删掉，重启之后目前一切正常。</p>
<p>至此虽然告一段落，但是为什么会中毒，毒源还没找到，每天上的网站也都是固定的几个，也不怎么乱下软件。其中一个原因是可以肯定的，就是windows，至于为什么windows的病毒这么多？原因也是很多的，比如windows系统很复杂，说他复杂过linux毫不过分，普通的人很难完全精通掌握系统复杂层次的东西，当然，他们的安全防范的设计估计也挺差，不至于因为大家都用管理员账户就可以这么容易感染病毒吧，比如那个注册表，怎么那么容易被改写？难道真是因为用户都变成傻瓜了。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2007/08/25/anti_virus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

