I just added this section to the libguestfs man page. Always good to be upfront about your mistakes.
LIBGUESTFS GOTCHAS Gotcha (programming): "A feature of a system [...] that works in the way it is documented but is counterintuitive and almost invites mistakes." Since we developed libguestfs and the associated tools, there are several things we would have designed differently, but are now stuck with for backwards compatibility or other reasons. If there is ever a libguestfs 2.0 release, you can expect these to change. Beware of them. Autosync / forgetting to sync. When modifying a filesystem from C or another language, you must unmount all filesystems and call "guestfs_sync" explicitly before you close the libguestfs handle. You can also call: guestfs_set_autosync (handle, 1); to have the unmount/sync done automatically for you when the handle is closed. (This feature is called "autosync", guestfs_set_autosync q.v.) If you forget to do this, then it is entirely possible that your changes won’t be written out, or will be partially written, or (very rarely) that you’ll get disk corruption. Note that in guestfish(3) autosync is the default. So quick and dirty guestfish scripts that forget to sync will work just fine, which can make this extra-puzzling if you are trying to debug a problem. Read-only should be the default. In guestfish(3), --ro should be the default, and you should have to specify --rw if you want to make changes to the image. This would reduce the potential to corrupt live VM images. Note that many filesystems change the disk when you just mount and unmount, even if you didn’t perform any writes. You need to use "guestfs_add_drive_ro" to guarantee that the disk is not changed. guestfish command line is hard to use. "guestfish disk.img" doesn’t do what people expect (open "disk.img" for examination). It tries to run a guestfish command "disk.img" which doesn’t exist, so it fails, and it fails with a strange and unintuitive error message. Like the Bourne shell, we should have used "guestfish -c command" to run commands.Leading me down the garden path today, how to quickly display an XML document … graphically, from the command line?
This doesn’t work:
$ virt-inspector --xml RHEL54.img | firefox -Creating a temporary file is possible, but ugly.
Then I was tipped off that you can create and pass a data: URI to Firefox.
There is no existing command line tool to generate data URIs, but we can write one in 3 lines of shell script:
#!/bin/sh - echo -n data:$1\; uuencode -m notused | tail -n +2 | tr -d '\n'Example:
$ cat > /tmp/test.html <b>Hello,</b> <i>world!</i> $ datauri text/html < /tmp/test.html data:text/html;PGI+SGVsbG8sPC9iPgo8aT53b3JsZCE8L2k+Cg======This also doesn’t work. There are two problems: the XML generated by virt-inspector is too long for a data URI, and in any case Firefox seems to ignore the data URI although I’m sure I’m constructing it correctly. Maybe it’s a security or configuration issue?
Well, good idea, but let’s go back to the temporary file idea. Bash process substitution might have worked:
$ firefox <(virt-inspector --xml RHEL54.img)but Firefox’s frankly stupid session management crap gets in the way because this command expands to something like:
$ firefox /proc/self/fd/123and the new firefox process passes the non-portable /proc/self path to the currently running instance of Firefox which doesn’t have the same view of /proc/self.
So we are finally left with:
$ firefox $(f=`mktemp -u`; virt-inspector --xml RHEL54.img > $f.xml; echo $f.xml)which is fugly and unsafe.
If only there was a less insane tool to display XML, but being XML I guess insane goes with the territory.
OggCamp10 is an unconference, which means that the schedule will be finalised on the day. So if you come along, you can not only have a say in that schedule but you can offer be part of that schedule.
What to expect…OggCamp10 isn’t just about software. You can offer to talk about anything at all. And if people want to hear your talk, you’ll be able to give it. Even if your talk isn’t on the schedule, you can still meet up with like-minded people and discuss the things that are important and interesting to you.
At last year’s OggCamp, we had talks on how to hook your house up to Twitter (or Identica!), politics and geeks, online privacy and security, engaging young people in open source, how to explain programming to your grandmother, just what is Pokebook(!), and what your pig says about you (yes, really).
You can see the final schedule from OggCamp 2009, plus photos and Twitter/Identica feeds from the weekend, on the OggCamp 2009 website.
OggCamp is jointly organised by the Ubuntu-UK Podcast and Linux Outlaws podcast teams. OggCamp 2009 was a one-day event in Wolverhampton, UK and about 120 people turned up – which was fantastic! OggCamp10 will be a bigger and better two-day event in Liverpool, UK at The Black-e community arts centre.
Audio trailer…please playOur resident Liverpudlian, Dan, has done this brilliant audio trailer for OggCamp10 (MP3 or OGG). Have a listen! If you produce your own podcast, we’d be eternally grateful if you’d play it for your listeners – thanks!
Sponsorship opportunity…And finally, if you are interested in sponsoring OggCamp10 by contributing towards the cost of the venue hire, or by providing prizes for the event, or if you have any cool novel ways to support us, please email me: uupc@lauracowen.co.uk. Thanks.
In the continued interests of helping to make Ubuntu rock as a platform for scratching itches and making awesome apps, I am putting together a new online learning event: Ubuntu Opportunistic Developer Week, happening online between 1st – 6th March 2010.
The week will be just like our previous online learning events such as Ubuntu Developer Week and Ubuntu Open Week, but instead providing a week jam packed with awesome sessions about writing applications that scratch your itch, and predominantly focusing on Python tools and frameworks, Bazaar, Launchpad and infrastructure. The goal for the week is give attendees a head start on a given technology useful for applications.
So, I am looking for volunteers. If you feel you could give a tutorial about a given Python module or associated technology (e.g. Glade, Launchpad, Bazaar etc), please drop me an email at jono AT ubuntu DOT com and I will liaise with you to get it scheduled. I am also look for some showcase sessions: stories about how you put together an application, how it scratched your itch and what tools you used. Thanks to everyone who contributes to leading a session!
The week has already been added as a Lernid event and I am going to encourage session leaders to create slides for their sessions. As each session is confirmed it will appear in Lernid and on the wiki page. Rocking!
I had a crack at creating some electronic music. I know, not metal. I figured I would share this, and I have never done this before, so be gentle.
Check out Master Of The Situation in MP3 and Ogg format.
Created in Cubase with Halion One, a KeyRig and Drumkit From Hell.
So I've been using the Google Android phone for about six months now, and it's about time I reflected on how it's gone. Here's a bit of a rambling review.
The hardwareThe G1 hardware is pretty limited. There's not enough RAM, and the default Android way of storing apps on the phone rather than on the removable flash storage means you run out of space pretty quickly. The latter is fixed by using a custom image like Cyanogen, which is awesome.
The buttons on the phone are kinda dumb. There's green and red buttons for call management, just like most phones. Then there's a home and a "back" button, which are kinda superfluous as they could easily be replaced by some sort of touch gesture. The "Menu" is kind of a universal interupt button, and I suppose might be useful. And the trackball is completely useless yet seems to be mandatory for all designs. I never use it. On the sides are the camera and volume buttons, which I suppose are handy.
The buttons that would be really useful are missing. I'd love a pause/play button for when I'm using the thing to play music.
The G1 has a built-in keyboard. This is great, but has been dropped on later releases. Given a decent touchscreen interface, I think I could live without it. Not convinced that the on-screen keyboard is good enough, but it will make the device smaller, lighter and sexier. Though the keyboard rocks for answering emails or using ssh.
Multistasking: good and badMultitasking, the key difference between Android and the iPhone, is a double edged sword. It means you can run cool third-party apps that need to run all the time, like apps that show your calendar and weather forecast on the home screen. It also means that crap stays running all the time, meaning performance can be glacial if you've got something hogging the CPU in the background, and memory fills up very quickly.
Some allowance for the slowdown of background apps could be incorporated into the OS. It'd be nice to have apps not slow down core phone functions. I'd even be willing to completely pause background apps while something important is going on, like an incoming phone call. I kid you not, I've missed incoming calls because the phone's CPU has been busy on some other crap. Many is the time I've given up taking a photo because after pressing the camera button, whatever I wanted to snap has long finished before the camera app is up and ready to take a photo.
Shitty memory manglementAndroid takes the same "automatic" approach to memory management as Symbian: if it runs out of memory, it kills something random that's running in the background to make some space. Apps tend to run in the background unless you explicitly exit, or use a power user tool to kill the process. That means while you might have something cool running in the background, it could randomly and without notice be killed at any time because you opened something else that wants more memory. The usual excuse for this kind of thing is you don't want to make users of consumer devices think about things like memory. Try telling that to some angry consumer whose fancy alarm clock app got killed to make space for another app meaning the user overslept and was late for work! How much sense does it make to kill the music player when I'm listening to music just to make space for something else? I'd much rather have to explicitly manage the memory and be asked what should get killed.
None of this is helped by the miserly allowance of RAM on the G1, 192MB. The Nexus One's 512MB should make this much more useful, though it's going to make running a G1 or any of the first generation Android phones somewhat suckier, given developers will now be targetting the new, faster, roomier Nexus One.
How about event-driven OS callbacks?I think many of the problems with multitasking could be solved by introducing some OS-level event-driven triggers. What I'm thinking is instead of apps having to hang around in memory and periodically using the CPU, they could register with an OS service that they want to be woken on specific events: an SMS is received, the phone's power source changes, it's a specific time, the phone's location gets within x metres of a coordinate. That way you wouldn't need, for example, to keep your alarm clock app in memory all the time, wasting RAM and CPU cycles. The app would register the events its interested in, then explicitly exit.
No idea how practical this idea would be once implemented, and whether the overhead of loading up the app to handle the event would kill performance, but I think something different to the always-running-but-could-be-killed-any-time approach needs to be looked into.
Integrated appsIf you've taken a good slug of the GoogleJuice Kool Aid and moved your whole life into the cloud, Android is a really easy integration. I've got my email, calendar and instant messaging all in my Google Apps cloud, and have done for a while now. Starting with Android was as simple as logging in and waiting for it to all sync up. Brilliant. Everything Just Works™.
The apps are good too. Email is just like you'd expect, all your contacts are right there where you expect. A live calendar is life-changing, especially if you sync your work calendars into the cloud too.
One area that could do with some improvement is the way the GTalk app works. When I'm sitting at my desk and someone opens a chat session with me, I get three notifications that this has happened: inside my current browser Gmail session, the desktop GTalk app, and on my phone. Surely the server can work out which one I use to handle the session and close the others for me? Instead I have to go in and close those sessions myself, which is kinda clunky.
It'd also be nice if the instant messaging apps were a bit smarter. Let's say I want to contact someone, and the contact record shows the person has GTalk and a mobile phone. Surely I shouldn't have to work out which one to use, it can instead use the user's presence to work it out. If the remote user is on an Android phone, it could be really clever about it and switch to SMS if that user isn't online. All these contacts should show up in the same interface, regardless of underlying mechanism.
My favourite appsBy far the finest app so far is SlideScreen, which replaces the default home screen. At the top are your "private" communications: phone calls, SMS, email, calendar. Below are your "public" comms: Google Reader, Twitter. In the middle you get some status info: date, time, network connection, current weather. You can slide the middle part up and down to give more space to one area at the expense of the other. You "throw" an item to the right to mark it as read and get rid of it.
It's a beautifully-designed app, and nearly completely suits my way of working. Unfortunately it's just too heavy for the poor little G1. It takes up pretty much the whole of the RAM, so if you run another app it gets killed, and you can't really run it and another app. Should be great on the Nexus One though!
Ever since I lived in London, I've read the Guardian as my newspaper and news source of choice. I subscribed to the Guardian Weekly until recently. Part of the reason I stopped subscribing is this app, which downloads the whole paper overnight and presents it in an awesome UI that doesn't require network access. If you're writing a newspaper app, you should copy the design of this app.
ConclusionThe Android OS is excellent and improving all the time. Its openness means you can swap out much of the bits you don't like, which contasts well with Apple and Nokia's smartphone efforts, where you're stuck doing things the way the vendor tells you.
The app marketplace started off pretty poor, with lots of not very good apps, but is improving fast. People point out the high quality of the iPhone apps, but it's worth also pointing out that a popular app there can easily pay for multiple full-time developers. Android isn't there yet, but the marketplace is expanding incredibly fast. Some stand out apps are appearing (like SlideScreen) and you can expect more with the hundreds of Android handsets that will be available by the end of this year.
I'm looking forward to upgrading to the Nexus One, especially since I dropped the G1 and now have a lovely big crack across the LCD. Just have to keep working on the boss to release the funding. It'd be really good if a version appeared that handles the 850MHz UMTS band, since I'll probably be scoring a work SIM soon and Telstra's network uses this slightly-unusual frequency range.
Good
Ed Mayo talking to the Phone Co-op meeting
Yesterday I had the pleasure to be at the Phone Co-ops annual meeting, as those of you who follow me on identi.ca or elsewhere will already know. The proceedings included a speech from Cooperatives-UK Chief Exec Ed Mayo that included the co-op pub in Salford, spurning David Beckham’s gift and this summer’s Co-operatives Fortnight.
As ever, the bits I liked best were the lively question-and-answer sessions, both on Ed’s speech and the annual report. I took notes and reproduce them below, but I didn’t capture every question, or every answer and none of this is verbatim. Questions to Ed about UK cooperation included:
Questions about the annual report asked about:
I've been trying to remember to post the pictures I like online for the past few months. So this is a reminder to myself.
This image below didn't turn out quite how I wanted it to:
But that said I keep on coming back to look at it. I like the lighting, and I love the way that the brick wall on the right hand side angles towards the building on the horizon.
Enjoy. Or not.
A similarly "not perfect" image is this outdoor shot. I have only one irritation with this shot - and that is that the trees are clipped at the top. Meh, such is life.
(I have two styles of photography; semi-random where I snap what is in front of me, and staged where I try to construct a particular picture - the two images above? One of each.)
ObFilm: Bound
I love being married, it has opened up an incredible sense of commitment and security in my life and my wife’s life. Love is love, and I would never want to prevent anyone from enjoying what I am afforded the privilage of enjoying. This includes gay people. As such, I have joined this Facebook group to get 1,000,000 who support same sex marriage. I usually hate these kinds of groups, but I think it could be interesting to visualize the support behind this issue. Worthy, methinks.
Today I'm performing some minor enhancements to a hardware interface I wrote some time ago. The program isn't a perfect example of object orientated bliss, with automated regression tests, but it's a fairly cleanly written procedural program that is divided into subroutines, however it's not to hard to maintain.
It's been a while since I've blogged, I find Twitter a bit easier to keep updating. In the fine tradition of itch-scratching, I recently rebuilt my own personal mail server based on a virtual private server from Bitfolk using Exim, Dovecot and Squirrelmail. You can find the HOWTO here, I hope you find it useful.
In the continued interests of making Ubuntu a rocking platform for opportunistic developers, today we formulated the plan for Project Awesome Opportunity. The goal is simple: build an opportunistic development workflow into Ubuntu. You will install one package from Universe and your Ubuntu will be hot-rodded for opportunistic application development, making development more fun and more accessible for a glorious itch scratching smackdown.
At the heart of the project is Ground Control by Martin Owens and Quickly by Rick Spencer and Didier Roche. I have been thinking about the challenges of how we build a great first incarnation of a platform optimised for opportunistic developers, and it struck me that we can divide the first set of tasks into three broad areas:
A key part of this workflow which I designed yesterday is the Fixing a Bug component, and this is something I am really passionate about us trying to deliver in the Lucid timeframe. This is not a formal project that my team is working on, this is something that I am focused on in my spare time and coordinating with Ground Control author and rock star, Martin Owens.
Let me explain how it works:
Opportunistic development lives in the Projects/ directory in your home directory. When you load this directory in Nautilus, you see this:
Ground Control places three buttons that identify the key use cases we are keen to satisfy. When the user clicks the ”Fix Bug” button the following dialog box appears
For the first cut of this feature a bug number is required, but the feature could also include a search box for finding bugs and even potentially have an option on the Launchpad project page saying ”Fix a bug on your desktop” (or some other descriptive term) and when you click that link, Nautilus opens up and is fed the bug number.
When a bug number is submitted, Ground Control will create a branch that the bug affects (typically trunk) into your Projects/ directory. You can then go and hack the code:
When a source file in the branch is changed (and ultimately the coder fixes the bug), we now see an ”Upload Fix” button:
At this point the branch has the fix committed, so the coder clicks the button and then sees this dialog box:
This dialog box asks for the following:
When the user clicks the OK button, the following process occurs:
So, I fleshed this idea out over the last few days and documented it and had a chat with Martin Owens who created Ground Control, and he has committed to finish off the current feature set of Ground Control and creating the Fix a Bug feature in the next two weeks. Martin has volunteered to invest a significant amount of time and effort into solving this problem in Ground Control, and I am going to be working to grow awareness of the project, handle the packaging in Universe, and help to get more people involved in testing and translations. See the Create a Project, Collaborate and Fix a Bug blueprints for this feature. Feel free to subscribe to them to track progress.
For this feature to flourish and for us to rock the socks off opportunistic developers everywhere, we are going to need your help, particularly with testing and where possible bug fixes. Here are the main ways in which you can help:
So that is the goal. Let’s see if we can rock it and fire up more opportunistic developers.
At work I’m still looking for a short term PHP contractor. Perhaps I’m being unrealistic in my expectations/requirements (rate/location/duration/skills etc), but nevertheless…. As I’ve not found anyone via normal channels (twitter/phpwm user group etc) I thought I’d turn to a random recruitment agency (who I’d spoken to a week or so ago).
Yesterday I interviewed one guy – who’d been a programmer for a number of years (10+) – using Visual Foxpro (whatever that is) – presumably it’s a dead language, as he wants to move across into PHP. He has very basic PHP experience (yet claims 2 years on his CV), figured out how to do FizzBuzz and Recursion without too much help – but didn’t know anything about object orientation, separation of concerns (specifically MVC), security (obvious SQL injection) or unit testing and failed to make any comment on what is almost the worst code I could find to present to him. This isn’t necessarily a problem – I would normally be happy to train someone – however, not when I’m paying him £25/hour and I’d be lucky if he was productive within a week. (Hint: students are better than this when they’ve only been in University for two years).
Today, I therefore continued hunting, with mixed success. I had three more CVs – all asking for more money, and one looked quite good – but had a requirement he worked remotely after the first few days (well he does live in Telford). Another, who is local, I’m interviewing tomorrow. Wanting to do some homework on him, I had a look at a couple of websites mentioned in his doctored CV - the first is clearly .Net from the error message it throws when you pass a > into it’s search box – so either they replaced his PHP site quickly or his CV is misleading. The second has a PHP error on it – and is only (effectively) a themed wordpress site which looks like it’s slowly rotting. From these I found out his address (hint: whois $flamingodomain) and an invalid email address/domain (which archive.org seems to not do much with). Typing in his name into Google / LinkedIn, Facebook etc produces no obvious matches. So I know hardly anything about him, and for all intent he may as well not exist. Great sales job there.
From talking to the recruiters it seems it’s difficult to find decent PHP programmers – and anyone who may be decent will almost certainly not be programming PHP as their primary language (i.e. they’ll be doing web development in Java/.Net, and know PHP quite well). This seems a shame, but really only confirms what I already knew from interacting with others in the community. I’ve known for ages that I’ve effectively taken a large pay cut by running my own company, and doing PHP. It sucks that this continues to be the case. Clearly I’m a martyr or something.
So, if you happen to be a contractor looking for work, please make an effort. I’m not overly impressed so far, and may just end up stalling customers for another week/month instead.
(Oddly I wrote this post, posted it, and it vanished. What are you up to wordpress? Why do you want me to retype things in twice?)