<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>x3ro&#039;s blog</title>
	<atom:link href="http://x3ro.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://x3ro.de</link>
	<description>Yet another blog</description>
	<lastBuildDate>Mon, 19 Dec 2011 15:23:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fixing playback delay in iTunes on Mac OS X</title>
		<link>http://x3ro.de/fixing-playback-delay-itunes-mac-os/</link>
		<comments>http://x3ro.de/fixing-playback-delay-itunes-mac-os/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 15:23:09 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[multiple speakers]]></category>
		<category><![CDATA[playback]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=346</guid>
		<description><![CDATA[Recently I noticed that it was taking ages for iTunes to start playback of any audio file (up to 3 seconds). I found a solution for my problem in the Apple Support Communities: One just has to disable the &#8220;Multiple Speakers&#8221; feature of iTunes when not streaming to any AirPort speakers, because iTunes seems to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I noticed that it was taking ages for iTunes to start playback of any audio file (up to 3 seconds). I found a solution for my problem in the <a href="https://discussions.apple.com/thread/2539259?start=0&amp;tstart=0">Apple Support Communities</a>: One just has to disable the &#8220;Multiple Speakers&#8221; feature of iTunes when not streaming to any AirPort speakers, because iTunes seems to try to connect to them every time you start playback.</p>

<p>If you have &#8220;Multiple Speakers&#8221; enabled, you should see an icon in the lower right corner of the window saying so. This is where you can disable it, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/fixing-playback-delay-itunes-mac-os/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coding-Journal.com</title>
		<link>http://x3ro.de/codingjournalcom/</link>
		<comments>http://x3ro.de/codingjournalcom/#comments</comments>
		<pubDate>Mon, 23 May 2011 01:29:38 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=337</guid>
		<description><![CDATA[Hey there folks. This blog has gone from being a mere reference for myself to at least having a small number of visits every day :) But from now on I will be putting my work into a new blog project, Coding Journal, which will cover every coding-related topic we, that is my friends Marian, [...]]]></description>
			<content:encoded><![CDATA[<p>Hey there folks.</p>

<p>This blog has gone from being a mere reference for myself to at least having a small number of visits every day :) But from now on I will be putting my work into a new blog project, <a href="http://coding-journal.com">Coding Journal</a>, which will cover every coding-related topic we, that is my friends Marian, Peter and I, come in contact with.</p>

<p>I&#8217;ll migrate some of the content from this blog to CJ as soon as I figure out how to do it without breaking all the links.</p>

<p>Visit us at <a href="http://coding-journal.com">Coding Journal</a> :)</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/codingjournalcom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cygwin + VMware: Unable to resolve host address</title>
		<link>http://x3ro.de/cygwin-vmware-unable-resolve-host-address/</link>
		<comments>http://x3ro.de/cygwin-vmware-unable-resolve-host-address/#comments</comments>
		<pubDate>Thu, 19 May 2011 18:26:59 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[nat]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=331</guid>
		<description><![CDATA[When working with Cygwin inside VMware, I had the weird problem of not being able to download stuff using wget or cloning repositories with git because I got the following or similar error messages: Resolving google.de (google.de)... failed: Non-recoverable failure in name resolution. wget: unable to resolve host address `google.de' I really don&#8217;t know what [...]]]></description>
			<content:encoded><![CDATA[<p>When working with Cygwin inside VMware, I had the weird problem of not being able to download stuff using <code>wget</code> or cloning repositories with <code>git</code> because I got the following or similar error messages:</p>

<pre><code>Resolving google.de (google.de)... failed: Non-recoverable failure in name resolution.
wget: unable to resolve host address `google.de'
</code></pre>

<p>I really don&#8217;t know what causes this problem (and if anyone knows, please feel free to leave a comment), but it turns out that it does not occur when you switch your networking mode for <strong>NAT</strong> to <strong>Bridged</strong>. At least that worked from me :)</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/cygwin-vmware-unable-resolve-host-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cygwin: Running an sshd on Windows 7</title>
		<link>http://x3ro.de/cygwin-running-sshd-windows-7/</link>
		<comments>http://x3ro.de/cygwin-running-sshd-windows-7/#comments</comments>
		<pubDate>Thu, 19 May 2011 18:14:28 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=328</guid>
		<description><![CDATA[Currently I am writing a build script for a UNIX application which needs to be built for Windows using the Cygwin environment. I quickly got tired of working inside the default Cygwin window (which doesn&#8217;t even have proper copy &#38; paste), so I installed a SSH server to work on the Cygwin environment remotely: First [...]]]></description>
			<content:encoded><![CDATA[<p>Currently I am writing a build script for a UNIX application which needs to be built for Windows using the <a href="http://www.cygwin.com/">Cygwin environment</a>. I quickly got tired of working inside the default Cygwin window (which doesn&#8217;t even have proper copy &amp; paste), so I installed a SSH server to work on the Cygwin environment remotely:</p>

<ol>
<li><p>First of all, you need to install the SSH package using the Cygwin installer. If you already installed Cygwin don&#8217;t worry, just re-run the installer and you&#8217;ll be fine. When you reach the &#8220;<strong>Select Packages</strong>&#8221; section, just enter <code>ssh</code> into the search field, open the &#8220;Net&#8221; section and select the &#8220;openssh&#8221; package.</p></li>
<li><p>Now make sure that your Cygwin shell is started in administrative mode, by right-clicking the Cygwin icon and selecting <code>Run as administrator</code>.</p></li>
<li><p>In your shell, run <code>ssh-host-config -y</code> which will create the necessary configuration files for your SSH server.</p></li>
<li><p>Set a password for your account (which you will connect to via SSH) by running <code>passwd</code>. If you are unsure which is your username, just run <code>whoami</code>.</p></li>
<li><p>Now you can start your server by running <code>cygrunsrv --start sshd</code></p></li>
<li><p>You will need to disable your Windows Firewall, either completely, or for <a href="http://windows.microsoft.com/en-US/windows-vista/Open-a-port-in-Windows-Firewall">TCP connections to port 22</a>.</p></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/cygwin-running-sshd-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3 Routing Parameters with Dots</title>
		<link>http://x3ro.de/rails-3-routing-parameters-dots/</link>
		<comments>http://x3ro.de/rails-3-routing-parameters-dots/#comments</comments>
		<pubDate>Wed, 18 May 2011 14:05:11 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=325</guid>
		<description><![CDATA[By default, Rails 3 interprets a dot in a URL as a format specifier. For example, given the route match "/foo/:search" and the URL /foo/bar.baz, this would result in the following parameters being passed: { :search =&#62; "bar", :format =&#62; "baz" } This may not be what you desire, so here is a quick workaround, [...]]]></description>
			<content:encoded><![CDATA[<p>By default, Rails 3 interprets a dot in a URL as a format specifier. For example, given the route</p>

<pre><code>match "/foo/:search"
</code></pre>

<p>and the URL <code>/foo/bar.baz</code>, this would result in the following parameters being passed:</p>

<pre><code>{ :search =&gt; "bar", :format =&gt; "baz" }
</code></pre>

<p>This may not be what you desire, so here is a quick workaround, using <a href="http://edgeguides.rubyonrails.org/routing.html#segment-constraints">segment constraints</a>:</p>

<pre><code>match "/foo/:search", :constraints =&gt; { :search =&gt; /[^\/]*/ }
</code></pre>

<p>The constraint for the <code>:search</code> parameter now matches anything but a slash, which includes the dot, and Rails will no longer interpret it as a format.</p>

<p>Thanks to <a href="http://zargony.com/2009/05/05/routing-parameters-with-a-dot">this guy</a>, who led me in the right direction.</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/rails-3-routing-parameters-dots/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Chrom(e&#124;ium) without the &#8220;Open frame in new tab&#8221; feature</title>
		<link>http://x3ro.de/chrome-without-open-frame-tab-feature/</link>
		<comments>http://x3ro.de/chrome-without-open-frame-tab-feature/#comments</comments>
		<pubDate>Mon, 02 May 2011 06:40:20 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Chromium]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=318</guid>
		<description><![CDATA[Apparently the Chrome development team is becoming as ignorant as the Internet Explorer development team has been for some time now. Seems to run in the family of browser developers or something, I don&#8217;t know. Anyway, as of Chrome v10, they&#8217;ve removed the &#8220;Right-click -> Open frame in new tab feature&#8221;, which I constantly used [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently the Chrome development team is becoming as ignorant as the Internet Explorer development team has been for some time now. Seems to run in the family of browser developers or something, I don&#8217;t know.</p>

<p>Anyway, as of Chrome v10, they&#8217;ve removed the &#8220;Right-click -> Open frame in new tab feature&#8221;, which I constantly used when developing. <a href="http://code.google.com/p/chromium/issues/detail?id=66129">Half a dozen bug reports</a>, with the main bug starred 37 times, have been ignored with a &#8220;WontFix&#8221; and the closing comment from a Chromium developer was just</p>

<blockquote>
  <p>The bug tracker is not a feedback forum.</p>
</blockquote>

<p>What do we learn? I totally agree with this comment, also posted in the bug report:</p>

<blockquote>
  <p>Once again (as with the &#8220;open file&#8221; and &#8220;http in the address bar issue&#8221;), Google makes the mistake with the &#8220;we know what you need&#8221; attitude. Chrome&#8217;s popularity is only as a result of its increased performance and usability. As the latter decreases and the former is mimicked by other browsers, Chrome will quickly go the way of Wave and Buzz.</p>
  
  <p>Microsoft was able to more or less &#8220;push the customer around&#8221; during IE&#8217;s heyday, but only because IE significantly dominated the browser market. In todays open market (where Chrome only occupies a small percentage), disgruntled users will be quick to turn to alternatives, especially as virtually all Chrome users are by definition not afraid to try something new.</p>
  
  <p>Nice try, Google, but maybe one day you&#8217;ll learn not to piss off your consumer base. As for me, I&#8217;m going to try the latest version of Firefox.</p>
</blockquote>

<p>Off to Firefox and Safari I go. Thanks Chrome/Chromium developers.</p>

<p>PS: Just not to confuse anyone. There is <a href="https://chrome.google.com/webstore/detail/kdhjgkkaacdhdioocfbpmhjidbinfajj">an extension</a> to bring the feature back, but my reason to switch to another browser is the ignorance of the developers, for dropping a feature, <strong>and not adding it again after lots and lots of complains from the users</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/chrome-without-open-frame-tab-feature/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Editing GitHub Wikis locally with the Gollum Gem</title>
		<link>http://x3ro.de/editing-github-wikis-locally-gollum-gem/</link>
		<comments>http://x3ro.de/editing-github-wikis-locally-gollum-gem/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 11:25:34 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Gems]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Gollum]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Wiki]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=311</guid>
		<description><![CDATA[You can easily edit your GitHub hosted wikis by cloning them to your local machines ( yes, the GitHub Wikis are also backed by Git ) and using your favorite text editor. Alternatively, GitHub open-sourced their Wiki software named Gollum which you can install as a Ruby Gem: $ gem install gollum This however will [...]]]></description>
			<content:encoded><![CDATA[<p>You can easily edit your GitHub hosted wikis by cloning them to your local machines ( yes, the GitHub Wikis are also <a href="https://github.com/blog/699-making-github-more-open-git-backed-wikis">backed by Git</a> ) and using your favorite text editor. Alternatively, GitHub open-sourced their Wiki software named Gollum which you can install as a Ruby Gem:</p>

<pre><code>$ gem install gollum
</code></pre>

<p>This however will not install some required Gems for editing, because those <a href="https://github.com/github/gollum/issues/101">seem to be considered development dependencies</a>. To install those dependencies, first install the &#8220;bundle&#8221; Gem:</p>

<pre><code>$ gem install bundler
</code></pre>

<p>Then check where your &#8220;Gollum&#8221;-Gem lies and install the development dependencies using the &#8220;bundler&#8221;-Gem:</p>

<pre><code>$ gem which gollum
/Users/lucas/.rvm/gems/ruby-1.9.2-p180/gems/gollum-1.3.0/lib/gollum.rb
$ bundle install /Users/lucas/.rvm/gems/ruby-1.9.2-p180/gems/gollum-1.3.0/
...
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
</code></pre>

<p>As you can see I stripped the last part of the path given by <code>gem which</code>, to the Gem&#8217;s root directory.</p>

<p>This should leave you with a working installation of Gollum which supports all the features the GitHub.com Wiki supports. Now navigate to your cloned wiki directory and run:</p>

<pre><code>$ gollum
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/editing-github-wikis-locally-gollum-gem/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Textmate &#8211; Automatically removing trailing whitespaces</title>
		<link>http://x3ro.de/textmate-automatically-removing-trailing-whitespaces/</link>
		<comments>http://x3ro.de/textmate-automatically-removing-trailing-whitespaces/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 11:15:51 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[trailing]]></category>
		<category><![CDATA[whitespaces]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=300</guid>
		<description><![CDATA[Finally found an easy solution to automatically remove trailing whitespaces when saving a file in Textmate. Addition: This approach seems to have its downsides though. Every time you save, Textmate will re-render the syntax highlighting of the entire file, and center the viewport on the cursor, which can be annoying sometimes. Guess I really have [...]]]></description>
			<content:encoded><![CDATA[<p>Finally found <a href="http://blogobaggins.com/2009/03/31/waging-war-on-whitespace.html">an easy solution</a> to automatically remove trailing whitespaces when saving a file in Textmate.</p>

<p><strong>Addition</strong>: This approach seems to have its downsides though. Every time you save, Textmate will re-render the syntax highlighting of the entire file, and center the viewport on the cursor, which can be annoying sometimes. Guess I really have to switch to Vim or MacVim if TextMate 2 isn&#8217;t released real soon :(</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/textmate-automatically-removing-trailing-whitespaces/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP 5.3 and Typo3 4.3 &#8211; t3lib_error_Exception</title>
		<link>http://x3ro.de/php-53-typo3-43-t3liberrorexception/</link>
		<comments>http://x3ro.de/php-53-typo3-43-t3liberrorexception/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 18:51:12 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Typo3]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=292</guid>
		<description><![CDATA[If you are already using PHP 5.3.x and you&#8217;ve just upgraded to Typo 4.3 or greater, Typo3 might start throwing exceptions where previously everything had worked out just fine. This is because the Typo3 developers chose to take some of the error handling into their own hands and raise exceptions for certain errors. Now these [...]]]></description>
			<content:encoded><![CDATA[<p>If you are already using PHP 5.3.x and you&#8217;ve just upgraded to Typo 4.3 or greater, Typo3 might start throwing exceptions where previously everything had worked out just fine.</p>

<p>This is because the Typo3 developers chose to take some of the error handling into their own hands and raise exceptions for certain errors. Now these &#8220;certain errors&#8221; for which exceptions are raised include E_DEPRECATED, and as a bunch of functions have been deprecated in PHP 5.3, well, you know where I&#8217;m going with this.</p>

<p>Fortunately, there is a configuration variable which allows to change the default behavior:</p>

<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$TYPO3_CONF_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SYS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'exceptionalErrors'</span><span style="color: #009900;">&#93;</span></div></div>

<p>The default value (defined in &#8220;t3lib/config_default.php&#8221;) is</p>

<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900; font-weight: bold;">E_ALL</span> ^ <span style="color: #009900; font-weight: bold;">E_NOTICE</span> ^ <span style="color: #009900; font-weight: bold;">E_WARNING</span> ^ <span style="color: #009900; font-weight: bold;">E_USER_ERROR</span> ^ <span style="color: #009900; font-weight: bold;">E_USER_NOTICE</span> ^ <span style="color: #009900; font-weight: bold;">E_USER_WARNING</span></div></div>

<p>To disable the deprecation exceptions, just add a <code>^ E_DEPRECATED</code> like this (the line goes in your localconf.php file):</p>

<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$TYPO3_CONF_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SYS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'exceptionalErrors'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">E_ALL</span> ^ <span style="color: #009900; font-weight: bold;">E_NOTICE</span> ^ <span style="color: #009900; font-weight: bold;">E_WARNING</span> ^ <span style="color: #009900; font-weight: bold;">E_USER_ERROR</span> ^ <span style="color: #009900; font-weight: bold;">E_USER_NOTICE</span> ^ <span style="color: #009900; font-weight: bold;">E_USER_WARNING</span> ^ E_DEPRECATED<span style="color: #339933;">;</span></div></div>

<p>Thanks to <a href="http://bingprofi.blogspot.com/2010/05/typo3-43-update-und-t3liberrorexception.html">this guy (link in German)</a> for sending me onto the right path.</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/php-53-typo3-43-t3liberrorexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby 1.9: Array to Hash</title>
		<link>http://x3ro.de/ruby-19-array-hash/</link>
		<comments>http://x3ro.de/ruby-19-array-hash/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 20:51:26 +0000</pubDate>
		<dc:creator>x3ro</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://x3ro.de/?p=280</guid>
		<description><![CDATA[If you google for &#8220;Array to Hash&#8221; then you will probably see this snippet close to the top of your search results, and it works pretty well too. However, since that snippet was posted, 6 years have passed, and with Ruby 1.9 it is a bit simpler now: Ruby &#60; 1.9: a = &#91;1, 2, [...]]]></description>
			<content:encoded><![CDATA[<p>If you google for &#8220;Array to Hash&#8221; then you will probably see <a href="http://snippets.dzone.com/posts/show/302">this snippet</a> close to the top of your search results, and it works pretty well too. However, since that snippet was posted, 6 years have passed, and with Ruby 1.9 it is a bit simpler now:</p>

<p>Ruby &lt; 1.9:</p>

<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">a = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>v<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">&#91;</span>v, v<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># =&gt; [ [1, 2], [2, 4], [3, 6] ]</span><br />
<span style="color:#CC00FF; font-weight:bold;">Hash</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">*</span>a.<span style="color:#9900CC;">flatten</span><span style="color:#006600; font-weight:bold;">&#93;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># =&gt; {1=&gt;2, 2=&gt;4, 3=&gt;6}</span></div></div>

<p>Ruby 1.9:</p>

<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">a = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>v<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">&#91;</span>v, v<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># =&gt; [ [1, 2], [2, 4], [3, 6] ]</span><br />
<span style="color:#CC00FF; font-weight:bold;">Hash</span><span style="color:#006600; font-weight:bold;">&#91;</span>a<span style="color:#006600; font-weight:bold;">&#93;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># =&gt; {1=&gt;2, 2=&gt;4, 3=&gt;6}</span></div></div>

<p>This is because Ruby 1.9 features a new form for Hash[  ]:</p>

<pre><code>Hash[ [ [key, value], ... ] ] → new_hash
</code></pre>

<p><a href="http://ruby-doc.org/core/classes/Hash.html#M000716">More info in the docs</a>.</p>

<p>No wonder Ruby is still my favorite language :)</p>
]]></content:encoded>
			<wfw:commentRss>http://x3ro.de/ruby-19-array-hash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

