Search Results: "Chris Lamb"

11 December 2007

Chris Lamb: Claws Mail transparent subject rewriting

I use Claws-Mail (née Sylpheed-Claws) for my email. One nice feature I found a couple of months ago was subject-line rewriting: A number of mailing lists I subscribe to add a totally obnoxious prefix on each outgoing message. I’ve yet to think of a good reason to do this - I can only assume it’s for far less capable mail clients. Or something. This results in much cleaner message list. You can probably do this in procmail, but having it in the presentation layer has the advantage that the rewrite is non-destructive - pressing Reply constructs a subject line from the original.

Chris Lamb: So awesome..

I <3 Ellie so much - she made me a cat for my birthday. :)

7 December 2007

Chris Lamb: Maintainership of SWI-Prolog

As of today I am the new maintainer of the SWI-Prolog package in Debian:
swi-prolog (5.6.47-1) unstable; urgency=low
  * New upstream version (Closes: #295209, #308325, #425580)
  * New maintainer (Closes: #422576)
  * Bump Debhelper compatibility to 5
  * debian/rules:
     * Update config.sub and config.guess from autotools-dev
         (Closes: #408076, #414181)
     * Desist from blindly ignoring "clean" target
  * debian/control:
     * Use $ binary:Version  instead of $ Source-Version 
     * Add new Homepage: field
     * Add XS-Vcs-* fields
  * Change ".menu" sections from
       "Apps/Programming" -> "Applications/Programming"
  * Documentation:
     * Remove some SGML documentation now missing from upstream
     * Add Sicstus and SWI-Prolog v4.8 -related XPCE documentation
  -- Chris Lamb < _ @chris-lamb.co.uk>  Sun, 02 Dec 2007 23:26:00 +0000
There are still a few issues with the package, but I felt that getting the new upstream release and fixing the RC bugs was the primary goal. It will be of a superior quality to the current one anyway (which was removed from Etch). UPDATE: Oh, I forgot to mention #423322. Too many bugs!

2 December 2007

Chris Lamb: Custom Debian-Installer images for DCS

It can be a little awkward installing Debian in my Department’s labs. After obtaining a DHCP lease, you cannot establish any useful connection without first authenticating against a HTTP Basic page. However, as this page uses SSL and D-I’s Wget is not linked against any SSL libraries, you are a little stuck. To solve this (and to avoid resorting to ugly hacks), I created a udeb that prompts the user for their username and password (see screenshots above) and then authenticates using a statically-linked build of Curl. It seems to be fairly robust, and only bloats the ISO by about 200KB. I’ve also preseeded a number of options suitable for DCS, such as using the local mirror and assuming UK locales and keyboard, etc. My modifications are available, along with some documentation on how to recreate my images. I have also uploaded a few images to our mirror. D-I hacking turns out to be quite fun and relatively painless, but I’m now stuck for a useful project to use it again, and I probably don’t know enough yet to tackle some of its Lenny goals either. Any ideas? Oh, if some d-i guru can explain how I can force the display of the “Choose suite” question without patching choose-mirror, that would also be excellent.

31 October 2007

Chris Lamb: Essential course texts for sale. Never used .

17 October 2007

Chris Lamb: Missing notes in the Mozart s Dissonance quartet K. 465?

The second movement of Mozart’s String Quartet in C «Dissonance», K. 465 has an interesting two bars where it appears that the violin theme is accidentally missing. As highlighted in red on the score, the violin part is devoid of the crotchet/four quavers that the other parts present - the other “missing” bar is at this section’s mirror in the sub-dominant, bar 75. Some printed editions have added the missing notes, claiming that Mozart made a mistake (or overruling him on musical grounds!), but it seems bizarre that Mozart—who even likened the composition of the “Haydn” quartets to a long, labourious fatigue (”lungha e laboriosa fatica“)—would make such an error. The preface to the Neue Mozart Ausgabe claims:
It is unthinkable that Mozart [could] have made a mistake or from absent-mindedness made a slip of the pen no less than four times in such an obvious and important detail.
(The preparation of the original first edition, which Mozart himself presided over, presumably accounts for the other two.) At least one scholar has claimed that the notes aren’t missing at all; they are simply contained within the cello’s notes. I don’t find this explanation particulary satisfying. The NMA goes further by stressing its wish that the original version should be used in performances, which seems to suggest that adding the notes is (or at least, was) a common practice, but I cannot find many recordings with the added notes: my Leipziger, Emerson, Alban Berg, Ysa e, Italiano and Amadeus Quartet interpretations all omit the notes, whilst only the Hagen Quartet add them.

9 October 2007

Chris Lamb: Optimal solution for the block stacking problem found

I attended an interesting seminar on the block stacking problem today given by Professor Mike Paterson of the University of Warwick. Like all good problems, it can be stated simply: how far can a stack of n identical blocks be made to hang over the edge of a table? The answer was widely believed to be of order log n (like the white shaded example above), but Mike Paterson and Uri Zwick previously constructed overhangs of order n^ 1/3 . In the seminar today, Paterson and his co-authors presented their proof that order n^ 1/3 is indeed the upper bound possible, resolving a long-standing mathematical problem. Professor Paterson is an excellent orator, highly recommended.

Chris Lamb: Top 10 interactive shell anti-patterns

In general, if you’re doing a repetitive task by hitting lots of keys, you’re doing it wrong. Not only are you wasting time, you’re wearing out your keyboard and damaging your wrists and fingers. Here are the ten most common anti-patterns (actually amelioration patterns) that I commonly see in other people’s line editing:
  1. Repeating a command by retyping it
    Press Ctrl-p and Enter, or “!!“. Zsh users get “r” as well. You can even get the command n times before, use “!-1“. Using the arrow keys is obviously flawed - find out how to unmap them in your shell.
  2. Manually changing back to your previous directory
    Give “cd -” a whirl.
  3. Typing a long command (or sequence of commands) excessively often
    Obviously wrong, but I see it so often it’s worth mentioning. Try using an alias and put it in your shell’s startup file. If the command is parameterised, you could construct a simple function. If you are writing software, look into the build systems available for your language - the basics of GNU Make can be mastered within 20 minutes or so, and have many other benefits too.
  4. Opening another shell when the current process blocks
    (e.g. You realise the command you started is going to take a lot longer than you thought) Pause the current process with Ctrl+z and then put the job in the background with bg. fg will bring it to the foreground again. Fewer shells mean you stay focused on what you were trying to achieve.
  5. Searching history by grep’ing ~/.bash_history, or Up Up Up … etc.
    Use CTRL+r (or “/” in vi-mode) for search-as-you type. You can immediately run the command by pressing Enter.
  6. Adding a prefix to a command with Up Home $command Space
    (e.g. You ran a command that really needed sudo). Try: $prefix !!
  7. Changing a command with Home Right Right Right Right … BkSpace BkSpace … etc.
    (e.g you accidentally ran chown instead of chmod) Try: $new_command !*
  8. Retyping significant parts of the previous line
    $ command arg1 /long/path/to/file
    $ command2 arg2 /long/path/to/file
    $ command3 arg1 arg3 /long/path/to/file
    Try using !$ to get the right-most argument on the previous line (you can also use !:2 to get the second argument, etc.):
    $ command arg1 /long/path/to/file
    $ command2 arg2 !$
    $ command3 arg1 arg3 !$
  9. Using Home/End to move to the beginning/end of the line
    This is how you completely ruin your wrists. Use Ctrl+a and Ctrl+e.
  10. Hitting tens of keys to make a substitition
    (e.g. you made a trivial mistake in the middle of your previous command). Use ^foo^bar. If you forget the other nine, try this one - stop punishing yourself for making mistakes! :)

5 October 2007

Steve Kemp: Now the severe beating of a high-school science teacher

The following companies, or people, are using xen-shell with their Xen hosting product(s):
I'm sure there are more, but I've been lax at keeping track. I do want a list, if only for advertising purposes. I'll update the list here if/when people point out omissions. In other news yesterday I managed to release security updates for KDM & fetchmail which were missing i386 builds. Not good. The problem was fixed fairly quickly once it was actually noticed, with the help of Noah. But I did get several angry emails during the wait. *sigh* It looks like people are starting the notice the downside to having broken security buildd machines which frequently cause these kind of problems for us - so hopefully these kind of errors will diminish in time. (Who am I kidding?)

3 October 2007

Chris Lamb: Yet another community Xen Server

For the last month, I’ve been running a non-profit Xen server for a few friends. It’s been working really well but I’ve got three two one no slot left. I think it’s quite good value: £7.88 per month (£17.73 setup) gives you: If you’re interested, please drop in on #lamby-xen on OFTC. UPDATE: All gone. Thanks for the huge interest. :)

2 October 2007

Chris Lamb: Renaming a Mailman list

This evening I renamed a number of UWCS’s mailing lists for a few reasons, mostly due to the annoying ambiguity of the old names. Mailman doesn’t make this particularly easy - this how you can do it under Etch;
  1. First, define variables to avoid stupid mistakes:
    $ OLD=old-list-name
    $ NEW=new-list-name
    $ set -u
  2. Next, take down Mailman and do a quick sanity check. The MTA should queue any incoming mails when qrunner stops responding.
    $ sudo /etc/init.d/mailman
    $ sudo sh -c "[[ -a /var/lib/mailman/archives/private/$ NEW  ]] && echo '*** That mailing list name already exists. *** '"
  3. Now move the list data and regenerate the archives for that list:
    $ sudo mv /var/lib/mailman/lists/$ OLD  /var/lib/mailman/lists/$ NEW 
    $ sudo mv /var/lib/mailman/archives/private/$ OLD  /var/lib/mailman/archives/private/$ NEW 
    $ sudo mv /var/lib/mailman/archives/private/$ OLD .mbox /var/lib/mailman/archives/private/$ NEW .mbox
    $ sudo mv /var/lib/mailman/archives/private/$ NEW .mbox/$ OLD .mbox /var/lib/mailman/archives/private/$ NEW .mbox/$ NEW .mbox
    $ sudo /var/lib/mailman/bin/arch $ NEW 
  4. You should probably provide legacy aliases:
    $ cp /etc/aliases  mktemp aliases-backup.XXXX 
    $ printf "\n# '$ OLD ' -> '$ NEW ' mailing list rename \n"   sudo tee --append /etc/aliases
    $ echo "$ OLD : $ NEW "   sudo tee --append /etc/aliases
    $ for SUFFIX in admin bounces confirm join leave owner request subscribe unsubscribe; do echo "$ OLD -$ SUFFIX : $ NEW -$ SUFFIX "   sudo tee --append /etc/aliases; done
  5. Now go to the administrator interface and change:
    • General / real_name: NEW
    • General / subject_prefix: “[NEW] ” (or similar)
    • Privacy / Recipient filters / acceptable_aliases: Add OLD
  6. Now, bring everything back online with:
    $ sudo newaliases
    $ sudo /var/lib/mailman/bin/genaliases
    $ sudo /etc/init.d/mailman start
  7. For bonus points, generate yourself Apache redirect for the new name:
    $ echo "RewriteRule ^/([^/]*)/$ OLD ($ (/.*)) /$1/$ NEW $2$3 [R=301,L]"
Ta-da, nice new names. You will need to warn your users as their filtering will have now broken.

18 September 2007

Chris Lamb: Graphing the Debhelper Design Pattern

(In case anyone has missed it, Debian Live is a neat framework for creating live Debian distributions on CD, DVD, USB or netboot media.) Debian Live’s primary utility, live-helper, is implemented using what Daniel calls the “Debhelper” design pattern: that is, a number of small shell scripts (or helpers) that are run just below a configuration directory. Each helper should ideally perform a single task, and running a helper is always ’safe’, meaning that any logic for determining whether the helper’s actions should take place is in the helper itself, rather than in the caller. This arrangement results in a somewhat modular design (for shell scripts, anyway) and allows for simple debugging - simply run the helpers manually, or ‘set -x‘ the helper you are interested in and re-run the lot. live-helper currently has a total 69 helpers, and included in this are a number of ‘meta-helpers’ such as lh_build, lh_chroot, etc. whose job it is to simply call other helpers in the correct order. In an attempt to tame this large number, I made this SVG (45KB). Each edge corresponds to a call in the direction of the edge. Source is available in my branch on the master tree.

15 September 2007

Chris Lamb: Why does using all the upstream cause lag?

It’s a common story. A housemate starts torrenting some American television series of dubious artistic quality and/or legality, or perhaps starts calling their girlfriend on some fluffy non-free privacy invading spyware and your SSH sessions start to lag. Why does this happen? When the upstream channels become saturated, data must overflow into the modem’s buffers. This causes TCP acknowledgement (ACK) packets originating from your SSH client to be delayed, resulting in an increase in the overall round trip time. This phenomena is usually worse on cable connections as their modems’ buffers are generally larger. Avoiding the problem can be pretty simple — limiting your upstream bandwidth just below its maximum helps, and some smarter solutions involving prioritising ACK packets work even better. Although these are best achieved at your router, a number of applications have their own limiting features: every BitTorrent client will have one, and other tools such as scp (via the ‘-l‘ option) have them too.

30 August 2007

Chris Lamb: Strawman

We have a somewhat esoteric heating arrangement at my parent’s house. We burn bales of bean straw inside a large combustion chamber (similar to these) which is located in an out-house to the main building. A number of water-filled pipes run through the chamber which is then pumped around the house. Environmentally, it’s really good. Most of the straw would have been burnt anyway (the rest cut into the soil) and the combustion is fan-assisted to minimise incomplete combustion. Very little ash is produced from burning such a bale. Anyway, the delivery and storage of approximately 700 straw bales has become a yearly tradition in our house. As a guide, the trailer in the picture below is holding 160. It’s pretty tough going: even individually these things weigh a considerable amount, and they require removing from the trailer and then stacking in a 3 metre pile inside another shed! You quickly adopt the rules of moving a bale as little as possible vertically (carry them on your back if you’re young enough!), and never, ever, moving a bale twice. There’s also a large amount of dust, and a geek’s delicate palms quickly tire of the string holding the bales together. Anyway, this happened today on a couple of hours notice. The other two males in the house decided to be elsewhere *cough*, leaving it up to me and my poor mum. If anyone was expecting email/code/chat/info today.. sorry.

29 August 2007

Chris Lamb: Citylink libnotify client

What does a geek do when waiting for shiny to arrive? Writes a libnotify client around Citylink’s parcel tracker, of course: Source available, patches welcome.

20 August 2007

Chris Lamb: Eww

This is not how to do HABTM (ie. “many-many“) database joins.

18 July 2007

Chris Lamb: Graduation

Oh hai, I graduated. :)

17 July 2007

Chris Lamb: Updates

On the subject of conferences, I’m also planning to attend AngloHaskell, LinuxConf Europe amd PyCon UK. Let me know if you want to meet up or need a place to crash.

19 June 2007

Pete Nuttall: freduce

Since I'm not at Debconf, I've been filling in time in the early mornings by randomly browsing Facebook. Chris Lamb had a post on a function called fnreduce, which clearly wandered past on planet when I was away. Since I was bored, I wrote a simple haskell version:
fnreduce :: [(a->a)]->a->a
fnreduce [] value = value
fnreduce (a:as) value = freduce as $ a value
Line by line, its clear how it works. The first line is the type sig, which says that the function fnreduce takes a list of functions, and a value of type a, and a gives back a value of type a. The functions all need to be of the type a->a, which means they take a a and give back a a. a is a type varible, which means it can be replaced with any type you feel like, for example: Int or String. The second line merely defines a base case, which says that if the list of functions is empty, it just returns the value given. The last line does all the work, and says that fnreduce on a non-empty list is computed by taking the first element of the list, computing the new value using it, then calling fnreduce on the rest of the list and the new value. This is how most list processing works in haskell. I'm left with two quick questions: the first is how to define it in terms of a fold, which it clearly is. The second is how to escape the a->a resriction, which lamby's can do. Since I'm writing haskell, I'ld like to do this in a type safe way, to have my cake and eat it too. This cant be done with haskell's type system, but I may run it past Edwin for his two cents if I remember...

10 June 2007

Chris Lamb: Sudoku solver in PostScript

There seems to have been a bit of fuss over this Sudoku solver implemented in SQL. In Easter 2005, when Sudoku fever kicked off in a big way in England, my Dad started writing a solver implemented in PostScript which I then modified so that it could perform backtracking. I also wrote a C# solver for my phone around the same time and later sneakily won a competition with it - I am now barred from entering competitions in that paper. Anyway, here is an example PostScript board (PDF version). It was labelled “Fiendish” in The Times. The board can be easily changed at the top of the PostScript file. NB. Best results are achieved if you view the PostScript directly in a viewer such as gv or GSview as you actually see the process of backtracking in solving the puzzle, the recursion depth and the set of possible symbols for each square — most PDF viewers are terrible at displaying the process as they seem to render inside the wrong thread. (In terms of solving the puzzle, we both found that by enforcing the simplest constraints and then ‘guessing’ was far easier and more efficient than performing any of the complicated constraints typically employed by human solvers. I’m certain I am not the first to notice that attempting to emulate the brain’s method of solving a problem is usually a short-sighted approach for a computer.) There are few other goodies in the file: replacing the final autotest with autotestR will recurse using the right-most possible symbol - if you get the same board with both of these then the initial board has a unique solution. Also, if you can get your hands on a true PostScript printer, printing the file will mean the puzzle is solved in hardware. Enjoy :) . I’m looking forward to DebConf7! UPDATE: Added PDF version.

Next.

Previous.