DOKK Library

Linux Voice [Issue 23]

Authors Linux Voice

License CC-BY-SA-3.0

Plaintext
FREE 222-PAGE TUTORIAL MEGAPACK DOWNLOAD                                                                            See p5
                                                                                                                  for details



                                                                   RASPBERRY PI
                                                                      GPIO Zero –
                                                                       hassle-free
                                                                         hardware
February 2016                                 www.linuxvoice.com          hacking



BUILD A LINUX
SMART HOME
Connect mundane household
items to the wonders of the
internet – just because we can!

 $5 RASPBERRY PI
 ZERO: REVIEWED


 RSS
 Take back your
 news from Twitter’s
 proprietary clutches

 IF THIS, THEN THAT                     PRIVACY:
 Simple scripts to save                SECRETS OF
 time, work better and               TOR’S BROWSER
 make your life easier
                                                            32 PAGES OF TUTORIALS
 DEFENDER OF THE GPL              SUSE CONF
 BRADLEY KUHN                     SUSE
                                                                       Febr uar y 2016 £5.99 Printe d in the UK




 Opportunistic GPL                There’s something
 abusers, beware – the            happening at
 Software Freedom                 SUSE – the
 Conservancy’s coming             forgotten distro
 to get you…                      is fighting back!



MINSKY › SYNTHESIZERS › OGGCAMP & MORE!
The only Linux magazine available
   as DRM-free PDFs and ePub




shop.linuxvoice.com
                                                                                                   ISSUE 23 WELCOME



PUT LINUX IN EVERYTHING
The February issue                                                                        What’s hot in LV#023
                                                                                                   ANDREW GREGORY
                                                                                                   Studying economics usually
                                                                                                   involves lots of charts and axis
                                                                                                   intersections. But being able to
                                                                                                   visualise and play with these via
                                                                                                   Minsky has been truly revealing.
                                                                                                   p90
                                             GRAHAM MORRISON
                                             A free software advocate
                                             and writer since the late                             BEN EVERARD
                                             1990s, Graham is a lapsed                             None of us would be here without
                                             KDE contributor and author                            the GPL, and yet very few people
                                             of the Meeq MIDI step                                 defend its use and fight for our
                                             sequencer.                                            rights. Bradley Kuhn is one of




I
                                                                                                   those people, and our interview
     t’s difficult to come up with snappy terms for technology. Cloud                              this month is enlightening.
     doesn’t do it for me, and neither does ‘Internet of Things’, which I                          p34
     find particularly bereft of meaning. But both technologies are
incredibly exciting, and I’ve been hooked on the idea of home                                      MIKE SAUNDERS
automation for some time. With the launch of the new £4 Raspberry                                  Ben’s exceptional games tutorial,
Pi, I can envisage fitting this small, light, fully functional Linux                               using nothing more than SVG and
computer into all kinds of things, maybe even the toaster.                                         a few lines of JavaScript, is
   Doing this yourself is not only an adventure, it ensures you’re not                             brilliant. And the game itself is
beholden to whomever owns the technology. We can easily envisage                                   really, really addictive. It’s like
a time when Philips ‘upgrades’ its remote lighting protocol, for                                   Flappy Birds meets Scramble.
                                                                                                   p88
example, forcing us all to upgrade too, and that’s before asking
where the data is going and who has access to your central heating
schedule. Once again, Linux and open source is the only option.

Graham Morrison
Editor, Linux Voice

                                             Linux Voice is different.
  THE LINUX VOICE TEAM
                                             Linux Voice is special.                        SUBSCRIBE
  Editor Graham Morrison
  graham@linuxvoice.com                      Here’s why…                                    ON PAGE 56
  Deputy editor Andrew Gregory
                                              1 At the end of each financial year we’ll
  andrew@linuxvoice.com
                                             give 50% of our profits to a selection of
  Technical editor Ben Everard               organisations that support free
  ben@linuxvoice.com                         software, decided by a vote among our
  Editor at large Mike Saunders              readers (that’s you).
  mike@linuxvoice.com
  Games editor Michel Loubet-Jambert          2 No later than nine months after first

  michel@linuxvoice.com                      publication, we will relicense all of our
  Creative director Stacey Black             content under the Creative Commons
  stacey@linuxvoice.com                      CC-BY-SA licence, so that old content
                                             can still be useful, and can live on even
  Malign puppetmaster Nick Veitch
                                             after the magazine has come off the
  nick@linuxvoice.com
                                             shelves
  Editorial contributors:
  Mark Crutch, Andrew Conway,                 3 We’re a small company, so we don’t
  Marco Fioretti, Vincent Mealing,           have a board of directors or a bunch of
  Simon Phipps, Les Pounder,                 shareholders in the City of London to
  Valentine Sinitsyn.                        keep happy. The only people that matter
                                             to us are the readers.



                                                                 www.linuxvoice.com                                                      3
     CONTENTS ISSUE 23 FEBRUARY 2016




                        Contents
                           What rough beast, its hour come round at last, slouches to the sofa for a nap?


    Regulars                                      Cover Feature
News                                      06
Gimp turns 20, Debian developers fall out
and Tor Messenger brings privacy to our                                                                                                                16
Instant Messenger bletherings.

Distrohopper                              08
Revitalise old hardware with Puppy Linux,
get support for new users with Black Label,
and do, er, BSD stuff with BSD.

Speak your brains                           10
How to engage the great unwashed with
privacy, justifiable paranoia and a vote of         OPEN
                                                    SOURCE
confidence for SUSE.

Subscribe!                            12/56

                                                    SMART HOME
Save money, get the magazine delivered to
your door and get access to 23 issues of
Linux Voice, in lovely DRM-free PDFs.

FOSSPicks                                   58
Freedom isn’t free – it’s a load of searching,
                                                 Control your heating from your phone and get emails when your smoke
downloading and compiling, and the fruits        alarm goes off – welcome to your new connected home.
are here in FOSSPicks.

Core Tech                               94        Interview                                         Feature
Linux is more secure than Windows not
because of some voodoo – a large part of
it is privilege separation.
                                                                                        34                                                             24
Geek Desktop                            98
The Mate desktop, Minecraft and the
Ubuntu Podcast have all been made better
by the presence of Martin Wimpress, now
also found on our geek desktop page.




                                                 Bradley Kuhn                                     Don’t you forget about me…
        SUBSCRIBE                                Look – it’s the president of the                 Enterprise clouds, IBM and fluffy penguins. The future’s
        ON PAGE 56                               Software Freedom Conservancy!                    bright: the future’s green.


                                                  FAQ                                    Group Test
                                                 Flutter                           32   Lightweight web browsers       50
                                                 Web development frameworks             Explore the wonders of the world
                                                 are like buses: you wait a while,      wide web without melting your
                                                 then three come along at once.         RAM banks.

                                                                                                      OGGCAMP 2015
                                                                                                     TURN TO PAGE 14!
4                                                                   www.linuxvoice.com
                                                                                           ISSUE 23 FEBRUARY 2016 CONTENTS
        FREE
  222-PAGE TUTORIAL
    Feature
      MEGAPACK                                                                                                       Tutorials
DOWNLOAD OUR TUTORIAL
 EXTRAVAGANZA FROM:
 WWW.LINUXVOICE.COM/ NVPHE4J
                                                                                                         28




           inside                                                                                                   Repurpose your old Android phone
                                                                                                                    Turn old hardware into something useful.
                                                                                                                                                             66

                                                                                                                    NB only possible because of Free Software.




   The future of the cloud
   Enterprise distributions beware: CoreOS is coming, and it’s going to eat your dinner.                            Record synthesized tunes                68
                                                                                                                    Ardour, Helm and a load of plugins combine
                                                                                                                    to make beautiful music.
     Reviews
                                                                                                                    GPIO Zero                               72
                                                                                                                    Connect your Raspberry Pi with the physical

                                                                                                         42         world the easy, quick and clever way.

   Phoronix                                                                                                         If This Then That                         76

   Test Suite
                                                                                                                    Build scripts to automate your life through
                                                                                                                    an easy web service. Welcome to the future!
   Benchmark your harware, share your
                                                                                                                    RSS                                        78
   results online with the PC modifying
                                                                                                                    Access, filter and control the anarchy of the
   community and help others make the
                                                                                                                    interweb with this old web technology.
   right purchasing decisions. It’s the dream
   scenario for hardcore upgraders.
                                                                                                                     Coding
   CamJam EduKit 3                 43    Raspberry Pi Zero              44    OpenElec 6                       45
   Get a box of bits and bobs to turn    The Raspberry Pi is now smaller,     Turn any conveniently small PC
   your Raspberry Pi into a simple       more efficient and cheaper than a    into a smart TV with this single-
   robot. Happy Christmas!               very expensive pint of beer.         purpose media distro.




                                                                                                                    ARM Assembly                              84
                                                                                                                    Code directly on to the bare metal of the
                                                                                                                    most common chipset in the world.

                                                                                                                    SVG games                               88
                                                                                                                    Code a cross-platform side-scrolling game
                                                                                                                    using only scalable vector graphics.
   Gaming on Linux                                     46   Books                                           48
   The primal fear of Alien: Isolation, plus some other     Vim is a complex beast, so we’re enormously             Minsky                                  90
   games that aren’t Alien: Isolation. You really should    grateful to those who’ve taken the time to document     Practical macroeconomics and libidinous
   try Alien: Isolation son – it’s very good.               it. Also: is there life on Mars? Find out!              captains, the Linux Voice way.



                                                                      www.linuxvoice.com                                                                       5
    NEWS ANALYSIS




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


Does Microsoft Love Linux Yet?
The company that once compared Free Software with drug dealers is cleaning up its act. Or is it?

                          Simon Phipps
                          is ex-president of the
                          Open Source Initiative
                          and a board member
                          of the Open Rights
                          Group and of Open
                          Source for America.




W
              hen news broke in the Autumn
              that Microsoft and Red Hat had
              reached an agreement for Red
                                                     It’s up to you, dear readers,
Hat Enterprise Linux and the rest of Red
                                                     to make up your minds
Hat’s software portfolio to be sold through
                                                     how much you trust our old
Microsoft’s Azure cloud service, many saw it         friends at Microsoft.
as an end to hostilities from Microsoft.
Indeed, anywhere Microsoft’s Azure team
goes, it displays the slogan “Microsoft Loves      Windows and Office business units are still     “loving” Linux, and only modest signs of
Linux” and embraces the geek subculture,           solidly proprietary, with the tiniest of        co-existing with open source.
right down to Microsoft-branded Tux                concessions to their closed software                It’s hard to change a company as large
plushies. Even this esteemed magazine              working on open platforms being treated as      and profitable as Microsoft quickly. But a
carried an interview with a key Microsoft          salvation. Worse, there seems to be no          significant and binding gesture of goodwill
spokesman in a recent issue.                       let-up in their continued taxation of open      would go a long way to convincing those of
   So is it true? Does the company whose           source community members using                  us with the scars of Microsoft’s decades of
former CEO described Linux as a cancer             embedded Linux or adding compatibility          verbal and actual abuse of open source that
really love Free Software now? Has                 with Windows filesystems, and revenues          they mean business. One aspect of the Red
Microsoft joined the FOSS community?               from enforcing software patents against         Hat press release was its mention of a
   The answer has to be “not yet”. The Azure       Android appear to be at an all-time high.       “patent stand-still agreement” with
cloud business unit has definitely                    According to personal reports I’ve           Microsoft. Clearly Red Hat is wary of
understood that it can only succeed by             received, they also still seem to covertly      Microsoft’s ongoing patent aggression, and
embracing Linux, and its influence has led to      spread FUD about open source applications       if they are concerned, so should we be.
other projects (such as the .Net developer         here in Europe when there is a risk of              That’s why my recommended remedy for
tools Azure needs) also taking open source         regional governments adopting ODF or            Microsoft concerns patents. If Microsoft
steps. It would be fair for Microsoft to use       LibreOffice. So while the Azure business unit   really wants to convince us all that it has
the slogan “Azure Loves Linux”.                    is embracing the ecosystem the same as          changed and now wants to be considered a
   But the rest of the company is not so           many before them have done, the Windows         full member of the open source community,
advanced. As far as anyone can tell, the           and Office business units show no signs of      it needs to foreswear patent aggression. It
                                                                                                   could do that by joining the Open Invention
    Microsoft still seems to spread FUD about                                                      Network (OIN) or by signing up to Mozilla’s
                                                                                                   Open Software Patent Licence. But until
    open source when there is a risk of regional                                                   Microsoft ceases hostilities, it’s too early to
                                                                                                   say that the whole company loves Linux or
    governments adopting ODF or LibreOffice                                                        open source.



6                                                              www.linuxvoice.com
                                                                                                    ANALYSIS NEWS



        Tor Messenger • LibreOffice • Hurd + Gimp • Kernel • Jolla • Debian



CATCHUP                                                      Summarised: the biggest news
                                                             stories from the last month

          Tor-based Messenger                          LibreOffice team holds                      New Raspberry Pi Zero
   1      chat program hits beta                2      bug hunting session                  3      costs less than a pie
          Tor Browser has become                        LibreOffice 5.1 is undergoing               After admitting he’d spent
the go-to program for anonymously            heavy development work, and the team        his entire savings twice when he was
accessing the web, and now                   is trying to get more coders involved       younger, first on an Acorn BBC then
Tor Messenger is here to do the same         by holding bug hunting sessions.            on a Commodore Amiga, Raspberry
for instant messaging. The program           Experienced LibreOffice hackers will be     Pi CEO, Eben Upton, launched the
supports multiple transport networks         available to assist and mentor newbies      incredibly affordable £4 Raspberry Pi
such as Jabber, IRC, Google Talk and         who want to fix bugs in the upcoming        Zero. See p44 for our full review.
others, and enables OTR (Off-the             5.1 release, but don’t know their way
-Record) encryption and authentication       around the labyrinthine codebase. All
by default. Downloads are available for      being well, LibreOffice 5.1 final will be
Linux, Windows and Mac OS X.                 released in early February 2016, and
https://blog.torproject.org/blog/tor-        promises to start up twice as quickly as
messenger-beta-chat-over-tor-easily          the current stable release.




          GNU Hurd 0.7 released                        Gimp turns 20 with 2.8.16                   Linux kernel 4.4 to bring
   4       When Richard Stallman                5      and shiny new website                6      Pi graphics driver + more
           started the GNU project, he                  Yes, the GNU Image                          Version 4.4 of the Linux kernel
didn’t expect the Linux kernel to arrive     Manipulation Program has turned 20          should be available by the time you
several years later and take a lot of the    years old. Developer Peter Mattis           read this, and brings about a boatload
Free Software fanfare. GNU has been          announced the first publically available    of improvements and updates. A KMS
working on its own kernel, Hurd,             snapshot of Gimp to the comp.os.linux.      (kernel mode setting) driver for the
although development has been                development.apps newsgroup on               Raspberry Pi has been included –
painfully slow. Being a microkernel,         21 November 1995. Two decades later,        although hardware acceleration and
where drivers, filesystems and network       the project has undergone a (long           power management will come in a later
stacks are kept in separate processes,       needed) website revamp, and a new           release. Linux 4.4 also includes support
Hurd could one day be even more              Gimp release – 2.8.16 – is here with        for AMD’s Stoney APU, along with VirtIO
reliable than Linux (but with significant    support for layer groups in OpenRaster      VirtGL which provides OpenGL support
performance impacts).                        files, PSD fixes and other updates.         for guest virtual machines running
http://tinyurl.com/pjg3zae                   www.gimp.org                                inside the Qemu+KVM combo.




          Jolla lays off staff, goes                                                               Debian Live falls victim
   7      for debt restructuring                                                            8      to developer spat
           Bad times for Jolla,                                                                     “Debian can be great. But
developers of the smartphone of the                                                      depending on who you are, where you
same name and the Linux-based                                                            come from, and who your friends
Sailfish OS. The company has                                                             are, Debian can also be hateful and full
temporarily laid off most of its staff and                                               of deceit.” So says Daniel Baumann,
applied for debt restructuring, following                                                lead developer of Debian Live, claiming
the withdrawal of its largest investor.                                                  that his work has been hijacked by other
“Jolla is now fighting for survival”,                                                    developers inside the Debian-CD and
says co-founder Antti Saarnio, and the                                                   Debian-Installer teams. Those teams
news raises big questions about Jolla’s                                                  claim it was necessary in order to add
planned tablet. More details here:                                                       new features such as UEFI support and
https://blog.jolla.com/open-letter-                                                      fix long-standing bugs.
jolla-community                                                                          http://tinyurl.com/qdyjq4x




                                                      www.linuxvoice.com                                                              7
    DISTROHOPPER LINUX DISTROS




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


Black Lab Linux 7.0
With commercial support.


N
           ew Linux convertees often have a
           hard time. They can be bamboozled
           by the sheer number of distros,
desktop environments and window
managers, and when they finally settle on
something and get it installed, finding help
can be a whole other challenge. “RTFM” is
the usual response ladled out by many in the
community – while the friendlier among us
try to point newbies in the direction of
forums, mailing lists and wikis.
   Black Lab Linux aims to fix this problem
by offering a polished home desktop distro
with personal support. It’s available in two
versions: for $89.99 USD you get one year of
phone and email support, while for $25.99
you get 30 days of email support. The
former may seem like a lot of cash,
especially when many of us are used to
fixing problems ourselves for free, but the
ability to call someone at any time and get     Got a friend who wants to try Linux, but needs help getting started? Black Lab could be the answer.
personalised help could be a major
attraction for many potential Linux newbies.    (including the Pepper Flash plugin) and            notice a lot of similarities in the desktop
   Black Lab Linux 7.0 features an Xfce         Steam Client, all running on kernel 3.19.          here, especially those title bars… Ah,
desktop with LibreOffice 5, Chromium            Readers who recall the days of BeOS will           nostalgia. www.blacklablinux.org




Puppy Linux 6.3.0
Slackware goodness fine-tuned for older machines.


W
            e’re often asked which distro is    of apps and utilities. Puppy itself is a very
            best suited for an old PC. Of       trimmed-down distro that uses the JWM
            course, that depends on the         window manager alongside the ROX file
definition of “old”, but in most cases we       manager as its desktop setup.
recommend Lubuntu for machines with                Almost all of the software supplied with
1GB+ of RAM, while Puppy Linux is a great       Puppy is friendly to your RAM banks as well:       Got an old PC or laptop sitting around doing
alternative for boxes with 512MB.               there’s the Sylpheed email client, AbiWord         nothing? Give it a new lease of life with Puppy.
   Puppy Linux 6.3.0, the latest release, is    word processor, mtPaint image editor and
based on Slackware 14.1, which in itself is a   other tools. We were surprised to see Firefox        Puppy has plenty of fans on its forums
fairly minimalist distro that uses mostly       included as the default browser – sure, it’s a     ready to help newbies, and development is
vanilla upstream sources. Puppy is designed     great browser, but Midori or NetSurf (see our      active so you don’t have to hunt down a
to be compatible with Slackware’s package       Group Test on page 50) would have been             distro from five years ago just to find
repositories, so you get access to hundreds     more appropriate alternatives.                     something that runs decently on an old PC.



8                                                           www.linuxvoice.com
                                                                                                    LINUX DISTROS DISTROHOPPER



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


O
          penBSD head honcho Theo de
          Raadt often gets flak for his
          no-nonsense attitude on mailing
lists, and some developers in other projects
have criticised him for being “arrogant” and
out of touch. A video interview from a BSD
conference in 2013 (www.youtube.com/
watch?v=OXS8ljif9b8) shows another side
to the man, however; in it he freely admits
that OpenBSD has historically been weak in
some areas, most notably in support for
SMP (multiple processors) and virtual
machines.
   The latter deficiency is being fixed though:
developer Mike Larkin has started to
introduce code for the new VMM subsystem
into the main source tree. Currently, VMM is
a simple hypervisor that makes it possible to
run OpenBSD guest virtual machines on an                    DesktopBSD takes a mature and well-tested FreeBSD base and peps it up with a graphical installer
OpenBSD host, but due to a lack of a BIOS                   and other newbie-friendly goodies.
there’s no proper support for other operating
systems right now. (Larkin noted that he has                traditionally been very conservative with         DesktopBSD (www.desktopbsd.net). It’s a
managed to get a NetBSD kernel booting                      new features, focusing intensely on code          respin of FreeBSD with new users in mind,
with a bit of hackery.)                                     quality and security rather than having every     and to that end it has a graphical installer
   The VMM code is undergoing heavy                         bell and whistle available from day one, so       and other tools to make life easier for
development, and as stated on the mailing                   we’re intrigued to see how VMM develops.          first-timer BSDers. The DesktopBSD team
list, “There are still lots of things that need to             Meanwhile, if you’ve always wanted to get      has just announced the first milestone
be fixed and improved. For this reason, it is               into the world of BSD but found the               release towards version 2.0, so grab it from
still disabled by default.” OpenBSD has                     installation processes rather taxing, try         the site for testing.


  Wayland: finally here?

  It feels as if Wayland, the replacement for the venerable X Window
  System, has been “just around the corner” for many years now. For a lot of
  people in the GNU/Linux community, there’s nothing wrong with X – so if it
  ain’t broke, why fix it? X has served us well over the years (no pun
  intended), providing some features like network transparency that have
  been hugely useful for setting up thin-client desktop terminals.
      But X is still full of cruft and hacks that have built up over the decades.
  It often takes a lot of fiddling to get good performance from the X server,
  eg without tearing effects when dragging windows around, along with
  other issues, so we need something that’s simpler, more streamlined, and
  more usable across different devices including smartphones and tablets.
      Wayland has already seen some (limited) real-world use in the Sailfish
  OS running on the Jolla smartphone – although the future of Jolla is
  looking shaky now, as reported on page 7. In regular distro-land, we’ve had
  the bizarre RebeccaBlackOS as a testing ground for Wayland, but none of
  the big-name distros have adopted it yet.
      That’s about to change though: Fedora 24, due in May 2016, will likely
  have Gnome running on Wayland as the default desktop. Fedora 23 uses
  Wayland for the login screen, but this switch for the complete desktop will
  be a huge – and possibly risky – change. Still, somebody has to do it, so
  even if Fedora 24 ends up being released with some bugs and glitches on
  the desktop, hopefully this will lead to widespread usage and testing of
  Wayland, so that the community can iron out the wrinkles and prepare for          Wayland aims to replace the X Window System’s legacy architecture
  an X-free future.                                                                 with something simpler and more streamlined.




                                                                           www.linuxvoice.com                                                                9
     MAIL YOUR LETTERS




YOUR LETTERS
Got an idea for the magazine? Or a great discovery? Email us: letters@linuxvoice.com


                      TALKING TO PEOPLE ABOUT PRIVACY
                      I listened to the 5 November podcast today., and I also
                      believe that the general public needs to be made aware of
                      privacy issues, and I have also encountered people who
STAR                  don’t initially seem concerned about it. To discuss the
LETTER                issue with the ignorant masses, you have to put it in a
                      form they understand. When I encounter a person who
                      says they aren’t concerned, I follow this “program”:
                      Ask the person for their wallet.
                      If they don’t offer it
                      Ask why they didn’t offer it.
                      If the reason is that they don’t want anybody to see what’s in
                      it
                      Open the discussion into internet privacy.
                      Else open the discussion into internet privacy.
                      Else
                      Open their wallet.
                      Until the wallet is empty or the person protests # Protest is
                      an immediate interrupt to this loop
                      Take an item from the wallet.
                      If you’re in a room full of people
                      Read the information from the item aloud to the room.             The writer of the dreadful Telegraph piece linked to below is
                      Else copy the information to a piece of paper.                    an advisor to this man. On unicorns, probably.
                      Give the person back their wallet and items.
                      If the person protested the release of their information          Andrew says: To misquote WB Yeats: The best lack
                      Open the discussion into internet privacy.                        all conviction, while the ignorant spew rubbish
                      Else if there was nothing of importance in their wallet           without shame because they don’t realise just
                      Congratulate them on the mugging decoy.                           how daft they sound. Unfortunately the great
                      Open the discussion into internet privacy.                        mass of comment about privacy tends towards
                      Else you’re dealing with somebody who has no concept of           drivel (as with this idiocy: www.telegraph.co.uk/
                      the idea of privacy. Explain it to them, then enter into the      technology/12008689/Why-is-Silicon-Valley-
                      discussion on internet privacy.                                   helping-the-tech-savvy-jihadists.html). Thanks
                      Paul Olson, Eufaula, Oklahoma, USA                                very much for this clear sighted good sense.



                      DEBIAN!= LINUX
SUSE won us over
                      I was an OpenSUSE desktop user for a few years before             standard, nor necessary. I find it interesting, and I suppose
years ago for its
superb hardware       switching over to Mint. I wanted to install Steam, which          a little sad that people become so familiar with
detection, but it’s   really works smoother on Ubuntu-based distros. This               commands that are specific to one distro, or family of
pushing ahead in      helped me to realise some of the differences in userland.         distros, that they take it for granted that there are other
all sorts of new      I’d like to comment on the letter titled ‘Cinnamon’ in Linux      ways to do things. Another nasty surprise for me was
   areas now.         Voice 21. It would appear John doesn’t realise that sudo is       when my script, which used ‘rename’ in SUSE didn’t work
                                  a Debian, or perhaps Ubuntu thing. Mageia, like       in Mint. A quick look at both man pages tells all: same
                                     Mandriva before it, like Slackware, OpenSUSE       command name, but they don’t work the same. So in
                                       and I believe Red Hat use “su” as the default    Mageia’s defence, you don’t have to include an extra and
                                        method to execute commands as root.             unnecessary command to be ‘complete enough’.
                                        You can, of course, set up sudo, but it’s not   Bruce Muggins
                                                                                                        YOUR LETTERS MAIL


TINKER, TAILOR                                                                                                              There’s no way
                                                                                                                            to tell whether
                                                                                                                            this motherboard
Following Lenovo’s foray into spying, by placing software
                                                                                                                            is infected with
on its desktop and laptop motherboards to gather                                                                            any malware. Be
information not related to making the computer work;                                                                        careful!
would the Linux Voice team like to consider how long it will
be before Cameron and Obama take a deeper walk into
‘George Orwell land’, and finance computer manufacturers
to purpose-design motherboards to harbour spying
software that does not need to load onto a hard drive. This
would appear to be the next logical step in monitoring
everything that we do on our computers. How possible or
probable this is? Woud this compromise the Tor Browser?
Would such a system be able to spy on our encryption
codes?                                                          in the short-term interests of its shareholders than
John Bourne                                                     the government of the day though; if it were to
                                                                come out that, say, HP were installing government
Andrew says: I’d be very surprised if Chinese-made              spyware on its models, it would expose itself to a
models were completely government spyware-free.                 ton of legal action and would lose a ton of money.
Any western company would be more interested                    That’s more important than anything else.


PENDANTS CORNER
I am a subscriber and regular reader of Linux Voice since       Linux in a smarter manner.” She then asked whether it was
its beginning. I have been working with computers since         an American magazine, as perhaps it was just an
January 1968. My wife, a retired primary school                 Americanism. Anyway, thank you for the contents, I have
headmistress, uses a Lenovo laptop bought through               hidden the cover so I am allowed to read quietly with my
Amazon which came delivered with Linux installed and            glass of wine…
with the username defined. Just the password needed to          Peter Maunder
be changed. Since then we have upgraded her to Linux
Mint Mate 17.                                                   Andrew says: I’ve met a few Americans and they
   On glancing at the cover of the January 2016 Linux           were jolly good chaps and chapesses. Their cars
Voice my wife was moved to ask “What is Linux Smarter           are rubbish, but the way they’re adapting the
and do we use it on our machines?” I explained that it was      language of their colonial overlords is pretty good,
not a software product but that the author meant “Use           in my opinion. Apart from obligate; that’s a horrid,
Linux more smartly”, “improve your use of Linux” or “use        horrid word.




                                                               www.linuxvoice.com                                                         11
     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 many 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.

12                                                         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                                        13
     SHOW REPORT OGGCAMP 2015




          Graham Morrison enjoys another great year at the UK’s best open
          source gathering [objectivity disclaimer: we sponsored the event].


         E
                  ven if you’re not in the UK, where OggCamp          Tolkien’s Oxford last year. The University buildings
                  has been held since 2009, we know you’ll be         are well suited to an event like this because there
                  familiar with the atmosphere that pervades          are lots of different spaces of different sizes. There
         this whole weekend – it’s like returning to your home        was an area for hacking hardware, for example, and
         town and meeting up with old school friends, many            another for attempting a Nerf Gun Challenge, an event
         years after heading off to seek your own fortune. For        successfully hacked by several children in attendance.
         us, it also turned into a bit of a road trip, as we headed   It also meant that there were plenty of rooms with
         north to Liverpool from our bolt holes in the South          varying capacity. This was important because
         West of England. We got there eventually, and were           OggCamp is an ‘unconference’: that means there’s
         incredibly grateful to our Airbnb host for driving us        no fixed schedule, and attendees propose their own
         over to the Friday night drinks venue, even if that did      talks on the day, with rooms assigned according to an
         mean a four-mile walk back in the pouring rain at three      event’s popularity. Previous years have used an online
         in the morning.                                              system to manage this live scheduling, but the last
            The venue for this year’s event was the John              few have see this break down to the point that this
         Lennon Art & Design Building at John Moores                  year we were using a whiteboard and Post-it notes.
         University, literally in the shadow of Liverpool’s              The talks themselves were generally excellent. The
         modern Metropolitan Cathedral. This is where the             weekend kicked off with Gurbir Singh talking about
         event was held in 2013, before a brief sojourn to            the new space race to Mars. If we’re being completely




14                                                       www.linuxvoice.com
                                                                                             OGGCAMP 2015 SHOW REPORT




Held over Halloween weekend,
there was plenty for attendees of
all ages to do, including a Nerf Gun
challenge that was successfully
hacked by the children playing it.




honest, it failed slightly to deliver on its potential. The   discussion about privacy, and a live recording of
                                                                                                                          There was cake, tea
audience was keen, and it was obvious that Gurbir             episode 19 of our own podcast, complete with the
                                                                                                                          and coffee, plus two
is incredibly knowledgeable and enthusiastic about            bells of the Metropolitan Cathedral.                        excellent evening events.
his subject, but we wanted to hear more than he was               Our own long-time contributor, Les Pounder, made        We also recorded our
given time to deliver.                                        OggCamp 2015 his last as ‘The Chief’ – controller of        own podcast live, which
                                                              event logistics. After years at the helm, he announced      you can listen to here:
Talk talk                                                     he was bowing out during the final session and prize        www.linuxvoice.com/
Canonical’s Alan Pope, for example, gave a great              draw. The audience gave a heartfelt thank you for           podcast-season-3-
presentation describing how the Ubuntu Phone                  all his hard work, and we could see the edges of his        episode-19.
app store was ‘Pwned’ by a malicious app that got             resolve soften in the glow of such appreciation. Event
more access than was safe. Stuart Langridge, of the           organiser, founder and Linux Outlaw, Dan Lynch, also
excellent Bad Voltage podcast, talked about putting           received a huge applause for his incredible efforts
your podcasts on YouTube, which we’ve been doing              putting everything together, made no easier by recent
since his presentation, and Jon ‘The Nice Guy’ Spriggs        ill health. Thanks Dan, and get well soon!
gave an excellent talk about Sandstorm – easy web                 None of this would have been possible without the
containers for self hosting, which we’ll hopefully be         sponsors, of course, and laptop, PC and server
writing about for a future issue of Linux Voice. All          crafters, EntroWare, deserve a huge amount of credit
three of those presentations are available on YouTube,        for being this year’s Platinum Sponsor. These lads
although the audio quality is poor. We also want to           from Liverpool have built a great company behind
desperately experiment with an RF interface and our           their Linux-running hardware, and it was lovely to
central heating system, after a talk by Tim Gibbon            meet them, share a few pints and play with their
that hacked the frequencies used by many of the               Steam Machine. Both Ubuntu/Canonical and Fedora
controllers used in UK.                                       also helped sponsor the event, with stands full of
   As tradition dictates, there was a great podcasters’       stickers and hardware in the exhibition space.
panel (featuring our Ben!), with a long                             We got to see Ubutu phones running the mythical
                                                                  convergence mode, switching between a touch and
                                                                  windowed environment while connected to a
                                                                  screen, and Jon Archer on the Fedora stand was
                                                                   also giving away DVDs and running the latest
                                                                   Fedora on a laptop – still the best way to help
                                                                   people get over any initial Linux anxiety.
                                                                      This year’s event was a huge success, and we
                                                                    wouldn’t have expected anything less. We know it
                                                                    takes a huge amount of effort from a huge
                                                                    number of volunteers, and we’re incredibly
                                                                     grateful to them all for giving up their time and
                                                                     putting so much into each day. With a bit of luck,
                                                                     after the hangovers become a distant memory,
                                                                     they’ll reconvene and start planning OggCamp
                                                                      2016. Fingers crossed. No Pressure.



                                                                www.linuxvoice.com                                                             15
     FEATURE OPEN SOURCE SMART HOME




OPEN SOURCE
SMART HOME
Give your home a brain with the Internet of Things.



T
         he idea of a computer-controlled
         home has been in science fiction
         almost as long as there has been
science fiction, and with the advent of
cheap, small, low-power modules and
ubiquitous Wi-Fi smarthomes have finally
become a realistic option.
   Now that you can get an entire
computer capable of running Linux for
under £30, it’s time to start putting them
around the house. These devices can
monitor anything from your heating to
your burglar alarm, and control every
aspect of your environment until you’re
living in computer-maintained luxury.
   Want to be able to turn your heating on
before you get home? No problem. Want
to get an email when your burglar alarm
goes off? Easy. Want a robotic arm to
hand you an umbrella when you open the
door and there’s rain forecast? That’ll take
a little more work, but it is possible.

Your freedom matters!
The same principles that make open
source essential to having control of your
computer mean that open source is also
vital when it comes to having control of
your home: the more power your devices
have, the more control we as users and
developers should have to make sure
we can run them as we want to. What’s
more, your smart home will monitor
details about your life that you may want      The more power your devices have, the more
to keep off the internet. Fortunately,
there are plenty of tools that we can use      control we as users should have to make sure
to build a powerful home setup without
compromising our software freedom.
                                               we can run them as we want to



16                                                 www.linuxvoice.com
                                                                            OPEN SOURCE SMART HOME FEATURE




