blog/hackinghttp://walfield.org/blog/hacking.html
Neal H. WalfieldGNU Hackers Meetinghttp://walfield.org/blog/2012/06/23/GNU_Hackers_Meeting.htmlhttp://walfield.org/blog/2012/06/23/GNU_Hackers_Meeting.html
hackingSat, 23 Jun 2012 04:37:18 -04002012-06-23T08:38:57Z<p>Hello World,</p>
<p>This year's installment of the <a href="http://www.gnu.org/ghm/2012/ddorf/">GNU Hacker's Meeting</a> is just a
month away.</p>
<ul>
<li>When: Thursday July 19th until Sunday July 22th</li>
<li>Where: Düsseldorf</li>
</ul>
<p>As in previous years, the fun starts on Thursday with an informal
hacking / social evening followed by talks (as well as more hacking)
Friday through Sunday.</p>
<p>If you are planning on coming, we request that you register soon by
emailing <a href="mailto:ghm-registration@gnu.org">&#x67;&#x68;&#x6D;&#45;&#114;e&#103;&#x69;&#x73;&#x74;&#114;&#x61;&#116;&#105;&#111;&#110;&#64;&#x67;&#x6E;&#x75;&#x2E;&#x6F;&#x72;&#x67;</a> as we have a limit amount of
space.</p>
<p>Note: We are also still accepting presentation proposals.</p>
<p>See you soon!</p>
A Subtilty in Overlaying Notification Windows on Maemohttp://walfield.org/blog/2011/11/05/A_Subtilty_in_Overlaying_Notification_Windows_on_Maemo.htmlhttp://walfield.org/blog/2011/11/05/A_Subtilty_in_Overlaying_Notification_Windows_on_Maemo.html
hackingmaemoSat, 05 Nov 2011 12:15:59 -04002011-11-05T16:15:59Z<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://walfield.org/blog/./2011/11/05/khweeteur-notify.png"><img src="http://walfield.org/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>
Profiling Python Codehttp://walfield.org/blog/2011/11/01/Profiling_Python_Code.htmlhttp://walfield.org/blog/2011/11/01/Profiling_Python_Code.html
hackingmaemowoodchuckTue, 01 Nov 2011 09:34:07 -04002011-11-01T13:34:07Z<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>
Khweeteur Now Woodchuck Enabledhttp://walfield.org/blog/2011/10/20/Khweeteur_Now_Woodchuck_Enabled.htmlhttp://walfield.org/blog/2011/10/20/Khweeteur_Now_Woodchuck_Enabled.html
hackingmaemowoodchuckThu, 20 Oct 2011 17:21:57 -04002011-10-20T21:21:57Z<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>
Woodchuck Presentation in Viennahttp://walfield.org/blog/2011/10/05/Woodchuck_Presentation_in_Vienna.htmlhttp://walfield.org/blog/2011/10/05/Woodchuck_Presentation_in_Vienna.html
hackingmaemowoodchuckWed, 05 Oct 2011 15:51:07 -04002011-10-05T19:51:07Z<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>
Woodchuck Ported to N950http://walfield.org/blog/2011/10/04/Woodchuck_Ported_to_N950.htmlhttp://walfield.org/blog/2011/10/04/Woodchuck_Ported_to_N950.html
hackingmaemowoodchuckTue, 04 Oct 2011 13:29:48 -04002011-10-04T17:29:48Z<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>
Managing VCS Repositories with Woodchuckhttp://walfield.org/blog/2011/10/03/Managing_VCS_Repositories_with_Woodchuck.htmlhttp://walfield.org/blog/2011/10/03/Managing_VCS_Repositories_with_Woodchuck.html
hackingmaemowoodchuckMon, 03 Oct 2011 15:56:54 -04002011-10-03T20:07:46Z<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>
Wireless Transfers are Battery Intensivehttp://walfield.org/blog/2011/09/22/Wireless_Transfers_are_Battery_Intensive.htmlhttp://walfield.org/blog/2011/09/22/Wireless_Transfers_are_Battery_Intensive.html
hackingmaemowoodchuckThu, 22 Sep 2011 17:07:51 -04002011-09-22T21:07:51Z<p>One of the arguments for
[Woodchuck][http://hssl.cs.jhu.edu/~neal/woodchuck] 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>
A Proper Development Environment Thanks to Tramp Mode in Emacshttp://walfield.org/blog/2011/09/21/A_Proper_Development_Environment_Thanks_to_Tramp_Mode_in_Emacs.htmlhttp://walfield.org/blog/2011/09/21/A_Proper_Development_Environment_Thanks_to_Tramp_Mode_in_Emacs.html
hackingmaemowoodchuckWed, 21 Sep 2011 13:40:55 -04002011-09-21T17:46:30Z<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>
howtohttp://walfield.org/blog/2011/09/18/howto.htmlhttp://walfield.org/blog/2011/09/18/howto.html
hackingmaemowoodchuckSun, 18 Sep 2011 16:39:51 -04002011-09-18T20:39:51Z<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>