<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    <link href="http://blog.codekills.net/feeds/atom.xml" rel="self" title="Code Kills" type="application/atom+xml" />
    <link href="http://blog.codekills.net/"                        rel="alternate"    title="Code Kills" type="text/html" />
    <link href="http://blog.codekills.net/rss.php?version=2.0"     rel="alternate"    title="Code Kills" type="application/rss+xml" />
    <title type="html">Code Kills</title>
    <subtitle type="html"></subtitle>
    <icon>http://blog.codekills.net/templates/default/img/s9y_banner_small.png</icon>
    <id>http://blog.codekills.net/</id>
    <updated>2008-08-27T18:42:03Z</updated>
    <generator uri="http://www.s9y.org/" version="1.1.3">Serendipity 1.1.3 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:david@wolever.net" />

    <entry>
        <link href="http://blog.codekills.net/archives/42-Why-I-Dont-Like-git.html" rel="alternate" title="Why I Don't Like git" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-08-27T13:59:01Z</published>
        <updated>2008-08-27T18:42:03Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=42</wfw:comment>
    
        <slash:comments>4</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=42</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/42-guid.html</id>
        <title type="html">Why I Don't Like git</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I've got some code checked out with git-svn, and I'd like to do two things: pull in new revisions and push up my local revisions.  Pretty simple, brainless, thing, right?  But we're dealing with git, so of course not <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" />
<code></p>

<pre>
<strong># Fortunately I'm smart enough to remember that when you
# want to push changes to SVN, you've obviously got to use: </strong>
$ <strong>git-svn dcommit</strong>
...
$
<strong># Hurra! It worked! (at least I think...)
# Now for the next feat, pulling in more revisions...</strong>
$ <strong>git svn</strong>
...
  fetch            Download new revisions from SVN
...
<strong># Phew! That looks like exactly what I need... Maybe it's not so tricky after all!</strong>
$ git svn fetch
        A       basie/a3c/admin.py
r13 = 45f5309121a77f33f8bd87009671727c0e2dc4a5 (zuze)
<strong># Sweet! Now I can take a look at what has been changed</strong>
$ <strong>cat basie/a3c/admin.py</strong>
cat: basie/a3c/admin.py: No such file or directory
<strong># Hu? I thought I just fetched it...
# Crap, right! I'm NOT supposed to use fetch, I'm supposed to use 'rebase'
# (not, of course, that I understand why "pulling in new revisions from SVN
#  is equivilent to a mung-your-history-rebase... But that's ok, I guess)</strong>
$ <strong>git svn rebase</strong>
...
$ <strong>cat basie/a3c/admin.py</strong>
cat: basie/a3c/admin.py: No such file or directory
<strong># Blast.  That didn't work either.
# Right, that's because 'fetch' updates the git repository but not the
# working tree... Alright, let's try an update</strong>
$ <strong>git up</strong>
git: 'up' is not a git-command. See 'git --help'.
<strong># Crap, right, git is too cool to have 'update'... I think I need reset</strong>
$ <strong>git reset</strong>
docs/cmdline.wiki: needs update
<strong># hhmm... Why is it telling me that the files I edited need update?
# And how on earth do I update them?
# I give up <img src="http://blog.codekills.net/templates/default/img/emoticons/sad.png" alt=":-(" style="display: inline; vertical-align: bottom;" class="emoticon" /> Can someone smarter than I am tell me what to do?</strong>
</pre>

<p></code></p>

<p>I guess I'll go back to Bazaar... It may be slow as molasses on a cold day, but at least it is simple enough that mere mortals can use it without resorting to Google.</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/41-Python-Brain-Teaser.html" rel="alternate" title="Python Brain-Teaser" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-05-29T15:14:57Z</published>
        <updated>2008-05-30T19:08:17Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=41</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    
            <category scheme="http://blog.codekills.net/categories/8-Play" label="Play" term="Play" />
            <category scheme="http://blog.codekills.net/categories/6-Python" label="Python" term="Python" />
    
        <id>http://blog.codekills.net/archives/41-guid.html</id>
        <title type="html">Python Brain-Teaser</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I'm working on pulling some functionality out of one object and putting it in another, and I came across this interesting problem:</p>

