Lightly Seared On The Reality Grill

Random expat geekery from The Low Countries

Browsing Posts in Desktop

File this under New To Me. The Vim text editor includes a handy command to convert code to HTML.

The command, unsurprisingly, is: :TOhtml

This generates a formatted HTML file which looks like this:

And if I paste this code straight into this post (with minimal editing to make the colours fit a little better with the blog theme), I am reminded the Python style guide recommends a maximum line length of 79 characters.



 1 #! /usr/bin/python
 2 """ XKComplete: A date reversing completeness counter inspired by XKCD
 3 http://xkcd.com/1017/
 4 
 5 Copyright (C) 2012 Paul Pritchard
 6 
 7 This program is free software; you can redistribute it and/or modify
 8 it under the terms of the GNU General Public License as published by
 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>."""
19 
20 from __future__ import division
21 import datetime
22 import math
23 
24 def xkcdate(percentage_complete):
25     """ Returns the percetange completed, either as a date or a year"""
26     today = datetime.date.today()
27     completion = percentage_complete / 100
28     days = float(365.25 * (math.exp(3+20.3444*(completion)**3) - math.exp(3)))
29     try:
30         date = (today - datetime.timedelta(days)).strftime("%A, %d %B %Y")
31     except:
32         dateval = datetime.datetime.today().year - int(days / 365.25)
33         if dateval < 0:
34             dateval = 0 - dateval
35             adbc = " BC"
36         else:
37             adbc = " AD"
38         date = str(dateval) + adbc
39 
40     return date
41 
42 if __name__ == "__main__":
43     percentage_complete = 0
44     while percentage_complete < 100:
45         percentage_complete = input("Enter percentage complete: ")
46         print xkcdate(percentage_complete)

With thanks to @jk

flattr this!

For historical reasons, I tend to rename all the photos I take so that whatever prefix the camera uses is replaced by the date the photo was taken. This makes for a handily consistent naming convention which allows me to easily organise my photos regardless of whether I happen to be using an image manager or not.

I don’t do this renaming manually and have finally gotten around to putting together a Python script to completely automate this process (with thanks to Paolo Bergantino for this answer on Stack Overflow)

The script is very me specific, but it works for photos taken with my devices (Panasonic Lumix camera and HTC Wildfire running stock Android).

As ever, there is a project page here and you can find the source on GitHub. Feel free to take a look, have a tinker, or ignore it completely.

flattr this!

Just a quick note to mention that I have now added a setup script to Macsen’s Transitioning Background. This is primarily about cleaning up the codebase a bit before I start tinkering with a Gnome 3 version – which will be coming at some point in the not too distant future.

flattr this!

I have been meaning to take a look at openSUSE for a while and, this evening, finally got around to putting it on my spare laptop.

I’ve only been playing around with it for an hour or so but my first impressions are really rather positive. The install went as smoothly as I have come to expect these days (that is: very smoothly indeed) and the auto configuration provided some nice touches – most notably remembering my wireless password from the LiveCD session.

I am planning to spend some time tinkering with it, but that’s for another day. For now, here’s a view of my (unchanged and unchanging) desktop.

flattr this!

Way back in 2011, I built a small application to build a Transitioning Background XML which could then be fed into Gnome 2 so that I could distract myself with a constantly changing background. This worked well enough and achieved what I wanted – an easy way to rebuild the XML every time I wanted to add some more photos. It didn’t provide any help text, though, which is something I kept meaning to sort out.

And then Gnome 3 came along and everything changed.

I have now gotten around to looking at Macsen’s Transitioning Background again and have finally found the time to replace getopt with argparse. What that means in English is that if you type mtb -h, you will see this:

usage: mtb.py [-h] [-p PATH] [-s STATIC] [-t TRANSITION]

Create a transitioning background XML for Gnome 2

optional arguments:
  -h, --help            show this help message and exit
  -p PATH, --path PATH  Set path for images and XML
  -s STATIC, --static STATIC
                        Set static time in seconds
  -t TRANSITION, --transition TRANSITION
                        Set transiton time in seconds

As ever, all of the source can be found on GitHub.

flattr this!

Exaile

No comments

Somewhere along the line, Exaile became the default media player for Sabayon. I looked at this way back in 2007, as well as a few others. I wasn’t overly impressed at the time and quite quickly went back to using Rhythmbox. But since I have the latest version of Exaile I thought I might as well take another look at it and the project really has come on.

Importing my music collection was easy enough and, after shifting the notifications around and connecting the application to my Last.fm profile, I was ready to go.

The main reason I have stuck with Rhythmbox for so long is that I have tended to take the view that a media player is a media player is a media player. And for the most part, this is true. I want an application that will play either an album or a selection of tracks without impacting on whatever else I happen to be doing – and Exaile does a perfectly good job of delivering this.

Then I noticed a button labelled “Dynamically add similar tracks to the playlist”. So I clicked it and started playing Fegmania to see what it would come up with.

These are the results so far:

I’m impressed.

flattr this!

