<?xml version="1.0" encoding="UTF-8"?>
<essay xml:lang="en" version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:gal="http://norman.walsh.name/rdf/gallery#" xmlns:foaf="http://xmlns.com/foaf/0.1/">
<info>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
<title>Which end is up?</title><biblioid class="uri">http://norman.walsh.name/2008/12/08/whichEndIsUp</biblioid>
<volumenum>11</volumenum>
<issuenum>70</issuenum>
<pubdate>2008-12-08T21:45:24-05:00</pubdate>
<author>
      <personname>
<firstname>Norman</firstname>
	<surname>Walsh</surname>
</personname>
    </author>
<copyright>
      <year>2008</year>
      <holder>Norman Walsh</holder>
    </copyright>
<abstract>
<para>It's no secret that I need help staying organized. I multitask
reasonable well, but only among the small number of tasks that have my
attention.</para>
</abstract>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#OSX"/>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#SelfReference"/>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Software"/>
</info>

<epigraph>
<attribution>
      <personname>
	<firstname>Immanuel</firstname>
<surname>Kant</surname>
      </personname>
    </attribution>
<para xml:id="p2">Science is organized knowledge. Wisdom is
organized life.
</para>
</epigraph>
<para xml:id="p1">Left to my own devices, I would rarely remember to
perform any of the enormous number of mundane tasks of which life is
composed. I'd function, but awkwardly. I'd forget to participate in
teleconferences, I'd neglect to return phone calls, I'd forget to
assemble the recycling on the curb, my hair would rarely be kempt,…you
get the idea.</para>

<para xml:id="p3">I use technology to compensate for my natural inabilities. I
keep all of my appointments, contacts, etc. on my mobile phone. I sync
my phone with my laptop, so no matter what I'm doing, there's a good
chance that I'll be reminded to do the things I'm supposed to
do.</para>

<para xml:id="p4">That's good, as far as it goes. The alarm going off five minutes
before the working group telcon reminds me to dial in. But reacting to
everything five minute before it happens isn't ideal.</para>

<para xml:id="p5">When I used <wikipedia>Linux</wikipedia>, I arranged things so
that everytime I opened a shell window, it printed the day's remaining
appointments. That worked very well, as I tended to open shell windows
with wild abandon. Now that I'm on a Mac, however, I have two shell
windows open all the time and I rarely create new ones. I really don't
know why I work differently on the Mac, but I do.</para>

<para xml:id="p6">Ever since I started using a
<wikipedia page="Personal_information_management">PIM</wikipedia>, I've
made sure that I could get at all the data in XML. One of the very first
things I did after I got an <wikipedia page="IPhone">iPhone</wikipedia> was
figure out how to extract the Calendar and Contacts as XML. 
<markup>&lt;aside&gt;</markup>The fact that
the Notes application doesn't sync in any reasonable way
<emphasis>seriously</emphasis> irritates me and, as a result, I don't really
use it.<markup>&lt;/aside&gt;</markup></para>

<para xml:id="p7">Once the data is in XML, I can use off-the-shelf XML tools to format it.
For example, like this:</para>

<screen>Coming up:
............. TAG f2f (9 Dec 2008, 1 day)

............. Events on 8 Dec 2008
............. XML 2008 Conference
07:00a-07:10a Garbage and paper
03:00p-04:00p XML CG</screen>

<para xml:id="p8">That's the sort of thing I used to print at the top of each new
shell window. But since I don't see new shell windows with any
regularity anymore, the question is, how else to display it?
</para>

<para xml:id="p9">Not long after I joined <link xlink:href="http://www.marklogic.com/">Mark
Logic</link>, I converted the iPhone syncing stuff to use Mark Logic Server.
I know it's <link xlink:href="/2005/12/08/baking">better to bake than fry</link>,
but if your fryer operates at about a billion degrees, sometimes it's
a lot simpler to fry.
With a quick little dash of <wikipedia>XQuery</wikipedia>, I had a web
page that displayed my daily calendar based on the most recent synced data:
no muss, no fuss</para>

<para xml:id="p10">My first thought was that I'd use a
<link xlink:href="http://fluidapp.com/">Fluid SSB</link> to display
the schedule. That worked fine, but it occupied screen real estate, which
is precious. I stuck it way over on the right hand side, but it occluded
part of the desktop so I was always moving it to get at some mounted drive
or downloaded file. I keep almost nothing on the desktop, but it's a handy
place to download <wikipedia>.dmg</wikipedia> files and, of course, the Mac
sticks all mounted drives on the desktop.</para>

