<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:posterous="http://posterous.com/help/rss/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>connecting the dots . . .</title>
    <link>http://www.mikeivanov.com</link>
    <description>Most recent posts at connecting the dots . . .</description>
    <generator>posterous.com</generator>
    <link xmlns="http://www.w3.org/2005/Atom" href="http://posterous.com/api/sup_update#a16d101b9" type="application/json" rel="http://api.friendfeed.com/2008/03#sup" />
    
    
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/mikeivanov/VUvI" /><feedburner:info uri="mikeivanov/vuvi" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://posterous.superfeedr.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
      <pubDate>Tue, 10 Jan 2012 00:37:00 -0800</pubDate>
      <title>Machine Learning Class</title>
      <link>http://www.mikeivanov.com/machine-learning-class</link>
      <guid>http://www.mikeivanov.com/machine-learning-class</guid>
      <description>
        <![CDATA[<p>
	<p>Professor Ng rules. Concretely.</p>
<p><img src="http://dl.dropbox.com/u/5211432/ml-class-statement.png" alt="" /></p>
	
</p>

<p><a href="http://www.mikeivanov.com/machine-learning-class">Permalink</a> 

	| <a href="http://www.mikeivanov.com/machine-learning-class#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Thu, 22 Dec 2011 01:33:00 -0800</pubDate>
      <title>Stanford Artificial Intelligence Class</title>
      <link>http://www.mikeivanov.com/stanford-artificial-intellegence-class</link>
      <guid>http://www.mikeivanov.com/stanford-artificial-intellegence-class</guid>
      <description>
        <![CDATA[<p>
	<p>Just have got my Statement of Accomplishment - 95.6%. Better than I expected, worse than I could.</p>
<p>Anyways, at least it was fun. Many thanks to professors Thrun and Norvig and also to all those people who made it possible.</p>
<p><img src="http://dl.dropbox.com/u/5211432/ai-class-statement.png" alt="" /></p>
	
</p>

<p><a href="http://www.mikeivanov.com/stanford-artificial-intellegence-class">Permalink</a> 

	| <a href="http://www.mikeivanov.com/stanford-artificial-intellegence-class#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Mon, 12 Sep 2011 19:42:00 -0700</pubDate>
      <title>Now a part of the BuzzData team</title>
      <link>http://www.mikeivanov.com/now-a-part-of-the-buzzdata-team</link>
      <guid>http://www.mikeivanov.com/now-a-part-of-the-buzzdata-team</guid>
      <description>
        <![CDATA[<p>
	<p>Today is my first official work day at <a href="http://buzzdata.com">BuzzData</a>&mdash;a startup company devoted to humanization of data. That means, we facilitate the process of transforming raw data ore into all-powerful fuel of knowledge. We are the <a href="http://grammar.about.com/od/c/g/contextterm.htm">context</a>. Although there are newspapers, independent journalists, government agencies, data miners among our clients, BuzzData is perfect for everyone with good will and an interesting dataset. Come and try, it's free.</p>
<p>There was a lot of factors contributing to my decision to join BuzzData, but here is the most important one: an opportunity to join a team of highly skilled professionals and just amazingly friendly people. Also, this is not coincidental that I revived my interest in statistics, optimization, machine learning and related things not so long ago.</p>
<p>The first day was spent on figuring out an algorithm for computing distances in a multidimensional non-isomorphic space. Abstract algebra and all that stuff... Looks like there is a lot of fun there.</p>
<p>I also want to thank Shane Caraveo and David Eaves for heading me up. It wouldn't happen without their support.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/now-a-part-of-the-buzzdata-team">Permalink</a> 

	| <a href="http://www.mikeivanov.com/now-a-part-of-the-buzzdata-team#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Sat, 27 Aug 2011 22:54:00 -0700</pubDate>
      <title>How much can be done in four hours</title>
      <link>http://www.mikeivanov.com/how-much-can-be-done-in-four-hours</link>
      <guid>http://www.mikeivanov.com/how-much-can-be-done-in-four-hours</guid>
      <description>
        <![CDATA[<p>
	<p>Today I had an awesome day at the first OpenDataBC hackathon which took place at Mozilla&nbsp;Labs Vancouver.</p>
<p>Tara Gibbs pitched this wonderful idea of consolidating shelter availability data and displaying it on a few window displays, so the homeless people living DTES would not waste their time going from one shelter to another just to find a free spot.</p>
<p>This doesn't solve all the problems of course, but it does solve a little yet very annoying one.</p>
<p>So... At 11:30 we had nothing but an idea. We discussed possible approaches for a while, then came David Eaves and suggested using Twitter as a message queue service.</p>
<p>At approximately 12:00 we still had nothing but a piece of paper covered with boxes and arrows, then we started coding. Tara did the frontend, I was busy hacking the backend and the Twitter stuff.</p>
<p>Four hours later we had a fully functional, production ready system&nbsp;- <a href="https://github.com/mikeivanov/vanshelter">https://github.com/mikeivanov/vanshelter</a></p>
<p>How it is supposed to work:</p>
<ol>
<li>Shelters tweet their availability data (they all have internet access)</li>
<li>VanShelter monitors -- each of them independently -- receive Twitter updates and</li>
<li>Refresh their displays when something changes.</li>
</ol>
<p>For displays we can use cheap LCD monitors, probably even donated. The software will run on those amazing Raspberry thingies - <a href="http://www.raspberrypi.org/">http://www.raspberrypi.org/</a>, $25 each. This brings the full cost of installing 10 displays down to $250+.</p>
<p>Thank you Tara and David. Also, thank you Jeff and all the people who made this hackathon possible.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/how-much-can-be-done-in-four-hours">Permalink</a> 

	| <a href="http://www.mikeivanov.com/how-much-can-be-done-in-four-hours#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Sun, 14 Aug 2011 23:13:00 -0700</pubDate>
      <title>How I learned to like Ruby</title>
      <link>http://www.mikeivanov.com/i-like-ruby</link>
      <guid>http://www.mikeivanov.com/i-like-ruby</guid>
      <description>
        <![CDATA[<p>
	<p>The point of this rant is to <span style="text-decoration: line-through;">annoy people</span>&nbsp;share my experiences with Ruby.</p>
<p>As strange as it seems, I develop deep emotional relationships with programming languages. I love Python. I truly do. I totally irrationally hate Java (though I'm ok with JVM).&nbsp;</p>
<p>Now, I like Ruby.&nbsp;</p>
<p>Well, it has some little warts, but generally it is a very enjoyable language.</p>
<p>I didn't "get" Ruby for quite a long time because I tried to wrap my head around it from the wrong end. Ruby didn't like me, I didn't like Ruby -- it lasted until I realized a very simple thing: Ruby is not "like Perl".</p>
<p>The same happened many years ago with JavaScript. I disliked it so much so couldn't make myself write code in it. I hated it until it occurred to me that JavaScript is not "like Java". JavaScript is a <a href="http://javascript.crockford.com/javascript.html">Lisp in disguise</a>. Once I realized that, I stopped worrying and quickly found myself in an intimate, romantic relationship with JavaScript. It is still one of my favourite languages.</p>
<p>Then came Ruby. I had to use it because it was a part of my job. At first Ruby felt like a Perl with broken legs. I tried to make it run and it crawled. I missed one important detail: it didn't have legs at all -- it got wings. Ruby flies.</p>
<p>Here comes my little revelation: Ruby is a Smalltalk. Ruby has much more in common with Smalltalk than with anything else.&nbsp;</p>
<p>Actually it's a better Smalltalk.&nbsp;Since I realized that, I started to enjoy this beautiful language. Hey, peace and happiness -- welcome back.</p>
<p>Conclusion: it is often our own distorted perception that makes good things look ugly.</p>
<p>Rant mode off.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/i-like-ruby">Permalink</a> 

	| <a href="http://www.mikeivanov.com/i-like-ruby#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Sun, 14 Aug 2011 22:40:00 -0700</pubDate>
      <title>Simple things</title>
      <link>http://www.mikeivanov.com/simple-things</link>
      <guid>http://www.mikeivanov.com/simple-things</guid>
      <description>
        <![CDATA[<p>
	<p>It was a wonderful week. I didn't realize how much I needed to step away from the daily routine. This week was completely spent on (get jealous!):</p>
<ul>
<li>sleep</li>
<li>beer</li>
<li>football (Lions vs Winnipeg; it was an exciting game, yet a little bit disappointing -- we lost 17:30)</li>
<li>slacking on the beach</li>
<li>some hacking (just a little bit)</li>
<li>meeting some new people (really nice ones)</li>
</ul>
<p>The stuff I definitely didn't miss:</p>
<ul>
<li>nosy office</li>
<li>commuting to work (2 hours every day)</li>
<li>stress</li>
<li>coffee</li>
</ul>
<p>I'm happy now, at last.</p>
<p>&nbsp;</p>
	
</p>

<p><a href="http://www.mikeivanov.com/simple-things">Permalink</a> 

	| <a href="http://www.mikeivanov.com/simple-things#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Fri, 08 Jul 2011 17:53:00 -0700</pubDate>
      <title>Ruby keyword args</title>
      <link>http://www.mikeivanov.com/ruby-keyword-args</link>
      <guid>http://www.mikeivanov.com/ruby-keyword-args</guid>
      <description>
        <![CDATA[<p>
	<p>This doesn't make any sense to me:</p>
<div class="CodeRay">
  <div class="code"><pre>$ irb
ruby-1.9.2-p180 :001 &gt; def nofun(a=nil, b=nil)
ruby-1.9.2-p180 :002?&gt;   puts &quot;a=#{a}, b=#{b}&quot;
ruby-1.9.2-p180 :003?&gt;   end
 =&gt; nil 
ruby-1.9.2-p180 :004 &gt; nofun(b=&quot;b&quot;, a=&quot;a&quot;)
a=b, b=a
 =&gt; nil</pre></div>
</div>

<p>Why?..</p>
	
</p>

<p><a href="http://www.mikeivanov.com/ruby-keyword-args">Permalink</a> 

	| <a href="http://www.mikeivanov.com/ruby-keyword-args#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Tue, 28 Jun 2011 19:36:00 -0700</pubDate>
      <title>Pure Python Paillier Homomorphic Cryptosystem Implementation</title>
      <link>http://www.mikeivanov.com/pure-python-paillier-homomorphic-cryptosystem</link>
      <guid>http://www.mikeivanov.com/pure-python-paillier-homomorphic-cryptosystem</guid>
      <description>
        <![CDATA[<p>
	<h4>What</h4>
<p>This is a very basic <a href="http://en.wikipedia.org/wiki/Paillier_cryptosystem">Paillier Homomorphic Cryptosystem</a> implemented in pure <a href="http://python.org">Python</a>.</p>
<p>The idea is, in short, to encrypt two numbers, perform an "add" operation on cyphertexts, decrypt the result and find it to be the sum of the original plaintext numbers.</p>
<h4>How</h4>
<p>The code is loosely based on the <a href="http://code.google.com/p/thep/">thep project</a> and a few <a href="http://code.activestate.com/recipes/">ActiveState recipes</a>. The code is pure Python and all objects are serializable.</p>
<h4>Where</h4>
<p>Here: <a href="https://github.com/mikeivanov/paillier">https://github.com/mikeivanov/paillier</a></p>
<h4>Why</h4>
<p>I was bored.</p>
<p>&nbsp;</p>
	
</p>

<p><a href="http://www.mikeivanov.com/pure-python-paillier-homomorphic-cryptosystem">Permalink</a> 

	| <a href="http://www.mikeivanov.com/pure-python-paillier-homomorphic-cryptosystem#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Tue, 14 Jun 2011 19:37:00 -0700</pubDate>
      <title>Different emails for different Git repositories</title>
      <link>http://www.mikeivanov.com/different-emails-for-different-git-repositori</link>
      <guid>http://www.mikeivanov.com/different-emails-for-different-git-repositori</guid>
      <description>
        <![CDATA[<p>
	<p>On my laptop I have two directories:</p>
<ul>
<li><code>~/activestate</code>, where my work projects reside, and</li>
<li><code>~/me</code> -- for my personal stuff.</li>
</ul>
<p>The problem is, when I commit changes I want them to be properly attributed.&nbsp;More specifically:</p>
<ol>
<li>everything that belongs to ActiveState should be checked in using my work email</li>
<li>all other stuff checks in with my private address</li>
<li>I don't want to `<code>git config user.email &lt;...&gt;</code>` each time I clone a new repository ('cause I do it a lot).</li>
</ol>
<p>Here's what I've done:</p>
<ul>
<li>in my home directory I created a file called <code>~/.gitemail</code> containing just my private email. This address is going to be the default</li>
<li>to the <code>~/activestate</code> directory I added another <code>.gitemail</code> with my work address.</li>
<li>finally, I added this snippet to <code>~/.bashrc</code>:<br />
<div class="CodeRay">
  <div class="code"><pre>alias git='GIT_AUTHOR_EMAIL=$(
      p=$(pwd)
      while [[ $p != &quot;$HOME&quot; ]]; do
        [ -e $p/.gitemail ] &amp;&amp; cat $p/.gitemail &amp;&amp; break
        p=$(dirname $p)
      done) /usr/bin/git'</pre></div>
</div>

</li>
</ul>
<p>The alias scans all the directories up to the home dir looking for a file called&nbsp;<code>.gitemail</code>. When found, it sets the <code>GIT_AUTHOR_EMAIL</code> variable to the file's content.&nbsp;This effectively makes the actual <code>git</code> command use the subtree-specific email.&nbsp;Now, when I'm working e.g. in&nbsp;<code>~/activestate/stackato</code>, it will automatically pick up my work email from <code>~/activestate/.gitemail</code>.</p>
<p>No extra efforts, less things to remember, and no history rewriting anymore.</p>
<p>&nbsp;</p>
	
</p>

<p><a href="http://www.mikeivanov.com/different-emails-for-different-git-repositori">Permalink</a> 

	| <a href="http://www.mikeivanov.com/different-emails-for-different-git-repositori#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Thu, 09 Jun 2011 00:55:00 -0700</pubDate>
      <title>How to mount an NTFS-formatted USB drive in read-write mode on Mac OS X</title>
      <link>http://www.mikeivanov.com/how-to-mount-an-ntfs-formatted-usb-drive-in-r</link>
      <guid>http://www.mikeivanov.com/how-to-mount-an-ntfs-formatted-usb-drive-in-r</guid>
      <description>
        <![CDATA[<p>
	<p>Actually, it's very easy. No additional software is required. Just seven easy steps:</p>
<ol>
<li>Attach your USB drive</li>
<li>Open the Terminal app (Command-Space, then type "Terminal", hit Enter)</li>
<li>Type or copy/paste this command:
<div class="CodeRay">
  <div class="code"><pre>sudo sh -c &quot;mkdir -p /mnt $(mount | grep ntfs | head -n 1 \
   | awk '{ print &quot;&amp;&amp; umount &quot; $3 &quot; &amp;&amp; mount_ntfs -o nosuid,rw &quot; $1 &quot; /mnt&quot; }')&quot;</pre></div>
</div>

</li>
<li>Locate your drive in Finder</li>
<li>Drag/drop files there</li>
<li>Unmount the drive as usual</li>
<li>DONE!</li>
</ol>
<p>The command breakdown, if you're interested:</p>
<ol>
<li><code>mkdir -p /mnt</code> creates a mount point -- a place in the file system where we will attach the drive</li>
<li>the <code>mount</code> command without parameters gives you a list of the currently attached drives</li>
<li><code>grep ntfs</code> filters non-ntfs drives out the list</li>
<li><code>head -n 1</code> grabs the first line (we're assuming only one ntfs drive can be attached at a time)</li>
<li>the <code>awk</code> part produces two commands:      
<ul>
<li><code>umount /Volumes/&lt;name&gt;</code> -- unmounts the drive from its original place</li>
<li><code>mount_ntfs -o nosuid,rw /dev/&lt;device&gt; /mnt</code> -- mounts the drive again, but this time in the read-write mode</li>
</ul>
</li>
<li>now, the <code>sudo sh -c "..."</code>&nbsp;thing allows code execution with superuser privileges.</li>
</ol>
<p>That's it.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/how-to-mount-an-ntfs-formatted-usb-drive-in-r">Permalink</a> 

	| <a href="http://www.mikeivanov.com/how-to-mount-an-ntfs-formatted-usb-drive-in-r#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Sat, 04 Jun 2011 21:12:00 -0700</pubDate>
      <title>Think Stats in Clojure</title>
      <link>http://www.mikeivanov.com/think-stats-in-clojure</link>
      <guid>http://www.mikeivanov.com/think-stats-in-clojure</guid>
      <description>
        <![CDATA[<p>
	<p>Recently I started looking for an opportunity to refresh my math/stats skills. I din't do this stuff for a long time, probably more than a decade; so I wanted something really basic for a refresh. Then I discovered this <a href="http://greenteapress.com/thinkstats/">Think Stats book</a>, which I'm going through right now. I find the book useful and interesting.&nbsp;</p>
<p>To add more fun, I decided to do all the exercises from the book in Clojure instead of Python. This indeed has turned out to be a good adventure.&nbsp;</p>
<p>My worksheets (which is a work in progress) are on Github just in case it could be it useful for someone. The project is here -&nbsp;<a href="https://github.com/mikeivanov/thinkstats">https://github.com/mikeivanov/thinkstats</a>.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/think-stats-in-clojure">Permalink</a> 

	| <a href="http://www.mikeivanov.com/think-stats-in-clojure#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Thu, 02 Jun 2011 17:44:19 -0700</pubDate>
      <title>Moved to Posterous</title>
      <link>http://www.mikeivanov.com/moved-to-posterous</link>
      <guid>http://www.mikeivanov.com/moved-to-posterous</guid>
      <description>
        <![CDATA[<p>
	<p>Just have finished transferring my stuff to Posterous.</p>

<p>I like it a lot. The UI is much simpler and cleaner, everything I need is at hand. The TOS is much more straightforward. I like it understands Markdown. It just feels right.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/moved-to-posterous">Permalink</a> 

	| <a href="http://www.mikeivanov.com/moved-to-posterous#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Sat, 21 May 2011 01:36:00 -0700</pubDate>
      <title>How to make eshell pick up the right PATH</title>
      <link>http://www.mikeivanov.com/2011/05/how-to-make-eshell-pick-up-right-path.html</link>
      <guid>http://www.mikeivanov.com/2011/05/how-to-make-eshell-pick-up-right-path.html</guid>
      <description>
        <![CDATA[<p>
	<dl><dt><strong>Context:</strong><br /></dt><dd>a freshly installed Emacs on Mac OS X.<br /></dd><dt><br /><strong>Itch:</strong><br /></dt><dd>the PATH is the default system path, not that one you get in your terminal:<br />
<div class="CodeRay">
  <div class="code"><pre>~ $ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
~ $ bash -l -c &quot;echo \$PATH&quot;
/Users/mike/.rvm/gems/ruby-1.9.2-p180/bin:
/Users/mike/.rvm/gems/ruby-1.9.2-p180@global/bin:
/Users/mike/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mike/.rvm/bin:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
/usr/X11/bin:/opt/local/bin:/usr/local/cuda/bin:/Users/mike/bin
~ $ rvm
rvm: command not found</pre></div>
</div>

Not good. <br /></dd><dt><br /><strong>Scratch:</strong><br /></dt><dd>Now here's the choice: either you fiddle with .MacOSX/environment.plist or use a quick and dirty sub-shell hack. I chose the latter for the sake of not touching XML. The idea is to call bash directly from Emacs and ask it for the right PATH: <br />
<div class="CodeRay">
  <div class="code"><pre>(setenv &quot;PATH&quot; (shell-command-to-string &quot;/bin/bash -l -c 'echo -n $PATH'&quot;))</pre></div>
</div>

Add the line above to your ~/.emacs and the next time you start eshell you will see:<br />
<div class="CodeRay">
  <div class="code"><pre>~ $ echo $PATH
/Users/mike/.rvm/gems/ruby-1.9.2-p180/bin:
/Users/mike/.rvm/gems/ruby-1.9.2-p180@global/bin:
/Users/mike/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mike/.rvm/bin:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
/usr/X11/bin:/opt/local/bin:/usr/local/cuda/bin:/Users/mike/bin
~ $ rvm
= rvm
* http://github.com/wayneeseguin/rvm
...........
blah blah blah...
............
limitations under the License.</pre></div>
</div>

Schnell und lustig!<br /></dd></dl>
	
</p>

<p><a href="http://www.mikeivanov.com/2011/05/how-to-make-eshell-pick-up-right-path.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2011/05/how-to-make-eshell-pick-up-right-path.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Sun, 20 Mar 2011 07:30:00 -0700</pubDate>
      <title>Oh Joy!</title>
      <link>http://www.mikeivanov.com/2011/03/oh-joy.html</link>
      <guid>http://www.mikeivanov.com/2011/03/oh-joy.html</guid>
      <description>
        <![CDATA[<p>
	<p>A quote that very closely reflects my own feelings: "<em>[It] feels like a minor miracle. It&rsquo;s an astoundingly high-quality language, sure&mdash;in fact, I&rsquo;m beginning to think it&rsquo;s the best I&rsquo;ve ever seen&mdash;yet somehow it has still managed to be fashionable. That&rsquo;s quite a trick. It gives me renewed hope for the overall future of productivity in our industry.</em>" -- Steve Yegge in his <a href="http://www.manning.com/fogus/excerpt_foreword.html">foreword to "Joy of Clojure"</a>.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/2011/03/oh-joy.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2011/03/oh-joy.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Tue, 31 Aug 2010 19:04:00 -0700</pubDate>
      <title>ActiveState loves M2Crypto</title>
      <link>http://www.mikeivanov.com/2010/08/activestate-loves-m2crypto.html</link>
      <guid>http://www.mikeivanov.com/2010/08/activestate-loves-m2crypto.html</guid>
      <description>
        <![CDATA[<p>
	<p><a href="http://www.activestate.com/blog/2010/08/new-m2crypto-module-activepython">Now</a> it is <a href="http://www.activestate.com/activepython/python-crypto-modules">official</a>.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/2010/08/activestate-loves-m2crypto.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2010/08/activestate-loves-m2crypto.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Fri, 20 Aug 2010 10:13:00 -0700</pubDate>
      <title>Tail recursion without TCO</title>
      <link>http://www.mikeivanov.com/2010/08/tail-recursion-without-tco.html</link>
      <guid>http://www.mikeivanov.com/2010/08/tail-recursion-without-tco.html</guid>
      <description>
        <![CDATA[<p>
	<p>Emacs lisp has no Tail Call Optimization (TCO), neither do many other lisp dialects.   The lack of TCO is not a big deal--it's always possible to transform a tail recursive algorithm into a cycle. However, it makes procedures uglier.   Here is a very simple method of enabling Clojure-style tail call recursion in Emacs lisp:</p>
<div class="CodeRay">
  <div class="code"><pre>;; A very simple linearized Y combinator.
;; All the state management stuff is incapsulated here.
;; Don't call it directly.
(defun rloop- (body &amp;rest args)
  (let ((res nil))
    (while (progn
             ;; here's the idea: we keep calling body 
             ;; while it returns the recursion marker
             (setq res (apply body args))
             (when (and (consp res)
                        (eq :loop-recur-marker (car res)))
               (progn (setq args (cdr res))
                      t))))
    res))

;; Recursion marker factory
(defun recur (&amp;rest args)
  ;; instead of a real recursive call,
  ;; just signal an intention to make one
  (cons :loop-recur-marker args))

;; The form macro
(defmacro rloop (init body)
  (let ((args (mapcar 'car init)))
    ;; a little courtesy to the macro users
    `(let* ,init
       ;; make a lambda from the body and pass it 
       ;; to the combinator function
       (rloop- (function (lambda (,@args) ,body))
               ,@args))))</pre></div>
</div>

<p>Here's how to use it:</p>
<div class="CodeRay">
  <div class="code"><pre>(defun factorial (x)
  ;; this is the recursion entry point
  (rloop ((x   x) 
          (acc 1))
         (if (&lt; x 1)
             acc ;; done, just return the result
           ;; not done, start the whole rloop block again
           (recur (1- x) 
                  (* x acc)))))

ELISP&gt; (factorial 10)
3628800</pre></div>
</div>

<p>The funny part is defun is not necessary. You can have as many sequential inlined rloops as you want. I like this approach a lot: all the state management stuff is off the sight. The procedure is almost identical to the underlying algorithm.  Another classic example:</p>
<div class="CodeRay">
  <div class="code"><pre>(defun fibo (x)
  (rloop ((x    x)
          (curr 0)
          (next 1))
         (if (= x 0)
             curr
           (recur (1- x) 
                   next 
                  (+ curr next)))))

ELISP&gt; (fibo 10)
55</pre></div>
</div>

<p>Nice, eh?  Of course, this kind of beauty comes with a price. Here is how the rloop macro expands:</p>
<div class="CodeRay">
  <div class="code"><pre>ELISP&gt; (macroexpand '(rloop ((n 0)) (if (&gt; n 5) n (recur (1+ n)))))

(let*
    ((n 0))
  (rloop-
   #'(lambda
       (n)
       (if
           (&gt; n 5)
           n
         (recur
          (1+ n))))
   n))</pre></div>
</div>

<p>...which means two extra function calls on each iteration. But realistically, it's not such a big deal. Clarity of the code is way more important.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/2010/08/tail-recursion-without-tco.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2010/08/tail-recursion-without-tco.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Thu, 19 Aug 2010 23:23:00 -0700</pubDate>
      <title>ActivePython: now with binary psycopg2 module</title>
      <link>http://www.mikeivanov.com/2010/08/activepython-now-with-binary-psycopg2.html</link>
      <guid>http://www.mikeivanov.com/2010/08/activepython-now-with-binary-psycopg2.html</guid>
      <description>
        <![CDATA[<p>
	<p>Binary <a href="http://www.activestate.com/activepython/python-database-modules">PostgreSQL database modules</a> (psycopg2) are available for MacOS X, Windows and Linux platforms in both 32 and 64 bit versions. The modules are available through PyPM package manager for ActivePython users. <p />We compiled all the modules, so you don't have to. We statically linked all the dependency libraries (where it was appropriate), so you don't have to build those either. SSL is fully supported on all platforms.<p />By the way, <a href="http://www.activestate.com/blog/2010/08/5-key-database-modules-added-activepython-postgresql-oracle-mysql-microsoft-sql-server-">it's not just about PostgreSQL -- MySQL, Oracle and MS SQL Server modules</a> are also there.<p />We have even got ODBC drivers for those who lost their hope.<p />Enjoy.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/2010/08/activepython-now-with-binary-psycopg2.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2010/08/activepython-now-with-binary-psycopg2.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Tue, 11 May 2010 22:30:00 -0700</pubDate>
      <title>Python Crypto: State of the Art (Part 3)</title>
      <link>http://www.mikeivanov.com/2010/05/python-crypto-state-of-art-part-3.html</link>
      <guid>http://www.mikeivanov.com/2010/05/python-crypto-state-of-art-part-3.html</guid>
      <description>
        <![CDATA[<p>
	<p><a href="http://blogs.activestate.com/2010/05/python-crypto-state-of-the-art-part-3/">The third part of my Python crypto saga is on the ActiveState blog.</a><p /><em>Cryptlib: Peter Gutmann&rsquo;s cryptlib library -- a powerful security toolkit that allows even inexperienced crypto programmers to easily add encryption and authentication services to their software. The high-level interface provides anyone with the ability to add strong security capabilities to an application in as little as half an hour, without needing to know any of the low-level details that make the encryption or authentication work...</em><p />Read the whole article here: <a href="http://blogs.activestate.com/2010/05/python-crypto-state-of-the-art-part-3/">http://blogs.activestate.com/2010/05/python-crypto-state-of-the-art-part-3/</a></p>
	
</p>

<p><a href="http://www.mikeivanov.com/2010/05/python-crypto-state-of-art-part-3.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2010/05/python-crypto-state-of-art-part-3.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Thu, 06 May 2010 01:54:00 -0700</pubDate>
      <title>How to make cryptlib_py work on 64-bit platforms</title>
      <link>http://www.mikeivanov.com/2010/05/how-to-make-cryptlibpy-work-on-64-bit.html</link>
      <guid>http://www.mikeivanov.com/2010/05/how-to-make-cryptlibpy-work-on-64-bit.html</guid>
      <description>
        <![CDATA[<p>
	<p><a href="http://www.cs.auckland.ac.nz/~pgut001/cryptlib/">Cryptlib</a> is a totally fascinating cross-platform crypto library with Python bindings. Unfortunately, the current version (3.3.3) is unusable on 64-bit platforms. The good news though it is easily fixable.  Let's look what's going on there:</p>
<div class="CodeRay">
  <div class="code"><pre>$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; 
&gt;&gt;&gt; from cryptlib_py import *
&gt;&gt;&gt; cryptInit()
&gt;&gt;&gt; sess = cryptCreateSession(CRYPT_UNUSED, CRYPT_SESSION_SSH)
&gt;&gt;&gt; sess.CRYPT_SESSINFO_SERVER_NAME = &quot;myserver.com&quot;
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;&lt;string&gt;&quot;, line 32, in __setattr__
cryptlib_py.CryptException: (-2, 'Bad argument, parameter 2')
&gt;&gt;&gt;</pre></div>
</div>

<p>No good.  The problem is the way <code>PyObject_AsWriteBuffer</code> (and <code>PyObject_AsCharBuffer</code>) is called. The last parameter is declared as a pointer to <code>Py_ssize_t</code> type, which can be either 32 or 64 bit depending on the platform. Here is the actual declaration in the abstract.h file:</p>
<div class="CodeRay">
  <div class="code"><pre>PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
                      void **buffer,
                      Py_ssize_t *buffer_len);</pre></div>
</div>

<p>Now, here is how this function is used in cryptlib_py (python.c, line 21):</p>
<div class="CodeRay">
  <div class="code"><pre>if (PyObject_AsWriteBuffer(objPtr, bytesPtrPtr, lengthPtr) == -1)</pre></div>
</div>

<p>Where lengthPtr is declared as "<code>int* lengthPtr</code>". See the problem?  This is what happens: the function expects a pointer to a 8-byte blob but instead it is provided with a pointer to a 4-byte int. Being unaware of that, the function smashes the variable next to the one pointed by lengthPtr.   The solution is to patch cryptlibConverter.py, the script generating bindings/python.c. Although this problem is very likely to be fixed in the next cryptlib release, here is what you do if you can't wait:</p>
<div class="CodeRay">
  <div class="code"><pre>mkdir cryptlib; cd cryptlib
curl -O ftp://ftp.franken.de/pub/crypt/cryptlib/cl333.zip
unzip cl333.zip
curl -O http://mikeivanov.com/pc/cryptlibConverter.py.patch
patch -p0 &lt; cryptlibConverter.py.patch
python tools/cryptlibConverter.py cryptlib.h bindings python
make
cd bindings
python setup.py build
sudo python setup.py install</pre></div>
</div>

<p>Fixed! The patched version is working just fine:</p>
<div class="CodeRay">
  <div class="code"><pre>$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; 
&gt;&gt;&gt; from cryptlib_py import *
&gt;&gt;&gt; cryptInit()
&gt;&gt;&gt; sess = cryptCreateSession(CRYPT_UNUSED, CRYPT_SESSION_SSH)
&gt;&gt;&gt; sess.CRYPT_SESSINFO_SERVER_NAME = &quot;myserver.com&quot;
&gt;&gt;&gt; sess.CRYPT_SESSINFO_USERNAME = &quot;mike&quot;
&gt;&gt;&gt; sess.CRYPT_SESSINFO_PASSWORD = raw_input(&quot;pwd=&quot;)
pwd=mypassword
&gt;&gt;&gt; sess.CRYPT_SESSINFO_ACTIVE = 1
&gt;&gt;&gt; data = array('c', '\0' * 1024)
&gt;&gt;&gt; recv = cryptPopData(sess, data, 1024)
&gt;&gt;&gt; print data.tostring()[:recv]
Linux myserver.com 2.6 XXXXXXXXX x86_64 GNU/Linux
Ubuntu 10.04 LTS
.......
&gt;&gt;&gt; cryptPushData(sess, &quot;uptime\n&quot;)
7
&gt;&gt;&gt; cryptFlushData(sess)
&gt;&gt;&gt; recv = cryptPopData(sess, data, 1024)
&gt;&gt;&gt; print data.tostring()[:recv]
uptime
 18:17:15 up 6 days,  1:54, 13 users,  load average: 0.30, 0.27, 0.26
mike@myserver:~$ 
&gt;&gt;&gt;</pre></div>
</div>
	
</p>

<p><a href="http://www.mikeivanov.com/2010/05/how-to-make-cryptlibpy-work-on-64-bit.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2010/05/how-to-make-cryptlibpy-work-on-64-bit.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Tue, 06 Apr 2010 03:19:00 -0700</pubDate>
      <title>Clouds and entropy</title>
      <link>http://www.mikeivanov.com/2010/04/clouds-and-entropy.html</link>
      <guid>http://www.mikeivanov.com/2010/04/clouds-and-entropy.html</guid>
      <description>
        <![CDATA[<p>
	<p>In a post titled <a href="http://www.elasticvapor.com/2009/08/trusted-cloud-entropy-authority.html">"A Trusted Cloud Entropy Authority"</a> Reuven Cohen writes:</p>
<blockquote class="posterous_medium_quote">"...maybe there an opportunity to create a trusted cloud authority to provide signed verified and certified entropy. Think of it like a certificate authority (CA) but for chaos. Actually, Amazon Web Service itself could act as this entropy authority via a simple encrypted web service call. I even have a name for it, Simple Entropy Service (SES)."</blockquote>
<p>This is really a good idea. Amazon should have provided such a service long time ago. <p />When an SSL connection is being established, a browser and a server perform the Handshake protocol. This protocol involves exchanging random bits between the parties. The important thing is that security depends on how random those bits are. If they are not, the connection is effectively insecure.<p />In the case of AWS, there is no source of true randomness, therefore SSL on AWS is inherently insecure. Moreover, instances running on the same physical machine can affect each other's security by draining the shared random pool in the host system.<p />Further he writes:</p>
<blockquote>"a website called <a href="http://random.org/">http://random.org</a> [is] a true random number service that generates randomness via atmospheric noise. Looks cool, maybe this may help solve the problem."</blockquote>
<p>I think that random.org is not a good choice for several reasons.<p />One problem is a connection to such a service. It should be as secure as the most secure secret handled on your system. If the random bit connection is encrypted with 256 bit AES (and it actually is), this is the highest level of security your system can provide. Plus, there should be guarantee that no unencryped random bits are stored anywhere. The same is true for the proposed SAS service, too.<p />Another problem with random.org is... well, randomness is perceptive. What you see as "random" can be quite deterministic to the people who run the random.org service. Even though they might not store anything, their present is your future--just think about relativistic effects. A temptation to tamper with someone's future can be, you know, very strong.<p />The overall quality of the service is not known. There is no guarantee it is random at all. A quote from their FAQ: "<em>Q1.2: Is the source code for the generator available? -- Not currently, no. Maybe I'll make it available as open source some day.</em>"<p />Even though the Whois database indicates the domain name's registrant is located in France, the SSL certificate owner is not specified. I have no reasons for not believing the guy running the service, but I would not entrust my customers' data into a total stranger's hands, even though he or she seems to be a nice person.<p />So the conclusion is: while there is no trusted entropy generator on the AWS side, we, the AWS customers, are on our own.<p />Here is a hint: entropy seeds can be generated in-house and smuggled into instances over a secure channel. Then those seeds could be fed to a cryptographically secure RNG like <a href="http://www.burtleburtle.net/bob/rand/isaacafa.html">Isaac</a> to produce actual "random" bits. I think there should be a way of injecting those into the instance's random pool.</p>
	
</p>

<p><a href="http://www.mikeivanov.com/2010/04/clouds-and-entropy.html">Permalink</a> 

	| <a href="http://www.mikeivanov.com/2010/04/clouds-and-entropy.html#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1406554/mikelt.jpg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/hesvHo89zyJyq</posterous:profileUrl>
        <posterous:firstName>Mike</posterous:firstName>
        <posterous:lastName>Ivanov</posterous:lastName>
        <posterous:nickName>mikeivanov</posterous:nickName>
        <posterous:displayName>Mike Ivanov</posterous:displayName>
      </posterous:author>
    </item>
  </channel>
</rss>

