Search Results: "xam"

22 January 2010

Marc 'Zugschlus' Haber: Block devices in KVM guests

In the last few days, I found the time to spend some with KVM and libvirt. Unfortunately, there is a subject that I haven t yet found a satisfying solution: Naming of block devices in guest instances. This is surely a common issue, but solutions are rare. Neither an article on Usenet (in German) nor the German version of this blog article has found solutions for the main question. I should have written this in English in the first place and am thus translating from German to english, hoping that there will be some answers and suggestions. KVM is quite inflexible when it coms to configure block devices. It is possible to define on the host, which files or whole devices from the host should be visible in the guest. The documentation suggests that devices should be brought into the guest with the virtio model, which needs suppport in the guest kernel. Importing a device as emulated ATA or SCSI device brings a performance penalty. The devices brought into the guest via virtio appear in the guest s dev as /dev/vd<x> and do also have their corresponding entries in /dev/disk/by-uuid and /dev/disk/by-path. The vd<x> node is simply numbered in consecutive order as hd<x> and sd<x>. /dev/disk/by-uuid is the correct UUID of the file system found on the device, at least if it s a block device partitioned inside the guest and formatted with ext3 (I didn t try anything else yet). The terminology of the /dev/disk/by-path node is not yet understood, and I am somewhat reluctant to assume the PCI paths of emulated hardware as stable. Looks like I am forced to configure inside the guest when I have changed the host s mass storage system (for example, after migration to a different file system or after new block devices have been added) to accommodate for the new order of the /dev/vd<x> or to have the UUID correctly configured. This is like calling for configuration errors. This is a reincarnation of the same issue that has been killed by LVM on Linuxes running on bare metal : The block device itself has a mnemonic name which is constant even in migration and copy actions. This works without file-system specific stuff like UUID or label, and wouldn t even be possible with a UUID (which won t be unique in this case). The mnemonic names of LVs are also available when the data is directly written to the raw device such as a CNFS buffer of a news server. I would love to have something like a paravirtualized device mapper interface which would allow to say in the host s configuration which of the host s LVs should be visible in the guest with which name in /dev/mapper. That way, the guest s configuration could remain stable during data wrangling operations on the host. One solution is to have a single LV for each guest and import this LV as /dev/vda into the guest. /dev/vda would then be partitioned like a real disk and have its own LVM installation. This would however need kpartx if one wants to access the data from the host, and loses flexibility when resizing file systems. These issues appear in every installation of KVM virtualization, and I would expect that there are gazillions of other possible solutions. I am interested in knowing how other people have tackled this issue and whether there are more possiblity that I haven t thought of before. Maybe there is a solution that doesn t leave me with the feeling of having implemented something ugly. Does the interface between the host s KVM and the guest s device mapper that I have been dreaming of maybe exist. Or is there any other possibility of configuring the device node s name in the guest Linux on the host side?

21 January 2010

Daniel Kahn Gillmor: TCP weirdness, IMAP, wireshark, and perdition

