Linux To The Rescue.

One of my common post types is a big up for Linux, but I can’t help feeling that this one is worth it.

Here at work I was presented with an old, battered laptop whose owner had schlepped around the world with it. It was refusing to start, and the request was to help extract important data before it became inoperable forever.

In the early stages I got lucky and managed to get the computer to boot successfully into Windows. However, the success was short lived, and the system froze, displaying a classic blue screen of death.

The next approach was to try and clone the data from the system using CloneZilla. I created a bootable USB stick, restarted the machine and began cloning the partitions. Unfortunately the two important partitions kept on throwing errors on particular sectors and stopping the cloning process in its tracks. And as the system discs were all using NTFS I wasn’t able to attempt any kind of on-the-fly repairs.

In the end, I got a live CD version of a low resources Ubuntu (Lubuntu, using the LXDE window manager) and booted the system with that. The boot process was seamless and the window manager started without a problem. I then used the command line and some Linux know-how to mount the Windows hard drive and an external hard drive provided by the user. Then it was just a matter of finding the data that the user wanted saved and copying it using the normal file system manager.

It has taken a while. The USB interface on the machine is slow, and data reading from the hard drive seemed sluggish, but it has worked well, and all of the users data is now safe.

It is worth noting that when I say ‘Linux know-how’ then it makes it sound simpler than it was. I realised this when the user asked whether it would be possible for me to tell her how to mount the discs if she needed to do. I started to explain the process, then realised (prompted by the way her eyes were glazing over) that while it is obvious to a long term Linux user it might as well be in a foreign language to a new user. Worse than that, when I tried some Google-Foo I wasn’t replete with good explanations that way either. I’m not sure if this is a failing of my Google-Foo or a gap in the otherwise excellent on-line documentation.

Advertisements

My iMac Approaches Perfection Asymptotically.

I have written several times about the learning curve of turning my 27″ iMac into the computer that I am happy to use all day every day. Much of this process has revolved around me moving away from using the Mac OS X operating system as much as possible. I run Linux, and, as I’ve noted in other entries I have a very tweaked system.

But there was one thing about the Mac that was a problem from the start, and which I hadn’t been able to sort out. I like to listen to music when I work, but as I share an office, I have to be concious of the impact of the impact of music on others around me.

After installing Linux I found that plugging in headphones cut off the sound from the speakers, just as you would expect, but the sound would resolutely refuse to flow from the headphones.

I have finally found a fix, of sorts. The forum post which explains the solution is here.

Essentially a short Python script is created which resets the headphones configuration and allows sound through the headphones. Apparently it needs re-running every time you re-start the computer, but I can live with this. I already run a couple of scripts when I log into the computer in the morning (to turn on my preferred keyboard layout, launch Dropbox, X Screensaver, Synergy and other useful functions).

So now I can listen to music when I’m at my desk and not disturb others with my choice.

 

Synergy – Control For More Than One Computer At A Time.

I am not, by habit or practice, a tidy person. This is strongly reflected in my work desk which is awash with stacks of papers, forms and diaries. Unfortunately, I am also someone who has two computers on my desk (see many previous comments on the subject).

The computer I use most is a 27″ screen iMac. The screen is lovely, with excellent image quality.

However, I don’t particularly like Apple keyboards, so I don’t use an Apple keyboard. Instead I have a wireless Logitech keyboard (a  K230 for the record). The previous keyboard that I had didn’t have a number pad on it, so I added a separate wireless number pad (also Logitech, a N305). I’m also not that keen on Apple mice because I need at least two buttons and the direction of scrolling is all wrong, so I have a trackball, which I like because it doesn’t need lots of desk space (M570).

The brilliant thing about the Logitech kit is that they all link using Logitech’s ‘Unity’ wireless system, and, importantly, each Unity USB connector can support up to 6 devices. That means I can have the keyboard, number pad and trackball all connecting to a single USB connection, and I don’t lose a heap of precious USB ports.

I am very happy with this setup and can type quickly, mouse around accurately and enter data in spreadsheets efficiently.

