DOKK Library

Linux Voice [Issue 16]

Authors Linux Voice

License CC-BY-SA-3.0

Plaintext
        NEW TO LINUX? INSTALL IT NOW WITH OUR GUIDE P32




                                                               BEST

                                                                 DISTROS
                                                                2015
                                                                  Discover the best Linux for
                                                                  you right now with our pick
                                                                      of the distro landscape

             GPX                               RASPBERRY PI                                ADMIN
Track your location                     Musical Minecraft                               Docker
Collect and edit your                   Enhance Minecraft                        Provision many servers at
own data for open                       with sound effects                       once, the easy way, with this
mapping applications                    courtesy of Sonic Pi                     CV-enhancing tool – Docker



                                                                               36+ PAGES OF TUTORIALS
LINUX IN THE MOVIES Free Software on film, from Tron to The Matrix
IPYTHON Expand the power of Python with this superb interactive mode
                                                                                               July 2015 £5.99 Printed in the UK




ASSEMBLER Draw graphics on-screen with our homemade operating system

  DEBIAN PROJECT LEADER                        DESKTOP ENVRONMENT

  NEIL MCGOVERN                                KDE PLASMA 4.3
  Inside the world’s                           Tinker, tailor and modify to
  biggest, most important                      your heart’s content with the
  Free Software project                        best KDE desktop ever
                                                                                                                               WELCOME



Distros, distros, distros!
The July issue



Linux Voice is different.
Linux Voice is special.
Here’s why…                                                                             GRAHAM MORRISON
                                                                                         A free software advocate
      At the end of each financial                                                       and writer since the late
 1
      year we’ll give 50% of our                                                         1990s, Graham is a lapsed
profits to a selection of                                                                KDE contributor and author
organisations that support free                                                          of the Meeq MIDI step
software, decided by a vote among                                                        sequencer.
our readers (that’s you).


                                          T                                                                              SUBSCRIBE
                                                   hankfully, Linux is now very easy to install and use (if you
       No later than nine months                   want it to be). I’ve not counted how many clicks are
  2
       after first publication, we will
relicense all of our content under
                                                   required by the Ubuntu installer, but it’s probably less than
                                          10. That makes it considerably easier than installing one or two
                                                                                                                         ON PAGE 66
the Creative Commons CC-BY-SA             commercial operating systems I could mention. But one thing that
licence, so that old content can          doesn’t necessarily get easier is finding the confidence to take that
still be useful, and can live on even     first step, whether it was Debian 1.1 in 1996 or Debian 8 in 2015.
after the magazine has come off           There’s something empowering about installing your choice of
the shelves.                              operating system. But the knowledge that you’re moving into new
                                          and unknown territory can also be a little scary.
      We’re a small company, so              We feel the solution to this problem is simple. It’s support; to
 3
      we don’t have a board of            know that you’re not alone. And it’s this solution we’re trying to
directors or a bunch of                   nurture at Linux Voice, and why we try to cover as wide a range of
shareholders in the City of London        subjects as possible, for all kinds of readers – from beginners (see
to keep happy. The only people            p32), tinkerers (p84) and coders (p106), to advanced users (p68).
that matter to us are the readers.        Linux and open source is an adventure, and the more people who
                                          come along for the ride, the better that ride will be for all of us.

THE LINUX VOICE TEAM                      Graham Morrison
Editor Graham Morrison                    Editor, Linux Voice
graham@linuxvoice.com
Deputy editor Andrew Gregory

                                          What’s hot in LV#016
andrew@linuxvoice.com
Technical editor Ben Everard
ben@linuxvoice.com
Editor at large Mike Saunders
mike@linuxvoice.com
Games editor Michel Loubet-Jambert
michel@linuxvoice.com
Creative director Stacey Black
stacey@linuxvoice.com
Malign puppetmaster Nick Veitch
nick@linuxvoice.com
Editorial contributors:
Mark Crutch, Andrew Conway, Marco
Fioretti, Josette Garcia, Juliet Kemp,    ANDREW GREGORY                     BEN EVERARD                           MIKE SAUNDERS
Vincent Mealing, Simon Phipps,            “Until reading Ben’s tutorial on   “Juliet Kemp’s series on old          “Our interview with the new
Gregory Pittman, Les Pounder,             Docker, I’d wrongly assumed it     programming languages is              Debian Project Leader is a great
Mayank Sharma, Valentine Sinitsyn.        was yet another catchy buzword.    brilliant, especially as I’ve got a   reminder of just how awesome
                                          But it seems rather ace.” p96      soft spot for Lisp.” p92              the Debian project really is.” p42



                                                           www.linuxvoice.com                                                                       3
               CONTENTS


                                                                                                                                    July LV016
   Rejoice, for Debian Jessie is here and the green shoots are showing.
                                                                                   18      REGULARS
SUBSCRIBE                                                                                        News
                                                                                           06
ON PAGE 66                                                                                       Rumours, whispers and
                                                                                                 analysis of the latest
                                                                                                 happenings on Planet Linux.

                                                                                           08    Distrohopper
                                                                                                 Brought to you by Fedora 22
                                                                                                 and a version of Ubuntu LTS
                                                                                                 tweaked for web apps.

                                                                                           10    Gaming
                                                                                                 Including the one game that’ll
                                                                                                 get UK Linuxers into the
                                                                                                 wonderful game of baseball.

                                                                                           12    Speak your brains
                                                                                                 Discord, praise for Ubuntu, and
                                                                                                 a super find for organising your
                      Delight in the tasty smorgasbord                                           essay’s bibliography.
                          that is the Linux desktop.                                             LV on tour
                                                                                           16
                                                                                                 Calling out to Pycon in
                                                                                                 Florence and the Libre
                                                                                                 Graphics Meeting in Toronto.
        42
                                                                                                 Group test
        Neil McGovern
                                                                                           58
                                                                                                 Share files without letting
                                                                                                 Google read them first, with a
                                                                                                 file sync client.
        The Debian Project
        Leader on running a                                                                66    Subscribe!
                                                                                                 Never miss an issue – and
        volunteer                                                                                get every back issue as a
                                                                                                 digital download.
        organisation and
                                                                                                 Core technologies
        what’s next for                                                                    68
                                                                                                 The essential plumbing
        Debian GNU/Linux.                                                                        of asynchronous network
                                                                                                 programming.

                                                                                           72    FOSSPicks
                                                                                                 Free software rounded up
                                                                                                 from the wilderness of the
                                                                                                 internet, presented to you
                                                                                                 with pride.

                                                                                           110   Masterclass
                                                                                                 Edit sound files the graphical
                                                                                                 way with Audacity and on the
                                                                                                 command line with Sox.
   28
        LINUX ON FILM           32
                                     SWITCH TO LINUX         40
                                                                  FAQ: ARDUINO                   My Linux desktop
                                                                                           114
        One day you might            Show this to your            The open source                Neil McGovern, Debian Project
        be stuck on an island        friends and help free        microcontroller                Leader – plus a warning that
                                                                                                 not everyone provides the goals
        full of Velociraptors        another Windows              working its way into a         from their crowdfunding projects
        and save the day with        user from proprietary        hardware hacking               on time…
        your Linux skills…           clutches.                    project near you.


   4                                                   www.linuxvoice.com
TUTORIALS                                                                            REVIEWS
  82                                                        Multitrack
                                                            audio with
                                                            Ardour

                                                            Take sound from
                                                            more than one
                                                            source, edit it
                                                            and export it as a       50   Ardour 4
                                                            single file. It’s like        Edit sound and add effects with
                                                            layers in Gimp,               this enormously powerful audio
                                                            but with audio.               editor – there’s a tutorial on p82!




  84                                        88




                                                                                     52   Debian 8 Jessie
                                                                                          For stability, for freedom, and
                                                                                          for a huge variety of software,
Raspberry Pi:                            GPX processing: create,                          vote Debian.
Minecraft & Sonic Pi                     edit and share GPS data
                                                                                     53   Visual Studio Code
Add sound effects to events in      Add detail to maps with                               A closed source code editor?
every 10-year-old’s favourite game. open, editable GPS data.                              From Microsoft? Good luck to
                                                                                          them in a competitive field.

  92                                       96
                                                                                     54   KDE Plasma 5.3
                                                                                          The KDE desktop is improving
                                                                                          rapidly – try it today. We
                                                                                          promise you’ll love it.

                                                                                     55   Synfig Studio 1.0
                                                                                          A hugely powerful (and just
                                                                                          as complex) Free Software
                                                                                          animation tool.
Lisp: let’s program                      Docker: roll out apps
                                                                                          Books Paper is still a winning
like it’s 1958                           consistently and quickly
                                                                                     56

                                                                                          way to get information into your
Learn the language of artifical          Ensure a cosy environment for                    brain, as we find out.
intelligence research.                   your applications.
100
      IPython: Python      104
                                 Code ninja:          106
                                                            Assembly
      and more                   Boolean logic              language
      Interactive                Simplify your              Add graphics to
      computing for all.         coding.                    your basic OS.



                                                 www.linuxvoice.com                                                         5
     ANALYSIS




NEWSANALYSIS
The Linux Voice view on what’s going on in the world of Free Software.
Opinion


Free to scam
With great freedom comes great opportunity to swindle unsuspecting computer users…

                           Simon Phipps             money monthly. The scammers often direct           at Mozilla’s strong trademark policy. But
                           is president of the      enquiries to the OpenOffice community              it’s paid dividends. Mozilla’s (excellent)
                           Open Source Initiative                                                      legal advocate has repeatedly shut down
                                                    public mailing lists, where confused users
                           and a board member
                           of the Open Rights       show up assertively demanding refunds              Firefox scams, in one case partnering with
                           Group and of Open        believing they are addressing a private            the German public prosecutor to secure
                           Source for America.      customer service address.                          both a conviction and damages against a
                                                       The same pattern also holds for Mozilla’s       substantial scam that had been preying on
                                                    Firefox. Mozilla’s legal representative            the public for years.
                                                    Anthonia Ghalamkarizadeh of law firm
                                                    Hogan Lovells told me “Mozilla is regularly        We are not alone


O
          pen source software is made               receiving reports through its online abuse         Not all projects can afford to instruct
          available without any restrictions to     reporting system from users. Most users            dedicated legal counsel to defend their good
          everyone. Permission is granted in        won’t be able to tell, or won’t notice, that the   name and user community. The US-based
advance to do whatever you want with it.            download is not for the original version but       Software Freedom Law Centre (SFLC) will
That’s great! But that freedom also offers a        either for one with modified default settings      usually help with the early stages of
resource for scammers to deceive and                (such as different home page and different         trademark enforcement for open source
defraud the unwary. Freely licensed                 inbuilt search engine features) or comes           projects, but they do need to have clear
copyrights are freely licensed to the bad           with bundled third-party software.”                trademark use and enforcement policies.
guys as well. There are plenty of them                 VLC scams go even further. Using publicly       But as open source grows ever stronger, we
exploiting this gift to society for harm            available source code, the scammers                can expect the problem to grow, so now is
instead of for good as it’s intended.               build binaries that insert adware (or even         the time to make sure your trademark policy
   OpenOffice scams have been a sad                 malware) into Windows systems. They then           is concrete if you are involved in a project.
fact of life for many years. Since users of         buy Adwords credit from Google, placing               Google also just accidentally helped
office productivity suites are conditioned          advertisements for “VLC” and “Videolan” as         matters get better. At the end of April,
to expect substantial payments and                  well as the names of various hard-to-view          Google quietly changed its rules for Adwords
regular updates, the scammers create                video formats, so that people searching            advertisers who link to software. In the
professional-looking websites that offer a          for a download of a media player or codec          process, it has helped reduce the fraudulent
subscription to OpenOffice. They usually            are deceived into downloading the trojan-          abuse of open source software. The new
use the trademarked name and graphics in            infected rebuild of VLC. They then profit from     rules disallow “Promotion of free desktop
a way that would make anyone think they             the malware – injecting adverts, stealing          software, unless the ad includes the name
were the owner or licensee of the product.          credit card details and personal information       of the specific software being promoted and
The most frequent pattern then offers “free”        and even participating in paid botnets – and       leads to the authoritative online distribution
downloads, but require downloaders to               use part of the profits to buy more adverts.       source for the software. The authoritative
pay a fee for an account to the download               What can we do about this? Mozilla              source must not have a history or reputation
service. That fee is often modest, but hidden       spends big money trying to protect us all,         of policy violations.”
in the terms of use is an agreement that            using trademark law as the lever. That led            Maybe these changes by Google, intended
the fee is actually a recurring charge. Users       to a falling-out with the Debian project,          to protect it from ad-injection malware, will
who pay for the fee via credit card discover        which decided to make a running fork of            make a difference. But the scammers will
that they are charged the same amount of            Firefox rebranded as IceWeasel in protest          go where the money is to be made, and as
                                                                                                       open source grows so will their target. Take
                                                                                                       care out there, and help educate your friends
“The Mozilla Foundation spends big money trying to                                                     and family to always download open source
protect us all, using trademark law as the lever.”                                                     direct from the project and never from any
                                                                                                       other site.



6                                                               www.linuxvoice.com
                                                                                                                ANALYSIS


              Releases • Endless • Cyanogen • Mint • Xubuntu • Qt • Microsoft




CATCHUP                                       Summarised: the biggest news
                                              stories from the last month

          New releases galore!                        78% of businesses use                        Endless: a Linux computer
   1       It’s been a busy month for          2      open source software                  3      for the whole world
           FOSS projects. Debian 8 was                   That’s what a survey by                   This kickstarter aims to bring
released after two years of development     Black Duck Software, an open source          Linux to the 5 billion people who don’t
(and plenty of flamewars over Systemd).     consulting firm, says. However accurate      have a computer. It’s a cheap and
See page 52 for our review. Around the      it is, there’s no denying that FOSS is       cheerful box that plugs into a TV and
same time, Ubuntu 15.04 arrived (more       playing an increasingly vital role in many   uses a mobile phone-type low-power
on that in our cover feature), along with   businesses. In fact, we find it hard to      CPU. http://tinyurl.com/q76r5ng
its variants in the form of Kubuntu,        imagine any business that doesn’t use
Xubuntu and Lubuntu. On the desktop         FOSS such as OpenSSH, Apache, PHP,
front, KDE Plasma 5.3 was released,         Perl, MySQL and other well-known tools.
and we have the full lowdown on that        Or perhaps those 22% of businesses
on page 54. And by the time you read        that claim they don’t use FOSS simply
this, Fedora 22 will be close – turn over   don’t realise that it’s inside many apps
the page to find out what’s new.            and products that they depend on…




          Cyanogen partners up                        Linux Mint gets cash                         Xubuntu announces Core,
   4      with… Microsoft                      5      boost from VPN service                6      unrelated to Ubuntu Core
          This news had the internet                   Ubuntu spin-off Linux Mint                   Xubuntu is already one of
exploding with rage, but it was largely     has announced a new primary sponsor,         the lighter mainstream distros, but the
misinterpreted. Cyanogen Inc., which        PrivateInternetAccess. This company is       newly announced Core version will fit
makes mobile OSes based on Android,         one of the biggest VPN providers, and        onto a CD and offer just the basics.
has announced that it will bundle           claims to offer extremely high levels of     Users can then download what they
Microsoft apps and services with its        security, never logging anything that its    want, without having to remove bundled
Cyanogen OS platform. But note: this is     users do. However, it’s based in the USA     apps. The choice of “Core” as the name
not the same as CyanogenMod, the            and could be served with secret court        is crazy though – even the Xfce team
Android variant that many of us run on      orders to hand over any data it has,         admits that it could get confused with
our smartphones and tablets. The latter     without telling the public. In any case,     Ubuntu Core, a very different project!
will remain “neutral on services”, while    this is great news for the popular Mint      “Xubuntu Mini” would be better, we
Cyanogen OS will chase the big bucks.       distro, and should ensure a healthy          reckon. http://xubuntu.org/news/
So breathe a sigh of relief…                future for a few years to come at least.     introducing-xubuntu-core




          Qt slips up with installer                                                               Microsoft in actually-
   7      account requirement                                                               8      liking-Linux shocker
            Qt, the framework used                                                                  Flying pigs have had to
by KDE and other FOSS projects,                                                          wrap up well during the cold spell in
has always occupied a difficult spot                                                     hell recently. Not only did Microsoft
between the free and commercial                                                          hold a launch party for Debian 8 at a
software worlds. For the latest release,                                                 Linux event in the US, the notoriously
the Qt Company changed the installer                                                     non-FOSS-friendly company has also
so that it asked users to log in with a                                                  released a code editor for Linux (see
Qt account before proceeding. This                                                       our review on page 53). Maybe this
smacked of “registration” or “activation”                                                is down to the new CEO, who has a
for many users, who complained                                                           markedly different attitude to “Linux is
bitterly. In the end, the Qt Company                                                     cancer” Steve Ballmer, or perhaps it’s
wisely backed down and removed the                                                       just acceptance that yes, Linux is here
login requirement.                                                                       to stay, so let’s all get along nicely.




                                                     www.linuxvoice.com                                                             7
     DISTROHOPPER




DISTROHOPPER
What’s hot and happening in the world of Linux distros (and BSD!).

Fedora 22
Bleeding-edge Linux.


F
          edora 22’s final release date has
          slipped by a week, but it should
          almost be ready by the time you read
this; it’s due on 26 May. We’ve come to
expect plenty of cutting-edge goodies in
Fedora releases, but 22 goes a step further
with major updates all over the distro.
Wayland takes a prominent role, being the
default display subsystem for the login
screen, although X.org is still used for
regular desktop sessions. It feels like we’ve
been waiting for Wayland for aeons, so this
is a small but significant step forward, and
will provide the Fedora and Wayland teams
with plenty of real-world feedback.              Fedora 22 showcases the latest Gnome, along with Wayland and the new DNF package manager.
   Then there’s a big change to Yum, the
package manager. This has been replaced            On the server, there’s a new Database role      kernel, Glibc and Systemd, so it’s pretty much
by DNF, the “Dandified Yum”, which offers        (utilising PostgreSQL) and improvements to        the most bleeding-edge distro you can get.
better performance for such things as            the Cockpit web-based management tool.               If you try Fedora 22 and have any issues
dependency resolution, but also maintains        Fedora 22 will be available in three flavours     at the login screen, it’s well worth letting the
most of the same command line options.           – Workstation, Server and Beta – the first of     developers know (http://bugzilla.redhat.
Then there’s the new Gnome release with its      which is provided as a 1.3GB DVD ISO              com). The more users that test it on a wide
improved notifications, plus enhancements        download. All flavours are built from the         range of hardware, the closer we’ll get to
to the bug reporting tool and other apps.        same core, using the latest versions of the       Wayland replacing X.org on the desktop.




Chromixium 1.0
A web-centric OS based on Ubuntu’s LTS releases.


G
         oogle’s Chromebook laptops have         middle ground: it “combines the elegant
         taken off in a big way. They do         simplicity of the Chromebook with the
         almost everything that a typical        flexibility and stability of Ubuntu’s Long Term
non-technical user needs, and they have          Support release”. By and large, it looks
some benefits from being locked down and         similar to Chrome OS, with a very
limited in scope, in that users can’t double-    minimalistic panel sitting on the bottom of       Like the idea of Chrome OS, but want more
click random .exe files in emails and clog the   the screen, providing access to various web       Linux behind it? This could well float your boat.
machine up with spyware.                         apps (from Google, of course).
   Now, as Linux geeks we have our issues           But it’s still Ubuntu, so you can load it up   documentation. We’re also unsure about the
with such restrictive devices, and while         with LibreOffice, Skype, Steam and other          name: not only is it a mouthful, but it’s close
Google has generally been a good ally of the     popular apps. Right now it’s only available as    enough to Google’s own wares (Chromium,
free software community, its vast data           a 32-bit ISO download, and the distro’s           Chrome OS, Chromebooks) that users could
collection mechanisms cause us a bit of          website is rather lacking, but the team           conceivably see it as an official project, and
concern. Chromixium looks like a healthy         promises to do a lot more work on                 not something spun-off by the community.



8                                                            www.linuxvoice.com
                                                                                                                           DISTROHOPPER



News from the *BSD camps
What’s going on in the world of FreeBSD, NetBSD and OpenBSD.


B
         HyVe, FreeBSD’s native hypervisor for
         running virtual machines, is a
         relatively new project (having first
appeared in FreeBSD 10.0) but it’s making
rapid progress. Until a few weeks ago, it was
capable of running FreeBSD, OpenBSD and
Linux as guests, and a recent update has
added support for Windows as well. In the
past, it was possible to run Windows on
FreeBSD via VirtualBox, but the new BHyVe
support should boost performance on the
guest and means that extra software won’t
be required.
   Also on the FreeBSD front, the project has
issued its first quarterly status report for
2015, detailing work that’s taking place all
over the codebase. LLVM/Clang, the default
compiler toolchain in recent FreeBSD
releases (replacing GCC), has been updated               A few OpenBSD hackers will be financially rewarded for their work this summer thanks to Google.
to 3.6.0, while some developers have been
beavering away on a new bootloader.                      certain bits of code are stored in memory,        SD card controllers on ARM devices, and a
There’s also a push for ASLR – address                   making it harder to perform exploits.             port of DragonFly BSD’s Hammer 2
space layout randomisation – which                          A number of OpenBSD projects have been         filesystem. Oh, and the EU published a study
improves security by randomising the                     accepted in the Google Summer of Code             in favour of financially supporting open
location of executables and libraries in RAM.            2015. Projects include asynchronous USB           source projects – including OpenBSD – so
With ASLR, crackers can’t guarantee where                transfers from userland, better support for       maybe more funding will come from there.


  Debian 1.1 – actually the first Debian release!

  Yes, it sounds odd, but there was no such thing as Debian 1.0. At
  least, not officially. Back in 1995, the newly assembled Debian team
  was grafting away on the distro’s first release, and then a CD vendor
  called InfoMagic took a development branch, accidentally labelled it
  “1.0”, and started shipping it. This major slip-up could’ve ruined the
  fledgling project’s reputation, but both Debian and InfoMagic quickly
  announced that the so-called 1.0 wasn’t actually a proper release,
  and the first real version of Debian would now be called 1.1 to avoid
  any confusion.
     Released on 17 June 1996, Debian 1.1 included Linux kernel 2.0
  and a whopping 474 packages. (Contrast this with the newly released
  Debian 8, which has over 43,000 packages in its repositories – that’s
  growth!) The distro also used the ELF binary format throughout, in
  comparison to a.out that some other distros were still struggling
  along with, so in that respect it was fresh and modern.
     You might expect such an early Linux distro to lack a proper
  installer, providing instead just a list of steps to go through, but
  Debian’s setup tool was impressive at the time. It’s a colourful
  menu-driven program that’s not a million miles away from what we
  have today, helping you to partition your hard drive and copy files
  over. If you want to give it a go, grab the floppy disk images from
  http://archive.debian.org/debian/dists/buzz/main – you may be able
  to get it up and running in Qemu or VirtualBox. Or if you have an
  ancient PC sitting around doing nothing useful, try that instead!


  Cosmetically, the text-mode variant of Debian’s
  installer has barely changed in the last 20 years.




                                                                       www.linuxvoice.com                                                                  9
     GAMING ON LINUX




GAMING ON LINUX
The tastiest brain candy to relax those tired neurons

 THE SONS OF RAGNAR
                                            Pillars of Eternity
                                            An epic CRPG that sucks you into its rich fantasy world.


                                            D
                                                      espite all the vapourware that Kickstarter
                                                      games give us, when something like
                                                      Pillars of Eternity comes out it makes all
                                            that seem worthwhile. Obsidian Entertainment
                                            promised a classic CRPG experience, and that’s
                                            exactly what they delivered.
                                               Story-wise the game puts you in control of a
 Michel Loubet-Jambert is our Games
 Editor. He hasn’t had a decent night’s     character of your creation, and lets you choose
 sleep since Steam came out on Linux.       their backstory, gender and race among other
                                            things, but the character is always a “watcher”        The character creation screen provides plenty of


 A
           t the time of writing, Steam     – someone who can see past lives. The story            options – massive heads are ill advised.
           has almost 1,200 Linux           unfolds in The Dyrwood, a land at the edge of
           games in its store, and while
                                            civilisation and troubled by strange goings on         of metagame extras remind us that this is a
 this is far from a comprehensive
 figure of all the games on Linux, it’s a   which you have to get to the bottom of.                product of the 21st century rather than the 20th.
 pretty good indicator. To put this into       Pillars proves that the vapid eye candy of multi-      The stronghold sidequest, which allows the
 perspective, the Xbox One has just         million dollar graphics offered by the AAA game        player to take over a castle, restore it, upgrade it
 under 200 games, while there are           industry don’t make a good game alone, and one         and oversee its management is the cherry on the
 around 1,700 OS X games on Steam.
                                            that uses isometric graphics and has the player        icing of this game, not to mention the vast multi-
    Linux gaming is becoming a big
 deal, and if Valve decides to market       reading novels of text can provide a far more          floor mega-dungeon underneath it, which again
 its Steam Machines as consoles, it         meaningful and captivating experience.                 provide elements of digression which make the
 will have the biggest launch lineup in        This doesn’t mean that the game looks               game more welcoming to newer players.
 history by a long, long way. If Valve’s    particularly dated, since some very pretty
 own figures are to be believed, there                                                               Website http://store.steampowered.com/
                                            particle effects, solid voice acting in certain
 are currently between 1.25 and 1.5                                                                  app/291650 Price £34.99
 million active Linux gamers on             quests, a professional musical score and plenty
 Steam, which is a pretty sizeable
 figure but again most likely falls
 short, especially considering users
 tend to steer clear of DRM.

 All hail Linux!
 Linux is becoming a force to be
 reckoned with and is an increasingly
 attractive market to developers now
 that porting and cross-platform
 development is becoming easier and
 cheaper. With this in mind, it seems
 likely that even if Steam Machines
 are a complete flop – though we may
 not continue getting some of the
 bigger titles which were ported based
 on its potential success – we’ll still
 get a decent number of games. In
                                              The fantasy setting is often
 the worst-case scenario, we’ll have
                                              mesmerising and full of detail.
 1,200 games to play, plus the
 countless other great open source
 projects like 0 AD and OpenMW,
 though it’s more likely that little Tux
 icons will become a common sight at
                                            “The story unfolds in The Dyrwood, a land at the edge of
 games vendors.                             civilisation and troubled by strange goings on.”

10                                                               www.linuxvoice.com
                                                                                                                GAMING ON LINUX


Age of Wonders III                                                                               ALSO RELEASED…
A solid turn-based strategy game in a fantasy setting.


A
          ge of Wonders III provides a           it a bit intimidating. However, this can
          welcome addition to the 4X genre       be overlooked when taking into account
          (that’s eXplore, eXpand, eXploit,      the things the game does very well, such
eXterminate). In particular, it excels in        as heroes leading troops into battle or
“selling” the world to its players by creating   a vast underworld as big as the above-
a backstory and lore for the different           ground world. The battles are epic affairs
characters and races; without this, a 4X         with detailed character models and vast
game in an alternate world can often             armies, which introduce an element of           SuperTuxKart
feel like micromanaging numbers (as it           skill rather than the units with the most hit   Our favourite open source kart racing game
did with Beyond Earth), rather than a fun        points being assured victory.                   has reached version 0.9, and has implemented
strategy game.                                                                                   a new rendering engine which makes the
  Players familiar to the genre will get to        Website http://store.steampowered.com/        graphics look stunning and on par with many
                                                   app/226840 Price £29.99                       commercial games. This release candidate
grips with it very quickly; others may find                                                      version may pave the way for releases on
                                                                                                 platforms like Steam, as developers have
                                                                                                 hinted, which would be a big breakthrough for
                                                                                                 open source gaming.
                                                                                                 http://supertuxkart.sourceforge.net




                                                           The game provides a new setting
                                                               for those bored with building
                                                                                                 StarDrive 2
                                                                                                 In this strategy game you lead a spacefaring
                                                             empires as Romans or Greeks.        civilisation and form a galactic empire, taking
                                                                                                 part in epic space battles against pirates and
                                                                                                 rival civilisations with highly customisable
                                                                                                 ships along the way. The usual 4X tech trees,

Out Of The Park Baseball 16                                                                      building mechanics and exploration are very
                                                                                                 well executed, not to mention an excellent
                                                                                                 tutorial which helps the player get to grips with
An addictive addition to the Linux management sim roster.                                        things right from the start. Very nice musical



O
                                                                                                 score too!
          OTP 16 is the third iteration of the                                                   http://store.steampowered.com/app/252450/
          game we’ve seen on Linux, but
          unfortunately the franchise has
gone largely unnoticed.
   So should this game be discarded for
those who know nothing about baseball?
The short answer is no. The long answer
is no, and you didn’t need to be a GP to
enjoy Theme Hospital or a theme park
aficionado to enjoy Roller Coaster Tycoon.       OOTP 16’s level of detail won’t disappoint
   The game is not only impressive for           those who obsessively go over statistics.
containing basically every baseball league                                                       The Banner Saga
                                                                                                 Trudging through the cold northern lands with
on earth, but also for being able to play        top of that learning a lot about baseball.      a Viking caravan, in a world where the sun has
historical games going all the way back to       Soon enough it turns into one of those          stopped and falling apart at the hands of a
1871, making it in some ways a historical        games where every time you look at the          terrifying foe, this game puts you in the thick
strategy game which lets the player              clock a couple of hours have passed.            of it right from the start. The story is well put
change the course of history as well as a        Be warned if you still intend on being a        together, the animation is spectacular and the
                                                                                                 tactical combat is extremely satisfying. The
sports management sim.                           productive and sociable person.                 Banner Saga is a great RPG experience which
   It really is incredibly satisfying to see                                                     also suits casual gamers.
your little team climb the league as a             Website http://store.steampowered.com/        http://store.steampowered.com/app/237990
                                                   app/333820 Price £29.99
result of your managerial skills, while on



                                                                www.linuxvoice.com                                                                   11
     MAIL




                           YOUR LETTERS
                            Got something to say? An idea for a new magazine feature?
                            Or a great discovery? Email us: letters@linuxvoice.com



             LINUX VOICE STAR LETTER
  LYX
  Great to see the article on LyX;
  just one quibble though. Nobody
  seriously uses Aspell with LyX.
  The default is Hunspell, which
  uses the LibreOffice dictionaries.
    One LaTeX feature not
  mentioned (I know you
  cannot mention everything in
  a short article) is BibTeX, the
  bibliographic database system
  which is second to none for           source of information, particularly        is indeed the default spellchecker for
                                                                                                                               LyX and LaTeX give
  anyone in academia.                   on more specialist features.               Lyx, to the extent that it’s not compiled
                                                                                                                               you much more
    There are some PDFs at              John R Hudson                              into the Lyx binaries for Windows. Not      control over your
  http://johnrhudson.me.uk/                                                        that we need spellcheckers anyway…          documents than
  computing.html, which may be          Andrew says: Much as my heart              Now BibTeX, that’s a golden discovery.      a typical word
  useful for people wanting to go       trembles at the thought of using a         References are an absolute pain to get      processor.
  further with LyX. The LyX wiki        spellchecker originally written for the    right, so anything that helps there is
  http://wiki.lyx.org is also a great   Hungarian language, it looks like this     worth its weight in electrons.



SECOND HAND GAMES
I like to buy second hand PC            computer for five years and I’ve got
games on disc, usually four or five     alot of catching up to do.
years old and mystery or puzzle         Mark Alexander
games. On the box it says they
can be used with XP, Vista and          Graham says: PC games on disc are
Windows 7.                              getting rarer and rarer. Most games
    My questions are: will these        are delivered as digital downloads
games run if I use Linux as my          through a website or application.
OS; and if not, is it possible to buy   Steam is the most popular, with over
mystery/puzzle games, on disc,          1,100 Linux games now listed. GOG.
that will work with Linux.              com is another but with an emphasis
    I saw in your most recent edition   on old games. This sounds much
that more games are now available       more your kind of thing (games are
to use with Linux, including a city     typically cheap too). You can run
builder game which I would love.        some old XP, Vista and Win 7 games
Do you have to download these           discs on Linux, but it’s a case-per-case
games from websites or can you          situation and you’ll need to run them
buy them on disc?                       through something called Wine. This
    Sorry if my questions seem          is actually a really good idea for a
obvious, but I’ve only owned a          tutorial, so keep an eye out!              Emulators (such as Nestopia) can bring old games to life on Linux.



12                                                            www.linuxvoice.com
                                                                                                                                          MAIL


THE LAUGHING GNOME                                                                                             IDENTICA
I seem to remember, years ago, a                                                                               Guys, why no Identi.ca presence?
certain magazine ran with a cover                                                                              You’re on Twitter and Google+
asking “Has Ubuntu Lost it?”.                                                                                  – why do you support those big
This was in response to the                                                                                    old corporations and not the
dummy-spitting that went                                                                                       free software equivalent. You’re
on when Ubuntu changed                                                                                         supposed to be about Free
from Gnome to the Unity                                                                                        Software and free speech, so do
desktop. If the geeks                                                                                          something about it!
don’t like it (and a lot                                                                                       Richard Hirst
of geeks didn’t like
it), then it must be                                                                                           Andrew says: You’re right. Mea culpa.
rubbish, right?                                                                                                If it helps us reach more people and
    Well, no, not                                                                                              supports free software, we should be
really. Old-time                                                                                               doing it.
Unixers getting                                                                                                    When Twitter goes the way of
upset about                                                                                                    Facebook and starts charging you
change                                                                                                         to send out messages to all your
are                               the                                                                          followers, when it’s invading your
equivalent                                                                                                     privacy, selling your details to
of comic                                                                                                       advertisers, and constantly bugging
geeks getting upset because                                                          Traditional WIMP          you to get in touch with people you
the costume of their favourite          deserves.                                    interface? No. Perfect    don’t like or have never met, we’ll all
character is a different shade of       David Ross, Dundee                           for mobile, touchscreen   wish we did more to support Identica.
red than it was in the comics. It’s                                                  computing? Yes.
not about them; it’s about the kids     Andrew says: To be fair to the
who’ve come to see the Hulk and         excellent editorial team who asked
Thor and the boring one with the        the question ‘Has Ubuntu Lost It?’,
bow and arrow.                          the answer to that rhetorical question
    Anyway, I think we can all see      was a firm ‘no’. Any change is always
with the benefit of hindsight that      going to ruffle feathers (see below),
Unity was not meant to satisfy          but if you ask the people what they
existing Linux users, but to bring      want, all they’ll say is ‘faster horses’.
Ubuntu and Linux to a wider             It’s to Canonical’s credit that it’s stuck
audience, and if you think about        to its guns and produced something
it that way it’s been a massive         so touchably lovely that, even without                                 Perhaps one reason we haven’t joined
success. It’s just a shame that         Android’s massive app ecosystem,                                       Identica is that we’re put off by its dire
more people can’t acknowledge           the Ubuntu phones are destined to                                      website.
this and give it the credit it          do well.




                                                                www.linuxvoice.com                                                                   13
     MAIL



WINNING                                 SYSTEMD: WHAT’S IT ALL ABOUT?
Just another conversion story           What’s all the fuss about
here folks. My wife bought a            Systemd? I’ve been listening to the
laptop by accident; she needs           Linux Voice podcast for years now
a machine to do her marking             (and the Tuxradar podcast that
on (she’s a teacher), but it can’t      you chaps used to do), and you
be ‘mobile’. Never mind that a          all seem to make a teeth-sucking
desktop tower is just as mobile         noise whenever Systemd comes
as a laptop to anyone with the          up, like a mechanic about to
strength to pick one up, but the        overcharge me.
education authority has its rules          Surely it’s not the end of the
that must be obeyed. Anyway,            world if your init system changes?
she needs Microsoft Windows             Surely nobody even needs to know
to access the marking software,         what in init system is if they’re just
                                                                                                                              The latest version of
but as the laptop became surplus        a common or garden desktop user            David Ross’s point, that any change
                                                                                                                              Debian has made the
to requirements I quickly loaded        like most of us are? Do Windows            is going to ruffle feathers. Imagine       switch to Systemd,
it with Linux Mint Mate, installed      users need to know what startup            you’ve spent years learning how a          in the teeth of fierce
all the codecs at boot time, and        scripts are running on their               system works, its every intricacy,         opposition from a group
let her have it. No support, no         machines? Of course not. This is           and then someone comes along with          of developers.
guidance, no sitting down with          quite apart from the abuse that            an innovation that improves on that
her to show her what all the            the developers have been getting,          system, but makes all your years of
buttons do – she just gets it.          which is another issue entirely.           learning worthless. That’s the only
   This is how things should be.        As civilised adults, we should be          way I can make sense of all the rage
It’s not going to get slowed down       able to separate the technical             around a bit of plumbing on my Linux
by viruses, or weighed down by          discussion from personal attacks.          machine. The irony is that it’s so
an increasingly bloated operating       Unfortunately many people are not          contrary to the spirit of Free Software,
system, so I’m expecting the new        civilised adults.                          where everyone contributes and the
machine to last a lot longer than       Robert O’Sullivan, Cork                    best code wins; clinging to the past
its predecessor. Never mind next                                                   is something you’d expect a near
year being the year of Linux on         Andrew says: I too find it baffling.       monopoly to do in order to stifle more
the desktop – in our house, it’s        But I think a lot of it comes back to      advanced competition…
this year.
Brian Holgate

Graham says: Mint really is
                                        LIBREOFFICE
fantastic for a beginner-level Linux    Can we have a beginner’s tutorial
distribution, even though in our        on doing stuff with LibreOffice
feature on page 32 Mike backs           please? It’s a huge piece of
Ubuntu as the best for newbies.         software, and I get the feeling that
However, this is partly because         I only ever use a tiny slice of what
Ubuntu has the biggest support          it can do. There must be so many
community; if your wife has in-house    ways of saving time and effort that
support (ie you), she’s winning         I don’t know about – share the
already. Well done at keeping another   secrets with us!
precious computer away from             Sarah McKie
Microsoft’s clutches!
                                        Andrew says: There must be. I
                                        understand the importance of
                                        LibreOffice to a lot of people, but I’ve
                                        never really had to use it that much.
                                        In the days when it was bloated old
                                                                                                                              It’s one of the
                                        OpenOffice I always used to use the        the two use cases. That said, the
                                                                                                                              flagship free software
                                        AbiWord word processor, as it was          development team is adding features        applications –
                                        much, much faster. Nowadays I use          all the time, so we should take a look     LibreOffice is proof that
                                        InDesign when I want words to look         at some of those soon. I don’t think       you don’t need to pay to
If you need to breathe new life into    nice, and a text editor when I want        there’s too much call for a beginner’s     get excellent software.
old hardware, there’s a flavour of      to write something quickly – for my        tutorial though – does anyone out
Linux out there for you.                needs, LibreOffice falls in between        there disagree?



14
                                          MAIL




Email andrew@linuxvoice.com to advertise here


                 www.linuxvoice.com              15
     LUGS ON TOUR




LUGS ON TOUR
Pycon Sei
Josette Garcia reports on what’s new in Python or how to enjoy a bunch of friends.


A
          few weeks ago, I received   Pycon Cinque. During that year, the
          the most wonderful email    Associazione Python Italia with
          – an invitation to attend   Tinker Garage APS also organised
Pycon Sei in Florence. Who could      Django Village.
refuse such an invitation – not me      For 2015, they decided to
for sure!                             combine the two conferences
   I could spend weeks there          and produced Pycon Sei with a
enjoying the views, the food and      minimum of four tracks: Python,
going mad at the number of            Django, PyData and Odoo.
tourists! Unfortunately Florence        Lots of the talks were in English.
is loved by many people and           My favourite speaker, Alex Martelli,
sometime you feel that you are not    started the day with Modern Python
going where you want to but you       patterns and idioms first in Italian
                                                                               Over 1,000 delegates
are carried somewhere.                and later on in English – I do not                                  by Giulio Calacoci; Does Python
                                                                               attended Pycon Sei – so
   In Italy the Pycon meetings        understand Italian nor Python but        many that the venue        stand a chance in today’s world of
started in 2007 in the centre of      to see Alex’s passion is pure magic      needed to be changed.      data science by Radim Rehurek;
Florence and continued until          – all of his body is moving. He is the                              Packaging Django projects for PyPI
Pycon Quattro – I fell in love with   epitome of Italians, the way we like                                by Roberto Rosario, and more.
Florence during Pycon Due when        them and sometime make gentle                                          Saturday saw a recruiting
Richard Stallman gave a talk at       fun of them.                                                        session – it was fascinating to see
the Palazzo Vecchio. In 2011,           Other good presentations                                          the different ways that companies
Florence hosted EuroPython – a                                                                            try to entice new recruits. It went
partnership that lasted three years
(pretty good when EuroPython
                                      “There are no techie conferences                                    from the big PR spiel to the down-
                                                                                                          to-earth approach: that’s the job,
had to move on to another city        without networking, and the first                                   that’s what we want from you,
after three years). Unfortunately
the hotel in the centre could not
                                      event was PyBeer on Friday.”                                        that’s what you get from us. The
                                                                                                          companies hiring included InfoCert,
cope with 1,000 delegates and                                                                             Zalando, Kuldat, Develer and
the conference was moved to the       included Asynchronous Web                                           2ndQuadrant.
Grand Hotel Mediterraneo, a few       Development with Python 3 by                                           There are no techie conferences
yards from the Arno and almost        Anton Caceres; PostgreSQL 9.4 for                                   without networking, and the first
opposite the Piazzale Michelangelo.   Devops by Gabriele Bartolini; Odoo                                  event was PyBeer on Friday,
2014 saw the return of Pycon with     disaster recovery con Barman                                        which took place at the James
                                                                                                          Joyce pub. To consolidate our
                                                                                                          new friendships, on Saturday we
                                                                                                          met at the Ristorante Zazà for
                                                                                                          PyFiorentina. There you can taste
                                                                                                          the famous bistecca alla Fiorentina
                                                                                                          – a T-bone steak grilled over a wood
                                                                                                          or charcoal fire, to be eaten with a
                                                                                                          glass of wonderful Italian red wine.
                                                                                                          Just delicious!
                                                                               Despite our not
                                                                                                             Pycon Italy is organised by the
                                                                               understanding his
                                                                               Italian, Alex Martelli’s   Python Association of Italy, and
                                                                               talk on modern Python      Develer SRL (www.develer.com)
                                                                               patterns looked            spends a lot of time and resources
                                                                               fantastic!                 putting the show together.



16                                                         www.linuxvoice.com
                                                                                                                   LUGS ON TOUR



Libre Graphics Meeting 2015
Greg Pittman reports on this year’s finest open source graphics event


L
        GM 2015 has just taken
        place in surprisingly sunny
        Toronto, Canada, from 29
April to 2 May, at the University of
Toronto. It was a smaller crowd
than at some previous LGMs, yet a
dedicated one, and we saw an
impressive array of presentations.
Not only did we find, as expected,
that our major projects such as
Gimp, Inkscape, Scribus and Blender
are very much alive and still
developing after this decade of
LGMs, but we continue to see new
ideas coming to the open source
graphics community. Lively
discussions occurred following
presentations, and in various formal
and informal meetings.
                                       Blender, Gimp, Inkscape
  Early on we received some                                      for making use of the advanced           like loading a JPEG into Audacity,
                                       and other teams get
encouragement and prodding for         together once a year      features of OTF fonts.                   editing there, and seeing what
the vector graphics artists out        to synergise their                                                 happened.
there to submit work to Wikimedia      awesome visions!          Animation and video editing                 From some ideas coming out of
Commons in order to improve                                      Blender continues to rise in its         steganography we get to new ways
the quality of Wikipedia articles.                               stature in the world of not only open,   to compress 3D images into 2D
We also learned about an Android                                 but also commercial animation. A         image formats, which leads to
app (The List) in development                                    new open source video editor,            ideas on image manipulation. And
so that users can learn about                                    Natron, is working on closer             LGM wouldn’t be LGM without
image requests from Creative                                     connections with Blender for various     some selected sessions on small
Commons, take photos with their                                  video compositing tasks. Pitivi          bits of code having powerful
phones, then automatically submit                                                                         effects, like graphically
them. From the W3C we learned
about developing guidelines for
                                       “We continued to see new ideas                                     manipulating the code itself
                                                                                                          (Microraptor GUI). GEGL on a server
accessibility features for the web,    coming to the open source                                          can be used to automatically
even some ideas about considering
how to make graphics accessible
                                       graphics community.”                                               modify images on a web page
                                                                                                          (imgflo). LibreOffice is undergoing
to the visually impaired. Also from                                                                       some major changes in its
W3C we learned that an effort                                    seems to have gotten some                rendering scheme, promised to
has begun to create guidelines to                                renewed energy in recent years, and      bring improvements in results as
encourage the ability to read ePubs                              is now approaching version 1.0. We       well as cross-platform economies
and other ebooks within browsers.                                also heard from a university             of coding. The Documentation
  Work on font creation,                                         educator using open source               Liberation Project continues its vital
manipulation, and usage has                                      software, finding he not only            work on unlocking proprietary and
become a major part of Libre                                     empowers his students, but they          aging file formats, and managing
Graphics Meetings in the past                                    seem more creative, and are              colour in all of our various devices
several years. Although work                                     encouraged to interact with the          continues to become easier with
continues on FontForge, others are                               projects. A group (Theory                the availability of open source
working in other directions, such as                             Animation) has managed to create         software and hardware.
the ability to edit entire character                             a virtual animation studio by               LGM 2016 will take place in
sets at once by manipulating                                     regularly interacting online from        London, at the University of
various font metrics (metapolator),                              numerous sites on three continents,      Westminster (Harrow). Anyone
and OSP continues their pioneering                               using Blender to create animations.      interested in open source graphics
work on font creation, usage, and                                   We learned about glitch art,          is encouraged to attend.
publishing. A concerted effort has                               various ways to “mess up” image          www.libregraphicsmeeting.
begun to start the groundwork                                    files for interesting effects – things   org/2015



                                                            www.linuxvoice.com                                                               17
     59 BEST LINUX DISTROS 2015




                       DISTROS
                    BEST



                                                                                                             2015
                     The Linux Voice team selects the cream of the Linux crop
                         for 2015 – there’s something here for everybody.


           W
                        e don’t need much of an excuse to start          Installing and playing with all these distributions
                        playing with lots of different Linux          has also reminded us about just how much has
                        distributions. It’s one of the best ways of   changed. Many distributions are now offering rolling
           spending a wet afternoon, especially if you’ve been        releases, for instance, where you don’t have to go
           using the same clutch of distributions for a while.        through a monumental system upgrade just to get
           Trying something different opens up all kinds of new       the latest version of Firefox. And there are now more
           perspectives on the software we all use and love,          desktop environments than ever before, with some
           and that’s why we’ve put so many together here.            distributions remaining the ideal choice for users of
              We’ve forgone any ranking of the distributions,         one desktop or another.
           instead focusing on a selection we find fascinating           We often joke about the vast number of
           and worthy of your consideration, from distributions       distributions there are. When you look at the
           that take up less                                                                        huge list curated by
           space than an email                                                                      DistroWatch.com, you
           attachment to one      “We’ve focused on a selection                                     can’t help but wonder
           that’s helping
           decode the secrets
                                  we find fascinating and worthy                                    why so many have been
                                                                                                    created, especially when
           of the universe.       of your consideration.”                                           the effort involved in their
              Considering the                                                                       creation is so huge. But if
           vast majority are built around the same software, the      there’s one thing we’ve learnt by installing and using
           breadth of Linux (and a few non-Linux) distributions       such a huge number for this issue, it’s that they each
           you can download and try is staggering, and there’s        have a job to do, and each distribution we’ve chosen
           always something new to discover. Each distribution        does its job brilliantly. If you ever wanted proof for
           is like an evolutionary branch, even if it leads to a      the success of Linux and open source, we’d argue it
           dead end.                                                  is its sheer diversity.



18                                                       www.linuxvoice.com
                                                                                                        59 BEST LINUX DISTROS 2015




1
Ubuntu 15.04
Ubuntu is a perfect place for us start our
epic dive into the world of distributions
because this is the one that’s done more
than most to make Linux accessible, easy to
use and friendly. It pioneered installation
from a live CD or DVD, and would even ship
these out for free if you simply asked. In a
recent post on insights.ubuntu.com,
Canonical has also stated that Ubuntu now
has more than 25 million users, making it
the distribution most people are likely to
have heard the most about.
The latest version of Ubuntu is codenamed
‘Vivid Vervet’ – a ververt being a kind of
monkey. The word ‘vivid’ could also be a
reference to the latest colour scheme,
because Ubuntu is definitely getting less
brown and more saturated purple with each         With the new version of Unity, you can now place menus within an application’s title bar.
release. Prince in his Purple Rain phase
would be very pleased with the new                hard to see. As you’d expect, all the main              helped give Linux Mint so much momentum,
backdrop, and we like it too.                     applications have been updated, and the                 and it’s great to see the work the team has
   There isn’t a huge amount of difference        Unity interface has a few tweaks. It runs well          done, as well as the acknowledgement that
in this release compared to either 14.10          and we’re getting used to it, especially after          some people just prefer the old desktop
or 14.06; it feels more like a staging            using the Ubuntu Phone for a while now                  metaphor, being recognised and supported
environment for the migration to the                                                                      by the original distribution.
Systemd boot system. Everyday users don’t         Spin-off flavours                                         The question of whether it’s worth
need to know about this, and won’t see any        Of course, alongside the main distribution              the upgrade or not has more to do with
operational changes, but for the engineering      there’s also the officially recognised Ubuntu           support than new features. And with the
teams, there’s a huge amount of effort            spins. Kubuntu is one of our favourite KDE              non-LTS releases getting only nine months
involved migrating from the old system to         distributions, for example, and 15.04 is the            of updates, we’d suggest holding back on
the new, and 15.04 is proof that the team         first release of the newly ordained Ubuntu              upgrading unless you enjoy experimenting
has done a good job. We experienced               Mate. Mate is the continuation of Gnome 2,              with new features and getting the latest
no problems on our installation, and the          prior to the huge user-interface changes that           applications. But as an indication of where




                                                                                      4                                               5
distribution upgrade even worked. Other           came in with both Gnome 3 and Unity, as                 Ubuntu is headed, this is still a great distro.
than the background, visible differences are      used in modern versions of Ubuntu. It’s what            www.ubuntu.com




2
NIXOS 14.12                                                                                               SOLYDXK 201501
This is a fascinating distribution built around
                                                    LINUX MINT 17.1                                       There are probably more Debian-derived
                                                    The most successful offshoot of Ubuntu, Mint
its own package manager that uses a                                                                       distributions in this feature than any other,
                                                    at times rivals its progenitor for popularity and
declarative language to satisfy the desired         influence. Despite early versions defaulting          especially if you include Mint and Ubuntu.
configuration. Packages are then installed          to KDE, it was Ubuntu’s gamble on dumping             Solyd’s (the X or K above is for Xfce or KDE)
into their own isolated sandbox, making it          Gnome 2.x for its own Unity desktop that gave         killer feature is that it’s a rolling release
ideal as an alternative to containers on a          Mint its biggest boost, and both the Cinnamon         distro. You install once and simply upgrade
                                                    and Mate desktops offered and co-developed
server. The downloadable VirtualBox image                                                                 to get the latest packages. It accomplishes
                                                    by Mint are still the best reasons for using it.
made testing much easier for us, before                                                                   this brilliantly, making it an easy alternative




                          3
                                                    In our opinion, they’ve even helped smooth the




                                                                                                                              6
deciding on a fully fledged installation.           acceptance of the rather revolutionary Gnome          to something more technical, such as Arch.
http://nixos.org                                    3.x by providing a well-supported alternative         http://solydxk.com
                                                    to the older version while the Gnome team got
SCIENTIFIC LINUX 7.1                                their act together.
                                                       Mint installs easily and complements
                                                                                                          KNOPPIX 7.5
Produced by the Fermi National Accelerator          Ubuntu’s packages with its own apps and               Revolutionary from the beginning, Knoppix
Laboratory, Scientific is (like CentOS) built       design, and it also runs well on older hardware.      was one of the first distributions to run in a
from the sources of Red Hat Enterprise              Support comes from an excellent community             live environment directly off a USB stick or
Linux, which are only available as binaries         and the distribution is well funded, which            CD/DVD. It used to default to a KDE desktop,
                                                    means you can rely on a Mint installation
with a subscription from Red Hat. This                                                                    but the move to LXDE was a sensible one, as
                                                    providing a straightforward productive desktop
makes it incredibly stable, scalable and            environment that’s going to last. It would be         it runs much better from slow media. The
adaptable. It’s used by many science labs           unfair to describe it as the Windows XP of Linux,     latest release is excellent, but you’ll need to
around the world and is also a good choice          especially as XP is no longer supported, but it’s     wait for a distribution exclusivity agreement
for austere office environments and servers.        close. The Debian edition is also worth a try.        to expire before being able to download it.
                                                    www.linuxmint.com
www.scientificlinux.org                                                                                   www.knoppix.org



                                                               www.linuxvoice.com                                                                      19
     59 BEST LINUX DISTROS 2015




7
Arch Linux
We’re big fans of Arch here at Linux Voice
but it’s not for everybody. For a start, in an
era where distributions are often installed
with one or two clicks of the mouse,
installing Arch needs time and patience.
You’ll need to read the installation guide
carefully (or take a look at our own guide in
                                                                                                     CRUNCHBANG PLUS PLUS 1.0


                                                                                                                                      8
                                                                                                     CrunchBang, the name for the # and ! symbols
                                                                                                     you typically find at the beginning of a script,
                                                                                                     was a hugely popular Debian-based distribution.
                                                                                                     It didn’t need much in the way of system
                                                                                                     resources, and its minimal Openbox desktop
                                                                                                     attracted many users who wanted function over
                                                                                                     form. But when its creator, Philip Newborough,
                                                                                                     decided to call it a day, we all thought
our very first issue) and adapt the
                                                                                                     CrunchBang’s days were over.
installation for your own hardware. It’s not                                                             Amazingly, CrunchBang’s ethos has been
difficult but it requires a different kind of    Arch is one of the only distributions that has      preserved, with new developers and a new
mental approach, and the same could be           the latest and greatest KDE 5 packages.             version of Debian from which to draw packages.
said for running and maintaining the system                                                          After negotiating the standard Debian installer,
                                                                                                     version 1.0 looks fabulously minimal, from the
after you get it installed.                         If you like building and modifying, the
                                                                                                     login screen to the desktop; everything looks
   There are several huge advantages to          source and build trees that can be created          like a shinier version of the command line. Many
explain why you might want to do this.           are also very powerful, enabling you to             things can be launched with a simple keyboard
The first is that you’ll learn a lot about       automagically handle dependencies and               shortcut with everything else though a right-
how Linux works. Just connecting to the          patch only specific files.                          click of your mouse. And because this release
                                                                                                     is built on the latest Debian, CrunchBang is now
internet, for example, will teach you about         Finally, the quality of the documentation
                                                                                                     bang up to date with all the latest packages,
your hardware, the kernel drivers and            is unparalleled, whether it’s explaining how        making it perfect for power users who want a
the commands needed to configure and             to get networking working or the differences        quick installation and a desktop with minimal
connect them. It’s the same for installing a     between the various audio layers. This is           distraction or interference.
graphical environment or building your own       a huge part of the project but it requires          https://crunchbangplusplus.org
packages. And you’ll be left with a system       some skill to find the pieces relevant to your
fine-tuned to your exact requirements, which     installation and requirements, as well as




                                                                                                  9
means the typical Arch installation will         navigating the occasional contradictions or       CHAKRA 2015.03 “EULER”
occupy less space and boot faster.               out of date material.                             This is a great KDE distribution that’s low on
   Another huge advantage is that Arch is           Every upgrade needs preparation,               system resources and provides one of the
a rolling release distribution. Packages are     which means Arch needs some serious               easier ways of staying on top of KDE 5
constantly updated and can be constantly         commitment. But get past the relative             development through a specific repository.
upgraded. Even hourly, if you so choose. You     complexity and labour of running an Arch          Another great feature is that while the
often need to proceed with caution, but it       installation and we feel you have one of the      foundation packages are updated only every
makes Arch the best distribution for cutting-    best distributions available, whether that’s      six months, other packages for many
edge releases and upgrades. The package          on a Raspberry Pi or the latest PC hardware.      applications are updated quickly, making




                                                                                                                                10
manager is also very powerful, enabling you      If all this sounds too complex, there are         this a great half-rolling release distro.
to roll back and forward through your locally    some easier-to-maintain alternatives, such        http://chakraos.org
cached downloads, and the user repository        as Manjaro or KaOS. These can offer many
of unofficial packages has the largest           of the advantages without the install and         PORTEUS 3.1
breadth of choice we’ve seen, with even the      update hassle. But for purists like us, nothing   Because Porteus is a minimal, fast booting




                   11                                                12
most esoteric of projects getting a relatively   quite beats the real thing.                       live distro, we love the way you select what
painless installation package.                   www.archlinux.org                                 you want before you even download, from
                                                                                                   EFI to desktop. You then get a personalised
STEAMOS                                          PCLINUXOS 12-18-2014                              image. Our no-frills LXQt build was just
Valve’s reputation is mythical. It’s a games     As old Mandrake users, will still remember        150MB and booted to a fully functional
company that has not only created some of        Texstar’s brilliant set of KDE packages that      desktop within just 12 seconds, making it
the best games ever made, but also the           transformed the appearance and                    our go-to distribution when we need
games platform at the heart of PC gaming.        capabilities of that old distribution. And it     something quick and clickable.
When Valve announced it was moving to            was these packages that led to the creation       www.porteus.org
Linux, bringing its games, APIs and gaming       of PCLinuxOS over 10 years ago. The
partners with it, there was a huge wave of       package manager may have changed, and             ANDROID X86 4.4-R2
expectation. SteamOS is its Linux distro,        its old muse has fallen on hard times, but        Why include a Linux ‘distribution’ developed
created to deliver seamless integration          PCLinuxOS is still a distribution with the        by Google to run on smartphones? It runs
between your PC, your games and the              same emphasis on a great-looking desktop.         surprisingly well and is useful even without a
community. It’s perfect on a powerful box           There’s now a choice between KDE, Mate         touchscreen (although this does help).
tucked beneath your TV, and is now relatively    and LXDE, all of which feature similar styling    Android’s full-screen apps and streamlined
easy to install. It streams games from other     and all the packages you’ll ever need. KDE 5      task switching makes it a great option for
machines, and can be augmented with              has yet to make an appearance, which we’re        distraction free working, and if you get
standard Debian repositories. We can’t wait      surprised at considering the distro’s heritage,   Google Play working, there are many
for commercial boxes to appear.                  but it will be a great upgrade when it does.      different apps you can install and play with.
http://store.steampowered.com/steamos            www.pclinuxos.com                                 www.android-x86.org



20                                                           www.linuxvoice.com
                                                                                                            59 BEST LINUX DISTROS 2015




14                                                                             16 17
OPENELEC 5.08                                                                                                 PUPPY TAHRPUP 6.0 CE
This is a distribution with only one job – to
                                                     FEDORA 22 WORKSTATION                                    Despite being based on Ubuntu 14.04,
                                                     Fedora should need no introduction. It’s
run the Kodi media centre, and it does this                                                                   Puppy is so tiny it should even fit on a
                                                     a candidate for being one of the most fun
job perfectly. It’s ideal if you want to turn        distributions to try, mainly thanks to the               256MB USB drive. 256MB is not a typo
your low-end box or Raspberry Pi into a              cutting-edge nature of many of its packages.             – with that you get a fully functional
movie, music and photos powerhouse, and              It also does a brilliant job of remaining true to        desktop, a startup wizard and barking
its minimal install and automatic updates            the projects it packages, meaning the Gnome              samples. There are many apps including
                                                     experience is very close to what the Gnome
means you can stick it onto your computer                                                                     AbiWord and the Pale Moon browser, based
                                                     team see themselves, with the exception of the
and forget about it. If you need some help,                                                                   on Firefox. If you ever need a desktop on a




                           15
                                                     traditional change in background. By the time
see our comprehensive guide in issue 12.             you read this, Fedora 22 should be released,             USB stick, this should always be in your bag.
http://openelec.tv                                   but at the time of writing, we could only play           http://puppylinux.org
                                                     with early-May beta version. This included




                                                                                                                                         18
SYSTEMRESCUE CD                                      the latest Gnome 3.16 and the new kernel,                DAMN SMALL LINUX 4.11RC2
                                                     as well as Fedora’s updated fork of the Yum
Sooner or later, something is going to go            package manager, DNF. DNF should feel almost             If you think Puppy’s 256MB footprint is
wrong with your Linux installation, and you’ll       identical to Yum, but there’s a lot going on in the      small, wait until you try this – a full Linux
need a distro with lots of tools to get you out      background, including a much more efficient              environment from 50MB. Sadly, DSL hasn’t
of trouble. Ubuntu is a good option, but             approach to dependency resolution.                       been updated since 2012, but it still
                                                         DNF has been available for some time, but
SystemRescueCD is our favourite. We’ve                                                                        deserves a place here simply because of its
                                                     this is going to be the first release where it’s the
used this after deleting files by mistake, and       default tool for package management, and we              size and functionality; MP3 playback, web
even repartitioning the wrong drive. It’s quick      experienced no issues with the beta. If you’ve           browsing, SSH, email and text editing. It’s
to download, fits on almost any USB key.             yet to try Fedora, version 22 is shaping up to be        not pretty, but what do you expect for a
(435MB) and is crammed full of hope.                 a great update.                                          distro smaller than the PDF version of this
                                                     https://getfedora.org
www.sysresccd.org                                                                                             magazine? www.damnsmalllinux.org

Elementary OS Freya



19
Elementary is an Ubuntu LTS (14.04) based
distribution that’s trying to do things a little
differently. This is obvious when you take a
look at its home page, as it proudly lays
down the gauntlet by stating it’s “A fast and
open replacement for Windows and OS X.”
There’s only a single mention of Linux on
this page, and that’s in the small paragraph
headed “Safe & Secure.”
   The team has also courted controversy
recently. To get to the SourceForge hosted
download link, you need to navigate through
a payment box that defaults to $25. If you
want the download link without paying
anything, you need to escape this box,
choose ‘Custom’ and enter $0 manually.
This is a process the developers originally
described as ‘cheating’ in a part of a blog        Freya looks beautiful, runs well on older hardware and offers access to Ubuntu’s repositories.
post now deleted.
   One of the reasons for this is that             same applications loaded faster and were                   appearance for email, and the terminal
Elementary OS is attempting to be a                slightly more responsive.                                  emulator is one of our favourites. Everything
commercial success, using paid developers                                                                     about Freya is easy.
to create a custom desktop environment             Custom applications                                           Thanks to its Ubuntu heritage, installation
and user interface, complete with its own          Applications themselves are launched from                  is a breeze. You can connect to your
modified window manager and desktop                a simple panel that hides itself at the bottom             wireless network and download updates,
interface. This desktop is definitely one of       of the screen. The top panel is equally                    and Freya detected our Mint installation with
the best reasons to install Elementary OS          unobtrusive, defaulting to transparency and                a warning about not overwriting it. Package
because it looks beautiful. And unlike the         showing just the time, status icons and                    repositories are also Ubuntu’s, giving plenty
good looks that come with something like           the applications launch menu. It all looks                 of choice for software and PPAs. Freya is
KDE, appearances in Elementary are mostly          fantastic and is very easy to use.                         a seriously strong contender for non-Linux
good design choices rather than eye candy.           OS X migrants in particular are going                    users and Linux users with an appreciation
   We installed the latest release on a low        to feel at home with the grey window                       for aesthetics – if you’re prepared to forgive
powered (Atom-based) Samsung NC-10                 decoration, settings panels and task                       the developers for their occasional lack of
netbook and performance was better than            switcher. The choice of applications is also               tact in getting people to pay for their work.
running Mint on the same machine. The              good, with Geary making a well deserved                    https://elementary.io



                                                                 www.linuxvoice.com                                                                      21
     59 BEST LINUX DISTROS 2015

CentOS



20
CentOS, or the Community Enterprise
Operating System, is a distribution built on
the code to Red Hat Enterprise Linux
(RHEL). That means it’s just as secure and
reliable as RHEL, and also gets updates for
10 years, but unlike RHEL, CentOS is
available for free. This combination of
features means it’s ideal for servers for any
organisations that don’t need the level of
support that Red Hat offers. In fact, we trust
CentOS so much, it’s the distro we use for
our Linux Voice servers. We’re not alone in
this. According to w3techs.com, CentOS is
the third most popular Linux distro for web
servers (after Debian and Ubuntu) and 20%
of all Linux webservers run CentOS.
   The only real differences between CentOS
and RHEL is in the branding (the Centos              CentOS 7 comes with a Gnome 3 desktop that’s been customised to the Gnome 2 style.
team have to remove all trademarks before
they recompile the source of RHEL and                   Originally, the CentOS project ran entirely          processors as well (both 32-bit and 64-bit),
release the binaries). The two distros behave        separately from Red Hat. However, in                    but at the time of writing, there were no
the same in almost all technical areas, so           January 2014, CentOS announced that it                  official version for this architecture.
CentOS is also an excellent choice for any           was joining Red Hat (although it will still                While CentOS is often seen as a server OS,
aspiring sysadmin. This compatibility also           remain separate from RHEL). This should                 it can also be used as a desktop. The long,
means that almost all Linux server software          mean that updates continue to come in a                 slow release cycle means that you won’t
is supported on, and packaged for, CentOS.           timely manner, and it guarantees that the               have the latest software (including drivers
Whether you’re running the latest-and-               project will continue and not wind up leaving           for newer hardware), but once it’s installed,
greatest open source code, or some closed-           CentOS installs unsupported.                            you don’t need to worry about upgrading
source proprietary server, you can guarantee                                                                 the distro for a long time. Leaving a desktop
that if it runs on Linux servers, there’ll be        Enterprise features – for free!                         operating system installed for over five years
a version for RHEL and Centos. The Extra             The most recent version (7) only supports               might seem anathema for most geeks, but
Packages For Enterprise Linux (EPEL)                 64-bit x86 processors, but anyone still                 for ordinary desktop users, this isn’t unusual.
repositories that are provided by the Fedora         running 32-bit servers can continue to run              We wouldn’t recommend CentOS for




                                                                                                                                       24
project to provide additional software for           CentOS 6, as support will continue until                everyone, but it certainly has a place.




                                                                            23
RHEL are compatible with CentOS.                     2020. There are plans to support ARM                    www.centos.org




21
TINY CORE                                                                                                    YGGDRASIL
Tiny Core’s special feature isn’t just that it’s
                                                       BODHI                                                 Between 1992 and 1995 Yggdrasil was one
                                                       Bodhi Linux is a distro for the Enlightenment
really small, it’s that it’s small enough to run                                                             of the most popular Linux distros, but there
                                                       desktop. Or at least it was until 28 April 2015,
entirely from memory. This means that the              when the developers decided to switch to              hasn’t been a release in 20 years. Back then,
entire OS is loaded into RAM at boot time,             the Moksha desktop. This isn’t really much            Linux was a bit rougher around the edges,
and the result is a blazingly fast system.             of a change, as Moksha is a fork of the E17           and supported less hardware, but the brave
Even on a slow computer, Tiny Core can                 Enlightenment desktop. Moksha is born out of          soles who ran Yggdrasil despite its many
                                                       a frustration with a deterioration in the stability
start in just a few seconds, and applications                                                                limitations, fixing bugs as they came up
                                                       in more recent version of the Enlightenment
open almost instantly. By keeping things                                                                     against them, are the pioneers of the Linux




                       22
                                                       desktop, so it aims to go back to simpler, more




                                                                                                                                 25
really simple, Tiny Core speeds up old PCs.            stable times and provide users with what they         systems we have today.
http://distro.ibiblio.org/tinycorelinux                really want: a desktop that looks incredibly          No website
                                                       pretty and that just works.
                                                           The great feature of Enlightenment (and we
CLONEZILLA
                                                       hope Moksha) is that it provides a good-looking
                                                                                                             KAOS
Clonezilla only does two things: it makes              interface without overly taxing the CPU. The          Linux is about choice, right? Not according
clone images of hard drives; and it re-images          amount of eye candy Bodhi manages to pack in          to this distro. The Kaos developers have
hard drives. It may seem strange to build an           while barely taxing the CPU is truly impressive,      selected what they view as the best
entire distro just to do this, but that’s              especially on older computers that struggle           applications available for each task and only
                                                       to run KDE with any form of effects enabled.
because to work with hard drives at this                                                                     packaged them. For example, KDE is the
                                                       It goes to show that clever coding, not more
level, they have to be unmounted. By running           graphical processing power, is the best way to        only desktop. This means that the
as a live distro, Clonezilla allows its tools full     get a great desktop experience. While other           repositories contain much less software
access to the hardware. It’s a great example           distros have Enlightenment in their libraries,        than most distros, but it’s all the best of its
of how the flexibility of Linux pays off.              Bodhi is built specially for it.                      type, leading to a very focused distro.
                                                       www.bodhilinux.com
http://clonezilla.org                                                                                        http://kaosx.us



22                                                                www.linuxvoice.com
                    26 27
                                                                                                   59 BEST LINUX DISTROS 2015


  CYANOGENMOD
                                                     Raspbian
                                                     Most Linux distros are designed to run on a
  Android is the most popular Linux distribution,    variety of computers, but not Raspbian: this
  but like all popular Linux distributions, it
                                                     distro is carefully crafted for just one device,
  has derivatives. The best known of these is
  CyanogenMod. This is built from the source         the Raspberry Pi. Actually, that’s five devices
  code from the Android Open Source Project          (the Raspberry Pi models A, B, A+, B+ and
  (AOSP), which contains the code to the core        version 2 model B), but they all share a lot of
  of Android. Not everything in the commercial       common hardware. Some other
  version of Android is in the AOSP; many of the
                                                     manufacturers have managed to persuade
  default apps such as the mail reader and the
  camera are proprietary, so new versions of         Raspbian to run on their hardware, but the
  these have been written for CyanogenMod, and       distro is so closely tied to the Raspberry Pi
  in most cases they’re more powerful than the       that this is never going to be a good idea.        The LXDE desktop in Raspbian is simple, easy
  default Android ones.                                 By focussing on just a single hardware          to use and runs well on low-powered hardware.
     There are community builds of CyanogeMod
                                                     platform, the distro can take full advantage
  for a huge variety of devices (see http://wiki.
  cyanogenmod.org/w/Devices for details). There      of it. Since the Pi has, by modern standards,      languages). This is particularly appealing to
  is often support for more recent version of        quite a low-power processor, Raspbian is           children starting programming.
  Android than the device manufacturers provide,     adept at squeezing as much power out
  so it can be a great way of getting the latest-    of it as possible, and runs more efficiently       Another child of Debian
  and-greatest features on older phones. It’s also
                                                     than most distros. It contains drivers for         Raspbian also comes with a special build
  a good way of getting a version of Android that
  doesn’t have all of Google’s services syphoning    the VideoCore graphics processor; much             of Wolfram’s Mathematica (a mathematical
  off data for their advertising engine (although    of the software contains platform-specific         programming system). This is widely used
  you can install Google services if you wish).      optimisations; and the repositories contain        in schools because of its ease of use, and
  www.cyanogenmod.org                                utilities for controlling the GPIO pins.           the amount of data included as well as




                  28
                                                        Raspbian’s web browser is a perfect             mathematical functions.
                                                     example of how targeting just a single                 The Raspberry Pi Foundation continue
ROSA                                                 hardware platform benefits the distro.             to push more optimisations into Raspbian,
Rosa is developed by the Russian company             Raspbian comes with a fork of the Epiphany         so more recent versions run faster than
Rosa Labs as a cutting-edge KDE                      browser (aka Gnome Web) that’s been                older ones even when running on the same
distribution. Its best feature is that it has a      modified run far better on the Raspberry           hardware. Raspbian isn’t built from scratch.
really good-looking desktop right out of the         Pi’s unique hardware. This means it is             As the name suggests, it’s based on Debian,
box, including a large number of                     optimised for ARM v6 and v7 processors,            so as well as all the additional Raspberry Pi
customisations to the default KDE look. It’s a       while also offloading graphical processing to      software, there’s also the full set of Debian
great option if you like the idea of KDE, but        the VideoCore. The result is a far nicer web       software. You should find whatever you
struggle to find a setup that you like.              experience than you should really expect           need in the repositories.




                         29
www.rosalab.com                                      given the rather limited hardware.                     There are other distros available for the
                                                        The Raspberry Pi is designed for                Raspberry Pi, but for most users, most of
                                                     education, and Raspbian comes with                 the time, Raspbian is the best option. In fact,
CORE OS                                              some software that’s custom-made for               it’s so good, it’s arguably the best reason to
The future of the data centre is in containers       this. There’s a special Raspberry Pi build         choose the Raspberry Pi over other small




                                                                          31                                                        32
– at least, it is if you believe the hype. Core      of Minecraft that enables users to interact        ARM-based computers.
OS is a distro built from the ground up for          with the world through Python (and other           www.raspbian.org
this new world of Docker (or Docker-like)
applications running in isolation from each          TAILS                                              TRISQUEL
other (see the tutorial on Docker on page            We’re being spied on. Our internet providers       Most distros include some non-free
96). CoreOS is designed to run in large              are keeping detailed records of what               software, often for device drivers or media
groups of containers all intercommunicating          websites we visit. Our governments are             players. Trisquel is different. It includes only




                  30
to make the cloud run smoothly.                      monitoring who we’re contacting.                   100% free software, and doesn’t have any
https://coreos.com                                   Advertising companies know more about us           non-free repositories. This does mean it
                                                     than our closest friends. It’s time to fight       works with less hardware than other distros,
OPEN MEDIA VAULT                                     back. Tails is a distro built around Tor to        but you’re fully in control of your computer.
A Network Attached Storage unit (NAS) is a           make it easy to browse the web without             http://trisquel.info
device that you plug into your house’s               being tracked. We like to keep a copy of the
network, sharing some hard disk space with           latest Tails ISO in a virtual machine when we      ZORIN OS
all the other computers that are connected.          want a private web browsing session.               Zorin is a distro built to ease the journey into
This makes it easy to back up and share                 Tails includes software for encryption          Linux from Windows. It focuses on providing
files between all the computers in the               and private instant messaging, so it’s got         a familiar interface so that new users aren’t
building. Open Media Vault (OMV) is a distro         a full suite of privacy tools to keep any          put off, and using the Zorin Look Changer
that converts a regular PC into a NAS with           communications secure. Download Tails              application, you can customise the distro to
an easy-to-use web interface.                        and protect yourself from prying eyes.             match different versions of Windows.
www.openmediavault.org                               https://tails.boum.org                             http://zorin-os.com



                                                                 www.linuxvoice.com                                                                  23
     59 BEST LINUX DISTROS 2015




34
Kali
Computer security is possibly one of the
most important issues facing the digital
world. Governments are attacking each
other; companies are attacking each other;
and bands of digital bandits are attacking
regular web users. If you work in computing
in any way, it’s important that you
                                                                                                     MIKE OS

                                                                                                                                 35
                                                                                                     There are many reasons to create an operating
                                                                                                     system: a desire for freedom, a belief that you
                                                                                                     can do it better than the existing options, and
                                                                                                     as a hobby. MikeOS was created to demonstrate
                                                                                                     the usage of x86 assembly language. The
                                                                                                     standout feature of MikeOS isn’t any technical
                                                                                                     aspect, or a flashy user interface, but the
                                                                                                     fact that the source code is clear and well
understand the issues in computer security,
                                                                                                     commented.
and to do that, you need a distro built for IT                                                          Linux Voice’s Mike Saunders created Mike
security professionals. That distro is Kali                                                          OS. You may have read his series on assembly
Linux. Kali’s main function is to help            Kali Linux provides everything a penetration       programming (continued in this issue), where he
penetration testers – the people who try to       tester may need in a live-booting distro.          goes through the techniques he used to develop
                                                                                                     Mike OS. If you have, and you want to learn
break into an organisation’s computer
                                                                                                     more about how to program on bare metal, then
systems in order check the defences.              view because they’re small enough to be            MikeOS is the best place to start.
   Kali includes the Metasploit Framework         hidden inside an office and will run for a            As operating systems go, MikeOS is quite
(which we looked at last issue) for attacking     considerable amount of time on battery             limited: there’s a text editor, and a few other
servers, the Social Engineer’s Toolkit (SET)      power alone. Using Kali in this way enables        utilities, but not much in the way of general
                                                                                                     productivity software. Mike tells us that
for attacking personnel, tools for making         penetration testers to make devices that
                                                                                                     networking is possible, but it’s not easy. In other
malicious hardware, and dozens of other           will capture information about wireless            words, don’t install it and expect it to replace
pieces of security software, all set up           traffic, or attempt to break in from inside        a general purpose OS (even Mike uses a Linux
and ready to go. Most useful tools come           a building with no one physically present.         distro for most of his work).
installed by default, so you just need to         There have even been some projects that            http://mikeos.sourceforge.net
browse the menus to find the best tool for        have performed penetration tests by putting
the job and you’re ready to start attacking.      these small computers inside remote




                                                                                                  36
In fact, browsing the menus of Kali is a great    control planes, and launching them from          MINIX
way of seeing all the open source security        a distance.                                      Originally, Minix was a purely academic
tools that are available.                            Kali also runs on mobile devices such         distro created by Andrew Tanenbaum to
                                                  as tablets and Chromebooks. These give           help teach students about OS kernel design.
Industry standard                                 attackers the power of a full pen testing        However, in recent versions (starting with
Since it’s so widely used, most books and         environment while maintaining the                Minix 3 in 2005) the aim has shifted to
other resources on penetration testing            appearance of performing some mundane            creating a real-world OS. The main
use Kali (or BackTrack as it used to be           task. After all, who would suspect that          advantage of Minix over other Unix Kernels
known) in their examples, so it’s the easiest     someone tapping away at a tablet has             is that it’s designed using the microkernel,
penetration testing distro to get started with.   access to a range of sophisticated pen           model which should, theoretically, lead to a
   There are builds of Kali for quite a lot of    testing tools?                                   far more stable and self-healing OS.
different platforms, including small ARM-            Kali Linux is a distro that every security-      The code is now available under the
based computers such as the Raspberry             minded Linux user should try out – if only so    BSD licence, and version 3.3 (released in
Pi, the Odroid U2 and the Beaglebone              they can see the range of tools available to     september 2014) came with support for the




                   37 38                                                                                                        39
Black. These small devices are particularly       attackers                                        ARM architecture as well as x86.
interesting from an attacker’s point of           www.kali.org                                     www.minix3.org

OPENINDIANA                                       GNU HURD                                         SABAYON
OpenIndiana is a distribution of Illumos,         When GNU first launched its project to           If you like the idea of Gentoo, but don’t want
which is itself a fork of Open Solaris. This      re-implement UNIX in the 80s, it needed a        to install everything from scratch, Sabayon
means it’s a Unix OS that’s from a separate       kernel. At this point the Linux kernel didn’t    is for you. It sticks close to the bleeding edge
lineage to Linux and the BSDs. Perhaps the        yet exist and the BSD kernels were legally       of software development, but also tries to be
two best reasons for using OpenIndiana            uncertain, so GNU set out on a new project:      stable. The team pride themselves on how
(aside from academic interest) are that it’s      Hurd. It’s taken a long time to become           good the distro looks out-of-the-box, so just
Solaris that gave us the ZFS filesystem and       useable, but version 0.6 (released in April      install and go.




                                                                                                                                40
Solaris Jails (a sandboxing environment).         2015) brought in more stability.                 www.sabayon.org
Other free Unixes are catching up in this            Hurd isn’t the kernel itself, but a set of
area now, but Solaris and derivatives were        servers and protocols that sit on top of the     DEEPIN
for a long time significantly more advanced       Mach microkernel. This microkernel model         Deepin isn’t well known in the English-
than their cousins. All these technical           is often cited as the cause for delays in the    speaking world, but it’s popular in China. As
differences aren’t immediately apparent as        kernel’s release, since it has led to more       well as a customised desktop, it features the
OpenIndiana boots up to a Gnome 2                 complexity than the monolithic architecture      Deepin Software Centre, which enables users
environment that will be familiar to many         of Linux. However, you can now try the Hurd      to rate and comment software. Most of the
Linux users, so it’s easy to get started.         in a port of Debian.                             comments are written in Chinese.
http://openindiana.org                            www.gnu.org/software/hurd                        http://planet.linuxdeepin.com



24                                                            www.linuxvoice.com
                                                                                                            59 BEST LINUX DISTROS 2015




41
Debian GNU/Linux
Virtually everyone has heard of Debian, and
most Linux users have tried it at least once,
but what makes it so successful? It’s not
backed by a big company, it’s rarely the
starting point for new Linux users, and it
lacks the snazz and pizazz that many other
distributions have.
    Well, we’d say this: Debian is the closest
thing we have to a “standard” among
distributions. It’s one of the longest-
running distros out there, it’s incredibly well
respected, and along with CentOS it’s the
go-to distro when you want to put Linux on a
box and then forget about it for the next five
years – updates included.
    Debian is conservative and slow moving,
but you know that it has been extremely
                                                    Some Debian developers have welcomed the switch to Systemd. Others fear a total-control 1984-
well tested and won’t break with the next           like scenario, engineered by Red Hat. (Image credit: http://blog.desdelinux.net).
round of updates. A Debian release will
stay the same across its lifespan; patches          kFreeBSD (the Debian and GNU userland                       Now imagine such a scenario happens
are provided to plug security holes and             combined with the FreeBSD kernel). Many                   again, with a much bigger company trying
fix critical (ie data-loss) bugs, but you           pundits have criticised Debian for putting                to assert ownership of Linux, or even have
won’t have to deal with software versions           time and effort into these niche projects, but            Linux declared as a copyright-infringing
changing under your feet.                           we think they’re important.                               work. This is very unlikely, but crazier things
    Debian also prides itself on being a                                                                      have been known to happen…
“universal” operating system. In other words,       Freedom is strength                                         If the Linux kernel somehow gets tangled
it’s designed for everyone, and not just            Sure, very few people are going to use                    up in these legal wranglings, and they
a niche of users. This manifests itself in          Debian GNU/Hurd or the FreeBSD variant.                   take years to sort out, thanks to the other
multiple ways: Debian puts great effort into        But consider the IBM vs SCO lawsuit back in               Debian offerings we’ll still be able to enjoy
supporting users with disabilities, so that         the 2000s, when the latter company insisted               the benefits of a free operating system. The
people with vision problems, for instance,          that proprietary Unix code had somehow                    FreeBSD kernel is very well regarded, and
can still install it. Similarly, Debian has goals   found its way into the Linux source tree. SCO             combined with the GNU userland you have
beyond merely providing a Linux distro, and         effectively tried to own Linux and get users              an extremely impressive OS. Bring on more




                                                                              43                                                          44
tries to be a framework for other operating         to pay licence fees. Those were bad times,                projects like that, we say!
system projects, such as Debian GNU/                but IBM came out on top.                                  www.debian.org




42
MANJARO                                                                                                       HAIKU
Many Arch fans claim that the distro is easy
                                                      GENTOO                                                  This isn’t Linux-based, but it’s a project with
                                                      Back in the early 2000s, Gentoo was the
to install, thanks to its extensive and superb                                                                bags of potential nonetheless. Haiku is an
                                                      absolute darling of power users – and for good
documentation, and there’s some truth in              reason. It was immensely configurable, as               open source reimplementation of BeOS, a
that. But you still need a good grounding in          you were encouraged to build everything from            desktop OS that gained mild popularity in
Linux and related technologies, and if you            scratch. You could change CFLAGS to compile             the late 90s. BeOS was strikingly fast and
just want to set up a box with a rolling              packages with specific optimisations for your           multimedia-friendly back in the day, and
                                                      CPU, and you could enable or disable custom
release distro in 10 minutes, the process is                                                                  while Haiku is still undergoing heavy
                                                      features for your setup. On top of this, it was
somewhat long-winded.                                 one of the earliest rolling-release distros: you        development, it could prove to be a great




                                                                                                                                  45
   Manjaro is one of many Arch forks that             got new software as it came down the pipeline           lightweight OS one day.
aim to preserve the best aspects of the               from upstream developers, instead of waiting            www.haiku-os.org
distro, but make them more accessible                 for another big distro upgrade in six months.
                                                         So what happened? Why isn’t Gentoo
to new and intermediate Linux users. So
                                                      dominating today? Well, a big chunk of its
                                                                                                              DEVUAN
Manjaro has a graphical installer, hardware           userbase moved over to Arch Linux. While                Debian’s switch to Systemd wasn’t received
detection tools, and other features that              playing around with CFLAGS was fun, many of             well by the whole distro community. A few
simplify and accelerate the process of                the optimisations made very little difference,          disgruntled developers left the Debian
getting the distro installed.                         and the most passionate Gentooers were                  project to start Devuan, a distro for “init
                                                      mocked as “ricers” – in other words, the Linux
   Although Manjaro hasn’t hit version 1.0                                                                    freedom lovers”. Whether this will turn out to
                                                      equivalent of car modders who add go-faster
yet, it’s already a very polished and usable          stripes. Still, Gentoo lives on and is one of the       be a serious project – or just a knee-jerk
linux distribution, and well worth a try if           few distros that hasn’t adopted Systemd by              reaction that leads to nothing – remains to
you’re tempted by Arch Linux but want                 default, so we’re sure it’ll be around for a while.     be seen, but there has certainly been plenty
something easier.                                     www.gentoo.org                                          of chatter on the mailing lists.
https://manjaro.github.io                                                                                     https://devuan.org



                                                                  www.linuxvoice.com                                                                       25
     59 BEST LINUX DISTROS 2015




46                                                                          48 49
ELIVE                                                                                                   ORACLE LINUX
Before the KDE and Gnome dektop
                                                    LXLE                                                Ask database giant Oracle what the best OS
                                                    Talk about standing on the shoulders of giants.
environments took off in the late 90s,                                                                  is for running its products, and you’ll be told:
                                                    LXLE is based on Lubuntu, which is based on
Enlightenment was the top-tier window               Ubuntu, which is based on Debian. It might          Solaris, of course! But Oracle has had to
manager in Linux, with impressive effects           seem crazy to have so many spin-offs in the         accept that its proprietary Unix isn’t the
such as window translucency and gorgeous            distro world, and we’d agree that some distros      be-all and end-all on servers, and many
themes. Enlightenment is still going today,         offer little more than wallpaper changes, but       people want to run Oracle’s DB on Linux. So
                                                    LXLE is well worth looking at. The developers
and Elive uses it on top of a Debian base to                                                            the company forked Red Hat Enterprise
                                                    have put great effort into a consistent theme
create a distro that’s good looking, featureful                                                         Linux (see opposite page) and added kernel




  47
                                                    and layout for the LXDE desktop, while the
and relatively low on system requirements.          default app selection has been carefully chosen.    tweaks to handle huge workloads.
www.elivecd.org                                        Most importantly, LXLE is great for reviving     www.oracle.com/linux
                                                    older machines that have limited RAM: it will run




                                                                                                                                     50
                                                    pretty well in just 512MB. So if you have an old
PEPPERMINT OS
                                                    netbook lying around doing nothing especially
                                                                                                        FREEBSD
Chromebooks are increasingly popular                useful, pop LXLE on it and bring it back to life.   It’s not Linux, but it’s a free and open source
among non-technical users, offering a               Or if you know someone still running XP on an       Unixy operating system – very much like
stripped-down operating system that                 older box, you could install LXLE for them and      Linux. In FreeBSD, the whole operating
provides most of its functionality via web          bring them up to date. There are plenty of other    system is developed inside a single source
                                                    lightweight distros out there, but LXLE is one
apps. Peppermint does a similar job as a                                                                code tree, in contrast to Linux where the
                                                    of the most polished we’ve come across, and
“web centric operating system”, except you          as it’s based on the LTS releases of Lubuntu        kernel, C library and base utilities are from
don’t have to submit to Google’s giant data         (for long term support), you know it will receive   separate projects. FreeBSD sees plenty of
collection machine. It’s based on Ubuntu’s          security patches for many years to come.            use on servers, and it’s fairly good on the
Long Term Support releases.                         www.lxle.net                                        desktop with the right hardware.
www.peppermintos.com                                                                                    www.freebsd.org

MAGEIA



51
Mah-jee-a? Ma-gay-a? Mah-gaia? There’s no
official way to pronounce this distro’s name,
which we regard as something of a
marketing fail, but we’ll let that minor
grumble pass. Mageia is one of the most
prominent forks in Linux distro history, and
unlike many projects, it didn’t just happen
because of a squabble between developers.
   No, Mageia came about from necessity.
In the 2000s, one of the most popular
distributions among new users was
Mandriva, formerly known as Mandrake
Linux. This was a long-running distro
originally based on Red Hat Linux, and
was noted for its slick desktop, excellent
hardware detection and newbie-friendly
Windows Control Panel-esque setup
tool. Also, it was one of the few distros to      Mageia’s Control Center is a one-stop shop for all things system configuration.
offer snazzy boxed sets with CDs, printed
manuals and customer support.                     specific theming, and the development                 forks happen in the free software world, and
   We were big fans of Mandriva back in           team has done a good job pumping out                  often for good reason, but is it ever possible
the day, but unfortunately the company            regular releases over the last few years. In          for two projects to merge?
wrestled with financial problems for many         a fascinating turn of events, the Mandriva              We asked the Mageia team about this at
years and ended up laying off most of             company, which still exists (albeit in a much         the FOSDEM conference in February, and
its distro developers. A bunch of them            smaller form than in the past), is now using          yes, there had been talks in the past about
wanted to carry on with their work, however,      chunks of Mageia in its own Business Server           merging the projects, but today their goals
and Mageia was formed. Initially, many            product. Who knows – maybe the projects               are increasingly diverging. Mageia is largely
observers suspected that the Mageia project       could join together again one day...                  focused on being the spiritual successor to
would go nowhere, but time has proven                                                                   Mandriva, targeting new and intermediate
them wrong and it’s a very fine distro today.     Mandriva lives on!                                    desktop users, while OpenMandriva is doing
   Like its predecessor, Mageia excels with       There’s another spin-off of Mandriva called,          much more experimental work by switching
its Mageia Control Center configuration tool      innovatively enough, OpenMandriva. Initially          to the LLVM/Clang compiler and targeting
and novice-friendly installer. Users can          the goals of that distro and Mageia were so           ARM devices. Don’t expect a merge any time
choose between KDE, Gnome and Xfce                well aligned that it seemed crazy to have             soon, but both projects are doing great work.
desktops, all of which are given Mageia-          two distros doing exactly the same job. Sure,         www.mageia.org



26                                                             www.linuxvoice.com
                                                                                                   59 BEST LINUX DISTROS 2015


ANTERGOS


                   52
“Your Linux, always fresh, never frozen.”
That’s the motto for Antergos, and reflects
that it’s a rolling-release distro based on Arch
Linux. But unlike Arch, it tries hard to attract
new and intermedite Linux users, with an
attrative website and polished desktop
environment configurations. Antergos has
                                                      OpenSUSE

                                                                           53
                                                      If you were using Linux in the late 90s and
                                                      early 2000s, you may recall the chunky
                                                      boxed sets you could buy from various
                                                      distro vendors, containing CDs/DVDs, books,
                                                      stickers and other goodies. OpenSUSE
                                                      (known back then as just SUSE) was the
                                                      best distro in this respect: you’d get a shiny
its own installer, Cnchi, and could be a big          card wallet jammed with discs containing




                          54
player over the next few years.                       thousands of packages, along with three
http://antergos.com                                   thick manuals teaching you everything you
                                                      needed to know about the OS. Getting one          OpenSUSE is still available in boxed set form –
NETRUNNER                                             of these boxed sets through the door was          at least, for the German market.
There are a million and one KDE-based                 bliss, especially if you had only a dialup
distros out there, but Netrunner                      modem connection.                                 tools work together, but we can see the
distinguishes itself by actively supporting              OpenSUSE is one of the longest running         attraction in Yast. Whenever you need to do
KDE with financial help – a rarity in Free            distros, coming to life in Germany in 1992        some kind of administration work on your
Software. There are two flavours of                   as “Software und System Entwicklung”              installation, you know exactly where to start.
Netrunner: one is based on Kubuntu and has            (software and systems development), and
regular six-monthly releases, while the other         originally based on Slackware. The SUSE           Roll your own
is based on Arch and is therefore a rolling-          company grew quickly, establishing itself         Another ace that OpenSUSE has up its




                   55
release distro.                                       as the main competitor to Red Hat, and            sleeve is its Open Build Service. This is
www.netrunner.com                                     was eventually bought by Novell in 2003           an online resource where developers
                                                      for a cool $210m. Novell itself was later         can upload code and build packages for
AROS                                                  snapped up by The Attachmate Group, and           OpenSUSE and other distributions including
We have to include this here (even though             today SUSE operates as a subsidiary, selling      Fedora and Debian, without having to
it’s not based on the Linux kernel), just             enterprise Linux solutions to big business.       install the distros and the (often rather
because we still get misty-eyed when                     Amongst hobbyists, however, the                complicated) set of build tools manually. It’s
thinking about the Amiga. Yes, this is an             OpenSUSE distro is still going strong.            great to see the OpenSUSE team playing
open source implementation of AmigaOS,                Its flagship feature is Yast (Yet another         such an active role in distro cross-pollination
running on modern PCs. It’s lacking a lot of          Setup Tool), a graphical and command              efforts – and making life easier for app
hardware support compared to Linux, but it’s          line program which handles virtually every        developers who want to package up their




                   56
impressive and brings back great memories             aspect of system administration. While            work for as many distros as possible.
of the glory days of Workbench.                       most distros have a disparate bundle of              Along with the regular release versions
http://aros.sf.net                                    tools for handling such things as user            of OpenSUSE, there’s also a “tumbleweed”
                                                      management, startup services, package             flavour that’s a rolling release, much like Arch
                                                      installation and so forth, Yast provides all      Linux. It’s not guaranteed to be as stable as
  SLACKWARE                                           of these facilities – and much more – from        the well-tested releases, but it’s great if you
  Slackware is the oldest Linux distribution that’s   the same place. Yes, some would argue             want to live on the bleeding edge and get the




                                                                                                                                 58
  still running, and is largely the project of one




                                                                          57
                                                      that such a large, monolithic program goes        latest and greatest applications.
  man: Pat Volkerding. This might seem like an
  impossible feat given the huge teams behind         against the philosophy of Unix, where small       www.opensuse.org
  Debian, Fedora and other big-name distros,
  but Slackware is very simple under the hood.        RED HAT ENTERPRISE LINUX                          SLITAZ
  Its packages are tarballs with some metadata,       Here’s a distro that gets relatively little       Desktop Linux in just 35MB – is that even
  its boot scripts are short and BSD-like, and
                                                      coverage in Linux Voice, as we tend to focus      possible? With SliTaz, yes. You get a very
  the whole distro has an air of simplicity and
  elegance that makes it a joy to work with. It’s     on home users and tinkerers, but it’s the         trimmed-down GUI with a handful of apps
  not easy going for newbies, but because it          biggest flavour of Linux in the corporate         such as the Midori web browser, and it all
  doesn’t make big changes to upstream code,          world. Red Hat Enterprise Linux (RHEL) is         runs in RAM at lightning speed. It’s great to
  you get a very vanilla Linux experience without     based on work done in the Fedora project,         carry on a USB key and boot up on someone




                                                                                                                                 59
  distro-specific “features” causing trouble.
                                                      and comes with support contracts that can         else’s PC to show Linux’s awesomeness.
     Indeed, one of the favourite sayings among
  users of this distro is: “With Red Hat you learn    cost a bunch of bucks.                            www.slitaz.org
  Red Hat. With Ubuntu you learn Ubuntu. But              But why pay for Linux when you can get
  with Slackware, you learn Linux.” Slackware         it for free? Well, with RHEL you know there’s     LINUX FROM SCRATCH
  fans are noted for their eclectic taste in humour   someone on the phone to fix any problems          So those are 58 distros – and now it’s time
  (see the Church of the Subgenius) and general
                                                      you may come across. Businesses need              to create your own to add to the pantheon!
  apathy towards converting others. Have you
  ever seen a foaming Slacker trying to win over      this, or at least someone they can point the      Linux From Scratch is a guide and repository
  users on an internet forum? Of course not –         finger at. Red Hat Enterprise Linux gets 10       of source code, explaining in detail how to
  that simply ain’t the Slackware way.                years of support as well, so while costly, it’s   install Linux by hand, piece by piece. Give
  www.slackware.com                                   a sound investment.                               it a go – you learn a lot…
                                                      www.redhat.com                                    www.linuxfromscratch.org



                                                                  www.linuxvoice.com                                                                27
     FEATURE LINUX ON FILM




                                                                     LINUX ON


               Graham Morrison spends a week on YouTube to discover the
               ghostly corners where Linux has appeared on the big screen.


          B
                   ack in the late 1980s, I worked in what used to   closer to the theatrical release, which made videos
                   be known as a ‘Video Shop’, or a ‘Video Rental    feel rather exclusive for those who may have missed
                   Store’. This was a real, physical place you       the cinema release.
          could visit by walking down your High Street, or by
          taking a short drive to your local strip mall, and         Stars of screen and stage
          entering an actual door. These places would let you        For those of us into computers, conversations around
          browse and borrow the latest films for a single night,     video often surround the depiction of computers on
          usually for around £2.99, with a discount for a second     the screen. This being the late 80s/early 90s, there
          title on Sunday. You’d be handed the film and              were an increasing number of films about and
          expected to return it the following morning, either by     featuring computers, and it was also obvious that
          going back to the shop or by slotting it through an        computers and the way they were portrayed in film
          appropriately sized hole in                                                                was becoming a
          the door.                                                                                  reflection of how
              We issued fines for      “Some computers, such as IBM’s                                computers were
          people who didn’t rewind
          their films (they were all
                                       AN/FSQ-7, bridged decades with                                perceived and how that
                                                                                                     perception was
          on bulky VHS cassettes),     its on-screen menace.”                                        changing. A couple of
          or were late, or who failed                                                                decades before, that
          to collect a reserved title.                                                               meant a background of
              Despite a salary that barely covered Thursday’s        vacuum tubes and blinking lights, or a room full of
          night’s Pernod and black, this was one of the three        clinical white hardware. HAL in Stanley Kubrik’s 1969’s
          coolest jobs in town (the other two being similar          science fiction classic 2001, for example, was
          positions at the other video rental stores in Ashby-       famously authoritarian and represented a scary
          de-la-Zouch). You could watch whatever you wanted,         dystopia for the new machines taking over payroll and
          usually as soon as it was released, and spend quiet        banking. Some computers, such as IBM’s AN/
          days drinking tea and watching child-friendly titles       FSQ-7, bridged decades with its menace – from
          on the in-store screen; Labyrinth, Short Circuit, The      Fantastic Voyage in 1966 to Dr Evil’s
          Neverending Story, Indiana Jones, Twins... I can still
          remember the rental number attached to the spine of
                                                                     submarine lair 2002’s Austin Powers.
                                                                        But the microcomputer changed                 MAY
          each case. It was a time before the pressure of online
          piracy brought the consumer releases of films far
                                                                     all that with its increasing
                                                                     affordability. 1983’s War Games , for
                                                                                                                    CONTAIN
                                                                                                                   SPOILERS!
28                                                       www.linuxvoice.com
                                                                                                       LINUX ON FILM FEATURE

instance, bridged the gap between the old menace          to generate the scenes and animation, to the user-
of technology and the rise of this new subculture.        interfaces behind the custom software for studios
Its virtual protagonist was WOPR, a pseudo-               that would rather not mention it.
intelligent computer system designed to predict war
strategies while having a Telnet connection to the        Fame at last
nuclear button. Mutually assured destruction was          There are lots of brief appearances on screen though.
a simulation away. But its depiction of Matthew           It’s seen in 2010’s film about the creation of Facebook,
Broderick’s hacker, using an IMSAI 8080 to dial into      The Social Network, for example, and even features in
random computers, is relatively accurate and more         the official trailer (skip to 1:04). The character based
representative of what other crackers were doing. This    on Mark Zuckerberg uses KDE 3 pimped out with the
focus on what the population were doing with their        Keramic theme to browse the internet. And Linus
new computers was the beginning of a new age.             Torvalds was rumoured to have bumped up the kernel

                                                                                                                                  MIITT
    The early microcomputers, there was no choice         version to 4 in preparation for meeting the exact
of operating system: you got whatever came with           version number, 4.1.15-1.1381_SKYN12nnmp, spotted
                                                                                                                              ADD
                                                                                                                              A NEM
                                                                                                                                OONE
your Apple II, Commodore Amiga or Macintosh. But          running on the T-800 in the film Terminator: Salvation.
by the 90s, that the operating system was becoming        Plus there’s been plenty of mentions on geek-centric
a choice, and a choice that filmmakers could use          TV, in particular “They even had Gnome 2.0 the day
within their films. Windows, for example, was often       Warty Warthog came out.” on Veronica Mars, and
the backdrop for business, whereas Mac OS was             Sheldon Cooper in The Big Bang Theory: “Oh Ubuntu,
seen with designers. Linux and UNIX, when they            you are my favourite Linux-based operating system.”
appeared, were for geeks. And its appearance over             We’re going to take a look at some of our favourite
the years says something about how Linux and open         Linux-appearances, but to set the scene, we’re going
source has been viewed by outsiders and how it’s          to choose a film where it doesn’t. Before Linux could
finally being represented as a technology core to their   become usable, the operating system it was based
use and development. This is partly because many          upon – UNIX – was already being associated with
people are now aware of what Linux does and what          the geeky side of computers, preparing the stage for
it is, but it’s also because Linux and open source has    a time when Linux itself could make an entry. And
for a long time been used in film production itself,      its most mention has become both a meme and a
from 3D modelling and the complex calculations used       subreddit, and it comes from the biggest film of 1993.




Jurassic Park (1993)
Surely everyone knows the plot to this blockbuster,       rendering quality typical in the early 90s. What’s
based on a novel by Michael Crichton. The film itself     unusual is that while it’s easy to scoff at this 3D
is set on a fictional island called Isla Nublar where a   representation of a filesystem and accessing
bioengineering company has created a unique theme         locations in this way, the tool they’re using was real
park. Instead of roller coasters and over salted fries    and contemporary to the SGI machine being used
next to expensive drink stands, this theme park is        in the movie.
inhabited by a variety of genetically cloned dinosaurs
built from DNA extracted from ancient mosquitoes          The velociraptors are coming!
caught in amber. What could possibly go wrong? Of         The tool was called File System Navigator,
course, it all goes wrong and the dinosaurs begin to      abbreviated to fsn, and was developed by
rampage, spoiling the trip for a number of actors.        Silicon Graphics as a proof of concept. What’s
   The clip we’re after appears towards the end of the    particularly awesome is that there was a port of
film, where one of the young people in the surviving      this to Linux and an updated version of that port
group recognises the computer sitting in the room         that still compiles today. It’s called 3D File System
by saying, “It’s a UNIX system, I know it.” She’s then    Visualizer, or fsv, and the latest version is fsv2 (see
able to awkwardly use the mouse to navigate a 3D          http://fedorchenko.net/fsv2.php). We needed
map of the filesystem, switching to a Motif-like GUI      to build the executable from the source code
that displays the local area in 2D and allows the locks   and because of its age, we needed to add -lGLU
to be activated, saving the group moments before          to the next but last build step, but otherwise,
                                                                                                                        A version of the 3D
an extra wearing claw gloves can get into the room.       it’s still fully functional. You can’t quite lock the doors   filesystem viewer used in
The machine itself is a Silicon Graphics Crimson,         with it, but fsv2 still does a good job of showing you        Jurassic Park can be built
and befitting a system with the best graphics of the      which folders have the most files and presenting your         and installed on a modern
time, the 3D rendering on the screen has that lovely      filesystem in a nicely drawn OpenGL window.                   Linux system.



                                                            www.linuxvoice.com                                                                  29
     FEATURE LINUX ON FILM


                                Antitrust (2001)
                                 Antitrust is a big-budget film with a ridiculous          people actually used, and seeing those scenes now is
                                 script, hammed-up acting and a plot that                  quite nostalgic if you happen to remember the Gnome
                                 combines pre-dot-com bubble startup culture               of the day. Also, in our opinion, the film has its faults
                                 with a Microsoft-gone-bad alike corporation and a         but it’s also quite good fun to watch, especially after
                                 megalomaniac CEO.                                         all this time. Microsoft is no longer using the same
                                    Unlike the majority of films, where Linux is           strategies it did 15 years ago and the world of big data
                                  but a brief screenshot and a prop for a hacker’s         and governmental snooping makes our old worries
                                  credentials, however, the story manages to portray       about corporate monopoly seem rather quaint. (Also,
                                  some understanding of what open source is                Mr Veitch, if you’re reading this. I’ve still got the copy
                                  about, even squeezing in a few cameos from               you lent me almost 10 years ago along with your copy
                                  prominent open source figures of the timesuch            of Dark Star).
                                  as Miguel de Icaza (next to Sun’s Scott McNealy
                                  no less). Open source was also talked up as
                                   part of the pre-release marketing, perhaps in an
                                   attempt to generate interest within the Linux
                                   communities.
                                      The film also has plenty of Linux screen
                                   action, and as you might expect from a film
                                   showing Miguel set in a period where the Eazel
Perhaps the most                   company was raising millions of dollars to help
remarkable thing about        develop Gnome’s file manager, Nautilus, this screen
Antitrust is that it’s        action mostly shows Gnome. What’s great about
directed by Peter Howitt      the depiction in Antitrust though isn’t that it’s being
who mid-life UK readers       used to lend credibility, but because it’s actually what
will know as Joey Boswell     the people depicted in the movie would use to work
in 80s sitcom, Bread.         on the ideas they worked on. It’s the desktop those




The Matrix Reloaded (2003)
Like many of the films here, The Matrix is likely to need    she wants to access is running SSH on port
little introduction. A total of three films were made,       22, the default port for SSH. Trinity then runs
and the impact the first had in both its visual style (the   a fictitious exploit called ‘sshnuke’ against the
ultra-slow bullet time), and its mind bending narrative      server, presumably setting the root password
has been seen in countless films since. Written and          ‘Z10N0101’ as this is the value she passes in
directed by the Wachowski Brothers, the first film           the argument. This exploit then outputs that
eventually became part of a trilogy that explored our        it’s successful taking advantage of ‘SSHv1
influence over the nature                                                                   CRC32’ before
of reality while a war                                                                      enabling Trinity
rages between the tiny      “What we see has all the                                        to issue a normal
percentage of humans
who escape slavery
                            hallmarks of Linux with a tiling                                SSH command to
                                                                                            access the root
and their machine-like      or minimal window manager.”                                     account of the
controllers.                                                                                server.
    Linux makes an entry around two thirds of the                Nearly everything covered in this brief
way through the second film in the trilogy, The Matrix       sequence is very close to being realistic. And
Reloaded. Trinity, played by Carrie-Anne Moss, needs         while the operating system could feasibly
to break into a supercomputer, and she does so by            be something like Mac OS X, which was
using an old-school green phosphor terminal. The             released a year or two earlier, what we see
display you see on the film shows the results of a           has all the hallmarks of Linux with a tiling or minimal     Could the password, Zion,
command you don’t see her type, but the output is            window manager. The display could even have been            followed by the binary
what you’d get from the network portscanner nmap.            constructed using a text interface such as curses on        value for 5 be a coded
This output includes the discovery that the server           the command line, for instance.                             message?



30                                                             www.linuxvoice.com
                                                                                                       LINUX ON FILM FEATURE


Tron: Legacy (2010)
The first Tron film was made in 1982 and with it,           and operating system being used. For the film,
Disney become one of the first studios to successfully      this is SolarOS 4.0.1, which probably a reference
blend live action with computer-generated graphics.         to Solaris, hinted at with the sun4m kernel running
The scene in which Jeff Bridges races his Light Cycle       surprisingly in 32-bits (i386), also seen in the
across the neon vector wasteland is burned into our         output from iostat running in another terminal.
collective memories. Tron also had a compelling plot,          Sam then uses some neat Bash skills by typing
involving a malevolent computer system going out            bin/history. This isn’t perfect, but the output
of control and a brilliant soundtrack by synth pioneer      is the slowed-down output of the real history
Wendy Carlos. The film’s slow burning success led to        command, which will list all your previously logged
an eventual sequel in 2010,                                                                  commands. Those
Tron: Legacy.
   The sequel isn’t as
                             “The sequel to Tron isn’t as                                    displayed on screen
                                                                                             include vi ~/last_
good, but it does feature    good as the original, but it                                    will_and_testament.
our favourite operating
system, in a clip where
                             does feature our favourite OS.”                                 txt, ps -a -x -u for
                                                                                             listing processes
Sam, the son of the                                                                          and the utterly
protagonist in the the original film, uncovers his          feasible kill -9 2207. Sam then manually types
father’s large touchscreen computer. He removes dust        the output from the final command output in the
from the screen with his hand to reveal a relatively        history, the implication being this was the last
monochrome X11 environment. In the film, there are          thing his father typed on the computer.                      This may not have been
a few windows open, including a terminal showing a             The only thing we could have improved from a              a real theme at the time
process list thanks to the top command, and another         Linux point of view – and this would admittedly look         the movie was made,
terminal that the protagonist types in using the on-        less cool on screen – is that Sam could have done the        but you can now get the
screen keyboard. His interaction with the terminal is       same thing much more quickly by typing ! followed            Tron Legacy look on both
relatively realistic, first typing whoami to return the     by the number of the command he needed from the              Gnome and KDE.
name of his father, and uname -a to return the kernel       history output.




                               Citizenfour (2014)
                                Citizenfour is a vital documentary that follows               Linux and open source in Citizenfour is the only
                                 Edward Snowden in the days up to and                      trusted method for sending this information, and for
                                 immediately following his whistleblowing on the           that reason, this is the best film with which leave the
                                  activities of the NSA and the extent of its global       story arc of this feature. From the fiction of a dinosaur
                                  surveillance. It’s filmed in Hong Kong before he         theme park to the reality of governmental data
                                  fled to Russia and before he knew what the world’s       collection and spying, the portrayal of UNIX/Linux
                                  response would be to what he reveals.                    has come a long way. And now that open source has
                                     The big difference in Citizenfour, of course, is      effectively won in the world of development, mobile
                                   that while nearly every other film uses Linux,          and servers, it much more likely to be realistically
                                   UNIX or the command line to imbibe the viewer           portrayed in the future.
                                   with a sense of computing literacy, in Citizenfour
                                   Ed Snowden is simply using Linux and open
                                   source for real. It’s not a set up. It’s not there to
                                    add pseudo credibility. It’s there because it’s the
                                    best tool for the job. He uses it for GPG email
                                    encryption when contacting the film’s director,
                                    Laura Poitras, and he uses the Tails distribution
                                    to connect to the Tor network. There’s also plenty
                                    of Rsync action on screen – used to transfer
While the other films are           an archive securely, and SSH is mentioned as
primarily entertainment,     an alternative method in an email. We even see how
Citizenfour uses Linux to    difficult it is trying to tutor Guardian journalist, Glen
make a very serious point.   Grenwald, into how to use all this technology.



                                                              www.linuxvoice.com                                                                 31
     LINUX FOR NEWBIES




New to Linux? Or want to convert your
friends and colleagues? Our guide has
everything you need to know.


L
        inux Voice is unashamedly a geeky magazine.
        We don’t shy away from advanced topics such
        as assembly programming and kernel hacking.
But we were all beginners once, so this month we’ve
decided to help newbies get into Linux with a special
guide. If you’ve never used Linux before but want to
dip your toes into its glistening waters, we’ll
get you started over the next six pages. Or
if you’re a regular Linux Voice reader who
already knows his or her way around the
operating system, cut out this guide and
give it to friends, family and colleagues
                                                                                                              Creative
– or make photocopies and convert                                                                            Commons
                                                                                                             licensed:
everyone you know!
   Before we get started, though, what
exactly is Linux? Where did it come                                                                      photocopy this guide
from? Well, Linux is an operating system,                                                                and spread the love!
much like Windows and Mac OS X. It runs on your
computer, acting as a middleman between your
hardware and your applications. It manages your
computer’s memory, helps different programs to run       operating system that totally dominates
together, and has drivers for your hardware.             smartphones and tablets.
   Linux has many strengths, such as security and          What we call “Linux” today is the work of
performance, as we’ll see in a moment. It runs its own   multiple projects that have been running since the
software, although it                                                                  1980s, all of which have
can also run a selection
of Windows programs.
                              “Linux is a secure, reliable                             worked together to
                                                                                       create a free, open and
Linux is great as a         desktop operating system, and                              shareable computing
secure and reliable
desktop operating
                             it also powers the internet.”                             platform. The GNU
                                                                                       project played a huge
system, but it also                                                                    role in this, which is why
powers the internet: Google runs Linux on tens of        you sometimes see Linux referred to as GNU/Linux,
thousands of servers, for instance. And you might        and today the operating system has hundreds of
not know it, but Linux forms the basis of Android, the   thousands of developers around the globe.



32                                                         www.linuxvoice.com
                                                                                                             LINUX FOR NEWBIES


Why use Linux?
The four big reasons why you should make the switch.
1   It’s free
Linux is free (as in zero-cost). That’s right, you don’t
have to pay a penny to use it. But how on earth is
such a large body of software completely free – who
pays for its development?
   Much of the work on Linux is done by volunteers
around the world, working over the internet. But an
increasing number of contributions come from large
companies such as IBM, Intel, Red Hat and Canonical.
They don’t make money from selling the operating
system itself, but they generate revenue by offering
support contracts, services, documentation etc.
   So if you just want to use Linux on your home
computers, you can download and use it for free.
If you want to deploy it across 5,000 PCs in an
enterprise, and need someone on the end of the
phone who will fix any potential problems, you can
pay IBM, Red Hat or other companies to provide
support. Many volunteer Linux developers and
projects also raise money via donations or selling
merchandise such as T-shirts and mugs.

2   It’s open and secure
This is hugely important. Linux is open source, which
                                                                                                                       While many Linux
means anyone can study its inner workings. You can          working on its codebase, bugs are found very quickly,      developers are volunteers,
download the source code (the original human-               and because it’s open source, anyone can fix a bug.        the system is also backed
readable recipe) of Linux, change it, and recompile it to   Even if you’re not a programmer yourself, you can pay      by some of the biggest
run on your computer. Now, few people have the              someone to fix an issue or add a feature you need.         companies in IT.
technical nous to do this, but it’s essential               With Microsoft? Good luck, unless you have tens of
nonetheless: you have full control over your computer.      thousands of pounds to wave around…
      With Windows, Mac OS X or iOS, you can never             A properly set up Linux system simply won’t crash
        be sure what the software is doing – you can’t      unless something is wrong with your hardware. We
         get the source code, and you can’t fix it          know people who’ve been running Linux servers
         yourself. It’s like buying a car with the bonnet   for several years without a single reboot. Linux is
        welded shut.                                        designed in such a way that its various components
     With Linux, anyone can look inside and improve         are well isolated from one another, so if there’s an
it. The knowledge encapsulated in its millions of           issue with one part of the operating system (such as
lines of source code is there for the whole world to        the graphical user interface), the rest of it carries on
benefit from. And because its code is in the open,          chugging away.
it’s almost impossible for government agencies or
other nefarious types to sneak in back-doors or other       4   It’s compatible
ways to monitor you. With many thousands of people          Linux may be a different operating system to
studying new code as it’s added to Linux, security          Windows and Mac OS, and doesn’t run all of the same
holes are usually spotted very quickly. Who knows           programs, but it’s the most compatible OS in
what’s lurking inside Windows and Mac OS? You               existence. You can open your Microsoft Office
can’t find out. In short: with Windows and Mac OS           documents in LibreOffice, you can play all your videos
X, someone else is in charge of your computer. With         and music in the VLC media player, and there are Linux
Linux, you have total control.                              equivalents for pretty much every application in the
                                                            Windows and Mac OS worlds – we’ll explore the best
3   It’s reliable                                           software later on. Whereas paid-for software often
Linux is well known for its reliability and general         tries to lock you in to closed file formats, Linux
crash-proofness. Its overall design is based on that of     applications respect that we all like freedom of
Unix, a family of operating systems that goes back to       choice. And Linux happily co-exists with Windows or
the 1970s, so it’s built on mature and well-established     Mac OS X, so you can have both on your computer
foundations. With developers all over the world             and choose when you power it on.



                                                                www.linuxvoice.com                                                            33
     LINUX FOR NEWBIES


Which distribution?
Linux comes in many flavours – here are the biggest names.
Because the Linux source code is free and         There are hundreds of distributions out        distributions are geared towards new users,
open for everyone to share, anyone can also       there, some made by big companies and          others for servers and software
package it together and make their own            some made by small groups of volunteers,       development workstations – everyone has
“distribution” (aka “distro”), which is an        but they’re all Linux at the core and          their favourite. Here are the main ones you
installable version of the operating system.      compatible with each other. Some               need to know about.




Ubuntu www.ubuntu.com                             Fedora www.getfedora.org                       OpenSUSE www.opensuse.org
This is by far the best-known distribution,       This is from Red Hat, the makers of Red Hat    Developed in Germany, OpenSUSE is one of
and is a great all-round operating system.        Enterprise Linux, a distribution focused on    the longest-running Linux distributions,
Ubuntu is primarily geared towards                servers and business usage. Fedora is a        having started life in the mid 90s. It’s popular
desktops and laptops, although it’s making        community-supported distribution known         among intermediate Linux users, sporting
gains on tablets and phones as well. With         for incorporating cutting-edge technologies,   an excellent configuration tool called Yast
Ubuntu, you can get a modern, shiny and           and makes new releases every six months.       that lets you tweak all aspects of your
well-tested version of Linux on your PC           Like Ubuntu, Fedora focuses on having an       system from within a single program. Great
within just a few mouse clicks.                   attractive and versatile interface.            for control freaks.




Debian www.debian.org                             Arch Linux www.archlinux.org                   Linux Mint www.linuxmint.com
Debian is released rather slowly (once every      Arch can be complicated to install but it      Mint is based on Ubuntu, but provides a
two years), but is well known for its stability   teaches you a huge amount about how            different interface and set of default
and is therefore used on tens of millions of      Linux works under the hood. Arch Linux is a    software. It’s popular among new users and
servers around the world. Debian is               rolling release distro, so instead of having   has a very helpful, supportive community.
compatible with many kinds of computer            big updates every six months like most         Various versions of Mint exist with different
hardware, and provides the basis for many         other distros, it’s constantly changing with   interfaces – the most popular at the
other distributions, such as Ubuntu.              the latest software.                           moment is the traditional Mate version.



So which one should I choose?
We’ll make this simple: Ubuntu. You’ll see        community on the web (eg www.askubuntu.        so we think it’s the best way to start. After a
people recommending other distributions as        com). The Ubuntu team puts a lot of effort     few months with Ubuntu, you’ll be confident
well, but Ubuntu is the best known, is very       into its interface and makes sure that the     enough in Linux to try other distributions and
polished, and has a huge supporting               operating system works well out of the box,    expand your horizons.



34                                                           www.linuxvoice.com
                                                                                                          LINUX FOR NEWBIES

    Install Linux! Follow our step-by-step guide and get Ubuntu onto your PC.
                        Requirements: 1GHz Intel/AMD CPU, 2GB RAM, 10GB drive space




1
    Download                                                             2
                                                                             Boot
Go to www.ubuntu.com/download/desktop and get the latest                 Boot your PC from the DVD-R or USB key; you normally need to
version (15.04 at the time of writing). You’ll download a .iso file,     press a key on your keyboard when your computer starts to do this,
which is a disc image that can be burned to a DVD-R using your           so consult your PC’s documentation to find out how. After a few
regular disc burning software. If you want to use a USB key to install   moments, Linux will run from the DVD and this screen will appear –
Linux, follow the instructions at http://tinyurl.com/ubuntukey.          click Install Ubuntu to begin the installation process.




3
    Settings                                                             4
                                                                             Partition
The Ubuntu installer will check that your machine has sufficient hard    Now choose where to install Linux on your PC’s hard drive. You can
drive space to install Linux. If you’re connected to the internet, you   install it alongside Windows, and have a menu when you start your
can download updates and extra drivers and media file codecs             PC to choose your operating system, or you can dedicate the whole
(recommended) during installation; click on the network icon in the      hard drive to it. Choose “Something else” if you’re experienced with
top-right to set up a Wi-Fi connection if necessary.                     partitioning and want full control of where the systems end up.




5
    User account                                                         6
                                                                             And you’re done!
Now the Linux files will be copied to your hard drive, and you’ll be     Once all the files have been copied over (depending on your PC, this
asked to set your location and keyboard layout. You will also be         can take a few minutes), the installer will prompt you to reboot the
prompted to set up a user account so that you can identify yourself      machine, so click on Restart Now and remove the DVD or USB key
to the operating system and log in – don’t forget your password! You     once the PC restarts. Then you can choose Ubuntu from the boot
can also choose to encrypt your personal files here.                     menu that appears, and turn over the page to start exploring.



                                                             www.linuxvoice.com                                                            35
     LINUX FOR NEWBIES


Explore Linux
Discover your new operating system and its included software.
Congratulations – you now have Linux                     directory is like My Documents in Windows             OS X. Firefox is arguably the best browser
installed! Log in with the username and                  – it’s where your personal files are stored. If       out there, combining good performance
password that you specified during the                   you insert a DVD or plug in a USB key, a              and thousands of extensions with excellent
installation, and the Unity desktop will                 window will pop up showing its contents,              privacy settings. And underneath Firefox
appear. You’ll notice that it looks quite                and on the left-hand panel of the file                you’ll see three icons for LibreOffice, opening
different to Windows and Mac OS X – but                  manager, you can also access resources on             the word processor, spreadsheet and
it’s also very easy to pick up.                          the network.                                          presentation tool respectively.
    To access your personal files, click the                Underneath the drawer button you’ll see              LibreOffice is the flagship office suite
drawer button underneath the Ubuntu                      an icon for Firefox, a web browser you’re             on Linux, and is tremendously capable,
button on the left-hand panel. Your “home”               probably familiar with from Windows or Mac            having seen decades of development in its


  Exploring the Ubuntu desktop

                                         4                                                                                       5
         1




         2                                                               3




        6




   1 Ubuntu button This is similar to the Start button   choose “Lock to Launcher” to keep it there after      5 System tray This is where you’ll find icons for

  in Windows. Click on it to browse included software    closing the app.                                     audio levels, power management and networking.
  (go to the Applications button at the bottom of the     3 Windows Click and drag the title bars to move     Click on the cog icon on the far right to log out or
  window after clicking it, and then Installed to see    them, and use the edges to resize them. The red      shut down the machine.
  what’s included by default). You can also type to      button on the top bar closes windows, while the       6 Settings Click this cog-and-spanner icon to open
  search and run programs.                               other buttons minimise and maximise respectively.    up the Systems Settings window, from which you
   2 Applications These buttons are shortcuts to          4 Menu bar Ubuntu has a global menu bar, like in    can configure your installation, manage your
  useful programs. When you start a new program, its     Mac OS X; when using an application, move your       hardware, and add new user accounts, if more than
  icon will appear on this bar; right-click it and       mouse pointer to the top bar to show menu entries.   one person will be using the PC.




36                                                                   www.linuxvoice.com
                                                                                                                    LINUX FOR NEWBIES

previous incarnations as OpenOffice and StarOffice.                                                                            LibreOffice is compatible
LibreOffice does a great job of opening Microsoft Office                                                                       with Microsoft’s suite,
documents – although there can be slight formatting                                                                            and has excellent word
issues with some very complicated documents. Still,                                                                            processing, spreadsheet
if you open an Office doc from one version of the suite                                                                        and presentation tools.
in a different version, you’ll likely experience the same
thing, so this is something even Microsoft gets wrong!
   For email, click on the Ubuntu button and search for
Thunderbird. This is an email client from the makers
of Firefox, and is mature and very stable. Other pre-
installed software worth exploring is Rhythmbox (a
music player), Empathy (for instant messaging) and
Shotwell (a photo manager). Of course, you’ll find
plenty of small tools such as a calculator and text
editor as well.                                                     for instance, while the Tab key auto-completes file
                                                                    or directory names. Say you have a directory called
Command line basics                                                 MyPhotosFrom2007, and you want to switch into
While it’s perfectly possible to use Linux without the              it with cd. Instead of having to type the full directory
command line, many advanced features and                            name, enter cd My and hit Tab – it will auto-complete
shortcuts are accessible through it. So it’s worth                  the directory so you can just hit Enter.
learning the basics, even if you spend 99% of your                     In guides and tutorials on the web (and in this
time doing things via the graphical user interface. In              magazine), you’ll often see commands beginning with
Ubuntu, you can open up a command line by clicking                  sudo. This performs the command as the “root” user,
the Ubuntu button and searching for Terminal. Click                 which is the administrator, so it should only be used
this, and a window with a prompt will appear.                       for commands that make important system changes.
    By default, this starts in your home directory (aka             After hitting Enter, you will be prompted to enter your
home folder), which as mentioned is akin to My                      password before the command is executed; in this
Documents on Windows. This is in                                    way, random pieces of software can’t change your
/home/<username>, where <username> is replaced                      operating system without your permission.
by the name you gave during the installation. Enter ls
(list files) to see files and directories (coloured in blue)        Where to go from here?
in the current directory. To switch into a directory, use           So, you have Linux installed, you’ve explored the
cd, eg cd Downloads. To switch back into the previous               desktop and supplied software, and you’ve learned the
directory, use cd ... (note the two full stops).                    command line basics. Good work: you’re now a Linux
    To get a detailed list of files, use ls -lh, while to           user! From here you’ll want to add more software (see
delete a file use rm filename (or rm -r dirname for                 the boxout) and become more proficient with your
a directory). You can copy files with cp file1 file2,               Linux skills. Of course, we recommend a subscription
and rename with mv oldname newname. To see the                      to Linux Voice for this, because every subscription
disk space usage in a directory, enter du -h, while the             includes access to all back issues in DRM-free digital
contents of text files can be read with less filename               (PDF and ePub) formats. So from just £38 you get a
(press Q to quit).                                                  mammoth compilation of over 1,500 pages of Linux
    The Linux command line has many shortcuts to                    tutorials and features – see http://shop.linuxvoice.
save you time. You can use the up and down cursor                   com. And if you need any help, pop by our forums at
keys to cycle through previously entered commands,                  http://forums.linuxvoice.com. Happy Linuxing!


  Adding more software
  Ubuntu comes pre-installed with many top-class applications, but thousands
  more are available too. Click on the Ubuntu button, type “software” and choose
  the Ubuntu Software Centre to explore programs available to download – most
  of them free and open source. You can browse categories down the left, and
  explore desktop productivity programs, multimedia apps, games, software
  development tools and much more.
      Some of our recommendations include Gimp (an image editor), Audacity (for
  editing audio files), OpenShot (a movie maker), VLC (a media player that handles
  virtually every format under the sun) and HomeBank (personal finance). If you’re
  looking for a specific type of program but can’t find something suitable, ask
  fellow Linux Voice readers on our forums at http://forums.linuxvoice.com!


  The Ubuntu Software Centre provides access to thousands of
  downloadable programs with just a few clicks.



                                                                       www.linuxvoice.com                                                              37
     SUBSCRIBE




SUBSCRIBE
                                                    UK READERS!
            Did you know that you can subscribe to Linux Voice from
            just £10 per quarter with Direct Debit? Get every issue
            straight to your mailbox (or inbox) and spread the costs!
                                                                                             What you get
                                                                                                116 pages each month
                                                                                             of the best tutorials,
                                                                                             features and interviews
                                                                                                Access to all back issues
                                                                                             in DRM-free digital formats -
                                                                                             over 1,500 pages
                                                                                               Take part in our yearly
                                                                                             profit donating scheme,
                                                                                             and help FOSS projects

                                                                                             Yearly Direct Debit prices
                                                                                             UK print subscription – £55
                                                                                             Digital subscription – £38

                                                                                             Quarterly Direct Debit prices
                                                                                             UK print subscription – £15
                                                                                             Digital subscription – £10

                                               Go here now to subscribe!
                        www.linuxvoice.com/shop
Payment is in Pounds Sterling. If you are dissatisfied in any way you can cancel your subscription at any time and receive a refund for all unmailed issues.

38                                                                www.linuxvoice.com
     FAQ ARDUINO




                Arduino
                   Discover one of the world’s simplest single-board computers.

                                           way of using them is to compile code         sound appalling by the standards of
BEN EVERARD                                on a separate computer and copy it           modern computers, but remember that
                                           directly into the flash memory. When         its main function is to monitor sensors
                                           the Microcontroller is powered on, it just   and control simple hardware. It’s more
       Ard-what? how do you even           executes the single program stored in        than powerful enough for most
       pronounce that?                     this memory.                                 projects.
       It’s Ard-WEE-no. The project got       Physical computing is computing              As well as the Uno, there are 20 other
       its name from the bar where the     that interacts with the real world in        official boards that all work in the same
founders used to meet, and the bar got     some way. For example, a physical            way, but are different sizes and have
its name from Arduino, Margrave of         computing system might use sensors           different configurations of pins, and
Ivrea and King of Italy (from 1002 to      to measure the environment, and then         different power processors. For
1014 AD).                                  respond by lighting up different things      example, there’s the Arduino Nano,
                                           depending on what readings it received.      which is much smaller than the Uno but
      Right, what is this Ard-WEE-            The Arduino project has created a         has fewer inputs and outputs; the
      no thing then?                       series of small boards that contain a        Arduino Due, which is larger and has
      Arduino is a project to make         microcontroller, and a large number of       more input and outputs a more
      microcontroller boards, to make      connectors to which you can add              powerful ARM processor; and the
physical computing more accessible.        sensors. Programs can be written in the      Arduino Lilypad which is designed to be
                                           Arduino IDE on another computer and          sewn into clothing.
        That answer just confused me       uploaded to the Arduinos via a USB
        more! What’s a microcontroller,    cable. Typically, Arduino programs run              I like the idea of physical
and what’s physical computing?             without prompting by the user and                   computing, but I don’t know
        A microcontroller is a chip that   without a keyboard or mouse (though          the first thing about electronics. Is
        contains a processor along with    sometimes buttons or joysticks are           there an easy way to get started?
some flash memory and RAM. Typically,      added to allow some user input).                    The headers on the Arduino allow
the processors in microcontrollers are                                                         specially designed add-on boards
far simpler than the sort of CPUs that            That sounds cool. What are            called shields to be plugged in. These
you find in regular computers, so don’t           these Arduino boards like?            enable you to add extra hardware to
have all the features necessary to run a          The most popular Arduino board        your Arduino with no electrical
fully fledged OS like Linux. The normal           is the Arduino Uno Revision 3.        knowledge at all. There are loads of
                                           This is small enough to fit in the palm      these shields from a wide range of
                                           of your hand. It’s got 14 programmable       manufacturers. They can be as simple
“The Arduino’s headers enable              digital input/output pins and 6 analogue
                                           input pins. It’s all based on an ATMega
                                                                                        as a few buttons to add input, or as
                                                                                        complex as modems that interact with
you to add extra hardware with             328 8-bit microcontroller which has          a mobile phone network. Perhaps the
no electrical knowledge at all.”           32K flash memory, 2KB of RAM and
                                           runs at 16MHz. These specs may
                                                                                        most common use of shields is to add
                                                                                        environmental sensors, or output



40                                           www.linuxvoice.com
                                                                                                                   ARDUINO FAQ

displays to your Arduinos.
  Shields can be stacked, so it’s
possible to connect more than one to
an Arduino at a time, but not all are
compatible with each other when
stacking as they may use the same
pins to communicate.

       I already have a Pi, which has
       input and output pins. What
are the advantages of an Arduino?
       There are quite a few advantages,
       depending on what projects
you’re doing. The Raspberry Pi runs
Linux, which is a general-purpose OS,
and has a whole heap of software
running at once, and a kernel that allots
processor time to different pieces of
software. This means that it can be
hard, or even impossible to perform                    Most Arduino boards have rows of connectors to allow shields to push straight in.
precisely timed actions. On the other
hand, and Arduino doesn’t run an OS, so                  All the boards are programmed in the       quality as well). There are also many
every CPU cycle is devoted to just one                 same way. The IDE has a menu where           boards that modify the basic Arduino to
piece of software. If you need to switch               you select the target hardware, and it       include additional features, or fit into
a pin on or off with millisecond                       compiles it appropriately. Most code         other form-factors.
accuracy, the Arduino’s microcontroller                will run on any of the boards unless it        Several of what are now official
approach will do the job far better.                   requires a hardware feature that’s not       Arduino boards were designed by other
   On the other hand, if you’re doing any              present on some.                             organisations to fulfill niches that
processing that requires high-level                                                                 weren’t well satisfied by existing
functions, particularly anything that                        Is the Arduino IDE open                microcontroller boards. Others have
needs significant processor power, or                        source?                                taken the Arduino hardware in entirely
interaction using a monitor or keyboard,                     All the Arduino software and           new directions. For example, there’s the
the Raspberry Pi will be a better option.                    hardware is open source. This          Udoo, which is a single-board computer
                                                       means the IDE that’s used to program         that combines an ARM CPU running
      How do you program these                         the boards, the bootloader that enables      Linux with a microcontroller setup
      Arduino boards?                                  uploading the software via USB, and the      that’s based on the Arduino Due.
      All the boards can be                            designs of the boards themselves.            Together this gives you a computer that
      programmed using the Arduino                                                                  runs a Linux desktop, but also has a
IDE, which uses a dialect of C++ and                          The designs of the boards are         high level of control over the input and
runs on Linux, Mac OS X and Windows.                          open source? I thought open           output pins.
                                                       source was just about software.                Sometimes it feels like there’s a new
                                                              Although open source software is      Arduino-based board coming out every
                                                              the most common embodiment            day, and there are regular crowdfunding
                                                       of the open source principles, there’s       campaigns by people trying to launch
                                                       also a growing movement for open             new boards. They mostly have a project
                                                       source hardware. To be open source,          name ending in -duino.
                                                       hardware has to release the schematics
                                                       and design files under a licence that               The Arduino project sounds
                                                       allows modification and redistribution.             awesome. Is there a website I
                                                       That way, just as people can modify          can go to and find out more?
                                                       FOSS, they can create new pieces of                 Ah! This is a slightly thorny
                                                       hardware based on the originals.                    question at the moment. There’s
                                                                                                    a bit of a dispute between the founders
                                                              If it’s open source, does that        of the project. The project’s website has
                                                              mean there are other boards           always been www.arduino.cc, but one
                                                       based on the Arduino hardware?               founder has set up www.arduino.org,
                                                              Yes, loads! There are lots of         and is claiming to be the rightful heir to
                                                              clones of the Arduino products        the project. For tradition’s sake, we’ll
The Arduino IDE includes a wide range of programs to   that are often far cheaper than the          stick with arduino.cc, as this has the
help you access the features of the hardware.          originals (though they’re usually lower      most active community.



                                                         www.linuxvoice.com                                                                41
     INTERVIEW NEIL MCGOVERN




DEBIAN PROJECT LEAD:
NEIL MCGOVERN
Ben Everard and Graham Morrison head to the
city of Cambridge in a big week for the world’s
biggest Linux distribution.


D
        ebian is one of the oldest           days of releasing Debian 8. It’s the
        Linux distributions. It’s also       Project Leader’s job to ensure Debian’s
        one of the most widely used          community and engineers are listened
and adapted, being at the core of            to, and to provide a public face for the
more derivatives than our immediate          project, which is a huge challenge for
memory cache can count. It’s also            a something as important as Debian.
one of the most democratic, and the          Which is why, when we found the new
project has just elected a new Project       project leader was based in Cambridge
Leader to take over from previous            – a mere three-hour drive away – we
incumbent Lucas Nussbaum, all within         had to make the trip.




                                                                                               “Debian Project Leader is
       Can you tell us about what you               Are you allowed to work on
       do for a day job and how that               Debian as part of your daily
relates to your work with Debian?
Neil McGovern: Yeah, sure absolutely.
                                             9 to 5 job?
                                             NMcG: Yes, we’ve got a few schemes
                                                                                               more of a figurehead role.
When I first thought about running, I        called community days where I take                You don’t get to direct the
first checked with the CEO and CTO of        time to go and do it. Basically, our CEO
                                                                                               way the project goes, but
                                                                                               you can set your ideas out.”
my employer, Collabora, who both             said as long as it doesn’t cause a
started as free software developers          problem, it’s fine. If it does start to
themselves. At Collabora, one of the key     cause a problem, we’ll just have a chat
things we try to do is accelerate the use    and work something out. At Collabora,
of open source in the industry. So, not      we make sure it actually happens and
only using free software, but the            carries on. It’s really good.                  to people online is one of the key things
methodologies behind it and trying to                                                       I have to do every day.
bridge the gap between this huge                    Maybe it’s early days, but it
collection of free software and it being            feels like, on the surface                     How do you do that? Is that
used in real life. So I’m in charge of all   anyway, that there’s quite a lot of                   through IRC?
our engineers here.                          overlap between what you do at                 NMcG: Yeah, lots of IRC. In Debian,
                                             Collabora, such as managing                    there are lots of email lists. And just
       That’s a huge job in itself!          engineers, and what your job is and            simple things like after someone’s done
       NMcG: It is, yeah. It has been        will be at Debian?                             quite a bit of work, just send them a
useful and been described as herding         NMcG: The difference with Debian is            quick thank you email can work
cats a lot before. We try to hire the best   that it’s entirely voluntary driven, so you    wonders really.
open source people out there, so the         can’t just tell people that they need to          At Debian, it’s an interesting role,
bosses are more than happy with me           do something by a date or something            being project leader. It’s more a
doing work with Debian. It’s quite           similar. But a lot of what I do is trying to   figurehead role. You don’t necessarily
important for Collabora as well,             encourage our developers to grow and           get to direct the way the project goes,
because lots of our customers end up         see what they want to do in the future,        but you can set your views out, where
using Debian or Debian-based                 rather than just say ‘that’s your project,     you think the project should go and just
distributions. So they’re certainly very     go on and do it’. My job is more to            try to sort of speak to lots of other
happy with it. We’ve got a really good       ensure that people get career                  organisations and groups around
policy of giving back to the community       development and things like that, so it        Debian, and act as that liaison.
and trying to stay involved with the         works well.
upstream policies rather than                  As we’re locally distributed both in               Would these other organisation
disappearing off somewhere.                  Debian and Collabora, being able to talk             be people that already work



42                                                             www.linuxvoice.com
                                                                                         NEIL MCGOVERN INTERVIEW


                                                                                                        Can you tell us why you
                                                                                                        thought at this point you
                                                                                                 wanted to go for it?
                                                                                                 NMcG: Yeah, so I’ve been involved with
                                                                                                 Debian for about 12–13 years or so,
                                                                                                 and I’ve done various bits and pieces,
                                                                                                 and for the last five years or so I was
                                                                                                 release manager. So I had – not Jessie,
                                                                                                 that’s just gone out – but the previous
                                                                                                 three releases I’ve been involved with. I
                                                                                                 finally stepped down from that as that’s
                                                                                                 also a considerable amount of work. It’s
                                                                                                 not the nicest job in the world to have to
                                                                                                 say no to people when they want their
                                                                                                 new package in and you’re in a freeze
                                                                                                 and you’re trying to stabilise the
                                                                                                 product.

                                                                                                       Debian’s very clear on this,
                                                                                                       isn’t it?
                                                                                                 NMcG: Yes, it is. But there is tension
                                                                                                 there, and just trying to bring that
                                                                                                 together is, well, I think we’re over
                                                                                                 45,000 binary packages now in the
                                                                                                 latest release, so trying to bring it all
                                                                                                 together is a lot of work and it takes
                                                                                                 some time. Just trying to make sure
                                                                                                 you have that stable, reliable system
                                                                                                 that carries on working is a trade-off for
                                                                                                 being able to bring in the new things.

                                                                                                        So what is it that you feel you
                                                                                                        can bring to Debian from
                                                                                                 maintaining those releases?
                                                                                                 NMcG: I think that mostly it’s my
                                                                                                 relationships with all the people in

“We’re over 45,000 in the
                                                 NMcG: I did get quite a good handover           Debian. So not only the release
                                                 from Lucas, which is fairly unusual. And        managing, I’ve done lots of press work,

latest release – bringing that                   he’s still around, so I can still talk to him   secretary work, before that I was one of

all together is a lot of work.”
                                                 as well. Lots of the previous DPLs              the founding people of the secure
                                                 (Debian Project Leads) do talk to one           testing teams, and I’ve written policy for
                                                 other and share ideas. It’s quite a broad       web apps and various things. So I’ve
                                                 job; there are lots of demands on your          interacted with so many people over
        with and know Debian?                    time and it’s hard to fit it all in.            the years that it’s a thing I think I can
        NMcG: So my handover involved a lot                                                      help with, which is basically getting
        of speaking to the Free Software                 It sounds like one of those jobs        people to talk to each other and work
        Foundation, the SFLC…                            that suck up any time that you          with each other well, because I know
                                                 have if you want it to.                         everyone so I can go and talk to FTP
               To say hello?                     NMcG: Yep, absolutely. Previously,              masters who I’ve had beers with in
               NMcG: To say hello and to work    when I was involved in quite a lot of           Mexico or Edinburgh or all over the
        with them, because there are various     politics, the one things that’s said when       world at DebConf. And just being able
        things that we try to work together to   you ask “Oh, what about doing this”, and        to use that personal relationship to try
        try and increase the use of free         they’ll say “take as much time as you           and help things along and get progress.
        software, and make sure that works       want or as little time as you want”, and
        really well.                             it’s always a lie. It’s always a lot of time          Is it something that you’ve
                                                 that you need to spend doing it, but it               always wanted to do, or is it
             Did Lucas Nussbaum have any         can certainly grow to a large amount of         just something that felt like a
             pearls of wisdom for you when       time if you need it, but at the moment          natural fit considering what you’ve
        you took up his old job as DPL?          it’s fairly manageable.                         done before?



                                                   www.linuxvoice.com                                                                   43
     INTERVIEW NEIL MCGOVERN




  Neil is the first Debian Project
  Leader since the anti-
  Systemd faction left to fork
  the Devuan distribution.


NMcG: I certainly didn’t enter Debian       just going to see how it goes?                project in the past and it’s caused a lot
thinking that. It’s something that,         NMcG: For the moment, a year. Next            of disagreements within the project on
certainly at the moment, is the right       time the elections come up, I’m going to      how we do that, because there’s a real
thing for the project and for me to be      pretty much do the same thing – try           risk that you create two classes of
able to do. We’ll see in 12 months if it    and work out whether I still think I’m        developers: the normal everyday
was a horrible mistake or something,        doing a great job, would the project still    volunteers, and those who are blessed
but I’ve always been aware of the           benefit from me doing this role or is         to be paid by the project. In a volunteer
amount of time it takes and the amount      there anyone else that would be better,       project, that can create a lot of tension.
of dedication that’s needed to actually     and if there’s someone else that I think         But there are things we can try and
do the job well, and making sure I was      will be better then I’ll back them and        do to improve Debian and the way it
able to do that. The time was right to do   help them do it as well. Yeah, I certainly    works. We work online entirely, through
that, and it’s always a case of seeing      don’t want to bite off more than I can        email, sometimes IRC, but our primary
who else is running and working out if      chew, and commit to doing something           mechanism is mailing lists. And the
you think you could do a better job or if   too long really.                              best way of getting progress is to get
you believe that, you can lead the                                                        people together, actually sitting around
project then.                                     One of the things you said you          the table and working together at it. So
                                                  want to do is spend some of             a lot of our funding goes for helping
       Was there a point when you           the money that Debian has. Where

                                                                                          “I’m not keen on employing
       thought “Oh no, I’ve gone and        do you see that money going – is
done it now”?                               that employing developers,
NMcG: Probably about five minutes           developing the infrastructure?
                                                                                          developers… In a volunteer
                                                                                          project, that can create tension.”
after the election results came out!        NMcG: A lot of our infrastructure
There were mixed emotions. The              comes from machines that have been
election results came out late on           donated to us, and a lot of our hosting
Tuesday evening and I took my new           comes very nicely from ISPs that use          things like DebConf, which is our annual
post on Friday morning, so there were a     Debian and like it so we get a lot of that.   conference. This year it’s in Heidelberg,
few days to try to work out what was        But hard drives need replacing and            Germany, and next year it’s in Cape
going on. It’s slightly daunting I guess,   upgrades need to happen and                   Town in South Africa. Some of the new
the amount of work, but it’s also           machines get old so that they                 contributors can’t afford to go there, so
exciting that I’m going to actually go      eventually need replacing, and we do          there are some programs to help pay
and do this.                                quite a lot of that.                          for their plane tickets. It’s really
                                              I’m not particularly keen on                important that people get together.
      Have you started it with a            employing developers as a whole.                 The other thing I’m keen on is
      duration in mind, or are you          That’s been a thing we’ve looked at as a      average. I’m sure we know that female



44                                                           www.linuxvoice.com
                                                                               NEIL MCGOVERN INTERVIEW

and minority representation in software    want to come can do that and it doesn’t   about Debian and they’d all heard the
is pretty bad, and in open source          cost them anything.                       news. And so sometimes I think we do
software it’s even worse.                    Debian has never really solicited       forget about how well known Debian is
   And so there are programs like the      donations, apart from DebConf, and we     now. It doesn’t go out and trump its
Outreach, which started out as the         haven’t really ever asked for any.        own horn, and try and do lots of
Outreach Program for Women. Debian               I know for such a hugely vital      marketing and drive it. But it is the basis
this year will be funding a minimum of           distribution…                       of a lot of these systems that are out
four slots and is about to try and         NMcG: Yeah, I think the last time I       there, and lots of other distributions as
improve it. Hopefully we can use some      checked we get about 40 or 50             well. It’s quite an important distribution,
of the funds that have kindly been         thousand pounds a year of unsolicited     we’ve found.
donated to us for that.                    donations, so making sure we’re able to
                                           spend that effectively and actually use         It would be a good contender
      Do you know where the funds          that for good projects is important.            for the most important
      for Debian come from? Is it                                                    distribution in the whole world!
basically individuals, is it                      Do you think that reflects the     NMcG: Yes, it’s certainly one of the
companies?                                        nature of Debian itself? That      earliest and the basis for a lot of things.
NMcG: The vast majority of our             it’s such an important distribution,
everyday unallocated funding comes         you’d expect it to have a formal                 What made you chose Debian?
from individuals. We do have some          structure and be much more worried               So, 12 years ago, what was
corporate sponsorships, but that’s         about donations, but it does              there… Mandrake… there was no
mostly for the conference itself           everything at its own pace.               Ubuntu…
because we don’t charge for                NMcG: Yeah, it kind of hit me a couple    NMcG: My first install I think was
attendance. We have to pay for the         of days after I was elected – I went to   Mandrake. I was at the University of
venue and various things, and also a lot   the pub and five or six people who I      Sheffield as part of the IT committee
of the accommodation is paid for by        know all came up to me and offered to     there, which basically ran the web
the organisation, so that people that      buy me a pint, because they’d all heard   servers for people to put up their
                                                                                     websites because there wasn’t any
                                                                                     student web offering in those days. And
                                                                                     then my housemate who I moved in
                                                                                     with during the second year happened
                                                                                     to also be a Debian developer. I’d used
                                                                                     Debian a few times before but they
                                                                                     encouraged me to get into that and I
                                                                                     think I packaged an application called
                                                                                     Drivel, which was a LiveJournal client at
                                                                                     the time. So that was my earliest
                                                                                     contribution.

                                                                                           That must have been quite
                                                                                           difficult to put together?
                                                                                     NMcG: Yeah, it’s become a lot easier
                                                                                     now. The installer hasn’t changed much
                                                                                     since then. It’s all been fairly well put
                                                                                     together, and fairly stable, but it just
                                                                                     requires a lot of work to make sure that
                                                                                     the system as a whole can be installed
                                                                                     easily. Certainly over the years, it’s got a
                                                                                     lot easier to install and put together. I
                                                                                     mean you can just insert a CD, say ‘go’,
                                                                                     accept the defaults and you know that
                                                                                     in the end you’ll have a really good
                                                                                     working system.

                                                                                           So is there something about
                                                                                           Debian that you particularly
                                                                                     like?
                                                        Owing to its stability and   NMcG: I think the primary thing about
                                                   number of packages, Debian is
                                                                                     Debian is that it makes the decisions
                                                  a popular base system for other
                                                       distros – such as Ubuntu.     that are most technically correct
                                                                                     beyond all levels.



                                             www.linuxvoice.com                                                              45
     INTERVIEW NEIL MCGOVERN

       Even when it comes to
       something like Systemd?
NMcG: Yeah. And, as a community, we
make decisions and we do it on the
basis of getting it right and making sure
things are aligned.
   We’re not a distribution that hides its
problems. We do everything in the open,
and that way of working together works
really well. The Debian mailing lists
have been less intense recently than
they were about five or six years ago,
and the project’s calmed down a lot and
is working.

       Oh really?
       NMcG: Apart from the rather
large Systemd [disagreement]; that
used to be a fairly common
atmosphere on the lists but it’s become
a lot more calm and people just work
together to do it. But even despite those
huge flamewars that you used to get,
we still produce the right solution and
try to make sure things are stable and
we carry on going together. We make it
a distribution that people can rely on.

      And do you have to remain
      impartial on decisions like
that, now that you’re the leader, or
do you have to ensure there’s debate
and everyone gets heard?
NMcG: I think my role is to help lead
discussion. I’m not a leader who says
“We’re doing this – follow me!”.
                                               Despite RPM being officially adopted
Obviously, on some issues, I have my
                                               by the Linux Standards Base as the
own views on where we go…                      standard Linux package format, Debian’s
                                               Deb format is still extremely popular.
      And do you still state those?
      NMcG: Yes, absolutely. But part
of my role is to represent the views of      stage a new version of a library or a          recently, and just being able to see that
the project as a whole, and to make          new version of, say, Gnome or KDE, and         that works stable and testing and
sure the project has the discussions         make sure it works altogether before           unstable, all at the same time, being
and that we come to a good                   we move it into our own stable                 able to use that to make sure nothing’s
consensus.                                   distribution. And that should help us all      going to break.
                                             ensure that things remain working a lot
      One of the things Debian is            better, it’s all about quality and making it           Would Debian’s PPAs require
      trying to do is PPAs (Personal         easier for people to test things and                   anything from Launchpad to be
Package Archives). Why is that               create stuff.                                  able function properly?
important?                                                                                  NMcG: No, but there are a few systems
NMcG: It’s a way of easing the                     Are you planning to do the               out there that we’re looking at and so
development that we do, and making it              same as Ubuntu has done, and             we could write our own which goes
easier to stage things and how we do it.     have all the software hosted in the            with our own software. There are other
We have a slightly different plan from       same place?                                    build softwares that we could pull in. I
the way Ubuntu does it. I don’t plan to      NMcG: Yeah, it’s already fairly easy for       think we looked at Launchpad, which is
pushing something where anyone can           people to create their own repositories        fairly tightly integrated into Ubuntu.
have their own PPA with different            anyway, but being able to create a new         Obviously, that’s a bit of a deal breaker
software from anywhere.                      version of, say, Chromium, or I think          for us. It’s been something we’ve been
  For example, you could have a PPA to       there was a new WordPress release out          looking at for a long time. And it’s



46                                                             www.linuxvoice.com
                                                                                          NEIL MCGOVERN INTERVIEW

                                                                                                 dependencies between them, and make
                                                                                                 sure things don’t break, they stay there.

                                                                                                         What do you think your biggest
                                                                                                         challenge will be over the next
                                                                                                 12 months?
                                                                                                 NMcG: Well there are a few things that
                                                                                                 have come out recently. Just before
                                                                                                 Lucas left, he was talking with various
                                                                                                 people about things like including ZFS
                                                                                                 on Linux, which is a tricky one because
                                                                                                 it’s CDDL licenced [Common
                                                                                                 Development and Distribution Licence]
                                                    As a defender of the free software flame,
                                                                                                 rather than GPL, so there could be
                                                     Debian takes a firm stance on copyright
                                                                                                 some licensing incompatibilities there.
                                                     issues – which is why Firefox in Debian
                                                        is rebranded Iceweasel, for example.     And it’s the start of a new release, and
                                                                                                 so this is about the right time for a lot of
                                                                                                 churn.
       something that the project and               the kind of containerisation and                 Trying to make sure that we get
       members of the project want. It’s just       sandboxing of some packages so               those good foundations in and trying to
       trying to make sure we can accelerate        that different libraries can be              work out how we can deal with, for
       the process.                                 installed alongside one another.             example, the Free Software Foundation
                                                    NMcG: Yeah, there are advantages and         not agreeing that ZFS is compatible
             Do you think people will be            disadvantages of having that. A few          even as module. Although, on the other
             installing stable versions of          years ago, there was a big security          hand, people do it all the time. And so
       Debian alongside PPAs to get the             vulnerability in Zlib, which affected        there is that pressure from both sides
       latest version of, say, Chromium, or         almost every package out there. The          to try and marry up those two, and
       are you going to want people                 ability to update that and manage that,      make sure Debian remains a free
                                                     if you have to do it in essentially every   software distribution.

“I don’t want to go back to the                      application, is a huge hassle. Being able
                                                     to maintain that sort of level of core             Is it possibly the most
days of finding a random                             system is important.                               important thing, that Debian

application on a website.”                                 And that’s how it should stay.
                                                                                                 remains true to its origins as a
                                                                                                 defender of software freedoms,
                                                           NMcG: Yeah, and there’s also an       rather than taking the easy road?
       experimenting?                               issue with trust when it comes to            NMcG: I think so. From a philosophical
       NMcG: That can happen already,               random packages from the internet. I         point of view, it is right that we do
       because we have the backports                don’t want to go back to the Windows         produce a good software distribution,
       system, where we take things and do it       days of finding random application on a      so you don’t end up with vender lock-in
       that way. It’s a way of making it easier,    website and you download it. In Debian,      and people can have that trust in what
       so for example, I think the Mozilla          people trust Debian to do it.                you do. And additionally, what we’re
       packaging team have mozilla.debian.             We have security updates that we          starting to see now is that since the
       net and they put their latest ones and       backport and we don’t break the              Snowden days, there has been a lot of
       the backport things to stable, so it’s       software, and that doesn’t really come       concern over privacy and what happens
       making it easier for that.                   from using containers in that way. I         with your data. By making sure we have
         And for some people, it is important       think it reflects Debian’s focus on          that in free software, you know what’s
       to get hold of the new versions and try      producing those stable systems and           happening with your data and that
       and run them alongside the stable            making sure people can rely on and           there’s nothing untoward going on.
       versions. But I think it’s something that    trust their systems.                            But also I think that being a free
       will complement stable, rather than                                                       software distribution has been one of
       change it, because all the larger                  And Debian doesn’t feel any            the reason that Debian has been so
       organisations don’t want to upgrade                pressure just to go along with         successful in corporate environments,
       their software every six months and          the current trends…                          because people know they’re not going
       have a new distribution, so it’s trying to   NMcG: Yeah, we created the .deb              to be stuck when something like a
       keep that adequate.                          format and there have been lots of           company CEO is going to change and
                                                    changes, like RPMs and various               they’re going to be left high and dry. Or
            Do you think package                    updates, but I still think the .deb format   also creating downstream distributions
            management in general can               is one of the best package formats out       as well because, when Debian says it is
       change? For instance, there are              there for managing packages. The             free software, they know they can trust
       things like Snappy Ubuntu Core and           complex way you can portray                  that. People can rely on Debian.



                                                       www.linuxvoice.com                                                                47
        LISTEN TO THE PODCAST



         WWW.LINUXVOICE.COM




BUY           MUGS AND T-SHIRTS!




      shop.linuxvoice.com
                                                                                                                            INTRO REVIEWS




                                                 REVIEWS
                                                 The latest software and hardware for your Linux box, reviewed
                                                 and rated by the most experienced writers in the business


                                                  On test this issue...
                                                     50                                                      52



Andrew Gregory
Reminder for the lazy: Hadrian’s Wall does not
mark the border between Scotland and England.




R
         egardless of the result of the
         latest UK general election, we           Ardour 4                                                 Debian 8 Jessie
         should all be able to agree that         Dedicated beeps-and-bleeps producer                      Debian releases don’t come around too
the BBC’s graphics department is doing            Graham Morrison needs no excuse to                       often, so Mike Saunders is taking a
a fantastic job. The weirdly blinking CGI         fiddle with audio, so this Free Software                 moment to appreciate one of the oldest
mannequins of our politicians were                multitrack editor is music to his ears.                  distributions in existence.
uncannily lifelike, and somehow looked
more human than the real-life leaders
of the party. It’s also extremely likely             53                                    54                              55
that without Linux and Free Software,
these graphics wouldn’t look anywhere
near as good.
   Sure, the BBC has money to burn and
can afford to buy in whatever expensive
solution it wants, but in the world of
graphics, Linux is king. The BBC pays
                                                   Visual Studio Code KDE Plasma 5.3                                      Synfig Studio 1.0
for its own developers to produce                  Ben Everard is confused: a            Graham Morrison is fond of       Cartoon Inkscape-style
whatever its election coverage team                code editor for Linux, from           the KDE desktop; even more       editing is an awful lot of
requires, and Free Software gives it a             Microsoft, and released               so now that there’s decent       fun. Mike Saunders making
fantastic base on which to work –                  under a proprietary licence?          power management. The            his own Jessica Rabbit fan
without it, it would be forced to develop          What does it mean?                    future is here, and it’s kool.   fiction, for example.
from scratch (costly) or buy off the
shelf (limiting).
                                                  BOOKS AND GROUP TEST
Will it blend?
                                                  Sharing documents, calendars and photos via
This freedom gives benefits all the way
                                                  Dropbox is convenient, but as it’s a closed-source
down to smaller organisations and                 service, you have no idea who’s rummaging through
individuals. Anyone can download                  your files. Condoleeza Rice could be reading all your
Synfig Studio, for example, watch a few           shopping lists, for example. The way to alleviate this
video tutorials and start using an                fear is to choose some other software that will do the
                                                  same job, so we’re looking at some of the best
incredibly powerful professional-quality
                                                  solutions for Linux to preserve your peace of mind
animation tool. Free doesn’t mean                 and get all the features you need. And in the world of
cut-down – it’s what gives software the           books, we find out who Anonymous are, and learn Qt
potential to be excellent.                        coding and teach our addled minds how to think.
andrew@linuxvoice.com



                                                                   www.linuxvoice.com                                                                  49
     REVIEWS ARDOUR 4



Ardour 4
If you’re wondering why this issue is late, blame Graham Morrison
and his obsession with audio software.

                             M
                                          usic production is no longer niche. Thanks
  DATA                                    to a proliferation of apps, synths and
  Web
                                          effects on tablets and smartphones, and a
  http://ardour.org          new fervour for both old gear and new bits of dinky
  Developer                  hardware, lots of people are making lots of music. But
  Ardour community           before you can share your music and become
  Licence                    famous, you need to pull everything from these
  GPLv2
                             various sources into one place, mixing your tracks into
                             a single file that can then be shared on SoundCloud or
                             listened to on your phone.
                                The applications that do this are called ‘Digital
                             Audio Workstations’ (or, DAWs), a term that pre-
                             dates phones having more processing power                      Ardour’s GUI makes few concessions to the modern world,
                             than a Commodore Amiga. These are powerful, all                except the inclusion of exporting audio directly to the
                             conquering tools that skilled engineers use to coax            SoundCloud.com service.
                             harmony from discord. But they’re essential for us
                             mortals too, because mixing and mastering your                 and comes two years after version 3.0. The Windows
                             sounds is beyond the scope of Audacity. And in                 version is important, but the major feature for us is
                                                                another throwback to        that a previous reliance on Jack has been removed.
                                                                a bygone era, these         Jack is a powerful piping system for audio, letting
“Ardour is a digital audio                                      applications can still be   you take an audio stream from your microphone,
workstation for Linux, OS X, and                                expensive. The latest
                                                                version of one of the
                                                                                            push it through some echo effect (for example) and
                                                                                            pipe it back to Ardour. But Jack is tricky to get running
for for the first time, Windows.”                               market leaders, Cubase,     properly and doesn’t work well alongside other audio
                                                                for example, is £370.       layers, such as PulseAudio. You’d typically have to kill
                                                                  Ardour is one of          off any other audio before launching Ardour, which
                             those applications for Linux, OS X, and for the first          always diminished its quick-fix effectiveness.
                             time, Windows (thanks to a Google Summer of Code
                             project). It’s open source and it’s free. But it’s also        Sound has been simplified
                             the full time occupation for its lead developer, Paul          Ardour will now use your ALSA drivers, just like most
                             Davis. While Ardour is free in all senses of the word it’s     other audio applications. The low-level nature of its
                             definitely worth giving a little back when you do make         access means desktop audio may stop, which
                             your fortune.                                                  happened in our case, but service is resumed after
                                Ardour is already widely used, both in commercial           quitting Ardour again. With our hardware, both on a
                             studios and as the framework for other commercial              laptop and a semi-pro Focusrite Saffire Pro 40, we had
                             software, and version 4 is a major new release with            better stability with ALSA than we did running through
                             many contributions from lots of different developers,          Jack, especially with low latency settings. Latency is
                                                                                            the delay between the sound going in and the sound
                                                                                            going out, and we were able to get this down to a
                                                                                            barely perceptible 10ms, even with the laptop’s Intel
                                                                                            HDA audio.
                                                                                               This direct access to ALSA is a huge advantage,
                                                                                            and there’s obviously been a lot of work in the
                                                                                            background helping to make this happen. All of
                                                                                            Ardour’s internal routing previously used Jack to avoid
                                                                                            re-inventing wheels, but you can now interface with
                                                                                            your audio hardware directly and still use Ardour’s
                                                                                            incredible routing and connection windows to pipe
                                                                                            audio wherever you need it within the application, all
The monitoring sections
are clearer than ever, and                                                                  without Jack running. Running Ardour without Jack
give you the perfect                                                                        also means there’s less distraction because you’re not
overview of your track                                                                      piping audio into external effects, keeping you within a
levels, input and output.                                                                   single application for longer.



50                                                             www.linuxvoice.com
                                                                                                                    ARDOUR 4 REVIEWS

   There has also been a graphical overhaul in version
4, with subtle improvements made to contrast,                Dialling in the effects
colour vibrancy and highlighting. Behind the scenes,
rendering has moved to APIs like Cairo for great
output and better performance on high-resolution
displays. It looks more professional and much more
like its commercial competitors, but Ardour is still
an application that makes too few concessions for
newcomers. Each track has the letters P, A, G, M and
S, for instance, alongside the fader and track name.
These represent Playlist (what source this track is
playing), Automation, Grouping, Mute and Solo, but
you’d never know. The learning curve is very steep
when you’re trying to figure out the meaning of letters
while at the same time mastering a new environment.
Nearly every other application we can think of uses          Dexed, seen running here as a VST within Ardour, is a complete recreation of a
more illustrative icons for these functions.                 Yamaha DX7 synth and sounds wonderful.
   This austere approach can be seen in many
aspects of Ardour’s GUI, and while we appreciate             One area where Linux can’t yet compete with      Fortunately, there’s still a small selection
                                                             other operating systems is in the quality and    of open source alternatives that are worth
that mixing consoles can be incredibly complex,              range of the audio effects you often need        it. In particular, VST library compatibility
we’d love to see Ardour become more accessible. It’s         to use to make your audio sound good. You        means we get the GUI bundled for the first
almost impossible to divine functionality from the GUI       need decent compression for most tracks,         time. Dexed is the best example of this and
alone, and that’s a huge shame because it hides a            for example, as well as some mastering           is capable of fantastic output. And of course,
remarkable amount . The online manual is excellent,          compression and limiting for when the            there are commercial options too. Our
                                                             audio goes through the master bus before         favourite come from Loomer
but we’re as bad as most people at reading the things        a final file. On both OS X and Windows,          (www.loomer.co.uk) and includes a gorgeous
before diving into a major project.                          there are hundreds of effects to choose          string machine. For some professional
                                                             from, but often, the majority of these will be   mastering effects, take a look at those from
Living colour                                                closed source, commercial and expensive.         OverToneDSP (www.overtonedsp.co.uk).
You’ll spend most of your time editing – the process
of trimming blocks of audio (known as regions in
Ardour), moving those regions slightly to change their     multiple regions at the same time, which is something
timing and cutting mistakes out. (This is what we do       we rely on, and we still would love to see region
when we produce the Linux Voice podcast.)                  selection locked so we can simply split and move new
   The already ultra-powerful editing facilities have      regions without reselecting the same audio with every
had a few upgrades. Automation lines are easier to         single operation. We also wish tracks could be moved
edit, which is important, because they enable you to       into a folder, not a group or a bus, so they can be
fine tune your mix without moving the faders during        hidden unless unfolded, much like in an IDE.
playback, and the rather unintuitive use of the S key to      If you prefer putting your hands on real sliders
split blocks beneath the cursor has been made more         and keys, Ardour still has good support for physical
accesible with a real ‘cut’ mouse tool, complete with      external remotes, and there’s new 14-bit support for
a ‘scissors’ vector-based icon in the toolbar. However,    controllers like our Behringer BCR2000. MIDI regions,
we couldn’t find a way of using this tool and selecting    the biggest new feature for Ardour 3, now co-exist
                                                           with audio groups and tracks, and Ardour can now
                                                           use Linux VST synthesisers when Steinberg’s VST
                                                           development libraries are installed, alongside native
                                                           LV2 audio generators and effects. MIDI editing itself is
                                                           still secondary, and we’d rather use a MIDI sequencer
                                                           for composing rather than the strained track view in
                                                           Ardour. This release also takes 80% less memory, at
                                                           least in the beginning of a project, and after you’ve
                                                           spent some time memorising the keyboard shortcuts,
                                                           the application feels brilliant to use. In short, Ardour is
                                                           complicated, but there’s nothing else like it.


                                                             LINUX VOICE VERDICT
                                                             You need the training, precision and
                                                             skills of a surgeon. But Ardour is
                                                             capable of awesome results.
Even without Jack connection system, you can still
connect any source to any other input.



                                                             www.linuxvoice.com                                                                            51
     REVIEWS LINUX DISTRIBUTION



Debian 8 Jessie
After fierce debates about the switch to Systemd, Debian 8 is finally here.
Mike Saunders checks out one of the most significant distro releases of the year.

                             D
                                       ebian 8, codenamed Jessie, is the most            like almost every other major distro; try an alternative
  DATA                                 controversial release in Linux distribution       such as Upstart from Ubuntu; or just remain with
  Web
                                       history. That sounds rather tabloid-esque, but    the tried-and-tested SysVinit. After countless
  www.debian.org             it’s true: in the last two years we’ve seen giant           arguments and developer spats, the Debian Technical
  Developer                  flamewars on the web, developers quitting the project       Committee voted to switch to Systemd – a vote that
  Debian Project             due to hate mail, and a fork of the distro in the name      was accepted by most of the community, but led to
  Licence                    of Devuan. The reason for all this? Systemd, the init       the creation of Devuan, a Debian-based distro that
  FOSS licences
                             system replacing the “bag of bits” that was SysVinit.       features “init system freedom”.
                                 This release adds support for 64-bit ARM machines,
                             but drops the Sparc and IA-64 (Itanium) architectures       Out with the old
                             due to insufficient developer support. Desktop-wise,        But why is Systemd so controversial? Until now, Linux
                             Gnome 3.14, KDE 4.11 and Xfce 4.10 are available,           has been very much a traditional Unix system: a
                             and these run on a base of Linux kernel 3.16 and Glibc      bunch of shell scripts start up the machine, various
                             2.19, compiled by GCC 4.9.2. So as expected, it’s fairly    disparate tools handle things like resource allocation,
                             up to date, but as with previous Debian releases the        logging and timed events (cron), and log files are
                             focus is on maximum stability rather than providing         scattered around several directories. Systemd replaces
                             the latest bleeding-edge software.                          all of this with an integrated set of tools built from the
                                 Debian 8 will be supported with security and critical   ground up. The upsides: administrators and app
                             bugfixes until April 2020 – so it’s playing in the same     developers don’t need to worry so much about the
                             league as RHEL, CentOS and Ubuntu LTS as a reliable         niggling differences between distros. They can write
                             distro you can install and forget about, running the        Systemd unit files to start and manage their software
                                                                occasional apt-get       without worrying if they’re running on Fedora, SUSE or

“Debian 8 is playing in the same                                update && apt-get
                                                                upgrade command.
                                                                                         Debian. It’s also much easier to sandbox processes.
                                                                                             Systemd keeps track of the state of the system, so
league as RHEL, CentOS and                                      Indeed, the distro has   it can restart programs that stop or crash, and handle

Ubuntu LTS as a reliable distro.”                               proven to be robust
                                                                in our testing, as
                                                                                         hotplugging events very quickly. The journal brings
                                                                                         log files together and means you don’t need to juggle
                                                                expected from Debian,    regular expressions to say: “show me all warning
                             despite the fact that it was released with 78 “critical”    messages from PID X in the last five boots.”
                             bugs still open. If you’re running a bunch of servers           The downsides: it’s not really Unixy in many
Gnome is Debian 8’s
                             that simply can’t afford any glitches, you’re better off    respects. Logs are stored in binary format, the
default desktop, and apart
from a dab of distro         waiting for Debian 8.1 to really polish the edges.          interpreted shell scripts have been replaced by
theming it’s largely a           Now, let’s talk about Systemd. The Debian project       compiled C code, and Systemd is very much tied to
vanilla setup.               had a choice: switch to this new suite of base tools,       the Linux kernel. This is why an online war broke out,
                                                                                         why developers left and forks appeared, but time will
                                                                                         tell if switching to Systemd was the right decision. Still,
                                                                                         Systemd has been used by distros like Arch for several
                                                                                         years now, so it’s fairly mature, and most admins
                                                                                         are learning to live with it – even if they don’t love
                                                                                         it. If you’re a hardcore SysVinit fan and Debian lover,
                                                                                         however, you’ll have to do some distro-hopping now.
                                                                                             On the whole, it’s a solid release that handles the
                                                                                         transition to a new init system well, and while some
                                                                                         of the bugs are cause for concern, nothing dodgy
                                                                                         manifested itself in our testing. Kudos to the Debian
                                                                                         team for (mostly) surviving a very difficult two years.

                                                                                           LINUX VOICE VERDICT
                                                                                           The last big-name distribution to
                                                                                           switch to Systemd, and the transition
                                                                                           has gone well.




52                                                           www.linuxvoice.com
                                                                                              VISUAL STUDIO CODE REVIEWS



Visual Studio Code
After scanning the horizon for airborne pork, Ben Everard installs
Microsoft’s coding environment in Linux.

N
            o, your eyes do not deceive you. We really are
            reviewing a Microsoft programming
            environment on Linux. In a move that
surprised many people, including us at Linux Voice,
Microsoft has announced a cross-platform
development environment. Visual Studio Code
(VSCode) runs on Linux, Mac OS X and Windows. At
the time of writing, there was only a preview release
available, which ran for us without any problems.
    The install process isn’t a great introduction to the
software. VSCode comes as a Zip file that extracts into
the current directory without creating a subdirectory
for its files (as most Linux programs do). Once you’ve
decompressed it, there’s no instructions file to let you
know what to do. Fortunately, it’s quite simple: you
just execute the binary called Code, and it starts.
    Aside from the name, Visual Studio Code has very
little in common with the Visual Studio IDE. It’s a
programmers’ text editor with integrated debugger.
                                                                                                                         It feels surreal running
VSCode is based on Electron, the engine behind                said that its debugger will work with other text editors
                                                                                                                         something called Visual
GitHub’s Atom text editor. At a technical level, this         such as Vim and Atom, but at the time of writing there     Studio on Linux, even if it is
means it’s built on Node.js using web technologies.           weren’t any details on this.                               a stripped-down code
    The user interface defaults to light-grey code on a                                                                  editor rather than the full
dark grey background. This is easy on the eyes, but if        Grudging praise                                            IDE.
you don’t like it, you’re out of luck: you can configure      Code completion is also restricted to the same
quite a bit about the editor in the settings.json file, but   languages as the debugger. The completion run well
at the moment, there isn’t the option to change the           even on low-powered machines, and worked                     DATA
colour scheme.                                                intuitively to speed up our coding. The editor can
                                                                                                                           Web
    The best feature of VSCode is the debugging               connect to a Git repository to enable you to version
                                                                                                                           https://code.
support. At the moment, this is limited to ASP.net, C#        control your code. Once connected, staging and               visualstudio.com
and Node.js JavaScript, but Microsoft promises                pushing changes just take a few mouse-clicks.                Developer
support for more languages in the future. You can set            Some people may find it a little galling that Visual      Microsoft
breakpoints, and examine variables. It’s easy to              Studio Code is closed-source despite the fact that it’s      Price
                                                                                                                           Free (closed source)
control and doesn’t contain any surprises. If – and this      largely based on open source components. However,
is a big if – Microsoft can extend this debugger              it doesn’t violate any of the licences (for example,
support to more languages, then this will be an               Node.JS and Electron are MIT licensed), so they
important feature for future releases. Microsoft has          Microsoft has the right to do this.
                                                                 All told, Visual Studio Code is a good programmer’s
                                                              text editor. But it’s entered an enormously competitive
                                                              arena: the existing text editors for Linux are mature
                                                              and highly tuned to developers’ needs. For a new
                                                              editor to stand out, it needs to really have something
                                                              special. For Visual Studio Code, this could be the
                                                              integrated debugger. However the current limitation to
                                                              just a few languages and frameworks mean it’s not
                                                              yet useful to most programmers.

                                                                LINUX VOICE VERDICT
                                                                A good editor, but not good enough to
                                                                tempt us from our regular development
                                                                environment.
Visual Studio Code’s code completion ran well, though
many programmers editors have a similar feature.


                                                                www.linuxvoice.com                                                                 53
     REVIEWS KDE PLASMA 5.3



KDE Plasma 5.3
Christmas has come early for Graham Morrison.


                              T
                                       he components that come together to make
  DATA                                 KDE are going through a prolonged phase of
  Web
                                       rapid development. These components are
  http://kde.org              KDE Frameworks 5, KDE Plasma 5 and the suite of
  Developer                   KDE applications ported to the new environment. KDE
  Team KDE                    Frameworks 5.9 was released on 10 April, with the
  Licence                     15.04 applications suite of 72 ported KDE programs
  LGPL
                              released almost a week later.
                                 Many old applications, such as Telepathy and
                              Kdenlive, have now been ported to Frameworks 5.9,
                              but the ports of both the Dolphin file manager and
                              KMail have yet to be completed, which is what we             Background widgets in the new KDE can be moved
                              miss most. KDE Plasma 5 is the closest to what used          without unlocking the panel. Just press, hold and drag.
                                                       to be just the KDE desktop,

“There’s a new info module,                            and when we looked at KDE
                                                       Plasma 5.2 in issue 13, we
                                                                                           sessions get suspended on AC power, on battery
                                                                                           power and on low battery. You can even create
so you can quickly see                                 concluded that KDE was now          different settings for different activities, perhaps

what’s killing your battery.”                          good enough to replace those
                                                       aging KDE 4.x desktops you
                                                                                           adding more aggressive power management in an
                                                                                           activity you can use while travelling, for example. The
                                                       might be still using, and this is   icing on the power management cake is that there’s a
                              exactly what’s happened with the release of Kubuntu          new info module that lists processes by energy
                              15.04, which now defaults to its version of Plasma 5.2       consumption, so you can quickly see what’s killing
                              for the first time.                                          your battery.
                                 But development has continued apace, and Plasma
                              5.3 sports some decent upgrades that might make it           Touch and go
                              worth Kubuntu users hunting out the Kubuntu                  Sticking with modules, we can finally dump the
                              Backports PPA. We were complaining about the lack            synclient script we were using to configure our
                              of power management in KDE only six months ago,              Synaptics touchpad: there’s now a touchpad module
                              for instance. Our specific complaint was that you            for the settings panel. Alongside the regular controls,
                              couldn’t even get an estimate of how much battery life       such as tap to left click and pointer acceleration,
                              you might have left. And Plasma 5.3 goes well beyond         there’s two-finger and reverse scrolling, as well as
The battery icon will show
you if any applications are   this requirement by not only providing ‘time until           noise cancellation and palm detection.
blocking the sleep process    charged’ and ‘time until empty’ statistics from the             Finally, there are two experimental features added
from activating (as VLC is    panel widget, but also letting you control screen and        to this release. The first is a new media centre
doing here).                  keyboard brightness, button events and when                  application called Plasma Media Centre. This runs
                                                                                           full screen and is designed to be used as a new
                                                                                           session from your login manager when your KDE box
                                                                                           is connected to a TV or large screen. It’s currently
                                                                                           difficult to see why you’d want a KDE solution over
                                                                                           something like Kodi, which does an almost perfect
                                                                                           job. The KDE version rifles your storage for audio and
                                                                                           visual content and presents thumbnails of its finds
                                                                                           like a robot pet with a pack of cards. The second
                                                                                           experimental feature is that the window manager and
                                                                                           compositor can now use a nested Wayland session.
                                                                                           We weren’t able to test this, but it’s great to see KDE
                                                                                           one step closer to the X.org replacement we’ve all got
                                                                                           such high hopes for.

                                                                                             LINUX VOICE VERDICT
                                                                                             This release is made for laptop users –
                                                                                             it’s difficult to resist the upgrade




54                                                            www.linuxvoice.com
                                                                                                     SYNFIG STUDIO 1.0 REVIEWS



Synfig Studio 1.0
Mike Saunders finally puts his crayons and tracing paper away.


S
        ynfig Studio has quite a lot in common with the
        3D studio and rendering powerhouse, Blender.
        They’re both graphical applications that
generate animations, they’re both notoriously difficult
for beginners to get started with and they both started
life as proprietary software within a commercial
setting before being open sourced after their
custodians experienced financial difficulty.
   In Synfig’s case, it’s taken almost 10 years to get
from proprietary beginnings to a 1.0 release, and while
development has sometimes been slow, its release is
a monumental achievement. But Blender and Synfig
are also very different. Synfig Studio is specifically
developed to generate 2D animations, as you’d find in
cartoons, rather than the 3D you now find in
everything from Jar Jar Binks to Jurassic World IV.
   In use, Synfig is much more like Inkscape than any
other application, and Inkscape even supports Synfig’s
file format. This is because it deals mostly with vector
                                                                                                                          Cairo is used as the
images. These are pictures that can be infinitely          speed of the animation. As a crude example, if you put
                                                                                                                          rendering engine, and
scaled because they’re constructed by joining points,      a circle at x=10 in the first keyframe and x=20 in the         complex views and
lines and curves together, just like fonts.                second, Synfig would move the circle across points             animations can take their
   Alongside the essential drawing tools for creating      x=11, 12… 18, 19 to complete the animation. Synfig             toll on your system.
various shapes, lines, curves and gradients, Synfig        enables you to define how you want this transition to
uses a timeline for plotting changes in these points       happen. Choosing ‘Ease in/out’, for instance, would
over time. Just like the timeline in Blender, Ardour or    accelerate and brake the animation rather than
Kdenlive, the timeline is used to map changes which        moving at a constant rate. And you can do this with
are played back as a cursor travels from left to right.    many other elements within an image too, such as an              DATA
                                                           object’s fill colour or the blend method.                        Web
Cross keys                                                    Getting to grips with all this potential is difficult. We     www.synfig.org
As with any modern animation studio, these changes         watched several excellent tutorial videos on YouTube             Developer
                                                                                                                            Robert B Quattlebaum
occur at points you create known as keyframes.             to get ourselves familiar with the application, and
                                                                                                                            Jr., Adrian Bentley &
Anything that changes between one keyframe and             these helped immensely. So too did the online help,              team.
the next will be interpolated, or tweened, to create       which includes some great tutorials to help you get              Licence
smooth transitions from one keyframe to the next.          started. If you’ve used Inkscape or even Gimp, the GUI           GPL
This helps the animator avoid having to create every       itself is fairly easy to understand. There are layers and
single frame, and can also aid in the generation of the    sets, where you group objects together such as with
animation by adding effects such as friction to the        an eye or an ear. We liked the sketch tool for mapping
                                                           out ideas without having to include them or remove
                                                           them for the final image and the timeline itself is
                                                           relatively straightforward.
                                                              Unless you know what you’re doing, things can get
                                                           out of hand. Images are made up of dozens of spline
                                                           points and vertices, all of which can be animated,
                                                           and it’s difficult to know where to start. However, this
                                                           shouldn’t put off potential animators, as it’s wonderful
                                                           having this kind of power in an open source tool.

                                                             LINUX VOICE VERDICT
                                                             More than a simple point-and-click
                                                             animator, this is a serious tool that
                                                             needs some skill to use.

There are plenty of export options, but no animated SVG.



                                                             www.linuxvoice.com                                                                     55
     REVIEWS BOOKS



We Are Anonymous
Ben Everard is anonymous… wait, no he’s not.


F
         or about a year, the hacking              (which come from interviews with the people
         collective known as Anonymous             involved, chat logs, and court records)
         made headline after headline in           portray a very different story than the one
newspapers around the world for their cyber        given by the media at the time.
insurgency. In We Are Anonymous, Parmy                Not everything was as it appeared.
Olson uncovers what went on behind the             Some of this is due to certain members of
scenes. Much of the action took place in IRC       anonymous deliberately trolling the news
chatrooms as people planned, coordinated           media at the time and feeding them false
and executed attacks on targets around the         stories, while other parts of this are just due
world, bringing online services to their knees.    to the full picture not being available to
   Olson follows some of the inner core of         anyone at that time.
Anonymous through from the early days to
the splinter groups such as LulzSec that           Anonymous claimed they don’t forgive and they
terrorised parts of the internet. She follows      don’t forget. Neither did the FBI.
them through message boards, public IRC,
and private IRC channels to discover what            LINUX VOICE VERDICT
really happened for the brief period when it         Author Parmy Olson
seemed that they had mastered the internet.          Publisher William Heinemann
   It’s a bittersweet tale of righteous anger,       Price £12.99
                                                     ISBN 978-0434022083
good-old-fashioned anarchism and petty
                                                     A revealing peek deep inside the secretive world
squabbles. Most of the protagonists are in           of the hacking collective.
jail now, so the truth can come out without
fear of repercussions. The details in the book




Qt 5 Blueprints
GTK or Qt? Ben Everard ponders the eternal question


Q
          t is one of the most important           explained. Perhaps the biggest problem with
          widget toolkits for Linux and            any book on Qt is the sheer size of the toolkit:
          cross platform development in            it would be impossible to cover everything. Qt
general. It runs on most desktop operating         5 Blueprints sticks to using just a few of the
systems and some mobile ones, and it’s             basic widgets, and trusts that once the user
easy to use once you’ve learned your way           fully understands those, they won’t have too
around the labyrinthine tree of classes            much difficulty picking up the others.
available to developers. In other words, it’s         This book is probably best suited to people
a really important graphical toolkit for any       with a little C++ experience, but not much
programmer to know.                                knowledge of GUI programming. After all,
   Qt 5 Blueprints is an easy introduction to Qt   Qt 5 is well documented, and experienced
for C++ programmers. You can use Qt 5 with         programmers will want something with
other languages, but you’ll be better served       more depth than this book.
by a different book, as this one is closely tied
to the language. The examples it gives are           LINUX VOICE VERDICT
straightforward, so you don’t need to be a           Author Symeon Huang
skilled C++ programmer to follow it, but you’ll      Publisher Packt Publishing
probably struggle to get the most out of the         Price £32.99
                                                     ISBN 978-1784394615
toolkit unless you’ve got a reasonable grasp
                                                     A gentle introduction to Qt for C++
of that language.                                    programmers.
   Huang does a good job of going through                                                               There are Qt bindings for many languages, but
his examples slowly, and everything is well                                                             Qt 5 Blueprints focuses on C++.



56                                                              www.linuxvoice.com
                                                                                                                      REVIEWS BOOKS


Learning PHP, MySQL, JavaScript…                                                                    ALSO RELEASED…
Graham Morrison finally gets beyond using <tables> for everything.



I
    f you’re just discovering how the
    World Wide Web works, you could
    be forgiven for thinking that web
development is no longer something a
beginner could get into. You could argue
that you’re better off learning WordPress or                                                                                      Even without
                                                                               If we’d typed the
a shiny and modern web framework.                                                                                                 snooping,
                                                                               title out in full,
However, we’d argue that it’s still worth                                                                                         there’s a lot of
                                                                               we’d have written
learning the basics.                                                                                                              information about
                                                                               half the review
                                                                                                                                  all of us online.
   This is a book that encapsulates what                                       already.
we’d describe as the basic technologies of                                                          Hacking Web Intelligence
the web, and it does it for the complete         to nothing about Linux. But what we liked          We love the idea behind this – delving into the
beginner, starting with programming              most is that it makes building your own            web to uncover data most of us don’t know
concepts and moving through PHP,                 dynamic website feasible, which is both            exists – something called open source
                                                                                                    intelligence and web reconnaissance. We’re off
MySQL and JavaScript before ending up            liberating and an important idea in itself.
                                                                                                    to find a black beret and a suitable location
with HTML 5. We like the way it builds up                                                           with internet in the Vercors Massif.
your skills, and while the book is                 LINUX VOICE VERDICT
undoubtedly large, it tackles so many core         Author Robin Nixon
technologies that each section is                  Publisher O’Reilly
manageable. If you get a taste for web             ISBN 978-1-491-94946-7
                                                   Price £33.50
development, you’ll certainly want to
                                                   A brilliant overview that gives you everything
augment what you learn here with more              you need to build an online empire.
specific titles. We’d also like to see
something on sysadmin, and there’s next
                                                                                                                                    Python’s quick
                                                                                                                                    style is perfect
                                                                                                                                    for test-driven
Functional Thinking                                                                                                                 development.

Never again will Graham Morrison mistake functional for functions.                                  Test-Driven Python Development
                                                                                                    Python has been a serious development tool



P
                                                                                                    for some time. This book will show you how to
         rogramming with a functional                                                               build a project around the test-driven
         language is now more popular                                                               development process, which Python is perfect
         than ever, but if you’ve been raised                                                       for as it revolves around short, testable
in a diet of procedural programming, as                                                             programming cycles.
most of us have, it’s a difficult concept
to grasp. Which is why we keep reading
books about it (see Becoming Functional in                                    At only 164
issue 9).                                                                     pages, it’s a
   Functional Thinking is a good attempt.                                     book that’s
Each chapter in this small book, is full of                                   quick to read.
practical examples, mostly pointing out
how terrible the procedural or object            mathematical background, putting                                                  Linux runs on
oriented approaches are by comparison.           functional languages in context. But                                              all the fastest
   There’s no single instance or page            most of all, for us, it’s also missing the                                        computers.
where we had a Eureka moment. But as             spirit of adventure.                                                              But it can still
you work through the chapters, the ideas                                                                                           go faster.
slowly percolate through your brain matter         LINUX VOICE VERDICT                              Power and Performance
until they do start to have an effect. This is     Author Neal Ford                                 If you take a look at our sysadmin section this
evident by our imagination working on              Publisher O’Reilly                               month (p68), you’ll see it tackles the complex
                                                   ISBN 978-1-4493-6551-6                           issues surrounding asynchronous networks
problems we’d previously solved
                                                   Price £26.60                                     and the many ways you can make mistakes or
procedurally. But it is hard work, and for us
                                                   A useful and persuasive resource, but too dry    improve things. Here’s a book to outline many
at least, not much fun – we enjoy hacking          for us, and not great value.                     of the other possible pitfalls and upgrades.
around with procedures too much. What
we imagine is missing is a more formal



                                                                 www.linuxvoice.com                                                                    57
     GROUP TEST FILE SYNC MANAGERS




      FILE SYNC      GROUP TEST
     MANAGERS Mayank Sharma likes his data to be nimble and omnipresent, and
                      is on the lookout for the ultimate data sync solution.



 On test                                                         File sync managers
                                                                 B
                                                                          ack before there was                 SD card with your vacation pics to
 Dropbox                                                                  Dropbox, the only practical          friends and family: it’s preposterous.
              URL www.dropbox.com                                         solution to sharing files was        In the same way, these services
              VERSION 3.4.3                                      to roll up your sleeves and configure         automatically sync the documents
              LICENCE Proprietary                                a file server. It wasn’t for the faint of     you’re working on, along with the
              The closed source segment leader faces             heart, especially if you wanted to            ebooks you’re reading and the
              stiff open source competition.
                                                                 share and sync beyond the                     music you’re listening, to the online
                                                                 confines of your local network. Not           storage spaces and make them
 Seafile                                                         only was the process an involved              available on across your devices.
              URL www.seafile.com                                one, it demanded a certain level of
              VERSION 4.0.6                                      expertise that you couldn’t expect            Privacy vs convenience
              LICENCE GPL v3                                     from an average desktop user. Then            In this group test we examine
              It doesn’t offer much free storage, but            Dropbox came along and made the               six top rated storage and sync
              could it impress with its features?                process idiot-proof. Suddenly                 solutions that make data
                                                                 sharing files and syncing them                omnipresent. Broadly speaking, you
 SparkleShare                                                    between computers and devices
                                                                 became a no-brainer.
                                                                                                               can divide these services into two
                                                                                                               categories. On the one hand we
              URL www.sparkleshare.org
                                                                    Dropbox ushered in an era of               have proprietary services that keep
              VERSION 1.4.0
              LICENCE GPL v3                                     cloud storage and sync services. It           the data on remote storage servers
              Will it be able to cash in on the popularity       makes even more sense in these                outside your and control. For the
              of its Git underpinnings?                          days of universal access when                 privacy conscious, we also have
                                                                 everyone owns multiple computing              open source services that offer all
                                                                 devices of all shapes and sizes and           the convenience of an omnipresent
 BitTorrent Sync                                                 they’re all hooked up to the internet.        storage service, while keeping
              URL www.getsync.com                                   Shuttling around data on USB               the data within the confines of
              VERSION 2.0.82                                     drives as you move from the                   your firewall. Can the self-hosted
              LICENCE Proprietary
                                                                 computer to the tablet makes about            solutions match the convenience of
              Does this serverless tool have an edge
                                                                 as much sense as snail mailing an             an online storage service?
              over the others?


 OwnCloud                                                        “These services automatically sync your
              URL https://owncloud.org                           documents, ebooks, music and more.”
              VERSION 8.0.2
              LICENCE AGPL v3
              It’s going from strength to strength, but            Cloud host vs self host
              how does it match up to its peers?
                                                                   We’re testing two types of services in      may expose your potentially sensitive
                                                                   this group test, both of which have their   data to risk. Also, most of the
 SpiderOak                                                         advantages and disadvantages that you       proprietary services have price-bound
                                                                   should be aware of before homing in on      features and storage space restrictions.
              URL https://spideroak.com
                                                                   one. The biggest advantage of cloud         The extra effort required to set up your
              VERSION 5.2.0
                                                                   storage services like Dropbox is the        own storage server eliminates both
              LICENCE Proprietary                                  convenience of a quick rollout. However,    these factors. Furthermore, it ensures
              Proprietary service known for its                    on the downside you have to agree to        full privacy and mitigates the risk of
              privacy-respecting features.                         their terms for hosting your data, which    unexpected downtime.




58                                                           www.linuxvoice.com
                                                                                        FILE SYNC MANAGERS GROUP TEST



Outside the network
Access your personal cloud from the internet.


B
        y default self-hosted solutions like      firewall. Or, you can set up Dynamic DNS in           individuals. Fire up a terminal and install
        OwnCloud and Seafile will only be         your router or local machine.                         PageKite with
        accessible from computers and                The smarter way though is to use a                 curl -s https://pagekite.net/pk/ | sudo bash
devices within the local network; you don’t       tunnelling service such as PageKite. The                Assuming your cloud server is running on
get the benefit of connecting from                service uses a pay-what-you-want model.               port 8000, make it public with
anywhere, as you do with Dropbox.                 As a non-commercial user, you can use the             pagekite.py 8000 mycloudserver.pagekite.me
  But that’s not to say that you can’t access     service for free by filling out a form once             That’s it. Your private server is
your private cloud from the internet. One         a month, telling PageKit how you use the              now publicly accessible on https://
solution is to get a static IP address from       service, but it’s definitely worth more than          mycloudserver.pagekite.me. Remember to
your ISP and then poke holes in your router’s     the $3/month minimum they request from                replace ‘mycloudserver’ with any name.




Seafile
Splash and dash.

S
        eafile is an open source solution that
        works pretty much like Dropbox and
        offers two rollout options. If you want
the convenient option, you can download a
client and set it up to sync across either of
the two online storage servers -- one in
Germany and one in the US -- that offer 1GB
of free storage space. The other option is to
set up a Seafile server within your firewall
and extend the same sync facilities as any
other cloud sync service.
   Setting up a Seafile server doesn’t
take much effort. While the process is            Regularly check the integrity of your file using the included fsck tool.
well documented it obviously requires
a familiarity with configuring network-           group can have a public discussion with               share single documents with another user.
based software. For small installations,          each other.                                           Members can upload, download and edit
you can deploy Seafile with the SQLite               Seafile offers flexible options to share           files online or even download the whole
database, while larger setups can use full-       these libraries with other users, who can             libraries from the cloud.
fledged databases like MariaDB, MySQL or          hook to the server via the Seafile clients.              The Seafile client doesn’t integrate with
PostgreSQL. The detailed manual also has          Seafile has clients for all the popular               the file manager, but you can use it to share
instructions on hooking it up with existing       desktop and mobile platforms, though the              a folder on the desktop by uploading its
web servers, including Nginx and Apache.          Seafile client for Linux is only available as         contents into a shared library. You can also
   Seafile also lets users collaborate            precompiled Debs, so you’ll have to rely on           use it to create new libraries and download
on documents, which is a very handy               external repositories for RPMs. Every Seafile         existing ones, and keep tabs on the file
feature. New versions of documents                desktop client has a unique private key.              transfers.
are automatically generated after each            When a client and a server connect, they                 Also, the service has a flexible version
modification, and you can easily switch to        exchange the public key and negotiate a               control system that lets you browse the
an older version without much effort.             session key. This session key is then used to         history of a file and restore the file content
                                                  encrypt the data transfer.                            to an old version. By default, Seafile will
Easy to manage                                       The service offers flexible options to             preserve the entire history of a file. However,
You can use Seafile to create libraries that      share libraries or individual files with users        you do have the option to specify a period of
can optionally be encrypted with AES-256,         or groups of users. You can also transfer             time for preserving old files per library.
and then add files to them. You can add           ownership to other registered users and
users and organise them into groups and           even allow them to create libraries. The
share libraries with groups, and enable the       service gives you the option to share a                VERDICT
                                                                                                         A well rounded solution
optional wiki module to enable users to           library with specific contacts or groups of            with features to impress
collaborate on a wiki. Additionally, users can    users and enable read-write or read-only               all kinds of users.
also message each other and members of a          access to different libraries. You can even



                                                               www.linuxvoice.com                                                                      59
     GROUP TEST FILE SYNC MANAGERS


SparkleShare
Not much glitter.


J
        ust like with Dropbox and Seafile,   add-ons. Also, unlike other services,
        SparkleShare offers the option to    SparkleShare doesn’t have a web-based
        sync via protected storage           interface and all the administration
spaces or set up your own                    tasks must be done from the CLI.
SparkleShare server.                            The service has a desktop client
   When you create a project,                that can be used to connect to a
SparkleShare displays the SSH address        SparkleShare and displays notifications
of the host and the location to the          about the sync tasks as well as lists
shared directory. The service houses         changes across all shared directories.
all shared directories inside the /home/        Since it’s based on Git, SparkleShare
storage user directory, which it creates     has version control built-in. Using
during installation.                         the tool, you can share some of your         The SparkleShare client can connect to the host as well as
   You can install SparkleShare clients      projects with other users, while keeping     to other hosting sites, including GitHub and Bitbucket.
from your distro’s repository or compile     others private. However, unlike other
it yourself, following instructions on the   options you can’t share files with links.                   SparkleShare isn’t great for storing
website. To hook up these clients to the     Also while the file transfers and sync                      photo or music collections and large
SparkleShare host, you’ll need to know       worked as advertised in our tests, the                      binary files that change often, such as
the host’s public SSH key and location,      developers themselves admit that                            video editing projects, which would rule
which was displayed earlier when you                                                                     it out for most desktop users.
created the share.
   Unlike some of the other services on      “Since it’s based on Git,                                     VERDICT
test, SparkleShare is a pure file sharing    SparkleShare has version                                      It’ll appeal to developers


                                             control built-in.”
                                                                                                           but isn’t as complete as
service that doesn’t offer any other                                                                       some other solutions.
features and facilities even as optional




BitTorrent Sync
Peer-to-peer version 2.


B
         itTorrent Sync is the proprietary   the option to limit access permissions.
         decentralised file-sharing          The service encrypts all traffic using
         service from the developers of      a private key derived from the shared
the popular peer-to-peer file sharing        secret key.
technology. The USP of the service is
that it employs no server and the files      Keep it simple
are securely transferred between users.      The service offers no add-ons and is a
This makes BitTorrent Sync one of the        pure file sharing and sync service. Also
easiest services to get started with.        it isn’t quite as easy as some of the
   The service has clients for all the       other services on test for some tasks
popular platforms, however, the              such as backups. Plus, if you want to
Linux flavour is web-based. There is         share files with other people, they’ll       You can freely test the £26/year Pro service which offers
no installation involved and you just        need to install the BitTorrent Sync client   more granularity to folder syncing.
download, extract and run the server.        and equip it with the code for the folder
Then head to its web interface and           you wish to share.                                          two versions. The Free version lets you
create an admin user. You can then               To simplify the process, the service                    share up to 10 folders, while the paid
add folders that you want to sync. Each      lets you generate links for sharing.                        Pro version offers advanced features
folder has a unique key that must be         You can set expiration times for the                        such as on-demand access and folder-
passed on to any other device that you       links you create so that the link is only                   level access control.
wish to sync with. You can email the         active for a specific length of time.
key as text or scan a QR code if you’re      You can also optionally configure the                         VERDICT
                                                                                                           Interesting solution but
setting up sync on the mobile version        service to notify you when a link is                          requires everyone to use
of the service. While creating a key to      clicked and you can approve and deny                          the client.
share a folder, the service gives you        access accordingly. The service has



60                                                            www.linuxvoice.com
                                                                                        FILE SYNC MANAGERS GROUP TEST


Owncloud                                                                                          Other options
Overcast forecast.                                                                                Sync clients of all shapes
                                                                                                  and sizes.

                                                                                                  I
                                                                                                       f you don’t have any issues keeping the
                                                                                                       data you want to sync in a drive on the
                                                                                                       other side of the planet, you can use any of
                                                                                                  the cloud storage services that suit your
                                                                                                  budget. Almost every cloud storage service
                                                                                                  now supports Linux, so you have plenty of
                                                                                                  options, including CloudMe and Mega.
                                                                                                     The geekier ones can use the venerable
                                                                                                  command-line rsync utility or its graphical
                                                                                                  cousin LuckyBackup (as seen in LV015’s
                                                                                                  Masterclass). Both are wonderful tools for
                                                                                                  backing up data and keep folders in sync
                                                                                                  across machines but lack features such as the
                                                                                                  ability to share files with links.
                                                                                                     There’s also Syncthing, which is often
OwnCloud also has an impressive browser-based interface and a file manager that can handle        described as the open source alternative to
files in most popular formats.                                                                    BitTorrent Sync. Syncthing is well designed
                                                                                                  with security and privacy in mind and works



O
         wnCloud is perhaps the most              old versions). Another advantage that we        across all major platforms. Setting it up is
         popular DIY storage and sync             like is that OwnCloud lets you mount            similar to the process used with BitTorrent
         solution on test here. You can           external cloud storage drives, such as          Sync, and the services uses a global discovery
manually install the OwnCloud server on           Google Drive, Amazon S3, Dropbox, and           server to connect clients anywhere on the
your machine or from the official                 OpenStack Swift, and can seamlessly             internet. However, it didn’t always work during
repositories for popular distributions.           manage data on these along with that in         our tests and we also had trouble connecting
Installing the server is straightforward and      your private cloud.                             a PC to the alpha Android client.
well documented. Just like Seafile, by               OwnCloud’s impressive desktop client
default, OwnCloud uses the SQLite                 displays notifications, shows you a             The cloud at home
database and the Apache web server, but           summary of sync activity, and offers the        Another option for the more hands-on among
it can plug in to an existing MySQL               ability to throttle upload and download         us is to set up a NAS (Network Attached
database and will also work with other            bandwidth, and pause and resume                 Storage) that offers syncing facilities. One of
web servers, including Nginx and Lighttpd.        transfers. The client also lets you add local   the easiest options if you go down this path
   Owncloud’s biggest feature is its              folders and specify patterns for files or       is the proprietary freeware Tonido software.
extensibility. It’s much more than a file         directories that shouldn’t be synced.           Unlike other synchronisation tools, Tonido
storage and sync server. It ships with a             If you have a large group of users,          doesn’t store the data on its public cloud and
photo gallery app, uses Ampache for               OwnCloud will impress you with its user         only relays it through Tonido’s servers.
music streaming and has a web-based               management options. While adding users             Then there’s the open source
PDF viewer and ODF viewer.                        in OwnCloud, you can restrict their storage     OpenMediaVault distro, which has plugins
   There’s also a task scheduler, an online       space and organise them into different          to sync data to USB drives. You can even
text editor, and an app to store                  groups. You can share your admin                configure something like BitTorrent Sync to
bookmarks. Plus, you can download other           responsibilities with other users and make      sync data from your NAS.
apps from its app store. It hosts                 certain users group admins, and can
productivity tools such as a                      select which users or groups you want to
URL shortener and the Roundcube mail              share files with and whether you want to
server, multimedia tools such as the              give them permission to modify the files.
JW Player-based video player, and tools to        You can share an item with someone who
visualise storage space and scan files            isn’t on your OwnCloud server by sharing
with the ClamAV virus scanner.                    a URL to that file on your server. You can
                                                  also password-protect the link and set an
All encompassing                                  expiration date.
You can use OwnCloud to create
encrypted storage spaces, and the server           VERDICT
                                                   The most comprehensive
also keeps tracks of all versions of files. Its    storage and sync server                        Syncthing is shaping up to be a very useful and
versioning mechanism ensures you never             on test here.                                  apt replacement for BitTorrent Sync.
run out of space (by automatically deleting



                                                                  www.linuxvoice.com                                                                61
     GROUP TEST FILE SYNC MANAGERS


Dropbox vs SpiderOak
The proprietary behemoths.


D
         ropbox is one of the most
         widely used storage and sync
         services. It has clients for all the
major operating systems and offers
2GB of free storage space with paid
plans starting at $10/month for 1TB.
The service creates a ~/Dropbox folder
under your home directory, and any files
you drop here and automatically
synced to the online Dropbox account
and from there to all the devices
connected to your Dropbox account.
   The service installs a system tray
icon with which you can keep track
of the syncing status and view a list
of recently changed files. The icon
also lets you change your Dropbox
preferences, including the location             The Dropbox client only supports a limited number of Linux desktops.
of the synced Dropbox folder, and
network settings. You can also use it              Dropbox has partnered with                               It encrypts data before uploading it, and
to configure Dropbox’s selective sync           Microsoft to enable you to edit any                         does so without missing out on
feature to only sync a selection of             Microsoft Office documents in your                          advanced features such as versioning.
folders to your computer.                       Dropbox from within your web browser.                       The service also implements data
   Unlike other similar services, Dropbox       Dropbox keeps multiple versions of all                      deduplication to minimise the drain on
has only a minimal client for Linux, and        files and from its web interface you can                    bandwidth and also save storage
even that client officially only supports       view several versions of deleted files                      space. The service offers 2GB of free
Gnome’s Nautilus file manager. Using            and easily restore the one you want.                        storage space and has plans starting at
the right-click context menu you can                                                                        $7/month for 30GB.
move any folder on your computer to             Rich oaky flavour                                              Unlike Dropbox, SpiderOak can be
the Dropbox folder. Once inside the             The other proprietary service,                              used to back up the contents of any
Dropbox folder, you can use the context         SpiderOak, has crafted a name for itself                    folder on your computer and even
menu to share them with links and view          with its impressive list of features and                    external and network drives. The
older versions of the file.                     its focus on ensuring its users’ privacy.                   service has an advanced filtering
                                                                                                            mechanism, and you can use wildcards
                                                                                                            to exclude particular files and folders
                                                                                                            from the backup. Furthermore, instead
                                                                                                            of sharing single files, SpiderOak lets
                                                                                                            you arrange the files in your SpiderOak
                                                                                                            account that you wish to share inside
                                                                                                            virtual silos known as ShareRooms.
                                                                                                            Every ShareRoom has a unique
                                                                                                            URL that enables recipients to view
                                                                                                            and download its contents. You can
                                                                                                            optionally password-protect these
                                                                                                            virtual storage areas as well.
                                                                                                               To top it all, SpiderOak’s interface lets
                                                                                                            you keep an eye on all ongoing tasks
                                                                                                            as well as the current downloading and
                                                                                                            uploading queue, and much more.

                                                                                                              VERDICT
                                                                                                              DROPBOX Doesn’t          SPIDEROAK Simple to
                                                                                                              offer any feature that   set up with impressive
                                                                                                              you can’t get            privacy protection
                                                                                                              elsewhere.               measures.

SpiderOak’s client offers complete control over all aspects of the service.



62                                                                www.linuxvoice.com
                                                                                            FILE SYNC MANAGERS GROUP TEST




  OUR VERDICT
File sync managers
I
     f you want a solution that’s full    unsuitable for other tasks such as
     of features and can do a lot         backups. Other factors that tick us            You can demo Seafile on its website before deploying it.
     more than just sync files, there’s   off are the fact that it’s a proprietary
no beating OwnCloud – we use it at
Linux Voice to share documents,
                                          client that you should have on all
                                          your devices to sync and share –
                                                                                          1st Seafile
                                                                                          Licence GPL v3 Version 4.0.6
and it works brilliantly for our needs.   we’ll always choose the best tool
But the purpose of the group test is      for the job, but the idea of becoming           www.seafile.com
to find a tool that primarily syncs       reliant on a proprietary solution               The right mix of features and usability.
files and offers related                  makes us a little uncomfortable.
conveniences. With that criterion,           Of the two proprietary clients               2nd SpiderOak
OwnCloud is overkill, and despite         on test, we were surprised by                   Licence Proprietary Version 5.2.0
being fans we can’t get ourselves to      SpiderOak. It’s well designed and
recommend it to users who are             takes steps to ensure our privacy. If           https://spideroak.com
looking for a simple solution to keep     you don’t mind offloading your data             For convenience seekers who aren’t averse to proprietary
                                                                                          software.
data between their devices in sync.       to the cloud for a price, take your
   The problem with SparkleShare          business to SpiderOak.
is its involved process, which might         This leaves us with Seafile,                 3rd BitTorrent Sync
                                                                                          Licence Proprietary Version 2.0.82
“Seafile offers advanced features such                                                    www.getsync.com
as client-side encryption.”                                                               The ideal solution for easily syncing files, but closed source.


not be very intuitive to new users.       which aces this test. For the extra             4th Owncloud
Also, it involves finding a way to        configuration steps it requires                 Licence AGPL v3 Version 8.0.2
securely transfer the public SSH          you to undertake, Seafile offers                https://owncloud.org
keys between the host and the             more than enough features to                    Feature-rich software that’s probably overkill for simply syncing
client. Then there’s the fact that        compensate, such as client-side                 and sharing.
the developers have themselves            encryption. It offers you all the
admitted that SparkleShare isn’t
really suitable for storing images
                                          advantages you get with other
                                          services, such as an extensive
                                                                                          5th SparkleShare
                                                                                          Licence GPL v3 Version 1.4.0
and audio nor for large binary            file-revision history and the ability
files that change often. On top of        to selectively share files with links.          www.sparkleshare.org
that the developers have put the          You can deploy Seafile for personal             Loses out because of its geeky bent and lack of mobile clients.
development of the Android client         use or easily scale it up as a
on hold, which undermines the             collaboration server for a whole lot            6th Dropbox
benefit of being able to sync all your    of users.                                       Licence Proprietary Version 3.4.3
files across all of your devices.            All factors considered, Seafile is
   BitTorrent Sync loses out for          a robust file synchronisation tool              www.dropbox.com
being entirely focussed on one            that’ll meet the expectations of the            This is 2015 and we know better.
task – to sync files. This makes it       greatest number of users.

                         Self-hosted      Cloud server      Sync files      Share files          Back up data         Add-ons              Mobile client
  OwnCloud                     Y                N                Y                   Y                  Y                    Y                    Y
  Seafile                      Y                Y                Y                   Y                  Y                    Y                    Y
  SparkleShare                 Y                Y                Y                   Y                  N                    N                    N
  BitTorrent Sync              Y                N                Y                   N                  N                    N                    Y
  Dropbox                      N                Y                Y                   Y                  N                    N                    Y
  SpiderOak                    N                Y                Y                   Y                  Y                    N                    Y



                                                                www.linuxvoice.com                                                                          63
64
65
     SUBSCRIBE




SUBSCRIBE              shop.linuxvoice.com
                                                                        Get your regular dose
                                                                        of Linux Voice, the
                                                                        magazine that:
                                                                          Gives 50% of its profits
                                                                        back to Free Software
                                                                          Licenses its content
                                                                        CC BY-SA within 9 months
                     SUBSCRIBE TO

                                                                          UK subs prices
                     TODAY!                                               12-month print & digital: £55
                                                                          12-month digital only: £38


         Get 114 pages                                     Access our                                         Save money on
          of tutorials,                                  rapidly growing                                       the shop price
      features, interviews                            back-issues archive                                    and get each issue
          and reviews                                 – all DRM-free and                                        delivered to
          every month                                  ready to download                                         your door

               Payment is in Pounds Sterling. 12-month subscribers will receive 12 issues of Linux Voice a year. 7-month
            subscribers will receive 7 issue of Linux Voice. If you are dissatisfied in any way you can write to us to cancel your
                      subscription at subscriptions@linuxvoice.com and we will refund you for all unmailed issues.



66                                                         www.linuxvoice.com
                                                                       SUBSCRIBE


                                All subscribers get access to every
                                single digital back issue –
                                that’s about 1,000,000 words of
                                tutorials, reviews and free software
                                hackery at your fingertips




Overseas subs prices
12-month print & digital:
Europe: £85
US/Canada: £95
Rest of world: £99                               DIGITAL
                                                 SUBSCRIPTION*
                                                 ONLY
                                                  *
                                                      £38
                                                    WHEREVER IN THE WORLD YOU
                                                  ARE – IT’S DIGITAL, SO THERE ARE
                                                         NO POSTAGE COSTS


                            www.linuxvoice.com                                       67
      CORETECHNOLOGY




                                  CORE
Valentine Sinitsyn develops
high-loaded services and
teaches students completely
unrelated subjects. He also has
a KDE developer account that
                                  TECHNOLOGY
he’s never really used.           Prise the back off Linux and find out what really makes it tick.

Asynchronous network programming
You know what a network socket is. Now, let’s learn how to juggle with thousands of them.


C
        omputers are meant to compute. But                (say, Asterisk) happily follow this route.         mechanism is probably the select(2)
        quite often programs just pump                    However, you won’t build the next Twitter          system call. It’s been present in Unix since
        loads of data from here to there and              this way. And this is where asynchronous           4.2BSD (circa 1983). select(2) receives
back again without incurring much CPU                     I/O comes into play.                               three sets of file descriptors: the first
load. This is known as an I/O-bound task,                     The idea is to do multiplexing yourself:       one is monitored for read availability, the
and there are several ways to do it in Linux.             while your code is waiting for A to reply, it      second for write availability, and the third is
The simplest way is to block I/O. Traditional             can serve B and C. Asynchronous code is            watched for errors. Each set is represented
read(2) and write(2) system calls are                     usually built around an event loop concept:        as a bitmask. When you call select(2), it
blocking, and the socket samples from                     first, it checks if there are any requests ready   blocks until either event you are waiting for
LV006’s Core Tech (www.linuxvoice.com/                    to read, and processes them. Then it checks        occurs or timeout fires, or the process is
core-technology-6) and LV007 were                         if it can write any responses. Finally, if there   interrupted with a signal (as we looked at
blocking as well.                                         are no more items to handle, the process is        in LV011). With pselect(2) you have greater
  In blocking I/O, the operating system                   put to sleep until some event (or timeout)         control over signals, but we won’t cover this
multiplexes data coming from various                      occurs. Unix systems provide various ways          variation here.
sources for you. It’s easy but not very                   to do asynchronous I/O. They have different           A typical select(2)-based event loop may
scalable. To handle N simultaneous client                 scalability characteristics, and here we’ll        look like this:
connections, you’ll need roughly N OS-level               cover three that are most important for            #include <sys/select.h>
processes or threads (internally, both are                Linux.                                             int main() {
just “tasks” in Linux). A typical server can                                                                  fd_set rfds;
handle up to several hundred threads. This                You are selected                                    int fds[NUM_FD];
may be enough already, and some services                  The most traditional multiplexing                   struct timeval tv;
                                                                                                              int i, retval, max_fd = -1, done = 0;


                                                                                                              /* Fill fds[] with file descriptors */
                                fd_set
                                                                                                              while (!done) {
     0       1                    4               7       8
                                                                                                               FD_ZERO(&rfds);
         0       0     0      0     1    0    0       0    ...
                                                                                                               max_fd = -1;
                                                                         0     struct file                     for (i = 0; i < NUM_FD; i++) {
                                                                         1     struct file                       FD_SET(fds[i], &rfds);
                                                                         2     struct file                       if (fds[i] > max_fd)
                                                                         3                                         max_fd = fds[i];
                                                                         4     struct file                     }
                                                                                                               tv.tv_sec = 3;
                                                                         5
                                             fd = 4                                                            tv.tv_usec = 0;
                                                                         6
                                                                         7
                                                                                                               retval = select(max_fd + 1, &rfds, NULL, NULL,
                                                                         8     ...
                                                                                                             &tv);
                                                                                                               if (retval > 0) {
                                                                                                                 for (i = 0; i < max_fd + 1; i++)
This is how fd_set, the file descriptor (fd) and struct file relate to one another. Bit 4 is set, so              if (FD_ISSET(i, &rfds)) {
select(2) uses the struct file’s poll() method to check if fd 4 is ready                                            /* Data has come, handle it */



68                                                                    www.linuxvoice.com
                                                                                                                                   CORETECHNOLOGY

        }
     } else if (retval == 0) {
       /* Timeout happened */
     } else {
       /* Error occurred */
     }
    }
    return 0;
}
The lines beginning FD_ are macros to deal
with file descriptor sets. If a bit number N is
raised (set to1) in fd_set, select(2) watches
for the file descriptor number N.
    We start with clearing the bitmask with
FD_ZERO() and setting bits corresponding
to fds[i] with FD_SET(). Then we call
select(), which returns -1 on failure or
number of ready file descriptors on success.
In the latter case, we check for descriptors
having events with FD_ISSET(), and handle
data. Here, we focus solely on readability, but
it is readily extensible to a real-world case.             Both tmux and screen are similar, but the more recent tmux uses poll(2) via libevent, while the
Returning a value of zero means timeout                    older screen relies on select(2).
(tv, which is three seconds here). We also
pass select(2), the highest file descriptor                event loop. It’s fatal, as select(2) won’t be          across veteran Unix system that lacks it.
number in the set. Note that we have to                    called again, and we’ll miss events on all             For Linux, it doesn’t matter: both poll(2) and
recreate arguments at every loop iteration                 file descriptors. In other words, one client           select(2) are supported, and both are in
as select(2) overwrites them, including tv.                will ban all others, effectively making a DoS          POSIX 1003.1g standard. Unlike select(2),
    select(2) is “level-triggered”. This term              attack on our server.                                  poll(2) accepts an array of struct pollfd
is attributed to BSDCON 2000 presenter                                                                            items that can be as small or as large as you
Jonathan Lemon, and comes from the                         Flexible fishing                                       need. Without initialisation, the rest of the
design of hardware interrupts. It means that               select(2) has one limitation you’ve probably           usage is similar:
the system call will signal readiness for a                already spotted. Bitmasks are not very                 #include <poll.h>
file descriptor as long as it will be readable,            flexible data structures, and they have a              int main(int *fds) {
not when it starts to be readable for the first            hard-coded maximum length (typically                    struct pollfd pfds[NUM_FD];
time. The alternative design to this is known              1024 bits). This means file descriptors                 int i, retval, done = 0;
as “edge-triggered”.                                       having numbers of 1024 and greater can’t                int timeout_msec = 3000;
    It’s important to make file descriptors                be watched, which may pose problems to                  int fds[NUM_FD];
non-blocking with fcntl(fds, F_SETFL,                      long-running daemon processes. Moreover,
O_NONBLOCK) or similar before starting                     fd_set can’t have any gaps. So, if you’re                  /* Fill fds[] with file descriptors */
the event loop. The reason is that readiness               interested in a single file descriptor number              for (i = 0; i < NUM_FD; i++) {
signalled from select(2) is only a hint from               1023, you waste more than thousand bits.                     pfds[i].fd = fds[i];
the kernel, not a strong guarantee. Another                It’s not only memory space that’s wasted,                    pfds[i].events = POLLIN;
process can get in and read the data before                however. select(2) will also need to loop                  }
we have the chance to do it, for instance. If              through the whole mask just to see that all
you’re interested in how the file descriptor               bits but the last one are not set. This is not             while (!done) {
can make its way into a separate process,                  good for performance either.                                 retval = poll(pfds, NUM_FD, timeout_msec);
see Core Technology in LV015. In this                          poll(2) is a more flexible alternative. It’s             if (ret_val > 0) {
case, a call to read(2) will block a whole                 younger than select(2) so you can come                         for (i = 0; i < NUM_FD; i++) {
                                                                                                                           if (pfds[i].revents & POLLIN) {
                                                                                                                             /* Data has come, handle it */
     Flying higher                                                                                                                  }
     Being system calls, select(2), poll(2) and epoll(7)   C++ libraries that do this job, but libevent and             } else if (retval == 0) {
     are among the lowest-level mechanisms you can         libev are arguably most popular. Both provide                  /* Timeout happened */
     get in Linux. The last one is also OS-dependent: it   a platform-independent event loop API that is                } else {
     won’t work in FreeBSD or Solaris, not to mention      callback-based. You assign C functions that act as
                                                                                                                          /* Error occurred */
     Microsoft Windows.                                    callbacks to events, you start the event loop, and
        If you think it would be good to have some         the library does the rest. This way, you get all the         }
     way to abstract these differences and low-level       benefits of asynchronous I/O without having to             }
     complexity, you’re not alone. There are several C/    bother with platform details.                              return 0;
                                                                                                                  }



                                                                         www.linuxvoice.com                                                                          69
     CORETECHNOLOGY

                                                                                                      the process is resumed. For poll(2) and
                                                                                                      select(2) it’s the same and quite simple,
                                                                                                      but epoll(7) registers its own sophisticated
                                                                                                      callback. The process fishing for events
                                                                                                      with epoll(7) is added to two wait queues.
                                                                                                      One is per-file descriptor watched, like in
                                                                                                      poll(2) or select(2), and another is per epoll
                                                                                                      instance. When the kernel detects activity
                                                                                                      on a watched file descriptor, it calls ep_
                                                                                                      poll_callback(), which adds the descriptor
                                                                                                      to a so-called “ready-list” and wakes up
                                                                                                      the process sleeping on the epoll instance
                                                                                                      queue. Then the ready-list is scanned, and
                                                                                                      if there is anything of interest to userspace,
                                                                                                      the syscall returns. Otherwise, the process is
                                                                                                      put to sleep again.
Twisted is an old but very powerful way to do asynchronous network programming in Python.                 Note that this never requires the
                                                                                                      kernel code to loop over the whole file
   Each struct pollfd contains the file            operations is poll(): usually, it adds a calling   descriptor set. It only scans the ready-list,
descriptor (fd) to watch and the bitmask           process to the wait queue and returns the          which requires O(NumReady) steps, with
of events to wait for (events). Events are         bitmask representing the current struct            NumReady being the number of descriptors
described with flags like POLLIN (data             file state.                                        ready. Under the assumption that it doesn’t
can be read), POLLOUT (the descriptor is               select(2) and poll(2) call f_op->poll()        depend on how many descriptors you watch
writable) or POLLERR (error occurs). On            for each descriptor in the set, and return         (which sounds reasonable), this yields ‘O(1)’
output, revents will contain the events            if there is anything ready. Otherwise, the         performance. select(2) and poll(2) are just
occurred. As with select(2), on success the        process is put to sleep (syscall blocks) until     multiplexers, whereas epoll(7) is event-
number of file descriptors ready is returned.      another part of the kernel (like the network       driven. Moreover, in epoll(7), the in-kernel
Zero means timeout and -1 signifies an             subsystem in the case of a socket) detects         representation of the descriptor set and
error (errno stores the details, as usual). The    activity on the file or a timeout elapses.         related data structures are preserved across
timeout value is passed to poll(2) as a plain      When the process wakes up, the syscall             system calls, thus reducing setup and
number of milliseconds; -1 means infinity          resumes and once again loops over the              teardown costs per each call.
and 0 forces poll(2) to return immediately.        entire descriptor set checking for events,
This is not what you usually want, but it’s        as it has no idea what caused the wakeup.          Event loop revisited
useful for “peeking”, event loop integration       If there were any events the caller wants          Now, when we understand how the whole
and other hardcore stuff.                          to know, control is returned to userspace.         thing works, let’s learn how to use it.
   Having a flexible array instead of a fixed-     Otherwise the process sleeps again. As each        Compared to poll(2) or select(2), epoll(7) is
size bitmask is certainly a step forward.          file descriptor takes about the same time to       not a single system call but a set of three.
However, both select(2) and poll(2) suffer         handle, the overall loop time grows linearly       The first one, epoll_create(2), creates an
the same scalability issue. Namely, their          with the descriptor set’s size.                    epoll file descriptor (epoll_fd), which is
time complexity is about ‘O(N)’ where N is             In high-loaded services, ‘O(N)’ behaviour      basically a handle for the in-kernel epoll
the number of file descriptors watched. This       is not what you want, as it puts a limit on        instance. When the last process closes
means that the time needed to poll() a file        how many concurrent connections you can            epoll_fd, the epoll instance is also freed.
descriptor set is proportional to its size. It’s   handle. Another mechanism is required,             Then, epoll_ctl(2) is the way to add and
a challenge for high-loaded services, known        and it comes in many OS-specific forms.            remove file descriptors or otherwise modify
as the “C10k problem”, and you can find a          FreeBSD has kqueue, Solaris offers /dev/           the file descriptor set. Finally, epoll_wait(2) is
good overview of it here: www.kegel.com/           poll. In Linux, we have epoll(7). Originally,      what you call to fish for events.
c10k.html.                                         it was also implemented as /dev/epoll                 This is what a typical epoll(7)-based event
                                                   in the Solaris spirit, but Linus banned the        loop (without most of the error checking)
Down to the kernel                                 idea so it was rewritten as a set of system        may look like:
To understand why select(2) and poll(2)            calls, similar to FreeBSD’s. The best thing
behave this way, we’ll need to learn how           about epoll(7) is that it allows for ‘O(1)’s       #include <sys/epoll.h>
they are implemented at kernel level. In           performance. This means it runs roughly            #include <unistd.h>
Linux, each open file has a corresponding          the same length of time regardless what            int do_epoll(int *fds) {
struct file instance in kernel space, and          the size of descriptor set is. We’ll show you       struct epoll_event ev, events[NUM_FD];
a file descriptor is basically an index into       some examples shortly, but let’s discuss            int i, retval, done = 0;
an array of these objects. This structure          how epoll(7) achieves this result first.            int timeout_msec = 3000;
provides file operations (f_op) whose actual           The key to epoll(7)’s scalability is clever     int fds[NUM_FD];
implementation depend on whether the               use of callbacks and a bit of indirection. Wait     int epoll_fd;
descriptor in question is for a socket, a pipe,    queues in the kernel have an associated
an on-disk file or anything else. One of these     callback function, which is called when             /* Fill fds[] with file descriptors */



70                                                             www.linuxvoice.com
                                                                                                                            CORETECHNOLOGY

 epoll_fd = epoll_create(NUM_FD);
                                                        Isn’t everything a file already?
 for (i = 0; i < NUM_FD; i++) {                         If all you have is a hammer, everything looks like     as coming from the same family, as they share a
   ev.events = EPOLLIN | EPOLLET;                       a nail. If your program is built around an event       common suffix: fd. Their names are signalfd(2),
   ev.data.fd = fds[i];                                 loop, it’s very convenient to have every input as a    timerfd, and eventfd(2). The first one delivers Unix
   epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fds[i], &ev);     pollable file descriptor.                              signals, the second is for timers and the third is
                                                            Luckily, almost everything in Linux is already     suitable for posting application-level events or as
 }
                                                        a file. Signals are notable exceptions here, but       an IPC mechanism (see LV015). It can also serve
                                                        Linux has several mechanisms that can come to          as an event channel between userspace and the
  while (!done) {                                       the rescue. They appeared first in kernel 2.6.22,      kernel. For instance, it is the mechanism QEMU
    retval = epoll_wait(epoll_fd, events, NUM_FD,       and are very similar in their operation. You are       and KVM use for bi-directional notifications. It is
timeout_msec);                                          given a way to obtain a special file descriptor that   also employed in high-speed kernel-space device
                                                        becomes readable when some event occurs. This          emulation (the VHost and VFIO subsystems).
    if (retval > 0) {
                                                        can be a signal delivered to your process, a timer        Consult the corresponding man pages for
      for (i = 0; i < retval; i++) {                    expiration or some other event that needs your         details and usage examples. For timerfd, try man 2
                if (events[i].events & EPOLLIN) {       attention. You can think of these mechanisms           timerfd_create.
                  /* Data has come, handle it */
                }
      } else if (retval == 0) {
        /* Timeout happened */                        “edge-triggered”, which is another distinctive           On the Python side
      } else {                                        feature of epoll(7). poll(2) and select(2) are           The code samples we’ve seen so far used
                /* Error occurred */                  always level-triggered, meaning that they                C, but that doesn’t mean you can’t write
      }                                               will signal the event as long as the condition           asynchronous code in a high-level language
  }                                                   holds – if, for example, there is data to read.          such as Python. In this case it is unlikely
   close(epoll_fd);                                   With EPOLLET, only events that change the                you’ll do system calls directly, however. Most
   return 0;                                          descriptor state (eg from empty to readable)             probably, you’ll rely on some asynchronous
}                                                     are signalled. It may be tempting to use                 framework or networking library, like Gevent,
                                                      it for new data indication, and it will work.            Tornado or Twisted. Let’s have a sneak peek
   The only argument epoll_create(2)                  However, you should always keep in mind                  on what happens behind the curtains here,
receives used to be a hint for descriptor set         that the event is signalled on a state change.           taking the latter as an example.
size. Modern kernels ignore it (albeit it must        If 5k of data arrived in a socket, and you                  Twisted is a callback-based framework.
be non-zero for backward compatibility), and          read only 3k of it before calling epoll_wait(2)          When asynchronous operation (say, socket
there is newer epoll_create1(2) that doesn’t          again, you’ll lose the event for the next 5k of          read) starts, you get a ‘Deferred’ object that
take this argument. Events are represented            data coming. That’s yet another reason to                you can attach your callbacks to. Those are
with struct epoll_event, which again stores           set file descriptors to non-blocking state, so           called when the data is ready.
a file descriptor to watch and the events             you can drain the descriptor safely.                        Twisted can preserve an illusion of
mask, as in poll(2). You add these structures             epoll_fd is itself pollable. You can add it          synchronous code execution. It relies on
to epoll_fd with epoll_ctl(2). Other possible         to the file descriptor set, and it will become           co-routines, the yield keyword and a custom
arguments include EPOLL_CTL_DEL to                    readable if there are any events signalled.              decorator (@defer.inlineCallbacks). Instead
remove descriptors, and EPOLL_CTL_MOD                 It’s not a good idea to add an epoll file                of attaching callbacks yourself, you ‘yield’ the
to change the events mask.                            descriptor to its own set, however.                      ‘Deferred’, and the decorator does this for
   Most event mask flags are quite                        While select(2), poll(2), and epoll(7) work          you. When the value is ready, the decorator
descriptive. For instance, EPOLLIN is for             well on sockets or pipes, you shouldn’t                  takes it and sends it back to the yield
readability test, and EPOLLOUT is for                 assume the same for regular files. Carefully             expression, or injects an exception in case of
writeability. Note the use of EPOLLET,                use non-blocking disk access, yielding an                error. All this runs in a loop which terminates
however. As the example shows, it can be              event loop when necessary, or try POSIX                  when the wrapped function returns a value
combined with other flags. ET stands for              Asynchronous I/O here.                                   or simply ends.




Command of the month: strace
This month, we’ve learned several ways to             program_name, but more importantly, you                  11:35:57 poll([{fd=5, events=POLLIN}, {fd=6,
create event loops in a Linux application.            can also connect to the process already                  events=POLLIN}, {fd=3, events=POLLIN}], 3, 145) = 0
How do you know which one the given                   running with strace -p PID. You can also                 (Timeout)
program uses?                                         add -e desc to filter out everything but file              Here I traced the update-notifier process
  Try strace(1), a small tool that does a             descriptor-related system calls.                         on an Ubuntu 14.04 LTS system, and I also
great job tracing system calls live. It requires        Consider the following:                                added -t for timestamps. We see update-
root permissions to run, because snooping             $ sudo strace -p 3492 -e desc -t                         notifier relies on poll(2), and you can also
on another user’s processes is certainly              11:35:56 poll([{fd=5, events=POLLIN}, {fd=6,             note how strace(1) decodes the arguments
a privileged operation. You can trace a               events=POLLIN}, {fd=3, events=POLLIN}], 3, 1065) =       and return values for you. We’ll come back to
process you start yourself with strace                1 ([{fd=6, revents=POLLIN}])                             strace(1) next issue.



                                                                   www.linuxvoice.com                                                                             71
     FOSSPICKS




FOSSpicks                                                                                           Sparkling gems and new
                                                                                                    releases from the world of
                                                                                                    Free and Open Source Software

             Hunting snarks is for amateurs – Ben Everard spends his time in
             the long grass, stalking the hottest, free-est Linux software around.
Microkernel


Hurd
T
         here are two different types      Hurd is a set of servers and
         of code running on a           related protocols that run on top of
         computer: kernel space         the Mach microkernel to enable
code and userspace code. Code in        userspace software to run
the kernel space is held in memory      everything that’s needed.
and has full access to the hardware,       The easiest way to try Hurd is to
while code in userspace is              download a Qemu image file from
controlled by the kernel and can        https://people.debian.
access the hardware by calling          org/~sthibault/hurd-i386. Once
procedures in the kernel. However,      unzipped, this can be run with:
there’s also a large grey area where    qemu-system-x86_64 -m 1024 debian-
code could live either in kernel        hurd-20150105.img
space or userspace – filesystem
drivers, for example. Most operating    A work in progress…
systems have these in the kernel;       At the time of writing, there isn’t a     The Debian Hurd image doesn’t come with much by default, but it
however, there’s no reason they         build using the latest 0.6 kernel, but    does have IceWM and the w3m text-based web browser.
can’t live in userspace.                this may change by the time you
   Linux, BSDs, and almost all          read this. This is built on Debian, but                               software/hurd/hurd/running/
modern operating systems have a         with Hurd and Mach instead of the                                     qemu.html.
lot of systems functionality in the     Linux kernel. There aren’t as many                                       Mach and Hurd have been in
kernel. Theoretically, there may be     packages as in the Linux version of                                   development for 25 years, but it’s
an advantage to shifting this out       Debian, because some software                                         not particularly stable, and there’s
into userspace: doing so would          requires features that aren’t yet in                                  limited hardware support. Hurd
keep the kernel smaller and could       Hurd. If you’re a glutton for                                         simply doesn’t have enough
increase security. These minimalist     punishment, you can build a                                           developers to realise its vision in the
kernels are known as microkernels,      system yourself from the                                              short term, a problem that’s
and Mach is one of these.               instructions at www.gnu.org/                                          exacerbated by the complexity of
                                                                                                              the microkernel model.
                                                                                                                 There are versions of Debian and
                                                                                                              Arch that use Hurd and Mach in
                                                                                                              place of the Linux kernel, though
                                                                                                              without a mature kernel, and a
                                                                                                              software stack designed to take
                                                                                                              advantages of the specific features
                                                                                                              that a microkernel would give, it’s
                                                                                                              hard to realise the potential of Hurd.
                                                                                                              For the time being, Hurd is an
                                                                                                              interesting idea, but it’s not yet a
                                                                                                              serious kernel for real work. Of
                                                                                  Arch Hurd doesn’t get
                                                                                                              course, there was a time when the
                                                                                  much development, but
                                                                                  the most recent update      same could be said of Linux…
                                                                                  on the website assures
                                                                                                               PROJECT WEBSITE
                                                                                  us that the project isn’t
                                                                                                               www.gnu.org/software/hurd/index.html
                                                                                  dead.


72                                                            www.linuxvoice.com
                                                                                                                             FOSSPICKS


Video editor


Kdenlive
O
          nce upon a time, video
          production was a specialist
          activity which only a few
highly skilled individuals ever dared
to try, but now, with YouTube, Vine
and other user-generated video
sites, it’s becoming more common
for ordinary people to produce
videos for themselves. Kdenlive is a
video editor for the masses.
   Kdenlive is a non-linear video
editor for KDE. The non-linear part
of the name means that it’s not
destructive of the source material
(almost all digital video editors are
non-linear).
   Version 15.04 is the first release
of Kdenlive since the project
became an official part of KDE. This
change should mean that we see          The Kdenlive interface is welcoming for beginners, but doesn’t hide anything away from the user.
more frequent updates than
previously, as it will keep pace with      Kdenlive can use either FFmpeg or                                 transitions. As well as merging
the official KDE release schedule. It   Libav to convert tracks as they’re                                   tracks, you can add various effects,
also means that the software’s          imported or exported, so it supports                                 such as colour transformations or
switched to using the Qt 5 graphical    a huge range of video file formats.                                  spatial distortions.
toolkit, so it might be quite some      In its basic usage, Kdenlive enables                                    For many years, we’ve been put
time before the latest build makes it   you to take a series of video and                                    off Kdenlive because it hasn’t been
into the more conservative distros,     audio tracks and combine them to                                     stable. In fact, once we had to
but users of Arch and other             make a whole video. Each clip can                                    abandon a project because we just
cutting-edge distros should already     be as short as a single frame or as                                  couldn’t get it to work with the video
have it.                                long as you like, and you can merge                                  files we needed. However, the last
   The interface is nicely laid out,    between them with a range of                                         few releases have seen a noticeable
with the default layout giving you                                                                           rise in stability, and it’s been a while
tracks at the bottom and the clips,     “Kdenlive enables you to combine                                     since it’s crashed on us.
                                                                                                                The last couple of years have
effects and preview in a line across
the top. This gives you access to       a series of video and audio tracks                                   seen a considerable amount of
what you need without over-             to make a whole video.”                                              interest in video editing on Linux,
                                                                                                             and people are putting money into
complicating the window.
                                                                                                             creating better software. Kdenlive
                                                                                                             raised almost $7,500 in an
                                                                                                             Indiegogo crowdfunding campaign,
                                                                                                             while more recently Pitivi (a
                                                                                                             competing open source video
                                                                                                             editor) raised over €23,000.
                                                                                                                We’re starting to see the fruits of
                                                                                                             this cash injection, and the
                                                                                                             standard of all tools in the field is
                                                                                                             rising. Perhaps we’ll get to a day
                                                                                                             when the quality of tools for video
                                                                                                             production on Linux is as good as
                                                                                 Kdenlive includes a title   the quality of the developer tools.
                                                                                 clip editor for creating
                                                                                                              PROJECT WEBSITE
                                                                                 simple text overlays for
                                                                                                              https://kdenlive.org/
                                                                                 your videos.



                                                             www.linuxvoice.com                                                                  73
     FOSSPICKS


Private file sharer


Lockee
H
         ave you ever tried to share    the shared file (known as a storage
         a large file with someone      locker), and create a password.
         and found that none of the     Your files will be encrypted on your
existing solutions really worked?       device, and uploaded to a locker.
Email just won’t handle it. There are   You can share a link with anyone,
some cloud-based options (Google        give them the password, and they
Drive and Dropbox to name but           can download the contents of that
two), but these require you to hand     locker, and after 24 hours, the files
your data over to organisations that    are deleted.
are known to data-mine for profit,        Encryption is done client-side
so may not be suitable for private      using the Stanford JavaScript
data. There are other solutions that    Crypto Library using 512-bit AES.          The web interface is simple and easy to use, because Lockee
provide more security, but require      This should be sufficient for most         focuses on doing just one thing, and doing it well.
the person you’re sharing the data      security needs, but we can’t
with to install software, and that’s    guarantee that there aren’t any                                       with any of the settings (such as
not always possible.                    weaknesses in it.                                                     the amount of time files are held for
  In other words, there are lots of       The server-side software is all                                     before they’re deleted). It’s based on
ways you can share large files over     open source, so you can deploy it to                                  node.js, and can be installed with
the internet, but none of them work     your own server if you wish to tinker                                 the npm package manager, so you
well. Enter Lockee. This solves the                                                                           can your own private file sharing
problem by providing temporary                                                                                running in just a few minutes.
encrypted online storage. You can       “Lockee encrypts your files
use the public instance at www.
lockee.me: just think up a name for
                                        and uploads them to a locker.”                                         PROJECT WEBSITE
                                                                                                               www.lockee.me




Backup tool


Rsnapshot
R
          sync is arguably the best       Since Rsnapshot uses Rsync and
          tool for making copies of     SSH to do the backups, you can
          filesystems. It’s almost      save files from a server with just
endlessly configurable, but as a        these two utilities installed, so
consequence of this power, it can       there’s no need to put extra
also be complex to fine-tune.           software on the machine you want
Rsnapshot is a set of shell scripts     to back up. You just need to install
that wrap around Rsync to provide       Rsnapshot onto the machine that
easy access to some of its most         will save the backups, and you can
useful backup features.                 set it running.
  As well as providing the ability to     There are lots of wrappers
create a snapshot, Rsnapshot lets       around Rsync. Rsnapshot’s main
                                                                                   Rsnapshot is configured
you create incremental backups          selling point is its simplicity, and the   by the file /etc/          never need to worry about your
based on this snapshot. With clever     fact that it’s command-line based,         rsnapshot.conf. Using      backups. Just install it and forget
use of hardlinks, this means you        so it can be run from Cron (or             this, you can tune its     about it. Then, should the
can store the state of the backed-      Systemd timers if you’re cutting-          behaviour however you      unfortunate happen, just browse
up directory at any point of time       edge). Once it’s set up, it will just      want.                      through the backups (which are just
with very little extra space. It        continue running, meaning you                                         a clone of the backed-up
maintains the permissions of the                                                                              directories), and restore anything
original files, so if you’re running                                                                          you need.
locally, the owners of the files can    “Rsnapshot is a set of shell scripts
restore them without the root user
having to get involved.
                                        that wrap around the Rsync utility.”                                   PROJECT WEBSITE
                                                                                                               http://rsnapshot.org




74                                                            www.linuxvoice.com
                                                                                                                             FOSSPICKS


eBook editor


Sigil
E
         Pub, the most popular           Amazon’s Kindle Store using the
         format of eBooks, is a          Calibre eBook manager).
         format that uses Zip files to      You can create your books using
bring together HTML documents            either WYSIWYG editing or HTML
and associated content (CSS,             editing of the files, but Sigil’s best
images, etc) into a single file that     features are its ePub checking
can be saved to a device. This           tools. The ePubs standard is stricter
format means you can use                 than standard HTML, and some
standard web technologies, but still     viewers have very pedantic
read the contents offline. Since         rendering engines, so it’s important
ePubs use HTML, you can create           to thoroughly check them before
them with any HTML authoring tool,       sending them out into the world.
however, a specialist ePub creator
makes it easier to bring everything      Sigil + Calibre
                                                                                  We use Sigil in the
together into a single file.             We use Sigil as well as Calibre for                                  recommend any prospective eBook
                                                                                  process of creating the
   Sigil has everything you need to      this when we produce the Linux           Linux Voice ePub.           editors try out both to see which
create your own ePub files. These        Voice ePubs, which are available to                                  works best for them. Since the
could be ones your want to share         subscribers. Each has different                                      ePub format is standard, it’s trivial
with your friends, or your               strengths, so we’d strongly                                          to work on a single book using both
groundbreaking first novel that you                                                                           tools, and we haven’t had a problem
want to publish online (Sigil can                                                                             doing so.
create files for Google Play Books,      “Sigil has everything you need
and Sigil’s ePubs can be converted
into the appropriate format for
                                         to produce your own ePub files.”                                      PROJECT WEBSITE
                                                                                                               http://sigil-ebook.com/




Wikipedia reader



Xowa
W
            ikipedia is probably the     when you’re offline. This is,
            greatest single              obviously, a huge amount of data,
            information repository       so it does require a large download
mankind has ever created. It holds       when you install the wiki, but once
a frankly mind boggling amount of        you’ve got the data, it’s available
information, and despite the             whether or not you’re connected.
potential for vandalism, maintains a
high level of accuracy. There’s only     Knowledge of the world
one problem with it: you have to be      If you can get the database, you
online to access it.                     can store it for use offline. This
   For most situations, this isn’t a     means that as well as working with
problem. In todays always-online,        Wikipedia in any language, you can
smartphone-connected world,              use it to grab wiki dictionaries
many people are connected to the         (wiktionaries) or any of the other
internet every second of every day.      sources from WikiMedia.                  Xowa’s help files are themselves wiki pages; they’re included in the
However, there’s a significant              There are links to the appropriate    standard install, while you have to download other wikis.
proportion of the world where that       downloads in the Tools > Import
simply isn’t the case. This is true in   Online menu. It lists all the options                                would tell you what articles are in
rural parts of rich countries, and in    by size, so you can get anything                                     the latter one, but we couldn’t find
huge swathes of the developing           from the full English Wikipedia                                      an Arpitan reader to translate for us.
world.                                   (11GB) to the Arpitan (a language
   Xowa allows you complete              from Provence) version of the                                         PROJECT WEBSITE
                                                                                                               http://xowa.sourceforge.net
access to the whole of Wikipedia         dictionary that’s just 1MB. We



                                                              www.linuxvoice.com                                                                  75
     FOSSPICKS


Integrated development environment


Qt Creator
W
             riting software requires a   more cross-platform capabilities, Qt
             few different tools.         Creator supports building HTML
             Depending on your exact      apps, which provide a great option
requirements, you may need a text         for cross-platform development.
editor, build system compiler (or            Although Qt Creator can work
interpreter), interface designer and      with other languages and
source code manager. There are            platforms, it’s designed to work with
two options: you can find separate        C++ and the Qt toolkit. Version 3.4
tools for each task, or you can find      comes with improved support for
one powerful tool that does it all. If    refactoring, and smarter syntax          Drag-and-drop your own
you find yourself going down the          highlighting. As well as the FOSS        GUIs, and let Qt Creator       The biggest advantage of using
latter route, you’ll need an              version, there are commercial            generate all the code for   Qt Creator is probably the designer,
Integrated Development                    versions of Qt Creator with better       you.                        which lets you drag-and-drop your
Environment (IDE).                        integration with testing tools, and                                  user interface. This integrates well
   Qt Creator, as you may have            support from the makers. The                                         with the rest of the software, so you
guessed from the name, is an IDE          community version is perfectly                                       can easily build quite complex user
for the Qt toolkit. This means it’s       usable for most people, and doesn’t                                  interfaces. Fans of the GTK toolkit
ideal for building software for KDE       feel deliberately crippled to generate                               will have to wait for the soon-to-be-
and LXQt as well as any of the            sales of the commercial version.                                     released Gnome Builder IDE to have
mobile environments built on Qt,                                                                               the same level of functionality.
such as Sailfish. In fact, Qt is an
excellent option for cross-platform       “Qt Creator is an integrated                                          PROJECT WEBSITE
development, and runs on most
modern OSes. It you need even
                                          development environment for Qt.”                                      https://wiki.qt.io/Category:Tools::
                                                                                                                QtCreator




Network graphical configurer


NetCTL GUI
A
         rch Linux uses netctl, a tool        Usually, the solution is simply to
         to help you configure your       look it up on the Arch Wiki, but you
         network containers using         can’t until you get your computer
profiles and Systemd’s networkd           connected. In this situation, NetCTL
daemon. NetCTL GUI is a graphical         GUI would save you fiddling around
tool that lets you do all this without    trying to read the wiki on your
having to dig down to the                 phone, or – even worse – turning to
command line.                             a Macbook using friend and
  Of course, some people may              uttering the most embarrassing
argue that if you don’t like digging      words a Linux user ever has to say
down to the command line, then            to a non-Linux user “Can I borrow
Arch Linux probably isn’t the right       your computer for a second? I’ve
distro for you. Maybe they have a         forgotten how to configure
point, but there are a few situations     networking on Arch Linux”. NetCTL        NetCTL GUI is possibly the most important piece of software to
when we think NetCTL GUI could            GUI can save you this humiliation        stop Arch Linux users losing face.
come in handy. For example, you           – install it now. You may never need
arrive at a coffee shop and take out      it, you may never even open it, but                                  GTK-based desktop. We tested it on
your laptop. You go to connect to         in case you do, you’ll thank us.                                     the Mate desktop, and it worked
the wireless network. Can you                                                                                  without problems.
remember the syntax for the               Safety first!
profiles or the arguments for netctl?     NetCTL GUI is written using Qt, but                                   PROJECT WEBSITE
Perhaps you can, but we find that         it’s such a simple application that it                                http://arcanis.name/projects/
                                                                                                                netctl-gui/
we forget stuff like this all the time.   shouldn’t look out of place on a



76                                                              www.linuxvoice.com
                                                                                                                         FOSSPICKS


  FOSSPICKS Brain Relaxers
https://launchpad.net/pybik/
 Run and gun


 C-Dogs SDL
 O
           riginally a shareware        than the original game, including
           game for DOS, C-Dogs is      Linux. There’s even an Android
           a fast-paced running and     version for those of you who use
 shooting game for one to four          Linux on the go.
 players. It’s a straightforward          The graphics are true to the
 game of keeping on the move            game’s 90s heritage, and won’t tax
 and shooting anything else that        your graphics hardware, or require a
 moves. You can play as several         high-res screen. Simple and
 different characters, and the          pixellated are the two adjectives
 multiplayer options enable you to      that best capture the visual feel of
 play either with or against the        the game. Of course, as every retro
 other players.                         gamer knows, you can’t judge a
                                                                                The name C-Dogs
    The original game was               game by the graphics, and the                                     get bored too soon. It’s probably
                                                                                comes from Cyberdogs
 available until 2001, and at the       simple visuals belie great gameplay.    (the games doesn’t        not the game for epic weekend-
 end of its commercial life, Ronny      There’s no real plot to follow, or      feature any pirates).     long sessions, but a quick stress
 Wester, its programmer, open           complex manoeuvres to master:                                     reliever after a long day… just
 sourced the code. Naturally, this      just keep moving, and keep                                        what arcade games were
 was picked up by a few                 shooting. It’s the way games used                                 intended for.
 developers, and soon the code          to be.
 was ported to the SDL game               C-Dogs SDL is easy to pick up,                                   PROJECT WEBSITE
 library. C-Dogs SDL was born, and      and quick to play, but also                                        http://cxong.github.io/cdogs-sdl

 it worked on far more platforms        entertaining enough that you won’t




 Turn-based strategy

 The Battle for Wesnoth
 T
          he Battle for Wesnoth is a    its effectiveness. The similarity
          turn based strategy game      ends there though, because in The
          set in a Tolkien-esque        Battle for Wesnoth, you can play with
 fantasy realm. You play as one of      whichever pieces you like, since you
 six factions, which are made up        amass your army by paying gold to
 by various combinations of men,        recruit troops. Now I think about it,
 elves, goblins, orcs, trolls,          that could make chess a little better
 dragons, skeletons, mermen and         as well. I never could work out a
 others. There isn’t a central          good way of using knights.
 theme, but a series of 16                 Wesnoth walks the line of not
 campaigns that you can play,           being too hard to put off beginners
 each with its own storyline.           and at the same time not being so
                                                                                Who needs Steam, or
    You take it in turns (against the   easy as to get boring. Even                                         Once you’ve completed the 16
                                                                                friends, or the outside
 computer) to make your moves           newcomers to the turn-based                                       official campaigns, you can
                                                                                world? Not us. We just
 and plan your attacks, much like       strategy genre should find it a         need The Battle For       continue with user-generated
 a graphically-appealing game of        entertaining game.                      Wesnoth.                  ones – there are enough of these
 chess played on a hexagonal                                                                              that even avid gamers should be
 grid. Like chess, different players                                                                      playing for a long time.
 have different abilities, and the      “… a turn-based strategy game
 key to success is to learn how to
 use each piece so as to maximise
                                        set in a Tolkien-esque world.”                                     PROJECT WEBSITE
                                                                                                           www.wesnoth.org




                                                            www.linuxvoice.com                                                                77
     SUBSCRIBE




SUBSCRIBE              shop.linuxvoice.com


                                                                        Get your regular dose
                                                                        of Linux Voice, the
                                                                        magazine that:
                                                                          Gives 50% of its profits
                                                                        back to Free Software
                                                                          Licenses its content
           SUBSCRIBE TO                                                 CC-BY-SA within 9 months
                                                                          US/Canada subs prices
           TODAY!                                                         1-year print & digital: £95
                                                                          12-month digital only: £38


         Get 114 pages                                     Access our                                         Save money on
          of tutorials,                                  rapidly growing                                       the shop price
      features, interviews                            back-issues archive                                    and get each issue
          and reviews                                 – all DRM-free and                                        delivered to
          every month                                  ready to download                                         your door

               Payment is in Pounds Sterling. 12-month subscribers will receive 12 issues of Linux Voice a year. 7-month
            subscribers will receive 7 issue of Linux Voice. If you are dissatisfied in any way you can write to us to cancel your
                      subscription at subscriptions@linuxvoice.com and we will refund you for all unmailed issues.



78                                                         www.linuxvoice.com
                                                                                                                                          NEXT MONTH



                                 NEXT MONTH IN



ON SALE                                                                                   EVEN MORE AWESOME!
THURSDAY
                                                                                                                                             Inside the kernel
 25 JUNE




        SYS
                                                                                                                                             Delve inside the
                                                                                                                                             project that everyone
                                                                                                                                             relies on – the Linux
                                                                                                                                             kernel. Be advised
                                                                                                                                             that there may be
                                                                                                                                             swearing and
                                                                                                                                             intolerance for low




       ADMIN
                                                                                                                                             quality code…

                                                                                                                                             Robot takeover
                                                                                                                                             Ben is still in his
                                                                                                                                             shed, working on an
                                                                                                                                             army of Linux-
                                                                                                                                             powered robot super
                                                                                                                                             soldiers. Who knows
                                                                                                                                             what he’s planning in
                                                                                                                                             the fug of flux and
                                                                                                                                             solder?

                                                                                                                                             Profits giveaway
                                                                                                                                             At Linux Voice, we

BE YOUR OWN SYSADMIN                                                                                                                         like to put our money
                                                                                                                                             where our mouth is,
Run your own servers, manage your own                                                                                                        and we’re giving half
                                                                                                                                             our (modest) first
data, and take control over all your digital                                                                                                 year’s profits to help
happening – all with Free Software.                                                                                                          Free Software. Here’s
                                                                                                                                             where it’s going.




       LINUX VOICE IS BROUGHT TO YOU BY
Editor Graham Morrison           Editorial consultant Nick Veitch                through the use of advice in this magazine.   Copyright Linux is a trademark of Linus
graham@linuxvoice.com            nick@linuxvoice.com                             Experiment with Linux at your own risk!       Torvalds, and is used with permission.
Deputy editor Andrew Gregory                                                     Distributed by Marketforce (UK) Ltd, Blue     Anything in this magazine may not be
andrew@linuxvoice.com            All code printed in this magazine is licensed   Fin Building, 110 Southwark Street, London,   reproduced without permission of the
Technical editor Ben Everard     under the GNU GPLv3                             SE1 0SU                                       editor, until February 2016 when all content
ben@linuxvoice.com                                                               Tel: +44 (0) 20 3148 3300                     (including our images) is re-licensed CC-
Editor at large Mike Saunders    Printed in the UK by                                                                          BY-SA.
mike@linuxvoice.com              Acorn Web Offset Ltd                            Circulation Marketing by Intermedia Brand     ©Linux Voice Ltd 2014
Creative director Stacey Black                                                   Marketing Ltd, registered office North Quay   ISSN 2054-3778
stacey@linuxvoice.com            Disclaimer We accept no liability for any       House, Sutton Harbour, Plymouth PL4 0RA
                                 loss of data or damage to your hardware         Tel: 01737 852166                             Subscribe: shop.linuxvoice.com

                                                                    www.linuxvoice.com
                                                                                                                           TUTORIALS INTRO




                                              TUTORIALS
                                              Dip your toe into a pool full of Linux knowledge with eight
                                              tutorials lovingly crafted to expand your Linux consciousness


                                               In this issue…
                                                  82                                                        84



Ben Everard
Does his computing on an abacus. It may be
basic, but the hardware is open.




I                                              Ardour multitrack audio                                   Sonic Pi and Minecraft
     ’ve been writing about Linux for
     almost half a decade, and I honestly
     never thought I’d report on               Graham Morrison likes nothing more than                   These two programs are arguably the best
Microsoft’s Visual Studio for Linux. This      open source software and making music.                    two pieces of software to get kids coding.
issue I’ve done exactly that (albeit in a      Join him, and indulge your creative side by               The ever-youthful Les Pounder brings
stripped-down programmer’s editor, not         making multi-track music.                                 them together for the geeks of tomorrow.
the full Visual Studio IDE). This raises so
many questions. Is this a cynical
                                                  88                                     92                                   96
marketing move or a genuine change of
strategy? Will we see more Linux
software from Microsoft? What does
this mean for Linux as a desktop
operating system? For now, we can
only speculate wildly, so here are my
bold predictions for the future.
                                               GPX data                               Coding Lisp                          Docker
Speculation                                    Use open standards and                 Juliet Kemp travels back             Discover the latest
I think that this is a genuine change          satellites to track your               in time to look at the first         buzzwords in system
from Microsoft, and will likely be             movements. Marco Fioretti              functional programming               administration as
accompanied in the future by more              unleashes the power of                 language and see how it              Ben Everard reveals the
software releases for Linux, and               XML and GPX.                           affects coding today.                secrets of containerisation.
continued support. However, it will be
several years before we see a major
Microsoft product (such as the full            PROGRAMMING
Visual Studio, or Office) released on
desktop Linux. We’ve seen Linux grow           IPython                                Logic                                ASM School
slowly but steadily in market share for        100 Interactive programming is          104 True and False; 1 and 0:        106     In the final part of the
the last ten years. This release is an                the process of exploring                 these are the building             series on assembly
                                               data by running code one line at a     blocks of computers, but how can     language programming, we extend
acknowledgement of Linux’s increasing
                                               time. There are a few tools availble   you manipulate them? What do         the operating system that we built
importance, and I think the trend’s likely     for this, but IPython is the best      AND, OR, and NOT have to do with     last month by introducing system
to continue for some time (at least five       open source option. It can run in      it all? Is XOR really a word? From   calls, which enable programs to
years). Will we see a dramatic increase        either a terminal or a web browser.    Boolean algebra to bitwise masks,    interact with your OS. We also add
in the uptake of Linux in this time            Combining it with Python’s             we uncover the techniques that       a simple graphics driver to add
                                               excellent numerical modules            make logic useful to programmers     some colourful images, and give
frame? Only time will tell.
                                               makes a great analytical platform.     of all levels.                       the potential for a GUI system.
ben@linuxvoice.com



                                                                www.linuxvoice.com                                                                          81
        TUTORIAL ARDOUR



                             MULTITRACK AUDIO WITH
            TUTORIAL
                             ARDOUR
                             A great new release gives the perfect excuse to explore some of
GRAHAM MORRISON
                             the new features in this Free Software audio editor.


                             C
                                     ontinuing our loose theme of looking at open     Jack as a pre-requisite. Jack is the audio connectivity
   WHY DO THIS?
                                     source applications capable of competing with    layer that’s powerful but complicated. Its requirement
   • Add effects to
                                     the very best commercial alternatives, this      by Ardour added a considerable hurdle for users who
     recordings
                             month we’re going to examine the new version of          just wanted to try the application. But you can now
   • Edit out dead air and
     other mistakes          Ardour. Ardour is an audio powerhouse, capable of        simply launch Ardour just as you would a similar
                             recording, editing and mastering music that could be     application such as Audacity. We’ll use our standard
                             released professionally (see our review on p50).         laptop hardware to record a few tracks of audio and
                                Like Gimp, it’s difficult to work out how to use it   use Ardour to mix these down to a single audio file.
                             simply by loading the application, but the new version   It’s the audio equivalent of creating and merging
                             has made things considerably easier by removing          layers in Gimp.


                                 Step by step: Record and edit an audio track
                             1
                                 Connect to your audio                                2
                                                                                          Explore the interface
                             When Ardour launches, you’ll be asked where you          Click on OK and you’ll be presented with a warning
                             want to create a new session. It’s worth doing this in   about memory limits. We’d recommend disabling this
                             a separate folder, because there are usually lots of     and closing it. The main application window will then
                             files associated with a single project. After giving     appear. First appearances can be intimidating
                             your new session a name, the ‘Audio/MIDI Setup’          because Ardour gives you no clues about what to do
                             wizard appears. This is where you tell Ardour which      next, so we’re going to use this as an excuse to
                             audio hardware and driver to use, as well as the         provide a brief overview of the interface.
                             sample rate and buffer size. Now that you no longer         In the very top-right of the window, you’ll find
                             need to run Jack in the background, you can select       various stats about the recording format, CPU state
                             ALSA as the audio subsystem and you shouldn’t            (labelled as DSP) and how much recording time is
                             need to make any other system changes. Sample            available in your hard drive, labelled as ‘Disk’. The
                             rate is usually best at 44.1kHz (the same as a CD)       multi-coloured LED is clickable and will be off when
                             and the buffer size is fine at 1024 samples.             there are no messages, yellow when there’s an update
                                A larger buffer will help with audio glitches,        and red if there are problems. The two large number
                             especially on slower machines, but a larger              fields are for the cursor position within the recording,
                             buffer also increases the time it takes for audio        as a time and as bars/beats. Transport controls are to
                             generated in Ardour to make a sound – known as           the left and beneath there’s cursor, snapping and
                             latency. The buffer latency is shown to the right of     mouse options. Finally, the entire lower section of this
                             the buffer size field. By default this is 23.3ms         window is for each of your recorded audio tracks,
                             (1 second = 1000ms).                                     which we’ll create now




   82                                                       www.linuxvoice.com
                                                                                                               ARDOUR TUTORIAL

3
    Audio connections                                      4
                                                               Recording audio
Before you can record anything you have to add a           Ardour will always attempt to make sensible
track to record something into. There’s already a          connections by default, but you can always go into the
single entry labelled Master. All tracks and audio will    Connections window and change them, much as you
be mixed into this Master bus and sent to your             would in a recording studio by unplugging one cable
headphones/speakers. To get a clearer idea of this,        from a mixer channel and connecting it somewhere
add a new audio track from the Track menu.                 else. This is how you’d set up multiple inputs to be
   A new red track will be added, and you should notice    recorded at the same time on different tracks, for
a volume meter bouncing up and down on both this           example. Hopefully, your microphone or other input is
track and the Master bus. This is the input from your      already connected to the input and the volume meter
microphone connected by default to the new track. All      is bouncing around on the track. This means you’re
connections within Ardour are configurable from the        ready to record, and to make a recording you need to
Window > Audio Connections panel. Currently, the           ‘Record Enable’ the new track by pressing the red
hardware ‘Source’ is connected to the track                button and then press the large red recording button
‘Destination’, the Source > Track is connected to the      in the transport section followed by ‘Play’. As the
Destination > Master bus and the Source > Master bus       recording progresses you should see the amplitude
is connected to the Destination > Hardware Output.         waveform drawn into your record enabled tracks.




5
    Editing your masterpiece                               6
                                                               Mastering and output
The next step is editing, and just like you’d edit out     The final step is mastering your edit into a single file.
errors with Gimp, it’s now time to edit your recordings.   To start, open the mixer view from the Window menu.
Use the cursor to trim the beginning and end of the        You can adjust the relative volume and left/right
audio, or move blocks against one another in time to       balance of your tracks here. If you’ve got any LADSPA
improve timing. Drag corners to add fade-in and            effects installed, you can use them too. If you want to
fade-out effects. Press C for cut mode, which will let     make changes happen over time, you’ll need to use
you split blocks so you can remove or edit only one        automation, enabled back in the track view by pressing
part. Press T to enter stretch mode. This will let you     the A button. Select Fader to adjust the volume and
drag blocks to fit the time/space, but doesn’t sound       use the Write mode, which will record changes in the
so great with extreme stretches. You can get a better      fader level as you adjust them during playback.
view of your editing by changing the zoom level with          To export your creation, select Session > Export >
your mouse wheel, or adjust the vertical height of         Export to Audio. Change the format to WAV or Ogg
each track using the right-click menu, and can group       Vorbis and make sure the time span covers your whole
tracks together and edit across the multiple tracks        project. Now click Export. Ardour will play through your
when more than one is selected.                            recording and write the output to a single audio file.




                                                               www.linuxvoice.com                                                83
     TUTORIAL EDUCATION



                              CODE YOUR MINECRAFT WORLD
          TUTORIAL
                              USING SONIC PI
                              Learn a new way to hack Minecraft, using Sonic Pi. Shape your
   LES POUNDER
                              world and make a lot of noise doing it!


                              T
                                       wo applications on the Raspberry Pi have
 WHY DO THIS?
                                       ignited imaginations more than any others:
 • Merging Minecraft                   Minecraft and Sonic Pi. Minecraft is the open
   and Sonic Pi into one
   project is a genius way    world sandbox game in which you can build anything;
   of introducing coding,     it even has its own Python API that enables anyone to
   music and game design.     shape their world using programming. Sonic Pi is a
                              popular music creation tool that uses Ruby as its
                              programming language. But what if we could merge
 TOOLS REQUIRED               them together and control Minecraft using Sonic Pi,
 • A Raspberry Pi 2.          while programming music? Well now we can!
 • Keyboard,mouse and            In this tutorial we will be using the development        In our first project we create a teleporter that plays music
   monitor with sound         version of Sonic Pi, as at the time of writing it is the    upon a successful teleport. Beam us up, Mr Scott!
   capabilities.              only version capable of talking to Minecraft.
 • If your monitor does          Setting up Sonic Pi Dev requires a little command        Sonic Pi contains eight workspaces, and each
   not have sound, plug
   in headphones to your      line magic. So on your Raspberry Pi 2, connected to         workspace has its own programming panel.
   Raspberry Pi 2 and use     the internet, open a terminal and issue the following       Workspaces can be played simultaneously and will
   Sonic Pi preferences to    command.                                                    automatically save when Sonic Pi is closed.
   change output.
                              git clone git://github.com/samaaron/sonic-pi.git                Just above the programming panel are four buttons
 • You can download the
   completed code from        cd sonic-pi/app/gui/qt                                      used to play and stop your composition, save your
   https://github.com/lesp/   sudo ./rp-fetch-deps                                        work to a file, and lastly to record your composition to
   LinuxVoice_Issue16_        ./rp-build-app                                              a WAV file for use in another application.
   Education/archive/
   master.zip                 cd ../../server/bin/                                            With Sonic Pi Dev ready to go, let's fire up Minecraft
                              ./compile-extensions.rb                                     Pi; you can find it in the menu under Games. Create a
                              cd ../../../                                                new world in Minecraft Pi and wait for it to load. When
                              ./bin/sonic-pi                                              it's ready we need to switch our focus back to Sonic Pi
                                 So what have we just done? Well, we've used              Dev, and the easiest way to do this is by pressing the
                              git clone to download the code from GitHub, then            Tab key on your keyboard. This will release the mouse
                              changed directory and run a script to download the          and enable us to select the Sonic Pi Dev window.
The two towers use
                              dependencies for Sonic Pi Dev to work. We have then             In Sonic Pi Dev we'll write a line of code in
different block types to
                              built the application from source, and finally run Sonic    Workspace 0 to test that the connection between
give them a different
colour. There are lots of     Pi Dev from its directory rather than call the version of   Sonic Pi Dev and Minecraft Pi is complete. The most
block types for you to use,   Sonic Pi that's installed by default on Raspbian.           basic test is to push a message to the Minecraft chat
just be careful with the                                                                  window and we do this as follows.
flowing lava and water.       Sonic Pi                                                    mc_message(“Hello World”)
                                                                                            Press Run and change your focus back to the
                                                                                          Minecraft Pi window. You will see “Hello World” on the
                                                                                          screen, proving that the connection has been made.
                                                                                          Unlike the Python API, which requires us to import
                                                                                          the Minecraft library, Sonic Pi 2.5.0 Dev is already
                                                                                          configured to connect to Minecraft if we give it a
                                                                                          command that will output in the Minecraft world.

                                                                                          Project 1 – Mixing music with worlds
                                                                                          Our goal for this project is to teleport the player from
                                                                                          one place to another and to play a jingle at the same
                                                                                          time. Let’s begin with our first line of code, which is the
                                                                                          start of an infinite loop – but not your typical “while
                                                                                          True” loop. Rather, we use.
                                                                                          live_loop :NAME do



84                                                                www.linuxvoice.com
                                                                                                                         EDUCATION TUTORIAL

  #Code to loop indefinitely
end
   This loop enables us to update its contents on the
fly, an increasingly popular and challenging practice
known as live coding, where changes to code are
instantly reflected and shown to a live audience. A live
loop needs a name, so we'll call this one “project1”.
   Once you make changes to the code you'll need to
reload the code using the Play button; it will take effect
the next time the code is loaded, with no break in the
music. At the end of a loop we must make sure that
we close the loop using end, otherwise we'll generate
an error in Sonic Pi.
   Inside the loops we'll add the code that we wish to
repeat, which will be as follows.
Find the position of the player
                                                                                                                                  In Project 2 the towers
Teleport them 5 blocks in every direction                            With the code in place, let's test it out. Click on the
                                                                                                                                  are 100 blocks high, with
Play a sample to indicate success.                                Play button and switch your focus to Minecraft. Every           each block being 1m high.
   Teleportation is achieved by changing the player's             two seconds your player will be teleported to a new             This means that we have
x,y and z positions in the world, and we can do this              location. With that test successfully under our belt            created 200m of blocks in
in two ways: using a relative position to our current             press the Stop button to cease teleporting the player.          less than a second!
position, or with an absolute position. The benefit               Now we need to add the sound effect to accompany
of using a relative position is that we can transport             the teleport. There are many different samples that
the player around the map no matter where they are,               come with Sonic Pi, but one of the most recognisable
whereas an absolute position will return our player to            is called Amen, used since 1969 as a drum solo and
the same place in the map.                                        a sample added to hip hop music. In our code it looks
   In order to teleport a player to a relative position           like this.
we'll need to know where they are in the Minecraft                live_loop :project1 do
world. We can find this out using mc_location, which                 sample :loop_amen
will return the player's coordinates in the world. In                x, y, z = mc_location
order to breakout the coordinates into each axis we                  mc_teleport(x + 5, y + 5, z + 5)
will create three variables called x, y and z. Now our               sleep 2.2
code will look like this.                                         end
live_loop :project1 do                                              Now click on the Play button to restart the code,
   x, y, z = mc_location                                          and we should see our player teleport along with a
end                                                               brief sample of the Amen loop.
   Now each time the loop iterates we will update
the variables with the player's current location. Let's           Project 2 – Create to the beat
use these positions to teleport our player using mc_              One of the most exciting areas for merging Sonic Pi
teleport from the current position to 5 blocks in every           and Minecraft is creating interactivity between the two.
direction, effectively moving us in a 3D movement to              In this project we'll show how we can synchronise the
the top-right of a 5x5x5 cube – that is, until gravity            beat of the music to activity in the world. Let's start
takes hold and drops you to the ground. We’ll include             with a blank workspace and a Minecraft world open
a two-second delay to enable the teleport to be                   and ready. The first line of code is a simple post to
successfully displayed on the screen.                             chat message welcoming the player to the project.
live_loop :project1 do                                            mc_chat_post("Hello welcome to Project 2")
   x, y, z = mc_location                                            Next we will teleport the player to a location:
   mc_teleport(x + 5, y + 5, z + 5)                               mc_teleport(14,6,-88)
   sleep 2.2                                                        With these two lines completed we now turn our
end                                                               attention to the loop. Again we will use the same live


  Sonic Pi and Ruby
  Developed by Dr Sam Aaron as a personal project to create       Matsumoto as a personal project to help create an object-
  music using programming logic, Sonic Pi’s is now part of the    oriented scripting language. Sonic Pi is a great gateway to
  default Raspbian operating system, bringing it into the homes   learning more about Ruby, and there are two great resources
  of many thousands of eager Raspberry Pi users.                  we'd recommend if you're just starting out: an application
     It's powered by Ruby, and its ease of use and clear          called Kids Ruby, available from http://kidsruby.com, and the
  syntax enables anyone to compose their own music. The           book Ruby Wizardry, written by Eric Weinstein and published
  Ruby language was created in the 1990s by Yukihiro "Matz"       by No Starch Press.




                                                                    www.linuxvoice.com                                                                   85
     TUTORIAL EDUCATION

                                                                                         number 60 is equivalent to a middle C. After the note
                                                                                         has been played we instruct the project to pause for a
                                                                                         second. This helps us to control the beat.
                                                                                           We will now alter the blocks that make up our
                                                                                         towers, by changing the block type, but keeping the x, y
                                                                                         and z coordinates the same. In this case we swapped
                                                                                         the diamond for obsidian and the gold for melon.
                                                                                          mc_set_area(:obsidian, 12, 6, -90, 12, 106, -90)
                                                                                          mc_set_area(:melon, 13, 6, -91, 13, 106, -91)
                                                                                           We now play a D# note and again instruct Sonic Pi
                                                                                         to wait for 1 second.
                                                                                          play 63
                                                                                          sleep 1
                                                                                           Finally we close the two loops that make up the
                                                                                         project; these are live_loop do and with_fx.
                                                                                          end
Our towers rise menacingly
                             loop as per project ,1 but we'll call the loop project2.    end
from the ground and dwarf
the course for Project 3!    live_loop :project2 do                                        With the code complete, click on the Play button
                               In the loop we will create another loop to handle         and then change your focus to the Minecraft window.
                             playing any samples of audio with effects, in this case     You'll see your player teleported to the location of the
                             reverb to give the audio a presence and gravity. The        towers and a 24-esque booming noise will sound to
                             sample that we will play is a boom, and we will play it     the beat.
                             once per second.
                             with_fx :reverb, room: 1 do                                 Project 3 – Crazy platforms
                              sample :bd_boom, amp: 10, rate: 1                          For the last project we will create our own platform
                                Now we change our focus to building the towers of        game along with a soundtrack. We start with a new
                             blocks. The towers are built at absolute coordinates,       workspace and Minecraft open with a new world. Our
                             so they will appear at the same place every time.           first few lines of code again use the chatbox to
                             We first create the two towers using the command            introduce the project.
                             mc_set_area and then specify the type of block to use.      mc_chat_post("Welcome to project 3 - can you make it to the
                             We then provide the starting x,y and z coordinates          end")
                             and then the finishing coordinates. So our first tower      mc_chat_post("without falling off?")
                             is made of diamond and starts at x12, y6 and z-90 on          Next up we level out the playing area by turning a
                             the map. We then specify that the x and z coordinates       big cube of the world into air.
                             remain the same, but the tower will be 100 blocks tall,     mc_set_area(:air, -12, 8, -81, 3,20,-56)
                             this is done by setting the final y value to 106.             Now we teleport the player to the start of our
                              mc_set_area(:diamond, 12, 6, -90, 12, 106, -90)            platform game.
                              mc_set_area(:gold, 13, 6, -91, 13, 106, -91)               mc_teleport(-12,8,-81)
                               With the first tower complete, you can see that             This time we start the live loop process again,
                             our second tower is made of gold and has the same           renaming the loop to project3. We also create another
                             height, but the start and finishing x and z coordinates     loop to handle the reverb audio effect and reuse the
                             are next to the main tower. Now that we have created        boom sample from project 2.
                             the towers we'll play a note to create the beat of our      live_loop :project3 do
                             project.                                                      with_fx :reverb, room: 1 do
                              play 60                                                      sample :bd_boom, amp: 10, rate: 1
                              sleep 1                                                      Now we create the first few platforms, these are
                               Sonic Pi uses MIDI numbers to identify notes that         how our player can jump from place to place. We
                             you can play in your compositions, and the note             create them using the mc_set_area function that we




                                                                                         This course resembles a typical platform game, with
                             Our towers are so high that they exceed Minecraft's draw    hazards around every corner! It would look rather good
                             distance, creating a fog effect for objects too far away.   with lava underneath it.



86                                                                www.linuxvoice.com
                                                                                                                             EDUCATION TUTORIAL

                                                                                                                                   In classic homage we’ve
                                                                                                                                   included a yellow power
                                                                                                                                   up box with a mushroom
                                                                                                                                   inside it. Remember kids,
                                                                                                                                   don’t eat any mushrooms
                                                                                                                                   that you cannot identify.




A player's-eye view of the course – this is similar to what
Mario can see. That platform looks rather narrow!
                                                                     mc_set_area(:mushroom_red, -2, 19, -65, -2, 19, -65 )
learnt in Project 2. The first platform will be made                 We now create a platform to the right of the original
of grass and be three blocks long; the next two will               path, requiring the player to side step off at their peril.
be made of wood and made to hover in the air by                      mc_set_area(:wood_plank, -3, 13, -59, -3, 13, -61, )
changing their y coordinates.                                        mc_set_area(:diamond_block, -3, 13, -58, -3, 13, -55 )
 mc_set_area(:grass, -12, 8, -81, -12, 8, -83, )                     We change the block type to redstone and drop a
 mc_set_area(:wood_plank, -10, 9, -81, -10, 9, -83, )              block in the line, we’ll use it later on.
 mc_set_area(:wood_plank, -8, 10, -81, -8, 10, -83, )               mc_set_area(:redstone_ore , -3, 13, -54, -3, 13, -54 )
  To make it a little tricky our next block is only two              A few more diamond blocks to make up a path to
units long, controlled by the z axis.                              the end of the course.
 mc_set_area(:wood_plank, -6, 11, -81, -6, 11, -82, )               mc_set_area(:diamond_block , -3, 13, -53, -3, 13, -48 )
   Our next portion of code creates a larger platform               mc_set_area(:diamond_block , -3, 14, -47, -3, 14, -46 )
by expanding the x and z coordinates but keeping the                mc_set_area(:diamond_block , -3, 15, -45, -3, 15, -44 )
y coordinate the same.                                                The goal for our course is the large stone dance
 mc_set_area(:wood_plank, -4, 12, -81, -2, 12, -83, )              floor; we'll reuse the same technique that made the
  Now we create a long thin row of wooden blocks.                  large wooden platform earlier.
 mc_set_area(:wood_plank, -2, 13, -81, -2, 13, -70, )               mc_set_area(:stone_slab , -1, 14, -43, -6, 14, -38 )
   On top of some of the wooden blocks we add some                   Remember that block of redstone we used earlier?
diamond blocks to create a raised platform. Then we                The next portion of code will change it to a block of air
create a gap between them by ending the first row                  every second, effectively creating a trapdoor – sneaky!
at z -69 and starting the next at z -66. We also create             sleep 1
some air blocks in between them.                                    mc_set_area(:air , -3, 13, -54, -3, 13, -54 )
 mc_set_area(:diamond_block, -2, 14, -71, -2, 14, -69 )             sleep 1
 mc_set_area(:diamond_block, -2, 14, -66, -2, 14, -60 )               For our last portion of code we create another
 mc_set_area(:air, -2, 14, -68, -2, 14, -67 )                      live_loop to handle the music, which is a mix of an
  Now we create a yellow block and mushroom as an                  industrial-sounding sample and an electric guitar
homage to the Mario games. This will appear above                  playing chords. We use the reverb effects to give it an
our diamond path.                                                  ominous twist.
 mc_set_area(:melon, -2, 18, -65, -2, 18, -65 )                    live_loop :industrial do
                                                                     with_fx :echo, mix: 0.3, phase: 0.25 do
                                                                      #sleep 2
  Sonic Pi resources                                                  sample :loop_industrial, rate: 0.5
  The Raspberry Pi Foundation’s education team have created           sample :guit_e_fifths, rate: 0.5
  a series of worksheets that are free to use and download           end
  from their website: www.raspberrypi.org/resources/learn.           sleep 4
  Key computing concepts such as loops, variables etc are
                                                                   end
  explained using musical composition, helping children to
  understand both music and coding, but with a heavy slant           With this code complete, press the Play button in
  upon the musical elements.                                       Sonic Pi and you will see that the Minecraft window will
     The Sonic Pi website at http://sonic-pi.net is also a great   update to show the game. Can you make it to the end
  resource, with code snippets and audio samples on the site       without falling off?
  for you to insert into your own compositions. There are also
  sections covering the use of Sonic Pi in the classroom along
                                                                     And that’s it! We have taken our first steps with
  with guides for teachers to use when planning lessons.           Sonic Pi and Minecraft. If you'd like to know more,
     Sonic Pi can be downloaded for Windows, Mac and               there's a handy resource provided by the Raspberry Pi
  Raspberry Pi from the Sonic Pi website. At the time of           Foundation at http://bit.ly/LV_SonicPi.
  writing there are no prepackaged versions for Linux
  distributions other than Raspbian, but you can download
                                                                    Les Pounder divides his time between tinkering with
  the source code from https://github.com/samaaron/sonic-
                                                                    hardware and travelling the United Kingdom training teachers
  pi and build it from source.
                                                                    in the new IT curriculum.




                                                                     www.linuxvoice.com                                                                   87
     TUTORIAL GPX PROCESSING



                              GPX PROCESSING: CREATE, EDIT
          TUTORIAL
                              AND SHARE GPS DATA
                              Don’t get lost on the way to the shops – keep an (open, editable)
MARCO FIORETTI
                              record of your movements with GPS.


                              A
                                       s anyone who’s studied the golden age of
 WHY DO THIS?
                                       Elizabeth the first knows, maps are important.
 • Make sure that all your             The Spanish maps of the time were more or
   GPS data will always
   remain available           less green blobs, while the English and Dutch maps
 • Prepare high-precision     were superbly accurate for the time, enabling an era of
   digital routes for your    maritime dominance. Those days are gone now, and
   future vacations           in the past they must remain, but maps are still
 • Share GPS data with        important. Remembering the exact path followed
   others, or create it
   to geotag your own         during a trekking, for example, lets you give safer
   photographs                advice to friends interested in the same route. Detailed
                              analyses of walks or biking trips may provide useful
                              inputs for staying in good physical shape. Automatic
                              comparison and processing of travel logs from many
                              people are essential in many important activities, from
                              mapping to traffic predictions and planning of public      The GPSPrune main window, showing how it renders a
                              transport.                                                 GPS track downloaded from gpsies.com, and how much
                                 Any scenario like these relies on the same data:        detail can be hidden in each trackpoint of a GPX file.
                              sequences of location/time pairs, which can be
                              recorded in real time by Global Positioning System         Language: plain text, with each type of data enclosed
                              (GPS) devices or generated by software.                    by appropriate markers. Of course, this doesn’t explain
If you really want or need       This tutorial describes GPX – the GPS eXChange          why anyone but GPS maniacs would want to mess
to do it, both GPSPrune (in   Format. Many products with GPS capabilities store          with GPX files in the first place. The point is that
the screenshot) and Viking
                              data in their own format. Therefore, an open GPS           knowing GPX is essential to obtain GPS data good
will let you edit waypoints
                              interchange standard like GPX is the best way to make      enough to be useful for you, in ways that you may
directly. These operations,
however, can be often done    sure that your GPS data will remain fully reusable with    never have imagined. Even where there was no data
much more efficiently at      any other GPS software or navigator.                       at all to begin with!
the command line, with           GPX is also very easy to hack, because it’s just           Good GPX tracks are usable for creating custom
GPSBabel.                     another dialect of XML, the eXtensible Markup              maps of your trips, or routes for your GPS navigator.
                                                                                         They are also essential for geotagging; that, is giving
                                                                                         geographical coordinates to photographs and other
                                                                                         documents, so they can show up on any digital,
                                                                                         interactive map.
                                                                                            Unfortunately, most of the GPS tracks recorded in
                                                                                         real time by ordinary navigators and smartphones
                                                                                         are not reusable in any meaningful way. Real GPX
                                                                                         files often contain redundant data (such as duplicate
                                                                                         points where you stopped to enjoy the scenery,
                                                                                         or roads already saved), errors (points with bogus
                                                                                         coordinates, caused by poor signal reception) and
                                                                                         actual holes, where there was no satellite signal at all.
                                                                                         This unfortunate fact of life, which has nothing to do
                                                                                         with file formats, is why you want to be able to create
                                                                                         and edit, not just use, GPX files.

                                                                                         The GPX format
                                                                                         Let’s start by looking at a very short snippet of a basic
                                                                                         GPX file (edited for clarity!):
                                                                                          <?xml version=”1.0”?>
                                                                                          <gpx version=”1.0” creator=”Viking”



88                                                           www.linuxvoice.com
                                                                                                         GPX PROCESSING TUTORIAL

 xmlns:xsi=”http://www...”
 xmlns=”http://www.topografix.com/GPX/1/0”                     Micro GPX/GPS glossary
 xsi:schemaLocation=”http://www... “>
 <trk>                                                         GPS is a complex technology, heavily based            user-specific locations, like your home or
                                                               on very complicated calculations and                  place of work.
  <name>mignone-track-1</name>
                                                               mathematical models. In order to use it as            Route A series of waypoints that
  <trkseg>                                                     we propose here, however, you only need               correspond to the exact path one intends,
  <trkpt lat=”42.202982878” lon=”11.882421524”>                to know the meaning of a few key terms                or should follow to go from one point to
   <name>Beginning ofthe hike</name>                           explained here. However, in other GPS-                another, eg from home to office. Internally,
   <time>2015-03-20T09:09:18Z</time>                           related contexts, several of the terms below          a route can be divided in several legs.
                                                               can, and do, have additional meanings!                Track A series of trackpoints that describe
   <ele>115</ele>
                                                                  Geodetic Datum A mathematical model of             exactly the path that somebody has
  </trkpt>                                                        the real surface of Earth, which is not a          already followed to go from one place to
 ETCETERA...                                                      perfect sphere or ellipsoid. Several datums        another, including when he or she moved
Not really hard to understand, is it? The initial header          exist, partly for historical reasons and           through each point. In other words, while
may also contain, among other things, a detailed                  parthly because each of them describes             routes are suggestions of directions for
                                                                  some part of the planet better than the            the future, tracks are logs of actual travels,
description of the file, author name, or keywords.
                                                                  others. All GPS coordinates are based on           already happened. Tracks can be divided
   After the header, a GPX file may contain any                   the WGS-84 datum surface.                          into segments.
combination of waypoints, tracks and routes. The                  Waypoint A single point, defined by its            Trackpoint Just like a waypoint, but with
example shows the beginning of a track called                     latitude, longitude and elevation, of the          more data, because it must describe when
mignone-track-1, with name, coordinates, elevation                Earth’s surface. GPS files and devices             someone passed there, at which speed,
                                                                  store generic landmarks as waypoints,              how the GPS signal was received, and
and creation time of the first point (trkpt) of its first
                                                                  from monuments to restaurants, as well as          other stuff.
segment (trkseg).
   GPX files use the WGS 84 datum (see the box, right,
for what this means), storing latitude and longitude            Let’s now take a quick look at how to increase the
in decimal degrees and elevation in metres. Times, in        quality and usability of the GPX files you already have.
the format YYYY-MM-DDTHH:MM:SSZ, are always                  Some operations are much faster at the command
in the Coordinated Universal Time (UTC) time zone.           line with GPSBabel, and some with the other tools.
A point may also contain data including GPS signal           Once you start, you’ll quickly find out which tool is
strength and a specific place (the <extension></             better at each task, for your actual needs and taste.
extension> tag) for, you guessed it, data from third-        Here, we give more examples with GPSBabel simply
party extensions.                                            because it is the least intuitive program of the bunch.
                                                             All the examples focus on tracks, because they
Three great GPX free software tools                          usually need much more editing, much more often,
There are several programs for GPX editing on Linux.         than waypoints and routes. Most of what follows,
Three of the best are: GPSBabel (www.gpsbabel.org),          however, also applies to those other kinds of data.
GPSPrune (http://activityworkshop.net/software/                                                                                           PRO TIP
gpsprune), and our personal favourite, Viking                Metadata                                                                  It’s an absolute must to
                                                                                                                                       give each item a coherent
(http://sourceforge.net/projects/viking).                    The best way to make GPX files useful and reusable is
                                                                                                                                       name and set of labels,
  GPSBabel is a universal GPS converter and                  to add rich and consistent tags and other metadata.                       if you want to keep your
processor that can work with literally hundreds of GPS       Unfortunately, this is also a task that’s better done the                 collection under any
                                                                                                                                       semblance of control.
formats beside GPX. The only way to convert many             “dirty” way – adding them manually with a text editor,
                                                                                                                                       This is also true with GPX
GPS tracks at once is to use scripts, and the only tool      or writing shell scripts that perform the same tasks.                     files, so plan carefully
usable with these scripts is GPSBabel, so you’d better       This is much easier than you may think, since GPX is                      how to organise yours
                                                                                                                                       before you start.
focus on how it works at the prompt.                         plain text. And even if there were full-featured GUIs for
  The simplest GPSBabel commands just convert                GPX metadata, you would have to do a lot of manual
formats, and all take this form:                             work inside them anyway. No software may decide
-gpsbabel -i INPUTFORMAT -f INPUTFILE -o OUTPUTFORMAT -F     autonomously, for example, what it should write as
OUTPUTFILE                                                   “author” or “licence” if you combine many tracks from
where the -f and -F switches define the names of the         different sources. Scripts or manual editing may also
input and output files, and -i and -o their respective       be mandatory to remove sensitive data before sharing
formats. The real power of GPSBabel, however, is its         the files.
collection of filters, which we will show in a moment.
  GPSPrune, which runs anywhere there is Java 1.5            Track transformations
or later, is great for editing already-existing GPX files.   A common need with GPX files is to combine multiple
Viking, on the other hand, lacks some of the niftiest        tracks (maybe recorded simultaneously by different
functions of GPSPrune (including a real undo feature),       GPS navigators) into a single one that fully describes
but being a native Linux application it fits better with     the whole trip. With GPSBabel, you can do this with the
most Linux desktops. Besides, it’s great for drawing         merge or pack options, as in these examples that
GPX tracks and routes from scratch, and can create           introduce the general syntax of GPSBabel filters:
maps with the Mapnik toolkit, search tracks by date          gpsbabel -t -i gpx -f track-1.gpx -i gpx -f track-2.gpx -x
and plenty of other things.                                  track,merge,title=”FULL TRIP” -o gpx -F full-trip.gpx



                                                               www.linuxvoice.com                                                                                 89
     TUTORIAL GPX PROCESSING

                                                                                                      transforms a track or set of waypoints into a route,
                                                                                                      or vice versa. Reversion produces instructions to, so
                                                                                                      to speak, “get back home”, by reverting the order of
                                                                                                      all the points into a track or route. To transform, for
                                                                                                      example, a set of waypoints into one route, use:
                                                                                                      gpsbabel -i gpx -f myfile.gpx -x transform,rte=wpt
                                                                                                        In the other case, type:
                                                                                                      gpsbabel -t -i gpx -f myfile.gpx -x reverse -o etc etc...
                                                                                                      in GPSPrune you could do the same, selecting the
                                                                                                      track as a range of points and then clicking on
                                                                                                      Reverse Range in the Range menu.

                                                                                                      Removing cruft
                                                                                                      As we said, it is extremely common for a real GPX
                                                                                                      track to contain many points that shouldn’t be there.
                                                                                                      Can we find and remove them efficiently?
                                                                                                         Viking can only remove points with exactly the same
                                                                                                      position or time. GPSPrune can create a new point
                                                                                                      whose coordinates are the average of all the points
Drawing tracks and routes
                                 gpsbabel -t -i gpx -f track-1.gpx -i gpx -f track-2.gpx -x           you had previously selected. This program also has
in Viking is a pleasure. Do
you see the street names?        track,pack,title=”FULL TRIP” -o gpx -F full-trip.gpx                 four cleaning options under the Track > Compress
That’s OpenStreetMap                In the first case, the track, merge, title part tells             Track menu option, called Duplicate, Wacky, Singleton
layered over right over          GPSBabel to take all the input tracks, filter them by                and Nearby. Duplicate, as the name suggests, only
satellite pictures, to let you   merging all their points into one sequence sorted by                 finds exact duplicates. Wacky and Singleton identify
see as exactly as possible       timestamps, and put that sequence into one new                       outliers – points too far from the adjacent ones to be
where each trackpoint            track called FULL TRIP. The pack filter of the second                genuine. The Nearby filter marks as likely duplicates
should go.                       command is more efficient, as it simply appends                      all points that are closer to each other than a given
                                 tracks to one another as they come. For the very                     ‘span factor’, which is related to the total area covered
                                 same reason, however, it will produce correct output                 by the whole track. Whatever option you choose, you
                                 only if applied to tracks that never overlap in time!                must then click on Track > Delete Marked Points to
                                    Combining multiple tracks is as common a need as                  remove the points that were selected.
     PRO TIP                     its opposite – splitting single GPS tracks. Many such
 Many GPX operations             tracks, in fact, contain different independent paths                 Interpolation
 can only be done in a           that have no real reason to stay together, like trips to             As well as having to get rid of errant points, you may
 graphical interface, with a
 good map as background.         unrelated places. Splitting those tracks, in the same or             find that some of your tracks contain too few points to
 For many others, though,        different files, makes them more searchable and can                  be useful. Points that are one or more mile apart, for
 shell scripts remain a          be done in several ways. GPSPrune and Viking both                    example, may be too few to get accurate directions on
 much more efficient.
 If you want to become           have relatively intuitive commands for this, but may                 the ground. The solution in these case is to interpolate
 a serious GPX hacker,           be much slower to use with the required accuracy.                    – to tell your software to automatically fill the track
 refresh your scripting          GPSBabel filters, instead, can automatically split tracks            with more points. This is quite easy in GPSPrune (look
 skills first!
                                 according to time and distance, exactly as you need:                 for ‘Interpolate’ in the Range menu) and with
                                 gpsbabel -t -i gpx -f in.gpx -x track,split,title=”LOG # %Y%m%d”     GPSBabel. The latter can interpolate between every
                                 -o gpx -F out.gpx
                                 gpsbabel -t -i gpx -f in.gpx -x track,split=4h,title=”LOG # %c” -o
                                 gpx -F out.gpx
                                 gpsbabel -t -i gpx -f in.gpx -x track,sdistance=0.5k” -o gpx -F
                                 out.gpx
                                     The first command creates one separate track per
                                 day, titled LOG of YYYYMMDD. The second starts a
                                 new track every time two consecutive points have
                                 timestamps at least four hours apart. The sdistance
                                 filter does the same thing every time the distance
                                 between consecutive points is above the given
                                 threshold (500 meters in the example). The split
                                 and sdistance filters can be combined (written one
                                 after the other) separated by a comma: this makes
                                 GPSBabel create new tracks only if both time and                     Once you have finished drawing or cleaning up a GPX
                                 distance intervals exceed their thresholds.                          track or route, getting a 3D version of it that you can
                                     Two other important transformations are data                     rotate as you want only takes a few more clicks in
                                 structure conversion and reversion. Conversion                       GPSPrune.



90                                                                     www.linuxvoice.com
                                                                                                            GPX PROCESSING TUTORIAL

two adjacent points that are too far either in distance
(10km in the first example) or time (10 minutes in the
second one):
gpsbabel -i ... -x interpolate,distance=10k -o ...
gpsbabel -i ... -x interpolate,time=600 -o ...
  Whatever tool you use, it will place the new points
along a straight line, at regular intervals. Therefore,
you may need to adjust some of those points by
moving them manually in the GUI editors.

Going 3D
Since we don’t live in a flat world, elevation matters.
You can’t estimate speed or travelling time, or draw a
3D map of a track if you don’t know the altitude of all
its points. GPS navigators will add such data
automatically, but tracks you drew in your computer
need to get them from some other source. The
easiest way we found to add elevations to tracks and
routes is the Online > Get Altitudes From SRTM
                                                                                                                                  Viking and GPSPrune can
function in GPSPrune.                                              reach the borders of the window, click on the Pan
                                                                                                                                  geotag all the points in a
                                                                   button to move the map, and then again on Create               photograph automatically,
How to create tracks from scratch (and why)                        Track. When you’re done, click on the track name in            or let you manually place
Drawing tracks and routes from scratch isn’t just fun:             the left-hand pane, select Finish Track and save. You          each one of them in the
sometimes it’s absolutely necessary. Viking is great for           can also add existing tracks or waypoints in their own         right place.
drawing tracks and routes, thanks to its layer system.             layers, to use them as reference.
Here’s how to use it: first, pan and zoom the Default                 What’s the point of a good track if you can’t show it
Map (OSM) until you are exactly where you want to                  off? The 3D-View panel of GPSPrune (which requires
draw. Next, select Layers > New Map Layer and                      the j3d library) can display tracks on a 3D terrain that
choose Bing, or any other set of satellite/aerial                  you can rotate at will and export in various graphic
photographs. Then select the Default Map layer in the              formats. If privacy isn’t a problem, uploading a GPX
left-hand pane, click on Layers > Properties and                   file to http://utrack.crempa.net will produce reports
change its transparency, setting its alpha value to                with several statistics, and better graphics than those
something around 120 or 130.                                       you can get from GPSPrune or Viking.
   By doing this, that is, by laying OSM right over
actual photographs of the area, the actual drawing                 Geotagging
will be really accurate and easy: add and select a new             Once you have a good GPX track complete with
‘TrackWaypoint’ layer, click on the Create Track button,           timestamps, you can use it to automatically geotag
and start clicking where the track should pass. If you             pictures. Viking, GPSPrune and photograph managers
                                                                   such as Digikam all have interfaces that enable you to
  GeoJson and KML                                                  write the geographical coordinates into each picture
                                                                   of a given folder the point of the track that has the
  While GPX is the lingua franca of GPS, there are at least        same, or the closest timestamp.
  two other geographic formats that you should know about:            3D images will appear much faster, printouts will be
  GeoJSON (http://geojson.org) and the Keyhole Markup
                                                                   much clearer and geotagging really accurate, only if
  Language (KML, https://developers.google.com/kml/
  documentation). The first is widely used in OpenStreetMap        you’ve created te best tracks possible. To continue on
  applications such as Umap, and the second in Google Maps         this path, first read the right stuff – all the GPSBabel
  and Google Earth.                                                examples here are samples of the great
     GeoJSON can describe all kinds of location-related data,      documentation at www.gpsbabel.org. Other must-
  from country boundaries to the history of tourist locations.
                                                                   reads are the GPX homepage (www.topografix.com/
  You can move from GPX to GeoJson and vice versa (see
  https://developers.google.com/kml/documentation                  gpx.asp) and the tutorials at www.gpsvisualizer.com,
  and, respectively, https://github.com/tyrasd/togpx), but         which is also a web-based GPX editor. Invite all your
  the second procedure often loses information, because            relatives, high school friends and so on to go there
  GeoJson is much more complex than GPX.                           and draw the places and walks you did together in the
     KML is another XML format for waypoints, tracks and
                                                                   old days, and send you the results. With any luck, and
  routes, with the important difference that, unlike GPX, it
  was specifically designed for annotating maps. This is why       without asking anybody to install any software, you
  KML files come in two flavours: .kml and .kmz. The first         should receive lots of GPX files to combine and reuse
  of these are plain text files, while files ending .kmz are ZIP   as shown in this tutorial!
  archives that may also contain icons, full text documents or
  image overlays. GPSBabel can, of course, convert data from        Marco Fioretti is a free software campaigner and one of the
  one format to the other.                                          instigators behind the Digital DIY project – www.didiy.eu.




                                                                     www.linuxvoice.com                                                                  91
     TUTORIAL LISP



                     LISP: ELEGANT PARENTHESES
       TUTORIAL
                     FOR A MORE… CIVILISED AGE
     JULIET KEMP
                     A language created for artificial intelligence research sounds
                     modern – but Lisp comes from 1950s…

                     L
                              isp is the third of the big four early languages, a
                              year younger than FORTRAN and about the
                              same age as ALGOL. But unlike ALGOL, Lisp
                     has been in use ever since that its first
                     implementation, and is undergoing something of a
                     revival in recent years. Lisp stands for List Processing,
                     and as you’ll see when you read on, lists are what Lisp
                     is all about.
                        John McCarthy began thinking about an algebraic
                     language in 1956, and he and colleagues spent the
                     next couple of years looking at conditional
                     expressions and the possibility of writing a list
                     processing language in FORTRAN. When McCarthy
                     started at MIT in 1958, he began both working on an                       Lisp Slime; note the use of the quote evaluator with car
                     artificial intelligence project, and implementing Lisp,                   and cdr; when I missed it out the first time, it produced an
                     based around the vital idea of using a list for both                      error. The quote tells Lisp that this is data not code.
                     code and data.
                        Initially, his team postponed the idea of writing a                    that one could build a Turing-complete algorithm
                     compiler in favour of hand-compiling Lisp functions                       language with only a very few simple operators and a
                     and subroutines in assembly language, making for a                        function notation. (See the boxout for more detail.)
                     kind of Lisp ‘environment’ used by stringing functions                       As part of this paper (www-formal.stanford.edu/
                     together. Various simplifying decisions which resulted                    jmc/recursive/recursive.html), McCarthy described
                     from this made Lisp into a neat way of describing                         an eval function, written in Lisp. Steve Russell
                     computable functions, and McCarthy published a                            noticed that this would, if implemented, act as a Lisp
                     paper in 1960 focussing on this. The paper showed                         interpeter, and went ahead and implemented it on the


                       The theory of Lisp
                       The basic Lisp building block is an expression, which is either             Part of Register Number, and cdr for Contents of the
                       an atom (a sequence of letters, like name) or a list (() is a zero-         Decrement Part of Register Number.)
                       length list; (a b (foo bar)) is a 3-element list, one of whose          6   (cons x y) concatenates the elements of the list y after the
                       members is a 2-element list). (Note that to evaluate these in               value of x.
                       Slime you’ll need to quote them; see below.)                            7   (cond (p1e1) ... (pnen)) evaluates each p expression in turn
                           Expressions also have values: an expression e returns                   until it finds one which evaluates true. The corresponding e
                       a value v. McCarthy established seven basic (axiomatic)                     expression is then returned as the value of the whole cond
                       expressions. In each case the expression is a list, with the                expression.
                       operator as the first element of the list and the arguments the              Finally, McCarthy defined a function expression:
                       rest of the list.                                                       ((lambda (x y) e) a b)
                        1 (quote x) or (‘ x) returns x. quote protects a list from being          x and y are parameters, e is an expression, and a and b are
                          evaluated, meaning it is treated as data instead of as code.         values (which may be expressions that first must be evaluated
                          Since in Lisp both code and data are lists, quote enables us         to give their values). e is evaluated with a substituted for x and
                          to tell the difference.                                              b substituted for y wherever they occur. A function can have
                        2 (atom x) returns t if x is an atom, or the empty list. If x is a     as many parameters and values as you like.
                          list, it returns (). In Lisp, t represents truth and () represents      Functions can also refer to themselves using the notation
                          falsity.                                                             label, but in Lisp this is usually written as:
                        3 (eq x y) returns t if x and y both evaluate to () or to the same     (defun f (x y z) e)
                          value, and () otherwise.                                             then the function is called as (f a b c) with a substituted for x
                        4 (car x) returns the first element of the list x.                     in e, and so on. Paul Graham’s excellent paper
                        5 (cdr x) returns everything after the first element of the list x.    (www.paulgraham.com/rootsoflisp.html – to which I owe
                          (car and cdr originate from the initial IBM 704 hand-coding          thanks for the above) goes on to explain in detail how this
                          of Lisp, which used two assembly language macros to                  setup enables McCarthy to define a function which evaluates
                          decompose lists. car stood from Contents of the Address              any Lisp expression; so Lisp can interpret itself.




92                                                          www.linuxvoice.com
                                                                                                                                LISP TUTORIAL

project’s IBM 704. (Somewhat to McCarthy’s surprise;
until Russell succeeded, he didn’t believe that the eval        Modern Lisp dialects
in the paper could be translated into machine code.)            There are currently three well-known dialects   Python and Ruby VMs. It’s influenced by
This was slow, but it was a genuine Lisp interpreter.           of Lisp (and a collection of less-well-known    Haskell and keen on immutability. It provides
It was an exciting step forward, but McCarthy has               ones as well).                                  direct access to Java libraries, to speed up
commented that the existence of the interpreter did                 Common Lisp has a large language            links with Java code.
also have the less-desirable effect of freezing the             standard with lots of built-in types,              There are also a handful of Lisp dialects
                                                                functions, macros, etc, and an object system.   used as scripting languages. The best known
existing form of the language. The first complete               It has also borrowed some features from the     is of course Emacs Lisp, but others include
compiler (also written in Lisp) was also implemented            Scheme programming language.                    the embedded Gimp Script-fu, and embedded
at MIT, in 1962, by Tim Hart and Mike Levin.                        Scheme was designed to be clear, simple,    languages in Audacity, AutoCAD, and other
   Lisp development continued, and during the 1960s             and minimalist. It can express numerous         CAD apps. Lisp is used on running on top of
and 1970s, Lisp was heavily used in AI research,                different programming styles. It does           JVMs in Clojure, and Common Lisp is used in
                                                                however have a smaller set of standard          financial institutions.
which required significant processor time and vast              features than Common Lisp.                         Any of the major three dialects can be
(for the time) memory space. This was made more                     Clojure compiles directly to Java Virtual   useful, and any of them will teach you Lisp
difficult because machines were usually optimised for           Machine bytecode, and also targets the          basics. Here I’ll use Common Lisp.
Fortran or assembler, rather than for Lisp. Initially, too,
Lisp, being interpreted rather than compiled, ran much
more slowly; and garbage collection was a problem,            boxout for more on currently available dialects of Lisp.
though this was improved by the routines developed              For a rundown of Lisp’s early history from McCarthy
at MIT by Daniel Edwards.                                     himself, check out www-formal.stanford.edu/jmc/
   Trying to resolve these issues, in 1973, two MIT           history/lisp/lisp.html.
AI researchers built a machine with some Lisp
operations as part of the hardware rather than                Installing and getting started
software. Towards the end of the decade, this                 The most popular Linux implementation of Common
led to the creation of Symbolics, a commercially              Lisp is SBCL (Steel Bank Common Lisp). You can
funded company aiming to produce Lisp machines.               make do with just this (install via your package
Various other manufacturers followed suit through             manager or from the website), but installing Emacs
the early/mid 1980s. Lisp machines were briefly               and Slime – the Superior Lisp Interaction Mode for
successful, and they really were very good at what            Emacs – as well will give you a more functional dev
they did, but the advent of the microcomputer meant           environment.
that by the end of the decade they were largely                 Once you’ve installed them, add these lines to your
obsolete. Symbolics no longer exists as a computer            ~/.emacs:
manufacturer, but a private company owns its assets           ;; Set up Common Lisp
and continues to sell the Genera Lisp machine OS,             (add-to-list ‘load-path “/usr/share/common-lisp/source/slime/”)
which runs on various Symbolics Lisp machines                 (setq inferior-lisp-program “/usr/bin/sbcl”)
and DEC Alpha. It also sells the Macsyma computer             (require ‘slime)
algebra system. (symbolics.com was the first ever             (slime-setup)
.com domain, registered on 15 March, 1985.)                   ;; Use highlight colors
   Interest in Lisp declined in the 1990s, but recently       (global-font-lock-mode t)
there has been an increase of interest again. See the         Start emacs, type M-x slime, and you’ll see a CL-USER (or *)
                                                              prompt. This is your Lisp command prompt. Try typing some
                                                              things:
                                                              > (* 2 3)
                                                              6
                                                              > (car ‘(1 2 3))
                                                              1
                                                              > (cdr ‘(1 2 3))
                                                              (2 3)
                                                                 As discussed in the boxout, everything in Lisp is a
                                                              list, surrounded by brackets. Operators go at the start
                                                              of a list.
                                                                 What about Hello World?
                                                              > (print “Hello World”)
                                                              “Hello World”
                                                              “Hello World”
                                                                 The interpreter prints the string twice, because
                                                              it executes the function (printing the string), then
Trying out hash tables. Note the undefined variable           outputs the return value (which is also the string).
warning; the code does work anyway, but we’ll look at            To run a ‘real’ program (one that won’t go away
defining variables a bit later.                               when you quit the interpreter), open up a new file



                                                                www.linuxvoice.com                                                                          93
     TUTORIAL LISP

                                                                                            DEFVAR defines the dummy variable myword
                                                                                        without setting it, so we don’t get a warning about
                                                                                        it. DEFUN shows that we’re defining a new function.
                                                                                        The next symbol after that is the function name,
                                                                                        make-word, and the list after that is the parameter
                                                                                        list. Everything after that is the body of the function.
                                                                                        Mostly, this just consists of putting the parameters
                                                                                        into the SETF calls we used above. However, note that
                                                                                        final line, myword. The return value of a Lisp function
                                                                                        is the last expression evaluated. We want that to be
                                                                                        the new hash table itself, and without that final line, it
                                                                                        would be the return value of the last call to SETF.
                                                                                            The general form of a function definition, then, looks
                                                                                        like this:
                                                                                        (DEFUN name (parameter_list)
                                                                                         (function_body))
                                                                                        Like everything else in Lisp, it’s a list.
                                                                                           That’s a single database entry defined; we want lots
                                                                                        of them, so we need a global database variable, and a
                                                                                        function to add entries to it:
Outputting all the data.
                             hello.lisp:                                                (defvar *wordlist* nil)
Note the DIY loop code
commented out in the         #!/usr/bin/sbcl --script                                   (defun add-word (myword) (push word *wordlist*))
code window, showing         (write-line “Hello World”)                                   DEFVAR is the macro that defines a variable (but
another (less neat) way to     Run it from the command line with chmod u+x              only if it hasn’t already been defined; to override an
do it.                       hello.lisp; ./hello.lisp. Note s WRITE-LINE outputs        existing variable use DEFPARAMETER), and the Lisp
                             the string with a newline and with no quotes around it,    naming standard for global variables is *name*. The
                             unlike PRINT.                                              add-word function simply uses the PUSH macro to
                                                                                        add its single parameter to *wordlist*.
                             A little more complicated                                    Add a few words, then (if in Slime) type *wordlist* to
                             For a more complicated project, let’s try a foreign        see them all:
                             language flashcards game. I’ve gone for Russian            (add-word (make-word “house” “дом”))
                             (which means Unicode; see the box). It’ll show you a       (add-word (make-word “hello” “привет”))
                             word in Russian, you type in the English equivalent,       (add-word (make-word “river” “река”))
                             and it tells you whether you were right or wrong.            If you’re not in Slime, you’ll want a way to output
                               The first step is to define a database entry. We’re      the list (and if you are in Slime, you’ll want a way that
                             going to use a hash table, which is a data type that       doesn’t just give you lots of hash parameters). The
                             contains a set of keys and their associated values.        best bet for this is the function maphash:
                             This Slime code creates a hash table word, with keys       (defun print-hash (key value)
                             english and russian:                                        (format t “~5t~S - ~S~%” key value))
                             > (setq word (make-hash-table :test ‘equal))
                             > (setf (gethash “english” word) “house”)                  (defun show-single-word-details (myword)
                             > (setf (gethash “russian” word) “дом”)                     (maphash #’print-hash myword))
                                When making the hash table, passing in :test ‘equal
                             defines the equality test, so Lisp knows how to test       (defun show-all-word-details (mylist)
                             the lookup value against the stored hash keys (in           (dolist (myword mylist)
                             order to return the correct value). GETHASH returns          (show-single-word-details myword)))
                             a key value, and SETF sets it (in this case, creating it
                             first). To return a value, use GETHASH, which returns      (show-all-word-details *wordlist*)
                             both the value, and T (true, because found):                 print-hash defines how to output a key/value pair,
                             > (gethash “russian” word)                                 using FORMAT. FORMAT controls string format
                             “дом”
                             T
                               This will be a bit time consuming to do by hand for        Unicode
                             every entry, so let’s create a function to handle it:        To enter Russian letters (or any other Unicode symbol) in
                             (defvar myword)                                              Emacs, type C-x 8 RET then the Unicode hex code or full
                             (defun make-word (english russian)                           name (Tab-completion works):
                              (setf myword (make-hash-table :test ‘equal))                C-x 8 RET 0434
                                                                                          C-x 8 RET CYRILLIC SMALL LETTER DE
                              (setf (gethash “english” myword) english)
                                                                                            both give д. Modern Linux boxes should automatically
                              (setf (gethash “russian” myword) russian)                   have Unicode support in XEmacs and in the terminal.
                              myword)



94                                                               www.linuxvoice.com
                                                                                                                                      LISP TUTORIAL

output and is therefore, as with all format functions in                                                                               Testing in action!
all languages, somewhat confusing to the untrained
eye. t outputs to standard out; ~5t tabs in 5 spaces,
~S consumes the arguments after the format string
(here key first and value second), and ~% is the
newline.
   show-single-word-details passes the print-hash
function into maphash together with the hash to
print. Note that print-hash is quoted here, so that it is
passed on as data, rather than being evaluated there
and then. Finally, show-all-word-details uses dolist to
iterate over the list and show each word in turn.

User input                                                          ‘else’ (this part is optional; you don’t always want an
Finally, we need the bit where it asks you what the                 ‘else’). However, it has two really useful points:
word means. Here’s the code:                                         1
                                                                        You can have multiple statements in the “things to
(defvar answer)                                                         do” part (just put them all in the appropriate
(defun show-user-word (myword)                                          brackets).
 (write-line (gethash “russian” myword))                             2
                                                                        Lisp doesn’t have an elseif, so if/then can only have
 (write-line “Enter English translation: “)                             one if, one then, and an else. cond can have as
 (setq answer (read))                                                   many tests as you like.
 (cond                                                               3
                                                                        If you have multiple tests, more than one of them
  ((equalp (string-trim “\n” answer) (gethash “english” myword))        may be true for each thing tested (eg testing if a
   (write-line “Correct!”))                                             number is less than 10, less than 50, less than
  (t (write-line “Wrong!”))))                                           100), and you want to go through all the tests, not
                                                                        drop out at the first ‘true’, cond does this too.
(defun show-user-all-words (mylist)                                    Here it’s more straightforward: we test whether
 (dolist (myword mylist)                                            the string is equal to the ‘english’ value from the hash
  (show-user-word myword)))                                         (note the use of string-trim to trim off the newline
                                                                    at the end of the user input), and output Correct or
(show-user-all-words *wordlist*)                                    Wrong accordingly.
  In show-user-word we output the Russian part of                   show-user-all-words then iterates over the list, so the user is
the hash, output a message to the user, then use read               asked about each word in turn.
to get the user input and setq to set it.                              If you want to carry on experimenting with Lisp,
  cond is a neat function, but it can look a little                 here are a few improvements you could try making to
complicated. Its basic structure is:                                this code:
(cond ((predicate1) (things to do in this case))                        Ask the words in a random order.
   ((predicate2) (things to do in this case))                           Keep track of how often a word is asked or is
   (t (else this)))                                                     answered correctly. (You’ll need to find some way
   It works, as you can see, a lot like if/then, with the               to read data in and out to keep track of this over
t acting as an always-true condition that provides an                   multiple instances of running the code.)
                                                                        Pick out only the words that haven’t been asked
                                                                        recently, or which have been answered wrongly in
  Lambda functions
                                                                        the past. Try using REMOVE-OR-NOT swith a
  A particularly neat Lisp-ism, and one that has made its               lambda function to do this.
  way into many other languages, is lambda functions,                   Allow the user to add more words.
  or anonymous functions. (The word ‘lambda’ is used                   For more information on programming Lisp, try
  after Church’s lambda calculus.) Here’s a very simple
                                                                    the very readable introduction (free online) Practical
  mathematical example:
  * (remove-if-not #’(lambda (x) (= 3 x)) ‘(1 2 3 4 5))             Common Lisp.
  (3)                                                                  Once you get used to the syntax, Lisp has a real
     REMOVE-IF-NOT simply returns a list of anything that           elegance, and there are certain classes of problem
  matches its function parameter (removes the things that           that it is truly well suited to and by its current
  do match). So (remove-if-not #’oddp ‘(1 2 3)) would return
                                                                    resurgence as an active language. Try out Scheme or
  (1 3). Here, the lambda function is effectively a temporary
  function:                                                         Clojure if you want a change from Common Lisp; or
  (lambda (x) (= 3 x))                                              one of the many other minor variants. For a language
     lambda (x) means “anything that matches 3”, and so the         that’s now coming up on 60 years old, it’s impressively
  function as a whole returns (3). A lambda function, then,         evergreen.
  is a neat way of creating a function to plug into a bigger
  function, and you’ll find them all over Lisp code as well as in
                                                                     Juliet Kemp is a scary polymath, and is the author of
  other languages.                                                   Apress’s Linux System Administration Recipes.




                                                                      www.linuxvoice.com                                                                    95
     TUTORIAL DOCKER



                              GET STARTED WITH
          TUTORIAL
                              DOCKER
                              Make sure your software runs consistently in any environment by
   BEN EVERARD
                              packaging it up with Docker.


                              D
                                        ocker enables you to bring together your
 WHY DO THIS?                           environment and your code into a single
 • Ensure consistency                   package that you can take and run on any
   when setting up multiple   Linux distro. You don’t have to worry about which
   environments               libraries are installed on the host, or which versions of
 • Enhance your CV with       what other software are available: you just start your
   this great buzzword!
                              package with Docker and it will work.
 • Automation is always
   good                          It does this by using containers to encapsulate
                              a separate environment running on top of the host
                              kernel. This environment runs parallel to the host
                              operating system, but is partitioned off by the Docker
                              tools. It has its own filesystem and own software
                              that’s nothing to do with the operating system running
                              on the host system.
                                 Let’s look at a quick example to see why this is
                              useful. Suppose a company is building a new web
                              app on top of Node.js. They’ve got a server running         The Docker Hub holds a wide variety of official and user-
                              Red Hat Enterprise Linux, a developer running Arch          contributed images to make it easy to get started.
                              Linux and a freelancer running Ubuntu. There are
                              Node.js packages for all of these different Linuxes, so     builds the latest version of Node from source, and
                              they could all install Node.js and start programming.       they get going.
                                 The developer using Arch makes a start and sends            Once they’ve developed the web app, they deploy it
Shipyard is a Docker          his work to the freelancer. However, the freelancer         to the server, but again it doesn’t work. The package
web front-end that is         finds that it doesn’t run properly. After some              for RHEL doesn’t have the features they need. They’ve
conveniently distributed      investigation, they find that it’s because Arch has a       dealt with this before, so they try to build Node.js from
via Docker.                   newer build of Node.js than Ubuntu. The freelancer          source. However, it needs newer versions of some
                                                                                          libraries than are available in RHEL. They end up
                                                                                          having to build several packages from source in order
                                                                                          to make the app work. This means that they can’t use
                                                                                          the package manager to stay up to date, and have
                                                                                          to continue re-building the app every time a security
                                                                                          patch is released.

                                                                                          The Docker way
                                                                                          Obviously this isn’t great, but it’s also not necessarily
                                                                                          the way it had to work. The developers and server
                                                                                          maintainers could have standardised on a distribution
                                                                                          from the start – one that they could all have running in
                                                                                          a virtual environment if they didn’t want to install it
                                                                                          natively – and this would have bypassed the issues
                                                                                          with versioning. However, there would still be work to
                                                                                          make sure that it was set up in the same way, that
                                                                                          they had the same repositories available, and have the
                                                                                          same software installed.
                                                                                             With Docker, the process works like this:
                                                                                             Create a Docker image for the project.
                                                                                             All developers/testers work with this Docker image.
                                                                                             Once the software is developed, deploy this image
                                                                                             to the server.



96                                                            www.linuxvoice.com
                                                                                                                    DOCKER TUTORIAL

   By using the same Docker image, you guarantee
that everything is the same on every developer’s             Docker Hub The joys of sharing
instance, on every tester’s instance, and the final          One of the great features of Docker is the     container, you can download one ready-
instance that is deployed. There are also a few added        ability to share your images with other        made. A user “l3iggs” has an image called
benefits, such as that Docker can be used to package         people. This means there are loads of ready    owncloud that they keep as the most up-to-
                                                             made images for you to use. There are also     date version. You can run this with:
software to be released in a distro-agnostic way.
                                                             official images from many projects including   docker run -d -p 7000:80 l3iggs/owncloud
   That’s enough about why to use Docker, let’s get          Linux distros (such as Ubuntu and CentOS),        This will download and run the OwnCloud
started with how to use it. Once you’ve installed            web apps (such as WordPress), and server       Docker instance, and expose the webserver
Docker through your distro’s package manager (note:          software (such as Node.js or MongoDB). All     on port 7000 (you can change this to another
it could be in a package called docker.io), you can          these are hosted through the Docker Registry   port if you wish). If you point your web
                                                             (https://registry.hub.docker.com).             browser to localhost:7000/owncloud, you
start a new Docker container with:
                                                                You can install images from these           should see a form inviting you to create an
docker run -it ubuntu /bin/bash                              repositories by calling them by name in        admin password, and then you can complete
   The first thing you should notice about this is that      docker run commands (like we did in the        the owncloud install.
it doesn’t matter what distro you’re running on, this        main text with the Ubuntu images), or by          You can upload your containers to the
will get and run the latest version of Ubuntu. The           using docker pull <image-name> (which          Docker Hub. First you need to create an
                                                             downloads the image but doesn’t run it).       account at https://registry.hub.docker.com,
download should be fairly small by distro standards
                                                                As well as the official images, you can     then you can log in your machine with the
(about 200MB). That’s because it’s just a bare-bones         get images that users have uploaded. This      command:
version of Ubuntu, and you’ll need to install whatever       is done by putting <user-name>/ in front of    docker login <username>
applications you want on top of it. The -t option tells      the image name. For example, if you don’t        Once you’re logged in, you can push
Docker that you want a TTY (console), and -i tells           want to go through the rest of this tutorial   images to the Docker Hub with:
                                                             and learn how to create an OwnCloud Docker     docker push <username>/<imagename>
Docker to keep STDIN attached ( -it are the standard
options for starting an interactive session) and the
final argument tells Docker what command you want          exit the original Ubuntu session, and go back with:
to run; in this case, it just starts a Bash shell.         docker runt -it testubuntu /bin/bash
                                                             Using this approach, you can build an image with
Consistent environment                                     whatever software you want. However, it’s not very
Once Docker’s downloaded what it needs, it’ll launch       convenient. For example, if you want to rebuild your
an interactive shell in the Ubuntu container. In here      server using Debian rather than Ubuntu, you’d have to
you can make changes and install whatever you like.        manually go through all the steps again. A better way
However, any changes you make will only be for that        of creating your own Docker images is by building                 You can run GUI
session. If you exit the shell with the exit command,      them using Dockerfiles, which state the start image,              applications in Docker.
                                                                                                                             This is Firefox running
then restart it in the same way, you won’t get any of      and then all the steps needed to install everything
                                                                                                                             in Docker showing a
your changes. Docker works with images, and it will        you want. Docker can build from these file by running
                                                                                                                             web page about running
always start the image that’s saved, rather than as it     through them like a script.                                       Firefox in Docker
last was. This means you know you’re always starting         To recreate the same image as above using a                     (http://fabiorehm.com/
in a consistent environment.                               Dockerfile, you’ll first need to create a directory in            blog/2014/09/11/running-
   You can save your changes to a new Docker image         which to do the build. The directory name is the                  gui-apps-with-docker).
by committing it. To do this, you need to know two
things: the ID of the container and the name you want
to commit to.
   If you don’t have an Ubuntu docker container still
running, start it as you did before, then make a change
that you can check is saved:
cd ~
mkdir test
  While that container is still running, open another
terminal window, and type:
docker ps
   This will list all the currently running Docker
containers. It will probably only have one entry so
far. That’s the container you need. It will have an
alphanumeric ID assigned to it, which is the ID you
need. The name to save the container to can be any
you like – we’ll just call ours testubuntu. You can save
your changes with:
docker commit <image-id> testbubuntu
  Where <image-id> is the ID from the previous
docker ps output. This saves the current state of that
image, so you should have it running in the current
state you want it in. Once you’ve committed it, you can



                                                             www.linuxvoice.com                                                                          97
     TUTORIAL DOCKER

                                                                                                        What we’ve done so far more or less the ‘Hello
                                                                                                      world’ of Docker. Hopefully you should have a bit of an
                                                                                                      idea how it works, but this particular example is a bit
                                                                                                      useless.

                                                                                                      Serving the world
                                                                                                      In order to make our container more useful, there are a
                                                                                                      couple more arguments to docker run that we’ll need.
                                                                                                         -d (daemonise) This runs the Docker container in
                                                                                                         the background and doesn’t put you to a prompt like
                                                                                                         the first example. This is useful for running servers
                                                                                                         where you don’t want to interact with them, you just
                                                                                                         want them to start and continue running.
                                                                                                         -p <external-port>:<container-port> This is used
                                                                                                         to connect the Docker container to the real world. It
                                                                                                         links a particular port on the Docker container to a
                                                                                                         port on the host.
                                                                                                         We’ll use these to containerise a website. First, we’ll
                                                                                                      need a new directory to build our image in. We’ll call
                                                                                                      ours helloweb. Then, in that, we’ll need a Dockerfile to
The docker images
                                   name your Docker image will have; we’ll call ours                  build our website. We’ll start with Ubuntu, then we’ll
command will list all the
images you currently have          testubuntu2. Inside this directory, you’ll need to create          install Apache, then we’ll include a simple web page.
installed on your computer.        a text file called Dockerfile, which will contain all the          The Dockerfile for this is:
                                   build instructions. In this case it should contain the             FROM ubuntu
                                   following:                                                         MAINTAINER Ben Everard <ben@linuxvoice.com>
                                   FROM ubuntu
                                   MAINTAINER Ben Everard <ben@linuxvoice.com>                        RUN apt-get update
                                                                                                      RUN apt-get upgrade -y
                                   RUN mkdir ~/test                                                   RUN apt-get install apache2 -y
                                      The first line tells Docker what to use as our base
                                   image; the second tells anyone working with this                   ADD website/* /var/www/html/
                                   who to contact if there’s a problem; and the final line            ADD apache-config.conf /etc/apache2/sites-enabled/000-
                                   tells Docker to run the mkdir command in the image                 default.conf
                                   before finishing. You can now create the image using
                                   the docker build command. The format is:                           EXPOSE 80
                                   docker built -t <image-name> <image-directory>                     CMD /usr/sbin/apache2ctl -D FOREGROUND
                                    We’ve used the directory ~/testubuntu2 and we                        The first section of this looks roughly like the first
                                   want to call the image testbuntu2, so the command is:              Dockerfile we made. It uses RUN commands to
                                   docker build -t testubuntu2 ~/testubuntu2                          execute instructions inside the container, but in this
                                     You can now run the image testubuntu2 exactly as                 case, it uses them to grab the latest packages, and
                                   you did testubuntu.                                                install Apache. The -y flag on apt-get makes it run
                                                                                                      automatically without asking for input.
                                                                                                         The rest of the Dockerfile is a little different. ADD
  Alternative containers
                                                                                                      commands are used to copy files from the build
  It should come as no surprise to anyone           Rocket is still under heavy development,          directory to the Docker container (we’ll look at these
  paying attention to the init wars that the        so not ready for production use just yet. At      a little later). EXPOSE 80 tells Docker to open port
  ever-expanding Systemd project includes a         a lower level, there’s also Linux Containers      80 (the HTTP port) on the container, and CMD is the
  container controller. The nspawn command          (LXC). This technology enables you to create
                                                                                                      default command to run when Docker starts. In this
  enables Systemd to automatically launch           and manipulate containers. With LXC, you
  and control containers in a very similar way      have a lot of control, but it’s not as easy to    case, it just runs Apache in the foreground.
  to Docker. What nspawn lacks, however, is         get started as with the other options. There’s       As you’ve seen, this needs extra files for the website
  an elegant system for making and sharing          a new tool from the LXC project called LXD,       and for the Apache configuration. The website is in
  containers, though it is possible to use          which aims to provide easier access to LXC        a directory called website inside the Docker build
  Docker containers.                                containers in a more Docker-like way.
                                                                                                      directory. The Dockerfile will contain whatever you put
      CoreOS, a project that’s building a minimal      At the time of writing, Docker has far more
  Linux distro just for cloud servers, is also      traction than its competitors both in terms of    in this directory, so it could be as complex as you like,
  working on a container control tool called        the number of people using the software, and      but we’ve just included a single file called index.html,
  Rocket (aka rkt). This works in a similar way     the number of images available. However,          which contains:
  to Docker, but it’s much more stripped down,      containers are a young technology and few         <html>
  and without many of the more complex              places are entrenched with Docker, so there’s
                                                                                                      <head>
  features of Docker that some people feel          still time for one of the other technologies to
  are leading to bloat on the original platform.    become the Next Big Thing in containers.          <title>HelloWeb!</title>
                                                                                                      </head>



98                                                                      www.linuxvoice.com
                                                                                                                             DOCKER TUTORIAL


  Security Keeping containers safe
  You may be tempted to think that by running software in
  different Docker containers, each piece is isolated from the
  others and therefore a compromise in one Docker container
  won’t allow an attacker to access another. In an ideal world
  this would be true, but the underlying technologies behind
  Docker (namespaces, cgroups and others) have not yet
  been adequately tested from a security point of view to
  make this claim. There’s a high probability that a talented
  hacker could break out of the Docker container and
  compromise the rest of the system.
     In other words, don’t run anything in Docker that you
  wouldn’t run on your system normally. Virtualisation
  provides a much higher degree of security and has been
  tested far more thoroughly than containerisation, so this is
  a better option if you want to run code you don’t trust.


<body>
<h1>Hello Web!</h1>
</body>
</html>
   The Apache config file sits in the Docker build
directory (but not in the website directory) and
contains:
<VirtualHost *:80>                                                                                                                According to Docker,
ServerAdmin ben@linuxvoice.com                                   RUN wget -q -O - https://download.owncloud.org/community/        the logo communicates
DocumentRoot /var/www/html                                       owncloud-latest.tar.bz2 | tar jx -C /var/www/html                expedition, automation,
                                                                 RUN chown -R www-data:www-data /var/www/html/owncloud            encapsulation and
ErrorLog ${APACHE_LOG_DIR}/error.log                             ADD apache-config.conf /etc/apache2/sites-enabled/000-           simplification. To us it
CustomLog ${APACHE_LOG_DIR}/access.log combined                  default.conf                                                     communicates a whale
</VirtualHost>                                                   EXPOSE 80
                                                                                                                                  that’s more buoyant than it
                                                                                                                                  should be.
  With all those files in place, you can build the Docker        CMD /usr/sbin/apache2ctl -D FOREGROUND
container from a terminal with:                                      Here, we use wget to grab the latest version from
docker build -t helloweb ~/helloweb                              the OwnCloud website. This is the best option for
  Then run it with:                                              OwnCloud, but other projects deploy in different ways.
docker run -d -p 7777:80 helloweb                                For example, you could replace the wget line with a
   You can then point your web browser to                        git clone command to grab the latest version of the
localhost:7777 and view your website. Notice that                some software that’s kept on GitHub.
the external port is 7777 despite the fact that Apache               Notice that this also requires the apache-config.
is listening on port 80 in the container, because                conf file that we used in the previous Dockerfile, so
when we ran the container, we used the argument -p               you’ll need to copy this into the same directory for
7777:80, which maps the external port 7777 to the                it to run. If you build and start this in the same way
container port 80. This means that you can run the               as before, but using the
Docker container unmodified on machines with other
services running on port 80 and not have conflicts.
                                                                 external port 7778, you’ll
                                                                 find OwnCloud at http://
                                                                                                   “You can wrap your software
                                                                 localhost:7778/owncloud.          up to make it easy to deploy
pwn the cloud
The previous example built a trivial website, but we
                                                                     That’s all you need to
                                                                 know to use Docker. Its
                                                                                                   across any Linux platform.”
can use it to deploy a more complex web app. In this             main selling point is that
case, it may be better not to copy in files as we did            it makes containers easy to use. With just a few lines
before, but to grab the latest version from an online            of easily understood Dockerfiles, you can wrap your
repository. For example, to install OwnCloud, you                software up to make it easy to deploy across any
could use the following Dockerfile:                              Linux-based platform. It also makes it easier than
FROM ubuntu                                                      ever before to install the latest versions of web apps
MAINTAINER Ben Everard <ben@linuxvoice.com>                      (see boxout on the Docker Hub), so you can test out
                                                                 software without having to first install and configure
RUN apt-get update                                               all the requirements.
RUN apt-get upgrade -y
RUN apt-get install -y apache2 php5 php5-gd php-xml-parser
                                                                  Ben Everard is the best-selling co-author of the best-selling
php5-intl php5-sqlite smbclient curl libcurl3 php5-curl bzip2     Learning Python With Raspberry Pi, published by Wiley.
wget sharutils



                                                                   www.linuxvoice.com                                                                     99
          TUTORIAL iPYTHON



                                      INTERACTIVE PYTHON
               TUTORIAL
                                      COMPUTING FOR EVERYBODY
VALENTINE SINITSYN
                                      From trying out code snippets to solving differential equations:
                                      IPython is a tool that has something to offer for any problem.

                                     O
                                               ne thing that’s great about Python is its
     WHY DO THIS?                              immediacy: you think of something, you type
     • Improve your Python                     the commands and see if it works or not.
       shell experience
                                      There‘s no compilation, no deployment, no whatever,
     • Build a computer
       algebra system                 and it’s all great for quick prototyping.
       completely free                   However, for ideas larger than a one-liner, things
     • Create interactive             aren’t so good. The Python shell is not very good with
       tutorials with live code       multiline history: if you spot a bug in a class definition,
       samples
                                      you can’t fix it easily. There are no writing aids, like
                                      code completion. If your idea turns out to be good,
                                      you can’t easily export it to a script, and there’s no
                                      straightforward way to share you findings with others.
                                         By itself, IPython is just a sophisticated Python shell,        The IPython console sports bright colours and many
                                      but that’s only a part of the story. Being free software,          interactivity features.
                                      it enjoys a vast library ecosystem. With these third-
                                      party add-ons, you can turn IPython into your testbed              library for high-level network communications. We’re
                                      for programming ideas, an interactive tutorial or even             not going to cover it here, but you should be aware
                                      a computer algebra system (CAS).                                   that ZeroMQ lacks built-in security mechanisms. So, if
                                                                                                         you’re really going to run IPython in distributed fashion,
                                      Getting ready                                                      be sure to read the relevant parts of the official
                                      As an IPython user, you usually work in a console or in            documentation. In a nutshell, securing IPython kernel
                                      a web-based notebook. IPython comes with two                       connections boils down to creating SSH tunnels and
                                      consoles: traditional and a graphical Qt-based one.                forcing IPython to listen on loopback addresses.
                                      There are several processes involved in a typical
                                      IPython session. The most important one is the kernel              First steps
                                      (not to be confused with an OS kernel) which actually              With everything in place, your first step into the
                                      executes your code. For the notebook, there will be                IPython world is straightforward:
                                      also a Tornado-based web server. This is known as                  val@y550p:~$ ipython
                                      decoupled process architecture: client and                         Python 2.7.9 (default, Dec 11 2014, 04:42:00)
                                      computational core are separated. You can even run                 Type “copyright”, “credits” or “license” for more information.
                                      them on different machines.
                                        IPython components are glued together with                       IPython 3.0.0 -- An enhanced Interactive Python.
                                      ZeroMQ, which is a popular “sockets on steroids”                   ?       -> Introduction and overview of IPython’s features.
                                                                                                         %quickref -> Quick reference.
                                                                                                         help -> Python’s own help system.
     Project Jupyter
                                                                                                         object? -> Details about ‘object’, use ‘object??’ for extra details.
     Some pillars IPython stands on are Python-       and factors them out. IPython remains the          In [1]:
     specific, such as SymPy or Matplotlib. The       default Python kernel, but you can switch to         You’ll see a banner revealing some of IPython’s
     others, like decoupled protocol or web           Ruby or anything else if you wish.
                                                                                                         powers. % is the so-called “line magic”, because it
     notebooks, are language-agnostic, so it’s           If you are using IPython 3.0, you’ve
     natural to extend IPython’s beyond Python.       probably spotted the Jupyter logo in the web       works on a single line, and can be used inside blocks
         This is exactly what project Jupyter does.   notebooks already. Plans are to finish the         of code. There are also “cell magics” that start with
     It takes the IPython environment, notebook       split by IPython 4.0, so version 3.x will likely   %% and work multiline. Below is a command prompt
     document format and various other bits           be the last “monolithic” one.                      which behaves as you might expect:
                                                                                                         In [1]: print ‘Hello world!’
                                                                                                         Hello world!
                                                                                                           Things will be different however, if your expression
                                                                                                         produces a value:
     “Project Jupyter” sounds cooler than “IPython without Python”.                                      In [2]: 2+2
                                                                                                         Out[2]: 4



    100                                                                    www.linuxvoice.com
                                                                                                                            iPYTHON TUTORIAL

                                                                                                                                   PdfFileReader complains
   Graphics covered                                                                                                                about a malformed file,
   IPython sports a thing called “GUI integration”. In plain
                                                                                                                                   but Tab completion makes
   words, it means that you can create Qt, GTK and some other                                                                      fixing it easy.
   graphical UI applications straight from the console. It’s a
   useful feature for introspection, especially given the fact
   that IPython can be embedded in your own programs. It
   also comes handy when you need to quickly create a widget
   and test its behavior.
      To use it, nothing is required on your side. Just execute
   %gui qt (or other toolkit). Don’t start the main loop
   (QApplication(sys.argv)._exec() or similar) as it will block
   the console. Create your widgets and do other things as if it
   were already running, and IPython will take care of the rest.


   Here, output appears in its own cell. To suppress               the input. Now, press Ctrl+P: you’ll get back to your
this, end the expression with a semicolon (;). The last            function and can change it as you like. The only
output is always available via the special variable, _.            inconvenience is that it is really a long wrapped line,
In [3]: _                                                          not a multiline text. You can navigate it with the Left
Out[3]: 4                                                          and Right keys, Ctrl+A/Ctrl+E (or Home/End), but
   object? prints details about an object. IPython                 pressing Up or Down still switches to another history
gathers these from docstrings, introspection and                   item. For a real multiline editor, do %edit In[N]. This
other means, and ?? tries to be even more verbose                  opens input N in a default text editor (likely Vim). Qt
(though it doesn’t necessarily succeed). This feature              Console and Notebook can edit multiline cells with no
isn’t much help on standard library objects, but is                external aids.
quite wordy with IPython’s own ones and various                       It is also possible to get one of your previous inputs
IPython-aware third-party libraries.                               editable at the command prompt. %recall N is the
   A double underscore __ refers to the output before              magic you need here. It comes in handy when the
the last one. To get an arbitrary output, use Out[N] or            input you need is buried too deep in the history. If you
_N, where N is the output’s number (2 below):                      only need to rerun the input, use %rerun N.
In [4]: Out[2]                                                        IPython also provides some writing aids, like Tab
Out[4]: 4                                                          completion. If you forget a method’s name, type some
  Note that you can’t refer to printed text this way, as           first letters then tap Tab to see the options. Even
print yields no value – it just puts characters on the             better, you can use shell wildcard syntax and ? to
screen. Similarly enough, you can use _i, __i, and In[N]           search through Python objects:
(or _iN) to retrieve previous inputs:                              In [7]: itertools.c*?
In [5]: In[1]                                                      itertools.chain
Out[5]: u”print ‘Hello world!’”                                    itertools.combinations
    A magic called %history prints all inputs in the
current session. This comes in handy when you’ve
                                                                     Need more terminals
tried some idea and decide it’s worth putting into
standalone script. The magic accepts various options                 IPython Notebook 3.0 comes with a built-in terminal,
(like the range of inputs to export) which you can                   which is like Chrome Secure Shell but works in any modern
                                                                     browser. This requires the python-terminado package, and
examine with %history?. For more sophisticated
                                                                     you can create terminals in Dashboard the same way as
session logging, consider the %logstart and %logstop                 notebooks. It may come in handy for working remotely, but
magics. They also produce logs that are valid Python                 keep in mind that this opens shell access to anyone who
code you can readily use.                                            connects to your IPython Notebook server. Be careful not to
                                                                     leave your system vulnerable.
Writing aids
Session history is also easy to navigate the same way
you do it in Bash. In fact, both shells relies on the
readline library for all heavy lifting. Use the Up and
Down keys (or Ctrl+P/Ctrl+N) to select previous
inputs, or type some words and press Ctrl+R to search
history. Unlike the standard Python interactive shell,
this works multiline.
In [6]: def f(x):
  ...: return 2 * x
  ...:                                                               IPython’s web terminal is good enough to run the
  Note that IPython automatically indents code when                  ipython console.
you press Enter. The first empty line terminates



                                                                     www.linuxvoice.com                                                                101
      TUTORIAL iPYTHON

Interactive plots work even                                                                      latter form. There is also a convenient SList.grep()
in mobile browsers, but                                                                          method, which behaves the same way as the shell
you’ll need a live kernel                                                                        command.
connection for them.                                                                                Next, we’ll loop through reports, getting the number
                                                                                                 of pages in each document. It’s not straightforward
                                                                                                 to do in a shell, but the pyPDF library makes it a
                                                                                                 snap. You can probably find it in your distribution’s
                                                                                                 repositories, and the code we need looks like this:
                                                                                                 In [3]: from pyPdf import PdfFileReader
                                                                                                 In [4]: from os import path
                                                                                                 In [5]: for p in reports.p:
                                                                                                   ...: with open(p, “rb”) as f:
                              # skipped for brevity                                                ...:     print PdfFileReader(f).getNumPages()
                                 IPython ignores prompts like >>>, In [] or ... in code            Check that it works (it should). Finally, return to the
                              you enter. It’s very useful for pasting doctests and               fourth import and change the last line to:
                              code snippets you find online.                                     In[6]: # original code here
                                 So far we’ve discussed the IPython console, but                  ...: if PdfFileReader(f).getNumPages() < 5:
                              all tricks you’ve learned work in Qt Console (ipython               ...:     !cp “$p” ~/somewhere/”{path.basename(p)}”
                              qtconsole) as well. History in IPython is per kernel,                 $p is substituted with the string value of the Python
                              so it is shared between consoles. For instance, run                variable p before the code reaches the shell. You can
                              ipython console in the terminal, then use %qtconsole               also embed Python expressions into shell commands
                              to start Qt Console connected to the same kernel.                  with curly braces. Quotes account for shell-escape
                              You should be able to see your previous commands.                  characters, such as spaces.
                              Instead of %qtconsole, you could also use the                         The code we wrote isn’t error-proof. If you happen to
                              %connect_info magic, which displays the kernel                     have a .pdf file that PdfFileReader can’t parse (maybe
                              connection information and a command line you can                  an incomplete download), it will raise an error. When
                              run to connect to the existing kernel.                             this happens, note how exceptions are rendered in
                                 To exit the IPython console, press Ctrl+D.                      IPython. They’re usually quite detailed, but if you want
                                                                                                 more, try %xmode verbose. Exception tracebacks are
                              Magic in a shell                                                   also coloured so you can grasp them more easily.
                              IPython provides basic shell command equivalents.
                              You can do things like cur_dir = %pwd, %cd another_
                              dir and %cd - to return back, if you need. Shell                     Notebooks beyond IPython
                              scripting language is certainly powerful, but not
                                                                                                   The more you get used to IPython, the more likely is you’ll
                              necessarily intuitive. If you mix and match it with
                                                                                                   want to share a notebook with someone who doesn’t have
                              Python, you get best of both worlds.                                 (and doesn’t want) IPython installed. You can always use
                                Think of the following problem. You want to find all               ipython nbconvert, but in the cloud era, there’s a better way.
                              PDF reports in your Downloads folder that are less                       NBViewer (http://nbviewer.ipython.org) is the closest
                              than five pages long, and copy them somewhere. To                    alternative to an online nbconvert. If you have your IPython
                                                                                                   notebook available online (maybe shared in Dropbox) or on
                              make it a bit simpler, let our reports have the report_
                                                                                                   GitHub/public Gist, simply paste its URL or Gist ID into the
                              prefix in their names.                                               textbox and you’re done. You can now send your contact
                                Open the IPython console (Qt Console will do as well)              a link that’s viewable in any browser. The major limitation
                              and let’s begin with:                                                is that you must have your IPython notebook public, and
                                                                                                   there’s also no kernel connection available.
      PRO TIP                 In [1]: reports = !ls ~/Downloads/report_*.pdf
                                                                                                       If you’re a professional Python developer, chances are
 Tab completion in IPython       ! denotes a shell command expression. It passes
                                                                                                   you use the PyCharm IDE. It’s commercial, but there’s a
 also works for files.        the command line to the shell, captures standard                     free (as in beer and as in speech) variant called PyCharm
 Press Tab and you’ll see
                              output and returns it as the result. The actual type of              Community Edition. Both support IPython notebooks, so you
 suggestions, like in a
 regular shell.               ‘reports’ is SList, as you can easily check with ?:                  can enjoy great interactivity with high-end IDE features like
                              In [2]: reports?                                                     code suggestions. However, my experience is that you may
                                                                                                   have trouble getting PyCharm’s IPython support to work.
                              Type:      SList
                                                                                                   PyCharm will also use IPython as a Python shell if available.
                              ...
                              File:     /usr/lib/python2.7/dist-packages/IPython/utils/text.py
                              Docstring:
                              List derivative with a special access attributes.
                              ...
                                SList is IPython’s own type that derives from list.
                              You can use it as a normal Python list (reports.l),
                              a newline-separated string (reports.n), a space-
                              separated string (reports.s), or a list of Python’s path
                              objects (reports.p). For our purposes, we’ll prefer the



102                                                                www.linuxvoice.com
                                                                                                                          iPYTHON TUTORIAL

   If want a whole block of pure Bash code in your                                                                            Latex makes formulas look
IPython session, use the %%bash cell magic.                                                                                   nice even on the web.
Everything you enter in that input will go to Bash
directly, and the output will be printed. Similar cell
magics exist for Perl and Ruby.

Pretty plotting
IPython consoles are good for us geeks, but for many
others around IPython is a synonym for web-based
Notebook. It’s a great tool for interactive tutorials,
presentations, and online learning. It also provides
scientific computing environment rivalling commercial
tools like Maple or Wolfram Mathematica.                    import numpy as np
   Start the service via ipython notebook, and you’ll       import matplotlib.pyplot as plt
see the web browser window with Dashboard.                  def trajectory(velocity, angle):
Dashboard displays IPython documents in the current           g = 9.8
directory and enables you to create new ones. IPython         t = np.linspace(0, 2 * velocity * np.sin(angle) / g, 100)
Notebook documents (sometimes also called IPython             x = velocity * np.cos(angle) * t
notebooks) are just JSON files. You can convert them          y = velocity * np.sin(angle) * t - g * (t ** 2) / 2
to other formats like HTML or Latex with ipython              plt.plot(x, y)
                                                                                                                                  PRO TIP
nbconvert. However, in this case you’ll lose much of            We simply find out how long the body will go and
                                                                                                                               Always run ipython
the interactivity.                                          calculate its x and y coordinates in 100 consecutive               notebook under tmux
   Notebook itself is a collection of cells. Cells have a   moments of time during the flight. Now, if you call                or screen (LV013). This
type: code cells contain Python code, heading cells         trajectory(5, np.pi/4), you’ll see a curve. But how                way, you won’t interrupt
                                                                                                                               a session if you close the
give your document a structure, Markdown cells are          would a change of velocity or angle affect its shape?              terminal occasionally.
used for formatted texts and so on. To change a cell’s      It’s a good question, and IPython has the answer. You
type, use the drop-down under the main menu bar.            may be surprised, but making the plot interactive is
When you’re in command mode (hello Vim!), you can           mostly a matter of a one-liner:
move between cells, create, and cut and paste them.         from IPython.html import widgets
However, you can’t cut and paste multiple cells, and        widgets.interact(trajectory,
there is no multi-level undo. Clicking on a cell switches      velocity=widgets.FloatSliderWidget(min=0, max=20),
you to edit mode, where you can change the cell’s              angle=widgets.FloatSliderWidget(min=0, max=np.pi/2))
contents.                                                     interact takes a function and creates widgets to
   To execute a cell, press Shift+Enter or use the main     manipulate its arguments. It tries to guess appropriate
menu. It will be evaluated, and the output (if any) will    widget types (eg uses checkboxes for Booleans), but
appear beneath. All history-related commands you            you can always override the defaults as we do here.
know work in notebooks, too. Cell evaluation may            You can also apply it as a decorator:
take time, and a circle at the top-right corner indicates   @widgets.interact
whether the kernel is currently busy or not. If it is,      def trajectory(velocity=1, angle=np.pi/4):
the circle will be filled. You can interrupt the current      # function body
operation via Kernel > Interrupt or Ctrl+M I.                  Play with the plot: for instance, set velocity to some
   Let’s write a simple example that draws the              fixed value and drag the angle slider to see which
trajectory of a small body (like a stone) thrown at         value gives you the longest flying distance (measured
some angle above the horizon. For that, we’ll need          along the x axis). You should get something around
plotting facilities. Matplotlib is the de facto standard    0.78 (np.pi/4). Note however that this will work only
plotting tool in Python. It’s modelled after Matlab (but    if you are connected to the kernel, as the function is
provides a fully pythonic API as well) so drawing           re-evaluated every time you change its arguments.
anything is very easy. First of all, we need to enable         IPython encompasses many good technologies,
Matplotlib in the session. To do this, run:                 and if you want to know more about Matplotlib, SymPy
In[1]: %matplotlib inline                                   or whatever, please drop us a line. In the meantime,
   “Inline” here means that graphs we plot will appear      have a look at https://github.com/ipython/ipython/
in the notebook and not in a separate window.               wiki/A-gallery-of-interesting-IPython-Notebooks.
   Two main factors affect trajectory shape: the initial    Here, IPython authors collect notebooks from various
velocity and the angle. The x and y coordinates are         fields that you can use as a starting point for your
then easily found as time functions (consult the            own work, or just for learning. IPython welcomes
physics textbook of your liking). From a mathematical       contributions, and if you do something that’s accepted
viewpoint, this means the trajectory y(x) is given as       upstream, please share it with us!
parametric function. Matplotlib can draw it as well as
2D/3D plots, histograms and more exotic plot types.          Dr Valentine Sinitsyn teaches Physics, develops high-loaded
                                                             services and does other clever things with Python.
All we need is to write a simple function:



                                                              www.linuxvoice.com                                                                       103
      CODING NINJA



                                  CODE NINJA: BINARY
          TUTORIAL
                                  BOOLEAN LOGIC
                                  Understand True and False, and program using the very essence
   BEN EVERARD
                                  of computer logic.


                                  I
                                      f you’ve done even a little programming before,               True
 WHY DO THIS?                         you’ll probably have come across the basic logical            >>> print (True ^ True) and (False ^ False)
 • Master the building                operators AND, OR, NOT and XOR at some point.                 False
   blocks of computation
                                  They operate on values that can be either True or                       In the last example, the is used to denote XOR.
 • Improve your programs
   by manipulating raw bits       False. These values are known as Boolean (after the
                                  mathematician George Boole). For example, take a                  Logical operators
                                  look at the following Python code:                                As well as these operators that take two inputs, there’s
                                  if first_name == “Ben” or first_name == “Mike”:                   the NOT operator, which acts on just a single input
                                              print “Cool name!”                                    and changes it, so if it’s True it returns False and if it’s
                                     This uses the variable first_name and first                    False it returns True:
                                  compares it to the string “Ben”. This comparison will             >>> print not True
                                  either return True or False depending on whether or               False
                                  not first_name contains “Ben”. Then it will compare               >>>print not False
                                  the variable to “Mike” and again it will return either            True
                                  True or False. The OR operation then looks at the two                There are three more logical operators that are
                                  values returned, and if either of them is True, the               created by combining the two-input operators with
                                  whole statement returns True. If neither of them is               not. NOR is not and OR, in other words (NOT (a OR B))
                                  True, then the whole expression returns False                     is the same as (a NOR b).
                                  (actually, there’s a little white lie in this – see the              So far, we’ve been looking at logical operators that
                                  boxout for more details).                                         work with single values, True or False. At a lower level,
                                     The operators AND and XOR (exclusive OR) work in               usually, a binary 1 represents True and 0 represents
                                  a similar way. AND returns True if both inputs return             False. Since everything in your computer is also
                                  True, and False otherwise. XOR returns True if either             stored in binary, you can use logical operators on the
                                  one of the inputs returns True, but False if either none          bits that make up larger values.
                                  or both of the inputs return True. The full range of                 As an example, the number 4, when represented in
                                  outputs from all the logical operations is given in the           binary is 100, while the number 3 is 011. If you start
                                  truth tables below.                                               with the left-most bit of both numbers, you get 1 (or
                                     You can combine these to build up complex                      True) from 4, and 0 (or False) from 3. True OR False is
                                  expressions. Python’s interactive shell is a great place          True, so the first bit of our output is 1. Then focus on
Truth tables give the             to experiment with these. For example:                            the next bit along. From the 4, this is 0, while from the
outputs of logical                >>> print False or True                                           3 you get 1. Again, these OR together to produce 1,
operators for every               True                                                              and likewise with the last bit. The output of 4 OR 3 is 7
possible set of inputs.           >>> print (False and True) or (False or True)                     when done bitwise. In Python, this is:

OR                                                       AND                                                     XOR
 First input       Second input          Output            First input            Second input   Output           First input        Second input   Output
      False               False           False                 False                 False      False                   False            False      False
      False               True            True                  False                 True       False                   False            True        True
      True                False           True                   True                 False      False                   True             False       True
      True                True            True                   True                 True        True                   True             True       False



NAND                                                     NOR                                                     XNOR
 First input       Second input          Output            First input            Second input   Output           First input        Second input   Output
      False               False           True                  False                 False       True                   False            False       True
      False               True            True                  False                 True       False                   False            True       False
      True                False           True                   True                 False      False                   True             False      False
      True                True            False                  True                 True       False                   True             True        True




104                                                                      www.linuxvoice.com
                                                                                                                         NINJA CODING

>>> print 4|3
7
   Notice that we used the operator | (the pipe symbol)
rather than OR. That’s because OR works on whole
values while | operates at bit-by-bit level. Bitwise AND
is done with & and bitwise NOT is done with ~. XOR is
still done with ^.

Binary Booleans
Using bitwise operators on whole numbers works, but
it looks a bit strange. It’s easier to see what’s going on
if you view everything in binary, and Python lets you
do this. Firstly, anything starting with 0b will be treated
as binary. Secondly, the bin(function) can be used to
convert a number to binary. So, to display a bitwise OR
of 4 and 3, but display everything in binary, you can do:
>>> bin(0b100 | 0b011)
0b111
This performs exactly the same function as the
previous bit of code; the only difference here is that
we’ve told Python to display everything in binary.
   The most common use of bitwise operations is
applying masks to a value when you are only
interested in a few of the bits. The two most common
                                                                                                                         If you struggle to
operators for this are AND and XOR. AND can be used           >>>bin(0b10101010 ^ 0b11110000)
                                                                                                                         understand binary
when you only want to remove some of the values.              01011010                                                   numbers, the Cisco Binary
   It’s quite common to transmit Boolean values in              Another feature of bitwise XOR is anything XOR’d         Game is a great way to
8-bit sequences that are usually interpreted as               with the same value twice is unchanged. This can be        learn (http://forums.cisco.
numbers. For example, if you’re controlling hardware,         used to create a simple (and not particularly secure)      com/CertCom/game/
you might have eight outputs that you can switch on           form of encryption. If you pick a key that’s the same      binary_game_page.htm).
or off. You can send a byte of data to tell the controller    length as the message (or repeat a shorter key), you
which ones should be on and which ones should be              can XOR the message and the key once to get an
off. Each bit would correspond to a particular pin.           encrypted message. You can then bitwise XOR the
In order to extract the value for a pin (eg pin 4), you       encrypted message with the key again to get the
could use the following Python code (where the                original message. So:
variable data_byte contains the data for which pins           message = 0b10101010
to switch on)                                                 key = 0b11001100
>>> data_byte & 0b00010000
  This can be incorporated into an if function. For           encrypted_message = message ^ key
example (where the function set_pin() is used to              bin(encrypted_message ^ key)
control the hardware):                                          Bitwise operations can cause some strange
if data_byte & 0b00010000:                                    problems because of the way numbers are stored. For
            set_pin(4, “ON”)                                  example:
   The if statement works because Python considers            >>> print ~1
anything other than 0 to be                                                          -2
True.
   You can use bitwise OR in a
                                        “It’s common to                                  This is because Python stores
                                                                                      numbers using a method known
similar way because anything        transmit Boolean values                           as two’s complement, where the
OR’d with True is always True,
and anything OR’d with False
                                      in 8-bit sequences.”                            largest binary digit is negative
                                                                                      and subtracted from the rest of
is its original value. This way                                                       the numbers. For example, in
you can manipulate individual bits in the byte. For           4-bit two’s complement, 1000 is -8, 1001 is -7 (-8 + 1)
example, to set the fourth bit of data_byte to 1 but          and 0111 is 7. In this case, NOT 0001 is 1110, which
leave the rest unchanged:                                     is -8 and 6, or -2. Python stores numbers in a slightly
>>> data_byte = data_byte | 0b00010000                        unusual way. Instead of allocating a fixed number of
   Bitwise XOR has a couple of interesting properties.        bits to a variable (as C does for example), Python
Firstly, anything XOR’d with 0 is itself, while anything      increases the number of bits depending on how large
XOR’d with 1 is its opposite. This can be used to             the number stored is. This makes two’s complement a
selectively apply NOT operations to some bits in a            little unusual, so carefully test any bitwise functions
byte. For example:                                            that may operate on negative numbers.



                                                                www.linuxvoice.com                                                              105
      CODING MACHINE CODE



                             ASMSCHOOL: EXPAND
         TUTORIAL
                             THE SELF-MADE OS
                             Part 5: We finish off this series by making system calls accessible
MIKE SAUNDERS
                             to user programs, like in a full operating system.


                             L
                                     ast issue we put together a simple operating           That’s all good and well, but it means our OS is just
 WHY DO THIS?                        system, using the techniques and tricks we           a glorified program launcher at this stage. Proper
 • Learn what compilers do           explored over the last four issues. This             OSes provide facilities to programs, however, so that
   behind the scenes
                             miniature OS consists of a tiny bootloader that loads a      they don’t have to implement everything themselves.
 • Understand the
   language of CPUs          kernel from a FAT12 formatted floppy disk, and the           For instance, every standalone program shouldn’t
 • Fine-tune your code for   kernel then displays a prompt and takes input. If you        need its own string printing routine – our OS can
   better performance        enter the ls command you get a list of files from the        provide that, among other features. So in this final
                             disk – or if you enter a filename, the OS will load it and   instalment of our assembly tutorial series, we’ll beef
                             try to execute it.                                           up our kernel with routines that programs can call.


                               1    MAKING SYSTEM ROUTINES AVAILABLE
                             We’ll be working from the codebase used last month,          available in most distros.) Now you boot floppy.img in
                             so grab it from www.linuxvoice.com/code/lv015/               a PC emulator such as QEMU or VirtualBox – eg
                             asmschool.zip. As a quick reminder, here’s a list of the     qemu-system-i386 -fda floppy.img. So, we have our
                             files included and what they do:                             codebase and build instructions. Let’s build MyOS 2.0!
                                boot.asm The 512-byte bootloader that’s injected
                                into the start of the FAT12 floppy disk image.            What’s our vector, Victor?
                                bpb.asm The BIOS parameter block, a chunk of              Imagine that test.asm wants to use the lib_print_
                                disk-identification information that is embedded          string routine inside our kernel. What does it need to
                                into boot.asm during assembly.                            do? Well, it has to use the call instruction followed by
                                disk.asm FAT12 file-reading routines, as used by          the address in memory of lib_print_string. But there’s
                                boot.asm.                                                 a major problem here: test.asm has no idea where
                                mykernel.asm Our OS kernel, including a simple            lib_print_string is. If we disassemble our kernel using
                                command line and program execution facility.              ndisasm mykernel.bin, and search for “pushaw” (the
                                lib.asm A set of useful                                                                  first instruction in the
                                routines for screen,
                                keyboard and disk               “Every program shouldn’t need                            lib_print_string routine),
                                                                                                                         we can see that the code
                                handling, which gets            its own string printing routine                          for lib_print_string starts
                                included into mykernel.
                                asm during assembly.            – our OS can provide that.”                              at position 557
                                                                                                                         (hexadecimal, in the
                                test.asm A test                                                                          column on the left).
                                program that our OS can load and launch – it just            So, that’s a start – test.asm could just put a string
                                prints the letter ‘X’ and exits.                          location in SI and use call 0x557 to print a string,
                                To assemble the bootloader, use:                          right? That may indeed work, but here we bump into
                             nasm -f bin -o boot.bin boot.asm                             another problem: the location of lib_print_string will
                               To create a virtual floppy disk image called floppy.       change as we make modifications to the kernel. It
                             img in MS-DOS format, and inject our bootloader into         could move by just a few bytes if we make a minor
                             the first 512 bytes, do this:                                alteration, or it could jump by several kilobytes if we
                             mkdosfs -C floppy.img 1440                                   add loads of code to lib.asm before it.
                             dd conv=notrunc if=boot.bin of=floppy.img                       Fortunately, however, there’s a way to fix this: using
                               To assemble the kernel and test program, and add           vectors. If we put a series of jmp instructions at the
                             them to the floppy disk image:                               beginning of our kernel, which jump to different
                             nasm -f bin -o mykernel.bin mykernel.asm                     routines in lib.asm, these will always stay in the same
                             nasm -f bin -o test.bin test.asm                             place. These jumps are called vectors and redirect call
                             mcopy -i floppy.img mykernel.bin ::/                         instructions from programs to the appropriate places.
                             mcopy -i floppy.img test.bin ::/                                Let’s see this in action. Edit mykernel.asm and add
                             (Note that mcopy is part of the GNU Mtools package,          three jmp instructions and a “start” label to the very



106                                                              www.linuxvoice.com
                                                                                                           MACHINE CODE CODING

top so that it looks like this:
           jmp start               ; 0x0000
           jmp lib_print_string    ; 0x0002
           jmp lib_input_string    ; 0x0005


start:
           mov ax, 2000h
           mov ds, ax
           mov es, ax


loop:
           mov si, prompt
           call lib_print_string
           ...
   The hexadecimal numbers in the comments
alongside these jmp instructions show exactly where
they’ll be in RAM when the kernel is loaded. So, the
jmp start instruction is at position 0 (as it’s right at the
start of the kernel), while jmp lib_input_string is at
position 0x0002, and the next jmp is at 0x0005. (The
first jmp instruction is only two bytes, as it’s jumping
to a very close address, just a few bytes ahead,
whereas the other jmps use three bytes and go to
code further away, and therefore use longer
addresses.) You can find out the location of these
jump instructions using ndisasm mykernel.bin – the
locations are in the left-hand column.

Make it easier for other developers
                                                               More real-hardware fun, this time showing the use of graphics routines we’ve added to
So, we’ve created three vectors here: if a program
                                                               our simple operating system.
wants to use lib_print_string, instead of using that
routine’s exact address in memory, it can simply call             But now imagine that you want to get other people
the vector at position 0x0002, which then redirects to         to write software for your OS. If you tell them to call
lib_print_string. This vector will always remain at            various hexadecimal numbers, it all looks a bit hacky,
0x0002, unless we change the order of the vectors –            so we can make our pseudo-API more attractive by
but as Linus Torvalds always says with colourful               aliasing proper names to the numbers. Alongside
language, you NEVER break userspace – so our                   test.asm, create a file called myos.inc with the
vectors won’t change location. We can add more of              following contents:
them, but that doesn’t change the location of the              lib_print_string equ 0x0002
previous ones.                                                 lib_input_string equ 0x0005
   Try this out by modifying test.asm like so:                   The equ here simply means: the string on the left is
           ORG 32768                                           equivalent to the number on the right. So now you can
                                                               modify test.asm as follows:
           mov si, string                                                 %include “myos.inc”
           call 0x0002
           ret                                                            ORG 32768


           string db “Ciao!”, 0                                           mov si, string
  Assemble the kernel and test.asm and then copy                          call lib_print_string
them to the disk image as per the previous                                ret
instructions, and boot up the OS. Run test.bin and
voilà: it uses the kernel’s lib_print_string routine. It                  string db “Ciao! inc”, 0
doesn’t care where that routine is in RAM, but knows              By including myos.inc into our test.asm file, we can
that it can call the vector at 0x0002, which will then         use human-readable names for the routines and not
jump to the right place.                                       just the hexadecimal numbers (although those will
  And the same is true of lib_input_string – we’ve             still work, of course). As you add more routines to
also added a vector for that. You can now go ahead             lib.asm and make them accessible via vectors at the
and add other vectors for routines in lib.asm, making          start of your kernel code, you can add more equ
them available to standalone programs. Yes, our                statements to myos.inc and make it easier for people
project really is becoming a proper operating system!          to write programs for your OS.



                                                                 www.linuxvoice.com                                                               107
      CODING MACHINE CODE


                    2    FUN WITH GRAPHICS
                  We’ve worked hard over the last five issues, so it’s
                  time to play hard as well by adding some graphics                     lib_plot_pixel:
                  capabilities to our OS. As with the keyboard, screen                              pusha
                  and disk routines, the BIOS can help out here –                                   mov ah, 0Ch
                  although it’s not especially fast. If you had wanted to                           mov bh, 0
                  write lightning-fast games back in the glory days of                              int 10h
                  MS-DOS, you’d have worked with video RAM directly,                                popa
                  but in our case we can ask the BIOS to plot pixels for                            ret
                  us and do the grunt work.                                               The first of these, lib_gfx_mode, uses the BIOS (int
                     First up, we need to create three routines: one to                 10h, routine 0) to switch to 320x200 pixel mode with
                  enable graphics mode, one to plot a pixel with the                    256 colours at your disposal. Sure, it’s very low-res by
                  specified colour and location on the screen, and one                  modern standards, but plenty of great games were
                  to return to text mode. Open lib.asm and add the                      written in this limited environment! The second routine
                  following routines:                                                   switches back to text mode, and the third plots a pixel
                  lib_gfx_mode:                                                         and takes three parameters: the colour in the AL
                             pusha                                                      register, the X (horizontal) location in the CX register,
                             mov ah, 0                                                  and the Y (vertical) location in DX.
                             mov al, 13h                                                  Next up, add vectors to these at the start of your
                             int 10h                                                    kernel. If you haven’t added any other vectors for
                             popa                                                       routines in lib.asm yet and you only have the three we
                             ret                                                        created earlier, you can add them onto the end like so:
                                                                                                   jmp lib_gfx_mode        ; 0x0008
                  lib_text_mode:                                                                   jmp lib_text_mode       ; 0x000B
                             pusha                                                                 jmp lib_plot_pixel    ; 0x000E
                             mov ah, 0                                                     (Again, the vectors are three bytes apart; use
                             mov al, 3                                                  ndisasm to see where all the jmps are in mykernel.bin
                             int 10h                                                    if you’re not sure.) Now open myos.inc and add the
                             popa                                                       appropriate equ lines for these routines, so that other
                             ret                                                        programs can use them, and then edit test.asm. Here


                    What’s next?
                    So, where do you go from here? The next step is to explore          instructions and registers from x86, most of the concepts you
                    some other x86 real-mode 16-bit operating systems, such as          learn are the same in any assembly language. (Well, unless
                    MikeOS (http://mikeos.sf.net). No, that isn’t just a cheap plug     you start coding for extremely limited embedded chips that
                    – MikeOS is very similar to the mini OS we’ve made here, albeit     don’t even have multiply instructions!)
                    with many more library routines and kernel features. But the           Once you’re up to speed on ARM, you could try making your
                    memory layout and use of vectors is the same, the code is well      own OS for the Raspberry Pi. This is considerably more
                    commented, and there’s plenty you can nab for your own OS           involved than our tutorial series, as you have no BIOS to help
                    (it’s under a BSD-like licence).                                    you out – indeed, you have to write your own video driver early
                        After that, you’ll want to explore something more powerful.     on just to display anything on the screen! But it’s good fun, so
                    KolibriOS (www.kolibrios.org) is a mightily impressive              check out this guide: www.cl.cam.ac.uk/projects/raspberrypi/
                    graphical desktop operating system written in assembly              tutorials/os.
                    language, which features pre-emptive multi-tasking, various
                    filesystem drivers, and other cool features. KolibriOS is a fork
                    of MenuetOS (www.menuetos.net), which is open source in its
                    32-bit incarnation, and includes extra sound and network
                    drivers. It’s insanely fast, but still rather limited compared to
                    the likes of Linux and the *BSDs.
                        Of course, x86 isn’t the be-all and end-all of assembly
                    language. In fact, many coders regard it as a very ugly
                    language, due to all the cruft that has been added onto it since
                    the 1980s (the upside of this is excellent backward
                    compatibility). ARM chips are everywhere these days, and
                    while most of them are in embedded or locked-down devices
                    such as phones and tablets, if you have a Raspberry Pi you
                    can start hacking ARM assembly code straight away.
                        There’s a good starting tutorial at http://tinyurl.com/
                    nsgzq89, which explains how to assemble and link binaries,
                    and then moves on to the specifics of the ARM chip in the           The Raspberry Pi rocks for many reasons, but it’s also
                    subsequent chapters. Note that while ARM has different              the ideal platform for learning ARM assembly.




108                                                    www.linuxvoice.com
                                                                                                           MACHINE CODE CODING

we’re going to write a program that draws horizontal
lines of pictures on the screen, from top to bottom,
changing colour each time. This program makes use
of an inner and outer loop, so it’s a good way to beef
up your assembly knowledge with concepts you’ve
probably come across in higher-level languages.
Here’s the code:
             %include “myos.inc”


             ORG 32768


             call lib_gfx_mode


             mov al, 0
             mov cx, 0
             mov dx, 0


outerloop:
                                                            Steve Ballmer was right – it’s all about developers, developers, developers, developers!
             inc al
                                                            Win them over with an API for your operating system.
             inc dx
             cmp dx, 199                                    return to the outer loop for the next line. Build the OS
             je $                                           and boot it, and you’ll see results like in the picture –
                                                            not bad for such a small program, is it?
             innerloop:
                          call lib_plot_pixel               Custom lines and shapes
                          inc cx                            With this knowledge, you can now build some custom
                          cmp cx, 319                       routines to draw straight horizontal and vertical lines,
                          jne innerloop                     and even filled or outlined boxes. But what about
                                                            arbitrary lines from one point to another? This is a bit
             mov cx, 0                                      more complicated, but one solution is to use
             jmp outerloop                                  Bresenham’s line algorithm. This determines the pixels
  Here, after switching to graphics mode, we set our        that need to be plotted on the screen when a straight
colour, X position and Y position registers to zero.        line is drawn from one point to another. The maths
Then we begin our outer loop, which bumps up the            involved in this is beyond the scope of this tutorial, but
colour by one and moves on to the next line. If we’ve       there’s some pseudocode at http://tinyurl.com/
reached line 199 (the bottom of the screen), then we        k6qsxty, which will help you to implement it.
execute jmp $, which jumps to the same instruction in          The web is full of x86 assembly language
the code – thereby setting up an infinite loop. (Yes, the   implementations of the algorithm, such as http://
only way out of this program is to reset the machine!)      bloerp.de/code/asm/x86/line.html, so do a bit of
  If we’re not at the bottom-most line, however, we         Googling and see how it’s done. You can find similar
begin an inner loop. This plots a pixel at the current      code chunks explaining how to draw circles and other
location and then adds 1 to the CX, moving to the right     shapes. If you’re feeling especially ambitious, and
each time. When we hit the right-hand side (319) the        have plenty of time, you could even try adding mouse
loop ends, so we reset the X position back to zero and      support. The BIOS doesn’t provide any routines for
                                                            this, but you can write a simple PS/2 mouse driver
                                                            and many PCs will emulate USB mice as PS/2 ones
                                                            (in 16-bit real mode). See http://wiki.osdev.org/
                                                            Mouse_Input to get started – and note the links at the
                                                            end of the page, which include example code listings.
                                                               And that’s it! We’ve come to the end of our journey
                                                            through the awesome land of assembly language,
                                                            and hopefully it has whetted your appetite to explore
                                                            even further. Keep banging those bits and bytes on
                                                            bare metal, and if you ever happen to land a six-figure
                                                            salary from an assembly language-related job, this
                                                            author wouldn’t object to a free beer in the post…
                                                            happy hacking!
It’s a good idea to document your system calls so that
                                                             Mike Saunders is now moving on to coding mostly in 1s and
you (and others) know exactly which registers they take
                                                             0s, with the odd 2 thrown in for good measure.
and return.


                                                              www.linuxvoice.com                                                                 109
       MASTERCLASS SOUND EDITING




                                MASTERCLASS
                                Manipulate sound, filter the noise and rub some funk on your
   BEN EVERARD                  masterpiece.



 CAPTURE AND TWEAK AUDIO
 WITH AUDACITY
 Your one-stop tool for melodiously enhancing recordings and audio files.


                                A
                                            udacity is one of those rare breed of open
MAYANK SHARMA                               source software that Linux users love to
                                            flaunt. It runs across platforms and packs in
                                 more tricks than Gandalf. You can use the incredibly
                                 powerful and versatile application for everything from
                                 recording music, vocals, instruments and other
                                 sounds and editing them into a professional sounding-
                                 mix. One of the most popular uses of Audacity is to
                                 churn out podcasts, though you can also use it to
                                 compose tracks for your garage band, record
                                 voiceovers, capture audio from apps, make ringtones                While exporting a recording you can also attach various
       PRO TIP                   and do a lot more.                                                 optional metadata with the file.
  You can tell if a track is        All this robustness hides behind an interface that
  active by the colour of the    might appear cryptic to new users, but it’s also fairly            the pop-up menu next to the microphone icon in the
  track menu — an active
                                 intuitive and grows on you when you start using it.                top bar and select the Start Monitoring option. Now
  track’s menu is a darker
  shade than an inactive         Grab Audacity from your distro’s official repository,              speak into the microphone and if the input meters
  track’s menu.                  either with                                                        respond, your recording hardware is properly hooked
                                 sudo apt-get install audacity                                      up. Note however that the meters shouldn’t hit 0dB. If
                                 if you use a Debian-based distro or                                they do, lower the record volume using the Input
                                 sudo yum install audacity                                          Volume slider on the right, or using your distro’s Sound
                                 on Fedora-based distros. While Audacity is equipped                Settings dialog.
                                 to export Ogg files, if you wish to save your recordings              Before you capture any audio, make sure the audio
                                 in other formats such as MP4 you’ll need to make                   sampling rate is set higher than 22050Hz. By default
                                 sure your distro includes the FFmpeg libraries.                    the app sets this to 44100Hz (in the bottom-left
                                 Similarly, for saving as MP3 you’ll need the Lame                  corner of the interface) and you should leave it as is.
                                 encoder. You can install them both from your distro’s              Now click the red button and start talking. Use the
                                 package manager.                                                   Pause button to take a break and resume recording
                                    The first thing you should do when you launch                   from where you left off. When you’ve finished, click the
                                 Audacity is to check your recording hardware. Bring up             Stop button. If you press the Record button again,
                                                                                                    Audacity will record the audio in a new track. Instead,
                                                                                                    to continue recording from the end of the original
  Enhance with effects                                                                              track press and hold the Shift key before clicking the
  One of the coolest features of Audacity are     pitch of your voice without changing the
                                                                                                    Record button again.
  the dozens of effects housed under the          tempo. Use the Echo effect to dramatise
  Effect menu. Besides the Noise Removal          announcements, or the Reverse effect to play      Polish your recordings
  effect that we’ve demonstrated in these         a track back-to-front for fun. There’s also the   If your cat pounced on you in the middle of a sentence
  pages, there are several other useful ones      Compressor effect, which equalises volume         and you let out a PG-13 utterance or an R-rated
  that you can use to enhance your recordings.    variations in the track by effectively making
  The Change Pitch effect lets you alter the      the quiet parts louder.
                                                                                                    expletive, you can continue recording and easily take
                                                                                                    them out later. When you’re done recording, select the



 110                                                                  www.linuxvoice.com
                                                                                              SOUND EDITING MASTERCLASS

zoom tool from the Tools toolbar and highlight the
portion of the track that contains the aberration. Then
activate the selection tool, carefully select just the bit
that you want to zap, and hit the Delete key. You can
also remove unnecessary portions from the recording
using Audacity’s trim tools. Suppose a track has a lot
of silence at the beginning and the end. In such a
case, select the region of the audio that you’d like to
keep and click the Trim Outside Selection button from
the Edit toolbar to trim all audio not in the selection.
   Another common editing task is to remove
background noise. Using Audacity’s Noise Removal
tool, which has been significantly improved in the
latest version, you can take out constant background
sounds such as fan noise, carrier noise and such.
                                                                                                                           If you plan to work with
Head over to Effect > Noise Removal, click on the Get        and head to File > Import > Audio and select the first
                                                                                                                           Audacity on a regular basis,
Noise Profile button and select a region of the              audio track. Repeat the process to import all three
                                                                                                                           make sure you familiarise
recording that only contains the noise. Then head            tracks and then hit Play to enjoy your masterpiece.           yourself with its keyboard
back to Effect > Noise Removal and experiment with              Another use of the mixing tracks features is when          shortcuts.
the noise removal parameters. Use the Preview button         you wish to mix narration with some background
to listen to a few seconds of audio and tweak the            music or overlay section announcements on top of a
parameters accordingly until you’re satisfied.               longer podcast. On the left of each track is the Track
   Sometimes you might want to reposition sections           Control Panel. It presents relevant information about
within your recording. For example, if you’ve recorded       each track, including its sample rate and bit depth.
a podcast with multiple sections in a particular order       Use the pull-down menu next to the Track title to
and then later decide to rearrange the order of these        rename the track.
sections. Instead of re-recording the podcast, you can          Then there’s the Mute button, which cuts the audio
cut-copy-paste sections of the track just like you           of the track from the mix when you hit the Play button.
would in a text editor. Select the portion you wish to       Conversely, the Solo button cuts out the rest and only
move and press Ctrl+X to cut it. Then move to the            plays the audio from the corresponding track. At the               PRO TIP
position where you want to insert it and press Ctrl + V      bottom is the track’s Pan Control, which lets you              Go to Tracks > Add Label
to paste it.                                                 adjust the track’s audio either to the left or right. Above    At Selection to mark
                                                             this is the track’s Gain Control, with which you can           positions in a track. This
                                                                                                                            is useful for annotating
Mixing tracks                                                control the relative volume of the track.                      bits in a long piece of
If you wish to record from two microphones, you’ll              In order to blend tracks, begin by first splitting the      audio such as an
need a soundcard that can record from multiple               main track into multiple clips. Use Edit > Clip                interview.
channels or you can connect the microphones to a             Boundaries > Split and insert a split where you need to
mixer which you can then hook up to your computer. If        insert audio from another track. You can split a track
you’re on a budget, you can record different sources in      into as many clips as you want. Similarly split the
multiple tracks and then combine them with Audacity.         other track, then use the Time Shift tool from the
So if you have a band, you can record vocals in one          Tools toolbar, at the top of the Audacity interface,
track, the guitar on another and the drums on the third.     make room for the bits from the other track.
Once you have the three tracks, start a new project             If you have places in the track where the music                 PRO TIP
                                                             overpowers the voice, you can fade down the music              Go to Tracks > Mix and
                                                             when the voiceover begins and turn it back up at the           Render before exporting
                                                                                                                            your recording. This will
                                                             end. For this, select the Envelope tool, next to the
                                                                                                                            merge all your tracks into
                                                             selection tool. When you activate the tool you’ll notice       one single track that you
                                                             horizontal lines at the top and bottom of each track.          can then clip, normalise,
                                                                                                                            and enhance as a whole.
                                                             These are representations of the track’s volume,
                                                             which by default are at 100%. Then in the music track,
                                                             head over to the area where you need to fade the
                                                             music and click, hold and drag at either the top or the
                                                             bottom line to reduce the volume of the music. You
                                                             can also click inside the music track envelope to add
                                                             control points and drag the envelope to create a
                                                             desired shape. Experiment with the shape of the
                                                             envelope until you’re satisfied.
Don’t be overwhelmed by the tweakable parameters of the         All this might sound a bit confusing at first, but this
various options and effects. Most of them can be applied     flexibility enables you to create complex compositions
only after trial-and-error.                                  by mixing multiple smaller tracks.



                                                               www.linuxvoice.com                                                                   111
       MASTERCLASS SOUND EDITING



 HACK AUDIO FILES WITH SOX
 Surgically manipulate audio with this command-line gem.


                             S
                                     ox is the Swiss Army knife of command-line           on-the-fly processing. For example, we use the PiFM
                                     sound editing tools. While it lacks the more         script, which enables us to use the Raspberry Pi as a
MAYANK SHARMA                        powerful features and the graphical interface of     low-power FM transmitter. It’s very easy to implement
                             Audacity, Sox is incredibly versatile and has the            and enables us to listen to audio even on older FM
                             batch-processing advantage of a command line utility.        players that don’t have Wi-Fi. However, the script can
                             The tool is adept at several common sound editing            only play audio files that are 16-bit 22050Hz mono
                             tasks such as converting files into different formats        and in the WAV format. Instead of first converting all
                             and applying sound effects.                                  our music into WAVs to conform to these restrictions,
                                Grab Sox from your distro’s mirrors either with sudo      we use Sox to process the file on the fly and then pass
                             apt-get install sox or sudo yum install sox depending        it on to the script. The command:
                             on your distro. Also grab the libsox-fmt-all package,        sox -t ogg SomeSong.ogg -t wav -r 22050 -c 1 - | sudo ./pifm
       PRO TIP               which includes all of the Sox libraries and the ability to   - 100.1
  Use the avg parameter      work with various file formats including MP3.                will translate the Ogg file into a WAV file, change its
  when converting a             Once you have the tool and the libraries, converting      sampling rate to 22050Hz and down mix the track to
  multi-channel Stereo       files from one format to another is a simple affair. The     a mono channel. The converted audio is sent to the
  track to Mono.
                             command sox some-file.mp3 great-file.ogg will                standard output, denoted by the hyphen sign (-) and is
                             encode the MP3 file into Ogg. As you can see, Sox            then piped (|) into the standard input of the pifm
                             recognises the formats of the input file and the output      command. The script will then broadcast it on the
                             file from the extension of the file.                         100.1 FM frequency.
                                Before you can manipulate a file, you’ll need to            You don’t even need the file on your disk. If you wish
                             know its encoding information. The command                   to broadcast the Linux Voice podcast, you can do so
                             sox --i some-file.ogg                                        with the command:
                             will list various details about the file including its       sox -t ogg http://www.linuxvoice.com/episodes/lv_s03e05.ogg -t
                             sample rate, file size, bit rate, and more.                  wav -r 22050 -c 1
                               If you wish to reduce the size of the audio files on         The only difference between this command and the
                             your disk, one way to do so is to reduce their sampling      previous example is that instead of pointing to a local
                             rate. The command                                            Ogg file, we are now pointing to one that resides
                             sox some-file.ogg -r 16k downsampled-file.ogg                online. Similarly, you can use Sox to convert an online
                             will change the sampling rate of the file down to            radio station and pipe it to the PiFM script, like so:
                             16kHz. Now check the file again with the --i switch          sox -t ogg http://network.absoluteradio.co.uk/core/audio/ogg/
 Use the -S switch to keep   and note the changed sampling rate and the reduction         live.pls?service=a6bb -t wav -r 22050 -c 1
 an eye on the progress of   in file size.                                                  Not all stations broadcast Ogg streams. To convert
 ongoing activity.              One of the most popular ways of using Sox is to do        MP3 streams all you need to do is change the type of
                                                                                          the input file you are converting with Sox, like so:
                                                                                          sox -t mp3 http://www.ndr.de/resources/metadaten/audio/m3u/
                                                                                          ndrloop5.m3u -t wav -r 22050 -c 1


                                                                                          Audiophiliac remedies
                                                                                          Besides converting music, there are various other
                                                                                          ways you can manipulate audio with Sox. You can, for
                                                                                          example, use it to extract a part of audio with the trim
                                                                                          switch. The trim switch accepts two parameters: the
                                                                                          starting point of the portion you wish to keep and the
                                                                                          second denotes its length. For example,
                                                                                          sox original.ogg beginning.ogg trim 0 10
                                                                                          will extract the first 10 seconds from the original.ogg
                                                                                          file. Conversely, if you wish to clip the first 10 seconds
                                                                                          and keep the rest, first find the duration of the track in
                                                                                          seconds with the
                                                                                          sox file.ogg -n stat
                                                                                          command. Make a note of the value listed next to the
                                                                                          Length (seconds) parameter. Let’s assume ours reads
                                                                                          2965.12. Then use the command
                                                                                          sox original.ogg silence-clipped.ogg trim 20 2945.12



 112                                                           www.linuxvoice.com
                                                                                                  SOUND EDITING MASTERCLASS


                                                                                                                          You can use Sox to start
                                                                                                                          recording when it detects
                                                                                                                          audio and stop when it
                                                                                                                          detects a specified length
                                                                                                                          of silence.




Here 20 is the starting point of the recording we wish      the clip by half.
to preserve, and 2945.12 is the original length minus         Sox also includes two other command-line utilities.
the first 20 seconds.                                       There’s the play utility, which is basically just a shell
   An easier way to do this is to specify the length of     script that calls Sox to play an audio file over the
the track you wish to clip. So if you wish to lop off the   default audio device. So
first 10 seconds, use                                       play some-audio.ogg
sox original.ogg start-clipped.ogg trim 10                  will play the file. Since it’s just a script around Sox you        PRO TIP
  Similarly you can also clip from the end of the track.    can use play to hear a file without actually modifying         Add a small amount of
The command                                                 it. So if you wish to boost the bass of a song but aren’t      stereo reverberation
sox original.ogg end-clipped.ogg reverse trim 5 reverse     sure of the value you want to boost it by, you can use         effect to a mono file with
                                                                                                                           the -w switch to make it
will reverse the track, trim 5 seconds from the             the play command. The command                                  sound more natural.
reversed track and reverse it back again, which             play some-audio.ogg bass +3
effectively removes the last 5 seconds of audio.            will play the file after boosting the bass 3 notches
   You can also use Sox to merge multiple audio files       without touching the original file.
into one. The command                                         Sox also comes with a recording utility. The
sox -m background-music.ogg commentary.ogg great-show.ogg   command
will combine the background-                                                             rec voice.ogg
music.ogg file with
commentary.ogg so that they
                                      “If you need to modify an                      will start recording from the
                                                                                     default recording device. It’ll
overlap each other in the             audio file chances are you                     record until you use the Ctrl +
great-show.ogg file.
   Sox also lets you add a
                                      can do it with Sox.”                           C hot key to abort the
                                                                                     operation. The recorded
fade-in and fade-out effect to                                                       clip will be saved in the voice.
a track. The command                                        ogg file. You can also limit the duration of the                   PRO TIP
sox music.ogg with-fade-in.ogg fade 10                      recording. The command                                         You lose some
will slowly raise the volume from zero to maximum in        rec record-voice.ogg trim 0 10                                 information when
                                                                                                                           converting to some
10 seconds. If you wish to add a fade-out effect as         will record for only 10 seconds. And you can even use
                                                                                                                           formats, such as like
well, you’ll need to know the length of the track.          other switches as well. The command                            MP3, that compress
Assuming the length of the track to be 400 seconds,         rec -r 16k -c 1 voice.ogg trim 0 10                            audio. Know that
                                                                                                                           converting back again
the command                                                 will record for 10 seconds and then downsample
                                                                                                                           from such formats will
sox music.ogg with-fades.ogg fade 10 400 5                  the recording to a single channel audio with a 16k             not produce an exact
will add a 5 second fade-out at the end of the track in     sample rate.                                                   copy of the original.
addition to the 10 second fade-in.                            There’s so much more that you can do with Sox.
   There are several other ways you can alter the           We’d run out of paper if we attempt to cover
audio, some more useful than others. For example,           everything you can do with the utility. But rest assured
you can also speed up or slow down a file by                that if you need to modify an audio file, chances are
changing its pitch by a particular factor. The default      you can do it with Sox .
pitch factor of a file is 1.0. The command
sox normal.ogg faster.ogg speed 2.0                          Mayank Sharma has been finding productive new ways to
                                                             mess about with free software for years now.
will double its speed and also reduce the duration of



                                                              www.linuxvoice.com                                                                    113
      /DEV/RANDOM/




Final thoughts, musings and reflections
                            Nick Veitch
                            was the original editor                                                                   Sennheiser HD25-1
                            of Linux Format, a                                                                        headphones – in a
                            role he played until he                                                                   previous life I was a
                            got bored and went                                                                        sound engineer…
                            to work at Canonical
                            instead. Splitter!




L
        ast year I backed a Kickstarter for a 3D
        printer. In fact I backed several, but there
        was one I was particularly keen on seeing.
                                                                     Lenovo X220 –
Everything would be straightforward and ‘Just                        works flawlessly!
Work’, etc. So far it’s six months late, but hey, I
was expecting that.
   What I wasn’t expecting was the slide on their
promises. When I backed the Kickstarter, it
proclaimed it would work with Windows/Mac/
Linux. I didn’t pay that much attention to it at the                     Mechanical keyboard
time, because after all, what idiots would                               from Filco, with cherry
produce a 3D printer without making it                                   brown keys, but also                     I’ve always preferred
                                                                         rubber dampers.                          trackballs to mice – they
compatible with all the industry-leading 3D
                                                                                                                  seem to work better.
software out there. Let’s face it, home 3D printing
was invented (whatever those Makerbot sell-out
turncoats would have you believe) by the
RepRap project, using open hardware and open
source software. In Bath, as it happens.
   Fast forward a few seasons, and a website is
                                                         My Linux Setup Neil McGovern
duly created. Worryingly it now says “Windows/
Mac. Linux support is also likely”. When the
                                                         The Debian Project Leader shares his hacking environment.
printers start shipping, I discover that they have
spent at least 12 months hiring developers and                What version of Linux are you          and have been running that ever since.
writing their own software! Not their own                     currently using?
front-end or anything, but a complete Windows                 I’m currently running the latest              What Free Software/open source
application, helpfully written in something that              release of Debian 8 “Jessie”,                 can’t you live without?
will be hard to port to Linux.                           unsurprisingly.                                    As most of my job involves
   The developers have kindly enabled an option                                                             communications, and a lot of it, I’ll
not to ship the printer before the software is                 And what desktop do you               have to go with a combination of Irssi for
ready for those platforms, but as they can’t say               currently use?                        IRC and Mutt for email. Text-based
when that will be, and haven’t even started                    I’m using Gnome 3.14 – I’ve tried a   interfaces are the only way I’m able to stay
working on it, I don’t want to wait another year…              few different ones, and it seems to   on top of things!
   The worst part of all is that all this info has had   be the most complete at the moment.
to be dragged out of them. The ‘we are too busy                                                             What do other people love but
to respond’ excuse is pointless and foolish when             What was the first Linux setup                 you can’t get on with?
you have a website and a forum – it actually                 you ever used?                                 Not wanting to cause a holy war, but
saves time! If you are starting a Kickstarter, don’t         The first install I did was Mandriva,          I guess Emacs. I’m a Vim user, and I
be an idiot. And also, remember to reply to all the          about 13 years ago. However, I          just never seem to have enough fingers to
backers. Even the idiots.                                moved on to Debian after about a year,      make Emacs work for me.



114                                                             www.linuxvoice.com
CC-BY SA