<?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/"
	>

<channel>
	<title>Ramblings</title>
	<atom:link href="http://blog.oscarbonilla.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.oscarbonilla.com</link>
	<description>Stuff that's on my mind</description>
	<pubDate>Tue, 02 Dec 2008 17:06:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple Guide to Complexity Theory</title>
		<link>http://blog.oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/</link>
		<comments>http://blog.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&#8217;s terribly misguided post about NP-completeness I thought to myself: &#8220;If Jeff, who seems to be completely clueless about complexity theory, can write a blog post about it then so can I.&#8221;
So without further ado, here&#8217;s ob&#8217;s complex guide to simplifying complexity theory.
First of all let&#8217;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&#8217;s terribly misguided post about NP-completeness</a> I thought to myself: &#8220;If Jeff, who seems to be completely clueless about complexity theory, can write a blog post about it then so can I.&#8221;</p>
<p>So without further ado, here&#8217;s ob&#8217;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&#8217;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&#8217;s a mathematical model of computer so it can kick your Core 2 Duo&#8217;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&#8217;t ask &#8220;take this list and sort it and print the last ten items&#8221; that&#8217;s not a decision problem. You do ask &#8220;does this program, given this input, produce the last ten items of the sorted input?&#8221;.</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 &#8220;last ten items&#8221; to &#8220;last C items&#8221; where C is a function of n would make it not be a decision problem. Better to use some other example, like &#8220;<a href="http://en.wikipedia.org/wiki/Primality_testing">is the number given prime?</a>&#8220;)</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&#8217;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&#8217;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&#8217;ve reduced P2 to P1. How&#8217;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&#8217;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&#8217;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&#8217;s uninteresting to call an NP-complete problem NP-hard. The point of calling a problem NP-hard is that, it&#8217;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 &#8220;hey, baby! your love is NP-hard to get&#8221; is a very successful pickup line at pubs around M.I.T.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The case against snippets</title>
		<link>http://blog.oscarbonilla.com/2008/08/the-case-against-snippets/</link>
		<comments>http://blog.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>

		<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: &#8216;fl&#8217;, hit Tab and TextMate will write:</p>

