Category: Howto

Fixing KSnapshot Quirks – and Programming the Linux Shell in the Process

KSnapshot is the best of programs, and KSnapshot is the worst of programs.

First of all, KSnapshot is a terribly nifty utility that takes screenshots of the current screen. It’s very flexible and allows you to grab the whole screen, a single window on the screen, an area of a window, a random rectangle on the screen, or even some weird shape that you draw on the screen. It’s got tons of opportunities for you to record what’s going on.

Also, it is very powerful in what you can do with the grabbed stuff: you can save it in a variety of formats, you can send it on to some other application (for instance, email or photo editing). But wait! There is more! You can request a delay, so you can arrange the screen just the way you want (for instance, if you want to grab a video still); you can have or remove window decorations; and you can or may not include the mouse, if it happens to be where you are grabbing.

To top it all off, KSnapshot is integrated into the default desktop. When you hit the Print Screen key, it pops up, with a grab of the screen (minus KSnapshot) already in it. Save it, and you are done!

Sadly, KSnapshots also has a series of stupid quirks that are largely unexplained. What’s quirky is that the functionality is there, it’s just unreachable.

(more…)

Keep Your Data Safe: Cloud RAIDs

You have probably heard the story: someone has all their data stored in the Cloud, and one morning it’s all gone. Maybe Google disabled your email account and won’t you let back in. Or maybe it’s Dropbox that dropped your files. Or maybe it’s (and this is a real case) box.com that handed somebody’s account to someone else, who promptly cleaned the account and deleted all the other person’s files.

In information security, the concept of safety includes and extends security. Security is what you need to protect your data from malevolent others. Safety encompasses that, but adds protection from other kinds of mistakes. Like the ones mentioned above.

Here is an analogy: data security is like the walls and doors and alarm systems you use to protect yourself from burglars. Data safety is that plus the smoke detector and the sprinkler system.

Here is what we’ll do: we will use free cloud services to keep an encrypted copy of whatever data we want. We will provide the encryption, and we will make sure the data is “safe,” in that the failure of any single provider will not cause us to lose any data.

(more…)

HOWTO: Figure Out What File Is Missing, and Where

One of the really maddening things about Linux (and UNIX in general) is that files are stored in random places. That is, they are not really random, but each application has its own idea of where it wants to look for stuff. You, as a user, have an inkling of what’s missing (maybe because of an error message, or because you researched on a search site). But you have not the foggiest idea of where you should look for it.

For instance, you may have installed a Python extension. Then you start python, and type:import myextension. And Python will spit out this:

Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
ImportError: No module named myextension

Of course, you know that you installed myextension. So why can’t Python find it?

Well, fret no more, there is an almost simple way of figuring this out in a jiffy, using the Linux utility strace.

(more…)

Securing Dropbox Content with EncFS

I read an article this morning about encryption on Cloud Storage Services. The idea was that the latest NSA spying scandals revealed how much the government can access, and the assumption is that a lot of the thing you store are sensitive enough that you wouldn’t want the government to have random access.

The article then went on and introduced a series of software/service combinations that perform a sync and add encryption to your files. The list was separated in three main categories:

  1. services that store unencrypted, like Amazon Cloud, Google Drive, and Microsoft SkyDrive
  2. services that encrypt the data on the server, but pass around unencrypted data, like Dropbox
  3. services that encrypt the data on the client, and the server never sees unencrypted data nor does it keep a key

Having a “little” experience in cryptology, just enough to be dangerous, let me start by saying that relying on any service to provide encryption is as good as not relying on encryption at all.

(more…)

Fixing AWSTATS

On this server (and on most others I administer) I use awstats for statistics. It’s a really nice package that give a pretty decent granularity of the visitors. It’s been working wonderfully for years, and once you get it configured, it is reliable.

Until recently. I installed awstats 7.1, and it worked fine, but suddenly it stopped. Just like that. Adding any key-value configuration option would completely corrupt the output, and all output was gone for searches, bots, etc. It was pretty much useless.

After much wrangling, I decided to face the Perl code. I am not too fond of Perl, finding its way mysterious and inscrutable. I am particularly confounded by variable typing, with the various $ and @, as well as by the automatic variables. Sure, it would be easy enough to get used to it, but why would I? It’s not like I want to write code in Perl (or a lot of other people, for that matter).

But in I went, copying the log files to my local machine and analyzing them. There is a good debug facility in awstats, but it works only from the command line, and it has to be turned on in the configuration file (and then again in the command line output).

(more…)

HOWTO: Add Your Own Nation to FreeCiv

