<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" 
   xmlns:atom="http://www.w3.org/2005/Atom"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
   <title>Get Up 8</title>
   <link>http://hakki.cornelii.org</link>
   <atom:link href="http://hakki.cornelii.org/index.rss"
       rel="self" type="application/rss+xml" />
   <description>Michael's Internal Dialogue</description>
   <language>en</language>
   <copyright>Copyright &#169; 2004-2008 Michael Cornelius</copyright>
   <ttl>60</ttl>
   <pubDate>Mon, 03 Mar 2008 15:08 GMT</pubDate>
   <managingEditor>michael@ninthorder.com (Michael Cornelius)</managingEditor>
   <generator>PyBlosxom http://pyblosxom.sourceforge.net/ 1.4.2 8/16/2007</generator>

<!--
vim: nobackup
-->
<item>
   <title>Bachelor Weekend</title>
   <guid isPermaLink="false">bachelor_weekend</guid>
   <link>http://hakki.cornelii.org/bachelor_weekend.html</link>
   <description><![CDATA[ 
<p>I'm pleased to report that my butt did not grow into the couch while
I watched DVDs over the weekend while Barbara is away, as was predicted
by some. [<em>Cough!</em>]</p>

<p>Our first arguably spring-like day happened Saturday, so I took the
opportunity to get out on the bicycle. After getting a few chores done
around the house, I used it as incentive to actually go to work and get
ahead of the curve on an imminent deadline.</p>

<p>Though I usually prefer heat and sweat, it was a nearly ideal day for
cycling. Pleasantly cool, nice breezes (especially when I was headed
north instead of south), and sunlight. On the way home, I bumped into
Oliver Banta on the Rock Island Trail; he's apparently taken up road
cycling fairly seriously. I'll have to watch for him now, because he
told me he's seen me commuting. I was embarassed that I had not
recognized him. I managed <em>not</em> to bump into the folks strolling
on the path who insist on stopping to chat with people they know
<em>blocking both lanes of the trail</em>.</p>

<p>Barbara's in South Carolina, visiting her mother who is
undergoing treatment for cancer. I would have liked to gone along, but
the situation at the office is such that it's hard for me to take the
kind of time away that Barbara wanted to spend with her parents.</p>

<p>On Sunday, a cat I have never seen before appeared on our back porch
soliciting hand-outs. At first I thought it was Lorenzo, but this
fellow's stripes were more black and gray, less tan. In fact, he looked
very much like Penelope (aka Dr. Girlfriend), whom we took to Milwaukee
to be adopted by Kelly and James, right down to the distinctive shape of
his head.</p>

<p>He was neither collared nor neutered.</p>

<p>I tried to make friends and get a picture of him, but he was too
skittish&mdash;probably not domesticated. Lorenzo was none too happy
that he was around either, and that didn't help things. I managed to
stay between them so no fight broke out while the other guy made his way
off of Lorenzo's primary territory, but there was growling and hissing
all the way. Fortunately, Lorenzo elected to return to the back porch
instead of giving chase when the other guy finally ran off.</p>


<!--
vim:filetype=html:tw=72:ai:nobackup
-->
 ]]></description>
   <pubDate>Mon, 03 Mar 2008 15:08 GMT</pubDate>
</item>
<item>
   <title>Tagging Old Entries</title>
   <guid isPermaLink="false">tagging_old_entries</guid>
   <link>http://hakki.cornelii.org/tagging_old_entries.html</link>
   <description><![CDATA[ 
<p>As part of the current upgrade effort, I decided it was time to go
through and tag older blog entries, the ones written before the
introduction of tags. These entries were categorized, and the filesystem
was used to manage the categorization. Each directory represented a
category, and each subdirectory a subcategory. The directories were
given descriptive names, suitable for use with the <a
    href="http://pyblosxom.sourceforge.net/registry/category/pycategories.html">pycategories</a>
plugin for <a
    href="http://pyblosxom.sourceforge.net/">pyblosxom</a>.</p>

<p>An obvious approach to automating the retagging of these old entries
was to use the category hierarchy itself to provide the tags. I wrote a
<a href="http://bzr.ninthorder.com/blogtools/tagold.py">python
    program</a> to walk the directory tree, and add tags to the old
entries.</p>

<p>I chose to ignore the <q>general</q> category, though, because as a
tag <q>general</q> doesn't provide much information. I think I might try
a more sophisticated approach to those entries, analyzing the content of
the entry to choose tags. I haven't worked out all the details, yet, but
I'm considering building a map of tagged entries, based on the frequency
of certain words or phrases that appear in them, then applying that map
to a histogram of the entries currently categorized as
<q>general</q>.</p>

<!--
vim:filetype=html:tw=72:ai:nobackup
-->
 ]]></description>
   <pubDate>Tue, 26 Feb 2008 15:21 GMT</pubDate>