<div class="wp_syntax"><div class="code"><pre class="c 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:#800080;">0</span>; i <span style="color: #339933;">&lt;</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&#8217;s worth using snippets at all.</p>
<p>Snippets eliminate the need to type recurrent idioms. If you have to write accessors, it&#8217;s very pleasant to type &#8217;set&#8217;, 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&#8217;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&#8217;s hard to write. Snippets would help me write it by automatically filling all the appropriate places with  &#8220;Tim&#8221; and &#8220;Oscar&#8221;.</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&#8217;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 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:#800080;">0</span>; i <span style="color: #339933;">&lt;</span> length<span style="color: #009900;">&#40;</span>list<span style="color: #009900;">&#41;</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 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 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>;</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://blog.oscarbonilla.com/2008/08/the-case-against-snippets/feed/</wfw:commentRss>
<enclosure url="http://media.rubyonrails.org/video/rails_take2_with_sound.mov" length="54364199" type="video/quick" />
		</item>
		<item>
		<title>Another useless C99 tidbit</title>
		<link>http://blog.oscarbonilla.com/2008/04/another-useless-c99-tidbit/</link>
		<comments>http://blog.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[C99]]></category>

		<category><![CDATA[GCC]]></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 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;">??&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://blog.oscarbonilla.com/2008/04/another-useless-c99-tidbit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hidden Gems in C99 (1)</title>
		<link>http://blog.oscarbonilla.com/2008/04/hidden-gems-in-c99-1/</link>
		<comments>http://blog.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>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=63</guid>
		<description><![CDATA[After some late night reading of the C99 spec, I&#8217;ve found quite a few hidden gems. I&#8217;m going to start posting some of these. Since it&#8217;s late, I&#8217;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&#8217;ve found quite a few hidden gems. I&#8217;m going to start posting some of these. Since it&#8217;s late, I&#8217;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&#8217;s try this program:</p>

<div class="wp_syntax"><div class="code"><pre class="c 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;">%&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&#8230; I know, I know&#8230; useless. Wait for the next post then.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2008/04/hidden-gems-in-c99-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Haskell</title>
		<link>http://blog.oscarbonilla.com/2008/04/haskell/</link>
		<comments>http://blog.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>

		<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'><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://blog.oscarbonilla.com/2008/04/haskell/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cold Boot Attacks Against Disk Encryption</title>
		<link>http://blog.oscarbonilla.com/2008/02/cold-boot-attacks-against-disk-encryption/</link>
		<comments>http://blog.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&#8217;t boot from a different drive. It&#8217;s a simple countermeasure that is available today. It won&#8217;t work in all cases, but it certainly will defeat a fair number of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2008/02/cold-boot-attacks-against-disk-encryption/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tête de Moine and&#8230; Challah?</title>
		<link>http://blog.oscarbonilla.com/2008/01/tete-de-moine-and-challah/</link>
		<comments>http://blog.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&#8217;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' 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&#8217;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&#8217;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&#8217;t have milk and has honey, so it&#8217;s not quite the same flavor. However, it was ok for having the Tête de Moine.</p>
<p>I&#8217;ve also found Tête de Moine at <a href="http://www.igourmet.com/shoppe/search.aspx?qry=Tete+de+Moine&#038;search.x=0&#038;search.y=0">iGourmet</a>, so I&#8217;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://blog.oscarbonilla.com/2008/01/tete-de-moine-and-challah/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Beautiful Emacs (Windows Edition)</title>
		<link>http://blog.oscarbonilla.com/2008/01/beautiful-emacs-windows-edition/</link>
		<comments>http://blog.oscarbonilla.com/2008/01/beautiful-emacs-windows-edition/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 00:03:01 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/2008/01/04/beautiful-emacs-windows-edition/</guid>
		<description><![CDATA[After fixing the font on my Carbon Emacs on Mac OS X, I&#8217;m spoiled with good fonts. Today I had to work on Windows and naturally, the only way to make Windows liveable is to work inside Emacs.
This is what a default installation of EmacsW32 looks like.

Oh horror! You guys are kidding, right? Courier? Seriously?
Naturally, [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://blog.oscarbonilla.com/2007/12/05/beautiful-emacs/">fixing the font</a> on my <a href="http://homepage.mac.com/zenitani/emacs-e.html">Carbon Emacs</a> on Mac OS X, I&#8217;m spoiled with good fonts. Today I had to work on Windows and naturally, the only way to make Windows liveable is to work inside Emacs.</p>
<p>This is what a default installation of <a href="http://www.ourcomments.org/Emacs/EmacsW32.html">EmacsW32</a> looks like.</p>
<p><a href='http://blog.oscarbonilla.com/wp-content/uploads/2008/01/emacsw32-courier.png' title='EmacsW32 Courier'><img src='http://blog.oscarbonilla.com/wp-content/uploads/2008/01/emacsw32-courier.png' alt='EmacsW32 Courier' /></a></p>
<p>Oh horror! You guys are kidding, right? Courier? Seriously?</p>
<p>Naturally, my first inclination was to use <a href="http://www.levien.com/type/myfonts/inconsolata.html">Inconsolata</a> again. Just like in Mac OS X. However, this is what Inconsolata looks like.</p>
<p><a href='http://blog.oscarbonilla.com/wp-content/uploads/2008/01/emacsw32-inconsolata.png' title='Emacs W32 Inconsolata'><img src='http://blog.oscarbonilla.com/wp-content/uploads/2008/01/emacsw32-inconsolata.png' alt='Emacs W32 Inconsolata' /></a></p>
<p>WTF? What&#8217;s with all the blurred text? Well, it turns out that <a href="http://antigrain.com/research/font_rasterization/">anti-aliasing and text rasterization differ significantly</a> between Mac OS X and Windows. Oh well. Scratch that plan.</p>
<p>Then I remembered that Incosolata is actually based on <a href="http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3">Consolas</a>, which is a font Microsoft created specifically for programming.</p>
<p>I downloaded and installed Consolas, and voil&agrave;! Beautiful Emacs once again.</p>
<p><a href='http://blog.oscarbonilla.com/wp-content/uploads/2008/01/emacsw32-consolas.png' title='EmacsW32 Consolas'><img src='http://blog.oscarbonilla.com/wp-content/uploads/2008/01/emacsw32-consolas.png' alt='EmacsW32 Consolas' /></a></p>
<p>Now it was just a matter of figuring out what the font was called. I had changed the font by clicking on the Emacs frame and pressing the shift key. In order to see what that does, I ran the <code>describe-key</code> function by typing <code>C-h k</code>, then clicking on the frame while holding the shift key. That told me the function that is called is <code>mouse-set-font</code> and it&#8217;s defined in <code>c:/Program Files/Emacs/emacs/lisp/term/w32-win.elc</code>. You can click on the file link and Emacs will take you to the function definition.</p>

<div class="wp_syntax"><div class="code"><pre class="lisp lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> mouse<span style="color: #66cc66;">-</span>set<span style="color: #66cc66;">-</span>font <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>rest fonts<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Select an Emacs font from a list of known good fonts and fontsets.
&nbsp;
If `w32-use-w32-font-dialog' is non-nil (the default), use the Windows
font dialog to display the list of possible fonts.  Otherwise use a
pop-up menu (like Emacs does on other platforms) initialized with
the fonts in `w32-fixed-font-alist'.
If `w32-list-proportional-fonts' is non-nil, add proportional fonts
to the list in the font selection dialog (the fonts listed by the
pop-up menu are unaffected by `w32-list-proportional-fonts').&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive
   <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> w32<span style="color: #66cc66;">-</span>use<span style="color: #66cc66;">-</span>w32<span style="color: #66cc66;">-</span>font<span style="color: #66cc66;">-</span>dialog
       <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>chosen<span style="color: #66cc66;">-</span>font <span style="color: #66cc66;">&#40;</span>w32<span style="color: #66cc66;">-</span>select<span style="color: #66cc66;">-</span>font <span style="color: #66cc66;">&#40;</span>selected<span style="color: #66cc66;">-</span>frame<span style="color: #66cc66;">&#41;</span>
					   w32<span style="color: #66cc66;">-</span>list<span style="color: #66cc66;">-</span>proportional<span style="color: #66cc66;">-</span>fonts<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> chosen<span style="color: #66cc66;">-</span>font <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">list</span> chosen<span style="color: #66cc66;">-</span>font<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
     <span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">-</span>popup<span style="color: #66cc66;">-</span>menu
      last<span style="color: #66cc66;">-</span>nonmenu<span style="color: #66cc66;">-</span>event
      <span style="color: #808080; font-style: italic;">;; Append list of fontsets currently defined.</span>
      <span style="color: #808080; font-style: italic;">;; Conditional on new-fontset so bootstrapping works on non-GUI compiles</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>fboundp 'new<span style="color: #66cc66;">-</span>fontset<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">append</span> w32<span style="color: #66cc66;">-</span>fixed<span style="color: #66cc66;">-</span>font<span style="color: #66cc66;">-</span>alist <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">list</span> <span style="color: #66cc66;">&#40;</span>generate<span style="color: #66cc66;">-</span>fontset<span style="color: #66cc66;">-</span>menu<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> fonts
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span>font<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#40;</span>while fonts
	  <span style="color: #66cc66;">&#40;</span>condition<span style="color: #66cc66;">-</span><span style="color: #b1b100;">case</span> <span style="color: #b1b100;">nil</span>
	      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">progn</span>
                <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> font <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> fonts<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#40;</span>set<span style="color: #66cc66;">-</span>default<span style="color: #66cc66;">-</span>font font<span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> fonts <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">error</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> fonts <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> fonts<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span> font<span style="color: #66cc66;">&#41;</span>
	    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">error</span> <span style="color: #ff0000;">&quot;Font not found&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Now, I don&#8217;t know what all of that does, but it seems like <code>(set-default-font font)</code> is the one function that actually sets the font. In order to figure out what the font is called, I copied all of the function to the good old <code>*scratch*</code> buffer, and added a call to <code>(message font)</code> right after the call to <code>(set-default-font font)</code>. Then I redefined the function by typing <code>C-x C-e</code> at the end of it. After shift clicking on the frame again and selecting the Consolas font I had all the information I needed.</p>
<p>Now it was just a matter of putting the following snippet in my <code>.emacs</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp lisp" style="font-family:monospace;">    <span style="color: #66cc66;">&#40;</span>set<span style="color: #66cc66;">-</span>default<span style="color: #66cc66;">-</span>font
     <span style="color: #ff0000;">&quot;-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1&quot;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Ahh&#8230; I feel so much better now&#8230; now what was I doing in Windows again?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2008/01/beautiful-emacs-windows-edition/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lazy-loading emacs functionality</title>
		<link>http://blog.oscarbonilla.com/2008/01/lazy-loading-emacs-functionality/</link>
		<comments>http://blog.oscarbonilla.com/2008/01/lazy-loading-emacs-functionality/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 05:05:20 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/2008/01/02/lazy-loading-emacs-functionality/</guid>
		<description><![CDATA[Quick, how big is your .emacs file? How long does it take emacs to load? A few days ago I found that my .emacs file had slowly grown to the point where it was taking emacs a significant amount of time to load. Something needed to be done.
A quick glance at the file told me [...]]]></description>
			<content:encoded><![CDATA[<p>Quick, how big is your <code>.emacs</code> file? How long does it take emacs to load? A few days ago I found that my <code>.emacs</code> file had slowly grown to the point where it was taking emacs a significant amount of time to load. Something needed to be done.</p>
<p>A quick glance at the file told me I was loading a lot of modules that I seldom use. For instance, I occasionally write some code in Common Lisp or Haskell, so naturally I was loading <a href="http://common-lisp.net/project/slime/">slime</a> and the <a href="http://www.haskell.org/haskell-mode/">haskell</a> environment. I commented those out.</p>
<p>However, after commenting them out, I quickly realized that not loading them was problematic. When I wanted to use them, I had to open my <code>.emacs</code> file, uncomment the relevant portion,  and <code>M-x eval-region</code> the code.</p>
<p>Then it occurred to me that I had a clear entry point for some of these modules. When I write Common Lisp, I usually start by loading SLIME&#8217;s REPL by running <code>M-x slime</code>. I came up with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> slime <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>add<span style="color: #66cc66;">-</span>to<span style="color: #66cc66;">-</span><span style="color: #b1b100;">list</span> 'load<span style="color: #66cc66;">-</span>path <span style="color: #ff0000;">&quot;~/emacs/slime&quot;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> inferior<span style="color: #66cc66;">-</span>lisp<span style="color: #66cc66;">-</span>program <span style="color: #ff0000;">&quot;/usr/local/bin/sbcl&quot;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>require 'slime<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>slime<span style="color: #66cc66;">-</span>setup<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>slime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Which basically sets up my slime environment and then loads slime. Note that the <code>slime</code> function itself is redefined as part of the evaluation of <code>(require 'slime)</code>, so although this looks like a recursive call, it&#8217;s not.</p>
<p>I&#8217;ve used this trick in several other cases and I think it&#8217;s kind of neat. It helps me keep Emacs loading fast, but I still have all the bells and whistles available.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2008/01/lazy-loading-emacs-functionality/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Leave a door open (for Peace)</title>
		<link>http://blog.oscarbonilla.com/2007/12/leave-a-door-open-for-peace/</link>
		<comments>http://blog.oscarbonilla.com/2007/12/leave-a-door-open-for-peace/#comments</comments>
		<pubDate>Sat, 08 Dec 2007 15:52:24 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=38</guid>
		<description><![CDATA[
Today is John Lennon&#8217;s death anniversary. He was shot to death on December 8th, 1980. I always commemorate this day by listening to John Lennon&#8217;s music, smoking unfiltered Gitanes, playing guitar, and letting my hair grow long&#8230; for a day&#8230; ok, not really, but I do try to listen to Imagine, at least once. 
At [...]]]></description>
			<content:encoded><![CDATA[<p><img align="left" border="1" vspace="8" hspace="8" src='http://blog.oscarbonilla.com/wp-content/uploads/2007/12/340x.thumbnail.jpg' alt='John Lennon' /></p>
<p>Today is <a href="http://en.wikipedia.org/wiki/John_Lennon">John Lennon&#8217;s</a> death anniversary. He was shot to death on December 8th, 1980. I always commemorate this day by listening to John Lennon&#8217;s music, smoking unfiltered Gitanes, playing guitar, and letting my hair grow long&#8230; for a day&#8230; ok, not really, but I do try to listen to <a href="http://www.youtube.com/watch?v=jEOkxRLzBf0">Imagine</a>, at least once. </p>
<p>At any rate, <a href="http://www.imaginepeace.com/">there is a website</a> now to commemorate John. It has a letter from Yoko Ono and a video from John Lennon.</p>
<p>The goal of an artist is to elicit some kind of emotion from the audience through his art. You cannot see the video and feel nothing. I left it running in the background while doing other things as I&#8217;ve seen Lennon interviews thousands of times and can usually remember how they go, but the imagery at the end, after John stops talking, pulled my eyes and engaged me like nothing has for a long while. I literally couldn&#8217;t stop watching.</p>
<p>At any rate, here&#8217;s to you John Lennon. You were the Walrus.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2007/12/leave-a-door-open-for-peace/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Vive la différence</title>
		<link>http://blog.oscarbonilla.com/2007/12/vive-la-difference/</link>
		<comments>http://blog.oscarbonilla.com/2007/12/vive-la-difference/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 15:02:09 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=31</guid>
		<description><![CDATA[One of the more useful programs in the developer&#8217;s toolkit is diff. This little utility compares two files and gives you just the differences (what changed) between them. Evey version control system in the world is ultimately based on diffs.
One way I commonly use it, is to see what I&#8217;ve changed in a file or [...]]]></description>
			<content:encoded><![CDATA[<p>One of the more useful programs in the developer&#8217;s toolkit is <code>diff</code>. This little utility compares two files and gives you just the differences (what changed) between them. Evey version control system in the world is ultimately based on diffs.</p>
<p>One way I commonly use it, is to see what I&#8217;ve changed in a file or a set of files. Let me clarify. I put <strong>everything</strong> in version control. Even tiny little programs that I&#8217;m tempted to throw away are in version control. Being able to use diff between my modified file and the previous version is a major reason for doing so.</p>
<p>Now, if I told you to quit your editor and run <code>diff</code> in a terminal, I wouldn&#8217;t be surprised if you decided to beat me with a clue stick. <em>You should <strong>NEVER</strong> leave your editor</em>. If you do, you don&#8217;t know how to use your editor, or your editor is not powerful enough. If your problem is the latter, you should switch to <a href="http://www.gnu.org/software/emacs/">Emacs</a> right now. Otherwise, keep reading, I can help you.</p>
<p>Depending on what version control system you use, you should modify the commands given below. I use <a hrefame="http://www.bitkeeper.com">BitKeeper</a> (well, duh!), so all my examples will use that one.</p>
<p>To start with, stick this in your <code>.emacs</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> bk<span style="color: #66cc66;">-</span>diffs <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Get diffs between current edited buffer and checked in revision&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span><span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>filename <span style="color: #66cc66;">&#40;</span>buffer<span style="color: #66cc66;">-</span>file<span style="color: #66cc66;">-</span><span style="color: #b1b100;">name</span> <span style="color: #66cc66;">&#40;</span>current<span style="color: #66cc66;">-</span>buffer<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#40;</span>newbuf <span style="color: #66cc66;">&#40;</span>get<span style="color: #66cc66;">-</span>buffer<span style="color: #66cc66;">-</span>create
		 <span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;%s diffs&quot;</span>
			 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> filename <span style="color: #66cc66;">&#40;</span>buffer<span style="color: #66cc66;">-</span><span style="color: #b1b100;">name</span><span style="color: #66cc66;">&#41;</span> default<span style="color: #66cc66;">-</span>directory<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>set<span style="color: #66cc66;">-</span>buffer newbuf<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> buffer<span style="color: #66cc66;">-</span>read<span style="color: #66cc66;">-</span>only
	<span style="color: #66cc66;">&#40;</span>toggle<span style="color: #66cc66;">-</span>read<span style="color: #66cc66;">-</span>only<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>erase<span style="color: #66cc66;">-</span>buffer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>insert
     <span style="color: #66cc66;">&#40;</span>shell<span style="color: #66cc66;">-</span>command<span style="color: #66cc66;">-</span>to<span style="color: #66cc66;">-</span>string
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> filename <span style="color: #66cc66;">&#40;</span>format <span style="color: #ff0000;">&quot;bk diffs -uph %s&quot;</span> filename<span style="color: #66cc66;">&#41;</span> <span style="color: #ff0000;">&quot;bk -r diffs -uph&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>switch<span style="color: #66cc66;">-</span>to<span style="color: #66cc66;">-</span>buffer<span style="color: #66cc66;">-</span>other<span style="color: #66cc66;">-</span>window newbuf<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>diff<span style="color: #66cc66;">-</span>mode<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>beginning<span style="color: #66cc66;">-</span>of<span style="color: #66cc66;">-</span>buffer<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>diff<span style="color: #66cc66;">-</span>hunk<span style="color: #66cc66;">-</span>next<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>toggle<span style="color: #66cc66;">-</span>read<span style="color: #66cc66;">-</span>only<span style="color: #66cc66;">&#41;</span>
    newbuf<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Now, whenever you are in a file and want to modify it, all you need to do is run the command <code>bk-diffs</code> and you&#8217;ll get something like this:</p>
<p><a href='http://blog.oscarbonilla.com/wp-content/uploads/2007/12/emacs-bk-diffs-1.png' title='Emacs diff mode screenshot'><img src='http://blog.oscarbonilla.com/wp-content/uploads/2007/12/emacs-bk-diffs-1.png' alt='Emacs diff mode screenshot' /></a></p>
<p>Cool, eh?</p>
<p>The command is also context sensitive, so if you run it from a buffer where you&#8217;re not editing a file, e.g. a dired buffer or a shell buffer, it will run a recursive diff and give you diffs for all the files. I use this all the time when I go back to repositories I haven&#8217;t touched in a while. It&#8217;s my &#8220;what the hell was I doing?&#8221; command. The output looks something like this:</p>
<p><a href='http://blog.oscarbonilla.com/wp-content/uploads/2007/12/emacs-bk-diffs-2.png' title='Emacs diff mode screenshot 2'><img src='http://blog.oscarbonilla.com/wp-content/uploads/2007/12/emacs-bk-diffs-2.png' alt='Emacs diff mode screenshot 2' /></a></p>
<p>That&#8217;s not all. I have more tricks for you. First of all, navigation:</p>
<table>
<tr>
<td>n or M-n</td>
<td>Move to the next hunk</td>
</tr>
<tr>
<td>p or M-p</td>
<td>Move to the previous hunk</td>
</tr>
<tr>
<td>M-N</td>
<td>Move to the next file</td>
</tr>
<tr>
<td>M-P</td>
<td>Move to the previous file</td>
</tr>
</table>
<p>If you are an old school hacker and would rather see context diffs than unified diffs, you can hit <code>C-c C-d</code> while in the diffs buffer. To go back to unified diffs, hit <code>C-c C-u</code>.</p>
<p>There are also key strokes for going back to the source file from the diff buffer. Pressing <code>Enter</code> or <code>M-o</code> or <codde>C-c C-c will take you to the equivalent line (or thereabouts) in the source file from which the diff was taken.</p>
<p>Ok, that is useful, but I see you&#8217;re not blown away. The truth is, I saved the best part for last. Once you&#8217;re walking the diffs one by one, you can also press <code>C-c C-a</code> to either apply, or revert a hunk! How cool is that eh?</p>
<p>This last feature is something I use all the time to clean up a file before checking it in. E.g. I sometimes have a bunch of debug code or comments to myself that need to be removed before checking the file in. Rather than review the file by hand, I can go through the diffs and use the quick navigation that emacs provides for doing the clean up.</p>
<p>Finally, if you are a CVS user (I&#8217;m sorry, really. You should switch to something else), you can probably still use it inside vc-mode, hit <code>C-x v =</code> to get the diffs and try the keystrokes I mentioned.</p>
<p></codde></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2007/12/vive-la-difference/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Beautiful Emacs</title>
		<link>http://blog.oscarbonilla.com/2007/12/beautiful-emacs/</link>
		<comments>http://blog.oscarbonilla.com/2007/12/beautiful-emacs/#comments</comments>
		<pubDate>Thu, 06 Dec 2007 05:23:45 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=26</guid>
		<description><![CDATA[When you spend all day looking at code, it&#8217;s important to select a good editor font. Obviously, the font needs to be monospaced or the alignment will be all wrong. Well, there are only a handful of monospaced fonts worth looking at (and Courier is not one of them).
Take a look at the following image. [...]]]></description>
			<content:encoded><![CDATA[<p>When you spend all day looking at code, it&#8217;s important to select a good editor font. Obviously, the font needs to be monospaced or the alignment will be all wrong. Well, there are only a handful of monospaced fonts worth looking at (and Courier is <strong>not</strong> one of them).</p>
<p>Take a look at the following image. Click on it, and pick your favorite of the four fonts.</p>
<p><a href='http://blog.oscarbonilla.com/wp-content/uploads/2007/12/fonts.png' title='Different fonts in Carbon Emacs'><img src='http://blog.oscarbonilla.com/wp-content/uploads/2007/12/fonts.png' alt='Different fonts in Carbon Emacs' /></a></p>
<p>These are the fonts in the image, clockwise from the top left corner: Bitstream Vera Sans Mono, Andale Mono, Monaco, and <a href="http://www.levien.com/type/myfonts/inconsolata.html">Inconsolata</a>.</p>
<p>Bitstream Vera Sans Mono is my second favorite. It&#8217;s the font I use on my web browser. However, for editing code, I find it a bit too heavy. This probably has more to do with my color scheme than the font per se, so your millage might vary.</p>
<p>Andale Mono is very readable, but I find the spacing all wrong and somewhat distracting. Look at the word &#8220;String&#8221;, the letters seem too far apart.</p>
<p>Inconsolata is my personal favorite. You need to crank up the font size because it seems to be a smaller font than the rest. I thought that point sizes were supposed to be standard, but apparently I was wrong.</p>
<p>Monaco is the default in Mac OS X, but it looks kind of silly. I used to use whatever was the default, so I&#8217;ve used this font quite a while. I never did mind it, but once I made the switch to Inconsolata, I can&#8217;t stand it anymore.</p>
<p>If you want to play with different fonts in Carbon Emacs, you can enable mac keys by running the <code>(mac-key-mode)</code> function, and then pressing ⌘T, which will open a standard font dialog.</p>
<p>However, if you want to use Inconsolata as your default font, put this in your <code>.emacs</code></p>

<div class="wp_syntax"><div class="code"><pre class="lisp lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>require 'carbon<span style="color: #66cc66;">-</span>font<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>fixed<span style="color: #66cc66;">-</span>width<span style="color: #66cc66;">-</span>set<span style="color: #66cc66;">-</span>default<span style="color: #66cc66;">-</span>fontset
       <span style="color: #ff0000;">&quot;-apple-inconsolata-medium-r-normal--14-*-*-*-*-*-iso10646-1&quot;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>It took me a while to figure out how to change the font on Carbon Emacs, so I hope that even if you don&#8217;t choose Inconsolata as your preferred font, this information might prove useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2007/12/beautiful-emacs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Norton Fighter</title>
		<link>http://blog.oscarbonilla.com/2007/12/norton-fighter/</link>
		<comments>http://blog.oscarbonilla.com/2007/12/norton-fighter/#comments</comments>
		<pubDate>Thu, 06 Dec 2007 01:27:56 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=28</guid>
		<description><![CDATA[And on a lighter note&#8230; I found this clip hilarious. 
Part 1:

and part 2:

If I used Windows, I&#8217;d buy norton antivirus just because of this ad.
]]></description>
			<content:encoded><![CDATA[<p>And on a lighter note&#8230; I found this clip hilarious. </p>
<p>Part 1:</p>
<p><a href="http://www.youtube.com/v/6XLPZSHkFjA" ><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/6XLPZSHkFjA&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/6XLPZSHkFjA&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></a></p>
<p>and part 2:</p>
<p><a href="http://www.youtube.com/v/qXWGDS3hoNM"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/qXWGDS3hoNM&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/qXWGDS3hoNM&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></a></p>
<p>If I used Windows, I&#8217;d buy norton antivirus just because of this ad.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2007/12/norton-fighter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Timeo Facebook et dona ferentes</title>
		<link>http://blog.oscarbonilla.com/2007/12/timeo-facebook-et-dona-ferentes/</link>
		<comments>http://blog.oscarbonilla.com/2007/12/timeo-facebook-et-dona-ferentes/#comments</comments>
		<pubDate>Thu, 06 Dec 2007 01:17:42 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=27</guid>
		<description><![CDATA[Which can be loosely translated as &#8220;I fear Facebook even if it brings gifts&#8221;. My friends have noticed that for quite some time I&#8217;ve stopped updating my Facebook status, or even interacting with the site altogether. The reason is simple. I don&#8217;t trust them.
A short time ago, Facebook introduced a new feature called &#8220;Beacon&#8221; that [...]]]></description>
			<content:encoded><![CDATA[<p>Which can be loosely translated as &#8220;I fear Facebook even if it brings gifts&#8221;. My friends have noticed that for quite some time I&#8217;ve stopped updating my Facebook status, or even interacting with the site altogether. The reason is simple. I don&#8217;t trust them.</p>
<p>A short time ago, Facebook introduced a new feature called &#8220;<a href="http://www.facebook.com/business/?beacon">Beacon</a>&#8221; that lets websites send status to your mini-feed. It immediately <a href="http://gigaom.com/2007/11/06/facebook-beacon-privacy-issues/">drew a lot of criticism</a> because of its invasion to privacy, to the point that many people figured out <a href="http://www.ideashower.com/blog/block-facebook-beacon/">ways to block it</a>. Facebook&#8217;s CEO <a href="http://blog.facebook.com/blog.php?post=7584397130">apologized</a> for it today and made beacon opt-out.</p>
<p>Now, I was going to write a detailed article about why this bothers me and how insincere the apology sounded, but our good old friend <a href="http://fakesteve.blogspot.com">Fake Steve Jobs</a> did a much better job <a href="http://fakesteve.blogspot.com/2007/12/faceberg-were-sorry-really-okay-not.html">in this blog post</a>. Money quote:</p>
<blockquote><p>These guys are like Google, only their slogan isn&#8217;t &#8220;Don&#8217;t be evil&#8221; &#8212; it&#8217;s &#8220;Don&#8217;t get caught.&#8221;</p></blockquote>
<p>And later:</p>
<blockquote><p>The smarmy fake apology is not at all reassuring and seems to have been written by PR people who were trying to imitate a 23-year-old kid who&#8217;s speaking from the heart and trying to sound all sheepish and aw-shucks &#8212; except the flacks can&#8217;t do it because they&#8217;re as insincere and stage-managed as as the Facebook guys. Plus, let&#8217;s face it, the flacks are getting paid in Facebook equity, right?</p></blockquote>
<p>I couldn&#8217;t have said it better myself. You should go read the whole post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2007/12/timeo-facebook-et-dona-ferentes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Apple Experience</title>
		<link>http://blog.oscarbonilla.com/2007/10/the-apple-experience/</link>
		<comments>http://blog.oscarbonilla.com/2007/10/the-apple-experience/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 04:20:38 +0000</pubDate>
		<dc:creator>ob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=25</guid>
		<description><![CDATA[Last week I was once again sucked into the argument of whether Apple is a hardware company or a software company. My take on it: it&#8217;s neither.
Apple is an &#8220;experience&#8221; company. They do hardware because it&#8217;s the only way to have the software under control. They do software because without good software, the hardware is [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I was once again sucked into the argument of whether Apple is a hardware company or a software company. My take on it: it&#8217;s neither.</p>
<p>Apple is an &#8220;experience&#8221; company. They do hardware because it&#8217;s the only way to have the software under control. They do software because without good software, the hardware is useless. What they ultimately worry about is the user experience.</p>
<p>They partnered with AT&#038;T because they needed to add the cellular network to the experience and they couldn&#8217;t build their own (they would have loved to). If they look like control freaks from the outside it&#8217;s because, well, they are.</p>
<p>On that note, in <a href="http://bits.blogs.nytimes.com/2007/10/01/att-welcomes-programmers-for-all-phones-except-the-iphone/">this piece</a>, Saul Hansell argues that AT&#038;T allows applications on other phones, <em>except</em> the iPhone. Saul claims that Mark Bercow, senior vice president of business development for Palm, encourages developers to do pretty much as they please with the Palm Treo:</p>
<blockquote><p> Indeed, some developers have made video streaming applications, a particularly big bandwidth hog. (Of course, the cellular companies are free to charge whatever they wish for bandwidth use.)</p></blockquote>
<p>Now go to the AT&#038;T website and try to find their data rates. I could find a $24.99 data rate that was limited to 10MB, and an unlimited plan (with some fine print about per-kilobyte charges) for $69.99. That is in addition to the cost of the plan. The iPhone unlimited data plan is $20 per month. So while developers can create apps for any other AT&#038;T phone, customers get charged <strong>per kilobyte</strong>. Now consider again what Steve Jobs said about third-party apps:</p>
<blockquote><p>You need it to work when you need it to work. Cingular doesn’t want to see their West Coast network go down because some application messed up.</p></blockquote>
<p>My take on that is that AT&#038;T doesn&#8217;t want to see their network swamped with data transfers <em>without being able to charge for them</em>. However, a per-kilobyte service plan would have totally ruined the iPhone experience for the users. Apple wanted users to experience having a device that is <em>always</em> connected to the Internet. That experience is ruined if you&#8217;re worrying about how much you&#8217;re accessing the net because your service provider charges you per-kilobyte. </p>
<p>The reason Apple is so successful is because using their products is a pleasurable experience. That&#8217;s their trick, they think about the &#8220;experience&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oscarbonilla.com/2007/10/the-apple-experience/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