Then there is my other computer. The keyboard is stiff and not particularly pleasant to use, and the mouse is an old Apple mouse (pre touch surface, even pre-rollable nipple thing) where the whole case of the mouse is the button. Its horrible.

So how do I manage this setup, and the challenges of limited desk space, preferred hardware etc. Enter Synergy, a simple system to manage multiple computers from a single keyboard and mouse.

Setting up Synergy appears to be easiest when you are sharing multiple Windows computers as Windows is provided with a nice handy app where you can name computers and define where their monitors lie in relation to one another. Users of other systems need to create and edit a text file to define these relationships. So I chose to make the iMac the server machine and the Windows machine a client. Following instructions was simple enough, and after having a few connection issues caused by misnamings of the two systems I was suddenly up and running.

I have a similar issue in starting the Synergy server on my Linux box that I have setting the keyboard, activating the screensaver etc, so initially I was tempted to append the instructions to activate the server onto the script that sets these things up. However, the only time I’m going to use the Synergy system is at work, so it doesn’t make sense to add this overhead to all my Linux systems. Instead I created a script which launches the Synergy server. I run this after my initial login (and after the keyboard setting script).

Using Synergy is simply a matter of mousing over to the screen edge which is defined as the point at which the two computers meet. For reasons of understandability this should be the edge of the screens where the monitors abut. Pause for a moment and the mouse will flip over to the other screen, and you are in control of the other computer.

One unforeseen advantage of this has been the way that the keyboard layout on the server computer, that is the iMac is the keyboard layout used on the other computer. As I have written elsewhere, I use a non-Qwerty keyboard layout. In Linux I can choose a Dvorak keyboard layout, but with UK punctuation (a £ sign, the @ sign being on the middle row, just by the return key etc). I also have the Caps Lock key and the left hand Ctrl key swapped so that I have a Ctrl key on the home row of the keyboard. Replicating the finer points of this in Windows is difficult as the normal Dvorak options are US English, Dvorak left handed and Dvorak right handed. Customisation is possible, but it requires installation of extra programs and understanding an arcane piece of software.

However, using Synergy with Linux as the server fixes this as the Linux keyboard layout is carried over to the Windows computer as I flip over. Bonus!

 

Linux vs. Windows – Another Linux Success Story.

When I was purchasing my home laptop, I chose a Dell. One of the reasons that I liked the Dell store was the way that I could choose a system and then tweak the requirements as needs be.

As I was running through the options, things like processor, memory and disc size, I remember deliberately choosing not to have a webcam at all.

The reasoning was simple. I was planning to use Linux at least part time on this new computer, and add-ons like webcams were, I thought, difficult to use, or poorly supported. If I didn’t bother having them then I wouldn’t need to fiddle to get them working.

Now, spool forward three or four years. My daughter got a book for Christmas which boasts ‘Augmented Reality’, requiring a simple program install and a webcam. So I borrowed a webcam from work (we have it for those occasions when interviewers want to Skype) and took it home.

Obviously the ‘AR’ software only runs on Windows or Mac, so we booted the laptop into Windows, plugged in the webcam and waited while Windows did its thing.

It is worth noting that Windows 7 does an excellent job of detecting the device and installing the drivers, but it took an inordinately long time to do so (more than 5 minutes, less than 10). But once it was done, it worked very well.

When I got to work this morning I decided to try an experiment by plugging the webcam into my desktop machine running Linux (its a Mac, but it dual boots into Linux because, well, I like it like that!).

I plugged it in, then started up ‘Cheese’, the webcam program where you can add weird and wonderful effects to you images. I then selected ‘Preferences’ and was able to switch between the computers built-in webcam and the USB webcam straight away (with no apparent drivers required).

Now I have a horrible feeling I will need to buy a webcam for home…

2013 Book Report 20: Hello World! Computer Programming for Kids and Other Beginners – Warren Sande

I read this book in a combination of the paperback and the Kindle version as purchase of one brings with it the option of downloading the other.

Introduction to Programming.

I purchased this book, at least in part, as I am interested in making sure that as time goes on my daughter begins to learn more about computers than just the fact that it is possible to watch YouTube videos on them.  While this is a project that I feel strongly about, I am being careful to not push any agenda.