freeciv screenshotFreeCiv is an amazing clone of the old Civilization games. It got stuck somewhere between Civ 2 and Civ 3 as far as the graphics are concerned, but the game play is as much fun as in the original. Plus, it’s open source and hence hackable, has a scripting interface (at least in the soon to be released version 2.4) and has built-in hackability.

Here is a quick primer on getting your very own, private nation implemented in FreeCiv. Once you are done, you can play as your favorite city, sports team, state, or whatever grouping you like. Want a battle between the Romulans and the Klingons? No problem!

First, a list of the things you’ll need:

(more…)

HOWTO: Map Truecrypt USB Drives on Linux

One of the little annoyances with USB drives on Linux is that they are placed on a different device node each time, depending on the sequence with which they were mounted. The problem with that is that if you tell Truecrypt to mount, say, /dev/sde1, it might be a different drive next time you mount.

My setup here is such that I have truecrypt mounting drives automagically using autofs. I have a smart script that knows how to mount all sorts of things, and truecrypt files are just one of those things. (It also knows how to automatically mount source code repositories, ssh/ftp/http file systems, ISO files, and a bunch of other things.

The one thing that eluded me, though, is the ability to mount automatically USB drives, because I have no fixed target to work with. After a while, I was quite annoyed at having a script that was almost perfect and dug up if there was a way to identify a drive that didn’t depend on the order in which they were connected or responding.

Turns out there is a very simple way, at least on Kubuntu: the /dev directory has all sorts of fancy symlinks that give you alternate names for the devices you already find in the top level directory. In this case, the devices we want are simply in the /dev/disk/by-id directory.

There are two easy ways to go about this, depending on the information you have:

(more…)

Fixing bizarre sound playback in Flash Player

For a while now I’ve had a strange behavior happen in Firefox on Ubuntu 8.10 (Ibex): whenever I started a flash video (e.g. in YouTube or CNN.com), the video would come out abut right, maybe a little halting, but the sound would be choppy. I would hear something that sounded about right for a fraction of a second, but then it would repeat like an echo. Turns out that an echo every fraction of a second makes the whole sound unusable.

Given that this morning, Inauguration Day, watching video had a certain importance, I tried to address the issue. The process of addressing an issue in Ubuntu is always the same:

  1. Type in an accurate description of your problem and add distribution and version into a search enging
  2. Sift through all sorts of useless links: people that post the question, but nobody replies; people that post the question, and the reply is RTFM or a variant; people that post the question and the reply is private-messaged
  3. Find something that vaguely sounds right (invariably on a site like ubuntuforums or linuxquestions) and try to apply it to your situation
  4. Poke around your system configuration until you find the location of the problem
  5. Fix the problem creatively

(more…)

OO vs. PP (KDE vs. Gnome)

In the flame war between Gnome and KDE, the leading desktop environments for Linux, I’ve always been on the side of KDE. As you may recall, KDE was first: based on the QT libraries from Norway’s Trolltech (now part of Nokia), KDE was the first real desktop environment for Linux. Then a Stallman-esque backlash at the licensing of QT generated a group that wanted a fully open-source product, and out of GIMP (the Gnu Image Manipulation Program) came Gnome.

I confess Richard Stallman, for all the good he’s done, has been going on my nerves for quite a while. The messianic attitude, the holier-than-though accusations of abandoning the free software movement to everybody that disagrees with him on pretty much anything… We didn’t really need that. In truth, though, Gnome did force an opening up of the QT libraries (now available open source). Of course, the Gnome project did not die just because its fundamental reason for existence was gone. And, really, nobody cares at this point. The only difference between a pure Gnome or pure KDE environment and a mixed one is the libraries and a few integration points.

(more…)

Linux and the Polar F6 Heart Rate Monitor

Well, if this is not a telling example of how things are progressing in the world of open source… I recently bought a heart rate monitor, since I realized there was something wrong with the calories burnt displayed on exercise equipment. Never one to leave out a geeky detail, I ran to the closest sports equipment store (in my case Sports Basement) and checked out the latest gear.

My geek heart was pounding for the latest and greatest, of course: the Garmin Forerunner 405 was beckoning, a GPS-enabled masterwork that seemed just made for my nerdy self. It had everything you’d want from an exercise watch, and I had already used the Forerunner 201 to great satisfaction in my cycling days.

After a little deliberation, I decided that I really just needed a heart rate monitor, not a full exercise computer. I wasn’t going to use GPS any time soon, and even if I wanted to, I would have probably used the GPS in my cell phone, the BlackBerry 8830. There is software for that one (BBTracker) that records GPS data, and that’s all you need for real.

(more…)