This is the story of a weirdly unfriendly/non-compliant IMAP server, and some nice interactions that arose from a debugging session around it. Over the holidays, i got to do some computer/network debugging for friends and family. One old friend (I'll call him Fred) had a series of problems i managed to help work through, but was ultimately basically stumped based on the weird behavior of an IMAP server. Here's the details (names of the innocent and guilty have been changed), just in case it helps other folks in at least diagnosing similar situations. the diagnosis The initial symptom was that Fred's computer was "very slow". Sadly, this was a Windows machine, so my list of tricks for diagnosing sluggishness is limited. I went through a series of questions, uninstalling things, etc, until we figured it would be better to just have him do his usual work while i watched, kibitzing on what seemed acceptable and what seemed slow. Quite soon, we hit a very specific failure: Fred's Thunderbird installation (version 2, FWIW) was sometimes hanging for a very long period of time during message retrieval. This was not exhaustion of the CPU, disk, RAM, or other local resource. It was pure network delay, and it was a frequent (if unpredictable) frustrating hiccup in his workflow. One thought i had was Thunderbird's per-server max_cached_connections setting, which can sometimes cause a TB instance to hang if a remote server thinks Thunderbird is being too aggressive. After sorting out why Thunderbird was resetting the values after we'd set them to 0 (grr, thanks for the confusing UI, folks!), we set it to 1, but still had the same occasional, lengthy (about 2 minutes) hang when transfering messages between folders (including the trash folder!), or when reading new messages. Sending mail was quite fast, except for occasional (similarly lengthy) hangs writing the copy to the sent folder. So IMAP was the problem (not SMTP), and the 2-minute timeouts smelled like an issue with the networking layer to me. At this point, i busted out wireshark, the trusty packet sniffer, which fortunately works as well on Windows as it does on GNU/Linux. Since Fred was doing his IMAP traffic in the clear, i could actually see when and where in the IMAP session the hang was happening. (BTW, Fred's IMAP traffic is no longer in the clear: after all this happened, i switched him to IMAPS (IMAP wrapped in a TLS session), because although the IMAP server in question actually supports the STARTTLS directive, it fails to advertise it in response to the CAPABILITIES query, so Thunderbird refuses to try it. arrgh.) The basic sequence of Thunderbird's side of an initial IMAP conversation (using plain authentication, anyway) looks something like this:
1 capability
2 login "user" "pass"
3 lsub "" "*"
4 list "" "INBOX"
5 select "INBOX"
6 UID fetch 1:* (FLAGS)
What i found with this server was that if i issued commands 1 through 5, and then left the connection idle for over 5 minutes, then the next command (even if it was just a 6 NOOP or 6 LOGOUT) would cause the IMAP server to issue a TCP reset. No IMAP error message or anything, just a failure at the TCP level. But a nice, fast, responsive failure -- any IMAP client could recover nicely from that by just immediately opening a new connection. I don't mind busy servers killing inactive connections after a reasonable timeout. If it was just this, though, Thunderbird should have continued to be responsive. the deep weirdness But if i issued commands 1 through 6 in rapid succession (the only difference is that extra 6 UID fetch 1:* (FLAGS) command), and then let the connection idle for 5 minutes, then sent the next command: no response of any kind would come from the remote server (not even a TCP ACK or TCP RST). In this circumstance, my client OS's TCP stack would re-send the data repeatedly (staggered at appropriate intervals), until finally the client-side TCP timeout would trigger, and the OS would report the failure to the app, which could turn around and do a simple connection restart to finish up the desired operation. This was the underlying situation causing Fred's Thunderbird client to hang. In both cases above (with or without the 6th command), the magic window for the idle cutoff was a little more than 300 seconds (5 minutes) of idleness. If the client issued a NOOP at 4 minutes, 45 seconds from the last NOOP, it could keep a connection active indefinitely. Furthermore, i could replicate the exact same behavior when i used IMAPS -- the state of the IMAP session itself was somehow modifying the TCP session behavior characteristics, whether it was wrapped in a TLS tunnel or not. One interesting thing about this set of data is that it rules out most common problems in the network connectivity between the two machines. Since none of the hops between the two endpoints know anything about the IMAP state (especially under TLS), and some of the failures are reported properly (e.g. the TCP RST in the 5-command scenario), it's probably safe to say that the various routers, NAT devices, and such were not themselves responsible for the failures. So what's going on on that IMAP server? The service itself does not announce the flavor of IMAP server, though it does respond to a successful login with You are so in, and to a logout with IMAP server logging out, mate. A bit of digging on the 'net suggests that they are running a perdition IMAP proxy. (clearly written by an Aussie, mate!) But why does it not advertise its STARTTLS capability, even though it is capable? And why do some idle connections end up timing out without so much as an RST, when other idle connections give at least a clean break at the TCP level? Is there something about issuing the UID command that causes perdition to hand off the connection to some other service, which in turn doesn't do proper TCP error handling? I don't really know anything about the internals of perdition, so i'm just guessing here. the workaround I ultimately recommended to Fred to reduce the number of cached connections to 1, and to set Thunderbird's interval to check for new mail down to 4 minutes. Hopefully, this will keep his one connection active enough that nothing will timeout, and will keep the interference to his workflow to a minimum. It's an unsatisfactory solution to me, because the behavior of the remote server still seems so non-standard. However, i don't have any sort of control over the remote server, so there's not too much i can do to provide a real fix (other than point the server admins (and perdition developers?) at this writeup). I don't even know the types of backend server that their perdition proxy is balancing between, so i'm pretty lost for better diagnostics even, let alone a real resolution. some notes I couldn't have figured out the exact details listed above just using Thunderbird on Windows. Fortunately, i had a machine with a decent OS available, and was able to cobble together a fake IMAP client from a couple files (imapstart contained the lines above, and imapfinish contained 8 LOGOUT), bash, and socat. Here's the bash snippet i used as a fake IMAP client:
spoolout()   while read foo; do sleep 1 && printf "%s\r\n" "$foo" ; done  
( sleep 2 && spoolout < imapstart && sleep 4 && spoolout < imapfinish && sleep 500 )   socat STDIO TCP4:imap.fubar.example.net:143
To do the test under IMAPS, i just replaced TCP4:imap.fubar.example.net:143 with OPENSSL:imap.fubar.example.net:993. And of course, i had wireshark handy on the GNU/Linux machine as well, so i could analyze the generated packets over there. One thing to note about user empowerment: Fred isn't a tech geek, but he can be curious about the technology he relies on if the situation is right. He was with me through the whole process, didn't get antsy, and never tried to get me to "just fix it" while he did something else. I like that, and wish i got to have that kind of interaction more (though i certainly don't begrudge people the time if they do need to get other things done). I was nervous about breaking out wireshark and scaring him off with it, but it turned out it actually was a good conversation starter about what was actually happening on the network, and how IP and TCP traffic worked. Giving a crash course like that in a quarter of an hour, i can't expect him to retain any concrete specifics, of course. But i think the process was useful in de-mystifying how computers talk to each other somewhat. It's not magic, there are just a lot of finicky pieces that need to fit together a certain way. And Wireshark turned out to be a really nice window into that process, especially when it displays packets during a real-time capture. I usually prefer to do packet captures with tcpdump and analyze them as a non-privileged user afterward for security reasons. But in this case, i felt the positives of user engagement (how often do you get to show someone how their machine actually works?) far outweighed the risks. As an added bonus, it also helped Fred really understand what i meant when i said that it was a bad idea to use IMAP in the clear. He could actually see his username and password in the network traffic! This might be worth keeping in mind as an idea for a demonstration for workshops or hacklabs for folks who are curious about networking -- do a live packet capture of the local network, project it, and just start asking questions about it. Wireshark contains such a wealth of obscure packet dissectors (and today's heterogenous public/open networks are so remarkably chatty and filled with weird stuff) that you're bound to run into things that most (or all!) people in the room don't know about, so it could be a good learning activity for groups of all skill levels. Tags: debugging, imap, perdition, wireshark

Andrew Pollock: [tech] Finding the maximum message size

This was born from a need to see how big a ZIP file I could send my accountant in Australia, and scratching the itch to write some code. The fact that most SMTP servers talk Extended SMTP makes this relatively easy, and Python has some great modules for DNS and SMTP. One gripe I do have is how long it takes the Python modules to mature. It's taken until Python 2.6 for smtplib.SMTP() to gain a timeout parameter, for example. Anyway, I was able to write something nice and generic (it works for any domain) in around 100 lines, thanks in no small part to the DNS module, which makes getting a list of MX records stupidly easy.
$ ./maxmessagesize.py andrew.net.au
daedalus.andrew.net.au: -1
$ ./maxmessagesize.py pollock.id.au
ASPMX.L.GOOGLE.COM: 35,651,584
ALT1.ASPMX.L.GOOGLE.COM: 35,651,584
ALT2.ASPMX.L.GOOGLE.COM: 35,651,584
ASPMX2.GOOGLEMAIL.COM: 35,651,584
ASPMX3.GOOGLEMAIL.COM: 35,651,584
ASPMX4.GOOGLEMAIL.COM: 35,651,584
ASPMX5.GOOGLEMAIL.COM: 35,651,584
$ ./maxmessagesize.py debian.org
master.debian.org: 104,857,600
$ ./maxmessagesize.py cameronp.com
mail1.mysmarthost.com: 30,000,000
mail2.mysmarthost.com: 30,000,000
$ ./maxmessagesize.py ubuntu.com
mx.canonical.com: 62,914,560
$ ./maxmessagesize.py clug.org.au
mx.clug.org.au: 50,000,000
$ ./maxmessagesize.py linux.org.au
morton.linux.org.au: 52,428,800
It's good to see that in most cases of domains I tried, all of the MXes had the same maximum message size. Source code is here

20 January 2010

Robert Collins: LCA 2010 Thursday Keynote Glyn Moody


Glyn Moody Hackers at the end of the world. Rebel code is now 10 years old 50+ interviews over a year and could be considered an archaeology now :) I probably haven t down the keynote justice it was excellent but high density you should watch it online ;) Glyn talks about open access various examples like the public library of science (and how the scientific magazine business made 30%-40% profit margins. The Human Genome Project & the Bermuda Principles : public submimssion of annotated sequences. In 2000 Celera were going to patent the entire human genome. Jim Kent spent 3 weeks writing a program to join together the sequenced fragments on a 100 PC 800Mhz Pentium processor. This was put into the public domain on just before Celera completed their processing and by that action Celera were prevented from patenting *us*. Openness as a concept is increasing within the scientific community open access to result, open data, open science (the full process). An interesting aspect to it is open notebook science daily writeups, not peer reviewed: release early, release often for science. Amazingly, Project Gutenberg started in 1971! Glyn ties together the scientific culture (all science is open to some degree) and artistic culture (artists share and build on /reference each others work) by talking about a lag between free software and free content worlds. In 1999 Larry Lessig setup Copyright s Commons built around an idea of counter-copyright copyleft for non-code. This didn t really fly, and Creative Commons was setup 2 years later. Wikipedia and newer sharing concepts like twitter/facebook etc are discussed. But what about the real world: transparency and governments, or companies? They are opening up. However, data release != control release. And there are challenges we all need to face:
  • GFinancialC my gain is your loss . Very opaque system.
  • GEnvironmentalC my gain is our loss
Glyn argues we need a different approach to economic governance: the commons. 2009 Nobel laureate for Economic Sciences Elinor Ostrom work on commons and their management via user associations which is what we do in open source! Awesome!

19 January 2010

Robert Collins: LCA2010 Wednesday Keynote


Another must-grab-the-video talk : Mako s keynote. Antifeatures, principles vs pragmatism do come together. The principled side RMS & the FSF important to control ones technology because its important to control ones life. The pragmatic side quality, no vendor lock etc. False dichotomy.. freedom imparts pragmatic benefits even though it doesn t intrinsically import quality, good design: 95% of projects 5 contributors; median number of contributors 1, and such small collaborations are no different than a closed source one. Definition of antifeatures built functionality to make a product do something one does not want it to do. Great example of phone books: spammers pay for access to the lists, and thus we have to pay *not to be listed*, but its actually harder to list and print our numbers in the first place. Mako makes a lovely analogy to the mafia there. Similarly with Sony charging 50 dollars not to install trialware on windows laptops in the past. Cameras: Canon cameras disabled RAW saving . CHDK, an open source addon for the camera outputs RAW again. Panasonic are locking down their cameras to reject third party batteries. The tivo is an example of how focusing on licensing can miss the big picture: free stack, but still locked into a subscription to get an ongoing revenue stream. Dongles! Mako claimed there wasn t a facebook appreciation group for dongles there is. Github: paying for the billing model lots of code there to figure out how many projects in a repo, so that they can charge on that basis. DRM is the mother of all antifeatures 10K people writing DRM code that no users want!

Torsten Landschoff: quiltrc for Debian packaging

Working on another laptop, I was missing my quiltrc settings. I think, I got them from a this email by Marco d Itri. Perhaps it is of help to somebody (for example, when I go searching for it again). BTW, I changed it locally to check only for debian folder in parent directories and create debian/patches automatically if needed:
1
2
3
4
5
6
7
8
for d in . .. ../.. ../../.. ../../../.. ../../../../..; do
if [ -d $d/debian ]; then
if ! [ -d $d/debian/patches ]; then
mkdir $d/debian/patches
fi
export QUILT_PATCHES=debian/patches
fi
done
I d rather end up with a patches dir inside the debian folder instead of having it at a random place in the package sources when adding the first quilt patch. I wonder if we should ship this with the quilt package!?

18 January 2010

Matthew Garrett: Nook GPL update

"We are currently working on getting the code shipped out, we have your shipping address on file and will ship the code out as soon as it is ready, this will be by the end of this month."

2/10, must try harder. Even ignoring the fact that it's taking the best part of two months to get from shipping binaries to shipping source, it'll be interesting to see which version of the firmware the source release corresponds to given that the 1.1.0 update included a new kernel.

Speaking of firmware updates - as shipped, the nook was a disaster. The firmware update improved things greatly, but I'm still stuck with cases where books render with the last couple of words in a page left out, and the order of books in the local content library is now based on last modification time rather than, say, author name. The continuing lack of any way to implement catagorisation or provide worthwhile metadata means that it's frustrating having to remember which order the books in a series go in. The fact that there's even a distinction between content you've obtained from B&N and content you've obtained from elsewhere is mindboggling. You need to explicitly switch between the two, which means that collections are broken up if you've had the audacity to buy some books from B&N and some books from elsewhere.

Having now spent a while travelling with the nook, it's clear that it's still not an especially effective example of its type. If my Sony hadn't suffered an unfortunate accident, I'd be using it instead. The nook's hardware is significantly better and as a platform it's got much more potential, but it just doesn't do a terribly good job at its core role - reading books. It'll get better with time, but if you're in the market for something that actually works today then go elsewhere.

There's other little things that are upsetting at a conceptual level. The 1.0.0 firmware will flash unsigned firmware, which is useful[1] but also an obvious wtf. The filesystem is full of scripts that are world writable and executed as root. There's a libGLES, but the coverflow implementation appears to be handled entirely in software. There's a general feeling that the platform's been put together by people who either don't know what they're doing, don't care about doing it properly or were working under sufficient time constraints that getting it right wasn't an option. I'm really not impressed.

[1] Especially given that the 1.1.0 firmware will happily flash the 1.0.0 firmware...

17 January 2010

Steve Kemp: Dammit, Martin! This is compressed air!

So I previously mentioned I'd knocked up a simple automation tool, for deploying policies (read "scripts") from a central location to a number of distinct machines. There seemed to be a small amount of interest, so I've written it all up: Why slaughter? I have no idea. Yesterday evening it made sense, somehow, on the basis it rhymed with auto - (auto as in automation). This morning it made less sense. But meh. This list of primitives has grown a little and the brief examples probably provide a little bit of flavour. In short you: All in all its probably more complex than it needs to be, but I've managed to get interesting things primarily with these new built-in primitives and none of it is massively Debian, or even Linux, specific. ObSubject: Jaws

16 January 2010

Biella Coleman: Being Bad-Ass w/o the Arrogance

bad-ass For the first time in a long while I took a vacation in New Zealand where I am for LCA. I decided to also take a break (mostly) from the Internet but I decided to it was worth to come back to write a brief response to Clay Shirky s rant about women, which I find pretty unsettling. So the basic upshot of his entry is that for women to get ahead in this world, they need to not only behave more like men but in specific, like all the effing blow-hard jerky self-promoting men like, well Clay Shirky (I guess, right? and he in fact might be proud, I a woman, made this accusation). What I appreciate about the post is the fact that he does not pigeon hole women as caring, maternal, and meek. I have always resented the idea that women can t be assertive and confident. However, confidence and self-esteem, which I agree are vital for getting noted, does not inherently entail jerky behavior.I think Shirky s perspective might be skewed because of his home field, which is filled with just the type of guys he is describing. I call them pundit-entrepreneurs (though to be sure some are pretty darn nice). If you take the field of anthropology, for example, it has traditionally and for a long time been known for grand slam female scholars from Ruth Benedict and Margaret Mead in the past to the ones of the present like Nancy Scheper Hughes and Jean Comaroff. During grad school, I was surrounded by strong, smart, witty, confident ladies and always felt I had role models to follow and emulate. They were not, however, low-life jerks clawing their way to the top of the academic mountain leaving a trail of destruction behind their path. Then when I started to go to the tech and media academic conferences, I was soon swimming in a sea of mostly white men and the vibe was different. I was ignored and talked over a handful of times, which had never happened to me before. There was a lot more self-promotion than I had seen in other fields, in part, it seemed because the media pays more attention to this field so folks are trying to get the media light focused on them. While I don t disagree that many fields from medicine to law promote and reward blow-hards and massive unrestrained arrogance, I would rather not create a false binary between meek/low self-esteem/female and total-jerky/arrogance/confidence. Why not instead promote and highlight behavior that rewards confidence sans the arrogance? Here are some thoughtful related posts.

Biella Coleman: Being Bad-Ass w/o the Arrogance

bad-ass For the first time in a long while I took a vacation in New Zealand where I am for LCA. I decided to also take a break (mostly) from the Internet but I decided to it was worth to come back to write a brief response to Clay Shirky s rant about women, which I find pretty unsettling. So the basic upshot of his entry is that for women to get ahead in this world, they need to not only behave more like men but in specific, like all the effing blow-hard jerky self-promoting men like, well Clay Shirky (I guess, right? and he in fact might be proud, I a woman, made this accusation). What I appreciate about the post is the fact that he does not pigeon hole women as caring, maternal, and meek. I have always resented the idea that women can t be assertive and confident. However, confidence and self-esteem, which I agree are vital for getting noted, does not inherently entail jerky behavior.I think Shirky s perspective might be skewed because of his home field, which is filled with just the type of guys he is describing. I call them pundit-entrepreneurs (though to be sure some are pretty darn nice). If you take the field of anthropology, for example, it has traditionally and for a long time been known for grand slam female scholars from Ruth Benedict and Margaret Mead in the past to the ones of the present like Nancy Scheper Hughes and Jean Comaroff. During grad school, I was surrounded by strong, smart, witty, confident ladies and always felt I had role models to follow and emulate. They were not, however, low-life jerks clawing their way to the top of the academic mountain leaving a trail of destruction behind their path. Then when I started to go to the tech and media academic conferences, I was soon swimming in a sea of mostly white men and the vibe was different. I was ignored and talked over a handful of times, which had never happened to me before. There was a lot more self-promotion than I had seen in other fields, in part, it seemed because the media pays more attention to this field so folks are trying to get the media light focused on them. While I don t disagree that many fields from medicine to law promote and reward blow-hards and massive unrestrained arrogance, I would rather not create a false binary between meek/low self-esteem/female and total-jerky/arrogance/confidence. Why not instead promote and highlight behavior that rewards confidence sans the arrogance? Here are some thoughtful related posts.

C.J. Adams-Collier: AoE root for KVM guests

So. I m trying to get familiar with libvirt and friends. To this end, I ve set up a Lucid virtual machine booting from PXE into an initrd environment which does a pivot_root to an AoE block device. The #virt channel on irc.oftc.net told me that in order to have libvirt provide PXE capability, I would have to install a recent version of libvirt. I built version 0.7.5-3 from sid on my karmic laptop and it seems to be working okay. I decided to set up the pxe root directoy in /var/lib/tftproot just because that s what the example code had in it. I had to manually configure a virtual network. Here is the XML config file:
$ sudo virsh net-dumpxml netboot
<network>
  <name>netboot</name>
  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='off' delay='1' />
  <domain name='example.com'/>
  <ip address='192.168.123.1' netmask='255.255.255.0'>
    <tftp root='/var/lib/tftproot' />
    <dhcp>
      <range start='192.168.123.2' end='192.168.123.254' />
      <bootp file='pxelinux.0' />
    </dhcp>
  </ip>
</network>
This, of course, depends on the pxelinux.0 file. Luckily, this is packaged up in syslinux and can be installed with a simple
$ sudo apt-get install syslinux
$ sudo mkdir /var/lib/tftproot
$ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftproot
I had to create a pxelinux config file for the virtual machine (indexed by mac address). Note that I put a console=ttyS0,115200 argument on the kernel command line so that I can attach to the serial port from the host system for copy/paste debugging. Also of importance is the root=/dev/etherd/e0.1p1 argument, specifying which block device we ll be doing the pivot_root to eventually.
$ mkdir /var/lib/tftproot/pxelinux.cfg/
$ cat /var/lib/tftproot/pxelinux.cfg/01-52-54-00-44-34-67
DEFAULT linux
LABEL linux
SAY Now booting the kernel from PXELINUX...
KERNEL vmlinuz-lucid0
APPEND ro root=/dev/etherd/e0.1p1 console=ttyS0,115200 initrd=initrd.img-lucid0
I decided to use the karmic kernel for lucid initially. I ll eventually switch over to the lucid kernel ;)
$ sudo cp /boot/vmlinuz-2.6.31-17-generic /var/lib/tftproot/vmlinuz-lucid0
I copied /etc/initramfs-tools to ~/tmp/lucid so that I didn t mess up the system initrd scripts:
$ mkdir -p ~/tmp/lucid && cp -r /etc/initramfs-tools ~/tmp/lucid/
Since mkinitramfs doesn t currently have a system for AoE root, I had to do a bit of fiddling. I copied the NFS root boot script and made a couple of modifications.
$ diff -u /usr/share/initramfs-tools/scripts/nfs ~/tmp/lucid/initramfs-tools/scripts/aoe
--- /usr/share/initramfs-tools/scripts/nfs	2008-06-23 23:10:21.000000000 -0700
+++ /home/cjac/tmp/lucid/initramfs-tools/scripts/aoe	2010-01-15 14:56:28.098298027 -0800
@@ -5,59 +5,25 @@
 retry_nr=0
 # parse nfs bootargs and mount nfs
