<?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>Anlek Consulting &#187; Ruby</title>
	<atom:link href="http://anlek.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://anlek.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Mon, 27 Feb 2012 22:49:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>RVM install ruby-1.8.7-p330 fails</title>
		<link>http://anlek.com/2011/01/rvm-install-1-8-7-p330-fails/</link>
		<comments>http://anlek.com/2011/01/rvm-install-1-8-7-p330-fails/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 03:46:49 +0000</pubDate>
		<dc:creator>Andrew Kalek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[readline]]></category>
		<category><![CDATA[Ruby 1.8.7]]></category>
		<category><![CDATA[RVM]]></category>

		<guid isPermaLink="false">http://anlek.com/?p=241</guid>
		<description><![CDATA[Today I&#8217;m thinking of getting back into so good old work and I read there is a new patch to Ruby, version p330. So I figure that RVM (Ruby Version Manager) being so easy and quick to update, I&#8217;d do the good old &#8220;rvm get head, rvm reload, rvm update 1.8.7&#8243; and I&#8217;m off to [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;m thinking of getting back into so good old work and I read there is a new patch to Ruby, version p330. So I figure that <a href="http://rvm.beginrescueend.com/" target="_blank">RVM</a> (Ruby Version Manager) being so easy and quick to update, I&#8217;d do the good old &#8220;rvm get head, rvm reload, rvm update 1.8.7&#8243; and I&#8217;m off to the races.</p>
<p>Well it wasn&#8217;t quite as simple. I ended up with an error:<br />
<code>ruby-1.8.7-p330 - #fetching<br />
ruby-1.8.7-p330 - #extracting ruby-1.8.7-p330 to /Users/andrew/.rvm/src/ruby-1.8.7-p330<br />
ruby-1.8.7-p330 - #extracted to /Users/andrew/.rvm/src/ruby-1.8.7-p330<br />
ruby-1.8.7-p330 - #configuring<br />
ruby-1.8.7-p330 - #compiling<br />
Error running 'make ', please read /Users/andrew/.rvm/log/ruby-1.8.7-p330/make.log<br />
There has been an error while running make. Halting the installation.</code></p>
<p>When I looked into the the make.log, It had this to say:<code><br />
readline.c: In function ‘username_completion_proc_call’:<br />
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)<br />
readline.c:730: error: (Each undeclared identifier is reported only once<br />
readline.c:730: error: for each function it appears in.)</code></p>
<p>So, I figured this was going to take too long to deal with, and moved on to working on my projects. That is till I opened up my project and and did a &#8220;rvm 1.8.7@rails3&#8243; and it come up with:<br />
<code>warn: ruby ruby-1.8.7-p330 is not installed.<br />
To install do: 'rvm install ruby-1.8.7-p330'</code></p>
<p>Great! Now I can&#8217;t upgrade, and I can&#8217;t work with what I have!</p>
<p>Long story short, I figured out that I was missing readline (now I&#8217;m sure I&#8217;ve installed in a long while ago, but I think I was missing the latest version). Also, rvm install readline resulted in an &#8220;<em>Unrecognized command line argument: &#8216;readline&#8217; ( see: &#8216;rvm usage&#8217; )</em>&#8221;</p>
<p>Turns out RVM updated it&#8217;s command to <a href="http://rvm.beginrescueend.com/packages/readline/" target="_blank">install readline</a> to:<br />
<code>rvm package install readline</code></p>
<p><b>Update: (Nov 10, 2011)</b><br />
If you&#8217;re using a newer version of RVM, package has been renamed to pkg, so the command to install readline would be:<br />
<code>rvm pkg install readline</code></p>
<p>However this didn&#8217;t fix my install issue, still got the same error. Luckily I found a <a title="Michael Hartl's tech blog" href="http://blog.mhartl.com/2010/02/19/some-rvm-gotchas/" target="_blank">post</a> that pointed out that my rvm may not know where readline is (odd, as I used rvm to install readline). Running this command allowed me to install it correctly:<br />
<del datetime="2011-01-05T16:46:29+00:00">rvm install 1.8.7 -C &#8211;with-readline-dir=/Users/andrew/.rvm/usr<br />
[Notice: 'andrew' is my username on my mac, yours might be different]</del><br />
<code>rvm install 1.8.7 -C --with-readline-dir=$rvm_path/usr</code></p>
<p>Like always, I&#8217;m hoping this helps some people out.</p>
<p>Let me know if you have any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://anlek.com/2011/01/rvm-install-1-8-7-p330-fails/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Stripping ASCII colour from a ruby string</title>
		<link>http://anlek.com/2010/06/stripping-ascii-colour-from-a-ruby-string/</link>
		<comments>http://anlek.com/2010/06/stripping-ascii-colour-from-a-ruby-string/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 03:35:01 +0000</pubDate>
		<dc:creator>Andrew Kalek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ASCII]]></category>
		<category><![CDATA[RegEx]]></category>

		<guid isPermaLink="false">http://blog.anlek.com/?p=178</guid>
		<description><![CDATA[I spent a few good hours trying to figure out how to strip a coloured ruby string: which comes out as this: &#62;&#62; p t"2 scenarios (e[33m2 undefinede[0m), 7 steps (e[36m2 skippede[0m, e[33m3 undefinede[0m, e[32m2 passede[0m)"=&#62; nil Now I tried to gsub the string and remove the colour using a RegEx like this: &#62; t.gsub(/\e[(d+)m/, [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a few good hours trying to figure out how to strip a coloured ruby string:</p>
<div  style="width:100%;float:left;">
<p><img src="http://blog.anlek.com/wp-content/uploads/2010/06/coloured-ruby-string.jpg" alt="Coloured Ruby String" width="423" height="32" /></p>
</div>
<p>which comes out as this:</p>
<p><code>&gt;&gt; p t<br />"2 scenarios (e[33m2 undefinede[0m), 7 steps (e[36m2 skippede[0m, e[33m3 undefinede[0m, e[32m2 passede[0m)"<br />=&gt; nil</code></p>
<p>Now I tried to gsub the string and remove the colour using a RegEx like this:</p>
<p><code>&gt; t.gsub(/\e[(d+)m/, "")<br /> =&gt; "2 scenarios (e[33m2 undefinede[0m), 7 steps (e[36m2 skippede[0m, e[33m3 undefinede[0m, e[32m2 passede[0m)"</code></p>
<p>But as you can see, nothing changed. After reading a whole lot of docs on Ruby, Googling around and reading the Ruby String class I came to this conclusion:</p>
<p><code>&gt;&gt; b = "e[33m"<br />=&gt; "e[33m"<br />&gt;&gt; b.each_byte{|c| puts c}<br />27<br />91<br />51<br />51<br />109<br />=&gt; "e[33m"<br />&gt;&gt; "" &lt;&lt; 27 #The only way I know how to add ASCII codes to string<br />=&gt; "e"<br /></code></p>
<p>Now what this allowed me to do is figured out the ASCII code for the e character. However because normally you escape the back slash on regular expressions, once I figured out e was a valid character, I got this:</p>
<p><code>&gt;&gt; "e[33m".gsub(/e[(d+)m/, '')<br /> =&gt; ""</code></p>
<p>I hope this saves someone a few hours!</p>
]]></content:encoded>
			<wfw:commentRss>http://anlek.com/2010/06/stripping-ascii-colour-from-a-ruby-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing/Updating SQLite3 on Windows</title>
		<link>http://anlek.com/2008/09/installing-updating-sqlite3-on-windows/</link>
		<comments>http://anlek.com/2008/09/installing-updating-sqlite3-on-windows/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 15:29:52 +0000</pubDate>
		<dc:creator>Andrew Kalek</dc:creator>
				<category><![CDATA[gem]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://blog.anlek.com/?p=25</guid>
		<description><![CDATA[Installing SQLite3 DLL To install SQLite3 in windows you require not only the gem but a DLL files in your system PATH (or in your windows/system32 folder). To obtain the DLL, go to: http://www.sqlite.org/download.html I always believe that DLLs belong in the windows/system32 folder but as long as you put yours somewhere where your PATH [...]]]></description>
			<content:encoded><![CDATA[<h3>Installing SQLite3 DLL</h3>
<p>To install SQLite3 in windows you require not only the <em>gem</em> but a <em>DLL </em>files in your system PATH (or in your windows/system32 folder).</p>
<p>To obtain the DLL, go to: <a title="SQLite3 Download Page" href="http://www.sqlite.org/download.html" target="_blank">http://www.sqlite.org/download.html</a></p>
<p>I always believe that DLLs belong in the windows/system32 folder but as long as you put yours somewhere where your <a title="More info on PATH" href="http://vlaurie.com/computers2/Articles/environment.htm" target="_blank">PATH environment variable</a> points to, you should be fine.</p>
<h3>Installing/Updating the SQLite3 Gem</h3>
<p>Normally to install the gem you&#8217;d call <strong>gem install sqlite3-ruby</strong> and it would do everything automatically but if you try it (as of today) it will give you the following error:</p>
<p><code>C:&gt;gem install sqlite3-ruby<br />
Building native extensions.  This could take a while...<br />
ERROR:  Error installing sqlite3-ruby:<br />
ERROR: Failed to build gem native extension.</code></p>
<p><code>c:/ruby/bin/ruby.exe extconf.rb install sqlite3-ruby<br />
checking for fdatasync() in rt.lib... no<br />
checking for sqlite3.h... no</code></p>
<p><code>nmake<br />
'nmake' is not recognized as an internal or external command,<br />
operable program or batch file.</code></p>
<p><code>Gem files will remain installed in<br />
c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.<br />
Results logged to<br />
c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out</code></p>
<p>As not helpful as that error message is, it turns out that the new version of sqlite3-ruby doesn&#8217;t have a win32 version (which is needed for it to install/function correctly). So all you have to do is specify an older version of sqlite3.</p>
<p>To install a older version of a gem, run:</p>
<p><strong><code>gem install --version 1.2.3 sqlite3-ruby</code></strong></p>
<p>Now you&#8217;re all set to go!</p>
<p>Once sqlite3 is installed and you try to update the rest of your gems calling <strong>gem update</strong>, it will fail because (as of September 8th) sqlite3-ruby doesn&#8217;t have a win32 version of the 1.2.4 gem. To get around this, remove the sqlite3-ruby gem (<strong>gem uninstall sqlite3-ruby</strong>), then call <strong>gem update</strong> and then reinstall the gem by calling <strong><span class="quoting-level-1">gem install &#8211;version 1.2.3 sqlite3-ruby.</span></strong></p>
<p>SOURCE:</p>
<p>The most helpful site online that helped me figure this out was: <a title="Source for GEM fix" href="http://www.ruby-forum.com/topic/164116" target="_blank">http://www.ruby-forum.com/topic/164116</a></p>
<h3>UPDATE:</h3>
<p><strong>I just tired updating the gems myself and had to uninstall sqlite3-ruby (it seems as of October 21st, 2008, they still haven&#8217;t fixed the issue!) and I copied the command of my own blog to find it doesn&#8217;t work. Not sure if it&#8217;s just firefox or wordpress but the problem is in the way the page is rendered, the &#8220;- &#8211; version&#8221; has a double dash (without the space) but the browser changes the html and makes it one dash. So I attempted to put it in a different format. So for those who had issues before, you can now copy the code above and just make sure that the version has a double dash in front of it.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://anlek.com/2008/09/installing-updating-sqlite3-on-windows/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

