Sunday, March 24, 2013

Open Source - Saving Puppies

Slight exaggeration... okay, so it's a massive exaggeration.  The 'pup' is just shy of being a full-grown dog, and the veterinary surgeon is the one who saved her, well, her ability to walk.  But Hackerspace, the Fab Lab, and Open Source software and hardware all played their part.

Just to give you an idea of Open Source's power and awesomeness: our Fab Lab was recently contacted by a Veterinary Surgeon who had a tricky surgery to perform. He wondered if it was possible to print a copy of the dog's bones so he could prepare better.

Turns out it was not just possible, but relatively simple (once we found the youtube video) and I did it using all open source software and an open source printer (the Huxley).  Even the CT Scan Data format (dicom, or DCM) is open. I ♥ Open Source.  No really.  Marry me?


As many of you know Fab Labs aren't really set up for medical use - but I was intrigued.  It would be pretty awesome if we could do this.  So I sat down with the Vetinary Surgeon and discussed the possibility, while searching up a storm on the interwebs. There were a few posts about it, many involving expensive software, but also many about doing it open source.  Enough to make me think I might have a chance.

A year or so I would not even have thought of trying.  But the skills I've learnt at Hackerspace, and seeing just what's possible with open source, gave me the confidence to give it a go.  I got some tips (thanks Pix), and just started manipulating data - learning as I went, and a couple of days later I was able to present  the doc with a 3D printed model of the bones.

The feedback from our Vet Surgeon was positive.  The 3D printed model of our pup's bones was, indeed, helpful in preparing for last Wednesday's successful operation  ("it was the best") - woot!  The surgeon could plan where to cut, and pre-contour the plate (bend it correctly).  Though our pup isn't out of the Woods yet.  So cross your fingers with me, and wish her and her owner luck.

Update:  The Pup's first check-up has gone well.  Let's keep our fingers crossed.

Tuesday, March 5, 2013

This Linux biz is awesome, can I put it on my other computers?

Why, yes, you can I'm glad you asked.

Sorry about the delayed updates.  I haven't really been using my Raspberry Pi lately, but I did manage to trash the Windows install on my Laptop.  It was entirely my own fault.  If there's anything more dangerous than a total noob, it's a noob who knows just enough to get herself into trouble when trying to 'fix' things *sigh.*

I've been meaning to dual-boot1 my laptop for a while now, and get back into using Linux. I figured I'd take the opportunity to get Linux up and running. Here I am nearly 3 months later and I haven't even bothered to reinstall Windows. Not even for gaming (but that's a post of its own). As with the Raspberry Pi, the first step is to decide which Distribution2 to use.

 Most of the Linux Distros I've used have been based on Debian. Most recently Raspbian, but before that Antix and Ubuntu. So I figured, since I loved all the Distros based on Debian, then Debian would be even better - right? Well, no, not for my purposes. The 'problem' with Debian (for a nooby user like me, and perhaps you if you're reading this) is that most of the nuts and bolts programs that work behind the scenes are so out of date. An example is libc6 - the program that runs C languge programs. A lot of programs use libc6.  Thus a lot of the games and programs I wanted to install, well, wouldn't. I could have compiled the programs for my computer (and version of libc6), but that's a lot of work, so instead I switched to Ubuntu. I highly recommend this distro. It's beautiful, modern, and easy to use. Its compatibility to Windows Games (through Play Linux Online) means the RPGs I'm into (every one I've tried so far) all work in an easy plug and play fashion. In fact many of them run better under Ubuntu than they did in Windows 7. Especially older games in *shudders* compatibility mode.

There are a lot of reasons to choose a distro based on Debian. Its massive repos3 for starters. Sure, there are other ways of installing software, but this is by far the easiest. Ubuntu is not quite as stable as Debian, and if you don't want to install newer software then Debian is a fine choice, but I feel Ubuntu has the best of both worlds. It's still pretty stable, but modern enough to game on. Linux Mint is another option (also based on Debian) that's gaining in popularity. I haven't tried it yet, but it seems like it might be more Noob friendly than Ubuntu. Give it a try if you want, a lot of my posts will apply equally well to Mint as to Ubuntu. If you want to do more research on which is the best Distribution for you DistroWatch is a great place to start, and will give you the lowdown on all the things.

So now we (I) have chosen a distro, next is to choose a Windows Manager. Sorry, I know. Just when you think you're getting a handle on it there's another layer. First you have the Operating System (Linux) and on top of that layer is the Distribution, or Distro (Ubuntu), now this? Another layer? What are we making, an Adriano Zumbo Cake? Well, no, this is the last layer I swear. But, arguably, one of the most important. The Windows Manager will determine how you interact with your computer. It is the very top layer between you and your machine. Because of my laptop's tendency to overheat I decided against installing Unity (the default Ubuntu WM) which is graphics intensive. If you have a flash new computer, then it's fine. It is highly configurable and reasonably intuitive.

For my old beast I went with XFCE4 (also called XFWM). It's a solid Windows Manager. This is easier on your hardware than Unity, and is simple to use - especially for Windows peeps, who will feel a bit of deja vu at how it is set out.  It is not as pretty out of the box (by a long shot) as Unity, though you can change some things and there are themes available.  I'll be doing a few how-tos on making it prettier in the weeks ahead.

The easiest and best way to install Ubuntu with XFCE as your windows manager is to download Xubuntu. It comes with XFCE instead of Unity, so saves a little bit of room on your download and HDD when installed. Installing Unity when you don't need it is a massive waste of hard drive.

If you want to Dual boot with Windows there are a few headaches, which I managed to avoid by avoiding Windows.  If you really need Windows though, here's a neat how-to: Sorry guys. I'd like to help, but I'd rather not put myself through a Windows install if I don't have to.  =)  Have fun!

