Locking Session in KDE

I’ve been using KDE full-time long enough that I ought to know this, but I had to look it up! I was working in a shared location and I wanted to lock my session when I walked away from my machine. There’s an option in the start menu but the keyboard shortcut is ctrl + alt + L – then you need your password to unlock it when you get back.

Ubuntu Launching Apps

Since I started using Linux on the desktop, I’ve always used katapult to launch applications. However I have another machine that doesn’t have katapult and (since I don’t use a mouse) I’ve always used Alt+F2 to launch appilcations on there. Well, since installing Kubuntu Hardy Heron I notice it (it = KDE4 I think) has a funky new launcher thing that appears when you press Alt+F2:

As you start typing, it autocompletes and shows the icons of possible matches below – then you can click (or tab and arrow) to them, or keep typing until only the one you want remains. Very cute!

Colourful Tabs in Screen

A while ago I posted about screen, and included my .screenrc file. I got some teasing for this, since the tabs show up pink. In fact this .screenrc file is one I stole from somewhere a few years ago and didn’t really think much about the colours. Since then I’ve fiddled with the colours and now use different colours on different servers, which is a nice little addition.

Its really easy to do – using the .screenrc from my previous post – just replace all the M and m characters in the last line with the colour you’d like. I started off with something like this:

Y is for Yellow

replacing m with y and M with Y I get:

Green and Cyan

I’ve also used g/G and c/C codes for other servers, which looks something like this:

Titles

I seem to be keen on subtitles in blog posts, but I’ve not labelled many of my screen tabs in these examples (I have no idea why, I usually do). The yellow example has one where one of the tabs is named and this is really helpful once you get past about three tabs and start losing which one was tailing the apache logs! To label a tab in screen, go to that tab and then ctrl+a, shift+a and you are typing in the box. Enjoy :)

Screen for Linux

I use a lot of apps from the command-line, partly because command-line stuff is the same on every system, and partly because I struggle to use a mouse for RSI reasons. Unsurprisingly, the best keyboard-navigable apps are ones that only use the keyboard in the first place! One app that I can’t live without is screen which allows me to have one ssh connection with multiple windows in it. What’s even better is that I can detach and reattach it – so if I’ve got a complicated set of screens open on a server, or even if I’m just using IRC over a dodgy connection, I can run it in screen and go back and re-attach when I need to.

I use a custom .screenrc file, which adds numbered labels so show which screens I have open, so I see something like this at the bottom of my screen (click on it to make it normal size, the thumbnail is somehow tiny):

My .screenrc file looks like this:

termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
termcapinfo xterm ti@:te@
shelltitle '$ |bash'

termcapinfo rxvt 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
termcapinfo rxvt ti@:te@

hardstatus on
hardstatus alwayslastline
hardstatus string "%{wk}%H%{Bk}|%{Mk}%?%-Lw%?%{km}[%n*%f %t]%?(%u)%?%{mk}%?%+Lw%? %=%{Bk}"

Don’t ask me what any of it does, I got it from someone else and just copy it around machines all the time! The tabs create themselves when you create a new screen (ctrl + a, c) and then you can edit the labels with ctrl + a, A. What else can you do with .screenrc? I must confess I’ve never really looked

rsnapshot flag for usb drive

rsnapshot is a great tool that I use for all my backup stuff, its really easy and seems pretty robust (or rather, I haven’t broken it yet!). When I set it up most recently, I discovered that it has a very useful flag, no_create_root. The problem I often have is that since I back up to removable media, if the disk isn’t mounted, rsnapshot will back up to the local drive instead, in the mount point – and then I’ll promptly run out of space. Stopping rsnapshot from creating directories means no writing rubbish into your mount point, and this setting is designed specifically for this issue with removable media.

This setting does have a gotcha, however. It does the check for whether the directory exists before it calls the script named in cmd_preexec – so if you were hoping to mount your drive in the pre-exec script, you can’t! I was very confused why my rsnapshot configuration didn’t work to start with. My workaround is to run a separate mount script before calling rsnapshot in a cron job, not ideal but it does work for me.

Acer Aspire One (and cosy)

I can’t remember another post which was in both the “tech” and “craft” categories – so no complaints from either camp please! Last week I became the new owner of an acer aspire one netbook/ultra mobile PC. Its little, blue, and very cute! If you want to skip the tech bit and read about the cosy I made, click here.

