<?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>blogging and scraping &#187; ruby</title>
	<atom:link href="http://www.tsnpc.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tsnpc.com</link>
	<description></description>
	<lastBuildDate>Mon, 12 Jul 2010 22:54:43 +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>Multiple ruby files work together</title>
		<link>http://www.tsnpc.com/multiple-ruby-files-work-together/</link>
		<comments>http://www.tsnpc.com/multiple-ruby-files-work-together/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 04:06:05 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[multiple ruby files]]></category>

		<guid isPermaLink="false">http://www.tsnpc.com/?p=196</guid>
		<description><![CDATA[When writing the first few Ruby programs, there is a tend to place all the code in a single file. But as time passes by and the Ruby programs grow, it is nature that at some point we have to break our code up into logical groupings and place each group in a separate file [...]]]></description>
			<content:encoded><![CDATA[<p>When writing the first few Ruby programs, there is a tend to place all the code in a single file. But as time passes by and the Ruby programs grow, it is nature that at some point we have to break our code up into logical groupings and place each group in a separate file or files. </p>
<p>following is an examle:</p>
<p>in foo.rb:<br />
puts &#8220;it is foo&#8221;<br />
$foo = 3  # $ for global variable</p>
<p>in bar.rb:<br />
puts &#8220;it is bar&#8221;<br />
$bar = 3  # $ for global variable</p>
<p>in test.rb:<br />
require &#8216;foo&#8217; # pay attention &#8211;no &#8220;.rb&#8221;<br />
load &#8216;bar.rb&#8217; # pay attention &#8212; &#8220;.rb&#8221; is there<br />
test = 1 + $foo + $bar</p>
<p>when execute test.rb, it shows :<br />
it is foo<br />
it is bar<br />
9</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tsnpc.com/multiple-ruby-files-work-together/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The ruby code to find which weekday is current day</title>
		<link>http://www.tsnpc.com/the-ruby-code-to-find-which-weekday-is-current-day/</link>
		<comments>http://www.tsnpc.com/the-ruby-code-to-find-which-weekday-is-current-day/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 16:24:45 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[Time.now]]></category>

		<guid isPermaLink="false">http://www.tsnpc.com/?p=176</guid>
		<description><![CDATA[At first, I failed to find which weekday is today by following codes: timetoday = Time.now if timetoday =~ /Fri/ puts &#8220;Friday&#8221; end I found in the internet that following codes works: timetoday = &#8221; &#8221; timetoday = Time.now.to_s() if timetoday =~ /Fri/ puts &#8220;Friday&#8221; end]]></description>
			<content:encoded><![CDATA[<p>At first, I failed to find which weekday is today by following codes:</p>
<p>timetoday = Time.now</p>
<p>if timetoday =~ /Fri/<br />
puts &#8220;Friday&#8221;<br />
end</p>
<p>I found in the internet that following codes works:</p>
<p>timetoday = &#8221; &#8221;<br />
timetoday = Time.now.to_s()</p>
<p>if timetoday =~ /Fri/<br />
puts &#8220;Friday&#8221;<br />
end</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tsnpc.com/the-ruby-code-to-find-which-weekday-is-current-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>watir installation error 14001</title>
		<link>http://www.tsnpc.com/watir-installation-error-14001/</link>
		<comments>http://www.tsnpc.com/watir-installation-error-14001/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 12:17:44 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[watir]]></category>
		<category><![CDATA[14001]]></category>

		<guid isPermaLink="false">http://www.tsnpc.com/?p=155</guid>
		<description><![CDATA[I encountered a error 14001 when I tried to install watir 1.6.2 in a new computor, I googled and found: the version of win32-api should be 1.3.0 or later the version of windows-api should be 0.3.0 or later the version of windows-pr should be 0.9.9 or later After fix the above version problems, the watir [...]]]></description>
			<content:encoded><![CDATA[<p>I encountered a error 14001 when I tried to install watir 1.6.2 in a new computor, I googled and found:</p>
<p>the version of win32-api should be 1.3.0 or later<br />
the version of windows-api should be 0.3.0 or later<br />
the version of windows-pr should be 0.9.9 or later</p>
<p>After fix the above version problems, the watir can work properly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tsnpc.com/watir-installation-error-14001/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hpricot vs Mechanize vs ScrAPI vs Watir vs ScRUBYt!</title>
		<link>http://www.tsnpc.com/hpricot-vs-mechanize-vs-scrapi-vs-watir-vs-scrubyt/</link>
		<comments>http://www.tsnpc.com/hpricot-vs-mechanize-vs-scrapi-vs-watir-vs-scrubyt/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 14:15:08 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[autoposting]]></category>

		<guid isPermaLink="false">http://www.tsnpc.com/?p=148</guid>
		<description><![CDATA[Hpricot vs Mechanize vs ScrAPI vs Watir vs ScRUBYt! For autoposting and scraping, at first I got familiar with watir, and then I learned somthing about Hpricot, now I am concentrated on Mechanize. I think all of the tools stated above are quite good. Related Blogs Related Blogs on autoposting Testing Posterous Email Autoposting 30dc [...]]]></description>
			<content:encoded><![CDATA[<p>Hpricot vs Mechanize vs ScrAPI vs Watir vs ScRUBYt!</p>
<p>For autoposting and scraping, at first I got familiar with watir, and then I learned somthing about Hpricot, now I am concentrated on Mechanize.</p>
<p>I think all of the tools stated above are quite good.<br />
<h4>Related Blogs</h4>
<ul class="pc_pingback">
<li class="hdl" style="list-style: none">Related Blogs on <b>autoposting</b></li>
<li><a href="http://wastedmonkeys.com/2008/10/26/testing-posterous-email-autoposting-2/">Testing Posterous Email <b>Autoposting</b></a></li>
<li><a href="http://esworldmarketing.com/blog/wp/?p=242">30dc &#8211; day 23 &#8211; <b>autoposting</b> content on wordpressdirect</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.tsnpc.com/hpricot-vs-mechanize-vs-scrapi-vs-watir-vs-scrubyt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>if statement with multiple conditions in ruby</title>
		<link>http://www.tsnpc.com/if-statement-with-multiple-conditions-in-ruby/</link>
		<comments>http://www.tsnpc.com/if-statement-with-multiple-conditions-in-ruby/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 03:18:13 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.tsnpc.com/?p=82</guid>
		<description><![CDATA[It is difficult to find the examples demonstrating how to combine two conditions in the if statement of ruby, I tried and found following code is ok: tmp = rand(10) if ((tmp &#62; 5) &#38;&#38; (ie77.text.include? &#8216;fine&#8217;)) puts &#8220;fine&#8221; else sleep 7 end]]></description>
			<content:encoded><![CDATA[<p>It is difficult to find the examples demonstrating how to combine two conditions in the if statement of ruby, I tried and found following code is ok:</p>
<p>tmp = rand(10)</p>
<p>if ((tmp &gt; 5) &amp;&amp; (ie77.text.include? &#8216;fine&#8217;))<br />
puts &#8220;fine&#8221;</p>
<p>else</p>
<p>sleep 7<br />
end</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tsnpc.com/if-statement-with-multiple-conditions-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>firebug + hpricot</title>
		<link>http://www.tsnpc.com/firebughpricot/</link>
		<comments>http://www.tsnpc.com/firebughpricot/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 12:24:29 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[hpricot]]></category>

		<guid isPermaLink="false">http://www.tsnpc.com/?p=48</guid>
		<description><![CDATA[Following code is trying to scrape the content in a webpage, the content cannot be picked by the scraping software tool I used: require &#8216;rubygems&#8217; require &#8216;hpricot&#8217; require &#8216;open-uri&#8217; url = &#8220;http://homemsg.focus.cn/msgview/607/50129006.html&#8221; doc = Hpricot(open(url)) td_contents = (doc/&#8221;/html/body/table[8]/tbody/tr/td[4]/table[2]/tbody/tr/td&#8221;).inner_html puts td_contents It did not work, there must be something wrong. by firebug, I can copy the [...]]]></description>
			<content:encoded><![CDATA[<p>Following code is trying to scrape the content in a webpage, the content cannot be picked by the scraping software tool I used:<br />
require &#8216;rubygems&#8217;<br />
require &#8216;hpricot&#8217;<br />
require &#8216;open-uri&#8217;</p>
<p>url = &#8220;http://homemsg.focus.cn/msgview/607/50129006.html&#8221;<br />
doc = Hpricot(open(url))<br />
td_contents = (doc/&#8221;/html/body/table[8]/tbody/tr/td[4]/table[2]/tbody/tr/td&#8221;).inner_html<br />
puts td_contents</p>
<p>It did not work, there must be something wrong.</p>
<p>by firebug, I can copy the xpath(/html/body/table[8]/tbody/tr/td[4]/table[2]/tbody/tr/td), and copy its innerHTML.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tsnpc.com/firebughpricot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
