<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>tag:pdw.org.uk,2007-05-22:blog-atom-1.0-feed</id>
  <title>Paul's Weblog</title>
  <updated>2008-03-27T16:48:17Z</updated>
  <link href="http://pdw.org.uk/blog/atom.xml" rel="self" />

  <author>
    <name>Paul</name>
    <email>blog-comments@pdw.org.uk</email>
  </author>

  <entry>
    <title type="html">Blink and you'll&amp;hellip; oh, too late.</title>
    <id>tag:pdw.org.uk,2007-09-15:blog-post-0019</id>
    <updated>2007-09-15T22:21:46Z</updated>
    <link href="./posts/0019.html" />

    <summary type="html">There will exist a 200-picosecond interval, henceforth ignored, every 136 years when the 64-bit field will be zero and thus considered invalid. </summary>
    <content type="html">
      <![CDATA[<q>There will exist a 200-picosecond interval, henceforth ignored, every
136 years when the 64-bit field will be zero and thus considered
invalid.</q>
<p>&mdash; RFC1305</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Atom for the Masses</title>
    <id>tag:pdw.org.uk,2007-07-17:blog-post-0018</id>
    <updated>2007-07-17T10:23:18Z</updated>
    <link href="./posts/0018.html" />

    <summary type="html"> Whilst running the blog's Atom feed through a feed validator, I discovered that I may have been unwittingly causing people problems by &amp;hellip; using sane XML for the feed. </summary>
    <content type="html">
      <![CDATA[<q>If it ain't broke, maybe you still need to &lsquo;fix&rsquo; it.</q>

<p>Whilst running the blog's Atom feed through a feed validator, I
discovered that I may have been unwittingly causing people <a
href="http://validator.w3.org/feed/docs/warning/AvoidNamespacePrefix.html"
>problems</a> by &hellip; using sane XML for the feed.</p>

<p>Having dutifully associated the Atom namespace with the
<code>atom:</code> prefix that all appropriate tags had been given, it
turns out that this is more than many aggregators understand, despite
being barely above entry-level XML syntax.  So, I've moved to the
alternative &lsquo;switch default namespaces as necessary&rsquo;
approach, which is a bit like moving to a friend's house just so that
you can say &lsquo;home&rsquo; rather than &lsquo;your place&rsquo;.</p>

<p>Fortunately <a href="http://plasmasturm.org/log/376/"> other
people</a> also feel this is an unsatisfying state of affairs, and
there's a <a
href="http://intertwingly.net/wiki/pie/XmlNamespaceConformanceTests"
>project</a> already in place that identifies the offenders (which sadly
include Safari and Thunderbird) and the standards-compliant tools (such
as Firefox and IE7).</p>

<p>If you've been having problems with the Atom feed for this blog in
the past, hopefully all should now work.  Why not drop a line to your
aggregator's developers and see if you can't get it fixed for all the
others too?</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Setting up DNS caching on Ubuntu</title>
    <id>tag:pdw.org.uk,2007-05-22:blog-post-0017</id>
    <updated>2007-05-22T22:58:37Z</updated>
    <link href="./posts/0017.html" />

    <summary type="html">Quick post: how to set up local DNS caching under Ubuntu. </summary>
    <content type="html">
      <![CDATA[<q>You'll <code>dig</code> this</q>
<p>Quick post: how to set up local DNS caching under Ubuntu.  I
sometimes find that there's a long delay when launching applications.
Often this is just the system working hard to start them, but sometimes
there's no load being generated whilst everything sits there for a
couple of seconds.</p>
<p>It occurred to me that this might be due to a network timeout or
sluggish response of some kind, and a quick look at the output of
tcpdump proved that there was indeed a DNS query going on every time I
launched <code>xterm</code>.</p>
<p>Rather than sit and wait for the DNS server to get back to me, I
decided to install a local DNS server to cache responses.  These
instructions are a bit basic, but they should show you what needs to be
done.  Good luck!</p>
<ul>
<li>Have a look at what DNS you're getting a the moment.
<pre>
root@box:~# dig google.com | grep -A 1 Query
;; Query time: 146 msec
;; SERVER: 10.0.0.254#53(10.0.0.254)          
</pre>
</li>

<li> Install the package.
<pre>
root@box:~# aptitude install dnsmasq
</pre>
</li>

<li> Edit the server config to enable local serving.
<pre>
root@box:~# vi /etc/dnsmasq.conf
  [look for a line starting '#listen-address=']
  [remove that initial '#' and add '127.0.0.1']
  [result should be 'listen-address=127.0.0.1']
  [save file and exit]
</pre>
</li>

<li> Add 127.0.0.1 to your list of nameservers.
<pre>
root@box:~# vi /etc/resolv.conf
  [insert a new first line that reads 'nameserver 127.0.0.1']
  [save file and exit]
</pre>
</li>

<li> Every time DHCP gets a new lease, <code>resolv.conf</code> will be
re-written.  Edit the DHCP configuration to always add the local DNS
server entry that we added in the previous step.  (You might want to
check that the last step hasn't been re-written whilst you've been doing
this one.)
<pre>
root@box:~# vi /etc/dhcp3/dhclient.conf
  [find the line starting '#prepend domain-name-severs']
  [remove the initial '#' character]
  [line should read 'prepend domain-name-servers 127.0.0.1;']
  [save file and exit]
</pre>
</li>

<li> Launch the server.
<pre>
root@box:~# /etc/init.d/dnsmasq start
</pre>
</li>

<li> Check the local server is being used, and see how much faster it
is.
<pre>
root@box:~# dig google.com | grep -A 1 Query
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
</pre>
</li>
</ul>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Generating UUIDs with the 'tag:' URI scheme</title>
    <id>tag:pdw.org.uk,2007-05-16:blog-post-0016</id>
    <updated>2007-05-16T21:55:53Z</updated>
    <link href="./posts/0016.html" />

    <summary type="html">For some time I've been tripping over the need to generate unique identifiers for things. </summary>
    <content type="html">
      <![CDATA[<q>What no <code>4e0c21aa-03f8-11dc-8528-000d616f1a9f</code>?</q>
<p>For some time I've been tripping over the need to generate unique
identifiers for things.  I've always managed to avoid actually having to do
so one way or another, but (to make a cliched paraphrase) "with great blog
engine comes great responsibility": in order to generate an Atom RSS feed, I
need to generate identifiers for each posts.</p>

<p>So far I've been expecting this to involve generating 128-bit UUIDs (as
described in <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>)
using one of several algorithms, none of which are simple, and all of which
seem much too involved when I'm simply trying to stop a feed aggregator
confusing my posts.</p>

<p>All of this might explain why I was so happy to find a page describing <a
href="http://www.taguri.org/">how to generate a tag URI</a>.  Especially so
when I realised there was an <a
href="http://www.faqs.org/rfcs/rfc4151.html">RFC</a> for the procedure.  I
won't try to cover all the details they give there, but in a nutshell the
procedure is approximately this</p>

<ul>

<li>Start off with '<code>tag:</code>' .</li>

<li>Add your e-mail address, or domain name if you have one.</li>

<li>Add a comma, and follow that by the date in <code>2007-01-01</code>
format.</li>

<li>Think of a name which hasn't already been used for that combination of
address/domain and date, and separate it from what's gone before using a
colon.</li>

<li>The end result might look like this:
<code>tag:pdw.org.uk,2007-05-16:Example</code>
</li>

<li>Profit!</li>

</ul>

<p>Hopefully you might find it useful (or at least informative).  I know I
will!</p>

<p>For more details, see <a
href="http://www.taguri.org/">http://www.taguri.org</a>.</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">A new blog engine</title>
    <id>tag:pdw.org.uk,2007-05-16:blog-post-0015</id>
    <updated>2007-05-16T21:38:25Z</updated>
    <link href="./posts/0015.html" />

    <summary type="html">Well, it's finally happened. </summary>
    <content type="html">
      <![CDATA[<q>If you want something done&hellip;</q>
<p>Well, it's finally happened.  I've been getting along reasonably well with
Nanoblogger for some time now, but a couple of things started to put me
off.</p>

<p>Firstly, it is very slow indeed.  I've only got a few posts up here, and I
was having to wait for well over a minute for it to generate the blog.  It
might have been about three, but it was some time ago so don't quote me on
that.  Delving into the code, it looked like there were just a couple of hot
spots, but they were getting very hot indeed.</p>

<p>Secondly, support for images in posts was, for me, rather awkward.  The
only way to include images in a post was to point to them with an absolute
URL.  For most people I can imagine this isn't a problem, but as it happens I
like to view my blog from two places: via my main blog URL (where you're
probably reading this from now), and from a secondary URL which gives me the
option of previewing things before I release them.  Obviously having the same
link at different URLs isn't going to be easy, and although I'd patched round
it using symlinks it wasn't pretty.</p>

<p>So, I decided that I wanted to keep the other key features of Nanoblogger
&mdash; static pages, categories, no software dependencies other than
<code>bash</code>, and a simple interface &mdash; whilst improving on the
speed and flexibility.  Needless to say, I've written the new engine from
scratch, in <code>bash</code>, and it's both fast and portable.  In fact, all
the internal links are relative, and there's facility for including user
content alongside the posts.</p>

<p>Atom, or possibly RSS 2.0, support will be along shortly, once I've had
chance to digest the specification documents.  In the meantime, hopefully
this will mean that posts are slightly less infrequent.</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Finally - 1989 at last!</title>
    <id>tag:pdw.org.uk,2006-11-25:blog-post-0014</id>
    <updated>2006-11-25T00:35:32Z</updated>
    <link href="./posts/0014.html" />

    <summary type="html">If you ever had the pleasure of using !Draw on the Archimedes A3000, put your pointer here, click the link, then close your eyes and wish for home &amp;hellip;  If you made it back here only to find you now need a copy of that marvellous RISC OS app to take the pain away, I can only suggest you get yourself a copy of the excellent Inkscape instead. </summary>
    <content type="html">
      <![CDATA[<q>Quick, !Draw something.</q>
<p>If you ever had the pleasure of using <code>!Draw</code> on the Archimedes
A3000, put your pointer <a
href="http://www.old-computers.com/museum/computer.asp?st=1&amp;c=697">here</a>,
click the link, then close your eyes and wish for home &hellip;</p>

<p>If you made it back here only to find you now need a copy of that
marvellous RISC OS app to take the pain away, I can only suggest you get
yourself a copy of the excellent <a
href="http://www.inkscape.org/download/">Inkscape</a> instead.  (Available
for Linux, Mac OS X (universal) and Windows.)</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Holy Forking Emacs, Batman! (Pt.2)</title>
    <id>tag:pdw.org.uk,2006-11-16:blog-post-0013</id>
    <updated>2006-11-16T16:36:03Z</updated>
    <link href="./posts/0013.html" />

    <summary type="html"> OK, so maybe some of you are still thinking "Remote file access? Surely you don't still think that's worth blogging about, do you?." And I'll be the first to agree &amp;mdash; what really got me going was this:    There are lots of other nice things (as you're about to see), but if it hadn't been for the ability to do that, you probably wouldn't be reading this. </summary>
    <content type="html">
      <![CDATA[<q>No really &mdash; there's a church <em>and</em> background processing.</q>

<p>OK, so maybe some of you are still thinking <em>"Remote file access?
Surely you don't still think that's worth blogging about, do you?."</em> And
I'll be the first to agree &mdash; what <em>really</em> got me going was
this:</p>

<img src="images/tramp-and-auctex-screens/auctex-quadratic.png"
alt="Properly typeset formula in an Emacs window" />

<p>There are lots of other nice things (as you're about to see), but if it
hadn't been for the ability to do that, you probably wouldn't be reading
this.</p>

<p>So what's it like, then?  Well, I'm no LaTeX heavyweight &mdash; I've
never written a document that spreads across multiple files, unlike several
of my friends &mdash; but I've done enough here and there to be able to see
that this is a very well thought-out package.</p>

<p>First though, install AUCTeX.  I use Ubuntu (as you might have gathered
by now), so I just type:</p>

<pre>
aptitude install auctex
</pre>

<p>The <code>README</code> gives three lines which you should add to
your <code>.emacs</code> file, but I'm feeling exuberant, so instead I let dpkg
configure things so that <em>everyone</em> on my machine (that is, me) gets
AUCTeX.</p>

<p>Then we install the preview-latex package, which we'll see more of
later.</p>

<pre>
aptitude install preview-latex
</pre>

<p>And now the fun starts!</p>

<ul>

<li>First, there's a key binding (<code>C-c C-e</code>) to insert any kind of
environment you might want (and you can tab-complete them if you're not
sure).  For example, starting a new report using the 11pt font is as simple
as typing <code>C-c C-e document RET </code> ... <br />

<img
src="images/tramp-and-auctex-screens/auctex-insert-document.png"
alt="Specifying the environment type" />
</li>

<li> ... <code> report RET 11pt RET</code>.<br />

<img
src="images/tramp-and-auctex-screens/auctex-specify-document-options.png"
alt="Specifying document options" />
</li>

<li>Inserting section headings (<code>C-c C-s</code>) is just as simple:
decide whether you want a section, subsection, chapter, or whatever,
then give it a title.  I find this interactive approach makes life much
easier.  You'll also find the cursor automatically positioned somewhere
useful; starting a document leaves it just after the
<code>\begin{document}</code> line.<br />

<img
src="images/tramp-and-auctex-screens/auctex-section-title.png"
alt="Entering the section title" />
</li>

<li>You're prompted to supply a label for the section (with a helpful prefix
filled in automatically), and headings are (configurably) displayed in a
suitable font.<br />

<img
src="images/tramp-and-auctex-screens/auctex-section-with-label.png"
alt="A section heading with its label" />
</li>

<li>You also get font highlighting available for footnotes, math mode, etc.,
plus a couple of subtle things, like subscript characters being slightly
smaller (look at the <code>B</code>, <code>D</code>, and <code>E</code>
characters in the formula).  <br />

<img
src="images/tramp-and-auctex-screens/auctex-font-highlighting.png"
alt="Font highlighting on various elements" />
</li>

<li>The fun really begins when you fire up the preview-latex package.
First we type <code>C-c C-p C-f</code> to turn on some
caching, and then we type <code>C-c C-p C-b</code> to run the
<code>preview-buffer</code> command.  (There's a menu you can access all of
this from, too, of course.)  After a couple of seconds and some processor
activity, bits of the document vanish, and are mysteriously replaced by tiny
"men at work" signs: <br />

<img
src="images/tramp-and-auctex-screens/auctex-roadworks.png"
alt="Men-at-work signs where elements will be rendered" />
</li>

<li>After another couple of seconds, the roadworks signs vanish too, and
you see the fully-rendered TeX output, right there in the buffer!  There
are a few things to notice here.  First, the section heading has the
appropriate number attached; it's 0.1 here because we're in a report and
there isn't a chapter yet.  Second, the math-mode formula has been
rendered, and properly shows the superscript and subscript characters.
Finally, the footnote has been rendered down to a superscript '1'.  <br
/>

<img
src="images/tramp-and-auctex-screens/auctex-preview.png"
alt="Buffer with LaTeX elements rendered" />
</li>

<li>All of the rendered sections are genuine parts of the buffer, not
some kind of temporary overlay &mdash; they scroll off-screen with the
rest of the text, and you can move the cursor around and over them.  The
only difference is that they will expand into the original source
whenever you try to move 'into' them.  You can then edit that source
normally, and recompile the affected part using <code>C-c C-p C-p</code>
to run the <code>preview-at-point</code> command.<br />

<img
src="images/tramp-and-auctex-screens/auctex-expanded-footnote.png"
alt="Rendered footnote expanded to source" />
</li>

<li>Even better, it's compatible with a 'greenscreen' mode I put
together a while ago.  You need to re-render things to pick up the new
colours, but that's it.  Green-tastic!<br />

<img
src="images/tramp-and-auctex-screens/auctex-greenscreen.png"
alt="Same buffer in 'greenscreen' mode" />
</li>

</ul>

<p>There are, of course, lots of things which I haven't covered here:
toggling whether a preview section is rendered or not; marking sections
of the document to be rendered as a single block; re-rendering only part
of a buffer, or the whole document; do-the-right-thing LaTeX compiling
and viewing commands; handling multi-file compilation;
block-(un)commenting commands; LaTeX environment folding; and lots of
customisable options through <code>M-x customize-group RET AUCTeX
RET</code>.</p>

<p>One thing which I came across myself and might be of use if you
notice the same problem was that some of the rendered text had green
fringing.  (If you weren't sharp-eyed enough earlier, have a look at the
bottom of the '0.1' section header.)  This is caused by preview-mode
antialiasing to the wrong color.  By default it uses the pale green used
for mouse highlighting, and it does look exactly right when you move the
mouse over it (for example, if you're asking preview-mode to render the
section again via a pop-up).  Normally I don't use the mouse, though, so
I customised this by changing the value of "Preview Transparent Color"
using <code>M-x customize-group RET preview-appearance RET</code> (or,
for a slightly quicker way, via <code>C-h v preview-transparent-color
RET</code> and the 'customize' link).</p>

<p>Something to be aware of if you do this: setting the transparency colour
to <em>exactly</em> the same colour as the default text background makes the
cursor shape used for rendered sections change from a box around the outside
of them to a solid rectangle, which can make previews hard to see.  There
might be more informed ways to solve this problem, but I found that setting
the transparency colour to <em>almost</em> exactly the same as the background
looked fine.</p>

<p>After all these features, I can start to see where sites such as <a
href="http://www.dina.kvl.dk/~abraham/religion/">this one</a> might be
coming from &hellip;</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Holy Forking Emacs, Batman! (Pt.1)</title>
    <id>tag:pdw.org.uk,2006-11-14:blog-post-0012</id>
    <updated>2006-11-14T22:37:49Z</updated>
    <link href="./posts/0012.html" />

    <summary type="html"> I recently had something of an Emacs overload after discovering two separate, great, add-ons within a couple of days of each other. </summary>
    <content type="html">
      <![CDATA[<q>No really &mdash; there's a church <em>and</em> background processing.</q>

<p>I recently had something of an Emacs overload after discovering two
separate, great, add-ons within a couple of days of each other.  Either
would have been bearable, but I'm afraid the two together compels me to
post; and following earlier success with the what-I-see-is-what-you-get
approach, you'd better get ready for more screenshots&hellip;</p>

<p>First was <a
href="http://www.emacswiki.org/cgi-bin/wiki/TrampMode">TRAMP</a> mode.
This has been around for years, but was still new to me, and might be to
you too.  (If not, hey &mdash; what can I do?)</p>

<p>The basic idea is that you can use SSH to let you edit files on any
machines you have access to.  TRAMP logs in via SSH, pulls a copy of the
file back, and lets you work on it as if it were local.  Some pictures
will give you a better idea.</p>

<ul>
<li> First, since I'm running Ubuntu, I just install the package with:<br />
<pre>
$ sudo aptitude install tramp
</pre></li>

<li> Then we load Emacs, specify the file name in the form <code> /
&lt;user&gt; @ &lt;host&gt; : &lt;path&gt; </code> and we're off.<br />
Let's have a look at my remote <code>.emacs</code> file:<br />

<img src="images/tramp-and-auctex-screens/tramp-find.png"
alt="find-file dialog" /></li>

<li> Wait for a few seconds for TRAMP to log in and figure out what the
shell at the other end's capable of:<br />
<img src="images/tramp-and-auctex-screens/tramp-remote-shell.png"
alt="Checking remote shell capabilities" /></li>

<li> That's it; the file's loaded.  You can edit it, save it, or write
to a different name if you like; the fact that the file's on another
machine is entirely transparent. <br />
<img src="images/tramp-and-auctex-screens/tramp-voila.png"
alt=".emacs file loaded" /></li>
</ul>

<p> TRAMP also handles other communications methods, such as scp, rsh,
telnet, plink (distributed with Putty on Windoze), sudo (for editing as
someone else), and rsync.  You can also do tab completion on file and
directory names, or use Dired mode (Emacs' file explorer) on the remote
filesystem, should you feel the need. </p>

<p> I also discovered the joys of <a
href="http://www.gnu.org/software/auctex/">AUCTeX</a>, but you'll have
to wait until next time to see <em>those</em>.</p>

<p>Enjoy!</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Revision Control Not-So-Quickie</title>
    <id>tag:pdw.org.uk,2006-11-06:blog-post-0011</id>
    <updated>2006-11-06T21:52:12Z</updated>
    <link href="./posts/0011.html" />

    <summary type="html">The other day I found myself needing to put some relatively minor code under revision control. </summary>
    <content type="html">
      <![CDATA[<q>Introduction to darcs</q>
<p>The other day I found myself needing to put some relatively minor code
under revision control.  Traditionally I've used <a
href="http://en.wikipedia.org/wiki/Revision_Control_System"><code>rcs</code></a>,
as it's very simple, not hard to understand, and was available damn near
everywhere (on Un*x machines, at least).</p>

<p>This time though, my laptop <em>didn't</em> have it installed, so I looked
around for alternatives.  <a
href="http://en.wikipedia.org/wiki/Concurrent_Versions_System"><code>cvs</code></a>
and its successor Subversion (<a
href="http://en.wikipedia.org/wiki/Subversion"><code>svn</code></a>) both
require a central repository to be set up, which was neither simple enough to
do on the spur of the moment, nor a convenient architecture for my
circumstances, working as I do on a laptop, public server, and (frequently
powered down) home machine.</p>

<p>What I found instead was <a
href="http://en.wikipedia.org/wiki/Darcs"><code>darcs</code></a>, which has a
number of things going for it.  Firstly, it has a good <a
href="http://www.darcs.net/manual/darcs.ps">manual</a> and plenty of <a
href="http://www.darcs.net/DarcsWiki">support</a>.  Secondly, it has a well
thought-out <a href="http://www.darcs.net/DarcsWiki/PatchTheory">formal
semantics</a> underneath it, which (writing as a computer scientist) is
always a good thing to see.  This is bolstered by the fact that it's written
in <a
href="http://en.wikipedia.org/wiki/Haskell_%28programming_language%29">Haskell</a>,
by a physicist who appears to know <a
href="http://osdir.com/Article2571.phtml">what he's on about</a>.  Finally,
it's a decentralised architecture, meaning the options available at one
installation are much the same as those available anywhere else, whether they
happen to be on the same machine or not.</p>

<p>Anyway, enough of that: here's what it looks like to use.</p>

<ul>

<li>Get things started.
<pre>
$ cd ~/SRC
$ vi foo.lisp        # Create the masterpiece
$ darcs initialize
$ ls
_darcs  foo.lisp     # All darcs' stuff is in _darcs
</pre>
</li>

<li>Add something to the repository.
<pre>
$ darcs add foo.lisp
$ darcs whatsnew
<em>{</em>
<em>addfile</em> ./foo.lisp
<em>hunk</em> ./foo.lisp 1
+(format t "Hello, world!")
<em>}</em>
</pre>
</li>

<li>Check things in.
<pre>
$ darcs record
Darcs needs to know what name to use as the author so that [...]
&lt;snip&gt;
What is your e-mail address? foo@bar.baz
<em>addfile</em> ./foo.lisp
Shall I record this change? (1/?)  [ynWsfqadjkc], or ? for help: y
<em>hunk</em> ./foo.lisp 1
+(format t "Hello, world!")
Shall I record this change? (2/?)  [ynWsfqadjkc], or ? for help: y
What is the patch name? Initial revision
Do you want to add a long comment? [yn]n
Finished recording patch 'Initial revision'
$ darcs whatsnew
No changes!
</pre>
</li>

<li>Make more changes
<pre>
$ vi foo.lisp
$ darcs whatsnew
<em>{</em>
<em>hunk</em> ./foo.lisp 1
+;; Print "Hello, world!" message
<em>}</em>
$ darcs record
<em>hunk</em> ./foo.lisp 1
+;; Print "Hello, world!" message
Shall I record this change? (1/?)  [ynWsfqadjkc], or ? for help: y
What is the patch name? Add "Hello, world!" comment
Do you want to add a long comment? [yn]n
Finished recording patch 'Add "Hello, world!" comment'
</pre>
</li>

<li>See what we've got.
<pre>
$ darcs changes
Mon Nov  6 22:15:12 GMT 2006  foo@bar.baz
* Add "Hello, world!" comment

Mon Nov  6 21:45:46 GMT 2006  foo@bar.baz
* Initial revision
</pre>
</li>

<li>Let's make a new copy to work on different branch &mdash; on another
machine, if we want to.
<pre>
$ cd ~/BRANCHES
$ ls
$ darcs get ~/SRC
Copying patch 2 of 2... done!
Finished getting.
$ ls
SRC
$ darcs get foo@machine.com:/home/foo/SRC --repo-name=SRC-SSH
Enter passphrase for key '/home/foo/.ssh/id_dsa':
Applying patch 2 of 2... done!
Finished getting.
$ ls
SRC SRC-SSH
$ cd SRC-SSH
$ darcs changes
Mon Nov  6 22:15:12 GMT 2006  foo@bar.baz
* Add "Hello, world!" comment

Mon Nov  6 21:45:46 GMT 2006  foo@bar.baz
* Initial revision
$ vi foo.lisp
$ darcs whatsnew
<em>{</em>
<em>hunk</em> ./foo.lisp 3
+(format t "The End.")
<em>}</em>
$ darcs record
Darcs needs to know what name [...]
&lt;snip&gt;

What is your e-mail address? foo-ssh@bar.baz
<em>hunk</em> ./foo.lisp 3
+(format t "The End.")
Shall I record this change? (1/?)  [ynWsfqadjkc], or ? for help: y
What is the patch name? Add ending.   
Do you want to add a long comment? [yn]n
Finished recording patch 'Add ending.'
</pre>
</li>

<li>Now bring the changes back into the original repository.  This could just
as easily be done over HTTP if the directory were visible on a web server.
<pre>
$ cd ~/SRC
$ darcs pull ~/BRANCHES/SRC-SSH

Mon Nov  6 22:26:32 GMT 2006  foo-ssh@bar.baz
  * Add ending.
Shall I pull this patch? (1/1)  [ynWvpxqadjk], or ? for help: y
Finished pulling and applying.
$ cat foo.lisp
;; Print "Hello, world!" message
(format t "Hello, world!")
(format t "The End.")
</pre>
</li>

<li>We're bored of this, so let's e-mail the changes off, create a tarball
of the current state, and get rid of all the <code>darcs</code> stuff.  Here
the web-site has already got the first two patches, so <code>darcs</code>
only sends the third.
<pre>
$ darcs send http://foo.bar.baz/projects/demo

Mon Nov  6 22:26:32 GMT 2006  foo-ssh@bar.baz
  * Add ending.
Shall I send this patch? (1/1)  [ynWvpxqadjk], or ? for help: y
What is the target email address? foo-mail@bar.baz
Successfully sent patch bundle to: foo-mail@bar.baz
$ darcs dist
Created dist as SRC.tar.gz
$ ls
_darcs foo.lisp SRC.tar.gz
$ tar tzf SRC.tar.gz 
SRC/
SRC/foo.lisp
$ rm -rf _darcs
$ ls
foo.lisp SRC.tar.gz
$ darcs changes

darcs failed:  Not a repository
</pre>
</li>
</ul>

<p>The e-mail contains an attachment, which can be saved and applied using
<code>darcs apply</code>.  You can also sign the e-mail with your GPG key
when you send, and have the other end automatically check the signature
against its keyring.  Oh, and there's a helpful <a
href="http://www.darcs.net/manual/node7.html#SECTION00782000000000000000">setting</a>
that lets you specify a command which runs any tests you might have, for
example HTML validators or unit tests; this lets you stop patches which would
break things from getting committed to the repository.  And of course, you
can do lots of other stuff, like back changes out, tag versions with numbers
and labels, etc.</p>

<p>It might not be so industrial-strength as a full Subversion installation,
but it's just right for setting up in a couple of seconds where its needed
and getting things done.  And if you later find you need the big guns, don't
worry &mdash; there's <a href="http://www.darcs.net/DarcsWiki/Tailor">tool
support</a> for converting to (and from) most major alternatives.</p>]]>
    </content>
  </entry>

  <entry>
    <title type="html">Framebuffer (Disabling) for Dummies</title>
    <id>tag:pdw.org.uk,2006-11-02:blog-post-0010</id>
    <updated>2006-11-02T15:29:55Z</updated>
    <link href="./posts/0010.html" />

    <summary type="html"> Linux framebuffer support has been around for so long that some people probably don't realise that there was a world before framebuffers, in which the only way to look at graphics was to a) run X, or some such program, which would take over the console and speak SVGA straight to the graphics card, or b) get creative. </summary>
    <content type="html">
      <![CDATA[<q>Full of Framebuffer Goodness</q>

<p>Linux framebuffer support has been around for so long that some
people probably don't realise that there was a world before
framebuffers, in which the only way to look at graphics was to a) run
X, or some such program, which would take over the console and speak
SVGA straight to the graphics card, or b) get <a
href="http://aa-project.sourceforge.net/gallery/">creative</a>.</p> 

<p>Whilst I don't much mind pretty graphics at boot time (the default
<a href="http://www.ubuntu.com/">Ubuntu</a> <a
href="http://blog.eax.fr/index.php/2006/01/26/58-installation-de-ubuntu-linux-illustree-pas-a-pas-pour-debutants">splash</a>
<a
href="http://www.zdnet.com.au/shared/images/news/ubuntu/bootscreen.gif">screen</a>
is pleasant enough), it's a little-mentioned fact that on the text
consoles, framebuffer support is significantly slower than the
alternative (presumably because it sends rendered characters to the
video card one pixel at a time, rather than sending them over as
(byte-sized) character values for the hardware to render itself).</p> 

<p>As an example, my current (work) machine is able to scroll through
the <code>man</code> man page in about four and a half seconds using
the framebuffer.  That's about 28k of text, and 3700 lines.  (In case
you were wondering, running <code>man</code> takes about 0.2 seconds;
dumping the output in a file and using <code>cat</code> instead makes
no appreciable difference in speed.) Without framebuffer, my (old)
work laptop is able to scroll through almost three megabytes of text
&mdash; 350,<em>000</em> lines &mdash; in less than five seconds.
In case it hasn't hit you yet, that's a factor of about a hundred.  As
you might imagine, there was rarely any point in using
<code>tail</code>, because displaying output and returning to the
prompt rarely took more than a blink.  Scrolling text in a pager used
to be instantaneous; with framebuffer you can watch the characters
scrolling up the screen.</p> 

<p>Of course, as I rarely venture outside X these days, this isn't a
problem.  And the framebuffer isn't all bad: it can do things which
weren't possible before &mdash; one of the nicest of which is being
able to use high resolutions for displaying lots of text.  At only
1024&#215;768, you can get 48 rows of 128-column text, which makes for
a nice <code>mutt</code> or <code>emacs</code> session.  And of
course, you can also get a <a
href="http://distro.ibiblio.org/pub/linux/distributions/vectorlinux/docs/vl50/images/vl5dyn/vd5-boot.png">picture</a>
of a <a
href="http://users.telenet.be/geertu/Linux/fbdev/logo.html">penguin</a>
with your login prompt.</p> 

<p>Anyway, I'd long assumed that the only way to change what, and
whether, framebuffer was available was to get into kernel recompiles;
and life is too short for that, especially now that packaged kernels
regularly support everything I need them to.  So I occasionally
thought fondly of it, and left it at that.  But no!  Life is
<strong>much</strong> simpler than I'd expected it could ever be!
Hurrah, and much use of exclamation marks!</p>

<p>It turns out that you can just use the kernel boot-time options.
See your local, friendly <a
href="http://www.gnu.org/software/grub/">boot-loader</a> documentation
for information on passing these to the kernel; I press <code>e</code>
a couple of times from the boot menu.  There are generally a few
kernel options already set, such as <code>splash</code> and
<code>root=/dev/...</code>, which you can look for if you're not sure.</p>

<p>Then, if you want to use plain (fast) text for your text consoles
just add</p>

<pre>vga=normal</pre>

<p>to your options.  Unless you're using the framebuffer as your
rendering device, this will make no difference at all to how X works
&mdash; and if find you are, just reboot and you'll be right back to
normal.</p> 

<p>If you want to stay with framebuffer but go for something
higher-res, pick a value from Ubuntu's <a
href="https://wiki.ubuntu.com/FrameBuffer">helpful page</a> and
substitute a number (in decimal) in place of <code>normal</code>.  The
mode mentioned above would be</p>

<pre>vga=791</pre>

<p>for example.</p> 

<p>And if you really like it, you can always set it for future use:
see <a href="http://ubuntuforums.org/showthread.php?t=258484">
http://ubuntuforums.org/showthread.php?t=258484</a> for details.</p>]]>
    </content>
  </entry>

</feed>
