<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Operations and other mysteries</title>
	<atom:link href="http://blogs.operationaldynamics.com/andrew/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.operationaldynamics.com/andrew</link>
	<description>Comments and notes by Andew Cowie</description>
	<lastBuildDate>Wed, 02 May 2012 02:23:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Upgrading to Precise</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/ubuntu-linux/upgrading-to-precise</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/ubuntu-linux/upgrading-to-precise#comments</comments>
		<pubDate>Wed, 02 May 2012 02:21:11 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[Ubuntu Linux]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=638</guid>
		<description><![CDATA[The latest release of Ubuntu, version 12.04 aka Precise, has a lot of updates we&#8217;ve been waiting on for a while &#8212; GNOME 3.4, Haskell 7.4.1, and a huge stack of bugfixes. On the desktop side, quite a number of Linux kernel vs X video modes vs suspend glitches have gone away. That&#8217;s fantastic. During [...]]]></description>
			<content:encoded><![CDATA[<p>The latest release of Ubuntu, version 12.04 aka Precise, has a lot of updates we&#8217;ve been waiting on for a while &#8212; GNOME 3.4, Haskell 7.4.1, and a huge stack of bugfixes. On the desktop side, quite a number of Linux kernel vs X video modes vs suspend glitches have gone away. That&#8217;s fantastic. During most of Oneiric, my laptop was freezing and needing a hard reset at least once a day. Tedious. So I&#8217;m quite pleased to report that running Precise, Linux 3.2, gdm, and GNOME 3.4, things are vastly more stable.</p>

<p>Getting upgraded to Precise, however, has not been a pleasant experience.</p>

<p>First we&#8217;ve had <code>unattended-upgrades</code> overwriting any configuration stating &#8220;no automatic upgrades&#8221;. The number of non-technical friends who were set to &#8220;security updates only&#8221; calling in wondering why a &#8220;big upgrade&#8221; happened and now their computers don&#8217;t work has been staggering. Needless to say we nuked <code>unattended-upgrades</code> from all of <em>our</em> systems a hurry, but for those people it was already too late.</p>

<p>Several desktop upgrades failed half-way through because <code>dpkg</code> suddenly had unresolved symbol errors. Fortunately I was able to work out the missing library binary and manually copy it in from another machine, which was enough to get package system working. Hardly auspicious.</p>

<p>Server side was fraught with difficulty. You cannot yet upgrade from Lucid to Precise. It <a href="https://plus.google.com/104216419012637157644/posts/JFeMQRkDyPi">breaks</a> horribly.</p>

<pre><code>E: Could not perform immediate configuration on 'python-minimal'. Please
see man 5 apt.conf under APT::Immediate-Configure for details. (2)
</code></pre>

<p>Brutal. I tried working around it on one system by manually using <code>dpkg</code>, but that just led me into recursive dependency hell: </p>

<pre><code># cd /var/cache/apt/archvies
# dpkg -r libc6-i686
# dpkg -i libc6_2.15-0ubuntu10_i386.deb
# dpkg -i libc-bin_2.15-0ubuntu10_i386.deb
# dpkg -i multiarch-support_2.15-0ubuntu10_i386.deb
# dpkg -i xz-utils_5.1.1alpha+20110809-3_i386.deb
# dpkg -i liblzma5_5.1.1alpha+20110809-3_i386.deb
# dpkg -i dpkg_1.16.1.2ubuntu7_i386.deb
# apt-get dist-upgrade
</code></pre>

<p>Huh. That actually worked on one system. But not on another. Still slammed into the <code>python-minimal</code> failure. For that machine I couldn&#8217;t mess around, so I had to give up and did a re-install from scratch. That&#8217;s not always feasible and certainly isn&#8217;t desirable; if I wanted to be blowing systems away all the time and re-installing them I&#8217;d be running Red Hat.</p>

<p>Anyway, I then located this <a href="https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/990740">bug</a> about being unable to upgrade (what the hell kind of QA did these people do before &#8220;releasing&#8221;?) where, very helpfully, Stefano Rivera suggested a magic incantation that gets you past this:</p>

<pre><code># apt-get install -o APT::Immediate-Configure=false -f apt python-minimal
# apt-get dist-upgrade
</code></pre>

<p>(I <em>had</em> tried something very close to this, but didn&#8217;t think of doing <em>both</em> <code>apt</code> <em>and</em> <code>python-minimal</code>. Also, it hadn&#8217;t occurred to me to use <code>-f</code>. Ahh. For some reason one always sees <code>apt-get -f install</code> not <code>apt-get -f install whatever-package-name</code>).</p>

<p>Ta-da.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/ubuntu-linux/upgrading-to-precise/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using inotify to trigger builds</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/haskell/rebuilding-via-inotify</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/haskell/rebuilding-via-inotify#comments</comments>
		<pubDate>Sun, 04 Mar 2012 14:53:59 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=620</guid>
		<description><![CDATA[Having switched from an Eclipse (which nicely takes care of building your project for you) to working in gVim (which does nothing of the sort), it&#8217;s a bit tedious to have to keep switching from the editor&#8217;s window to a terminal in the right directory to whack Up then Enter to run make again. I [...]]]></description>
			<content:encoded><![CDATA[<p>Having switched from an Eclipse (which nicely takes care of building your project for you) to working in gVim (which does nothing of the sort), it&#8217;s a bit tedious to have to keep switching from the editor&#8217;s window to a terminal in the right directory to whack <strong><code>Up</code></strong> then <strong><code>Enter</code></strong> to run make again.</p>

<p>I know about inotify, a capability in the Linux kernel to watch files for changes, but I hadn&#8217;t realized there was a way to use it from the command line. Turns out there is! <a href="http://www.mega-nerd.com/erikd/Blog/">Erik de Castro Lopo</a> pointed me to a program called <code>inotifywatch</code> that he was using in a little shell script to build his Haskell code. Erik had it set up to run <code>make</code> if one of the files he&#8217;d listed on the script&#8217;s command line changed.</p>

<h2>Saving isn&#8217;t what you think it is</h2>

<p>I wanted to see if I could expand the scope in a few ways. For one thing, if you had <code>inotifywatch</code> running on a defined list of files and you created a <em>new</em> source file, it wouldn&#8217;t trigger a build because it wasn&#8217;t being watched by inotify. So I had a poke at Erik&#8217;s script.</p>

<p>Testing showed that the script was working, but not quite for the reason that we thought. It was watching for the &#8216;modify&#8217; event, but actually catching a non-zero exit code. That&#8217;s strange; I was expecting a normal <code>0</code> not error <code>1</code>. Turns out <code>1</code> is the exit code in situations when the file you were watching is <em>deleted</em>. Huh? All that I did was save a file!</p>

<p>Of course, that&#8217;s <strong>not</strong> what many programs do when saving. To avoid the risk of destroying your original file in the event of having an I/O error when overwriting it, most editors do NOT modify your file in place; they write a new copy and then atomically rename it over the original. Other programs move your original to a backup name and write a new file. Either way, you&#8217;ve usually got a new inode. Most of the time.</p>

<p>And that makes the exact event(s) to listen for tricky to pin down. At first glance the &#8216;modify&#8217; one seemed a reasonable choice, but as we&#8217;ve just seen that turns out to not be much use, and meanwhile you end up triggering due to changes made to transient garbage like Vim&#8217;s swap files &#8212; certainly what you <em>don&#8217;t</em> want to trigger a build. Given that a new file is being made, I then tried watching for the &#8216;create&#8217; event, but it&#8217;s overblown with noise too. Finally, you want <code>touch</code>ing a file to result in a rebuild and that <em>doesn&#8217;t</em> involve a &#8216;create&#8217; event.</p>

<p>It turns out that saving (however done) and touching a file have in common that at some point in the sequence your file (or its backup) will be opened and then closed <em>for writing</em>. inotify has a &#8216;close_write&#8217; event (complimenting &#8216;close&#95;nowrite&#8217;) so that&#8217;s the one to watch for.</p>

<p>If you want to experiment with figuring all this yourself, try doing:</p>

<pre><code>$ inotifywait -m .
</code></pre>

<p>and then use your editor and build tools as usual. It&#8217;s pretty interesting. The <a href="http://linux.die.net/man/1/inotifywatch"><em>inotifywait(1)</em></a> program is part of the <code>'inotify-tools'</code> package on <a href="http://packages.debian.org/sid/inotify-tools">Debian</a>-<a href="http://packages.ubuntu.com/oneiric/inotify-tools">based</a> Linux systems.</p>

<h2>Resurrection, Tron style</h2>

<p>Triggering a build automatically is brilliant, but only half the equation; inevitably you want to <em>run</em> the program after building it. It gets harder; if the thing you&#8217;re hacking on is a <em>service</em> then, having run it, you&#8217;ve got to <strong>kill it off and restart it</strong> to find out if your code change fixed the problem. How many times have <em>you</em> been frustrated that your bugfix hasn&#8217;t taken only to realize you&#8217;ve forgotten to restart the thing you&#8217;re testing? Running the server manually in yet another terminal window and then killing it and restarting it &#8212; over and over &#8212; is quite a pain. So why not have that triggered as a result of the inotify driven build as well?</p>

<p>Managing concurrent tasks is harder than it should be. Bash has &#8220;<a href="http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics">job control</a>&#8220;, of course, and we&#8217;re well used to using it in interactive terminals:</p>

<pre><code>$ ./program
^Z
$

$ bg
[1] 13796
$ jobs
[1] Running    ./program
$

$ kill %1
[1] Terminated ./program
$
</code></pre>

<p>It&#8217;s one thing to run something and then abort it, but it&#8217;s another thing entirely to have a script that runs it and then kills it off in reaction to a subsequent event. Job control is lovely when you&#8217;re interactive but for various reasons is problematic to use in a shell script (though, if you really want to, <a href="http://stackoverflow.com/a/690297/901918">see</a> <code>set -m</code>). You can keep it simple, however: assuming for a moment you have just one program that needs running to test whatever-it-is-you&#8217;re-working-on, you can simply capture the process id and use that:</p>

<pre><code>    #!/bin/sh

    ./program &amp;
    PID="$!"
</code></pre>

<p>Then you can later, in response to whatever stimuli, do:</p>

<pre><code>    kill $PID
</code></pre>

<p>Said stimulus is, of course, our blocking call to <code>inotifywait</code>, returning because a file has been saved.</p>

<h2><code>GOTO 10</code></h2>

<p>Do a build. If it succeeds, run the specified program in the background then block waiting for an inotify &#8216;close&#95;write&#8217; event. When that happens, kill the program and loop back to the beginning. Easy, right? <em>Sure. that&#8217;s why it took me all day.</em></p>

<p>I called it <a href="http://research.operationaldynamics.com/src/inotify/buildtools/inotifymake.sh"><code>inotifymake</code></a>. Usage is simple; throw it in <code>~/bin</code> then:</p>

<pre><code>$ cd ~/src/project/branch/
$ inotifymake ./program
</code></pre>

<p><em>make does its thing, building program as its result</em><br />
<em>program runs</em><br />
<em>waiting&#8230;</em></p>

<p><em>change detected!</em></p>

<p><em>kill program</em>
<em>make does its thing, build failed</em> <code>:(</code><br />
<em>waiting&#8230;</em></p>

<p><em>change detected!</em></p>

<p><em>make does its thing, rebuilding program as a result</em><br />
<em>program runs</em><br />
<em>waiting&#8230;</em></p>

<p>the nice part being that the server or whatever isn&#8217;t running in the middle when the build is borked; <code>http://localhost:8000/</code> isn&#8217;t answering. Yeah.</p>

<p>So yes, that was a lot of effort for not a lot of script, but this is something I&#8217;ve wanted for a long time, and seems pretty good so far. I&#8217;m sure it could be improved; frankly if it needed to be any more rigorous I&#8217;d rewrite it as a proper C program, but in the mean time, this will do. <a href="https://plus.google.com/104216419012637157644/posts/CiwS58MWEKs">Feedback</a> welcome if you&#8217;ve got any ideas; branch is <a href="http://research.operationaldynamics.com/bzr/inotify/buildtools/">there</a> if you want it.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/haskell/rebuilding-via-inotify/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taming gVim on a GNOME Desktop</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/taming-gvim</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/taming-gvim#comments</comments>
		<pubDate>Sat, 03 Mar 2012 00:52:55 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[GNOME Desktop]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=615</guid>
		<description><![CDATA[I love using GEdit to write text documents like blog posts marked up in Markdown. I&#8217;ve been using it extensively to write technical documentation for a while now. It&#8217;s a lovely text file editor. Programming with GEdit is a bit more subject to critique. Sure, source code is text files, but as programmers we expect [...]]]></description>
			<content:encoded><![CDATA[<p>I love using GEdit to write text documents like blog posts marked up in Markdown. I&#8217;ve been using it extensively to write technical documentation for a while now. It&#8217;s a lovely text file editor.</p>

<p>Programming with GEdit is a bit more subject to critique. Sure, source code is text files, but as programmers we expect a fair bit of our editor. I&#8217;ve been writing my C code in <code>vi</code> for like 25 years. When I returned to Java after a few years in dot-com land I (with great scepticism) began using Eclipse. IDEs are for wimps, after all. Boy was I wrong about that. Once I got the hang of its demented way of doing things, I was blown away at the <em>acceleration</em> that code completion, hierarchy navigation, and most of all context appropriate popups of JavaDoc. Hard to leave that behind.</p>

<p>Lately, however, I&#8217;ve been doing a lot of work with Haskell and JavaScript, and that ain&#8217;t happening in Eclipse. Since I use GEdit for so much else, I thought I&#8217;d give it a whirl for programming in other-than-Java. Didn&#8217;t work out so well. I mean, it&#8217;s <em>almost</em> there; I tried a bunch of plugins but it seems a bit of a crap shoot. To make development easier I&#8217;d certainly need e.g. ctags, but there was nothing packaged.</p>

<p>You&#8217;re probably asking why I&#8217;m not content to just use Vim from a terminal; after all, been doing so for years. I&#8217;ve begun to have a bit of a backlash against running <em>applications</em> in terminal windows; command lines are for doing Linux things, but once you run an editor or email client or whatever in a terminal then suddenly your productivity on the Desktop goes to hell; the whole premise of <strong><code>Alt+Tab</code></strong> (we won&#8217;t even talk about the bizarre GNOME Shell <strong><code>Alt+</code>&#96;</strong> business) is switching between <em>applications</em> but having both <code>$</code> and programs in the same type of window blows that up.</p>

<p>Vim, however, has long had a GUI version called gVim, and when running it shows up as an independent application. So, for the hell of it, I gave it a try.</p>

<h2>Cut and Paste</h2>

<p>Immediately I went bananas becuase copy and paste didn&#8217;t work like they should. <em>Yes</em> this is vi; yank-yank, baby. But as gVim it&#8217;s also a GUI, and we&#8217;ve all pretty much learnt that if you&#8217;ve got a white canvas in front of you, <strong><code>Ctrl+C</code></strong> and <strong><code>Ctrl+V</code></strong> are going to work. So much so that I have gnome-terminal rejigged to to make <strong><code>Ctrl+Shift+C</code></strong> result in <code>SIGINT</code> leaving <strong><code>Ctrl+C</code></strong> for copy. Consistency in user interaction is everything.</p>

<p>There&#8217;s an entire page on the <a href="http://vim.wikia.com/wiki/Copy,_cut_and_paste">Vim Tips Wiki</a> devoted to using <code>y</code>, <code>d</code>, and <code>P</code> to yank or delete then put. No kidding. But just as I was about to give up I found, buried at the bottom, advice to add:</p>

<pre><code>    source $VIMRUNTIME/mswin.vim
</code></pre>

<p>to your <code>.vimrc</code>. The script affects some behaviour changes which among other things makes selection, cut, copy, and paste work like a normal GtkTextView widget. Hooray!</p>

<p>As for the rest of the GUI, I&#8217;ve gone to a lot of trouble to tame it. You need to make quite a number of changes to gVim&#8217;s default GUI settings; it&#8217;s all a bit cumbersome and the gVim menus (which at first seem like such a great idea!) don&#8217;t actually give you much help. Figuring these customizations out took a <em>lot</em> of wading through the wiki and worse the voluminous internal help documentation to figure any of this out; it&#8217;s pretty arcane.</p>

<h2>Cursor</h2>

<p>In particular, I want an unblinking vertical bar as a cursor (to match the desktop wide setting properly picked up by every other GNOME app, here I had to manually force it):</p>

<pre><code>    set guicursor=a:ver1,a:blinkon0
</code></pre>

<p>See the documentation for <code>'</code><a href="http://vimdoc.sourceforge.net/htmldoc/options.html#'guicursor'"><code>guicursor</code></a><code>'</code> for other possibilities.</p>

<h2>Mouse pointer</h2>

<p>Also for consistency, I needed to get standard behaviour for the mouse pointer (in particular, it&#8217;s supposed to be an I-beam when over text; the ability to change pointer depending on which mode you&#8217;re on is interesting, but it is jarring when compared to, well, everything else on the Desktop):</p>

<pre><code>    set mouseshape=n:beam,ve:beam,sd:updown
</code></pre>

<p>The documentation for <code>'</code><a href="http://vimdoc.sourceforge.net/htmldoc/options.html#'mouseshape'"><code>mouseshape</code></a><code>'</code> describes enough permutations to keep even the most discerning customization freak happy.</p>

<h2>Window dressing</h2>

<p>The remaining settings are certainly personal, but you&#8217;ll want to pick a default window size that makes decent use of your screen real estate:</p>

<pre><code>    if has("gui_running")
        set lines=45 columns=95
    endif
</code></pre>

<p>You need to guard with that if block because otherwise running <code>vim</code> from your command line will resize your terminal (!) and that&#8217;s annoying.</p>

<p>You can set the editor font from the menu, but to make it stick across program invocations you need it in <code>.vimrc</code> as shown here; finally, the <code>'</code><a href="http://vimdoc.sourceforge.net/htmldoc/options.html#'guioptions'"><code>guioptions</code></a><code>'</code> at the end disables tearoff menus (<code>t</code>) and turns off the toolbar (<code>T</code>):</p>

<pre><code>    set guifont=DejaVu\ Sans\ Mono\ 11
    set guioptions-=tT
</code></pre>

<h2>Syntax colouring</h2>

<p>I normally use Vim in a terminal with a black background, but for some reason I don&#8217;t much like the colour set chosen. Forcing the change to <code>'light'</code> makes for a nicely different set, but since I run gVim with a white background to be consistent with other GUI programs, I had to do a bit of tweaking to the colours used for syntax highlighting:</p>

<pre><code>    set background=light
    highlight Constant ctermfg=Blue guifg=DarkBlue
    highlight String ctermfg=Blue cterm=bold guifg=DarkBlue gui=bold
    highlight Comment ctermfg=Grey guifg=DarkGrey
</code></pre>

<p>Hopefully that does it. As I said, the new Vim wiki is full of an insane amount of information, but since Vim is so powerful it can, ironically, be hard to find what you need to fine tune things just the way you want them. So if you&#8217;re a power Vim or gVim user, why don&#8217;t you blog about <strong>your</strong> <code>.vimrc</code> settings?</p>

<p>Still not sure if using gVim is going to be a good idea; the fact that despite all this hackery the editor canvas is still not a GNOME app with behaviour matching the standards of the entire rest of the Desktop is going to make me crazy. Hopefully I can keep things straight in my head; frankly I&#8217;d rather be using GEdit but it <em>is</em> nice to have consistency between using Vim to do sysadmin work and using gVim to write code.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/taming-gvim/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My sound hardware didn&#8217;t vanish, honest</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/my-sound-hardware-didnt-vanish-honest</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/my-sound-hardware-didnt-vanish-honest#comments</comments>
		<pubDate>Mon, 30 Jan 2012 07:10:57 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[GNOME Desktop]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=605</guid>
		<description><![CDATA[I&#8217;ve been having intermittent problems with sound not working. Usually restarting (ie, killing) PulseAudio has done the trick but today it was even worse; the sound hardware mysteriously vanished from the Sound Settings capplet. Bog knows what&#8217;s up with that, but buried in &#8220;Sound Troubleshooting&#8221; I found &#8220;Getting ALSA to work after suspend / hibernate&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having intermittent problems with sound not working. Usually restarting (ie, killing) PulseAudio has done the trick but today it was even worse; the sound hardware mysteriously vanished from the Sound Settings capplet. Bog knows what&#8217;s up with that, but buried in &#8220;<a href="https://help.ubuntu.com/community/SoundTroubleshooting">Sound Troubleshooting</a>&#8221; I found &#8220;Getting ALSA to work after suspend / hibernate&#8221; which contains this nugget:</p>

<blockquote>
  <p>The alsa &#8220;force-reload&#8221; command  will kill all running programs using the sound driver so the driver itself is able to be restarted.</p>
</blockquote>

<p>Huh. Didn&#8217;t know about that one. But seems reasonable, and sure enough,</p>

<pre><code>$ /sbin/alsa force-reload
</code></pre>

<p>did the trick.</p>

<p>That wiki page goes on to detail adding a script to <code>/etc/pm/sleep.d</code> to carry this out after every resume. That seems excessive; I know that sometimes drivers don&#8217;t work or hardware doesn&#8217;t reset after the computer has been suspended or hibernated, but in my case the behaviour is only intermittent, and seems related to having docked (or not), having used an external USB headphone (or not), and having played something with Flash (which seems to circumvent PulseAudio. Bad). Anyway, one certainly doesn&#8217;t want to kill all one&#8217;s audio-using programs just because you suspended! But as a workaround for whatever it is that&#8217;s wrong today, nice.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/my-sound-hardware-didnt-vanish-honest/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Poisoning DNS perhaps a bad idea</title>
		<link>http://blogs.operationaldynamics.com/andrew/engineering/internet/poisoning-dns-perhaps-a-bad-idea</link>
		<comments>http://blogs.operationaldynamics.com/andrew/engineering/internet/poisoning-dns-perhaps-a-bad-idea#comments</comments>
		<pubDate>Tue, 20 Dec 2011 04:00:51 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=600</guid>
		<description><![CDATA[This is insane. I&#8217;m sitting at a café in Sydney using their hotspot. Went to search for something, and I kept getting strange looking &#8220;site not found&#8221; pages. Huh? Thy were working a few hours ago. So I started digging. The café&#8217;s upstream ISP is &#8220;Optus&#8221;, one of the major Australian carriers. To my astonishment [...]]]></description>
			<content:encoded><![CDATA[<p>This is insane. I&#8217;m sitting at a café in Sydney using their hotspot. Went to search for something, and I kept getting strange looking &#8220;site not found&#8221; pages. Huh? Thy were working a few hours ago. So I started digging.</p>

<p>The café&#8217;s upstream ISP is &#8220;Optus&#8221;, one of the major Australian carriers. To my astonishment I found that Optus&#8217;s DNS servers are <strong>interfering</strong> with Google searches, stealing their DNS lookups and serving results pages on their own (shitty quality) branded search instead! Try <code>https:</code>? No connection; and <a href="https://plus.google.com/">Google+</a> wouldn&#8217;t load either.</p>

<p>Obviously as soon as realized what&#8217;s going on I immediately changed DNS servers to something reliable. Before I did I found a tiny &#8220;about this page&#8221; link at the bottom of the heinous Optus search results page, where I was told how great this was for me, but how I could opt out of their &#8220;default&#8221; search engine if I wanted to but was warned this was an &#8220;advanced setting&#8221;.</p>

<p>Seriously, what do Optus think they&#8217;re doing? From a commercial standpoint, do they really think that their captive audience matters to anyone advertising on the web? Of course not, but in the mean time they&#8217;re certainly going to alienate customers who just maybe actually do want to use (in this case) Google sites.</p>

<p>There&#8217;s a bigger issue, though. Unaltered answers to DNS queries is a backbone of net neutrality. That&#8217;s <em>our</em> problem, but once carriers start poisoning nameservers in their own favour it will be but a blink before everyone is doing it to each other and lookups will become worthless. While I&#8217;m sure the morons in Marketing who thought that sabotaging DNS queries would be a good idea won&#8217;t be worried about the wreckage that will cause for everyone else, such a war wouldn&#8217;t be good for any of the companies involved, either. And meanwhile, if they <em>really</em> want everyone to learn how to install an app to &#8220;fix&#8221; the internet&#8230;</p>

<p>Of course, this is only a taste of what we&#8217;ll be in for when the communications minister finally gets his compulsory <a href="http://nocleanfeed.com/">Great Firewall of Australia</a> censorship in place, but one thing at a time. If you&#8217;re looking for internet access down here, clearly Optus or anything that uses their network should be blacklisted.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/engineering/internet/poisoning-dns-perhaps-a-bad-idea/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Haskell</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/haskell/learning-haskell</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/haskell/learning-haskell#comments</comments>
		<pubDate>Mon, 28 Nov 2011 05:35:22 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=570</guid>
		<description><![CDATA[In the land of computer programming, newer has almost always meant better. Java was newer than C, and better, right? Python was better than Perl. Duh, Ruby is better than everything, so they&#8217;d tell you. But wait, Twitter is written in Scala. Guess that must be the new hotness, eh? Haskell has been around for [...]]]></description>
			<content:encoded><![CDATA[<p>In the land of computer programming, newer has almost always meant better. Java was newer than C, and better, right? Python was better than Perl. Duh, Ruby is better than everything, so they&#8217;d tell you. But wait, Twitter is written in Scala. Guess that must be the new hotness, eh?</p>

<p>Haskell has been around for quite a while; somehow I had it in my head that it was outdated and only for computer science work. After all, there are always crazy weirdos out there in academia working on obscure research languages — at least, that&#8217;s the perspective from industry. After all, we&#8217;re the ones getting real work done. All <em>you&#8217;re</em> doing is sequencing the human genome. <em>We</em> invented Java 2 Enterprise Edition. Take that, ivory tower.</p>

<p>The newness bias is strong, which is why I was poleaxed to find people I respect like <a href="http://www.mega-nerd.com/erikd/Blog/">Erik de Castro Lopo</a> and <a href="http://blog.kfish.org/">Conrad Parker</a> working hard in, of all things, Haskell. And now they&#8217;re encouraging <em>me</em> to program in it, too (surely, cats and dogs are sleeping together this night). On their recommendation I&#8217;ve been learning a bit, and much to my surprise, it turns out Haskell is vibrant, improving, and really cutting edge.</p>

<h2>The next thing</h2>

<p>I get the impression that people are tired of being told that the some cool new thing makes everything else they&#8217;ve been doing irrelevant. Yet many professional programmers (and worse, fanboy script kiddies) are always looking to the next big thing, the next cool language. Often the very people you respect about a topic have already moved on to something else (there&#8217;s a book deal in it for them if they can write it fast enough).</p>

<p>But still; technology is constantly changing and there&#8217;s always pressure to be doing the latest and greatest. I try my best to resist this sort of thing, just in the interest of actually getting anything done. Not always easy, and the opposite trap is to adopt a bunker mentality whereby you defend what you&#8217;re doing against all comers. Not much learning going on there either.</p>

<p>There is, however, a difference between the latest new thing and learning something new.</p>

<p>One of the best things about being active in open source is the opportunity to meet people who you can look up to and learn from. I may know a thing or two about operations and crisis and such, but my techie friends and colleagues are <em>my</em> mentors when it comes to software development and computer engineering. One thing they have taught me over the years is the value of setting out deliberately to &#8220;stretch&#8221; your mind. Specifically, experimenting with a new programming language that is not your day-to-day working environment, but something that will force your to learn new ways of looking at problems. These guys are professionals; they recognize that whatever your working language(s) are, you&#8217;re going to keep using them <em>because you get things done there</em>. It&#8217;s not about being seduced by the latest cool project that some popular blogger would have you believe is the be-all-and-end-all. Rather, in stretching, you might be able to bring ideas back to your main work and just might improve thereby. I think there is wisdom there.</p>

<h2>Should I attempt to learn Haskell?</h2>

<p>I&#8217;ve had an eye on functional programming for a while now; who hasn&#8217;t? Not being from a formal computer science or mathematics background &#8212; (&#8220;<em>damnit Jim, I&#8217;m an engineer, not an english major</em>&#8221; when called upon to defend my atrocious spelling) &#8212; the whole &#8220;omigod, like, everything is function and that&#8217;s like, totally cool&#8221; mantra isn&#8217;t <em>quite</em> as compelling by itself as it might be. But lots of people I respect have been going on about functional programming for a while now, and it seemed a good direction to stretch. So I asked which language should I learn?</p>

<p>My colleagues suggested Haskell for a number of reasons. That cutting edge research was happening there and that increasingly powerful things were being implemented in the compiler and runtime as a result sounded interesting. That Haskell being a pure functional language (I didn&#8217;t know yet what that meant but that&#8217;s beside the point) would really force me to learn a functional way of doing at things (as opposed to some others where you can do functional things but can easily escape those constraints; pragmatic, perhaps, but since the idea was to learn something new, that made Haskell sound good rather than perceiving this as a limitation). Finally, they claimed that you could express problems concisely (brevity good, though not if it&#8217;s so dense that it&#8217;s write-only).</p>

<p>Considering a new language (or, within a language, considering various competing frameworks for web applications, graphical user interface, production deployment, etc) my sense is that when we look at such things we are all fairly quick to judge, based on our own private aesthetic. Does it look clean? Can I do things I need to do with this easily? How do the authors conceive of the problem space? (in web programming especially, a given framework will make some things easy and other things nigh on impossible; you need to know what world-view you&#8217;re buying into). </p>

<p>I don&#8217;t know about you, but <strong>elegance</strong> by itself and in the abstract is not sufficient. Elegance is probably the most highly valued characteristic of good engineering design, but it must be coupled with <strong>practicality</strong>. In other words, does the design get the job done? So before I was willing to invest time learning Haskell, I wanted to at least have some idea that I&#8217;d be able to use it for something more than just academic curiosity.</p>

<p>Incidentally, I&#8217;m not sure the Haskell community does itself many favours by glorifying in how clever you can be in the language; the implied corollary is that you can&#8217;t do anything without being exceedingly clever about it. If true, that would be tedious. I get the humour of the commentary that as we gain experience we tend to overcomplicate things, as seen in the <a href="http://www.willamette.edu/~fruehr/haskell/evolution.html">many different ways</a> there are to express a factorial function. But I saw that article linked from almost every thread about how clever you can be with Haskell; is that the sort of thing that you want to use as an introduction for newcomers? Given the syntax is so different from what people are used to in mainstream C-derived programming languages, the code there just looks like mush. The fact that there are people who studied mathematics are doing theorem proving in the language is fascinating, but the tone is very elevated as a result. A high bar for a newcomer — even a professional with 25 years programming experience — to face.</p>

<p>It became clear pretty fast that I wouldn&#8217;t have the faintest idea what I was looking at, but I still tried to see if I could get a sense of what using Haskell would be like. Search on phrases like &#8220;haskell performance&#8221;, &#8220;haskell in production&#8221;, &#8220;commercial use of haskell&#8221;, &#8220;haskell vs scala&#8221;, and so on. You get more than enough highly partisan discussion. It&#8217;s quick to see people love the language. It&#8217;s a little harder to evidence see it being used in anger, but eventually I came across pages like <a href="http://www.haskell.org/haskellwiki/Haskell_in_industry">Haskell in Industry</a> and <a href="http://contemplatecode.blogspot.com/search/label/HWN">Haskell Weekly News</a> which have lots of interesting links. That pretty much convinced me it&#8217;d be worth giving it a go.</p>

<h2>A brief introduction</h2>

<p>So here I am, struggling away learning Haskell. I guess I&#8217;d have to say I&#8217;m still a bit dubious, but the wonderful <a href="http://learnyouahaskell.com/">beginner tutorial</a> called <em>Learn You A Haskell For Great Good</em> (No Starch Press) has cute illustrations. <code>:)</code> The other major starting point is <em>Real World Haskell</em> (O&#8217;Reilly). You can flip through it <a href="http://book.realworldhaskell.org/">online</a> as well, but really, once you get the idea, I think you&#8217;ll agree it&#8217;s worth having both in hard copy.</p>

<p>Somewhere along the way my investigations landed me on discussion of something called &#8220;software transactional memory&#8221; as an approach to concurrency. Having been a Java person for quite some years, I&#8217;m quite comfortable with multi-threading &#91;and exceptionally tired of the rants from people who insist that you should only write single threaded programs&#93;, but I&#8217;m also aware that concurrency can be hard to get right and that solving bugs can be nasty. The idea of applying the database notion of transactions to memory access is fascinating. Reading about STM led me to this (short, language agnostic) <a href="http://blip.tv/oreilly-open-source-convention/oscon-2007-simon-peyton-jones-322473">keynote</a> given at OSCON 2007 by one Simon Peyton-Jones, an engaging speaker and one of the original authors of GHC. Watching the video, I heard him mention that he had done an &#8220;introduction to Haskell&#8221; earlier in the conference. Huh. Sure enough, linked from <a href="http://research.microsoft.com/en-us/um/people/simonpj/papers/haskell-tutorial/index.htm">here</a>, are his slides and the video they took.</p>

<p>Watching the tutorial implies a non-trivial investment in time, and a bit of care to manually track the slides with him as he is presenting, but viewing it all the way through was a <strong>very</strong> rewarding experience. By the time I watched this I&#8217;d already read <em>Learn You A Haskell</em> and a goodly chunk of <em>Real World Haskell</em>, but if anything that made it even more fascinating; I suppose I was able to concentrate more on what he was saying for the emphasis on <em>why</em> things in Haskell are the way they were.</p>

<p>I was quite looking forward to how he would introduce I/O to an audience of beginners; like every other neophyte I&#8217;m grinding through learning what &#8220;<a href="http://news.ycombinator.com/item?id=1202002">monads</a>&#8221; are and how they enable pure functional programming to coexist with side effects. Peyton-Jones&#8217;s discussion of IO turns up towards the end (<a href="http://blip.tv/file/325646">part 2</a> at :54:36), when this definition went up on a slide:</p>

<div style="font-family: monospace;">
<pre>
IO (<span style="color: darkgreen;">a</span>) :: <span style="color: darkgreen;">World</span> -> (<span style="color: darkgreen;">a</span>, <span style="color: darkgreen;">World</span>)
</pre>
</div>

<p>accompanied by this description:</p>

<blockquote>
  <p>&#8220;You can think of it as a function that takes a <span style="color: darkgreen;"><code>World</code></span> to a pair of <span style="color: darkgreen;"><code>a</code></span> and a new <span style="color: darkgreen;"><code>World</code></span> &#8230; a rather egocentric functional programmer&#8217;s view of things 
  in which your function is center of the universe, and the entire world sort of goes in one side of your function, gets modified a bit by your function, and emerges, in a purely functional way, in a freshly minted world which comes out the other&#8230;&#8221;</p>
  
  <p>&#8220;Oh, so that&#8217;s a metaphor?&#8221; asked one of his audience.</p>
  
  <p>&#8220;Yes. The world does <em>not</em> actually disappear into your laptop. But you can think of it that way if you like.&#8221;</p>
</blockquote>

<p>Ha. <code>:)</code></p>

<h2>Isolation and reusability</h2>

<p>A moment ago I mentioned practicality. The most practical thing going these days is the web problem, i.e. using a language and its toolchain to do web programming. Ok, so what web frameworks are there for Haskell? Turns out there are a few. Two newer ones in particular, <a href="http://www.yesodweb.com/page/about">Yesod</a> and the <a href="http://snapframework.com/">Snap Framework</a>. Their raw performance as web servers looks <em>very</em> impressive, but the real question is how does writing web pages &amp; application logic go down? Yesod&#8217;s approach, called &#8220;<a href="http://www.yesodweb.com/book/templates">Hamlet</a>&#8220;, doesn&#8217;t do much for me. I can see why type safety across the various pieces making up a web page would be something you&#8217;d aspire to, but it ain&#8217;t happening (expecting designers to embed their work in a pseudo-but-not-actually HTML language has been tried before. Frequently. And it&#8217;s been a bust every time). Snap, on the other hand, has something called &#8220;<a href="http://snapframework.com/docs/tutorials/heist/">Heist</a>&#8220;. Templates are pure HTML and when you need to drop in programmatically generated snippets you do so with a custom tag that gets substituted in at runtime. That&#8217;s alright. As for writing said markup from within code there&#8217;s a different project called &#8220;<a href="http://hackage.haskell.org/packages/archive/blaze-html/latest/doc/html/Text-Blaze.html">Blaze</a>&#8221; which looks easy enough to use.</p>

<p>Reading a <a href="http://stackoverflow.com/questions/5645168/comparing-haskells-snap-and-yesod-web-frameworks">thread</a> about Haskell web programming, I saw explicit acknowledgement on the part of framework authors from all sides that it would be possible to mix and match, at least in theory. If you like Yesod&#8217;s web server but would rather to use Snap&#8217;s Heist template engine, you could probably do so. You&#8217;d be in for all the glue code and knowing what you&#8217;re about, but this still raises an interesting point.</p>

<p>A big deal with Haskell &#8212; and one of the core premises of programming in a functional language that emphasizes purity and modularity &#8212; is that you can rely on code from other libraries not to interfere with <em>your</em> code. It&#8217;s more than just &#8220;no global variables&#8221;; pure functions are self contained, and when there <em>are</em> side effects (as captured in IO and other monads) they are explicitly marked and segregated from pure code. In IT we&#8217;ve talked about reusable code for a long time, and we&#8217;ve all struggled with it: the sad reality is that in most languages, when you call something you have few guarantees that nothing <em>else</em> is going to happen over and above what you&#8217;ve asked for. The notion of a language and its runtime explicitly going out of its way to inhibit this sort of thing is appealing.</p>

<h2>Hello web, er world</h2>

<p>Grandiose notions aside, I wanted to see if I could write something that felt &#8220;clean&#8221;, even if I&#8217;m not yet proficient in the language. I mentioned above that I liked the look of Snap. So, I roughed out some simple exercises of what using the basic API would be like. The fact that I am brand new at Haskell of course meant it took a lot longer than it should have! That&#8217;s ok, I learnt a few things along the way. I&#8217;ll probably blog separately about it, but after an essay about elegance and pragmatism, I thought I should close with some code. The program is just a little ditty that echos your HTTP request headers back to you, running <a href="http://kernel.operationaldynamics.com:58080/headers">there</a>. You can decide for yourself if the <a href="http://research.operationaldynamics.com/src/explorations/replace/Experiment.hs">source</a> is aesthetically pleasing; &#8217;tis a personal matter. I think it&#8217;s ok, though I&#8217;m not for a moment saying that it&#8217;s &#8220;good&#8221; style or anything. I will say that with Haskell I&#8217;ve already noticed that what looks deceptively simple often takes a lot of futzing to get the types right &#8212; but I&#8217;ve also noticed that when something does finally compile, it tends to be <em>very</em> close to being done. Huh.</p>

<p>So here I am freely admitting that I was quite wrong about Haskell. It&#8217;s been a bit of a struggle getting started, and I&#8217;m still a bit sceptical about the syntax, but I think the idea of leveraging Haskell shows promise, especially for server-side work.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/haskell/learning-haskell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A good GNOME 3 Experience</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gnome-3-experience</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gnome-3-experience#comments</comments>
		<pubDate>Mon, 21 Nov 2011 06:28:32 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[GNOME Desktop]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=536</guid>
		<description><![CDATA[I&#8217;ve been using GNOME 3 full time for over 9 months, and I find it quite usable. I&#8217;ve had to learn some new usage patterns, but I don&#8217;t see that as a negative. It&#8217;s a new piece of software, so I&#8217;m doing my best to use it the way it&#8217;s designed to be used. Sure, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using GNOME 3 full time for over 9 months, and I find it quite usable. I&#8217;ve had to learn some new usage patterns, but I don&#8217;t see that as a negative. It&#8217;s a new piece of software, so I&#8217;m doing my best to use it the way it&#8217;s designed to be used. </p>

<p>Sure, it&#8217;s different than GNOME 2. It&#8217;s vastly different. But it <strong>is</strong> a new UI paradigm. The GNOME 2 experience was over 9 years old, and largely based on the experience inherited from the old Windows 95 muxed with a bit of CDE. There were so many things that the GNOME hackers wanted to do &#8212; and lots of things all the UI studies said needed changing &#8212; that the old pattern simply couldn&#8217;t support.</p>

<p>Still, a lot of people are upset. Surprise. Most recently it&#8217;s been people running Debian Testing who just recently found that their distro has migrated its packages from GNOME 2.32 to GNOME 3.x. Distros like Ubuntu have been shipping GNOME 2.32 for ages; but it has been well over 2 years since anyone actually worked on that code. It&#8217;s wonderful that nothing has changed for you in all that time &#91;a true Debian Stable experience!&#93; but I think it&#8217;s a bit odd not to expect that something that was widely advertised as being such a different user experience is &#8230; different.</p>

<p><em>What I find annoying about these conversations is that if they had gone and bought an Apple laptop with Mac OS X on it they would be perfectly reasonably working through learning how to use a new Desktop and not complaining about it at all. But here we are admonishing the GNOME hackers had the temerity to do something new and different.</em></p>

<h2>Installing</h2>

<p>I went to some trouble to run GNOME 3 on Ubuntu Linux during the Natty cycle; that was a bit of work but I needed to be current; now with Oneiric things are mostly up to date. GNOME 3.0 was indeed a bit of a mess, but then so was GNOME 2.0. The recently released 3.2 is a big improvement. And it looks like the list of things that seem  targeted to 3.4 will further improve things.</p>

<p>I&#8217;m now running GNOME 3 on a freshly built Ubuntu Oneiric system; I just did a &#8220;command line&#8221; install of Ubuntu and then installed <code>gdm</code>, <code>gnome-shell</code>, <code>xserver-xorg</code> and friends. Working great, and not having installed <code>gnome-desktop</code> saved me a huge amount of baggage. Of course a normal Oneiric desktop install and then similarly installing and switching to gnome-shell would work fine too; either way you probably want to enable the  <code>ppa:gnome3-team/gnome3</code> PPA.</p>

<h2>Launchers</h2>

<p>One thing I do recommend is mapping (say) <strong><code>CapsLock</code></strong> as an additional &#8220;<code>Hyper</code>&#8221; and then <strong><code>Caps</code></strong> + <strong><code>F1</code></strong> .. <strong><code>Caps</code></strong> + <strong><code>F12</code></strong> as launchers. I have epiphany browser on <strong><code>F1</code></strong>, evolution on <strong><code>F2</code></strong>, my IRC client on <strong><code>F3</code></strong> and so on. Setting up <strong><code>Caps</code></strong> + <strong><code>A</code></strong> as to do <code>gnome-terminal --window</code> means you can pop a term easily from anywhere. You do the mapping in:</p>

<pre><code>    System Settings → Keyboard Layout → Layout tab → Options...
</code></pre>

<p>and can set up launchers via:</p>

<pre><code>    System Settings → Keyboard → Shortcuts tab → "Custom Shortcuts" → `[+]` button
</code></pre>

<p><em>(you&#8217;d think that&#8217;d all just be in one capplet, but anyway)</em></p>

<p>Not that my choices matter, <em>per se</em>, but to gives you an idea:</p>

<table>
<tr>
<th>Accelerator</th><th>Launches</th><th>Description</th>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F1</code></b></td>
<td><code>epiphany</code></td>
<td>Web browser (primary)</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F2</code></b></td>
<td><code>evolution</code></td>
<td>Email mail</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F3</code></b></td>
<td><code>pidgin</code></td>
<td>IRC client</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F4</code></b></td>
<td><code>empathy</code></td>
<td>Jabber client</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F5</code></b></td>
<td><code>firefox</code></td>
<td>Web browser (alternate)</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F6</code></b></td>
<td>shotwell</td>
<td>Photo manager</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F7</code></b></td>
<td><code>slashtime</code></td>
<td>Timezone utility</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F8</code></b></td>
<td><code>rhythmbox</code></td>
<td>Music player</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F9</code></b></td>
<td><code>eclipse</code></td>
<td>Java IDE</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F10</code></b></td>
<td><code>devhelp</code></td>
<td>GTK documentation</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F11</code></b></td>
<td><code>gucharmap</code></td>
<td>Unicode character picker</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>F12</code></b></td>
<td><code>gedit</code></td>
<td>Text editor</td>
</tr>
<tr>
<td><b><code>Caps</code></b> + <b><code>Z</code></b></td>
<td><code>gnome-terminal --window</code></td>
<td>New terminal window</td>
</tr>
</table>

<p>That means I only use the Overview&#8217;s lookup mechanism (ie typing <strong><code>Win</code></strong>, <strong><code>T</code></strong>, <strong><code>R</code></strong>, <strong><code>A</code></strong>&#8230; in this case looking for the Project Hamster time tracker) for outlying applications. The rest of the time it&#8217;s <strong><code>Caps</code></strong> + <strong><code>F12</code></strong> and bang, I&#8217;ve got GEdit in front of me.</p>

<p>Of course you can also set up the things you use the most on the &#8220;Dash&#8221; (I think that&#8217;s what they call it) as favourites. I&#8217;ve actually stopped doing that (I gather the original design didn&#8217;t have favourites at all); I prefer to have it as an alternative view of things that are actually running.</p>

<h2>Extensions</h2>

<p>People love plugin architectures, but they&#8217;re quite the anti-pattern; over and above the software maintenance headache (evolving upstream constantly breaks APIs used by plugins, for one example; the nightmare of packaging plugins safely being another) before long you get people installing things with contradictory behaviour and which completely trash the whole experience that your program was designed to have in the first place. </p>

<p>Case in point is that it didn&#8217;t take long after people discovered how to use the extension mechanism built into gnome-shell for people to start using it to implement &#8230; GNOME 2. Gawd.</p>

<p>Seeking that certainly is <em>not</em> my recommendation; as I wrote above the point of GNOME 3 and it&#8217;s new shell is to enable a new mode of interaction. Still, everyone has got their itches and annoyances, and so for my friends who can&#8217;t live without their GNOME 2 features, I thought I&#8217;d point out a few things.</p>

<p>There are a collections of <a href="http://live.gnome.org/GnomeShell/Extensions">GNOME Shell Extensions</a> some of which appear to be packaged, i.e. <code>gnome-shell-extensions-drive-menu</code> for an plugin which gives you some kind of menu when removable devices are inserted. I&#8217;m not quite sure what the point of that is; the shell already puts something in the tray when you&#8217;ve got removable media. Whatever floats your boat, I guess. Out in the wild are a bunch more. The charmingly named <a href="http://intgat.tigress.co.uk/rmy/extensions/index.html">GNOME Shell Frippery</a> extensions by Ron Yorston has a bunch of plugins to recreate GNOME 2 features. Most are things I wouldn&#8217;t touch with a ten-foot pole (a bottom panel? Who needs it? Yo, hit the <strong><code>Win</code></strong> key to activate the Overview and you see everything!).</p>

<p>My personal itch was wanting to have 4 fixed workspaces. The &#8220;Auto Move Workspaces&#8221; plugin from <code>gnome-shell-extensions</code> was close (and would be interesting if its experience and UI were properly integrated into the primary shell experience), but the &#8220;Static Workspaces&#8221; plugin from <code>gnome-shell-frippery</code> did exactly the trick. Now I have four fixed workspaces and I can get to them with <strong><code>Caps</code></strong> + <strong><code>1</code></strong> .. <strong><code>Caps</code></strong> + <strong><code>4</code></strong>. Hurrah.</p>

<p>You install the plugin by dropping the <code>Static_Workspaces@rmy.pobox.com/</code> directory into <code>~/.local/share/gnome-shell/extensions/</code>, then restarting the Shell via <strong><code>Alt</code></strong> + <strong><code>F2</code></strong>, <strong><code>R</code></strong>, and then firing up <code>gnome-tweak-tool</code> and activating the extension:</p>

<pre><code>    Advanced Settings → Shell Extension tab → switch "Static Workspaces Extension" to "On"
</code></pre>

<p>Hopefully someone will Debian package <code>gnome-shell-frippery</code> soon.</p>

<h2>Not quite properly integrated</h2>

<p>Having to create custom launchers and fiddle around with plugins just to get things working? &#8220;Properly integrated&#8221; this ain&#8217;t, and that&#8217;s my fault. I respect the team hacking on GNOME 3, and I know they&#8217;re working hard to create a solid experience. I feel dirty having to poke and tear their work apart. Hopefully over the next few release cycles things like this will be pulled into the core and given the polish and refined experience that have always been what we&#8217;ve tried to achieve in GNOME. What would be really brilliant, though, would be a way to capture and export these customizations. Especially launchers; setting that up on new machines is a <em>pain</em> and it&#8217;d be lovely to be able to make it happen via a package. Hm.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gnome-3-experience/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restoring Server to Server Jabber capability in Openfire 3.7.0</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/packaging/fix-openfire-s2s-3-7-0</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/packaging/fix-openfire-s2s-3-7-0#comments</comments>
		<pubDate>Fri, 23 Sep 2011 03:36:38 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[Packaging]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=523</guid>
		<description><![CDATA[We upgraded our Jabber from Openfire 3.6.4 to 3.7.0 but suddenly it wasn&#8217;t talking to others who had self-signed certificates (despite having been told that was ok; in such circumstances Jabber offers a &#8220;dialback&#8221; to weakly establish TLS connectivity). It was breaking with messages like: Error trying to connect to remote server: net.au (DNS lookup: [...]]]></description>
			<content:encoded><![CDATA[<p>We upgraded our Jabber from Openfire 3.6.4 to 3.7.0 but suddenly it wasn&#8217;t talking to others who had self-signed certificates (despite having been told that was ok; in such circumstances Jabber offers a &#8220;dialback&#8221; to weakly establish TLS connectivity). It was breaking with messages like:</p>

<pre><code> Error trying to connect to remote server: net.au (DNS lookup: net.au:5269)
</code></pre>

<p>in the logs. Took a while to isolate that (Java stack traces in server logs, how I hate thee), but that led me to this <a href="http://community.igniterealtime.org/thread/43966">discussion</a> about the problem.</p>

<p>Turns out to be, more or less, this <a href="http://issues.igniterealtime.org/browse/OF-443">issue</a>.</p>

<p>Back to the original thread, comment by Gordon Messmer turns the trick; he isolated the specific problem and provided a <a href="http://community.igniterealtime.org/servlet/JiveServlet/download/210618-10600/R11784.patch.zip">patch</a> which you can reverse apply. Since I had already downloaded the 3.7.1 <a href="http://bamboo.igniterealtime.org/browse/OPENFIRE-NIGHTLYDEB-286/">nightly build</a> <code>.deb</code> and installed it (which did <em>not</em> fix the problem), but with a patch in hand, I was then able to follow the advice of &#8220;Devil&#8221; to <a href="http://daredavil2014.livejournal.com/3003.html">rebuild the server and replace the <code>openfire.jar</code> manually</a>.</p>

<p>Obviously I will rebuild the <code>.deb</code> in question shortly, but I can confirm that reverting that specific change does restore server to server functionality with people you used to be able to connect to fine.</p>

<p>Meanwhile 3.7.1, alpha though it may be, does seem to have a fair few fixes in it. We&#8217;ll keep that for now.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/packaging/fix-openfire-s2s-3-7-0/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting a kvm image on a host system</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/research/mounting-a-kvm-image-on-a-host-system</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/research/mounting-a-kvm-image-on-a-host-system#comments</comments>
		<pubDate>Thu, 22 Sep 2011 13:34:34 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=511</guid>
		<description><![CDATA[Needed to mount a KVM disk image on a host system without booting the guest. I&#8217;ve used kvm-nbd in the past, but that&#8217;s more for exporting a filesystem from a remote server (and, in any event, we now use Sheepdog for distributing VM images around). Found a number of references to using losetup but wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Needed to mount a KVM disk image on a host system without booting the guest. I&#8217;ve used <code>kvm-nbd</code> in the past, but that&#8217;s more for exporting a filesystem from a remote server (and, in any event, we now use Sheepdog for distributing VM images around).</p>

<p>Found a number of references to using <code>losetup</code> but wanted something simpler; doing the loop part automatically has been a &#8220;take for granted&#8221; thing for years.</p>

<p>It turns out that if your image is in <code>kvm-img</code>&#8216;s &#8220;raw&#8221; format already then you can pretty much access it directly. We found this <a href="http://en.wikibooks.org/wiki/QEMU/Images#Mounting_an_image_on_the_host">article</a>, dated 2009, which shows you can do it pretty quickly; assuming that the partition is the first (or only one) in the disk image:</p>

<pre><code># mount -o ro,loop,offset=32256 dwarf.raw /mnt
#
</code></pre>

<p>which <em>does</em> work!</p>

<p>I&#8217;m a bit unclear about the offset number; where did that come from?</p>

<p>An <a href="http://blog.dustinkirkland.com/2008/10/mounting-kvm-disk-image.html">earlier post</a> mentioned something called <code>kpartx</code>. Given a disk, it will identify partitions and make them available as devices in via the device mapper. Neat. Hadn&#8217;t run into that one before.</p>

<p>This <a href="http://www.linuxquestions.org/questions/linux-virtualization-90/how-to-mount-a-kvm-image-file-787557/#post3856523">comment</a> on Linux Questions suggested using <code>kpartx</code> directly as follows:</p>

<pre><code># kpartx -a dwarf.raw 
# mount -o ro /dev/mapper/loop0p1 /mnt
#
</code></pre>

<p>Nice.</p>

<p>Incidentally, later in that thread is mention of how to calculate offsets using <code>sfdisk -l</code>, however that doesn&#8217;t help if you don&#8217;t already have the disk available in <code>/dev</code>. But you can use the very same <code>kpartx</code> to get the number of cylinders:</p>

<pre><code># kpartx -l dwarf.raw 
loop0p1 : 0 16777089 /dev/loop0 63
#
</code></pre>

<p>Ah ha; 63 sectors × 512 byte block size is 32256. So now we know where they got the number from; adjust your own mounts accordingly. <code>:)</code></p>

<p>AfC</p>

<p><strong>Comments</strong>:</p>

<ol>
<li>Pádraig Brady wrote in, saying &#8220;I find <code>partx</code> is overkill. I&#8217;ve been using the following <a href="http://www.pixelbeat.org/scripts/lomount.sh">script</a> for years; <code>lomount.sh dwarf.raw 1 /mnt</code> is how you might use it.&#8221; Interesting use of <code>fdisk</code>, there.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/research/mounting-a-kvm-image-on-a-host-system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix your icons package</title>
		<link>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/fix-your-icons-package</link>
		<comments>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/fix-your-icons-package#comments</comments>
		<pubDate>Sun, 21 Aug 2011 02:07:34 +0000</pubDate>
		<dc:creator>Andrew Cowie</dc:creator>
				<category><![CDATA[GNOME Desktop]]></category>

		<guid isPermaLink="false">http://blogs.operationaldynamics.com/andrew/?p=505</guid>
		<description><![CDATA[Updating today, suddenly a whole bunch of icons are broken; GNOME shell was presenting everything with a generic application diamond as its icon. Bah. I noticed gnome-icon-theme was one of the packages that bumped. It turns out that package is now only a limited subset of the GNOME icon set and that you have to [...]]]></description>
			<content:encoded><![CDATA[<p>Updating today, suddenly a whole bunch of icons are broken; GNOME shell was presenting everything with a generic application diamond as its icon. Bah.</p>

<p>I noticed <code>gnome-icon-theme</code> was one of the packages that bumped. It turns out that package is now only a limited subset of the GNOME icon set and that you have to install <code>gnome-icon-theme-full</code> to get the icons you actually need. Bah², but now everything is back the way it should be.</p>

<p>AfC</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/fix-your-icons-package/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