<para xml:id="p11">What I really wanted, I realized, was to put the schedule <emphasis>in
the desktop</emphasis>, so it would always be visible but it would be
<emphasis>under</emphasis>
whatever I or OS X splattered onto the desktop.</para>

<para xml:id="p12">A little digging (and help from my 
<link xlink:href="http://twitter.com/sideshowbarker/statuses/1022369117">followers</link>
on <link xlink:href="http://twitter.com/">twitter</link><footnote>
      <para xml:id="p13">Though
I have an aesthetic preference for <link xlink:href="http://identi.ca/">identi.ca</link>.</para>
    </footnote>) lead me to
<link xlink:href="http://www.paulhammond.org/webkit2png/">webkit2png</link>.
</para>

<para xml:id="p14">Getting <command>webkit2png</command> to work was a real
struggle. I don't know if it's OS X 10.5 or if it's just me, but I
could not get <code>import WebKit</code> to work in <wikipedia page="Python_(programming_language)">Python</wikipedia>. After all 
of the obvious (and several of the obscure) things failed, with a little
help from <personname>
      <firstname>Paul</firstname>
      <surname>Hammond</surname>
</personname>, I came to the realization that it would work if I explicitly
placed <filename>/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC</filename> in my <envar>PYTHONPATH</envar>. This causes cranky
warnings, but <emphasis>it works</emphasis>.</para>

<para xml:id="p15">Once I was able to turn web pages into graphics (which is kind
of cool in its own right), I turned my attention to getting them onto
the desktop. My, my, my, now there's a task that the Mac doesn't make
easy. Well, programmatically easy, anyway.</para>

<para xml:id="p16">The magic incantation appears to be this (in
<wikipedia>AppleScript</wikipedia>):</para>

<programlisting>tell application "Finder"
set desktop picture to {"Macintosh HD:Users:ndw:Documents:Graphics:Desktop:sched.png"} as alias
end tell</programlisting>

<para xml:id="p17">(Assuming the graphic is in <filename>/Users/ndw/Documents/Graphics/Desktop/sched.png</filename>.) There's some other incantation you can use to get
<wikipedia>AppleScript</wikipedia> to understand <wikipedia>POSIX</wikipedia>
filenames, but I didn't bother to work it out.</para>

<para xml:id="p18">That's fine, except that if you change <filename>sched.png</filename> and run
that incantation again…nothing happens. OS X tries to be smart
and figures if you attempt to use the same filename twice, it doesn't
have to do anything because that file is already displayed as the
desktop. Nevermind that the contents of that file has changed.</para>

<para xml:id="p19">So, you have to be a little more clever. You wind up with something
like this:</para>

<programlisting>#!/bin/bash

# Stupid AppleScript won't load the same picture twice, so we alternate pics
if [ -f ~/Documents/Graphics/Desktop/1.png ]; then
    rm -f ~/Documents/Graphics/Desktop/1.png
    FN=2.png
else
    rm -f ~/Documents/Graphics/Desktop/2.png
    FN=1.png
fi

cd /tmp
rm -f sched-desktop*.png
webkit2png -o sched-desktop -F http://localhost:8300/today.xqy &gt; /dev/null 2&gt;&amp;1
convert sched-desktop-full.png -crop 325x300+0+0 sched-desktop-crop.png
convert sched-desktop-crop.png -bordercolor "#617187" -border 0x200 sched-desktop.png
convert ~/Documents/Graphics/BlankDesktop.png sched-desktop.png \
        -gravity NorthEast -composite ~/Documents/Graphics/Desktop/$FN
osascript - &lt;&lt;EOF
tell application "Finder"
set desktop picture to {"Macintosh HD:Users:ndw:Documents:Graphics:Desktop:$FN"} as alias
end tell
EOF</programlisting>

<para xml:id="p20">And a desktop like this:</para>

<mediaobject role="flickr">
    <!--Desktop reminders-->
  <imageobject xlink:href="http://www.flickr.com/photos/ndw/3094614128/">
    <imagedata fileref="http://farm4.static.flickr.com/3181/3094614128_c587ecc26c.jpg"/>
  </imageobject>
</mediaobject>

<para xml:id="p21">Which works very nicely, thank you very much.</para>

</essay>

