<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6590658056679626212</id><updated>2012-02-04T02:38:09.746-05:00</updated><title type='text'>Crazy Programmer Blog</title><subtitle type='html'>Please don't interrupt. Just sit back and listen.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>33</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-5440823820088463764</id><published>2008-12-25T15:32:00.002-05:00</published><updated>2008-12-25T15:59:08.091-05:00</updated><title type='text'>Ruby Ternary Search Tree</title><content type='html'>Simple Ruby Ternary Search Tree Implementation.&lt;br /&gt;&lt;br /&gt;Currently supports:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Insertion (insert)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Search (search, node)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Printing (to_s)&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;git clone at: &lt;code&gt;http://github.com/giancarlo/algorithms.git&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-5440823820088463764?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/5440823820088463764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=5440823820088463764' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/5440823820088463764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/5440823820088463764'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/12/ruby-ternary-search-tree.html' title='Ruby Ternary Search Tree'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-3075408088902121456</id><published>2008-12-10T16:13:00.002-05:00</published><updated>2008-12-10T16:14:26.185-05:00</updated><title type='text'>Ruby 1.9 C Api Extensions Guide</title><content type='html'>I am writing a guide on the Ruby (SVN) C API. You can see it here: &lt;a href="http://coaxialhost.com/tutorials/writing_ruby_extensions.html"&gt;http://coaxialhost.com/tutorials/writing_ruby_extensions.html&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Expect more stuff to be added later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-3075408088902121456?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/3075408088902121456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=3075408088902121456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3075408088902121456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3075408088902121456'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/12/ruby-19-c-api-extensions-guide.html' title='Ruby 1.9 C Api Extensions Guide'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-6517606820114119234</id><published>2008-12-10T16:02:00.002-05:00</published><updated>2008-12-10T16:05:52.498-05:00</updated><title type='text'>New Mirror Blog and Theme</title><content type='html'>I have created a wordpress blog in my own server which will eventually replace this site. The blog is at &lt;a href="http://cpb.coaxialhost.com"&gt;http://cpb.coaxialhost.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This new blog has a better format and will implement new features in the future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-6517606820114119234?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/6517606820114119234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=6517606820114119234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6517606820114119234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6517606820114119234'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/12/new-mirror-blog-and-theme.html' title='New Mirror Blog and Theme'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-621956499360598524</id><published>2008-11-21T12:02:00.002-05:00</published><updated>2008-11-21T12:06:58.188-05:00</updated><title type='text'>Embed Fonts in HTML document using PHP and Javascript</title><content type='html'>I wrote a php + js script to replace HTML markup with formatted text in the form of images. The script is called PHPJSFont and it is available at http://code.google.com/p/phpjsfont. &lt;br /&gt;&lt;br /&gt;What it does is simple: the Javascript code replaces the text inside HTML tags with an image generated by the PHP script.&lt;br /&gt;&lt;br /&gt;Currently it depends on JQuery and PHP 4+ compiled with the GD extension and TTF support.&lt;br /&gt;&lt;br /&gt;It should be fairly simple to use, as in:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;PJF.replace("h2");&lt;br /&gt;PJF.replace("#topmenu UL &gt; LI");&lt;br /&gt;PJF.replace("h1", { size: 20, color: [255, 0, 0] });&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-621956499360598524?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/621956499360598524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=621956499360598524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/621956499360598524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/621956499360598524'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/11/embed-fonts-in-html-document-using-php.html' title='Embed Fonts in HTML document using PHP and Javascript'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-918348425537355728</id><published>2008-11-15T12:17:00.003-05:00</published><updated>2008-12-16T14:36:32.348-05:00</updated><title type='text'>Install Intel Compiler(icc) in Ubuntu 8.10</title><content type='html'>To install icc in Ubuntu:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt; &lt;li&gt;Download icc from Intel &lt;a href="http://www.intel.com/cd/software/products/asmo-na/eng/compilers/clin/277618.htm"&gt;website&lt;/a&gt;&lt;/li&gt;&lt;br /&gt; &lt;li&gt;tar -zxvf the file.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;Run 'install.sh'.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;Follow the installer instructions.&lt;/li&gt;&lt;br /&gt; &lt;li&gt;When it is done add this line to your ~/.bashrc (or initialization script):&lt;br /&gt;&lt;code&gt;source /opt/intel/Compiler/11.0/069/bin/iccvars.sh ia32&lt;/code&gt;&lt;br /&gt;Replace ia32 with your platform: (ia32, intel64, ia64)&lt;/li&gt;&lt;br /&gt; &lt;li&gt;Log off and log in and that is it. You can test it with &lt;code&gt;icc -v&lt;/code&gt;&lt;/li&gt;&lt;br /&gt; &lt;li&gt;To use &lt;code&gt;icc&lt;/code&gt; with a configure script use &lt;code&gt;./configure CC=icc&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;NOTE: If you get a libimf.so error like "file does not exists" while using sudo, you will need to write a bash script adding "source /opt/intel/Compiler/11.0/069/bin/iccvars.sh" and the program you are trying to run.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-918348425537355728?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/918348425537355728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=918348425537355728' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/918348425537355728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/918348425537355728'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/11/install-intel-compilericc-in-ubuntu-810.html' title='Install Intel Compiler(icc) in Ubuntu 8.10'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-829330294168480009</id><published>2008-10-01T17:20:00.005-04:00</published><updated>2008-10-02T15:04:02.559-04:00</updated><title type='text'>Ruby 1.9 Blocks Notes</title><content type='html'>&lt;script language='javascript' src='http://coaxialhost.com/sh/Scripts/shBrushRuby.js'&gt;&lt;/script&gt; &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Every function can accept a block.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;Kernel.block_given?&lt;/code&gt; will tell you if a block was passed.&lt;/li&gt;&lt;br /&gt;&lt;pre name='code' class='ruby'&gt;&lt;br /&gt;def test&lt;br /&gt;  a = 42&lt;br /&gt;  yield(a) if block_given?&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;To assign the block to an argument, you add an ampersand (&amp;) in front of the last argument of your function. This will affect performance.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You can call the block inside the function using &lt;code&gt;yield&lt;/code&gt; or &lt;code&gt;Proc.call&lt;/code&gt; like this:&lt;/li&gt;&lt;br /&gt;&lt;pre name='code' class='ruby'&gt;&lt;br /&gt;def test(&amp;block)&lt;br /&gt;  a = 42&lt;br /&gt;  yield(a) # or block.call(a,b)&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;yield&lt;/code&gt; calls and passes the arguments to the block.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;block.arity&lt;/code&gt; will tell you the number of arguments a block can accept&lt;/li&gt; &lt;br /&gt;&lt;li&gt;If you have a recursive function accepting a block, you can pass the block to it using '&amp;'.&lt;/li&gt;&lt;br /&gt;&lt;pre name='code' class='ruby'&gt;&lt;br /&gt;def recursive_function(&amp;block)&lt;br /&gt;  # Do stuff&lt;br /&gt;  recursive_function(&amp;block)&lt;br /&gt;  # pass to other functions accepting blocks&lt;br /&gt;  10.times &amp;block # will run block 10 times&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;If you use the return keyword inside a block, it will return the value and exit the function binded to the block, which is the one that created it.&lt;/li&gt;&lt;br /&gt;&lt;pre name='code' class='ruby'&gt;&lt;br /&gt;def bl(&amp;block)&lt;br /&gt;  yield&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def test&lt;br /&gt;  bl { return }&lt;br /&gt;  puts "Hello" # this will not be executed.&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;You can use &lt;code&gt;break&lt;/code&gt; to return a value inside a block and stop iterating.&lt;/li&gt;&lt;br /&gt;&lt;pre name='code' class='ruby'&gt;&lt;br /&gt;def bl(&amp;block)&lt;br /&gt;  (0..10).each &amp;block &lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def test&lt;br /&gt;  # This block will stop iterating at 5 and return true.&lt;br /&gt;  bl { |x| (break true) if (x == 5); false }&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-829330294168480009?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/829330294168480009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=829330294168480009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/829330294168480009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/829330294168480009'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/10/ruby-19-blocks-notes.html' title='Ruby 1.9 Blocks Notes'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-4873742411407974223</id><published>2008-09-04T00:30:00.009-04:00</published><updated>2008-09-04T00:56:56.230-04:00</updated><title type='text'>Using SyntaxHighlighter with Blogger or Blogspot</title><content type='html'>&lt;script language='javascript' src='http://www.coaxialhost.com/sh/Scripts/shBrushXml.js'&gt;&lt;/script&gt;I added Syntax Highlighting capabilities to this blog and here it is how i did it. You might need another server where to put your files:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Download SyntaxHighlighter from http://code.google.com/p/syntaxhighlighter/downloads/list.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Add this to your Edit HTML code in Layout: &lt;/li&gt;&lt;br /&gt;&lt;pre name="code" class="html"&gt;&amp;lt;script language='javascript' src='http://www.url.com/Scripts/shCore.js'&gt;&amp;lt;/script&gt;&lt;br /&gt;&amp;lt;script language='javascript'&gt;&lt;br /&gt; window.onload = function() {&lt;br /&gt; dp.SyntaxHighlighter.ClipboardSwf = 'http://www.url.com/Scripts/clipboard.swf';&lt;br /&gt; dp.SyntaxHighlighter.BloggerMode();&lt;br /&gt; dp.SyntaxHighlighter.HighlightAll('code');&lt;br /&gt; }&lt;br /&gt;&amp;lt;/script&gt;&lt;br /&gt;&amp;lt;link href='http://www.url.com/Styles/SyntaxHighlighter.css' rel='stylesheet' type='text/css'/&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;Put the code you want to highlight inside a &amp;lt;pre&gt; tag like this:&lt;/li&gt;&lt;br /&gt;&lt;pre name="code" class="html"&gt;&amp;lt;pre name='code' class='language'&gt;&lt;br /&gt; code;&lt;br /&gt;&amp;lt;/pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;Make sure you replace the url and also '&amp;lt;' with &amp;amp;lt; if you are using HTML code&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Add this to the top of your post:&lt;/li&gt;&lt;br /&gt;&lt;pre name='code' class='html'&gt;&amp;lt;script language='javascript' src='http://www.url.com/Scripts/shBrushXml.js'&gt;&amp;lt;/script&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;Replace the script name with the one used for your language.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;For more information and language list visit http://code.google.com/p/syntaxhighlighter/w/list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-4873742411407974223?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/4873742411407974223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=4873742411407974223' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/4873742411407974223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/4873742411407974223'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/09/using-syntaxhighlighter-with-blogger-or.html' title='Using SyntaxHighlighter with Blogger or Blogspot'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-8981733990968098524</id><published>2008-09-03T22:53:00.006-04:00</published><updated>2008-09-04T00:56:21.190-04:00</updated><title type='text'>CSS Sprites</title><content type='html'>&lt;script language="javascript" src="http://www.coaxialhost.com/sh/Scripts/shBrushCss.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;What a wonderful idea, simple and easy. A great way to reduce HTTP GET's. &lt;br /&gt;&lt;br /&gt;How to use it in your application:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt; Find/Buy a good icon set (like tango), try to find a transparent one. &lt;/li&gt;&lt;br /&gt;&lt;li&gt; Place a div where the icon would be located and set its onclick event to whatever you want it to do. &lt;/li&gt;&lt;br /&gt;&lt;li&gt; create a css class for the icon:&lt;/li&gt;&lt;br /&gt;&lt;pre name="code" class="css"&gt;&lt;br /&gt;  .icon-name { &lt;br /&gt;    display: block; height: 32px; width: 32px;&lt;br /&gt;    background: transparent url(icon.png) -(x)px -(y)px no-repeat;&lt;br /&gt;    cursor: pointer;&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt; Change height, width and (x) and (y) position with the respective values.&lt;/li&gt;&lt;br /&gt;&lt;li&gt; assign the class to your div.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;Pretty easy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-8981733990968098524?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/8981733990968098524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=8981733990968098524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8981733990968098524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8981733990968098524'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/09/css-sprites.html' title='CSS Sprites'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-3671182171306669849</id><published>2008-09-03T11:50:00.004-04:00</published><updated>2008-09-03T11:55:12.199-04:00</updated><title type='text'>Ruby on V8</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;What a great idea, someone put together a hacked version of &lt;a href="http://macournoyer.wordpress.com/2008/09/02/ruby-on-v8/"&gt;ruby for the v8&lt;/a&gt; engine based on hotruby.js. It is not a real compiler but it works. &lt;br /&gt;&lt;br /&gt;Now, Who is going to make a real port of Ruby to the v8 engine? Sounds like an interesting project. Just what we need, another ruby virtual machine/interpreter!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-3671182171306669849?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/3671182171306669849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=3671182171306669849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3671182171306669849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3671182171306669849'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/09/ruby-on-v8.html' title='Ruby on V8'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-5047854643402805212</id><published>2008-09-02T18:52:00.002-04:00</published><updated>2008-09-02T20:16:40.587-04:00</updated><title type='text'>Chrome</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;Chrome is fast. Even though I had problems installing it on my laptop win xp sp3, I managed to get a copy of the exe file from http://cache.googlevideo.com/chrome/install/149.27/chrome_installer.exe. I run it and it installed fine. Not sure what the problem was because other people with sp3 could install it just fine. It was probably a disabled service.&lt;br /&gt;&lt;br /&gt;Cool things to try in the address bar: &lt;br /&gt;&lt;br /&gt;&lt;b&gt;about:network&lt;/b&gt; - Network Tools&lt;br /&gt;&lt;b&gt;about:stats&lt;/b&gt; - Shhh! This page is secret!&lt;br /&gt;&lt;b&gt;about:cache&lt;/b&gt; - Cache.&lt;br /&gt;&lt;b&gt;about:histograms&lt;/b&gt; - Data about chrome features.&lt;br /&gt;&lt;b&gt;about:plugins&lt;/b&gt; - Installed Plug-ins.&lt;br /&gt;&lt;b&gt;about:dns&lt;/b&gt; - DNS records.&lt;br /&gt;&lt;b&gt;about:version&lt;/b&gt; - Google Chrome browser version.&lt;br /&gt;&lt;b&gt;https://gmail.com&lt;/b&gt; - This one is pretty bad actually... No one is perfect.&lt;br /&gt;&lt;br /&gt;To access google's &lt;b&gt;task manager&lt;/b&gt;: right click in the blue space at the top and click Task Manager.&lt;br /&gt;&lt;br /&gt;Bad news: still doesn't work on linux(nor wine) or macs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-5047854643402805212?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/5047854643402805212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=5047854643402805212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/5047854643402805212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/5047854643402805212'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/09/chrome.html' title='Chrome'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-6487211057563330688</id><published>2008-08-29T13:29:00.003-04:00</published><updated>2008-08-29T13:33:57.038-04:00</updated><title type='text'>Understanding a Crazy Programmer</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;Found this on the net. If you have any problems with a programmer in your team, this article/blog might help.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://lispy.wordpress.com/2008/08/25/do-you-know-any-programmers-that-exhibit-these-personality-traits/"&gt;Learning Lisp - Do you know any programmers that exhibit these personality traits?&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-6487211057563330688?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/6487211057563330688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=6487211057563330688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6487211057563330688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6487211057563330688'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/08/understanding-crazy-programmer.html' title='Understanding a Crazy Programmer'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-8027509893090175086</id><published>2008-08-05T23:45:00.002-04:00</published><updated>2008-08-06T00:09:54.639-04:00</updated><title type='text'>Catching Ctrl+C in Ruby 1.9</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;Ctrl+C sends a SIGINT signal to the kernel. &lt;br /&gt;To catch it and execute code we use:&lt;br /&gt;&lt;code&gt;Kernel.trap('INT') { code }&lt;/code&gt;&lt;br /&gt;Remember to call Kernel.exit if you want to terminate the execution of your ruby script. Kernel.trap can also catch other signals. For more information visit: &lt;a href="http://ruby-doc.org/core-1.9/classes/Kernel.html#M006066"&gt;Kernel.trap&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-8027509893090175086?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/8027509893090175086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=8027509893090175086' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8027509893090175086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8027509893090175086'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/08/catching-ctrlc-in-ruby-19.html' title='Catching Ctrl+C in Ruby 1.9'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-7154062979114296941</id><published>2008-08-02T01:40:00.004-04:00</published><updated>2008-08-06T00:23:14.370-04:00</updated><title type='text'>Storing Passwords securely</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;The best way to store a password: Salt it then Hash it.&lt;br /&gt;&lt;br /&gt;To salt it add random characters to the password entered by the user. Remember we are going to need those random characters later so save them somewhere you can retrieve them later. I would say insert them in fixed locations in the hash. To hash it use the md5 or sha1 function. You can find these functions in the encode ruby extension.&lt;br /&gt;&lt;br /&gt;To authenticate the user, you will need to pull the hash associated with the username, retrieve the salt characters, apply them to the password entered by the user, hash it and compare.&lt;br /&gt;&lt;br /&gt;Is there a better way?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-7154062979114296941?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/7154062979114296941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=7154062979114296941' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7154062979114296941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7154062979114296941'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/08/storing-passwords-securily.html' title='Storing Passwords securely'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-7644384826761069404</id><published>2008-07-29T01:58:00.003-04:00</published><updated>2008-08-21T15:30:54.397-04:00</updated><title type='text'>Terminal Awesomeness</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;The best way to make your desktop look nice is to add true transparency to your terminals. I got urxvt with true transparency enabled working with xcompmgr and it looks wonderful.&lt;br /&gt;&lt;br /&gt;xcompmgr is a lightweight composite window manager.&lt;br /&gt;urxvt is an xterm-like terminal lightweight and fast.&lt;br /&gt;&lt;br /&gt;I'm using openbox as a window manager and hsetroot to set my desktop wallpaper. These are the contents of my ~/.config/openbox/autostart.sh :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;hsetroot -fill ~/Desktop/desktop.jpg &amp;&lt;br /&gt;xcompmgr &amp;&lt;br /&gt;rxvt &amp;&lt;br /&gt;docker &amp;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;"docker" takes care of the system tray.&lt;br /&gt;&lt;br /&gt;To enable transparency in urxvt you need to add these lines to your ~/.Xresources file:&lt;br /&gt;&lt;code&gt;URxvt*depth: 32&lt;br /&gt;urxvt*background: rgba:0000/0000/0000/cccc&lt;br /&gt;URxvt*background: rgba:0000/0000/0000/cccc&lt;br /&gt;URxvt*foreground: green&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Change the background and foreground to whatever color you want. &lt;br /&gt;&lt;br /&gt;I believe desktop managers like kde or gnome are overrated. Openbox is great and doesn't consume your precious resources so u can use them for more important things like compiling code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-7644384826761069404?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/7644384826761069404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=7644384826761069404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7644384826761069404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7644384826761069404'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/terminal-awesomeness.html' title='Terminal Awesomeness'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-7269098909264365194</id><published>2008-07-25T13:37:00.002-04:00</published><updated>2008-08-06T00:22:15.048-04:00</updated><title type='text'>More VIM stuff</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;Set tab size:&lt;br /&gt;&lt;code&gt;set tabstop=2&lt;/code&gt;&lt;br /&gt;Quick Write and quit&lt;br /&gt;&lt;code&gt;:wq&lt;/code&gt;&lt;br /&gt;If you press Ctrl+S while on a terminal and it freezes then press the following to unfreeze:&lt;br /&gt;&lt;code&gt;Ctrl+Q&lt;/code&gt;&lt;br /&gt;Working with tabs&lt;br /&gt;&lt;code&gt;:tabe file # Opens File&lt;br /&gt;:tabn  # goes to next tab&lt;br /&gt;:tabp  # goes to previous tab&lt;br /&gt;:q     # closes current tab&lt;br /&gt;gt     # will take you to the next tab&lt;br /&gt;gT     # will take you to the previous tab&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Auto completion&lt;br /&gt;&lt;code&gt;Ctrl+N Ctrl+P&lt;/code&gt;&lt;br /&gt;You can also invoke make and grep within vim&lt;br /&gt;&lt;code&gt;:grep args&lt;br /&gt;:make&lt;/code&gt;&lt;br /&gt;If you work on windows (gvim.exe) place your vimrc file in the VIM exe directory. You might need to set the environment variable VIM to the path where gvim.exe. Name your vimrc file as _vimrc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-7269098909264365194?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/7269098909264365194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=7269098909264365194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7269098909264365194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7269098909264365194'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/more-vim-stuff.html' title='More VIM stuff'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-989880799470670058</id><published>2008-07-25T00:55:00.002-04:00</published><updated>2008-07-25T13:09:23.316-04:00</updated><title type='text'>Moving to VIM</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;I decided to make vim my default text editor. Here are a couple of tips:&lt;br /&gt;&lt;br /&gt;To get syntax highlighting in vim, add the following to your ~/.vimrc file or enter while editing (command mode, remember to press ':' before entering):&lt;br /&gt;&lt;code&gt;set background=dark # if your console background is dark.. &lt;br /&gt;syntax on&lt;/code&gt;&lt;br /&gt;To get line numbers: &lt;br /&gt;&lt;code&gt;set nu&lt;/code&gt;&lt;br /&gt;To split the screen in 2&lt;br /&gt;&lt;code&gt;split&lt;br /&gt;vsplit # Vertical Split&lt;/code&gt;&lt;br /&gt;To Move from split windows&lt;br /&gt;&lt;code&gt;Ctrl+W+(direction)&lt;/code&gt;&lt;br /&gt;Open a file&lt;br /&gt;&lt;code&gt;open file&lt;/code&gt;&lt;br /&gt;Close a file&lt;br /&gt;&lt;code&gt;close&lt;/code&gt;&lt;br /&gt;Search Reg Ex&lt;br /&gt;&lt;code&gt;/regex&lt;/code&gt;&lt;br /&gt;Goto Line Number&lt;br /&gt;&lt;code&gt;:number&lt;/code&gt;&lt;br /&gt;Search word under cursor&lt;br /&gt;&lt;code&gt;*&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I will post more eventually... vim kicks emacs butt by the way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-989880799470670058?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/989880799470670058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=989880799470670058' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/989880799470670058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/989880799470670058'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/moving-to-vim.html' title='Moving to VIM'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-1863793894846303343</id><published>2008-07-18T11:57:00.001-04:00</published><updated>2008-07-18T12:00:40.596-04:00</updated><title type='text'>Ruby 1.9 C API - Object Instances</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;To Create a new instance of an object with class Class we will do this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  VALUE obj;&lt;br /&gt;  &lt;br /&gt;  obj = rb_obj_alloc(Class); // Allocate space and create new instance&lt;br /&gt;  rb_obj_call_init(obj, 0, 0); // We call the initialize method for the object  &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Remember rb_obj_alloc() does not initialize the object and will seg fault if you use any custom data types in the object. &lt;br /&gt;&lt;br /&gt;The 2nd and 3rd parameters of rb_obj_call_init() are the argument count (argc) and the constructor parameters array ( VALUE* ).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-1863793894846303343?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/1863793894846303343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=1863793894846303343' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/1863793894846303343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/1863793894846303343'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/ruby-19-c-api-object-instances.html' title='Ruby 1.9 C API - Object Instances'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-7175376360633493402</id><published>2008-07-11T11:54:00.004-04:00</published><updated>2008-07-16T10:44:23.372-04:00</updated><title type='text'>Ruby C API - Classes I</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;To create a class:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;VALUE rb_define_class("name", parent_class);&lt;br /&gt;VALUE rb_define_class_under(module_or_class, "name", parent_class);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To create a method:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;rb_define_method(class, "name", c_function, argc)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;argc is the number of arguments of the function, not including the first parameter of the c_function which would be the instance variable. Default Parameters can be implemented by setting this number to negative. (-1 would mean variable number of parameters, -2 would create an array to store the arguments)&lt;br /&gt;&lt;br /&gt;"name" is the name of the method in ruby, for setter methods you would add the = to the name just like in ruby ( ie "name=" ). The same with operator for the [] operator you will use the string "[]" or "[]=".&lt;br /&gt;&lt;br /&gt;The format of a ruby function accepting a variable number of arguments (argc = -1) would be like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;VALUE function( int argc, VALUE* args, VALUE instance );&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;argc is the number of arguments passed.&lt;br /&gt;args is an array containing the arguments.&lt;br /&gt;instance is the instance of the object.&lt;br /&gt;&lt;br /&gt;The format for a ruby function accepting an array of arguments (argc = -2) :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;VALUE function( VALUE instance, VALUE array_of_arguments);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To access instance variables you will use this two methods:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;rb_iv_get(instance, "variable");&lt;br /&gt;rb_iv_set(instance, "variable", new_value);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;stay tuned for part II.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-7175376360633493402?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/7175376360633493402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=7175376360633493402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7175376360633493402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7175376360633493402'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/ruby-c-api-classes-i.html' title='Ruby C API - Classes I'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-3412356640061651715</id><published>2008-07-10T14:51:00.003-04:00</published><updated>2008-07-10T15:10:50.433-04:00</updated><title type='text'>Firefox Download Antivirus??</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;I recently noticed that firefox stopped responding for a couple of seconds every time i downloaded a file. The cause was the new virus scan feature. To disable this ( I tried Tools/Options but couln't find anything ) go to about:config and search for browser.download.manager.scanWhenDone then set it to false.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-3412356640061651715?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/3412356640061651715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=3412356640061651715' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3412356640061651715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3412356640061651715'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/firefox-download-antivirus.html' title='Firefox Download Antivirus??'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-1584622254219094595</id><published>2008-07-06T00:49:00.003-04:00</published><updated>2008-07-12T12:13:33.344-04:00</updated><title type='text'>Ruby 1.9 C API - Exceptions I</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;&lt;code&gt;rb_raise(exception_object, string_message);&lt;/code&gt;&lt;br /&gt;rb_raise will try to call exception_object.new and display string-message as the exception error message. &lt;br /&gt;&lt;br /&gt;Some of the built-in exceptions that can be raised are: &lt;br /&gt;&lt;code&gt;rb_eArgError&lt;br /&gt;rb_eEOFError&lt;br /&gt;rb_eException&lt;br /&gt;rb_eFatal&lt;br /&gt;rb_eFloatDomainError&lt;br /&gt;rb_eIndexError&lt;br /&gt;rb_eInterrupt&lt;br /&gt;rb_eIOError&lt;br /&gt;rb_eKeyError&lt;br /&gt;rb_eLoadError&lt;br /&gt;rb_eLocalJumpError&lt;br /&gt;rb_eNameError&lt;br /&gt;rb_eNoMemError&lt;br /&gt;rb_eNoMethodError&lt;br /&gt;rb_eNotImpError&lt;br /&gt;rb_eRangeError&lt;br /&gt;rb_eRegexpError&lt;br /&gt;rb_eRuntimeError&lt;br /&gt;rb_eScriptError&lt;br /&gt;rb_eSecurityError&lt;br /&gt;rb_eSignal&lt;br /&gt;rb_eStandardError&lt;br /&gt;rb_eStopIteration&lt;br /&gt;rb_eSyntaxError&lt;br /&gt;rb_eSysStackError&lt;br /&gt;rb_eSystemCallError&lt;br /&gt;rb_eSystemExit&lt;br /&gt;rb_eThreadError&lt;br /&gt;rb_eTypeError&lt;br /&gt;rb_eZeroDivError&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-1584622254219094595?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/1584622254219094595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=1584622254219094595' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/1584622254219094595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/1584622254219094595'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/ruby-19-c-api-exceptions-i.html' title='Ruby 1.9 C API - Exceptions I'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-2881811716343979105</id><published>2008-07-05T22:10:00.004-04:00</published><updated>2008-07-05T22:19:25.483-04:00</updated><title type='text'>Listing RSS items with PHP in 3 lines</title><content type='html'>&lt;style type="text/css"&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$rss = simplexml_load_file("rss feed url");&lt;br /&gt;foreach ($rss-&gt;channel-&gt;item as $k)&lt;br /&gt;echo $k-&gt;title . "\n";&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;In 4 lines with HTML formatting!!&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$rss = simplexml_load_file("blog rss url!");&lt;br /&gt;foreach ($rss-&gt;channel-&gt;item as $k)&lt;br /&gt; $rss_list .= "&amp;lt;li&gt;" . $k-&gt;title . "&amp;lt;/li&gt;\n";&lt;br /&gt;&lt;br /&gt;$index_rss = "&amp;lt;ul&gt;$rss_list&amp;lt;/ul&gt;";&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-2881811716343979105?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/2881811716343979105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=2881811716343979105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/2881811716343979105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/2881811716343979105'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/listing-rss-items-with-php-in-3-lines.html' title='Listing RSS items with PHP in 3 lines'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-6750921895705826958</id><published>2008-07-05T12:35:00.003-04:00</published><updated>2008-07-05T20:00:05.807-04:00</updated><title type='text'>Ruby 1.9 C API - Accepting Blocks</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;Executing the Block&lt;br /&gt;&lt;code&gt;rb_yield(Qnil);&lt;/code&gt;&lt;br /&gt;Replace Qnil with the parameters you wish to pass to the block. The Result of the block is returned. &lt;br /&gt;&lt;code&gt;rb_block_given_p();&lt;/code&gt;&lt;br /&gt;This function will tell you if a block was passed. Blocks are not counted as parameters so if your function only accepts a block then you need to specify 0 as the number of parameters.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-6750921895705826958?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/6750921895705826958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=6750921895705826958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6750921895705826958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6750921895705826958'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/ruby-19-c-api-accepting-blocks.html' title='Ruby 1.9 C API - Accepting Blocks'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-6750083047608590253</id><published>2008-07-04T15:51:00.004-04:00</published><updated>2008-07-05T21:24:18.432-04:00</updated><title type='text'>Ruby 1.9 C API !! - Internal Structures</title><content type='html'>&lt;style type="text/css"&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre; color: #eee} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;To access the internal structure of any Ruby object, 'ruby.h' defines the following macros:&lt;br /&gt;&lt;code&gt;#define RBASIC(obj)  (R_CAST(RBasic)(obj))&lt;br /&gt;#define ROBJECT(obj) (R_CAST(RObject)(obj))&lt;br /&gt;#define RCLASS(obj)  (R_CAST(RClass)(obj))&lt;br /&gt;#define RMODULE(obj) RCLASS(obj)&lt;br /&gt;#define RFLOAT(obj)  (R_CAST(RFloat)(obj))&lt;br /&gt;#define RSTRING(obj) (R_CAST(RString)(obj))&lt;br /&gt;#define RREGEXP(obj) (R_CAST(RRegexp)(obj))&lt;br /&gt;#define RARRAY(obj)  (R_CAST(RArray)(obj))&lt;br /&gt;#define RHASH(obj)   (R_CAST(RHash)(obj))&lt;br /&gt;#define RDATA(obj)   (R_CAST(RData)(obj))&lt;br /&gt;#define RSTRUCT(obj) (R_CAST(RStruct)(obj))&lt;br /&gt;#define RBIGNUM(obj) (R_CAST(RBignum)(obj))&lt;br /&gt;#define RFILE(obj)   (R_CAST(RFile)(obj))&lt;br /&gt;#define RRATIONAL(obj) (R_CAST(RRational)(obj))&lt;br /&gt;#define RCOMPLEX(obj) (R_CAST(RComplex)(obj))&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The most important are:&lt;br /&gt;&lt;code&gt;struct RFloat {&lt;br /&gt; struct RBasic basic;&lt;br /&gt; double float_value;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;struct RBignum {&lt;br /&gt; struct RBasic basic;&lt;br /&gt; union {&lt;br /&gt;     struct {&lt;br /&gt;         long len;&lt;br /&gt;         BDIGIT *digits;&lt;br /&gt;     } heap;&lt;br /&gt;     BDIGIT ary[RBIGNUM_EMBED_LEN_MAX];&lt;br /&gt; } as;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;struct RBasic basic;&lt;br /&gt;union {&lt;br /&gt; struct {&lt;br /&gt; long len;&lt;br /&gt; char *ptr;&lt;br /&gt; union {&lt;br /&gt;long capa;&lt;br /&gt;VALUE shared;&lt;br /&gt;     } aux;&lt;br /&gt; } heap;&lt;br /&gt; char ary[RSTRING_EMBED_LEN_MAX];&lt;br /&gt;} as;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;To Access the value of a float number you will call:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;RFLOAT(ruby_value)-&gt;double_value;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Fixnum's (Integers) are stored differently:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;10 in Ruby =&gt; (10 &gt;&gt; 1) in C&lt;br /&gt;10 in C    =&gt; (10 &lt;&lt; 1 | 1) in Ruby&lt;br /&gt;-10 in Ruby =&gt; (10 &gt;&gt; 1) in C&lt;br /&gt;-10 in C    =&gt; (10 &gt;&gt; 1 | 1) in Ruby (0xffffffed)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Bignums are usually 8 bytes (long long).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-6750083047608590253?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/6750083047608590253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=6750083047608590253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6750083047608590253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6750083047608590253'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/07/ruby-19-c-api-internal-structures.html' title='Ruby 1.9 C API !! - Internal Structures'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-7091703366350811616</id><published>2008-06-27T00:32:00.006-04:00</published><updated>2008-06-27T00:49:50.233-04:00</updated><title type='text'>Finish What You Start</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;As usual we will go straight to the point.&lt;br /&gt;&lt;br /&gt;Three Ways to finish things:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Throw it away. Put an end to it. Example: Your sudoku game. Seriously is not that important.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Do it yourself. But really, do it.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Delegate it. Find someone to do it for you, your friend, or that developer from india. Make sure that you find someone who you can trust.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Why is it important?&lt;/b&gt;&lt;br /&gt;Sense of accomplishment and tranquility. Yes, now you can get that out of your mind. As embarrassing or ridiculous you may think it is; it is now out of your head.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How is it relevant to programming?&lt;/b&gt;&lt;br /&gt;Finish that project you started a couple of days ago and gave up because it turned too complicated. Spend an entire night finding the solution. It will be more rewarding than what you think and you will probably learn more than what you intended.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Crazy Googled Internet Quote&lt;/b&gt;&lt;br /&gt;&lt;i&gt;"The way to achieve inner peace is to finish all the things you've started."&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-7091703366350811616?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/7091703366350811616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=7091703366350811616' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7091703366350811616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/7091703366350811616'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/06/finish-what-you-start.html' title='Finish What You Start'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-3358691815991839753</id><published>2008-06-23T23:28:00.005-04:00</published><updated>2008-06-23T23:36:02.837-04:00</updated><title type='text'>PHP Segmentation Fault</title><content type='html'>&lt;style type='text/css'&gt;code{color: #80FF00; border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;I ran around this problem a couple of times, and recently i spent more than 20 mins trying to figure out why my php page was seg faulting. Well now I'm going to document it.&lt;br /&gt;&lt;br /&gt;To make it simple, this code will give you a seg fault:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;class A&lt;br /&gt;{&lt;br /&gt;  function __construct()&lt;br /&gt;  {&lt;br /&gt;    new B;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class B extends A&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;new A;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Don't create new objects from classes that inherit from the class you are creating the object. Yes sounds confusing, and probably it makes no sense but i think the code above is enough to explain it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-3358691815991839753?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/3358691815991839753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=3358691815991839753' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3358691815991839753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3358691815991839753'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/06/php-segmentation-fault.html' title='PHP Segmentation Fault'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-5426311155923563776</id><published>2008-06-09T23:24:00.003-04:00</published><updated>2008-06-10T00:21:16.717-04:00</updated><title type='text'>New Company Website</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;My new website is up at : &lt;a href="http://coaxialhost.com"&gt;http://coaxialhost.com&lt;/a&gt; Handcoded HTML, JS and CSS. Fun to make but is it Google friendly? I hope it is.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-5426311155923563776?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/5426311155923563776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=5426311155923563776' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/5426311155923563776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/5426311155923563776'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/06/new-company-website.html' title='New Company Website'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-6716541405223788903</id><published>2008-06-07T00:57:00.009-04:00</published><updated>2008-06-07T03:57:57.955-04:00</updated><title type='text'>Validating (X)HTML using Ruby</title><content type='html'>&lt;style type='text/css'&gt;code{border: 1px solid #666;background-color: #333;padding: 4px;width: 100%;text-align: left;display: block;white-space: pre} code .comment{color:#DDD;font-style:italic;} code .keyword{color:#80FF00;font-weight:bold;} code .method,.class,.module,.ident{color: #80FF00; } code .punct{color:#80FF00;font-weight:bold;} code .symbol{color: #E90;font-weight:bold;} code .char, .string,.attribute{color:#F77;} code .expr,.escape,.global,.number,.regex,.constant{color:#EEE;}&lt;/style&gt;&lt;br /&gt;This function returns validation messages from the w3c website (&lt;a href="http://validator.w3.org"&gt;http://validator.w3.org&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;net/http&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;br /&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;uri&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;XHTML&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="constant"&gt;VALIDATOR_URL&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;http://validator.w3.org/check&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;br /&gt;&lt;span class="constant"&gt;XHTML_STRICT&lt;/span&gt;  &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;XHTML 1.0 Strict&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;br /&gt;&lt;span class="constant"&gt;XHTML_TRANSITIONAL&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;XHTML 1.0 Transitional&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;br /&gt;&lt;span class="constant"&gt;XHTML_FRAMESET&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;XHTML 1.0 Frameset&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;br /&gt;      &lt;br /&gt;&lt;span class="comment"&gt;# Returns validation messages&lt;/span&gt;&lt;br /&gt;&lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;XHTML.validate&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;what&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="ident"&gt;xhtml_version&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt;&lt;span class="constant"&gt;XHTML_STRICT&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class="ident"&gt;post_data&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;fragment&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="punct"&gt;=&gt;&lt;/span&gt; &lt;span class="ident"&gt;what&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;doctype&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;  &lt;span class="punct"&gt;=&gt;&lt;/span&gt; &lt;span class="ident"&gt;xhtml_version&lt;/span&gt;&lt;br /&gt;  &lt;span class="punct"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;br /&gt;  &lt;span class="ident"&gt;r&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Net&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;HTTP&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;post_form&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="constant"&gt;URI&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;parse&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="constant"&gt;VALIDATOR_URL&lt;/span&gt;&lt;span class="punct"&gt;),&lt;/span&gt; &lt;span class="ident"&gt;post_data&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;br /&gt;  &lt;span class="keyword"&gt;return&lt;/span&gt; &lt;span class="ident"&gt;r&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;body&lt;/span&gt;&lt;br /&gt;&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We could try to parse the results into an array... maybe in the future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-6716541405223788903?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/6716541405223788903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=6716541405223788903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6716541405223788903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/6716541405223788903'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/06/validating-xhtml-using-ruby.html' title='Validating (X)HTML using Ruby'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-3230108929196145971</id><published>2008-06-06T21:38:00.009-04:00</published><updated>2008-06-07T00:54:31.484-04:00</updated><title type='text'>Creating Custom Ruby Accessors</title><content type='html'>&lt;b&gt;Built In Ruby Accessors&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span class="ident"&gt;attr_reader&lt;/span&gt; &lt;span class="symbol"&gt;:a&lt;/span&gt;  &lt;span class="comment"&gt;# Generates a reader/get function:&lt;/span&gt;&lt;br /&gt;&lt;span class="comment"&gt;#def a&lt;/span&gt;&lt;br /&gt;&lt;span class="comment"&gt;#  @a&lt;/span&gt;&lt;br /&gt;&lt;span class="comment"&gt;#end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="ident"&gt;attr_writer&lt;/span&gt; &lt;span class="symbol"&gt;:a&lt;/span&gt;  &lt;span class="comment"&gt;# Generates a writer/set function&lt;/span&gt;&lt;br /&gt;&lt;span class="comment"&gt;#def a= (value)&lt;/span&gt;&lt;br /&gt;&lt;span class="comment"&gt;#  @a = value&lt;/span&gt;&lt;br /&gt;&lt;span class="comment"&gt;#end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="ident"&gt;attr_accessor&lt;/span&gt; &lt;span class="symbol"&gt;:a&lt;/span&gt;  &lt;span class="comment"&gt;# Generates Both get/set functions&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Creating Custom Accessors&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;We need to define a function in the main Module class:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;class Module&lt;br /&gt;  def custom_accessor(*symbols)&lt;br /&gt;    symbols.each do |symbol|&lt;br /&gt;      class_eval "&lt;br /&gt;        # Here we would insert the code that we want to generate.&lt;br /&gt;      "&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And this is it. Now we can use our custom accessor like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;custom_accessor :accessor&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-3230108929196145971?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/3230108929196145971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=3230108929196145971' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3230108929196145971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/3230108929196145971'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/06/creating-custom-ruby-accessors.html' title='Creating Custom Ruby Accessors'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-1854429578874572655</id><published>2008-05-30T00:21:00.002-04:00</published><updated>2008-06-03T00:07:47.816-04:00</updated><title type='text'>Ruby Predefined Constants/Variables</title><content type='html'>&lt;b&gt;Constants&lt;/b&gt;&lt;br /&gt;&lt;code&gt;ENV # Hash of environment variables&lt;br /&gt;STDIN # IO stream for standard input&lt;br /&gt;STDOUT # IO stream for standard output, most cases the console&lt;br /&gt;STDERR # IO stream for standard error output&lt;br /&gt;RUBY_VERSION # String containing current ruby version&lt;br /&gt;RUBY_RELEASE_DATE # String containing the date in which ruby was compiled&lt;br /&gt;RUBY_PLATFORM # String containing the platform and compiler used to build ruby&lt;br /&gt;ARGV # Array of arguments used to run the ruby file. ARGV[0] is the first argument, not the name of the file.&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Variables&lt;/b&gt;&lt;br /&gt;&lt;code&gt;$:      # Ruby Include Path&lt;br /&gt;$&gt;      # STDOUT&lt;br /&gt;$.      # Current Line&lt;br /&gt;$!      # Latest error message&lt;br /&gt;$@  # location of error&lt;br /&gt;$_  # string last read by gets&lt;br /&gt;$.  # line number last read by interpreter&lt;br /&gt;$&amp;  # string last matched by regexp&lt;br /&gt;$~  # the last regexp match, as an array of subexpressions&lt;br /&gt;$n  # the nth subexpression in the last match (same as $~[n])&lt;br /&gt;$=  # case-insensitivity flag&lt;br /&gt;$/  # input record separator&lt;br /&gt;$\  # output record separator&lt;br /&gt;$0  # the name of the ruby script file&lt;br /&gt;$*  # the command line arguments&lt;br /&gt;$$  # interpreter's process ID&lt;br /&gt;$?  # exit status of last executed child process&lt;br /&gt;$SAFE   # safe level (0-4)&lt;br /&gt;$"      # Loaded modules, extensions (also $LOADED_FEATURES)&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-1854429578874572655?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/1854429578874572655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=1854429578874572655' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/1854429578874572655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/1854429578874572655'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/05/ruby-predefined-constantsvariables.html' title='Ruby Predefined Constants/Variables'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-4569929680676589966</id><published>2008-05-25T01:38:00.002-04:00</published><updated>2008-05-26T01:02:51.162-04:00</updated><title type='text'>Mysql Ruby Extension</title><content type='html'>&lt;b&gt;Installing in Windows&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Download mysql dev files from : http://dev.mysql.com/downloads/mysql/5.0.html&lt;br /&gt;Install them in your hard drive. We only need the include and lib files, not the server. Download the zip package.&lt;br /&gt;&lt;br /&gt;Download last mysql-ruby extension from http://tmtm.org/downloads/mysql/ruby/ and extract it.&lt;br /&gt;&lt;br /&gt;we run extconf.rb with the following parameters:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;ruby extconf.rb --with-mysql-include=/path/to/mysql/include --with-mysql-lib=/path/to/libs&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;By default the mysql installer saves the lib files in the lib/opt.&lt;br /&gt;&lt;br /&gt;To compile the extension:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;nmake&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now we should have a valid mysql.so file. We need to get the libmysql.dll from the bin folder of the mysql distribution, you can grab it from the zip version.&lt;br /&gt;&lt;br /&gt;To test it: &lt;br /&gt;&lt;br /&gt;&lt;code&gt;ruby test.rb [hostname [user [passwd [dbname [port [socket [flag]]]]]]]&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-4569929680676589966?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/4569929680676589966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=4569929680676589966' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/4569929680676589966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/4569929680676589966'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/05/mysql-ruby-extension.html' title='Mysql Ruby Extension'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-8123952678048286803</id><published>2008-05-24T14:55:00.003-04:00</published><updated>2008-05-24T21:31:25.730-04:00</updated><title type='text'>Ruby 1.9 C API - Data Conversion</title><content type='html'>&lt;b&gt;Ruby -&gt; C&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;char* RSTRING_PTR(VALUE); /* Ruby String to char*  */&lt;br /&gt;int RSTRING_LEN(VALUE); /* String length */&lt;br /&gt;char* StringValuePtr(VALUE); /* Returns string representation of any object */&lt;br /&gt;RSTRING StringValue(VALUE); /* Returns Ruby string representation of any object */&lt;br /&gt;int NUM2INT(VALUE); /* Number to Int */&lt;br /&gt;double NUM2DBL(VALUE); /* Double to Int */&lt;br /&gt;VALUE* RARRAY_PTR(RARRAY); /*Returns the pointer to values of a Ruby Array */&lt;br /&gt;int RARRAY_LEN(RARRAY); /* Returns length of Array */&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;C -&gt; Ruby &lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* Integer to Ruby Number*/&lt;br /&gt;INT2NUM(number);&lt;br /&gt;UINT2NUM(number);&lt;br /&gt;DOUBLE2NUM(double); /* Or rb_float_new(double) */&lt;br /&gt;RSTRING rb_str_new(char*, len); /* Returns ruby string from char* and length*/&lt;br /&gt;RSTRING rb_str_new2(char*); /* Returns ruby string from null terminated char* */&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Generating Arrays&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;VALUE array = rb_ary_new(); /* Create the array */&lt;br /&gt;rb_ary_push(array, VALUE); /* Push data into the array */&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Generating a Hash&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;VALUE hash = rb_hash_new();&lt;br /&gt;rb_hash_aset(hash, VALUE key, VALUE);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Get the type of a Ruby VALUE object&lt;/b&gt;&lt;br /&gt;&lt;code&gt;rb_type(VALUE);&lt;/code&gt;&lt;br /&gt;Possible Types: &lt;br /&gt;&lt;code&gt;&lt;br /&gt;#define T_NONE   RUBY_T_NONE&lt;br /&gt;#define T_NIL    RUBY_T_NIL&lt;br /&gt;#define T_OBJECT RUBY_T_OBJECT&lt;br /&gt;#define T_CLASS  RUBY_T_CLASS&lt;br /&gt;#define T_ICLASS RUBY_T_ICLASS&lt;br /&gt;#define T_MODULE RUBY_T_MODULE&lt;br /&gt;#define T_FLOAT  RUBY_T_FLOAT&lt;br /&gt;#define T_STRING RUBY_T_STRING&lt;br /&gt;#define T_REGEXP RUBY_T_REGEXP&lt;br /&gt;#define T_ARRAY  RUBY_T_ARRAY&lt;br /&gt;#define T_HASH   RUBY_T_HASH&lt;br /&gt;#define T_STRUCT RUBY_T_STRUCT&lt;br /&gt;#define T_BIGNUM RUBY_T_BIGNUM&lt;br /&gt;#define T_FILE   RUBY_T_FILE&lt;br /&gt;#define T_FIXNUM RUBY_T_FIXNUM&lt;br /&gt;#define T_TRUE   RUBY_T_TRUE&lt;br /&gt;#define T_FALSE  RUBY_T_FALSE&lt;br /&gt;#define T_DATA   RUBY_T_DATA&lt;br /&gt;#define T_MATCH  RUBY_T_MATCH&lt;br /&gt;#define T_SYMBOL RUBY_T_SYMBOL&lt;br /&gt;#define T_RATIONAL RUBY_T_RATIONAL&lt;br /&gt;#define T_COMPLEX RUBY_T_COMPLEX&lt;br /&gt;#define T_VALUES RUBY_T_VALUES&lt;br /&gt;#define T_UNDEF  RUBY_T_UNDEF&lt;br /&gt;#define T_NODE   RUBY_T_NODE&lt;br /&gt;#define T_MASK   RUBY_T_MASK&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Iterate through a Ruby Hash&lt;/b&gt;&lt;br /&gt;We iterate with the function &lt;br /&gt;&lt;code&gt;rb_hash_foreach(hash, iterator_c_function, extra_value);&lt;/code&gt;&lt;br /&gt;iterator_c_function is of the form:&lt;br /&gt;&lt;code&gt;int iterator(VALUE key, VALUE value, VALUE extra);&lt;/code&gt;&lt;br /&gt;Remeber VALUE is the same size as a void*, this means we can typecast it into whatever we want.&lt;br /&gt;To tell the rb_ruby_foreach() function to continue we return a ST_CONTINUE in the iterator function. We can also return a ST_STOP, ST_DELETE, or ST_CHECK.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-8123952678048286803?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/8123952678048286803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=8123952678048286803' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8123952678048286803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8123952678048286803'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/05/ruby-19-c-api-data-conversion.html' title='Ruby 1.9 C API - Data Conversion'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-8856856046249621507</id><published>2008-05-24T13:20:00.004-04:00</published><updated>2008-05-24T14:28:14.212-04:00</updated><title type='text'>Ruby 1.9 C API - Modules</title><content type='html'>&lt;b&gt;Creating a module:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;VALUE module = rb_define_module("name");&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Add methods/functions to a module:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;rb_define_method_function(module, "name", c_function, argc);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now the tricky part is that ruby adds a reference to the module when calling the function. c_function would look like this if it were to accept 1 parameter:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;VALUE c_function(VALUE module, VALUE arg);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In this case the argc parameter in the rb_define function should be 1 not 2 as you would expect.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Define a constant:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;rb_define_const(module_or_class, "NAME", value);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;value is a VALUE.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-8856856046249621507?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/8856856046249621507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=8856856046249621507' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8856856046249621507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/8856856046249621507'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/05/ruby-19-c-api-part-1.html' title='Ruby 1.9 C API - Modules'/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6590658056679626212.post-2835632647649951248</id><published>2008-05-23T01:45:00.004-04:00</published><updated>2008-05-23T02:02:46.368-04:00</updated><title type='text'></title><content type='html'>&lt;span style="font-weight: bold;"&gt;HOW TO specify GCC binary in configure script&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ubuntu installs gcc 4.2 as gcc-4.2 binary. To tell configure to use gcc-4.2 instead of gcc we use the following parameter&lt;br /&gt;&lt;br /&gt;&lt;code&gt;./configure CC=gcc-4.2&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6590658056679626212-2835632647649951248?l=crazyprogrammerblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazyprogrammerblog.blogspot.com/feeds/2835632647649951248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6590658056679626212&amp;postID=2835632647649951248' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/2835632647649951248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6590658056679626212/posts/default/2835632647649951248'/><link rel='alternate' type='text/html' href='http://crazyprogrammerblog.blogspot.com/2008/05/how-to-specify-gcc-binary-in-configure.html' title=''/><author><name>Giancarlo Bellido</name><uri>http://www.blogger.com/profile/12902557882230240444</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