The fact that such a book is available is an indication of the times that we live in. I grew up in the ZX Spectrum era, learning BASIC in lessons at school. But a ZX Spectrum was a simple machine, with limited capabilities.  Even the cheapest, simplest modern PC eclipses the original home computers in what they can do. But I think it is important to maintain a perspective on the functionality of modern computers. Programs now are huge projects, often written by an army of coders. Computers are still machines that are controlled by the programs that people write for them. Therefore having even simple skills to know how to program computers opens up a plethora of possibilities, which will help modify thought processes, teach critical thinking skills and prepare children for a technologically complex future.  In this much this book has similar aims to the Raspberry Pi. It aims to allow users of computers to see that they don’t have to be passive, they can interact, and they can make the computer do what they want it to.

These then are the aims of this book, and in order to guide the process this book is actually the product of a father and son team, where the father is an experienced programmer and the son is a beginner intent on wrestling control of the machine. This central conceit of the book works to make the book a good source of information, but it does sometimes lead to cutesy writing which is less than ideal.

To provide a suitable springboard the book looks at programming using the Python language. This is a popular programming language for those looking to learn, and it is easy to see why. Programs written in Python tend to be easy to understand, reading like a stilted English language description of what you are trying to achieve.

The only point I would raise about the wisdom of choosing Python is that the language is in something of a state of flux. Most of the code currently ‘out there’ is Python v. 2, but Python v. 3 is growing in popularity, and there are some quite major changes in the two versions, apparently intended to force reappraisal of some of the code base.  The book does address these issues and even highlights where they may cause problems, but it seems an awkward thing for the beginner to have to deal with.

And does it work? Well I haven’t tried it with my daughter yet. She is only 7 years old, and I think it is probably a little early to expect programming to fire her imagination. And when she is ready to make her first foray into coding I’ll start with Scratch, before the rather more abstract Python. But this book will be one I reach for when we are ready to make that transition.

Always Fiddling… Fortunately Rome Isn’t Burning.

I’ve written a couple of times about the fact that when I use Linux my window manager of choice (currently) is Xmonad. It has been for a while, but that doesn’t mean it has to continue being the choice, if something comes along.

I have also talked about my one bugbear with Xmonad. It is less convenient when I use my laptop as the function keys need an extra button to be pressed. It ends up being a two handed job changing screens. I was looking to find a way of changing the function keys to avoid this problem, and ended up reading about i3, another tiling window manager.

Installing it on my Linux machine was, as ever just a matter of using ‘aptitude’, and it only took a minute. Then simply log out, and set the session type.

As with most of the tiling managers, when you log in the screen is blank, apart from a simple status bar at the bottom of the page. I managed to run a script which I have to set the keyboard layout, screensaver etc.  But then I couldn’t work out how to do anything else!

I found the following page, so I’m going to give it another go. The cheat sheet can be found here.

Making ScrobbleThis work on Linux Mint.

I have been a long time user of Last.fm. I like the idea of social music, and I have regularly looked at making my iPod report my music listening to the Last.fm site.

This process goes by the name of scrobbling (no, I don’t know why!), and there are a few methods of scrobbling listed on the Rockbox website, but I was particularly interested in finding a command line version of the same as I was thinking about having the scrobbling process run automatically when my iPod was connected (a subject for another day).

I found a simple Python script here:

http://code.google.com/p/scrobblethis/

The download is small, and installation the work of moments. However, it didn’t run straight away. I also needed to do the following:

1) Install the Python module for communicating with Last.fm. On my Mint box this was achieved using:

sudo aptitude install python-pylast

2) Running the command scrobblethis followed by the path to the scrobble log produced an error about a module not being found in the file log.py. A little google foo showed that some users with the same error message had fixed it by changing the import command in log.py from:

import common

to:

import st.common

In my case however the import already read:

import st.common

So I added another line

import common

which seemed to fix things.

3) The last stage was to modify the local configuration file to include my username and password for Last.fm.

Once these things were done the process of uploading the scrobble file was just a matter of the command:

scrobblethis

One advantage of this script (over some of the online scrobblers I have tried) is that the log file is automatically deleted when the upload is complete.