<?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>YashLabs &#187; Tutorials</title>
	<atom:link href="http://www.yashlabs.com/wp/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yashlabs.com/wp</link>
	<description>Finance, Technology and the pursuit of Alpha Beauty</description>
	<lastBuildDate>Fri, 16 Jul 2010 20:35:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><cloud domain='www.yashlabs.com' port='80' path='/wp/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Extending the e Text Editor for Ruby Programming</title>
		<link>http://www.yashlabs.com/wp/2007/09/03/extending-the-e-text-editor-for-ruby-programming/</link>
		<comments>http://www.yashlabs.com/wp/2007/09/03/extending-the-e-text-editor-for-ruby-programming/#comments</comments>
		<pubDate>Mon, 03 Sep 2007 05:34:03 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=153</guid>
		<description><![CDATA[

At DemoCampMontreal4, I showed the results of time spent programming Ruby and RubyOnRails within the excellent e Text Editor for Windows. You can read about the presentation in my DemoCampMontreal4 report here at YashLabs, MTW and Marc-AndrÃ© Cournoyer&#8217;s blog.
e Text Editor and the extensible Bundle system
e is compatible with (the Mac OS X-only) TextMate bundles [...]]]></description>
			<content:encoded><![CDATA[<p><img align="left" hspace=10 vspace=10 src="http://www.yashlabs.com/wp/wp-content/logoheader.png" width="314" height="74" alt="e Logo" title="e Logo" /><script type="text/javascript"><!--
google_ad_client = "pub-4038366765312585";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0066CC";
google_color_url = "0066CC";
google_color_text = "333333";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>At DemoCampMontreal4, I showed the results of time spent programming Ruby and RubyOnRails within the excellent <a href="http://e-texteditor.com/blog/2007/e_v10_released" onclick="pageTracker._trackPageview('/outgoing/e-texteditor.com/blog/2007/e_v10_released?referer=');">e Text Editor</a> for Windows. You can read about the presentation in my <a href="http://www.yashlabs.com/wp/?p=151">DemoCampMontreal4 report</a> here at YashLabs, <a href="http://montrealtechwatch.com/2007/08/18/democampmontreal4/" onclick="pageTracker._trackPageview('/outgoing/montrealtechwatch.com/2007/08/18/democampmontreal4/?referer=');">MTW</a> and <a href="http://macournoyer.wordpress.com/2007/08/17/democampmontreal4-follow-up/" onclick="pageTracker._trackPageview('/outgoing/macournoyer.wordpress.com/2007/08/17/democampmontreal4-follow-up/?referer=');">Marc-AndrÃ© Cournoyer</a>&#8217;s blog.</p>
<p><strong>e Text Editor and the extensible Bundle system</strong></p>
<p><a href="http://www.e-texteditor.com/index.html" onclick="pageTracker._trackPageview('/outgoing/www.e-texteditor.com/index.html?referer=');">e</a> is compatible with (the Mac OS X-only) TextMate bundles and can load in its snippets for faster Ruby and Rails programming. However, I also wanted to have quick access to all the methods associated to the common Ruby data structures:</p>
<li>String</li>
<li>Array</li>
<li>Hash</li>
<li>Fixnum</li>
<p><strong>The Design</strong></p>
<li>A keyboard shortcut for launching the menu</li>
<li>A menu displaying all methods is displayed</li>
<li>From the menu, the user can scroll and select the method or jump to it with a keypress for the first letter of the method</li>
<li>On selection, the menu disappears and the appropriate method name is inserted at the current cursor position</li>
<p><strong>Ruby&#8217;s reflection capabilities</strong></p>
<p><img align="right" hspace=10 vspace=10 src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Ruby_logo.png/100px-Ruby_logo.png" alt="Ruby logo" /><a href="http://www.yashlabs.com/wp/?p=151">Ruby</a> is a great object-oriented language. In Ruby, everything is an object and hence all the object-oriented principles I learnt are implemented in Ruby quite well and simply, which is more than can be said for C++ and Java. For instance, in Ruby, you can do this:</p>
<p><code lang="php">10.times</code></p>
<p>or</p>
<p><code lang="php">"Hello".length</code></p>
<p>Ruby is great for introspection as it has good reflection capacities &#8211; an object can provide information about its internals. The inbuilt <em>.methods</em> method gives all the methods associated with a data structure. e.g.</p>
<p><code lang="php">puts Array.methods.sort.inspect</code></p>
<p>gives</p>
<p><code lang="php"><br />
["< ", "<=", "<=>", "==", "===", "=~", ">", ">=", "[]", "__id__", "__send__", "allocate", "ancestors", "autoload", "autoload?", "class", "class_eval", "class_variable_defined?", "class_variables", "clone", "const_defined?", "const_get", "const_missing", "const_set", "constants", "display", "dup", "eql?", "equal?", "extend", "freeze", "frozen?", "hash", "id", "include?", "included_modules", "inspect", "instance_eval", "instance_method", "instance_methods", "instance_of?", "instance_variable_defined?", "instance_variable_get", "instance_variable_set", "instance_variables", "is_a?", "kind_of?", "method", "method_defined?", "methods", "module_eval", "name", "new", "nil?", "object_id", "private_class_method", "private_instance_methods", "private_method_defined?", "private_methods", "protected_instance_methods", "protected_method_defined?", "protected_methods", "public_class_method", "public_instance_methods", "public_method_defined?", "public_methods", "respond_to?", "send", "singleton_methods", "superclass", "taint", "tainted?", "to_a", "to_s", "type", "untaint"]</code></p>
<p>However, [].methods.sort contains additional methods not contained within Array as shown by:</p>
<p><code lang="php"><br />
res= [].methods - Array.methods<br />
puts res.inspect</code></p>
<p>This gives the additional methods of []:</p>
<p><code lang="php">["select", "[]=", "transpose", "< <", "&#038;", "indexes", "partition", "map!", "uniq", "empty?", "fetch", "values_at", "*", "grep", "+", "shift", "clear", "-", "reject", "insert", "reverse!", "indices", "delete", "first", "concat", "member?", "flatten!", "|", "find", "join", "delete_at", "each_with_index", "nitems", "unshift", "index", "collect", "fill", "all?", "uniq!", "slice", "length", "entries", "compact", "last", "detect", "delete_if", "zip", "each_index", "map", "sort!", "assoc", "rindex", "any?", "to_ary", "size", "sort", "min", "push", "find_all", "each", "slice!", "pack", "reverse_each", "replace", "inject", "collect!", "rassoc", "at", "reverse", "compact!", "sort_by", "max", "reject!", "flatten", "pop"]</code></code></p>
<p>Therefore, instead of Array.methods, I&#8217;d rather get [].methods.</p>
<p><strong>Cygwin</strong></p>
<p><img align = "left" hspace=10 vspace=10 src="http://cygwin.com/cygwin-icon.gif" alt="Cygwin logo" />Cygwin&#8217;s great UNIX-like programming environment is used by e for the bundle system. This is interesting because from there you can run Ruby code within the e Bundle system and communicate with Cygwin through to the Operating System.</p>
<p>There&#8217;s a great post by Ben Kittrell describing how he made <a href="http://garbageburrito.com/blog/entry/391/a-macesque-rails-development-environment-on-windows" onclick="pageTracker._trackPageview('/outgoing/garbageburrito.com/blog/entry/391/a-macesque-rails-development-environment-on-windows?referer=');">a great Mac-like environment for Rails development on Windows</a> using Cygwin.</p>
<p><strong>wxCocoaDialog</strong></p>
<p><img align="right" hspace=10 vspace=10 src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/WxWidgets.svg/128px-WxWidgets.svg.png" alt="wxWidgets logo" /><a href="http://cocoadialog.sourceforge.net/index.html" onclick="pageTracker._trackPageview('/outgoing/cocoadialog.sourceforge.net/index.html?referer=');">CocoaDialog</a> is a lightweight <a href="http://en.wikipedia.org/wiki/Objective-C" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Objective-C?referer=');">Objective-C</a> application for Mac OS X to provide easy access to common GUI widgets and is particularly suitable for object-oriented scripting languages.</p>
<p>Fortunately, some kind soul ported <a href="http://cocoadialog.sourceforge.net/" onclick="pageTracker._trackPageview('/outgoing/cocoadialog.sourceforge.net/?referer=');">CocoaDialog</a> to use the cross-platform and open-source <a href="http://en.wikipedia.org/wiki/WxWidgets" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/WxWidgets?referer=');">wxWidgets</a> toolkit. Actually, it is e Text Editor and its TextMate-compatible bundle system that gave rise to <a href="http://code.google.com/p/wxcocoadialog/" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/wxcocoadialog/?referer=');">wxCocoaDialog</a>.</p>
<p>And in this wxCocoaDialog port, we have <a href="http://code.google.com/p/wxcocoadialog/wiki/Runmodes" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/wxcocoadialog/wiki/Runmodes?referer=');">three additional runmode items</a> not present in CocoaDialog on Mac OS X, including&#8230;menu!</p>
<p><strong>Putting it all together</strong></p>
<p>Provided you have e installed (wxCocoaDialog comes with it) as well as Cygwin and Ruby for Cygwin, here is how to proceed.</p>
<ol>
<li>In e, press <strong>CTRL-SHIFT-B</strong> to open the Bundle Editor</li>
<li>On the left tree-view pane, select Ruby</li>
<li>Click on the big <strong>+</strong> button lower down and choose <strong>New Command</strong></li>
<li>Name the command RubyMethodsString (or anything suitable for you)</li>
<li>Paste in the following code I wrote which connects Ruby, Cygwin, wxCocoaDialog and e. <em>Be careful when pasting as currently the code formatting plugin does weird things with quotes &#8211; all the quotes are straight except after <strong>index=</strong> &#8211; the outermost ones really are backticks to access the system</em></li>
<p><code lang="php"><br />
#!/usr/bin/env ruby</p>
<p>#Access Ruby Methods for strings<br />
#August 2007 - Josh Nursing - josh.nursing AT gmail.com</p>
<p>SUPPORT = ENV['TM_SUPPORT_PATH']<br />
DIALOG = SUPPORT + '/bin/CocoaDialog.exe'<br />
sel = ENV['TM_CURRENT_WORD']<br />
x = "--xpos #{ENV['TM_CARET_XPOS']} "<br />
y = "--ypos #{ENV['TM_CARET_YPOS']} "</p>
<p>am="".methods.sort </p>
<p>menu=[]</p>
<p>#Populate menu with formatted entries<br />
am.each do |w|<br />
    menu.push "'" + w.to_s + "' "<br />
end</p>
<p>#CocoaDialog menu<br />
index =`"#{DIALOG}" menu --items #{menu} #{x} #{y}`.to_i - 1</p>
<p>#Insert the selected method text at caret position<br />
print '.' + am[index]</code></p>
<li>In the upper right corner, as Environment, select <strong>Cygwin</strong></li>
<li>Lower down, select as Input: <strong>Selected Text</strong> or <strong>Word</strong></li>
<li>As Output, select <strong>Insert as Text</strong></li>
<li>As Activation, select <strong>Key Trigger</strong> and press a key combination. I used <strong>CTRL-SHIFT-Y</strong></li>
<li>Close the bundle editor and in your Ruby file within e, after a string variable name or string, press the key shortcut</li>
<p><img src="http://www.yashlabs.com/wp/wp-content/e%20menu.jpg" width="331" height="514" alt="e menu extension for Ruby Programming" title="e menu extension for Ruby Programming" /></p>
<li>Navigate the menu either with the <strong>Up</strong> or <strong>Down</strong> Arrows or jump straight to a method by pressing its first letter</li>
<p><img src="http://www.yashlabs.com/wp/wp-content/e%20menu2.jpg" width="353" height="264" alt="e menu extension for Ruby Programming 2" title="e menu extension for Ruby Programming 2" />
</ol>
<p>The selected method including the dot is inserted within your code in e.</p>
<p>From here you can derive the very similar codes for the other data structures and add them with new shortcuts. My shortcuts are in a row on the keyboard (CTRL-SHIFT-Y, -U, -I, -O).</p>
<p>This menu extension can be accessed when you&#8217;re developing a Ruby on Rails application as well.</p>
<p>This shows how e can be usefully extended to work better with your favorite programming language.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2007%2F09%2F03%2Fextending-the-e-text-editor-for-ruby-programming%2F&amp;linkname=Extending%20the%20e%20Text%20Editor%20for%20Ruby%20Programming" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2007_2F09_2F03_2Fextending-the-e-text-editor-for-ruby-programming_2F_amp_linkname=Extending_20the_20e_20Text_20Editor_20for_20Ruby_20Programming&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2007/09/03/extending-the-e-text-editor-for-ruby-programming/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hacking IronRuby</title>
		<link>http://www.yashlabs.com/wp/2007/07/27/hacking-ironruby/</link>
		<comments>http://www.yashlabs.com/wp/2007/07/27/hacking-ironruby/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 21:29:43 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=145</guid>
		<description><![CDATA[

John Lam of Microsoft released IronRuby this July 23rd. IronRuby is destined to enable the use of Ruby with .Net to build Windows applications. It targets the Dynamic Language Runtime, which Microsoft plans for IronRuby, IronPython and VBx, a dynamic version of Visual Basic. This post is a tutorial for hacking IronRuby.
In this tutorial I&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-4038366765312585";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0066CC";
google_color_url = "0066CC";
google_color_text = "333333";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><img hspace=10 vspace=10 border=0 align="left" src="http://www.yashlabs.com/wp/wp-content/IronRuby%20image.png" width="266" height="82" alt="IronRuby image" title="IronRuby image" /><a href="http://www.iunknown.com/" onclick="pageTracker._trackPageview('/outgoing/www.iunknown.com/?referer=');">John Lam</a> of Microsoft <a href="http://www.iunknown.com/2007/07/a-first-look-at.html" onclick="pageTracker._trackPageview('/outgoing/www.iunknown.com/2007/07/a-first-look-at.html?referer=');">released IronRuby</a> this July 23rd. IronRuby is destined to enable the use of Ruby with .Net to build Windows applications. It targets the Dynamic Language Runtime, which Microsoft plans for IronRuby, IronPython and VBx, a dynamic version of Visual Basic. This post is a tutorial for hacking IronRuby.</p>
<p>In this tutorial I&#8217;ll show:</p>
<li>How to build IronRuby and test it, including a simple .Net interop test</li>
<li>How to set up a Visual environment to hack IronRuby</li>
<li>How I hacked the IronRuby C# source code to fix a bug about string concatenation in Ruby</li>
<li>How I extended IronRuby with a new method implementation with the Visual environment</li>
<p>A few months ago, I emailed John about the possibility of using his RubyCLR, the precursor to IronRuby, to integrate with open-source IDEs. John was quite open to the idea. This new project renews my interest as already, IronPython has been integrated within the Visual Studio environment, and it would be great to tackle the VS integration of IronRuby in the future.</p>
<p>I checked out the source code to IronRuby in its really early pre-Alpha stage (so you should expect incompleteness and bugs). <a href="http://antoniocangiano.com" onclick="pageTracker._trackPageview('/outgoing/antoniocangiano.com?referer=');">Antonio Cangiano</a> wrote a <a href="http://antoniocangiano.com/2007/07/26/is-ironruby-mathematically-challenged/" onclick="pageTracker._trackPageview('/outgoing/antoniocangiano.com/2007/07/26/is-ironruby-mathematically-challenged/?referer=');">long post about this</a>, but this first release is under Microsoft&#8217;s Permissive License, so that anyone can look at the code and modify it.</p>
<p><strong>1. Building IronRuby</strong></p>
<p>1. Make sure you have the <a href="http://iunknown.typepad.com/IronRuby-Pre-Alpha1.zip" onclick="pageTracker._trackPageview('/outgoing/iunknown.typepad.com/IronRuby-Pre-Alpha1.zip?referer=');">IronRuby source code</a> and that you have extracted it, and also the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&#038;displaylang=en" onclick="pageTracker._trackPageview('/outgoing/www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5_038_displaylang=en&amp;referer=');">.Net framework</a> installed.</p>
<p>2. Because of a bug in Microsoft&#8217;s <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&#038;displaylang=en" onclick="pageTracker._trackPageview('/outgoing/www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5_038_displaylang=en&amp;referer=');">.Net framework</a> installation, paths to the framework or the corresponding system environment variables are not set correctly. Check the <strong>path to your latest version of .Net framework</strong> by looking in the <strong>Windows\Microsoft.Net</strong> directory.</p>
<p>Mine is: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727</p>
<p>3. In IronRuby&#8217;s installed directory, <strong>edit Build.cmd</strong> and <strong>replace<br />
%frameworkdir%\%frameworkversion% by your full path to your .Net framework dir</strong>.</p>
<p>4. Save Build.cmd.</p>
<p>Mine contains<br />
<code>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild.exe /p:Configuration=Release /t:Rebuild IronRuby.sln</code></p>
<p>5. Launch Build.cmd from the command line. </p>
<p>IronRuby should now build successfully.</p>
<p><strong>2. Testing IronRuby</strong></p>
<p>1. Launch <strong>rbx.exe</strong> in the <strong>Bin\Release</strong> subdirectory and try a simple Ruby command like 3+5 or puts &#8216;Hello!&#8217;</p>
<p>2. A simple .Net interop test:<br />
<code lang="php"><br />
require 'System.Windows.Forms'<br />
f=System::Windows::Forms<br />
f::MessageBox.show "Hello from .Net!"</code></p>
<p><img src="http://www.yashlabs.com/wp/wp-content/IronRuby.JPG" width="428" height="195" alt="IronRuby test" title="IronRuby test" /></p>
<p>3. A string test which fails:</p>
<div class = 'centered'>
<img src="http://www.yashlabs.com/wp/wp-content/IronRuby%20bug.JPG" width="272" height="116" alt="IronRuby bug" title="IronRuby bug" />
</div>
<p>Here, we can see that string concatenation unfortunately modifies the first argument. We&#8217;ll see how to fix this in IronRuby&#8217;s source code in a short while, but first we&#8217;ll set up a nice Visual environment to code in.</p>
<p><strong>3. Setting up Visual C# Express 2005 to hack IronRuby</strong></p>
<p>1. Download <a href="http://msdn.microsoft.com/vstudio/express/visualcsharp/" onclick="pageTracker._trackPageview('/outgoing/msdn.microsoft.com/vstudio/express/visualcsharp/?referer=');">Visual C# Express 2005</a> and install it. Do register the software.</p>
<p>2. Load the IronRuby solution file, <strong>IronRuby.sln</strong>, in the Visual C# Express 2005 IDE.</p>
<p>3. You can then build IronRuby straight from the IDE and also modify it which we will now see by going through fixing the bug encountered above.</p>
<p><strong>4. Hacking IronRuby to fix the string addition operation bug</strong></p>
<p>After grasping the overall source-code structure, I narrowed down the bug to the <strong>Ruby\Builtins\MutableStrings.cs</strong> file and the <strong>Concatenate(MutableString self, MutableString other)</strong> implementation of <strong>RubyMethodAttribute &#8220;+&#8221;</strong>:<br />
<code lang="php"><br />
[RubyMethodAttribute("+", RubyMethodAttributes.PublicInstance)]<br />
        public static MutableString Concatenate(MutableString self, MutableString other) {<br />
            return self.Append(other);<br />
        }<br />
</code></p>
<p>self.Append(other) was obviously effecting the concatenation but modifying self (as that&#8217;s what Append should do) and returning the result.</p>
<p>To fix this in C#, I needed to instantiate a new temporary MutableString object to which I could in turn append self and other and return this instead:</p>
<p><code lang="php"><br />
MutableString result = new MutableString();<br />
return result.Append(self).Append(other);<br />
</code></p>
<p><a href="http://www.yashlabs.com/wp/wp-content/Hacking%20IronRuby1.JPG"><img src="http://www.yashlabs.com/wp/wp-content/_Hacking%20IronRuby1.JPG" width="250" height="190" alt="Hacking IronRuby" title="Hacking IronRuby"  /></a></p>
<p>Once you&#8217;ve modified an existing IronRuby implementation, you can Build the solution within the Visual C# IDE (F6).</p>
<p>After a successful build, you can browse to the IronRuby <strong>Bin\Debug</strong> directory (or Bin\Release if you set it up this way within Visual C#) and check whether <strong>rbx.exe</strong> is recently timestamped. </p>
<p>Just double-click on <strong>rbx.exe</strong> to launch it and to check the bug fix:</p>
<div class = 'centered'>
<img src="http://www.yashlabs.com/wp/wp-content/IronRuby%20patched.JPG" width="361" height="222" alt="IronRuby patched" title="IronRuby patched" />
</div>
<p><em>Don&#8217;t forget to exit the debug version of rbx if you&#8217;re doing other modifications or you won&#8217;t be able to build it.<br />
</em><br />
<strong>5. Extending IronRuby with new Ruby methods implementations using Visual C#</strong></p>
<p>Here, we&#8217;ll be adding a new Ruby method implementation to the Ruby Builtins classes, so a simple Build of the code would not work, as there is intermediate C# code which has to be generated automatically thanks to a small program named ClassInitGenerator.</p>
<p>There&#8217;s a bad path setting in one of the files we&#8217;ll need, so we have to fix this first:</p>
<p>1. Browse to the <strong>Src\Ruby\Builtins</strong> directory</p>
<p>2. Right-click the <strong>GenerateInitializers.cmd</strong> file and select Properties.</p>
<p>3. Uncheck the Read-Only attribute and click Apply, then OK.</p>
<p>4. Right-click the same file again and select Edit.</p>
<p>5. Remove the initial &#8216;..\&#8217;</p>
<p>Your new file should contain:</p>
<p><code>..\..\..\Bin\Debug\ClassInitGenerator > Initializer.Generated.cs</code></p>
<p>6. Save the file.</p>
<p>As Antonio Cangiano of IBM Toronto&#8217;s Software Labs and others rightly pointed out, a simple float division will throw IronRuby astray:</p>
<div class = 'centered'>
<a href="http://www.yashlabs.com/wp/wp-content/IronRuby%20Float%20divide%20missing.JPG"><img src="http://www.yashlabs.com/wp/wp-content/_IronRuby%20Float%20divide%20missing.JPG" width="250" height="113" alt="IronRuby Float Divide missing" title="IronRuby Float Divide missing"  /></a>
</div>
<p>That&#8217;s because the Ruby &#8220;/&#8221; method for floats within the <strong>Builtins\FloatOps.cs</strong> file is not implemented yet.</p>
<p>Here&#8217;s my simple code for the IronRuby implementation of the Ruby &#8220;/&#8221; operation:</p>
<p><code lang="php"><br />
[RubyMethodAttribute("/", RubyMethodAttributes.PublicInstance)]<br />
        public static double Divide(double self, double other)<br />
        {<br />
            return (self / other);<br />
        }<br />
</code></p>
<p>Here are the steps to recreate an extended IronRuby with the IDE:</p>
<p>1. Save the FloatOps.cs file (or the project)</p>
<p>2. Right-click <strong>ClassInitGenerator</strong> in the solution tree-view and select <strong>Build</strong></p>
<p>3. Browse to <strong>Src\Ruby\Builtins</strong> and launch <strong>GenerateInitializers.cmd</strong>. A new Initializer.Generated.cs file will be generated. If the Visual C# IDE asks for it to be reloaded, click &#8220;Yes&#8221;.</p>
<p>4. Select the Solution and Build it (F6)</p>
<p>5. Browse to the <strong>\Bin\Debug</strong> directory and launch <strong>rbx.exe</strong> to test it:</p>
<div class = 'centered'>
<img src="http://www.yashlabs.com/wp/wp-content/IronRuby%20Float%20extended.JPG" width="401" height="92" alt="IronRuby Float extended" title="IronRuby Float extended" />
</div>
<p>You can now hack away at IronRuby with the Visual C# IDE. Microsoft will be accepting outside contributions to the source code which is expected to be on <a href="http://rubyforge.org/" onclick="pageTracker._trackPageview('/outgoing/rubyforge.org/?referer=');">RubyForge</a> by the end of August.</p>
<p>Other interesting posts about IronRuby:</p>
<li> <a href="http://weblogs.asp.net/scottgu/default.aspx" onclick="pageTracker._trackPageview('/outgoing/weblogs.asp.net/scottgu/default.aspx?referer=');">Scott Guthrie</a>&#8217;s demonstration of <a href="http://weblogs.asp.net/scottgu/archive/2007/07/23/first-look-at-ironruby.aspx" onclick="pageTracker._trackPageview('/outgoing/weblogs.asp.net/scottgu/archive/2007/07/23/first-look-at-ironruby.aspx?referer=');">IronRuby with .Net 3.x and Windows Presentation Foundation (WPF)</a></li>
<li><a href="http://www.hanselman.com/blog/" onclick="pageTracker._trackPageview('/outgoing/www.hanselman.com/blog/?referer=');">Scott Hanselman</a>&#8217;s <a href="http://www.hanselman.com/blog/WPFSampleInIronRubyTalkingViaCToWesabe.aspx" onclick="pageTracker._trackPageview('/outgoing/www.hanselman.com/blog/WPFSampleInIronRubyTalkingViaCToWesabe.aspx?referer=');">post on IronRuby and WPF with a C# client.</a></li>
<li><a href="http://antoniocangiano.com/" onclick="pageTracker._trackPageview('/outgoing/antoniocangiano.com/?referer=');">Antonio Cangiano</a>&#8217;s post &#8220;<a href="http://antoniocangiano.com/2007/07/26/is-ironruby-mathematically-challenged/" onclick="pageTracker._trackPageview('/outgoing/antoniocangiano.com/2007/07/26/is-ironruby-mathematically-challenged/?referer=');">Is IronRuby mathematically challenged?</a>&#8220;</li>
<li>Seo Sanghyeon has <a href="http://fepy.blogspot.com/2007/07/teaching-ironruby-math-tricks.html" onclick="pageTracker._trackPageview('/outgoing/fepy.blogspot.com/2007/07/teaching-ironruby-math-tricks.html?referer=');">additional ideas about extending IronRuby</a></li>
<li>Miguel de Icaza&#8217;s <a href="http://www.tirania.org/blog/archive/2007/Jul-23-1.html" onclick="pageTracker._trackPageview('/outgoing/www.tirania.org/blog/archive/2007/Jul-23-1.html?referer=');">post</a></li>
<li>Josh Holmes &#8211; <a href="http://www.joshholmes.com/2007/07/28/IronRubyRubyNET.aspx" onclick="pageTracker._trackPageview('/outgoing/www.joshholmes.com/2007/07/28/IronRubyRubyNET.aspx?referer=');">IronRuby = (Ruby + .Net)!</a></li>
<li>Ola Bini &#8211; <a href="http://ola-bini.blogspot.com/2007/07/ironruby-scoop.html" onclick="pageTracker._trackPageview('/outgoing/ola-bini.blogspot.com/2007/07/ironruby-scoop.html?referer=');">The IronRuby scoop</a></li>
<li>Ryan Stewart <a href="http://blogs.zdnet.com/Stewart/?p=464" onclick="pageTracker._trackPageview('/outgoing/blogs.zdnet.com/Stewart/?p=464&amp;referer=');">at ZDNet blogs</a></li>
<p><strong>Additional thoughts</strong></p>
<p>This is a great milestone achieved by John and the team and I would love to see Ruby used to produce full-fledged Windows apps. Given Microsoft&#8217;s horrendous track record at supporting standards, and habit of &#8216;extending&#8217; technologies to extinguish them later on, I want to see where this will go and I am also watching Microsoft&#8217;s sudden embracing of the terms &#8216;Open Source&#8217;.</p>
<p>However, for successful people and teams, history is not a perfect image of the future as they can transcend that. </p>
<p>John&#8217;s work on RubyCLR previously and IronRuby for the DLR today is testament to his great hacking skills and success at integrating Ruby and the .Net framework.</p>
<p>Well done, John.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2007%2F07%2F27%2Fhacking-ironruby%2F&amp;linkname=Hacking%20IronRuby" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2007_2F07_2F27_2Fhacking-ironruby_2F_amp_linkname=Hacking_20IronRuby&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2007/07/27/hacking-ironruby/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>How to enable two-way synchronization of Google Calendar with Thunderbird and Lightning</title>
		<link>http://www.yashlabs.com/wp/2007/06/30/how-to-enable-two-way-synchronization-of-google-calendar-with-thunderbird-and-lightning/</link>
		<comments>http://www.yashlabs.com/wp/2007/06/30/how-to-enable-two-way-synchronization-of-google-calendar-with-thunderbird-and-lightning/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 16:55:45 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=119</guid>
		<description><![CDATA[With the release of the latest version of the open-source calendaring application Sunbird, Mozilla has also released the Thunderbird extension Lightning. 
Until now it wasn&#8217;t really possible to have two-way synchronization of your local Lightning calendar with Google Calendar. In this post, I show you how to do this so that an event added or [...]]]></description>
			<content:encoded><![CDATA[<p><!--adsense--><a href="http://www.yashlabs.com/wp/wp-content/GoogleCalendar_syncs_ThunderbirdLightning.JPG"><img hspace=10 vspace=10 border=0 align="left" src="http://www.yashlabs.com/wp/wp-content/_GoogleCalendar_syncs_ThunderbirdLightning.JPG" width="250" height="117" alt="Google Calendar synced with Thunderbird and Lightning" title="Google Calendar synced with Thunderbird and Lightning"  /></a>With the release of the latest version of the open-source calendaring application <a href="http://www.mozilla.org/projects/calendar/sunbird/" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.org/projects/calendar/sunbird/?referer=');">Sunbird</a>, <a href="http://www.mozilla.org" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.org?referer=');">Mozilla</a> has also released the <a href="http://www.mozilla.com/en-US/thunderbird/" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.com/en-US/thunderbird/?referer=');">Thunderbird</a> extension <a href="http://www.mozilla.org/projects/calendar/lightning/" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.org/projects/calendar/lightning/?referer=');">Lightning</a>. </p>
<p>Until now it wasn&#8217;t really possible to have two-way synchronization of your local Lightning calendar with <a href="http://www.google.com/" onclick="pageTracker._trackPageview('/outgoing/www.google.com/?referer=');">Google Calendar</a>. In this post, I show you how to do this so that an event added or edited in Google Calendar will appear in Lightning, and vice versa automatically. For Windows XP you should apply the XP timezone patch, but for all other Operating Systems, like Mac OS and Linux, the steps should work the same.</p>
<p><strong>Requirements:</strong></p>
<p>1. If you have Windows XP: <a href="http://support.microsoft.com/kb/931836" onclick="pageTracker._trackPageview('/outgoing/support.microsoft.com/kb/931836?referer=');">XP timezone patch</a> </p>
<p>2. <a href="http://www.google.com/" onclick="pageTracker._trackPageview('/outgoing/www.google.com/?referer=');">Google Calendar</a></p>
<p>3. Mozilla <a href="http://www.mozilla.com/en-US/thunderbird/" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.com/en-US/thunderbird/?referer=');">Thunderbird</a> &#8211; The best open-source email program.</p>
<p>4. <a href="https://addons.mozilla.org/en-US/thunderbird/addon/4631" onclick="pageTracker._trackPageview('/outgoing/addons.mozilla.org/en-US/thunderbird/addon/4631?referer=');">Provider for Google Calendar</a> add-on</p>
<p>5. <a href="http://www.mozilla.org/projects/calendar/lightning/download.html" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.org/projects/calendar/lightning/download.html?referer=');">Lightning</a>  &#8211; Thunderbird calendar add-on</p>
<p>Install the timezone patch if necessary. If you already have Thunderbird and a Google Calendar account, then:</p>
<p>1. Download and install the Provider for Google Calendar add-on for Thunderbird</p>
<p>2. Download and install the latest Lightning add-on for Thunderbird</p>
<p>To do these two steps above, you must:</p>
<blockquote><p>
a. Right-click and save the extension in a local folder</p>
<p>b. In Thunderbird, go to Tools->add-ons</p>
<p>c. Click on the lower left &#8220;Install&#8230;&#8221; button and then find the two add-on files you saved (with the .xpi extension)</p></blockquote>
<p>Once the extensions are installed, check whether Lightning has correctly determined your timezone, and if not, set it manually in Thunderbird: </p>
<p>Tools->options->Lightning->Timezone tab</p>
<li>Now, log into your Google Calendar and choose the calendar (if you have more than one) you want to sync with. Add some new test events if you wish.</li>
<li>On the lower left pane next to your calendar, click the blue down arrow, and select Calendar Settings.</li>
<li>On the settings page, go down to your Private address and click the orange XML button.</li>
<li>Right-click on the address shown in the new window and Copy Link Location.</li>
<li>In Thunderbird&#8217;s lower left pane, click on the Calendars tab, and then click on the New&#8230; button.</li>
<li>Select &#8220;On the Network&#8221; in the new window which appears. Click Next&#8230;</li>
<li>Select &#8220;Google Calendar&#8221;, and then paste the private address you copied into the Location entry. Click Next.</li>
<li>Give a name to your Calendar and choose a color. Click Finish.</li>
<li>Enter your password for your Google Calendar account and check the box so that Password Manager remembers it.</li>
<p>You should find your events appear magically in Thunderbird.</p>
<p>Now try adding a new event in Thunderbird and Reload the Google Calendar page in your browser. Then, try editing an entry in Thunderbird and Reload the page in Google Calendar.</p>
<p>There you go, two-way sync between Thunderbird and Lightning and Google Calendar!</p>
<p>Now, when you see an interesting event on <a href="http://upcoming.yahoo.com/" onclick="pageTracker._trackPageview('/outgoing/upcoming.yahoo.com/?referer=');">Upcoming</a> or any other site which uses microformats, you can easily add that event to your Google Calendar with a single click, thanks to Firefox and the Operator add-on. If not, read my previous post on <a href="http://www.yashlabs.com/wp/?p=75">Enhancing calendar scheduling with Microformats</a>.</p>
<p>Once you&#8217;ve done that, your event is both in Google Calendar (so that you can check your calendar from any online computer) and in Thunderbird (so that you can check your calendar even when offline).</p>
<p>The world just got a whole lot better.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2007%2F06%2F30%2Fhow-to-enable-two-way-synchronization-of-google-calendar-with-thunderbird-and-lightning%2F&amp;linkname=How%20to%20enable%20two-way%20synchronization%20of%20Google%20Calendar%20with%20Thunderbird%20and%20Lightning" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2007_2F06_2F30_2Fhow-to-enable-two-way-synchronization-of-google-calendar-with-thunderbird-and-lightning_2F_amp_linkname=How_20to_20enable_20two-way_20synchronization_20of_20Google_20Calendar_20with_20Thunderbird_20and_20Lightning&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2007/06/30/how-to-enable-two-way-synchronization-of-google-calendar-with-thunderbird-and-lightning/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>The Internet is my Tech TV, Conference and University</title>
		<link>http://www.yashlabs.com/wp/2007/03/13/the-internet-is-my-tech-tv-conference-and-university/</link>
		<comments>http://www.yashlabs.com/wp/2007/03/13/the-internet-is-my-tech-tv-conference-and-university/#comments</comments>
		<pubDate>Wed, 14 Mar 2007 04:17:04 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=85</guid>
		<description><![CDATA[We have the best software to convert pdf to word documents as well as pdf to excel. Our server side PDF converter makes it easty to convert and create PDF files  at Investintech.com
TV:
1. MIT World Videos
Filmed presentations from the MIT School of Engineering professional education program. The public debate between Ray Kurzweil and David [...]]]></description>
			<content:encoded><![CDATA[<p style="font-size:0.8em">We have the best software to <a href="http://www.investintech.com/prod_a2d.htm" onclick="pageTracker._trackPageview('/outgoing/www.investintech.com/prod_a2d.htm?referer=');">convert pdf to word</a> documents as well as <a href="http://www.investintech.com/able2extract.html" onclick="pageTracker._trackPageview('/outgoing/www.investintech.com/able2extract.html?referer=');">pdf to excel</a>. Our server side <a href="http://www.utexas.edu/ogs/etd/pdf/converters.html" onclick="pageTracker._trackPageview('/outgoing/www.utexas.edu/ogs/etd/pdf/converters.html?referer=');">PDF converter</a> makes it easty to convert and <a href="https://ritdml.rit.edu/dspace/help/converttopdf.jsp" onclick="pageTracker._trackPageview('/outgoing/ritdml.rit.edu/dspace/help/converttopdf.jsp?referer=');">create PDF files</a>  at <a href="http://www.investintech.com" onclick="pageTracker._trackPageview('/outgoing/www.investintech.com?referer=');">Investintech.com</a></p>
<p><strong>TV</strong>:</p>
<p>1. <a href="http://mitworld.mit.edu/video_index.php" onclick="pageTracker._trackPageview('/outgoing/mitworld.mit.edu/video_index.php?referer=');">MIT World Videos</a></p>
<p>Filmed presentations from the MIT School of Engineering professional education program. The public debate between Ray Kurzweil and David Gelertner about AI was interesting.</p>
<p>2. <a href="http://ted.com/tedtalks/" onclick="pageTracker._trackPageview('/outgoing/ted.com/tedtalks/?referer=');">TED Talks</a></p>
<p>Clips of past talks at the <a href="http://ted.com/" onclick="pageTracker._trackPageview('/outgoing/ted.com/?referer=');">TED</a> Technology-Entertainment-Design yearly conference.</p>
<p>Hans Rosling&#8217;s presentation is fantastic. He shows how information is still hidden beneath our usual file formats and in various databases, and demonstrates new ways of revealing and analyzing this information. I was happily surprised to see Mauritius feature prominently way up there on the right of a graph. </p>
<p>You can find more information at the <a href="http://gapminder.org/" onclick="pageTracker._trackPageview('/outgoing/gapminder.org/?referer=');">GapMinder</a> site and interact with the interface which accesses the data at <a href="http://tools.google.com/gapminder/" onclick="pageTracker._trackPageview('/outgoing/tools.google.com/gapminder/?referer=');">Google&#8217;s GapMinder World 2006 Tool</a>.</p>
<p>3. <a href="http://www.bestechvideos.com/" onclick="pageTracker._trackPageview('/outgoing/www.bestechvideos.com/?referer=');">Best Tech Videos</a></p>
<p>All sorts of Technology-related videos including clips of conferences, including Google&#8217;s TechTalks or EngEdu as they&#8217;re tagged on Google Video.</p>
<p>4. <a href="http://video.google.com/videosearch?q=documentary" onclick="pageTracker._trackPageview('/outgoing/video.google.com/videosearch?q=documentary&amp;referer=');">Google Video &#8211; Documentaries</p>
<p></a><strong>University</strong>:</p>
<p>1. <a href="http://ocw.mit.edu/index.html" onclick="pageTracker._trackPageview('/outgoing/ocw.mit.edu/index.html?referer=');">MIT OpenCourseWare</a></p>
<p>It is expected that by the end of 2007, all the courses by MIT will be available online freely. That&#8217;s going to be historical.</p>
<p>2. <a href="http://webcast.berkeley.edu/courses.php?semesterid=22" onclick="pageTracker._trackPageview('/outgoing/webcast.berkeley.edu/courses.php?semesterid=22&amp;referer=');">University of California &#8211; Berkeley Webcasts</a></p>
<p>Videos and podcasts from UC Berkeley.</p>
<p>3. <a href="http://en.wikiversity.org/wiki/Main_Page" onclick="pageTracker._trackPageview('/outgoing/en.wikiversity.org/wiki/Main_Page?referer=');">Wikiversity</a></p>
<p>A free learning collaborative resource for the masses, by the masses.</p>
<p>4. <a href="http://showmedo.com/" onclick="pageTracker._trackPageview('/outgoing/showmedo.com/?referer=');">ShowMeDo</a></p>
<p>Tutorials in screencast form or videos.</p>
<p>In <a href="http://www.yashlabs.com/wp/?p=36">a previous post</a>, I had mentioned that you could watch PBS&#8217; Nova online.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2007%2F03%2F13%2Fthe-internet-is-my-tech-tv-conference-and-university%2F&amp;linkname=The%20Internet%20is%20my%20Tech%20TV%2C%20Conference%20and%20University" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2007_2F03_2F13_2Fthe-internet-is-my-tech-tv-conference-and-university_2F_amp_linkname=The_20Internet_20is_20my_20Tech_20TV_2C_20Conference_20and_20University&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2007/03/13/the-internet-is-my-tech-tv-conference-and-university/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enhance your Calendar scheduling with Microformats.</title>
		<link>http://www.yashlabs.com/wp/2007/03/06/enhance-your-calendar-scheduling-with-microformats/</link>
		<comments>http://www.yashlabs.com/wp/2007/03/06/enhance-your-calendar-scheduling-with-microformats/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 20:30:38 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=75</guid>
		<description><![CDATA[Have you missed some event lately because the information about events is dispersed and fragmented and it&#8217;s boring to have to type things in your calendar? 
I will show you how to improve the scheduling of activities in an online calendar by automating much of this process by using Microformats.
Microformats enable machine readability but additionally [...]]]></description>
			<content:encoded><![CDATA[<p><img vspace="15" hspace="15" border="0" align="left" src="http://www.yashlabs.com/wp/wp-content/microformats.jpg" width="144" height="36" alt="microformats logo" title="microformats logo" /><!--adsense-->Have you missed some event lately because the information about events is dispersed and fragmented and it&#8217;s boring to have to type things in your calendar? </p>
<p>I will show you how to improve the scheduling of activities in an online calendar by automating much of this process by using <a href="http://microformats.org/wiki/what-are-microformats" onclick="pageTracker._trackPageview('/outgoing/microformats.org/wiki/what-are-microformats?referer=');">Microformats</a>.</p>
<p>Microformats enable machine readability but additionally add meaning to chunks of text and other data. That means that these chunks of information also become machine &#8216;understandable&#8217;. In turn, this leads to automated processing of semantically useful data.</p>
<p>The implications for building an Artificial Intelligence with the Semantic Web are staggering but in the meantime, I just want to tell you about a practical application of Microformats which is useful today itself, namely how to make good use of the <a href="http://microformats.org/wiki/hcalendar" onclick="pageTracker._trackPageview('/outgoing/microformats.org/wiki/hcalendar?referer=');">hCalendar Microformat</a>.</p>
<p><strong>What you should use:</strong><br />
1. <a href="http://www.mozilla.com/en-US/" onclick="pageTracker._trackPageview('/outgoing/www.mozilla.com/en-US/?referer=');">Firefox</a>. You are using Mozilla&#8217;s Open-Source Firefox, aren&#8217;t you? If not download it.</p>
<p>2. <a href="https://addons.mozilla.org/firefox/4106/" onclick="pageTracker._trackPageview('/outgoing/addons.mozilla.org/firefox/4106/?referer=');">Operator</a>. A Firefox extension or addon by <a href="http://www.kaply.com/weblog/2007/02/21/operator-source-code-is-finally-available/trackback/" onclick="pageTracker._trackPageview('/outgoing/www.kaply.com/weblog/2007/02/21/operator-source-code-is-finally-available/trackback/?referer=');">Michael Kaply</a> of <a href="http://www.ibm.com/" onclick="pageTracker._trackPageview('/outgoing/www.ibm.com/?referer=');">IBM</a>, which detects Microformats and enables you to act on them. Install it and restart Firefox and restore your session to come back here. Michael just opened up Operator&#8217;s source code. Thanks for that and for Operator Michael.</p>
<p>3. <a href="http://www.google.com/calendar" onclick="pageTracker._trackPageview('/outgoing/www.google.com/calendar?referer=');">Google Calendar</a>. Get an account with Google and login.</p>
<p>4. <a href="http://upcoming.org/" onclick="pageTracker._trackPageview('/outgoing/upcoming.org/?referer=');">Upcoming.org</a>. Yahoo&#8217;s event site which has support for Microformats.</p>
<p>On installing Operator and relaunching Firefox, you should have a new thin toolbar. Mine shows: [Export Contact | Google Calendar | Google Maps | Flickr | Del.icio.us | Technorati]</p>
<p>Now, head to upcoming.org and as search tags, type in, for instance, &#8216;Montreal&#8217;. This should list all events locally. It would be much more helpful if upcoming.org also provided Microformats on this list of events but currently it doesn&#8217;t.</p>
<p><a href="http://www.yashlabs.com/wp/wp-content/MTEBfast.jpg"><img src="http://www.yashlabs.com/wp/wp-content/_MTEBfast.jpg" width="250" height="167" alt="MTEBFast II" title="MTEBFast II" class='centered' /></a></p>
<p>Click one of these events. For this example, I chose the forthcoming <a href="http://www.instigatorblog.com/montreal-tech-entrepreneur-meetup-a-success/2007/02/14/" onclick="pageTracker._trackPageview('/outgoing/www.instigatorblog.com/montreal-tech-entrepreneur-meetup-a-success/2007/02/14/?referer=');">Montreal Tech Entrepreneur Breakfast</a> II launched by <a href="http://www.instigatorblog.com/" onclick="pageTracker._trackPageview('/outgoing/www.instigatorblog.com/?referer=');">Ben Yoskovitz</a>. </p>
<p><a href="http://www.yashlabs.com/wp/wp-content/GoogleCal.jpg"><img src="http://www.yashlabs.com/wp/wp-content/_GoogleCal.jpg" width="214" height="250" alt="GoogleCal1" title="GoogleCal1"  class='centered'/></a></p>
<p>Operator detects the hCalendar Microformat content and add &#8220;(1)&#8221; next to the [Google Calendar] button among other things.</p>
<p><a href="http://www.yashlabs.com/wp/wp-content/GoogleCal2.jpg"><img src="http://www.yashlabs.com/wp/wp-content/_GoogleCal2.jpg" width="234" height="250" alt="GoogleCal 2" title="GoogleCal 2" class='centered' /></a></p>
<p>Click on this button and the events information is automatically added to Google calendar&#8217;s event form. You can then save the event into your calendar.</p>
<p>VoilÃ . You now have a way to rapidly find and integrate events within your online Calendar with nothing to type &#8211; just clicks.</p>
<p>Now, it would be more interesting if people blogging about events would take the time to add Microformats to the information. One way to do this is to use the <a href="http://microformats.org/code/hcalendar/creator" onclick="pageTracker._trackPageview('/outgoing/microformats.org/code/hcalendar/creator?referer=');">hCalendar Creator</a> by <a href="http://theryanking.com/blog/" onclick="pageTracker._trackPageview('/outgoing/theryanking.com/blog/?referer=');">Ryan King</a>, based on previous work by <a href="http://tantek.com/" onclick="pageTracker._trackPageview('/outgoing/tantek.com/?referer=');">Tantek Ã‡elik</a>. It also automatically add tags so that you can found similar events on <a href="http://www.eventful.com/" onclick="pageTracker._trackPageview('/outgoing/www.eventful.com/?referer=');">eventful.com</a>, another web service which is also using Microformats. Similarly here, Eventful does not provide the Microformat information in the list view.</p>
<p>Check <a href="http://www.yashlabs.com/wp/?p=70">my past post about DemoCampMontreal1</a>. Operator detects it immediately because that informative chunk of text was microformatted with hCalendar information by using the hCalendar creator.</p>
<p>You can read more about Operator on Michael&#8217;s blog and on the <a href="http://labs.mozilla.com/2006/12/introducing-operator/" onclick="pageTracker._trackPageview('/outgoing/labs.mozilla.com/2006/12/introducing-operator/?referer=');">Mozilla blog</a>.</p>
<p><script type="text/javascript">
digg_url = "http://www.yashlabs.com/wp/?p=75";
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2007%2F03%2F06%2Fenhance-your-calendar-scheduling-with-microformats%2F&amp;linkname=Enhance%20your%20Calendar%20scheduling%20with%20Microformats." onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2007_2F03_2F06_2Fenhance-your-calendar-scheduling-with-microformats_2F_amp_linkname=Enhance_20your_20Calendar_20scheduling_20with_20Microformats.&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2007/03/06/enhance-your-calendar-scheduling-with-microformats/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>One-hour Ruby &#8211; Part 5: Classes and Modules</title>
		<link>http://www.yashlabs.com/wp/2006/05/18/one-hour-ruby-part-5-classes-and-modules/</link>
		<comments>http://www.yashlabs.com/wp/2006/05/18/one-hour-ruby-part-5-classes-and-modules/#comments</comments>
		<pubDate>Thu, 18 May 2006 13:29:46 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=51</guid>
		<description><![CDATA[In this section, we&#8217;ll see how to write classes in Ruby. We will also see how Ruby helps greatly to reduce class development time thanks to symbols. And lastly, we will see how to reuse our classes.
Note here that I am not covering object-oriented principles. I assume you are already somewhat familiar with these.
5.1 Creating [...]]]></description>
			<content:encoded><![CDATA[<p>In this section, we&#8217;ll see how to write classes in Ruby. We will also see how Ruby helps greatly to reduce class development time thanks to symbols. And lastly, we will see how to reuse our classes.</p>
<p>Note here that I am not covering object-oriented principles. I assume you are already somewhat familiar with these.</p>
<p><strong>5.1 Creating Classes and Accessing Internal Variables</strong></p>
<p>We will create a simple Car class in Ruby with an internal variable for its brand. Note that the class name must begin with a capital letter.</p>
<p>In your favourite editor, type the following:</p>
<p><code lang="python">class Car<br />
   def initialize(brandname)<br />
     @brand = brandname<br />
   end<br />
end</code></p>
<p>Now that we&#8217;ve written the contents for the initialize method, you can create new car objects by passing an initial argument for the brand:</p>
<p><code lang="python">myCar = Car.new("Lamborghini")</code> or <code lang="python">myCar2 = Car.New "Lamborghini"</code></p>
<p>Now, note here that because of encapsulation (an important principle in Object-Oriented programming), the internal variable @brand of your object is not directly accessible.</p>
<p>You cannot yet type:<br />
1. To access the value: <code lang="python">puts myCar.brand</code><br />
nor<br />
2. To write a new value into it: <code lang="python">myCar.brand = "Vektor"<br />
</code><br />
Before you can do this in any OO language, you must write what are called &#8220;getter&#8221; and &#8220;setter&#8221; methods. For example, in the above Car class, we would write a getter method for the brand thus:</p>
<p><code lang="python">def brand<br />
   return @brand #This is a comment: in fact, you could even omit the return keyword ;p<br />
end</code></p>
<p>Try it in your IDE (add this &#8220;getter&#8221; method after the initialize one) and see that this time around, you can get the brand name by invoking: puts myCar.brand</p>
<p>Similarly, for the &#8220;setter&#8221; method, we would add this to the class:<br />
<code lang="python">def brand= (brandname)<br />
   @brand = brandname<br />
end</code></p>
<p>Add the above to your Car class and try it by changing the brand of myCar:<br />
<code lang="python">myCar.brand = "Vektor"<br />
puts myCar.brand</code></p>
<p>So, your Car class should now look like this:<br />
<code lang="python">class Car<br />
   def initialize(brandname)<br />
     @brand = brandname<br />
   end</p>
<p>   def brand<br />
     return @brand<br />
   end</p>
<p>   def brand= (brandname)<br />
     @brand = brandname<br />
   end<br />
end</code></p>
<p><strong>5.2 Attribute Symbols: Ruby&#8217;s shortcuts for Rapid Development and Prototyping</strong></p>
<p>Now, it would be more interesting if we could input a more complete set of details about our cars. Let&#8217;s say we would like also to be able to get and set the Model, the Year, the Colour, the Maximum speed, etc&#8230; But this entails having to write a getter method and a setter method for each of these attributes! Not very interesting, isn&#8217;t it? Time-consuming? Certainly!</p>
<p>In Ruby there is a shortcut that allows us to do the same thing but much more rapidly and succinctly.</p>
<p>In your Car class, instead of writing the getter method, just type this:<br />
attr_reader :brand</p>
<p>This makes :brand a symbol which will be expanded internally and automatically into a getter method for you! attr_reader specifies that the internal variable @brand will be read only.</p>
<p>Similarly, the setter method is written thus:<br />
attr_writer :brand</p>
<p>Fantastic isn&#8217;t it? No need to write those pesky getter and setter methods.</p>
<p>So now, your Car class would rather be:</p>
<p><code lang="python">class Car<br />
   def initialize(brandname)<br />
     @brand = brandname<br />
   end</p>
<p>   attr_reader :brand<br />
   attr_writer :brand<br />
end</code></p>
<p>But wouldn&#8217;t it be interesting if we also had another way to easily specify that several attributes should be both readable and writable?</p>
<p>Another shortcut does just that in Ruby: attr_accessor</p>
<p>Therefore, here is how to rapidly prototype a class in Ruby:<br />
<code lang="python">class Car<br />
  attr_accessor :brand, :model, :year, :colour, :maxspeed   </p>
<p>  def initialize(brandname, modelname, year, colour, maxspeed)<br />
    @brand = brandname<br />
    @model = nodelname<br />
    @year = year<br />
    @colour = colour<br />
    @maxspeed = maxspeed<br />
  end<br />
end</code></p>
<p>or if you don&#8217;t need to initialize your object with values right away, simply:<br />
<code lang="python">class Car<br />
   attr_accessor :brand, :model, :year, :colour, :maxspeed<br />
end</code></p>
<p>Now, to use this Car class you would simply type:<br />
<code lang="python">myCar3 = Car.new</code></p>
<p>and then, you could manipulate its attributes like brand and model as usual:<br />
<code lang="python">myCar3.brand = "Vektor"</code></p>
<p>Can you see how symbols help to drastically reduce design and development time in Ruby as compared to other languages?</p>
<p><strong>5.3 Reusing classes as modules</strong></p>
<p>Let&#8217;s assume that you wrote a great Person class and that several of your programs must use this class. It is good practice to reuse your existing code (er&#8230; especially if it is GOOD code, ok?).</p>
<p>Ruby provide an easy way to do just this.</p>
<p>Just save your Person class as person.rb. Then, when you wish to reuse that class in any new program, you invoke the file which contains the Person class fist, and subsequently use the class as you would normally:<br />
<code lang="python"><br />
require "person.rb" # Note I am assuming the person.rb file<br />
                         # is in the same directory as your new program</p>
<p>p1= Person.new<br />
</code><br />
Try it with your Car class, for instance. </p>
<p>Note that if you have many constants and classes that you want to reuse, then use the &#8216;module&#8217; and &#8216;end&#8217; keywords to enclose all these into a reusable file.</p>
<p>This concludes the introduction to Ruby. You do not need classes to write Ruby scripts, but if you do you will find that your code is better, more readable and maintainable. In other words, you will be benefiting from all the advantages of Object-Oriented programming.</p>
<p>If you have come this far, I urge you to continue to explore programming in Ruby by perusing the various resources on the web. You can access a free version of the â€œPickaxeâ€? book online and also â€œWhy&#8217;s poignant guide to Rubyâ€?, replete with fox cartoons.</p>
<p>When you are comfortable with Ruby programing, you can also try your hand at Ruby on Rails, the fantastic framework for easily developing database-driven web-applications.</p>
<p>Happy programming with Ruby!</p>
<p><!--adsense#chitika--></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2006%2F05%2F18%2Fone-hour-ruby-part-5-classes-and-modules%2F&amp;linkname=One-hour%20Ruby%20%26%238211%3B%20Part%205%3A%20Classes%20and%20Modules" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2006_2F05_2F18_2Fone-hour-ruby-part-5-classes-and-modules_2F_amp_linkname=One-hour_20Ruby_20_26_238211_3B_20Part_205_3A_20Classes_20and_20Modules&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2006/05/18/one-hour-ruby-part-5-classes-and-modules/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One-hour Ruby &#8211; Part 4: Looping and Branching</title>
		<link>http://www.yashlabs.com/wp/2006/05/18/one-hour-ruby-part-4-looping-and-branching/</link>
		<comments>http://www.yashlabs.com/wp/2006/05/18/one-hour-ruby-part-4-looping-and-branching/#comments</comments>
		<pubDate>Thu, 18 May 2006 13:12:24 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=50</guid>
		<description><![CDATA[4.1 Looping
Note: a range in Ruby is denoted this way: 2..5 (from 2 to 5).
a. The for loop:
for i in 2..5
   puts i
end
IRB faithfully gives you 2, 3, 4 and 5. Note the in keyword here. Also note that the for loop in Ruby ends with end and not next as in BASIC.
b. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>4.1 Looping</strong></p>
<p>Note: a range in Ruby is denoted this way: 2..5 (from 2 to 5).</p>
<p><strong>a. The for loop:</strong></p>
<p><code lang="python">for i in 2..5<br />
   puts i<br />
end</code></p>
<p>IRB faithfully gives you 2, 3, 4 and 5. Note the in keyword here. Also note that the for loop in Ruby ends with end and not next as in BASIC.</p>
<p><strong>b. Using <number>.times:</number></strong></p>
<p>In IRB, type: <code>3.times {puts "I get it!"}</code></p>
<p>The sentence is output three times as expected. Nifty loop instruction, isn&#8217;t it? Note here that I am using {} to delimit a code block of a single line. For blocks with more than one line, use do and end as in the example below.</p>
<p><strong>c. The while loop:</strong></p>
<p><code lang="python">i=10<br />
while i>0 do<br />
   puts i<br />
   i -= 1<br />
end</code></p>
<p>IRB outputs all values of i from 10 to 1. Note here the use of  do and end to delimit the code block for the loop as there are several instructions. Also, see that Ruby enables &#8216;i-=1&#8242;, which equivalent to &#8220;i=i-1&#8243;, just as in C/C++. Both are correct in Ruby.</p>
<p><strong>d. Iteration</strong></p>
<p>You can easily iterate through the elements of an array using the &#8216;each&#8217; method. In IRB, try:</p>
<p><code>a=["A", "B", "C"]<br />
a.each {|x| puts x}</code></p>
<p>IRB prints out all elements of the array a in turn. Note here the use of | |. This defines a type of assignment for the element at each iteration so as to process it right afterwards. i.e. on the first execution of the loop, x gets assigned &#8220;A&#8221;, and this is printed out. Then, thanks to &#8216;each&#8217;, the next element of the array, â€œBï¿½?, is assigned and processed.</p>
<p><strong>Q: What do you think is the method for iterating the elements of a Hash?</strong></p>
<p>There are other ways of looping in Ruby, so have a look at the documentation should you need other constructs.</p>
<p><strong>4.2 Branching</strong></p>
<p><strong>a. The if conditional</strong></p>
<p>In IRB, type:<br />
<code lang="python">i=10<br />
if i==10<br />
   puts i<br />
end</code></p>
<p>IRB outputs 10. </p>
<p>Note the difference, just as in C/C++ between assigning a value to i (i=10), and testing whether i is equal to 10 (i==10).</p>
<p>There is a shorter version of &#8220;if&#8221; in Ruby, but use it for short lines:</p>
<p><code><br />
  puts "Everything is all right!" if (2+2 == 4)<br />
</code></p>
<p>Now try:<br />
<code lang="python">if i==5<br />
  puts i<br />
elsif<br />
  puts i*i<br />
end</code></p>
<p>You should see 100. Note the <strong>elsif</strong> keyword, NOT &#8216;elif&#8217; nor &#8216;elseif&#8217;.</p>
<p><strong>b. The case-when-else conditional</strong></p>
<p>This expression is especially useful in a loop where the parameter tested changes. But I&#8217;ll show only the syntax for two or three tests here:</p>
<p><code lang="python">case i<br />
  when 10<br />
    puts i<br />
  when 5<br />
    puts i*i<br />
  else<br />
    puts "unknown"<br />
end</code></p>
<p>IRB shows 10. Try i=5 and then the same code to get 25. Also, try another value not included in the case statement and get &#8220;unknown&#8221;.</p>
<p>With the knowledge you have, you can already write a plethora of useful programs. Practice building simple or bigger programs with the information you have learned up to now.</p>
<p><a href="http://www.yashlabs.com/wp/?p=51">Part 5</a></p>
<p><!--adsense#chitika--></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2006%2F05%2F18%2Fone-hour-ruby-part-4-looping-and-branching%2F&amp;linkname=One-hour%20Ruby%20%26%238211%3B%20Part%204%3A%20Looping%20and%20Branching" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2006_2F05_2F18_2Fone-hour-ruby-part-4-looping-and-branching_2F_amp_linkname=One-hour_20Ruby_20_26_238211_3B_20Part_204_3A_20Looping_20and_20Branching&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2006/05/18/one-hour-ruby-part-4-looping-and-branching/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One-hour Ruby &#8211; Part 2: Basic Input/Output</title>
		<link>http://www.yashlabs.com/wp/2006/05/17/introduction-to-ruby-part-2-basic-inputoutput/</link>
		<comments>http://www.yashlabs.com/wp/2006/05/17/introduction-to-ruby-part-2-basic-inputoutput/#comments</comments>
		<pubDate>Wed, 17 May 2006 08:17:26 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=48</guid>
		<description><![CDATA[Part 2: Basic Input/Output
In this second installment, I describe basic input and output operations in Ruby, and especially some issue that can stump a newbie on Windows.
In the first part, I recommended RDE as a learning IDE because of Autocomplete (it also has syntax highlighting). IRB, the interactive Ruby shell is also a great way [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Part 2: Basic Input/Output</strong></p>
<p>In this second installment, I describe basic input and output operations in Ruby, and especially some issue that can stump a newbie on Windows.</p>
<p>In the first part, I recommended RDE as a learning IDE because of Autocomplete (it also has syntax highlighting). IRB, the interactive Ruby shell is also a great way to learn. It comes with your Ruby installation in the bin directory.</p>
<p>In Ruby, you can output using puts or print. Typically, puts will also operate a carriage return/newline and puts will not.</p>
<p>1. puts &#8220;Hello, World!&#8221; works, just as puts &#8216;Hello, World&#8217;. Print &#8220;Hello, World!\n&#8221; is another way of doing the same thing.</p>
<p>2. In Ruby, strings are concatenated with the + sign. Print &#8220;Hello&#8221; + &#8220;World!&#8221; is similar to the above.</p>
<p>3. If you want to concatenate and also output a numerical value, you usually have to use the .to_s method. i.e. print &#8220;five=&#8221; + 5.to_s.<br />
.to_s means convert to string.</p>
<p>4. There is a nice shortcut for variable substitution in Ruby. Let&#8217;s say you have a variable, age which is equal to 25. Then, print &#8220;His age is #{age}&#8221; will evaluate the age variable and substitute it into the string as soon as the #{ is encountered by the interpreter.</p>
<p>You can do input in Ruby using the gets command, like in:<br />
<code lang="php">print "Enter your age:"<br />
age = gets<br />
</code><br />
However, there is buffered output in Ruby and you will be surprised or stumped when working with Ruby on Windows, as the previous command will first wait for your entry and then output the print string!</p>
<p>What you can do here is to just turn off the buffered output before anything else using:<br />
<code lang="php">$stdout.sync = true</code></p>
<p>This done, the functioning of Ruby becomes intuitive for the newbie with some performance hit (not important when learning).</p>
<p><a href="http://www.yashlabs.com/wp/?p=49">Part 3</a></p>
<p><!--adsense#chitika--></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2006%2F05%2F17%2Fintroduction-to-ruby-part-2-basic-inputoutput%2F&amp;linkname=One-hour%20Ruby%20%26%238211%3B%20Part%202%3A%20Basic%20Input%2FOutput" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2006_2F05_2F17_2Fintroduction-to-ruby-part-2-basic-inputoutput_2F_amp_linkname=One-hour_20Ruby_20_26_238211_3B_20Part_202_3A_20Basic_20Input_2FOutput&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2006/05/17/introduction-to-ruby-part-2-basic-inputoutput/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One-hour Ruby &#8211; Part 1: Variables</title>
		<link>http://www.yashlabs.com/wp/2006/05/16/introduction-to-ruby-part-1-variables/</link>
		<comments>http://www.yashlabs.com/wp/2006/05/16/introduction-to-ruby-part-1-variables/#comments</comments>
		<pubDate>Tue, 16 May 2006 16:06:35 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=47</guid>
		<description><![CDATA[This is the first part of a quick and easy 5-part tutorial for the Ruby programming language. I initially sent it to Rubidius, the local Ruby User Group I founded, as well as to my Local Linux User Group. It&#8217;s free as in free beer. Learn Ruby in one hour. At least the basics. Seriously, [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first part of a quick and easy 5-part tutorial for the Ruby programming language. I initially sent it to Rubidius, the local Ruby User Group I founded, as well as to my Local Linux User Group. It&#8217;s free as in free beer. Learn Ruby in one hour. At least the basics. Seriously, it will take you about an hour for the whole. Enjoy.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p><strong>One-hour Ruby<br />
An introduction to the Ruby language in 5 easy pieces</strong></p>
<p>by</p>
<p>Josh Nursing</p>
<p><strong>Introduction</strong></p>
<p>	This is a very brief introduction to some of Ruby&#8217;s syntax. This tutorial is designed to get you up and running with Ruby and writing scripts as rapidly as possible. It is not intended as a complete Ruby course nor as a course for Object-oriented principles. You will find it especially useful if you already know programming in some language other than Ruby and want to see how it is to program in Ruby. And it only takes an hour of your spare time.</p>
<p><strong>Part 1: Variables</strong></p>
<p>If you haven&#8217;t yet installed Ruby and would like to try it, it is readily available for Linux, Mac, and Windows: </p>
<p>http://www.ruby-lang.org/en/20020102.html</p>
<p>A nice install for Windows is Curt Hibbs&#8217; one-click installer. It comes with a good IDE called FreeRIDE, but for learning, I recommend RDE as it contains Autocomplete and shows you the methods of a class, etc&#8230;</p>
<p>Let&#8217;s see briefly how variable are declared in Ruby.</p>
<p>In Ruby, part of the syntax denotes the type of locality of a variable.</p>
<p>1. A global variable starts with a $, like in $MaxItems<br />
2. A local variable starts with lowercase, like in myval</p>
<p>Similarly, constants are defined in Ruby by using a name which starts with an UPPERCASE, like PI = 3.141592653 or Pi = 3.141592653.</p>
<p>Note here that we never had to define the actual type of variable. It isn&#8217;t necessary for us to define that $MaxItems is an integer. Ruby will infer this automatically. This saves a lot of time and makes you more productive.</p>
<p>Now, let&#8217;s see the cases of variables when you are writing classes and using objects (instances of classes). </p>
<p>1. A class variable starts with @@, like in @@name<br />
2. An object instance variable starts with @, like in @address</p>
<p>Don&#8217;t worry about classes and objects right now as we&#8217;ll see them again in the last section.</p>
<p><a href="http://www.yashlabs.com/wp/?p=48">Part 2</a><br />
<!--adsense#chitika--></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2006%2F05%2F16%2Fintroduction-to-ruby-part-1-variables%2F&amp;linkname=One-hour%20Ruby%20%26%238211%3B%20Part%201%3A%20Variables" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2006_2F05_2F16_2Fintroduction-to-ruby-part-1-variables_2F_amp_linkname=One-hour_20Ruby_20_26_238211_3B_20Part_201_3A_20Variables&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2006/05/16/introduction-to-ruby-part-1-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Synthesis on the Kurzweil K2000, K2500, K2600 and K2661 synthesizers.</title>
		<link>http://www.yashlabs.com/wp/2005/08/30/advanced-synthesis-on-the-kurzweil-k2000-k2500-k2600-and-k2661-synthesizers/</link>
		<comments>http://www.yashlabs.com/wp/2005/08/30/advanced-synthesis-on-the-kurzweil-k2000-k2500-k2600-and-k2661-synthesizers/#comments</comments>
		<pubDate>Tue, 30 Aug 2005 10:51:25 +0000</pubDate>
		<dc:creator>Yash</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Kurzweil]]></category>
		<category><![CDATA[Synthesizers]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.yashlabs.com/wp/?p=28</guid>
		<description><![CDATA[(c) Josh Nursing
I am a huge fan of the Kurzweil K2 series synthesizers and their seminal V.A.S.T. architecture which is still one of the most powerful synth engines today. 
But with power comes complexity. Hence, as a long-time contributor to the Kurzweil mailing lists for about ten years, I usually teach people how to harness [...]]]></description>
			<content:encoded><![CDATA[<p><strong>(c) Josh Nursing</strong></p>
<p>I am a huge fan of the <strong>Kurzweil</strong> K2 series synthesizers and their seminal V.A.S.T. architecture which is still one of the most powerful synth engines today. </p>
<p>But with power comes complexity. Hence, as a long-time contributor to the Kurzweil mailing lists for about ten years, I usually teach people how to harness the raw synthesis power of these synths. </p>
<p>On the mailing list once, a reader asked if it was possible to re-create sounds that The Prodigy used on their album &#8220;Voodoo People&#8221;. Although somebody else was saying that The Prodigy probably used &#8216;racks of gear&#8217; and that it was impossible to do the same on the Kurzweil K2000, I proceeded to describe step by step a few avenues to explore. The reader replied that during the week-end, he had achieved even better sounds thanks to my advice.</p>
<p>Subsequently, I wrote several advanced tutorials for the Kurzweil synthesizers based on more than 15 years of experience with sound synthesis.</p>
<p>These advanced tutorials for the Kurzweil K2 series synthesizers have been edited from their previous versions and reproduced here. I have added screenshots to make them easier to follow. The screenshots are provided by <strong>YashLabs&#8217; KurView</strong>, a brilliant software remote controller for the Kurzweil K2 series synthesizer.</p>
<p><span id="more-28"></span><br />
<iframe src="http://rcm.amazon.com/e/cm?t=yashlabsmusic-20&#038;o=1&#038;p=15&#038;l=st1&#038;mode=mi&#038;search=kurzweil&#038;fc1=333333&#038;=1&#038;lc1=0066CC&#038;lt1=_top&#038;bg1=FFFFFF&#038;f=ifr" marginwidth="0" marginheight="0" width="468" height="240" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe></p>
<p>The texts were originally called &#8220;Advanced K2000 Programming&#8221; because they went much further than the original Kurzweil manual as well as the existing tutorials by other users at the time.</p>
<p>Readers were enthusiatic about the information these tutorials contain. You can read their comments at the end of this post.</p>
<p>There were three original tutorials targetting mostly the K2000 but the information is valid for other synths like the K2500, K2600 and K2661:<br />
1. <a href="http://www.yashlabs.com/wp/?p=24">Interactive Phrase Sequencing</a><br />
2. <a href="http://www.yashlabs.com/wp/?p=26">Vector Synthesis &#038; WaveSequencing Emulation</a><br />
3. <a href="http://www.yashlabs.com/wp/?p=27">Faking effects</a></p>
<p>I was the winner of an early VAST programmer&#8217;s challenge for a program called &#8220;Evolvers&#8221; based on my ideas about Wave sequencing emulation and received three great samples CDROM from Sweetwater.</p>
<p>And when I wrote the tutorial about Wave Sequencing emulation, a new VAST programmer&#8217;s Challenge was under way with that very same subject! See the comment by Jeffrey Carpenter below.</p>
<p>Enjoy the tutorials.</p>
<p>The Comments are on the next page.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.yashlabs.com%2Fwp%2F2005%2F08%2F30%2Fadvanced-synthesis-on-the-kurzweil-k2000-k2500-k2600-and-k2661-synthesizers%2F&amp;linkname=Advanced%20Synthesis%20on%20the%20Kurzweil%20K2000%2C%20K2500%2C%20K2600%20and%20K2661%20synthesizers." onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save?linkurl=http_3A_2F_2Fwww.yashlabs.com_2Fwp_2F2005_2F08_2F30_2Fadvanced-synthesis-on-the-kurzweil-k2000-k2500-k2600-and-k2661-synthesizers_2F_amp_linkname=Advanced_20Synthesis_20on_20the_20Kurzweil_20K2000_2C_20K2500_2C_20K2600_20and_20K2661_20synthesizers.&amp;referer=');"><img src="http://www.yashlabs.com/wp/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yashlabs.com/wp/2005/08/30/advanced-synthesis-on-the-kurzweil-k2000-k2500-k2600-and-k2661-synthesizers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 2.525 seconds -->
