<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.6(BH)" -->
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>Planet Maemo: category &quot;feed:a0c08ff969d5d3e61fed8f9a52a2f2af&quot;</title>
        <description>Blog entries from Maemo community</description>
        <link>http://maemo.org/news/planet-maemo/</link>
        <lastBuildDate>Sat, 04 Apr 2026 00:04:50 +0000</lastBuildDate>
        <generator>FeedCreator 1.7.6(BH)</generator>
        <language>en</language>
        <managingEditor>planet@maemo.org</managingEditor>
        <item>
            <title>A Subtilty in Overlaying Notification Windows on Maemo</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/11/05/A_Subtilty_in_Overlaying_Notification_Windows_on_Maemo/</link>
            <description><![CDATA[
<p>I was recently hunting down a slightly annoying usability bug in
Khweeteur, a Twitter / identi.ca client: Khweeteur can notify the user
when there are new status updates, however, it wasn't overlaying the
notification window on the application window, like the email client
does.  I spent some time investigating the problem: the fix is easy,
but non-obvious, so I'm recording it here.</p>

<p><a href="http://hssl.cs.jhu.edu/~neal/woodchuck/maemo/../blog/2011/11/05/khweeteur-notify.png"><img src="http://hssl.cs.jhu.edu/~neal/woodchuck/maemo/../blog/2011/11/05/A_Subtilty_in_Overlaying_Notification_Windows_on_Maemo/400x-khweeteur-notify.png" width="400" height="240" class="img" /></a></p>

<p>A notification window overlays the window whose <a href="http://tronche.com/gui/x/icccm/sec-4.html#WM_CLASS"><code>WM_CLASS</code></a>
property matches the specified desktop entry (and is <a href="https://github.com/gpodder/gpodder/blob/maemo-5/debian/postinst">correctly
configured</a> in
<code>/etc/hildon-desktop/notification-groups.conf</code>).  Khweeteur was doing
the following:</p>

<pre><code>import dbus

bus = dbus.SystemBus()
notify = bus.get_object('org.freedesktop.Notifications',
                        '/org/freedesktop/Notifications')
iface = dbus.Interface(notify, 'org.freedesktop.Notifications')

id = 0
msg = 'New tweets'
count = 1
amount = 1
id = iface.Notify(
    'khweeteur',
    id,
    'khweeteur',
    msg,
    msg,
    ['default', 'call'],
    {
        'category': 'khweeteur-new-tweets',
        'desktop-entry': 'khweeteur',
        'dbus-callback-default'
            : 'net.khertan.khweeteur /net/khertan/khweeteur net.khertan.khweeteur show_now',
        'count': count,
        'amount': count,
        },
    -1,
    )
</code></pre>

<p>This means that the notification will overlay the window whose
<code>WM_CLASS</code> property is <code>khweeteur</code>.  The next step was to figure out
whether Khweeteur's <code>WM_CLASS</code> property was indeed set to <code>khweeteur</code>:</p>

<pre><code>&#036; xwininfo -root -all | grep Khweeteur
        0x3e0000d "Khweeteur: Home": ("__init__.py" "__init__.py")  800x424+0+56  +0+56
        ^ Window id                   ^ WM_CLASS (class, instance)
&#036; xprop -id 0x3e0000d | grep WM_CLASS
WM_CLASS(STRING) = "__init__.py", "__init__.py"
</code></pre>

<p>Ouch!  It appears that a program's WM_CLASS is set to the name of its
"binary".  In this case, /usr/bin/khweeteur was just a dispatcher that
executes the right command depending on the arguments.  When starting
the frontend, it was running a Python interpreter.  Adjusting the
dispatcher to not exec fixed the problem:</p>

<pre><code>&#036; xwininfo -root -all | grep Khweeteur
     0x3e00014 "khweeteur": ("khweeteur" "Khweeteur")  400x192+0+0  +0+0
        0x3e0000d "Khweeteur: Home": ("khweeteur" "Khweeteur")  800x424+0+56  +0+56
</code></pre>
<span class="net_nemein_favourites">7 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=91141b6807ce11e1841bbb3cc1cbc173c173&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/91141b6807ce11e1841bbb3cc1cbc173c173/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=91141b6807ce11e1841bbb3cc1cbc173c173&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/91141b6807ce11e1841bbb3cc1cbc173c173/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Sat, 05 Nov 2011 15:55:34 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-91141b6807ce11e1841bbb3cc1cbc173c173</guid>
        </item>
        <item>
            <title>Profiling Python Code</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/11/01/Profiling_Python_Code/</link>
            <description><![CDATA[
<p>While working on the <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/">Woodchuck</a> support in
<a href="http://gpodder.org/">gPodder</a>, I decided to profile the code.  Reading the
<a href="http://docs.python.org/library/profile.html#instant-user-s-manual">Python manual</a>, I thought it would be as easy as:</p>

<pre><code>    import cProfile
    cProfile.run('foo()')
</code></pre>

<p>On both Debian and Maemo, this results in an import error:</p>

<pre><code>    Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/lib/python2.6/cProfile.py", line 36, in run
      result = prof.print_stats(sort)
    File "/usr/lib/python2.6/cProfile.py", line 80, in print_stats
      import pstats
    ImportError: No module named pstats
</code></pre>

<p>To my eyes, this looks like I need to install some package.  This is
indeed the case: the <a href="http://packages.debian.org/squeeze/python-profiler"><code>python-profiler</code></a> package
provides the <code>pstats</code> module.  Unfortunately, <code>python-profiler</code> is not
free.  There's a depressing <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=130;bug=293932">back story</a> involving ancient
code and missing rights holders.</p>

<p>If you're on Debian, you can just install the <code>python-profiler</code>
package.  Alas, the package does not appear to be compiled for Maemo.</p>

<p>Happily, <a href="http://packages.python.org/line_profiler/">kernprof</a> works around this and is easy to use:</p>

<pre><code>    # wget http://packages.python.org/line_profiler/kernprof.py
    # python -m kernprof /usr/bin/gpodder
</code></pre>

<p>Kernprof saves the statistics in the file <code>program.prof</code> in the
current directory (in this case, it saves the data in <code>gpodder.prof</code>).</p>

<p>To analyize the data, you'll need to copy the file to a system that
has <code>python-profiler</code> installed.  Then run:</p>

<pre><code>    # python -m pstats gpodder.prof
    Welcome to the profile statistics browser.
    % sort time
    % stats 10
    Tue Nov  1 13:09:54 2011    gpodder.prof

             105542 function calls (101494 primitive calls) in 117.449 CPU seconds

       Ordered by: internal time
       List reduced from 1138 to 10 due to restriction &lt;10&gt;

       ncalls  tottime  percall  cumtime  percall filename:lineno(function)
            1   57.458   57.458   69.012   69.012 {exec_}
            1   16.052   16.052   26.417   26.417 /usr/lib/python2.5/site-packages/gpodder/qmlui/__init__.py:405(__init__)
            1    8.591    8.591   13.790   13.790 /usr/lib/python2.5/site-packages/gpodder/qmlui/__init__.py:24(&lt;module&gt;)
           60    7.041    0.117    7.041    0.117 {method 'send_message_with_reply_and_block' of '_dbus_bindings.Connection' objects}
            3    6.357    2.119    7.469    2.490 {method 'reset' of 'PySide.QtCore.QAbstractItemModel' objects}
           36    2.636    0.073    2.636    0.073 {method 'execute' of 'sqlite3.Cursor' objects}
            1    2.283    2.283    2.284    2.284 {method 'setSource' of 'PySide.QtDeclarative.QDeclarativeView' objects}
            1    1.848    1.848    1.848    1.848 /usr/lib/python2.5/site-packages/PySide/private.py:1(&lt;module&gt;)
            2    1.789    0.895    1.789    0.895 {posix.listdir}
            1    0.765    0.765    4.234    4.234 /usr/lib/python2.5/site-packages/gpodder/__init__.py:20(&lt;module&gt;)
</code></pre>

<p>The statistics browser is relatively easy to use (at least for the
simple things I've wanted to see so far).  Help is available online
using its <code>help</code> command.</p>
<span class="net_nemein_favourites">5 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=ee3038e0049011e1a9cecd64683d8a818a81&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/ee3038e0049011e1a9cecd64683d8a818a81/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=ee3038e0049011e1a9cecd64683d8a818a81&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/ee3038e0049011e1a9cecd64683d8a818a81/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Tue, 01 Nov 2011 13:01:45 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-ee3038e0049011e1a9cecd64683d8a818a81</guid>
        </item>
        <item>
            <title>Khweeteur Now Woodchuck Enabled</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/10/20/Khweeteur_Now_Woodchuck_Enabled/</link>
            <description><![CDATA[
<p><a href="http://khertan.net/khweeteur">Khweeteur</a> is a great twitter and identi.ca client for
Maemo.  One feature I particularly like is its support for queuing of
status updates, which is useful when connectivity is poor or
non-existent (which, for me, is typically when something tweet-worthy
happens).  It also supports multiple accounts, e.g., a twitter account
and an identi.ca account.</p>

<p>Khwetteur can automatically download updates and notify you when
something happens.  Enabling this option causes Khwetteur to
periodically perform updates <em>whenever there is an internet
connection</em>---whether it is a WiFi connection or via cellular.  This
is unfortunate for those, who like me, have limited data transfer
budgets.</p>

<p>Deciding when to transfer updates is exactly what
<a href="http://hssl.cs.jhu.edu/~neal/woodchuck">Woodchuck</a> was designed for, and recently, I added
Woodchuck support to Khweeteur.  Now, if Woodchuck is found, Khweeteur
will rely on it to determine when to schedule updates (of course, you
can still manually force an update whenever you like!).</p>

<p>While modifying the code, I also made a <a href="https://gitorious.org/~nwalfield/khweeteur/nwalfields-khweeteur/commits/master">few bug fixes and some small
enhancements</a>.  Two improvements that, I think, are
noteworthy are: displaying unread messages in a different color from
read messages, and indicating when the last update attempt occured.</p>

<p><strong>You can install the Woodchuck-enabled version of Khweeteur on your
N900 using this <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/khweeteur.install">installer</a></strong>.  You'll also need to
<a href="http://hssl.cs.jhu.edu/~neal/woodchuck/woodchuck.install">install the Woodchuck server</a>, to profit from the
Woodchuck support.  Hopefully, the version in Maemo extras will be
updated soon!</p>

<p>Other Woodchuck-enabled software for the N900 include:</p>

<ul>
<li><a href="http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/08/02/version_0.3_released/">FeedingIt</a>: An RSS reader</li>
<li><a href="http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/09/14/APT_Woodchuck/">APT Woodchuck</a>: A software update scheduler for Maemo5</li>
</ul>

<p>If you are interested in adding Woodchuck support to your software,
let me know either via email or join #woodchuck on irc.freenode.net.</p>
<span class="net_nemein_favourites">5 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=12f37e0afb6611e08a164d8267638e318e31&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/12f37e0afb6611e08a164d8267638e318e31/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=12f37e0afb6611e08a164d8267638e318e31&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/12f37e0afb6611e08a164d8267638e318e31/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Thu, 20 Oct 2011 21:18:57 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-12f37e0afb6611e08a164d8267638e318e31</guid>
        </item>
        <item>
            <title>Woodchuck Presentation in Vienna</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/10/05/Woodchuck_Presentation_in_Vienna/</link>
            <description><![CDATA[
<p>I'll be at the <a href="https://metalab.at/wiki/N9_Hackathon">N9 Hackathon</a> this weekend in Vienna.
Sunday morning (October 9th) at 10am, I'll give a presentation about
<a href="http://hssl.cs.jhu.edu/~neal/woodchuck">Woodchuck</a>.  I'll talk a bit about Woodchuck's
<a href="http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/09/22/Wireless_Transfers_are_Battery_Intensive/">motivation</a> and a fair amount about Woodchuck's
architecture as well as what we hope to learn from the <a href="http://lists.maemo.org/pipermail/maemo-developers/2011-October/028630.html">user
study</a> and how we planning on using it to evaluate
different scheduling algorithms.  If you are around, you should come
by!</p>
<span class="net_nemein_favourites">2 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=e1bf266aef9211e0877cbf8b165996fa96fa&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/e1bf266aef9211e0877cbf8b165996fa96fa/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>1 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=e1bf266aef9211e0877cbf8b165996fa96fa&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/e1bf266aef9211e0877cbf8b165996fa96fa/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Wed, 05 Oct 2011 19:53:41 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-e1bf266aef9211e0877cbf8b165996fa96fa</guid>
        </item>
        <item>
            <title>Woodchuck Ported to N950</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/10/04/Woodchuck_Ported_to_N950/</link>
            <description><![CDATA[
<p>I've finished an initial port of Woodchuck to Harmattan.  To get it,
you need to manually add the source repository: Harmattan's
application manager does not support .install files.  Add the
following to <code>/etc/apt/sources.list.d/hssl.list</code>:</p>

<p>deb http://hssl.cs.jhu.edu/~neal/woodchuck harmattan harmattan</p>

<p>Then, run <code>apt-get update</code>.</p>

<p>The following packages are available: the Woodchuck server (package:
murmeltier), the Python bindings (package: pywoodchuck) and the
Glib-based C bindings (libgwoodchuck and libgwoodchuck-dev).</p>

<p>smart-storage-logger, the software for the <a href="http://lists.maemo.org/pipermail/maemo-developers/2011-October/028630.html">user behavior
study</a>, has not yet been ported: I'm still trying to figure
aegis out.</p>

<p>If you are interested in adding Woodchuck support to your software,
see the <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/doc/howto/">HOWTO</a> and the <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/doc/html/woodchuck.html">documentation</a>.  You
can also email me or visit #woodchuck on irc.freenode.net (my nick is
<code>neal</code>).</p>
<span class="net_nemein_favourites">3 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=124fb462eeb111e0a7e1ed531cf289a389a3&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/124fb462eeb111e0a7e1ed531cf289a389a3/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>1 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=124fb462eeb111e0a7e1ed531cf289a389a3&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/124fb462eeb111e0a7e1ed531cf289a389a3/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Tue, 04 Oct 2011 16:56:17 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-124fb462eeb111e0a7e1ed531cf289a389a3</guid>
        </item>
        <item>
            <title>Managing VCS Repositories with Woodchuck</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/10/03/Managing_VCS_Repositories_with_Woodchuck/</link>
            <description><![CDATA[
<p>At the recent <a href="http://www.gnu.org/ghm/2011/paris/">GNU Hackers Meeting</a>, I gave a <a href="http://www.gnu.org/ghm/2011/paris/#sec-3_19">talk</a> about
<a href="http://hssl.cs.jhu.edu/~neal/woodchuck">Woodchuck</a>.  (I'll publish another post when the video is
made available.)  The talk resulted in a lot of great feedback
including a question from <a href="http://draketo.de/">Arne Babenhauserheide</a> whether
Woodchuck could be used to automatically synchronize git or mercurial
repositories.</p>

<p>I hadn't considered using Woodchuck to synchronize version control
respoitories, but it is a fitting application of Woodchuck: some data
is periodically transferred over the network in the background.  I
immediately saw two major applications in my own life: a means to
periodically push changes to a personal back up repository; and
automatically fetching change sets so that when I don't have network
connectivity, I still have a recent version of a repository that I'm
tracking.</p>

<p>I decided to implement Arne's suggestion.  It's called <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/src/branches/master/clients/vcssync.py.raw.html">VCS
Sync</a>.  To configure it, you create a file in your home
directory called .vcssync.  The file is JSON-based with the extension
that lines starting with // are accepted as comments.  The file has
the following shape:</p>

<pre><code>    {
      "directory1": [ { action1 }, { action2 }, ..., { actionM } ],
      "directory2": [ { action1 }, { action2 } ],
      ...
      "directoryN": [ { action1 } ],
    }
</code></pre>

<p>That is, there is a top-level hash mapping directories to arrays of
actions.  An action consists of four possible arguments: 'sync'
(either 'push' or 'pull'), 'remote' (the remote repository, default:
origin), 'refs' (the set of branches, e.g., +master:master, default:
'master') and 'freshness' (how often to perform the action, in hours).</p>

<p>Here's an example configuration file:</p>

<pre><code>    // To register changes, run 'vcssync -r'.
    {
        "~/src/woodchuck": [
          // Pull daily.
          {"sync": "pull", "remote": "origin", "freshness": 24},
          // Backup every tracked branch every few hours.
          {"sync": "push", "remote": "backups", "refs": "+*:*", "freshness": 3}
        ],
        "~/src/gpodder": [
          // Pull every few days.
          {"sync": "pull", "remote": "origin", "freshness": 96}
        ]
    }
</code></pre>

<p>VCS Sync automatically figures out the repository format and invokes
the right tool (currently only git and mercurial are supported;
patches for other VCSes are welcome).</p>

<p>After you install the configuration file, you need to run 'vcssync -r'
to inform Woodchuck of any changes to the configuration file.</p>

<p>You can use this on the N900, however, because this is a programmer's
tool and you need to edit a file to use it, it is not installable
using the hildon application manager.  Instead, you'll need to run
'apt-get install vcssync' from the command line (the package is in the
same repository as the <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/woodchuck.install">Woodchuck server</a>).  If
you encounter problems, consult $HOME/.vcssync.log.</p>

<p>I also use this script on my laptop, which runs Debian.  Building
packages for Debian is easy, just check out woodchuck and use
dpkg-buildpackage:</p>

<pre><code>    git clone http://hssl.cs.jhu.edu/~neal/woodchuck.git
    cd woodchuck
    dpkg-buildpackage -us -uc -rfakeroot
</code></pre>

<p>This (currently) generates eight packages.  In addition to vcssync,
you'll also need to install murmeltier (my Woodchuck implmentation),
and pywoodchuck (a Python interface to Woodchuck).</p>
<span class="net_nemein_favourites">5 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=8cdfe04aee0111e0a3b811a9b30125cc25cc&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/8cdfe04aee0111e0a3b811a9b30125cc25cc/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=8cdfe04aee0111e0a3b811a9b30125cc25cc&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/8cdfe04aee0111e0a3b811a9b30125cc25cc/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Mon, 03 Oct 2011 20:08:50 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-8cdfe04aee0111e0a3b811a9b30125cc25cc</guid>
        </item>
        <item>
            <title>Wireless Transfers are Battery Intensive</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/09/22/Wireless_Transfers_are_Battery_Intensive/</link>
            <description><![CDATA[
<p>One of the arguments for <a href="http://hssl.cs.jhu.edu/~neal/woodchuck">Woodchuck</a> is that it can save
energy.  In this post, I want to examine that claim a bit more
quantitatively.</p>

<p>To determine whether or not Woodchuck can save energy, we first need
to know approximately how much energy the activities we are interested
in consume.  To measure this, I charged my N900 until the battery was
full, then I started some activity and let it run until the device
turned off.  Every five minutes, I queried the battery's state
(voltage, mAh and whether the device was being charged) and wrote it
to an SQLite database.  The activities that I measured were: streaming
or playing an mp3 file at various encodings, downloading over WiFi at
different speeds, having the LCD on, and idling.  Some of the results
are summarized in the table below.  Keep in mind that a full charge
has approximately 18 kWs (= 5 Wh).</p>

<table>
    <thead>
        <tr>
            <th>Data Acquisition </th>
            <th>Activity </th>
            <th>Watts </th>
            <th>Energy Consumed Relative to Idle</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>3G </td>
            <td>Play 56 Kb/s stream </td>
            <td>1.00 </td>
            <td>12.5</td>
        </tr>
        <tr>
            <td>Edge </td>
            <td>Play 56 Kb/s stream </td>
            <td>0.96 </td>
            <td>12.0</td>
        </tr>
        <tr>
            <td>WiFi </td>
            <td>Play 56 Kb/s stream </td>
            <td>0.75 </td>
            <td>9.3</td>
        </tr>
        <tr>
            <td>Flash </td>
            <td>Play 56 Kb/s files </td>
            <td>0.28 </td>
            <td>3.5</td>
        </tr>
        <tr>
            <td>Flash </td>
            <td>Play 128 Kb/s files </td>
            <td>0.27 </td>
            <td>3.4</td>
        </tr>
        <tr>
            <td>Flash </td>
            <td>Play 320 Kb/s files </td>
            <td>0.32 </td>
            <td>4.0</td>
        </tr>
        <tr>
            <td>WiFi </td>
            <td>Download at 4.7 Mb/s </td>
            <td>1.23 </td>
            <td>15.4</td>
        </tr>
        <tr>
            <td>WiFi </td>
            <td>Download at 1.0 Mb/s </td>
            <td>0.91 </td>
            <td>11.4</td>
        </tr>
        <tr>
            <td>WiFi </td>
            <td>Download at 256 Kb/s </td>
            <td>0.76 </td>
            <td>9.5</td>
        </tr>
        <tr>
            <td>None </td>
            <td>Idle, LCD on </td>
            <td>0.27 </td>
            <td>3.4</td>
        </tr>
        <tr>
            <td>None </td>
            <td>Idle </td>
            <td>0.08 </td>
            <td>1</td>
        </tr>
    </tbody>
</table>

<p>The first thing to notice is that streaming over a network connection
is expensive: <em>streaming over 3G consumes 20% of the N900's battery
capacity per hour</em>.  Although it is possible to save a bit of energy
by using Edge or WiFi, the improvement is marginal.  Playing back
audio data saved on flash requires significantly less energy---just
30% as much.  In other words, if all you do is use your N900 to listen
to audio, listening to audio data saved on flash will allow you to
listen to more than <em>3 times as much</em> audio on a single battery charge
than if you were to stream that data.</p>

<p>It is not always possible to ensure that the data is saved on flash.
In this case, the best approach is to download the data as fast as
possible: although downloading over WiFi at 4.7 Mb/s (the maximum
sustainable throughput I observed) requires more energy than
downloading at, say, 256 KB/s, the required energy per bit is
significantly lower.</p>

<p>To put these values in perspective, I measured how much energy the
system consumes at idle and with the LCD on.  I think it is not
surprising that having the LCD on consumes significantly more power
than not, however, I was surprised that the network uses 3 times as
much energy as having the LCD on.</p>

<p>What do these values mean for Woodchuck?  Woodchuck tries to schedule
downloads to occur when conditions are good.  In terms of energy,
conditions are best when the device is connected to the mains.  I
charge my N900 about every two days.  Only updating my subscriptions
every two days is not often enough: I don't want the news from a day
and a half ago; many blogs that I read are updated daily; and, my
calendaring information should be synchronized constantly.  In this
case, fetching the data as fast as possible over WiFi when the signal
is strong is the next best approach.</p>

<p>To understand the possible savings, consider the case where 8 hours of
audio, about 200~MB of data, are prefetched over WiFi.  At 4.7~MB/s,
this requires 420~Ws (2.5% of the battery's capacity).  If a user
listens to 30 minutes of audio (25~MB) on the commute home, only an
additional 480~Ws (2.7% of the battery's capacity) are required.
Streaming 30 minutes of audio over 3G requires 1800~Ws, twice the
amount of energy to prefetch 8 times the data and listen to the same
audio.  Thus, <em>even with a cache hit rate of 12%, prefetching uses
just half of the energy</em> needed to stream.</p>
<span class="net_nemein_favourites">5 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=acb17874e56511e0946fd501bdf987ff87ff&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/acb17874e56511e0946fd501bdf987ff87ff/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=acb17874e56511e0946fd501bdf987ff87ff&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/acb17874e56511e0946fd501bdf987ff87ff/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Thu, 22 Sep 2011 21:06:03 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-acb17874e56511e0946fd501bdf987ff87ff</guid>
        </item>
        <item>
            <title>A Proper Development Environment Thanks to Tramp Mode in Emacs</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/09/21/A_Proper_Development_Environment_Thanks_to_Tramp_Mode_in_Emacs/</link>
            <description><![CDATA[
<p>As part of some <a href="http://hssl.cs.jhu.edu/~neal/woodchuck">Woodchuck</a>-related work, I've done a fair
amount of Python programming on Maemo.  Python, being an interpreted
language, runs the source code; there is no need to compile it to some
binary representation as is the case with C.  This is a great
convenience when developing for a device such as the N900: there is no
need to compile the code and copy the resulting binaries; I just edit
the code on the device and run it.  The trade-off is that I need to
edit the files directly on the device: but, I want my Emacs (qemacs is
not enough!), git and the regular GNU tools.  It turns out that I was
able to get pretty close.</p>

<p>Using Emacs to edit files on the N900 does not necessarily mean
running Emacs on the N900: <a href="http://www.gnu.org/s/tramp/">Emacs' tramp mode</a> makes it
possible to edit files on another system!  I had read about tramp mode
in the past, but most systems I use already have Emacs installed, so I
never bothered to investigate it further (or at least, it was easier
to install Emacs than learn about tramp mode).  Using tramp mode to
edit a file is embarrassingly easy: you just prefix the login
information to the filename that you want to edit.  In my case, I add
'/user@n900:' to access my home directory on my N900.  (To avoid
constantly typing in your password, you'll want to add an ssh key to
your $HOME/.ssh/authorized_keys file on your device).</p>

<p>Tramp mode is not just for editing: many Emacs functions support
tramp.  For instance, tab completion knows about tramp, as does dired.
Even <a href="http://www.gnu.org/software/libtool/manual/emacs/Grep-Searching.html">grep-find</a> is tramp enabled: tramp knows how to run
grep and find on the remote machine!</p>

<p>grep-find assumes relatively feature-complete tools.  By default, the
N900 includes busybox's grep and find, which have rather limited
functionality.  Happily, Thomas Tanner has packaged many of the GNU
tools for Maemo and they are just an apt-get install away.  (The
packages you need are: grep-gnu, sed-gnu, findutils-gnu,
coreutils-gnu, and diffutils-gnu.)</p>

<p>Installing Thomas's packages does not immediately make grep-find work:
the packages do not replace the busybox tools; the binaries are
installed in /usr/bin/gnu, which is not in the user's default path.
To fix this problem, I first installed bash and edited my .bashrc file
to read:</p>

<p>PATH=/usr/bin/gnu:$PATH
  export PATH</p>

<p>And my .bash_profile to read:</p>

<p>. $HOME/.bashrc</p>

<p>I also changed the user's default shell to bash using chsh.  Now when
I run grep at the command line, I get GNU grep, not Busybox's.</p>

<p>This is still not enough to get grep-find to work: by default, tramp
does not respect the PATH variable on the remote machine.
(<a href="http://www.gnu.org/s/tramp/#Remote-Programs">See</a> for more details.)  This behavior can be overridden by
adding the following to your .emacs file:</p>

<p>(require 'tramp)
  (add-to-list 'tramp-remote-path 'tramp-own-remote-path)</p>

<p>Now, Emacs's grep-find function works.</p>

<p>The last piece of the puzzle is working with git repositories.  My
primary interface to git is via <a href="http://philjackson.github.com/magit/">Magit</a>.  Unfortunately, Magit
v0.7, which is distributed with Debian Squeeze, does not fully support
tramp mode.  Magit v1.0, however, does and it is available in Debian
testing.  (Note: if you are a Magit v0.7 user and you customized
magit-diff-options, you'll need to change the value from a string to a
list, e.g., '(setq magit-diff-options '("--patience"))')</p>

<p>This set up is great and I'm happy.  As a final tweak, I tend to use
<a href="http://wiki.maemo.org/N900_USB_networking">USB networking</a>, because access over WiFi has a fair
amount of latency.</p>
<span class="net_nemein_favourites">4 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=69737e78e47911e099eabbcab6650fa60fa6&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/69737e78e47911e099eabbcab6650fa60fa6/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=69737e78e47911e099eabbcab6650fa60fa6&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/69737e78e47911e099eabbcab6650fa60fa6/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Wed, 21 Sep 2011 17:35:42 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-69737e78e47911e099eabbcab6650fa60fa6</guid>
        </item>
        <item>
            <title>howto</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/09/18/howto/</link>
            <description><![CDATA[
<p>The following text is from the introduction of the <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/doc/howto/">HOWTO</a> I've
written explaining how to modify a program to use Woodchuck.  The
focus is on the Python interface, but it should be helpful to anyone
who wants to modify an application to use Woodchuck.  This document,
unlike the detailed <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/doc/html/">documentation</a>, should be a bit easier to
digest if you are just getting started with Woodchuck.  If questions
still remain, feel free to email me or ask for help on #woodchuck on
irc.freenode.net.</p>

<h1>Introduction</h1>

<p>Woodchuck is a framework for scheduling the transmission of delay
tolerant data, such as RSS feeds, email and software updates.
Woodchuck aims to maximize data availability (the probability that the
data the user wants is accessible) while minimizing the incurred costs
(in particular, data transfer charges and battery energy consumed).
By scheduling data transfers when conditions are good, Woodchuck
ensures that data subscriptions are up to date while saving battery
power, reducing the impact of data caps and hiding spotty network
coverage.</p>

<p>At the core of Woodchuck is a daemon.  This centralized service
reduces redundant work and facilitates coordination of shared
resources.  Redundant work is reduced because only a single entity
needs to monitor network connectivity and system activity.  Further,
because the daemon starts applications when they should perform a
transfer, applications do not need to wait in the background to
perform automatic updates thereby freeing system resources.  With
respect to the coordination of shared resources: the cellular data
transmission budget and the space allocated for prefetched data need
to be allocated among the various programs.</p>

<p>Applications need to be modified to benefit from Woodchuck.  Woodchuck
needs to know about the streams that the user has subscribed to and
the objects which they contain as well as related information such as
an object's publication time.  Woodchuck also needs to be able to
trigger data transfers.  Finally, Woodchuck's scheduler benefits from
knowing when the user accesses objects.  In my experience, the changes
required are relatively non-invasive and not difficult.  This largely
depends, however, on the structure of the application.</p>

<p>...</p>

<p>I designed Woodchuck's API to be easy to use.  A major goal was to
allow applications to progressively add support for Woodchuck: it
should be possible to add minimal Woodchuck support and gain some
benefit of the services that Woodchuck offers; more complete support
results in higher-quality service.</p>

<p>To support Woodchuck, an application needs to do three things:</p>

<ul>
<li>register streams and objects;</li>
<li>process upcalls: update a stream, transfer an object, and,
optionally, delete an object's files; and,</li>
<li>send feedback: report stream updates, object downloads and object
use.</li>
</ul>

<p>The rest of this document is written as a tutorial that assumes that
you are using PyWoodchuck, the Python interface to Woodchuck.  If you
are using libgwoodchuck, a C interface, or the low-level DBus
interface, this document is still a good starting point for
understanding what your application needs to do.</p>

<p><a href="http://hssl.cs.jhu.edu/~neal/woodchuck/doc/howto/">Read the rest.</a></p>
<span class="net_nemein_favourites">5 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=7b580074e23911e09395bbfcbee2fa30fa30&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/7b580074e23911e09395bbfcbee2fa30fa30/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=7b580074e23911e09395bbfcbee2fa30fa30&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/7b580074e23911e09395bbfcbee2fa30fa30/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Sun, 18 Sep 2011 20:35:27 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-7b580074e23911e09395bbfcbee2fa30fa30</guid>
        </item>
        <item>
            <title>APT Woodchuck</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/09/14/APT_Woodchuck/</link>
            <description><![CDATA[
<p>A couple of weeks ago, I was chatting with <a href="http://www.advogato.org/person/mbanck/">Michael Banck</a>
about DebConf.  He told me that one of the sponsors provided everyone
a SIM card with 5 units of credit, and that the first time he
established a data connection was also his last: he got bit by Maemo's
<a href="https://bugs.maemo.org/show_bug.cgi?id=5137">automatic repository update misfeature</a>; because, he had
gone more than 24 hours without checking for software updates, Maemo
checked even though he was using a cellular data connection and only
had a few megabytes worth of data transfer credit.</p>

<p>A simple workaround for this bug is to <a href="http://wiki.maemo.org/Customizing_Maemo#Disabling_Auto_Updates_Check">disable updates</a>.
This has the unfortunate side effect that the user is no longer
informed when updates become available.  A better solution is one that
fetches updates when background updates are acceptable.  This is
exactly the type of scheduling problem that Woodchuck was designed to
help applications with.</p>

<p>Over the past few days, I've developed <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/src/branches/master/clients/apt-woodchuck.py.raw.html">APT Woodchuck</a>, a
small Python script, that does exactly this: APT Woodchuck lets
Woodchuck determine when it should check for updates.  On
installation, APT Woodchuck disables HAM's automatic update feature
and registers itself with Woodchuck.  When Woodchuck decides APT
Woodchuck should perform an update, it starts it (using DBus).  APT
Woodchuck then updates the package list (it uses HAM's apt-worker
utility to ensure that all of HAM's usual update mechanisms are
performed, including tickling the update widget, if necessary).  APT
Woodchuck also prefetches packages for which an update is available.</p>

<p>In total, APT Woodchuck is about 700 SLOC and took about 2 days to
write.  Most of the time was spent figuring out how to use Python APT.
That seems to me like a pretty easy solution to a hard scheduling
problem.</p>

<p>I've made <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/apt-woodchuck.install">packages for APT Woodchuck</a> for Maemo available.</p>

<p>If you are thinking about including Woodchuck support in your
application, APT Woodchuck is a fairly good example of how to go about
going it.</p>
<span class="net_nemein_favourites">6 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=daf5a928ded811e0971983cb47f4b9ccb9cc&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/daf5a928ded811e0971983cb47f4b9ccb9cc/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=daf5a928ded811e0971983cb47f4b9ccb9cc&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/daf5a928ded811e0971983cb47f4b9ccb9cc/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Wed, 14 Sep 2011 12:56:21 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-daf5a928ded811e0971983cb47f4b9ccb9cc</guid>
        </item>
        <item>
            <title>version 0.3 released</title>
            <link>http://hssl.cs.jhu.edu/~neal/woodchuck/blog/2011/08/02/version_0.3_released/</link>
            <description><![CDATA[
<p>I'm pleased to annouced the release of version 0.3 of Woodchuck.  This
release includes a server implementing the Woodchuck interface, called
Murmeltier, as well as two libraries for interacting with a Woodchuck
server, a glib-based C library, libgwoodchuck, and a set of Python
modules, PyWoodchuck.  Also included is <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/doc">extensive
documentation</a>.  Of particular note is the
documentation for the PyWoodchuck interface, which includes
self-contained working examples for every function.</p>

<p>The Murmeltier server implements most of the Woodchuck API.  Testing
has shown it to be relatively stable.  Currently, only a simple
scheduler is implemented: Murmeltier periodically triggers updates and
transfers (starting the application if necessary) if the default route
is a WiFi or ethernet connection.  Improvements planned for the next
release include considering the available power, incorporating whether
the user is interacting with the system, and actively looking for and
connecting to WiFi networks.</p>

<p>The components have been tested on Debian Squeeze x86-64 and Maemo 5.
You can download the <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/releases/">source</a>.  We've also make binary
packages available <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/woodchuck.install">Maemo 5</a>.</p>

<p>Concurrent with the release of Woodchuck is the release of a snapshot
of <a href="http://hssl.cs.jhu.edu/~neal/woodchuck/feedingit.install">FeedingIt</a>, an RSS reader for the N900, with
support for Woodchuck.  Work on gPodder, a podcast manager, is nearing
completion.  Ports of additional applications will follow in the near
future.</p>
<span class="net_nemein_favourites">1 <a href="http://maemo.org/news/?net_nemein_favourites_execute=fav&net_nemein_favourites_execute_for=443313f4c19b11e09502171651910e890e89&net_nemein_favourites_url=https://maemo.org/news/favorites//json/fav/midgard_article/443313f4c19b11e09502171651910e890e89/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-favorite.png" style="border: none;" alt="Add to favourites" title="Add to favourites" /></a>0 <a href="http://maemo.org/news/?net_nemein_favourites_execute=bury&net_nemein_favourites_execute_for=443313f4c19b11e09502171651910e890e89&net_nemein_favourites_url=https://maemo.org/news/favorites//json/bury/midgard_article/443313f4c19b11e09502171651910e890e89/" class="net_nemein_favourites_create"><img src="http://static.maemo.org:81/net.nemein.favourites/not-buried.png" style="border: none;" alt="Bury" title="Bury" /></a></span>]]></description>
            <author>Midgard Administrator &lt;dev@midgard-project.org&gt;</author>
            <category>feed:a0c08ff969d5d3e61fed8f9a52a2f2af</category>
            <pubDate>Tue, 02 Aug 2011 20:32:54 +0000</pubDate>
            <guid>http://maemo.org/midcom-permalink-443313f4c19b11e09502171651910e890e89</guid>
        </item>
    </channel>
</rss>