<p><style type="text/css">
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.python .de1, .python .de2 {color: #000060; font-weight: normal;}
.python  {white-space: nowrap;border: 1px dotted #a0a0a0; font-family: 'Courier New', Courier, monospace; font-size: 110%; background-color: #f0f0f0; margin: 0; line-height: 110%; padding: 0;color: #000099;}
.python a:link {color: #006;}
.python a:hover {background-color: #d6d6e6;}
.python .head {font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;}
.python .foot {font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;}
.python .imp {font-weight: bold; color: red;}
.python li, .python li.li1 {font-family: 'Courier New', Courier, monospace; color: #000060; background-color: #e0e0e0; padding-bottom: 2px;}
.python .kw1 {color: #ff7700;font-weight:bold;}
.python .kw2 {color: #008000;}
.python .kw3 {color: #dc143c;}
.python .kw4 {color: #0000cd;}
.python .co1 {color: #808080; font-style: italic;}
.python .coMULTI {color: #808080; font-style: italic;}
.python .es0 {color: #000099; font-weight: bold;font-weight: normal;}
.python .br0 {color: black;}
.python .sy0 {color: #66cc66;}
.python .st0 {color: #483d8b;}
.python .nu0 {color: #ff4500;}
.python .me1 {color: black;}
.python .me {1}
</style></p>

<div class="python">
<div class="de1"><span class="kw1">class</span> Foo:</div>
<div class="de1">&#160; &#160; me = <span class="st0">&quot;foo&quot;</span></div>
<div class="de1">&#160;</div>
<div class="de1"><span class="kw1">class</span> Bar:</div>
<div class="de1">&#160; &#160; me = <span class="st0">&quot;bar&quot;</span></div>
<div class="de1">&#160; &#160; <span class="kw1">def</span> get_me<span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:</div>
<div class="de1">&#160; &#160; &#160; &#160; <span class="kw1">return</span> <span class="kw2">self</span>.<span class="me1">me</span></div>
<div class="de1">&#160;</div>
<div class="de1">Foo.<span class="me1">get_me</span> = Bar.<span class="me1">get_me</span></div>
<div class="de1">x = Foo<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
<div class="de1">&#160;</div>
<div class="de1"><span class="kw1">print</span> x.<span class="me1">get_me</span><span class="br0">&#40;)</span></div></div>

<p><br /></p>

<p>What does this print?</p>

<p>And, next question, why is that?</p>

<p>After lunch I'll post my thoughts <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>

<hr />
 <br /><a href="http://blog.codekills.net/archives/41-Python-Brain-Teaser.html#extended">Continue reading "Python Brain-Teaser"</a>
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/40-SSH-Connection-Sharing.html" rel="alternate" title="SSH Connection Sharing" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-05-17T13:35:07Z</published>
        <updated>2008-05-17T18:18:54Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=40</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    
            <category scheme="http://blog.codekills.net/categories/8-Play" label="Play" term="Play" />
    
        <id>http://blog.codekills.net/archives/40-guid.html</id>
        <title type="html">SSH Connection Sharing</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>This tip was originally posted to the <a href="http://mail.python.org/pipermail/python-dev/2008-May/079499.html">python-dev</a> mailing list, so I can't take one scrap of credit for it.</p>

<p>Basically, since OpenSSH4, there has been an option to share connections -- that is, once you've opened one connection to a host, every subsequent connection is tunneled through the same channel, completely removing the overhead of authentication!</p>

<p>It's quite simple, just add this to <code>~/.ssh/config</code>:</p>

<pre><code>ControlMaster auto
ControlPath ~/.ssh/.%r@%h:%p
</code></pre>

<p>There can be problems if your machine crashes and that file is left lying around...  So adding this to your crontab will fix that:</p>

<pre><code>@reboot rm -f .ssh/controls/*
</code></pre>

<p>Next time: tab completion with scp!</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/39-SVK-+-Unicode.html" rel="alternate" title="SVK + Unicode == :(" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-05-06T21:43:06Z</published>
        <updated>2008-05-06T21:43:06Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=39</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=39</wfw:commentRss>
    
            <category scheme="http://blog.codekills.net/categories/13-Fixed-it" label="Fixed-it" term="Fixed-it" />
            <category scheme="http://blog.codekills.net/categories/7-Work" label="Work" term="Work" />
    
        <id>http://blog.codekills.net/archives/39-guid.html</id>
        <title type="html">SVK + Unicode == :(</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I was not impressed when I tried to check out a UTF-8 encoded file with SVK, then got the helpful message <code>Can't encode path as ascii</code>:</p>

<pre><code>$ svk up
Syncing //drp/trunk(/drp/trunk) in /home/wolever/Trunk to 5388.
Can't encode path as ascii.
</code></pre>

<p>I was even less impressed when I searched Google for <a href="http://google.ca/search?q=svk+unicode">svk unicode</a> and this blog was the first hit.</p>

<p>Fortunately my Google-foo is high today, and I was able to find <a href="http://wiki.opengarden.org/User:PeteE/Synchronizing_SVN_Repositories_With_Svk#section_7">a page</a> that gives a solution:  Making sure that your locale is set to something similar to <code>en_US.UTF-8</code>.</p>

<p>On Debian, here's how I do it:</p>

<pre><code>$ sudo apt-get install locales # Ubuntu 6.06 didn't have it...
...
$ export LANG="en_US.UTF-8"
$ export LANGUAGE="$LANG"
</code></pre>

<p>And, of course, it may be good to put those two <code>export</code>s in <code>~/.bashrc</code>.</p>

<p>Oh, but wait!</p>

<pre><code>$ svk up
Syncing //drp/trunk(/drp/trunk) in /home/wolever/Trunk to 5388.
Can't encode path as ascii.
</code></pre>

<p>It still doesn't work!</p>

<p>It turns out that, for what ever reason, something was upset.  Eventually I got it working by deleting the offending directory, then using <code>svk revert</code> to revert it:</p>

<pre><code>$ rm -r hacking/
$ svk revert -R hacking
...
Reverted hacking/utf8_爱的
</code></pre>

<p>Hurra!</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/38-Encoding-and-Decoding-Text-in-Python-or-I-didnt-ask-you-to-use-the-ascii-codec!.html" rel="alternate" title="Encoding and Decoding Text in Python (or: &quot;I didn't ask you to use the 'ascii' codec!&quot;)" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-05-01T17:27:00Z</published>
        <updated>2008-05-01T17:45:39Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=38</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=38</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/38-guid.html</id>
        <title type="html">Encoding and Decoding Text in Python (or: &quot;I didn't ask you to use the 'ascii' codec!&quot;)</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>When dealing with Unicode in Python, it doesn't take long to get the dreaded <code>'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)</code>.</p>

<p>You never see it coming.  It doesn't make any sense. You didn't even ask for <code>ascii</code>!</p>

<p>So what's the deal?</p>

<p>I'm glad you asked.  I will demonstrate:</p>

<pre><code>&gt;&gt;&gt; s = file("data").read()
&gt;&gt;&gt; s
'SGVsbG8sIHdvcmxkIQ==\n'
</code></pre>

<p>If you guessed that <code>s</code> is a hunk of base64 encoded data, you'd be right! Give yourself a gold star.</p>

<p>Now, if we want to do anything useful with this data, it needs to be <b>decoded</b>:</p>

<pre><code>&gt;&gt;&gt; s.decode('base64')
'Hello, world!'
</code></pre>

<p>We have just taken an <b>encoded</b> hunk of data and <b>decoded</b> it to get a useful hunk of data.</p>

<pre><code>&gt;&gt;&gt; s.decode('base64').replace('world', 'Marguerite')
'Hello, Marguerite!'
&gt;&gt;&gt; _.encode('base64')
'SGVsbG8sIE1hcmd1ZXJpdGUh\n'
</code></pre>

<p>Now we can take that useful hunk of data (the English in 7-bit ASCII), do something useful with it (in this case, replace 'world' with 'Marguerite'), and finally <b>encode</b> the data.</p>

<p>So how does all this relate back to Unicode and ascii error messages?</p>

<p>I have used base64 encoded data here, but the same concept applies when dealing with <b>Unicode</b> data:</p>

<ol>
<li>Hunk of opaque data comes in (but we know that it contains some sort of Unicode text)</li>
<li>Hunk of opaque data is <b>decoded</b>, creating a <code>unicode</code> object</li>
<li>The <code>unicode</code> object is used for something useful</li>
<li>The <code>unicode</code> object is <b>encoded</b> and saved (to disk, to a database, or sent to a browser)</li>
</ol>

<p><small>(of course, in the Real World, you've got to figure out which encoding was used on the data (UTF-8, Latin1, etc)... But that's a topic for another post.)</small></p>

<p>Ok, back to the <code>'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)</code> error.  It should be fairly clear that this error is coming up because Python is trying to decode a bunch of bytes as 7-bit ASCII, but some of them are out of that range (eg, they have a value over 127).</p>

<p>I know what you're saying, "but I never asked Python to decode anything!  I'm just trying to turn it into unicode!"</p>

<pre><code>&gt;&gt;&gt; unicode("Ol\xc3\xa1, mundo!")
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)
</code></pre>

<p>Two questions arise here:  First, "Where is the 'ascii' coming from?"  Second, "How do I make it work?"</p>

<p>To answer the first question, it's important to think about what's happening when the call to <code>unicode(...)</code> is made.  The <code>unicode</code> function accepts an encoded string, <b>decodes</b> it, and creates a <code>unicode</code> object.  In this case, though, we haven't given the function any indication of which decoder it should use, so it falls back to the computer's default encoding: <code>ascii</code>.</p>

<p>So how can you make it work?  Tell <code>unicode</code> which encoding to use:</p>

<pre><code>&gt;&gt;&gt; unicode("Ol\xc3\xa1, mundo!", 'utf8')
u'Ol\xe1, mundo!'
</code></pre>

<p><small>(now, as I mentioned before, figuring out which encoding to use is another huge problem... But I'll leave that for another day)</small></p>

<p>Another problem I run into quite often is this:</p>

<pre><code>&gt;&gt;&gt; "Ol\xc3\xa1, mundo!".encode('utf8')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)
</code></pre>

<p>And, by now, the cause of this should be painfully obvious: I've given Python an <i>encoded</i> string, so I should be <i>decoding</i> it, not encoding it again.</p>

<p>But why the confusing error message?  Well, I'm not entirely sure, but my guess is that the UTF-8 encoder expects a <code>unicode</code> object, so it tries to convert the input (in this case, "Ol\xc3...") to Unicode before encoding it.</p>

<h3>Is there any end to this insanity?!</h3>

<p>Yes!  Python 3000 will have two distinct classes: one for strings, one for hunks of data.  Whenever data is read, it will come in as a "hunk of data".  It will have to be explicitly decoded to a string before it can be used as such.  Hopefully that will make life a little bit less painful.</p>

<h3>See also:</h3>

<ul>
<li>The obligatory link to <a href="http://www.joelonsoftware.com/articles/Unicode.html">Joel Spolsky's The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets</a></li>
<li><a href="http://www.python.org/dev/peps/pep-3112/">PEP 3112 - Byte literals in Python 3000</a></li>
</ul>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/37-Another-reason-I-like-SVK.html" rel="alternate" title="Another reason I like SVK" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-04-16T18:47:35Z</published>
        <updated>2008-04-16T18:47:35Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=37</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    
            <category scheme="http://blog.codekills.net/categories/9-DrProject" label="DrProject" term="DrProject" />
            <category scheme="http://blog.codekills.net/categories/7-Work" label="Work" term="Work" />
    
        <id>http://blog.codekills.net/archives/37-guid.html</id>
        <title type="html">Another reason I like SVK</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I got a fairly significant patch to DrProject today.  I wanted to show it to the other developers so they could give it a look over.  How'd I do it?</p>

<p><html></p>

<pre>
    $ patch -p0 < patch
    ... check that it works ...
    <font color="green"># Create a new branch for the patch</font>
    $ svk cp //drp/trunk //drp/branches/patch -m "Created branch for patch"
    <font color="green"># Do an in-place switch of my repository (which takes about 2 seconds,
    # versus the minute or two it would take to check the entire tree out)</font>
    $ svk switch //drp/branches/patch 
    <font color="green"># Because switch doesn't revert modified files, the changes are still here,
    # ready to be checked in</font>
    $ svk ci -m "Checking in patched code"
</pre>

<p></html></p>

<p>Now they can use <a href="http://www.drproject.org/">DrProject's</a> fancy online changeset viewer, checkout the code for themselves, use <code>svn diff</code>... The list is endless.</p>

<p>Now that rocks SO much more than mailing around <code>.diff</code> files (and makes life happier when it comes time to pull it back into trunk).</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/36-SSH-and-HTTPS-on-the-same-port!.html" rel="alternate" title="SSH and HTTPS on the same port?!" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-04-11T21:38:16Z</published>
        <updated>2008-04-15T19:44:01Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=36</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=36</wfw:commentRss>
    
            <category scheme="http://blog.codekills.net/categories/8-Play" label="Play" term="Play" />
            <category scheme="http://blog.codekills.net/categories/6-Python" label="Python" term="Python" />
    
        <id>http://blog.codekills.net/archives/36-guid.html</id>
        <title type="html">SSH and HTTPS on the same port?!</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>A friend of mine was over the other night, and we were talking about how much we like running SSH on port 443.  It gets you around all but the most insane firewalls, and to anyone but the keenest of observers it just looks like HTTPS traffic.</p>

<p>But running SSH over port 443 makes it particularly difficult to run a secure web server as well.</p>

<p>So what can be done?</p>

<p>Well, it turns out that when an SSH client initiates a connection, it waits for the server to send a banner (<code>SSH-1.99-OpenSSH_4.7</code>, for example) before beginning the secure negotiation.  Browsers, on the other hand, just go right ahead and begin the secure negotiation.</p>

<p>Knowing this, it didn't take long to formulate a plan: write a little program which will listen on 443.  When it gets a connection, it figures out if the remote end is trying to speak SSH or HTTPS, makes the appropriate connection on the local end, the passes the data between the two.</p>

<p>It only took a couple of hours to write a <a href="http://wolever.net/~wolever/sstp/sstp.py">small proof-of-concept</a>... And, believe it or not, it even works! <small>Disclaimer: this particular implementation is not quite suitable for any real use.</small></p>

<p>Anyway, this may not be the most efficient way of doing things... But that's no matter.  It's still neat <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>

<p>Code: <a href="http://wolever.net/~wolever/sstp/sstp.py">sstp.py</a></p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/35-How-SVK-has-made-my-life-happy.html" rel="alternate" title="How SVK has made my life happy" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-04-04T19:40:06Z</published>
        <updated>2008-04-08T15:33:23Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=35</wfw:comment>
    
        <slash:comments>4</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=35</wfw:commentRss>
    
            <category scheme="http://blog.codekills.net/categories/7-Work" label="Work" term="Work" />
    
        <id>http://blog.codekills.net/archives/35-guid.html</id>
        <title type="html">How SVK has made my life happy</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>SVK, despite some of it's shortcomings, has proved worthy of my use in the last couple of days.  Here is a quick script which shows how I've been using it, and how it's rocked the pants off of SVN:</p>

<p><font color="red">red = commands with SVN</font><br />
<font color="blue">blue = equivalent SVK commands</font><br />
<font color="green">green = comment</font><br /></p>

<pre>
<font color="green"># Mirror the DrP repository to //dpr</font>
<font color="red">$ # No equivilent</font>
<font color="blue">$ svk mirror https://drproject.org/drproject/DrProject/ //drp/</font>

<font color="green"># Create the tags branch</font>
<font color="red">$ svn cp https://drproject.org/drproject/DrProject/tunk \
         https://drproject.org/drproject/DrProject/branches/tags</font>
<font color="blue">$ svk cp //drp/trunk //drp/branches/tags</font>

<font color="green"># Check out the branch</font>
<font color="red">$ svn co https://drproject.org/drproject/DrProject/branches/tags Tags</font>
<font color="blue">$ svk co //drp/branches/tags Tags</font>

<font color="green"># Some changes are made to the tags branch</font>

<font color="green"># Checkin those changes</font>
<font color="red">$ svn ci -m "Made some changes to tags branch"</font>
<font color="blue">$ svk ci -m "Made some changes to tags branch"</font>
<font color="green"># In this case, SVK is not being used in decentralized
# mode, so the changes will be pushed upstream to the
# SVN repository, just like the svn commit does.</font>

<font color="green"># Changes have also been made to trunk.
# Time to merge those changes in.

# First, a merge with SVN:</font>
<font color="red">$ svn log --stop-on-copy</font>
<font color="green"># Look for either the last revision which trunk was merged
# You can't always use the base revision, otherwise conflicts
# may ensue.</font>
<font color="red">$ svn merge -r $REV:HEAD https://drproject.org/drproject/DrProject/tunk .</font>
<font color="green"># Hope that there are no trivial conflicts to sort out,
# then test and commit the merge. </font>
<font color="red">$ svn ci -m "Merged trunk into tags."</font>

<font color="green"># And now, exactly the same operation with SVK:</font>
<font color="blue">$ svk pull</font>
<font color="green"># ... changes are merged ...</font>
<font color="blue">$ </font>
</pre>

<p>I don't think I need to say any more <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>

<p>(Yes, I realize that there are tools like <a href="http://www.orcaware.com/svn/wiki/Svnmerge.py">svnmerge.py</a> which make SVN merges less painful... But that's one extra command to run.  And you've still got those stinking <tt>.svn</tt> directories everywhere.)</p>
 <br /><a href="http://blog.codekills.net/archives/35-How-SVK-has-made-my-life-happy.html#extended">Continue reading "How SVK has made my life happy"</a>
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/34-Conditionally-Sourcing-vimrc-files.html" rel="alternate" title="Conditionally Sourcing vimrc files" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-03-16T23:28:01Z</published>
        <updated>2008-03-16T23:28:01Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=34</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=34</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/34-guid.html</id>
        <title type="html">Conditionally Sourcing vimrc files</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I'm sitting in a tutorial at <a href="http://www.python.org/community/pycon/">PyCon</a><sup>1</sup> on hacking the Python core.  One of the things that was mentioned is Python's coding standards, and their supporting <a href="http://svn.python.org/view/python/trunk/Misc/Vim/">Vim scripts</a>.</p>

<p>I've got no complaints with them -- I just don't want to use them all the time.  So I've added this bit of code to <code>~/.vimrc</code>:</p>

<pre><code>let path = expand('%:p:h')
if path =~ "Python-trunk"
    let path = substitute(path, '\(.*/Python-trunk\).*', '\1', '')
    execute('source ' . path . '/Misc/Vim/vimrc')
endif
</code></pre>

<p>In short, if it looks like I'm in the Python-trunk directory, it sources their vimrc <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>

<p>1: Blog posts to come... I promise!</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/33-Reverting-Changes-in-SVN-or-its-not-as-easy-as-svn-up-r.html" rel="alternate" title="Reverting Changes in SVN (or: it's not as easy as svn up -r)" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2008-02-08T16:57:24Z</published>
        <updated>2008-02-08T17:02:22Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=33</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=33</wfw:commentRss>
    
            <category scheme="http://blog.codekills.net/categories/9-DrProject" label="DrProject" term="DrProject" />
            <category scheme="http://blog.codekills.net/categories/6-Python" label="Python" term="Python" />
            <category scheme="http://blog.codekills.net/categories/7-Work" label="Work" term="Work" />
    
        <id>http://blog.codekills.net/archives/33-guid.html</id>
        <title type="html">Reverting Changes in SVN (or: it's not as easy as svn up -r)</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>If there is one thing that I've found universally confusing about version control systems, it's how to revert back to a previous revision, then move on from there.  Conventional wisdom would dictate that <code>svn up -r $OLD</code> with some additional flag that says <code>pretend that we're still at HEAD</code> would do the trick... But, alas, there exists no such flag.</p>

<p>So, besides <code>svn cat -r $OLD $FILE &gt; $FILE</code>, what's the best way to revert a file (or entire tree) to an older revision?  Well, it turns out that <strong>merge</strong> is the tool you're looking for.</p>

<p>The trick is that you can <code>diff</code> backwards as well as forwards:</p>

<pre>
[wolever@thebes] ~/test_dr/All svn diff -r <strong>2:1</strong>
Index: stuff
===================================================================
--- stuff       (revision 2)
+++ stuff       (revision 1)
@@ -1,4 +1,3 @@
 Let us endeavor so to live that when we come to die even the undertaker will be
 sorry.
                -- Mark Twain, "Pudd'nhead Wilson's Calendar"
-Increased knowledge will help you now.  Have mate's phone bugged.
Index: docs.html
</pre>

<p>Which means that <strong>merge</strong> will work both ways as well:</p>

<pre>
[wolever@thebes] ~/test_dr/All svn <strong>merge -r 2:1</strong> stuff
U    stuff
[wolever@thebes] ~/test_dr/All svn ci -m "reverted changes" stuff
[wolever@thebes] ~/test_dr/All svn diff -r 1:3 stuff
[wolever@thebes] ~/test_dr/All

</pre>

<p>Of course, this will also work with the myriad of other version control tools out there.  In fact, if you're still using SVN, reverting old changes is probably the least of your problems... At least compared to, say, merging different branches ^_^</p>

<p>But that's a post for another day -- I need to stop writing about merging and actually get on with, err, <a href="https://www.drproject.org/DrProject/ticket/1236">doing it</a>...</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/32-How-I-keep-all-my-config-files-under-version-control.html" rel="alternate" title="How I keep all my config files under version control" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2007-12-15T20:05:31Z</published>
        <updated>2007-12-16T23:52:47Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=32</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=32</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/32-guid.html</id>
        <title type="html">How I keep all my config files under version control</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Ah, a Saturday morning that I should spend studying for my exam on Wednesday... What better thing to do than get all my important config files under version control?</p>

<h2>Executive summary</h2>

<p>To get all my config files under version control, I:</p>

<ol>
<li>Moved all my important config files to ~/.config/</li>
<li>Put ~/.config/ under version control</li>
<li>Wrote a script to make links from ~/.config/* to the Right Place (ie: ~/.config/vim -> ~/.vim)</li>
<li>All my machines are in sync <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></li>
</ol>

<p>So, the problem:  I use three machines on a regular basis (my laptop, my server, my computer at work).  I want to keep all my important config files in sync (ie: Bazaar and Vim).  I'd also like to keep them under version control (version control is a good thing, right?)  Can both happen at once?  Well, with the magic of <code>bzr</code> <small>(or your favourite distributed version control tool)</small>, it turns out they can <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>

<p>The first step was to collect everything into one place.  I moved the files I'm going to care about (in this case, <code>~/.vim</code>, <code>~/.vimrc</code> and <code>~/.bazaar</code>) into <code>~/.config</code> and put that under version control: <code>cd ~/.config; bzr init; bzr add *</code> (it's worth noting that I had some problems with a couple of the bzr plugins which were under version control... Bzr didn't want to add them to my repository because they themselves were repositories.  That problem was fixed with a quick <code>rm -r &lt;plugin&gt;/.bzr</code> though).</p>

<p>The next step was replacing the old config files with links to the new (versioned) ones.  That was nothing a simple shell script couldn't solve, though (take a look at <a href="http://wolever.net/~wolever/conf/install_links.sh">install_links.sh</a> if you're interested in now it works).</p>

<p>Beautiful.  Everything is versioned, I've just got to distribute it.</p>

<p>Bazaar (and just about every other distributed VCS out there) has some wonderful facilities to push/pull it's repositories. All it took was a quick <code>bzr push sftp://wolever.net:443/home/wolever/.config/</code> to move it over, then <code>ssh</code>ing over, checking out the files and installing the links:</p>

<pre>
  $ ssh wolever.net
  $ cd .config
  $ bzr co .
  $ ./install_links
</pre>

<p>Finally, I put a link to the repository in a web-facing directory (<a href="http://wolever.net/~wolever/conf">http://wolever.net/~wolever/conf</a>) so I could grab it from my work machine using <code>bzr get http://wolever.net/~wolever/conf/ ~/.my_config</code> (I have to use <code>~/.my_config</code> because some program (I suspect XFCE) is using <code>~/.config</code>).</p>

<p>And that's all there is to it <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/31-College-Puzzle-Challenge-2007-Pre-Event-Puzzles-3.html" rel="alternate" title="College Puzzle Challenge 2007 Pre-Event Puzzles #3" />
        <author>
            <name>Ted Campbell</name>
            <email>codekills@gmail.com</email>
        </author>
    
        <published>2007-11-03T01:12:26Z</published>
        <updated>2007-11-03T01:50:43Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=31</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=31</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/31-guid.html</id>
        <title type="html">College Puzzle Challenge 2007 Pre-Event Puzzles #3</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Following <a href="http://blog.codekills.net/archives/30-College-Puzzle-Challenge-2007-Pre-Event-Puzzles-2.html">College Puzzle Challenge 2007 Pre-Event Puzzles #2</a>, it is time for puzzle #3, <a href="http://collegepuzzlechallenge.com/Puzzles/Rotation%20Schedule.pdf">Rotation Schedule</a>.</p>

<p>This was a fun little puzzle with codes on codes that reminded us of a problem from 2006 <a href="http://ipsc.ksp.sk/">IPSC Contest</a> called <a href="http://ipsc.ksp.sk/contests/ipsc2006/real/problems/m.php">Matrioska</a> (which are those Russian doll things that <a href="http://es.wikipedia.org/wiki/Imagen:Russian-Matroshka_no_bg.jpg">fit inside each other</a>). The IPSC problem involved decoding the first puzzle or program who's output was another puzzle itself.</p>

<p>This Puzzle Challenge one starts off with a page of <a href="http://en.wikipedia.org/wiki/Pigpen_cipher">Pigpen cipher symbols</a>. Decoding these symbols gives the following sequence of letters:</p>

<pre>ROTTHR EEURWD WHGQLQ HWBFOR FNZLVH STVQJQ HNECYS USLZEI</pre>

<p>'ROT THREE ... &lt;gibberish&gt;' Now ROT-13 refers to a <a href="http://en.wikipedia.org/wiki/Caesar_cipher">Caeser Cipher</a> with a shift of 13, so ROT-3 is a shift of three letters instead.  Since we are decoding, we actually want to undo the rotation which is done by rotating forward by 23 (which is 26 letters - 3).  David found a simple online shifter <a href="http://rumkin.com/tools/cipher/caesar.php">here</a> (although it is a very easy task in nearly any programming language) which we used.  Deciphering the remaining letters in the string we end up with:</p>

<pre>****** **ROTA TEDNIN ETYCLO CKWISE PQSNGN EKBZVP RPIWBF</pre>

<p>This time the clue is 'ROTATED NINETY CLOCKWISE ... &lt;gibberish&gt;'.  At this point David started looking into trying things like ROT-(90 modulo 26), and I decided the clue referred to geometry and tried to figure out ways of rotating the pigpen symbols.<br />
Once again since we are decoding, we want to rotate 90 degrees CCW instead.  I was about to start writing the gibberish part to Pigpen so I could rotate the page, but quickly realized that I just needed to look at the pigpen grid and have the letters move position 90 degrees around the respective hash or cross. The result of this transform was:</p>

<pre>****** ****** ****** ****** ****** ROTNIN EMDYUR LRCXDB</pre>

<p>Similar to before, 'ROT NINE ... &lt;gibberish&gt;'.  Undoing the ROT-9 we end up with:</p>

<pre>****** ****** ****** ****** ****** ****** *DUPLI CITOUS</pre>

<p>My final answer: <b>DUPLICITOUS</b><br />
The real answer: .. we'll see ..</p>

<p>This is enough procrastinating for one day... Ted, out.</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/30-College-Puzzle-Challenge-2007-Pre-Event-Puzzles-2.html" rel="alternate" title="College Puzzle Challenge 2007 Pre-Event Puzzles #2" />
        <author>
            <name>Ted Campbell</name>
            <email>codekills@gmail.com</email>
        </author>
    
        <published>2007-11-03T00:44:44Z</published>
        <updated>2007-11-03T01:48:32Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=30</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=30</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/30-guid.html</id>
        <title type="html">College Puzzle Challenge 2007 Pre-Event Puzzles #2</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Continuing the post <a href="http://blog.codekills.net/archives/29-College-Puzzle-Challenge-2007-Pre-Event-Puzzles-1.html">College Puzzle Challenge 2007 Pre-Event Puzzles #1</a>, I'd like to briefly describe our answer to the second puzzle, <a href="http://collegepuzzlechallenge.com/Puzzles/Lyrical%20Genius.pdf">A Heartbreaking Work of Lyrical Genius.</a></p>

<p>This puzzle took us the longest time to do, but I think most of that was due to the fact I did the research wrong (yep, my fault this time).  The first difference we noticed we looked at this puzzle was there was no intro paragraph full of clues this time.  Just a list of lyrics.  We quickly recognized these were real songs and went to find what they were.  Unfortunately I managed to swap a few of the band names and song names (I blame confusing lyrics websites).  After a few days of getting nowhere, we discovered the errors and corrected them.
Now with the correct list and a fresh look we noticed a pattern in the song list.</p>

<pre>
        Scar Tissue - <b>R</b>ed Hot Chili Peppers
      Lose Yourself - <b>E</b>minem
           Freebird - <b>L</b>ynard Skynard
              React - <b>E</b>rick Sermon
      The Adventure - <b>A</b>ngels and Airwaves
Truely Madly Deeply - <b>S</b>avage Garden
  Dirty Little Girl - <b>E</b>lton John

  Lights and Sounds - <b>Y</b>ellowcard
               Blue - <b>E</b>iffel 65
         Skater Boy - <b>A</b>vril Lavigne
 Losing My Religion - <b>R</b>.E.M.

Beach Side Property - <b>M</b>odest Mouse
    Like Satellites - <b>O</b>ver It
Blasphemous Rumours - <b>D</b>epeche Mode

          Head Club - <b>T</b>aking Back Sunday
     Wild West Hero - <b>E</b>lectric Light Orchestra
Living in the Roses - <b>N</b>ew Model Army
</pre>

<p>Much better. RELEASE YEAR MOD TEN. Our first explicit clue.  From here on it was straight forward.  Look up the release years on songs using Wikipedia and Last.FM and taking the last digit from the year (year mod 10), we get a new number for each line.  Number n meant use the n-th word from the given lyrics to form a new phrase.  We had to fudge the release years a bit to make sense but we ended up with 'I WAS A MEMBER OF THE POLICE AND I WROTE AND SANG THE HIT SONG DESERT ROSE'.  An issue that bugged Dave while we struggled with the wrong clues was that there were only 16 words at the bottom but 17 songs.  In the end, it seemed this was just a mistake as the word that slipped through was 'I' and was probably accidentally forgotten.</p>

<p>More searching resulted in finding that the artist was <a href="http://en.wikipedia.org/wiki/Sting">Sting</a>.  Another problem solved.  These problems are addicted and frustrating at times, but looking back this one wasn't  too difficult if we had gotten the research right at first.</p>

<p>My final answer: <b>STING</b><br />
The real answer: .. we'll see ..</p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/29-College-Puzzle-Challenge-2007-Pre-Event-Puzzles-1.html" rel="alternate" title="College Puzzle Challenge 2007 Pre-Event Puzzles #1" />
        <author>
            <name>Ted Campbell</name>
            <email>codekills@gmail.com</email>
        </author>
    
        <published>2007-11-02T23:54:07Z</published>
        <updated>2007-11-03T01:52:50Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=29</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=29</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/29-guid.html</id>
        <title type="html">College Puzzle Challenge 2007 Pre-Event Puzzles #1</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <div class="serendipity_imageComment_left" style="width: 98px"><div class="serendipity_imageComment_img"><!-- s9ymdb:3 --><img width='98' height='98'  src="http://blog.codekills.net/uploads/Puzz-Challenge-2007-Logo.png" alt="" /></div><div class="serendipity_imageComment_txt">Puzzle Challenge 2007 Logo</div></div>

<p>Well, the <a href="http://www.collegepuzzlechallenge.com">College Puzzle Challenge</a> hosted by Microsoft is coming up again and David, Pete, Greg, and I are signed up as a team.  We were at the event last year for the first and didn't do as well as we hoped (we were in the middle of the pack overall) and we plan to change that this year. 
There are a few practice problems that go up before the contests starts and we've been working through them.  So far we have 3/3 "solved" and are waiting for the last two to go up.  These are my answers to the puzzles with help from the others.  These aren't necessarily correct and I'll link to the official solutions when they come up but I thought I'd put these up anyways.</p>

<hr />

<p>The first practice puzzle, <a href="http://collegepuzzlechallenge.com/Puzzles/Symphony%20No.%2031.pdf">Symphony No. 31, Op. 66</a> was full of little clues on how to proceed.</p>

<p>Reading through the description a few times I noticed the letters I, S, and O in bold in the name 'Interdepartmental System Operations'.  ISO.. due to the fact that computers have taken over my brain, the first thing that came to mind was ISO standardizations, but hey, I'm crazy, it is probably something else.  None the less, I look for the numbers on the page 31 66 1 and search for a standard with those numbers, and sure enough, <a href="http://en.wikipedia.org/wiki/ISO_3166-1" >ISO 3166-1</a> is the standardization of country codes.</p>

<p>By looking at the music notes in the puzzle, it is quickly apparent that they are in pairs and music notes have letters... two-letter country codes anyone?</p>

<p>Decoding this we wind up with a list of countries:</p>

<ol>
<li>Canada</li>
<li>Antigua</li>
<li>Barbados</li>
<li>French Guiana</li>
<li>Ecuador</li>
<li>Burkina Faso</li>
<li>Andorra</li>
<li>Great Britain</li>
<li>Belgium</li>
<li>Germany</li>
<li>Bosnia</li>
<li>Egypt</li>
<li>Bulgaria</li>
<li>Estonia</li>
<li>Georgia</li>
<li>United Arab Emirates</li>
</ol>

<p>These countries are loosely clustered by location so I try to plot them on a map and connect the lines, ending up with this :</p>

<div class="serendipity_imageComment_center" style="width: 427px"><div class="serendipity_imageComment_img"><!-- s9ymdb:2 --><img width='427' height='242'  src="http://blog.codekills.net/uploads/Pre-Puzz-1-Map.jpg" alt="" /></div><div class="serendipity_imageComment_txt">Countries mapped out.</div></div>

<p><br />
The letters ML appear backwards on the map.  This is the country code for MALI so that is what I am calling my final answer.  I'll find out when the answers are released whether this is correct.  Up until the map is almost certainly correct but I wonder about my interpretation of the final answer.
Looking the puzzle over some more I noticed another clue which is the fake composer's initials are MAP.  A final big clue that Pete noticed was the notes also encode <a href="http://en.wikipedia.org/wiki/Morse_Code">Morse code</a> and say CONNECT THE DOTS.  Both these extra clues reaffirm the solution.</p>

<p>My final answer: <b>MALI</b><br />
The real answer: ...we'll see...<br /></p>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://blog.codekills.net/archives/28-Secure-RSS-with-DrProject.html" rel="alternate" title="Secure RSS with DrProject" />
        <author>
            <name>David Wolever</name>
            <email>david@wolever.net</email>
        </author>
    
        <published>2007-10-11T22:53:44Z</published>
        <updated>2007-10-16T01:07:17Z</updated>
        <wfw:comment>http://blog.codekills.net/wfwcomment.php?cid=28</wfw:comment>
    
        <slash:comments>11</slash:comments>
        <wfw:commentRss>http://blog.codekills.net/rss.php?version=atom1.0&amp;type=comments&amp;cid=28</wfw:commentRss>
    
    
        <id>http://blog.codekills.net/archives/28-guid.html</id>
        <title type="html">Secure RSS with DrProject</title>
        <content type="xhtml" xml:base="http://blog.codekills.net/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p><strong>Situation</strong>: <a href="http://drproject.org">DrProject</a> has a very useful timeline feature, which shows all the activity (tickets opened/closed, source control checkins, wiki edits, etc) relating to a project.  To make things even better, there is also an option to export this feed as RSS (now, [this is also slightly broken][960], but that's another story).</p>

<p><strong>Problem</strong>: If students are using DrProject to manage a marked project, there should be no way that students in one group can see the timeline another group.  From the web interface, this is handled by the standard authentication mechanism... But there is no standard mechanism for authenticating RSS feeds.  And, even if there was, students should not be giving their <a href="http://www.cdf.toronto.edu/">CDF</a> passwords to online news reading services (both because the service might do Something Bad with it and because people should <a href="http://www.codinghorror.com/blog/archives/000953.html">not be in the habit of giving out their credentials</a>).</p>

<p><strong>Current solution</strong>: Turn off RSS.</p>

<p>That's a really crappy solution.</p>

<p>What can be done?</p>

<p>Well, <a href="http://hyfen.net">Andrew Louis</a> and I were talking about it yesterday, and we were discussing a few of the different mechanisms used by similar web pages.</p>

<p>Flickr, for instance, assigns each user an arbitrary ID.  After they register a name, there is no way to see this ID.  If you manage to find a person's ID (either before they register a name or through some other means), there is nothing stopping your from taking a look at any of their feeds (take a look at the <a href="http://api.flickr.com/services/feeds/photos_friends.gne?user_id=34763018@N00&amp;friends=0&amp;display_all=0&amp;format=atom">photos from my contacts</a>!).  Ok, so that's a pretty crummy solution.</p>

<p>Facebook is a bit more interesting.  It assigns each feed a random ID.  To view a feed, you need to know both the user's ID (easy to get) and the random ID (hard to get): <code>http://utoronto.facebook.com/feeds/friends_status.php?id=</code><strong><code>1658670036</code></strong><code>&amp;key=</code><strong><code>c16adb2zcd</code></strong><code>&amp;format=rss20</code>.</p>

<p>But this isn't quite good enough.  If someone gets hold of the secret key, it's all over.</p>

<p><strong>So what can we do?</strong></p>

<p>Well, else can we use to tell the difference between you and me?  What about the headers our newsreaders send? The IP block our request originates from? How frequently we check the feed?</p>

<p>Ok, so it might be tricky to implement a frequency-checking heuristic... But it would be easy to say "hhmm... Last time you checked this feed, you used Google Reader.  But this time your User-agent tells me that you are curl.  Something's up!"</p>

<p>When a user wants to read an RSS feed, they are given a URL with a unique key.  The first time that feed is accessed, the User-agent string (and possibly other headers) are recorded.  On subsequent requests, the values are compared and if there is a significant change (for some value of "significant") <strong>[edit]</strong> and the old key will be invalidated.  The legitimate user will be asked to re-validate the next time they download the feed.<strong>[/edit]</strong></p>

<p>This will not make attacks impossible, but will certainly frustrate them, because the attacker must get the headers right on the first try. <strong>[edit]</strong> If they get it wrong, they will have to wait for the legitimate user to get a new key, find that key, then try again. <strong>[/edit]</strong></p>

<p>Problems:</p>

<ul>
<li>What if someone checks their feed from both an online service (such as Google Reader) and a newsreader on their laptop?<br />
They just generate two keys -- I don't see any reason that one user should not have more than one key associated with them.</li>
<li>What if the headers change from less sinister actions?<br />
No problem -- getting a new key will be a matter of a couple of clicks.</li>
<li>But doesn't that mean all the old items will be marked unread?<br />
Yes.  Is there a way to fix that?</li>
<li>Isn't there still a possibility of attack?<br />
Yes, it is possible.  But, hopefully, it will be hard enough to thwart casual attackers.</li>
</ul>

<p><strong>So, any comments?</strong></p>

<h3>Postscript 0: What about OpenID?</h3>

<p>It looks really neat.  In theory, it would solve this problem.  In practice, though, there are two issues:</p>

<ul>
<li>Added complexity -- we would either have to build an OpenID server into DrP or rely on an external server.</li>
<li>Limited support -- at the moment, only a handful of readers have support for OpenID (Google Reader being, I believe, a notable exception)... And we don't quite have the market share to change that.  At least not yet <img src="http://blog.codekills.net/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></li>
</ul>
 
            </div>
        </content>
        
    </entry>

</feed>