After almost a week, I have started to find the default wallpaper for Sabayon 8 a bit dark. A change is as good as a rest, and this one is one of the stock photos that came with my HTC Wildfire. I’ve been using it on the phone for a while now so now I shall see how it feels on a full size screen.

flattr this!

Laptoptastic

No comments

Yesterday I ordered a new Laptop and today my Samsung NP300E7A-A02NL turned up. I wasn’t originally planning to blog the entire set-up process, but I did have a few initial thoughts and thought I might as well jot them down while I wait for the backup of my old laptop to finish.

First Impressions

It’s surprisingly light. With a 17.3 inch screen this is very much a desktop replacement and not a machine that I expect to be lugging around so I was a little surprised at how light it was when I pulled it out of the box (compared to my Dell Inspiron, which also has a 17.3 inch screen).

The laptop comes with Windows 7 pre-installed and – this time around – I am planning to keep a Windows partition. This is entirely because of the limitations of the Belgian online tax returns service, but that’s a rant for another time. One thing that did impress me when I initially booted into Windows – and I don’t know if this is a Microsoft or a Samsung thing – is that it promptly asked me if I wanted to partition my disk. It’s a nice touch, even if I did launch the Disk Management application (type Disk Management in the search box in the Start Menu) to delete the newly created D: drive and create a nice big chunk of free space.

I am less enthusiastic about the keyboard. The keyboard and the number pad are the chiclet (separated keys) style and the keys don’t travel as well as I am used to. As someone whose typing stye normally involves battering the keyboard into sbubmission, the lack of travel felt a litle uncomfortable. It’s early days yet, but this keyboard is going to take some getting used to.

Installing Sabayon

So in goes the previously prepared USB stick, reboot, press F2 to access the BIOS, and I’m in the Sabayon 8 live environment. It’s a painless process but I do like the reassurance of being able to check everything works before I hit the install button. And since I am typing this from part of the post from within the live environment, I think it’s time to start the install.

And we’re in.

I am increasingly impressed with the Anaconda installer. It recognised that there was unused space on the hard drive (I knew it was worth deleting the D: drive I created under Windows) so I was able to just accept the defaults, hit go and take the dog for a walk.

I did encounter one problem though. Once the install was complete, booting into Sabayon failed with the following message:

Block device /dev/mapper/vg_barbarella-lv_root is not a valid root device
Could not find the root device in .

This, it appears, is a problem with the bootloader install and is easily fixed by putting the USB stick back in the laptop and reinstalling the bootloader.

Sabayon 8

One of the things with using a rolling release distro is that you don’t realise quite how far your setup has diverged from the default until you come to do a fresh install on all new hardware. The biggest change I’ve noticed is that the default repository is now sabayon-weekly.

This repository was launched a year ago and is updated only once a week. What you lose in getting everything right now with this repository, you will gain in stability – that’s the theory anyway. I’ve left this set-up as it is for now but may go back to the main (all shiny, all the time) repository at some point in the future.

The Sabayon team also appears to have dropped Firefox from their default install in favour of Chromium. So I have installed Firefox and applied the Sabayon Chrome theme. Maybe it’s just me, but I do find the default Chromium theme to be quite an ugly affair.

I’m also a big fan of the Gnome desktop environment. I do like the direction the Gnome team are taking with Gnome 3, so once my preferred packages were installed, I untweaked all of the Sabayon tweaks and put the clock back in the centre of the system bar, because that’s where it belongs.

And finally

All of my data and all of my settings are currently sitting on an external hard drive. And now I am going to restore them. I won’t bore you with the details. Instead, I shall hit the Publish button on this post and then open a whisky while the restore completes.

flattr this!

After nearly 18 months solid service, my Dell Inspiron is starting to die. To be fair, the screen has never been quite right since one of the twins dropped it last summer and now it’s getting worse and I think a replacement is due.

I am planning to order said replacement from my favourite electronics store but I thought it would be worth asking around online to see what other Linux users had to say about the pros and cons of various devices.

Inevitavbly, a lot of the feedback about specific brands was contradictory and the obcervation that “Nowadays, any laptop from a decent brand is good” is probably true.

What I did find particularly handy, though, was this checklist from Fitzcarraldo on the Sabayon Forums:

- Wireless controller must be Intel
- Audio controller must be Intel
- Ethernet controller should preferably be Intel
- All other controllers should preferably be Intel except for GPU (see next rule)
- GPU must be ATI or NVIDIA
- Bluetooth controller should preferably be Broadcom

I’m not convinced about the GPU part – I have heard some horror stories about ATI and have found that the Intel graphics card in the Dell has been perfectly adequate for my needs.

But now, it’s nearly lunchtime and and almost time to go shopping.

flattr this!

Extreme Waiting

No comments

Following on from yesterday’s XKCD inspired post, I have now knocked together an extreme waiting application in Python.

You can find the source for XKComplete on GitHub. It’s pretty basic, but it works well enough to provide dates (or years) right back to the beginning of the universe.

flattr this!