-do_nfsmount()
+do_aoemount()
  
-
 	configure_networking
-	# get nfs root from dhcp
-	if [ "x$ NFSROOT " = "xauto" ]; then
-		# check if server ip is part of dhcp root-path
-		if [ "$ ROOTPATH#*: " = "$ ROOTPATH " ]; then
-			NFSROOT=$ ROOTSERVER :$ ROOTPATH 
-		else
-			NFSROOT=$ ROOTPATH 
-		fi
-
-	# nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
-	elif [ -n "$ NFSROOT " ]; then
-		# nfs options are an optional arg
-		if [ "$ NFSROOT#*, " != "$ NFSROOT " ]; then
-			NFSOPTS="-o $ NFSROOT#*, "
-		fi
-		NFSROOT=$ NFSROOT%%,* 
-		if [ "$ NFSROOT#*: " = "$NFSROOT" ]; then
-			NFSROOT=$ ROOTSERVER :$ NFSROOT 
-		fi
-	fi
+        ip link set up dev eth0
-	if [ -z "$ NFSOPTS " ]; then
-		NFSOPTS="-o retrans=10"
-	fi
+        ls /dev/etherd/
-	[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount"
-	run_scripts /scripts/nfs-premount
-	[ "$quiet" != "y" ] && log_end_msg
+        echo > /dev/etherd/discover
-	if [ $ readonly  = y ]; then
-		roflag="-o ro"
-	else
-		roflag="-o rw"
-	fi
+        ls /dev/etherd/
-	nfsmount -o nolock $ roflag  $ NFSOPTS  $ NFSROOT  $ rootmnt 
+        mount $ ROOT  $ rootmnt 
  
-# NFS root mounting
+# AoE root mounting
 mountroot()
  
-	[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top"
-	run_scripts /scripts/nfs-top
-	[ "$quiet" != "y" ] && log_end_msg
-
-	modprobe nfs
-	# For DHCP
-	modprobe af_packet
+	modprobe aoe
 	# Default delay is around 180s
 	# FIXME: add usplash_write info
@@ -67,17 +33,13 @@
 		delay=$ ROOTDELAY 
 	fi
-	# loop until nfsmount succeds
+	# loop until aoemount succeds
 	while [ $ retry_nr  -lt $ delay  ] && [ ! -e $ rootmnt $ init  ]; do
 		[ $ retry_nr  -gt 0 ] && \
-		[ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
-		do_nfsmount
+		[ "$quiet" != "y" ] && log_begin_msg "Retrying AoE mount"
+		do_aoemount
 		retry_nr=$(( $ retry_nr  + 1 ))
 		[ ! -e $ rootmnt $ init  ] && /bin/sleep 1
 		[ $ retry_nr  -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg
 	done
-
-	[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom"
-	run_scripts /scripts/nfs-bottom
-	[ "$quiet" != "y" ] && log_end_msg
  
(below is the full file in case udiff is less convenient)
$ cat ~/tmp/lucid/initramfs-tools/scripts/aoe
# NFS filesystem mounting			-*- shell-script -*-
# FIXME This needs error checking
retry_nr=0
# parse nfs bootargs and mount nfs
do_aoemount()
 
	configure_networking
        ip link set up dev eth0
        ls /dev/etherd/
        echo > /dev/etherd/discover
        ls /dev/etherd/
        mount $ ROOT  $ rootmnt 
 
# AoE root mounting
mountroot()
 
	modprobe aoe
	# Default delay is around 180s
	# FIXME: add usplash_write info
	if [ -z "$ ROOTDELAY " ]; then
		delay=180
	else
		delay=$ ROOTDELAY 
	fi
	# loop until aoemount succeds
	while [ $ retry_nr  -lt $ delay  ] && [ ! -e $ rootmnt $ init  ]; do
		[ $ retry_nr  -gt 0 ] && \
		[ "$quiet" != "y" ] && log_begin_msg "Retrying AoE mount"
		do_aoemount
		retry_nr=$(( $ retry_nr  + 1 ))
		[ ! -e $ rootmnt $ init  ] && /bin/sleep 1
		[ $ retry_nr  -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg
	done
 
There was also a small modification to the initramfs.conf file:
$ diff -u /etc/initramfs-tools/initramfs.conf ~/tmp/lucid/initramfs-tools/initramfs.conf
--- /etc/initramfs-tools/initramfs.conf	2008-07-08 18:37:42.000000000 -0700
+++ /home/cjac/tmp/lucid/initramfs-tools/initramfs.conf	2010-01-15 14:33:38.088295207 -0800
@@ -47,14 +47,16 @@
 #
 #
-# BOOT: [ local   nfs ]
+# BOOT: [ local   nfs   aoe]
 #
 # local - Boot off of local media (harddrive, USB stick).
 #
 # nfs - Boot using an NFS drive as the root of the drive.
 #
+# aoe - Boot using an AoE drive as the root of the drive.
+#
-BOOT=local
+BOOT=aoe
 #
 # DEVICE: ...
I also needed to add aoe to the list of modules included in the initramfs:
$ echo aoe >> ~/tmp/lucid/initramfs-tools/modules
In order to generate the initrd.img file from this new config, I ran the following:
$ sudo mkinitramfs -d ~/tmp/lucid/initramfs-tools/ -o /var/lib/tftproot/initrd.img-lucid0
I created a lucid VM by installing from the desktop install disk. You can grab the ISO here: http://cdimage.ubuntu.com/daily-live/current/ I ll leave the creation of the virtual machine and installation as an exercise for the reader. I put the filesystem on an lvm volume group called vg0 in a logical volume called lucid0 (ie, /dev/vg0/lucid0). At this point, I created a new virtual machine called lucid0. Here is the xml for the domain:
$ sudo virsh dumpxml lucid0
<domain type='kvm' id='1'>
  <name>lucid0</name>
  <uuid>96fbad21-4f25-5700-ddd8-1a565c7170ee</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.11'>hvm</type>
    <boot dev='network'/>
  </os>
  <features>
    <pae/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <interface type='network'>
      <mac address='52:54:00:44:34:67'/>
      <source network='netboot'/>
      <target dev='vnet0'/>
    </interface>
    <serial type='pty'>
   <source path='/dev/pts/4'/>
      <target port='0'/>
    </serial>
  <console type='pty' tty='/dev/pts/4'>
   <source path='/dev/pts/4'/>
      <target port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
    <sound model='es1370'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
</domain>
Now we re ready to start the AoE target and launch the virtual machine. If you don t have vblade installed, do so now:
$ sudo apt-get install vblade
Start the target up with the following command:
$ sudo vbladed 0 1 virbr1 /dev/vg0/lucid0
Now, if all goes well, you should be able to watch the virtual machine boot up and do its thing like so:
$ sudo virsh start lucid0 && sudo screen -S lucid0 sudo virsh ttyconsole lucid0 115200
If you get errors about /dev/etherd/e0.1p1 not existing (these might look like this):
Begin: Retrying AoE mount ...
err         discover    interfaces  revalidate  flush
err         discover    interfaces  revalidate  flush
mount: mounting /dev/etherd/e0.1p1 on /root failed: No such file or directory
Done.
then you might want to try restarting vbladed like this:
$ sudo kill -9 ps auwx grep vblade grep -v grep awk ' print $2 ' && sudo vbladed 0 1 virbr1 /dev/vg0/lucid0
So. Now you should have a lucid gdm in your virt-manager console. Any questions? #virt on irc.oftc.net
<script>//<script language="javascript" src="http://reddit.com/button.js?t=1"></script>

Steve Kemp: I don't like this ending...

I've talked before about the minimal way in which I've been using a lot of the available automation tools. I tend to use them to carry out only a few operations: In the pub I've had more than a few chats about how to parse a mini-language and carry these operations out, and what facilities other people use. It'd be almost trivial to come up with a mini-language, but the conclusion has always been that such mini-languages aren't expressive enough to give you the arbitrary flexibility some people would desire. (Nested conditionals and the ability to do things on a per-host, per-day, per-arch basis for example.) It struck me last night that you could instead cheat. Why not run scripting langues directly on your client nodes? Assume you could write your automation in Ruby or Perl and all you need to do is define a few additional primitives. For example:
#
#  /policies/default.policy - the file that all clients nodes poll.
#
#
#  Fetch the per-node policy if it exists.
#
FetchPolicy $hostname.policy ;
#
#  Ensure SSH is OK
#
FetchPolicy ssh-server.policy ;
#
#  Or explicitly specify the URL:
#
# FetchPolicy http://example.com/policies/ssh-server.policy ;
#
#  Finally a quick fetch of a remote file.
#
if ( FetchFile(
                Source => "/etc/motd",
                Dest => "/etc/motd",
                Owner => "root",
                Group => "root",
                Mode => "0644" ) )
 
    RunCommand( "id" );
 
This default policy attempts to include some other policies which are essentially perl files which have some additional "admin-esque" primitives. Such as "InstallPackage", "PurgePackage", and "FetchFile". FetchFile is the only one I've fully implemented, but given a server it will fetch http://server/prefix/files/$FILENAME - into a local file, and will setup the owner/gid/mode. If the fetch succeeded and contents differ from the current contents of the named file (or the current file doesn't exist) it will be moved into place and the function will return true. On the server side I just have a layout that makes sense:
.
 -- files
     -- etc
         -- motd
         -- motd.silver.my.flat
         -- motd.gold
 -- policies
     -- default.policy
     -- ssh-server.policy
     -- steve.policy
Here FetchFile has been implemented to first request /files/etc/motd.gold.my.flat, then /files/etc/motd.gold, and finally the global file /files/etc/motd. In short you don't want to be forced to write perl which would run things like this:
# install ssh
if ( -e "/etc/apt/sources.list" )
 
  # we're probably debian
  system( "apt-get update" );
  system( "apt-get install openssh-server" );
 
You just want to be able to say "Install Package foo", and rely upon the helper library / primitives being implemented correctly enough to be able to have that work. I'll probably stop there, but it has given me a fair amount to think about. Not least of which : What are the minimum required primitives to usefully automate client nodes? ObFilm: Moulin Rouge!

Miriam Ruiz: Packaging openFrameworks for Ubuntu and Debian

It seems that I m not blogging as often as I was some months ago. The main reason is microblogging, which is somehow quicker, even though briefer. It is also less informative, I guess, because 140 characters is a very limited length. Probably because of that, a friend of mine asked me to write a proper blog entry about this, and I think that he s probably right. openFrameworks is an open source toolkit, released under the MIT license, written in C++ and designed to assist the creative process by providing a simple and intuitive framework for experimentation. According to its authors, it was developed for folks using computers for creative, artistic expression, and who would like low level access to the data inside of media in order manipulate, analyze or explore. I attended a short course in openFrameworks some months ago, and decided that if I wanted to experiment with it, I should somehow structure the building process of the library a bit, remove the dependency on FMOD, which is not DFSG-free, even though that might require remove the whole audio subsystem, make it buildable without Code::Blocks, and hopefully build some more-or-less proper packages. I ve also added some pkg-config files, so that it becomes easier to build projects based in openFrameworks (as easy as g++ source.cpp -o test $(pkg-config openframeworks openframeworks-addons cflags libs) ). Even though the packages are still not as good as they should, they re absolutely usable right now. I ve uploaded them, as well as their dependencies, to my Ubuntu PPA (although I m using those packages in my Debian), in case that someone is interested. I ve also uploaded a couple of tiny examples (the second one downloaded from here) of openFrameworks.

15 January 2010

Dirk Eddelbuettel: RQuantLib 0.3.2 released

A new version of RQuantLib (a package combining the quantitative analytics of QuantLib with the R statistical computing environment and language) is now out at CRAN and in Debian (where it depends on the 1.0.0 beta of QuantLib that is currently in the NEW queue with its new library version). This RQuantLib release works with either the current release 0.9.9 as well as with the just-released first beta of QuantLib 1.0.0. This versions brings a few cleanups due to minor Rcpp changes (in essence: we now define the macro R_NO_REMAP before including R's headers and this separate non-namespaced functions like error() or length() out into prefixed-versions Rf_error() and Rf_length() which is a good thing). It also adds a number of calendaring and holiday utilities that Khanh just added: tests for weekend, holiday, endOfMonth as well dayCount, date advancement and year fraction functions commonly used in fixed income. Full changelog details, examples and more details about this package are at my RQuantLib page.

14 January 2010

Jonny Lamb: Monorail

Recently, I've been working on a file transfer app for the N900. It's called monorail and I uploaded it to extras-devel last night, so you can try it out right now. Click for full-sized image I implemented an OssoABookContactView with support for filtering on Contact Capabilities (or a draft of it, at least) as old-style caps aren't great. This gives a nice list of address book contacts who have at least one account that should support receiving file transfers. It would be nice if these extra caps could go into the address book which is where they belong, but it won't. If someone would find this widget useful, I'll clean up the code and maybe throw it in its own library. Click for full-sized image
Choose one of the accounts which support file transfer. I also started to implement a sharing plugin, but it turns out it's poorly documented and appears to be impossible to do anything useful for my use-case, like popping up a dialog when the user taps "Share". The example isn't very exemplary, but does contain some amusing code. This sharing plugin is only half-written and impossible to debug. If anyone has any pointers on writing these plugins, I would appreciate them. Click for full-sized image It's a shame that although Hildon widgets can look really good on the device, it can often take some fiddling to make them look consistent with the rest of the UI. Additionally, oddities in some widgets can leave you baffled, or amused. The most annoying thing I have come across regarding this app is just how little I can get it integrated. The file manager is all hard-coded so there's no way to add a Send to Contact menu item, and no buttons can be added to the libsharing dialog (which appears when the user shares a photo) which is annoying as it looks like it's missing this feature. Click for full-sized image Oh, and Telepathy is pretty sweet.

Sam Hartman: Open Source Accounting Software

I m developing a huge backlog of things to write about, going back as far as a couple of posts inspired by the Kerberos conference in October. However, those require more effort putting together the post, so I m going to focus on something more recent. Part of running a business even a small business like Painless Security is dealing with the administrative and bookkeeping. The normal solution seems to be Intuit s Quick Books. When I set up the company, I looked into that. However, Intuit s accessibility story starts with give up, and goes down hill from there. Apparently, screen reader vendors have offered to work with Intuit to help them, but have been turned down, or at least that s the strong implication I get from reading blogs from these accessibility vendors. So, I d definitely rather not give Intuit my money. I m also looking for a bit more than the minimum in accounting software. Keeping the books in order enough to pay taxes would be easy. However I want to be able to understand where I m making money; I want to be able to figure out if the fixed price contracts I enter into end up being good ideas. I want to understand how expensive community projects Painless Security gets involved in like Debian and IETF work are both in terms of direct costs and opportunity costs. I want to understand what sorts of work ends up being the most profitable. All of these are fairly typical management questions; solutions to varying degrees are understood. however it means I m actually going to use an accounting product more than just to track my invoices and prepare taxes. I decided to see what the open source world was like in this space. I started with Ledger SMB. Ledger SMB s main claim to fame is that it tries to be better than SQL Ledger. Being better than SQl Ledger is definitely a good thing. It worked well enough to generate invoices and income statements. It nominally had facilities to track the sort of per-project information I m looking for, but the facilities are not near good enough. Also, there were some issues things like the fact that total debits didn t particularly need or tend to sum to total credits got old after a very short while. Also, facilities for correcting mistakes were unfortunate. You could either operate in a mode where you could delete a transaction, or a mode where you reverse transactions. Deleting transactions in practice meant deleting most of a transaction; balances became out of sync and half of the transaction tended to stick around using some interfaces but not other interfaces. Database cleanup was almost always required. In principle, reversals are better. However, there is no facility to indicate that you re not expecting payment on a reversed invoice. The receivables/payables account balance out because of the reversing transaction, but both the reversing and reversed transaction end up becoming over-due. Hey, can you please send me some anti-money to clean this up? The code was dreadful; the goal was to have better abstraction than SQL Ledger. Perhaps that was achieved, but man that leaves a lot to desire. Now, I m playing with Open ERP. It wants to grow up some day to be a competitor to SAP R3. In a way that sounds good, although it does mean there s a high complexity cost. There s a lot of functionality. There s reasonably good separation between view and model (and possibly even controller). The code is often clean, although the random blocks of commented out code with no explanation cause me to cringe. Many aspects of the system seem incredibly well designed; you can approach the system through a web client, graphical client, two different RPC mechanisms, XL and Open Office plugins. However, there s this mix of missing stuff and completely broken that causes me to wonder whether I m going to be sad. First, there appears to be basically no support for the US. All addresses are European format and are hard coded. Each individual report needs to be changed. Recently, I found cases where as best I can tell debits and credits are just reversed. I ve found a case where backing up the database succeeds but generates a zero length file. I almost lost data through that last one. There s a complex set of mechanisms to deal with units-of-measure for products for example, some jobs billed in hours, some are billed in days. However other parts of the code just add quantities. Playing around with this I am reminded again that I really enjoy thinking about these sorts of problems. An interesting ERP project could be fun to work on. for example, I bet handling ERP needs for some cloud-centered company would be a lot of fun. Also, as part of looking at Open ERP, I ve more or less developed the necessary scripts to migrate a simple service company from Ledger SMB to Open ERP. There are limitations of course, but if this would be useful to you, drop me a line.

13 January 2010

Russell Coker: My Ideal Netbook

I have direct knowledge (through observation or first-hand reports) of the following use cases for Netbooks:
  1. System administrator s emergency workstation something light to carry when you might get an SMS about a problem.
  2. A really small laptop for a serious technical user, can be used for programming and other serious tasks. Only someone who is really dedicated to the hobby of computing would choose a system with a tiny screen for their main computer so that they can take it everywhere.
  3. A computer for a child. Children are less demanding about some aspects of their computer experience, no-one wants to buy a really expensive toy for a young child, and children find it difficult to carry full size laptops.
1 and 2 are the options that interest me. But it would be good if the extensive children s toy market could drive economies of scale and reduce the expenses of my hobby and profession. I have found my EeePC 701 to provide adequate CPU performance (Celeron-M 630MHz) for light compiling tasks and I have used it for some Debian development work. The SSD that is built in is very fast and OpenOffice load times compare well to my Thinkpad T41p because of it. The main problems I have with my EeePC for sysadmin and coding tasks are the small keyboard (which can t be fixed the overall size of the machine needs to remain small), the small screen (which could be expanded without changing the case size), the low resolution screen (which has been fixed in newer netbooks), and the fact that my 3G dongle sticks out and is likely to get broken. More recent Netbooks address these issues while having the trade-off of being heavier and larger. There are also some tasks which are generally not performed on a Netbook but that could be if it was properly designed. Here are some examples of things that I think should be done on a Netbook:
  1. Basic image editing and blogging something that a lot of people do on smart-phones nowadays. It can be done more effectively and with less effort on a general purpose computer I can t imagine the GIMP or Inkscape running on a smart-phone.
  2. Reading electronic books. The number of people who want a Netbook but don t want to read electronic books would be quite small as would the number of people who only want to read electronic books and never want to use a general purpose computer while travelling. No-one really wants to carry both a Netbook and an ebook reader at the same time.
  3. Watching movies.
  4. Everything that you might want to do on a terminal in an Internet cafe those machines are always 0wned, just say no for security reasons.
  5. Games. The Nintendo DS has two ARM CPUs running at 66MHz and 33MHz and a combined screen resolution of 256*384*18bpp [1] and the Sony PSP has a 333MHz MIPS R4000 CPU and a screen resolution of 480*272*24bpp [2]. The original EeePC had more CPU power and more screen resolution than the DS and the PSP so it IS suitable for games even though it won t run the latest 3D games. There are lots of great games like Wesnoth that don t require much video performance.
  6. Educational Software. Portable educational devices include the awful V.smile system for young children [3] and the educational software for the DS (I ve seen a demonstration of a training program in rapid completion of basic maths problems for elderly people and presume it s not the only educational software on that platform).

Image editing requires a color screen of high resolution. Effective blogging requires a platform with a resolution that compares to the typical web user according to Hitslink 1024*768 is the most popular resolution of web browsing systems at 28.34% and the most popular resolution that is less than 1024*768 is 800*600 at 3.28% [4]. So even the most casual blogger will have an incentive to get a screen that is of higher resolution than all but the latest Netbooks. The recently released EeePC 1201 has a screen resolution of 1366*768 which should be barely adequate for those tasks. Reading electronic books requires a reasonable resolution. Based on my experience with the 1400*1050 display in my Thinkpad it seems that a resolution of 1366*768 would be barely adequate for reading an academic paper that has two columns in a small font. But as the original Kindle had a resolution of 600*800 and the latest Kindle has a resolution of 824*1200 [5] it seems that perhaps the epaper displays are good enough to allow reading the text at a lower resolution. A display that can draw little or no power when idling (as epaper does) is simply required for an ebook. The Pixel-Qi hybrid displays are claimed to offer the best features of TFT and epaper displays [6] but they haven t been released yet. I think it s reasonable to assume that someone will achieve that Pixel-Qi is attempting and that it will become the standard display for a Netbook. Watching movies and playing games (even games like Wesnoth) requires better video performance than epaper can deliver, we just have to hope that Pixel-Qi release something soon. Watching movies and reading ebooks are both things that are best done without a keyboard in the way. The Always Innovating Touch Book [7] seems like a good solution to this problem. It s a tablet PC that can be connected to a keyboard base if/when you desire. It should also be good for web browsing and reading email while on the move, I find that my EeePC is unreasonably heavy and awkward for typing email while walking. Intel CPUs are not particularly energy efficient. As there are ARM CPUs with clock speeds as high as 2GHz and with as many as four CPU cores it seems that the ARM architecture can provide as much CPU power as is required. Debian currently supports two versions of the ARM CPU, if another one became commonly used it wouldn t be that difficult to run Debian build servers for it. Given a screen resolution equal to the latest Kindle, CPU power greater than the early Netbooks, and the ability to run a free software OS the range of educational and gaming software should be adequate. So it seems that the ideal netbook would have a detachable keyboard and base and a touch-screen in the computer part. It would have a Pixel-Qi display (or equivalent) with a resolution of 1400*1050 or better. It would have USB, Gig-E, Wifi, and Bluetooth connectivity and the ability to have an internally mounted USB dongle (as the Always Innovating Touch Book does). I think that this is not overly difficult to achieve it is basically an Always Innovating system with a better display. Update: Another criteria is the ability to start operating quickly when requested. Even mobile phones are often limited in their utility by the time that is taken to activate them (I can t get my mobile phone to take a photo in much less than 7 seconds after removing it from my pocket). The Always Innovating system is apparently always in suspend to RAM mode when it s not being used so that it can start quickly. That combined with fast application load times and a good menu system could allow turning the system on and launching an application in less than 2 seconds. If I was buying a Netbook right now the only thing that would stop me from buying an Always Innovating device is the shipping delay. But as my EeePC is working quite well I m not going to buy another system unless I am going to get significant benefits such as a high resolution PixelQi display.

Matt Brubeck: Weekend hack: outline grep

I keep almost all of my notes and to-do lists in plain text files, so I can edit and search them with Vim, grep, and other standard Unix tools. I often indent lines in these files to create a simple outline structure, and use the autoindent and foldmethod=indent options to make Vim into a simple outliner. To get useful output when searching through these outline-structured files, I wrote a simple grep replacement. Given a text file with a Python-style indentation structure, ogrep searches the file for a regular expression. It prints matching lines, with their "parent" lines as context. For example, if input.txt looks like this:
2009-01-01
  New Year's Day!
    No work today.
    Visit with family.
2009-01-02
  Grocery store and library.
2009-01-03
  Stay home.
2009-01-04
  Back to work.
    Remember to set an alarm.
then ogrep work input.txt will produce the following output:
2009-01-01
  New Year's Day!
    No work today.
2009-01-04
  Back to work...
You can download ogrep from the outline-grep repository on GitHub, or just read the literate Haskell file. The code is almost trivial (40 lines of code, plus imports and comments); I'm publishing it just in case anyone else has a use for it, and because some of my friends were curious about how I'm using Haskell. I've now written a few "real-world" Haskell programs (compleat was the first). I'm finding Haskell very well suited to such programs, though this particular one would be equally easy in a language like Perl, Python, or Ruby. This is a one-off tool to fill a gap in my workflow; there are no configuration options or useful error messages. It would be fairly easy to extend it, though. For example, it might be handy to have an option to include children (as well as parents) of matching lines. I recently realized that ogrep often works for searching through source code too, which might generate some more unexpected use cases.

Dirk Eddelbuettel: Rcpp 0.7.2

Not even two weeks after the Rcpp 0.7.1 release, Romain and I have a new one to present: Rcpp 0.7.2. It has been uploaded to CRAN and Debian, and the respective package management systems should carry them around in the next few hours. As always, the local page is also available for download too. A lot of the momentum for the new API is continuing, thanks in large part to Romain. A number of new classes have been added, and existing ones have been enhanced. There are more unit tests than ever, and more documentation. We have better build support (with g++ version detection so that we can add some C++0x support where available) and a new examples sub-directory. We did take one toy away, though. The Doxygen-generated docs were getting so big that we decided to keep them out of the source tarball. (And arguably, they are also too volatile.) We still have the browseable html docs as well as the pdf version (now at over 300 pages!). And we added zip archives of the docs in html, latex, and man format for download. As always, full details are in the ChangeLog on the Rcpp page. Questions, comments etc: bring them to the rcpp-devel mailing list off the R-Forge page

Steve Kemp: Cover your heart! Cover your heart!

I've long been a fan of Danga's Memcached, back in 2005 I wrote about it for the first time. Recently I've been looking at the persistant version, memcachedb which is essentially a Berkeley Database using the memcached protocol as the transport layer. This allows you to get persistance for free, and means you can rely upon the content being present, rather than just hoping it will be there as an opportunistic cache. However in this brave new world of nosql I've been mulling over different options for new projects / new toys. I have to say that memcachedb lost out for me, and that Redis is my preferred flavour of new hot. Redis has a rich API allowing you to store interesting datatypes such as lists, and it allows both replication and distribution (neither of which I need just yet, but both are useful to have as options for the future). The documentation is great including a well-documented Twitter clone, and the facilities that are available are a step up from memcached, albeit obvious extensions which you'd expect if you were doing interesting things. The redis-server package is already part of Debian GNU/Linux, and creating .deb package of the Redis module was trivial. So now that I'm familiar with it, what to use it for? Well I think the first thing will be the new 2010 Valentines site. Over the years I've hosted several Livejournal Valentine sites, and this year is no different. (Why? I like matching people, and I like social stuff. This is why I did ctrl-alt-delete in the past, even if that failed it was a great learning experience and I'd do it again if I had the time/patience/more optimism). So far the site only has a couple of users but I fully expect it to ramp up considerably before the magical day (ha!). In the past I've limited the lifetime of the site(s) from Feb 1st to Feb 14th and still managed to achieve 5000+ users. Right now I'm using flat files for storage specifically to avoid database-load issues (which caused me considerable pain one year). I suspect the backend will be Redis-based in the very very near future, but in the meantime if you're open to amusement and use Livejournal then feel free to poke at it: ljvalentine.com. ObFilm: Indiana Jones and the Temple of Doom

Next.

Previous.