</item>
<item>
   <title>1996 Called; They Want Their Webdesign Back</title>
   <guid isPermaLink="false">1998_called</guid>
   <link>http://hakki.cornelii.org/1998_called.html</link>
   <description><![CDATA[ 
<p>In preparation for adding a tagcloud, I've started revising the
layout of my blog. The goals are as stated <a
    href="http://hakki.cornelii.org/death_of_design.html">before</a>: to
be standards compliant, readable, minimal, and to provide control to the
user.</p>

<p>Progress can be seen <a
    href="http://hakki.cornelii.org/?flav=2c">here</a>, complete with
ugly background colors for debugging. This iteration will include styles
for embedded code fragments, and markup for photos, along with a
<q>fixed-fluid</q> two-column layout.</p>

<p>Comment welcome...</p>

<!--
vim:filetype=html:tw=72
-->
 ]]></description>
   <pubDate>Sun, 24 Feb 2008 19:38 GMT</pubDate>
</item>
<item>
   <title>Erasing Elements from a Map: A Mini-Pattern</title>
   <guid isPermaLink="false">map_erase</guid>
   <link>http://hakki.cornelii.org/map_erase.html</link>
   <description><![CDATA[ 
<p>It's a reality of programming in C++ that all containers are not
created equal, and do not receive equal protection under the algorithms.
Or something.</p>

<p>Today at work, for example, I needed to scan a <code>std::map</code>,
and erase elements from it for which some predicate was true. The
typical way to remove an element from a map is to use the map's erase
method. There is an erase method that takes a range (a start and end
iterator), but no way to perform the erase based on the result of a
predicate. That is, there's no <code>map::erase_if</code>.</p>

<p>For sequence containers, there exists an algorithm,
<code>std::remove_if(start, end, pred)</code>, but it operates by
reordering the elements of the range it's operating on, by assigning an
element from one position to another with <code>operator=</code>.
Because the first element of the pair that comprises a map::value_type,
the key, is <code>const</code>, it can't be assigned to.</p>

<pre class="code">
    <code class="cplusplus">
typedef std::map&lt;T,U&gt; Map;
typedef Map::value_type Value;
extern bool predicate(const Value &amp;v);

Map m;

// Wrong: compile error.
std::remove_if(m.begin(), m.end(), std::ptr_fun(predicate)); 
    </code>
</pre>

<p>The next obvious thing to try is an explicit loop, with an explicit
branch based on the predicate. The naïve implementation, though, will
have problems.</p>

<pre class="code">
    <code>
for(Map::iterator i = m.begin(); i != m.end(); i++) {
    if(predicate(*i))
        m.erase(i); // ONOZ!
}
    </code>
</pre>

<p><q>ONOZ!</q> because after the call to <code>m.erase(i)</code>,
<code>i</code> is no longer valid: it refers to memory that has been
released. I suspect the increment clause of the for-statement puts us in
<a href="http://catb.org/jargon/html/N/nasal-demons.html">nasal
    demon</a> territory, but I'm not sure what the standard says.</p>

<p>To be honest, I knew the above constructs were wrong, but I didn't
know if there was an idiom to get the behavior I wanted. After some <a
    href="http://groups.google.com/groups/search?q=group%3Acomp.lang.c%2B%2B+remove_if+map&amp;qt_s=Search+Groups">research</a> 
and some experimenting, the following is the construct I decided to
use.</p>

<pre class="code">
    <code>
for(Map::iterator i = m.begin(); i != m.end(); /* increment in body */ ) {
    Map::iterator current = i++;
    if(predicate(*current))
        m.erase(current);
}
    </code>
</pre>

<!--
vim:filetype=html:tw=72
-->
 ]]></description>
   <pubDate>Fri, 22 Feb 2008 04:41 GMT</pubDate>
