<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" 
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" 
   xmlns:html="http://www.w3.org/1999/html" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
   <title>internal fragmentation</title>
   <link>http://www.selenic.com/blog</link>
   <description>a personal journal of hacking, science, and technology</description>
   <language>en</language>
   <copyright>Copyright 2009 Matt Mackall</copyright>
   <ttl>60</ttl>
   <pubDate>Wed, 11 Nov 2009 19:47 GMT</pubDate>
   <managingEditor>mpm@selenic.com</managingEditor>
   <generator>PyBlosxom http://pyblosxom.sourceforge.net/ 1.3.2 2/13/2006</generator>
<item>
   <title>Gnote vs Tomboy memory showdown with smem</title>
   <guid isPermaLink="false">gnote-vs-tomboy</guid>
   <link>http://www.selenic.com/blog/gnote-vs-tomboy.html</link>
   <description><![CDATA[

<p>As an illustration of my recent release of <a
href="http://selenic.com/smem">smem 0.9</a>, here's how Gnome desktop
rivals <a href="http://live.gnome.org/Gnote">Gnote</a> and <a
href="http://projects.gnome.org/tomboy/">Tomboy</a> compare on memory
usage.</p>

<p>Methodology: take a normal GNOME desktop and add either Gnote or
Tomboy to a panel. Restart X, open a single terminal window, take a
process size measurement, open up the "Search All Notes" window, take
another process size measurement, then measure libary sizes.</p>

<p>Here's what the output for a freshly-started Gnote looks like:</p>

<pre>
# smem -P gnot*e -t
  PID User     Command                         Swap      USS      PSS      RSS 
 8552 mpm      /usr/bin/gnote --panel-appl        0    13652    14915    23896 
-------------------------------------------------------------------------------
   87 1                                           0    13652    14915    23896 
</pre>

<p>'RSS' (resident set size) is the measure reported by most tools,
and shows 23.8MiB of memory usage by Gnote. But that number is
misleading as it counts all the memory used by numerous shared
libraries (Gnote uses about 170 shared mappings). In fact, most developers (rightly)
ignore this number as meaningless and (not so rightly) assume that the
bulk of memory usage is shared. </p>

<p>
If we compare
running Gnote and not running Gnote, we'll see a much smaller
difference in memory usage. In fact, the difference we'll see is in
the table above as 'USS' (unique set size). There's 13.6MiB of memory
that's used <i>only</i> by Gnote. The remaining 10.2MiB is shared with
other applications. 'PSS' (proportional set size) accounts for that
difference by dividing up shared ownership of libraries on a page by
page basis. If you add up the PSS of all the processes on the system,
they will sum to the total (userspace) memory usage.</p>

<p>So, Gnote's real share of memory is <b>14.9MiB</b>, once sharing is
 accounted for. Fairly expensive for having only drawn a 32x32 icon so
 far. Hell, that's fairly expensive for a full-featured GUI
 environment and wordprocessor by mid-'90s standards, but I
 digress.</p>

<p>Now let's look at a freshly-started Tomboy:</p>

<pre>
# smem -P tom*boy -t
  PID User     Command                         Swap      USS      PSS      RSS 
 7873 mpm      bash /usr/bin/tomboy-panel         0      464      652     1612 
 7885 mpm      mono /usr/lib/tomboy/Tomboy        0    21732    22618    31116 
-------------------------------------------------------------------------------
   89 1                                           0    22196    23270    32728 
</pre>

<p>First note that Tomboy here is getting launched by an extra
persistent copy of bash that chews up an extra 652KiB of memory. But
the numbers for the main process are all larger also (by about 8MiB,
7.7MiB, and 7.2MiB respectively). 6.9MiB of that is 21 Mono libraries
that are only used by Tomboy (at least on my desktop):
</p>

<pre>
$ smem -m -M mono -t
Map                                       PIDs   AVGPSS      PSS 
/dev/shm/mono.9295                           1        4        4 
/usr/lib/mono/gac/NDesk.DBus.GLib/1.0.0.     1        8        8 
/usr/lib/mono/gac/gconf-sharp/2.24.0.0__     1       12       12 
/usr/lib/mono/gac/gnome-panel-sharp/2.24     1       16       16 
/usr/lib/mono/gtk-sharp-2.0/libglibsharp     1       16       16 
/usr/lib/mono/gtk-sharp-2.0/libgdksharpg     1       24       24 
/usr/lib/mono/gac/gmime-sharp/2.2.0.0__2     1       48       48 
/usr/lib/mono/gac/atk-sharp/2.12.0.0__35     1       56       56 
/usr/lib/mono/gac/pango-sharp/2.12.0.0__     1       60       60 
/usr/lib/mono/gac/NDesk.DBus/1.0.0.0__f6     1       72       72 
/usr/lib/mono/gac/glib-sharp/2.12.0.0__3     1       84       84 
/usr/lib/mono/gtk-sharp-2.0/libgtksharpg     1       92       92 
/usr/lib/mono/gac/gnome-sharp/2.24.0.0__     1      140      140 
/usr/lib/mono/gac/Mono.Posix/2.0.0.0__07     1      172      172 
/usr/lib/mono/gac/Mono.Addins/0.4.0.0__0     1      180      180 
/usr/lib/mono/gac/gdk-sharp/2.12.0.0__35     1      180      180 
/usr/lib/mono/gac/System/2.0.0.0__b77a5c     1      644      644 
/usr/lib/mono/gac/System.Xml/2.0.0.0__b7     1      652      652 
/usr/lib/mono/gac/gtk-sharp/2.12.0.0__35     1     1116     1116 
/usr/bin/mono                                1     1648     1648 
/usr/lib/mono/2.0/mscorlib.dll               1     1660     1660 
-----------------------------------------------------------------
21                                          21     6884     6884 
</pre>

Here's the PSS numbers including firing up search:

<table>
<tr><td>Tool</td><td>Startup</td><td>Search</td></tr>
<tr><td>Gnote</td><td>14915</td><td>16929</td></tr>
<tr><td>Tomboy</td><td>23270</td><td>27197</td></tr>
<table>

<p>
Conclusion? They're both hopeless bloated, but Tomboy considerably
more so. Next up: gweather, which takes 5MiB to tell me I should be
outside enjoying the sunshine.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Wed, 11 Nov 2009 19:47 GMT</pubDate>
</item>
<item>
   <title>Dogs and SUVs</title>
   <guid isPermaLink="false">dogs-and-suvs</guid>
   <link>http://www.selenic.com/blog/dogs-and-suvs.html</link>
   <description><![CDATA[

<p>There's a <a
href="http://www.amazon.co.uk/Time-Eat-Dog-Sustainable-Living/dp/0500287902">new
book out</a> by <a
href="http://en.wikipedia.org/wiki/Brenda_and_Robert_Vale">a pair of
architects</a> that's triggering a lot of clueless pop science news
articles with their claim that the ecological impact of a dog is
higher than an SUV.</p>

<p>But none of their methodology actually stands up to any scrutiny <a
href="http://daily.sightline.org/daily_score/archive/2009/11/02/dogs-vs-cars">(never
mind their numbers)</a>. Their argument is that feeding a dog
(as measured in calories) requires more hectares of land to sustain
than an SUV (as measured in joules). By looking at the amount of land
theoretically required to produce x calories of food and comparing
that to the amount of land to theoretically produce y joules of
energy, they arrive at a ratio. Simple enough?</p>

<p>The basic problem is that oversimplified theory and practice don't
agree. First, most dogs' diets consist almost entirely of food that
would otherwise be waste product, as it's not fit for human
consumption. So taking a measure for land productivity for human food
production and using that as a proxy for a dog's eco-footprint is
basically meaningless. Their actual food impact is so small it's hard
to measure. Also note that dogs are "built" from renewable materials
with very low upfront energy costs.</p>

<p>In contrast, SUVs aren't built from renewable materials and don't
run on renewable fuels so their footprint can't be measured. There are
no solar-powered SUVs and the energy efficiency of biodiesel is
extremely low (and thought to be negative in many cases). And if we
started running all the SUVs in the world on today's biodiesel, there
would be no land left to grow food (there are already <a
href="http://www.businessandmedia.org/articles/2008/20080411174526.aspx">food
riots</a> being caused by ethanol demand). So the effective
eco-footprint of an SUV is tremendously higher than the theoretical
fraction of a hectares per year they quote.</p>

<p>Compare these two meaningless numbers and you get a result that is
orders of magnitude out of touch with reality. If your instinct tells you that
a 15kg dog chasing a ball around the yard and basking in the sun uses less
of the world's resources than an 2500kg SUV roaring down a freeway or sitting
in traffic, you're right.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Sat, 07 Nov 2009 02:08 GMT</pubDate>
</item>
<item>
   <title>1.4 release plans</title>
   <guid isPermaLink="false">1.4-release-plans</guid>
   <link>http://www.selenic.com/blog/1.4-release-plans.html</link>
   <description><![CDATA[

<p>Spoke with our legal counsel from <a
href="http://www.softwarefreedom.org/">SFLC</a> this morning and
determined that we should probably not hold up the release process any
further. So the 1.4 feature freeze will be this Saturday, followed by
a release on November 16th. This release will still be under the old
GPLv2 only license, but <i>will</i> have SVN conversion support enabled.</p>

<p>The <a
href="http://mercurial.selenic.com/wiki/Relicensing">relicensing
process</a> is mostly about having all our ducks in a row to make
distributors and co-developers happy. We're 98% done, but the end game
is hard due to people that can't be located. I expect we'll have this
wrapped up in time for the 1.5 release on March 1st.</p>

<p>The best way to help make the 1.4 release a success is of course to
run the latest development version from the <a
href="http://selenic.com/hg">main repository</a> and report any
problems you encounter. There are also <a
href="http://bitbucket.org/tortoisehg/thg-winbuild/downloads/">nightly
builds</a> available for Windows users. We generally keep our
development tip end-user ready at all times (and do all our own day to
day work with it), so testing tip is pretty safe.</p>


]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Wed, 04 Nov 2009 19:20 GMT</pubDate>
</item>
<item>
   <title>Mercurial 1.4 delayed</title>
   <guid isPermaLink="false">1.4-delayed</guid>
   <link>http://www.selenic.com/blog/1.4-delayed.html</link>
   <description><![CDATA[

<p> I spent most of October arguing with people about licenses,
talking with lawyers, and tracking down contributors for <a
href="http://mercurial.selenic.com/wiki/Relicensing">our big
relicensing effort</a> but we haven't quite finished yet so I'm
letting our scheduled Nov 1st date slide. If it's not sorted out in a
couple weeks, we'll cut a release anyway.<p>

<p>A lot of the work that I hoped would happen for 1.4 didn't get
done, but we've been getting a steady stream of nice usability
improvements. The one I'm most excited about is the new summary
command, which combines the output of a bunch of commands in one
place, giving you a quick view of what's going on in your repo:</p>

<pre>
$ hg sum --remote
parent: 9665:1de5ebfa5585 tip
 walkchangerevs: drop ui arg
branch: default
commit: 15 unknown (clean)
update: (current)
remote: 1 or more incoming
</pre>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Tue, 03 Nov 2009 21:25 GMT</pubDate>
</item>
<item>
   <title>Twittering</title>
   <guid isPermaLink="false">twittering</guid>
   <link>http://www.selenic.com/blog/twittering.html</link>
   <description><![CDATA[

<p>You can follow me at <a
href="http://twitter.com/mpmselenic">mpmselenic</a>.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Tue, 03 Nov 2009 19:45 GMT</pubDate>
</item>
<item>
   <title>It's time to use SI prefixes</title>
   <guid isPermaLink="false">its-time-to-use-si-prefixes</guid>
   <link>http://www.selenic.com/blog/its-time-to-use-si-prefixes.html</link>
   <description><![CDATA[

<p>There's some <a
href="http://hackaday.com/2009/09/01/snow-leopard-ditches-real-math-for-fake/">fuss
being made</a> over OS X 10.6 using units derived from powers of 10
rather than powers of 2 to report drive size.
But I think it's high time we joined the rest of technical world in the
20th century and adopted the metric system.</p>

<p>First off, note that there are hundreds, probably thousands of
technical domains where the kilo prefix means 1000. Even in the domain
of computer science, it is <i>usually</i> assumed to mean 1000.
Consider: megahertz, kilobaud, gigabit, megapixel, MIPS, gigaflops. In
fact, the only place where power of two nomenclature can be taken for
granted is in the size of memory devices, where the wiring of address
lines dictate that only powers of two are possible. Claiming that disk
sizes should be measured the same as RAM is invoking a false
consistency: RAM is the odd one out and always has been.</p>

<p>Further, there's essentially no reason for anyone but electrical
engineers and kernel developers directly concerned with the geometry
of RAM to have any exposure to the powers of two issue at all. No one
writing a web app should care, no one writing a word processor should
care, and certainly no one <i>using</i> a word processor should have
to care. For the vast majority of computer users there is no upside to
measuring things in units of 1024, only confusion.</p>


]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Tue, 01 Sep 2009 20:55 GMT</pubDate>
</item>
<item>
   <title>Mercurial 1.3.1 released</title>
   <guid isPermaLink="false">mercurial/1.3.1</guid>
   <link>http://www.selenic.com/blog/mercurial/1.3.1.html</link>
   <description><![CDATA[

<p>Finally pushed a <a
href="http://mercurial.selenic.com/wiki/WhatsNew">.1 release</a> out
the door. We had a surprising number of performance regressions
related to the cleanups in 1.3, so everyone is encouraged to upgrade.
</p>

<p>In the future, we're going to have to find a way to get more real
users on big projects to test pre-release code, which means: easily
available nightly builds.</p>


]]></description>
   <category domain="http://www.selenic.com/blog">/mercurial</category>
   <pubDate>Thu, 23 Jul 2009 20:09 GMT</pubDate>
</item>
<item>
   <title>Mercurial 1.3 released!</title>
   <guid isPermaLink="false">mercurial/1.3</guid>
   <link>http://www.selenic.com/blog/mercurial/1.3.html</link>
   <description><![CDATA[

<p>In keeping with our <a
href="http://mercurial.selenic.com/wiki/TimeBasedReleasePlan">time-based
release plan</a>, Mercurial 1.3 is out the door. I'm pretty pleased
with it.</p>

<p>Exciting things in the queue for 1.4 including an improved wire
protocol and possibly a new hashing algorithm. And hopefully support
for a couple non-native subrepository types.</p>

]]></description>
   <category domain="http://www.selenic.com/blog">/mercurial</category>
   <pubDate>Wed, 01 Jul 2009 22:59 GMT</pubDate>
</item>
<item>
   <title>Walter Gordon Heffron</title>
   <guid isPermaLink="false">gordon-heffron</guid>
   <link>http://www.selenic.com/blog/gordon-heffron.html</link>
   <description><![CDATA[

<p>My grandfather passed away earlier today. Thinking back,
it amazes me the degree to which he set the foundation for my
later pursuits and hobbies: astronomy, physics, mathematics, electronics,
computing.<p>

<p>He was a researcher for many decades at Bell Labs. He was
intimately involved with the <a
href='http://ntrs.nasa.gov/search.jsp?Ns=HarvestDate|1&N=4294946533'>Apollo
program</a>, not to mention countless other efforts ranging from sonar
to the invention of videoconferencing. He was there for the invention
of the transistor.</p>

<p>He was colorblind (a trait he passed to me), but memorized the
colorblindness eye charts in attempt to qualify for the astronaut
program. He taught me the names of the constellations. And he took me
to see Star Wars in the theater.</p>

<p>He also introduced me to Unix via a home-built VT52 terminal that
dialed into a server at Bell Labs, the birthplace of Unix. I spent
countless hours exploring; I retrieved the <a
href='http://users.tkk.fi/eye/roguelike/rogue.html'>Amulet of
Yendor</a> at age 7. Not long after that, he sent me a first edition
copy of <a
href='http://en.wikipedia.org/wiki/The_C_Programming_Language'><i>The
C Programming Language</i></a>, also created by his coworkers. I
quickly read it cover to cover, despite having no access to a C
compiler. Thirty years later, I'm hacking the Linux kernel in C.<p>

<p>I saw him for the last time a couple weeks ago. I showed him the
bash shell prompt on my GPhone, a machine thousands of times more
capable and portable than the machines he introduced me to, and
running a version of Unix I'd helped develop.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Wed, 01 Jul 2009 03:09 GMT</pubDate>
</item>
<item>
   <title>Coming Soon!</title>
   <guid isPermaLink="false">mercurial/definitive-guide-printed</guid>
   <link>http://www.selenic.com/blog/mercurial/definitive-guide-printed.html</link>
   <description><![CDATA[

<p>Looks like <a
href="http://www.amazon.com/Mercurial-Definitive-Guide-Bryan-OSullivan/dp/0596800673/ref=pd_bxgy_b_img_a"><i>Mercurial:
The Definitive Guide</i></a> has finally <a
href="http://www.tweetphoto.com/544177">hit paper.</a> Looks like it's
set to ship to coincide with Mercurial's planned 1.3 release on July
1st.</p> 

]]></description>
   <category domain="http://www.selenic.com/blog">/mercurial</category>
   <pubDate>Thu, 18 Jun 2009 23:55 GMT</pubDate>
</item>
<item>
   <title>Steve Case</title>
   <guid isPermaLink="false">case</guid>
   <link>http://www.selenic.com/blog/case.html</link>
   <description><![CDATA[

<p>Before I caught the free software fever, I spent most of a decade
working on laser and imaging-based measurement. And I had the fortune
of spending that time working with an incredibly talented group at a
small company called CyberOptics. At every place I've worked since,
I've always been a little disappointed that the local talent didn't
quite measure up to their level.</p>

<p>The founder of that company was Steve Case, a professor of optics
turned entrepreneur. Today I learned <a
href="http://www.bizjournals.com/twincities/stories/2009/06/15/daily33.html">he
died in a solo plane crash</a>. He was a good guy.</p>


]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Thu, 18 Jun 2009 07:50 GMT</pubDate>
</item>
<item>
   <title>Mercurial on BigTable</title>
   <guid isPermaLink="false">mercurial/bigtable-talk</guid>
   <link>http://www.selenic.com/blog/mercurial/bigtable-talk.html</link>
   <description><![CDATA[

<p>Also worth mentioning there's now video for the recent Google I/O
talk on <a
href='http://code.google.com/events/io/sessions/MercurialBigTable.html'>adapting
Mercurial to BigTable</a>. A pretty decent introduction to both
Mercurial internals and their BigTable technology (see <a
href='http://wiki.apache.org/hadoop/Hbase'>Hbase</a> from the <a
href="http://hadoop.apache.org/core/">Hadoop</a> project for an open
alternative).</p>

]]></description>
   <category domain="http://www.selenic.com/blog">/mercurial</category>
   <pubDate>Mon, 15 Jun 2009 08:34 GMT</pubDate>
</item>
<item>
   <title>Shared Repos and Subrepositories</title>
   <guid isPermaLink="false">mercurial/sharedandsubrepos</guid>
   <link>http://www.selenic.com/blog/mercurial/sharedandsubrepos.html</link>
   <description><![CDATA[

<p>
With less than a week before Mercurial's 1.3 code freeze, I've pushed
two interesting new features. The first is the <a
href="http://www.selenic.com/mercurial/wiki/ShareExtension">share
extension</a> which can be thought of as an even lighter-weight local
clone. The core support for this has been in place for years now
(since 0.9.2), we'd just never gotten around to making it available as
a command.</p>

<p>Also, Mercurial now has <a
href='http://www.selenic.com/mercurial/wiki/subrepos'>support for
subrepositories</a> which is a way to automatically pull other
projects such as libraries into your working directory as part of a
larger project. Commits made at the top level repository will
recursively record the state of the subrepos, effectively allowing
atomic commits across multiple projects.</p>

<p>I've also managed to design the code in such a way that it should
be quite easy to extend this to support subrepositories from other
systems like SVN or git.</p>


]]></description>
   <category domain="http://www.selenic.com/blog">/mercurial</category>
   <pubDate>Mon, 15 Jun 2009 08:19 GMT</pubDate>
</item>
<item>
   <title>More smem</title>
   <guid isPermaLink="false">smem-article</guid>
   <link>http://www.selenic.com/blog/smem-article.html</link>
   <description><![CDATA[

<p>There's a good summary of my smem tool and presentation at <a href="
http://lwn.net/SubscriberLink/329458/a64cf1cf4e4f1b37/">LWN</a>
today.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Thu, 30 Apr 2009 03:44 GMT</pubDate>
</item>
<item>
   <title>ELC panel write-up</title>
   <guid isPermaLink="false">elc-panel</guid>
   <link>http://www.selenic.com/blog/elc-panel.html</link>
   <description><![CDATA[

<p>LWN has a good write-up of my <a
href="http://lwn.net/Articles/328421/">ELC kernel development
panel</a> comments.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 24 Apr 2009 21:10 GMT</pubDate>
</item>
<item>
   <title>Mercurial for OpenOffice.org and Google Code</title>
   <guid isPermaLink="false">mercurial-adoption</guid>
   <link>http://www.selenic.com/blog/mercurial-adoption.html</link>
   <description><![CDATA[

<p>Yesterday, I heard the OpenOffice.org project is running a <a
href="http://blogs.sun.com/GullFOSS/entry/mercurial_pilot_for_openoffice_org">pilot
program</a> for migrating to Mercurial.</p>

<p>And today I hear Google is adding <a
href="http://google-code-updates.blogspot.com/2009/04/mercurial-support-for-project-hosting.html">Mercurial
support to Google Code</a>. They've apparently implemented a Mercurial storage
backend based on <a
href="http://labs.google.com/papers/bigtable.html">BigTable</a> to
take advantage of their cluster infrastructure.</p>


]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 24 Apr 2009 19:09 GMT</pubDate>
</item>
<item>
   <title>How to go about actually solving a Rubik's Cube</title>
   <guid isPermaLink="false">rubiks-cube</guid>
   <link>http://www.selenic.com/blog/rubiks-cube.html</link>
   <description><![CDATA[

<p>I got my first Rubik's Cube some time around 1980, shortly after
they were released in the US, and spent countless hours trying to
solve it. Eventually, I stumbled on a solution that was satisfactory
for a kid my age: take it apart and put it back together.</p>

<p>Many years passed without me thinking much about the Cube until I
read a paper about computerized searches to find the minimum number of
moves to solve the cube. Not long after, I discovered the <a
href="http://www.youtube.com/watch?v=82wOGWBI3WY">Mirror Cube</a> and
the <a href="http://www.youtube.com/watch?v=pDvcmiuxsNU">Void Cube</a>
and that reawakened some toy lust a mild obsession with actually
properly solving the Cube from scratch.</p>

<p>And late last night, I happened upon a classic Cube at the local
pharmacy.</p>

<p><img src="i/0420cube.jpg"></p>

<p>Here's roughly how I went about solving the cube:</p>

<ul>
<li>Solve the top layer (~1 minute)
<li>Solve the middle layer (~5 minutes)
<li>Solve the bottom layer (~3 hours)
</ul>

<p>The bottom layer is obviously the hard part. My strategy was to
find various patterns of moves that scrambled the bottom while keeping
the top layers intact and figure out how to do useful things with
them. These aren't too tricky to find, but making sense of them is.<p>

<p>This part pretty much requires paper. First, write down a series of
 moves in a useful notation (eg F' for turn front face
 counter-clockwise). Then record the pattern of cubes on the bottom
 before and after applying the sequence. Now it's possible to work out
 what the combination of moves is doing in the abstract. For instance,
 this sequence flips the north and west edges, rotates the northwest
 and southeast corners clockwise, and the southwest corner
 counter-clockwise. </p>

<p>The things that can be wrong with the last face include: edges
rotated, edges out of position, corners rotated, and corners out of
position. Most of the simple patterns will change all of these at
once. But combining sequences (and their mirror images) will let you
cancel out some the unwanted changes in each sequence to narrow in on
the solution.</p>

<hr>

<p>That's one childhood dream down, now to become a writer and an
astronaut.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Mon, 20 Apr 2009 21:23 GMT</pubDate>
</item>
<item>
   <title>Google voice search</title>
   <guid isPermaLink="false">voice-search</guid>
   <link>http://www.selenic.com/blog/voice-search.html</link>
   <description><![CDATA[

<p>
A voice search button just appeared on the main page after the
software update on my G1. Handles things like 'mercurial' and 'salem
witch trial' and 'error 10053' pretty well but interprets 'Matt
Mackall' as 'mathematical'.
</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Thu, 16 Apr 2009 19:09 GMT</pubDate>
</item>
<item>
   <title>smem 0.1</title>
   <guid isPermaLink="false">linux/smem</guid>
   <link>http://www.selenic.com/blog/linux/smem.html</link>
   <description><![CDATA[

<p> Just finished a talk a bit ago at <a
href="http://www.embeddedlinuxconference.com/elc_2009">ELC 2009</a> on
my new <a href="/smem">smem</a> tool, which gives more meaningful
measurements of memory usage of Linux's shared virtual memory system
than the numbers reported by traditional tools like top, ps, free,
etc. My slides are <a href="/smem/download/smem.odp">here</a>.</p>

]]></description>
   <category domain="http://www.selenic.com/blog">/linux</category>
   <pubDate>Wed, 08 Apr 2009 00:44 GMT</pubDate>
</item>
<item>
   <title>BDFL chooses Mercurial?</title>
   <guid isPermaLink="false">mercurial/python-dvcs</guid>
   <link>http://www.selenic.com/blog/mercurial/python-dvcs.html</link>
   <description><![CDATA[

<p>Looks like <a
href="http://en.wikipedia.org/wiki/Guido_van_Rossum">Guido van
Rossum</a>, Python's Benevolent Dictator For Life, has <a
href="http://twitter.com/gvanrossum/status/1418085336">chosen
Mercurial</a> for future Python development. <a
href="http://mail.python.org/pipermail/python-dev/2009-March/087931.html">More
here.</a></p>
 

]]></description>
   <category domain="http://www.selenic.com/blog">/mercurial</category>
   <pubDate>Mon, 30 Mar 2009 16:33 GMT</pubDate>
</item>
<item>
   <title>Forthcoming Mercurial book from O'Reilly</title>
   <guid isPermaLink="false">mercurial/mercurial-the-definitive-guide</guid>
   <link>http://www.selenic.com/blog/mercurial/mercurial-the-definitive-guide.html</link>
   <description><![CDATA[

<p>
<a href="http://www.serpentine.com/blog/">Bryan O'Sullivan</a> has
finally <a
href="http://www.serpentine.com/blog/2009/03/27/mercurial-the-definitive-guide/">announced</a>
that his excellent <a href="http://hgbook.red-bean.com/">Mercurial book</a> has been picked up
by <a href="http://oreilly.com">O'Reilly</a>. Naturally, it will continue to be
available under an open license.</p>

]]></description>
   <category domain="http://www.selenic.com/blog">/mercurial</category>
   <pubDate>Sun, 29 Mar 2009 23:50 GMT</pubDate>
</item>
<item>
   <title>Mercurial dropping Python2.3 support</title>
   <guid isPermaLink="false">python23</guid>
   <link>http://www.selenic.com/blog/python23.html</link>
   <description><![CDATA[

<p>I've just announced that Mercurial will be dropping support for
Python2.3 with our 1.3 release in July. I've been rather reluctant to
do this on the general principle that applications (and programming
languages in particular!) should be stable enough to be usable over, say, 5
years. But it's now gotten to the point where Py2.3 hasn't been available
in Debian for two whole releases (in other words, forever), so I can't
actually test against it without building my own copy of Python.</p>

<p>On the upside, this means we'll get to start using a small handful
of nice features added in Python 2.4. Namely decorators, sorted(), and
generator expressions.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Thu, 26 Mar 2009 14:36 GMT</pubDate>
</item>
<item>
   <title>Kutiman</title>
   <guid isPermaLink="false">0313-kutiman</guid>
   <link>http://www.selenic.com/blog/0313-kutiman.html</link>
   <description><![CDATA[

<p>There's a lot of buzz going around about these videos, but really,
you shouldn't miss them. Especially <a
href="http://www.youtube.com/watch?v=EsBfj6khrG4">this one.</a>
</p>

<p>A quick aside about Linux and Youtube: I've had mixed results with
<a href="http://swfdec.freedesktop.org/">swfdec</a> for in-browser
viewing, so I often use <a
href="http://clive.sourceforge.net/">clive</a> to download videos and
view them outside my browser (and nicely buffered). I find "<a
href="http://www.niksula.hut.fi/~vherva/xsel/">xsel</a> | clive" is
quite handy to grab a link I've copied to the clipboard.</a></p>
 

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 13 Mar 2009 01:38 GMT</pubDate>
</item>
<item>
   <title>MNØPQ4</title>
   <guid isPermaLink="false">puzzle-quest4</guid>
   <link>http://www.selenic.com/blog/puzzle-quest4.html</link>
   <description><![CDATA[

<a href="http://waste.org/mnopq"><img src="http://www.waste.org/mnopq/game4/images/mn0pq4.jpg"></a>

<p>The <a href="http://www.waste.org/mnopq/game3/index.html">Mario
Kartel</a> is pleased to
announce <a href="http://waste.org/mnopq/">Puzzle Quest 4: Your Princess Is In Another Castle</a>.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Thu, 12 Mar 2009 14:55 GMT</pubDate>
</item>
<item>
   <title>Twin Cities Makers</title>
   <guid isPermaLink="false">0312-maker-meeting</guid>
   <link>http://www.selenic.com/blog/0312-maker-meeting.html</link>
   <description><![CDATA[

<p>Dropped in on the first official meeting of the <a
href="http://www.twincitiesmaker.com">Twin Cities Makers</a>. Seems
like a fun group, even if they like to use webforums. Also, it took
about an hour and a half of free-ranging gabble before we actually
settled down to some business.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Thu, 12 Mar 2009 14:40 GMT</pubDate>
</item>
<item>
   <title>Candle Power</title>
   <guid isPermaLink="false">candle-power</guid>
   <link>http://www.selenic.com/blog/candle-power.html</link>
   <description><![CDATA[

<p>My local green-oriented coffee shop has started putting out
candles at dinner time. It struck me as odd that they still
thought burning things for light was green, so I've decided
to do the math on their power efficiency and carbon impact.</p>

<p>A typical votive candle is about 2 ounces of paraffin and
burns for about 15 hours. Its brightness is approximately 1 <a
href="http://en.wikipedia.org/wiki/Candela">candela</a> or 12 <a
href="http://en.wikipedia.org/wiki/Lumen_(unit)">lumens</a> and
consumes power (in the form of paraffin fuel) at a rate of about
40W. That's one or two (or <a href="http://en.wikipedia.org/wiki/OLPC_XO-1">15!</a>) laptops' worth of power per candle. </p>

<p>Paraffin (like most fuels) is nearly all carbon by weight and
when burned it generates more than its weight in carbon
dioxide (12 atomic units of carbon from the candle + 32 atomic
units of oxygen from the air per CO2 molecule). About .2kg total
or about 13g per hour. Not much, but put a couple dozen of these
out every night for a year, and you're beginning to talk about a
substantial amount of carbon.</p>

<p>Now let's compare this to a 14W compact fluorescent bulb (as
bright as a 75W conventional bulb). This generates about 840
lumens of light. That's equivalent to 70 candles. If we hooked
this up to a dirty old coal-fired power plant (generating <a
href="http://answers.yahoo.com/question/index?qid=20070930191518AA7yWqo">1050g</a>
of CO2 per kWh), we'd generate about 14.7g of CO2 per hour - almost the same as our candle! If
instead we used wind power (<a
href="http://www.xcelenergy.com/Residential/RenewableEnergy/Windsource_/Pages/WindSource.aspx">readily
available in Minnesota</a>) and include the amortized impact of
building the wind turbines (something like 22g/kWh worst case),
that drops to less than .3 grams per hour.</p>

<p>In other words, the global warming impact of candles is on the
order of 60 to way more than 3000 times worse than fluorescent
lighting for the same amount of light.</p>

<p>This doesn't consider heat though. In the winter, a candle is
quite an efficient heat source as almost all of its energy is
converted to heat. So we end up with 13g of CO2 per hour per
candle to get 40 watts of heat. That same heat from an electric
heater powered by our coal worst-case would result in 42 grams of
CO2/hour. But with wind power, it'd be less than 1 gram of CO2
per hour in the worst case.</p>

<p>In the summer, there's no upside: candle heat battles against
air conditioning. A single candle produces enough heat to cancel
out more than 1% of a so-called <a href="http://en.wikipedia.org/wiki/Ton#Refrigeration">"ton"</a> of refrigeration (12000 BTUs /
hour).</p>

<p>Lastly, we should look at production cost and
impact. Light bulbs of any variety almost certainly win,
simply because they have lifespans of thousands of hours and are
so much brighter. It would take something like 45000 candles to
match both the brightness and lifespan of our typical CFL bulb.</p>

<p>So wish for a greener tomorrow and blow out those candles.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 06 Mar 2009 06:49 GMT</pubDate>
</item>
<item>
   <title>Mercurial 1.2</title>
   <guid isPermaLink="false">hg1.2</guid>
   <link>http://www.selenic.com/blog/hg1.2.html</link>
   <description><![CDATA[

<p>Mercurial 1.2 <a
href="http://www.selenic.com/mercurial/wiki/index.cgi/WhatsNew">went
out the door</a> a bit ago. It's the first release following our <a
href="http://www.selenic.com/mercurial/wiki/index.cgi/TimeBasedReleasePlan">time-based
release plan</a>. All in all, it went pretty well, though I did have
to delay a few days so that we could get some test builds made.
Hopefully by 1.3 (due July 1st), test builds for most platforms will
be automated.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Thu, 05 Mar 2009 03:50 GMT</pubDate>
</item>
<item>
   <title>Thing 23: Trivial granola</title>
   <guid isPermaLink="false">trivial-granola</guid>
   <link>http://www.selenic.com/blog/trivial-granola.html</link>
   <description><![CDATA[

<img src="i/0227granola.jpg">

<p>Not electronics, but another thing I've been experimenting with.
This is a granola recipe reduced to its bare minimum for ease of
preparation.<p>

<p>Preheat oven to 200°F<br>
In a large pot, mix 1/4 cup each of sugar, cooking oil and maple
syrup<br>
Add 1/2tsp salt (optional)<br>
Heat on stove until bubbly<br>
Reduce heat and fold in 4 cups rolled oats<br>
Place pot in oven for 1 hour</p>

<p>If you're the type of person who likes to ruin things with raisins
(and we are, but we ate them already),
add 1/2 cup of 'em when you're finished.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 27 Feb 2009 20:54 GMT</pubDate>
</item>
<item>
   <title>Miscellania</title>
   <guid isPermaLink="false">0227-misc</guid>
   <link>http://www.selenic.com/blog/0227-misc.html</link>
   <description><![CDATA[

<ul>
<li>Twin Cities Maker group <a
href="http://twincitiesmaker.com/weblog/?p=64">meeting March 11th</a>
<li>
<a
href="http://draketo.de/english/mercurial/anonymous-code-collaboration-freenethg">Details</a>
for using Mercurial over Freenet
<li><a
href="http://www.newscientist.com/article/mg20126964.700-quark-star-may-hold-secret-to-early-universe.html">Neutrino
data suggest</a> the nearby <a
href="http://en.wikipedia.org/wiki/SN1987A">SN1987A</a> may be an
instance of the currently theoretical <a
href="http://en.wikipedia.org/wiki/Quark_star">quark star</a>, a
middle ground between neutron stars and black holes
<li>Eric Drexler <a
href="http://metamodern.com/2009/02/26/new-future-of-space/">blogs
about the <a href="http://www.nss.org">National Space Society's</a> proposal to focus on visiting <a
href="http://en.wikipedia.org/wiki/Near-Earth_object">Near-Earth Objects</a>
<li>Wired has one of the better <a
href="http://www.wired.com/techbiz/it/magazine/17-03/wp_quant">backgrounders</a>
on the current financial crisis I've seen.<br>
<i>It assumed that correlation was a constant rather than something
mercurial.</i>


]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 27 Feb 2009 16:55 GMT</pubDate>
</item>
<item>
   <title>Mercurial code freeze</title>
   <guid isPermaLink="false">code-freeze</guid>
   <link>http://www.selenic.com/blog/code-freeze.html</link>
   <description><![CDATA[

<p>Mercurial has now entered a code freeze in preparation for next
week's 1.2 release. This is going to be be a few days later than hoped
as there were some issue with getting Windows test releases built that
needed sorting out. Ahh, Windows..</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 27 Feb 2009 15:23 GMT</pubDate>
</item>
<item>
   <title>Thing 22: Rescuing Angela's flash data</title>
   <guid isPermaLink="false">flash-repair</guid>
   <link>http://www.selenic.com/blog/flash-repair.html</link>
   <description><![CDATA[

<p>Some students sat down across from me today at the coffee shop and
one of them managed to break her flash drive while trying to transfer
some files. Some panic ensued, as the drive apparently contained the
only copy of her class project. After watching much fiddling, I
offered to take a look at it. The connector was quite loose. I pried
it open and as I suspected all the connector pins were pulled right
off the board.</p>

<img src="i/0224flash1.jpg">

<p>
I tried aligning the pins and applying pressure across them
to get the drive to mount, but no joy. Its LED blinked, but Linux
wasn't detecting a new USB device. Stiffer measures were called for. I
took it home and fired up the soldering iron.</p>

<p>I could tell that simply resoldering the connectors wasn't going to
work, otherwise my first attempt would have succeeded. Copper pads had
been pulled off and I was going to need to make some brand new
connections. I pulled out some 30 gauge wire-wrap wire and proceeded
to strip, flux, and tin all the leads. Hopefully I wouldn't melt or
burn anything else on this board in the process.</p>

<img src="i/0224flash2.jpg">

<p>All hooked up but again: no joy. Not even a flashing LED. So I
unsolder everything, wick up as much solder as I can, take some
close-up photos and poke around with a multimeter and determine that
three of four pads are no longer connected to the controller chip. The
copper they pulled up had broken the trace to the pad.</p>

<p>This was going to be tricky. I was going to have to solder wires
directly onto the controller chip's legs, which were even smaller than the
thinnest wire I have, not to mention much smaller than my cheapo
soldering iron. I call Angela to let her know the prognosis was not
good.</p>

<p>It was pretty hard to see even in macro photos which pins the
broken pads were leading to so I found a datasheet for the flash
controller (Phison PS2231) on the net and double checked. Vcc (pad 1) to
rightmost pin, and data in and out to pins 5 and 6. Right next to each
other <i>and</i> crossing. Fun fun fun!

<p>I set about refluxing and retinning all of my leads and
putting a bit of flux on the chip leads as well. Then I soldered the
leads on. Vcc was easiest - I set the lead against the outside edge of
the first leg and touched the iron above the lead end for about a
second and it stuck. Next, I touched the third lead to the solder pad
at the bottom of leg five and again briefly heated it to get another
fragile connection. Lead two I attached to the upper shoulder of pin 6
to get maximal distance from the previous connection.</p>

<img src="i/0224flash3.jpg">

<p>I carefully maneuvered my laptop into position to plug it in
without disturbing the fragile connections.. and it worked! Drive
mounted properly and all files recovered. Not bad for a software
guy.</p>

<p>Then I got to explain to an art student what Linux was and what the
difference was between megabytes and gigabytes.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Wed, 25 Feb 2009 06:39 GMT</pubDate>
</item>
<item>
   <title>Minimal I<super>2</super>C interface</title>
   <guid isPermaLink="false">minimal-i2c-interface</guid>
   <link>http://www.selenic.com/blog/minimal-i2c-interface.html</link>
   <description><![CDATA[

<p>Phillip Burgess has a clever approach to interfacing with external
<a href="http://en.wikipedia.org/wiki/I%C2%B2C"I<super>2</super>C</a> devices from your laptop: <a
href="http://www.paintyourdragon.com/uc/i2c/index.html">just plug them
into your VGA port</a>. The <a
href="http://en.wikipedia.org/wiki/Display_Data_Channel">DDC</a>
channel that the monitor uses to report its available display modes is
just a subset of I<super>2</super>C. Even if you have no idea what I'm
talking about, be sure to check out his fabulous <a
href="http://members.dslextreme.com/users/paintyourdragon/uc/i2c/compatibility.png">compatibility
chart</a>.</p>

<p>This suggests another super-cheap method for programming AVRs. Use
one AVR as an I<super>2</super>C slave, and allow the master (ie the
laptop) to send down commands to drive its four remaining pins, which
are attached to the appropriate pins on the device to be programmed.
This is significantly easier than USB and available on most machines,
though not without some software compatibility issues mentioned
above.</p>


]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Tue, 24 Feb 2009 08:32 GMT</pubDate>
</item>
<item>
   <title>Thing 21: Spider cable</title>
   <guid isPermaLink="false">spider</guid>
   <link>http://www.selenic.com/blog/spider.html</link>
   <description><![CDATA[

<img src="i/0224spider1.jpg">

<p>Today's hack is an in-circuit programmer for breadboards. All my
photos of my breadboard thus far have been cluttered with the
programming wires. This arachnid-looking contraption lets me easily
remove all that clutter. See <a
href="three-simple-programmers.html">my note on programmers</a> from
yesterday for the pin-out. Here's the spider cable with its
victim:</p>

<img src="i/0224spider2.jpg">

<p>An IC test clip would also do the job, of course, but I don't have
any.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Tue, 24 Feb 2009 08:04 GMT</pubDate>
</item>
<item>
   <title>Three simple programmers for ATtiny MCUs</title>
   <guid isPermaLink="false">three-simple-programmers</guid>
   <link>http://www.selenic.com/blog/three-simple-programmers.html</link>
   <description><![CDATA[

<p><b>Method 1</b>: The simplest method is the so-called 'DAPA'
programmer, which directly controls the programming pins via a PC
parallel port. For this to work, you must have a 'real' parallel port,
and not a USB adapter.</p>

<table>
<tr><td>Name</td><td>ATiny25 pin</td><td>Parallel pin</td></tr>
<tr><td>MOSI</td><td>5</td><td>2</td></tr>
<tr><td>MISO</td><td>6</td><td>11</td></tr>
<tr><td>SCK</td><td>7</td><td>1</td></tr>
<tr><td>RESET</td><td>1</td><td>16</td></tr>
<tr><td>GND</td><td>4</td><td>18</td></tr>
</table>

<p>This programmer can be built for under $2. All you need is a
parallel port connector, some wire, and a standard DIP socket (I just
use a solderless breadboard). You can add Vcc from the parallel port
as well, but it's a bit simpler and safer to use an external power
supply.</p>

<p><b>Method 2:</b> In a similar vein is the DASA device. This works
by bit-banging the programming lines through the <i>control</i> lines
on a standard RS-232 port. Generally, this <i>will</i> work with a USB
serial adapter. It needs extra hardware to adapt from RS-232 to 'TTL'
levels. The simplest way to do this is with zener diodes. See <a
href="http://www.ladyada.net/make/minipov3/hardware.html">Lady Ada's
MiniPOV</a> for an example (upper left part of the circuit).</p>

<p><b>Method 3:</b> If you can stand to order and wait for and build a
kit, you might want to check out <a
href="http://www.ladyada.net/make/usbtinyisp/">USBtinyISP</a> ($22),
which is about the cheapest USB design available. It's based on an
ATtiny 2313 driven by a 12MHz crystal, but it should be possible to do
this with an 8-pin ATtiny with no crystal.</p>


]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Mon, 23 Feb 2009 07:12 GMT</pubDate>
</item>
<item>
   <title>RSS link fixed</title>
   <guid isPermaLink="false">0223rss-fixed</guid>
   <link>http://www.selenic.com/blog/0223rss-fixed.html</link>
   <description><![CDATA[

<p>A redirection bug was keeping the RSS 2.0 links in the header from
working, now fixed.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Mon, 23 Feb 2009 06:43 GMT</pubDate>
</item>
<item>
   <title>Thing 20: Proton nanokernel</title>
   <guid isPermaLink="false">proton</guid>
   <link>http://www.selenic.com/blog/proton.html</link>
   <description><![CDATA[

<p>Today's thing is a kernel-like infrastructure. It provides:</p>

<ul>
<li>serial I/O
<li>timer initialization
<li>event scheduling and clock incrementing
<li>I/O pin helpers
<li>sleep and powersaving 
<li>ADC and temperature reading
<li>debug value logging
<li>pseudo-RNG with persistent seed
<li>hardware RNG
<li>boot counting
<li>oscillator and temperature calibration storage
</ul>

<p>It also has some convenience macros:</p>

<ul>
<li>aliases for common types (u8, u16, etc.)
<li>physical pin number macros (P1, P2, etc.)
<li>hex character generation
<li>shorthand for bit generation (eg B(P1))
<li>

<p>This framework greatly simplifies a lot of the techniques from my
earlier projects. The <a href="i/proton-demo.c">demo</a> blinks two
LEDs with independent timer events, while the main thread writes out
serial data. When it receives a character via serial, it echos back
its hex value.</p>

<p>There's of course a lot more to do here. In particular, the timer
management code is a bit too slow to run at 57.6kHz without
interfering with the serial receive side - I've had to bump
it down to 38.4. And the assembly that GCC generates for (1 << y) here
(used for toggling pins) is quite sad. If I want to make this faster,
I'll have to give in and hand-code some assembly. I'll also probably
want to add some generic code for managing LED PWM via charlieplexing
or the like.
</p>

<a href="i/proton.h">Proton source is here</a> (as a single header file)
and a basic demo is <a href="i/proton-demo.c">here</a>.

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Sat, 21 Feb 2009 07:55 GMT</pubDate>
</item>
<item>
   <title>Elsewhere</title>
   <guid isPermaLink="false">0220-tidbits</guid>
   <link>http://www.selenic.com/blog/0220-tidbits.html</link>
   <description><![CDATA[

<ul>
<li>Minnesotans: March 14th (Pi Day) is also <a
href="http://blog.makezine.com/archive/2009/02/make_day_at_the_science_museum_of_m.html">Make
Day</a> at the Science Museum.
<li><a
href="http://www.ted.com/talks/david_merrill_demos_siftables_the_smart_blocks.html">Siftables</a>:
intelligent toy blocks
<li>Clever hack: self-charging <a
href="http://hackaday.com/2009/02/16/solar-batteries/">solar-batteries</p>
<li>Detangling the evolutionary history of <a
href="http://blogs.sciencemag.org/origins/2009/02/deconstructing-the-ribosome.html">ribosomes</a>
points to the <a
href="http://en.wikipedia.org/wiki/RNA_world_hypothesis">RNA
hypothesis</a> for the origin of life
<li>Digital TV switchover buries the most familiar <a
href="http://www.universetoday.com/2009/02/16/the-switch-to-digital-switches-off-big-bang-tv-signal/">evidence
of the Big Bang</a>
<li>Low-tech <a
href="http://maradydd.livejournal.com/417631.html">electrophoresis</a>
for <a href="http://maradydd.livejournal.com/412238.html">DIY gene
sequencing</a>
<li><a href="http://blog.wired.com/27bstroke6/">Threat Level</a> has good
coverage of The Pirate Bay trial
<li><a href="http://www.beam-wiki.org/wiki/2-Motor_Walkers">2-motor
walkers</a> from <a
href="http://www.beam-wiki.org/wiki/Main_Page">BEAM robotics</a>
</ul>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 20 Feb 2009 21:26 GMT</pubDate>
</item>
<item>
   <title>Thing 19: Simple multitasking with timer events</title>
   <guid isPermaLink="false">timer-events</guid>
   <link>http://www.selenic.com/blog/timer-events.html</link>
   <description><![CDATA[

<img src="i/0219blinky.jpg">

<p>Doing independent operations on a microcontroller is a nuisance.
Often we want to wait 1 second and do X, while at the same time, wait
a millisecond and do Y. And when we're not doing that, we want to put
the CPU into sleep mode to reduce power consumption.</p>

<p>Real multitasking is probably out of the question here on very
small parts. An ATtiny25 microcontroller has only 128 bytes of RAM,
but it has 32 registers. Keeping the context (and stack!) of more than
one sleeping process would take up most of the system's memory.</p>

<p>Fortunately, most of our multitasking needs can be met with simple
timer events. We can set up a timer to interrupt at a regular interval
and keep track of "clock" ticks. And when we reach certain points on
the clock, we launch a particular event function. We can also use the
clock to let our "main" thread of execution sleep for well-defined
intervals instead of busy-looping.</p>

<p>This thing demonstrates using recurring timer events to blink two
leds and a clock-based pause() function in main() to blink a third,
all at different rates. <a href="i/tick.c">Source here</a> and <a
href="http://www.youtube.com/watch?v=xgGAHps2qAA">video here</a>.</p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 20 Feb 2009 05:43 GMT</pubDate>
</item>
<item>
   <title>Thing 18: Switchless power switch</title>
   <guid isPermaLink="false">soft-switch</guid>
   <link>http://www.selenic.com/blog/soft-switch.html</link>
   <description><![CDATA[

<p>Didn't manage to get this posted yesterday, but here's a trick for
avoiding adding a switch to a tiny electronics project. The idea is to
keep track of power cycles in EEPROM and alternate between "on" and
"deep sleep" modes on alternate boots. You can easily extend this to
multiple on modes. To change modes, simply snap the battery holder.</p>

In its deepest sleep mode, an ATtiny25 MCU can draw as little as 2µA,
which is pretty nearly negligible: if you can run a 20mA LED for an
hour, you can sleep for over a year. Some newer chips in this family can
get all the way down into the picoamp range. This example shows a
simple blinking LED with on/off toggling. <a
href="i/soft-switch.c">Source here</a> and <a
href="http://www.youtube.com/watch?v=P9FtNELUIOQ">video here.</a>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Fri, 20 Feb 2009 05:19 GMT</pubDate>
</item>
<item>
   <title>Shepard Fairey and appropriation</title>
   <guid isPermaLink="false">shepard-fairey</guid>
   <link>http://www.selenic.com/blog/shepard-fairey.html</link>
   <description><![CDATA[

<p>There's much fuss about Shepard Fairey's <a
href="http://www.boingboing.net/2009/02/17/stanford-fair-use-ce.html">famous
Obama poster</a> and whether it's too similar to a particular
photograph from the AP, and whether it merits standing as art.</p>

<p>Curiously absent from the discussion is a recognition that the
photograph is itself a derivative work of an even more extreme
variety. With just a small handful of a variables (position, angle,
exposure, aperture, etc.), the photographer appropriates light
patterns from their environment onto a film or digital image.
Especially in the realm of photojournalism, photography is a highly
constrained and derivative artform.</p>

<p>There's also a good argument to be made that Obama's iconic "gazing
off into the promising future" pose is itself borrowed from <a
href="http://upload.wikimedia.org/wikipedia/commons/5/5e/John_F._Kennedy,_White_House_photo_portrait,_looking_up.jpg">John
F. Kennedy.</a></p>

]]></description>
   <category domain="http://www.selenic.com/blog"></category>
   <pubDate>Wed, 18 Feb 2009 08:04 GMT</pubDate>
</item>
</channel>
</rss>