aspire startup screen

The hardware isn’t the best in its class, but it isn’t the most expensive machine either. It has 512MB RAM, 8GB hard drive (solid state drive), it measures 8.9 inches and weighs just 971g.

acer aspire on scales

The default OS for the linux version is something called “Linpus Lite”, which is a kind of toddler fedora as far as I can tell. I’m a long-term linux user and I found the locked-down-ness and the limited interface quite difficult to get started with. However with some help from this nice walkthrough plus some tips from the aspireoneuser.com forums I managed to get root access, turn on the xfce right-click menu and add a menu to the panel, install Opera and Skype and customise the main menu screens. Oh and have multiple desktops, which I like.

Its great for reading feeds, email, chat, and so on, and that’s probably all I’ll use it for. Since I often develop on a dev machine over vim + ssh, I might develop from this machine but I don’t think I’ll develop on it very often. I have already been tripped up by not having particular programs and not knowing what to use instead. Konqueror is leaving a big gap in my life, I do use it a lot. I haven’t done much with fedora before, I’m sure yum is great but it isn’t aptitude. Also the weird “the default user logs in automatically, needs no password, and has instant sudo rights” setup makes me twitch. We tried turning off the sudo rights but bits of the desktop stopped showing up so I’ve left that as is.

There are some definite disappointments. The multi card reader claims to read XD cards – this is a big selling point for me as I have reason to be on the road with camera and laptop soon and I have a fujipix camera which takes an XD card. Well, XD cards do not work with the acer aspire ones so far as I can tell. We’ve dug through the drivers and it looks like it just isn’t set up to do it at all. I’m logged a support email with Acer but no response just yet. I bought the machine through PC World which seems to reduce the amount of support Acer gives, which is a bit disappointing as I didn’t know that before I did it (nobody else seemed to have supply, and they are local if entirely unfriendly. I know I don’t look like a proper geeky business user, but that doesn’t mean you can ignore or patronise me). The wireless won’t resume if it was turned on and the machine hibernates, you have to turn off the wireless before you do that, which seems like a little niggle but when you have lots of tabs active and you have to reboot to get your connection back … its really annoying.

All in all, I would usually have waited for a second generation machine but this is cute, it seems pretty robust, and withouth being very expensive it does everything I need. And at less than 1 kg, I can actually carry it without getting shorter in the process, which is more than I can say for my laptop! There is online evidence of people successfully getting proper ubuntu installations onto these machines and I’m very tempted by that idea.

I have been busy installing the new toy, but I have also been busy making it a cosy!
finished product, outside finished product, inside

Its canvas on the outside, microfibre cloth on the inside (its really shiny and gets fingerprint-y, its good to have the soft inside) and it has rigid panels (made from a plastic placemat that got too close to me while I was feeling inspired). I made two simple envelope-type bags, put them inside one another, and stitched the lining into the outer. The fastenings are sticky dots of velcro (which I shoudl have sewn in because it doesn’t stick well to fabric, oops), and the beads are ones I’ve had in my stash for … more than ten years, scarily enough. They were just waiting for this project! I made the case to be a loose fit, knowing that I’ll try to get A5 paper in there as well as the machine itself as its sort of a convenient size!

LugRadio Live UK

I’m attending LUGRadio Live UK this weekend, in sunny Wolverhampton! I’m slightly concerned that this might be too geeky for me and I might be scared but there are people I’d like to meet, the talks look interesting, and I can imagine it will be a pretty good crowd. If you are there, please come and say hi to me – I’m very easy to spot because I am tall and female with curly hair, usually a rare combination at any technical gathering :)

Vim Macro: cleaning up line endings

When development teams have people working on a variety of platforms, its pretty common to end up with wrong line endings. In vim these will look like ^M at the end of each line. To get rid of these line endings you can use the following command (in command mode)

:% s/^M$//

To type the correct ^M character, you’ll need to press Ctrl + V followed by Ctrl + M (the first combination means “take the next combination literally).

To turn this into a macro you should do the following. In command mode, pressq, followed by any letter. This will be the shortcut to access the macro. Then type the command as above. Finally, press q again to stop recording and its done. You can use your macro by pressing @ and then the letter you chose.