Burn the disk image (ISO) file you've downloaded to disk using your fave software for this kind of thing. Right clicking on it should give you some options.  Plug in the power if you're installing to a laptop (pretty important for a Desktop too I guess =p).  If you can plug into a router using ethernet it's helpful, but not vital, so if you don't have a net connection don't worry.  Start the Install, and go and make a coffee.  It won't take much longer than that.  The 'good old days' of hours long installs are, thankfully, done.  At least for us Linux users.  Welcome to the club.  :)

DualBoot - Dual Booting means running more than one operating system on your computer. So, for example, on you Raspberry Pi you might like to run Raspbian for normal use, and XBMC for media use. Dual booting allows you to pick which one when you start your computer, rather than have to have separate SD cards (or Hard Disk Drives for larger computers). The most common configuration is Windows and one of the Linux Distro2, though you can dual boot anything. Windows XP and Windows 8, MacOS and Linux, or even MacOS and Windows (crazy kids).

Distro - The Distribution, or Distro, is the specific Linux you are using, which is packed with various other applications. Some examples are Ubuntu, Red Hat, Mandriva, Debian, Linux Mint, Raspbian, Xbian, etc.

Repos - 'The Repos' or Repositories are where the software that your Distribution live. Debian has the largest selection of software in its repositories. Software based on Debian, like Ubuntu, has access to these repos as well as its own.

Thursday, January 31, 2013

Nvidia and Debian Squeeze

So, using the Raspberry Pi as my Linux machine has spoiled me.  Because every RPi is the same there aren't the Driver issues that Linux often has.  If you have the drivers for one Raspberry Pi, you have them all (though the problem sometimes rears it's head with peripherals like wifi and bluetooth cards, you can avoid it by going to the Verified Peripherals page and selecting one known to work.

But blaming Linux for the lack of driver support is unfair.  It's not Linux fault that most parts manufacturers don't support Linux or won't even give the devs the info they need to support it.  It's amazing we have the support that we do have, and full credit to those masked men and women who spend hours trying (and mostly succeeding) to backwards engineer drivers for us.  Thank-you.  We've come a long way in the last 20 years.  However the sad truth is that drivers still cause issues, more often with laptops where you can't swap out video, wireless, or bluetooth cards that don't work (the main offenders).

Modern video cards are especially tricky to write drivers for, because they're just so complex.  In Nvidia's defence, they do release some closed source drivers for Linux (they got it half right), but it's not very high on their list of priorities, and support often breaks when the kernel is updated.  I'd tried all the methods on the official Debian wiki to try and get them working on Debian Squeeze (the stable, safe version of Debian)1.  No joy.  I googled for tutorials, followed them, still no joy.  As soon as they were installed I lost my graphical user interface.  If this happens to you the following command is your friend.  It will stop the computer using the (non-working) nvidia drivers by renaming the xorg.conf file.

cd /etc/X11/
mv xorg.conf xorg.conf.nvidia

Though I recommend making a copy of the original xorg.conf file before you start messing around with the image drivers, and then you can just (as root in recovery mode) move it back into the cd /etc/X11/ directory if something goes wrong.

cd into the folder where you saved the copy (with a sensibile name like xorg.conf.backup).  The ls command is helpful here, as it lists the contents of your current folder (the names of other folders will be in blue).  cd .. will make you go up a level.  When you're in the folder where you saved the backup type:

mv xorg.conf.backup /etc/X11/xorg.conf

Though even with the above knowledge this can be a risky business, and I recommend backing up everything before trying installing any new drivers.  Actually, I am assuming you know you have and nvidia card before coming here, you can check by typing:


My video card results look like this:

02:00.0 VGA compatible controller: nVidia Corporation GT216 [GeForce GT 320M] (rev a2)

If you don't have an nVidia card you will need to look somewhere else.  I recommend a google using the linux distribution you are using (in this case Debian Squeeze) and the name of the card (in my case GeForce 320M).  Good-luck.  For those of you who do have an nVidia card, let's continue :).

Firstly you will need to add the following repositories (where the software comes from) to your sources:
deb squeeze-backports main contrib non-free
deb-src squeeze-backports main contrib non-free
deb squeeze main contrib non-free

sudo gedit /etc/apt/sources.list

Then copy and paste the green writing into gedit, and save the file.

Install the following programs, and follow the instructions (click yes when asked a question)

apt-get install -t squeeze-backports dkms nvidia-kernel-dkms

Then you will need to run them with:

dpkg-reconfigure nvidia-kernal-dkms

Nearly there.  The next step is to update the xorg.conf file so that it says to use the new drivers.

sudo gedit /etc/X11/xorg.conf

You may need to change the Device Section so that it reads:

Section "Device"
    Identifier     "Video Card"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"

Finally you will need to add a Module Section just before it:

Section "Module"
    Load        "glx"

The final step is to reboot.  If you come come up with the black screen, then it means to nVidia driver install didn't work.  Just press CTRL+ALT+DEL and when you reboot choose the recovery version.  Enter you root password (you'll need to be root to make changes to the /etc/X11 folder) and follow the instructions for saving your xorg.conf.backup file as xorg.conf.  Hopefully, though, you get that interesting nVidia eye looking at you.  Good-luck!

1    Debian squeeze is the big brother of Raspbian, and so familiar to my fellow Raspberry Pi users.  This is why I chose it, though to be honest Xubuntu (a child of Debian) would be just as good a choice, and even runs the same Desktop (XFCE) and so may be a better choice for my fellow noobs.  This tutorial should work in Ubuntu as well.