BUILDING THE BRAIN
Create the hub that will control your house.
 Our smart home will be built around a hub to
 manage the data and control the peripheral devices.
 This hub will provide a simple user interface to
 visualise the data and enable us to control our
 home. It’s perfectly possible to build this hub from
 scratch using any programming language of your
 choice – however, there’s no need to go to these
 lengths, as there’s an open source framework for
 smart homes already available: OpenHAB.
    OpenHAB is written in Java so it’s platform-
 independent. You can use it on just about any
 device that’s capable of running Linux (or Mac OS
 X or Windows if you prefer). We used a Raspberry
 Pi, but any small low-power machine will work well
 whether it’s ARM- or x86-based. Since we’re using a
 Raspberry Pi, our instructions are for Debian-based
 systems, but it will be easy to convert them to other
 Linuxes. The only extra your device will need is a
 way of connecting to the network, which could be
 either a Wi-Fi dongle or an Ethernet cable.
    The first task, as always, is to get an up-to-date                                                           The OpenHAB web
 version of Linux running on your hardware by                OpenHAB needs some quite detailed setup before      interface is simple, yet you
 following the manufacturer’s instructions. Once it’s    it becomes useful. This means it’s quite slow to get    can still control just about
 installed, configure your network connection and        it running for the first time, but once this is done,   anything with a few clicks.
 you’re ready to start. It will be easier to manage      you’ll have exactly the system you want.
 if you assign your hub a static IP on your router.
 Check your router’s documentation for details of        Personalisation
 how to do this.                                         Configuration is mostly centred around items
    If you’re using Raspbian, you should already have    and sitemaps. As you can probably guess from
 Java installed, but it’s best to check, like so:        the names, items are individual things that are
 $ java -version                                         either data coming in, or services that OpenHAB
 java version “1.8.0_66”                                 can trigger. Sitemaps describe the layout of these
 Java(TM) SE Runtime Environment (build 1.8.0_66-        items on the final user interface (which can either
 b17)                                                    be presented through a website or an app for
 Since stability is important on software that           mobile phones). The exact configuration of items
 controls your house, we’re inclined to stick with       and sitemaps will depend on the hardware you
 the officially supported Oracle Java rather than        have running in your smart home, but first let’s
 OpenJDK.                                                look at a simple setup that doesn’t depend on
    Download the OpenHAB Runtime Core and                any external hardware: a weather forecast. This
 Addons packages from http://www.openhab.org/            can be important to your final setup because you
 getting-started/downloads.html. These come as           may choose to run your home slightly differently
 Zip packages, but lots of the files are in the root     depending on the conditions outside. This could be
 of the Zip, so it’s best to put them in their own       anything from turning on a sign reminding you to
 directories before unzipping them:                      take an umbrella if there’s rain expected to fine-
 mkdir openhab                                           tuning your heating setup.
 cp <runtime-core> openhab/                                 The weather forecast comes from an OpenHAB
 cd openhab/                                             addon, so you need to extract the addons Zip
 unzip <runtime-core>                                    file downloaded earlier. We’ll need a few different




                                                           www.linuxvoice.com                                                             17
     FEATURE OPEN SOURCE SMART HOME




 Competing                      addons in this article so you may as well copy them        you can request weather data by the forecast
 standards                      all over to the addons directory inside OpenHAB            provider). We defined a location called briz that gets
 There are a few different      now. You’ll need: org.openhab.binding.mqtt-                the data for Bristol, UK, from Weather Underground
 protocols used in              1.7.1.jar, org.openhab.binding.weather-1.7.1.jar           every ten minutes:
 commercial products.
                                and org.openhab.persistence.mysql-1.7.1.jar.               # location configuration, you can specify multiple ...
 Here are a few of the most
 popular:                          This OpenHAB addon connects to online                   weather:location.briz.latitude=51.454514
   Lightwave Accessible to      weather forecasts and downloads the appropriate            weather:location.briz.longitude=-2.587910
   OpenHAB through a            information for your location. All the configuration       weather:location.briz.provider=Wunderground
   Lightwave Wi-Fi Link.        of OpenHAB is done in the configuration folder. In         weather:location.briz.language=en
   Z-Wave You can plug a
                                there, you’ll find the openhab.cfg file that holds all     weather:location.briz.updateInterval=10
   controller into your
   OpenHAB hub and use          the application options. If you open this in a text           You can change the name briz to be anything you
   the Open Z-wave Control      editor and search for ‘weather’ (it’s quite a big file),   like, provided you change it everywhere. The only
   Panel to set up your         you should find the appropriate section:                   other thing you should have to alter is the latitude
   network.                     ############## Weather Binding #############               and longitude for your location. The updateInterval
   Nest The cloud service
                                # The apikey for the different weather providers,          setting is the number of minutes between each
   has an API that
   OpenHAB can use.             ...                                                        time OpenHAB will request additional information
   Thread Not yet               #weather:apikey.Wunderground=                              from the provider, so you need to make sure that
   compatible with                 You can choose to get your weather forecasts            this is within your API limits.
   OpenHAB.                     from any one of five different providers.                     This sets up the weather provider, but it doesn’t
                                Unfortunately OpenWeatherMap didn’t work for us            create items that we can use. These have to be
                                (the problem may be resolved by now), so we opted          created manually in an items file. You can have as
                                for Weather Underground. The process is exactly            many items files as you like. The only requirements
                                the same for each provider and it’s trivial to switch      are that they end with .items and that they live in
                                between them after you’re set up.                          the configurations/items folder. We decided to
                                   Before providing forecasts, each of the data            create a new one for each different set of items we
                                sources requires you to sign up for an API key.            created, so the first one we called weather.items.
                                This is different for each provider, so head to their         Items files contain a series of item definitions,
                                website and follow their instructions.                     one per line. They’re in the format:
                                   Any line in the OpenHAB configuration file with         <item type> <item name> <label> <binding options>
The OpenHAB
                                a hash is ignored (commented out). You should              To test everything out, create items for the current
