<?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>Ctrl-C &#187; Technology</title>
	<atom:link href="http://ctrl-c.us/blog/archives/category/tech/feed" rel="self" type="application/rss+xml" />
	<link>http://ctrl-c.us/blog</link>
	<description>a friendly interruption</description>
	<lastBuildDate>Fri, 28 May 2010 11:49:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gmail: Please Bold the Hidden Labels Button when there are Unread Messages</title>
		<link>http://ctrl-c.us/blog/archives/643</link>
		<comments>http://ctrl-c.us/blog/archives/643#comments</comments>
		<pubDate>Tue, 21 Jul 2009 18:41:56 +0000</pubDate>
		<dc:creator>Caleb Spare</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[gmail labels]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://ctrl-c.us/blog/?p=643</guid>
		<description><![CDATA[I love Gmail. It does everything I could possibly want an email client (web or desktop) to do. All of my non-junk email accounts are Gmail or are forwarded to Gmail accounts. That said, occasionally something occurs to me that would make my Gmail experience a little bit better. Sometimes these crop up as Labs [...]]]></description>
			<content:encoded><![CDATA[<p>I love Gmail. It does everything I could possibly want an email client (web or desktop) to do. All of my non-junk email accounts are Gmail or are forwarded to Gmail accounts. That said, occasionally something occurs to me that would make my Gmail experience a little bit better. Sometimes these crop up as Labs features, which I think is great, and is part of why I enjoy using Gmail so much.<br />
<span id="more-643"></span></p>
<div id="attachment_644" class="wp-caption alignright" style="width: 191px"><img class="size-full wp-image-644 " src="http://ctrl-c.us/blog/wp-content/uploads/2009/07/gmail-hidden-labels.jpg" alt="What if this were bold?" width="181" height="488" /><p class="wp-caption-text">What if this were bold?</p></div>
<p>There was a fairly recent change to Gmail, where infrequently used labels could be hidden. It lets you keep your important labels in the left sidebar, and if you have 10 more hidden labels you click a little button that says &#8220;10 more&#8221; to show a menu with all of these labels. Chats, Sent Mail, Drafts, Starred, All Mail, Spam, and Trash also behave like normal labels for this purpose. This is a nice feature, in my opinion. I usually don&#8217;t care about how many spam messages I have, so I can tuck it away from my normal view. More importantly, I use a lot of filters (50 or 60) to organize incoming mail under labels (I have 32 at the moment), but  most of these only occasionally receive mail and it&#8217;s nice to have them hidden too.</p>
<p>When a label has unread messages in, it turns bold. For me, this used to mean that to see if I had any new mail, I looked both at the top of the inbox and scanned the labels for a bold one. Now, to see if any of my hidden labels have new messages, I have to click the button to show these labels. The fix, in my opinion, is to turn the &#8220;25 more&#8221; text bold when hidden labels have unread messages (see picture). I know it&#8217;s small, but this would save compulsive email checkers like myself a fair amount of annoyance. (Yes, I&#8217;m aware that I can just move all my labels out of this menu, but I like this feature too much to stop using it because of this.)</p>
<p>A small caveat here is that if you move the Spam label into this menu, you will always have unread messages (unless you don&#8217;t get spam, or mark it as read). Spam could be ignored for the purposes of bolding the button, but this might be considered unexpected behavior. Regardless, I&#8217;m sure the smart people on the Gmail team could figure something out.</p>
<p>I couldn&#8217;t find anyone else talking about this. This may be due to poor Googling on my part, or perhaps nobody else really cares. Hopefully other people have thought about it and we can get the attention of somebody at Google.</p>
<p><strong>Edit:</strong> I found another person&#8217;s idea for a solution to this problem <a href="http://www.google.com/support/forum/p/gmail/thread?tid=1e61cf53d192cc1d&amp;hl=en">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ctrl-c.us/blog/archives/643/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interfacing C and Python 3 using SWIG</title>
		<link>http://ctrl-c.us/blog/archives/99</link>
		<comments>http://ctrl-c.us/blog/archives/99#comments</comments>
		<pubDate>Mon, 27 Apr 2009 09:06:17 +0000</pubDate>
		<dc:creator>Caleb Spare</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[python 3]]></category>
		<category><![CDATA[swig]]></category>

		<guid isPermaLink="false">http://ctrl-c.us/?p=99</guid>
		<description><![CDATA[I like Python, and I use it for almost all of my personal projects and whenever I can get away with it in school. Sometimes, however, (rarely, these days) you&#8217;re looking for raw speed. Python, alas, is not the fastest kid on the block, and at these times you might have to turn to a [...]]]></description>
			<content:encoded><![CDATA[<p>I like Python, and I use it for almost all of my personal projects and whenever I can get away with it in school. Sometimes, however, (rarely, these days) you&#8217;re looking for raw speed. Python, alas, is not the fastest kid on the block, and at these times you might have to turn to a different language to give you the necessary speed. (Another option you might consider first is <a title="Psyco" href="http://psyco.sourceforge.net/" target="_blank">Psyco</a>.) In these situations it is often the case that only particular operations or functions really have to be fast. Even if you want to write the whole piece of software in C, you might like to use Python to write the front end. There are a lot of different ways to do this, but my favorite is <a title="Simplified Wrapper and Interface Generator" href="http://www.swig.org/" target="_blank">SWIG</a>, because it&#8217;s easy and I&#8217;m lazy.</p>
<p><span id="more-99"></span>SWIG is a great tool that supports a host of high-level languages; I&#8217;ve only ever used it with Python. At the other end, you get your choice of C and C++—crappy languages aren&#8217;t really my thing, so this tutorial will be about C. I&#8217;m going to use Python 3 because all the cool kids live on the bleeding edge. This requires SWIG 1.3.37 or better; if you&#8217;re on Ubuntu like me, you&#8217;re going to have to go grab it from the website and compile it yourself (I&#8217;m using 1.3.39). Also, remember that you need the header files for python installed (python3-dev on Ubuntu). If you&#8217;re too lazy to copy-paste, you can download the files <a href='http://ctrl-c.us/wordpress/wp-content/uploads/2009/04/swig_intro.tar.gz'>here</a>.</p>
<p>We&#8217;ll start out with the obligatory hello world program just to test that SWIG is set up correctly. First make a C function that prints the text and name it <code>hello.c</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include&lt;stdio.h&gt;</span>
&nbsp;
<span style="color: #993333;">void</span> hello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Hello, World!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now we&#8217;ll get SWIG to generate a wrapper for us so that we can call it in Python. Make a file called hello.i and put this in it (my code highlighting isn&#8217;t feeling very confident about SWIG files, sorry):</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">%</span>module hello
<span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">void</span> hello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">%</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>This file is the interface file, and it tells SWIG what functions and data structures are going to be shared between C and Python. Now we&#8217;ll have SWIG process the interface file to make a wrapper for a python module:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ swig <span style="color: #660033;">-python</span> hello.i</pre></div></div>

<p>This should generate two files: <code>hello.py</code> and <code>hello_wrap.c</code>. Compile the C files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-c</span> <span style="color: #660033;">-fPIC</span> hello_wrap.c hello.c -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>python3.0 -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>python3.0</pre></div></div>

<p>Make sure that the direcotories are correct. Unfortunately, gcc generates a warning when I compile, which is bothersome as I&#8217;m a <code>-Werror</code> kind of guy. The <code>-fPIC</code> flag is necessary, because we&#8217;re making a shared library the python module is going to use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ld</span> <span style="color: #660033;">-shared</span> hello.o hello_wrap.o <span style="color: #660033;">-o</span> _hello.so</pre></div></div>

<p>If that works, you are ready to fire up Python and try it. At a Python3 prompt:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">from</span> hello <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> hello<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
Hello, World<span style="color: #66cc66;">!</span></pre></div></div>

<p>Easy, right? Now I&#8217;ll show you some of the features that I most frequently use. First, we&#8217;ll pass some data through by wrapping a C function to multiply integers. Make a file called <code>swig_intro.h</code>, and put in the following declaration:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include&lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include&lt;stdio.h&gt;</span>
&nbsp;
<span style="color: #993333;">int</span> mult<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Then in <code>swig_intro.c</code> we can write</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &quot;swig_intro.h&quot;</span>
&nbsp;
<span style="color: #993333;">int</span> mult<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> a <span style="color: #339933;">*</span> b<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Finally, the interface file, <code>swig_intro.i</code>, will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">%</span>module swig_intro
<span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>
    <span style="color: #339933;">#include &quot;swig_intro.h&quot;</span>
<span style="color: #339933;">%</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> mult<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To make things easier, let&#8217;s write a makefile for this little project:</p>

<div class="wp_syntax"><div class="code"><pre class="make" style="font-family:monospace;">TARGET     <span style="color: #004400;">=</span> swig_intro
CC         <span style="color: #004400;">=</span> gcc
CFLAGS     <span style="color: #004400;">=</span> <span style="color: #004400;">-</span>g <span style="color: #004400;">-</span>fPIC <span style="color: #004400;">-</span>Wall <span style="color: #004400;">-</span>Wextra
HEADERS    <span style="color: #004400;">=</span> swig_intro<span style="color: #004400;">.</span>h
SRCS       <span style="color: #004400;">=</span> swig_intro<span style="color: #004400;">.</span>c
INCLUDES   <span style="color: #004400;">=</span>
INTERFACE  <span style="color: #004400;">=</span> swig_intro<span style="color: #004400;">.</span>i
SWIG       <span style="color: #004400;">=</span> swig
&nbsp;
LDSHARED   <span style="color: #004400;">=</span> ld
CSHARED    <span style="color: #004400;">=</span> <span style="color: #004400;">-</span>shared
&nbsp;
OBJS       <span style="color: #004400;">=</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span>SRCS<span style="color: #004400;">:.</span>c<span style="color: #004400;">=.</span>o<span style="color: #004400;">&#41;</span>
&nbsp;
IWRAP      <span style="color: #004400;">=</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span>INTERFACE<span style="color: #004400;">:.</span>i<span style="color: #004400;">=</span>_wrap<span style="color: #004400;">.</span>i<span style="color: #004400;">&#41;</span>
ISRCS      <span style="color: #004400;">=</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span>IWRAP<span style="color: #004400;">:.</span>i<span style="color: #004400;">=.</span>c<span style="color: #004400;">&#41;</span>
IOBJS      <span style="color: #004400;">=</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span>IWRAP<span style="color: #004400;">:.</span>i<span style="color: #004400;">=.</span>o<span style="color: #004400;">&#41;</span>
&nbsp;
PYTHON_INCLUDE<span style="color: #004400;">=</span> <span style="color: #004400;">-</span>I<span style="color: #004400;">/</span>usr<span style="color: #004400;">/</span><span style="color: #666622; font-weight: bold;">include</span><span style="color: #004400;">/</span>python3<span style="color: #004400;">.</span>0 <span style="color: #004400;">-</span>I<span style="color: #004400;">/</span>usr<span style="color: #004400;">/</span>lib<span style="color: #004400;">/</span>python3<span style="color: #004400;">.</span>0
PYTHON_SO     <span style="color: #004400;">=</span> <span style="color: #004400;">.</span>so
&nbsp;
all<span style="color: #004400;">:</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">SRCS</span><span style="color: #004400;">&#41;</span>
	<span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">SWIG</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">-</span>python <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">INTERFACE</span><span style="color: #004400;">&#41;</span>
	<span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">CC</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">-</span>c <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">CCSHARED</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">CFLAGS</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">ISRCS</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">HEADERS</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">SRCS</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">INCLUDES</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">PYTHON_INCLUDE</span><span style="color: #004400;">&#41;</span>
	<span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">LDSHARED</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">CSHARED</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">OBJS</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">IOBJS</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">-</span>o _<span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">TARGET</span><span style="color: #004400;">&#41;</span><span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">PYTHON_SO</span><span style="color: #004400;">&#41;</span>
&nbsp;
clean<span style="color: #004400;">:</span>
	rm <span style="color: #004400;">-</span>f <span style="color: #004400;">*</span>_wrap<span style="color: #004400;">*</span> <span style="color: #004400;">*</span>~ <span style="color: #004400;">.</span>~<span style="color: #004400;">*</span> <span style="color: #004400;">*.</span>pyc
	rm <span style="color: #004400;">-</span>f <span style="color: #004400;">*.</span>o <span style="color: #004400;">*.</span>so <span style="color: #004400;">*.</span>so</pre></div></div>

<p>If that works, you can launch a Python3 shell (from now on I&#8217;ll assume you do the import first):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">from</span> swig_intro <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> mult<span style="color: black;">&#40;</span>-<span style="color: #ff4500;">10</span>, <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
-<span style="color: #ff4500;">50</span></pre></div></div>

<p>Behind the scenes, SWIG uses something called typemaps to specify how each type is from Python to C and vice versa. In many cases, such as this, we don&#8217;t need to worry about that at all, because SWIG has default typemaps for all the fundamental datatypes. For example, you might wonder what SWIG does with a C struct. Go ahead and add this definition to the header file and the interface file:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> Person <span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>first_name<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>last_name<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> birth_year<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> Person<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">void</span> print_person<span style="color: #009900;">&#40;</span>Person <span style="color: #339933;">*</span>p<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>and put the following function into the <code>.c</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">void</span> print_person<span style="color: #009900;">&#40;</span>Person <span style="color: #339933;">*</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>p<span style="color: #339933;">-&gt;</span>first_name <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>p<span style="color: #339933;">-&gt;</span>last_name<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;The person is not properly defined.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s %s was born in %d.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> p<span style="color: #339933;">-&gt;</span>first_name<span style="color: #339933;">,</span> p<span style="color: #339933;">-&gt;</span>last_name<span style="color: #339933;">,</span> p<span style="color: #339933;">-&gt;</span>birth_year<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now recompile and try this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> p = Person<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> p.<span style="color: black;">first_name</span> = <span style="color: #483d8b;">&quot;Paul&quot;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> p.<span style="color: black;">last_name</span> = <span style="color: #483d8b;">&quot;Black&quot;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> p.<span style="color: black;">birth_year</span> = <span style="color: #ff4500;">1977</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> print_person<span style="color: black;">&#40;</span>p<span style="color: black;">&#41;</span>
Paul Black was born <span style="color: #ff7700;font-weight:bold;">in</span> 1977.</pre></div></div>

<p>As you can see, the the struct Person was wrapped in a very simple Python class with the three public data fields <code>first_name</code>, <code>last_name</code>, and <code>birth_year</code>.</p>
<p>Next, let&#8217;s see how to use typemaps ourselves to pass a more complex structure from Python to C. We&#8217;re going to make a (rather contrived) C function that will return the product of a list of integers. We&#8217;ll do this by turning a Python list into a C struct that specifies an int array and a size. Add the following code to the header and interface files:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">struct</span> IntList <span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> size<span style="color: #339933;">;</span>
    <span style="color: #993333;">long</span> <span style="color: #339933;">*</span>list<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> IntList<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span> product<span style="color: #009900;">&#40;</span>IntList <span style="color: #339933;">*</span>l<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In the <code>.c</code> file, add the function:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> product<span style="color: #009900;">&#40;</span>IntList <span style="color: #339933;">*</span>l<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>l<span style="color: #339933;">-&gt;</span>size <span style="color: #339933;">&lt;=</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #993333;">int</span> ret_val <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i size<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ret_val <span style="color: #339933;">*=</span> l<span style="color: #339933;">-&gt;</span>list<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> ret_val<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now we need to define the typemap in the <code>.i</code> file. This isn&#8217;t too difficult; we just make use of several functions from the Python C API:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">%</span>typemap<span style="color: #009900;">&#40;</span>in<span style="color: #009900;">&#41;</span> IntList <span style="color: #339933;">*</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>PyList_Check<span style="color: #009900;">&#40;</span>$input<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        PyErr_SetString<span style="color: #009900;">&#40;</span>PyExc_TypeError<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Not a list.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> NULL<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #993333;">int</span> size <span style="color: #339933;">=</span> PyList_Size<span style="color: #009900;">&#40;</span>$input<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #0000dd;">1</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>IntList <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>malloc<span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>IntList<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">long</span> <span style="color: #339933;">*</span>list <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>malloc<span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #0000dd;">1</span><span style="color: #339933;">-&gt;</span>list <span style="color: #339933;">=</span> list<span style="color: #339933;">;</span>
    $<span style="color: #0000dd;">1</span><span style="color: #339933;">-&gt;</span>size <span style="color: #339933;">=</span> size<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> size<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        PyObject <span style="color: #339933;">*</span>item <span style="color: #339933;">=</span> PyList_GetItem<span style="color: #009900;">&#40;</span>$input<span style="color: #339933;">,</span> i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>PyInt_Check<span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            PyErr_SetString<span style="color: #009900;">&#40;</span>PyExc_TypeError<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;List item is not an integer.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            free<span style="color: #009900;">&#40;</span>list<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            free<span style="color: #009900;">&#40;</span>$<span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> NULL<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        list<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> PyInt_AsLong<span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">%</span>typemap<span style="color: #009900;">&#40;</span>freearg<span style="color: #009900;">&#41;</span> IntList <span style="color: #339933;">*</span> <span style="color: #009900;">&#123;</span>
    free<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>IntList <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$<span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>list<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>IntList <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$<span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This also illustrates how to tell SWIG to free your objects and how to handle errors. Now we can see it in action:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">from</span> swig_intro <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> product<span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
Traceback <span style="color: black;">&#40;</span>most recent call last<span style="color: black;">&#41;</span>:
  File <span style="color: #483d8b;">&quot;&lt;stdin&gt;&quot;</span>, line <span style="color: #ff4500;">1</span>, <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #66cc66;">&lt;</span>module<span style="color: #66cc66;">&gt;</span>
<span style="color: #008000;">TypeError</span>: Not a <span style="color: #008000;">list</span>.
<span style="color: #66cc66;">&gt;&gt;&gt;</span> product<span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;five&quot;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
Traceback <span style="color: black;">&#40;</span>most recent call last<span style="color: black;">&#41;</span>:
  File <span style="color: #483d8b;">&quot;&lt;stdin&gt;&quot;</span>, line <span style="color: #ff4500;">1</span>, <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #66cc66;">&lt;</span>module<span style="color: #66cc66;">&gt;</span>
<span style="color: #008000;">TypeError</span>: List item <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> an integer.
<span style="color: #66cc66;">&gt;&gt;&gt;</span> product<span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">3</span>,<span style="color: #ff4500;">5</span>,<span style="color: #ff4500;">7</span>,<span style="color: #ff4500;">9</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
<span style="color: #ff4500;">945</span></pre></div></div>

<p>As you would expect, transferring data the other way is similar. For an example, let&#8217;s make a function that takes a list and returns a dictionary mapping the list elements to their squares. Add these definitions to the header and interface files:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">struct</span> IntMap <span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> size<span style="color: #339933;">;</span>
    <span style="color: #993333;">long</span> <span style="color: #339933;">*</span>list1<span style="color: #339933;">;</span>
    <span style="color: #993333;">long</span> <span style="color: #339933;">*</span>list2<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> IntMap<span style="color: #339933;">;</span>
&nbsp;
IntMap <span style="color: #339933;">*</span>square<span style="color: #009900;">&#40;</span>IntList <span style="color: #339933;">*</span>l<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The actual C function will take a pointer to an <code>IntList</code> and return a pointer to an <code>IntMap</code>, allocating space for a second list as needed. The conversion to a <code>dict</code> will be specified with an out typemap. In the <code>.c</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">IntMap <span style="color: #339933;">*</span>square<span style="color: #009900;">&#40;</span>IntList <span style="color: #339933;">*</span>l<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    IntMap <span style="color: #339933;">*</span>ret_map <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>IntMap <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>malloc<span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>IntMap<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ret_map<span style="color: #339933;">-&gt;</span>size <span style="color: #339933;">=</span> l<span style="color: #339933;">-&gt;</span>size<span style="color: #339933;">;</span>
    ret_map<span style="color: #339933;">-&gt;</span>list1 <span style="color: #339933;">=</span> l<span style="color: #339933;">-&gt;</span>list<span style="color: #339933;">;</span>
    ret_map<span style="color: #339933;">-&gt;</span>list2 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>malloc<span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">long</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> l<span style="color: #339933;">-&gt;</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i size<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ret_map<span style="color: #339933;">-&gt;</span>list2<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> l<span style="color: #339933;">-&gt;</span>list<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> l<span style="color: #339933;">-&gt;</span>list<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> ret_map<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Add the typemap to the <code>.i</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">%</span>typemap<span style="color: #009900;">&#40;</span>out<span style="color: #009900;">&#41;</span> IntMap <span style="color: #339933;">*</span> <span style="color: #009900;">&#123;</span>
    $result <span style="color: #339933;">=</span> PyDict_New<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i size<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        PyObject <span style="color: #339933;">*</span>key <span style="color: #339933;">=</span> PyInt_FromLong<span style="color: #009900;">&#40;</span>$<span style="color: #0000dd;">1</span><span style="color: #339933;">-&gt;</span>list1<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        PyObject <span style="color: #339933;">*</span>val <span style="color: #339933;">=</span> PyInt_FromLong<span style="color: #009900;">&#40;</span>$<span style="color: #0000dd;">1</span><span style="color: #339933;">-&gt;</span>list2<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        PyDict_SetItem<span style="color: #009900;">&#40;</span>$result<span style="color: #339933;">,</span> key<span style="color: #339933;">,</span> val<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">%</span>typemap<span style="color: #009900;">&#40;</span>freearg<span style="color: #009900;">&#41;</span> IntMap <span style="color: #339933;">*</span> <span style="color: #009900;">&#123;</span>
    free<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>IntMap <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$<span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>list2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>IntMap <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$<span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And we&#8217;re done!</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> square<span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>,-<span style="color: #ff4500;">12</span>,<span style="color: #ff4500;">60000</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
<span style="color: black;">&#123;</span><span style="color: #ff4500;">60000</span>: <span style="color: #ff4500;">3600000000</span>, <span style="color: #ff4500;">1</span>: <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">12</span>: <span style="color: #ff4500;">144</span><span style="color: black;">&#125;</span></pre></div></div>

<p>I&#8217;ve only shown some of the more useful capabilities of SWIG that I find myself using a lot. For more information, consult the official <a href="http://www.swig.org/Doc1.3/Python.html">SWIG docs</a>. Unfortunately, they&#8217;re not entirely complete, so it is sometime easier to get answers by just browsing the built-in SWIG interface files to see how the typemaps work.</p>
]]></content:encoded>
			<wfw:commentRss>http://ctrl-c.us/blog/archives/99/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>64-bit Flash Player!</title>
		<link>http://ctrl-c.us/blog/archives/92</link>
		<comments>http://ctrl-c.us/blog/archives/92#comments</comments>
		<pubDate>Mon, 17 Nov 2008 06:47:39 +0000</pubDate>
		<dc:creator>Caleb Spare</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://ctrl-c.us/?p=92</guid>
		<description><![CDATA[Today Adobe is releasing an alpha version of a 64-bit Flash player for Linux. I cannot explain how happy this makes me. I have been dealing with shitty 32-bit Flash players running on 32-bit emulation in 64-bit browsers in Linux for about the past five years, and it has caused me nothing but endless annoyance [...]]]></description>
			<content:encoded><![CDATA[<p>Today <a title="Press release" href="http://news.cnet.com/8301-1001_3-10097931-92.html" target="_blank">Adobe is releasing an alpha version of a 64-bit Flash player for Linux</a>. I cannot explain how happy this makes me. I have been dealing with shitty 32-bit Flash players running on 32-bit emulation in 64-bit browsers in Linux for about the past five years, and it has caused me nothing but endless annoyance and frustration. Half the time I have to refresh a page a few times because Flash keeps dying, and even when it manages to play it&#8217;s a complete coin toss as to whether there will be sound. With my current setup I basically have to close Amarok to play a Flash video if I want to hear sound. Adobe is years late to the party with this one, but better late than never, right?</p>
]]></content:encoded>
			<wfw:commentRss>http://ctrl-c.us/blog/archives/92/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Seven Document Formats Worse than Scribd</title>
		<link>http://ctrl-c.us/blog/archives/83</link>
		<comments>http://ctrl-c.us/blog/archives/83#comments</comments>
		<pubDate>Fri, 31 Oct 2008 07:05:13 +0000</pubDate>
		<dc:creator>Caleb Spare</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://ctrl-c.us/?p=83</guid>
		<description><![CDATA[The other day while searching for some LaTeX information I came across this page on Scribd, and I was reminded once again how much I loathe this website. If you aren&#8217;t familiar with it, Scribd is a site which hosts various books, articles, and other documents. For reasons that are an impenetrable mystery to me, [...]]]></description>
			<content:encoded><![CDATA[<p>The other day while searching for some LaTeX information I came across <a title="Latex symbols reference on Scribd" href="http://www.scribd.com/doc/2287516/latex-symbols-reference" target="_blank">this page</a> on <a title="Scribd" href="http://www.scribd.com/" target="_blank">Scribd</a>, and I was reminded once again how much I loathe this website. If you aren&#8217;t familiar with it, Scribd is a site which hosts various books, articles, and other documents. For reasons that are an impenetrable mystery to me, these people have decided that the way to bring together potentially many different formats of print media is to turn them all into shockwave flash. As in, this beautifully typeset LaTeX document, compiled to PDF, was turned into a scrollable flash…thing. Combine this with the rather sorry state of flash on Linux, and you get just about my least favorite website on the entire intertubes. Just getting it in a Google search makes me almost as mad as getting a link to <a title="Experts Exchange" href="http://www.experts-exchange.com/" target="_blank">Experts Exchange</a>.</p>
<p>So, to keep my blood pressure down, I put things into perspective for myself by making a list of seven document formats Scribd <em>could </em>have chosen to use, but didn&#8217;t.</p>
<p><span id="more-83"></span></p>
<ol>
<li>Upon request, print the document out and mail it to the users, preferably from a distribution center somewhere in Africa.</li>
<li>Put each word from the document in a Web 2.0-esque cloud visualization where the size of each tag reflects the relative frequency of the word&#8217;s occurrence.</li>
<li>Save the document as a series of images. Upload these to Facebook. When a user requests the document, tag the user in all of those pictures so that he/she can view them.</li>
<li>Offer RealPlayer streaming videos of somebody slowly scrolling through the document.</li>
<li>Record someone reading the document, set it to soothing piano music with a psychedelic visualization, and submit it to YouTube in a series of 10-minute segments.</li>
<li>Ask the user for his/her phone number. Split the document into 140-byte chunks and send them sequentially as SMS messages.</li>
<li>Write out the document in 1:1000 scale on the ground using large rocks. Then provide links to the appropriate Google Map coordinates.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://ctrl-c.us/blog/archives/83/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
