<?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"
	>

<channel>
	<title>The Iron Sea &#187; Code</title>
	<atom:link href="http://theironsea.com/category/code/feed" rel="self" type="application/rss+xml" />
	<link>http://theironsea.com</link>
	<description>inside the never settle mind of Houston Ng</description>
	<pubDate>Tue, 13 May 2008 04:15:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>scRubyt Tutorial: Dogs of Hang Seng Index</title>
		<link>http://theironsea.com/2008/05/01/21/</link>
		<comments>http://theironsea.com/2008/05/01/21/#comments</comments>
		<pubDate>Thu, 01 May 2008 15:43:10 +0000</pubDate>
		<dc:creator>Houston</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[finance]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[scrubyt]]></category>

		<guid isPermaLink="false">http://theironsea.com/?p=21</guid>
		<description><![CDATA[Inspired by a scRubyt Tutorial: Dog of FTSE posted on straws-dog. Guess it&#8217;s time for me to give it a go!
This should work on all the Index, Dow Jones, NASDAQ Qs&#8230;.
So here&#8217;s the paste of the code. The idea is very similar to Dog of FTSE, except this uses the intelligent learning feature of scRubyt [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by a scRubyt Tutorial: <a href="http://www.straw-dogs.co.uk/09/05/scrubyt-tutorial-dogs-of-the-ftse/">Dog of FTSE</a> posted on straws-dog. Guess it&#8217;s time for me to give it a go!</p>
<p>This should work on all the Index, Dow Jones, NASDAQ Qs&#8230;.</p>
<p>So here&#8217;s the paste of the code. The idea is very similar to Dog of FTSE, except this uses the intelligent learning feature of scRubyt instead of the straight XPATH. This feature of scRubyt is especially useful when it is used on a well-element-classified (don&#8217;t know how to phrase it) site like yahoo finance.</p>
<p>#<br />
# Dog of HSI written by Houston Ng</p>
<p>require &#8216;rubygems&#8217;<br />
require &#8217;scrubyt&#8217;</p>
<p># Initialize an empty hash for final data<br />
final_data={}</p>
<p># Extractor 1: Get an update symbol list of HSI from yahoo finance<br />
hsi_list = Scrubyt::Extractor.define do<br />
fetch &#8216;http://hk.finance.yahoo.com/q/cp?s=%5EHSI&#8217;<br />
top    &#8220;//td[@class=&#8217;c1&#8242;]&#8221; do<br />
symbol &#8220;//a&#8221;<br />
end<br />
end<br />
hsi_stocks = hsi_list.to_hash</p>
<p># Extractor 2: Get the stock information, just modify the pattern learner<br />
hsi_stocks.each do |hsi_stock|<br />
sc = hsi_stock[:symbol]<br />
stock_data = Scrubyt::Extractor.define do<br />
fetch &#8216;http://hk.finance.yahoo.com/q&#8217;<br />
fill_textfield &#8217;s&#8217;, sc<br />
submit</p>
<p>#For the div with id, stock bar,<br />
#get the content inside h3, the first and second b tags<br />
#This only works for HK finance<br />
top &#8220;//div[@id=&#8217;stock-bar&#8217;]&#8221; do<br />
name &#8220;//h3&#8243;<br />
price &#8220;//b[1]&#8221;<br />
change &#8220;//b[2]&#8221;<br />
end<br />
end<br />
#Save the stock data into the final data<br />
final_data[sc] = stock_data.to_hash<br />
end<br />
# Print out the final data, basically just puts out the hash on screen<br />
#The example is just spitting out the name for simplicity<br />
final_data.each do |key, entry|<br />
puts &#8220;\n#{key}&#8221;<br />
entry.each do |datapair|<br />
puts &#8220;#{datapair[:name]} | Price: #{datapair[:price]} | Change: #{datapair[:change]}&#8221;<br />
end<br />
end<br />
I know I can just get everything from the same page I got the HSI symbol list. But Just for fun to play with auto-fill in. I load the actual quote page.</p>
<p>There is however, a slight pitfall that my little brain needs to work around. If you notice the output, there are two empty hashes. They are from the HSI list grabbing. It grabs too many cells, that it grab the header cell but since, the header cell does not contain any &lt;a&gt; tags, it return an empty value. This will be next improvement of the code&#8230;</p>
<p>Here&#8217;s the source code <a href="http://theironsea.com/wp-content/uploads/hsi-list.rb">Dog of HSI</a></p>
<p>Dog of the Dow coming soon&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://theironsea.com/2008/05/01/21/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing CSS accessiblity on a Mac</title>
		<link>http://theironsea.com/2008/04/23/10/</link>
		<comments>http://theironsea.com/2008/04/23/10/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 03:57:26 +0000</pubDate>
		<dc:creator>Houston</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://theironsea.com/?p=10</guid>
		<description><![CDATA[Well Mac has been a great friend from a developer point of view. I don&#8217;t think there are too many objections to that. The problem a web designer face is the pain in butt issue in IE both 6 &#38; 7 (probably 8 too, haven&#8217;t tried the beta yet tho). And yes I know this [...]]]></description>
			<content:encoded><![CDATA[<p>Well Mac has been a great friend from a developer point of view. I don&#8217;t think there are too many objections to that. The problem a web designer face is the pain in butt issue in IE both 6 &amp; 7 (probably 8 too, haven&#8217;t tried the beta yet tho). And yes I know this page&#8217;s header is not working too well on IE but I haven&#8217;t got a chance to work on it yet</p>
<p>Well, Thanks to Apple switching to Intel. We have parallels, which leads to IE6 or IE7&#8230; depending which one which one you&#8217;ve installed and there can only be one installed at the same time humm&#8230;</p>
<p>Here&#8217;s the solution.</p>
<p>I just found out how you can install all the IE from 3.3 to 6 all in a nice package HA!</p>
<p><a href="http://tredosoft.com/Multiple_IE" target="_self">Multiple IE from Tredo Soft </a></p>
]]></content:encoded>
			<wfw:commentRss>http://theironsea.com/2008/04/23/10/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code Versioning for startup</title>
		<link>http://theironsea.com/2008/04/22/9/</link>
		<comments>http://theironsea.com/2008/04/22/9/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 15:35:15 +0000</pubDate>
		<dc:creator>Houston</dc:creator>
		
		<category><![CDATA[Business]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Startup]]></category>

		<guid isPermaLink="false">http://theironsea.com/?p=9</guid>
		<description><![CDATA[Code management is probably the top priority of any software development startup. So this is going to be an ongoing post to keep track of what&#8217;s out there

SVN. Used to use it back at my old aero company. It&#8217;s great but the code pretty much sits in the companies&#8217; server. That was the old day.. [...]]]></description>
			<content:encoded><![CDATA[<p>Code management is probably the top priority of any software development startup. So this is going to be an ongoing post to keep track of what&#8217;s out there</p>
<ol>
<li>SVN. Used to use it back at my old aero company. It&#8217;s great but the code pretty much sits in the companies&#8217; server. That was the old day.. Anyway, There are tons of these online hosting too! There are, <a href="http://unfuddle.com/">Unfuddle</a> and <a href="http://www.assembla.com/">Assembla</a></li>
<li>GIT. New &#8220;IT&#8221; thing for the Web2.0 community. And now it&#8217;s much cleaner and simpler with the new <a href="http://github.com" target="_self">GitHub</a> repository service. Now code can stay online and shared anywhere! Great! Pricing is not too bad for a startup too like $7-12/month. Umm&#8230; sound like I need to get an account there&#8230; wait I don&#8217;t have any code nor collaborators&#8230;. well versioning is still a good habit</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://theironsea.com/2008/04/22/9/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
