<?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>oscarbonilla.com</title>
	<atom:link href="http://oscarbonilla.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://oscarbonilla.com</link>
	<description></description>
	<lastBuildDate>Wed, 24 Feb 2010 04:43:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mandoline my ass&#8230;</title>
		<link>http://oscarbonilla.com/2010/02/mandoline-my-ass/</link>
		<comments>http://oscarbonilla.com/2010/02/mandoline-my-ass/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 04:10:10 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=452</guid>
		<description><![CDATA[
...all you need is a sharp knife.
I just got The French Laundry Cookbook. It's awesome.
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://oscarbonilla.com/wp-content/uploads/2010/02/IMG_6499.jpg" class="lightview" rel="gallery[452]" title="Strawberry"><img class="size-medium wp-image-453 aligncenter" title="Strawberry" src="http://oscarbonilla.com/wp-content/uploads/2010/02/IMG_6499-300x199.jpg" alt="" width="300" height="199" /></a></p>
<p style="text-align: left;">...all you need is a <a href="http://www.amazon.com/gp/product/B00005OL44?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B00005OL44" target="_blank">sharp knife</a>.</p>
<p style="text-align: left;">I just got <a href="http://www.amazon.com/gp/product/1579651267?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1579651267" target="_blank">The French Laundry Cookbook</a>. It's awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/02/mandoline-my-ass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unleash the power of the atom&#8230; to boil water?</title>
		<link>http://oscarbonilla.com/2010/02/unleash-the-power-of-the-atom-to-boil-water/</link>
		<comments>http://oscarbonilla.com/2010/02/unleash-the-power-of-the-atom-to-boil-water/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 05:14:45 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Stuff I Know Nothing About]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=446</guid>
		<description><![CDATA[I'm going to go off on a limb and blog about something I know absolutely nothing about. Power generation.
So I'm reading the news recently and I read that the U.S. is going to invest in building a couple of nuclear power plants. Now, I don't know much about nuclear power plants or power generation in [...]]]></description>
			<content:encoded><![CDATA[<p>I'm going to go off on a limb and blog about something I know absolutely nothing about. Power generation.</p>
<p>So I'm reading the news recently and I read that the U.S. is going to invest in building a couple of nuclear power plants. Now, I don't know much about nuclear power plants or power generation in general. But I know how to use the googles for finding out about stuff I don't know much about. So I hit wikipedia and all those other websites and I find about all of these wonderful methods of generating power.</p>
<p><strong>Fossil Fuels:</strong> Coal for instance. Oil and natural gas too. The main idea is to burn these fossil fuels in order to boil water so that the steam can make a turbine spin and generate electricity using a big electromagnet.</p>
<p><strong>Nuclear Fission:</strong> Create a controlled nuclear reaction so that we can heat up water and produce steam to spin a turbine hooked up to a huge electromagnet.</p>
<p><strong>Geothermal Power:</strong> Drill a very, very deep hole to reach the hot granite that underlies the earth's crust. This granite is so hot we can use it to... boil water... steam... turbine... electromagnet.</p>
<p><strong>Hydroelectric:</strong> Just avoid the whole boiling water bit and spin the turbine directly from a river.</p>
<p><strong>Tidal Power:</strong> Make a dam in the ocean and put the turbine there.</p>
<p><strong>Wind Power:</strong> Instead of boiling water and using steam, use wind to spin the turbine.</p>
<p><strong>Solar power: </strong>At this point, if I had read that we were using solar to boil water I would've just given up hope for humanity. But no, at least with solar we actually just use the energy... no turbine involved.</p>
<p>So my question for more informed readers is: uh, how about <strong>not</strong> needing the turbine and using some other method of gathering the released energy? Especially in the case of Nuclear Fission. It seems somewhat wasteful to fire up an atomic bomb just to boil some water...</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/02/unleash-the-power-of-the-atom-to-boil-water/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enjoying Life (a little more)</title>
		<link>http://oscarbonilla.com/2010/01/enjoying-life-a-little-more/</link>
		<comments>http://oscarbonilla.com/2010/01/enjoying-life-a-little-more/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 05:24:42 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=339</guid>
		<description><![CDATA[This is a post about a simple trick you can use to enjoy the things you like a little more and/or make them enjoyable to others. But first, let's try a little experiment. Please listen to this piece of classical music. It's only 47 seconds long.
Now write down some measure of how much you enjoyed it [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about a simple trick you can use to enjoy the things you like a little more and/or make them enjoyable to others. But first, let's try a little experiment. Please listen to this piece of classical music. It's only 47 seconds long.</p>
<!-- Begin MP3 Player for Wordpress Version "1.2.4"-->
<div align="center" id="googlemp3player1">
     <object width="450" height="28" data="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" type="application/x-shockwave-flash">
<param name="bgcolor" value="#1FBF26" />
<param name="flashvars" value="playerMode=embedded" />
<param name="src" value="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" />
<param name="wmode" value="transparent" />
<param name="quality" value="best" />
</object>
</div>
<!-- End MP3 Player for Wordpress Version "1.2.4"-->
<p>Now write down some measure of how much you enjoyed it on whatever scale you want. Five stars, a number from one to ten, whatever. Ready? Okay, now read the following story.</p>
<p style="text-align: center;"><img class="aligncenter size-medium wp-image-403" src="http://oscarbonilla.com/wp-content/uploads/2010/01/Bach_Seal_wide-300x134.jpg" alt="" width="108" height="48" /></p>
<p style="text-align: left;">On the evening of May 7, 1747  in the grounds of the just finished <a href="http://en.wikipedia.org/wiki/Sanssouci">Sansoucci</a> palace of <a href="http://en.wikipedia.org/wiki/Frederick_II_of_Prussia">Frederick the Great</a>, King of <a href="http://en.wikipedia.org/wiki/Kingdom_of_Prussia">Prussia</a>, a 62-year old man arrives by carriage. As was the custom in those days, an officer writes his name in a list of visitors which is usually reviewed by the King.</p>
<p>Inside the palace, through the Entrance Hall and to the left, King Frederick is in an exquisitely decorated room, getting his flute ready for the nightly concert while the rest of the musicians tune up. The officer enters the room and gives the King the list of strangers who have arrived to the palace.</p>
<p style="text-align: left;">With his flute in his hand, Frederick runs down the list and immediately turns to the assembled musicians, exclaiming with a kind of agitation, “Gentlemen, old Bach is come.” He lays his flute aside, and announces to the other musicians and the rest of the people of the court that there will be no concert tonight.</p>
<p style="text-align: left;">
<div id="attachment_405" class="wp-caption aligncenter" style="width: 535px"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/800px-Flötenkonzert1.jpg"><img class="size-full wp-image-405    " title="800px-Flötenkonzert" src="http://oscarbonilla.com/wp-content/uploads/2010/01/800px-Flötenkonzert1.jpg" alt="" width="525" height="358" /></a><p class="wp-caption-text">Das Flötenkonzert Friedrich des Großen in Sanssouci by Adolph von Menzel</p></div>
<p style="text-align: left;">
<p><a href="http://en.wikipedia.org/wiki/Bach">Johann Sebastian Bach</a> has just arrived for a visit to his son <a href="http://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach">Carl Philip Emanuel Bach</a>, the court’s Capellmeister. The King had been wanting to meet with J.S. Bach, and his wish had just been realized. So without even giving Bach time to change from his traveling clothes to a more formal black chanter's gown, the King summons him to appear before his Highness. Frederick, after listening to Bach’s apology for his appearance, invites him to try his collection of <a href="http://http://en.wikipedia.org/wiki/Fortepiano#Silbermann_fortepianos">Silbermann fortepianos</a>, which are scattered throughout the palace.</p>
<p>The musicians follow them from room to room, and Bach is invited everywhere to try the fortepianos and play unpremeditated compositions. After going on for some time, Bach asks the King, “Would Your Highness be so kind as to honor me with a subject for a Fuge, so that I can execute it immediately and without any preparation?” The King, desiring to give such a learned musician a challenge, picks up his flute and plays the following tune:</p>
<p style="text-align: left;"><!-- Begin MP3 Player for Wordpress Version "1.2.4"-->
<div align="center" id="googlemp3player2">
     <object width="450" height="28" data="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3" type="application/x-shockwave-flash">
<param name="bgcolor" value="#1FBF26" />
<param name="flashvars" value="playerMode=embedded" />
<param name="src" value="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3" />
<param name="wmode" value="transparent" />
<param name="quality" value="best" />
</object>
</div>
<!-- End MP3 Player for Wordpress Version "1.2.4"--></p>
<p style="text-align: left;">
<div id="attachment_411" class="wp-caption aligncenter" style="width: 510px"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/500px-The_Musical_Offering_theme.svg_.png" class="lightview" rel="gallery[339]" title="500px-The_Musical_Offering_theme.svg"><img class="size-full wp-image-411" title="500px-The_Musical_Offering_theme.svg" src="http://oscarbonilla.com/wp-content/uploads/2010/01/500px-The_Musical_Offering_theme.svg_.png" alt="" width="500" height="42" /></a><p class="wp-caption-text">The King&#39;s Theme</p></div>
<p>This is quite a complex melody! One of which Michelle Rasmussen says:</p>
<blockquote><p>The King’s theme begins with a C minor triad, (“c - e flat – g”), is raised to the next half-note above that, “a flat,” and then takes a dramatic downward leap of a seventh from the "a flat" down to “B,” not included in C minor, but found in C major. This creates musical tension between two pairs of half-step intervals: from the ”B”  back to the beginning “C,” and the “g - a flat” interval.</p>
<p>Picking up on these half-steps from the first part, the second part of the Royal theme is a revolutionary ambiguous step-wise descent from the top of the triad, “g” one octave down to "G," comprised of a chromatic descent from "g" to "B", and then, down by major scale steps to  “G.” The concluding section hops up through "c" to "f," and ends with a stepwise journey down the C-minor scale from f, through "e flat," to end where it began on "c."</p></blockquote>
<p>Bach is silent for a couple of seconds, but he accepts the King's challenge. He plays the King's theme three times before proceeding to play a beautiful three-voice Fugue. Please listen to the first minute of it:</p>
<p style="text-align: left;"><!-- Begin MP3 Player for Wordpress Version "1.2.4"-->
<div align="center" id="googlemp3player3">
     <object width="450" height="28" data="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3" type="application/x-shockwave-flash">
<param name="bgcolor" value="#1FBF26" />
<param name="flashvars" value="playerMode=embedded" />
<param name="src" value="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3" />
<param name="wmode" value="transparent" />
<param name="quality" value="best" />
</object>
</div>
<!-- End MP3 Player for Wordpress Version "1.2.4"--></p>
<p>The King, impressed by the three-voice Fuge improvised by Bach, and to see how far such art could be carried, requests to hear a Fuge with six voices. Fearing he cannot, without preparation, invent such a complex Fuge based on the King's theme, Bach asks permission of the King to pick his own subject, which the King gently concedes. Bach proceeds then to execute it to the astonishment of all present in the same magnificent and learned manner as he had done that of the King.</p>
<p>After returning home to Leipzig, Bach composes a three-voiced and a six-voiced <a href="http://en.wikipedia.org/wiki/Fugue">fugue</a>, ten <a href="http://en.wikipedia.org/wiki/Canon_(music)">canons</a>, and a <a href="http://en.wikipedia.org/wiki/Sonata">sonata</a> for flute, violin, and piano. All based on the King's theme. This work has become known as the <a href="http://en.wikipedia.org/wiki/The_Musical_Offering">Musikalisches Opfer</a> (Musical Offering), after a phrase from Bach’s dedication to King Frederick[1].</p></blockquote>
<p>Bach sends this <em>Musical Offering</em> to King Frederick, and on the page preceding the first sheet of music, he inscribes: <em>Regis Iussu Cantio Et Reliqua Canonica Arte Resoluta,</em> meaning "At the King's Command, the Song and the Remainder Resolved with Canonic Art." an acrostic spelling "<a href="http://en.wikipedia.org/wiki/Ricercar">RICERCAR</a>," the original name for the musical form now known as the Fuge. Bach also uses this title for the two fugues. Ricercar is also an Italian word meaning "to seek", which is appropriate since Bach doesn't quite write <em>all</em> the music. He leaves hints on how to complete the scores as musical puzzles for the King to solve.</p>
<p>One example of these puzzles is the work entitled "Canon a 2 (Cancrizans)". The original score looks like this:</p>
<div id="attachment_412" class="wp-caption aligncenter" style="width: 382px"><img class="size-full wp-image-412" title="Canon-2a-Cancrizans" src="http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-2a-Cancrizans.gif" alt="" width="372" height="151" /><p class="wp-caption-text">Canon a 2 (Cancrizans)</p></div>
<p>The title "Canon a 2" implies it's a two-voice canon, but the score only shows one voice. There are hints in the score for solving the puzzle of the second voice:</p>
<ul>
<li> <em>Cancrizan</em> is Medieval-Latin meaning "to move backwards" literally <em>crab-like</em>.</li>
<li>There is an extra clef at the end of the score, and it is backwards.</li>
<li>The three flats at the end of the score are also facing backwards.</li>
</ul>
<p>All of these hints strongly imply that the second voice (the follower) is the same as the first voice (the leader) only played backwards. What you listened to in the beginning was Canon a 2 (Cancrizan) as performed by the <a href="http://www.stuttgarter-kammerorchester.de/">Stuttgarter Kammerorchester</a> under the direction of <a href="http://en.wikipedia.org/wiki/Karl_Münchinger">Karl Münchinger</a>. Listen to it again:</p>
<!-- Begin MP3 Player for Wordpress Version "1.2.4"-->
<div align="center" id="googlemp3player1">
     <object width="450" height="28" data="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" type="application/x-shockwave-flash">
<param name="bgcolor" value="#1FBF26" />
<param name="flashvars" value="playerMode=embedded" />
<param name="src" value="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" />
<param name="wmode" value="transparent" />
<param name="quality" value="best" />
</object>
</div>
<!-- End MP3 Player for Wordpress Version "1.2.4"-->
<p>But note that since the second voice is the same as the first voice, only played backwards. We should be able to reverse the recording and the canon should still sound the same! Listen to the same canon being played backwards:</p>
<!-- Begin MP3 Player for Wordpress Version "1.2.4"-->
<div align="center" id="googlemp3player4">
     <object width="450" height="28" data="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3" type="application/x-shockwave-flash">
<param name="bgcolor" value="#1FBF26" />
<param name="flashvars" value="playerMode=embedded" />
<param name="src" value="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3" />
<param name="wmode" value="transparent" />
<param name="quality" value="best" />
</object>
</div>
<!-- End MP3 Player for Wordpress Version "1.2.4"-->
<p>Now listen to the original canon once again. How much, on your same scale, did you enjoy it this time? Was it more? Significantly more? How likely are you to want to listen to the rest of the Musical Offering? For example by buying one of these two CDs?</p>
<p style="text-align: center;"><a style="border: none;" href="http://www.amazon.com/gp/product/B000VHKJSU?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B000VHKJSU&quot;"><img class="size-full wp-image-413 alignnone" src="http://oscarbonilla.com/wp-content/uploads/2010/01/MO_Munchinger.jpg" alt="" width="160" height="159" /></a> <a style="border: none;" href="http://www.amazon.com/gp/product/B000QR3R3E?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B000QR3R3E" target="_blank"><img class="size-full wp-image-414  alignnone" src="http://oscarbonilla.com/wp-content/uploads/2010/01/MO_Savall.jpg" alt="" width="160" height="159" /></a></p>
<p style="text-align: left;">If you are like most people, you found the second hearing much more enjoyable than the first. This is because your expectations, the context in which you have an experience, and how much you know about something all have a big effect on how much enjoyment you derive. Reading the story taught you something about the music, it served as a guide of what to look for. Sure, it helps that this is a musical masterpiece by the best baroque composer there is. But the effect works, even if <em>the story is false</em>.</p>
<p style="text-align: left;">Oh, I'm not saying that the above story didn't happen. I dressed it up a little, but the story is true. However, take a look at the <a href="http://significantobjects.com">Significant Objects</a> project. They take an insignificant object (bought at a Thrift store) and ask a writer to make up a back story for it. Then they sell it on ebay. They are careful to disclose that the story is false, and they donate the proceedings to charity. But how much do the objects gain in value? <a href="http://significantobjects.com/2009/08/25/russian-figure/">This Russian Figurine</a> that they bought for $3 was sold for $193.50!</p>
<p style="text-align: left;">In one <a href="http://www.boston.com/bostonglobe/ideas/articles/2008/02/24/grape_expectations/">experiment</a>, scientists at Caltech and Stanford told people they would be tasting wines ranging in price from $5 to $90, and asked them to rate the wines. Unsurprisingly, the more expensive wines were rated higher than the cheap wines. The twister? All the samples were the exact same wine. Since people expected the more expensive wine to taste better, it tasted better.</p>
<p style="text-align: left;">So here is the trick I promised you. If you want to make an experience more enjoyable, find or create a backstory. It's better if the story is true and you believe it, but it works even if it's a made up story.</p>
<p style="text-align: center;"><a href="http://en.wikipedia.org/wiki/BACH_motif"><img class="alignnone size-full wp-image-425" title="BACH" src="http://oscarbonilla.com/wp-content/uploads/2010/01/200px-Bachscross.svg_.png" alt="" width="90" height="90" /></a></p>
<p style="text-align: left;">For much more information about the canons of Bach's Musical Offering, look <a href="http://schillerinstitut.dk/moweb/musical_offering.htm">here</a>, or <a href="http://jan.ucc.nau.edu/~tas3/musoffcanons.html">here</a>.</p>
<p style="text-align: left;">
<p style="text-align: left;">
<ol class="footnotes"><li id="footnote_0_339" class="footnote">This is the letter of dedication that Bach sent to the King (quoted from <em><a href="http://www.amazon.com/gp/product/0393319563?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0393319563">The New Bach Reader</a></em>, p. 226-8):</p>
<blockquote><p>MOST GRACIOUS KING!</p>
<p>In deepest humility I dedicate herewith to Your Majesty a musical offering, the noblest part of which derives from Your Majesty's own august hand. With awesome pleasure I still remember the very special Royal grace when, some time ago, during my visit in Potsdam, Your Majesty’s Self deigned to play to me a theme for a fugue upon the clavier, and at the same time charged me most graciously to carry it out in Your Majesty’s most august presence. To obey Your Majesty’s command was my most humble duty. I noticed very soon, however, that, for lack of necessary preparation, the execution of the task did not fare as well as such an excellent theme demanded. I resolved therefore and promptly pledged myself to work out this right Royal theme more fully and then make it known to the world. This resolve has now been carried out as well as possible, and it has none other that this irreproachable intent, to glorify, if only in a small point, the fame of a monarch whose greatness and power, as in all the sciences of war and peace, so especially in music, everyone must admire and revere. I make bold to add this most humble request: may Your Majesty deign to dignify the present modest labor with a gracious acceptance, and continue to grant Your Majesty’s most august Royal grace to</p>
<p>Your Majesty’s most humble and obedient servant</p>
<p>Leipzig, July 7, 1747                                       The Author</p>
<p></li></ol>]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/01/enjoying-life-a-little-more/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" length="1253887" type="audio/mpeg" />
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3" length="842448" type="audio/mpeg" />
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3" length="1673634" type="audio/mpeg" />
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3" length="1104920" type="audio/mpeg" />
		</item>
		<item>
		<title>Proof that P=NP</title>
		<link>http://oscarbonilla.com/2009/10/proof-that-pnp/</link>
		<comments>http://oscarbonilla.com/2009/10/proof-that-pnp/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 18:03:52 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Fun]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=312</guid>
		<description><![CDATA[So I was browsing Concrete Mathematics by Don Knuth et al, and I found a proof that P=NP for small N[1]. However if you make P=0, the size of N doesn't matter. So if P=0, then P = NP. Where is my money?
Specifically for N=1. It's in the margin of the book]]></description>
			<content:encoded><![CDATA[<p>So I was browsing <a href="http://www.amazon.com/gp/product/0201558025?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0201558025">Concrete Mathematics</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=obonilswebsit-20&amp;l=as2&amp;o=1&amp;a=0201558025" border="0" alt="" width="1" height="1" /> by <a href="http://www-cs-faculty.stanford.edu/~knuth/">Don Knuth</a> et al, and I found <a href="http://www.wangcong.org/articles/cm_preface_en.html">a proof </a>that<a href="http://www.wangcong.org/articles/cm_preface_en.html"> </a><a href="http://cacm.acm.org/magazines/2009/9/38904-the-status-of-the-p-versus-np-problem/fulltext">P=NP</a> for small N[1]. However if you make P=0, the size of N doesn't matter. So if P=0, then P = NP. Where is my <a href="http://www.claymath.org/millennium/P_vs_NP/">money</a>?</p>
<ol class="footnotes"><li id="footnote_0_312" class="footnote">Specifically for N=1. It's in the margin of the book</li></ol>]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/10/proof-that-pnp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Two Envelopes Problem</title>
		<link>http://oscarbonilla.com/2009/10/the-two-envelopes-problem/</link>
		<comments>http://oscarbonilla.com/2009/10/the-two-envelopes-problem/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 05:13:54 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=280</guid>
		<description><![CDATA[A recent thread in reddit about the two envelopes problem reminded me of how unintuitive probabilities can be. There is a fundamental flaw with how the original post worded the problem:
You and I both have envelopes filled with money. My envelope contains either double or half the amount of money that’s in yours. If you want, [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://www.reddit.com/r/math/comments/9qsa7/you_and_i_both_have_envelopes_filled_with_money/">recent thread in reddit</a> about <a href="http://en.wikipedia.org/wiki/Two_envelopes_problem">the two envelopes problem</a> reminded me of how unintuitive probabilities can be. There is a fundamental flaw with how <a href="http://www.philipbrocoum.com/?p=1032">the original post</a> worded the problem:</p>
<blockquote><p>You and I both have envelopes filled with money. My envelope contains either double or half the amount of money that’s in yours. If you want, I’m going to let you switch envelopes. Should you stay, switch, or does it not matter?</p></blockquote>
<p>Stop right there. Read that again. Does that make sense to you? See if you can set up the experiment in the real world. Grab two envelopes and some money. Take $100 and put them in an envelope, then, uh... what do you do with the other envelope? Put $50 in it? Put $200?</p>
<p>The original poster then went ahead and solved assuming probabilities of 1/2. But I'm not really choosing between two equally likely options. I don't know the probability distributions!</p>
<p>A better wording for the problem (or a different problem if you're pedantic) would be:</p>
<blockquote><p>There are two envelopes. One contains double the amount of money than the other. You choose one of them, I take the other. Now I offer you a choice between keeping your original choice or switching envelopes with me. Is it to your advantage to switch?</p></blockquote>
<p>The answer should be obvious, it doesn't matter.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/10/the-two-envelopes-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Monty Hall problem</title>
		<link>http://oscarbonilla.com/2009/05/the-monty-hall-problem/</link>
		<comments>http://oscarbonilla.com/2009/05/the-monty-hall-problem/#comments</comments>
		<pubDate>Tue, 05 May 2009 14:27:47 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=179</guid>
		<description><![CDATA[After all the positive feedback I got from Visualizing Bayes' theorem, I thought I'd post my explanation of the Monty Hall problem. I was fascinated for a while with this problem because at first it doesn't seem to make any sense. And most of the explanations I've seen have a magic feel to them. I've [...]]]></description>
			<content:encoded><![CDATA[<p>After all the positive feedback I got from <a title="Visualizing Bayes' theorem" href="http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/" target="_blank">Visualizing Bayes' theorem</a>, I thought I'd post my explanation of the <a title="Monty Hall @ Wikipedia" href="http://en.wikipedia.org/wiki/Monty_Hall_problem" target="_blank">Monty Hall problem</a>. I was fascinated for a while with this problem because at first it doesn't seem to make any sense. And most of the explanations I've seen have a magic feel to them. I've even seen people with math backgrounds argue against the result.</p>
<p>I think the problem has to do with most of the explanations mixing two very different probability classes. But I'm getting ahead of myself.</p>
<h2>The Problem</h2>
<p>The problem statement (from Wikipedia) is:</p>
<blockquote><p>Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? (Schrock 1990) [1]</p></blockquote>
<p>If you are like most people, your gut feeling is going to be "it does not matter. There is a 50-50 chance that the car will be in the door I have already selected". Like most people, you would be wrong.</p>
<p>In order to solve this problem, you need to consider two very distinct pieces of information. One is "what state is the world in?", the other is "what events have occurred?". Let me elaborate.</p>
<h2>The States of the world</h2>
<p>When I deal with probabilities and get confused, I revert to counting. What are all the possible outcomes? What subset of those outcomes am I looking at? So let's look at all the posible states.</p>
<blockquote><p>Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats.</p></blockquote>
<p>Let's translate that to a simple diagram. We have three doors, let's label them A, B, and C. We also know that there is a car behind one of the doors, it can be behind door A, B, or C. So we have three possible configurations of the world:</p>
<p><img class="aligncenter size-full wp-image-205" title="picture-22" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-22.png" alt="picture-22" width="375" height="453" />The door with the car has been colored red. The possible states of the world are <em>Sa</em> (meaning the car is behind door A), <em>Sb</em> (car behind door B), and <em>Sc</em> (car behind door C).</p>
<p>Quick, what is the probability of the car being behind door A? Or to put it another way, what is the probability that the world is in state <em>Sa</em>? Note that these two questions are the same, but the latter reminds us of the possible states. It is easy then to see that</p>
<p><img class="aligncenter size-full wp-image-185" title="p-fig1" src="http://oscarbonilla.com/wp-content/uploads/2009/05/p-fig1.png" alt="p-fig1" width="107" height="133" />Now I'm going to ask you a very different question. Assume that instead of playing, you are observing your friend play the game. What is the probability that he will pick door A? Did you say 1/3? Of course you did, there are three doors and he must pick one. However, and this is really important, <strong>these probabilities are completely independent of the probabilities above!</strong></p>
<p>Think of it this way. If two doors had cars behind them instead of just one, would that change the number of states the world can be in? Would it change the probability of your friend choosing door A? What if all doors had cars? Now there is just a single state for the world, but your friend can still choose door A with 1/3 probability!</p>
<p>If we now say that A is the event of your friend opening door A, we can easily see that</p>
<p><img class="aligncenter size-full wp-image-186" title="p-fig2" src="http://oscarbonilla.com/wp-content/uploads/2009/05/p-fig2.png" alt="p-fig2" width="108" height="131" />which is just saying each door has an equal probability of being opened.</p>
<p>The trick to solving this problem is that you are dealing with two different classes of probabilities. One is the probability that the world is in a given state (a priori), the other is that a participant (you or Monty) chooses any given door. If you can keep these two classes of probabilities separate, you will be able to easily solve this problem.</p>
<p>Let's see what happens once you have made the choice. Let's assume you chose the door labeled A.</p>
<h2>What does Monty do?</h2>
<p>Monty is, of course, the host of the game show. And he is trying to screw you. He doesn't want you to get the car. He also happens to know where the car is, or in other words, he knows the state of the world. You on the other hand, are only guessing. You chose door A with probability 1/3, now he gets to choose a door. But there are only two doors left. He must choose either door B or door C.</p>
<p>So how does Monty choose? What is the probability that Monty will open the door labeled B? Here's what the world looks like to Monty:</p>
<p><img class="aligncenter size-full wp-image-206" title="picture-23" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-23.png" alt="picture-23" width="383" height="477" />Door A has been chosen, he must choose between doors B and C. Were he to choose randomly, each door would be equally probable,</p>
<p><img class="aligncenter size-full wp-image-194" title="picture-10" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-10.png" alt="picture-10" width="190" height="64" /></p>
<p>The little <em>m</em>'s are a reminder that this is Monty's choice, not your original choice. If you wanted to be pedantic you could add P(Am) = 0 since Monty can never choose door A (you chose that one).</p>
<p>But he knows better than to choose randomly, he knows whether we're in Sa, Sb, or Sc! How he chooses will depend on what the state of the world is. If we are in Sa, it doesn't matter what he chooses, he'll choose B or C with equal probability as neither has a car[2]. That is to say "given that we are in state Sa, Monty chooses door B with probability 1/2", in other words:</p>
<p><img class="aligncenter size-full wp-image-195" title="picture-12" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-12.png" alt="picture-12" width="137" height="61" />If we are in state Sb, Monty will <strong>never</strong> choose door B, that would be giving away the prize.</p>
<p><img class="aligncenter size-full wp-image-196" title="picture-14" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-14.png" alt="picture-14" width="127" height="39" />And finally, if we are in state Sc, Monty will <strong>always</strong> choose door B.</p>
<h2><img class="aligncenter size-full wp-image-197" title="picture-15" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-15.png" alt="picture-15" width="121" height="39" />Your turn</h2>
<p>And now it's your turn to make a decision. Do you stay with your original choice of door A? Or do you switch and choose door C?</p>
<p>First of all, does it matter? Is there any difference whether we switch or not? The answer is a resounding <strong>YES!</strong> Monty gave away information about the state of the world by choosing door B. We can use that information.</p>
<p>What we are really trying to figure out is this: "what configuration is the world in?" Monty knows, he used that information to choose door B. Now we have to ask ourselves, "given that Monty chose door B, what is the probability that the world is in state Sa versus the probability of the world being in state Sc?" Note that we have eliminated Sb because <em>Monty has already opened door B and there was no car!</em></p>
<p>Here is where we can apply Bayes' formula to get an answer:</p>
<p><img class="aligncenter size-full wp-image-198" title="picture-16" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-16.png" alt="picture-16" width="248" height="69" />and plugging in the values we have already computed:</p>
<p><img class="aligncenter size-full wp-image-199" title="picture-17" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-17.png" alt="picture-17" width="210" height="76" />Which means we have a 1/3 chance the car is behind our original choice of door A. Note that this 1/3 probability <em>is different than the original P(A) = 1/3 we had computed</em>. It ends up being the same number, but it is really a different probability!</p>
<p>What about the car being behind door C? What is the probability that we are in state Sc, given that Monty chose door B?</p>
<p><img class="aligncenter size-full wp-image-200" title="picture-18" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-18.png" alt="picture-18" width="255" height="62" />and plugging in the values we get:</p>
<p><img class="aligncenter size-full wp-image-202" title="picture-21" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-21.png" alt="picture-21" width="210" height="67" />Which means we have a 2/3 chance the car is behind the <em>other</em> door (door C). Therefore we should switch.</p>
<h2>Does it matter if Monty knows?</h2>
<p>The only reason we managed to gain any information from Monty's choice of door B is that he <em>knows</em> the state of the world and acts differently depending on what state is the correct one. If Monty didn't know, he would have been choosing randomly between doors B and C and we would not have gained any information (except that Sb is not possible since there was no car behind door B).</p>
<p>If Monty <em>always</em> chooses door B when neither B nor C have the car, we would not have gained any information when he opens door B, but we would gain information if he opens door C (do you see why?).</p>
<p>Note that it is still to our advantage to switch doors, since in this case the probabilities for the states Sa and Sc are the same (1/2). And if we don't know whether Monty knows or not, we <em>might</em> get an advantage from switching.</p>
<ol class="footnotes"><li id="footnote_0_179" class="footnote"> If you are really pedantic, the mathematically correct definition of the problem is: "Suppose you’re on a game show and you’re given the choice of three doors. Behind one door is a car; behind the others, goats. The car and the goats were placed randomly behind the doors before the show. The rules of the game show are as follows: After you have chosen a door,the door remains closed for the time being. The game show host, Monty Hall, who knows what is behind the doors, now has to open one of the two remaining doors, and the door he opens must have a goat behind it. If both remaining doors have goats behind them, he chooses one randomly. After Monty Hall opens a door with a goat, he will ask you to decide whether you want to stay with your first choice or to switch to the last remaining door. Imagine that you chose Door 1 and the host opens Door 3, which has a goat. He then asks you “Do you want to switch to Door Number 2?” Is it to your advantage to change your choice? (<a title="The Psychology of the Monty Hall Problem: Discovering Psychological  Mechanisms for Solving a Tenacious Brain Teaser " href="http://www.usd.edu/~xtwang/Papers/MontyHallPaper.pdf" target="_blank">Krauss and Wang 2003:10</a>)"</li><li id="footnote_1_179" class="footnote"> This is important, if he doesn't choose either door randomly, you gain information asymmetrically. Keep reading. </li></ol>]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/05/the-monty-hall-problem/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Visualizing Bayes&#8217; theorem</title>
		<link>http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/</link>
		<comments>http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/#comments</comments>
		<pubDate>Fri, 01 May 2009 14:11:31 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=119</guid>
		<description><![CDATA[I recently came up with what I think is an intuitive way to explain Bayes' Theorem. I searched in google for a while and could not find any article that explains it in this particular way.
Of course there's the wikipedia page, that long article by Yudkowsky, and a bunch of other explanations and tutorials. But [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came up with what I think is an intuitive way to explain Bayes' Theorem. I <a href="http://www.google.com/search?q=bayes+theorem+venn+diagram" target="_blank">searched in google</a> for a while and could not find any article that explains it in this particular way.</p>
<p>Of course there's the <a title="Bayes' theorem" href="http://en.wikipedia.org/wiki/Bayes'_theorem" target="_blank">wikipedia page</a>, that <a title="An Intuitive Explanation of Bayes' Theorem" href="http://yudkowsky.net/rational/bayes" target="_blank">long article</a> by Yudkowsky, and a bunch of other explanations and tutorials. But none of them have any pictures. So without further ado, and with all the chutzpah I can gather, here goes my explanation.</p>
<h2>Probabilities</h2>
<p>One of the easiest ways to understand probabilities is to think of them in terms of <a title="Venn diagram" href="http://en.wikipedia.org/wiki/Venn_Diagram" target="_blank">Venn Diagrams</a>. You basically have a <em>Universe</em> with all the possible outcomes (of an experiment for instance), and you are interested in some subset of them, namely some <em>event</em>. Say we are studying cancer, so we observe people and see whether they have cancer or not. If we take as our Universe all people participating in our study, then there are two possible outcomes for any particular individual, either he has cancer or not. We can then split our universe in two events: the event "people with cancer" (designated as <em>A</em>), and "people with no cancer" (or <em>~A</em>). We could build a diagram like this:</p>
<p><img class="aligncenter size-full wp-image-120" title="venn-a" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-a.png" alt="venn-a" width="390" height="340" />So what is the probability that a randomly chosen person has cancer? It is just the number of elements in <em>A</em> divided by the number of elements of <em>U</em> (the Universe). We denote the number of elements of <em>A</em> as <em>|A|</em>, and read it the <em>cardinality of A</em>. And define the probability of <em>A</em>, <em>P(A)</em>, as</p>
<p><img class="aligncenter size-full wp-image-149" title="eq01" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq01.png" alt="eq01" width="116" height="61" /></p>
<p>Since <em>A</em> can have at most the same number of elements as <em>U</em>, the probability <em>P(A)</em> can be at most one.</p>
<p>Good so far? Okay, let's add another event. Let's say there is a new screening test that is supposed to measure something. That test will be "positive" for some people, and "negative" for some other people. If we take the event B to mean "people for which the test is positive". We can create another diagram:</p>
<p><img class="aligncenter size-full wp-image-121" title="venn-b" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-b.png" alt="venn-b" width="390" height="340" />So what is the probability that the test will be "positive" for a randomly selected person? It would be the number of elements of <em>B</em> (cardinality of <em>B</em>, or <em>|B|</em>) divided by the number of elements of <em>U</em>, we call this <em>P(B)</em>, the probability of event <em>B</em> occurring.</p>
<p><img class="aligncenter size-full wp-image-150" title="eq02" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq02.png" alt="eq02" width="111" height="61" /></p>
<p>Note that so far, we have treated the two events in isolation. What happens if we put them together?</p>
<p><img class="aligncenter size-full wp-image-122" title="venn-last" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-last.png" alt="venn-last" width="390" height="340" />We can compute the probability of both events occurring (<em>AB</em> is a shorthand for <em>A∩B</em>) in the same way.</p>
<p><img class="aligncenter size-full wp-image-153" title="eq04" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq04.png" alt="eq04" width="153" height="63" /></p>
<p>But this is where it starts to get interesting. What can we read from the diagram above?</p>
<p>We are dealing with an entire Universe (all people), the event <em>A</em> (people with cancer), and the event <em>B</em> (people for whom the test is positive). There is also an overlap now, namely the event <em>AB</em> which we can read as "people with cancer and with a positive test result". There is also the event <em>B - AB</em> or "people without cancer and with a positive test result", and the event <em>A - AB</em> or "people with cancer and with a negative test result".</p>
<p>Now, the question we'd like answered is "given that the test is positive for a randomly selected individual, what is the probability that said individual has cancer?". In terms of our Venn diagram, that translates to "given that we are in region <em>B</em>, what is the probability that we are in region <em>AB</em>?" or stated another way "if we make  region <em>B</em> our new Universe, what is the probability of <em>A</em>?".  The notation for this is <em>P(A|B)</em> and it is  read "the probability of A given B".</p>
<p>So what is it? Well, it should be</p>
<p><img class="aligncenter size-full wp-image-151" title="eq03" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq03.png" alt="eq03" width="152" height="58" />And if we divide both the numerator and the denominator by <em>|U|</em></p>
<p><em><img class="aligncenter size-full wp-image-155" title="eq051" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq051.png" alt="eq051" width="159" height="79" /></em>we can rewrite it using the previously derived equations as</p>
<p><img class="aligncenter size-full wp-image-131" title="bayes-eq1" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq1.png" alt="bayes-eq1" width="178" height="54" />What we've effectively done is change the Universe from <em>U</em> (all people), to <em>B</em> (people for whom the test is positive), but we are still dealing with probabilities defined in <em>U</em>.</p>
<p><img class="aligncenter size-full wp-image-156" title="venn-justb" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-justb.png" alt="venn-justb" width="380" height="381" /></p>
<p>Now let's ask the converse question "given that a randomly selected individual has cancer (event <em>A</em>), what is the probability that the test is positive for that individual (event <em>AB</em>)?". It's easy to see that it is</p>
<p><img class="aligncenter size-full wp-image-132" title="bayes-eq2" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq2.png" alt="bayes-eq2" width="168" height="60" />Now we have everything we need to derive Bayes'  theorem, putting those two equations together we get</p>
<p><img class="aligncenter size-full wp-image-133" title="bayes-eq3" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq3.png" alt="bayes-eq3" width="240" height="28" />which is to say <em>P(AB)</em> is the same whether you're looking at it from the point of view of <em>A</em> or <em>B</em>, and finally</p>
<p><img class="aligncenter size-full wp-image-134" title="bayes-eq4" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq4.png" alt="bayes-eq4" width="213" height="58" /></p>
<p>Which is Bayes' theorem. I have found that this Venn diagram method lets me re-derive Bayes' theorem at any time without needing to memorize it. It also makes it easier to apply it.</p>
<h2>Example</h2>
<p>Take the following example from Yudowsky:</p>
<blockquote><p>1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammograms. 9.6% of women without breast cancer will also get positive mammograms. A woman in this age group had a positive mammography in a routine screening. What is the probability that she actually has breast cancer?</p></blockquote>
<p>First of all, let's consider the women with cancer</p>
<p><img class="aligncenter size-full wp-image-142" title="example14" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/example14.png" alt="example14" width="331" height="332" />Now add the women with positive mammograms, note that we need to cover 80% of the area of event A and 9.6% of the area outside of event A.</p>
<p><img class="aligncenter size-full wp-image-143" title="example21" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/example21.png" alt="example21" width="320" height="321" />It is clear from the diagram that if we restrict our universe to <em>B</em> (women with positive mammograms), only a small percentage actually have cancer.  According to the article, most doctors guessed that the answer to the question was around 80%, which is clearly impossible looking at the diagram!</p>
<p>Note that the efficacy of the test is given from the context of <em>A</em>, "80% of women with breast cancer will get positive mamograms". This can be interpreted as "restricting the universe to just <em>A</em>, what is the probability of <em>B</em>?" or in other words <em>P(B|A)</em>.</p>
<p>Even without an exact Venn diagram, visualizing the diagram can help us apply Bayes' theorem:</p>
<ul>
<li>1% of women in the group have breast cancer → <em>P(A)</em> = 0.01</li>
<li>80% of those women get a positive mammogram, and 9.6% of the women without breast cancer get a positive mammogram too →<em> P(B)</em> = 0.8 <em>P(A)</em> + 0.096 (1 - <em>P(A)</em>) = 0.008 + 0.09504 = 0.10304</li>
<li>we can get <em>P(B|A)</em> straight from the problem statement, remember 80% of women with breast cancer get a positive mammogram → <em>P(B|A)</em> = 0.8</li>
</ul>
<p>Now let's plug those values into Bayes' theorem</p>
<p><img class="aligncenter size-full wp-image-162" title="eq06" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq06.png" alt="eq06" width="182" height="59" />which is 0.0776 or about a 7.8% chance of actually having breast cancer given a positive mammogram.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>Is that possible?</title>
		<link>http://oscarbonilla.com/2008/12/is-that-possible/</link>
		<comments>http://oscarbonilla.com/2008/12/is-that-possible/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 05:59:34 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=95</guid>
		<description><![CDATA[I normally read the good math bad math blog, where Mark Chu-Carroll debunks crackpots that try to hide their crazyness behind bad math. A while ago, he posted an article called "Why Math?", where he discusses how math allows you to "without ambiguity, prove that something is true or false".
While I agree with Mark, I think [...]]]></description>
			<content:encoded><![CDATA[<p>I normally read the <a href="http://scienceblogs.com/goodmath/">good math bad math</a> blog, where Mark Chu-Carroll debunks crackpots that try to hide their crazyness behind bad math. A while ago, he posted an article called "<a href="http://scienceblogs.com/goodmath/2008/12/why_math.php">Why Math?</a>", where he discusses how math allows you to "without ambiguity, prove that something is true or false".</p>
<p>While I agree with Mark, I think it's not completely clear from his post the importance of math's role in deciding what to believe.</p>
<p>One <a href="http://scienceblogs.com/goodmath/2008/12/why_math.php#comment-1255771">comment</a> in particular inspired me to write this post.</p>
<blockquote><p>Statements of the form "___ is impossible." strike me as deeply unscientific and dogmatic.</p></blockquote>
<p>See, math is a formal system for thinking logically. The heart of math lies in being able to prove things from assumptions. So in that sense, if the math is done right, Mark's remark "without ambiguity, prove that something is true or false" is spot on.</p>
<p>However, the assumptions need to be true or your whole argument is invalid, no matter how good the math is.</p>
<p>But going back to "___ is impossible", I think there are different levels of "impossible" that we need to be concerned about.</p>
<p>We can classify impossible things in three categories: logically impossible, physically impossible, and technologically impossible.</p>
<p><strong>The logically impossible</strong></p>
<p>To understand the first category, we need to resort to some philosophical bullshit. Back in the day when people didn't have <a href="http://www.reddit.com/">reddit</a> and used to wander around in their togas thinking whether we could think at all, the great <a href="http://en.wikipedia.org/wiki/Aristotle">Aristotle</a> proposed what he called his <a href="http://en.wikipedia.org/wiki/Laws_of_thought#Aristotle">three laws of thought</a>. These form the basis of logic and if you think about them, they make perfect sense. The first law is called the <a href="http://en.wikipedia.org/wiki/Law_of_identity">law of identity</a>, and it just says an object is equal to itself. The second law is the<a href="http://en.wikipedia.org/wiki/Law_of_noncontradiction"> law of noncontradiction</a> and it says that nothing can both have a property and not have it at the same time. The third law is the <a href="http://en.wikipedia.org/wiki/Law_of_excluded_middle">law of excluded middles</a> and it says that objects either have a certain property or they don't</p>
<p>I particularly like <a href="http://en.wikipedia.org/wiki/Avicenna">Avicena</a>'s description of the law of noncontradiction:</p>
<blockquote><p>Anyone who denies the law of non-contradiction should be beaten and burned until he admits that to be beaten is not the same as not to be beaten, and to be burned is not the same as not to be burned.</p></blockquote>
<p>This is where math helps. Math allows you to follow arguments to their logical conclusion and either prove or disprove them. It's formalized thinking, and it's full of little shortcuts and notation that allows you to be efficient in reaching your conclusions and in communicating those conclusions to others.</p>
<p>If you find something to be logically impossible, you've found a real impossibility. No way around it. Time travel is the best example of a logical impossibility. If you travel back in time to a place (and time) you have never been before, you would violate the law of noncontradiction (you were both there and not there). That's why sophisticated science fiction writers like <a href="http://en.wikipedia.org/wiki/Michael_Crichton">Michael Crichton</a> always have the travelers go to a <a href="http://www.amazon.com/gp/product/0345468260?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0345468260">parallel universe</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=obonilswebsit-20&amp;l=as2&amp;o=1&amp;a=0345468260" border="0" alt="" width="1" height="1" />.</p>
<p><strong>The physically imposible</strong></p>
<p>Some things however, are not logically impossible, but they violate the laws of physics. This is slightly harder to detect, since our understanding of the laws of physics changes and it has been known to be <a href="http://en.wikipedia.org/wiki/Luminiferous_aether">completely wrong</a>. But if you claim that something that violates the laws of physics is possible, the burden is on you to convince us that the laws of physics are wrong. Not an easy feat!</p>
<p>One example of this would be the claim that you can<a href="http://en.wikipedia.org/wiki/Faster_than_light"> travel faster than light</a>. Unless you're willing to debunk <a href="http://en.wikipedia.org/wiki/Henri_Poincaré">Poincaré</a>'s <a href="http://www.mathpages.com/rr/s8-08/8-08.htm">theory of relativity</a>, you're going to have trouble having anyone believe you.</p>
<p><strong>The technologically impossible</strong></p>
<p>Other things don't violate either the laws of logic (math) or the laws of physics, yet they are beyond our current reach. This is the weakest level of impossibility because it could be just a matter of time before we get there. Almost all current technology would have fallen in this category only a century ago. Just imagine trying to explain the Internet and iPhones to people of the 1800's, they would have certainly shouted "Witchery!".</p>
<p>In conclusion, statements of the form "___ is impossible" don't need to be unscientific and dogmatic.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/12/is-that-possible/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Simple Guide to Complexity Theory</title>
		<link>http://oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/</link>
		<comments>http://oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 05:09:55 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=76</guid>
		<description><![CDATA[After reading Jeff's terribly misguided post about NP-completeness I thought to myself: "If Jeff, who seems to be completely clueless about complexity theory, can write a blog post about it then so can I."
So without further ado, here's ob's complex guide to simplifying complexity theory.
First of all let's get the definitions out of the way.
Turing [...]]]></description>
			<content:encoded><![CDATA[<p>After reading <a href="http://www.codinghorror.com/blog/archives/001187.html">Jeff's terribly misguided post about NP-completeness</a> I thought to myself: "If Jeff, who seems to be completely clueless about complexity theory, can write a blog post about it then so can I."</p>
<p>So without further ado, here's ob's complex guide to simplifying <a title="complexity theory" href="http://en.wikipedia.org/wiki/Computational_complexity_theory" target="_blank">complexity theory</a>.</p>
<p>First of all let's get the definitions out of the way.</p>
<p><strong>Turing machine:</strong> An idealized computer, with infinite memor<span style="text-decoration: line-through;">y, <span style="text-decoration: line-through;">an infinitely fast cpu, and unlimited bandwidth</span></span>. It's a mathematical model of computer so it can kick your Core 2 Duo's sorry little ass faster than you can say <em>Pentium</em>. <em>(</em><strong><em>update:</em></strong><em> I originally wanted to make the point that bandwidth and cpu speed are irrelevant, but it seems to have confused more than clarified.)</em></p>
<p><strong>Problem:</strong> In complexity theory, a problem is really a decision problem. It has a simple yes/no answer. <span style="text-decoration: line-through;">You don't ask "take this list and sort it and print the last ten items" that's not a decision problem. You do ask "does this program, given this input, produce the last ten items of the sorted input?".</span></p>
<p><em>(<strong>update:</strong> Although the sort problem as outlined here would be a valid decision problem, it is confusing since just changing my "last ten items" to "last C items" where C is a function of n would make it not be a decision problem. Better to use some other example, like "<a href="http://en.wikipedia.org/wiki/Primality_testing">is the number given prime?</a>")</em></p>
<p><strong><em>n</em>:</strong> Size of the input for the turing machine. E.g. if your turing machine is sorting strings, like in the example above, <em>n</em> is the number of symbols that it takes as input.</p>
<p><strong>T(<em>n</em>):</strong> Number of steps (i.e. instructions) that a turing machine must execute to solve a problem with input of size <em>n</em>.</p>
<p><strong>Polynomial Time:</strong> When T(<em>n</em>) can be expressed as an equation of <em>n</em>, and possibly some constants, using only addition, subtraction, multiplication, and constant non-negative whole number exponents. E.g. n² is a polynomial while 2ⁿ is not.</p>
<p><strong>Non-deterministic turing machine:</strong> A turing machine that can, at every branch point, take all possible branches in parallel. We call this <em>guessing</em> the optimal answer because, since the turing machine takes all branches, it must take the optimal branch too. If any of the parallel turing machines finds an answer, the non-deterministic turing machine stops and gives that answer (this means that it's ok for some branches to never end).</p>
<p>So take your already idealized computer from above and make it able to reproduce itself on every branch point. I.e. it can follow all possible decisions in parallel.</p>
<p><strong>P:</strong> The class of problems that can be solved by a turing machine in polynomial time.</p>
<p><strong>NP:</strong> The class of problems that can be solved by a non-deterministic turing machine in polynomial time.</p>
<p><strong>Reducing a problem to another:</strong> Imagine you have two problems, <em>P1</em> and <em>P2</em>. You know something about <em>P1</em> (e.g. that it belongs to <strong>NP</strong>). Now you want to prove some property of <em>P2</em>, for instance, that it belongs to <strong>NP</strong> as well.</p>
<p><span style="text-decoration: line-through;">One technique is to show that if we could solve </span><em><span style="text-decoration: line-through;">P2</span></em><span style="text-decoration: line-through;"> in polynomial time (i.e. </span><em><span style="text-decoration: line-through;">P2</span></em><span style="text-decoration: line-through;"> belongs to </span><strong><span style="text-decoration: line-through;">P</span></strong><span style="text-decoration: line-through;">), we could use that answer to solve </span><em><span style="text-decoration: line-through;">P1</span></em><span style="text-decoration: line-through;"> in polynomial time. This would mean that </span><em><span style="text-decoration: line-through;">P1</span></em><span style="text-decoration: line-through;"> belongs to </span><strong><span style="text-decoration: line-through;">P</span></strong><span style="text-decoration: line-through;"> which is a contradiction. This technique is called </span><em><span style="text-decoration: line-through;">reductio ad absurdum</span></em><span style="text-decoration: line-through;">.</span> <em>(<strong>update: </strong>I completely botched this and commenter Bibi correctly called me on it. Here's an attempt to clarify a reduction: if you want to solve an instance of P2, you convert it to an instance of P1, and then solve P1 to get an answer. Thus, you've reduced P2 to P1. How's that?)</em></p>
<p><strong>NP-complete:</strong> We say a problem is NP-complete if it satisfies two properties: 1) it belongs to <strong>NP</strong>, and 2) every other problem that belogs to <strong>NP</strong> can be reduced, in polynomial time, to it.</p>
<p>This means that if we come up with a solution for an NP-complete problem that runs in polynomial time in a deterministic turing machine (i.e. belongs to <strong>P</strong>), any other problem in <strong>NP</strong> can be solved in polynomial time by first reducing it (again, in polynomial time) to this problem, and using our solution. We would have proved that <strong>P = NP</strong> and we would have also won (pinky to corner of mouth) <a href="http://www.claymath.org/millennium/P_vs_NP/">one million dollars</a>.</p>
<p><strong>NP-hard:</strong> A problem <em>P1</em>, that is so hard, that even though we can prove number two above, we can't prove number one. This means we know <em>P1</em> to be just as hard as anything in <strong>NP</strong> and possibly harder, but <em>we don't know</em> if <em>P1</em> is in <strong>NP</strong> or not. <em>P1</em> is very likely to require exponential time.</p>
<p><strong><em>(update: <span style="font-weight: normal;">I stand by my definition of NP-hard. Although not being able to prove #1 is a sufficient condition, it is not necessary. All problems in P are in NP, and yet we call them P, not NP. Thus, even if all problems that are NP-complete are also NP-hard, it's uninteresting to call an NP-complete problem NP-hard. The point of calling a problem NP-hard is that, it's really hard! Even if it turned out that P = NP, an NP-hard problem might still be hard!)</span></em></strong></p>
<p>So there you have it, go impress your friends. I hear that "hey, baby! your love is NP-hard to get" is a very successful pickup line at pubs around M.I.T.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>The case against snippets</title>
		<link>http://oscarbonilla.com/2008/08/the-case-against-snippets/</link>
		<comments>http://oscarbonilla.com/2008/08/the-case-against-snippets/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 07:09:17 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=59</guid>
		<description><![CDATA[Back when TextMate was relatively new and that famous video of ruby on rails was making the rounds. I watched in amazement with the rest of the nerds as code flew around the screen. I had caught Snippet Fever.
After using TextMate for a while I became addicted to snippets. The basic idea of a snippet [...]]]></description>
			<content:encoded><![CDATA[<p>Back when <a href="http://macromates.com/">TextMate</a> was relatively new and<a href="http://media.rubyonrails.org/video/rails_take2_with_sound.mov"> that famous video</a> of ruby on rails was making the rounds. I watched in amazement with the rest of the nerds as code flew around the screen. I had caught Snippet Fever.</p>
<p>After using TextMate for a while I became addicted to snippets. The basic idea of a snippet is that you can write a few characters and they expand to whatever you want. For example, you can type: 'fl', hit Tab and TextMate will write:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> ... <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    ...		     
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Where <code>...</code> is where the insertion point will be each time you hit tab. You can do the same with Emacs in many different ways: Emacs skeletons, the snippet.el plugging, hand-coded elisp, etc. The point of this post, however, is not to show all the different ways that you can get snippets. The point is to ask whether it's worth using snippets at all.</p>
<p>Snippets eliminate the need to type recurrent idioms. If you have to write accessors, it's very pleasant to type 'set', hit tab and watch the screen fill with 20 lines of code that just wrap a field in a class with a setter function. But this is fixing the problem in the wrong place.</p>
<p>The fundamental problem is that the language <emph>is too damn verbose</emph>. </p>
<p>Imagine English had no pronouns so if I wanted to tell you a story about my friend Tim and me, I had to write:</p>
<blockquote><p>
  Tim had called Oscar to ask Oscar if Oscar could lend Tim the book that Oscar had bought the day before. Oscar told Tim that Oscar was still reading it, but that Oscar would be happy to lend Tim Oscar's book when Oscar was done with the book so that Tim could read it.
</p></blockquote>
<p>The above paragraph is too verbose. It's hard to write. Snippets would help me write it by automatically filling all the appropriate places with  "Tim" and "Oscar".</p>
<p>If the language you are using is so verbose that you need snippets, how about fixing the language?</p>
<p>Even on languages that don't allow fixing the syntax you can still do something.</p>
<p>For example, in C, if you find yourself typing a <code>for</code> loop to access a list over and over again:</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> length<span style="color: #009900;">&#40;</span>list<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Make a small pre-processor macro that abstracts that:</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">  <span style="color: #339933;">#define EACH(list) for (int i = 0; i &lt; length(list); i++)</span></pre></div></div>

<p>And now you can write:</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">  EACH<span style="color: #009900;">&#40;</span>list<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> list<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And since code is usually read many more times than it is written, you have helped make the source base a little better.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/08/the-case-against-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://media.rubyonrails.org/video/rails_take2_with_sound.mov" length="54364199" type="video/quicktime" />
		</item>
		<item>
		<title>Another useless C99 tidbit</title>
		<link>http://oscarbonilla.com/2008/04/another-useless-c99-tidbit/</link>
		<comments>http://oscarbonilla.com/2008/04/another-useless-c99-tidbit/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 06:50:04 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=64</guid>
		<description><![CDATA[Another useless C99 tidbit: trigraphs.]]></description>
			<content:encoded><![CDATA[<p>From page 18 of the <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf">C99</a> standard:</p>
<blockquote><p>
All occurrences in a source ﬁle of the following sequences of three characters (called trigraph sequences) are replaced with the corresponding single character. </p>
<pre>
??= #    ??( [     ??/ \
??) ]      ??' ^     ??< {
??! |      ??> }    ??- ~
</pre>
<p>No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed above is not changed.
</p></blockquote>
<p>Ok, so take the following C program:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">??=</span>include <span style="color: #339933;">&lt;</span>stdio.<span style="color: #202020;">h</span><span style="color: #339933;">&gt;</span>
<span style="color: #993333;">int</span>
main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #339933;">??</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">??</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #339933;">??&lt;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;hello world<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">??&gt;</span></pre></div></div>

<p>And compile it with the <code>-trigraphs</code> switch to gcc:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">dirac src $ gcc -trigraphs -o trigraphs trigraphs.c
dirac src $ ./trigraphs
hello world</pre></div></div>

<p>Combined with <a href="http://blog.oscarbonilla.com/2008/04/11/hidden-gems-in-c99-1/">this</a> you could seriously obfuscate your C code.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/04/another-useless-c99-tidbit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hidden Gems in C99 (1)</title>
		<link>http://oscarbonilla.com/2008/04/hidden-gems-in-c99-1/</link>
		<comments>http://oscarbonilla.com/2008/04/hidden-gems-in-c99-1/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 06:57:26 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=63</guid>
		<description><![CDATA[After some late night reading of the C99 spec, I've found quite a few hidden gems. I'm going to start posting some of these. Since it's late, I'll just post a teaser.
On page 64 of the C99 standard it says:

In all aspects of the language, the six tokens

  %: %:%:

behave,respectively,the same as the six [...]]]></description>
			<content:encoded><![CDATA[<p>After some late night reading of the C99 spec, I've found quite a few hidden gems. I'm going to start posting some of these. Since it's late, I'll just post a teaser.</p>
<p>On page 64 of <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf">the C99 standard</a> it says:</p>
<blockquote><p>
In all aspects of the language, the six tokens</p>
<pre>
<: :> <% %> %: %:%:
</pre>
<p>behave,respectively,the same as the six tokens </p>
<pre>
[ ] { } # ##
</pre>
<p>except for their spelling.
</p></blockquote>
<p>Really? Then let's try this program:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">%:</span>include <span style="color: #339933;">&lt;</span>stdio .<span style="color: #202020;">h</span><span style="color: #339933;">&gt;</span>
<span style="color: #993333;">int</span>
main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #339933;">&lt;::&gt;</span><span style="color: #009900;">&#41;</span>
<span style="color: #339933;">&lt;%</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;hello world<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">%&gt;</span></pre></div></div>

<p>Compile it an run it:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">dirac src $ gcc main.c
dirac src $ ./a.out
hello world</pre></div></div>

<p>Whaddaya know... I know, I know... useless. Wait for the next post then.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/04/hidden-gems-in-c99-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Haskell</title>
		<link>http://oscarbonilla.com/2008/04/haskell/</link>
		<comments>http://oscarbonilla.com/2008/04/haskell/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 00:47:53 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=60</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href='http://blog.oscarbonilla.com/wp-content/uploads/2008/04/haskell.png' class="lightview" rel="gallery[60]" title="Haskell and VS.Net"><img src="http://blog.oscarbonilla.com/wp-content/uploads/2008/04/haskell.png" alt="At the intersection between Haskell Programmers and VS.NET Users" title="Haskell and VS.Net" width="499" height="483" class="alignnone size-full wp-image-61" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/04/haskell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cold Boot Attacks Against Disk Encryption</title>
		<link>http://oscarbonilla.com/2008/02/cold-boot-attacks-against-disk-encryption/</link>
		<comments>http://oscarbonilla.com/2008/02/cold-boot-attacks-against-disk-encryption/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 05:47:11 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/2008/02/21/cold-boot-attacks-against-disk-encryption/</guid>
		<description><![CDATA[Bruce Schneier linked to an interesting article on techniques for reading the DRAM contents of a machine after it has been powered off. 

We show that disk encryption, the standard approach to protecting sensitive data on laptops, can be defeated by relatively simple methods. We demonstrate our methods by using them to defeat three popular [...]]]></description>
			<content:encoded><![CDATA[<p>Bruce Schneier <a href="http://www.schneier.com/blog/archives/2008/02/cold_boot_attac.html">linked to</a> <a href="http://www.freedom-to-tinker.com/?p=1257">an interesting article</a> on techniques for reading the DRAM contents of a machine after it has been powered off. </p>
<blockquote><p>
We show that disk encryption, the standard approach to protecting sensitive data on laptops, can be defeated by relatively simple methods. We demonstrate our methods by using them to defeat three popular disk encryption products: BitLocker, which comes with Windows Vista; FileVault, which comes with MacOS X; and dm-crypt, which is used with Linux.</p>
<p>[...]</p>
<p>The root of the problem lies in an unexpected property of today’s DRAM memories. DRAMs are the main memory chips used to store data while the system is running. Virtually everybody, including experts, will tell you that DRAM contents are lost when you turn off the power. But this isn’t so. Our research shows that data in DRAM actually fades out gradually over a period of seconds to minutes, enabling an attacker to read the full contents of memory by cutting power and then rebooting into a malicious operating system.</p>
<p>Interestingly, if you cool the DRAM chips, for example by spraying inverted cans of “canned air” dusting spray on them, the chips will retain their contents for much longer. At these temperatures (around -50 °C) you can remove the chips from the computer and let them sit on the table for ten minutes or more, without appreciable loss of data. Cool the chips in liquid nitrogen (-196 °C) and they hold their state for hours at least, without any power. Just put the chips back into a machine and you can read out their contents.</p>
<p>This is deadly for disk encryption products because they rely on keeping master decryption keys in DRAM. This was thought to be safe because the operating system would keep any malicious programs from accessing the keys in memory, and there was no way to get rid of the operating system without cutting power to the machine, which “everybody knew” would cause the keys to be erased.</p>
<p>Our results show that an attacker can cut power to the computer, then power it back up and boot a malicious operating system (from, say, a thumb drive) that copies the contents of memory. Having done that, the attacker can search through the captured memory contents, find any crypto keys that might be there, and use them to start decrypting hard disk contents. We show very effective methods for finding and extracting keys from memory, even if the contents of memory have faded somewhat (i.e., even if some bits of memory were flipped during the power-off interval). If the attacker is worried that memory will fade too quickly, he can chill the DRAM chips before cutting power.</p>
<p>There seems to be no easy fix for these problems. Fundamentally, disk encryption programs now have nowhere safe to store their keys. Today’s Trusted Computing hardware does not seem to help; for example, we can defeat BitLocker despite its use of a Trusted Platform Module.
</p></blockquote>
<p>Notice that this attack is particularly dangerous because it can be trivially automated. All you need is a USB drive or CD with the malicious operating system already set up. If you have access to a system (e.g. a laptop), all you need to do is shut it down and boot it up from your malicious OS and you have a copy of the DRAM and thus the encryption keys. </p>
<p>A little known fact from Apple hardware is that it supports setting <a href="http://docs.info.apple.com/article.html?artnum=106482">a password in the Open Firmware</a> which will prevent the machine from booting from any device other than the built-in hard drive. I highly recommend using this option. I believe it could help in defeating even this new sophisticated attack.</p>
<p>Unless the attacker is careful to freeze the DRAM and pull it out of the laptop and transfer it to another machine to read it from there, the contents will be erased while he figures out that the machine can't boot from a different drive. It's a simple countermeasure that is available today. It won't work in all cases, but it certainly will defeat a fair number of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/02/cold-boot-attacks-against-disk-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tête de Moine and&#8230; Challah?</title>
		<link>http://oscarbonilla.com/2008/01/tete-de-moine-and-challah/</link>
		<comments>http://oscarbonilla.com/2008/01/tete-de-moine-and-challah/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 03:18:08 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/2008/01/13/tete-de-moine-and-challah/</guid>
		<description><![CDATA[This weekend I was surprised by an invite from a friend to have dinner at his house. I was even more surprised when he gifted me a Girolle and a Tête de Moine. Wow! What a present!

Unfortunately, I couldn't find any Zopf to eat my cheese with. If anyone knows of a Swiss bakery in [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend I was surprised by an invite from a friend to have dinner at his house. I was even more surprised when he gifted me a <a href="http://www.lagirolle.ch/">Girolle</a> and a <a href="http://en.wikipedia.org/wiki/Tête_de_Moine">Tête de Moine</a>. Wow! What a present!</p>
<p><a href="http://blog.oscarbonilla.com/wp-content/uploads/2008/01/img_6423.jpg" class="lightview" rel="gallery[47]" title="Tête de Moine and Challah"><img src="http://blog.oscarbonilla.com/wp-content/uploads/2008/01/img_6423.jpg" alt="Tête de Moine and Challah" /></a></p>
<p>Unfortunately, I couldn't find any <a href="http://en.wikipedia.org/wiki/Zopf">Zopf</a> to eat my cheese with. If anyone knows of a Swiss bakery in the bay area, I'd like to know. At any rate, the bread you see in the picture is actually a <a href="http://en.wikipedia.org/wiki/Challah">Challah</a>, which doesn't have milk and has honey, so it's not quite the same flavor. However, it was ok for having the Tête de Moine.</p>
<p>I've also found Tête de Moine at <a href="http://www.igourmet.com/shoppe/search.aspx?qry=Tete+de+Moine&amp;search.x=0&amp;search.y=0">iGourmet</a>, so I'll be able to get some more once I finish this one. Is there a place in the bay area where they sell Tête de Moine?</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/01/tete-de-moine-and-challah/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
