<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">

<channel>
	<title>Giacomo Graziosi</title>
	
	<link>http://giacomo.graziosi.info</link>
	<description>if you really want to...</description>
	<pubDate>Sun, 12 Oct 2008 01:08:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/GiacomoGraziosi" type="application/rss+xml" /><item>
		<title>Open sourcing old shit</title>
		<link>http://giacomo.graziosi.info/2008/10/11/open-sourcing-old-shit/</link>
		<comments>http://giacomo.graziosi.info/2008/10/11/open-sourcing-old-shit/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 11:01:07 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[computer science]]></category>

		<category><![CDATA[open source]]></category>

		<category><![CDATA[c++]]></category>

		<category><![CDATA[gpl]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[ufs]]></category>

		<category><![CDATA[university]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=134</guid>
		<description><![CDATA[I just made public under the terms of the GPLv3 a couple of old university projects hoping they will damn help someone. Here they are: ufs (micro file system, a fat-alike user space file system with some unix extensions) and Vespasiano (small movie theater manager, done when learning sockets in Java).
Please note that they both [...]]]></description>
			<content:encoded><![CDATA[<p>I just made public under the terms of the GPLv3 a couple of old university projects hoping they will <span style="text-decoration: line-through;">damn</span> help someone. Here they are: <a href="http://www.assembla.com/wiki/show/ufs">ufs</a> (micro file system, a fat-alike user space file system with some unix extensions) and <a href="http://www.assembla.com/wiki/show/vespasiano">Vespasiano</a> (small movie theater manager, done when learning sockets in Java).</p>
<p>Please note that they both are <strong>so bugged to be broken</strong>. Be careful :-).</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/10/11/open-sourcing-old-shit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cerberus Linux</title>
		<link>http://giacomo.graziosi.info/2008/10/01/cerberus-linux/</link>
		<comments>http://giacomo.graziosi.info/2008/10/01/cerberus-linux/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 17:09:00 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[open source]]></category>

		<category><![CDATA[cerberus]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[computer science]]></category>

		<category><![CDATA[debian]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[video surveillance]]></category>

		<category><![CDATA[vigilante]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=118</guid>
		<description><![CDATA[
What is this cool drooling puppy doing on my blog? His name is Cerberus, he came from Greek mithology and he is nothing less than the guardian of the gate to Hades, also known as Hell.
No, I haven&#8217;t joined satanism, this is just a mascotte, the mascotte for a new project I&#8217;ve been thinking on [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-119 aligncenter" title="Cerberus" src="http://giacomo.graziosi.info/wp-content/uploads/2008/09/cerberus.png" alt="Cerberus" width="500" height="319" /></p>
<p>What is this cool drooling puppy doing on my blog? His name is <a href="http://en.wikipedia.org/wiki/Cerberus">Cerberus</a>, he came from Greek mithology and he is nothing less than the guardian of the gate to Hades, also known as Hell.</p>
<p>No, I haven&#8217;t joined satanism, this is just a mascotte, the mascotte for a new project I&#8217;ve been thinking on lately: a Debian based Linux distribution specialized on video surveillace, its name will obviously be Cerberus :-).</p>
<p>Why am I building another Linux distribution? Well, the answer is very simple: in the last two years I&#8217;ve been selling video surveillance systems build on top of Debian or Ubuntu with <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome">Motion</a> and <a href="http://giacomo.graziosi.info/tag/vigilante/">Vigilante</a>. Assembling such systems requires to repeat each time a set of very specific steps such as installing the distribution with the needed packages, configuring the modprobe options for driver of the video capture card (often based on the bt878 chip), setup Motion and Vigilante, linking it all together on the user&#8217;s desktop. Most of these actions (excluding hardware probing/configuration) could be automatized, or better, saved prebuild in a proper environment.<br />
This is where Cerberus Linux enters the game: it is meant to act like firmwares on embedded Linux devices, a main read-only partition containing the distribution with a small overlay read-write (freezable to read-only) partition containing the configuration files.<br />
Why am I following the &#8220;embedded-firmware&#8221;-like way in place of a more common standard installation? First reason is robustness: making the system read-only prevents damage to the file system when doing hard resets (which are very common on this kind of systems, often seen as vhs recorders or table dvd players by the inexperienced users who will use them). Second reason is easy of use: you can (re)install and update the base system by rewriting the partition without caring about backups or installation process, is it just a call to dd, automatizable. Third reason: users are idiots, give them a writeable home and they will find a way to mess up the entire system, give them a writeable root file system and they will bring back the system as an ash heap claiming you sold them a broken thing.</p>
<p>So the roadmap so far is to build the distribution with the listed features, put a new Vigilante (based on Cluttermm/Gstreamermm) on it and maybe develop a remote web configuration system (maybe with ExtJS and Rails or Zend Framework or Webtoolkit).</p>
<p>Of course if you have any advice or proposal for Cerberus please contact me, any good idea will be welcomed.</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/10/01/cerberus-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SQLite3 support for Motion</title>
		<link>http://giacomo.graziosi.info/2008/09/30/sqlite3-support-for-motion/</link>
		<comments>http://giacomo.graziosi.info/2008/09/30/sqlite3-support-for-motion/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 14:30:13 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[open source]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[motion]]></category>

		<category><![CDATA[patch]]></category>

		<category><![CDATA[sqlite]]></category>

		<category><![CDATA[video surveillance]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=116</guid>
		<description><![CDATA[﻿One of the first problem occurred when developing the specialized video surveillance Linux distribution I&#8217;ve been working on these days is the database engine to be used to archive the list of recording files saved by Motion. As every write operation will be placed on a read-write file system layer on top of the main [...]]]></description>
			<content:encoded><![CDATA[<p>﻿One of the first problem occurred when developing the specialized video surveillance Linux distribution I&#8217;ve been working on these days is the database engine to be used to archive the list of recording files saved by Motion. As every write operation will be placed on a read-write file system layer on top of the main read-only layer (containing the whole “monolithic” distribution, something like the firmware on an embedded device) I have the need to store the whole database data in a compact manner, something like only one file and not similar to the /var/lib/mysql/ directory with its many entries.<br />
The problem with this is that Motion only supported MySQL and PostgreSQL so I had to add the SQLite layer by myself. As a result I have published a <a href="http://www.lavrsen.dk/twiki/bin/view/Motion/SQLite3Patch">patch on the Motion&#8217;s wiki</a>, test it please :-).</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/09/30/sqlite3-support-for-motion/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AMD backs OpenCL</title>
		<link>http://giacomo.graziosi.info/2008/08/28/amd-backs-opencl/</link>
		<comments>http://giacomo.graziosi.info/2008/08/28/amd-backs-opencl/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 10:53:20 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[computer science]]></category>

		<category><![CDATA[open source]]></category>

		<category><![CDATA[amd]]></category>

		<category><![CDATA[gpgpu]]></category>

		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=114</guid>
		<description><![CDATA[Maybe you didn&#8217;t notice but AMD is now pushing the OpenCL standard. This is a really great news, the first step to a common GPGPU technology: who on Earth would want force himself to write the same program for three different architectures ?
]]></description>
			<content:encoded><![CDATA[<p>Maybe you didn&#8217;t notice but <a href="http://www.amd.com/us-en/Corporate/VirtualPressRoom/0,,51_104_543~127451,00.html">AMD is now pushing the OpenCL standard</a>. This is a really great news, the first step to a common GPGPU technology: who on Earth would want force himself to write the same program for <a href="http://en.wikipedia.org/wiki/Larrabee_(GPU)">three</a> <a href="http://en.wikipedia.org/wiki/CUDA">different</a> <a href="http://en.wikipedia.org/wiki/Close_to_Metal">architectures</a> ?</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/08/28/amd-backs-opencl/feed/</wfw:commentRss>
		</item>
		<item>
		<title>VMware Workstation 6.5 beta test drive</title>
		<link>http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/</link>
		<comments>http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 20:10:35 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[computer science]]></category>

		<category><![CDATA[open source]]></category>

		<category><![CDATA[video]]></category>

		<category><![CDATA[directx]]></category>

		<category><![CDATA[gaming]]></category>

		<category><![CDATA[ogre]]></category>

		<category><![CDATA[virtualization]]></category>

		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=81</guid>
		<description><![CDATA[Let&#8217;s face it: when a Linux user wants to chill out for a little bit and play for a few minutes there is a good chance that the game he likes doesn&#8217;t like Linux at all. There is a very small number of commercial games working natively on Linux and making other Windows games run [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face it: when a Linux user wants to chill out for a little bit and play for a few minutes there is a good chance that the game he likes doesn&#8217;t like Linux at all. There is a very small number of commercial games working natively on Linux and making other Windows games run on top of Wine or Cedega isn&#8217;t straightforward everytime (especially if you try to run new games) so unless you <em>really</em> like FPSes like Quake, Unreal Tournament (up to the 2004 version) or the free Nexuiz or some other small game like SuperTux or TuxRacer you would probably want to try something else.</p>
<p>Before VMware Workstation 6.5 there were only two ways to do this: a gaming console or a dual boot with both Linux and Windows. Buying a console is too much for someone like me who doesn&#8217;t play more than 3 hours in a month and rebooting could really piss you off as it forces you to reset your working environment (unless you configure something like suspension to disk, but that&#8217;s quite another story).</p>
<p>This is where the new VMware <em>come into play</em> as it has a <strong><em>really</em></strong> working DirectX accelerated virtualization layer, I download and tested the version 6.5.0 build-110068 and found it to be quite stable on my computer with an NVIDIA 9600GT, an Intel Core2 Quad Q6600 clocked at 3.0Ghz and 2GB of RAM.</p>
<p>Of course don&#8217;t expect to get native hardware performances but the results are actually above my expectations, the major bottleneck is the low amount of RAM assigned to the virtual machine: <strong>please note</strong> that with only my 2GB I had to run my host operating system (x86_64 Debian Sid) and VMware itselft (which uses RAM other than the one assigned to the virtual machine) so in the end I was unable to assign more than 900MB to the guest Windows XP. This is the main reason behind the bad performances that you will see on the Unreal Tournament 3 test video, if you look carefully you will notice that it runs smoothly in complex scenes and then it suddently freezes: that&#8217;s where it has to swap data because of the low amount of RAM.</p>
<p>So, here we go, here the interesting part is&#8230;</p>
<p><a href="http://ogre3d.org">OGRE 3D</a> demos:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="src" value="http://www.youtube.com/v/rCh0xJUZvGc&amp;hl=it&amp;fs=1&amp;ap=%2526fmt%3D18" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/rCh0xJUZvGc&amp;hl=it&amp;fs=1&amp;ap=%2526fmt%3D18" allowfullscreen="true"></embed></object></p>
<p>Unreal Tournament 3 (keep in mind the low RAM thing explained above):</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="src" value="http://www.youtube.com/v/FgL9yX9-u5k&amp;hl=it&amp;fs=1&amp;ap=%2526fmt%3D18" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/FgL9yX9-u5k&amp;hl=it&amp;fs=1&amp;ap=%2526fmt%3D18" allowfullscreen="true"></embed></object></p>
<p>Various screenshot in this gallery:</p>

<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/nwn2_at_vmware65_w01/' title='NWN2 on VMware Workstation 6.5 beta (01)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/nwn2_at_vmware65_w01-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/nwn2_at_vmware65_w02/' title='NWN2 on VMware Workstation 6.5 beta (02)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/nwn2_at_vmware65_w02-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/nwn2_at_vmware65_w03/' title='NWN2 on VMware Workstation 6.5 beta (03)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/nwn2_at_vmware65_w03-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/nwn2_at_vmware65_w04/' title='NWN2 on VMware Workstation 6.5 beta (04)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/nwn2_at_vmware65_w04-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/nwn2_at_vmware65_w05/' title='NWN2 on VMware Workstation 6.5 beta (05)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/nwn2_at_vmware65_w05-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/nwn2_at_vmware65_w06/' title='NWN2 on VMware Workstation 6.5 beta (06)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/nwn2_at_vmware65_w06-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/ut3_at_vmware65_w01/' title='UT3 on VMware Workstation 6.5 beta (01)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/ut3_at_vmware65_w01-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/ut3_at_vmware65_w02/' title='UT3 on VMware Workstation 6.5 beta (02)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/ut3_at_vmware65_w02-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/ut3_at_vmware65_w03/' title='UT3 on VMware Workstation 6.5 beta (03)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/ut3_at_vmware65_w03-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/ut3_at_vmware65_w04/' title='UT3 on VMware Workstation 6.5 beta (04)'><img src="http://giacomo.graziosi.info/wp-content/uploads/2008/08/ut3_at_vmware65_w04-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>

<p>If you liked it why don&#8217;t <a href="http://digg.com/linux_unix/http_giacomo_graziosi_info_2008_08_20_vmware_workstation_6">digg it</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/08/20/vmware-workstation-65-beta-test-drive/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What I don’t like in Ruby</title>
		<link>http://giacomo.graziosi.info/2008/07/22/what-i-dont-like-in-ruby/</link>
		<comments>http://giacomo.graziosi.info/2008/07/22/what-i-dont-like-in-ruby/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 12:34:13 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[computer science]]></category>

		<category><![CDATA[c++]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=76</guid>
		<description><![CDATA[I&#8217;m beginning to learn the well hyped Ruby language, in many ways it looks useful, elegant and pleasant, still it has something that, at least at a first glance, looks odd to me. I will use this post to take track of those odd things that I will meet when studying the language.
So, here we [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m beginning to learn the well hyped Ruby language, in many ways it looks useful, elegant and pleasant, still it has something that, at least at a first glance, looks odd to me. I will use this post to take track of those odd things that I will meet when studying the language.</p>
<p>So, here we go:</p>
<p><strong>1) Ends</strong>, take a look on this snippet:</p>
<pre><span style="font-weight: bold; color: #000000;">if</span><span style="color: #ff00ff;"> !</span><span style="color: #000000;">r</span><span style="color: #4000a7;">.nil?</span><span style="color: #000000;"> </span><span style="font-weight: bold; color: #000000;">then</span>
<span style="color: #000000;">  rr </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> r</span><span style="color: #4000a7;">.right</span>
<span style="color: #000000;">  </span><span style="font-weight: bold; color: #000000;">if</span><span style="color: #ff00ff;"> !</span><span style="color: #000000;">rr</span><span style="color: #4000a7;">.nil?</span><span style="color: #000000;"> </span><span style="font-weight: bold; color: #000000;">then</span>
<span style="color: #000000;">    </span><span style="font-weight: bold; color: #000000;">if</span><span style="color: #000000;"> ((r</span><span style="color: #4000a7;">.color</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">==</span><span style="color: #000000;"> </span><span style="color: #800000;">RedBlackTree</span><span style="color: #ff00ff;">::</span><span style="color: #bb1188;">RED</span><span style="color: #000000;">)</span><span style="font-weight: bold; color: #000000;">and</span><span style="color: #000000;">(rr</span><span style="color: #4000a7;">.color</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">==</span><span style="color: #000000;"> </span><span style="color: #800000;">RedBlackTree</span><span style="color: #ff00ff;">::</span><span style="color: #bb1188;">RED</span><span style="color: #000000;">)) </span><span style="font-weight: bold; color: #000000;">then</span>
<span style="color: #000000;">      x </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> rot_left()</span>
<span style="color: #000000;">      copy(x) </span><span style="font-weight: bold; color: #000000;">unless</span><span style="color: #000000;"> x</span><span style="color: #4000a7;">.nil?</span>
<span style="color: #000000;">      </span><span style="color: #008000;">@color</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">RedBlackTree</span><span style="color: #ff00ff;">::</span><span style="color: #bb1188;">BLACK</span>
<span style="color: #000000;">      l </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> </span><span style="color: #008000;">@left</span>
<span style="color: #000000;">      l</span><span style="color: #4000a7;">.color</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">RedBlackTree</span><span style="color: #ff00ff;">::</span><span style="color: #bb1188;">RED</span><span style="color: #000000;"> </span><span style="font-weight: bold; color: #000000;">unless</span><span style="color: #000000;"> l</span><span style="color: #4000a7;">.nil?</span>
<span style="color: #000000;">    </span><span style="font-weight: bold; color: #000000;">end</span>
<span style="color: #000000;">  </span><span style="font-weight: bold; color: #000000;">end</span>
<span style="font-weight: bold; color: #000000;">end</span></pre>
<p>and here comes the Python equivalent:</p>
<pre><span style="font-weight: bold; color: #000000;">if</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">(</span><span style="color: #000000;">right </span><span style="color: #ff00ff;">!=</span><span style="color: #000000;"> </span><span style="color: #008000;">None</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">    rr </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> right.__right</span>
<span style="color: #000000;">    </span><span style="font-weight: bold; color: #000000;">if</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">(</span><span style="color: #000000;">rr </span><span style="color: #ff00ff;">!=</span><span style="color: #000000;"> </span><span style="color: #008000;">None</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">        </span><span style="font-weight: bold; color: #000000;">if</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">((</span><span style="color: #000000;">right.__color </span><span style="color: #ff00ff;">==</span><span style="color: #000000;"> RedBlackTree.red</span><span style="color: #ff00ff;">)</span><span style="font-weight: bold; color: #000000;">and</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">rr.__color </span><span style="color: #ff00ff;">==</span><span style="color: #000000;"> RedBlackTree.red</span><span style="color: #ff00ff;">)):</span>
<span style="color: #000000;">            x </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> </span><span style="color: #008000;">self</span><span style="color: #000000;">.__rotLeft</span><span style="color: #ff00ff;">()</span>
<span style="color: #000000;">            </span><span style="font-weight: bold; color: #000000;">if</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">(</span><span style="color: #000000;">x </span><span style="color: #ff00ff;">!=</span><span style="color: #000000;"> </span><span style="color: #008000;">None</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">                </span><span style="color: #008000;">self</span><span style="color: #000000;">.__copy</span><span style="color: #ff00ff;">(</span><span style="color: #000000;">x</span><span style="color: #ff00ff;">)</span>
<span style="color: #000000;">            </span><span style="color: #008000;">self</span><span style="color: #000000;">.__color </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> RedBlackTree.black</span>
<span style="color: #000000;">            left </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> </span><span style="color: #008000;">self</span><span style="color: #000000;">.__left</span>
<span style="color: #000000;">            </span><span style="font-weight: bold; color: #000000;">if</span><span style="color: #000000;"> </span><span style="color: #ff00ff;">(</span><span style="color: #000000;">left </span><span style="color: #ff00ff;">!=</span><span style="color: #000000;"> </span><span style="color: #008000;">None</span><span style="color: #ff00ff;">):</span>
<span style="color: #000000;">                left.__color </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> RedBlackTree.red</span></pre>
<p>The Python way looks just the best way in my opinion. What&#8217;s the reason for the ends when you&#8217;ll indent the code anyway (and if you don&#8217;t then you deserve nothing else than suffering and pain)? Even the <strong>{</strong> C/C++/Java approach <strong>}</strong> appears way better or at least less intrusive.</p>
<p><strong>2) &#8220;Fuzzy&#8221; expressions terminators.</strong> Try to compile and execute the following C++ code:</p>
<pre><span style="color: #008000;">#include &lt;iostream&gt;</span>
<span style="font-weight: bold; color: #000000;">using</span><span style="color: #000000;"> </span><span style="font-weight: bold; color: #000000;">namespace</span><span style="color: #000000;"> std;</span>

<span style="font-weight: bold; color: #000000;">class</span><span style="color: #000000;"> Foo {</span>
<span style="color: #000000;">    </span><span style="font-weight: bold; color: #000000;">public</span><span style="color: #000000;">:</span>
<span style="color: #000000;">    </span><span style="color: #800000;">void</span><span style="color: #000000;"> bar() {</span>
<span style="color: #000000;">        </span><span style="color: #800000;">int</span><span style="color: #000000;"> x = </span><span style="color: #0000ff;">3</span><span style="color: #000000;">;</span>
<span style="color: #000000;">        </span><span style="color: #800000;">int</span><span style="color: #000000;"> y = </span><span style="color: #0000ff;">2</span><span style="color: #000000;">;</span>
<span style="color: #000000;">        cout &lt;&lt; x</span>
<span style="color: #000000;">        +y;</span>
<span style="color: #000000;">        cout &lt;&lt; endl;</span>
<span style="color: #000000;">    }</span>
<span style="color: #000000;">};</span>

<span style="color: #800000;">int</span><span style="color: #000000;"> main() {</span>
<span style="color: #000000;">    Foo *f = </span><span style="font-weight: bold; color: #000000;">new</span><span style="color: #000000;"> Foo;</span>
<span style="color: #000000;">    f-&gt;bar();</span>
<span style="color: #000000;">    </span><span style="font-weight: bold; color: #000000;">delete</span><span style="color: #000000;">(f);</span>
<span style="color: #000000;">    </span><span style="font-weight: bold; color: #000000;">return</span><span style="color: #000000;"> </span><span style="color: #0000ff;">0</span><span style="color: #000000;">;</span>
<span style="color: #000000;">}</span></pre>
<p>What do you expect it to print? Right, it will correctly print <em>5</em>. Now Ruby&#8217;s turn:</p>
<pre><span style="font-weight: bold; color: #000000;">class</span><span style="color: #000000;"> </span><span style="color: #800000;">Foo</span>
<span style="color: #000000;">  </span><span style="font-weight: bold; color: #000000;">def</span><span style="color: #000000;"> bar</span>
<span style="color: #000000;">    x,y </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">3,2</span>
<span style="color: #000000;">    </span><span style="color: #000080;">puts</span><span style="color: #000000;"> x</span>
<span style="color: #000000;">    </span><span style="color: #ff00ff;">+</span><span style="color: #000000;">y</span>
<span style="color: #000000;">  </span><span style="font-weight: bold; color: #000000;">end</span>
<span style="font-weight: bold; color: #000000;">end</span>

<span style="color: #000000;">f </span><span style="color: #ff00ff;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">Foo</span><span style="color: #4000a7;">.new</span><span style="color: #000000;">()</span>
<span style="color: #000000;">f</span><span style="color: #4000a7;">.bar</span></pre>
<p>Now what output do you expect? The answer is <em>3</em>. This is because Ruby doesn&#8217;t use semicolons as C, C++, Java, PHP and many other languages do to terminate statements. It is still the better way to go, semicolons are redundants useless things almost everytime, still you have to pay attention: note that the above Ruby code isn&#8217;t wrong so the interpreter will not warn you, it will just print <em>3</em> instead of <em>5</em> and the method <em>bar</em> will return the value <em>2</em> (remember that in Ruby the last expression in a method or function is the actual return value of it so if you replace <em>f.bar</em> with <em>puts f.bar</em> it will print the &#8220;missing&#8221; <em>2</em>).</p>
<p><strong>3) No method overloading.</strong> The following code is self-explanatory:</p>
<pre><span style="color: #141312;"><strong>class</strong> </span><span style="color: #0057ae;">Foo</span>
<span style="color: #141312;">    <strong>def</strong> bar(a, b)</span>
<span style="color: #141312;">        </span><span style="color: #000080;">puts</span><span style="color: #141312;"> b</span>
<span style="color: #141312;">    <strong>end</strong></span>
<span style="color: #141312;">    </span>
<span style="color: #141312;">    <strong>def</strong> bar(a)</span>
<span style="color: #141312;">        </span><span style="color: #000080;">puts</span><span style="color: #141312;"> a</span>
<span style="color: #141312;">    <strong>end</strong></span>
<span style="color: #141312;"><strong>end</strong></span>

<span style="color: #141312;">gh </span><span style="color: #ff9fec;">=</span><span style="color: #141312;"> </span><span style="color: #0057ae;">Foo</span><span style="color: #4000a7;">.new</span><span style="color: #141312;">()</span>
<span style="color: #141312;">gh</span><span style="color: #4000a7;">.bar</span><span style="color: #141312;">(</span><span style="color: #bf0303;">"hello"</span><span style="color: #141312;">, </span><span style="color: #bf0303;">"world"</span><span style="color: #141312;">)</span></pre>
<p>if you try to execute it then you will get something like this:</p>
<blockquote><p>asd.rb:12:in `bar&#8217;: wrong number of arguments (2 for 1) (ArgumentError)<br />
from asd.rb:12</p></blockquote>
<p><strong>4) GIL (global interpreter lock).</strong> To me it&#8217;s nothing else than an alternative reading for &#8220;fake threading&#8221;. If you are on a multicore/multicpu system try to execute this snippet while monitoring the cpu activity, it will start 8 threads and compute fibonacci(40) on each thread:</p>
<pre><span style="color: #141312;"><strong>class</strong> </span><span style="color: #0057ae;">Fibonacci</span>
<span style="color: #141312;">    <strong>def</strong> fib(i)</span>
<span style="color: #141312;">        <strong>if</strong> (i </span><span style="color: #ff9fec;">&lt;=</span><span style="color: #141312;"> </span><span style="color: #b08000;">2</span><span style="color: #141312;">)</span>
<span style="color: #141312;">            <strong>return</strong> </span><span style="color: #b08000;">1</span>
<span style="color: #141312;"><strong>        else</strong></span>
<span style="color: #141312;">            <strong>return</strong> fib(i </span><span style="color: #ff9fec;">-</span><span style="color: #141312;"> </span><span style="color: #b08000;">1</span><span style="color: #141312;">) </span><span style="color: #ff9fec;">+</span><span style="color: #141312;"> fib(i </span><span style="color: #ff9fec;">-</span><span style="color: #141312;"> </span><span style="color: #b08000;">2</span><span style="color: #141312;">)</span>
<span style="color: #141312;">        <strong>end</strong></span>
<span style="color: #141312;">    <strong>end</strong></span>
<span style="color: #141312;"><strong>end</strong></span>

<span style="color: #141312;">threads </span><span style="color: #ff9fec;">=</span><span style="color: #141312;"> </span><span style="color: #ff9fec;">[]</span>
<span style="color: #b08000;">8</span><span style="color: #4000a7;">.times</span><span style="color: #141312;"> </span><span style="color: #ff9fec;">{</span><span style="color: #141312;"> </span><span style="color: #ff9fec;">|</span><span style="color: #141312;">i</span><span style="color: #ff9fec;">|</span><span style="color: #141312;"> threads</span><span style="color: #ff9fec;">[</span><span style="color: #141312;">i</span><span style="color: #ff9fec;">]</span><span style="color: #141312;"> </span><span style="color: #ff9fec;">=</span><span style="color: #141312;"> </span><span style="color: #0057ae;">Thread</span><span style="color: #4000a7;">.new</span><span style="color: #141312;"> </span><span style="color: #ff9fec;">{</span><span style="color: #0057ae;">Fibonacci</span><span style="color: #4000a7;">.new</span><span style="color: #141312;">()</span><span style="color: #4000a7;">.fib</span><span style="color: #141312;">(</span><span style="color: #b08000;">30</span><span style="color: #141312;">) </span><span style="color: #ff9fec;">}</span><span style="color: #141312;"> </span><span style="color: #ff9fec;">}</span>
<span style="color: #141312;">threads</span><span style="color: #4000a7;">.each</span><span style="color: #141312;"> </span><span style="color: #ff9fec;">{|</span><span style="color: #141312;">t</span><span style="color: #ff9fec;">|</span><span style="color: #141312;"> t</span><span style="color: #4000a7;">.join</span><span style="color: #ff9fec;">}</span></pre>
<p>If you come from C/C++ or Java you may expect this code to use up to 8 cores/cpus on your system at the same time&#8230; wrong! It will execute the code using only one core/cpu at once because the GIL prevents the threads from taking control of the interpreter at the same time. Cool, isn&#8217;t it?</p>
<p><strong>5) Method invocation hooking.</strong> The following is the best way I found to intercept whenever a method is called:</p>
<pre><span style="color: #141312;"><strong>class</strong> </span><span style="color: #0057ae;">Foo</span>
<span style="color: #141312;">  <strong>def</strong> bar1(gh1</span>)
<span style="color: #141312;">    </span><span style="color: #000080;">puts</span><span style="color: #141312;"> </span><span style="color: #bf0303;">"bar1 </span><span style="color: #006e28;">#{</span><span style="color: #141312;">gh1</span><span style="color: #006e28;">}</span><span style="color: #bf0303;">"</span>
<span style="color: #141312;">  <strong>end</strong></span>
<span style="color: #141312;"><strong>end

</strong></span><span style="color: #141312;"><strong>class</strong> </span><span style="color: #0057ae;">Foo</span>
<span style="color: #141312;">  <strong>def</strong> bar1_hook(</span><span style="color: #ff9fec;">*</span><span style="color: #141312;">args)</span>
<span style="color: #141312;">    </span><span style="color: #000080;">puts</span><span style="color: #141312;"> </span><span style="color: #bf0303;">"bar1 hooked!"</span>
<span style="color: #141312;">    bar1_asd(args)</span>
<span style="color: #141312;">  <strong>end</strong></span>

<span style="color: #141312;">  alias_method(</span><span style="color: #d40000;">:bar1_asd</span><span style="color: #141312;">, </span><span style="color: #d40000;">:bar1</span><span style="color: #141312;">)</span>
<span style="color: #141312;">  alias_method(</span><span style="color: #d40000;">:bar1</span><span style="color: #141312;">, </span><span style="color: #d40000;">:bar1_hook</span><span style="color: #141312;">)</span>
<span style="color: #141312;"><strong>end</strong></span>

<span style="color: #141312;">a </span><span style="color: #ff9fec;">=</span><span style="color: #141312;"> </span><span style="color: #0057ae;">Foo</span><span style="color: #4000a7;">.new</span>
<span style="color: #141312;">a</span><span style="color: #4000a7;">.bar1</span><span style="color: #141312;">(</span><span style="color: #bf0303;">"foobar"</span>)</pre>
<p>So <em>bar1</em> is the method to be hooked: you have to monkey patch the <em>Foo</em> class defining the hooking method and hack it all together with alias_method. Doing this you are ripping the original class apart: if someone will edit the <em>bar1</em> method after your hook he/she will actually be editing the <em>bar1_hook</em> method without even noticing it (well, he will notice the unexpected behaviour and maybe try to debug his/her own code&#8230; have fun :-|), I really hope to be wrong about this point&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/07/22/what-i-dont-like-in-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bordello s’allarga per accogliere i «Papa boys»</title>
		<link>http://giacomo.graziosi.info/2008/07/01/bordello-sallarga-per-accogliere-i-%c2%abpapa-boys%c2%bb/</link>
		<comments>http://giacomo.graziosi.info/2008/07/01/bordello-sallarga-per-accogliere-i-%c2%abpapa-boys%c2%bb/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 11:06:36 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[italiano]]></category>

		<category><![CDATA[politics]]></category>

		<category><![CDATA[thoughts]]></category>

		<category><![CDATA[religion]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=79</guid>
		<description><![CDATA[Sono semplicemente senza parole anche se mi rendo perfettamente conto che ce ne sarebbero fin troppe da dire&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Sono semplicemente <a href="http://www.corriere.it/esteri/08_luglio_01/sydney_bordello_meeting_giovani_cattolici_5fbd5c50-474c-11dd-8c36-00144f02aabc.shtml">senza parole</a> anche se mi rendo perfettamente conto che ce ne sarebbero fin troppe da dire&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/07/01/bordello-sallarga-per-accogliere-i-%c2%abpapa-boys%c2%bb/feed/</wfw:commentRss>
		</item>
		<item>
		<title>They require darkness in order to shine</title>
		<link>http://giacomo.graziosi.info/2008/06/28/they-require-darkness-in-order-to-shine/</link>
		<comments>http://giacomo.graziosi.info/2008/06/28/they-require-darkness-in-order-to-shine/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 13:05:45 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[politics]]></category>

		<category><![CDATA[thoughts]]></category>

		<category><![CDATA[creationism]]></category>

		<category><![CDATA[darwinism]]></category>

		<category><![CDATA[religion]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=78</guid>
		<description><![CDATA[Princes use God as a bogey to get their grown-up children to bed when nothing else will any longer serve; which is why they value him so highly. [...] Since that ultima ratio theologorum (final argument of theology), the stake, has gone out of use, the effectiveness of this means of government has much diminished. [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Princes use God as a bogey to get their grown-up children to bed when nothing else will any longer serve; which is why they value him so highly. [...] Since that ultima ratio theologorum (final argument of theology), the stake, has gone out of use, the effectiveness of this means of government has much diminished. For, as you know, religions are like fireflies: they require darkness in order to shine. A certain degree of general ignorance is the condition for the existence of any religion, the element in which alone it is able to live.</p>
<p style="text-align: right;">Arthur Schopenhauer</p>
</blockquote>
<p><a href="http://arstechnica.com/news.ars/post/20080627-louisiana-passes-first-antievolution-academic-freedom-law.html">Darkness</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/06/28/they-require-darkness-in-order-to-shine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Khronos to standardize GPGPU, evaluting OpenCL</title>
		<link>http://giacomo.graziosi.info/2008/06/28/khronos-to-standardize-gpgpu-evaluting-opencl/</link>
		<comments>http://giacomo.graziosi.info/2008/06/28/khronos-to-standardize-gpgpu-evaluting-opencl/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 12:36:50 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[computer science]]></category>

		<category><![CDATA[gpgpu]]></category>

		<category><![CDATA[opencl]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=77</guid>
		<description><![CDATA[I was almost going to miss this press release from the Khronos Group (the industrial group behind standards like OpenGL), looks like they are finally getting serious with general purpose computing on GPUs with the launch of a working group to create open standards for it. This group is going to include names like AMD, [...]]]></description>
			<content:encoded><![CDATA[<p>I was almost going to miss <a href="http://www.khronos.org/news/press/releases/khronos_launches_heterogeneous_computing_initiative/">this press release</a> from the Khronos Group (the industrial group behind standards like OpenGL), looks like they are finally getting serious with general purpose computing on GPUs with the launch of a working group to create open standards for it. This group is going to include names like AMD, Apple, ARM, Freescale, IBM, Intel, Nokia, NVIDIA and many others so we can expect something really big coming out of it. Apple has already proposed <a href="http://en.wikipedia.org/wiki/OpenCL">OpenCL</a>, maybe it won&#8217;t take so long before we can put our hands on a cross platform GPGPU tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/06/28/khronos-to-standardize-gpgpu-evaluting-opencl/feed/</wfw:commentRss>
		</item>
		<item>
		<title>22</title>
		<link>http://giacomo.graziosi.info/2008/04/05/22/</link>
		<comments>http://giacomo.graziosi.info/2008/04/05/22/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 01:23:14 +0000</pubDate>
		<dc:creator>Giacomo</dc:creator>
		
		<category><![CDATA[art]]></category>

		<category><![CDATA[wordless]]></category>

		<category><![CDATA[me]]></category>

		<guid isPermaLink="false">http://giacomo.graziosi.info/?p=75</guid>
		<description><![CDATA[\o/&#8217;
Edit: my swiss friend Christian &#8220;bsolar&#8221; Apolloni brought this to my attention, so funny&#8230;
]]></description>
			<content:encoded><![CDATA[<p>\o/&#8217;</p>
<p>Edit: my swiss friend Christian &#8220;bsolar&#8221; Apolloni brought <a href="http://rotten.com/today/">this</a> to my attention, so funny&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://giacomo.graziosi.info/2008/04/05/22/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
