<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: Implementing &#8216;15 Exercises for Learning a new Programming Language&#8217;</title>
	<atom:link href="http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/</link>
	<description>Experiences with Ruby and Rails, Web2.0 and other development technologies</description>
	<pubDate>Sat, 13 Mar 2010 19:54:52 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: John</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-139779</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 12 Feb 2010 03:33:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-139779</guid>
		<description>&lt;p&gt;In response to problem 1, interrupting an infinite sum by hitting a character:&lt;/p&gt;

&lt;p&gt;Without doing threads in Ruby (like you would in Python, for ex), maybe you can do something simple like check for a kbhit (received character from std in) in your loop. This is a common technique when reading rs-232 serial lines on a microcontroller. You want to get data if its in a buffer, but if it is not then you absolutely can't hang in a get operation.&lt;/p&gt;

&lt;p&gt;something like:&lt;/p&gt;

&lt;p&gt;if(kbhit())
car=getc()&lt;/p&gt;

&lt;p&gt;I'm 2 hours into this language, so I don't know if this method exists, but it seems like it probably does.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>In response to problem 1, interrupting an infinite sum by hitting a character:</p>
<p>Without doing threads in Ruby (like you would in Python, for ex), maybe you can do something simple like check for a kbhit (received character from std in) in your loop. This is a common technique when reading rs-232 serial lines on a microcontroller. You want to get data if its in a buffer, but if it is not then you absolutely can&#8217;t hang in a get operation.</p>
<p>something like:</p>
<p>if(kbhit())<br />
car=getc()</p>
<p>I&#8217;m 2 hours into this language, so I don&#8217;t know if this method exists, but it seems like it probably does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Leitman</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-107390</link>
		<dc:creator>Jeff Leitman</dc:creator>
		<pubDate>Tue, 13 Jan 2009 19:17:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-107390</guid>
		<description>&lt;p&gt;For a simpler UNIX solution, you can trap SIGINT (Ctrl-C)&lt;/p&gt;

&lt;pre&gt;
i = 0
go = true
while go do
 print "#{i+=1}, "
 Signal.trap("INT") do
  go = false
 end
end
puts "Terminated by user."
&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>For a simpler UNIX solution, you can trap SIGINT (Ctrl-C)</p>
<pre>
i = 0
go = true
while go do
 print "#{i+=1}, "
 Signal.trap("INT") do
  go = false
 end
end
puts "Terminated by user."
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thando Vuzane - Net Age</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-40043</link>
		<dc:creator>Thando Vuzane - Net Age</dc:creator>
		<pubDate>Fri, 09 May 2008 13:57:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-40043</guid>
		<description>&lt;p&gt;Wow, thank you for this post. I will go home and do the '15 exercises for learning a new Programming Language'. And I'll use the above coding as my reference. I've just recently started developing in Ruby on Rails, so I'm at a point where I just want as many challenges and new applications to develop as possible, because I want to fully explore RoR. &lt;/p&gt;

&lt;p&gt;Thank you again,&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Wow, thank you for this post. I will go home and do the &#8216;15 exercises for learning a new Programming Language&#8217;. And I&#8217;ll use the above coding as my reference. I&#8217;ve just recently started developing in Ruby on Rails, so I&#8217;m at a point where I just want as many challenges and new applications to develop as possible, because I want to fully explore RoR. </p>
<p>Thank you again,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thando Vuzane - Net Age</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-39851</link>
		<dc:creator>Thando Vuzane - Net Age</dc:creator>
		<pubDate>Thu, 08 May 2008 09:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-39851</guid>
		<description>&lt;p&gt;Has anyone here created a helper.rb for a vCard on Rails? Please post an example of your coding if you have.&lt;/p&gt;

&lt;p&gt;Thanx!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Has anyone here created a helper.rb for a vCard on Rails? Please post an example of your coding if you have.</p>
<p>Thanx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2008-03-29 &#124; Moewes.com</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-35669</link>
		<dc:creator>links for 2008-03-29 &#124; Moewes.com</dc:creator>
		<pubDate>Sat, 29 Mar 2008 13:32:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-35669</guid>
		<description>&lt;p&gt;[...] Ruby, Rails, Web2.0 » Blog Archive » Implementing ‘15 Exercises for Learning a new Programming Language’ (tags: programming) [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Ruby, Rails, Web2.0 » Blog Archive » Implementing ‘15 Exercises for Learning a new Programming Language’ (tags: programming) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-34753</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Sat, 15 Mar 2008 15:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-34753</guid>
		<description>&lt;p&gt;&lt;a&gt;  &lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><a>  </a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Diesel</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-34742</link>
		<dc:creator>Diesel</dc:creator>
		<pubDate>Sat, 15 Mar 2008 13:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-34742</guid>
		<description>&lt;p&gt;&lt;a&gt;  &lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><a>  </a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-30658</link>
		<dc:creator>Vince</dc:creator>
		<pubDate>Fri, 25 Jan 2008 02:20:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-30658</guid>
		<description>&lt;p&gt;In solution #3 instead of &#60;&#60; p a.sort { &#124;a,b&#124; b&#60;=&#62;a } &#62;&#62; you could use &#60;&#60; p a.sort.reverse &#62;&#62;...just more readable&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>In solution #3 instead of &lt;&lt; p a.sort { |a,b| b&lt;=&gt;a } &gt;&gt; you could use &lt;&lt; p a.sort.reverse &gt;&gt;&#8230;just more readable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Edward Gray II</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-29694</link>
		<dc:creator>James Edward Gray II</dc:creator>
		<pubDate>Thu, 17 Jan 2008 13:54:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-29694</guid>
		<description>&lt;p&gt;I see there's already a Windows specific answer to the first problem, so I shall provide the Unix solution:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby -wKU

require "io/wait"

state = `stty -g`
begin
  system "stty raw -echo cbreak isig"

  1.upto(1.0/0.0) do &#124;n&#124;
    puts n
    exit if $stdin.ready? and $stdin.getc == 27
  end

ensure
  system "stty #{state}"
end

__END__
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The reason you need the platform specific code here is that you are doing complex interactions (reading and writing at the same time) with a terminal and all terminals are different.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I see there&#8217;s already a Windows specific answer to the first problem, so I shall provide the Unix solution:</p>
<pre><code>#!/usr/bin/env ruby -wKU

require "io/wait"

state = `stty -g`
begin
  system "stty raw -echo cbreak isig"

  1.upto(1.0/0.0) do |n|
    puts n
    exit if $stdin.ready? and $stdin.getc == 27
  end

ensure
  system "stty #{state}"
end

__END__
</code></pre>
<p>The reason you need the platform specific code here is that you are doing complex interactions (reading and writing at the same time) with a terminal and all terminals are different.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: knownone</title>
		<link>http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/comment-page-1/#comment-29090</link>
		<dc:creator>knownone</dc:creator>
		<pubDate>Sun, 13 Jan 2008 15:56:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/implementing-15-exercises-for-learning-a-new-programming-language/#comment-29090</guid>
		<description>&lt;p&gt;are your platform windows?nonblock.rb requires fcntl,but it didn't implement on all platforms?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>are your platform windows?nonblock.rb requires fcntl,but it didn&#8217;t implement on all platforms?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
