<?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>a monochromatic oeuvre</title>
	<atom:link href="http://blog.marquiswang.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.marquiswang.com</link>
	<description>Light hearted ramblings from a Computer Science major.</description>
	<lastBuildDate>Sun, 21 Feb 2010 00:54:13 +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>Fibonacci functions and Dynamic Programming</title>
		<link>http://blog.marquiswang.com/2010/02/20/fibonacci-functions-and-dynamic-programming/</link>
		<comments>http://blog.marquiswang.com/2010/02/20/fibonacci-functions-and-dynamic-programming/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 00:54:13 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.marquiswang.com/?p=126</guid>
		<description><![CDATA[Bhargav and I had a short discussion regarding Fibonacci number generating functions over winter break and I recently answered an interview question along the same vein, so I guess its a question worth looking at:
The recursive formula for the generation of the nth Fibonacci number Fn is Fn =  Fn-1 +  Fn-2, where [...]]]></description>
			<content:encoded><![CDATA[<p>Bhargav and I had a short discussion regarding Fibonacci number generating functions over winter break and I recently answered an interview question along the same vein, so I guess its a question worth looking at:</p>
<p>The recursive formula for the generation of the nth Fibonacci number F<sub>n</sub> is F<sub>n</sub> =  F<sub>n-1</sub> +  F<sub>n-2</sub>, where F<sub>1</sub> = F<sub>2</sub> = 1. How then, do we write a function that generates the nth Fibonacci number? The simplest approach is to convert this formula directly into code (all sample code given in python):</p>
<pre>def F(n):
    if n == 1 or n == 2:
         return 1
    else:
         return F(n-1) + F(n-2)</pre>
<p>This works, but there&#8217;s a minor problem. When we run it for small numbers, it seems fine, but it slows down rapidly for large values of n. On my computer (which, admittedly, isn&#8217;t very fast, but it&#8217;s still a reasonably nice computer),  F<sub>30</sub> takes about half a second to run, F<sub>35</sub> takes about 6 seconds, and I don&#8217;t even want to know when F<sub>50</sub> will finish (according to my rough calculations, in about 6 days). This is clearly unacceptable. I could calculate F<sub>50</sub> by hand in less than 6 days (or 20 minutes). So what&#8217;s wrong?</p>
<p>If we look at the function, we&#8217;ll see that when you call F(n), it makes two recursive calls to F(n-1) and F(n-2), each of those makes two more recursive calls, which each make two more, and so on. Furthermore, each additional call only reduces the problem size by a constant factor, one or two. This leads to exponential growth, where a call to F(n) takes almost twice as long as a call to F(n-1). This is bad! The culprit here is we&#8217;re doing extra work. Here is the tree of recursive calls for F(6):<br />
<a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDEwLzAyL1VudGl0bGVkLnBuZw=="><img class="aligncenter size-medium wp-image-129" title="Fib_6_calls" src="http://blog.marquiswang.com/wp-content/uploads/2010/02/Untitled-300x227.png" alt="Recursive tree of function calls for F(6)" width="300" height="227" /></a></p>
<p>As you can see, F(4) is being calculated in both subtrees of F(6), and F(3) is calculated in three different subtrees. As n gets larger, more and more work is being redone in multiple subtrees.</p>
<p>Bhargav&#8217;s solution was to use a hash table to save a solution once it&#8217;s been calculated, so that future calls can check if the solution has already been found for some n before calculating it again:</p>
<pre>fib_results = {1:1, 2:1}
def F(n):
    if n in fib_results:
         return fib_results[n]
    else:
         fib_results[n] = F(n-1) + F(n-2)
         return fib_results[n]</pre>
<p>This is in fact much faster and runs in linear time instead of exponential time. Unfortunately, it takes linear space in the form of the hash table, and it is unclear how or whether we can avoid using that space, though it seems like it might be possible since we didn&#8217;t use linear space in the naive solution. This approach is called memoization. Memoization is an example of a top-down alternative to <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9EeW5hbWljX3Byb2dyYW1taW5n">dynamic programming</a>. It&#8217;s advantage over the bottom-up approach, called dynamic programming, is that it is much easier to convert a naive recursive algorithm to a memoized algorithm. The disadvantage is that dynamic programming is generally somewhat faster in implementation and more powerful, making it clearer how to make optimizations such as getting rid of that linear space hash table.</p>
<p>The idea behind dynamic programming is, once we&#8217;ve defined a problem in terms of its subproblems, to solve it by starting from the base cases and solving subsequently larger problems, usually in tabular form. To find F(n), we create an array of n cells, filling cells 1 and 2 with the value 1 (those are the base cases). To fill each cell, we look at the two previous cells and fill it with their sum. Conveniently, this means that the ith cell contains the value of F(i). Hence, by the time we fill the nth cell we will have found the value of F(n).</p>
<p><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDEwLzAyL0RQLWZpYi5wbmc="><img class="aligncenter size-medium wp-image-133" title="DP-fib" src="http://blog.marquiswang.com/wp-content/uploads/2010/02/DP-fib-300x217.png" alt="Sequence for filling DP table to solve F(n)." width="300" height="217" /></a></p>
<p>This algorithm would look like this:</p>
<pre>def F(n):
    # Create an array of n cells
    fib_table = [None]*n

    # Initialize base cases
    fib_table[0] = 1
    fib_table[1] = 1

    # Fill table
    for i in range(2, n):
        fib_table[i] = fib_table[i-1] + fib_table[i-2]
    return fib_table[n-1]</pre>
<p>Unfortunately, this still takes linear space! It will probably be a little faster than the memoized algorithm, since arrays are a little faster than dictionaries, but we still haven&#8217;t got rid of the need for the lookup table. However, if we look at this algorithm, it becomes clear that to fill each cell, we only need to look at the two cells before it. In fact, we can forget the values in every cell before those two, since we&#8217;ll never need them again. To save using that space, we can just reuse the same three cells over and over again. In fact, since we only have three cells, we can just use variables instead of creating a table:</p>
<pre>def F(n):
    a = 1
    b = 1
    c = 1
    for i in range(2, n):
        c = a + b
        a = b
        b = c
    return c</pre>
<p>Mission accomplished. We have a Fibonacci number function that runs in linear time and constant space. Dynamic programming is clearly awesome. A Fibonacci number function is one of the simplest applications of dynamic programming. One could easily imagine coming up with this solution without going through this thought process. However, there are many more complex problems that dynamic programming can solve, without which the best solutions are incredibly difficult to find. Some applications of dynamic programming include <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5uY2JpLm5sbS5uaWguZ292L3B1Ym1lZC85OTI1Nzg0">RNA folding</a> and <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9TZWFtX2NhcnZpbmc=">seam carving</a> (crazy content aware image resizing)</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=126" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2010/02/20/fibonacci-functions-and-dynamic-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Poetry Spam?*</title>
		<link>http://blog.marquiswang.com/2009/07/09/poetry-spam/</link>
		<comments>http://blog.marquiswang.com/2009/07/09/poetry-spam/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 07:39:32 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://blog.marquiswang.com/?p=122</guid>
		<description><![CDATA[Some time in mid-February, I got tired of my spam filter&#8217;s many false positives and decided to turn it off. I preferred having to sift through 10-20 spam emails by hand than risk missing an important email falsely flagged and blocked. An additional bonus was the entertainment value of new and novel spam. Over the [...]]]></description>
			<content:encoded><![CDATA[<p>Some time in mid-February, I got tired of my spam filter&#8217;s many false positives and decided to turn it off. I preferred having to sift through 10-20 spam emails by hand than risk missing an important email falsely flagged and blocked. An additional bonus was the entertainment value of new and novel spam. Over the last month or two, I noticed a large amount of weird spam (as in not like your average spam, since all spam is pretty weird). This phenomenon peaked around two weeks ago, when I was receiving upwards of 5-10 of them a day.</p>
<p>Each email consisted of a subject, and when appeared to be a couplet of 19th-century-poetry sounding text. Some examples included:</p>
<blockquote><p>Subject: and said, as her tear drops back she forced,<br />
and, though i should say it never,<br />
the trees bring forth sweet ecstasy only for the sake of present ease or gratification?</p></blockquote>
<blockquote><p>Subject: launched on yon shining bay,&#8211;<br />
the latest spawn the press hath cast,&#8211;<br />
father, father, where are you going look on the rising sun: there god does live</p></blockquote>
<blockquote><p>Subject: thy summer&#8217;s play younger and younger every day;<br />
darkness passes away then cherish pity; lest you drive an angel from<br />
answer&#8217;d the lovely maid and said; i am a watry weed, this time last evening. right there! all aboard!&#8221;</p></blockquote>
<p>And that was it! No link to porn, no methods to please my man in bed, no pills to grow myself a 4 foot penis.</p>
<p>I think Scott put it best.</p>
<blockquote><p>Subject: Re: the sky-lark and thrush,<br />
From: Scott Smith<br />
&#8230;the fuck?</p>
<p>On Sat, Jun 27, 2009 at 1:15 AM, Nathan Harrison<br />
wrote:</p>
<p>&gt; he doth give his joy to all. sits and smiles on the night.<br />
&gt; become a garden mild. the miner pauses in his rugged labor,</p></blockquote>
<p>Incidentally, that one is my favorite, for some reason. It almost makes sense.</p>
<p>In the name of science, I did a little snooping regarding the emails. First, I checked the originating IP addresses from the email headers. I looked at maybe a dozen emails and traced the originating countries to see if they came from any one place. They came from a variety of countries, including Uruguay, Kuwait, Germany, Italy, and even Urbana, Ohio. Was this a semi-sentient global botnet determined to demonstrate its Vogon-esque poetry skills to the world?</p>
<p>The next question then is, were these couplets originally composed or plagarized from some famous poems? I pulled up Google and searched for some of the more coherent sounding phrases, and indeed several of them were hits. It appeared that this botnet was channeling the works of William Blake and Bret Harte to create its poetic genius.</p>
<p>So what&#8217;s going on? My guess is probably some variant on standard <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9CYXllc2lhbl9wb2lzb25pbmc=">Bayesian poisoning</a>, to try to confuse spam checkers.  According to the wikipedia article on <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9FLW1haWxfc3BhbQ==">email spam</a>, a common technique for Bayesian poisoning involves taking text from Project Gutenberg, and suspiciously, both Blake and Harte are in there.</p>
<p>However, Bayesian poisoning is used for text that goes along with spam trying to sell things, not random text by itself. Meh, whatever. Over the course of the last week, these emails have slowed, and I haven&#8217;t seen one in a couple days.  All I get now are my normal &#8220;How to Have rGeat sex &#8211; Smash alll Records www. bu15. net. Bewitcheed, Bedazzled, uBsted&#8221; emails.  Perhaps this will forever become a mystery.</p>
<p>Hey, maybe this is Conficker finally doing something interesting</p>
<p>* Note: Not to be confused with <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9TcG9ldHJ5">spam poetry</a> or &#8220;spoetry&#8221;, another interesting phenomenon where people make poems out of spam subject lines. <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5hbWF6b24uY29tL0FOVEhPTE9HWS1TUEFNLVBPRVRSWS1NT1JUT04tSFVSTEVZL2RwL0IwMDE2RjdMSEkvcmVmPXNyXzFfMT9pZT1VVEY4JmFtcDtzPWJvb2tzJmFtcDtxaWQ9MTI0NzEyNTQwMyZhbXA7c3I9OC0x">Seriously</a>.</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=122" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2009/07/09/poetry-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Google&#8217;s PHP optimization tips</title>
		<link>http://blog.marquiswang.com/2009/06/27/testing-googles-php-optimization-tips/</link>
		<comments>http://blog.marquiswang.com/2009/06/27/testing-googles-php-optimization-tips/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 06:13:19 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/2009/06/27/testing-googles-php-optimization-tips/</guid>
		<description><![CDATA[Recently, Google posted a series of articles titled &#8220;Let&#8217;s make the web faster&#8220;, including one by Google webmaster Eric Higgins about optimizing PHP.
Some of Google&#8217;s tips are obvious, like using caching or avoiding unnecessary SQL queries. A couple, however, seemed pretty weird to me, so I ran some benchmarks to check them out for myself. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Google posted a series of articles titled &#8220;<a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9zcGVlZC9hcnRpY2xlcy8=">Let&#8217;s make the web faster</a>&#8220;, including one by Google webmaster Eric Higgins about <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9zcGVlZC9hcnRpY2xlcy9vcHRpbWl6aW5nLXBocC5odG1s">optimizing PHP</a>.</p>
<p>Some of Google&#8217;s tips are obvious, like using caching or avoiding unnecessary SQL queries. A couple, however, seemed pretty weird to me, so I ran some benchmarks to check them out for myself. (See bottom of post for specs, and other info on how I ran the benchmarks)</p>
<ul>
<li><strong>Use echo instead of print</strong>: Higgins doesn&#8217;t explain why he thinks echo is faster than print. The PHP documentation links to <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5mYXF0cy5jb20va25vd2xlZGdlX2Jhc2Uvdmlldy5waHRtbC9haWQvMS9maWQvNDA=">an faq</a> that explains the difference, and mentions that echo is marginally faster because it doesn&#8217;t set a return value, but there is no real difference in speed between the two.
<p>To test this, I ran two tests, using <code>echo</code> and then <code>print</code> to print a short string (5 characters) and then a long string (5000 characters) 1,000 times each.</p>
<h4>The Benchmark</h4>
<p>Using <code>echo</code> to print a short string 1,000 times: 1170 microseconds<br />
Using <code>print</code> to print a short string 1,000 times: 1180 microseconds</p>
<p>Using <code>echo</code> to print a long string 1,000 times: 1163 microseconds<br />
Using <code>print</code> to print a long string 1,000 times: 1182 microseconds</p>
<p><strong>Verdict:</strong> For short strings, <code>echo</code> was slightly faster, and for long strings, it looks like <code>print</code> was slightly faster. For both cases, this was a difference of only about a couple hundred-millionths of a second per call, and likely well within normal variation between calls. I&#8217;d say use whichever one you feel like using, personally.</li>
<li><strong>Use <code>switch/case</code> instead of <code>if/else</code> for loosely-typed comparisons</strong>:Apparently this has better performance, readability, and maintainability. I&#8217;ll bit on the readability and maintainability, but this article is about performance.
<p>I&#8217;m testing with code very similar to the example that Higgins provided for this one. There are four branches, each of which calls a function that does nothing but return, and each branch is equally likely.</p>
<h4>The Benchmark</h4>
<p>Using <code>if/else</code>, repeated 1,000 times: 422 microseconds<br />
Using <code>switch/case</code>, repeated 1,000 times: 425 microseconds</p>
<p><strong>Verdict</strong>: Once again, the difference is barely noticeable, and it looks like <code>if/else</code> was actually slightly faster on this test. I would say not to worry too much about it, though the <code>switch/case</code> definitely looks better from a code readability point of view.</li>
<li><strong>Provide echo with many strings as arguments instead of using concatenation</strong>: In the video, Eric replaced each of the periods in an echo call with commas, so that the strings were passed as many arguments to echo instead of concatenating them before passing them in. This seems definitely weird to me, but it might work.
<p>For this one, I&#8217;m testing <code>echo "Hello "."World!"."\n";</code> vs. <code>echo "Hello ","World!","\n";</code></p>
<h4>The Benchmark</h4>
<p>Using concatenation, repeated 1,000 times: 1225 microseconds<br />
Using arguments, repeated 1,000 times: 3255 microseconds</p>
<p>Ouch! No way is it faster to pass in multiple arguments to echo than concatenation them first! I notice that I have three arguments to echo and that took almost 3 times as long to run&#8230; let&#8217;s try it with 6 arguments. This time I&#8217;m testing <code>echo "Hello "."World!"."\n"."Hello "."World!"."\n";</code> vs. <code>echo "Hello ","World!","\n"." ","World!","\n";</code></p>
<h4>The Benchmark (2)</h4>
<p>Using concatenation, repeated 1,000 times: 1445 microseconds<br />
Using arguments, repeated 1,000 times: 5354 microseconds</p>
<p>It&#8217;s not quite linear, but it&#8217;s definitely correlated.</p>
<p><strong>Verdict</strong>: There&#8217;s no question about it. Use concatenation! It&#8217;s better! Google doesn&#8217;t know everything!</li>
</ul>
<p>The moral of this story&#8230; Google is smart, but they don&#8217;t know everything. Test things for yourself to make sure their results are the same as yours. It&#8217;s possible that Google is using a different version of PHP, running on different hardware, or something like that. Each computer is different and if these small optimizations matter to you, you have to try it for yourself to make sure.</p>
<p>Edit: The <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2dyb3Vwcy5nb29nbGUuY29tL2dyb3VwL21ha2UtdGhlLXdlYi1mYXN0ZXIvYnJvd3NlX3RocmVhZC90aHJlYWQvZGRmYmU4MmRkODA0MDhjYz9wbGk9MQ==">PHP devs</a> and at least one <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5jb2RleG9uLmNvbS9wb3N0cy9kZWJ1bmtpbmctZ29vZ2xlcy1pbnRlcm5ldC1vcHRpbWl6YXRpb24tdGlwcw==">other blogger</a> have reached about the same conclusions.</p>
<p>Note: I ran these benchmarks on my Linode VPS, with 360MB RAM and 4&#215;2.50GHz processors. I was using PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 from the command line, and the PHP Benchmark library. Each reported time was an average over 100 trials. Source code for my benchmarks is available <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NhbmRib3gubWFycXVpc3cuY29tL2ZpbGVzL2JlbmNobWFya3MudHh0">here</a>. You have to pipe stdout to /dev/null, since I&#8217;m using print and echo. Results are in stderr.</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=112" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2009/06/27/testing-googles-php-optimization-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Writing a keygen: Hacker challenge</title>
		<link>http://blog.marquiswang.com/2009/04/01/writing-a-keygen-hacker-challenge/</link>
		<comments>http://blog.marquiswang.com/2009/04/01/writing-a-keygen-hacker-challenge/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 23:51:06 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/?p=101</guid>
		<description><![CDATA[I stumbled upon a hacker challenge posed by blogger Andy Sloane last night.  He explained how, as a hobby, likes to try to crack or create key generators for commercial programs.  Naturally, he never distributes these cracks, but is only doing it for the intellectual challenge.  Writing a key generator is usually more useful than [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled upon a <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2ExazBuLm5ldC9ibGFoL2FyY2hpdmVzLzIwMDkvMDMvMzEvaW5kZXguaHRtbA==">hacker challenge</a> posed by blogger Andy Sloane last night.  He explained how, as a hobby, likes to try to crack or create key generators for commercial programs.  Naturally, he never distributes these cracks, but is only doing it for the intellectual challenge.  Writing a key generator is usually more useful than cracking, since a good keygen typically allows you to receive future updates.  Often, it is also more interesting from an intellectual point of view, as writing a keygen usually requires some knowledge in reverse engineering and number theory.  Andy tries to demonstrate what he means by providing a simple key checker of his own for us to break.  Since I had a lighter workload last night, I figured I&#8217;d try it.</p>
<p>For his challenge to the world, he offers the source code of the key checker and three working keys.  The source is available on his blog.  (While a normal keygen writer would not have access to the source code of the key checker, it is usually simple, though tedious, to decompile and interpret the compiled binaries that would be released.)</p>
<p>After downloading and skimming the source, I spent a while trying to understand the custom written (and minimally commented) library he uses for large (125 bit, in this case) integers.  Rather than try to interpret the code itself, I used gdb to inspect the way the library worked, and had soon figured out the inner workings of the key checker:</p>
<p>Each key that it received, it would convert into an integer.  Each key had a unique integer <em>k</em> (with some exceptions: O, Q, and 0; I and 1; and Z and 2 were considered to be interchangeable to lower the change of an misread key) to which it was decoded.</p>
<p>Two magic numbers <em>n</em> = 21967608700894359473408781171922272451 and <em>d</em>=4444901153489723031681183441752517327 were hard-coded into the program.  A new number <em>m</em> ≡ <em>k<sup>d</sup></em> <em>mod</em> <em>n</em> was created.  The key was accepted if <em>m</em> ≡ 12345678 <em>mod</em> <em>c, </em>where <em>c = </em>⌊<em>n/2<sup>32</sup></em>⌋ (rounded down to the nearest integer).</p>
<p>This was clearly a problem for number theory! This algorithm looked suspiciously similar to the <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9SU0E=">RSA</a> encryption algorithm, which similarly employs two large numbers with special properties.</p>
<p>A quick summary of the steps behind RSA encryption:</p>
<ol>
<li>Pick two large primes <em>p</em> and <em>q.<br />
</em></li>
<li>Compute <em>n = pq</em>.</li>
<li>Compute the totient of <em>n, φ(<em>n</em>) = (p-1)(q-1)</em>.</li>
<li>Choose an integer <em>e</em> such that <em>e </em>is relatively prime to and less than <em>φ(<em>n</em>)</em>.</li>
<li>Compute the integer <em>d</em> such that <em>ed </em>≡ 1 <em>mod </em><em>φ(<em>n</em>)</em>.</li>
<li>For your message <em>m</em>, encrypt it by generating ciphertext <em>c ≡ m<sup>e</sup> mod n</em>. <em>e </em>is known as the public key and is used to encrypt the message.</li>
<li>The person who receives the ciphertext by using <em>d</em> and applying the formula <em>m = </em><em>c<sup>d</sup> mod n</em>.</li>
</ol>
<p>This works because of Euler&#8217;s theorem, which states that <em>a<sup>φ(n) </sup></em><em>≡ a</em><em> mod n</em> for any integers <em>a </em>and <em>n. </em></p>
<p>From that, <em>c<sup>d </sup></em><em>=</em>(<em>m<sup>e</sup></em>)<sup>d</sup>=<em>m<sup>ed</sup></em>= <em>m<sup>1+kφ(n) </sup></em>≡ <em>m mod n</em>. (Check out the explanation of RSA on wikipedia for a more in depth explanation.</p>
<p>I quickly used Mathematica to factor <em>n</em> to see if it was the product of two primes. It was!  I checked that <em>d</em> was relatively prime to <em>φ(<em>n</em>) </em>to be sure.  It also was. The only part where this differed from RSA was the final step where it checked to see if <em>m</em> ≡ 12345678 <em>mod</em> <em>c </em>before accepting the key.</p>
<p>I was a little thrown off by <em>c </em>being related to <em>n</em>, but I quickly realized that it didn&#8217;t matter what <em>c</em> was.  It was just there to make sure that more than one <em>m</em> (and therefore more than one key) was accepted.  Effectively, what this key checker did was to take RSA generated ciphertext as a key and check to see if it decryped to a message that left a remainder of 12345678 when divided by <em>c</em>.</p>
<p>Therefore, to generate a key, I needed to create a correct message and encrypt it, then convert the ciphertext back to the &#8220;key&#8221; format.  Creating a message is easy. <em>m</em> is an accepted message if <em>m</em> ≡ 12345678 <em>mod</em> <em>c</em>, so <em>m = ac + </em>12345678, where <em>a </em>is any natural number.  To encrypt <em>m</em>, I need to find the private key <em>e</em>.  Since <em>n</em> is small enough to factor and <em>ed </em>≡ 1 <em>mod </em><em>φ(<em>n</em>)</em>, it is easy to find <em>e</em> through modular arithmetic.</p>
<p>Voila! Now I have everything I need to write a keygen for Andy&#8217;s example key checker. In fact, <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NhbmRib3gubWFycXVpc3cuY29tL2ZpbGVzL2tleWdlbi50eHQ=">here</a> it is.  Now, clearly, I should go do my homework, having wasted several hours on this.</p>
<ol><em></em></ol>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=101" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2009/04/01/writing-a-keygen-hacker-challenge/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Good password habits?</title>
		<link>http://blog.marquiswang.com/2009/03/05/good-password-habits/</link>
		<comments>http://blog.marquiswang.com/2009/03/05/good-password-habits/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 08:04:29 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/?p=90</guid>
		<description><![CDATA[Cardinary Sins of Passwords

 Using short passwords with few numbers or special characters.
 Using the same password for many things (or everything).
 Rarely (or never) changing passwords.
 Using a name or common phrase in a password.

If you&#8217;re guilty of one or more of these bad password habits, raise your hand!
*Raises hand*
Despite being (I think) very [...]]]></description>
			<content:encoded><![CDATA[<h3>Cardinary Sins of Passwords</h3>
<ul>
<li> Using short passwords with few numbers or special characters.</li>
<li> Using the same password for many things (or everything).</li>
<li> Rarely (or never) changing passwords.</li>
<li> Using a name or common phrase in a password.</li>
</ul>
<p>If you&#8217;re guilty of one or more of these bad password habits, raise your hand!</p>
<p>*Raises hand*</p>
<p>Despite being (I think) very tech savvy, I have some very bad password habits, and I would not be at all surprised if many of my similarly computer-smart friends do too. Mostly, I use the same password for many things, and I rarely change my passwords.  The password I use most often, for almost all of my accounts on various websites, I first used with my <em>first</em> email account so long ago in the mid 90s.  It is a relatively short and simple password, and someone could definitely wreak some havoc if they got their hands on it, though they wouldn&#8217;t have access to anything important.  Of my other passwords, the newest one is about 3 years old and I came up with the oldest one almost 7 years ago.  That&#8217;s plenty of time for someone to get their hands on the keys to my personal information, bank accounts, etc.</p>
<p>One of my new years resolutions this year was to improve on my password habits, and I definitely haven&#8217;t gotten anywhere with that.  (Another one was to blog more, heh, fail there too.)  So I guess the question is, why <em>is</em> it so hard to keep passwords up to date and secure?</p>
<p>For me, the number one barrier to changing passwords regularly is the hassle of having to memorize a new password, especially a complex one with numbers and special characters. Similarly, I reuse the 3 or 4 passwords I use most often to minimize the risk of forgetting a password.  With so many different services which require passwords, and more every week as I sign up for a new web site, it is sometimes difficult to remember whether I <em>have</em> an account to a certain site, much less remember a unique password for each one. Furthermore, I&#8217;ve never had any problems with security, so I don&#8217;t have any real motivation to change them.</p>
<h3>Possible solutions</h3>
<p><strong>Using a password manager:</strong> I got a free license for <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2FnaWxld2Vic29sdXRpb25zLmNvbS9wcm9kdWN0cy8xUGFzc3dvcmQ=">1password</a> during MacHeist&#8217;s Giving Tree this year, which I&#8217;m going to start using. This allows me to use more passwords of greater complexity, and not have to worry about forgetting them.  Of course, this is only as secure as the master password I use for 1password, and I have to figure something out for when I am on a public computer.  If I don&#8217;t actually remember my passwords, I won&#8217;t be able to get to my accounts away from my computer.<br />
<strong>Using phrase passwords:</strong> Instead of the traditional 8-12 character random passwords, use a 20-30 character phrase that is easy to memorize but difficult to guess.  To help mitigate the risk of getting locked out of my accounts if I lose access to my password manager somehow, I think I will start using phrases from songs or quotes or something as passwords, instead.  Unfortunately, the longer a phrase is, the greater a chance for a typo while typing it in.<br />
<strong>Using a password generation system:</strong> Another option which might be safer than phrase passwords is using a system to generate secure passwords that are unique for every site.  One such system is <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2xpZmVoYWNrZXIuY29tL3NvZnR3YXJlL3Bhc3N3b3Jkcy9nZWVrLXRvLWxpdmUtLWNob29zZS1hbmQtcmVtZW1iZXItZ3JlYXQtcGFzc3dvcmRzLTE4NDc3My5waHA=">this one</a> suggested by <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2xpZmVoYWNrZXIuY29t">Lifehacker</a>.</p>
<p>I&#8217;m starting to migrate towards these practices right now. Hopefully, I&#8217;ll be able to keep it up and maintain my good luck with regard to password security for a while longer.</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=90" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2009/03/05/good-password-habits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replacing TwitterIM with my own bot.</title>
		<link>http://blog.marquiswang.com/2009/01/07/replacing-twitterim-with-my-own-bot/</link>
		<comments>http://blog.marquiswang.com/2009/01/07/replacing-twitterim-with-my-own-bot/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 02:37:04 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/?p=77</guid>
		<description><![CDATA[TwitterIM:  TwitterIM is under maintenance at the moment. Please check back later.
Twitter&#8217;s AIM bot, TwitterIM, has been &#8220;under maintenance&#8221; for as long as I can remember.  The last time it worked for me was in January 2008, and I have been &#8220;checking back later&#8221; periodically since.  Personally, I do not have high hopes for it [...]]]></description>
			<content:encoded><![CDATA[<pre>TwitterIM:  TwitterIM is under maintenance at the moment. Please check back later.</pre>
<p><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3R3aXR0ZXIuY29t" target=\"_blank\">Twitter</a>&#8217;s AIM bot, TwitterIM, has been &#8220;under maintenance&#8221; for as long as I can remember.  The last time it worked for me was in January 2008, and I have been &#8220;checking back later&#8221; periodically since.  Personally, I do not have high hopes for it working any time soon.  I decided to just take advantage of Twitter and AIM&#8217;s APIs and write my own bot to update my twitter through AIM.</p>
<p>I wrote this in about 10 minutes, so its a really simple program.  Once it connects to the AIM server, it waits for messages from me, ignoring all other messages.  A message from me is immediately posted to Twitter through curl.  In this implementation, there is no check for a successful post, though that would not be particularly difficult to implement.</p>
<p>The source code is available <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL21hcnF1aXN3YW5nLmNvbS9zYW5kYm94L3R3aXR0ZXJib3QvYm90LnB1YmxpYy50eHQ=" target=\"_blank\">here</a>.  You need Perl, the Net::OSCAR module, and AIM and Twitter accounts, naturally.  Just fill in your credentials at the top of program and run it with Perl.</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=77" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2009/01/07/replacing-twitterim-with-my-own-bot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Blackjack</title>
		<link>http://blog.marquiswang.com/2009/01/06/ruby-blackjack/</link>
		<comments>http://blog.marquiswang.com/2009/01/06/ruby-blackjack/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 09:48:56 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/?p=72</guid>
		<description><![CDATA[&#8220;Hm, I should probably learn Ruby.&#8221;
I probably first said this about a year and a half ago when Ruby and Ruby on Rails were &#8220;in&#8221;, the cool new (relatively, anyways, Ruby was written in 1995) language and the easy to use web application framework that went along with it.  In the year and a half [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Hm, I should probably learn Ruby.&#8221;</p>
<p>I probably first said this about a year and a half ago when Ruby and Ruby on Rails were &#8220;in&#8221;, the cool new (relatively, anyways, Ruby was written in 1995) language and the easy to use web application framework that went along with it.  In the year and a half since then, I&#8217;ve glanced at Ruby and Rails, not looking at it close enough to discover more than that it resembled Perl and possibly Python.</p>
<p>Well, as part of an internship interview, I&#8217;ve finally gotten a reason to actually sit down, read the Ruby documentation, and understand how this language works.  I am almost done writing a command line blackjack implementation in Ruby.  Here are my thoughts:</p>
<p><strong>Object-oriented</strong>. I really like the way Ruby strongly object oriented &#8211; everything is an object, including integers and booleans, which most other languages designate as primitives.  This preemptively takes care of the limitations in designating these types as primitives, which often lead to wrapper classes such as Java&#8217;s Boolean and Integer.</p>
<p><strong>Open classes.</strong> Ruby implements open classes, which allows you to define or redefine the behavior of any class at any time.  This way, I can easily implement: a predicate in the String class that checks if a string is empty or nil, a foldr method in the Array class, or anything else that I need.  In contrast, in Java, implementing these functions would require creating another StringUtils or ArrayUtils class.</p>
<p><strong>Powerful.</strong> I don&#8217;t know if powerful is the right word.  Overall, I just feel like I would be much more comfortable writing complicated/long programs in Ruby, over Python or Perl.  Normally, I would stick to Java or C++ for projects with a larger scope.  Ruby is really nice, except for&#8230;</p>
<p><strong>End? </strong>Syntax complaint.  I really prefer using brackets {} to denote a block of code, such as the interior of a loop or a function.  Maybe I&#8217;m just not used to the language yet, but I feel that it is laid out so that it is difficult to understand and read code by simply scanning through it.  The problem is made worse by the fact that with brackets, I can easily use vim or TextMate to find the corresponding bracket, whereas &#8220;if &#8230; end&#8221; doesn&#8217;t lend itself quite as well to that kind of searching.</p>
<p><strong>I hate blackjack</strong>. What a terrible game.  Blackjack is a mishmash of rules and variants that make an elegant implementation of the game difficult.  It is a simple, boring game that casinos keep around because it is considered a beginners game, and so is played by novices who pay little to no attention to strategy.  Provided a player plays correctly, the game is relatively even, with a house advantage of less than 0.5% for more common variants.  Generally, blackjack is just not worth playing. Stick with poker.</p>
<p>In summary, blackjack sucks, Ruby is pretty cool.</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=72" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2009/01/06/ruby-blackjack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All your info are belong to Facebook (and Google)?</title>
		<link>http://blog.marquiswang.com/2008/12/04/all-your-info-are-belong-to-facebook-and-google/</link>
		<comments>http://blog.marquiswang.com/2008/12/04/all-your-info-are-belong-to-facebook-and-google/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 04:27:30 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/?p=70</guid>
		<description><![CDATA[&#8220;But what about interesting things that you do on other sites? Maybe you commented on a blog or dugg an article on Digg. Maybe you put up something for auction on eBay, or found a video you love and wanted to share it. Wouldn’t it be nice if when you were on another site, you [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;But what about interesting things that you do on other sites? Maybe you commented on a blog or dugg an article on Digg. Maybe you put up something for auction on eBay, or found a video you love and wanted to share it. Wouldn’t it be nice if when you were on another site, you could easily find your friends on that site and see what they are doing there, just like you can on Facebook?&#8221; &#8212; Facebook Connect</p>
<p>In what almost seems like a synchronized release, <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5mYWNlYm9vay5jb20vaGVscC5waHA/cGFnZT03MzA=">Facebook Connect</a> and <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5nb29nbGUuY29tL2ZyaWVuZGNvbm5lY3Qv">Google Friend Connect</a> have been unveiled today by the largest social network and the largest search engine in the country.  At the very least, these two new technologies will be another general Web sign-on protocol, most likely replacing OpenID, which had a lackluster reception at best and will likely effectively disappear with these two giants as competition.  From a most pessimistic point of view, these two web giants who, between them, already have a ridiculous amount of information about the average user, has yet another means of data collection.</p>
<p>It does seem like Facebook has learned from <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5wY3dvcmxkLmNvbS9hcnRpY2xlLzE0MDE4Mi9mYWNlYm9va3NfYmVhY29uX21vcmVfaW50cnVzaXZlX3RoYW5fcHJldmlvdXNseV90aG91Z2h0Lmh0bWw/dGs9cmVsX25ld3M=">Beacon</a>, and has made Facebook Connect an opt-in service rather than an opt-out service, hopefully avoiding the privacy scandals that led Facebook to quickly pull Beacon off the site.  Still, I expect to hear stories of people accidentally publishing news about things that they don&#8217;t want known, though hopefully not to the same degree as the story about the man who bought an engagement ring on Overstock.com and got it published to his wall.</p>
<p>Perhaps these two tools can fulfill their promise of easy inter-website connectivity without bringing on the anti-privacy apocalypse.  I&#8217;ll keep my fingers crossed&#8230; while installing Facebook Connect onto my website.</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=70" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2008/12/04/all-your-info-are-belong-to-facebook-and-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Halloween!</title>
		<link>http://blog.marquiswang.com/2008/11/08/halloween/</link>
		<comments>http://blog.marquiswang.com/2008/11/08/halloween/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 04:03:00 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/?p=65</guid>
		<description><![CDATA[I don&#8217;t update very much, do I?
Blogs are hard. Oh well. Halloween happened! Here is a picture of me and Dana.
 ]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t update very much, do I?</p>
<p>Blogs are hard. Oh well. Halloween happened! Here is a picture of me and Dana.</p>
<div id="attachment_66" class="wp-caption alignnone" style="width: 462px"><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA4LzExL241MDA5MTA0MDFfNDc0Nzg3NF84NTU3LmpwZw=="><img class="size-full wp-image-66" title="Stick figure ♥." src="http://blog.marquiswang.com/wp-content/uploads/2008/11/n500910401_4747874_8557.jpg" alt="Stick figure ♥." width="452" height="604" /></a><p class="wp-caption-text">Stick figure ♥.</p></div>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=65" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2008/11/08/halloween/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My dorm room&#8230;</title>
		<link>http://blog.marquiswang.com/2008/09/09/my-room/</link>
		<comments>http://blog.marquiswang.com/2008/09/09/my-room/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 23:08:35 +0000</pubDate>
		<dc:creator>Marquis Wang</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://blog.marquisw.com/?p=46</guid>
		<description><![CDATA[So I arrived at school expecting to set up my room in about the same way as I had the year before.  My roommate and I would have our beds set up in a Captain&#8217;s bed style on opposite sides of the room along the shorter wall, with our desks along the longer wall [...]]]></description>
			<content:encoded><![CDATA[<p>So I arrived at school expecting to set up my room in about the same way as I had the year before.  My roommate and I would have our beds set up in a <a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9CZWQjVHlwZXNfb2ZfYmVkcw==">Captain&#8217;s bed</a> style on opposite sides of the room along the shorter wall, with our desks along the longer wall and the refridgerator and microwave in the middle of the longer wall between ours desks.</p>
<p>As I walked into my room on the first day, my first thought was that it felt somewhat smaller than it should have been.  I soon discovered that this was because it actually <em>was</em> smaller, as the school had, without informing us, shortened the shorter wall by about 6 inches, supposedly to earthquake-proof the dormitory.</p>
<p>These are pictures of my suitemates&#8217; room, which is set up like I was going to.</p>
<div id="attachment_48" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA4LzA5L2JpbGQxMTA0LmpwZw=="><img class="size-medium wp-image-48" title="Side with the door." src="http://blog.marquiswang.com/wp-content/uploads/2008/09/bild1104-300x225.jpg" alt="The bed is set up in a Captain's style, with the drawers and bookshelf underneath." width="300" height="225" /></a><p class="wp-caption-text">The bed is set up in a Captain&#39;s style, with the drawers and bookshelf underneath.</p></div>
<div id="attachment_47" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA4LzA5L2JpbGQxMTAzLmpwZw=="><img class="size-medium wp-image-47" title="Side away from the door." src="http://blog.marquiswang.com/wp-content/uploads/2008/09/bild1103-300x225.jpg" alt="The two desks are along the longer wall, with the fridge between the desks." width="300" height="225" /></a><p class="wp-caption-text">The two desks are along the longer wall, with the fridge between the desks.</p></div>
<p>As a result of these changes, one of the beds no longer fit along the shorter wall (the side with the door), and nothing worked anymore! All my plans had been ruined!  After a quick scramble to find an acceptable room design, we decided upon this design (I would try to describe it but pictures would work better I think):</p>
<div id="attachment_49" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA4LzA5L2JpbGQxMTA1LmpwZw=="><img class="size-medium wp-image-49" title="Between the two beds." src="http://blog.marquiswang.com/wp-content/uploads/2008/09/bild1105-300x225.jpg" alt="" width="300" height="225" /></a><p class="wp-caption-text">The two beds are lofted and closer together.  Mine is along the far side of the room, and Patrick&#39;s is in the middle of the room.</p></div>
<div id="attachment_50" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA4LzA5L2JpbGQxMTA2LmpwZw=="><img class="size-medium wp-image-50" title="My bed and desk." src="http://blog.marquiswang.com/wp-content/uploads/2008/09/bild1106-300x225.jpg" alt="" width="300" height="225" /></a><p class="wp-caption-text">The desks and drawers are under the beds, with our work areas in the room between the beds.</p></div>
<div id="attachment_51" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2Jsb2cubWFycXVpc3dhbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDA4LzA5L2JpbGQxMTA3LmpwZw=="><img class="size-medium wp-image-51" title="Lounge area" src="http://blog.marquiswang.com/wp-content/uploads/2008/09/bild1107-300x225.jpg" alt="A lounge area is set up with a sofa, bean bag sofa, fridge, TV, and video games." width="300" height="225" /></a><p class="wp-caption-text">A lounge area is set up with a sofa, bean bag sofa, fridge, TV, and video games.</p></div>
<p>To achieve this setup, I just bought the sofa, and had the bean bag sofa donated to me from my friend.  The leather sofa chair I used to have is now in the courtyard outside my room.  The only drawback is that our beds are now lofted and relatively close to each other, instead of on opposite sides of the room.  This hangout area is pretty sweet though.  Fair trade.</p>
 <img src="http://blog.marquiswang.com/wp-content/plugins/feed-statistics.php?view=1&post_id=46" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.marquiswang.com/2008/09/09/my-room/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->