</item>
<item>
   <title>WorldCat Lookup From Amazon</title>
   <guid isPermaLink="false">old/develop/worldcat_amazon</guid>
   <link>http://hakki.cornelii.org/old/develop/worldcat_amazon.html</link>
   <description><![CDATA[ 
<p><a href="http://www.greasespot.net/">Greasemonkey</a> is an extension
for <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> that
allows users (i.e., you and me) to run javascript programs of our
choice, called <em>user scripts</em>, to change the look or behavior of
web pages.</p>

<p><a href="http://www.worldcat.org">WorldCat</a> is a service that lets
you search the catalogs of libraries both nearby and around the world.</p>

<p><a href="http://www.amazon.com/">Amazon</a> is, well, Amazon.</p>

<p><i>Atalib</i> is a Greasemonkey script that runs on Amazon pages. It
performs a search on WorldCat, and displays the result on the Amazon
page, so you can see if the item is available from a library, near or
far. WorldCat helpfully orders its results by distance, so you can
easily determine whether the item you're interested in is available
within biking distance, or if you will need to charter a jet.</p>

<div class="thumb">
    <div style="width: 512px;">
        <a href="http://www.flickr.com/photos/cornelii/550541863/"
        title="Photo Sharing"><img
        src="http://farm1.static.flickr.com/204/550541863_b19f340427_o.png"
        width="510" height="360" alt="atalib" /></a>
    </div>
</div>

<p>To use Atalib:</p>

<ol>
    <li>
        <p><a href="http://www.mozilla.com/en-US/firefox/">Get Firefox</a> if
        you're not using it already.</p>
    </li>
    <li>
        <p><a href="https://addons.mozilla.org/firefox/748/">Install
        Greasemonkey</a>. You'll have to restart Firefox after
        installing it.</p>
    </li>
    <li>
        <p><a
        href="http://bzr.ninthorder.com/atalib/trunk/atalib.user.js">
        Download Atalib</a>.</p>
        <p>Look for one of these two ways of installing the script.</p>
        <div class="thumb">
            <div style="width: 456px;">
                <a href="http://www.flickr.com/photos/cornelii/550542155/"
                title="Photo Sharing"><img
                src="http://farm1.static.flickr.com/190/550542155_456a2fbd2b_o.png"
                width="454" height="472" alt="atalib_install_dialog" /></a>
            </div>
        </div>
        <div class="thumb">
            <div style="width: 602px;">
                <a
                href="http://www.flickr.com/photos/cornelii/550542141/"
                title="Photo Sharing"><img
                src="http://farm1.static.flickr.com/205/550542141_040305f578_o.png"
                width="600" height="110" alt="atalib_install_banner"
                /></a>
            </div>
        </div>
        <p>Whichever you see, click the <q>Install</q> button to install
        Atalib.</p>
    </li>
    <li>Rock the Library, 2.0-style.</li>
</ol>

<p>It was fun to find out that <a 
href="http://www.amazon.com/exec/obidos/ASIN/4537015160/michaelsinter-20">a
manual of Japanese etiquette</a>
is available through the <a href="http://www.loc.gov/">Library of
Congress</a>, and that the library of the <a
href="http://www.nelson-atkins.org/">Nelson-Atkins
Museum</a> owns a copy of <a
href="http://www.amazon.com/exec/obidos/ASIN/0134999975/michaelsinter-20">Introduction
to the X Window System</a>.</p>

<!-- 
vim: syntax=html tw=72 ai 
-->
 ]]></description>
   <pubDate>Tue, 19 Feb 2008 21:03 GMT</pubDate>
</item>
</channel>
</rss>