configuration can be a
little confusing, but there’s   see that all of the weather configurations are             temperature and humidity. These will both be
a demo house at http://         commented out by default, and you need to delete           of the item type number. The label is the text
demo.openhab.org:8080/          this hash in order to enable them. First, add your         that’s displayed alongside these items in the user
openhab.app that you can        API key and uncomment the appropriate line; then           interface, and it should include a place to put the
use to copy syntax (the         you can move on to the location configurations.            actual data. The binding options are specific to
configuration is available         You can define as many locations as you like            the weather binding and include the name of the
in the main downloads           (though you may be limited to the number of times          binding and the data we want to pass back. The
page).
                                                                                           weather items are:
                                                                                           Number briztemp “Temperature [%.2f °C]”
                                                                                           {weather=”locationId=briz, type=temperature,
                                                                                           property=current”}
                                                                                           Number brizhumid       “Humidity [%d %%]”
                                                                                           {weather=”locationId=briz, type=atmosphere,
                                                                                           property=humidity”}
                                                                                              The percent character is special in the label text.
                                                                                           %0.2f tells OpenHAB to output the data with a
                                                                                           decimal point in this location; %d tells OpenHAB to
                                                                                           use a whole number, and %% tells OpenHAB that
                                                                                           you want a percent sign in the final output. The
                                                                                           square brackets tell OpenHAB which part of the label
                                                                                           is the actual data.
                                                                                              Now we have some items, we can start to build
                                                                                           our interface to display everything. You define the
                                                                                           user interface in one or more sitemaps, which live
                                                                                           in the configurations/sitmaps directory and end
                                                                                           with the .sitemap suffix. You can create as many of




18                                                             www.linuxvoice.com
                                                                             OPEN SOURCE SMART HOME FEATURE




these as you like, but the one that OpenHAB will look
at first is default.sitemap.
   Sitemaps are hierarchical, with different sections
enclosed in parentheses. The highest level always
defines the sitemap itself and gives it a label.
Inside this you can add items or frames that group
items together. A sitemap to describe the current
temperature in Bristol is:
sitemap default label=”Bens House”{
     Frame label=”Weather from Wunderground” {
          Text item=briztemp
          Text item=brizhumid
     }
}
                                                                                                                 Using the OpenHAB
The items we created to hold the temperature and        CREATE DATABASE openhab;                                 Android app, you can
humidity were numbers, but here we’re defining          CREATE USER ‘openhab’@’localhost’ IDENTIFIED BY          control your smarthome
them as text because that’s how they’ll appear on       ‘openhab’;                                               with voice commands
the screen. The item type and sitemap type aren’t       GRANT ALL PRIVILEGES ON openhab.* TO
directly related.                                       ‘openhab’@’localhost’;
   Now everything’s set up and ready to run.  There
                                          Using the OpenHAB
                                                        exit; Android app, you can
are two scripts to launch OpenHAB in the main              Open openhab.cfg,
                                          control your smarthome   with voice find the persistence line and
OpenHAB directory: start.sh and start_debug.
                                          commands      tell the system to use mysql:
sh. As you’ve probably guessed, the latter of           # The name of the default persistence service to use
these provides much more output about what’s            persistence:default=mysql
happening in order to help you solve any problems.         Then, further down the same file, you’ll find the
To start your OpenHAB server, open a terminal in the SQL setup. Enter:
place you unzipped OpenHAB and run:                     mysql:url=jdbc:mysql://127.0.0.1/openhab
./start_debug.sh                                         mysql:user=openhab
On a Raspberry Pi version 2 it can take a minute or      mysql:password=openhab
so to start. Once it has, you’ll see a line that ends:      In the configurations/persistence directory,
- Started Classic UI at /openhab.app                     create a file that details when you’d like OpenHAB
  Browse to http://localhost:8080 to see                 to store the data for each item. The following code
your sitemap in action. You can view this from           tells OpenHAB to store the value of each change for
other machines on the network by using the               every item:
IP address of the hub. On our network, this is           Strategies {
http://192.168.0.25:8080, but this will be different     default = everyChange
on yours. Use the static IP you set up, or enter ip      }
addr at the command line to find the IP address.         Items {
                                                         * : strategy = everyChange
Saving data                                              }
The setup we’ve just created will keep displaying        This should be called mysql.persist. Once these are
fresh weather data every ten minutes it, but it          in place, you can restart OpenHAB and it will pick up
doesn’t save anything except the most recent data.       the new changes.
In order to keep hold of historical data, you need to       Let’s do something with our stored data.
set up persistence. There are a few ways of doing        OpenHAB includes a chart server that we can use
this, but we prefer to use MySQL. Obviously the first    to embed images in the site (there’s also the chart
step here is to install the mysql software:              type in the sitemap, but this doesn’t work as well).
sudo apt-get install mysql-server mysql-client           Frame label=”Weather Chart” {
  During the installation, you’ll be asked to set up a             Image url=”http://192.168.0.25:8080/
root password for the database. Remember this, as        chart?items=briztemp&period=D”
you’ll need it to set up the database for OpenHAB.       }
Once the software is installed, you can log in to the      You can add more than one item and plot them
database from a terminal with:                           against each other, as we’ll see later. The period
mysql -u root -p                                         specifies the length of time that the chart should go
  Then you’ll be prompted for the password you just      back, and can be any one of h,4h,8h,12h,D,3D,W,2
created. To set up the OpenHAB database, enter:          W,M,2M,4M,Y.




                                                             www.linuxvoice.com                                                           19
      FEATURE OPEN SOURCE SMART HOME




ATTACHING DEVICES
Sensing and controlling the world.

                                 To ground pin
                                                                                            Once everything’s attached, it’s time to set up
                                                                                         the software side of things. Fortunately, there’s a
                                                                                         Python library for getting the information out, so it’s
                                                                                         all quite straightforward. First, you need to get the
     To 3.3V Pin                                                                         dependencies:
                                                                                         sudo apt-get install build-essential python-dev
                                                                                         python-openssl
                                                                                           Then you need to grab the library from GitHub
                                                                                         and install it:
                                                                                         git clone https://github.com/adafruit/Adafruit_
                                                                                         Python_DHT.git
                                                                                         cd Adafruit_Python_DHT
                                                                                         sudo python setup.py install
                                                                                           This Python library (Adafruit_DHT) provides
     To input pin (eg 18)                                                                a simple read function that returns both the
                                                                                         temperature and humidity. All we need is a simple
                                                                                         wrapper to output either the temperature or
                                                                                         humidity. The Python code for this is:
                                                                                         import Adafruit_DHT
                                                                                         import sys
                                                                                         pin = 18
                                                                                         humidity, temperature = Adafruit_DHT.read_
The wiring for our
temperature and humidity        Now that you’ve got your hub up and running, it’s        retry(Adafruit_DHT.AM2302, pin)
sensor just requires a 4.7k     time to start using it to get information about your     if sys.argv[1] == “temp”:
pull up resistor on the data    home, and use this information to make your home                    print temperature
pin.                            a better place. You can buy ready-made devices           if sys.argv[1] == “humid”:
                                that will plug in and just work, but perhaps the most               print humidity
                                attractive thing about OpenHAB is that you can build        If you save this as temphumid.py, you can get
 Internet of Things:            your own devices to control your home in whatever        the temperature with python temphumid.py temp,
 fad or here to stay?           way you want. Let’s take a look at how this works        and the humidity with temphumid.py humid.
 When done well, the            with two addons: one that senses the environment            This gives us a way of getting the temperature
 Internet of Things (IoT)       and one that acts on it.                                 on this machine, but we need to send it back to the
 gives you more control
                                   Our sensor will be a simple heat and humidity         hub in order for it to be useful. The easiest way to
 over your devices than
 in the past. IoT devices       sensor, the AM2302 model, which can attach to            do this is through the MQTT messaging system.
 enable us to take              any programmable controller. We’ll use one of the        This is a really simple message-passing protocol
 computing outside the          older Raspberry Pi version 1 model B+s because           designed specifically for the Internet of Things. The
 virtual world and make         we’ve got a few spare lying around. The first task is    most popular Linux implementation is Mosquitto
 it interact with the real
                                to install the latest version of Raspbian and connect    [sic] which comes in two parts: a client and a
 world, whether that’s
 controlling your home,         to the network. Once you’ve got that, you’ll need        server. In Debian-based systems, these are in the
 your vehicle, or anything      to attach the sensor. The wiring for this is all quite   packages mosquitto-clients and mosquitto-server
 else. We’re already starting   straightforward (see the diagram above) If you hold      respectively. All the machines we’ll use MQTT on
 to see the benefits: cars      the Raspberry Pi with the SD card at the top and the     will need mosquitto-clients, while only the hub will
 automatically re-route
                                GPIO pins on the right, the 3.3V pin is the top-left,    need mosquitto server.
 based on traffic with
 connected navigation           the ground pin is the third pin down on the right, and      The mosquitto-clients package contains two
 devices, and smarthomes        pin 18 is the sixth pin down on the right. You’ll just   tools we’ll need: mosquitto_sub, which enables us
 adjust heating setups          need a 4.7k resistor, and a way of wiring everything     to receive messages; and mosquitto_pub, which
 based on actual usage          together (we used a breadboard and male–female           enables us to send messages. The general setup
 patterns of rooms. The
                                headers).                                                of MQTT is that a server maintains topics to which
 future is connected!




20                                                           www.linuxvoice.com
                                                                                 OPEN SOURCE SMART HOME FEATURE




clients can publish messages. Once a message is
published on a certain topic, it’s sent to every client
subscribed to that topic. In this way, it’s a little like a
really simplified version of IRC. Topics don’t have to
be predefined, so clients can subscribe or publish to
any topic without any setup needed on the server.
   We can use crontab to automatically send the
temperature and humidity data every minute. Use
the following command to edit the crontab file on
the Raspberry Pi with the sensor:
sudo crontab -e
   This will open a text editor with the configuration
file for cron. You need to add the following lines:
* * * * * mosquitto_pub -h 192.168.0.25 -t temp -m
`python /home/pi/temphumid.py temp`
* * * * * mosquitto_pub -h 192.168.0.25 -t humid -m
`python /home/pi/temphumid.py humid`
   The back ticks around the Python command tell
Bash to execute this first and put the output as an
argument to the mosquitto_pub command. On our
network, 192.168.0.25 is the IP address of our hub.
You’ll have to change this in order for it to work for
you. Exiting the text editor will automatically add
these changes to the cron schedule.
   If you followed this tutorial from the start, you’ll
                                                                                                                     We didn’t have a 4.7k
already have copied the MQTT addon for OpenHAB                   This new chart will plot the temperature inside
                                                                                                                     resistor to hand, so we
to the appropriate directory, so the only thing left          your house against the temperature outside.            used two 2.4k resistors in
is to edit the configuration. In the openhab.cfg file.           Heat and humidity are great places to start, but    series.
Find the MQTT Transport section and change the                there are loads of additional sensors you could add.
first configuration option to:                                  Passive Infra Red (PIR) to detect movement.
# URL to the MQTT broker, e.g. tcp://localhost:1883 or        These are cheap and easy to connect, as they
ssl://localhost:8883                                          simply turn a GPIO pin on or off.
mqtt:msgs.url=tcp://localhost:1883                              Bluetooth Want to check when you leave or
  Now, we just need to add the configuration to the           arrive? The chances are that your phone is
OpenHAB site. First, set up the following items in the        publicising this information. The Bluetooth bindings
weather.items file:                                           enable you to monitor your whereabouts.                The OpenHAB wiki has full
Number housetemp “Inside temperature [%.2f °C]” {mq             Door sensor Check the comings and goings with        details of all the bindings,
tt”<[msgs:temp:state:default]”}                               a simple magnetic switch attached to your door         so make sure you check
Number househumid “Inside humidity [%.2f %%]” {mqt            frame.                                                 out compatibility before
t”<[msgs:humid:state:default]”}                                                                                      buying any hardware.
   The data to the MQTT binding (in the parenthesis)
first tells OpenHAB that this is an inbound
connection (with the <). The second and third items
are the MQTT service (as defined in openhab.cfg),
and the channel. The third tells OpenHAB to use the
state of the channel, and the final one is the filter to
use (we’re not using a filter so it’s default). These
items can then be entered into the sitemap.
Frame label=”Conditions inside” {
           Text item=housetemp
           Text item=househumid
}
Frame label=”Weather Chart” {
           Image url=”http://192.168.0.25:8080/chart?ite
ms=housetemp,briztemp&period=D”
}




                                                                www.linuxvoice.com                                                            21
     FEATURE OPEN SOURCE SMART HOME




                                                                                       experimenting with programmable sockets, which
                                                                                       enable you to turn appliances on or off from within
                                                                                       OpenHAB. You can connect them to lamps, electric
                                                                                       heaters, coffee machines, dehumidifiers or anything
                                                                                       else that you can control by turning on or off at the
                                                                                       socket. As we’re using a Raspberry Pi, the obvious
                                                                                       option is the Pi-Mote from Energenie (https://
                                                                                       energenie4u.co.uk/catalogue/product/ENER002-
                                                                                       2PI), which enables us to turn sockets on or off with
                                                                                       a simple Python command. This device can also
                                                                                       work with devices other than the Raspberry Pi.
                                                                                          Again, we’ll use MQTT to pass messages between
                                                                                       OpenHAB and the process that’s controlling the
                                                                                       Pi-Mote. This means that it doesn’t matter which
                                                                                       machine runs the Pi-Mote: it could be the same
                                                                                       machine running OpenHAB, or it could be some
These Energenie sockets                                                                other machine. First, you need to grab the Python
are two of the many types      Moisture Ever forget to water your plants?              libraries:
of you can control from      Connect them to your OpenHAB hub and you can              sudo pip install paho-mqtt
OpenHAB.                     get an email (see below) whenever they run dry.           git clone https://github.com/MiniGirlGeek/energenie-
                               Smoke Alarm As well as the usual siren, you can         demo.git
                             get a notification of any problems at home.                  This will create a directory called energenie-
                               Camera Keep an eye on what’s going on in your           demo. The Python libraries aren’t actually installed
                             house when you’re not there.                              to the Python path, so you have to make sure
                               You don’t need all of these – just pick the ones        that energenie.py from inside this directory is in
                             that provide the data that will be useful in your         the same directory as your final Python program,
                             smart home set up.                                        otherwise it won’t be able to import the module
                                                                                       properly. The easiest option is just to put your code
                             Get active                                                in the energenie-demo folder.
                             So far, all OpenHAB has done is take in information          The code to turn a socket on or off on an MQTT
                             and display it on a screen. Visualising data does         command is:
                             have some uses, but it falls far short of the idea of a   import paho.mqtt.client as mqtt
The My.OpenHAB service       smart home. Really, we should be able to control          from energenie import switch_on, switch_off
enables you to access        some aspect of the house. For this, you’re obviously
your data via a Rest API
                             going to need some hardware that can do things in         def on_connect(client, userdata, flags, rc):
for integration with other
                             the real world. A great place to start is by              client.subscribe(“plugs”)
services.
                                                                                       def on_message(client, userdata, msg):
                                                                                       if str(msg.payload) == “11”:
                                                                                                  switch_on(1)
                                                                                       if str(msg.payload) == “10”:
                                                                                                  switch_off(1)


                                                                                       client = mqtt.Client()
                                                                                       client.on_connect = on_connect
                                                                                       client.on_message = on_message
                                                                                       client.connect(“localhost”, 1883, 60)
                                                                                       client.loop_forever()
                                                                                          This simply listens on the channel plugs for the
                                                                                       message 11 (to turn on) or 10 (to turn off). We
                                                                                       chose these because you can add additional plugs
                                                                                       linked to the messages 21 and 20, 31 and 30, etc.
                                                                                       You’ll need to start this running before moving on to
                                                                                       the OpenHAB setup.
                                                                                          Now we have these, we need to create the
                                                                                       items and add them to the sitemap. The items use
                                                                                       the MQTT bindings in a fairly similar way to the




22                                                         www.linuxvoice.com
                                                                             OPEN SOURCE SMART HOME FEATURE




temperature and humidity sensor. The item line is:
Switch plug1 {mqtt=”>[msgs:plugs:command:ON:11],>[
msgs:plugs:command:OFF:10]”}
   Here you’ll notice that the command starts with
a ‘greater than’ sign, which means outputs. The
first two arguments are the mqtt service and the
channel. The third tells OpenHAB that it should
operate on a command rather than a state; the
fourth is which command to operate on; and the
final one is what to send when that command is
issued. There are two sets of arguments because
there are two possible commands.
   Item is then placed in the sitemap with the
following:
Frame label=”Sockets” {
          Switch item=plug1
}                                                                                                                 If This Then That
   If you want to add more sockets (a Pi-Mote can                            sendCommand(plug1, ON)               (https://ifttt.com) contains
handle up to four), you just need to add additional                }                                              lots of premade rules that
commands to the Python file, and associated items                  if(housetemp.state > 22) {                     you can take inspiration
and sitemap entries.                                                         sendCommand(plug1, OFF)
                                                                                                                  from, many of which work
                                                                                                                  with OpenHAB.
   Switching a socket on or off is one of the simplest             }
things that a smart home can do, but there’s far
more if you want to get the hardware:                    Open access
  Radiator and heating control This is one of the        The OpenHAB setup we’ve created here provides
biggest advantages of smart homes, and there are         you insight and control over your home, but only
several options that will enable you to completely       while you’re connected to your local LAN. If you
program your heating setup.                              want to access it from outside your home you’ll
  Light switches Commercially available light            need to setup external access. There are a couple of
switches can be used both via OpenHAB and as             ways to do this. There’s a service called My
regular switches.                                        OpenHAB at my.openhab.org that connects your
  Light bulbs Control the colour and brightness of       home setup with a web server that both stores your        My OpenHAB and
your lights from your computer.                          data and enables you to use it in external services,      If This Then That
                                                         and provides you access to your OpenHAB interface         OpenHAB rules are really
Obey!                                                    from where ever you are on the internet.                  powerful and can interact
Adding devices that can interact with the real world        One of the reasons we gave for using OpenHAB at        with lots of external
                                                                                                                   services including email
makes our OpenHAB setup useful, but it doesn’t           the start was because we didn’t want to hand all our      and Twitter (provided
make it smart. For that, we need to add some basic       data over to a cloud provider, yet My OpenHAB goes        you have everything set
intelligence. This is done with rules that go in the     against this. If you want to keep complete control        up in openhab.cfg). An
configurations/rules folder and have the .rules          over your data, the alternative option is to configure    alternative option is linking
extension. The format is:                                your internet router to forward all connections on        a My OpenHAB account to
                                                                                                                   If This Then That (IFTTT).
rule “rule name”                                         port 8080 to port 8080 on your OpenHAB server.            IFTTT is an internet
when                                                     You’ll then need to sign up to a dynamic DNS              service for making actions
          <condition>                                    service that will link your home IP address with          based on inputs. It’s far
then                                                     a domain name and allow you to access it when             simpler that the OpenHAB
          <action>                                       you’re on the go even if your ISP changes your IP         rules, but it’s also easier to
                                                                                                                   use and can interact with
  The code for condition and action are written in       address.                                                  more external services.
a specialised version of Java. Here’s a simple rule         Each home is different, so there’s no right way to         Using IFTTT, you can set
to turn on a socket when the temperature gets cold,      set up a smart home. The best aspect of OpenHAB           rules based on anything
and turn it off again if it gets hot:                    is that it doesn’t try to dictate a way you should        from events from Google
rule “temp control”                                      work – instead it gives you the tools to work with        Calendar or Facebook to
                                                                                                                   new items on shopping
                                                         whatever hardware you want to get in whichever            sites such as Ebay to
when                                                     way you want to work. This does mean that it’s            location data from Android
          Item housetemp changed                         more work to set up than almost any commercial            devices. The range of
then                                                     offering, but at the same time, it makes it far more      possibilities is really
          if(housetemp.state < 19) {                     valuable once it is set up.                               staggering. Sign up at
                                                                                                                   http://ifttt.com.




                                                           www.linuxvoice.com                                                                  23
     SHOW REPORT SUSECON 2015




                 Mike Saunders checks out the new OpenSUSE release,                                                     2015
           big-iron hardware from IBM, and toy penguins from… Microsoft?!


         I
              f you’re on the hunt for a Linux-related job, SUSE     virtual machines simultaneously (and thousands of
              may be worth checking out. At the recent               containers inside each one) without breaking a sweat.
              SUSECon 2015 conference, President and General         The company has uploaded a video demonstrating a
         Manager Nils Brauckmann was chuffed to announce             LinuxONE handling vast workloads at https://www.
         that 20% of the company’s current employees were            youtube.com/watch?v=VWBNoIwGEjo.
         taken on in the last year. And at the time of writing, 67      Mainframes have historically been enormously
         positions were open, so visit www.suse.com/                 expensive beasts, but with the LinuxONE IBM is trying
         company/careers to see what’s on offer.                     to attract users on tighter budgets as well. So there’s a
            But what about the conference itself? Linux Voice        cut-down model called the Rockhopper, which sports
         was there of course – and thanks to the competition
         we ran back in issue 20, three of our readers got to
         attend for free as well. Held in the Beurs van Berlage, a
         former commodities exchange in central Amsterdam,
         SUSECon 2015 was the biggest event yet in SUSE’s
         history with around 1,000 attendees. And, of course,
         many engineers, testers and product managers from
         SUSE were present. Much of the event was geared
         towards SUSE partners and users in large enterprises,
         but there was plenty for us hobbyists and general
         Linux geeks to explore as well.
            IBM, for instance, showed us that the mainframe
         is far from dead with its LinuxONE range of
         machines. These mighty boxes – based on the z13
         mainframes – are designed to handle jobs involving
         huge numbers of transactions per second (such as            Linux Voice travel protip: Gandhi’s
         share trading). IBM claims the LinuxONE Emperor             restaurant in the centre of Amsterdam
         machine, the most powerful on offer, can run 8,000          does awesome Indian food.


24                                                      www.linuxvoice.com
                                                                                          SUSECON 2015 SHOW REPORT
IBM’s LinuxONE mainframes
can chew huge amounts of
data in a single box – here’s
one in a “naked” form.




                                                          a Faraday cage to protect us from its mind-altering          Microsoft
                                                          waves. Pro-open source moves from Microsoft are              has come a long
                                                          welcome, but it’s healthy to stay cynical…                   way since the days
                                                                                                                       of calling Linux a
                                                          One giant leap                                               “cancer”
                                                          The biggest news for us, though, was the release of
                                                          OpenSUSE 42.1 “Leap”. Given that the previous
an “elastic pricing” model – ie you install the machine   release of the distro was 13.2, you might be
on site in your company, and then only pay for the        wondering about the significance of this big version
computing resources you use.                              number bump. Well, Richard Brown of SUSE told us
  Breakout sessions at the event were used to show        that the ideas behind this release started off under the
what’s new in upcoming SUSE Linux Enterprise              internal SUSE codename of “Project 42” – and that
service packs, and demonstrate various hot                number has stuck ever since. But what makes it so
technologies like Docker in action. On the show floor,    different to the previous versions?
SUSE partners and other Linux-related businesses             Well, this is the first OpenSUSE to be based on
were touting their wares – and one company caught         the SUSE Linux Enterprise sources. SUSE wants to
us by surprise. A certain company that once called        consolidate the efforts across its two distros – but not
Linux a “cancer”. Yes, Microsoft was there, even giving   to end up with two functionally identical products like
away plushy penguin toys to promote the company’s         Red Hat has with RHEL and CentOS. No, Brown and
open source efforts. We posted a photo on Twitter         his team wanted to do “something more interesting”
and our followers were quick to respond, warning us       with the opening of the SUSE Enterprises sources.
that it could be a Trojan horse, or we should put it in   So OpenSUSE 42.1 “Leap” takes the base packages
                                                          from the enterprise release – the kernel, libraries and
Technology showcases provided                             similar low-level plumbing – and the community can
glimpses of apps and hardware
                                                          add newer packages where appropriate for home
being built around SUSE’s distros.
                                                            users, small businesses and desktops (eg newer
                                                            versions of Firefox or LibreOffice).
                                                                So the end result is a community-supported
                                                             distro with a reliable base, but moving at a slightly
                                                             faster pace than the more conservative enterprise
                                                              options. OpenSUSE Tumbleweed – the rolling
                                                              release distro – will continue, and Richard Brown
                                                              even claimed that rolling releases are the future of
                                                               all distros, including enterprise-oriented ones. This
                                                               might seem crazy when big businesses rely on
                                                               stability above all else, but Brown is confident that
                                                                with automated testing (like SUSE’s OpenQA),
                                                                and atomic updates (making it easy to roll back
                                                                a package if something breaks), a rolling release
                                                                geared towards enterprise users may be possible
                                                                 one day down the line. Watch this space!



                                                            www.linuxvoice.com                                                              25
     SECRETS THE TOR BROWSER




SECRETS OF THE
TOR BROWSER
The ultimate tool for self-defence when browsing the web.


Y
         ou are being watched. Every click, keystroke and command         launch a protected web session. The software will automatically
         you enter into your web browser is recorded by advertisers       connect to the Tor network, which uses three encrypted network
         and governments. In order to have any hope of online             hops to separate your browsing activity from any identifying
privacy, you need to change the way you go online. Only by hiding         information. Since the people most in need of protection online
your IP address and location can you stop this routine invasion of        aren’t necessarily tech-savvy, the Tor Browser is designed to be easy
your personal data.                                                       to use, and it succeeds wonderfully at this. There are, however, a few
  The Tor Browser is a simple defence tool. You just need to              additional features available to help you customise your browsing
download and extract the software, then run start-tor-browser to          experience if you peer beneath the slick exterior.




01                                                                  02




             01                                            02                                           03
                          Connect directly                                Stealth connect                            Privacy slider
                          In normal usage, you just                       If your ISP or government                  There are some settings
                          need to start the Tor Browser                   blocks direct access to the                that can increase your
              and the software will automatically          Tor network, you can get in via a bridge.    privacy, but make some websites hard
              connect to the Tor network before            The recommended option is obfs3,             to use – for example, limiting the use of
              opening the browser window.                  which scrambles the communication in         font features such as different sizes
                 The first page you’ll see will be a Tor   an attempt to disguise the type of           and typefaces. You can choose your
              test page that checks that everything        traffic as it connects to a private entry    own balance between browser
              has worked (if the page turns red,           point into the Tor network. Other            usefulness and privacy with Tor privacy
              something’s gone wrong, and you’re not       options include Flash proxy, which uses      settings, which enable you to make the
              browsing anonymously). Once this is          browser-based bridges, and Meek,             right choice between privacy and
              done, you’ll be able to browse the web       which hides the Tor data in connections      convenience. The defaults will be
              in anonymity.                                to popular internet services.                sufficient for most people, but if you’re
                                                                                                        facing a serious, persistent attack then

     The HTTPS Everywhere plugin forces your                                                            you may need to move the slider up to
                                                                                                        keep your connection private.
     browser to use the encrypted version of a

                                                                                                        04
                                                                                                                    HTTPS Everywhere
     website (via HTTPS) whenever there’s one                                                                       The HTTPS Everywhere

     available, rather than the unencrypted version                                                                 plugin created by the
                                                                                                        Electronic Frontier Foundation forces



26                                                           www.linuxvoice.com
                                                                                             THE TOR BROWSER SECRETS




03                                                                                      04




05                                                                                              06


                                                                                                07


                                                                                                08


your browser to use the encrypted          You can change the settings, but be          compromise your anonymity (such as
version of a website (via HTTPS) rather    careful as this can lead to leaking data.    downloading a file that could contain
than the unencrypted version (via                                                       links to external resources or malicious



                                           06
HTTP) whenever both are available.                       New identity                   code). It’s then up to you whether or not
This is important because even though                    When connecting to the         you heed these warnings – clever as it
Tor anonymises web browsing, it can’t                    web via Tor, your traffic is   is, software can’t do everything for you!
encrypt the final transmission from the    routed through an exit node. This can



                                                                                        08
Tor network to the web server. Using       be used to track you across a site (the                   Update check
HTTPS means your browsing data is          site can’t tell who you are, but they can                 It’s important to keep all
never sent unencrypted.                    see that a browser has been through                       your software up to date,
                                           the pages you’ve been through). The Tor      but with security-critical software it’s



05
             NoScript                      Browser gives you the ability to change      especially important, and the Tor
             Although most scripts that    to a new exit node, thereby getting a        Browser is one such program. It’s also
             run on websites are           new identity and breaking the tracking       especially prone to slipping out of date
perfectly harmless, there are a few that   that the site is using.                      because it’s usually installed outside
can be used to track you or attack your                                                 your distro’s package manager. The



                                           07
browser. To help defend against this                  Warnings                          update checker is a really simple tool
threat, the Tor Browser Bundle comes                  Tor can’t protect everything      for making sure that you’re always
with NoScript, a plugin that enables you              you do online, so it comes        protected by the latest security
to control what scripts run on your        with warnings for when you try to            updates, so it’s a good idea to run it
machine and which websites run them.       perform an action that could                 every time you start the browser.



                                                            www.linuxvoice.com                                                      27
      FEATURE INSIDE CoreOS




                                    Inside

             Dive with us into the world of complicated cluster computing
            with Graham Morrison and Brandon Philips, co-founder of one of
                        the hottest Linux startups in the galaxy.



                   T
                           here are many outcomes that Linus Torvalds         up on the opportunity to ask about Linux, hype and
                           could never have envisaged when he                 containers.
                           embarked upon his quest to create the Linux           “My co-founder, Alex Polvi, and I had been in
                   kernel. One is that it would lead to the creation of an    infrastructure software for a while,” Brandon started
                   operating system that now dominates the computing          out by telling us, and it was clear from the beginning
                   hemisphere. Another would be that by choosing to           that Alex and Brandon had no intention that their new
                   license the kernel under the terms of GPLv2 he would       distribution would be encumbered with the same
                   change an industry’s attitude towards open source          problems that held other distributions back, especially
                   and Free Software. But for us, two of the most             when it came to the dynamism and portability
                   unpredictable outcomes are how Linux has become            demanded by new online businesses.
                   used at the small and large scale. At the small scale,        “I worked at SUSE Linux… on the Linux kernel and
                   Linux-based Android is the dominant platform, fuelling     putting together a distro and fell out of the world of
                   the smartphone revolution. Those smartphones have          enterprise distros. [Alex and I] had known each other
                   spawned a new era and expectation for connectivity         for around 12 years. I was looking for a change – and
                   and data-driven intelligence. This has fuelled the other   he was kind of just floating around, so we got together
                   outcome, Linux at a large scale, in the cloud.             and said, ‘How can we fundamentally fix and secure
                      CoreOS Linux is a minimal Linux distribution            how this back-end infrastructure stuff works.’ We
                   that predates and encompasses the recent and               tossed around ideas and CoreOS Linux was the thing
                   most definitive stages of the cloud revolution – the       we settled on.”
                   migration from discrete distribution installations to
                   what are now being called clusters of containers. It       Come in from the cold
                   even boasts kernel supremo, Greg Kroah-Hartman,            Cloud has been much derided over the last decade,
                   as one of its chief advisors, and another kernel ace,      most famously by Richard Stallman, who told
                   Matthew Garrett, is an engineer at CoreOS.                 the Guardian in 2008 that the term is “worse than
                      This makes CoreOS a wonderful project to study          stupidity: it’s a marketing hype campaign.”
                   if you want to understand how and why the cloud               This is true of 2008, but by the time the first lines
                   evolved from those old servers and infrastructure into     of CoreOS were being committed in March 2013, we
                   this buzzword-infested computing paradigm. Which is        think the term had started to have concrete meaning
                   why, when had the chance to spend some time with           of its own, describing a solution to a very specific
                   Brandon Philips – CTO and co-founder of CoreOS,            set of problems. Brandon describes these problems
                   and one of its original developers – we couldn’t pass      when he told us about how CoreOS got started.
                                                                                 “There’s a lot of different places we could have
     CoreOS is a minimal Linux distribution                                   attacked, but it goes all the way back to the distro,” he
                                                                              told us. “The way we’re putting distros together today
     that encompasses the recent and most                                     makes it very difficult to have automatic updates, like

     definitive stages of the cloud revolution                                we have on our phones – Android and iPhones, and it
                                                                              makes it very difficult because this API boundary is so



28                                                www.linuxvoice.com
                                                                                                      INSIDE CoreOS FEATURE

huge that the distro has to maintain. Your database
comes from your distro. Your language runtime
comes from your distro. Your kernel comes from
your distro. And it’s this huge sprawling collection of
APIs and it makes it impossible so say, ‘Right, we’re
going to move from version A to version B of our Linux
distro,’ and have confidence in that actually working.
Because suddenly you have a new database version,
you have a new language version, it’s like this huge
zero day switch. I saw it at SUSE. There were people
running versions of SUSE that were 12 years old,
because it’s critical infrastructure and because their
application is tightly bound with this huge API layer.
There was no way for them to move from A to B.”

Enterprise: warp speed
The idea of the ‘old enterprise’ came up several
times during our conversation. It was also at the
heart of a point made by Greg Kroah-Hartman in
his late-2014 ‘Ask Me Anything’ on Reddit when
asked specifically about CoreOS. “I’m really happy
with CoreOS, it’s the way I think ‘enterprise’ distros
should be developed and deployed,” he wrote,
before explaining, “ Lots of things have changed
over the years and trying to keep servers as ‘pets’
is not the way to do it. Large numbers of servers,
deploying services that you need to use/provide is
the way to go. Keeping those servers up to date is
hard, as is managing the tasks on those servers,
and CoreOS provides a way to help out with that.”
   What started to make the difference was
the change in how containers were used, from
virtual machines to what have become isolated
sandboxes. CoreOS, in particular, was one of
the first projects to use containers to address a
Linux-specific problem – transparent and secure
package management that could be easily copied
across a huge cluster of machines. Docker, the
hugely successful deployment engine that now
dominates the cloud, has since helped to solve this
problem, but as Brandon explained, this was a time
before Docker.
   “Containers are necessary for CoreOS Linux to
work and so we we’re serving that scene and we
were starting to build some stuff, an API-driven
container system [the prototype is still up on GitHub].
Around that time, about 2–3 months after we’d
got the distro and good firmware and were able to
generate builds and document it, Docker came out.
We’d known Soloman [Hykes, creator of Docker] and
the team, and it totally made sense to band on what
we were working on and join up.”
   Brandon was contributing to Docker, even joining
the project’s governance board, while at the same         “We’ve got a little over 20 engineers, and that continues to grow. We’ve got offices in San
time trying to figure out how to solve the combined       Francisco and New York, and we’re always looking to hire” Brandon Philips.
problem of package updates and security rollouts.
The answer was always going to be containers.             that, we’ll build this CoreOS Linux thing, but Linux
   “We were thinking through the problems and             containers have existed for eight years or more
possible solutions, and the obvious solution was for      and nobody was using them in the way we were
containers,” he said. “The big risk we thought was        thinking about. Instead of it being a lightweight virtual



                                                            www.linuxvoice.com                                                                    29
     FEATURE INSIDE CoreOS

                                                                                          Cloud initially seemed to be a re-branding of ideas
                                                                                          that have been around for decades, like server
                                                                                          storage, thin clients and distributed computing. But
                                                                                          the ideas behind cloud computing have started to
                                                                                          coalesce thanks to the huge data being generated
                                                                                          and demanded by the hundreds of internet enabled
                                                                                          devices that we come in contact with. Google,
                                                                                          Amazon, Facebook, Twitter and the thousands of
                                                                                          smaller companies whose businesses are thriving
                                                                                          online owe their dynamism to many instances of
                                                                                          Linux running in sympathy with one another. Cloud
                                                                                          now means being able to scale, only paying for
                                                                                          resources you use, and abstracting the applications
                                                                                          and services that run in the cloud out of the hardware.
                                                                                             After deciding on containers, the next challenge
                                                                                          for CoreOS was to create a centralised configuration
                                                                                          system. This is a much more complex problem than
                                                                                          it sounds, especially when dealing with clusters of
                                                                                          potentially hundreds of environments. There needs
                                                                                          to be persistent storage, even when ‘nodes’ in the
                                                                                          network go down, while also providing access to
                                                                                          things like service registration, service discovery and
                                                                                          process coordination across the cluster. CoreOS
                                                                                          came-up with ‘etcD’, a clever, open source persistent
                                                                                          data store that’s now a vital component in Google’s
The white paper on the
                             machine, we’re thinking of it as, ‘What a replacement        Kubernetes cluster manager.
Raft consensus algorithm
describes a method           for the package manager!’ It’s a different way of               “We built a lot of difficult technology with the
that enables a cluster of    packing the software. A different way of doing a distro.”    consistent key-value store called etcD – the
servers to make decisions                                                                 underpinnings of Kubernetes, which is essentially
based on single database     Generation next                                              containers. etcD is the way all the important
shared across the cluster.   This is where there’s a demarcation between what             information and the consistency of the clusters is
                             was the old cloud – the cloud Richard Stallman               maintained. This was necessary because we had this
                             was talking about – and what has become a new                vision of automatically updated Linux server hosts.
                             kind of super-networked pervasive infrastructure.            But we also didn’t want to tell the other infrastructure


                                                                                                                                  systemd
                                                                                                                              service files poll

                                  Local machine                                                                                    Services


                                     fleetctl                                                                                        fleetd
                                     etcdctl




                                                               Host #5                      Host #2                     Host #3

                                                   Docker                       Docker                      Docker
                                                containers                   containers                  containers




                                                             etcd Docker                  etcd Docker                 etcd Docker
CoreOS is a minimal Linux                                     CoreOS host                  CoreOS host                 CoreOS host
distribution designed to
be run in parallel with
each host running multiple
containers running their
own applications.                                                                            etcd


30                                                            www.linuxvoice.com
                                                                                                  INSIDE CoreOS FEATURE

people, ‘Yeah, we’re going to automatically update        that algorithm and you can see it used all over the
and you won’t have any control or idea of when that’s     place now, and our implementation is one of the best
going to happen.’ You need this distributed database      because we’ve been there from the beginning.”
so that a machine can acquire a lock and say ‘I’m            Kubernetes is an integral part of the Cloud Native
rebooting for an update’.”                                Computing Foundation, which was launched at the
   This is technical stuff – the traditional domain       same time by the Linux Foundation. CoreOS has
of computer science. Like the hive mind, the etcD         advocated for lots of design decisions as well as
database lives on multiple machines. We wanted to         adding authentication back-ends such as OAuth.
know how the system was maintained when it didn’t         Kubernetes is important because it represents the
exist on a single machine, when there’s no single         next generation of cloud infrastructure, the kind of
process running to make a single decision based on        infrastructure that Google has developed internally.
the data. Brandon explained that this decision-making        Finally, we wanted to know whether Brandon
was made by a ‘consensus algorithm’ implemented           thought CoreOS had found its fight and whether the
using something called the ‘Raft Protocol’.               journey had been worth it.
   “We got really lucky that there’s a PhD student from      “We started two and a half years ago with this
Stanford University called Diego Ongaro who had just      vision of how we’d like infrastructure to happen. Now
written a very well designed consensus algorithm          we have Google and we have all these people who
in a white paper called Raft. We were one of the          are agreeing and we’re bringing open source
first implementations of it,” Brandon told us, before     software behind that vision. So like Cloud Native
explaining how they implemented Raft at CoreOS.           Computing Foundation, it’s an amazing change
   “The lead engineer on etcD, Xiang Li, was a summer     from 2.5 years ago – here are some people
intern and we told him, ‘We need a consistent             hacking in some garage in Palo Alto, kind of
data store.’ and he went off and built it. He is now      being called crazy people, to now an entire
mentioned as one of the authors on the thesis of          industry groundswell of new technologies in
Raft. So we were very early in the formative time of      open source happening. It’s been fun.”




OPEN SOURCE OR FREE SOFTWARE
On the emerging fault line between permissive and copyleft licences.
       What’s your commitment to open           router or something, [the licence] is
       source?                                  reasonable, because if that provider ever
Brandon Philips: People are unwilling to        goes away I want to secure that thing, I
bet their infrastructure choices on software    want to have the device drivers necessary
that isn’t open source. And we’re willing to    to patch the kernel. In the case of a lot of
go in and fill in the white space when things   this server software, like etcD is under the
are missing. We built things like etcD, key     Apache licence, you’re not going to make
value store; we built things like Flannel,      modifications that are specific to a piece
which is a networking system, we’ve             of hardware and if you’re going to
contributed to other projects that we didn’t    contribute you’re going to contribute.
originate, like Kubernetes and Docker and
the Linux kernel and the Grub bootloader               Are permissive licences seen as
and Systemd.                                           the path of least resistance?
                                                BP: Yeah, and it doesn’t scare people so
      Would you recommend permissive            much either. I think a lot of credit needs
      licences to your customers?               to be given to the Free Software
BP: [TheGPL] scares people off and people       movement in general because in a lot of
who aren’t going to contribute are always       cases infrastructure people simply
going to find a work around, even of the GPL.   demand that they have access to the
They’ll find some way – they’ll just open       source code. It does go all the way back
source the patches and code-drop them on        through the history of UNIX – if you’re
some FTP site when they release the             running a big complicated system and
product and they’ll never get merged            something goes wrong you really
upstream, or something. And in the case of      appreciate the ability to look at the
the Linux kernel, it actually is a more         source to see what the computer was
reasonable licence, because, say I get a        told to do versus what the computer is
wizbang widget from Amazon – it’s a Wi-Fi       doing right now.



                                                            www.linuxvoice.com                                            31
     FAQ FLUTTER




                                  Flutter
                       Oh look, yet another mobile app development framework!
                             Except this one has a few aces up its sleeve…

                                            compiler to turn your human-readable          by Google. You might think that’s no
MIKE SAUNDERS                               source code into bytecode that can be         huge reason to celebrate; after all,
                                            processed by the Android Runtime on           Google has hyped up many of its own
                                            the device. You’d also need a bunch of        products, services and projects over the
       Do we really need another            libraries to provide, encryption, online      years, only to abandon them down the
       framework for developing             communication and other features              line (like Buzz and Wave). So Google’s
mobile applications? Can’t the world        (assuming you didn’t want to write            support doesn’t guarantee that Flutter
just standardise around one?                them all yourself). Finally, you’d need a     is 100% the future of mobile application
       Well, to quote Minix creator         toolkit for creating forms, buttons and       development, but it can reassure us
       Andrew Tanenbaum: “The nice          other interactive widgets on the screen.      that it’s not a fly-by-night project that
thing about standards is that you have                                                    will be dropped when the developers
so many to choose from”. It’s true that              Doesn’t the Android SDK              find new toys to play with.
there are new mobile frameworks                      provide all that already?               Some mobile app development
popping up every day, and the vast                  Yes, but – of course – it’s limited   frameworks have made extensive use
majority of them have their five minutes             to making apps for Android.          of JavaScript and HTML 5, the idea
of fame on Hacker News before               Flutter lets you create software that         being that many people already know
disappearing into the void forever. Most    runs on both Android and iOS, so you          these languages, so it should be fairly
of them promise the world – extremely       can write programs that run on the vast       easy to knock together software that
rapid development of feature-rich apps      majority of mobile devices from a single      can be run in a desktop browser or
that run seamlessly across Android, iOS     code base. On top of that, these              wrapped up into an app on Android or
and other platforms – while bringing        programs will look good. Flutter’s own        iOS. All you need is a HTML rendering
along their own sets of problems (such      description says that the framework           engine – included as standard in
as codebase immaturity and lack of          “gives developers an easy and                 mobile devices – and you’re good to go.
commercial or community support).           productive way to build and deploy               Flutter rejects this approach,
   But before we get on to Flutter, let’s   cross-platform, high-performance              however, for performance reasons.
clarify what an app development             mobile apps on both Android and iOS.          “HTML and WebViews as they exist
framework actually is. Essentially, a       Flutter gives users beautiful, fast, and      today make it challenging to
framework is a collection of                jitter-free app experiences.”                 consistently hit high frame rates and
components designed for building                                                          deliver high-fidelity experiences, due to
software, including compilers, libraries          So, more big promises. What             automatic behaviour (scrolling, layout)
and toolkits. Imagine you want to make            makes this one different?               and legacy support.” So if you want to
an Android application for an online              Well, it’s open source for starters.    write an app that’s extremely
shop, for instance: you’d need a                  But most significantly, it’s backed     responsive and fluid, HTML and
                                                                                          JavaScript simply won’t cut it.
     With Flutter you can write programs that run
                                                                                                So what does Flutter use
     on the vast majority of mobile devices –                                                   instead?
                                                                                                Dart. This is a fairly new open
     Android and iOS – from a single code base                                                  source language developed at



32                                            www.linuxvoice.com
                                                                                                                         FLUTTER FAQ

Google that was first unveiled to the
world in late 2011. The current stable
release at the time of writing is 1.12,
and while Dart is still a baby compared
with many other big-name
programming languages like C++ and
Java, it is already being used
extensively inside Google.
   Dart is an object-oriented language
with a C-like syntax and support for
optional typing; you can run Dart
programs in “checked mode” during
development, which enables dynamic
type assertions. Once you’ve debugged
your code, you can run it in “production
mode”, which is faster.
   Dart code can be converted to
JavaScript to run inside mainstream
web browsers, but it can also run in the
dedicated Dart Virtual Machine (which        To learn more about the system architecture behind Flutter, check out the presentation slides at http://
is supplied in the SDK). There’s also a      tinyurl.com/flutterarch. Let us know if you’d like Linux Voice to cover Flutter and Dart in more detail.
version of the Chromium browser called
Dartium, which includes the Dart VM.         entry boxes etc) tend to look rather flat,                    for snazzier-looking software. Flutter
The language includes an extensive           a smattering of drop shadows and                              apps should look – and respond – in
standard library with routines to handle     lighting effects help to make it clear                        the same way on both Android and iOS,
I/O, maths, strings, UTF8, JSON and          which bits can be interacted with. If you                     so you shouldn’t have to worry about
more. So despite its youthfulness it’s       have a smartphone running a recent                            subtle differences messing up your
already a well kitted-out language with      version of Android, you’ve probably                           screen layouts.
plenty going for it.                         already seen Material Design in action
   Note that Dart is used inside Flutter     – especially in Google’s Mail and Maps                               OK, sounds good. I have an
for application development – in other       mobile applications.                                                 idea for a mobile app that will
words, Flutter app developers write             (Of course, as Flutter is open source,                     change the world, cure the common
their code in Dart. The Flutter              nothing’s stopping you from hacking                           cold and make me megabucks –
framework itself is written in a mixture     away at its code to make it more                              where do I begin?
of languages including C and C++.            suitable for desktop app development.                                Hold your horses for a moment!
                                             Just don’t expect a great deal of help                               Flutter is still an “early stage open
       Right. But iOS doesn’t include        from Google.)                                                 source project” and missing some big
       the Dart VM, so how do Flutter                                                                      chunks of functionality right now. It’s
apps run in it?                                     Alright, that’s enough                                 fun to play around with and see what
       Everything is converted into                 background information! Now                            it’s capable of, and it’s arguably worth
       native code. The C/C++                show me some code…                                            learning early on in case it takes off as
components are compiled with LLVM/                  Very well. This is FAQ and not a                       the Next Big Thing™. You’ll find the main
Clang, while the Dart code is converted             coding tutorial, but if you want a                     website at http://flutter.io, and from
ahead of time. No interpreter is involved    sample of how the language looks,                             the instructions there you can install
when the app built on Flutter is running     here’s an ultra-simple program that                           the SDK on Linux and Mac OS X
– one of the reasons why performance         displays a widget with the famous                             (Windows support is planned for the
is so good.                                  “Hello, world” on it:                                         near future).
                                             import ‘package:flutter/material.dart’;                           The site also has a brief tutorial
       Can I build games or desktop          void main() => runApp(new Center(child:                       explaining how to arrange widgets and
       apps with Flutter?                    new Text(‘Hello, world!’)));                                  take user input, using a shopping cart
       You could try, but that’s not what    Here, runApp is a function that takes a                       application as an example. Otherwise
       the framework is designed for. It’s   root widget as a parameter. There are                         the documentation is lacking in many
very much focused on mobile devices,         two widgets in use here: Center (which                        places – hopefully this will be rectified
providing fast 2D performance and a          is responsible for positioning on the                         closer to the first official release of the
consistent and clean widget set via          screen) and Text (which shows the                             framework. And of course, if you ever
Google’s much vaunted Material               “Hello, world” label.                                         become insanely rich one day from
Design. This is a set of interface design       With Flutter you can build simple                          building apps using Flutter, please don’t
guidelines that focus on grid-based          applications using standalone widgets                         forget your friends at Linux Voice who
layouts and fast animation effects, and      like this, or you can use more                                introduced you to it. We wouldn’t say no
while the widgets (buttons, sliders, text    complicated Material Design widgets                           to a round of beers…



                                                               www.linuxvoice.com                                                                  33
     INTERVIEW BRADLEY KUHN




BRADLEY KUHN
SOFTWARE FREEDOM CONSERVANCY
Graham Morrison meets someone who really does get the difference between free
as in beer and free as in freedom. Mmmm, beer freedom!


T
        he GPL guarantees the freedom             website. Or at least that’s the theory – in           Enter, Bradley Kuhn. As president of the
        of the Linux kernel, GCC compiler         reality there are lots of Bad People who           Software Freedom Conservancy it’s his
        (so we can write programs to              don’t give a flying monkey’s about software        job to keep an eye on corporate interests
run on the kernel) and other everyday             freedom, who think they can just take              to make sure Free Software stays free. We
heavyweights such as the MySQL                    whatever code they think will make them            were lucky enough to catch up with him to
database, used by pretty much every major         money and fiddlesticks to the rest of us.          find out more.



       We’re sitting here at the             un-American, it’s a virus, it’s a cancer, it   copyleft. They had a page up where
       biggest Free Software                 eats your software like a Pacman,              they compared copyleft to the Business
conference event of the year,                which was Bill Gates’ contribution to          Software Alliance and so forth, and
O’Reilly’s OSCON. But we’ve noticed          the debate), they decided to pursue            while they softened that page after I
it changing over the past 10 years or        co-option, which is what many of the           criticised it a few times in my talks, it
so. There was a lightning talk this          for-profit companies have done with            still basically says copyleft is viral –
year arguing against copyleft, even          Free Software over the last decade and         viruses make you sick, it’s the classic
saying that the ‘viral’ nature of            a half.                                        attack against the GPL! [Readers can
copyleft is damaging and that we                 Microsoft was one of the first             see https://www.openoffice.org/why/
should move forward to permissive            companies to try to co-opt Free                why_compliance.html and
licences. It seems that open source          Software. The way they tried to do it          https://web.archive.org/
has reached a point where there’s a          was to find what they saw politically as       web/20150120123334/http://www.
generation that doesn’t know what it         the key faultline in our community that        openoffice.org/why/why_compliance.
was like before it existed, and that’s       could disrupt us, which was copyleft vs        html to see the various versions of
a huge danger.                               non-copyleft licensing. That’s kind of         these statements.]
Bradley Kuhn: It’s a very big danger.        the way co-option works; your                      At this point, I don’t think I’m under
This is a focus and centre of my work.       opponents find the middle of the               any obligation to stand with a non-
At this very conference in 2002 I believe,   ground and say that that’s the radical         copyleft licence advocacy, so I’ve in fact
there was a situation where Microsoft        thing and now “we’re going to embrace          changed my rhetoric on it. I’m happy
first came to this conference and their      it”. That’s what we see happening here         to say that copyleft is better because
messaging, after attempting to try to        and that led to the lightning talk you         copyleft stands up for software
destroy the GPL (they had this               saw. I’ve seen many attacks by the             freedom, and basically non-copyleft
messaging in 2001 saying that GPL is         Apache Software Foundation on                  licences lay down for software freedom.
                                                                                            They give software freedom to you but
                                                                                            they allow companies to proprietarise it.
                                                                                                There’s no surprise that there’s this
                                                                                            push for non-copyleft by businesses.
                                                                                            It’s not a conspiracy by any means;
                                                                                            these companies all want non-copyleft
                                                                                            as a simultaneous spontaneous
                                                                                            alignment of the same self interest.
                                                                                            They all want more non-copylefted
                                                                                            software all for their own reasons,
                                                                                            some of which don’t even overlap, but
                                                                                            all of them are agreed that copyleft
                                                         Bradley’s a big fan of Richard     is not something they want because
                                                      Stallman, and worked with him
                                                                                            that requires that their own software
                                                     at the Free Software Foundation
                                                               before joining the SFC.      be liberated at least some of the time.
                                                                                            Non-copyleft leaves “all of their options



34                                                             www.linuxvoice.com
                   BRADLEY KUHN INTERVIEW




   “I believe in universal software
freedom. No one should ever have
to make the choice between being
   good neighbours and obeying a
                  software licence.”




                                            35
     INTERVIEW BRADLEY KUHN




  The SFC uses the law to
  protect the GPL, but it prefers
  to cooperate with violators to
  avoid the expensive business
  of taking them to court.


open” and it means they can consume                   Not that slow…                         interests. There’s nothing wrong
as much as they want without giving                   BK: Yes, true enough, not that         with that, but it’s a huge challenge.
back. And I’m not saying lots of               slow but it is in a larger time scale; it’s   BK: I agree with you. That’s why I’ve
companies participate in this anti-            not going to happen in two years, it’s        worked in non-profit charities my entire
copyleft rhetoric.                             going to happen in maybe 15 or 20. The        career, because if you look at how Free
                                               environmental movement has had a              Software started, it started in charities.
       Even Apple does it.                     tremendous amount of success. One of          The idea of the founding of the Free
       BK: Right, and even Apple are           the crazy things that you see as you          Software Foundation – where I serve
releasing some things as Free Software         walk around this conference centre is         on the board of directors although it’s
but they want to control completely and        all the recycling bins everywhere, and        not my primary day job – was to write
say “only some things are going to be          people might point to those bins and          Free Software as a charitable activity,
Free Software and we decide – only we          say, “Well, that’s successful                 and the FSF did that. That’s how GNU
companies decide what gets to be Free          environmentalism”.                            came into existence, that’s why we
Software”. I have been working my                 Yet we still have climate change;          have GCC and that’s why we have GNU
entire career for a world where all the        there’s so much work to do. And the
software is Free Software.
   I believe in universal software
                                               corporate adoption of open source is
                                               exactly like recycling programs. Every
                                                                                                I have been working my
freedom. No one should ever have to            company by analogy has a recycling               entire career for a world
make the choice between being good             program now, but they’re ignoring the
neighbours (ie, sharing your software)         climate change version of our issues in          where all software is Free
and obeying a software licence. I was          the Free Software world.
convinced by Richard Stallman’s                                                              Emacs, and all of the stalwart packages
arguments 20 years ago that that was                 People recognise it’s a                 of Free Software. Over time, companies
correct and I still think it’s correct. It’s         necessity to tackle climate             realised that they have an interest in
unfortunate now that this co-option has        change. For a long time, copyleft             making money from Free Software. The
occurred because it makes it much              was a necessity; software freedom             earliest writings of Free Software
easier for everyone to compromise with         wouldn’t have worked without it.              always said ‘we’re going to treat all
a partially Free Software world. I             And now companies don’t appreciate            commercial and noncommercial
compare it often to what’s going on in         that necessity, so they come along            activity equally’ (not that commercial
the environmental movement. Climate            and change things, not in an evil way         activity is more important, it’s equal to
change is a disaster that we’re facing         to make them do anything other                noncommercial activity). Therefore
and it’s a slow-moving time bomb.              than what’s in their own best                 people began making money with Free



36                                                              www.linuxvoice.com
                                                                                             BRADLEY KUHN INTERVIEW

             Software. And because their initial         GitHub, Dropbox and Yahoo) earlier          Conservancy – down if we did things in
             businesses were in copyleft                 and made an important point about           a company’s interest. Whereas a trade
             communities – Cygnus [Solutions]            including GPL representation. These         association is designed to be exactly
             being the classic historical example,       were companies whose success                that – all the businesses get together
             which Red Hat eventually bought –           would never had happened without            and decide what they want, and the
             was making money by adding changes          the GPL.                                    trade association goes out and
             to the copyleft software.                   BK: I’ve seen a lot of these kinds of       advocates for it.
                But once we got to the point that        initiatives start up – and there’s more         Now that these companies are
             was this co-option moment of open           and more coming around – for-profit         anti-copyleft, there is more anti-copyleft
             source, companies just came along           companies getting together, often           coming from more quarters, including
             and they wrote the software from            forming a trade association.                trade associations and for-profit
             scratch without copyleft. And that is          I think people forget that there are     companies. And meanwhile the
             where the real threat comes, because        different types of non-profits. Trade       number of people that violate the GPL
             companies are going to want to “keep        associations form to push forward a         continues to go up.
             their options open”: they’ll decide what    common business interest of what                Sorry to go off on little a tangent, but
             they want to release and, if they do use    companies want.                             it’s important to know that copyleft only
             a copyleft licence, they’ll often use it,                                               works if there’s code under copyleft
             in my view, manipulatively, where they             Such as the Linux Foundation?        that someone wants to incorporate
             keep all the copyrights and then try to            BK: The Linux Foundation is          into their product so much that they’re
             trick people into buying a proprietary      indeed a trade association and it’s so      willing to give it a go and try the licence.
             licence. Copyleft was not designed to       different to a charity. I don’t have any    If the code’s not interesting or they
             trick people into buying a proprietary      objection to them existing. I think,        can write it again from scratch, the
             licence, which is why I’m a fan of          actually, trade associations are a          copyleft doesn’t work, because they’ll
             multi-copyright GPLed projects run by       valuable thing to have in the               just write it again from scratch under
             communities, but we’re having fewer         community. But we also need charities,      a non-copyleft or proprietary licence.
             and fewer of those and that’s a deep        because charities fight for the public      In fact, that’s even what’s happening
             concern of mine.                            good. I fight for the individual user and   with LLVM. Apple’s funding LLVM to
                                                         developer, not the companies who give       rewrite a compiler from scratch – it
                   You were in the TODO Group            us money. In fact, the IRS [Internal        was a university project initially with
                   meeting (a group of campanies         Revenue Service] in the US, which           good motives and Apple’s somewhat
             that use open source, including             decides who’s charitable, would shut        taken it under its wing so that Apple
             Google, Facebook, Twitter, HP,              my employer – Software Freedom              can get rid of GCC. And that’s what




“If we don’t remember the
past, we’re condemned to
repeat it”. Hang on to your
software freedom…



                                                           www.linuxvoice.com                                                                 37
     INTERVIEW BRADLEY KUHN

we see happening slowly but surely. I               That’s what happened with the          organisation, the Software Freedom
suspect a lot of people look at that and            BitKeeper version control              Conservancy, is currently funding
say it’s progress, and the reason they       system, which forced Linus writing            Christoph Hellwig in a litigation in
say that’s progress is that there’s a lot    his own – Git.                                Germany – is incorporating Linux into
more Free Software written every day.        BK: Of course, this is repeated history       their proprietary kernel product. We’re
The weird thing that happens is that –       and should be condemned. I look at IRC        fighting that in the courts because they
even though we wake up every day and         and Slack and I see BitKeeper and Git.        will not comply with the licence
there’s more Free Software in the world      The fact that everybody loves Git and         because, they believe they can get
than there ever has been – there’s also      it’s GPLed is an irony, particularly          away with it.
more times in a day when it’s difficult      because when you go and use GitHub
to get a particular task done without        most of what you’re using (not Git itself,           How does a small group of
running into the proprietary software as     that’s Free Software) is proprietary                 people like yourselves
the only solution.                           software – such as the bug tracker and        challenge VMware?
  A great example is the mad rush            everything on their site.                     BK: At times I wake up in the morning
towards Slack [the communication                 These types of problems are of great      and think of myself as the Michael
system] – even Free Software projects        concern to me. And I keep saying “great       Moore of Free Software, as in his
use it for their internal collaboration      concern” in this interview because we’re      famous movie Roger and Me where he
despite the fact that Slack is proprietary   facing a very difficult time for the future   tries to take on big corporations hurting
software. I use IRC every day and I          of Free Software and the future of            people. That’s the glib answer.
know its limitations and annoyances,         copyleft. Right now, with regard to              The serious answer is that we’re a
but it’s a Free Software technology. But     Linux’s GPL, which is the strongest           non-profit charity that ask the public to
people see a new technology and are          program out there still under GPL, it’s       support us. It took us years to raise the
running to this proprietary software.        being generally treated like the LGPL.        funds to take on VMware… [it] took a
We’ve watched this over and over             Proprietary kernel modules are                tremendous amount of fundraising
again. Proprietary technologies keep         common. We have a company like                effort and a tremendous amount of
coming out and wooing users.                 VMware – against which my                     time talking to VMWare hoping that
                                                                                           they would do the right thing.

                                                                                                   Two years…
                                                                                                   BK: Actually we’d been talking to
                                                                                           VMware for about three years by the
                                                                                           time the lawsuit was filed, it may have
                                                                                           even been four. I think 2012 was the
                                                                                           first time I contacted them. So there’s
                                                                                           this constant difficulty in these kinds of
                                                                                           challenges and because we’re going to
                                                                                           have to use the courts if they refuse to
                                                                                           comply with friendly requests and
                                                                                           repeated offers for collaborative help.
                                                                                              We’re going to need to raise much
                                                                                           more money. I hate to have to give a
                                                                                           fundraising pitch but we’re a charity and
                                                                                           in the US donations are tax deductible.
                                                                                           If you go to http://sfconservancy.org/
                                                                                           supporter you can become one of our
                                                                                           supporters for $120 a year, and I’d ask
                                                                                           your readers to do that.
                                                                                              A lot of people are employed in jobs
                                                                                           that allow them to release at least
                                                                                           some of their work as Free Software
                                                                                           and it’s wonderful and I’m so happy that
                                                                                           people are doing it. But developers are
                                                                                           also incredibly highly paid in the
                                                                                           industrialised world. So, $120 a year is
                                                                                           not a lot to a software developer in
                                                                                           Europe or the US, and you can really
                                                                                           help us fight this if you care about
  “I think [Google’s] Open Source
                                                                                           copyleft. You should donate to us
  Program Office really does get it
  and understands Free Software.”                                                          because we’re the only one defending
                                                                                           the copyleft on Linux – the only one.



38                                                            www.linuxvoice.com
                                                                                                    BRADLEY KUHN INTERVIEW




“You can’t blame Twitter too much for doing what’s best for their business, because they’re a for-profit company, but I can blame the general principle
that we build societies around, ‘Do what’s best for your business rather than do good for the world,’ and this is why we need charities.”

                      Why do you think big                    we don’t enforce the copyleft, they’ve            We’re three charities, we only have
                      companies that have made                spent all this money to comply with a         between us less than 50, possibly
               their success on the back of Free              licence that everybody else is just going     less than 40 employees, and that’s
               Software aren’t more willing to                to get away with violating.                   the entirety of GPL enforcement in the
               support people like the Software                  In other words, there needs to be a        world (at least charity-focused and
               Freedom Conservancy?                           regulatory body. Because of the way           public-good focused enforcement).
               BK: With regards specifically to what          copyleft is designed, that regulator has      And so when violators see that they
               we were just speaking about –                  to be some charity, not a governmental        think “we could put the squeeze on”.
               defending copyleft – I think a few             agency. It’s not like the government’s        It’s easy to squeeze out 40 people
               companies understand at least why              going to enforce the GPL for us.              and if enforcement is squeezed out,
               copyleft needs to be enforced and what            But Conservancy is basically               there’s no GPL anymore. Because an
               convinces them sometimes is that they          – because we’re a public charity –            unenforced GPL is the moral equivalent
               spend a lot of money trying to do the          the public body doing that work and           of a non-copyleft because if you don’t
               right thing under GPL and their                we’re basically the folks doing the           enforce it, it’s just like it was under the
               competitors don’t. If you take a               compliance and enforcement. The               Apache licence to start with.
               company like Google, for example, they         problem is – and you have this in other
               spend a tremendous amount of                   areas of regulation – violators can                  That’s a very depressing
                                                              smell blood in the water, right? They                thought.
   We’re the only one                                         know the regulatory body is less funded       BK: A lot of my work these days is
                                                              than they are. Thus, violators work hard      depressing, but I’m a lifelong pessimist.
   defending the copyleft                                     (in usual industries, the standard way        My organisation as a whole, between

   on Linux – the only one                                    is to lobby Congress) and to get the
                                                              regulations loosened and loosened and
                                                                                                            me and my colleagues, remain hopeful
                                                                                                            as a group because I think that we can
                                                              loosened.                                     convince the public that we need to be
               resource on their open source program             Many have theorised this caused the        supported.
               office complying with Free Software            financial crisis. Throughout the 90s in          Traditionally, the organisations that
               licences, as does HP and many of the           the United States, the financial rules        stand up for software freedom have
               other large companies. That’s great for        and regulations from [the Securities and      been supported by for-profit grants.
               me because if they do have a violation,        Exchange Commission] were reduced             What we’re seeing now is companies
               which they sometimes do, I know who            and it allowed the crazy types of things      not wanting to give us grants because
               to contact and they get it resolved            like inappropriate mortgage-backed            we’re enforcing the GPL, which means
               quickly. People make mistakes.                 securities. Well it’s very similar in any     the public needs to step up and I have
                  But our goal is to get compliance, so       policy situation where two or three           faith that the public will step up and
               once you come into compliance, we’re           non-profit organisations – Software           support us financially They will make a
               happy. So these companies that do              Freedom Conservancy, the FSF and              vote for GPL, a vote for software
               spend that money supporting the                WordPress Foundation – are the only           freedom via a vote with their dollars by
               Conservancy; they understand that if           ones enforcing the GPL.                       donating to us.



                                                                www.linuxvoice.com                                                                  39
        LISTEN TO THE PODCAST



         WWW.LINUXVOICE.COM




BUY           MUGS AND T-SHIRTS!




      shop.linuxvoice.com
                                                                                                                         INTRO REVIEWS




REVIEWS
The latest software and hardware, rigorously bashed against a wall by our crack team.

                                               On test this issue . . .
                                                                                                                   42
                                                                                                                              Phoronix
                                                                                                                              Test Suite
                                                                                                                              The world’s best Linux
                                                                                                                              benchmarking site has
                                                                                                                              released its testing suite
                                                                                                                              unto us. Upload your
                                                                                                                              benchmarks and share your
                                                                                                                              performance with the world,
Andrew Gregory                                                                                                                then see what GPU you
Now has an allotment and has tasted the joys                                                                                  should buy next to ge the
of the two-stroke petrol strimmer.                                                                                            most out of Fallout 4.




T
          he problem with arbitrary
          measures of purchasing power
          parity is that local conditions
oftem make comparisons unreliable.
Take Graham’s comparison of £4.00 for
the Pi Zero vs £4.30 for a pint in his
local pub. If I can get a drink of similar     CamJam EduKit 3                  43   Raspberry Pi Zero            44     OpenElec 6                      45
quality in my local for £2.90, does the Pi     Turn your Raspberry Pi into a         Unbelievably, the Pi has got        Multimedia distros are 10
fall in attractiveness because it costs        programmable robot (and teach         even smaller and even cheaper.      a penny, but few do such a
more in pints? Does it rise, because I         the kids some Linux skills too).      So what’s the trade-off?            fantastic job as this one.
can afford more creativity juice to
inspire my projects? Or is the
comparison just a bit silly?
    In reality the cost to the individual
                                               Group test and books
consumer of the Raspberry Pi isn’t the
limiting factor any more. That’s the time
it takes to connect it up, to download,
dd and install Raspbian, and to seek out
worthwhile project to provide
inspiration. And that’s where third-party
efforts, such as the CamJam Edukit,
come in. £17 for a total of, maybe, 8–10
hours initial entertainment is superb
value for money, and that value is
entirely thanks to the imagination of the
creators who put it together for you and
provide the projects. The hardware             Booooooooooooooks!!!!                             48   Group test – lightweight web browsers               50
doesn’t matter any more – it’s the             The vortex of paper-based knowledge sucks us in        If you don’t need the huge attack vector of built-in
people who are priceless.                      and spits us out wiser, but more aware than ever of    PDF readers and all that JavaScript to browse the
andrew@linuxvoice.com                          our ignorance. At least we learned some Vim.           web, ditch Firefox and try one of these little gems.



                                                                  www.linuxvoice.com                                                                    41
     REVIEWS BENCHMARKING SUITE




Phoronix Test Suite 6
Ben Everard now has graphs to support his claim that he needs a new PC.


                              P
Web phoronix-test-suite.com            horonix is best known as the website that       your machine compares to others. If, for example,
Developer Phoronix Media
Licence GPL v3                         tests Linux hardware to find out what           you’re thinking of upgrading your CPU, you can find
                                       performs well and what doesn’t. The software    data on a similar machine to yours with the new CPU
                              the team developed to perform this benchmarking –        and compare it to your current setup before spending
                              the Phoronix Test Suite – is open source, and has just   any money on hardware.
                              reached version 6.                                          At present there are over 150 different tests to
                                 There are two interfaces to the suite: the command    stress almost any aspect of your system. Tests are
                              line interface, and the web interface. Whichever of      downloaded on the fly from the project’s website, so
                              these you use, you get the output as a HTML report       new tests can appear at any time. These tests are
                              that can be either saved locally or shared with the      grouped into categories and into suites. The latter
                              world via the openbenchmarking.org website. The          enables you to run standard sets of tests, which
                              Phoronix Test Suite can also combine the output of       is particularly useful in comparing different bits of
                              tests run on different machines to produce reports       hardware. Most of the benchmarks are based on real-
                              that compare the performance of different pieces of      world usage, such as unzipping a large file or checking
                              hardware. This stock of open data and the ability to     the frame rate on a game.
                              combine reports means that you can easily see how           The Phoronix Test Suite is easy to install and use (the
                                                                                       only major dependency is PHP, though some tests
                                                                                       require more software to be installed), and runs on a
                                                                                       wide variety of platforms including Linux, Windows,
                                                                                       OS X and most BSDs. According to the project’s
                                                                                       website, even Gnu Hurd is supported, though we didn’t
                                                                                       test this. The portability enables you to benchmark
                                                                                       different OSes as well as different pieces of hardware,
                                                                                       and makes the suite massively useful.
The HTML reports make it
easy to see the
performance of your                                                                    Easy to use, comprehensive and with a large
machine and compare it                                                                 stock of real results – the Phoronix Test Suite is
                                                                                       the most useful Linux benchmarking tool.
against others from
openbenchmarking.org.



42                                                           www.linuxvoice.com
                                                                                                       CAMJAM EDUKIT 3 REVIEWS




CamJam EduKit 3
Andrew Gregory might finally get his chance for Robot Wars glory. Awooga!


Y
         ou might have heard of a little device called                                                                   Web camjam.me/edukit
                                                                                                                         Developer Michael Horne,
         the Raspberry Pi. It’s been a massive success,                                                                  Jamie Mann & Tim Richardson
         but, like so many projects, the thing that’s                                                                    Price £17 + £2 UK delivery
made it really take off hasn’t been the device itself, but
the ecosystem that’s grown up around it.                                                                                 The worksheets still use
   One excellent grassroots exampe of this is the                                                                        RPI.GPIO, but plans are
CamJam EduKit, so named because it’s brought to                                                                          afoot to rewrite them
you by the team behind the Cambridge Raspberry                                                                           using the much simpler
Jam. This, the third installment in the EduKit series,                                                                   GPIO Zero.
provides all the kit (well, most of the kit) to build a
simple robot. It comprises two wheels, a ball bearing,       Raspberry Pi and Pythin 2 vs Python 3 are dealt with
two motors, a breadboard and a motor controller, plus        smartly, rather than drowning the new user in choice.
the jumper cables to connect the kit to your Raspberry           As well as programming a robot, the user is
Pi and the required resistors. For the more advanced         learning Linux: the cd, mkdir and sudo commands are
projects there’s also a distance sensor and a black/         introduced, so it’s also a practical way to get kids into
white boundary sensor.                                       the Free Software mindset – even more so now that
   Ah yes, the projects. The really special                  Daniel Bull has released the design for a 3D-printed
bit of the EduKit is its collection of projects,             robot chassis (the cardboard box does an equally
available online from http://camjam.me/?page_                good job), which users are free to share and modify.
id=1035#worksheets. These start from the basic               It’s not a big deal, but it’s another example of the
Hello World that kids have to endure before they             way that building things and showing them off is so
get to do anything interesting and work up to                inspiring. We’re jealous of the kids who are going to
controlling motors, steering, speed and reacting to          wake up on Christmas Day with this stocking filler. If
input from the sensors. We’ve got to take our hats           you’re looking for a way to bring a Raspberry Pi to life,
off here: the directions are extremely easy to follow,       this is it.
and each completed worksheet leaves you having
accomplished something.                                      A fun, clear and inspiring resource for building
                                                             your first robot army.
   The differences between Raspbian Wheezy and
Jessie, coding in Nano or Idle, the several models of



                                                               www.linuxvoice.com                                                                 43
     REVIEWS RASPBERRY PI




Raspberry Pi Zero
There’s no such thing as a division by zero error, writes Graham Morrison.


                               T
Web raspberrypi.org                    he Raspberry Pi Zero costs £4. Is there             But this component diet has advantages too. The Pi
Developer Raspberry Pi
Foundation                             anything really left to say? For £4 you get a   Zero is tiny and light, which is something you only
Price £4 including VAT                 device that’s more powerful than the original   really appreciate when roll it over your fingers. With
                               Raspberry Pi. Its CPU is factory overclocked to 1GHz    fewer components, power consumption is also
                               and there’s 512MB of RAM. It might not be the           reduced to around the 60mA mark (0.5/0.7W!). The Pi
                               multicore ARMv7 of the Raspberry Pi 2 (not yet,         Zero could easily be sewn into clothing, secreted
                               anyway), but it runs everything we threw at it. Of      within a boat, or put to flight in a DIY quadcopter.
                               course, compromises have been made; the camera              All the GPIO and composite video connections are
                               connector has gone, as has the DSI port for             here too, albeit unpopulated, so wires will need to be
                               connecting the official touchscreen. There’s only a     soldered manually. But at this price, the Pi becomes a
                               single micro-USB for networking and peripherals and     genuine alternative to even the cheap Arduino copies.
                               HDMI is via a mini HDMI, rather than the fat one.       Our collective imagination explodes at the potential for
                                                                                       where these devices can be placed and programmed.
                                                                                           If there’s anything to criticise, it’s perhaps the
                                                                                       premise that a $5 Pi Zero is will make computing
                                                                                       more accessible to people who can’t afford it. Even
                                                                                       with the original Pi, you spent more money buying the
                                                                                       keyboard, mouse, cables , screen, Wi-Fi and storage
                                                                                       than on the Pi itself, and if price is a focus for the
                                                                                       Raspberry Pi Foundation, it could perhaps help bring
                                                                                       its incredible economies of scale to these peripherals
                                                                                       too. But really, we’re only saying this to add some
                                                                                       perspective. The Raspberry Pi Zero is a no-brainer.
                                                                                       It’s going to bring Linux and open source to tens of
                                                                                       thousands of new makers.
The Pi Zero is tiny (65 x 30
x 5 mm, and weighing 9                                                                 We know everyone uses the price of a latte as
grams), yet packs more                                                                 the people’s currency, but we prefer to compare
                                                                                       the Pi Zero to a pint of Gem fine ale (£4.30).
punch than the original
Raspberry Pi Model B.



44                                                           www.linuxvoice.com
                                                                                                             OPENELEC 6 REVIEWS




OpenElec 6
Ben Everard sets up a smart TV with a Raspberry Pi and this media centre distro.


O
          pen Embedded Linux Entertainment Centre                                                                    Web http://openelec.tv
                                                                                                                     Developer OpenELEC Team
          (or OpenElec) is a Linux distro that’s stripped                                                            Licence Various FOSS licences
          down to just the bare essentials necessary for
a home theatre PC (HTPC). It contains little more than
the Kodi media player (version 15.2 in the latest                                                                    Once you’ve transferred
release) and the drivers necessary to make it run.                                                                   the image to the SD card
   There are a variety of images for various different                                                               with the dd command, the
hardware including x86 and a variety of ARM boards                                                                   installation is easy even
(such as the Raspberry Pi). Support for the WeTek                                                                    for non-technical people.
Play TV boxes is new in version 6, as is improved
support for the imx6 system on a chip that’s used in        For Updates. This rather awkward process was a
the Cubiebox and Hummingboard.                              slight dampener on what was otherwise a really easy
   When you first boot up OpenElec, you’ll see a wizard     installation process.
that introduces the system and helps you set up the            There’s a good range of addons including iPlayer
network. This means you can configure your device           (only in the the UK) and YouTube, but to really get
without a keyboard.                                         the best out of OpenElec, you’ll either need a digital
   We tested OpenElec on a Raspberry Pi 2. This is a        TV tuner or a range of videos already stored on the
popular choice and a lot of work has gone into making       computer that’s linked to your television.
both the underlying system and the mediaplayer                 The only downside to OpenElec is that it’s purely a
run well on this hardware. The result is flawlessly         media centre, so you can’t install a regular desktop
smooth operation, and in our testing, we didn’t come        or other software alongside the media player. This
across any issues with the computing power of the           shouldn’t affect many people who need a media
hardware.                                                   centre though, and the focus on doing just one thing
   The Kodi media player can play local files and           well is what makes it such a highly polished, useful
stream media through various addons. When we                Linux distribution.
first started OpenElec, we found that there weren’t
any addons available to install. We had to force a          The best Linux media centre distro – just make
                                                            sure you update the addons.
refresh of the addon repository by going to System >
Settings > Addons, then in the pull-out sidebar, Check



                                                              www.linuxvoice.com                                                                45
     REVIEWS GAMING




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


 CUTHBERT, DIBBLE, GRUB
                                              Alien: Isolation
                                              Guaranteed to raise your blood pressure.


                                              T
                                                       he Alien franchise may have been
                                                       severely overdone since the release of
                                                       the original film, but Alien: Isolation gets
                                              back to its roots, taking place 15 years after the
                                              events of the original. The game puts the player
                                              in the shoes of Amanda Ripley, the daughter of
                                              Alien’s protagonist, who is now tasked with
 Michel Loubet-Jambert is our Games
 Editor. He hasn’t had a decent night’s       investigating her mother’s disappearance.
 sleep since Steam came out on Linux.            The old-school beige panels and CRT monitor
                                              vision of the future is excellently captured,           The game does well to recreate the feel of 70s and


 W
              ith little fanfare, Valve has   while the hollow and eerie space sounds create          80s sci-fi films (and Graham’s synth collection).
              launched its much-              tension. Somehow, it also manages to pull off
              awaited Steam Machines
                                              great AAA graphics without needing a whopper            impressive. Making a terrifying game without
 and accompanying peripherals to the
 masses. The fairly low-key launch            of a graphics card.                                     pandering to the audiences of overacting internet
 was accompanied by no new major                 It must be pointed out that this game is             personalities or descending into the realms
 ports on launch day, which surprised         often terrifying. The unpredictability of the alien,    of fan fiction are notable achievements in this
 many, since other announcements              the building up of tension and the isolating            day and age. Our only criticism is that while the
 had been made alongside the launch
                                              environment of an abandoned space station               pacing of the story is excellent, the player has
 of major AAA titles.
    The hardware has been extremely           really do leave you on the edge of your seat. The       to spend considerable periods hiding in lockers
 well received. The Steam Controller in       game gradually builds up the story and often            until the alien gets bored, and this tends to drag
 particular has received much praise,         lulls the player into a false sense of security and     a little. That said, there is little to nothing else to
 despite its steep learning curve as a        always manages to catch you off guard.                  criticise about this excellent game.
 result of its unorthodox design. This
                                                 The pacing and story have been widely
 was expected, since its development                                                                    Website http://store.steampowered.com/
 and launch have been extremely               praised, and rightfully so. However, it is also what
                                                                                                        app/214490 Price £31.99
 cautious, and there is little doubt that     this game doesn’t do that makes it equally as
 numerous improved iterations of the
 hardware will appear in future.
    This is really only the beginning,
 and clearly no one has been
 expecting Linux gaming to become
 mainstream overnight. While the
 positive reception will help in that
 regard, what remains uncertain is
 whether the Linux-powered consoles
 will see widespread success. Only a
 handful of Steam Machines are at
 price points competitive with
 consoles, and though better on paper,
 they lack the advantage of
 hardware-specific optimisations
 which give consoles their appealing
 price/performance ratio.
    Sure, drivers are still a mess,
                                                Being persistently and
 performance is disastrous compared
                                                unpredictably stalked makes
 to Windows, but it is now out in the
 wild in a similar fashion to the early         you feel constantly on edge.
 Android devices, and only
 unpredictable and irrational markets
 will define whether it goes the way of          The game lulls you into a false sense of security
 Android or of the Sinclair C5.
                                                 and always manages to catch you off guard

46                                                                  www.linuxvoice.com
                                                                                                                GAMING REVIEWS


The Long Dark                                                                                     ALSO RELEASED…
A survival game that trumps all survival games.


D
          espite not being finished yet,         survival genre should be approached: in
          The Long Dark is already a deeply      the desolate Canadian wilderness, with
          captivating experience worthy of       harsh conditions and wildlife and all the
purchase. When there is also the promise         unpredictability that comes with it.
of an upcoming immersive story mode                 There are no other players to ruin the
featuring the voice acting of David Hayter       immersion and no tutorials to hold your
[Snake from Metal Gear Solid], it seems          hand, just the full Christopher McCandless
almost too good to be true.                      experience of the harsh struggle against         Mini Metro
   The Long Dark does away with all the          nature. It’s a wonder how something like         Mini Metro is about as simple as they come,
silly tree punching and crafting a GPS           this hasn’t come about sooner.                   but it’s also easily one of the most fun and
system from a couple of pieces of metal                                                           satisfying experiences out there. The game
                                                                                                  presents a metro map, with an increasing
and some string and brings things back             Website http://store.steampowered.com/
                                                                                                  number of stations appearing as the city
                                                   app/305620 Price £14.99
down to earth. This game shows how the                                                            grows. The player is tasked with building lines
                                                                                                  and making connections before the system
                                                                                                  overloads and the game ends. Ideal for a dose
                                                                                                  of fun relaxation.
                                                                                                  http://store.steampowered.com/app/287980




                                                                                                  Trine 3: The Artifacts of Power
                                                       The world’s harsh environment is as        The much loved puzzle-platformer series has
                                                      beautiful as it is intent on killing you.   returned, but this time with fully 3D graphics
                                                                                                  as opposed to 2.5D. The transition to a fully 3D
                                                                                                  game could have been smoother, and it’s
                                                                                                  difficult to improve on itspredecessors, but it

Insurgency                                                                                        is still a solid platformer nonetheless. The
                                                                                                  game features the trademark colourful
                                                                                                  graphics that helped make the originals so
A team-based first person shooter that focuses on the player.                                     appealing and still manage to make jaws drop.



T
                                                                                                  http://store.steampowered.com/app/319910
          he generic maps and standard
          “good guys” vs “bad guys”
          dichotomy that plagues shooters
dissuade us from trying a lot of shooters.
However, multiplayer FPS games can be
either excellent or atrocious based on their
subtle differences, and Insurgency excels
in this regard.
   It’s one of those games meant to be           The source engine can often feel pretty
perfected, where every nook and cranny           dated, but does the job.
becomes second nature to the player                                                               Layers of Fear
                                                                                                  This highbrow horror game puts the player in
and where familiarity with weapons and           learn while also not giving away enemy
                                                                                                  the shoes of a painter attempting to finish his
keyboard mappings makes the difference           positions – adding to the realism and            greatest piece of art. Rather than focusing on
between life and death. However, it’s            challenge. Getting better at the game is         jump scares, Layers of Fear builds up
accommodating in balancing realism with          very rewarding, while the game modes             atmosphere and draws on psychological
playability, managing to pull off realistic      are varied and fun without any particularly      horror. The psychedelic aspects seen from
                                                                                                  experiencing the game through the eyes of
damage without extremely short games,            weak ones. Overall, Insurgency is a solid
                                                                                                  madness, coupled with its knowledge of 19th
since this style of play imposes caution         choice for those feeling trigger happy.          century art and architecture, make the game
upon the player.                                                                                  feel very mature and pensive.
   The lack of kill cam is also an interesting     Website http://store.steampowered.com/         http://store.steampowered.com/app/391720
                                                   app/222880 Price £10.99
choice, which makes maps far harder to



                                                                www.linuxvoice.com                                                                  47
     REVIEWS BOOKS



Modern Perl (fourth edition)
Can this Rossetta Stone help Ben Everard learn this cryptic language?
Author Chromatic
Publisher Pragmatic Bookshelf
Price £22.49
ISBN 978-1-68050-088-2




P
          erl can be a confusing language,        through the concepts quickly with short
          even for people experienced with        examples. This works well for readers using
          other languages. At first glance, it    the book alongside some existing Perl code
can look like a mass of symbols with little       or some challenges, but anyone hoping
meaning, and it relies on concepts that don’t     to read the book as a standalone guide to
feature heavily in other languages, such as       learning the language may be left wanting a
context. Anyone moving to this language           little more.
is likely to need a guide. Modern Perl is just        With the impending release of Perl 6,
such a guide for programmers looking to           Autumn 2015 seems an unlikely time to
learn Perl. There’s little attempt to introduce   update a book focused on Perl 5, but if the
the basic concepts of programming, and the        experiences of the Python community are
process of breaking down a problem and            anything to go by, we’ll see Perl 5 around for
solving it using data and algorithms. Instead,    quite some time yet.
the book focusses on Perl syntax, and the
                                                  Everything you need to know about modern
Perl language features.                           Perl, but too rushed to make an enjoyable
   As we’re feeling generous, we’ll call the      read.                                            Historians claim the modern age began in
book concise (were we in a worse mood,                                                             the 15th century, but Perl programmers claim
we’d call it sparse). The reader is taken                                                          modern Perl started with version 5.10 in 2007.




Practical Vim (2nd Edition)
Ben Everard isn’t a real person, he’s Vim script that writes Linux articles.
Author Drew Neil
Publisher Pragmatic Bookshelf
Price £19.19
ISBN 978-1-68050-127-8




V
         im is a hugely powerful editor that      knowledge bit-by-bit until they become a
         can dramatically speed up routine        Vim master. Any new concepts are eased
         text-based tasks. All this power         in so that the reader has time to solidify
comes from a complex user interface that          the concept in their head before moving
requires the programmer to get to grips           forward. Practical Vim is for people who
with modes, commands and a myriad of              want a proper introduction to Vim and are
keystrokes that have different effects in         prepared to put the time into learning this
different modes. To get to grips with all         tool properly. If you want a quick-and-dirty
this, you’re going to need some help, and         30-minute intro, look elsewhere. If you’re
there are loads of places to go looking for       a programmer, sysadmin, or do anything
Vim advice. The thing we liked most about         else that requires you to spend a significant
Practical Vim when compared with other            proportion of your day in text files, then the
Vim learning materials is the smooth              time you invest in reading Practical Vim will
learning curve.                                   be paid back handsomely in more efficient
                                                  text editing.
Vim is better than Emacs                          The best way we’ve found to learn Vim            Emacs vs Vim is one of the oldest arguments
Practical Vim gives the reader a nice and         other than using it for 20 years.                in free software, but really we should just be
gentle (well, as gentle as is possible)                                                            grateful that there are two excellent editors to
introduction, then gradually builds up their                                                       choose from.



48                                                             www.linuxvoice.com
                                                                                                                  BOOKS REVIEWS



The Martian
Graham Morrison may be the last person on Earth to to read this.                         Also released…
Author Andy Weir
Publisher Crown Publishing
                                                                                         February 2016
Price £7.99
ISBN 978-1785031137

                                                                                         Python Crash Course
T
          his is a science fiction story
          with the emphasis, mostly, on                                                  There are lots of books
                                                                                         that teach you how to
          the science. We’re sure you’ve
                                                                                         program Python. Our
already heard of it, thanks to the 2015                                                  favourite is the 1,632-
Ridley Scott film staring Jason Bourne.                                                  page monster that is
But it wasn’t until speaking to Stuart                                                   O’Reilly’s Programming
Ward at OggCamp that we thought                                                          Python. But Crash Course
                                                                                         sounds good too. It’s
about the words behind the story, and
                                                                                         written to be quick and
we’re now really grateful to Stuart for                                                  yield immediate results,
giving us this book recommendation.                                                      which makes it ideal if
   The Martian is brilliant. Right from                                                  you’re looking for a primer
the first page, it imbibes itself with       We spent a large part of our childhood      without all the theory that
                                                                                         often comes as part of the     Python knows nothing of
the sense of wonder at the natural           dreaming of being on a planet all alone.
                                                                                         same read.                     engine thrust hazards.
world that you’d expect from a 10
year old. Everything is full of potential.   to space travel, and it’s this passionate
No situation is insurmountable, and          engagement with science that binds
disasters are nothing but challenges.        the book together.
   The setting is obviously perfect             That’s not to denigrate the narrative.   Ruby Performance
for this. It tells the story of NASA         The story is a rollercoaster ride that      Ruby is still very
astronaut, botanist and mechanical           grows to levels of fantastic intensity,     important, but from the
engineer Mark Watney, after he’s             pulling you through the pages like          people we know using it,
stranded on the red planet Mars              an inescapable force. What’s even           projects often start
                                                                                         quickly as the developers
all alone – an embodiment of the             more remarkable is that the book            work on their idea, before
Anthropic Principle – and it’s difficult     was originally self-published and           adding to the complexity,
to describe anything else without            given away for free. It was only after      and perhaps, breaking
giving the story away. But what              incredible demand for the Kindle            Ruby’s optimal use.
makes everything so compelling is            version, a version that Andy Weir           Reading something about
                                                                                         making Ruby perform
the inventiveness of both the main           reluctantly sold at a minimal price         better is always going to
character and the author.                    in order to adhere to Amazon’s              help avoid this trap, and
   Author Andy Weir is the son of a          conditions, that a publisher showed         as it’s Ruby, your design is   Ruby’s memory and CPU
particle physicist and obviously has         interest. The rest became history.          going to be better too.        usage are still important.
a technical background. There can’t
be many mainstream books that                Ziggy played guitar
contain a joke about Linux, even if          Even if you’re not particularly into
we can’t agree with its insinuation          science fiction as a genre, or enjoy        Why
that Linux is more complicated than          pretending that the robots are going to
                                                                                         That’s not one of our
NASA’s hardware. What makes the              take over the world, The Martian is a       classic typos. This book’s
Martian so interesting is that while it’s    wonderful read. It feels like how NASA      title doesn’t have an
science fiction, it’s most definitely set    should feel, had we not abandoned           question mark. Which
in the present or near future. All the       manned space exploration for the last       could be an example of
technology described in the book is          44 years. And of course, it leaves you      the causality it hopes to
                                                                                         describe – whether that’s
contemporary, and while it’s always          thinking again about what might be          studying the evidence for
going to be impossible to second-            possible were everyone to work              coffee being beneficial to
guess new discoveries (the book              together to create solutions to what        your health, or what
was written before the discovery of          may initially seem impossible               makes stock prices go up.
running water on Mars, for example),         problems, regardless of whether or not      Evidence is always good,
                                                                                         but interpreting the
The Martian feels remarkably authentic       those efforts are ultimately successful.    evidence is much,
to us. It’s obvious that the author has                                                  much harder.                   Why not?
                                             Compelling, authentic and entertaining.
done an incredible amount of research
into all kinds of subjects, from botany



                                                                  www.linuxvoice.com                                                                 49
     GROUP TEST LIGHTWEIGHT WEB BROWSERS




GROUP TEST
Firefox and Chrome are overkill (and security risks) for many tasks.
Mike Saunders explores the best RAM-friendly alternatives.



 On test                                                      Lightweight browsers
                                                              M
                                                                            onocultures are generally          If you often work with primarily
 NetSurf                                                                    very bad things in the          text-based content, where you
             URL www.netsurf-browser.org                                    software world, as we           don’t need JavaScript, fancy CSS
             Interface Graphical                              saw when Internet Explorer utterly            animations, plugins, webcam
             Latest release 3.3                               dominated the browser market in               access and other fluff, it’s well
             Describes itself as “small as a mouse,           the early 2000s. Very few                     worth investigating some of the
             fast as a cheetah and available for free.”
                                                              innovations were being made, the              other web browsers out there.
                                                              browser was a huge morass of                  Many open source browsers are
 Dillo                                                        bugs and security holes, and yet              lighter on your RAM banks, they
             URL www.dillo.org                                Microsoft didn’t seem fussed about            load and render pages more quickly,
             Interface Graphical                              making progress, as it had the                and because their codebases are
             Latest release 3.0.5                             market sewn up.                               smaller, there’s a reduced risk of
             Aims for the “democratisation of                    Today the situation is a lot better:       security holes opening up.
             internet information access”.                    we have two major open source                    So we thought we’d look at
                                                              browser projects in the form of               six web browsers that share no
 Lynx                                                         Firefox and Chromium, plus many
                                                              spin-offs from those. They’re
                                                                                                            heritage with Firefox or Chrome –
                                                                                                            that is, they don’t use the Gecko or
             URL http://lynx.invisible-island.net
                                                              progressing quickly, a lot more               WebKit rendering engines. These
             Interface Text
             Latest release 2.8.8                             reliable and secure than the IEs and          browsers don’t offer all the bells
             The classic text mode browser, dating            Netscapes of yesteryear, and enable           and whistles of the big names, but
             back to 1992.                                    us to access pretty much any                  they do have big advantages in
                                                              content on the web.                           terms of performance and security,
                                                                 We use Firefox extensively at              and have plenty of benefits for
 W3m                                                          Linux Voice Towers, and it’s one of           when you simply want to browse
             URL http://w3m.sourceforge.net                   the most important FOSS projects              the web for useful textual content.
             Interface Text                                   – but it’s not necessarily the best           After all, the web isn’t just about cat
             Latest release 0.5.3
                                                              tool at all times.                            videos, right?
             This text mode browser sports an
             uncanny ability to render complex pages.
                                                                These browsers don’t offer all the
 Amaya                                                          bells and whistles of the big names,
             URL www.w3.org/Amaya
             Interface Graphical                                but they do have big advantages
             Latest release 11.4.4
             More than just a browser, Amaya offers
             integrated website editing capabilities.          Who needs pictures?
                                                               Text-mode browsers may sound                 free Wi-Fi was providing just 1 kilobyte

 ELinks
                                                               pointless, but they’re surprisingly useful   per second. Everyone else had given up
                                                               if you want to concentrate on text-heavy     trying to browse the web, but we SSHed
             URL http://elinks.or.cz                           content such as Wikipedia. Plus, they        into a remote machine (a Raspberry
             Interface Text                                    consume very little bandwidth, and you       Pi), ran W3m, and were happily reading
             Latest release 0.12pre6                           can use them over an SSH session on          Wikipedia and Reddit with extremely
                                                               another machine.                             low bandwidth requirements – so it’s
             A highly customisable browser
                                                                   This author was recently stuck at an     well worth keeping a text mode browser
             extensible via Lua and Guile scripts.
                                                               airport for several hours and the awful      around and learning how to use it.




50                                                        www.linuxvoice.com
                                                                          LIGHTWEIGHT WEB BROWSERS GROUP TEST



A browser in your editor
Is there anything that Emacs can’t do?


A
         sk Emacs fans why they love their           tools. We’ve heard that there’s actually a          visually impaired users. W3 in particular is
         “editor” so much, and they’ll usually       good editor somewhere inside Emacs, but             surprisingly featureful, supporting forms,
         give you this answer: you can do            you have to switch to Evil mode first…              tables and basic CSS. Another option is to
(almost) everything in it, without having to           So it’s not surprising that some                  integrate the W3M text mode browser into
leave its cosy confines. Want to check your          enterprising hackers have created a                 Emacs. The process for doing this, plus
email? Organise your schedule? Play Tetris?          few web browsers for Emacs. The most                links to the other browsers and related
Or even talk to a virtual psychiatrist? Emacs        notable are Eww and W3, and they can be             information, can be found on the Emacs
lets you do all this – and much more –               used in combination with EmacsSpeak to              wiki at www.emacswiki.org/emacs/
without having to install a bunch of different       provide web browsing facilities for blind or        CategoryWebBrowser.




Dillo
Tiny, fast and very limited.

D
          illo is the first of the three graphical
          browsers on test, and distinguishes
          itself by being based on the FLTK
graphical toolkit. This is a very light
alternative to GTK and Qt, and while it looks
rather unappetising out of the box, it can be
themed up and does the job effectively. We
compiled the latest release from source;
note that you need to pass --enable-ssl to
the ./configure script to build in SSL
support, otherwise it’s disabled by default.
The end result is a 745k binary which
launches in a snap.
   By and large, Dillo looks and works like a
regular browser. There are familiar tool and
status bars at the top and bottom of the
window respectively, while Ctrl+L switches
focus to the address bar and Ctrl+R reloads          Dillo is fairly good for browsing Wikipedia, although you have to scroll past elements that would
a page. The browser loads pages at a                 otherwise be floating at the sides of a page.
scorching pace, with relatively small RAM
usage: when accessing the Wikipedia page             alongside the main content, Dillo simply            effects, like Wikipedia and Reddit. It’s
for Linux, for instance, Dillo uses just 24MB        places floating elements and content after          delightfully fast when it works, and very
of RAM, whereas Firefox eats up 235MB.               one another in one big vertical column. So          conservative with RAM, making it a good
   It’s not obvious from the start, but tabbed       in Wikipedia, for example, you have to spend        choice when you’re reviving an old netbook
browsing is possible via right-clicks on links,      ages scrolling past the Infobox panel before        and just want to use the browser for reading
while facilities for bookmarking, searching          you reach the content. (In Firefox, that panel      purposes. Unfortunately, though, it’s simply
for text and viewing HTML source code are            floats on the right and allows space for            too broken on many websites to make it
included as well. And that’s pretty much             content on the left.)                               suitable for daily general-purpose usage.
it – you won’t find any fancy features here                                                                 But! Support for floating elements will be
such as plugins or developer tools, but it has       Your mileage may vary                               included in Dillo 3.1, along with many other
the basic browsing jobs covered adequately.          This causes issues with many websites –             CSS attributes, which will make the browser
Some aspects of the design are a bit                 although it doesn’t render them unusable.           far more usable for the majority of websites
annoying, however, like the lack of history in       You just have to get used to scrolling past         out there.
the address bar and the use of /tmp as the           chunks of pages that you’d normally ignore.
default download location.                           Dillo has a smattering of CSS support, but no         VERDICT
   But how does it render pages? Well, it’s          JavaScript, so any pages dependent on that            The best graphical choice
                                                                                                           for ultra-low RAM usage,
a very mixed bag. Dillo’s major problem is           will break.                                           but has major issues
displaying content that’s provided inside               Ultimately, Dillo is acceptable for browsing       rendering pages.
floating panes. Instead of presenting them           text-heavy websites with minimal snazzy



                                                                 www.linuxvoice.com                                                                      51
     GROUP TEST LIGHTWEIGHT WEB BROWSERS


Lynx
The original (but not best) text mode browser.


A
          nd so we come to our first          default scheme often lends to garish
          browser that runs entirely in the   combinations that are hard to read.
          terminal. Lynx has been in             Lynx supports HTTPS and makes
development since 1992, so it’s pretty        a decent attempt at recreating page
much as old as the World Wide Web             layouts, but it’s the weakest of the
itself, and has been ported to a vast         text mode browsers in our Group
range of platforms including MS-DOS,          Test in this respect. It’s light on
VMS, AmigaOS, BeOS, OS/2 and others.          RAM, using just 15MB to render the
Although Lynx is still under development,     Wikipedia page for Linux, and can
progress is sometimes slow and often          be operated automatically using
the project goes half a year or more          keystrokes recorded in a file – useful for
between developer snapshots.                  performing tests on websites.
   Out of the box, Lynx is welcoming             All things considered, Lynx is the
and easy to use: a status bar and some        most mature text mode browser                Handily, most Lynx options can be configured inside the
lines of help text along the bottom           out there and is pleasingly user             browser, so you don’t need to faff around with config files.
provide information on common                 friendly given its age. With support
keyboard shortcuts, so you don’t              for HTTPS and forms it can be used                           its rendering abilities for tables and
have to delve into manual pages               with an impressive range of sites, but                       complex layouts fall behind those of
just to get basic navigation sorted                                                                        W3m and ELinks.
out. The left and right arrow keys               Lynx is light on RAM,
work like backwards and forwards                                                                            VERDICT
respectively – and to navigate to the            using 15MB to render the                                   Mature, accessible and
                                                                                                            easy to tweak – but
next link on the page, use Tab. Colour
is used extensively, although the
                                                 Wikipedia page for Linux                                   lagging behind.




Amaya
A website editor and browser combined into one app.


A
         maya is another of those             disable this in order to use Amaya
         projects with an extensive           purely as a web browser. And its
         history, going back to 1996. It      performance here is a real mixed bag.
was originally created at INRIA, the          Amaya uses OpenGL to render pages,
French Institute for Reasearch in             and we encountered a startling number
Computer Science and Automation,              of bugs and glitches when trying to
and is still seeing the occasional update     browse simple pages.
today – although the latest stable
release was issued back in 2013. Just         Sub-prime performance
getting Amaya installed can be a              This could be down to mismatches
headache; many distros, including             between OpenGL libraries of today and
Debian and Ubuntu don’t have it in their      those when the packages were built,
repositories, so you have to grab the         but then Amaya needs to generate
package from Amaya’s website and              updated packages (or work with distros       One error Amaya gave us was “No pincher, please call
hope for the best. The app depends on         to get the software into repositories).      crStateSetCurrentPointers() in your SPU”. Er, OK…
the wxWidgets toolkit, which in turn          Rendering of layouts wasn’t too bad
depends on GTK 2, so there’s a large          when the browser was behaving,                               the latter simply isn’t usable on a
layer of older dependencies involved.         although still uses 173MB of RAM to                          day-to-day basis until the freezes and
   When loaded, Amaya presents an             display the Wikipedia Linux page.                            rendering glitches are sorted out.
information page, which you can start            So we can’t really recommend Amaya
editing straight away. On the right-          for either of its tasks – website editing                     VERDICT
                                                                                                            Has potential, but eats up
hand side you’ll see a panel containing       or browsing – in its current form.                            too much RAM for its
various buttons to add HTML elements          BlueGriffon and SeaMonkey Composer                            browsing capabilities.
– under the Views menu you can                do better jobs with the former, and



52                                                             www.linuxvoice.com
                                                                                LIGHTWEIGHT WEB BROWSERS GROUP TEST


NetSurf
                                                                                                   Servo: the future?
The most promising graphical browser.
                                                                                                   Mozilla’s new rendering
                                                                                                   engine.


                                                                                                   W
                                                                                                                 ebsite rendering engines such as
                                                                                                                 Firefox’s Gecko or Chrome/
                                                                                                                 Chromium’s Blink (formerly WebKit)
                                                                                                   are insanely complicated pieces of software.
                                                                                                   They need to handle HTML, CSS, JavaScript,
                                                                                                   images, sound files, embedded videos and
                                                                                                   much, much more. Quite often, by the time
                                                                                                   that such a rendering engine reaches maturity,
                                                                                                   technology has moved on so much that the
                                                                                                   engine itself is rather dated. Gecko and WebKit,
                                                                                                   for instance, were started in an age when
                                                                                                   most people were using single-core
                                                                                                   computers. Today, even low-end smartphones
                                                                                                   boast quad-core chips – something that still
                                                                                                   seems crazy to us, but technology moves fast.
                                                                                                      So Servo is an attempt by the Mozilla
                                                                                                   project, the makers of Firefox, to create a
                                                                                                   new rendering engine that makes better use
NetSurf’s layout engine isn’t perfect, so expect the odd glitch here and there, but it does an     of multi-core chips. It’s designed for better
impressive job given the small team working on it.                                                 parallelism – so that HTML parsing, rendering,
                                                                                                   layout, JavaScript processing, images etc. can



R
         emember RISC OS, the operating            functionality required for most tasks. We       all be handled by different tasks at the same
         system used on the Acorn                  found its performance to be largely very        time. Servo is written in Rust, the new-ish
         Archimedes range of computers,            good; not as fast as the text-mode              programming language also from the good
and later the RiscPC? But back in the early        browsers, but still better than the             folks at Mozilla, and while it’s still in the early
2000s, some of its users were despairing           heavyweights on many sites. In terms of         stages of development, Samsung has shown
about the state of web browsers on the             RAM consumption it’s also worlds ahead          interest in running it on its mobile devices.
platform. So they created a new browser            of Firefox: where that browser requires            It may be a few years before we see Servo
from scratch – NetSurf – which has since           235MB to view the Linux Wikipedia page,         adopted in mainstream browsers like Firefox,
been ported to Linux.                              NetSurf does it in just 74MB.                   if ever, but the end result could be faster,
   We opted to build NetSurf 3.3 from                 Of course, none of this matters if the       more stable and more secure – especially
scratch, but the documentation inside              layout engine is pants, but NetSurf is by       on smartphones and tablets. For more
the source tarball described a rather              far the best on test here. It has problems      information, including access to the source
complicated procedure that ended                   with some complex sites and struggles           code, visit the project’s website at www.servo.
up retrieving the latest code from the             with certain layouts, but for the most part     org. As soon as Servo is ready for day-to-day
project’s Git repository and compiling that        it does a decent job handling HTML and          use, we’ll give it a thorough going-over in
instead, so we ended up with a NetSurf 3.4         CSS – far better than Dillo. We had little      Linux Voice.
development snapshot.                              luck getting JavaScript-heavy websites
   Once built, NetSurf’s 5MB binary started        to work, but those sites that scaled
up in less than a second, presenting               gracefully for non-JS-enabled browsers
an attractive GTK interface. We were               were mostly usable.
happy to find that most commonly used                 We’ve become big fans of NetSurf: it’s
keybindings had been implemented – eg              by a long shot the most promising non-
Ctrl+L to switch to the address bar – but          Gecko/WebKit/Blink browser out there, and
some behaved oddly or didn’t work at all.          while it still falls apart on very complex
                                                   pages, for most text-centric sites it’s fast,
Hey, good lookin’                                  reliable and a joy to use. Oh, and it’s a
NetSurf’s features include bookmarks,              great choice on the Raspberry Pi.
address bar history, page source viewing,
popup and ad blocking, Do Not Track                  VERDICT
                                                     As close to a Firefox as
header sending, and proxy server support             you’ll get, but using a                       Servo currently runs on Linux, Mac OS X, Android
– so it’s a well-featured lightweight                fraction of the RAM.                          and Firefox OS.
browser that provides the bulk of



                                                                      www.linuxvoice.com                                                           53
     GROUP TEST LIGHTWEIGHT WEB BROWSERS


ELinks vs W3m
Kings of text mode go head-to-head.


E
          Links is a derivative of the Links
          browser (which dates back to
          1999), and packs an impressive
amount of functionality given the
limitations of text mode. The project is
currently seeing very little development,
though; the last stable release arrived in
2009, and most distros are using the
0.12pre6 development snapshot which
is still rather old (October 2012).
   The browser’s most notable feature
is its menu-driven interface. Hit G to
open a URL dialog box, and F10 or Esc
to show the menu bar at the top, then
navigate through it using the cursor
keys. This use of menus and dialogs
makes ELinks feel to some extent like
a graphical browser – albeit without
any pictures. The Options Manager
(under the Setup menu) illustrates just
how capable the browser is, providing
a wealth of options for for handling
bookmarks, cookies, MIME types and             By default, ELinks doesn’t display any colours; go to Setup > Terminal Options to fix this.
the user interface.
   ELinks supports tabbed browsing a           however, handles complex layouts far                            but most distros still include that old
smattering of CSS and JavaScript (if           better than Lynx, and does a decent job                         release. Still, it’s not all doom and
SpiderMonkey support is compiled in),          trying to get colours right as well.                            gloom: W3m is up there with ELinks
and the ability to edit text boxes in an                                                                       in terms of its HTML layout engine,
external editor – a lovely feature if you      The W3m alternative                                             rendering some websites even better
want to do all your text poking work in        W3m provides some healthy                                       (but falling slightly short on others).
Vim. Performance-wise it’s OK, using           competition to ELinks, but it also suffers                         W3m is less accessible than ELinks in
16MB of RAM to render the Wikipedia            from a sluggish pace of development                             that it doesn’t have a familiar menu-
page for Linux, although we found it           – its last stable release was in January                        driven interface. Instead, you tap O to
sluggish when testing on a Raspberry           2011. Since then there have been a                              open a new website (ie enter a URL),
Pi compared to Lynx and W3m. Elinks,           couple of minor forks and patch sets,                           and B to go back in your history. Like
                                                                                                               Elinks, W3m supports tables, frames,
                                                                                                               SSL connections and other essential
                                                                                                               browsing features – but no JavaScript.
                                                                                                                  Memory-wise, W3m is a stellar
                                                                                                               performer, consuming just 11MB with
                                                                                                               the Wikipedia Linux page loaded. On
                                                                                                               the whole, both browsers are very close
                                                                                                               in terms of overall features and layout
                                                                                                               engine capabilities, but ELinks just takes
                                                                                                               the lead with its user-friendly interface
                                                                                                               and support for a limited subsection
                                                                                                               of JavaScript, though W3m has the
                                                                                                               advantage of lower memory usage and
                                                                                                               slightly faster page rendering.

                                                                                                                VERDICT
                                                                                                                ELINKS User-friendly   W3M Up there with
                                                                                                                and feature-packed –   ELinks in terms of its
                                                                                                                the best text mode     layout engine, but
                                                                                                                browser you can get.   harder to learn to use.

W3m has a GUI-like options screen, but we prefer ELinks’s menu and dialog-driven approach.



54                                                               www.linuxvoice.com
                                                                                      LIGHTWEIGHT WEB BROWSERS GROUP TEST



  OUR VERDICT
Lightweight browsers
S
       o, after examining six                   makes a lot of sense. They load
       lightweight web browsers                 pages quickly, use hardly any RAM
       that all eschew the popular              in comparison, and are way more
Gecko and WebKit/Blink/KHTML                    suited to low-spec devices such as
rendering engines in favour of their            the Raspberry Pi.
own home-brewed ones, what have                     So what’s the winner? For the
we learnt? Well, one thing is clear:            graphical browsers, it’s NetSurf by           NetSurf provides a browsing experience close to Firefox and
none of them are full-time                      a long shot. Its rendering engine             Chrome, albeit with a few issues on some complex pages.
replacements for Firefox or Chrome.             occasionally leaves a lot to be
But that’s not a bad thing. Different           desired, but it’s still way ahead of
tools should be used for different              Dillo and Amaya and usable on most             1st NetSurf
jobs – Vim is awesome for                       websites that we tested. Plus, it’s
programming, but for writing a                  undergoing active development and              Killer feature Rendering engine
shopping list you’re more likely to             we can hopefully expect a 3.4 or 4.0           www.netsurf-browser.org
use Nano. Gimp has oodles of                    release in the near future.                    Provides the bulk of functionality you expect in a browser, and
features for professional image                     Over in text-mode land, ELinks             handles simple sites with aplomb (and using little RAM).
processing, but if your kids want to            takes the crown here thanks to its
draw a picture, then TuxPaint is the            menu-driven interface, rudimentary             2nd ELinks
far better choice.                              JavaScript support, and impressive
   That’s how we should look                    rendering capabilities given the               Killer feature GUI-ish design
at these browsers. Firefox and                  restrictions of text mode. It’s                http://elinks.or.cz
Chrome may be the most sensible                 sometimes a bit sluggish on the                Impressively feature-rich for a text-mode browser, and a great
choices for browsing complex                    Raspberry Pi, pausing for several              help when you’re SSHed into a box and need to browse the web.
websites packed with CSS effects,               seconds when loading large
JavaScript, HTML 5 media, plugins               pages – an area where W3m does                 3rd W3m
and so forth, but they’re heavy                 better (and also in memory usage).
beasts with a big attack surface                Indeed, W3m renders some pages
                                                                                               Killer feature Speed daemon
for security vulnerabilities. For light         even better than ELinks, so it’s worth         http://w3m.sourceforge.net
browsing of text-oriented sites such            keeping both around, although                  Ultra fast and lightweight, W3m is a superb alternative to ELinks
as Wikipedia and Reddit, using one              it takes more time to learn its                and renders some sites even better.
of the browsers in this Group Test              keybindings and general operation.
                                                                                               4th Dillo
   NetSurf is way ahead of Dillo and
   Amaya and usable on most websites                                                           Killer feature Active development
                                                                                               www.dillo.org
   that we tested                                                                              Lags behind NetSurf in terms of its layout engine, but the next
                                                                                               release should be a huge improvement here.


  Browse without a web browser                                                                 5th Lynx
  Believe it or not, you can browse the web     to a website, it usually connects to port
  without even using a web browser. Well,       80 and says “Hey, send me some HTML            Killer feature Ultra maturity
  when we say “browse” we mean you can          please”. Try this:                             http://lynx.invisible-island.net
  view the HTML source of a website. And        telnet lynx.invisible-island.net 80
                                                                                               It’s as old as the hills and supremely reliable, but can’t compete
  you can’t follow links unless you type           A few lines of text will appear. Type in    with ELinks and W3m on complex websites.
  them in manually. And don’t even think        this, pressing Enter twice afterwards.
  about CSS or JavaScript...                    GET / HTTP/1.0
     But still, it’s a fun trick. Every Linux      A bunch of HTTP header lines will           6th Amaya
  and Unix flavour includes a command           appear followed by the HTML source for
  line tool called Telnet, which establishes    the Lynx website. There you go – you are
  a connection on a remote machine on           “browsing” using nothing more than a           Killer feature Page editing
  a specific port, and then sends textual       tiny tool included with every Unix-ish OS      www.w3.org/Amaya
  data to it. When a web browser connects       out there.                                     Very glitch-prone on s Linux distros, but could be a useful
                                                                                               website editor if the bugs were fixed.



                                                                          www.linuxvoice.com                                                                        55
     SUBSCRIBE




Subscribe
shop.linuxvoice.com
                                                                          Introducing Linux Voice,
                                                                          the magazine that:
                                                                            Gives 50% of its profits
                                                                          back to Free Software
                                                                            Licenses its content
                                                                          CC-BY-SA within 9 months

                                                                          12-month subs prices
                                                                          UK – £55
                                                                          Europe – £85
                                                                          US/Canada – £95
                                                                          ROW – £99

                                                                          7-month subs prices                              DIGITAL
                                                                          UK – £38                                         SUBSCRIPTION
                                                                          Europe – £53
                                                                          US/Canada – £57
                                                                                                                           ONLY £38
                                                                          ROW – £60




        Get many 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.


56                                                         www.linuxvoice.com
                                                                                                                                         NEXT MONTH



                           NEXT MONTH IN



ON SALE                                                                                   EVEN MORE AWESOME!
 THURSDAY
                                                                                                                                             MariaDB
28 JANUARY                                                                                                                                   It’s the database
                                                                                                                                             that’s powering an
                                                                                                                                             increasing number
                                                                                                                                             of sites in an
                                                                                                                                             increasing number
                                                                                                                                             of distros. Learn its
                                                                                                                                             ways and harness its
                                                                                                                                             awesome power!

                                                                                                                                             Cloning
                                                                                                                                             No, not Dolly – we’re
                                                                                                                                             talking about cloning
                                                                                                                                             machines over a
                                                                                                                                             network, whether
                                                                                                                                             that’s in a big
                                                                                                                                             business or just
                                                                                                                                             helping your dad out
                                                                                                                                             with his laptop.

                                                                                                                                             OnlyOffice
                                                                                                                                             Easy cloud email,


SNOOPER’S CHARTER
                                                                                                                                             calendaring and
                                                                                                                                             document sharing,
                                                                                                                                             untainted by the
Or: why the government is wrong to even                                                                                                      grasping fingers of

attempt to implement mass surveillance on                                                                                                    Google’s advertising
                                                                                                                                             wallahs. Sounds
its subjects. Free Software to the rescue!                                                                                                   good to us.




       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, 2nd      Anything in this magazine may not be
andrew@linuxvoice.com            All code printed in this magazine is licensed   Floor, 5 Churchill Place, Canary Wharf,       reproduced without permission of the
Technical editor Ben Everard     under the GNU GPLv3                             London, E14 5HU                               editor, until August 2016 when all content
ben@linuxvoice.com                                                               Tel: +44 (0) 20 3148 3300                     (including our images) is re-licensed
Editor at large Mike Saunders    Printed in the UK by                                                                          CC-BY-SA.
mike@linuxvoice.com              Acorn Web Offset Ltd                            Circulation Marketing by Intermedia Brand     ©Linux Voice Ltd 2015
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                                                                                  57
     FOSSPICKS




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

               Out benevolent editorial overlord Graham Morrison tears himself away
               from updating Arch Linux to search for the best new free software.
Network monitor


Wireshark 2.0
W
           ireshark has been around            hundreds of different protocols, and                                            Getting to grips with Wireshark
           for long enough to                  it can even decrypt protocols such                                            has never been easy, but like
           become both an                      as Kerberos, SSL/TLS, WEP and                                                 amateur astronomy, the easiest
exceptional security privacy tool              WPA2. As long as digital data                                                 way to start is to first take a look.
and a prerequisite installation for            passes between two devices,                                                   On most systems, this that means
any system administrator. It gives             Wireshark will be able to capture                                             that part of the installation needs
you the ability to take a deep dive            and interpret the data, presenting it                                         root access to be able to listen to
into the packets travelling across             as a contextualised list waiting for                                          your computer’s various network
your network (or more accurately,              your filters and analysis.                                                    hardware. The recommended
through the device that Wireshark is              Wireshark 2.0 is a major update                                            method is to isolate these privileges
connected to), letting you analyse             that has been brewing for some                                                to /usr/bin/dumpcap, usually by
them for things like their type and            time. In particular, there’s a new                                            adding your user to the wireshark
content, as well as their timings,             user interface built around Qt to                                             group after installation.
sources and destination. It                    strengthen its cross-platform
understands the innards of                     credentials.                                                                  Across the wire
                                                                                                                             Wireshark ’s power comes from the
                                2                                                                                            filtering mechanism, and while its
                                                                                                                             incredible control does come from
        1
                                                                                                3                            writing expressions to describe
                                                                                                                             what you want to see, you can get
                                                                                                                             close by selecting a packet and
                                                                                                                             using its attributes to create a new
               5                                                                                                             filter, or by using the ‘Expression’
                                                                                                                             button. This opens a huge window
                                                6
                                                                                                                             full of protocol specifics and
                                                                                                                             relationship filters so you can zone
                                                                                                                             in on specific protocol packets.
                                                                                                                                 It’s complex but also wonderfully
                                                                                                                             educational – a rare thing where
                                                                                            4                                you get to see network theory in
                         7
                                                                                                                             action, like an electron microscope
                                                                                                                             capable of real-time feedback from
                                    8
                                                                                                                             an Ethernet connection. Enter http.
                                                                                                                             content_type == “audio/ogg” to see
                                                                                                                             yourself download our latest
                                                                                                                             podcast, for example, but you could
                                                                                                                             also use the ‘Find Packet’ function
                                                                                                                             to look for specific ASCII strings
 1 Packet Capture Wireshark can work on a pre-recorded buffer of data or capture data live. 2 Analysis Use these menus
                                                                                                                             within a packet, all without knowing
to view statistics, run LUA scrips and see A–B conversations. 3 Filter Wireshark’s power comes from its ability to focus
                                                                                                                             anything about networking.
on the packets of most interest. 4 Expression Filtering is done with expressions, which can be built using the point-and-
click list of protocols. 5 Packet list The timeframe, source and destination address of each packet. 6 Protocol Packets
are coloured according to protocol. For example, green for HTTP; black for errors; violet for TCP. 7 Packet details Select
                                                                                                                              PROJECT WEBSITE
a packet to see its metadata. 8 Packet contents Like a Hex editor, you can see the contents of a packet and even decrypt
                                                                                                                              https://www.wireshark.org
certain protocols.



58                                                                     www.linuxvoice.com
                                                                                                                               FOSSPICKS


Oscilloscope


Xoscope 2.1
W
            e have very fond               directly, as well as more
            memories from the late         professional sensors if you want to
            80s of first getting hold      take it further, and it enables you to
of an audio sampler for the Amiga          do all the things we used to do.
500. We also had days of fun with             If you’re very careful, you can
tools like Aegis Audiomaster II, which     even use it to monitor real changes
visualised the shape of the audio          in voltage on the audio inputs, but
being digitised, just as you view          you can easily destroy your
changes in voltage with an                 hardware if you monitor voltages
oscilloscope. Try to whistle a sine        above those tolerated by your
wave, for example, or see what             inputs, so we’d recommend sticking
happens when you whistle up or             with audio. As most distributions
down an octave, or introduce other         use PulseAudio for talking to their
                                                                                    As well as audio inputs,
shapes and waveforms. It’s                 audio hardware, you may need to                                      but you may also need to specify
                                                                                    Xoscope can use what
immediate and addictive, and               disable or pause it before launching     are known as ‘Comedi’       which audio device to use with the
because these changes in audio are         Xoscope. We found that running           sources for input data,     -A hw:0,0 argument. With audio
analogous to changes in voltage,           pasuspender -- xoscope -D ALSA           such as analogue digital    entering an input or a microphone,
it’s teaching you about circuit            worked with our laptop hardware,         converters.                 you should be able to see the
design too.                                                                                                     oscilloscope bounce along to the
    Of course, you can still use an
oscilloscope to visualise audio
                                              You can even use Xoscope                                          input and experiment with the
                                                                                                                sounds.
today, but it’s not worth spending            to monitor real changes in
money on. Which is why Xoscope is                                                                                PROJECT WEBSITE

so interesting. It connects to ALSA           voltage on audio inputs                                            http://xoscope.sourceforge.net




File management


Midnight Commander 4.8.15
A
          generation of Unix geeks            Over its long history, there have
          have relied on Midnight          been various maintainers and
          Commander to make file           developers, periods where there
management on the command line             was little progress and periods
a little more intuitive. It takes one of   where MC has flourished. It’s
the best reasons for using a               currently flourishing, which is why
graphical desktop – a point and            we couldn’t wait for a major release
click interface in which files and         update to cover a new version in
folders can be visually manipulated        these pages.
– and transports the same                     One update follows another, and
functions to an easily navigable           Midnight Commander is still going
command-driven interface.                  from strength to strength, from
   The idea first coalesced as the         Samba support and Python APIs, to
orthodox file manager in the early         spellchecking, search and Zip, Rar,
90s, where this kind of functionality      ARJ, and Tar handling. It’s quick
                                                                                    Whether you’re using
was a necessity on DOS machines            and requires very few resources,                                     how to use most of its functions, as
                                                                                    SSH or a Terminal
without command histories and              other than the libraries for all this    running on your             it works just like any other file
auto-completion. But when so               added functionality. You can Tab         desktop, little can touch   manager, just with the added
many of us run low-powered                 between two locations and use the        Midnight Commander          advantage of running from the
machines, or low-end servers, its          Ctrl+number menus to invoke              for its power and           command line.
Bash-friendly interface and                functions. It’s impossible to do mc      flexibility.
graphical style make it just as            justice here, but the best thing                                      PROJECT WEBSITE
                                                                                                                 www.midnight-commander.org
important today.                           about it is that you already know



                                                                www.linuxvoice.com                                                                59
     FOSSPICKS


Movie player


mpv v0.10.0
M
            player has been around       offering every feature under the
            for a long time. Wikipedia   sun. Launch the application and
            says since the year 2000,    drag a media file into the window.
but it feels longer to us. We            That’s all there is to it. There are no
remember using it alongside Xv to        menus and the transport controls
display images back when icons           only appear after you move the
were chunky and colourful. All           mouse into the lower section of the
those years of development haven’t       window or screen. This is because
made Mplayer any prettier, but it’s      you interact with the player using
                                                                                   The company behind
still one of our favourite tools for     the keyboard – cursor keys to seek,                                   remote or used from an external
                                                                                   the Plex media player
no-fuss, rock-solid playback.            for instance, brackets for changing       has just hired the main     keyboard. In common with its
   Mpv is a fork of the venerable        playback speed, and numbers for           developer behind mpv,       Mplayer roots, mpv’s command line
Mplayer, a fork created to enable its    contrast, brightness, gamma and           and is now basing its       interface is far more powerful than
developers to remove much of             saturation. It’s a distraction-free       entire product around it    its simple playback window would
what they called Mplayer’s cruft,        player with high-quality playback,        rather than using the       suggest. Typing mpv --list-options
“features which stopped making           which is exactly what you need.           competing Kodi player.      | wc to count the number of lines of
sense 10 years ago”, and by giving       Mpv is quick and powerful and its                                     options in the latest version
them the ability to add many             keys can easily be remapped to a                                      returned 454, which is a colossal
modern features without having to                                                                              number and far more than we can
worry about fitting in with the
original project. The result is a
                                            Mpv is a distraction-free                                          even abbreviate here. We highly
                                                                                                               recommend you take a look!
brilliant movie player that focuses         movie player with high-                                             PROJECT WEBSITE
on the basics – playing moving
media without worrying about                quality playback                                                    http://mpv.io




Audio System


PulseAudio 7.1
T
         his is a major release of the   Even a normal user has to wade
         audio subsystem used by         through PulseAudio’s brain numbing
         nearly every Linux              nomenclature.
distribution, with 7.1 coming just
weeks after 7.0 to fix a few bugs.       A maze of configuration
This means that most users aren’t        The changes for each release are a
going to notice any differences.         good example of this complexity.
   PulseAudio remains incredibly         The big addition for 7.0 was ‘LFE
                                                                                   Support for LFE channel
stable, and we’ve had much better        channel synthesis with low-pass           synthesis means you’ll      too, including improved ‘jack’
luck with the new version talking to     filtering’, for example. It sounds        finally hear the sound of   detection. This initially got us
old ALSA applications or Jack.           complicated, but all that happens is      a Death Star imploding.     excited, because PulseAudio doing
Most users don’t want to mess            that your bass speaker will now                                       more to help Jack would be a good
around with virtual mixers, or edit      work properly, if you happen to use                                   thing. However, this isn’t the right
init scripts, or close processes that    one. Rather than sending all the                                      kind of Jack: PulseAudio is now
are already using your audio             audio to a speaker that’s only                                        more aware of hardware that can
hardware.                                capable of playing back sounds                                        detect when speakers or
   This is exactly what PulseAudio       below a certain low frequency,                                        headphones are connected to their
delivers the vast majority of the        PulseAudio will now filter out the                                    ‘jack’ ports, allowing your audio
time, which is why so many               bits the speaker can’t play and send                                  playback to switch automatically.
distributions use it. But if it shares   only the bits it can. This will improve
one thing with Systemd, its sister       the audio quality on speakers that                                     PROJECT WEBSITE
project also developed by Lennart        don’t filter the sound themselves.                                     www.freedesktop.org/wiki/Software/
                                                                                                                PulseAudio
Poettering, it’s over-complexity.        There are lots of smaller changes



60                                                             www.linuxvoice.com
                                                                                                                          FOSSPICKS


Simple VPN


sshuttle 0.72
O
         ne of SSH’s best feature is       But there are some limitations
         that you can use it as a        with SSH’s SOCKS implementation.
         simple SOCKS proxy server       SOCKS isn’t always supported, for
to tunnel network requests from          instance, and you may need admin
one machine through the internet         permissions at location B, which
connection of another. This means,       isn’t always possible. Plus the
for example, you can access sites        performance of SOCKS through
that are geographically restricted       SSH isn’t great. Which is where
from location A by connecting to an      sshuttle comes in. It’s a more
SSH server in location B, where          functional VPN without any
those sites are available. As your       complications or dependencies – it
                                                                                Don’t tell anyone, but
web requests and pages travel            doesn’t even need to be installed on                              GitHub (git clone git://github.com/
                                                                                there’s a rumour that
through SSH, they’re also encrypted      the server at location B, only an      sshuttle’s DNS routing     apenwarr/sshuttle). Now simply
between locations A and B.               SSH account. On the client (location   can bypass                 run the following command:
   All you need to do to enable this     A), just make sure you’ve got          geographical               ./’sshuttle --dns -vvr user@
magic is type ssh -D 8080 user@          Python installed and either install    restrictions in services   locationb 0/0’. You’ll be asked for
locationb from location A, changing      the sshuttle package if available or   like Netflix.              your local password to get sudo
the port number if this doesn’t          download the latest version from                                  access and the remote SSH user’s
work. On your location A machine,                                                                          password, if you use one, but after
you then need to either configure
your connection to use location B
                                            sshuttle is a more functional                                  that your VPN is up and running
                                                                                                           without any further configuration.
as a SOCKS proxy, or use your               VPN with no complications                                       PROJECT WEBSITE
browser’s Advanced settings to
configure SOCKS for web browsing.           or dependendencies                                              https://github.com/apenwarr/sshuttle




Note taking app


Cherrytree 0.35.11
A
         pplications that help you       adding this context as easy and as
         make and manage your            transparent as possible, while
         own notes are a little like     giving you lots of control over how
word processors. They’re incredibly      your notes look and are retrieved.
useful, and can easily become an
essential part of your workflow, but     Order, order!
they’re difficult to get excited about   Like the filesystem on our
and require discipline to use            computers, your notes are
effectively.                             organised in a hierarchical tree of
   But they’re genuinely worth the       nodes. You might create one for a
                                                                                Cherrytree also supports
effort, especially when you’re           specific magazine issue, for                                      used to represent nodes, for
                                                                                a huge number of
working on large or complex              example, or for college years and      import formats for         example, and replace them with
projects. Students, for example,         then a course.                         bringing in your           simple bullets, and you have
often make hundreds of different            Notes can be entered into the       collection of notes.       complete control over colours and
notes across many different              text editor for both the nodes that                               font sizes.
subjects and durations. For those        act as folders and for the nodes                                    You can choose to export a
notes to mean anything, they need        themselves. The text editor has                                   specific node or sub-nodes, for
to have context and be useful            excellent syntax highlighting, list                               instance, and output formats
during revision, and the same            and image embedding, and                                          include HTML, text, PDF and as an
principle applies to large projects or   HTML-styled markup. There’s also                                  HTML-styled table of contents.
even putting a magazine together.        plenty of control over how the
Cherrytree is a note-taking              application appears – you can                                      PROJECT WEBSITE
                                                                                                            http://www.giuspen.com/cherrytree
application that attempts to make        remove the muticoloured cherries



                                                             www.linuxvoice.com                                                                    61
     FOSSPICKS


Remote shell access


Shellinabox (unofficial fork)
I
     nitially, the thought of being able   default settings from /etc/default/
     to execute shell commands             shellinabox or /etc/sysconfig,
     from a web interface may seem         especially as you can limit access
like a bad idea. Most of us would          by IP address. This is the best
immediately think of the security          option, as the daemon will have the
implications. But it’s also a very cool    correct privileges to access local
idea and there’s a useful niche for        and remote servers – you can even
something like this, especially when       use a local instance to connect to
placed on any number of devices            any remote SSH server. You can
running in your home or behind any         provide local access to your own
firewall.                                  account with shellinaboxd -t -s
   At its best, Shellinabox is really a    /:AUTH:HOME:/bin/bash.
glorified SSH client, but with one            With the daemon running, you
important difference. Rather than          can now point a web browser at
requiring a shell or a terminal to         your machine’s IP address, or
access all the loveliness of SSH, all      https://localhost:4200 for local
                                                                                      Install Shellinabox and
you need is a web browser and              access. 4200 is the default port                                      for example, if it complains too
                                                                                      get lovely terminal
Shellinabox running somewhere you          unless you change this from the            goodness from anything     loudly, or SSL can be disabled by
can access. Installation onto that         configuration file, and Shellinabox        with a web browser,        adding the -t argument when you
‘somewhere’ is very straightforward.       does run through SSL so that data          from games consoles to     launch the daemon.
Grab and install the package and           between your browser and the               mobile phones.
most distributions will install an init    server is encrypted with a self-                                       PROJECT WEBSITE
script to launch the daemon at             signed certificate. You’ll need to                                     https://github.com/shellinabox/
                                                                                                                  shellinabox
boot. You may want to edit its             add an exception to this in Firefox,


RSS reader


FeedReader 1.4
L
       ike many people, we relied on       product and has the advantage of
       Google’s now-defunct cloud          being completely private to your
       RSS feed aggregator. It             OwnCloud account and installation.
enabled you to easily accrue                  There are also a considerable
automatic updates for sites on             number of standalone applications,
subjects you cared about, and its          but once you’ve got used to cloud
simple categorisation and                  synchronisation across multiple
hierarchical organisation meant you        devices, it’s difficult to go back to an
could easily keep abreast of 1000s         offline RSS reader. Which is why
of updates a day. For anyone               FeedReader is so good. It connects
working in the field of technology, it     to an online service and allows you
                                                                                      RSS aggregation is still
was the only way of sifting the            to browse your feeds, feeling very                                       It’s a great alternative to the web
                                                                                      alive and well thanks to
inconsequential from the important.        similar to Google Reader. It works         great applications like    interface and is even preferable for
   With the possible exception of          exactly how you’d expect it do, and        FeedReader                 us, despite OwnCloud’s News app
Feadly and some of the clients that        the HTML rendering is excellent.                                      improving solidly since its release
can access its API, the closest            Feedly is supported and works well,                                   close to the end of Google Reader.
alternative we’ve found to Google          but more importantly, the latest                                      FeedReader is also a fully fledged
Reader is the News app for                 release also adds support for                                         Gnome application and takes
OwnCloud. This enables you to add          OwnCloud, letting you connect the                                     advantage of the new design
RSS aggregation and browsing               client to your own server with the                                    minimalism, which we like.
from a browser session connected           News app installed and access
to your own OwnCloud account. It           your RSS feeds just as you would                                       PROJECT WEBSITE
                                                                                                                  https://jangernert.github.io/feedreader
looks very similar to Google’s             from a third-party site like Feedly.



62                                                               www.linuxvoice.com
                                                                                                                            FOSSPICKS


  FOSSPICKS Brain Relaxers
https://launchpad.net/pybik/
 Space trading


 Endless Sky
 L
          inux may not (yet!?) have     are all accurately pre-rendered and
          David Braben’s Elite/         lit according to the position of the
          Frontier sequel, Elite        sun, although distances and
 Dangerous, but it’s got a few great    alignment are complete fantasy.
 alternatives for lovers of space       Like Asteroids, your ship has its own
 trading and strategy. Endless Sky      inertia that you need to control
 is the latest we’ve found, and         while trying to target other craft or
 while it’s available on Steam, it’s    land on a new planet.
 also open source and hosted on             You pop into and out of the
 GitHub, and available as binary        background as you find places to
 packages for all the popular           land, as do other craft controlled by
 distributions. The only slight hitch   AI. The game mechanic relies on
                                                                                Imagine what would
 is that it requires OpenGL version     trading, completing missions and                                    through menus buying inventory
                                                                                happen if you could take
 3.0 or higher, which means you’ll      exploring, although combat is never     your ship out of the        and travelling around the system,
 need a graphics card capable of        far away. The missions themselves       arcade classic Asteroids,   and we’d suggest it may be ideal
 more than legacy drivers.              usually involve delivering              and use it to fly, trade    for younger people as they can
    The game itself isn’t visually      something from one place to             and fight – that’s          learn a lot about buying, selling
 demanding, relying instead on          another for a payment, and with the     Endless Sky.                and trying to make money while
 static text and illustrations and a    money you earn you can upgrade                                      having a great deal of fun in a
 real time Asteroids top-down view      your ship and hire people to help                                   wonderful environment.
 of your spaceship as it travels        you. Endless Sky reminds us of a
 from one system to another. It         text-based game for Palm OS called                                   PROJECT WEBSITE
                                                                                                             https://endless-sky.github.io
 still looks great, and the planets     Space Trader, where you shuffle




 Real time strategy


 Wyrmsun 1.7.0
 I
     t’s widely accepted that the       building the open source version,
     idea of harvesting limited         and the scenarios, characters and
     resources to build your            maps are also particularly well
 defences and attack some foe           thought out.
 across a hidden map started with           The graphics themselves stay
 the 1992 game Dune II. That            true to the retro feel of the genre,
 game was incredibly addictive,         with a top-down view that will feel
 but it’s still surprising that         familiar to Rogue players. Like
 something relatively complex           Rogue, many of the quests are
 could lead to such a popular           constrained to corridors and rooms
 genre, and one that’s still            within buildings, with a fog of war
 spawning new games today –             lifting as you walk to reveal more
 such as Wyrmsun.                       details on the map. This is different
                                                                                Open source takes on
    What makes Wyrmsun different        to the open world of most similar                                   skills to unlock, all of which can
                                                                                Steam with a great real
 is that it’s both a commercial         games and reminds us more of            time strategy game          be used as upgrades within the
 game on Steam (currently priced        Warcraft than the original real-time    that’s available to buy     game. For the price, it’s brilliant,
 at £3.99) and an open source/          strategy games. It means you pull       and to tinker with.         and considering it’s also open
 GPL game in its own right. The         your comrades through each level                                    source, highly recommended.
 commercial aspect in particular        as an adventurer rather than a
 means the game is already at a         strategist.                                                          PROJECT WEBSITE
 high standard of both gameplay             There are quests for different                                   https://github.com/andrettin/
                                                                                                             wyrmsun
 and graphics, even if you’re           races, with technology trees and




                                                             www.linuxvoice.com                                                                    63
                                                                                                                       INTRO TUTORIALS




TUTORIALS
Warning: excessive Linux knowledge may lead to fun and more efficient computing.

                                                In this issue . . .
                                                                                             66                                                     68




Ben Everard
is never happier than when he’s prying open a
box and reprogramming the gubbins inside.
                                                Repurpose your old                                      Create beeps and
                                                Android smartphone                                      beats with Ardour

T
           his month I’ve been working          Do you have obsolete hardware sitting around in a       Graham Morrison creates and records the latest
           with a lot of small embedded         drawer? Ben Everard did until he found new ways         in his series of Aphex Twin tributes with 99% open
           devices, both in the smart           to make these old machines live again.                  source software and 1% inspiration.
homes feature and in the tutorial on
reusing old Android phones. Yet again,
I’ve been reminded of the importance of
hackable devices. Most embedded
devices are closed off, and don’t allow
the user any option to meddle and
change their function. This might make
life a little easier for the manufacturer,
but they make things much worse
for users.                                      GPIO Zero                      72    If This Then That                76   RSS Processing                78
   The more control you have over a             Physical computing made easy.        If you follow this tutorial Then      Sharing on the internet
particular piece of hardware, the more          Les Pounder introduces the new       Ben Everard will show you how         without Facebook is possible.
uses you can put it too. In cases like a        GPIO library for the Raspberry Pi.   to make programs run online.          Marco Fioretti investigates RSS.
smart home, this gives you more
control of how you set up something as
important as your home environment.
In the case of an Android phone, this
                                                Coding
gives you the ability to repurpose your
hardware once you no longer need it for
its intended use. In all cases, it
empowers you to be a user of
technology rather than a consumer of
disposable devices, and that’s what we
should all be striving for.
   The more open a device is, the more
possibilities it has to make the world a        ARM Assembly                 84      SVG games                       88    Economic modelling part 2 90
better place, and this should be the aim        Mike Saunders turns his back         Make cross-platform games             Andrew Conway continue his
of all technology.                              on x86 PCs to get down and dirty     with Ben Everard’s guide to           voyage into the dark arts with
ben@linuxvoice.com                              with a mobile architecture.          interactive HTML 5 SVGs.              only free software to guide him.



                                                                  www.linuxvoice.com                                                                    65
     TUTORIAL ANDROID PHONES




ANDROID: REPURPOSE
YOUR OLD PHONE
Android devices are more than just phones and can live on in other guises.

   BEN EVERARD
                               H
                                          ow often do you replace your phone? For
                                          some people it's every year, but some people
                                          hang on until the device is completely dead
WHY DO THIS?                   before upgrading (every two years is about average,
• Reduce electronic waste      give or take six months). Whichever category you fall
  and save the environment     into, there's a pretty good chance that you've got one
• Make better use of the       or more old Android phones lying around the place no
  hardware you already own     longer being used. Even if you stubbornly refuse to
• Improve the security, look   replace a working phone, there's a good chance that
  or connectivity of your
  home                         you've got one with a dead and unreplaceable battery
                               that still works when the phone's plugged in.
                                  This mountain of unused phones is an untapped
                               resource, and it would truly be a shame if they were
                               left to rot. Instead, we're going to take a look at various
                               ways that you can still use your phone hardware
                               even when you no longer need it as a phone. After all,        Thieves beware: Linux Voice towers is protected by a
                               they're still little computers with a Wi-Fi connection, a     network of old phones.
                               camera and possibly a battery.
                                                                                             turn it into a webcam. You could use this for anything

     A phone is just a little computer with                                                  from security to a baby monitor to watching nature
                                                                                             (such as in a birdbox). You don't need a good screen
     a Wi-Fi connection, a camera and                                                        or battery for this (as you can leave it plugged in).
                                                                                             As long as the camera still works and the phone still
     possibly a battery                                                                      boots, you can convert it into a webcam.
                                                                                                There are quite a few apps for Android that will
                                 You may find that your phone refuses to work                convert your phone into a networked webcam, the
                               without a sim card in it. If so, you'll need to purchase      best of which (for our purposes) is IP Webcam by
                               a pay-as-you-go card and just put the minimum credit          Pavel Khlebovich. All you have to do is install the app,
                               on it.                                                        then open it and press Start Server. You'll see the URL
                                 Perhaps the most obvious thing to do with a small           of your web camera on the screen, so visit this on any
                               computer with a camera and a network connection is            other machine connected to the same Wi-Fi network.
                                                                                             On that webpage, you can create a video stream (just
                                                                                             click on one of the options for video to enable the
                                                                                             image). You can also schedule video capture, create
                                                                                             rolling captures and more. If the stream has too few
                                                                                             frames per second, you can downgrade the video
                                                                                             quality using the on-screen slider.

                                                                                             Getting the picture
                                                                                             Like many people, we find ourselves taking lots of
                                                                                             pictures, but hardly ever spend the time to look back
                                                                                             through them. This isn't like the good old days when
                                                                                             we took real pictures, the type that came back on
                                                                                             paper, the type you could put in a frame on your wall
                               Re-live your glory days by watching old photos on the old     or desk. If you've got an old Android phone with a
                               phone that you used to take them.                             working screen, you can relive those days by using it



66                                                              www.linuxvoice.com
                                                                                                  ANDROID PHONES TUTORIAL


as a digital picture frame. Even if the battery's dead,
you can keep it plugged in.
    As with the webcam, there are a bewildering
array of apps in the Google Play store to add this
functionality. Almost all of them will make a slideshow
out of the files you've got saved locally, and the better
ones will also be able to pull images from online
sources such as Facebook, Dropbox or Google Drive.
It's just a matter of finding one that has the features
you need and that isn't overloaded with adverts.
We found that Photo Frame Web by Jeroen Wyseur
worked well. After you've installed the app, you select
the source of the images and start the slideshow. For
an even more nostalgic experience, mount the old
phone inside a picture frame.
    Picture frames aren't the only way you can re-
                                                            Servers Ultimate: for when you want to turn a drawer full
purpose your phone as a internet-connected screen.          of old phones into a data centre.
You can use your old phone as a clock using any
one of the hundreds of clock apps. As with the photo
frame, the key here is finding a good-looking way to          Now that the devices are paired, you can select the
mount the phone so it doesn't look like an old phone        remote control option on your phone, and then the
lying around, but a stylish clock.                          phone acts as a touchpad for your computer. If you
                                                            need to enter text, you can hit the keyboard icon to
Seeking input                                               bring up the onscreen keyboard.
You can use an old phone as an input device for your
Linux computer using KDE Connect. Despite the name,         Serve yourself
this should work on most desktop environments               Phones are just small computers that are optimised
(although you will need to install the KDE framework        to use power efficiently, and this makes them perfect
in order to use it). You'll need the KDE Connect            for home servers. If there's any life left in the battery,
software installed on both your phone (from the             they even have an uninterruptable power supply to
Google Play store) and computer.                            keep your mini server humming even if mains power
   Once the software's installed, open the app on your      goes down.
phone, then on your Linux machine use the command              KWS is a simple and efficient web server for
kdeconnect-cli -l to find the devices. All devices have     Android. Just install it and hit Start Server to begin.
an associated ID that you'll need in order to connect,      There are a couple of useful options, including
and this is the alphanumeric string that should be          enabling directory listing and setting the home
listed by the above command. You can then use the           directory, but otherwise the defaults should be fine.
--pair option to connect the two devices together.          Performance on our test device (a Moto G) was
With our ID, this was done with:                            reasonable for text and HTML. Images and other
kdeconnect-cli --pair -d 3f01ca6d603c9c5b                   larger files were noticeably slower than the network
                                                            speed, but acceptable for light use.
                                                               Probably the most powerful server app for Android
                                                            is Servers Ultimate by Ice Cold Apps. This enables
                                                            you to run almost any type of server you can think
                                                            of, including common options such as HTTP and
                                                            FTP to more specialised options such as Git and
                                                            IRC. The chances are that if you need a server, this
                                                            app will be able to provide it on Android. You'll need a
                                                            rooted phone if you want to be able to run the server
                                                            on a normal port, but non-rooted phones can run
                                                            most servers on the higher port numbers if you wish.
                                                            Servers Ultimate is free for seven days, but if you want
                                                            to keep using it, you'll need the Pro version for £7.50 –
                                                            we think that's plenty of time to have a play with it and
                                                            make an informed decision.

As well as an input device, KDE Connect can be used to
                                                             Ben Everard plays with hardware for fun and is the co-author
share files and notifications between your computer and
                                                             of the excellent Learning Python with Raspberry Pi.
your phone.



                                                              www.linuxvoice.com                                            67
        TUTORIAL LLEARN TO SYNTH




   ARDOUR: SYNTH WORKSHOP
   Upgrade your hipster credentials with some bleeps, plops, pings and squelches.


                                    S
                                            oftware synthesizers,and the other lovely-                         But we've also had a couple of emails that asked
GRAHAM MORRISON                             sounding open source sound generators, are                      what should be an easy question to answer: “How do
                                            fully equivalent to the hardware devices that                   you actually get these software instruments to work?”
                                     typically cost hundreds and thousands of your local                    In formulating an answer, we quickly realised that it
   WHY DO THIS?
                                     currency. They’re playable, tweakable, configurable                    wasn’t easy at all; there’s a lot of assumed knowledge,
   • Create awesome sounds…          and powerful, and can be used as the central parts of                  big pieces of software to conquer and configurations
   • … without knowing               many different kinds of music. But synthesizers are                    to play around with. Almost the complete opposite to
     anything about sounds…          also a great deal of fun. After a decade in the geeky                  the switch-on-and-have-fun attitude we were
   • … then record a
                                     wilderness, they’ve started to become popular again                    describing. Which is why we’re going to tackle the
     masterpiece
                                     – forged into DIY cases, or wired into the storage of                  problem here by building an easy-to-use music/audio
                                     multi-buttoned Raspberry Pis. They’re instant,                         platform that will let you quickly play with synthesizers
                                     educational and entertaining. It's one of the reasons                  and audio effects without needing any prior
                                     we picked Sonic Pi as our educational tool of choice in                knowledge of how it works, or having any specialist
                                     a Group Test of software that teaches people to code.                  audio hardware.


     Overview of Linux Audio




                                      1

                                                                                                                          2




                                                                                                                                    3

                                                                                       8




                                                       5



                                                                                                                          4




      1 ALSA Even when using other audio layers, ALSA is still responsible for             easier to use with other audio software.
     talking to your audio hardware, and you can usually get ultimate control over          4 Jack Like a mixer in a recording studio, if you run ‘Jack’ you’ll be able to
     your input and output levels by installing the GTK Alsamixer.                         connect any Jack-supported audio destination with any source. It’s how Ardour
      2 Ardour We’ve used Ardour as the plugin host. It’s complex, like Blender, but       works in the background.
     powerful. If you want something simpler, Qtractor offers similar features.             5 Software synthesizer Many synths, like Helm here, will run as standalone
      3 PulseAudio Latest versions of PulseAudio will automatically pause when             applications, which is great for a quick play. But to record anything, they need
     something else takes control of ALSA, such as Ardour or Jack, making it much          to be paired with a host application.




   68                                                                     www.linuxvoice.com
                                                                                                 LEARN TO SYNTH TUTORIAL


1
    What is Linux audio?                                     2
                                                                 What are plugins?
The days of hunting down a wayward Macromedia                Most software synthesizers don’t run as applications.
Flash process just to get XMMS working are gone.             Instead, they’re installed as libraries and appear in
This is mostly thanks to PulseAudio, the overarching         host applications that support those libraries. This is
audio system used by the majority of distributions.          also true for audio effects. Synthesizers and effects
PulseAudio straddles the complete audio Linux audio          are called plugins because you plug them into your
stack, from the hardware up to the desktop. Before           existing environment (in the world of the recording
PulseAudio, ALSA was used to drive the hardware (and         studio, you really do plug these things in with cables).
ALSA’s hardware drivers are still used by the kernel).         Plugins are analogous to filters and processes you
ALSA would also speak to some applications, while at         use in graphics tools like Gimp, with a synthesizer
the same time, higher level sub-systems like artsD,          perhaps being more like a fractal generator, and an
Phonon, GStreamer or Xine would also battle for an           echo effect a little like a drop-shadow. The important
application’s attention. The result was usually silence.     point is that even after you’ve installed a plugin, you
PulseAudio has brushed these aside, and with the sole        won’t be able to use it without launching a host
exception of JACK, is now the only common Linux              application that knows how to find and open the
audio tool that talks to your hardware.                      plugin you’ve just installed.




3
    Libraries                                                4
                                                                 MIDI
There are lots of different plugin libraries for adding      The final piece in the puzzle of Linux audio is MIDI
synthesizers and effects, but there only three modern        support. MIDI is an ancient protocol that was used to
formats that you’re likely to come across. The first is      program synthesizers in the 1980s – think Vince
called ‘LV2’. This is the sequel to ‘LADSPA’, and it’s the   Clarke, long black cables and DIN sockets. MIDI
closest thing to a native open source format we have.        encapsulates musical elements such as playing a
The second common format is DSSI. This is used for           note, the speed that the key or note is hit (velocity) and
synthesizers because they don’t specifically process         any changes that occur while sounding the note, such
incoming audio, like an effect, but they respond to          as the pressure you apply to a key or sliders you
note information entering via MIDI or sometimes OSC,         move. Despite being designed for hardware, MIDI still
which is more advanced protocol for sending control          rules the software world too, with the protocol being
data. Finally, there’s the VST format. VST (Virtual          central to how you interact with desktop synthesisers.
Studio Technology) was developed by Steinberg in the         ALSA handles MIDI, and you don’t need a physical
1990s, and is by far the dominant plugin format for          MIDI keyboard to generate MIDI data. The easiest way
Windows. Linux users can run Windows VST plugins             is to install a virtual MIDI keyboard such as VMPK. This
under Wine, or more recently, native VST plugins built       sits on your desktop and turns mouse clicks and
against a Linux version of the VST library.                  Qwerty presses into MIDI note data. It’s the quickest
                                                             and easiest way to get up and running. If you ever get
                                                             Jack running, we’d also recommend jack-keyboard, as
                                                             it does the same thing without you having to worry
                                                             about MIDI devices: Jack handles everything.




                                                                 www.linuxvoice.com                                        69
     TUTORIAL LLEARN TO SYNTH


                  5
                      Introducing Helm                                        6
                                                                                  Create your own sound
                 We’re going to start with our favourite synth: Helm. It      None of the preset sounds in Helm are good at
                 sounds fantastic, but the best thing about Helm is that      teaching you how to create your own, so we’re going
                 it just works. After you’ve installed it (we used version    to start from scratch. If you're running Helm, you'll
                 0.50), you can launch it without worrying about MIDI         need to restart it to get the sound to an initial state,
                 or plugin hosts.                                             and you may need to restart from the command line.
                     By default, it will plug itself into ALSA connected to   Helm’s initial patch is a sine wave.
                 PulseAudio, and respond to keypresses on your                   You can see this when you play in the oscilloscope,
                 computer’s keyboard by playing a note – just make            and you can see the two oscillators that make up this
                 sure ALSA is the selected audio device type in the           sound in the top-left. Drag the small square to the
                 preferences panel that appears when you click on             right to change these to ‘Saw Up’. This is much more
                 Helm’s logo. We’d first recommend familiarising              suitable, because it contains harmonics we can work
                 yourself with the various sounds that Helm creates,          on with other parts of the synth. To fatten the sound,
                 which can be done using the preset browser. Open it          turn the ‘mod’ knob between the oscillators to the mid
                 by clicking on the preset name just to the right of the      point; this will mix the output from both equally, and
                 logo in the top-left. It opens a simple patch navigator,     slightly adjust the ‘Tune’ knob beneath one of the
                 and when you select a new patch you can play it with         oscillators. This will add a phased effect as the
                 your keyboard.                                               waveforms of each oscillator shift in and out of phase.




                  7
                      Enabling polyphony                                      8
                                                                                  Envelopes
                 Helm's default state is monophonic. This is great for        We’re now going to use the Filter Envelope to change
                 bass and lead sounds, but not so good if you want to         the cut-off frequency of the filter over time. First ramp
                 play chords. Look for ‘Voices’ in the ‘Articulation’         up Env Depth a little in the Filter section (this governs
                 section, bottom-right, and change the Voices value to        how much of the filter will be affected), then adjust the
                 5 or more. Because of the way the two oscillators are        ADSR values in the Filter Envelope. ADSR stands for
                 now driving in and out of phase for every note you’re        Attack (key down), Decay (the length of time it takes to
                 playing, you’ll get a rich string-like sound. We'll now      go from Attack to Sustain), Sustain (the level while the
                 filter out the high-harmonics, a process responsible         key is being held) and Release (the time it takes for the
                 for much of a synthesizer’s character. The filter            value to fade), and we’ve gone for A = 0; D = 0.2s;
                 section is in the middle of the window, and you need         S=0.15; R=1.5.
                 to select the waveform on the far-left. Now drag the           Finally, to add a lovely sparkle to your sound, enable
                 waveform to the left and up slightly to add a resonant       the reverb section. This will add a naturalistic acoustic
                 edge at the cut-off point. We’re now going to modulate       echo. You may also want to experiment with the delay
                 the cut-off point with the value of LFO 1. Do this by        section, or add a sub-bass element with the Sub
                 clicking on LFO 1’s Helm icon and click+dragging the         oscillator, although you should choose a Saw- or
                 horizontal slider beneath the filter waveform.               Square-based waveform to achieve the best effect.




70                                                www.linuxvoice.com
                                                                                               LEARN TO SYNTH TUTORIAL


9
     Getting sound somewhere else                           10
                                                                 Creating the tracks
We now need to start to consider recording the              At a minimum, we need to create two tracks – one for
output, or at least launching a synthesizer in an           handling the MIDI note data, and one for handling the
environment where other sounds can be added to.             audio that comes out of the synthesizer. You can do
This is where we need to run an audio host, and             this by right-clicking the background of Ardour’s main
there’s a quite a selection to choose from. At one end      window. Create a MIDI track first and you should be
of the scale, there’s Ardour, which is perhaps the audio    able to choose Helm, or any other DSSI synth you have
equivalent of Blender. It’s complicated and has a steep     installed as the instrument. This will load the
learning curve, but it’s capable of professional results.   instrument as the destination for this MIDI track, and
At the other end of the scale there’s something like        any other MIDI data coming into the application.
Radium, which is an old-style tracker with support for         Now create an audio track. Helm’s output is stereo,
all the best plugin and synth formats (including VST).      so you should choose that. Ardour will automatically
   We’re going to use Ardour, simply because we’re not      link the audio coming out of Helm into the input of the
afraid of its power (and because it no longer needs         new track you’ve created. Generate some MIDI input
Jack). Just install and launch. Select a New Session        or vertically expand the MIDI track and click on the
and make sure ALSA is selected as the audio                 notes to check. If no sound is generated, open
subsystem. This should work even if you have                Window > Audio Connections and make sure Audio In
PulseAudio installed and running, but you can also try      1 & 2 for your audio track are checked against MIDI 1
Jack if you like, as this is run automatically too.         L & R for the MIDI track.




11
     Add instruments and effects                            12
                                                                 Recording your masterpiece
You can open the synth’s control panel from either the      If you want to record what you’re playing, you need to
Mixer or by enabling View > Show Editor Mixer. This         first record-enable each track you want to save, and
will show the channel strip for the selected track, and     then press record in Ardour’s main transport bar.
when you select the MIDI track you’ll see that Helm is      Record-enabling a track with MIDI data will only record
listed as an insert at the top, above Fader. Double-click   the MIDI data – not the audio. This is highly useful, as
on the word to open the editor. You can add different       it lets you edit out mistakes in timing and pitch. You
effects or synthesizers to this insert point, although      can even create tracks in this way, using the pencil
we’d recommend creating separate tracks for                 tool on a vertically expanded MIDI track to program
separate audio generators. We added a new track for         the notes you want the synth to play. Audio tracks will
the Oxe synthesizer, for instance. Both outputs will be     record the audio input and can only be edited in the
mixed together, which you can see on the master             same way you edit audio files in Audacity.
channel of the mixer. The mixer view, Window > Mixer,           Being a multi-track recorder, Ardour can record
is perfect for changing the volume of each track, and       many tracks at the same time, and it will keep the
can even be used to replace a hardware mixer if all         audio separate until you mix them down into a single
you want to do is play around with the sounds and           file. This can be done by selecting Export > Export to
experiment with the synthesizers.                           Audio File from the Session menu.




                                                                 www.linuxvoice.com                                      71
     TUTORIAL EDUCATION




GPIO ZERO: HARDWARE
HACKING SIMPLIFIED
Programming logic meets cardboard and sellotape in our latest Python/Pi project.

   LES POUNDER
                            T
                                     he Raspberry Pi offers the RPi.GPIO library as
                                     part of its standard Python install and using
                                     this library we can bring physical computing
WHY DO THIS?                to life with sensors and motors etc. However, for
• Learn Python 3            those new to code the RPI.GPIO library can be a little
• Learn GPIO Zero           tricky to set up and use. Step forward the Raspbery Pi
• Control hardware using    Foundation and one of its key members, Ben Nuttall.
  the GPIO pins             Ben has worked with David Jones, of Picamera fame,
• Use programming logic     to create a library that performs similar to RPi.GPIO
                            but with less code and easier to understand. So let's
                            learn more about this library via a few projects that
                            will demonstrate how to use the library with LEDs
TOOLS REQUIRED
                            (Light Emitting Diodes), push buttons and sensors, all
• A Raspberry Pi running
  the latest Raspbian
                            leading to our final project where we build our own        Here we see the completed project constructed on a
  release                   burglar alarm system using a combination of very           breadboard, ready to alert us to a burglar or a dog.
• An internet connection    easy to source and cheap components.
• 6 x LED                                                                              LED for half a second before turning it off.
• 6 x 220Ω resistors        RPi.GPIO vs GPIO Zero                                      while True:
• Male–female jumper        RPi.GPIO was created by Ben Croston, and powers             GPIO.output(led_pin, True)
  cables                    the vast majority of Raspberry Pi hardware projects         time.sleep(0.5)
• Male–male jumper cables   across the globe. Originally written to help Ben use        GPIO.output(led_pin, False)
• A momentary switch        the Raspberry Pi to control his microbrewery, RPi.          time.sleep(0.5)
• A buzzer                  GPIO is now used in Raspberry Pi projects ranging             So the total number of lines of code required to
• Breadboard                in complexity from simple LEDs all the way to high         flash an LED on and off with RPi.GPIO is nine. Let's
• PIR sensor                altitude/space projects.                                   see how GPIO Zero compares.
                               RPi.GPIO requires the user to import the library, and      We start by importing the LED class from the GPIO
                            typically we rename it in our code to GPIO for ease        Zero library, and we import pause from the signal
                            of use. We also import the time library to control the     library – we’ll use that to keep the code active.
                            pace of our project.                                       from gpiozero import LED
                            import RPi.GPIO as GPIO                                    from signal import pause
                            import time                                                 Next we instruct our code that we have an LED on
                               Next we have to tell the project what GPIO pin          GPIO 17.
                            layout we're using.                                        red = LED(17)
                            GPIO.setmode(GPIO.BCM)                                       Lastly we use the blink function to handle turning
                                                                                       the LED on and off, and we end the code by using the
     For our first project with GPIO Zero                                              pause() function to keep our code active; without it
                                                                                       the project would blink once before ending.
     we'll do the 'Hello World' of hardware                                            red.blink()

     hacking – lighting an LED
                                                                                       pause()
                                                                                         With GPIO Zero it took only five lines of code, so we
                                                                                       saved four lines of code and skipped all of the GPIO
                              Next we create a variable to store the GPIO pin used     setup, which can be quite daunting for those new to
                            for our LED, before configuring that pin to be an output   the Raspberry Pi.
                            that will send power to the LED.
                            led = 17                                                   Setting up the software
                            Next we create an infinite loop, which will turn on the    We used the latest version of Raspbian for this



72                                                          www.linuxvoice.com
                                                                                                                 EDUCATION TUTORIAL


tutorial, which offers GPIO access for all users, and no
longer requires launching Idle with sudo. It also
features speed refinements to the overall operating
system that will make developing your project more
enjoyable. The latest version of Raspbian can be
downloaded from www.raspberrypi.org/downloads.
If you're using an older version of Raspbian you'll need
to launch Idle via the terminal, by typing.
sudo idle3 &
  Boot your Raspberry Pi to the desktop and open a
terminal; you can find a shortcut to the terminal in the
menu at the top-left of the screen. With the terminal
open we shall now install the dependencies for GPIO
Zero. Type the following into the terminal and press
Enter to install.
sudo apt-get install python-pip python3-pip python-
w1thermsensor python3-w1thermsensor python-spidev                 A Passive Infrared Sensor (PIR) is an affordable sensor to start your projects. It works
python3-spidev                                                    really well with the Raspberry Pi and is easy to use.
  With those installed, remain in the terminal and
type the following to install GPIO Zero using the pip             diagram over the page for how to lay out the
package manager for Python 2 & 3.                                 components. Components assembled, let's delve into
sudo pip install gpiozero                                         the code.
sudo pip-3.2 install gpiozero                                       Our first step is to import two libraries. Firstly we
   We'll be using the library for Python 3, but Python            import the LED class from the GPIO Zero library.
2 is available for those who wish to integrate it into            Secondly we import sleep from the time library.
existing projects.                                                from gpiozero import LED
   With that installed you can now close the terminal             from time import sleep
and navigate to the Programming menu, found in the                  We next create a variable called red, which will
main menu at the top-left of the screen. Click on the             contain the location of our LED, which is GPIO17.
Python 3 entry to load Idle. With Python 3 Idle open              red = LED(17)
click on File > New to open a new blank document.                   Finally we create an infinite loop, which will turn our
Immediately save your work as project1.py.                        LED on for one second and then off for a second.
                                                                  while True:
PROJECT 1                                                          red.on()
For our first project with GPIO Zero we'll do the “Hello           sleep(1)
World” of hardware hacking: lighting an LED. Before                red.off()
we write the code let's set up our circuit. We’ll need to          sleep(1)
use our breadboard, an LED, a 220Ω resistor and two                 Save your code and click on Run > Run Module.
female–male leads. One lead will attach to a GND on               You should now see the LED flash on and off.
your Pi, the other to GPIO 17. GPIO Zero uses the                 Congratulations: you have completed your first project
Broadcom pin mapping, which is the official standard              with GPIO Zero!
supported by the Foundation. Please refer to our
                                                                  PROJECT 2
                                                                  Let's try another quick project, this time with a
  GPIO Zero add-on boards                                         momentary switch (push button) attached to our
  In this tutorial we worked with common electronic               Raspberry Pi. Remove all of the components from
  components that offer a really cost effective entry             Project 1 and build Project 2 as per the diagram over
  to hardware hacking. But GPIO Zero is not just about            the page. Create a new file and save it as project2.py.
  individual components: it can also work with an expanding          Our goal for this project is to detect a button press
  series of add-on boards from third-party vendors.
     GPIO Zero also comes with a series of great classes that
                                                                  and react with a piece of humorous text. So let's start
  can handle controlling common components (we used the           this project by importing the Button class from the
  MotionSensor class to work with a PIR sensor). For those        GPIO Zero library.
  of you who are budding robotics developers there's a Robot      from gpiozero import Button
  class that enables robots from common components.                We now tell the code where our button is located,
  Typically a robot control board comes with its own software
  libraries but by using a typical motor controller, such as an
                                                                  which is GPIO 22.
  L298N, you can set which GPIO pins are used to control the      button = Button(22)
  direction of each motor thus giving you total control of the      We next create an event that's searching for a
  direction that our robot takes, including some precise spins.   button press.
                                                                  button.wait_for_press()



                                                                    www.linuxvoice.com                                                                       73
     TUTORIAL EDUCATION

                                                                                            PROJECT 4
                                                                                            In this project we use GPIO Zero and a few
                                                                                            components to build a burglar alarm system. We'll
                                                                                            reuse some of the principles used in our previous
                                                                                            projects and refine them further. Start by assembling
                                                                                            your breadboard so that it looks like the diagram, right.
                                                                                            This circuit is a little tricky to build but take your time,
                                                                                            check often and you will do great.
                                                                                               Create a new file and immediately save it as
                                                                                            Project4.py before proceeding. As always we'll
                                                                                            start by importing the libraries. Firstly we import
                                                                                            the MotionSensor, LED, Buzzer and Button classes
                                                                                            from the GPIO Zero library. We then import the sleep
                                                                                            function from the time library.
                                                                                            from gpiozero import MotionSensor, LED, Buzzer, Button
                                                                                            from time import sleep
                                                                                              Next we create a series of variables that will store
                                                                                            the GPIO pin numbers for our passive infrared sensor
                                                                                            (PIR), buzzer, button and six LEDs.
                                                                                            pir = MotionSensor(26)
                                                                                            buzzer = Buzzer(19)
                                                                                            button = Button(13)
                                                                                            led1 = LED(17)
                                                                                            led2 = LED(27)
Project 1 is a really simple
                                 Finally we create the text that will be printed to the     led3 = LED(22)
circuit, so great to learn
the ropes with.                shell when the button is pressed.                            led4 = LED(10)
                               print(“Hello Linux Voice readers…you are hacking with        led5 = LED(9)
                               GPIO Zero")                                                  led6 = LED(11)
                                 Save your code and click on Run > Run module.                Next we create a list, known as an array in other
                               Press the button and you'll see text appear on the           languages, and in there we store our LED variables.
                               screen. Congratulations – are you ready for the              We use the list in our code later.
                               challenge that is Project 3?                                 all = [led1,led2,led3,led4,led5,led6]
                                                                                               So now we create the first of two functions.
                               PROJECT 3                                                    Functions group batches of code together, and we
                               In this project we'll use a Passive Infrared Sensor (PIR)    can use them by calling the name of the function.
                               to detect movement. A PIR sensor detects movement            Our first function is called all_on(), and its purpose
                               and when triggered sends a pulse of current via its          is to turn on the buzzer, then use a for loop to iterate
                               output pin to a GPIO pin on our Raspberry Pi. In this        through all of the entries in our list. Each entry in the
                               project we shall trigger an LED to turn on when the          list is a reference to a GPIO pin for an LED. So for each
                               PIR sensor detects movement.                                 LED we instruct it to turn on and then wait for 0.1
                                  Create a new file and save it as project3.py. We          seconds before moving on to the next LED.
                               start as ever by importing the libraries for this project.   def all_on():
                               We will import the MotionSensor and LED classes
                               from the GPIO Zero library.
                               from gpiozero import MotionSensor, LED
                                 Now we tell our code that the PIR sensor is on GPIO
                               26 and that our LED is on GPIO 17.
                               pir = MotionSensor(26)
                               led = LED(17)
                                  Next we'll create two states for our sensor; the first
                               is for when motion is detected, and will trigger the
                               LED to illuminate for a few seconds (this is controlled
                               by how long the PIR sensor sends current to its
                               GPIO pin). The second state is for when no motion is
                               detected and turns off the LED accordingly.
                               pir.when_motion = led.on
                               pir.when_no_motion = led.off
                                 Save your work and click on Run > Run Module to            Project 2 uses a momentary switch (also called a push
                               start your code. Celebrate, as it will trigger the sensor    button) to act as a method of input. We can trigger any
                               and signify your success with this project.                  action to occur from this single button.



74                                                              www.linuxvoice.com
                                                                                                            EDUCATION TUTORIAL

 buzzer.on()                                                                                                               Project 4 brings together
 for i in all:                                                                                                             all the components that
   i.on()                                                                                                                  we used in the previous
   sleep(0.1)                                                                                                              projects to make one mega
  Next we create a second function called all_off(),                                                                       project.
which will ensure that the buzzer and all of the LEDs
are turned off.
def all_off():
 buzzer.off()
 for i in all:
   i.off()
   Our final section of code is an infinite loop that
will constantly loop round. Inside the loop we add a
button-press event that will prevent the PIR sensor
from activating until the button is pressed. Once the
button is pressed a message is printed to the Python
shell, warning you to run away before the alarm is
set. The code sleeps for five seconds, plenty of time
to hide. Now we create a trigger that instructs the
code to react when movement is detected by the PIR
sensor. The sensor works by sending current to the
Raspberry Pi when movement is detected; GPIO Zero
has a special method that will wait for the current
on the chosen GPIO pin to change and this acts as
a trigger in our code. At rest the PIR sensor sends
no current to the GPIO and we instruct the code to
ensure that all of the LED and buzzer are turned off
using the function we wrote previously.
while True:
 button.wait_for_press()
 print("SYSTEM ARMED YOU HAVE 5 SECONDS TO RUN
AWAY")                                                    sensor is pointing away from you as the it is rather
 sleep(5)                                                 sensitive and has around 180 degrees for detection.
 pir.when_motion = all_on                                 Any movement will trigger the sensor, which will call
 pir.when_no_motion = all_off                             the all_on() function and start the alarm process by
  Save your code and click on Run > Run Module            sounding the buzzer and sweeping through the six
to test the code. Press the button and you'll see the     LEDs on our breadboard.
warning message appear. It’s best to ensure that the
                                                          It's not the end
                                                          GPIO Zero is a welcome project that is sure to do
                                                          really well. It's still really early days, but this project is
                                                          already gaining ground and will be included by default
                                                          in a future Raspbian release.
                                                             GPIO Zero is an ideal way to introduce Python
                                                          programming to children and would be a great bridge
                                                          between the block-based languages, such as Scratch,
                                                          and the full implementation of Python.
                                                             We can’t wait to see what future projects will be
                                                          powered by this great library. Robotics, weather
                                                          stations and camera projects are achievable using
                                                          GPIO Zero, so there are plenty of avenues for future
                                                          inspiration.
                                                             All of the code for this project can be found via our
                                                          GitHub repository at http://bit.ly/LV23Code, or you
                                                          can download a Zip file containing all of the project
                                                          files from http://bit.ly/LV23ZIP.

In Project 3 we use the PIR sensor to trigger an LED to    Les Pounder divides his time between tinkering with
                                                           hardware and travelling the United Kingdom training teachers
light up – very handy for silent alerts when tracking
                                                           in the new IT curriculum.
burglars.



                                                            www.linuxvoice.com                                                                   75
     TUTORIAL IF THIS THEN THAT




BUILD SIMPLE SCRIPTS
WITH IF THIS THEN THAT
Create simple programs to manipulate online data and keep you dry in the rain.

   BEN EVERARD
                             T
                                      he internet is full of information. News reports,   input from the internet and trigger some output. The
                                      weather forecasts, stock prices, blog posts,        user specifies the This and That from a predefined
                                      cartoons and more are all out there ready for       list of choices. In this tutorial, we're going to build
WHY DO THIS?                 you to read at your leisure. All this information isn't      a simple weather alert that follows the formula: If
• Stay dry and warm while    just for you – computers can also use these online           there's rain forecast tomorrow then send me an alert
  all around are soaked to   news sources.                                                to remember to take an umbrella when I go out. The
  the skin                     If This Then That (IFTTT) is a really simple web           whole thing is accomplished with just a few mouse
• Make your life easier      app for creating and hosting programs that take an           clicks and not even a single line of code.
  by harnessing data and
  getting it to do your
  bidding
                             STEP BY STEP: INSTALL IF THIS THEN THAT
                             1
                                 Sign up                                                  2
                                                                                              If This
                             IFTTT is a hosted service that both provides the             To create a new recipe, go to the My Recipes page
                             tools to create your programs and runs them for              and click on Create New. IFTTT recipes trigger when
                             you. The first step is to sign up for an account at          a particular event occurs, so the first step is always to
                             http://ifttt.com. When you first log in, you'll be greeted   decide which trigger to use. These triggers come from
                             with a whole range of example programs (known as             channels, and there are over 230 of these to choose
                             recipes in IFTTT terminology). Browsing these gives          from. Some of these require specific hardware
                             you a great sense of what's possible with IFTTT –            (including one that works with OpenHAB, which
                             there are recipes to help you stay fit, to monitor your      we've looked at in this month's cover feature on
                             sleep and to find bargains online, among others. As          building an intert-connected home); others just get
                             programming languages go, it's very limited compared         information directly from the internet or a
                             to almost any other, but what it can do, it does very        smartphone.
                             easily and very well.                                           Some of the channels we've found most useful are
                                If you click on the Channels at the top of the screen,    Feeds, which brings any RSS feed into IFTTT; Reddit,
                             you'll get a list of all the data sources, and clicking      which creates alerts for topics that you're interested
                             on one of these will give details of the most popular        in; and Android Location, which triggers recipes when
                             published recipes using this channel. There are also         you enter or leave a particular place.
                             categories that show the most popular recipes of a              For our umbrella alert, we're going to use the
                             particular type, such as the productivity recipes at         Weather channel. Click on this icon, and IFTTT will
                             https://ifttt.com/categories/be-more-productive.             take you to the next step.




76                                                            www.linuxvoice.com
                                                                                             IF THIS THEN THAT TUTORIAL

3
    Configure Item                                        4
                                                              Then That
Channels aren't single pieces of data, but collections    The final stage of configuration is to define what
that can be selected from and configured to your          happens when the event is triggered. Again, there are
needs. The Weather channel will pick up some              a whole range of channels that you can use to define
information automatically (such as your location – to     the behaviour you want.
check this is correct, head to https://ifttt.com/            Our weather event happens every time the forecast
weather). Other bits need to be configured manually.      changes to include rain. However, we don't want a
   In the Weather channel, you can select the type of     constant flood of notifications every time the forecast
data you want, such as today's forecast, tomorrow's       is updated. Instead, we just want a single message
forecast and specific actions within this forecast.       that we can get first thing in the morning to tell us
In order for your recipe to behave as you expect, it's    what's going on. For this, the best option is an Email
important to understand exactly what triggers it.         Digest. This channel stores up notifications and sends
   For our alert, we'll use the channel Tomorrow's        them out at a particular time that you can specify.
Forecast Calls For, which is triggered every time the     Since all our notifications are about tomorrow, we'll
weather forecast for tomorrow includes a particular       set this to run late one night (11pm) and it'll email us if
weather, and we'll set the condition to be Rain.          there's been rain forecast for the day.




5
    Do Button, Note and Camera                            6
                                                              Managing recipes
Recipes run automatically according to a specific set     At the start of this tutorial, you had a look at some of
of rules. These work well in many circumstances;          the most popular recipes that other users had shared.
however, sometimes we need to be able to trigger a        When you create a useful IFTTT recipe, it's a good idea
rule whenever we want. For this, there's the DO button.   to publish it to enable other users to take advantage.
This is a smartphone app that enables you to create       This is done in My Recipes > Edit > Publish.
recipes that trigger whenever you press a button. The        IFTTT gives you a few tools to help you manage
DO button app is available from the Google Play and       recipes in the My Recipes page. If there's one that you
iTunes stores. Once it's installed, you can place a       want to keep, but don't want to have running at the
widget on your home screen to trigger a IFTTT action.     moment, you can turn it off. This leaves it in the My
The button can also pass location data to the That        Recipes page, but deactivates it. If you want to get
section of your recipe. If you need more information,     rid of a recipe, you can delete it permanently by going
you can also install the Note and Camera apps. These,     to Edit > Delete. You can also favourite recipes (by
as you've probably guessed, enable you to add small       clicking on the heart icon) that you like, but don't want
amounts of text or images to your recipes.                to install at the moment.




                                                              www.linuxvoice.com                                          77
     TUTORIAL RSS




KEEP TABS ON THE WEB
WITH RSS FEEDS
Getting information out of the web is like drinking from a firehose – so use a filter!

MARCO FIORETTI
                              T
                                      he greatest damage that Facebook et al may
                                      have done is that they've made the world
                                      forget that RSS exists. RSS (the acronym
WHY DO THIS?                  stands for Really Simple Syndication), as well as its
• Get the headlines without   successor and competitor Atom, is a file format
  having to check the BBC     designed to share and distribute content, usually over
  every 10 minutes            the internet. In this tutorial we explain what RSS and
• Group news feeds into       Atom feeds are, why sharing and distributing content
  lists based on your areas
  of interest                 is so important, and how to use them to read, create,
• Filter, process and         process, distribute and reuse content.
  redistribute news of           We wanted this to be a tutorial for absolute
  all sorts as efficiently    beginners. All you need to start playing with the tricks
  possible.
                              in these pages are a really basic understanding of
                              how scripting works and (possibly) Linux computer
                              with a text editor, a command line and an internet
                              connection. In order to keep the tutorial simple, all the
                              scripts shown here are simplified ones. They work
                              as described on our computers, with all the RSS/
                              Atom feeds we tried – but they are not optimised for            This is the magic RSS symbol – websites without it aren't
                              performance or robustness, and therefore may not                serving their content as well as they should.
                              work on computers or feeds with non-ASCII locales or
                              contents. Second, even if we almost always only say             nothing forbids other uses. As we will see shortly, you
                              "RSS" for brevity, most of what you'll read here also           can use RSS to distribute pretty much everything that
                              applies to Atom.                                                can be expressed by text. Everything! For the same
                                 RSS and Atom are XML (eXtensible Markup                      reason, it is easy to "reuse" data you got via RSS in all
                              Language) formats – that is plain text, but filled              sort of places.
                                                                                                 At the same time, with the right software it's easy to
                                                                                              aggregate, filter and read as many independent feeds
     With the right software it's easy to                                                     as you want all together, in one compact window of
     aggregate, filter and read as many                                                       your screen, without all the overhead, distractions and
                                                                                              other annoyances you'd be forced to endure on social
     independent feeds as you want                                                            networks that offer similar services. Trust us: RSS can
                                                                                              be a huge time saver.
                              with ugly-looking markup tags. Both formats were                 2
                                                                                                 The second big reason for RSS is to control for
                              developed to let people know all the most recent                yourself what you see and how you see it. Do you
                              articles that they could find on a certain website,             want to stay inside Facebook's filter bubble all the
                              without loading its home page in a browser. The                 time? RSS comes to you from the actual sources,
                              "RSS feed" file of a website, which is automatically            without intermediaries.
                              updated every time new content is added, contains                3
                                                                                                 The third reason for RSS is to avoid being controlled
                              titles, dates and links to the full text of all new articles.   – to read what you want, without anybody tracking it.
                              Yes, we know: said that way, an RSS feed seems just             RSS alone cannot prevent tracking, but is a necessary
                              a stripped-down version of a home page, without any             part of privacy-enhancing strategies.
                              real reason to exist. But RSS really is a big deal, for at
                              least three reasons:                                            RSS structure
                               1
                                 Efficiency. Sure, RSS was built to distribute                RSS 2.0, the current version of the format, is relatively
                              headlines of articles, usually with excerpts, but               limited (see the What's New In Atom box for a



78                                                               www.linuxvoice.com
                                                                                                                           RSS TUTORIAL


comparison, but also pretty simple to use. It is also         mobile platforms, including, Reader+ or gReader. Web-
the most popular one, if nothing else because it still is     based Free Software like Tiny Tiny RSS (aka TT-RSS,
the default format in many content management                 https://tt-rss.org) lets you aggregate and read RSS
systems. Listing 1 shows some parts, edited for               feeds directly in your browser, or in its official Android
clarity, of the Linux Voice atom feed, which is always        app. TT-RSS runs whenever there is a web server with
waiting for you at the address http://www.linuxvoice.         PHP support, and access to a PostgreSQL or MySQL
com/feed/:                                                    database. This may be your own Linux laptop, or any
 Listing 1:                                                   free or entry-level hosting account in a data centre.
 <channel>                                                       Installation of TT-RSS is as simple as it can be for
       <title>Linux Voice</title>                             a web-based application. Unpack the source files
       <atom:link href="http://www.linuxvoice.com/feed/"      in a folder accessible to the web server, edit the
rel="self" type="application/rss+xml" />                      configuration file to set the database parameters,
       <link>http://www.linuxvoice.com</link>                 point your browser to the root folder
       <description>The magazine that gives back to the       of the installation and follow the
free software community</description>                         instructions. A single installation of               PRO TIP
       <lastBuildDate>Mon, 19 Oct 2015 12:50:18 +0000</       TT-RSS may serve as many users as                    In these pages we've only used Python,
lastBuildDate>                                                you wish, each with his or her own                   but RSS libraries like the ones shown
                                                                                                                   below also exist for Perl and other
 ...                                                          password, graphic theme, tagging                     scripting languages which, depending on
 <item>                                                       system and collection of feeds.                      your needs, may be better than Python.
 <title>Create your own desktop environment</title>              TT-RSS may also be a great assistant
 <link>http://www.linuxvoice.com/create-your-own-             for RSS-based content curation. Its
desktop-environment/</link>                                   users, in fact, can aggregate and filter the items in
 <pubDate>Tue, 13 Oct 2015 13:45:27 +0000</pubDate>           all the feeds that they download with TT-RSS. The
 <dc:creator><![CDATA[Mike Saunders]]></dc:creator>           resulting lists of articles, which of course vary every
 <category><![CDATA[Featured story]]></category>              day as the content of their sources varies, can be
 <description>What to do if KDE, Gnome and Xfce don't         published from within TT-RSS as new, dynamic RSS
float your boat? Build your own custom desktop                feeds that everybody can download and read directly,
environment, of course!...</description>                      in any other RSS aggregator.
 ...
 </item>                                                      Create your own RSS feeds
   The first part contains a name, source link,               So far, we have summarised the main, standard ways
description and other metadata about the whole feed.          to use RSS feeds produced elsewhere. Now the fun
                                                                                                                              Figure 1: RSS aggregators
After that, there is a list of items, each containing all     begins. Let's see how, with a bit of scripting, you may         and readers such as Liferea
the information related to one article: title, link to full   consolidate practically every kind of information as an         have made it possible to
text, author, publication date, excerpt and so on. All        RSS feed and reuse it as and where you wish. Let's              fetch and browse hundreds
in nice, plain text, easy to read and process in many         start with the rssbuilder Python script of Listing 2:           of headlines at a time.
different ways.

Read RSS anywhere
The easiest way to read RSS feeds is to catalog and
filter all of them together inside a dedicated RSS
aggregator. The image below shows what the raw
RSS "source code" in the code above looks like from
within Liferea, the fantastic Free Software news reader.
    The left-hand side of the same figure confirms
what we already said: with RSS, one simple, compact
interface lets you collect, sort and filter as you wish a
lot of totally unrelated news sources.
    RSS aggregators such as Liferea, which are
sometimes also called feed readers, exist for all
platforms and tastes. On Linux and Unix-related
desktops, including Mac OS X, you may use the
command-line program Newsbeuter (http://
newsbeuter.org). This fine piece of mimimalist
software calls itself "the Mutt of RSS feed readers",
and for good reasons: you can completely control it
with the keyboard, and it has many functions to filter,
sort, tag and search the content of each feed. There
are also several RSS aggregation apps or services for



                                                                www.linuxvoice.com                                                                      79
     TUTORIAL RSS


                                                                                           28    rss.items.append(item)
                                                                                           29
                                                                                           30 fileHandle.close()
                                                                                           31
                                                                                           32 rss.write_xml(open(sys.argv[2], "w"))
                                                                                            The purpose of the script is to transform lists of
                                                                                        news in plain text format (with one "news" per line
                                                                                        composed of several fields separated by the pipe
                                                                                        (|) character) into one, standard RSS feed that any
                                                                                        aggregator might read.
                                                                                            The first eight lines of the script load several Python
                                                                                        modules and (re)configure system variables, like
                                                                                        character encoding, that the script needs.
                                                                                            Lines 10–16 create a new RSS object, and define
                                                                                        its title, source link, description and creation date. The
                                                                                        loop in lines 20–27 reads the text file passed as the
                                                                                        first argument in line 18, splits each line using the pipe
                                                                                        character as separator (line 21), puts each resulting
                                                                                        field in the corresponding one of a new RSS item, and
                                                                                        finally appends it to the RSS object (line 28).
                                                                                            The last two commands close the input file, and
                                                                                        write a whole RSS feed to another file, whose name is
                                                                                        the second argument given to the script. For example,
Figure 2: Is this a website?
                                Listing 2:                                              if you ran rssbuilder in this way inside a terminal:
Is this an RSS reader?
Actually it's both. Tiny          1 #! /usr/bin/python                                  #> rssbuilder allmynews.txt output.xml
Tiny RSS is a web-based           2                                                     using an "allmynews.txt" file with this content:
application that lets             3 import sys                                           2015-10-24 07:16:25+00:00 |bbc|BBC VIDEO: Is this the
multiple users read, filter,      4 reload(sys)                                         iceberg that sank the Titanic?|http://www.bbc.co.uk/
create and share RSS              5 import datetime                                     news/uk-34625510
feeds as they wish.               6 import PyRSS2Gen                                     2015-10-15 09:06:21+00:00 |mycomputer|Your print
                                  7                                                     queue is stuck|http://localhost:631
                                  8 sys.setdefaultencoding('utf8')                       2015-10-13 13:45:27+00:00 |linuxvoice|From LV: Create
                                  9                                                     your own desktop environment|http://www.linuxvoice.
                                  10 rss = PyRSS2Gen.RSS2(                              com/create-your-own-desktop-environment/
                                  11   title = "Bare DEMO Feed for Linux Voice",         2015-10-02 13:46:39+00:00 |gmail|You got email from
                                  12   link = "http://www.linuxvoice.com/samplefeed",   Aunt Judy|http://www.gmail.com
                                  13   description = "just a bare feed to demonstrate    2015-10-01 08:39:29+00:00 |mycomputer|Your hard drive
                               the power of RSS scripting",                             is almost full!|http://localhost
                                                                                           Inside any RSS reader the output would look
                                                                                        more or less like what's inside Akregator in figure 3.
     There are tons of applications that can                                            That screenshot highlights the real power of RSS.
     catch and use RSS feeds, including                                                 Email notifications, web pages, computer statuses…
                                                                                        RSS makes it easy to consolidate, distribute and
     WordPress and all decent CMSes                                                     use information of all sorts, from every conceivable
                                                                                        source. Isn't that cool?
                                  14                                                       Sure, this only happens after you've written down all
                                  15   lastBuildDate = datetime.datetime.now(),         the initial information as in Listing 3. But that's not as
                                  16   )                                                hard as you might fear. If the original content comes
                                  17                                                    from other RSS feeds, you can parse and filter it as
                                  18 fileHandle = open(sys.argv[1], 'r')                you want, with the techniques that we'll show you in
                                  19                                                    a moment. Non-RSS sources, like the email and disk
                                  20 for line in fileHandle:                            notifications of Figure 3, are just as easy to format
                                  21   fields = line.split('|')                         in the same way, even if that would be a topic for a
                                  22    item = PyRSS2Gen.RSSItem(                       separate tutorial.
                                  23       title = fields[2],                              It's now time to look at how to read and process
                                  24       link = fields [3],                           already existing RSS feeds. One way is the 22-line
                                  25       description = 'just a demo!',                script called rss-fetcher in Listing 4:
                                  26       pubDate = fields[0]                             Listing 4
                                  27       )                                               1 #! /usr/bin/python



80                                                                 www.linuxvoice.com
                                                                                                                            RSS TUTORIAL


   2
   3 import sys
   4 import feedparser
   5 import socket
   6 from dateutil import parser, tz
   7
   8 timeout = 120
   9 socket.setdefaulttimeout(timeout)
   10
   11 feed_name = sys.argv[1]
   12 feed_url = sys.argv[2]
   13 myrss = feedparser.parse(feed_url)
   14 for s in myrss.entries:
   15     title = unicode(s.title).encode("utf-8")
   16     title = title.replace('\n', ' ')
   17     title = title.replace('\r', ' ')
   18     title = title.replace('|', '--')
   19     datepublish = s.published
   20      dt = parser.parse(datepublish)
                                                             Figure 3: International news, computer warnings, email notifications... everybody can
   21     print(dt),
                                                             integrate whatever they want into RSS feeds, as long as it is formatted in the right way
   22      print "|" + feed_name + "|" + title + "|" +
unicode(s.link).encode("utf-8") + "\n"
   As in the other script, the first nine lines load some    information) in a series of pipe-delimited lines inside
libraries, which are all installable with the usual          a plain text file, and to transform files like that into
software management tools of your Linux distribution.        standard RSS feeds means that you can, with just a
The two arguments that rss-fetcher needs (and loads          bit more of scripting:
in lines 11 and 12), are an arbitrary feed name and           1
                                                                Save many feeds, from many different sources, in
the URL of an RSS feed. Line 13 does the real work,             plain text files that are perfect for further, easy
downloading the feed and saving it into an object               processing;
called myrss, with the methods provided by the                2
                                                                Combine, filter and/or sort the content of all those
Python feedparser library.                                      files in any way you wish;
   The loop starting in line 14 reads, formats and            3
                                                                Format the result(s) of step 2 into new standard
prints out the most important fields of each item.              feeds, reusable by everybody or, alternatively;
                                                              4
                                                                Embed the results of step 2 in any part of your
Download, parse and filter feeds                                desktop or websites.
As a practical example, this is what we got when we             Step 4 is described in the last part of the tutorial, but
ran rss-fetcher on the Linux Voice feed (both URLs           first let us explain step 2 a bit better. Imagine you've
and titles are trimmed for readability):                     saved many different feeds in as many text files called
 #> rss-fetcher lv http://www.linuxvoice.com/feed/ >         feed-01.txt, feed-02.txt and so on, using the rss-
linuxvoice.txt                                               fetcher script. At that point, commands like these:
 #> cat linuxvoice.txt                                        #> grep '2015-10-15' feed*.txt | sort > today.txt
 2015-10-19 12:49:12+00:00 |lv|Voice of the Masses: Who is    #> grep -i linux feed*.txt | sort > linux.txt
your Linux or Free Software hero?|www.linuxvoice.com/         #> grep -i '|KEYWORD|' feed*.txt | sort > KEYWORD.txt
voice-of-the-masses...                                       will extract, sort by date and save the news from
 2015-10-13 13:45:27+00:00 |lv|Create your own desktop       today (today.txt) or contain a specific word in the title
environment|http://www.linuxvoice.com/create-your-           (linux.txt) or fit into whatever category you passed
own-desktop-environment/                                     to rss-fetcher (KEYWORD.txt). At that point, it would
 2015-10-08 11:09:11+00:00 |lv|Podcast Season 3 Episode      be quite easy to pass those files to rss-builder, or
17|http://www.linuxvoice.com/podcast-season-3-               to reuse them in the other ways described below
episode-17/                                                  all through one script that does the whole work
 2015-10-05 09:06:21+00:00 |lv|Voice of the Masses: How      automatically. The hardest part may be to figure out
important is open hardware?|http://www.linuxvoice.com/       exactly, with pen and paper, all that you actually want
voice-of-the-masses...                                       to filter or process, and how.
 2015-10-02 13:46:39+00:00 |lv|Download Linux Voice
issue 11|http://www.linuxvoice.com/download-linux-           Reuse RSS everywhere. Really everywhere
voice-issue-11/                                              There are tons of end-user applications that can fetch
  Now, please take a moment to imagine what                  and display RSS feeds. WordPress and all other decent
you might get by combining two scripts like these.           content management systems, for example, all have
Being able to transform an RSS feed (or any other            modules that let webmasters automatically embed



                                                               www.linuxvoice.com                                                                   81
     TUTORIAL RSS


                                                                                                     file where you collected today's news. As it stands, the
                                                                                                     code is not complete, as it will play again for the same
                                                                                                     news, but you get the idea.

                                                                                                     RSS in every page, of every website
                                                                                                     What you see in Figure 4 are, from left to right, parts
                                                                                                     of three real Web pages, each managed in a totally
                                                                                                     different way from the others. The yellow sidebar on
                                                                                                     the left is part of a WordPress blog. The central, white
                                                                                                     section is the sidebar of another website, created
                                                                                                     with the Mynt static website generator (http://mynt.
                                                                                                     uhnomoli.com). The rightmost window in Figure 4
                                                                                                     shows the body of a static HTML page, in yet another
                                                                                                     website. What makes them relevant for this tutorial
                                                                                                     is that those very different websites are all being
                                                                                                     automatically updated with the same snippets of text,
Figure 4: Three websites, with three wildly different architectures, but all embedding the
                                                                                                     created with more complex versions of the scripts
same RSS feed, or what looks like an RSS feeds, automatically synchronized every time
new content comes in. How can that be possible?                                                      above. Every few hours, one cron job downloads
                                                                                                     and converts both RSS feeds and non-RSS news,
                                                                                                     merging them all into one text file formatted as in
                               and display feeds in all their pages. However, being                  Listing 2. That file is then converted into raw HTML
                               able to play with RSS and Atom as we've just seen                     with a script similar to rss-builder, and then “injected”
                               opens up a much bigger world of opportunities. Who                    in the places you see in Figure 4, each time with a
                               says that you should see those feeds only in places                   technique compatible with the target website. In the
                               (be they desktop clients or website modules) that                     first case, the code is written into a previously defined
                               were specifically written for that purpose?                           widget using the wp-cli command line interface for
                                  Think of your desktop. Depending on your own                       WordPress (http://wp-cli.org). In the other cases, a
                               habits, and on how your own brain works, it may be                    placeholder string is replaced in the Mynt templates,
                               very efficient to read RSS feeds in your taskbar, or in               and in the body of the HTML page.
                               menus that appear when you click on your wallpaper.
                               Or have your computer play some alarm when there                      Conclusion? Go RSS, of course!
                               are news items on some specific topic. The latter case                After reading this tutorial you may agree with us that
                               is the easiest to handle. Some shell code like this:                  much of what you get in a Facebook wall, or Twitter
                                Listing 5:                                                           timeline, is not so different from a glorified collage of
                                 1 #! /bin/bash                                                      RSS-like updates from several, otherwise unrelated
                                 2 NEWS=`grep -i -c Linux today.txt`                                 sources (a superbly glorified and well-done collage,
                                 3 if [ "$NEWS" -gt "0" ]                                            we'll grant you that). In any case, we hope that these
                                 4 then                                                              few pages have made you like the power and flexibility
                                 5      paplay there-is-news.mp3                                     of RSS and Atom, and given you lots of wild ideas to
                                 6 fi                                                                play with. Please tell us about them!
                               will play the MP3 file specified in line 5 whenever
                               $NEWS is greater than zero, that is whenever there is                  Marco Fioretti is a Free Software advocate and open data
                                                                                                      campaigner who has advocated FOSS all over the world.
                               at least one line containing the Linux keyword in the



                                  What's new in Atom?
                                  RSS took over the web in the early 2000s because it was very       find by themselves the URL of the feed of any Atom-compliant
                                  simple to use, and solved a big problem of the pre-Twitter, pre-   website, even if all you do is point those programs to its home
                                  Facebook era: getting updates from all over the web, without       page, or to a local copy of their feed on your disk.
                                  having to open hundreds of different websites. The success            For developers, Atom software libraries are also much
                                  of RSS was big enough, however, to highlight a few flaws that      more modular than the corresponding ones for RSS, and are
                                  were overlooked by its designers.                                  therefore more reusable in other projects. Atom is also better
                                     The solution to those problems is the Atom Syndication          than RSS when it comes to character encoding, content
                                  Format (https://tools.ietf.org/html/rfc4287). This is an           format specification and post modification timestamps. In an
                                  IETF standard with a registered MIME type, and mandatory           Atom feed it's much easier to hande non-ASCII characters and
                                  inclusion of its title and the URL from which it can be            make sure that you do not miss new versions of an article that
                                  retrieved. MIME types are a standard way to classify file types.   you already saw. Better content specifications also guarantee
                                  MIME compliance, together with the mandatory inclusion of          that Atom feeds can include more types of content than
                                  the source URL, guarantee autodiscovery – meaning that any         RSS besides text (audio, images etc…), in a way that will not
                                  standards-compliant browser or aggregator will immediately         confuse software clients.




82                                                                   www.linuxvoice.com
                     RSS TUTORIAL




www.linuxvoice.com                  83
     CODING ARM ASSEMBLY




BARE METAL: ARM
ASSEMBLY LANGUAGE
Hack code on your Raspberry Pi (or thousands of other devices) at the lowest level.

MIKE SAUNDERS
                              F
                                      rom issues 12 to 16 we ran a series on x86        every smartphone in the world and thousands of
                                      (PC) assembly language, and we received lots      other devices. Over 50 billion ARM chips have been
                                      of positive feedback. Although assembly may       produced since the first designs were crafted by
WHY DO THIS?                  not seem especially relevant in today's world, where      Sophie Wilson and her team at Acorn back in 1983.
• Write blazingly fast code   most software is written in high-level languages, it's    And while x86 chips have dominated the PC space
• Learn another CPU           still mightily useful in the embedded space, where you    since the 1980s by offering more raw performance
  architecture                don't have much RAM or storage space to play              than ARM equivalents, ARM still offers many
• Start to build your own     around with. Being able to use raw CPU instructions       advantages: less power consumption and a more
  OS!                         helps if you want to optimise certain routines that are   elegant instruction set, to name two.
                              run thousands of times a second – like in video
                              games or physics simulations. Oh, and learning            Setting up
                              assembly just for pure geektasticness is great fun too.   For this tutorial we'll be focusing on the Raspberry Pi,
                                 Our x86 assembly tutorials went through the basics     as it's pretty much the perfect environment for ARM
                              of writing code on Linux, and we then moved on to         assembly programming: it's cheap (now just $5!!),
                              creating a (very simple) operating system and adding      easy to get hold of, and runs Linux (and therefore the
                              graphics effects. If you're new to Linux Voice and want   superb GNU toolchain) like a champ.
                              to read the series, you can access all back issues in       If you don't have a Pi but still want to explore ARM
                              DRM-free digital format by buying a print or digital      coding, you could try installing an ARM Linux
                              subscription at http://shop.linuxvoice.com.               distribution on the Qemu PC emulator. For example,
                                 Anyway, some readers have asked us to expand           the Fedora project has some instructions for running
                              on the x86 series of tutorials by covering ARM chips.     older ARM versions of the distro in Qemu here:
                              These are the processors used inside the stonkingly       https://fedoraproject.org/wiki/Architectures/ARM/
                              popular Raspberry Pi, along with pretty much              HowToQemu.




You don't need expensive
development boards to
hack ARM code – an off-
the-shelf Raspberry Pi is
ideal.



84                                                           www.linuxvoice.com
                                                                                                                      ARM ASSEMBLY CODING


   If you're running Raspbian on a Pi, the two utilities
you'll need are as (the assembler, which converts
assembly language source code into binary code) and
ld (the linker, which creates the resulting executable
file). Both of these are provided in the binutils package
– so they may already be installed by default. Of
course, you'll need a good text editor as well; we
always recommend Vim for coding, but it has a steep
learning curve so Nano or a graphical editor will work
fine as well.
   Ready to go? Type this in and save it as myfirst.s:
          .global _start
_start:
          mov r7, #4
          mov r0, #1
          ldr r1, =string
          mov r2, #stringlen
                                                                                                                                        Here we're SSHed into
          swi 0                                                     at around 900 bytes – if you did the same thing in
                                                                                                                                        a Raspberry Pi, running
                                                                    C using puts(), the binary would be over five times                 Tmux to split the screen,
          mov r7, #1                                                bigger!                                                             editing code in Nano, and
          swi 0                                                                                                                         assembling it. Geek bliss.
                                                                    How it all works
          .data                                                     The first two lines here aren't CPU instructions but
string:                                                             directives to the assembler and linker. Every program
          .ascii "Ciao!\n"                                          needs a marked starting point called _start, which just
          stringlen = . - string                                    so happens to be at the top of the source code in our
   This program simply prints the string "Ciao!" to the
screen, and if you followed our x86 assembly series,
some of it may look familiar to you. But there are
                                                                       The Pi is the perfect environment for
many differences between x86 and ARM – and also                        ARM assembly programming – it's
in the syntax used in the source code – so we'll go
through it in detail.                                                  cheap, easy to get hold of and runs Linux
   But before that: to assemble the code and link the
resulting object file into an executable file, use this             case. So we confirm with the linker that yes, execution
command:                                                            should begin right at the top of our file, and we're
as -o myfirst.o myfirst.s && ld -o myfirst myfirst.o                ready to go.
  Now you can run the program in place with                           In the next instruction we put the number 4 into
./myfirst. You'll notice that the program is very small             the r7 register. (If you've never done any assembly


  Write your own Pi operating system
  If you followed our x86 assembly language series, you'll recall   that step through turning on LEDs, accessing pixels on the
  the moment of sheer awesomeness when you booted up your           TV, getting input from the keyboard and so forth. You have
  very first bare metal code, showing a message on the screen       to learn a lot about the Pi's hardware on the way, and the
  without the help of Linux or any other operating system. We       tutorials were written for the original models of the Pi – so
  then expanded this to include a simple command line and a         there's no guarantee that they'll work on the A+, B+ and Pi 2
  way to load and run programs from the disk, in effect creating    models.
  a very simple OS that could be expanded further. This was            If you'd rather go the C route, Valvers at http://tinyurl.com/
  all very cool, but the process was made much simpler thanks       qa2s9bg explains the process of setting up a cross-compiler
  to the BIOS – it provided simplified access to the screen,        and building a rudimentary operating system kernel, while the
  keyboard and floppy disk drive.                                   ever-useful OSDev Wiki at http://wiki.osdev.org/Raspberry_Pi_
      With the Raspberry Pi, you don't have these BIOS routines     Bare_Bones also shows you what you need to get a minimal
  to assist you, so you have to write drivers from scratch, which   kernel up and running.
  is really a pain in the rear when you'd rather be focused on         As mentioned, the big problem is writing drivers for the
  cool stuff like printing things on screen and running programs.   various bits of hardware on the Pi: the USB ports, the SD card
  Still, there are a number of guides on the web that take you      slot and so forth. The code for these alone can take up tens of
  through the initial steps of booting the Pi, accessing the GPIO   thousands of lines. If you really want to make your own fully-
  pins and so forth.                                                fledged Pi operating system, it'd be worth going to the forums
      One of the best is Baking Pi (www.cl.cam.ac.uk/projects/      at www.osdev.org and asking if anyone else has written
  raspberrypi/tutorials/os/index.html) from the University of       drivers for these bits of hardware – and maybe you can then
  Cambridge. It's a detailed set of assembly language tutorials     adapt them for your own kernel, saving you heaps of time.




                                                                      www.linuxvoice.com                                                                        85
     CODING ARM ASSEMBLY

                                                                                                 the kernel checks the contents of the other registers,
                                                                                                 does the printing work, and hands control back to us.
                                                                                                   So we have "Ciao!" on the screen, and now we want
                                                                                                 to end the program cleanly. We do this by placing the
                                                                                                 number for the exit system call into the r7 register and
                                                                                                 calling software interrupt number zero once more.
                                                                                                 And that's it – the kernel terminates our program and
                                                                                                 we land back at the command prompt.

                                                                                                 Subroutines, loops, conditionals
                                                                                                 Now that we know how to write, assemble and link a
                                                                                                 simple program, let's move on to something more
                                                                                                 intricate. The following program uses subroutines for
                                                                                                 printing a string (so we can re-use some code and
                                                                                                 don't have to set up registers manually each time). It
                                                                                                 has a main loop where a message is displayed until
                                                                                                 the user enters 'q'. Have a read through it to see what
Vim (above left) is a
superb editor for hacking           programming before, a register is an on-chip memory          you can understand (or guess!) already, and then we'll
assembly – get the syntax           store. Most CPUs only have a handful of registers,           go through it in detail. Note that @ symbols denote
highlighting file for ARM           compared to millions or billions of storage locations        comments in ARM assembly.
from http://tinyurl.com/            in RAM, but registers are much faster to use.) ARM                      .global _start
psdvjen.                            registers are plentiful and general purpose: there are       _start:
                                    16 in total, from r0 to r15, and they don't carry weird                 ldr r1, =string1
                                    historical baggage like in x86 where some registers                     mov r2, #string1len
                                    can only be used for certain purposes at certain times.                 bl print_string
                                       So, mov is very much like its x86 equivalent, and
                                    note the hash mark next to the 4 to show that it's a         loop:
                                    number and not a memory address. Here we want to                        mov r7, #3                         @ read
                                                    use the Linux kernel's write system call                mov r0, #0                         @ stdin
                                                    to print our string; to use system calls,               ldr r1, =char
PRO TIP                                             we need to populate registers with the                  mov r2, #2                         @ two chars
In assembly language, it's a good idea to           appropriate numbers before asking the                   swi 0
use comments liberally. We haven't used
many in the code samples here, to keep              kernel to do its job. The number of the
them short and sweet in the magazine                system call should go in the r7 register,               ldr r1, =char
(and also because we've provided                    and write is system call 4.                             ldrb r2, [r1]
detailed explanations). But if you write a
complicated routine that seems obvious                In the next mov instruction we place                  cmp r2, #113           @ ASCII for 'q'
to you now, think how it may look if you            the file descriptor for where the 'Ciao'                beq done
forget about ARM assembly for a few                 message should be output – eg the
months and come back to your code later.
You might have forgotten all the awesome            screen or a file – in r0. We're using                   ldr r1, =string2
tricks and shortcuts you made, and the              stdout, which is 1. Next up, we need                    mov r2, #string2len
code looks like gobbledygook. So add                to place the location of the string we                  bl print_string
plenty of comments, even if they seem a
bit too obvious at the time!                        want to print in the r1 register, using
                                                    the ldr ('load register' instruction; note
                                                                                                   Reverse engineering
                                                    the equals sign here to show a location
                                    rather than a direct number. At the bottom of the              Sometimes it's useful to take a binary file and convert it
                                    source code in the data section we define this string          back into assembly language. The results of this are usually
                                                                                                   not pretty, in that they're missing the human-readable label
                                    as a sequence of ASCII characters. For this 'write'            names and comments that you added to your source code,
                                    kernel system call, we also need to tell the kernel how        but it can be helpful to see what the assembler is doing
                                    long the string is, so we do that by placing the value of      with your code. To produce a disassembly of the myfirst
                                    stringlen into the r2 register. (This stringlen value is       binary, run:
                                                                                                   objdump -d myfirst
                                    calculated by taking the end location of the string and
                                                                                                      This will disassemble the executable code section of
                                    subtracting that from the starting point.)                     the binary (and not the data bit, because that's ASCII text).
                                       So, we've populated our registers with the relevant         You'll see that the instructions largely match what you
                                    values, and now we're ready to hand control over to            entered. Disassemblers really come to life when you're
                                    the Linux kernel. To do this, we use the swi instruction,      trying to analyse the behaviour of a program to which
                                    which is short for 'software interrupt' and basically          you only have the binary – eg a virus, or simply a piece of
                                                                                                   proprietary software that you want to emulate. Always keep
                                    switches execution to a routine in the kernel (just like       copyright concerns in mind though! Disassembling a binary
                                    int in the x86 tutorial series). The kernel looks at the       and copying and pasting its code straight into your project
                                    contents of the r7 register, sees that it's 4 and says         is a bad idea – just use it for learning.
                                    "Aha, the calling program wants to print a string". Then



86                                                                 www.linuxvoice.com
                                                                                                           ARM ASSEMBLY CODING

           b loop


done:
           mov r7, #1
           swi 0


print_string:
           mov r7, #4
           mov r0, #1
           swi 0
           bx lr


           .data
string1:
           .ascii "Enter q to quit!\n"
           string1len = . - string1
string2:
           .ascii "That wasn't q...\n"
           string2len = . - string2
                                                                                                                           ARM chips started off in
char:                                                       entered. Our next job is to compare the contents
                                                                                                                           the Acorn Archimedes
           .word 0                                          of r2 with the letter 'q', which happens to be 113 in          range of computers, but
   Here we start off by putting a string location and       ASCII (see www.asciichart.com). So we use the cmp              now utterly dominate the
its length into the appropriate registers for the write     instruction to perform the comparison, and then                mobile space. (Image:
system call – but then we jump to our print_string          'branch if equal' to the done label if r2 is 113. If not,      http://tinyurl.com/
subroutine further down the code. To perform this           we then go on to print our second string, then branch          qy9p2l5)
jump we use the bl instruction ('branch and link'),         back to the start of the loop with the b instruction.
which stores the current location in the code so               Finally, after the done label, we tell the kernel that
that we can return to it later with the bx instruction.     we want to exit – just like in the first program. To
The print_string routine simply populates the other         run this program, just assemble and link it as per the
registers for the write call, as in the first program we    instructions for the first one.
wrote, before calling the kernel and then returning to         So, we've covered a lot in a short space here, but it's
the calling code with bx.
   Back in that calling code, we next have a label
called loop – we're going to jump back to this point
                                                               Now that we know how to write,
in a moment. But first we want to use another kernel           assemble and link a simple program, let's
system call, read (number 3), to grab a character
from the keyboard. So we place 3 in r7, and then zero          move on to something more intricate
(stdin) in r0 because we want a character from the
user's input and not a file.                                always best to learn by actually typing in and trying
   Following this we place the location where we            out code yourself. There's no better way to get familiar
want to store the character in r1 – in this case, the       with a language than doing experiments by making
char location at the bottom of our data section. (We        changes and seeing what effects they have. You can
actually need a word, ie two characters, to store the       now write simple ARM assembly programs with input,
data here, as the enter key input is stored as well. In     output, loops, comparisons and subroutines. If you
assembly language, it's always important to be aware        had never dipped your toes into the imposing pond
of data overflows – there are no high-level niceties to     of assembly language before today, hopefully it has
save your hide here!)                                       made you more confident with the language and it
   Back in the main code, we put 2 in r2 for the two        seems less of mystical art that only a few geeks dare
characters that we're going to store, and then call the     to master.
kernel to perform the read operation. The user enters         Of course, that's just the tip of the iceberg when it
a character and hits Enter. Now we want to see what         comes to ARM assembly language. There's a lot more
this character contains: we put its location (char in our   to explore, so if you'd like us to cover the language in
data section) in the r1 register, and then using the ldrb   more depth in future issues, get in touch! Meanwhile,
instruction we load a byte from the memory location         another good resource for learning more about ARM
pointed to by r1.                                           coding on Linux can be found at http://tinyurl.com/
   The square brackets here make it clear that it's         nsgzq89. Happy hacking!
the data stored inside the memory location that
we're interested in – not the location itself. So r2
now contains a single character from the char bit of         Mike Saunders still thinks the Z80 is better than the 6502.
                                                             Flame on, BBC and C64 fans!
our data section, and it's the character that the user



                                                              www.linuxvoice.com                                                                  87
     CODING NINJA




CODE NINJA:
WRITE A GAME USING SVG
Turn your browser into a games console with scalable vector graphics.

   BEN EVERARD
                          S
                                  calable Vector Graphics (SVG) is, as the name
                                  suggests, a vector graphics format. This
                                  means that the images include details of what
WHY DO THIS?              lines, shapes and objects go into making the picture,
• Build cross-platform    rather than just details of what pixels should be which
  games                   colour. One advantage of vector graphics is that as
• Add animations and      you make them larger, software can redraw the image
  interactivity to your   at a higher resolution, so they don't lose quality (hence
  website
                          the scalable in the name). Another advantage is that
• Become an indie games
  superstar               because you know what the component parts of the
                          image are, you can manipulate them. In this tutorial,
                          we're going to manipulate SVGs using JavaScript and             You can play our game online – live, right now! – at
                          HTML to create a simple side-scrolling game.                    www.linuxvoice.com/issue23-ninja.html.
                             You can interact with SVGs using plain JavaScript,
                          but there are some differences between browsers,                us to create elements of the SVG. For example, we
                          and it can be a bit fiddly. It's easier to use a library that   can create a circle with a 10-pixel diameter with:
                          provides a wrapper to make it more straightforward.             var circle = draw.circle(10)
                                                                                            Our game will be made up of asteroids (represented

     We're going to manipulate SVGs using                                                 by circles) that move from right to left across the
                                                                                          screen, and a spaceship (represented by a rectangle)
     JavaScript and HTML to create a simple                                               that the user can move up or down. The aim is to keep
                                                                                          the spaceship from colliding with the asteroids for as
     side-scrolling game                                                                  long as possible. The asteroids will gradually speed
                                                                                          up, and your final score will be based on the speed the
                          We'll be using the SVG.js library.                              asteroids get to before a collision.
                           The basic HTML for our game is:
                          <html><head>                                                    Asteroids!
                          <title>SVG game</title>                                         The first part of our code sets up the variables we
                          <script src="http://www.linuxvoice.com/svg.min.js"></           need, and places the asteroids at random positions
                          script>                                                         across the SVG.
                          </head>                                                         var draw = SVG('drawing').size(1200, 600)
                          <body>                                                          var rocks = []
                          <div id="drawing"></div>                                        var num_rocks = 40
                          <button onclick="ship.dy(-5)">Up</button>                       var rock_size = 20
                          <button onclick="ship.dy(5)">Down</button>                      var speed = 1000
                          <script>                                                        var alive = true
                          var draw = SVG('drawing').size(1200, 600)                       for(var i=0;i<num_rocks;i++) {
                          </script>                                                           rocks.push(draw.circle(rock_size).fill('#aaaaaa' ))
                             In the HTML of this page, we've created a div                    rocks[i].move(Math.random()*1200 + 200, Math.
                          element in which we'll place our SVG, and two buttons           random()*600)
                          that we'll use to control the spaceship (the onclick            }
                          code for these buttons links to code that we'll create             This uses the array rocks to store details of all our
                          later in the tutorial). The first script loads the SVG.js       asteroids. To create them in random positions, we
                          library from the Linux Voice server, and the second             first use the circle method to create the object, then
                          creates an SVG object that we'll manipulate to create           use the fill() method to set them to the appropriate
                          our game. This SVG object has methods that enable               colour, and finally use the move method. Math.



88                                                          www.linuxvoice.com
                                                                                                                                    NINJA CODING


random() returns a random number between 0 and 1,
so by multiplying this by the dimensions of the image,
we can generate random positions. To give the player
a chance to get ready, we'll offest the initial x values by
200, so they're not immediately in front of the player.
  The ship is represented by a rectangle, which is
created by the rect method of our SVG object. This
takes arguments for the width and height of the ship.
The ship can't move forwards or backwards, just up
and down, so we start by moving it to the middle of
the left-hand edge of the screen. The move method
places the element's top left-hand corner at the given
coordinates, so this should have an x value of 0.
var ship = draw.rect(40, 20).fill('#aa00aa' )
ship.move(0,300)
loop_forever()
  After setting the ship up, everything is ready for our
game. We only need to start the main loop running.
We do this by calling the function loop_forever() that
                                                                                                                                     You can use the Firefox
will keep running until the game is finished. In most              variable increases by 1 every time this loop is run, so
                                                                                                                                     inspector (Ctrl+Shift+I) to
other languages, we'd use a while loop, but JavaScript             this will gradually speed up as the game runs. The                see elements inside the
doesn't have any way of pausing the code, so you                   dx() method moves an SVG element relative to its                  SVG, which can help debug
can't easily control the speed of your game using plain            current position. There's also a dy() method to move              any problems.
loops. Instead, we'll recursively call the loop_forever()          an element vertically which we tied to the click events
function using the setTimeout function to run the                  on our buttons in the HTML.
animation every 20 milliseconds:                                      Second, the first if statement checks for any
function loop_forever() {                                          asteroids that have moved off the left-hand edge of
    //animate rocks                                                the screen and places them at a random position
    for(var i=0;i<num_rocks;i++) {                                 on the right-hand edge of the SVG. The x() method
        rocks[i].dx(-1 * speed/1000)                               returns the current x position of an element. There's
        if (rocks[i].x() < 1) rocks[i].move(1200,Math.             also a y() method that does the same for the vertical,
random()*600)                                                      which we'll use a bit later. You can use either of these
        if(rocks[i].x() < 40 && rocks[i].y() > ship.y() - 20 &&    with a single argument to set the horizontal or vertical
rocks[i].y() < ship.y() + 20) {                                    position, but we don't need this in our game.
            alert("Score: " + speed + ". Reload the page to try
again")                                                            Collision detection
            alive = false                                          Third, the final if statement does a simple collision
        }                                                          check. This isn't perfect, since it checks the bounding
    }                                                              rectangle of the asteroid against the ship, but this is
    speed++                                                        accurate enough for our needs. SVG.js doesn't have
    if (alive) setTimeout(loop_forever, 20)                        any collision-detection methods built in, so if you want
}                                                                  to increase the accuracy of this, you'll have to write
   The main action in this function is in the for loop,            the code yourself.
which loops through every asteroid and does three                     If there is a collision, the game displays an alert to
things. First, it moves all the asteroids left by the              let you know your score, and sets the alive variable
amount determined by speed/1000. The speed                         to false to stop the game loop continuing. At this
                                                                   point, you could reset the game, but in the interests of
                                                                   saving space, we've just asked the player to reload the
    SVG vs Canvas
                                                                   page to continue.
    As well as SVG elements, you can create Canvas elements           And that's it: a game in under 30 lines of JavaScript.
    in HTML which also hold scriptable graphics. The               If you want to extend it, there are loads of options,
    fundamental difference between the two is that SVGs
    contain the elements that make up the image (such as
                                                                   such as improving the graphics (you can load images
    the circles and rectangles that we drew) while canvases        in the same way we created shapes using the draw.
    just allow you to draw bitmap images. They don't hold          image(url) method), changing the difficulty level or
    the elements that go together to make up these images          adding features such as a gun on the ship.
    meaning that you, as the programmer, have to do more
    work to keep track of what goes where. The pay off for this
    extra work is that you can get higher performance out of a
                                                                    Ben Everard is the best-selling co-author of the best-selling
    canvas, particularly if there are lots of bitmaps displayed.
                                                                    Learning Python With Raspberry Pi.




                                                                     www.linuxvoice.com                                                                      89
     CODING MINSKY




MINSKY PART 2:
ECONOMIC MODELLING
Master global wealth fluctuations and understand every word in the FT…

ANDREW CONWAY
                              T
                                        he financial crisis of 2008, which saw banks    only going to track two quantities: the money held by
                                        fail or survive only with lifelines thrown to   all businesses, and the money held by all workers.
                                        them by governments, prompted many to           Let's suppose both totals start (at t=0) at 100
WHY DO THIS?                  take a greater interest in economics and ask why the      Quatloos or Q100, the Quatloo being the currency of
• Correct the pub bore        "experts" failed to see it coming. Minsky is free and     Triskelion. Also, the total wage bill to pay all workers is
  who oversimplifies (and     open source software that can model many types of         constant at Q100 per Triskelion year. One year is
  misunderstands) the news    dynamic systems, but its raison d'être is to model the    equivalent to t changing by 1 in the simulation (see
• Make money in your          economy: the flows of money through businesses,           the top-right of Minsky's window). Let's also suppose
  pyjamas on pork belly and
  orange juice futures        consumers, government and banks.                          that the good people of Triskelion always spend 80%
• Play God with an economy       Minsky was created by Steve Keen, one of the few       of their wealth in each time period.
  despite only having a       economists that did see the 2008 crisis coming. He            The boxout over the page shows how to set up this
  fragile understanding       named the software in honour of economist Hyman           simple model in Minsky using the Godley Table, which
  yourself!
                              Minsky, who argued that economies were inherently         uses double-entry bookkeeping to ensure that our
                              unstable and prone to sudden crashes, known as            flows of money are correct, and we're not leaking or
                              "Minsky moments".                                         creating Quatloos unintentionally. When you run this
                                 We're going to use Minsky to enter the world of        model you'll see that workers' wealth rises from Q100
                              economic modelling. If you didn't see part 1 of this      and levels out at Q125 after five years or so, whereas
                              tutorial in issue 22, do take a moment just now to read   the business total drops from Q100 down to Q75. As
                              the Quick Start boxout. All the screenshots produced      we hoped, the number of Quatloos in the economy
                              for this article have a corresponding .mky file you can   remains constant at Q200.
                              load up for yourself, though we recommend you try             Now, you might have thought the Triskelion people
                              and wire up at least the most basic models. You can       were a bit free with their money, always spending 80%
                              grab the .mky files from https://github.com/mcnalu/       of whatever they had available. If so, you might be
                              linuxvoice-minsky and load them using the Open            surprised to see that the workers did well out of this:
                              item under the File menu.                                 overall, Q25 went from businesses to the workers.
                                                                                        You can see why this balance occurred, because once
                              Consume what you earn                                     achieved the workers spend 80% of Q125, which is
In the paradox of thrift      Let's model a very simple economy of the planet           Q100 and equal to their wages. What this example
both businesses and           Triskelion, which starts with no banks nor a              illustrates is that consumers are limited to spending
workers try to save money     government. Imagine that there is full employment, so     what they get paid, and that in turn determines profits
and cause a disaster.         everyone is a worker who works for a business. We're      (or losses) of businesses.

                                                                                        The paradox of thrift
                                                                                        One of the business owners notices that workers are
                                                                                        saving 20% of their wages and that the business is
                                                                                        currently making a loss. The owner might well
                                                                                        conclude that she needs to cut the wage bill. She
                                                                                        decides to replace the fixed Q100 wage bill with one
                                                                                        that's set at 90% or 0.9 times consumption. This
                                                                                        means the simulation starts with consumption at Q80
                                                                                        and wages at Q72, so businesses make a profit of Q8
                                                                                        per year. When you run this simulation you'll see that
                                                                                        business ends up with all the money and the workers
                                                                                        with none. But look at the graph of wages and
                                                                                        consumption – this is not a good outcome for
                                                                                        businesses, but a disaster all round! Workers end up



90                                                           www.linuxvoice.com
                                                                                                                                         MINSKY CODING


  Minsky quick start
  You can build Minsky from source, but we used the
  binaries available from the OpenSUSE build service – see
  sourceforge.net/projects/minsky. In Minsky you are
  building a numerical simulation using components and
  wires rather than lines of code. Components either have a
  value, such const (a constant) and var (a variable), or are
  operators, represented by a triangle pointing to the right
  with a symbol inside. All of these can be placed by clicking
  on the symbols on the toolbar and clicking again to place
  them on the canvas.
     For example, to calculate z=x+3, you would place a var
  called x, another var called z and a const set to 3. If you set
  x to 5, either on creation or via a right-click, then z will take
  on the value of 8. However, this is dull because it doesn't
  change with time. To make things more interesting, drop in
  the special t operator (which generates time), then sin and
  wire it all up as shown on the left of the screenshot. Finally,     plotted against t. We won't be using the time operator directly     Minsky is about
  place a graph using its icon (bottom-right on the toolbar)          in this tutorial because it's part of the Godley Table, which is    economics, but you'll also
  and wire z up to a port at its left. Now hit the square button      key to Minsky's economic modelling capability. As noted in the      learn a nice bit of maths
  in the toolbar to reset the simulation and hit the Play button      previous tutorial, Minsky is a work in progress, so a few quirks    while you're modelling.
  to run the simulation and watch your graph of z=sin(t)+3 be         and bugs are to be expected.



with nothing, so spend nothing, and the businesses                       If you check, you'll find that overall wealth – adding
get no income and can only sit on their amassed                       up government, workers and businesses on the
Q200. This is known as the paradox of thrift, because                 graph – is constant at Q200, as before. But in time
if everyone tries to save at the same time (business is               businesses will accumulate much more than Q200
effectively saving by retaining profits) then it leads to             in wealth. You can interpret the negative wealth
an economic dead-end.                                                 of government in two ways: either the Triskelion
   In reality, the disastrous end-point is not reached,               government is becoming indebted to another planet,
because workers will not be able to save once their
income has fallen so low that they cannot afford
basics such as food and housing. However, real
                                                                         If everyone tries to save at the same
societies can end up with significant problems arising                   time (businesses do this by retaining
from increasing inequalities of wealth and income.
                                                                         profits) it leads to an economic dead-end
Government – spend and tax
Eventually Triskelion introduces a government, mainly                 or they are simply creating Quatloos out of nothing
to help manage economic collapses like the one we've                  (being the government, they can do that).
seen, but also to help regulate an endemic gambling                      After 30 years, the government decides to stem
problem. Government becomes a new stock column                        this outpouring of Quatloos by raising the tax rate to
                                                                                                                                             Now a government
in the Godley Table, and two new flows are introduced.                25% so that government taxes equals its spending                       spends money on paying
There is now an income tax of 20% or 0.2 on worker's                  (both Q25). Investigate this for yourself: pause the                   government employees,
wages that goes to the government, but the                            simulation at t=30, edit the 0.20 under wages to 0.25                  but taxes workers
government also spends Q25 per year on paying its                     and unpause.                                                           employed by businesses.
own workers, such as the teachers and doctors.
These lucky government employees on Triskelion pay
no tax.
   You'll notice that the wealth of the government –
shown by the black line on the graph – is negative. It
starts at zero and decreases because the government
spends Q25 but only gets back Q20 per year in taxes
(20% of Q100). So, overall, money is flowing out of
the government – the public sector – and to the
workers and businesses – the private sector. At first
the workers benefit most, but as their wealth rises so
too does their consumption until it equals their wages.
At this point the workers' wealth reaches a maximum
and the money flowing out of government goes
via consumption to the businesses, whose wealth
continues to rise.



                                                                        www.linuxvoice.com                                                                             91
     CODING MINSKY


  The Godley Table
  Let's demonstrate how to use the Godley Table with a
  simple model of Triskelion's economy. First, click the
  orange icon to place the Godley Table (named in honour of
  economist Wynne Godley, who among other thigs was also
  a director of the Royal Opera) on the canvas.
     Now double-click on the placed icon and in the window
  that opens click on the button that says noAssetClass
  and select asset. Then click in the white area immediately
  beneath and enter businesses, and click the + button at the
  top to create a new column, make it an asset and label it
  workers. In the row below that says Initial Conditions, set
  both to 100, then click the + button on the left to create a
  new row. Click in the first column and name the new row
  Pay workers, then under workers enter wages and under
  businesses enter -wages. This creates a variable that
  means the business total will be reduced by that amount
  and the workers' increased by an equal amount. Now in
  the same way create the row called Workers buy goods.
  Workers spend an amount called consumption, which goes
  from the workers to the businesses.                               The variables workers and businesses shown at the             Minsky shows the Godley
     Notice that the Row Sum column is zero for these two        bottom of the Godley Table icon are stocks because they          Table as a columned
  rows. This is an example of what's called double-entry         represent an accumulated stock of money, whereas wages and       portico that resembles the
  bookkeeping, where the same amount is shown as a credit        consumptions are flows, because they move between stocks         frontage of the Bank of
  (positive) and a debit (negative).                             each year.                                                       England




                                  The Triskelion government does a good job of                   paid at 10% per year. This is represented in the Godley
                                  managing the economy for many years, but then                  Table with a new stock called workers debt and new
                                  succumbs to populism and gears the entire economy              flows called lend and interest, which are defined to
                                  around betting on gladiatorial combat. Fortunately, a          the left of the Godley Table icon.
                                  starship visits the planet and its libidinous captain              You may have spotted the problem before even
                                  deposes the government. However, following his                 running the simulation: the workers will need to
                                  departure the economy enters turmoil in which both             borrow the Q20 shortfall every year, and in addition
                                  loss-making businesses and cash-strapped workers               they'll need to borrow the money needed to pay the
                                  panic, try to save and via the paradox of thrift drive the     interest. As such, their debt increases exponentially as
                                  economy into a deep recession; wages fall and get              does the assets of the business: one person's debt is
                                  stuck at Q50 per year.                                         another's asset. This means great inequality develops,
                                    The situation is modelled in the final boxout with           with the businesses holding all the wealth and debt
                                  the workers having zero wealth and the businesses              assets, and workers with no wealth and ballooning
                                  having Q200 at t=0. Wages of Q50 per year are well             debt liabilities. Although we've not had space to cover
                                  below the Q70 per year that the workers need to                it, the Godley Table can be set up to represent assets,
                                  survive, eg to buy food and pay rent. The businesses,          liabilities and also equity.
Now a government
spends money on paying            seeing their future is in peril too, decide to offer the
government employees,             workers credit, lending them the difference between            Apologies, congratulations and where to go
but taxes workers                 their wages and the consumption they need to                   We are sorry to say we have tricked you into creating
employed by businesses.           survive. In return, the businesses expect interest to be       and solving differential equations, and for that
                                                                                                 congratulations are also due. If you don't believe us,
                                                                                                 then click the equations tab at the top-left of the
                                                                                                 screen to see them. If you like Latex and want to print
                                                                                                 out prettier equations (say, to frame and put on your
                                                                                                 wall) use the Output Latex item under the File menu.
                                                                                                    You may well have noticed that these hypothetical
                                                                                                 situations on Triskelion have some parallels with
                                                                                                 societies on our own planet. If you'd like to learn more,
                                                                                                 feel free to experiment with your own models and also
                                                                                                 to delve into the more complex models explained in
                                                                                                 Steve Keen's video tutorials on his website:
                                                                                                 http://www.debtdeflation.com/blogs/minsky.

                                                                                                  Andrew Conway aspires to be a libidinous astro-economist
                                                                                                  starship captain, bestriding the universe like a colossus.




92                                                                 www.linuxvoice.com
                                                                                                                MINSKY CODING


INTERVIEW                                          Steve's T-shirt reads:
                                                   "The difficulty lies not

STEVE KEEN
                                                   in the new ideas, but in
                                                   escaping from old ones."


Minsky is the brainchild of Professor Steve
Keen who is currently Head of the School of
Economics, History and Politics at Kingston
University in London. We caught up with
Steve just before he headed off to the House
of Lords to offer advice on economics.

        What led you to create Minsky?
        Steve Keen: I've always been a critic
of mainstream economics. It makes several
fundamental assumptions that I oppose, but
particularly that the economy is in
equilibrium or is heading towards it, and that
it can be modelled without describing how
banks handle money.
   I also have a background in computing
and was editor of software magazines in
Australia from the early 1980s to mid-1990s.
During my PhD I used MathCAD and                 software and I preferred it because I knew       clone of MathWorks Simulink. There's also
Mathematica for non-linear modelling and         it'd help with adoption. Interestingly enough,   Modelica which, although a compiler, has
also came across VisSim.                         when I spoke to the then director of INET he     various graphical front-ends. We thought
   I started out modelling the role of money     said it's got to be open source otherwise        about basing Minsky on Xcos, but found it
in the economy taking inspiration from a         people will think George Soros (co-founder       too cumbersome. Had we known about
predator–prey model developed by                 of INET) is trying to make money out of it!      Modelica at the time we might have used it
mathematician John Blatt, added debt-                                                             as the basis of Minsky rather than coding
based investment to it and ended up with a             Minsky's visual approach has the           from scratch in C++.
chaotic model [related to the Lorenz model             potential to get folk to engage with
discussed in part 1]. That work was in 1992      new economic ideas without requiring                   Where do you see room for
and since then I've been working to include      them to have a conventional                            improvement?
banking in the model. At first I worked with     mathematical or economics training.              SK: On the economics side, I'd like to add
differential equations by hand, then used a      SK: Exactly. To engage people you need to        multi-sectoral modelling (eg private and
matrix approach with MathCAD, which in turn      be visual. Economics is still stuck in a         public sector or multiple countries). I've done
led to the tabular format used in Minsky.        tedious world of intersecting lines and          that by hand: a few years ago I was asked by
                                                 algebra with differential equations hardly       the UN environment programme to provide
       So that's what led to Minsky's            getting a mention. A good way to encourage       a non-equilibrium, multi-sector economic
       unique Godley Table feature?              people into my approach of non-linear and        model to provide input to an ecological
SK: Yes. I knew I wanted to design a             non-equilibrium thinking was a visual tool.      model of the environmental impact on
software package around the idea and                                                              southeast Asia.
obtained a $128,000 grant from the Institute           Minsky has been updated in the last
of New Economic Thinking (INET). At this               year, but how much time has                       What would you do if you had a
point I brought in Russell Standish, who's       Russell got to work on it?                              million-dollar budget for Minsky?
currently a visiting professor at the            SK: He's got to earn a living from coding so     SK: Go multi-user so I can take policy-
University of New South Wales, who has a         needs funding to work on Minsky. In 2013         makers through the economic model where
background in physics and who'd already          we raised $78,000 from 620 backers on            they can see the effects of varying taxation
built the Ecolab software (a dependency of       Kickstarter and more recently I've put some      and spending. That way I could demonstrate
Minsky also available on SourceForge).           of my own money into it, some which I've         to them that if they do simplistic things like
Russell then wrote the code for Minsky, so I     earned by giving talks to banks for a sizeable   reducing the government deficit they risk
found myself not only working with a good        professional fee. People can also give           increasing the instability in the system by
programmer but a good friend who                 money via my blog www.debtdeflation.             driving people to run up higher private debt,
understood my approach to economics.             com/blogs/minsky.                                which caused the last financial crisis. I'd also
                                                                                                  like to create a model repository so you can
     Whose idea was it to release Minsky              Is there other free and open source         have an HTML 5 application with several
     under the GNU GPL?                               software that is similar to Minsky?         users building a model together. Ultimately,
SK: Russell works with open source               SK: There's Xcos, which is part of Scilab – a    the goal is to properly model capitalism.



                                                             www.linuxvoice.com                                                               93
      CORETECHNOLOGY




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

                                      Privilege separation
                                      Typical Linux system hosts multiple users running many
                                      processes. How does it ensure all these inhabitants play safely?


                                      I
                                          f you've ever tried to prove to someone that Linux     UIDs and GIDs are usually assigned human-readable
                                          is better than Windows, you'll have used security      names. This is similar to how DNS maps hostnames
                                          as one of your arguments. Regardless of the            to IPv4 (or IPv6) addresses. Most often, UID and GID
                                      improvements that Windows has made in this field in        mappings are stored in /etc/passwd and /etc/group,
                                      recent years, Linux still enjoys the reputation of more    respectively. You can read them with the getent
                                      robust, solid operating system. A well-thought out         command:
                                      process privileges mechanism is what earned Linux          $ getent passwd val
                                      this reputation. You can't do any harm to your system      val:x:1000:1000::/home/val:/bin/bash
                                      unless you're logged in as root, and if you use Linux         To do this in the code, refer to getpwnam(3) and
                                      properly, you are almost never logged in as root. Today    related functions. UID is the number in the third
                                      we'll see how these permission bits stick together to      column, and the next one is the primary group's GID.
                                      ensure safe operation of our desktops, servers, and        They don't have to be equal, but often coincide, as
                                      even mobile devices.                                       Linux system designers tend to put each user in a
                                                                                                 separate group.
                                      A two-numbers game                                            Any user in Linux may also belong to some
                                      At the centre of the Linux privilege system lie two        supplementary groups. You can change this
                                      integers: these are User ID, or UID, and Group ID,         membership via the usermod -a -G command; note
                                      or GID. They may come in different "flavours", but         that this requires root privileges. Supplementary
                                      ultimately these are the credentials that the kernel       groups are convenient for rights management: say,
For unprivileged processes,
                                      uses to determine if a process should be granted           you add users to the plugdev group to let them
IDs aren't assigned but
                                      access to some resource, like a file, or rejected. A UID   access external storage devices in Ubuntu.
"rotated" between values
already in the set. A                 and GID of zero are reserved for root, and normal user        Despite the text above attributing credentials
change in effective ID                accounts often start at 1000, but the latter is merely a   to human users, they are really associated with
updates filesystem ID as              convention.                                                processes. In fact, processes may have several
well.                                    People aren't good at remembering numbers, so           instances of both UIDs and GIDs. The kernel switches
                                                                                                 them under strict rules, and this is how privileges
                                                                                                 change in Linux. Let's go through this step by step.
                                                                                                 We'll speak of user identifiers; for group identifiers,
                                                                                                 things stay precisely the same.
                                  Effective UID                            Filesystem UID           The three "flavours" of UID are 'real', 'effective' and
                                                                                                 'saved'. A real UID determines who owns the process.
                                                                                                 The effective UID is the value that the kernel checks
                                                                                                 when evaluating resource access requests. The
                                                                                                 process inherits both from its parent across fork(),
                                                                                                 and usually they are equal to each other.
          Real UID                                    Saved set-UID                                 A third flavour, saved set-user-ID, comes into play
                                                                                                 with SUID binaries. Ordinary programs have the
                                                                                                 privileges of the user who executes them. Specific
                                                                                                 programs, like passwd, may need higher privileges,
                                                                                                 however. Such programs often have a SUID bit set



94                                                                    www.linuxvoice.com
                                                                                                                                         CORETECHNOLOGY

with chmod +s (usually, during packaging). When the
kernel starts a SUID program via execve(), it overrides
the effective UID and saved set-user-ID with the file
owner's UID (often 0).
    For historic reasons, Linux also defines filesystem
UID. The kernel automatically keeps filesystem UID
in sync with the effective UID, unless you change the
former manually. We won't, and this Core Tech won't
deal with filesystem UIDs.
    Why bother to have so many identifiers for a single
                                                                                                                                            Enlightenment's display
process? The trick is how Linux switches between                        works in Linux, let's see how processes obtain their                manager can also set
them. A privileged process with an effective UID of                     privileges. LV019 already covered daemons, so we'll                 process credentials, and
0 can use setuid() and related system calls (see the                    stick to interactive processes here. For these, privilege           does this with a jolly dash
boxout) to change the IDs arbitrarily. A non-privileged                 assignment occurs mainly in two spots: when we log                  of eye candy.
user, however, is restricted to values that are already                 in, or when we launch something with su/sudo.
in the (real, effective, saved) set. So it can, say, change                For most desktop Linux distributions, login
effective UID to real UID or saved set-UID, but can't set               happens via display managers, like KDM (KDE) or
it to 0 and become root.                                                GDM (Gnome). Both are relatively complex pieces of
    For instance, consider a program that starts as root                software. So, for this Core Tech, we'd opt for classical
but then drops privileges with seteuid(1000). When                      and simpler login, which manages text-based terminal
it decides it wants to make a privileged operation                      sessions.
once again, it can issue setuid(0) and this will work,                     The login command comes as a part of the util-
because zero matches its real UID. This ability to                      linux package, and you can find it as login-utils/
escalate once-dropped privileges back could be a                        login.c in the sources. The actual authentication
security breach. To prevent this behaviour, most                        happens in PAM (Pluggable Authentication Modules),
programs use setuid(1000), which updates all three                      which is not our focus today. If all goes well, the
UIDs if the caller effective UID is zero.                               program calls getpwnam() to get a password
    Set-UID programs work in a similar fashion.                         database entry (struct passwd) for the user whose
Consider a SUID program owned by a non-root user,                       name was passed to login as a command line
but not you. You run it, and at some point it decides                   argument. If the authenticating user is not root, login
it doesn't need owner privileges anymore. So, it uses
setuid(getuid()) to set an effective UID equal to the                       The kernel switches UIDs and GIDs
real one (ie, "become you"). However, it can switch
back to its owner's UID at any time, as the latter is                       under strict rules, and this is how
also in the set as a saved set-UID. Unlike a root-owned
program, an unprivileged one can never forget its
                                                                            privileges change under Linux
origins. The reason for this is that it can't set any UIDs
to the value not in the (real UID, effective UID, saved                 calls initgroups() to fill the supplementary group list
set-UID) set.                                                           from /etc/group (for root, it's empty). Then setgid()
                                                                        is called to set the primary group ID. As login runs
Gaining privileges                                                      as root, any value is acceptable, and all three group
Now when we know how privilege mechanics                                IDs are updated. From now on, the process runs with


  Managing user and group IDs
  Linux provides quite a few system calls and library functions to get or set user and group IDs.

  User ID                Group ID                 Operation remarks
  getuid()               getgid()                 Return real user or group ID of the calling process.
  setuid()               setgid()                 Set all three IDs (superuser) or just effective ID (non-privileged).
  geteuid()              getgid()                 Get effective IDs of the calling process.
  seteuid()              setegid()                Set effective IDs. Doesn't affect other IDs (e.g. real) for privileged processes.
  getresuid()            getresgid() Get real, effective and saved set-ID of the calling process.
  setresuid()            setresgid()              Set real, effective and saved set-ID (superuser) or "rotates" them (non-privileged).
  getfsuid()             getfsgid()               Get filesystem ID (defaults to effective ID).
  setfsuid()             setfsgid()               Set filesystem ID (reset to effective ID whenever the latter changes).

  Besides, Linux provides getgroups()/setgroups() system calls          function, which initialises the supplementary group list as per
  to get or set a supplementary group list, and the initgroups()        /etc/group.




                                                                           www.linuxvoice.com                                                                        95
     CORETECHNOLOGY

                                                                                                   looking for is privilege separation, and there are some
                                                                                                   well-known ways to implement it in Linux.

                                                                                                   Playing safely
                                                                                                   Daemons usually start as root. Most often, this
                                                                                                   happens from an init script running as root, and
                                                                                                   daemons simply inherit their parent's permissions.
                                                                                                   Even if you start a daemon from the terminal, you
                                                                                                   have to use sudo, as it is considered a privileged
                                                                                                   operation. Furthermore, daemons often need
                                                                                                   superuser privileges, for instance, to bind network
                                                                                                   ports below 1024.
                                                                                                      However, most of the work daemons do is perfectly
                                                                                                   bearable for a non-privileged user. So, as the principle
                                                                                                   of least privilege stipulates, they should drop root
popa3d – a tiny (yet real-
                                   authenticating user group privileges, but it still has an       privileges as early as possible. Calling setgid() followed
world) POP3 daemon from
the producers of John the          effective UID of root.                                          by setuid() will do the trick, but what if the daemon
Ripper.                                Then, login sets environment variables (like $USER          wants to regain superuser rights occasionally?
                                   and $HOME) from the passwd entry, prints motd and                  Consider a POP3 mail server. Once bound to a port
                                   forks to create a new session (see LV019). Recall that          (110), it can accept connections, handle the protocol
                                   group IDs (and the environment) are inherited across            and read mailboxes as non-privileged user, provided
                                   forks. The parent watches the child, which does                 that mailbox files have the appropriate permissions.
                                   setuid() shortly afterwards. As it still runs as root, this     However, it also needs to authenticate users.
                                   updates all three user IDs. From now, the process               Depending on the password database used, this may
                                   is wholly owned by the authenticating user. Unless              imply being root. For instance, it'll need superuser
                                   that user is root, it's non-privileged, and has no way to       privileges to read /etc/shadow. Truth be told,
                                   switch back to root (which would be a security hole).           today's mail servers are usually not POP3 but IMAP.
                                                    The only thing left for login is to chdir()    Furthermore, they don't use system-wide password
PRO TIP                                             into the home directory and run the shell.     databases, but this is how real mail servers worked
You can find a really short, pseudo-code               When I said there is no way to switch       about 10 years ago.
like su implementation in the Android               back  to root, I lied a bit. We all know how      popa3d (www.openwall.com/popa3d) is one such
sources: https://android.googlesource.              to regain root privileges with su or sudo.     mail server. It was built for the Openwall project
com/platform/system/extras/+/master/
su/su.c.                                            Both are separate root-owned programs
                                                    (so technically I was correct) and both
                                                                                                     Capabilities
                                                    have set-UID bit set. su is also part of
                                   util-linux, and is more flexible as it can switch to any          We got used to the concept of almighty root user, but it
                                   valid user, not only root. "su" means "switch user",              doesn't have to be so. Instead of the brute all-or-nothing
                                                                                                     approach, you can assign granular privileges to specific
                                   while "sudo" is "do as super user".                               programs or execution threads (think processes).
                                       When su starts, the kernel sets the process                      In fact, the kernel doesn't check that you are root.
                                   effective UID and saved set-UID to 0. Then su does                Instead, it evaluates process capabilities, as in this excerpt
                                   most of what we already saw in login. It reads a                  from the setuid() system call handler:
                                                                                                     if (capable(CAP_SETUID)) {
                                   password database entry for the new user (root, by
                                                                                                       new->suid = new->uid = uid;
                                   default) and performs authentication via PAM. Then                  ...
                                   it initialises supplementary groups, and calls setgid()               There is a set of dedicated system calls to manage per-
                                   and setuid() for the new user. The order is important:            thread capabilities. For details on using this mechanism,
                                   if su did it the other way around, the setgid() call could        refer to capabilities(7). Alternatively, there is the libcap (not
                                   fail, as the new group ID doesn't match your effective            to be confused with the libpcap) package, which provides
                                                                                                     a higher level, more stable process capabilities interface.
                                   GID, real GID or saved set-GID. I say "your", not "root",         It also includes two tools – setcap and getcap – to
                                   because su is set-UID, not set-GID. After that, su                manage file capabilities. Chances are, you already use file
                                   modifies the environment and, optionally, creates a               capabilities without even noticing it:
                                   new session. Finally, a user-supplied command or a                $ getcap /usr/bin/ping
                                                                                                     /usr/bin/ping = cap_net_raw+ep
                                   shell is executed with execvp().
                                                                                                       ping creates raw network sockets, which is a privileged
                                       These are not the only ways processes gain their              operation. So, my Arch Linux system grants it CAP_NET_
                                   privileges, but the idea stays pretty the same in all             RAW capability, and I can execute ping as a non-privileged
                                   cases. su and sudo are preferred ways for short-                  user. Alternatively, ping could be made into a SUID binary,
                                   lasting administrative tasks like installing updates              which is the case for Ubuntu:
                                                                                                     $ ls -l /bin/ping
                                   – you shouldn't log in as root, you know. This all
                                                                                                     -rwsr-xr-x 1 root root 44168 May 8 2014 /bin/ping
                                   works great for end-users, but what if you need a                   File capabilities require filesystem extended attributes
                                   non-interactive daemon to perform some selected                   support, but it pays with greater overall security.
                                   privileged operations in a safe way? What you are



96                                                                  www.linuxvoice.com
                                                                                                                                  CORETECHNOLOGY

with security being the top priority. It's relatively                                                                                popa3d processes
short (about 3500 SLOC) and currently comes as a                                                                                     communicate over
standard in Slackware.                                                               Client connects                                 an unnamed pipe to
   So, how does popa3d separates privileges? Let's                                                                                   achieve proper privilege
track it from the entry point: the do_pop_session()                                                                                  separation. Red blocks are
function defined in pop_root.c. First, it creates                                                                                    code that runs as root.
                                                                                                                   Child
an unnamed pipe and stores it in the channel                                         do pop session()
variable. This pipe will be used later as a simple IPC
mechanism. Then the daemon forks, chroots to
                                                                                                               drop_root()
/var/empty` (see below) and drops privileges. From                                                           Drop privileges
now, two processes are handling the session: the
                                                                                         User-supplied
parent and the child. The parent runs as root and                                         credentials
                                                                  do_root_auth()                           do_pop_auth()
spins waiting for data in do_root_auth(). The child is
                                                                                                         POP3 authentication
unprivileged, and it runs the do_pop_auth() function
which eventually supplies client-provided credentials
                                                                  auth_userpass()
into channel[1]. Then the privileged parent reads               (read /etc/shadow)
them from channel[0] and checks them against /etc/
shadow. After that, it doesn't need root permissions                                                                       Exit
                                                                   set_user()
anymore, so it drops privileges again and continues
                                                                 Drop privileges
handling POP3 protocol messages.
   So, popa3d has both privileged and non-privileged
processes, which communicate over an unnamed                   do_pop_trans()        Exit when POP3 session ends

pipe. This is quite a common pattern, and the benefit         POP3 commands
is that the privileged process is never exposed directly
to the outside world. This way, if a service appears to
be remotely exploitable, the damage would hopefully         per-process setting, but most of the time all processes
be minimal. Privileged operations are requested             share the same view of a filesystem. In a nutshell,
through the IPC channel as needed. However, one             chroot() is a way to move a filesystem root directory
can't use this mechanism to run arbitrary commands.         down the tree. If a process does, say, chroot("/var/
In the example above, one can check a username–             empty"), its view of a filesystem will be restricted by
password pair, but you can't order a system shutdown.       what's in /var/empty.
                                                                One can readily see this as a hardening mean.
Escaping the jail                                           If a process has no access to data files, binaries
It's important to understand that there is no such          or libraries, it can't do any harm to them, even if
thing as ultimate security. Imagine the do_root_auth()      exploited. In fact, it may even refuse to run if a chroot
function contained a bug that caused buffer overflows       misses some essentials like glibc, but that's a whole
on long usernames. A remote attacker could still            another story. It would in fact be a hardening mean,
trigger the vulnerability, even if he never interfaces      if the process were unable to escape the jail. The
with the privileged process directly. A false sense         reality is that it can, so you should never treat a chroot
of security is worse than no security at all, and one       as security measure. This doesn't mean chroots
mechanism that's often overestimated is the chroot()        are useless: they come handy in packaging, for
system call. You know that in Linux, the filesystem         example. Chroots are just not what they aren't – Linux
has a single root. This means, any file or directory in     alternatives to FreeBSD jails or Solaris Zones (look at
the system is ultimately a child of /. In fact, this is a   namespaces(7) instead).




Command of the month: id
Now we know that user and group IDs come in three           the -a command line switch. In fact, this does nothing
flavours. To obtain them in code, you use the system        in Linux and is retained for compatibility only.
calls summarised in the boxout. But how do you know            Alternatively, you can get raw identifiers (eg for
who you are, in a shell?                                    use in shell scripts). id -u shows your effective user
   The id command is the answer. When run with no           ID, id -g prints your effective group ID, and id -G lists
arguments, it prints a summary of your credentials:         supplementary groups. Add -r (eg id -ru) to print real
$ id                                                        identifiers instead. Note there's no way to get saved
uid=1000(val) gid=1000(val) groups=1000(val),4(adm),10(     set-ID identifiers. You can also get IDs for another user
wheel),14(uucp),90(network),91(video),92(audio),93(optic    in the system with id <username>.
al),98(power),108(vboxusers),150(wireshark),991(docker)        Optionally, id can also print security context on
Quite often, you'll find a recommendation to supply         SELinux-enabled kernels. Use id -Z.



                                                              www.linuxvoice.com                                                                            97
     /DEV/RANDOM/ FINAL THOUGHTS




Final thoughts, musings and reflections
                           Nick Veitch
                           was the original editor      The nuc is a Gigabyte Brix with
                           of Linux Format, a           Celeron 2955U @ 1.40GHz,
                                                                                                                      Mic is Blue Yeti in a Blue Radius II
                           role he played until he      16GB RAM and 2x SSD. It is
                                                                                                                      shock mount with a Blue pop filter
                           got bored and went           my main workstation running
                                                                                                                      all hanging off a Rode PSA-1.
                           to work at Canonical         Ubuntu MATE 16.04.
                           instead. Splitter!
                                                                                                                  Mobile devices for playing
                                                                                                                  with Ubuntu Touch,
                                                                                                                  Cyanogenmod and Sailfish.
                                                                                                                  I have the converged
                                                                                                                  experience running now.



C
          ast your mind back to 1995, if you
          can. Robson and Jerome dominated                                                Dell Precision T7400.
          the music charts, the Pokémon craze                                             Was on Bitcoin mining
                                                                                          duty from mid-2009 until
was in full swing and Nicholas Cage was                 Behind the Entroware              end 2013 but now it is my
seemingly in every film released – but it               Apollo you can just make          Arch Linux development
                                                        out the Nexus 9 in a                                                  Chromebook Pixel 2015 i5 with
wasn’t all grim. Linux was still rather                                                   machine, Blu-Ray ripper
                                                        Logitech K480 keyboard.                                               8GB. Destined to become a full
                                                                                          and Steam box.
obscure, but Peter Mattis and Spencer                                                                                         blooded Linux workstation.
Kimball started working on something that
would help change that – a software project
known as The Gimp.
   It seems remarkable to remember, but in
five or six years it became a robust and             MY LINUX SETUP
remarkable tool that was actually superior to
Adobe’s Photoshop in terms of features and
standards compliance. So what went wrong?
                                                     MARTIN WIMPRESS
   It is fair to say the project lost momentum.      MATE hacker, Ubuntu MATE co-founder and Ubuntu Podcaster.
While the nascent Linux ‘Enterprise’ players
were happy to fund developers to work on                   What version of Linux are you                    really wanted a Unix for home but couldn’t
kernel features, filesystems and the like,                 currently using?                                 afford SCO UNIX. Once I found Linux I
graphics software was seen as, at best,                    Ubuntu MATE Xenial Xerus                         ditched OS/2 and haven’t looked back. After
non-essential. Hampered by a lack of                       development branch (what will                    Yggdrasil I used Slackware (1996–1998),
experienced devs and hamstrung by                    become 16.04), on my Entroware Apollo and              Red Hat, CRUX, Fedora, Ubuntu (2004–
technical debt (Gimp was, and still is, RGB          cheap Celeron nuc. Arch Linux on my Dell               2011), Arch Linux ( 2011 till present) and
only, in a world that wanted CMYK and                Precision T7400. Android on my Nexus 9                 Ubuntu MATE since I started making it.
more) it spent many years seeing only                and moto X Style. ChromeOS on my
superficial updates.                                 Chromebook Pixel 2015 and Acer                                 What Free Software/open source
   The solution was a comprehensive                  Chromebook C720. Sailfish 2.0 on my Jolla                      can’t you live without?
retooling around a new graphics engine               phone and a Nexus 4, Nexus 7 and bq                            My favourite piece of open source
(GEGL) which can take better advantage of            Aquaris E5 all running Ubuntu Touch.                           software is OpenSSH. I’m not looking
modern processors and address the                                                                           forward to Theresa May banning it but have
fundamental restrictions of the original                  And what desktop are you using at                 been brushing up on my Telnet and FTP
design – it’s no less than a complete rewrite             the moment?                                       skills for when the cryptpocalypse happens.
from the inside out.                                      MATE on all the proper Linux
   Twenty years on, although it may seem                  workstations. I really like LXQt as well.               What do other people love but you
like not much has changed recently, Gimp is                                                                       can’t get on with?
poised once again to dazzle. And if you want              What was the first Linux setup you                      First-person shooters. Ever since I first
to help it get there faster, you can always               ever used?                                              sat in a hydraulic Outrun while on
donate:                                                   Yggdrasil LGX in 1994. I was using                holiday in the summer of 1987 I’ve been
https://www.gimp.org/donating                             Unix and Microsoft Xenix at work and              hooked on racing games.



98                                                               www.linuxvoice.com
This is what we’ve done in the last 12 issues.
  Subscribe to the next 12 from just £38.




Every subscription includes access to every PDF, ePub and audio edition we’ve ever published.



              shop.linuxvoice.com