DOKK Library

Linux Voice [Issue 26]

Authors Linux Voice

License CC-BY-SA-3.0

Plaintext
         PROUDLY INDEPENDENT SINCE 2013
                                                                                      RASPBERRY PI 3
                                                                                        Hands-on with
                                                                                            the most
                                                                                             powerful




DESKTOP
May 2016                                                         www.linuxvoice.com            Pi ever




SHOWDOWN
  STREAMLINE
                                                                                          OVERLOAD YOUR
                                                                                          BRAIN WITH
  YOUR WORKING                                                                            EYE CANDY
  ENVIRONMENT




                                                                                          MAKE THE MOST
  CONFIGURE, TWEAK                                                                        OUT OF OLD
  AND FIDDLE YOUR                                                                         HARDWARE
  PERFECT SETUP




      Discover the perfect desktop with our ultimate guide
OPENSTACK Build your own enterprise-level cloud platform
WORKRAVE Protect the soft parts that you use to interface with the world
                                                                               32 PAGES OF TUTORIALS
GO Use Google’s own language to create the programs of the future

ALAN POPE                                             WE, THE PEOPLE
                                                                                           May 2016 £5.99 Printe d in the UK




MR COMMUNITY                                          THE LV MANIFESTO
Inside the mind of top                                We hold this truth
Ubuntu podcaster and                                  to be self-evident:
Canonical community                                   Free Software needs a
manager chap                                          firm kick up the bum!


ZEPHYR › NETSURF › OPENSHOT › SOLUS & MORE!
Email andrew@linuxvoice.com to advertise here


                                                15
                                                                                                   ISSUE 26 WELCOME



WELCOME TO LINUX!
The May issue                                                                             What’s hot in LV#026
                                                                                                   ANDREW GREGORY
                                                                                                   Ben took the trip to London,
                                                                                                   where the streets are paved with
                                                                                                   gold, to get his hands on the new
                                                                                                   and super awesome Raspberry Pi
                                                                                                   3. Since then, he’s run every
                                                                                                   benchmark he can think of on it!
                                             GRAHAM MORRISON                                       p22
                                             A free software advocate
                                             and writer since the late                             BEN EVERARD
                                             1990s, Graham is a lapsed                             Go is a programming language
                                             KDE contributor and author                            I’ve read so much about, but
                                             of the Meeq MIDI step                                 never had the confidence to give
                                             sequencer.                                            it a go. But our 6-page tutorial




M
                                                                                                   takes you from complete
            icrosoft has been in the Linux news quite a bit recently.                              beginner to ace image hacker.!
            Firstly, by announcing that its SQL Server will run on Linux;                          p84
            and secondly by announcing its own specialised version
of Debian Linux. Quite apart from what people may or may not think                                 MIKE SAUNDERS
about Microsoft getting into Linux, this is a remarkable and                                       With a new version of OwnCloud
monumental point in our favourite operating system’s history. If you                               out, new online bits for
were ever looking for a sign that Linux has made it, this is it.                                   LibreOffice and the excellent
   The question I’m now often thinking is, “What next?” Where’s the                                OnlyOffice, there has never been
next big challenge. Ben mentions in his feature on the new                                         a better time to get away from
Raspberry Pi (p22) that more children are taking up computing at                                   Google Docs.
                                                                                                   p68
school. Open source is now the default. Even open data and open
government have become important keywords. But for me it’s quite
clear: the challenge is now holding on to this openness in the face of
big corporate investment.
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, Juliet Kemp,                   3 We’re a small company, so we don’t
  Vincent Mealing, Simon Phipps,             have a board of directors or a bunch of
  Les Pounder, Mayank Sharma,                shareholders in the City of London to
  Amit Saha, Valentine Sinitsyn              keep happy. The only people that matter
                                             to us are the readers.



                                                                 www.linuxvoice.com                                                    3
     CONTENTS ISSUE 26 MAY 2016




                        Contents
                          More Linux! More everything really, as long as we can play with it.


    Regulars                                    Cover Feature
News                                      06
We’re still waiting for Wayland, and Debian
will be late – but we can while away the                                                                                                         14
time playing games on MAME, which has
now been released under Free licences.

Distrohopper                              08
All hail glorious Red Star, programmed in a
single night by Kim Jon-un himself after a
dream in which he learned C.




                                                                               2016
Speak your brains                         10
Literate dogs, our continuing shared
awesomeness, and a Russian doll of a
virtualisation question.

Subscribe!                            12/56
Save money, get the magazine delivered to
your door and get access to 26 issues of          THE YEAR OF THE DESKTOP
Linux Voice, in lovely DRM-free PDFs.

FOSSPicks                                 58
                                               This is the year the Linux desktop becomes too pretty, to fast, too
Software that soars on the waves of            functional for the computing world to ignore. We live in a golden age!
freedom like Lynyrd Skynyrd’s Free Bird
would if it were an actual bird.
                                                Interview                                     Feature
Core Tech                                94
Asynchronous disk I/O – how your machine
does something while it’s doing else. We
can’t even walk down the street and chew                                          34                                                             22
gum at the same time.

Geek Desktop                              98
Now we know why we love Arch users so
much - they’re in touch with nature! Just
look at this desktop to see and then read
some of Evil Nick’s words of wisdom.



                                               Alan Pope                                    Raspberry Pi 3
        SUBSCRIBE                              This man fixes bugs in Ubuntu phones.        Now with built-in WiFi and a 64-bit ARM processor, the Pi is
        ON PAGE 56                             He’s the hero the world needs.               tastier and more nutritious than ever.


                                                FAQ                                Group Test
                                               Zephyr                        32   Privacy distros               50
                                               The Linux Foundation jumps on      The best bundles of the
                                               another bandwagon: this week,      tools you need to keep your
                                               it’s the Internet of Things!       communications private

                                                                                               LIBREOFFICE CALC
                                                                                                TURN TO PAGE 26
4                                                               www.linuxvoice.com
                                                                                                 ISSUE 26 MAY 2016 CONTENTS


 Feature                                                                                                         Tutorials


                                                                                                     28


                                                                                                                Workrave                               66
                                                                                                                Gamify your break times and save those
                                                                                                                precious carpal bones from RSI.




                                                                                                                OnlyOffice                               68

Let’s fix Free Software!                                                                                        Flee Google’s tentacles and set up your own
                                                                                                                cloud-based office system.
When the whinging’s done, it’s time to put things right. Here’s how we can heal the world.
                                                                                                                Raspberry Pi                           72
                                                                                                                Get to grips with the powerful Linux
 Reviews                                                                                                        command line at the heart of Raspbian.

                                                                                                                OpenStack                                76
                                                                                                                If you’ve 16GB of RAM lying around unused,
                                                                                                     42         you too can build a cloud infrastrucure.

                                                                                                                Philips Hue                             80

NetSurf 3.4                                                                                                     CSS and JavaScript combine to give finesse
                                                                                                                to our lightbulb controller.
Why borrow someone else’s rendering
engine when you can write your own
and build a lightweight replacement for                                                                          Coding
Firefox completely from scratch?



OpenShot 2.0                     43    Solus 1.1                      44   OwnCloud Server 9.0             45
The power of crowdfunding              The consumer-friendly good-         This self-hostable cloud solution
brings us the latest version of this   looking desktop OS is back, and     does everything – and now it’s
Free Software video editor.            it’s better than ever.              even taking on Facebook.


                                                                                                                Go                                     84
                                                                                                                Those clever sausages at Google have a
                                                                                                                written a smashing programming language.




Gaming on Linux                                     46   Books                                           48
Run, jump, shoot, plan tactics and win battles in        This month we’re most excited about learning to        Olde New Code                             90
real time against friends and foes on the internet.      code our games. Sharpe’s Opium War is going to be      What’s next in the world of coding? Find out
Also, pretend to drive big trucks across America.        the best-seller of 2017!                               with our soothsayer Juliet Kemp.



                                                                   www.linuxvoice.com                                                                     5
    NEWS ANALYSIS




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


Compliance?
Why is it so hard to follow the terms of a software licence? Well, it isn’t…

                          Simon Phipps             software for users are actually a                     Using an open source component is
                          is ex-president of the   comparative strength. Yes, industries with         equally bound by law. But additionally:
                          Open Source Initiative
                                                   strong fiduciary compliance rules will want           The licence aims to create a set of
                          and a board member
                          of the Open Rights       to include their open source software in the          liberties serving a community rather than
                          Group and of Open        mix with the rest of their responsibilities. But      a set of constraints serving a copyright
                          Source for America.      even that burden is lighter than for                  holder.
                                                   proprietary software. Open source licenses            Respecting the intent of the copyright
                                                   are standardised and non-negotiable, so               owner is a matter of community
                                                   once you’ve learned about the ones in your            conformity rather than iterative
                                                   business there’s nothing more to do.                  negotiation.



W
            hat does “open source licence                                                                Flouting the intent of the licence is thus
            compliance” mean, and does it          It’s not a big deal…                                  just as much a problem as breaching the
            affect you? It certainly affects       Maybe the people making a big deal out of             precise definition of its terms.
VMware, which is being sued by the                 “open source compliance” really mean                  When you build a business model that
Software Freedom Conservancy. It also              something else, then? Licencing maven              flouts the intent of the copyright holders, you
affects Versata, which is embroiled in a           Eben Moglen once shared a key insight into         can expect trouble. Compliance is the act of
complex lawsuit surrounding copyrighted            open source licensing. He explained that           trying to flout that intent without actually
source code. What did they do, and should          open source licences are best seen not as          facing legal consequences. The reason the
the rest of us be worried?                         legal agreements but as “the constitution for      VMware case in particular is so significant is
   In the wake of those recent lawsuits I have     a community”. While the licences we                that everyone involved has understood from
seen more discussion of “open source               encounter with proprietary software are            the beginning that VMware’s interpretation of
licence compliance” than usual. Clearly the        bilateral agreements – someone once                the licence expressly aims to avoid needing
experiences of these companies have struck         described them as “peace treaties” – open          to engage with the communities from where
a chord, even if only with suppliers whose         source licences are multilateral agreements        it derives the driver support code.
business depends on fear of compliance             describing a shared understanding of the
failures and mitigating that fear                  collaboration that’s taking place.                 … unless you make it a big deal
   Licence compliance is a major and costly           When you use a proprietary component            This is clearly not a simple case of
issue for proprietary software, but the            under bilateral licence terms, you do so           accidental non-compliance or even one of
licence involved in that case is an End User       knowing the intent – and prohibitions – of         isolated wilful abuse, as both the Software
Licence Agreement (EULA), not a source             the copyright holder. The way you use the          Freedom Conservancy and the FSF have
licence delivering liberties beyond mere use.      code is bound within the licence, and the          implied. It’s likely that the root of the dispute
In fact, mere use of open source software is       usage and abusage of the code is clear. If         is a difference in outlook. VMware sees the
never contingent on compliance; it is freely       you abuse the code, you can expect the next        code as a commons to be legally ravaged,
granted by all open source licences.               version to come with stricter licence terms        while SFC regards it as a shared community
   Of the many attributes of software              or to receive preventive action from the           property. The way the GPL is interpreted
freedom that could move to front-of-mind, it       copyright holder. If you’re making an app for      flows from those outlooks.
strikes me that the minimal licence                Apple, it may well re-express the intent once          Compliance – as applied to those trying to
compliance burdens for open source                 it sees how you try to circumvent it.              blend the GPL with proprietary code – is not
                                                                                                      primarily a matter of logic, law and licences.
    When you build a business model that flouts                                                       It’s about trying to circumvent the
                                                                                                      consensus of the community behind the
    the intent of the copyright holders, you can                                                      code with clever legal loopholes and

    expect trouble down the line                                                                      linguistic sophistry. Is it any wonder that the
                                                                                                      community wants to fight back?



6                                                              www.linuxvoice.com
                                                                                                      ANALYSIS NEWS



        Raspberry Pi • Wayland • Steam • MAME • Mint • FFmpeg • Collabora



CATCHUP                                                      Summarised: the biggest news
                                                             stories from the last month

          Raspberry Pi 3 is here                      Wayland will not be                           Steam on Linux reaches
   1      The Raspberry Pi has now             2      default in Fedora 24                    3     1,900 games
          overtaken the Amstrad PCW                     Wayland, the replacement                     A decade ago, the idea of
(remember that?) as the UK’s most           for the ageing X.org display server,           Linux being a killer games platform
successful computer. Now we have a          has seemed just around the corner for          was... well, laughable to be honest.
new version, the Raspberry Pi 3, which      many years now. Fedora developers              But now, largely thanks to Steam, it’s
is 10 times faster than the original        were hoping to use it as the default           superb, and we have over 1,900 games
model thanks to its quad-core 1.2 GHz       in their next distro release, Fedora 24,       to choose from. Onwards and upwards!
CPU. In addition, it has integrated Wi-Fi   but it turns out that it’s just not on par
and Bluetooth – so no need to add           with X.org for features. It’s a shame, as
more USB dongles! This makes the            Wayland offers many benefits in terms
dinky device very usable as a simple        of simplicity and performance, but we’ll
home desktop machine. For Pi expert         have to wait a bit longer. Wayland will
Ben Everard’s assessment of the new         still be an option in Fedora 24 for those
gizmo, turn to page 22.                     who want the bleeding edge.




          MAME released under                         Collabora Office 5.0 is                       Debian 9 “Stretch” release
   4      Free Software licences               5      now available                           6     date slips slightly
           MAME, the rather awesome                     LibreOffice is great, but if you               Debian often gets flak for
Multiple Arcade Machine Emulator, is        want to roll out an open source office         its slow-paced release schedule, but
one of our favourite projects, letting us   suite in an enterprise, you’ll probably        we appreciate that it makes the distro
relive the glory days of 1980s and          want commercial support. Collabora             super-solid and great for use on servers
1990s arcade machines. Until now,           Office 5.0 is based on LibreOffice 5.0 (with   and in enterprises. The next release,
MAME was released under a licence           some extra goodies backported from             Debian 9 (aka “Stretch”) will now
that restricted use in commercial           5.1) and comes with three years of             arrive a bit later than expected, due
activities – to stop arcade operators       long-term support. Meanwhile,                  to integration of the upcoming Linux
from building MAME cabinets, and            Collabora is beavering away on a               4.10 kernel. The current plan is for the
keeping the original machines going.        version of LibreOffice that works in the       distro to go into “freeze” – so no more
Now MAME has moved to GPL and               cloud, to compete with Microsoft’s             features added – on 5 February 2017,
BSD, eliminating that restriction.          Office 365 offering.                           with the final release to follow shortly
www.mamedev.org                             www.collaboraoffice.com                        after that.




          Linux Mint website falls                                                                  FFmpeg 3.0 released
   7      foul to crackers                                                                    8       If you use VLC, Xine, Blender
           We often recommend Linux                                                                   or Google Chrome, you’re
Mint as one of the best distributions                                                      using FFmpeg. This provides libraries
for new Linux users, offering a polished                                                   and tools for handling a vast range of
desktop and plenty of support for extra                                                    multimedia formats – and it’s just going
drivers and multimedia formats (often                                                      from strength to strength. Version 3.0
via proprietary software, admittedly)                                                      brings about many improvements and
out of the box. But in late February the                                                   optimisations, such as 30 new filters,
Mint website was cracked and ISOs of                                                       VP9 hardware acceleration, a stable
the distro were replaced by a version                                                      AAC encoder, and a Cindeform HD
containing malware. The problem was                                                        decoder. Expect it in the next round
found early on, but it reminds us that                                                     of distro updates, or if you’re feeling
Free Software is only as secure as the                                                     adventurous, grab the source code here:
machines that serve it up.                                                                 www.ffmpeg.org




                                                      www.linuxvoice.com                                                              7
     DISTROHOPPER LINUX DISTROS




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


Subgraph OS
Secure and user-friendly


T
         he recent security issues in Linux
         Mint show that even the most
         secure of operating systems isn’t
always secure enough. On the other hand,
an ultra-secure Linux distro that’s also easy
to use for the average user isn’t easy to
come by. That’s where Subgraph comes in,
offering an array of security features that are
normally only accessible to more
experienced users. Subgraph mitigates the
resource-hungry nature of such systems,
and it can be run even on lower-end
machines, making it even more accessible.
  The distribution is aimed at journalists,
activists and others who may have good             Subgraph OS could prove to be hugely useful for journalists and citizens of authoritarian regimes.
reason to require this level of security, but
might not have the technical knowledge to          system imaginatively called Subgraph Mail,         applications from each other, so if one is
set it up on an existing Linux distro or deal      which integrates OpenPGP. As expected, the         exploited, others are less likely to be
with distributions aimed at advanced users.        distro also comes with Tor, which is used          affected, reducing the chances of sensitive
  Subgraph comes with the Security-                with any application that performs                 information being accessed.
Enhanced Linux (SELinux) kernel module             communications, through its inbuilt                   A final release of Subgraph OS was
preconfigured, already saving one major            Metaproxy software, while applications             supposed to be nearing completion back in
headache. It also has a variety of useful          allowed to make communications are                 2014, but as of 2016 it has yet to move past
features such as full disk encryption and          limited. Another useful feature is a system        the pre-alpha stage, though the developers
access to an in-house encrypted mailing            called Oz, which isolates individual               indicate that things are moving along nicely.




Red Star OS
Don’t actually install it


N
         orth Korea’s homegrown Linux              renamed with their icons changed, though
         distribution has been undergoing          some aspects have undergone more
         some visual tweaks, dropping the          substantial changes. Firefox has been
ancient default KDE 3 interface in favour of       renamed to “Naenara” and is used to browse
something that looks like someone was sick         the country’s “Kwangmyong” intranet, since         North Koreans are apparently impressed by
on OS X. The distribution is only available in     internet as we know it is only available to a      excessive Compiz effects.
Korean, there is no 64-bit version and it is far   small fraction of the population.
more oppressive than other state-sponsored            Wine also comes pre-installed, presumably       with things such as the firewall, among
Linux distros such as Cuba’s Nova and              so that the regime could have a smoother           other paranoid-fuelled additions. One thing
Venezuela’s Canaima, which also both               transition when switching the country’s            that the regime is keen to combat is the
feature newer software and desktop                 Windows computers to Red Star. The                 passing around of western film and music,
environments. The distribution consists            Fedora-based system reboots itself or              so Red Star also watermarks all files so they
mostly of existing software packages,              throws errors if the user attempts to tamper       can be traced. Nice.



8                                                              www.linuxvoice.com
                                                                                                        LINUX DISTROS DISTROHOPPER



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


“S
       low and steady wins the race” is the
       mantra behind BSD, in that updates
       tend to be quite unexciting, but as a
result provide the stability and reliability for
which the operating system is famed.
DragonFly BSD saw such updates, with a
4.4.2 bugfix release after the meatier 4.4
update was released late last year. The
PC-BSD developers have released version
0.8.8 of the Lumina Desktop Environment,
consisting mostly of bugfixes and minor
tweaks that make it more straightforward to
set up, as well as out-of-the-box support for
NetBSD. The Lumina Desktop aims to hit 1.0
by July of this year alongside FreeBSD 11,
and will deliver a lightweight Qt 5 desktop
environment across Unix-like systems.
   On the other hand, the FreeBSD team has                The lightweight and customisable Lumina Desktop running on PC-BSD.
released a report highlighting the progress
made throughout 2015, and it’s pretty                     and X.Org, support for more ARM hardware                  coming to an end. Website maintainers had
substantial. Some achievements include                    and much more.                                            reportedly been receiving harassing emails
assessing whether to accept GPLv3 code                      In the OpenBSD camp, it seems that a                    for years since the system uses Comic Sans
into the source repository, updates to MESA               14-year-old joke by developers may be                     Serif as the default font for HTTPD status
                                                                                                                    pages and some visitors were extra-enraged
   The FreeBSD team has released a report                                                                           when experiencing 404 errors in the font. A
                                                                                                                    patch has been offered and it has become
   highlighting the progress made throughout                                                                        apparent that the use of the font was an
                                                                                                                    attempt by some FreeBSD folks at “annoying
   2015, and it’s pretty substantial                                                                                hipsters into donating money” to the project.


  MenuetOS and KolibriOS
  Digging deep into the realms of obscure operating systems, we find MenuetOS
  and its derivative KolibriOS. Both operating systems are ambitiously written
  entirely in the FASM assembly language and are incredibly tiny. (Many
  distributions of each operating system are small enough for their installers to
  fit on a 1.4MB floppy disk!) On top of this, the systems can run on as little as
  8MB for RAM and 1MB of disk space in the case of KolibriOS, while providing a
  full graphical desktop environment. Needless to say, bloatware isn’t really an
  issue here.
      As if this weren’t impressive enough already, both systems can run on
  incredibly old hardware (i586 processors) and still boot within a few seconds.
  To show off even more, KolibriOS is capable of full 1080p video and comes with
  more games than any other type of application, ranging from simple 2D
  minesweeper-like affairs to the likes of Quake and Doom. Its video drivers are
  based on the open source Radeon driver and are also shown off with support
  for eye-candy such as transparent windows.
      What immediately comes to mind here is the possibility of installing this on a
  Raspberry Pi, though since both only support the x86 architecture, this would
  unfortunately not be possible. Other things which aren’t possible include using
  either MenuetOS or KolibriOS as practical working desktops, since they lack
  basics like office suites, though there is a port of NetSurf (the go-to web          KolibriOS makes even the likes of Puppy Linux (which is genuinely
  browser for smaller operating systems) in the works for KolibriOS.                   tiny) seem huge and bloated by comparison.
      These ambitious projects, which are currently offered in three languages and
  support a multitude of filesystems, are worth keeping an eye on to track their       64-bit version of MenuetOS is released under a proprietary licence that allows
  development. Both operating systems are licensed under the GPL, though the           for non-commercial use only.




                                                                        www.linuxvoice.com                                                                              9
     MAIL YOUR LETTERS




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


             DOGITAL RIGHTS MANAGEMENT
             Every month my copy of Linux Voice arrives via by my
             neurotic, letterbox-guarding pet dog – always just about
             readable by me, but at the same time badly enough
STAR         traumatised to make it unfit for any kind of redistribution.
LETTER          Just one of those things or a cunning low-tech
             implementation of DRM via special dog attracting paper?
             And will I be prosecuted for circumvention if I’m caught
             with sellotape?
             Simon French

             Andrew says: Funnily enough, mine does the same.                  Our subscriptions team has no thumbs, so cannot take your
             Here’s a gratuitous picture of the ravening beast.                calls. Don’t phone him – turn to page 12 instead!



             A WHEEL WITHIN A WHEEL BITS AND BOBS
             I currently use SUSE “Tumbleweed” and Mint “LMDE” at              Has anyone noticed the pushing of x64 distros,
             home and I have been using Linux and free software for            particularly with those other magazines that offer a disc
             about 20 years. While I know my way around Linux and              – hmm hope no one here started the trend, or act of
             can sort out most problems eventually, I wouldn’t consider        sabotage! That’s great and I make use of such a distro
             myself to be a programmer or hacker.                              myself. No problem then. Well actually there may be. For
                 My work-supplied laptop is currently running Windows          many Windows users are using 32-bit, state-of-the-ark
             7 and will shortly be upgraded to Windows 10, with all of         devices; don’t tell Microsoft!
             its telemetry and privacy concerns. I have asked my work            Doesn’t the push for x64 distros in Linux magazines go
             if I could run my upgraded laptop on Linux, but they have         against part of the message that we all are trying to give
             said that I must run Windows for corporate security,              out: namely that it’s easy to switch to Linux, which still
             network, some proprietary programs and for support                runs brilliantly on older systems.
                    reasons, which also means that I can’t have a Linux          For many of us who are lucky enough to have newer
                       dual-boot option installed.                             machines then all is well. But I wonder if this switch has
                            As I value my security and privacy and trust       just come a little to early, as I see that many people are
                           the security of Linux, as a suggestion, I           happily using older machines, running Windows XP as
                            wonder if you would consider a project or          well! What are your thoughts on this? Does it matter?
                            tutorial, whereby an existing Windows              Oscar S
                            installation (eg the work supplied laptop)
                            could be run as a virtual machine under a          Andrew says: If you’re trying to evangelise, the
                           non-installed Linux distribution (from say a        way to do it is with 32-bit distros. A 64-bit distro
                          USB drive), allowing for the running of its native   is nice to have for the already converted, but the
                       Windows corporate log ons, corporate printer            poor huddled masses on old hardware running
                    access and drivers and exclusive proprietary               unsupported Windows XP installations need
             Windows programmes when required, but use Linux for all           every chance they can get of having a working
             other uses and also have the Windows privacy and                  system, and that
             security concerns addressed by Linux, eg a firewall,              means downgrading
             without having to re-boot. If this is practical, I would think    the OS to match the
             that there could be other people in the situation where this      hardware. Even 32-bit,
             approach might be of interest.                                    Linux is going to be a
             Malcom, Scone                                                     massive speed boost
             Andrew says: Noted. We’ll look into this.                         over old XP.



10
                                                                                     YOUR LETTERS MAIL


ELECTRONS
I just wanted to say a big thank you for offering your
magazine in PDF and ePUB formats. I’m partial to PDF
because you can mark it up and the markups stay with
the file, unlike with the ePUB format.
    I recently cancelled all of my digital subscriptions with
Zinio because of numerous problems experienced over
the past four years, either with their app or with account
snafus. I recently tried a subscription with your main
competitor via Google Play Newsstand, but I’m not able to
verify my subscription, so I’m going to cancel that
subscription as well. I’m glad there are some companies,
such as Linux Voice, who know how to do digital
subscriptions right. Keep up the good work.
Kurt Meyer                                                                                     If you’ve
                                                                                               subscribed, you
Andrew says: Thanks for the praise! We are trying                                              should be able to
our best. And in the UK, print magazines attract no                                            read Linux Voice
VAT, whereas epubs and PDF incur a 20% tax to Her                                              on any device you
Majesty’s Revenue and Customs. So we’re doing                                                  choose. That’s
the right thing (saving the trees, etc) despite being                                          how we do things
                                                                                               round here!
incentivised not to.



MORE PRAISE!
I am sure you are tired of hearing how awesome you are,
but I will say it again anyway. You are awesome! Keep up
the good work.
   And to put my money where my mouth is, I will
re-subscribe to the digital version once my current one
runs out. You guys need all the support you can get. Have
gotten some of my colleagues and friends to subscribe
also. That’s it. Hope this letter encourages more people to
do the same.
Gabriel Ozoani




                                                                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
     FEATURE 2016: THE YEAR OF THE DESKTOP




                                                                     21




THE YEAR OF THE DESKTOP
                             2016
       We spend a month
                             B
                                     ack in the olden days, there were       know what’s out there, and we’ve never taken
                                     things called ‘desktop fights’, where   a practical, visual look at what many of the
          trying the most            the merits of one desktop would be      most common desktops offer, until now.
     awesome desktops to     pitted against the merits of another. The          We’ve spent the last few weeks playing

               to work out   results were often polarising and seldom
                             led to any insight, and that was because
                                                                             with what we consider the 10 most popular
                                                                             Linux desktops, and we’ve attempted to
         when best to use    there couldn’t be one ‘best desktop.’ There     look at each objectively, regardless of the
        one, two or three.   are just too many different ways to use your    distributions we’ve been running them on. We
                             computer, and so many different kinds of        haven’t been trying to work out which was
                             users. This is what makes Linux unique – if     best, but rather we’ve looked at what kind
                             you don’t like something, you’re encouraged     of users may be able to get the most out of
                             to improve it or try something new.             them. Most of these desktops can even be
                                Rather than being corralled into one way     installed alongside your current favourite,
       “We’ve spent the      of doing something, such as with Apple’s        especially with one of the big distributions,
                             OS X and Microsoft Windows, for example,        so you don’t need to make any significant
         last few weeks      we can all decide for ourselves depending       commitment. Just give them a try and see
       playing with the      on our own requirements – whether that’s a      what you think. The fact that you can do this
        10 most popular      command line interface for a Raspberry Pi       is still amazing, all these years after the old
                             or a 3D cube running on KDE on a powerful       KDE versus Gnome debate, and we can’t
        Linux desktops”      PC. But before you can decide, you need to      encourage you enough to give it a go.




14                                           www.linuxvoice.com
                                                                      2016: THE YEAR OF THE DESKTOP FEATURE


               UNITY 7.4
               Ubuntu’s desktop is moving closer to convergence with its mobile devices.


   1

                                                                                                                   4

                                                                         3
                                                2




                                                    6




       8                                                                                       5

                                            7




The one element that really                 by default, sending your searches to
differentiates Unity from other desktops    Ubuntu servers and saving you from
                                                                                           Unity
is its all-powerful ‘Dash’ interface. One   Amazon products being returned in
press of the Meta key or a click on the     any lenses. But it also disables useful       1 Dash One click here and you can search

Ubuntu icon on the top-left and the         integration with non-commercial              everything, launch apps and explore content.
                                                                                          2 Lenses Data is pooled from all kinds of
default search scope appears, letting       online resources like Wikipedia, which
                                                                                         ‘aggregated scopes’, a little like having Google on
you quickly access your applications or     is disappointing. If you want to turn it     your desktop.
files. Clicking on the small icons below    back on, the option can be re-enabled in      3 Powerful filters Focus on specific results using a
lets you view applications, files, videos   the Security & Privacy panel.                keyword search.
music and photos.                                                                         4 General settings As with Gnome, use this quarter

   These are now called ‘Aggregation        Dash, Dance, Prance                          of the screen for networking, switching users and
Scopes’, or lenses, and they’re             Unity also does its own thing with           settings access.
                                                                                          5 App store Not-Unity specific, but the UI and dash
aggregating content from different          menus and window navigation. For
                                                                                         integration makes this a powerful feature.
sources in an attempt to make things        many applications, all menus will             6 Dash Plugins Add more integration by by
easier to discover. The music lens has      appear in the same place as part of the      installing plugins.
the potential to include files on Google    top panel, regardless of whether the          7 Settings One panel is used for all the major Unity

Drive, for example, or tracks held on       application is windowed or near the top.     settings, including turning on online search.
                                                                                          8 Panel Scale this and the top menu from the
Amazon, and the back-ends that bring        Unless you’ve used OS X, which does
in this data are called ‘scopes’. Scopes    the same thing, this can take some           display config panel.
are a big part of the Ubuntu Phone          getting used to. But it does help Unity to
operating system too, where they’ve         feel the most integrated because most
become the central way of navigating        applications look and behave the same.
through the operating system.               GTK applications in particular, like
   We’re also happier now that Ubuntu       Firefox and LibreOffice, feel just at home
16.04 no longer enables online scopes       on Unity as they do on Gnome.



                                                             www.linuxvoice.com                                                           15
     FEATURE 2016: THE YEAR OF THE DESKTOP


                 GNOME 3.18
                 A desktop that’s easy to use, minimalist and doesn’t get in the way.

                                                                                  3
     1                                               2                                                                                4




                                                                                                                                  5




                                                                                               6
                                          7




     8




                                                     VHS vs Betamax. Xbox vs Playstation.           developer’s conference. Gnome doesn’t
  Gnome 3                                            iPhone and Android. Technology is              have scopes nor the persistent panel on
                                                     littered with rivalry, and it used to be the   the left, and it’s taken a long time to
 1 Activities Moving the cursor here, or using the   case that Gnome and KDE were often             reach maturity and acceptance, but it’s
Meta key on your keyboard, launches Gnome’s          pitted against one another. But this           definitely getting there. Each release of
overview of everything you’re doing.
                                                     battle was more for the media – like           the last 18 months has been fantastic,
 2 Search From the activities overview, you can

search and select files and applications.
                                                     Blur vs Oasis – than it was a reflection       and we’re seeing it on more and more
 3 Notifications Messages from your applications     of the users and developers, and that’s        laptops. The latest version includes
now appear here and re-appear with a click of the.   because both desktops have always              Google Drive integration and a lovely
 4 User control Logout, change networks, enable      done things differently. Gnome is for          new calendar; the version before that
the VPN and open the settings.                       people who like to get things done, and        updated notifications and improved
 5 Workspaces These work just like virtual
                                                     that’s because there’s little in the way of    Nautilus, the file manager.
desktops – drag your windows into a new space
                                                     distraction. By default, for instance,            Desktop integration is another plus
and switch quickly with shortcuts.
 6 Apps View See your running applications, or       there are very few settings to tweak, but      and one that can’t quite be rivalled by
choose from files and apps to launch.                each and every option is considered            other desktops. This is thanks to so
 7 File manager Nautilus is an integral part of      and important, from the built-in privacy       many third-party projects choosing
Gnome, complete with tabs and integration with       settings to the network manager.               GTK, the toolkit used to develop
services like OwnCloud.                                                                             Gnome, being used to develop their
 8 Panel Choose between multiple windows and
                                                     Integration                                    own projects, from Gimp to Firefox and
use the matrix to open the application launcher.
                                                     Gnome’s unique take on application             LibreOffice. For advanced users, we also
                                                     launching and management, where a              like the way the internal configuration
                                                     hotkey or screen corner is used to open        options can be changed and updated
                                                     a shell, shares the same roots as              in realtime, especially when using
                                                     Ubuntu’s Unity. Both desktops came             gnome-tweak-tool, giving you the best of
                                                     from ideas shared at the same                  all worlds.



16                                                       www.linuxvoice.com
                                                                        2016: THE YEAR OF THE DESKTOP FEATURE


               KDE PLASMA 5.5
               A great choice for users who want a desktop that bends to their will.


                                                                       3




        1



                                                                                                        4
                                    2




                                                                                                                   5



                                        8




                                                             7                              6




KDE is one of the two desktops that         is KDE’s great strength – there’s a KDE
most people associate with Linux, and       tool or application for doing almost
                                                                                                  KDE Plasma
while both Gnome and KDE started out        everything, and many of these are near
looking somewhat similar, KDE is the        the best in their class.                             1 Widgets You can add multi-functional widgets to

only one to have stuck with a simple                                                            the background and to any number of panels.
                                                                                                 2 Settings System-wide options are all in the same
launch menu and a panel at the bottom,      Dolphins with lasers
                                                                                                place, and you can change almost anything about
so beloved by Windows XP users.             The file manager, Dolphin, is the perfect           anything.
   Many of the default choices are          example. You can quickly split views,                3 Plasma Search Press Alt+F2 to search the
sensible and hide the technical aspects     preview multimedia files, scale the                 internet and local files, look up words and perform
effectively. The Settings panel, for        icons and sort by any number of file                calculations.
                                                                                                 4 KDE Apps Applications such as Dolphin that use
example, offers the KDE-flavoured           attributes, including image resolution
control over almost everything, from        and album name, if you wish. The                    KDE’s libraries are well integrated with the system.
                                                                                                 5 Konsole The shell can be launched separately, or
changing the theme, the panel, the          terminal emulator is another example,
                                                                                                from apps like Dolphin and Kate.
background and icons to adding users,       and is our favourite regardless of                   6 Notifications KDE supports both on-screen
configuring the VPN and integrating         desktop. It’s tabbed with split views, has          notification and in-panel notifications.
online accounts. Each page is well          bookmarks, profiles and an infinite                  7 Panel Add as many or as few panels as you like,

designed and easy to use, and while the     scrollback. But it’s the small things that          floating, vertical or horizontal.
                                                                                                 8 OpenGL and Wayland Scalable drawing is
icons themselves can be a little small,     make the difference, like when you’re
we feel this integration is the best of     searching for a word in the buffer the              possible and Wayland support is coming soon.
any desktop.                                console highlights new instances of
   There’s a KDE-flavoured app for          that word as they appear, and these
almost every task, and if you’re a KDE      small differences are littered
user, you’ll likely prefer the way those    throughout KDE, whether it’s Digikam,
applications are built. Over and above      the Caligre office suit, Krita illustrator or
the ability to configure everything, this   simply re-configuring the dock.



                                                              www.linuxvoice.com                                                                17
     FEATURE 2016: THE YEAR OF THE DESKTOP


                MATE 1.12.1
                A retro desktop that’s now going from strength to strength.

Mate (pronounced ‘Mah-tay’) shares a similar origin to
Cinnamon, and that was Gnome 3 changing its                                  1

desktop – replacing the panel and launch menu with a                                                                                                 2
shell that acts much more like a launcher on a mobile
phone. Mate started out as a fork of Gnome 2.x,
whereas Cinnamon modified GTK 3, but both preserve
the original desktop metaphor of the previous era.
Mate, in particular, is brilliant for the many users who
liked the top/bottom panel approach of Gnome 2. We
tried the latest Ubuntu Mate 16.04 (a late beta at the
time of writing). It’s a lovely desktop that reminds you
just how polished Gnome was when it wore a
charcoal grey palette and chunky icons. It’s quick too,
reminding you that, for once, your computer is many
                                                                         4
times more powerful than it was just 10 years ago.
   The desktop wasn’t the only thing that forked: there                                                                 3

are Mate versions of many of the Gnome applications,
including the old file manager (Caja), the image viewer
(Eye of Mate) and the terminal emulator. It may sound               Mate
like Mate is more of a time capsule from 2011, but it’s
not. GTK 3 applications work natively and the only real            1 Launch Menus Mate looks like Gnome from 2011, and that’s a good thing. 2 Panels All the same

differences come from usability and aesthetics, which             applets are available and they’re all you need. 3 Mate apps There are native apps for Mate, just as
is something we’re very happy about.                              there are for KDE and Gnome. 4 Screen locking Windows can be locked to parts of the screen.




                 CINNAMON 2.8.6
                 People of the world. Spice up your life!

                                                                                                    Like Mate, Cinnamon was developed to maintain the
                                                                                                    old desktop metaphor. But rather than forking Gnome
                                                                                                    2.x, it built a new desktop atop GTK 3, forking
                                                                                                    applications where necessary. The project was
            1
                                                                                                    started by the Mint development team, which is where
                                                                                                    the most recent version can usually be found, but it
                                                                                                    hasn’t stopped Cinnamon being ported to the vast
                                                                                                    majority of other distributions.
                                                                                                       Thanks to using a modern API, Cinnamon’s
                                                                                                    minimalism doesn’t extend to its appearance or
                                                                                                    adaptability. Fonts can be scaled, for instance, and
                                                              3                                     they can all be updated in real time using a slider. The
                            5                                                                       theme engine is equally responsive, and while there’s
                                                                                                    nothing like the amount of control you find in KDE, you
                                                                                           2        can swap-out window decoration, icons, window
                                                                                                    buttons and desktops – all saveable as a theme and
                                                                                                    configurable through the settings panel. All this visual
  Cinnamon                                                                                          finesse is because Cinnamon uses ‘Muffin’, a fork of
                                                                                                    the Gnome 3 window manager, bringing together the
 1 Window management Window snapping, hot corners and great screen rendering. 2 Native apps         best of the classic design with modern graphics
and panels Each version of Cinnamon brings more modern convenience. 4 Applets Not as                manipulation. We also love the way panel applets can
advanced as KDE’s, but more practical and less resource hungry. 5 App launcher This has a great     be installed and even downloaded in-line, much like
interface, making it easy to find what you need without resorting to Unity’s Dash.                  you can with KDE’s own downloadable GUI elements.



18                                                                  www.linuxvoice.com
                                                                                   2016: THE YEAR OF THE DESKTOP FEATURE


                 XFCE 4.12
                 The best combination for speed and visual prowess.

                                                                                                       Despite their lack of power, older computers used to
                                                                                                       start more quickly. It would take a second or two for a
                                                                            2                          Commodore 64 to go from power switch to BASIC,
                                                                                                       and the Amiga booted to Workbench in seconds if you
                       1                                                                               had a hard drive. Modern desktops seems to waste
                                                                                                       much of their new power on shiny effects, drop
                                                                                                       shadows and even wobbly windows, but this doesn’t
                                                                                                       happen with XFCE. It’s a great-looking, powerful
                                                            3
                                                                                                       desktop that doesn’t steal too many cycles from your
                                                                                                       CPU, nor memory from your RAM, while still
                                                                                                       managing to look sleek and modern.
                                                                                                          XFCE is stable and comprehensive, including
                                                                                                       everything you need, from session management and
                                4                                                                      an application finder to its low-resource yet super-
                                                                                                       powerful Thunar file manager. Like KDE and Gnome, it
                                                                                                       feels like a complete desktop, one that adds character
                                                                                                       to the way you interact with your computer, even if all
                                                                                                       you’re doing is launching full-screen applications. It’s
  XFCE                                                                                                 also stable and mature, with few changes being made
                                                                                                       from one release to another. It’s easy to see why so
 1 Thunar The all-conquering file manager. 2 Eye candy It may be austere, but there’s lots of visual   many old Gnome users love XFCE, and why you don’t
potential too. 3 Panel items Add lots of new things to your panel. 4 Settings A mature set of          think about it much. It does what it’s designed to do
settings panels can change almost anything.                                                            with very little fuss.




                  LXQT 0.10
                  Lightweight doesn’t always have to be built around the GTK look and feel.

When it first appeared, we were hugely impressed by
a desktop called Razor-qt. Built using very little but the
Qt 4.3 API, it felt like a super-slim version of KDE for
users who didn’t need anything other than a panel and
                                                                                                1
a launch menu. It didn’t even include a window
manager, although most of us used either KDE’s
KWin, or OpenBox. Which is why we’re happy to see                                                                                            2

the project survives, merged with components from
LXDE and reborn as LXQt.
   Like Razor-qt, you have to select a window manager
before starting, so this isn’t the most friendly desktop,
but this kind of choice doesn’t bind you to your chosen
environment in the way it does on Gnome or KDE, for                                                                      4
example, even though it’s perfectly acceptable to use
                                                                                                                                                      3
KWin with Gnome, or Mutter with KDE. This is also the                                    5
first of the really minimum desktops we’ve looked at.
Other than providing an environment for running your
applications, there’s very else little to see. There’s a
modifiable panel and launch menu, a GUI for sudo                        LXQT
privilege escalation, a new Wayland-compatible status
notifier and a brilliantly simple file manager called                  1 File manager Fast, and works just like KDE 2. 2 Settings Native panels for changing most

PCMan. The rest of LXQt is simply an ultra-fast                       options. 3 Theme and Effects Basic but great-looking effects. 4 Powerful panel The panel can be
desktop built with a modern Qt look and feel.                         themed and widgets added. 5 Launch menu Open this with Alt F1 on the keyboard.



                                                                        www.linuxvoice.com                                                                         19
     FEATURE 2016: THE YEAR OF THE DESKTOP


                ENLIGHTENMENT 17.6
                If you miss gradients and you’re looking for darkness, this may be for you.
                                                                           This is a famously lightweight      resources, and it races along on
                                                                           desktop that feels like it was      modern hardware. You even get
                                                                           designed by an Amiga demo           to select the text size before you
                                                                           crew. It’s full of widgets and      get to the desktop, which is a
                                                                           panels with shaded gradients        brilliant feature if you’re running
                                                                           and light flares. Everything        this on a high DPI display, and
                                                                           scrolls into and out of view like   there are plenty of modules and
                                                                           part of a parallax starfield, and   configuration options to play
                                                                           there are subtle animations with    with. Even the window selection
                                                                           almost every element, from the      is unique, because you select an
                                                                           menus to the battery widget. But    application by rolling your cursor
                                                                           this is still a powerful desktop    over the window, which is
                                                                           that requires relatively few        enough to activate the process.




                DEEPIN 15.1
                Sometimes, looks are everything.
Deepin is a both a relatively new      used to configure everything
Linux distribution and an              from two-finger scrolling on your
associated desktop                     touchpad to keyboard shortcuts.
environment. It looks wonderful           The lovely aesthetic of the
and behaves quite differently to       user interface is carried over to
other desktops. In particular, all     its suite of native applications.
settings are hidden within a           There’s a music player, a video
vertical panel that takes up the       player, an app store and a
entire right side of your screen,      terminal. They all feature the
smoothly sliding into and out of       same polished transitions and
view when you need it. It’s a little   graphical finesse, making this
like the notification area in          one of the best-booking
recent versions of OS X, and is        desktops we’ve ever tried.




                XMONAD
                Minimalism is a feature.
                                                                           To finish our look at desktops,     see. Absolutely nothing. Press
                                                                           we wanted to include one of the     Alt+Shift and return and you’ll
                                                                           several excellent tiling window     get a full-screen terminal. Press
                                                                           managers available for Linux.       that combination again to get
                                                                           These aren’t strictly ‘desktops’    another. Now press Alt+Space
                                                                           because their main feature is the   to switch between tiling modes.
                                                                           lack thereof, but they perform      And so it continues. It’s ultra-fast
                                                                           the same function, giving you an    and ultra-responsive, and after
                                                                           environment to launch and           you’ve learned a few keyboard
                                                                           manage running applications.        commands, and added the
                                                                             Xmonad is written in Haskell      xmobar and dmenu modules, it’s
                                                                           and takes some getting used to.     a brilliant way to interact with
                                                                           To start with, there’s nothing to   your computer.



20                                                            www.linuxvoice.com
                                                                       2016: THE YEAR OF THE DESKTOP FEATURE


WHICH DESKTOP IS BEST?
We recently asked our readers on              the 300ms delay between workspace          version that must not be named and
LinuxVoice.com to tell us which               switching and a few other minor things,    never looked back, because it just helps
desktops they preferred and why. We           but it’s mostly vanilla Unity.”            me get stuff done while not standing in
had many responses, and the answers              Just working and ‘boring’ seemed        my way.”
were as varied as you’d expect, with no       important for users who just wanted to     Electronic Penguin praised the
clear consensus on which desktop was          get on and do their thing.                 configuration elements of XFCE: “To
leading, despite many commentators            Jack “Gnome 3. Just gets out the way       me it seems to… [have] the best balance
settling on one desktop or another.           and lets me get on with things, as         between functionality and systems
Here, we’ve selected a few of our             well as looking good. The shortcuts        resources staying out of the way.”
favourites.                                   and keys just work for my brain, and I     Tommi Helander and Peter Warrington
saif: “I like Unity. It seems to me so        really like for Super maps to Activities   both plumped for KDE, ith Peter finding
many people dumped Unity, and                 overview, and how I can drag and           out about KDE 5 from our very own
Ubuntu along with it, because they            drop windows between monitors and          humble Linux Voice podcast. How
didn’t like change. Along with this came      Workspaces.”                               that’s public service broadcasting?
an enormous amount of vitriol and hate        Nick: “I love myself some Cinnamon.           We used to wonder which desktop
for something that is what Linux is all       Not just because the name summons          would come to dominate, but it has
about…more choice and a platform for          memories of Christmassy, winterly          become clear that one of Linux’s great
innovation. Since the early days, Unity       tastes, but also because it looks          strengths is that there isn’t a single way
has improved and those who stuck              sufficiently boring, so I can get some     of doing things, and different desktops
with it helped it get better.”                work done while not being distracted       reflect the different needs of their users.
blahdeblah: “Unity, because Ubuntu just       by wobbly windows. Joking aside,           That so much choice still flourishes on
works out of the box nowadays, and            I switched to it, when Gnome2 was          Linux is something we can all be proud
I like boring. I’ve tweaked it to remove      abandoned in favour of the Gnome           of, and we think, celebrate.




CHOOSE YOUR PERFECT DESKTOP


       UNITY                         GNOME                          KDE                         MATE                         CINNAMON
   BEST FEATURES                  BEST FEATURES                BEST FEATURES                BEST FEATURES                  BEST FEATURES
   1 Brilliant integration      1 Distraction-free desktop    1 Integration with many     1 Gnome at its old-school      1 The best of old and new
  2 Consistent, clear and              2 Easy to use            KDE/Qt applications                  best                     desktop ideas
        easy to use               3 Very close to being a        2 Configure almost         2 Fast and lightweight      2 Excellent theme options
   3 Convergence turns          standard for Linux desktop            everything              3 Modern and well            3 Built atop GTK 3, so
  mobiles into desktops               environments                 3 Looks brilliant              supported             modern applications fit well




       XFCE                            LXQt                         E17                        DEEPIN                         XMONAD
   BEST FEATURES                  BEST FEATURES                BEST FEATURES                BEST FEATURES                  BEST FEATURES
      1 Very stable              1 Quick and responsive          1 Unique desktop            1 Looks fabulous                 1 Tiny resource
 2 Thunar is a brilliant file    2 A Qt/KDE look and feel           appearance           2 Has its own collection of            requirement
        manager                   3 Transparency effects       2 Themes are easy to          custom software                2 Fast and efficient
    3 Comprehensive             without prohibitive system            create             3 Simple, unified settings        3 Zero distractions by
  configuration options                 overheads                3 Stable and fast          make it easy to learn            graphical frippery



                                                              www.linuxvoice.com                                                                21
     FEATURE RASPBERRY PI 3




        RASPBERRY PI
         D
                                 Four years after the first board came out,
                                 the Raspberry Pi enters the 64-bit world.
                   epending on how you count leap-year
                   anniversaries, 29 February 2016 was either
                   the fourth or first birthday of the Raspberry Pi.
                                                                       popular with tinkerers who want a small low-power
                                                                       computer and makers who are finding new and
                                                                                                                         3
                                                                       around the Raspberry Pi, and the computer’s proving



          Either way, four years have passed since the first went      interesting ways to utilise the input and output
          on sale and promptly crashed their online shop.              capabilities in their projects.
             We’ve watched the original board evolve first into            However, the Pi is at its heart a board designed for
          the B+, then the Pi version 2, and finally, on Monday        education, and in this area there’s been huge progress.
          29 February, the Raspberry Pi Foundation released            Through its Picademy program, the Pi Foundation
          the Raspberry Pi Model B version 3. The new board            is training teachers, and we’re starting to see a real
          promises more features and better performance for            impact from their educational work. The number of
          the same price ($35 or about £27) and the same size.         students taking computing at A-Level (16–18 years
             Sales have continued to grow, and with 8 million          old) increased by almost 30% between 2014 and
          units sold, the Raspberry Pi is now the best-selling         2015, and while there are many reasons for this,
          British computer of all time. Unsurprisingly, these          at least some of the credit goes to the work of the
          sales figures mean that there’s a huge community             Raspberry Pi Foundation inspiring students.



             Through its Picademy program, the Raspberry Pi
             Foundation is training teachers, and we’re starting
             to see a real impact from their educational work

22                                                        www.linuxvoice.com
                                                                                                                   RASPBERRY PI 3 FEATURE


THE RASPBERRY PI MODEL 3
A closer look at the new board.
Place a Raspberry Pi 3 model B next to a Raspberry Pi
2 model B and it’s hard to tell the difference. The most
obvious change is that the power and activity LEDs
have switched sides and in their place, a small,
innocuous white block holds the biggest difference
between the two devices – it’s an aerial. The Pi 3, with
its onboard Wi-Fi and Bluetooth, is the first device in
the Pi family to have integrated wireless
communications.
   Most people with RasPis have been using USB Wi-
Fi, so the onboard Wi-Fi isn’t so much a new feature
as a cost saving of around £10, since there’s now no
need to buy a separate Wi-Fi dongle. There’s a second
advantage in that the data through the Wi-Fi will no
longer take up bandwidth on the USB bus. This leads
to better performance if you’re also heavily using other
USB devices, for example, streaming data from the
network directly onto a USB memory stick.
   Bluetooth is probably less important to most people
than Wi-Fi. It will enable you to use Bluetooth mice
and keyboards (note: not all wireless devices are
Bluetooth-enabled, so check before buying). This will
also enable you to use Bluetooth audio in headphones
and external speakers.

Pi for all the projects
The Internet of Things (IoT) is a tech buzz-phrase                  example We don’t see this being a particularly popular
that’s rarely left out of press conferences in 2016, and            option initially, because current IoT devices aren’t easy
the launch of the Pi 3 was no exception. With Wi-Fi                 to connect with this sort of setup. However, previous                   Eben Upton (centre)
and Bluetooth, the new Pi is more attractive in this                versions of the Raspberry Pi have proved popular with                   from the Raspberry Pi
                                                                                                                                            Foundation celebrates
area than earlier models. There are two parts to the                small businesses developing new products, and we
                                                                                                                                            the launch of the Pi 3
IoT: the things themselves, and hubs that are used                  imagine that this could well be the same. Look out for
                                                                                                                                            with Claire Doyle and
to control the things. While the Raspberry Pi is small,             Pi 3-powered smart home products in the near future.                    Richard Curtin from
cheap and low-power by computer standards, it’s                        The second big change is even harder to see:                         Element 14 (the company
large, expensive and high-power by IoT standards,                   the new System on a Chip (SoC). There are four                          manufacturing the new
and this makes it unattractive for most things that                 Cortex-A53 processing cores heart of the Pi 3 running                   boards).
could be connected to the internet. It is, however,                 at 1.2GHz. This compares with four Cortex-A7 cores
well provisioned to make an in-home hub for a smart                 running at 900MHz (overclockable to 1GHz) for the
home setup. A Raspberry Pi could control your                       previous model. The biggest difference between the
lighting over Wi-Fi and heating over Bluetooth, for                 two chips is that the new processor is 64-bit while the


  Wild speculation
  We’re not privy to the internal discussions of the     and B. The model A is most useful for robotics due        couple of years. The most obvious upgrade now is
  Raspberry Pi Foundation, but we’re not going to let    to its small size and low power, so adding wireless       to the RAM, and we’re going to guess that the next
  that stop us making some predictions about the         communications to this will be a useful advantage.        major release will be a 4GB version of the Pi 3, with
  future. The simplest is that we’ll see new versions       The next significant upgrade to the model B will       a release in the first quarter of 2017.
  of the model A and the Compute Module featuring        be to the memory. The Pi Foundations’s been able             One final piece of speculation is that we won’t
  the new 64-bit SoC this year – this isn’t really a     to upgrade so much in four years because it began         see a significantly improved version of the Pi Zero,
  guess, as the Foundation has already announced         with quite an out-of-date processor. Even in 2012,        at least, not in 2016. It would be too hard to hit
  this on its blog. We’ll add to this the speculation    the ARM v6 chip in the original Pi looked a little        the price point with anything faster or with more
  that the new model A will feature Wi-Fi and            aged. The Pi 2’s chip brought the device far more         features. That, and the name suggests to us that
  Bluetooth. This is a guess based on the physical       up to date, and the ARM v8 chip in the Pi 3 is really     they didn’t release it with an upgrade in mind –
  position of the wireless communications on the         quite modern. It’s unlikely that the Pi Foundation        what would they call it? A Pi 0.2? a Pi 1/2? (We
  board – they’re up near the SD card, and this end of   will be able to source a chip that is noticeably faster   wouldn’t rule out the possibility of a Pi Zero + based
  the board is almost identical between the model A      than the Pi 3 at the same price point for at least a      on the same SoC but with a few new features.)




                                                                      www.linuxvoice.com                                                                                23
     FEATURE RASPBERRY PI 3




Above: The Pi version 3
                                  older one is 32-bit. However, at the time of writing, all           B+, the power issues for USB devices have reduced
retains the four USB ports
and introduces power              the Raspberry Pi operating systems were 32-bit and                  significantly, and we’ve found that we rarely have
control that can supply           running on the newer chip in backwards-compatibility                problems with the usual setup (mouse, keyboard and
more current to attached          mode, so don’t take full advantage of the longer word               Wi-Fi). However, if you’re using more than this, the
devices.                          length. We expect future distros to bring in full 64-bit            extra half an amp may mean you can get by without
Above right: The small            support, which should speed up the software though                  using a powered USB hub.
white rectangle in the            we don’t yet know to what extent.                                      Perhaps the most minor upgrade on the new Pi
top-left corner is the Wi-Fi        The new Raspberry Pi comes with a reconfigured                    is to the SD card slot. On the new board, cards are
antenna that brings new
                                  power supply unit that can handle up to 2.5 amps.                   pushed in and pulled out rather than pushed in, then
networking powers to the
                                  This doesn’t really affect the board itself, because it             pushed again to release them. It’s a minor change, but
latest Raspberry Pi.
                                  draws much less power than this, but it does enable                 one that will please anyone who’s ever accidentally
                                  the new Pi to supply more current to external devices,              pushed an SD card on a running Pi and had it pop out
                                  particularly USB devices. Since the release of the Pi 1             and crash the Pi.



Features of the Raspberry Pi Model B Version 3

                                                                                                            9
                                                                              7
                                                                                                                                          10

                                                                                    8



                                                                                                                                                    1

                                                                                                                                                             2




                     6
                                                                                        4
                                                                                                                                                                   3

                                             5




1 Power and activity LEDs have moved to make way for Wi-Fi 2 Connector for official 7-inch touch display 3 Aerial for wireless networking 4 40-pin header with 26

addressable GPIO pins including UART, I2C and SPI functions 5 Mounting holes for Pi HAT extension boards 6 Four USB ports can supply more current than previous
Raspberry Pi models 7 Four-pole connector for audio and composite video output 8 Connector for official camera module (also available without IR filter for low-light
photography) 9 HDMI output 10 Micro USB power input can now handle up to 2.5A.



24                                                                     www.linuxvoice.com
                                                                                                                                       RASPBERRY PI 3 FEATURE


               BENCHMARKS
              We find out just how fast the new Pi runs.

                                                                               Raspberry Pi benchmark performance averaged by area
Time to complete compared to Raspberry Pi version 3 (percentage)




                                                                   180


                                                                   160


                                                                   140


                                                                   120

                                                                                                                                                            Pi 3
                                                                   100                                                                                      Pi 2 Normal
                                                                                                                                                            Pi 2 Overclocked

                                                                   80


                                                                   60


                                                                   40


                                                                   20


                                                                   0
                                                                         CPU                          Memory                                  GPU

               The Raspberry Pi 2 took 30–60% longer to perform the benchmarks than the new Raspberry Pi

              At present, the Pi 3 doesn’t officially offer any                                   time the Pi 2 took. The wired Ethernet port on the Pi 3
              overclocking, while the Pi 2 can be overclocked from                                still goes through the same bus as the USB, so to get
              900MHz to 1GHz. We tested the performance of the                                    this level of performance, you have to use the onboard
              Pi 3 against both of the configurations of the Pi 2.                                Wi-Fi, but it makes the Pi much more attractive as a
                 Our first set of tests compared the performance                                  NAS controller. The new networking controller isn’t
              of the key systems on the board: CPU, memory and                                    going to lift the performance of the Raspberry Pi to
              graphics. Each of these showed a significant speed                                  the level that you’d expect from some of the other
              up over the previous generation. The Raspberry Pi                                   ARM boards that include gigabit networking or SATA
              Foundation claims that the new board is 50–60%                                      hard drive controllers such as the Odroid C2 or the
              faster than the Pi 2, and our benchmarks support this                               x86 MinnowBoard, but it does bring much better
              for the Pi 2 at default clock speed. Compared to an                                 performance and enables you to keep benefitting
              overclocked Pi 2, the speedup is about 30–40%. Since                                from the Raspberry Pi software and community.
              both devices are quad core, this speed increase is
              reflected in both single and multi-core performance.                                Better, better…
                 All models of the Pi have all their networking                                   The new Raspberry Pi is faster than the previous
              options on the same bus as the USB ports. This                                      model, but it’s not the same step up as the transition
              means that if you were heavily using the network and                                from the Pi 1 to the Pi 2, when we saw a six-fold
              USB devices at the same time, you could run into                                    increase in performance. The 30–40% speedup over
              performance issues as this bus reached capacity.                                    an overclocked Pi 2 is noticeable, but it’s not enough
              On the new Pi, the onboard Wi-Fi is connected to a                                  to really change the usage of the device.
              different bus, so shouldn’t cause the same level of                                    For us, the onboard Wi-Fi is the biggest feature
              problems. In order to test this, we streamed data                                   of the new device. Unless you’re specifically having
              over a wireless network directly onto a USB memory                                  performance problems, the Pi 3 doesn’t offer enough
              stick. On the Pi 2, we used a USB Wi-Fi dongle. This                                new features to recommend abandoning a Pi 2 for it.
              test simulated the performance characteristic of the                                However, if you’re in the market for a new single-board
              Pi used as a network attached storage device (NAS)                                  computer, the Raspberry Pi 3 Model B should be the
              device. The Pi 3 transferred a 400MB file in 53% of the                             first device you consider.



                                                                                                    www.linuxvoice.com                                                   25
     SECRETS LIBREOFFICE




SECRETS OF
LIBREOFFICE
LibreOffice Writer is capable of way more than simple text documents.


W
            ord processors are one of the most under-utilised              that should be simple enough for someone to pick up and use
            applications – not because they’re rarely used, but            without any training. In truth, a word processor is the most complex
            because they’re rarely used to their full potential. Many      bit of software that most computer users use.
people just use them as text editors with better font control, but            In order to stay useable to beginners, many of the more advanced
they’re far more than this. A good word processor includes the             features are hidden away. Linux Voice is here to shine a spotlight and
features of a desktop publisher, spreadsheet, drawing tool, text           help you uncover the full power of one particular advanced word
formatter and Turing-complete language all into one neat package           processor – LibreOffice Writer.




                                                                                                01                                         02



                                                                                                         03
                                                                                                                       Formulas
                                                                                                                       Need to perform a
                                                                                                                       calculation in your
                                                                                                         document? You could open up a
                                                                                                         separate program, work it out, and put
                                                                                                         the answer in, but that way, you can’t
                                                                                                         see how you calculated the result when



              01                                            02
                           Layout                                        Drawing                         you go back. Instead, you can add the
                           Normal documents are laid                     If you need to add an           Formula Bar (View > Toolbars >
                           out from top to bottom and                    illustration to your            Formula) and embed the actual
               from left to right. Adding text at the top   document, there’s no need to switch to       calculation in the document. Only the
               will push all the content down, and it’ll    a separate program: just enable the          answer will appear in the text, but the
               flow onto other pages if need be. This is    drawing toolbar and sketch from within       maths will be saved so you can go back
               exactly what you want for most text          Writer. The options are a little limited,    and edit it in the future.
               documents, but occasionally, you need        but more than enough for a quick flow



                                                                                                         04
               a little more control over the layout. In    chart or simple diagram. By keeping all                     Styles
               Writer, you can add text boxes to specify    the material in a single file (rather than                  Proper management of
               exactly where you want the text to go        including a picture created elsewhere),                     styles will make your
               regardless of how the rest of the            you only have to keep track of changes       documents look a lot better. This
               document flows.                              in one place.                                doesn’t just mean making stuff bold or
                                                                                                         italic, but creating named styles that

     If you need to add an illustration to your                                                          you then apply to your text as you
                                                                                                         create your document. These named
     document, there’s no need to switch to a                                                            styles enable you to update particular
                                                                                                         styles across your whole document in
     separate program: just sketch from within Writer                                                    one go, and by saving styles in



26                                                            www.linuxvoice.com
                                                                                                       LIBREOFFICE SECRETS



                                                                                03                                                     04



                                                                                05

                                                                                                                                       06



                                                                                                                                       07
templates, you can ensure consistency       to hieroglyphs. Linux Voice is reliably
across a range of documents.                informed that the youth of today now
                                            mostly communicate in small icons



05
             Navigator                      known as Emoji. LibreOffice, ever keen
             The Navigator is Writer’s      to move with the times (even when that
             most powerful document         movement is towards anarchy), makes

                                                                                                                                       08
management tool. It enables you to          it easy to insert these abominations
manage the various parts of your            into documents by placing a word
document from a single, dockable tool       between two colons. For example,
set. Using the Navigator, you can see all   :keyboard: will insert a picture of a
the aspects of your document and also       keyboard. Why that’s better than just
move them around. For example, if you       writing the word keyboard we don’t
decide to switch two sections of your       know, but who are we to argue with the
document, you can use the Navigator’s       forces of progress?
Chapter Up function to move a heading



                                            07
and block of text up (or down) through                    Hybrid PDFs
the document rather than having to                        There are two ways you



                                                                                         08
copy and paste it manually.                               can share documents:                         Addons
                                            PDFs and editable formats. The former                      Can’t find the feature you’re



06
              Emoji                         method is great because it guarantees                      looking for? No problem.
              Until the 3rd Century BCE,    the layout (which is especially              Writer has a plugin system that enables
              text had no punctuation.      important if the document needs to be        people to extend the core with
Aristophanes, a librarian at Alexandria,    printed); however, it’s difficult to edit.   additional functionality. You can create
decided text was too hard to read           The latter is useful if the document         your own, but it’s far easier to grab ones
without and spaces or marks between         needs to be edited, however, it can          that already exist. Take a look at http://
any letters, so he introduced dots          render differently on different setups.      extensions.libreoffice.org/extension-
between intermediate, subordinate and       LibreOffice allows a compromise              center for a list of available options.
full points. Little did he know that he     between these two extremes – hybrid          That website also includes a range of
was starting a process that would lead      PDFs – which are normal PDF files but        dictionaries in case your LibreOffice
to symbols gaining ever more                with the entire document embedded in         install didn’t come with the languages
prominence in text and a gradual return     an editable format that can be changed.      you’re creating documents in.



                                                             www.linuxvoice.com                                                        27
       FEATURE THE LINUX VOICE MANIFESTO




 THE LINUX VOICE
MANIFESTO
  WHAT’S RIGHT, WHAT’S WRONG
  AND HOW WE CAN CHANGE
FREE SOFTWARE
FOR THE BETTER
  W
               e often talk about the Free            falling apart (eg if a lead developer were      And why do some opinions turn into rabid
               Software movement (and indeed          incapacitated or the single licence on which    hatred – like the obscenities and threats
               the open source and Linux              we depend was found to be unenforceable).       hurled at Lennart Poettering for his work on
  communities) as if everyone involved were           So it’s good to have variety. But do we         Systemd?
  part of one big, cohesive group, where              have too much sometimes? Does the vast             Many Free Software projects have
  everyone is marching in the same direction          proliferation of desktops and distros help or   introduced Codes of Conduct to mitigate
  towards a land where software is free to            hinder the GNU/Linux project when it comes      this problem; some argue that they will
  share and modify. And to some extent that’s         to spreading the word?                          simply turn mailing lists into “safe spaces”
  true: we all have broadly similar goals. But at                                                     where nobody can even criticise another’s
  the same time there is so much disparity            Prickly characters                              code, and the effect will be detrimental
  – especially when you consider all the              And then we have to think about                 in the long run. The goals are noble, and
  different GNU/Linux distributions, projects,        personalities. Hackers and software             any attempts to make communities
  licences and personalities involved.                engineers tend to be rather blunt and direct    more welcoming are to be applauded, but
     Now, there’s definitely strength in diversity.   in their communications, sharply criticising    shouldn’t the quality of software be the most
  If we just had one distro, one desktop              the work of others if they feel that work is    important factor in the end?
                          environment and one         holding back a project (see the many               So this issue we thought we’d look at
                              Free Software           expletive-laden rants from Linus Torvalds as    the state of Linux, Free Software and open




{ {
                                 licence, we          an example). Sometimes it helps to state        source today, and put our take on it: what’s
                                    would be at       your mind and get things fixed instead of       right, what’s wrong, and where we should be
 Sometimes it helps
 to state your mind
                                     risk of our      dressing up everything you say in cotton        heading in the future. So – let’s put the world
instead of dressing                   community       wool, but at what point does it go too far?     to rights!
 everything up in
coton wool, but at
what point does it
    go too far?




  28                                                             www.linuxvoice.com
                                                                              THE LINUX VOICE MANIFESTO FEATURE


THE GOOD
M
              any of us began using GNU/Linux in the late
              1990s, as the internet was starting to work
              its way out of universities and into homes.
Back then, Linux on the desktop was rather rough, and
we didn’t have anything in the way of attractive and
integrated desktop environments. No, if you somehow
magically managed to get XFree86 working, you
ended up with a rather ugly FVWM desktop (or its
more Windows 95-esque AnotherLevel spin-off).
   Rough edges aside, the GNU tools and Linux kernel
were impressive achievements back then. But the
big question was: is any of this sustainable? Can
businesses be built around Linux and Free Software?
Or is it all silly hippy commie “anti-American”
nonsense that will die out when programmers realise
they have to get bread on the table? (Sadly, that was
the argument from a lot of the proprietary software
world at the time.)
   A few companies such as the German SUSE and
American Cygnus Solutions had demonstrated that
they could make money by selling and supporting
Linux, but it was Red Hat that really took the charge
and battled to get Linux into enterprises. Red Hat
was generally a good community player and today is
making megabucks with Linux.
   But it’s not just about companies. In some
prominent cases, Free Software projects have been
largely abandoned by their commercial sponsors
                                                                                                                         Some people dislike
but taken up by communities and not-for-profit              (through extensions) browser that achieved rip-
                                                                                                                         Systemd – fair enough.
organisations. Take OpenOffice.org, which ended up          roaring success. Today its popularity is plummeting,         But the sheer amount
in the hands of Oracle – and then passed on to the          controversial add-ons such as Pocket are being               of abuse that its lead
Apache Foundation. Today, Apache OpenOffice is              chucked in to pay the bills, the interface is constantly     developer, Lennart
effectively dormant. Fortunately, just as Oracle was        being rejiggled and features are being removed (or           Poettering, receives is
handing off OpenOffice.org, a new community-led             dumped into about:config).                                   worrying.
organisation called The Document Foundation was                Maybe it’s time for a non-profit organisation to
created to work on a fork of the codebase, LibreOffice,     step up and work on the code, like The Document
Today the Foundation has enough financial support           Foundation did with LibreOffice. It’s too early to say
from donations that it can pay for infrastructure,          if such an organisation could make enough




                                                                                                               { {
developers, documentation staff and more. It shows          money from donations and merchandise
that even without the backing of a single big company,      sales to fund developers, documentation,                   Maybe it’s time
a major open source project can still flourish.             servers and all the other bits and bobs that               for a non-profit
                                                            a project needs, but it could be worth a try.          organisation to step
                                                                                                                     up and work on the
Power to the people                                            Technology-wise, we have desktop and
                                                                                                                   Firefox code, as The
At Linux Voice, that’s what we’d love to see more of:       productivity software well covered with                 Document Foundation
communities and non-profit organisations rallying           Firefox, Thunderbird, LibreOffice, Inkscape,            did with LibreOffice
behind big FOSS projects. It’s great to have Red Hat,       Scribus, Gimp, Audacity and other tools.
Canonical, SUSE and co. paying developers to hack on        Some may still have rough edges, but it’s
Linux and open source apps, but companies come              possible to do almost every daily task on Linux.
and go. Also, goals and objectives can change: Firefox      And of course, on the server it’s leading the pack by a
started out as a lean, fast and power user-friendly         long way, so there’s nothing to gripe about there.




                                                              www.linuxvoice.com                                                                   29
     FEATURE THE LINUX VOICE MANIFESTO


THE BAD
                                                                                     Compare this to FreeBSD, for instance, which has a
                                                                                     superb Handbook (www.freebsd.org/doc/handbook)
                                                                                     providing a reference to all aspects of the OS in a
                                                                                     single location.
                                                                                        Aggravating this problem is the variety of Linux
                                                                                     distros out there. We have nothing against specialised
                                                                                     custom distros that focus on a specific user, such
                                                                                     as penetration testing distros, distros for visually
                                                                                     impaired users and so forth. But spend half an hour
                                                                                     browsing www.distrowatch.com and what do you
                                                                                     see? 95% are distros that honestly don’t need to exist,
                                                                                     and could be recreated with an apt-get or Yum script.
                                                                                        If a distro is basically Fedora or Ubuntu with
                                                                                     a slightly different package set and a change of
                                                                                     wallpaper, does it really need to exist? No, we think. At
                                                                                     least, not in the open. Toying with distros is great fun
                                                                                     and if you make a spin of Fedora that you like – great,
                                                                                     have fun. But please don’t make a big song and dance
                                                                                     about it, upload it to a site, add it to DistroWatch and
                                                                                     other places. It just adds entropy to the ecosystem
                                                                                     and makes things confusing for new users when
                                                                                     they’re trying to choose a distro. We need a small
                                                                                     range of top-quality, distinct distros, not thousands of



                            O
FreeBSD’s Handbook is an         ne of the greatest things about community-          largely identical ones that only exist to boost the egos
excellent, well organised        developed open source projects is that people       of a few developers.
and single-stop-shop
                                 can choose the bits and pieces they want to
for documentation –
something many Linux
                        work on. If you work for a proprietary software              I want my new FooApp 2.0!
distros would be wise tocompany as a 9–5 job, you may have some awesome              Then we have the problem of software distribution.
copy.                   ideas for the application you’re working on, but your        There’s something fundamentally wrong when you
                        company has forced you to write boring test cases all        install an OS such as Ubuntu, and have to wait six
                        day. C’est la vie. If you’re donating some of your free      months before you get new releases of software. (Of
                        time to a FOSS project, it’s more likely that you’ll work    course, you can mess around with PPAs, backport
                        on the components that interest you the most.                repositories and other methods, but it gets messy.)
                            There is a downside to this, though: some of the         We need a simple, streamlined and effective way for
                              more laborious aspects of FOSS development             third-party app developers to push a button and boom




  { {
                                are often neglected. Take documentation              – their app can now be installed on any distro with a
       Who wants to write
                                   as an example. Who wants to write that,           single click. The now defunct Autopackage project
       documentation when            when you could be hacking new features,         was making good progress in this direction, but few
     you could be hacking            optimising code to run faster, or working       apps ended up supporting it. Since then, rolling-
          new features,              on graphics or sound for a game? So             release distros such as Arch have exploded in
       optimising code or            documentation in the Free Software              popularity, but they have potential sticking points in
      working on graphics
     or sound for a game?
                                     community      is something of a mixed bag. A   large-scale enterprise deployments where long-term
                                   few projects have superb docs, but in many        support and absolute stability is vital.
                                 cases they’re lacking or simply non-existent.          Finally, another issue that needs tackling is
                                 Because Linux is developed in “Wild West”           developer mentoring – and making the community
                          fashion, with lots of groups (kernel, Glibc, GCC, X.Org)   more welcoming in general. Now, this varies from
                        doing their own thing and distro vendors shoehorning         project to project; some put more effort into helping
                        the results together, it’s hard to put together a            new developers get involved in the code and submit
                        complete and integrated set of documentation                 their first patches, whereas other communities are
                        that covers every aspect of the operating system.            more elitist and tend to look down on newcomers.




30                                                        www.linuxvoice.com
                                                                             THE LINUX VOICE MANIFESTO FEATURE


THE ROAD AHEAD
U
          ltimately, we – as in Linux Voice, or indeed
          any other supporters and advocates of Free
          Software – can’t force anybody to do
anything. And that’s a good thing. As mentioned, most
FOSS developers work on their projects because
they’re passionate about it, so nobody can simply tell
them to shift their attention to something that doesn’t
interest them in the slightest.
   What we’d like to see, though, is a concerted effort
to get more people involved in the less trendy aspects
of FOSS development – like the aforementioned
documentation and testing jobs. How about a
non-profit Linux Documentation Team supported
by donations from companies and the wider
FOSS community, which funds efforts to improve
documentation across Free Software projects?
This is no silver bullet, but arguably it’d be a much
more effective way to improve documentation than
the current state where one person occasionally
contributes docs to KDE, another to GCC, and so forth.
Centralising and focusing efforts with a well organised
funding drive could make a significant difference.
   Another thing we’d like to see is more consolidation.      2.0.0 Major release with significant new features or        Inkscape is polished,
Wouldn’t it be great if two groups that worked on             codebase changes.                                           featureful and already used
extremely similar projects considered merging them?           2.1.0 Minor release with small feature changes.             by many professionals –
                                                                                                                          so why has it spent over a
That’s easier said than done, of course, and there are        2.1.1 Point release, exactly the same as with 2.1.0
                                                                                                                          decade at version 0.x?
often personalities and politics at play. At FOSDEM           but with only bug/security fixes
in 2014, we asked the developers of Mageia and                Some projects are guilty of using point releases to
OpenMandriva – two very similar follow-up distros to       squeeze in new features or interface changes, which
the once-famous Mandriva – if they would consider          is just wrong. Users – especially in enterprises –
merging. There was lots of umming-and-ahhing,              should be confident that a point release won’t break
references to minor differences between the distros,       any workflow or require documentation changes, but
but not much enthusiasm for the idea.                      merely fix issues. It’s sensible, consistent, and enables
                                                           big companies to keep software up to date without
Vision Thing                                               fear of breakages or random changes.
Again, we can’t tell people what to do. But there are so      And finally, let’s get some FOSS apps that are
many projects out there that exist due to “not invented    already widely used to version 1.0! It’s really frustrating
here” syndrome, or petty squabbles, that could easily      that Inkscape, one of the best Free Software apps
be brought together for the benefit of us all. Perhaps     out there, is still at 0.91 despite being developed for
we need some kind of FOSS Dispute Arbitration body         around 15 years. Inkscape is feature-rich, stable and
that takes an objective look at two projects that have     polished, so release 1.0 already and tell the world!
split due to non-technical reasons, and that can bring     Yes, it’s not up to us to tell the Inkscape team




                                                                                                               { {
them together without hurting the egos of those            what to do, but a 1.0 release would be much
involved.                                                  more attractive to non-FOSS-insiders,                        There are many
  Something else that needs to be unified is version       especially those on Windows or Mac OS X.                  projects that exist
numbers. This is another topic on which everyone              So that’s how we see the FOSS world                   due to “not invented
has their own opinion, but it would help the FOSS          improving. We’re in a good state, but                      here” syndrome, or
                                                                                                                       petty squabbles,
ecosystem if we standardised on the meaning of each        there’s still a lot to be done. But we’ll leave          that could easily be
number in a release. Our proposal, which is already        our final words to those wisest of sages,                   brought together
used by many projects, would be like this:                 Bill and Ted: “Be excellent to each other.”




                                                             www.linuxvoice.com                                                                  31
     FAQ ZEPHYR




               Zephyr
                        The Linux Foundation has a new project under its control,
                          and it’s one that doesn’t actually include any ‘Linux’.
                                            at the big enterprise level, all of which     real-time operating system for use on
GRAHAM MORRISON                             have some interest in the success of          resource-constrained systems
                                            Linux, from Google (gold member) and          supporting multiple architectures,”
                                            SUSE (gold member), to IBM (platinum          according to the publicity. The Zephyr
         Those of us born in the grim       member), Intel (platinum member) and          Project is the Linux Foundation’s
         1960s and 1970s of industrial      Oracle (platinum member). Incidentally,       attempt to grab a little of the zeitgeist.
Britain will already know what              it costs $500,000 to become a
Zephyr is – a car built by Ford that        platinum member, and $100,00 to                       Sorry, what is this Internet of
was designed to look like a sullen          become a gold member. Linux Voice                     Things thing again?
sci-fi robot on wheels. Surely a FAQ        has got some way to go before we can                  You know how it seems almost
is unnecessary?                             afford either of those.                               every device now has an IP
         We remember! The Zephyr was                                                      address – your watch, your fridge, your
         like the Ford Anglia’s eccentric          Doesn’t the Linux Foundation           mobile, your set-top-box, your television,
aunt! But no, unfortunately, this is the           have a habit of creating               your central heating, your car, your
wrong kind of magazine to take that         projects like this?                           smoke alarm, your music player? These
image further. Zephyr is just one of               As far as we know, it’s never          are the ‘things’, and it’s predicted that
those words that has been used for                 created a project named after a        over the next few years, we’ll have far
countless things, from a light westerly     British car before, but it’s certainly        more connected things. No one is quite
wind to the codename of a Soviet spy.       chased plenty of emerging                     sure what this future of IoT dominance
Quite why the Linux Foundation chose        technologies by creating collaborative        will look like, but lots of experts agree
it for its latest project is out of our     projects in their honour.                     that it’s going to be huge. If you’ve got
search scope.                                                                             an idea, buy the domain name now.
                                                   Does that mean this project is
     The Linux Foundation! So,                     about another ‘emergent                       What does the Internet of
     there’s a link to Linux then?          technology.’                                         Things have to do with the
     Yes! It’s the latest project to be            Yes. If we asked you to guess          Linux Foundation, and more
     announced by the Linux                        we’re certain you’d say ‘internet of   specifically, the Zephyr Project?
Foundation, the trade association that      the things.’ And you would be correct.               Linux is obviously going to be an
promotes the interests of its members       “Zephyr Project is a small, scaleable                integral part of this revolution for
                                                                                          the same reasons it’s been the central
     No one is quite sure what this future of Internet                                    component in both the cloud and
                                                                                          smartphone revolutions. It’s open
     of Things dominance will look like, but lots of                                      source, small, and secure. Anyone can
                                                                                          build their own projects using Linux and
     experts agree that it’s going to be huge                                             put them into lots of tiny bits of



32                                            www.linuxvoice.com
                                                                                                                           ZEPHYR FAQ

hardware without having to buy a single
software licence. But the Zephyr Project
isn’t Linux. It’s built on a tiny kernel
designed to run on tiny systems. The
kernel and modules can run in just 8kB
of memory, for example, which is half
the space in an expanded ZX81!
    The kernel is the part of the operating
system that turns inanimate hardware
into something on which you can run
applications – it’s the Linux in GNU/
Linux, and Zephyr is built to breathe life
into those small things that need an IP
address. Zephyr has also been
designed to be a real-time operating
system, which is something Linux finds
hard . A real-time operating system is a
serious endeavour, as they’re often
used in life-critical timing situations.      The Zephyr Project is a real-time operating system for tiny devices that provides APIs and connectivity
They’re designed to prioritise data           to help you build tiny connected devices (Image source: zephyrproject.org).
above all else, such as feedback from a
heart monitor or medical equipment.                                                                        Cloud Native Foundation, which aims to
It’s tempting to say Linux struggles with            Does that mean there’s no                             “drive the adoption of a new set of
this because of PulseAudio, but that                 Linux source code in Zephyr?                          common container technologies
isn’t true. Linux is just too complex.               When you look through Zephyr’s                        informed by technical merit and end
                                                     source code, most of the files are                    user value, and inspired by internet-
       What kind of devices does              attributed to Wind River Systems, Inc,                       scale computing.”
       Zephyr run on?                         which is itself a subsidiary of Intel                           The Linux Foundation’s current
       At the moment, the kernel runs         (Linux Foundation platinum member).                          emphasis is on spreading the
       only on specific boards, although      Wind River specialises in operating                          “collaborative DNA of Linux to other
that seems to have more do to with the        systems for small devices and has                            industries, companies and other
project only just starting. It can            already developed its own commercial                         projects,” according to the Foundation’s
generally run on x86 CPUs, ARM v7-M           version of Zephyr, something it’s calling                    Executive Directory, Jim Zemlin, and we
and v7E-M boards, and the ARC EM4             the ‘Wind River Rocket’ OS. Zephyr itself                    can see how that might include
instruction set found on the Arduino          has been released using the terms of                         real-time operating systems and small
101. But If you wanted to play around         the Apache 2.0 licence, which is                             kernels, even when there’s no Linux link.
with the project, the best way to do this     considered only asymmetrically
would be on your normal PC or laptop          compatible with the GPLv2 licence used                               Where can we find out more
using the Qemu 2.1 emulator to run the        by the majority of the Linux kernel. That                            about the project?
kernel. You’ll need to know what you’re       means the two projects are unlikely to                               Considering it’s only just been
doing and augment the installation with       share the same code, although with                                   announced, there’s already a
your own code before it will do anything      such a difference in emphasis, that                          great deal of information about Zephyr,
meaningful, but that’s the idea behind        would seem unlikely anyway.                                  and we highly recommend you take a
the Iot – connect small sensors and                                                                        look at the excellent documentation
write bits of code to do something                   Why would Zephyr be hosted                            that goes along with the project
clever with the data.                                by the Linux Foundation?                              (https://www.zephyrproject.org). In
                                                     Our cynical selves might say that                     particular, the part of the
        Does the Zephyr kernel have                  launching Zephyr as a                                 documentation that takes you through
        anything in common with the           collaborative project under the auspice                      the application development workflow
Linux kernel?                                 of the Linux Foundation is an attempt                        is very useful. If you have some coding
        Other than being hosted by the        to bring a platinum member’s project                         skills, we’re fairly sure you’ll be able to
        foundation that employs Linus         into the realm of wider industry                             build something, even without any prior
Torvalds, very little. This is perhaps best   exposure and adoption. But the Linux                         experience in micro- and nano-kernels.
illustrated by the download size for both     Foundation always seems to want a
source code trees. The tar.gz 1.0.0           project a project for every facet of                             Anything else you’d like to
release of the Zephyr kernel from             technological development. There’s                               add?
March 2016 is a 6.8MB download. The           Dronecode, for example, an open                                  Did we mention that it costs
equivalent March 4.4.4 release of the         source platform for Unmanned Aerial                              $500,000 to become a platinum
Linux kernel is 83.3MB. We daren’t think      Vehicles (UAVs). There’s Automotive                          member and $100,00 to become a gold
about number of lines of code.                Grade Linux for cars, and there’s the                        member of the Linux Foundation?



                                                               www.linuxvoice.com                                                                  33
     INTERVIEW ALAN POPE




ALAN POPE
LUNCH WITH MR CONVERGENCE
Graham Morrison drives out to the Saxon settlement of Ferneberga to meet
Ubuntu community manager and fellow Linux long-suffering podcaster.


I
   t’s been a year since the launch of the       driven and organic approach to its growth,         heart of this as a community manager at
   Ubuntu Phone – the launch where you           slowly introducing new models and new              Canonical, but you may also know him
   could actually start buying the devices.      partnerships while supporting the hackers          from such podcasts as the long running
Since then, Canonical, the company behind        and developers who want to play, whether           Ubuntu Podcast, of which he is co-founder
both Ubuntu and the phone’s operating            that’s a port to a new device or building          and co-host. We didn’t need much of an
system, has taken a very community–              new applications. Alan Pope is at the              excuse to meet up for a chat and a coffee.




        Your role at Canonical seems         very exciting place to be, and I think          Nowadays, if you look around at
        quite multi-faceted.                 similar to many user groups where you        FOSDEM there are a lot of (Apple)
Alan Pope: I work in the community           had enthusiasts and new people and           Macs, some of which are running Linux.
team, and that means that I work with a      people asking technical questions,           A lot of them are not. The people who
bunch of other community managers.           getting together and doing demos – all       are running Linux, either on those Mac
Canonical has a number of community          that kind of stuff.                          or on the die-hard Thinkpads, they’ve
managers in the community team and              There was a lot of that in the early      probably only needed to put a USB key
we have a manager of the community           days of Ubuntu and there were a lot of       in and it worked. Or if they were really
team – David Planella, and then there’s      people contributing to the platform          lucky, they went out and bought it and it
myself, Mike Hall, Daniel Hallback,          – people who were packaging software         works. So the motivation for you to go
Michael Hall, Nicholas Skaggs and            that goes into the archive, or maybe         to a user group and help someone edit
David Callé, and we all have our areas of    doing translations for stuff that goes       their Xorg.conf is much lower, because
focus. But mine is mostly core apps on       into the archive, or doing                   that stuff is a solved problem.
the phone, but we spread ourselves a         documentation or writing How Tos.               That doesn’t mean there aren’t other
little bit away from whatever our area of    There was a lot of that in the early days,   problems for us to solve; it’s just that
skills is. Daniel is mostly working on       and I think a lot of groups – not just       the lower-level stuff is a lot easier now.
Snappy at the moment, and David Callé        Ubuntu – a lot of communities seemed         You can go and get a USB key and
mostly works on documentation, but           to have moved on from that ‘Getting the      put it into almost any computer – any
we all pull together and organise things     Platform Done’ to other roles.               distro – and it just installs. We, as in
like events, or do Q and As and stuff like                                                Ubuntu, and lots of other communities
that. We each have a specialist area but            We’ve had the year of Linux on        atrophied our community a little bit,
we go beyond that.                                  the desktop!                          because they’ve moved on to more
                                             AP: Yep! Job done [laughter], we’re all      interesting things. Maybe that’s
      Does the phone community, for          finished now, let’s move on. I don’t know
      example, consist of ordinary
users or perhaps companies?
                                             exactly what it is. I know a lot of
                                             communities are seeing drift. Years ago
                                                                                             You can put a USB key
AP: I think of our users as extraordinary    if you went to a tech conference,               in almost any computer
[much laughter!].                            something like FOSDEM or SCALE, or
                                             any other tech conference that has a            and it just installs
      But after being involved in the        Linuxy-bent to it, it was all Thinkpads
      community side of Ubuntu for           and Dells, and you knew everyone in          hardware hacking and they’re into IoT
such a long time, starting with–             that room was running some version of        and Raspberry Pi, or something else
we’d imagine user groups discussing          Linux and that they’d probably had to        that’s more interesting than what they
the desktop and the operating                edit their Xorg.conf to make it work. Or     used to do, or maybe they’ve moved on
system – that must have changed?             use Ndiswrapper, or some wacky stuff         to the Mac because it was too much
AP: It has, and in the early days it was a   like that.                                   faff to get Linux working. I don’t know



34                                                            www.linuxvoice.com
                     ALAN POPE INTERVIEW




www.linuxvoice.com                         35
     INTERVIEW ALAN POPE

exactly where those people have gone            unanswered questions, and sit there         and interesting things that most people
but I miss them!                                and answer people’s questions. I had        on their phones don’t do. It’s quite good
                                                no idea who these people were, or           fun to do that.
       The computing trend has also             where in the world they were, and they
       moved away from the                      asked all kinds of things like “How do I          So there’s the same category
computer and laptop and towards                 get my wireless working?”                         of ‘hackers/users’, it’s just now
smartphones and mobile computing,                                                           they’re aligned to more modern
you’ve followed them in your role at                   Hence your memory for                technology rather than the desktop
Canonical.                                             Ndiswrapper!                         or getting Linux to work?
AP: Yes, totally, and so I now install          AP: Exactly! It’s still raw in my head.     AP: I think so. And a lot of those people
Ubuntu on a machine and then use it as          And that documentation we wrote all         might use Ubuntu or they might not.
a tool. This is one reason why I can’t get      those years ago for Ndiswrapper is no       We get people on our mailing lists who
my head around people who are                   longer applicable because wireless now      use Arch Linux, who want to develop
constantly distro hopping. There is a           just works, generally.                      apps for Ubuntu, or maybe they use
level of learning you get from trying             I remember one woman who asked a          Fedora and they bought an Ubuntu
different distros, sure, but I just can’t get   question that her husband had a piano       phone just to see what it’s like. And it’s
my head around people who are like,             and liked to make music and wanted to
“This icon is in the wrong place – I’ll
wipe the distro and start again.” I use
                                                get this particular piece of music
                                                software working on Ubuntu, and so I
                                                                                               We get a community of
the Linux desktop as a tool to do my job        went off and installed it on my machine        interested people coming
and so the desktop is not particularly          and fiddled around and got it working,
interesting to me any more, and I think         and then replied to the question – going       along for the ride
that’s probably true of a lot of people.        back and forth a few times. And I know
It’s not super-interesting any more.            that question is archived back in the       early days, and there are things that
                                                mists of time in Launchpad                  don’t work yet – it’s not quite finished.
      Was there a time when the                 somewhere, and it was really refreshing
      desktop was super-interesting             to talk to brand-new users about                   Is it every going to be finished?
to you?                                         something that they needed help with               AP: Is anything ever finished!
AP: Totally! When I started contributing        and I could help with just a few lines on   There is no version ‘n’ where there is not
to Ubuntu (2005–2006), I was working            a page. But now we get people asking,       a number higher than ‘n’. I’ve yet to see
where I had a lot of downtime, and I            “How do I do this on Ubuntu Phone,”         anything finished in the software world,
would spend a huge amount of time               and yes, that is where the interesting      so I think we’ll continue iterating. But it’s
answering support questions online.             stuff for me is now.                        fun when I get people sending me
We have a thing on [Canonical’s]                  People are saying, “How do I make         screenshots of mockups or whatever of
Launchpad called ‘Launchpad Answers.’           my app do this?” or “How can I make         an app they’ve created, or they’ve
And I would go there on a daily basis           my app run forever,” or “How do I do        created a new design for an existing
and just look for the new and                   SSH on my phone,” which are all cool        app. I want to grab hold of those people
                                                                                            and point them in the right direction
                                                                                            and then show them the tutorials for
                                                                                            getting started on Launchpad, or show
                                                                                            them where the source code is.
                                                                                              I had that just this week. Someone
                                                                                            pinged me on Telegram and said, “I’ve
                                                                                            had an Ubuntu Phone for over a year
                                                                                            now, and I’m quite interested in getting
                                                                                            involved in developing the core apps.”
                                                                                            Someone has come looking to
                                                                                            contribute, and sure enough I pointed
                                                                                            him in the right direction and now he’s
                                                                                            contributing to our calendar app. It’s
                                                                                            stuff like that that people can easily get
                                                                                            started on on Ubuntu Phone.

                                                                                                  Do you think part of the
                                                                                                  motivation behind the Ubuntu
                                                                                            Phone was to keep that community
  Where the desktop was, the                                                                of people who want to contribute
  phone is now, says Alan,
                                                                                            themselves, as well as getting the
  stroking the rich mahogany
  Louis XV escritoire.                                                                      platform on Chinese OEMs, for
                                                                                            example?



36                                                               www.linuxvoice.com
                                                                                         ALAN POPE INTERVIEW



                                                                                                        Alan used to use Red Hat,
                                                                                                      then moved to Debian when
                                                                                                        a bloke he knows told him
                                                                                                          Debian was “quite cool”.
                                                                                                              Well done that man!




AP: I think it’s more a by-product of        rather than a core goal. We do want         you weren’t working for Canonical,
what we’re doing. While Android is open      to have a community and we want to          so what led you to Ubuntu?
source and Apple’s iOS is not, they’re       have people interested, and without         AP: I was having problems with my
still very similar in the way that they’re   those people interested, you know,          Philips webcam that meant I had to
released – there’s a lot of development      ‘tech people’ who are willing to write      keep re-compiling the driver every time I
that’s done internally and then at a big     documents on GitHub about how to            updated Debian’s kernel. That frustrated
conference somewhere, the ‘thing’ is         manage your phone or create apps,           me, and my friend from my local LUG
announced with great fanfare. A short        then we’d be in a difficult place.          (Hugo!) said, “You should have a look at
while after, in the case of Google, it’s        Half of the apps that ship on the        this Ubuntu thing, it looks quite cool.” I
thrown over the wall and there is your       phone, by default, were written by          downloaded Ubuntu late 2004, early
new software.                                people in the community, not by people      2005 and started using it and thought it
    We aren’t doing it like that, very       at Canonical. Without those people,         was great. I’ve never really had to really
deliberately, which means that people        where would we be? We wouldn’t              compile the kernel since then.
see the warts and all as we go along. If     have a calendar, a clock, a music app,         That was a milestone because I
we’d closed the doors, brought up the        a document viewer! Those things             never had to go through that faff just to
shutters, and said we’re not going to        are important to us. And similarly,         get a thing working. Obviously I still
show you anything for another year,          those people in the community then          compile kernels now and again for
people would see a big change in what        contribute to the core as well. There       various reasons, but I’ve not had to just
had happened between last year and           are people who have contributed             for a webcam. But the thing that
this year. Whereas we’re iterating over a    to the web browser – recently the           attracted me more was, yes, the
year so that people see the individual       browser had a UI revamp and one             community. There seemed like a really
changes, and people blog about an icon       of the contributors of that, a student      positive vibe around Ubuntu while at
change, or they blog about the colour of     living in Italy called Ricardo, he helped   the time I found there was a bit of
something changing, or they’re               implement the new UI on our web             negativity around Debian – you could
interested in a bug that affects them.       browser. The community is very              get chastised for asking the wrong
Whereas that doesn’t tend to happen in       important to us and those people are        question in an IRC channel, or you
Apple Land or Google Land.                   enthusiastic. They come and go, we’ve       could get berated on a mailing list for
    We get a community of interested         noticed, over the years but we’re still     saying the wrong thing the wrong way
people coming along for the ride as          there for them when they come back.         and that disappointed me.
we’re doing this development. I think                                                       Some people loved Debian – they
it’s a by-product of what we’re doing –            Ten years ago, when you were          loved the rigidity of Debian’s rules, and
the fact that we’re doing it in the open,          helping people on Launchpad,          that’s fine, but I didn’t really like that. I



                                               www.linuxvoice.com                                                                 37
     INTERVIEW ALAN POPE

like the look of Ubuntu and people           a massive community around that, and          working on one device to make that a
seemed good fun.                             people love doing that and people love        really good ROM, and then move on to
   I was contributing in the community       hacking, but I don’t distro hop. I want to    the next one, so we end up with a line of
for a long time; up until 20011/12, I        have a thing that I can hack on that I        devices that are of a similar state.
was in various leadership positions in       don’t need to keep flip flopping all over     Bluetooth works on all of them, Wi-Fi
the Ubuntu community, and then I took        the place to be happy. On my desktop,         works on all of them, accelerated
a step back and thought, “Am I doing         I’ve done that and I’m on Ubuntu and          hardware works on all of them, but it’s
the right thing here?” I was doing my        I’m happy there. On my phone, I quite         difficult when that’s quite a specialist
paid job in the day and this volunteer       like the fact that on Ubuntu Phone I          task, porting Ubuntu to a phone.
stuff in the evening – I’m doing a lot       don’t have to install all these random
of volunteer stuff and I was thinking I      ROMs and I can hack on my phone,                    Is the community getting
needed to consolidate. I stepped down        because I like being able to hack on my             larger?
from a few of the positions.                 phone and do all kinds of cool                AP: I think there are a few things in this
                                             interesting things. Just being able to        platform that are missing or that are
       Did you intend to leave the           SSH into my phones is quite cool.
       community completely?                                                                  We’ve been banging the
AP: I kind of did. I resigned from a                 The launch of Ubuntu Phone
couple of positions and I actually got a             had a big impact on those ROM            convergence drum for a
personal message on IRC from Mark
Shuttleworth [Founder of Canonical/
                                             communities.
                                             AP: I think possibly we should have
                                                                                              long time now
Ubuntu] asking me whether there was          engaged with the ROM community, if
any background story, or whether there       we want to call it that, perhaps a bit        not fully fleshed out or fully finished,
was any reason why I was leaving             later. I think we engaged a bit too early     that have bugs in them. And I think as
because when people quit en masse,           because the sand was shifting a bit at        time goes on and we fix those, and also
sometimes there is a back story, and         the time and so a lot of people saw           that we, Canonical, have agreements
there may be a reason and you might          what we had on the phone and then             with partners with more devices, it
want to find out more, or whether it’s       they took that and ported it to other         becomes more interesting to people.
fixable. He messaged me and asked if         devices. And then various technical           When there’s only one device on the
there was any reason and I said I just       decisions we made changed the way             planet, it’s a lot harder for people to get
need to focus, really, because I’m           the platform worked, and so none of           interested, and it’s also harder when
spreading myself too thin. At that point,    those images work any more.                   those devices aren’t available in every
he said there might be a role for your                                                     country. There’s huge demand in the
focus at Canonical. Some month or two               Things like the Nexus 10 and           US, for example, where we don’t have a
later, a job came up and I joined.                  Nexus 5?                               good story for a phone you can use
   I had actually applied for jobs at        AP: That’s slightly different because we      over there yet. In the future we will, I’m
Canonical a couple of times before, but      only had one person maintaining that. It      sure of that.
I was unsuccessful, and Canonical do         would be great if we had a pool of               When you look at the number of
have a history of hiring from the            people. But what happens in the               people Google has to throw around at
community. There are a lot of people         Android community seems to me that            Android, or that Samsung has to throw
who work at Canonical who previously         you have one guy who makes his ROM            at Tizen, and we’re a 700-people
were students who worked on Ubuntu           and then someone else forks that and          company – that’s the entire company,
packages, for example, and were hired        makes his ROM, rather than multiple           not just the people who work on
in. There are a lot of people in Canonical   people work together on one really            Ubuntu Phone. People who work on
like that and so I was one of those.         good one. There are groups that have          Ubuntu Phone are in the tens, it’s not
Sometimes people say that the Ubuntu         emerged from that – like Cyanogen –           hundreds, so it’s an upward struggle
community is shrinking – that’s partly       but it would be great if we could have        and we are punching above our weight.
because Canonical is hiring them all!        groups of people working together.            You look at the size of our stand at
                                               There’s a guy called Marius who did a       Mobile World Congress [perhaps the
       Do you still feel just as excited     port to the OnePlus One and a couple of       biggest mobile event in the calendar] it
       by the phone?                         other devices, and he’s now working on        was humongous, showing off
AP: I’m not a big fan of Android. I’m not    the Fairphone 2, and he has a whole           community ports, community code.
a massive fan of iOS. I especially don’t     bunch of other phones on his list that        One of the best demos I’m told was the
like the whole going and downloading a       he’d love to get to, but he’s just one guy.   music app, because we’ve recently
random ROM from some obscurely               Whereas in the Android community one          created a converge version of the
named guy on the internet and flashing       person is focused on getting a ROM            music app so that it works on tablets,
that on my phone because it will give        working on their one device because           phones and when you rotate it it
me better battery life. Or I get another     you’re scratching an itch – you’re trying     behaves differently. And that was one
ROM that gives me better access              to get it to work on that device because      of the better demos given at MWC. The
controls on my phone and having to           that’s the one you have. What we would        demo was written by an Oxford student
seek out these phones. I realise there’s     rather do is have multiple people             in the UK. It wasn’t created by us. We



38                                                            www.linuxvoice.com
                                                                                                            ALAN POPE INTERVIEW


If you’d like to see a port of Ubuntu
on the Fairphone 2, or indeed any
other device, you can go to
https://ubports.com to find details
of how you can get involved.




             gave him some design input but he              into Ubuntu?                                    from Debian to Ubuntu I no longer have
             created that in his spare time, and            AP: If we find a bug in Network                 to compile my webcam driver. Now,
             those people who are willing to create         Manager or PulseAudio, the packages             with PulseAudio, I can have Skype open
             something cool and interesting to              that are on the phone are the same              – well maybe not now! – Mumble, I can
             demo to other people will start getting        – it’s the same package as from the             be playing a Flash video, I can get
             other people in, as well as the porting        (Ubuntu) archive. If you do a dpkg -l on        notification sounds from my browser.
             community as well.                             the phone, you’ll see Network Manager           And so on the phone with the bug we
                                                            and PulseAudio.                                 had, it turns out that when the phone
                    Was convergence always                     There was a fun bug we had maybe             gets a notification it makes a ‘ting’
                    intended to be part of the              eight months to a year ago. We couldn’t         sound and then the phone goes back to
             Ubuntu Phone operating system?                 figure out why the phone would                  sleep. Then you get another notification
             AP: It’s funny because I was clearing          sometimes suddenly start screeching             and it goes back to sleep again. When
             out my old email last night and I did a        really really loudly. I had this at a recital   the phone goes ‘ting’ the first time,
             search for everything older than the           concert at my daughters school and              PulseAudio is playing that noise
             beginning of 2016 to archive off my            just out of the blue my phone just              through the sound card.
             GMail, and it showed up some emails            started screaming at me! A real                    Then the phone goes back to sleep
             from 2011 and I saw an email entitled,         high-pitched wailing noise and it took a        but PulseAudio carries on sending the
             “Convergence Demo” and “Convergence            lot of digging to figure out that it was a      zeros to the soundcard because it
             devices” and stuff like that, and that         PulseAudio bug. It was the fact that            anticipates there’s more audio coming
             was five years ago, so we’ve been              PulseAudio was never really designed            down the line for a period of time. The
             banging the drum for a long time. But          to be on mobile devices like this.              CPU goes to sleep and then you get
             it’s only now coming to the point where                                                        another notification – the CPU wakes
             you can plug your keyboard and mouse                Was it ever designed to be on a            up and starts sending zeros to the
             into a device or Bluetooth attachment,              desktop though?                            soundcard and the soundcard freaks
             and use it like that. It’s taken a long time   AP: No comment! I love PulseAudio!              out and you get this screeching noise.
             to get here and there have been a                                                              That bug was fixed and that fix will
             couple of diversions long the way.                   What do you like about                    ripple down to the desktop in the same
                                                                  PulseAudio!                               way because it’s the same package,
                    Does much of what goes into             AP: It just works. For no other reason          and it’s the same with Network Manager
                    Ubuntu Phone get rolled back            than in the same way when I moved               and GStreamer.



                                                              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
                                                                                                                           NetSurf
                                                                                                                           3.4
                                                                                                                           With all the new features it
                                                                                                                           keeps adding, Firefox is at
                                                                                                                           risk of evolving itself out
                                                                                                                           of existence. If you agree,
                                                                                                                           try NetSurf: it’s small, fast
                                                                                                                           and could be the One True
Andrew Gregory                                                                                                             web browser to take back
Needs some spare time in which to play with                                                                                the web.
his Flotilla kit from Pimoroni.




S
        pring is in the air, which means a
        few things. First, there’s a fresh
        release of Ubuntu on the cards,
reminding me that I really must get
round to putting Ubuntu on my
smashed (again) Nexus 5 smartphone.
    Second, there are many, many things       OpenShot 2.0                 43    Solus 1.1                      44    Owncloud server 9.0           45
to be done. Last month the Linux Voice        In the already packed world        Arising from the ashes of            The workhorse of any cloud
team launched a Kickstarter campaign          of video editing, can this         SolusOS, Solus looks like a good     infrastructure, Owncloud gets
to get a children’s coding book               crowdfunded offering stand out?    bet for the desktop user.            better with every release.
published. We failed to reach our target,
but the idea is still a great one. We need
more coding materials, more volunteers
at Code Clubs, more online resources.
                                              Group test and books
It’s the future, and with Beep Beep Yarr!
we want to help make it happen. It’ll
take a little longer, but we’ll get there,
because it’s worth doing.

Brown rain
Spring is when projects arise, blinking
from their winter slumber. The
allotment needs work if we’re going to
get the potatoes planted in time. The
weather station needs building,
websites need to be coded, words need
to be written, businesses launched.           Booooooooooooooks!!!!                           48   Group test – privacy distros                        50
And, as always, Free Software makes it        If you learn how to program games, you’ve learned    The tools are out there to ensure your privacy, but
possible. Now let’s get stuck in!             how to program anything – at least, that’s the       why install them yourself when someone else has
andrew@linuxvoice.com                         theory. We just like shooting things.                made these user-friendly distros for you?



                                                               www.linuxvoice.com                                                                     41
      REVIEWS WEB BROWSER




NetSurf 3.4
After getting frustrated with Firefox, Mike Saunders needs a fast, light web browser.


                                  F
Web www.netsurf-browser.org               irefox has always been one of our favourite          viewing the Wikipedia page for Linux, NetSurf only
Platforms Linux, Unix, RISC OS,           FOSS projects (and in fairness, it’s still very      needs 76MB. Multiply that over many tabs and you
Haiku, AmigaOS, Atari
                                          good), but recent changes to the interface,          save a lot of memory.
License GPL v2
                                  coupled with the addition of unwanted features like             In addition, NetSurf offers most of the basics you
                                  the Pocket integration for saving offline content, have      expect in a browser: bookmarks, cookie management,
                                  started to annoy us. So while it’s still our browser of      pop-up and advert blocking, Do Not Track, and even
                                  choice for most cases, we’re always on the lookout for       a smattering of JavaScript support. In this release,
                                  something else. And NetSurf has been on our radar for        JavaScript is provided by the Duktape engine, but
                                  a while. Unlike most browsers doing the rounds, it           the results are a mixed bag due to a limited set of
                                  doesn’t use an existing HTML rendering engine like           bindings. Some sites are fairly functional, whereas
                                  WebKit, Blink or Gecko – but instead has its own, built      others struggle or just don’t work at all.
                                  from scratch.                                                   NetSurf has come on in leaps and bounds from
                                     NetSurf is designed to be highly portable and usable      the 3.3 release we tried last year, and works well
                                  on old machines running relatively obscure OSes. So          for casual browsing of simple sites, but it still gets
                                  if you’re still battling on with an old Amiga or Atari, or   confused in places. Of course, creating a HTML and
                                  you’re rocking with a Haiku OS or RISC OS installation,      CSS rendering engine that covers the ever-growing
                                  then NetSurf provides a fairly robust browser. It’s also     specification is a mammoth task, and all of the
                                  scorchingly fast and friendly with your RAM banks:           developers of NetSurf are working on it out of passion
                                  whereas a freshly started Firefox munches up 221MB           rather than as a paid job, so the achievements they’ve
                                                                                               made already are to be applauded.
                                                                                                  What we say is: definitely give NetSurf a try. It won’t
                                                                                               work flawlessly on every site you visit, but for those
                                                                                               times when you just want to spend a bit of time on
                                                                                               Wikipedia, Reddit and other text-oriented sites, you’ll
                                                                                               find it fast, sleek, and very pleasant to use.
JavaScript support may be                                                                      Making great progress, and usable on plenty of
disabled when you first                                                                        not-too-demanding websites, but still glitchy in
start NetSurf – to enable it,                                                                  places.
go to Edit > Preferences
and the Content tab.



42                                                                www.linuxvoice.com
                                                                                                              VIDEO EDITOR REVIEWS




OpenShot 2.0
Ben Everard needs to edit his many cat videos, can OpenShot enhance the cuteness?

O
         n 17 April 2013, The OpenShot project raised                                                                 Web www.openshotvideo.com
                                                                                                                      Developer Jonathon Thomas
         $45,028 in a crowdfunding campaign to                                                                        and contributors
         develop version 2.0 of this video editing                                                                    Licence GPL v3
software with a target to release in December 2013.
Development slipped, and the final version didn’t
come out until early 2016. Version 2.0 represents
almost three years of work to just about every area:
the rendering engine has undergone a major rewrite,
the interface has moved from GTK to Qt, and the
software now runs on OS X and Windows as well as
Linux. Hopefully this will bring in a larger pool of users                                                            The new Timeline dialog is
which in turn will mean more people to find bugs and                                                                  perfect for making video
develop patches.                                                                                                      slideshows from a
   There are only a couple of new features in OpenShot                                                                collection of photos.
2.0 – most of the work has been tidying up the
existing features rather than adding new ones. The           The problem is that the last three years have seen a
Split Clip and Timeline dialogs do make it easier to         renaissance in open source video editing. Pitivi has
construct videos, the former being used to manipulate        also had a significant funding drive, Lightworks on
long videos and the latter used for constructing             Linux is now considered stable, and Kdenlive continues
videos out of a large number of short clips.                 to improve. In this competitive landscape, the new and
   Our biggest complaint with earlier versions of            revamped OpenShot can still hold its own, particularly
OpenShot was the stability. During our editing with          with people who only do occasional video editing,
OpenShot 1.x, we found that crashes were part of the         because the interface is engaging and easy to use.
normal workflow. OpenShot 2.0 did crash during our
testing, but nowhere near as frequently.                     A great interface pushes OpenShot to the front
   Had OpenShot 2.0 met its delivery target of               of the increasingly competitive field of Linux
                                                             video editors.
December 2013, it would have been without a
doubt the best video editor on Linux at the time.



                                                               www.linuxvoice.com                                                             43
     REVIEWS LINUX DISTRO




Solus 1.1
SolusOS is dead – long live Solus! Mike Saunders examines this desktop distro.


                                Y
Web https://solus-project.com            ou may recall SolusOS, a newbie-oriented       uses some components of Gnome, so it’s somewhat
Platforms x86-84                         Debian-based distro that used the Gnome 2      analogous to Cinnamon on Linux Mint.
Price Free
                                         desktop with a bunch of custom add-ons.           While Budgie looks lovely, it has its limitations.
                                SolusOS was abandoned in late 2013 due to a lack of     Launcher icons in the top panel, for instance, don’t
                                development manpower, but the project has recently      have tooltips, so you can’t be sure what they do
                                been revived under the name Solus. Now, given that      without clicking on them. If you want to install Solus
                                there are more desktop-focused Linux distributions in   from live mode, you need to click the blue down arrow
                                existence than there are atoms in the universe, why     button – but that same button is also shared by the
                                are we covering Solus here?                             Software (package) Installer in the menu. Similarly,
                                   For starters, it’s extremely polished. So many       there’s little in the way of customisation to be done –
                                distros simply take Gnome, KDE or Xfce, chuck on a      forget about context menus for the panel or many of
                                custom theme, and leave it at that. Solus goes a lot    the notification area icons.
                                further by incorporating its own written-from-scratch      Otherwise, Solus provides a handful of FOSS
                                desktop environment, Budgie, which is now available     desktop apps: Firefox, Thunderbird, VLC, Rhythmbox
                                in some other distros such as Arch. Solus “focuses      and various Gnome utilities. We were surprised to see
                                on simplicity and elegance”, with a sleek program       no office software installed by default; most users
                                menu and notification centre – but fortunately it’s     would expect that, and it’s not like the distro is trying
                                not a victim of “not invented here” syndrome. Budgie    to squeeze onto a single CD.
                                                                                           In all, we like Solus for its attention to detail and
                                                                                        focus on good presentation (remember – this is a
                                                                                        feature), from the website through to the desktop
                                                                                        itself. Finding the right balance of usability for both
                                                                                        newbies and more experienced users is going to be
                                                                                        tough, but with a bit more work, it has the opportunity
                                                                                        to be the Ubuntu or Mint of its generation.
The main menu is
attractive and well-                                                                    An ambitious distro that could lead the pack
designed – it’s just a                                                                  when it comes to the desktop, but needs more
shame the distro doesn’t                                                                refining and a better out-of-the-box experience.
include more apps as
standard.



44                                                            www.linuxvoice.com
                                                                                                                  OWNCLOUD REVIEWS




OwnCloud Server 9.0
Graham Morrison takes another great leap away from Facebook and Google.


T
         he progress OwnCloud is making is almost                                                                       Web https://owncloud.org
                                                                                                                        Developer OwnCloud Inc.
         unbelievable. Not only is the project going                                                                    Licence AGPLv3
         from one major release to the next, cramming
great new features into each update, its user base has
grown from 2.4 million in 2015 to 8 million in 2016.
This is completely unprecedented, but also perhaps
understandable. It’s a slick, professional, beautiful
data repository for all your files. It synchronises with
your desktop and phone, adds context via calendar,
contacts and even document editing plugins, and can
of course be self-hosted. As we’ve mentioned before,                                                                    You can now edit
we use OwnCloud extensively to put the magazine                                                                         documents collaboratively,
together and it has never failed us.                                                                                    and it works well even on
   Version 9 was as easy to install as previous                                                                         low-end servers.
versions, at least manually. You download the latest
version, copy over the config and your data, and a          scalability”, implemented with help from CERN. We
web server restart instantiates the upgrade. The only       also really liked the new sharing options which now
thing left to do is re-enable any third-party plugins you   include tags and better permissions – you can even
need, a procedure that we found much quicker and            search by tags. You can also leave comments in
more responsive than with previous versions. We also        photos shared with you, which we think is a significant
noticed a big improvement in the latency between            step towards a self-hosted Facebook/Google+
updates on the server and updates on our local              replacement, as is the cooperative document editing
Linux client. You could be editing an ODT document,         with annotations. It’s all brilliant.
for example, and within a few seconds you’d see
your updates pushed to your local copy. The same            The rapid user-base expansion and new features
                                                            make this release stable and full of collaboration.
happened when we added files. These performance
upgrades could be thanks to the much touted “better



                                                              www.linuxvoice.com                                                                   45
     REVIEWS GAMING




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


 RUN. JUMP. SHOOT.                         XCOM 2
                                           A worthy successor to one of the best strategy games out there

                                           Website http://store.steampowered.com/app/268500
                                           Price £34.99




                                           X
                                                    COM: Enemy Unknown was hugely
                                                    successful, so expectations for its
                                                    sequel were extremely high. Thankfully,
                                           these expectations have been met and often
 Michel Loubet-Jambert is our Games
 Editor. He hasn’t had a decent night’s    exceeded. Firstly, there are no drastic changes
 sleep since Steam came out on Linux.      from its predecessor, and given that it received
                                           universal praise, that’s probably a good thing.    Missing that 90% accuracy shot reminds you that


 I
      t’s been anticipated for a long      The most fundamental difference is the change      XCOM 2 is as unforgiving as ever.
      time now, but OpenGL’s               of circumstances, where instead of
      successor, the Vulkan API, has
                                           spearheading a trans-national defence team         and it does feel like a new experience with
 finally been released in what
 promises to be a huge leap forward        against alien invasion, it now focuses on a much   continuity from where the previous game left off.
 for Linux and cross-platform gaming       leaner rebel team working to overthrow the alien      Combat remains the least changed aspect,
 as a whole. Along with the release,       regime after its successful invasion. This         with the base-management experiencing the
 Nvidia has provided drivers with          provides a far greater sense of urgency and        most changes. One criticised change is that
 Vulkan support. There are no drivers
                                           resourcefulness to a game in which humanity        some missions now have turn limits, though this
 currently released on the AMD side
 (despite the company having               was already the underdog.                          does add a sense of pace and urgency to parts
 developed the Mantle API on which            XCOM 2 strikes a careful balance between        of the game previously lacking it. The turn-based
 Vulkan is based), though their release    making the game familiar enough so as not to       tactical combat and the management aspects of
 is imminent.                              anger fans with drastic changes, but not subtle    the game provide that much-appreciated variety
     The cherry on the cake is that this
                                           enough that it feels like a lazy upgrade of its    and detail, all held together by a fun plot and kept
 release comes with an update of The
 Talos Principle: the first Linux game     predecessor. It does a great job in this regard,   interesting through steady progression.
 to support Vulkan. Current
 performance is not game changing,
 but given the beta state of the drivers
 and a game which was built around
 DirectX 11, it is very encouraging in
 this early stage. There is also already
 talk of DOTA 2 being shifted to
 Vulkan, as well as a few others.
     Currently, DirectX 12 is only
 supported on Windows 10, which
 accounts for around 13% of desktop
 operating system usage. With Vulkan
 supporting myriad operating systems
 and versions, this alone provides an
 obvious and significant advantage
 over the proprietary alternative and
 no doubt will prove to be attractive
 and cost-efficient for developers
 looking to publish across platforms.
                                             Wonky close-ups and shooting
 With developers hopefully opting to
                                             through walls still occur, but still
 develop solely on Vulkan and not on
 DirectX with a subsequent OpenGL            aren’t that annoying.
 port, this should mean more games
 for us at similar performance to those
 on Windows, if common sense can              XCOM 2 feels like a new experience with
 overcome the network effect.
                                              continuity from the previous game

46                                                                www.linuxvoice.com
                                                                                                                        GAMING REVIEWS


Firewatch                                                                                                 ALSO RELEASED…
    A gripping mystery that really hits the mark
    Website http://store.steampowered.com/app/383870    spend the summer. There are no other
    Price £14.99
                                                        physical characters in the game, and
                                                        the only human contact is a relationship



    E
            very so often a game comes along            which develops through the walkie talkie
            that shows the true merit of video          to another firewatcher named Delilah.
            games as an artistic medium.                Without giving too much away, the plot
    Firewatch is one of these.                          revolves around the mysterious and
       The game immediately sucks the player            sinister goings on in the surrounding area,
                                                                                                          Dying Light: The Following
    in with a harrowing backstory of a Henry            while Henry comes to terms with his               DLC content is often not worth mentioning, but
    and his wife Julia. Within minutes, Henry           unsettling past.                                  The Following is so massive it could easily be a
    (the protagonist) finds himself traversing            Firewatch is recommended to just about          standalone game. Additions include a huge
    the Wyoming wilderness to arrive at a               anyone who enjoys a good story and                new map, drivable vehicle, new weapons, a new
    lone firewatching tower where he will               doesn’t crave constant action.                    story and more. Like the base game, the story
                                                                                                          is poor at best, but it does extremely well in
                                                                                                          providing endless entertainment to an already
                                                                                                          very entertaining game.
                                                                                                          http://store.steampowered.com/app/239140




      Firewatch’s graphical style                                                                         Agatha Christie – The ABC Murders
      manages to be both beautiful                                                                        The crime and mystery genres tend to work
      and light on resources.                                                                             rather well with point-and-click mechanics,
                                                                                                          and it’s great to see such a game based on
                                                                                                          literature. The game has some lovely visuals,
                                                                                                          good voice acting, nice music and captures the

American Truck Simulator
                                                                                                          essence of the novels. Graphically, it does
                                                                                                          suffer from some aliasing issues, even on
                                                                                                          highest settings, but this can be forgiven if
    The game that shouldn’t be great, but is                                                              you’re after a solid “whodunnit” story.
                                                                                                          http://store.steampowered.com/app/374900
    Website http://store.steampowered.com/app/270880/
    Price £14.99




S
“
            imulator” is often a euphemism for
            “niche”, “parody” or just “terrible”,
            but the Truck Simulator games have
    been there to remind us that this isn’t
    always the case. This latest instalment
    is no exception and brings trucking to              Like everything in the States, the trucks are
    its spiritual home in the United States.            flamboyantly big.
    It’s time to put Johnny Cash on the truck                                                             Superhot
                                                                                                          Re-imagining the FPS genre, Superhot is a
    radio and watch the diners and motels               having the nice gaming mechanics of
                                                                                                          game in which time only advances as the
    pass by on the way to San Francisco.                building a logistics company from scratch         player moves, which makes things very
        How a game series in which one drives           on top of the driving.                            interesting indeed. Add in some stylised
    sensibly at the legal speed limit for long             Thankfully, this isn’t just a reskin of Euro   graphics, take away mechanics like
    stretches has become so popular defies              Truck Simulator 2, adding plenty of content       regenerating health and ammo drops and you
                                                                                                          have a game that’s proved to be insanely
    conventional logic, but to those who have           on top of the new locations and trucks.
                                                                                                          popular. Now you can play a shooter in which
    played this or its predecessors, it makes           The cities are more fleshed-out than in           you can have a coffee and file a tax return
    perfect sense. Playing American Truck               its predecessor, with more buildings and          between killing enemies.
    Simulator, for a lot of people, is a great way      landmarks, which only adds to what feels          http://store.steampowered.com/app/322500
    to unwind and listen to music, all the while        like a more genuine trucking experience.



                                                                       www.linuxvoice.com                                                                47
     REVIEWS BOOKS



Learn Game Programming With Ruby
Ben Everard knows that creating a game is just the first step to being beaten at it.
Author Mark Sobkowicz
Publisher Pragmatic Bookshelf
Price £15.99
ISBN 978-1680500738




B
        efore turning to a career writing        to construct the internals of the game
        about open source software, this         from scratch. This makes it more of a book
        reviewer had a brief stint teaching      about programming than a book about
English as a foreign language. It taught me      learning one particular games development
exactly one thing about getting students         framework. Learn Games Programming With
to learn a new subject, and that is that by      Ruby starts a little too quick for someone
far the most important thing is to get your      who’s not programmed before, but it
students interested in the topic. If they’re     makes a great second book to get new
excited to learn about something, it doesn’t     programmers thinking a little more about
really matter how badly you convey the           the best ways to structure their programs
information. Learn Game Programming with         after they’ve mastered the basics. The
Ruby is really a book about learning object      book’s getting started guide only covers
oriented programming, but it uses games          OS X and Windows, but all the libraries used
to get new programmers excited about the         are cross platform and work on Linux.
subject.
   Rather than use a games library, Mark         A fun way to build up your programming
                                                 skills.                                                Learn Game Programming With Ruby focuses
Sobkowicz builds all the games using just                                                               on 2D games such as vertical scrolling space
a media library and shows the reader how                                                                shooters. Fine by us!




Secure Your Node.js Web Application
Ben Everard secures web apps with an axe – cut the network cable and you’re safe.
Author Karl Duuna
Publisher Pragmatic Bookshelf
Price £23.99
ISBN 978-1680500851




S
        ecurity is vital for web applications    some peculiarities that make it vulnerable to
        – it’s a subject we’ve covered many      these attacks in unusual ways, and if you’re
        times in Linux Voice. Most of the        developing Node.js then you need to know
older web technologies – such as PHP             what to avoid to stay secure.
– are already well known from a security            Secure Your Node.js Web Application
perspective, and there are many resources        doesn’t go into much depth about the
to help developers know what mitigations to      different types of attack, and ideally we’d like
take to ensure that their software remains       to see some examples that aren’t trivial and
secure. Node.js is much newer, and this is       contrived. Software security is a complex
the first book to really go in to the security   topic, and security problems are often
implications of writing sever-side code          subtle and hard to spot. This book will help
in JavaScript (which is a very different         readers avoid most basic mistakes, but it’s
prospect to writing secure client-side           not detailed enough to help developers write
JavaScript).                                     really secure code.
   The basic techniques used to attack
Node.js are the same as those used to
attack other server-side technology: code        Not as in depth as we’d like, but currently the best
                                                 option available.                                      Apparently, attacking a website requires
injection, authentication-bypass, cross-site                                                            a transparent touchscreen and a hood to
scripting, etc. However, JavaScript has                                                                 obscure your face.



48                                                             www.linuxvoice.com
                                                                                                                    BOOKS REVIEWS



OpenStack Cloud Computing
Graham Morrison just can’t get his head out of the clouds.                                  Also released…
Author Kevin Jackson, Cody Bunch, Egle Sigler
Publisher Packt Publishing
Price £31.99
                                                                                            April 2016
ISBN 978-1782174783

                                                                                            3D Printing Designs
L
        earning about OpenStack
        can be a challenge. It’s a                                                          3D printing is still going
                                                                                            from strength to strength
        complicated subject, and that
                                                                                            and getting cheaper every
complexity seems to be increasing                                                           year, but there aren’t a
each year, mirroring its growth. The                                                        great deal of quality
main problem is its scale, both in                                                          examples to follow. This
terms of what there is to learn and                                                         book focuses on creating
                                                                                            an octopus pencil holder,
its requirements. It’s not a simple
                                                                                            which looks great from
case of installing a few packages or                                                        the cover, and should also
experimenting within the confines                                                           get children excited too.
of a virtual machine, and that makes                                                        This book promises to
learning about OpenStack and playing            This is a great book if you’ve ever         take you from Blender
                                                                                            models to final object,      Everyone needs a good
with new ideas difficult.                       thought about trying OpenStack.
                                                                                            step-by-step.                pencil holder.
    We discovered this while writing
our own tutorial on getting started             within the book should be easy to
with OpenStack (see p76), and while             understand, and unlike with
it is possible to install the system on         Canonical’s own (excellent) installer, by
a single relatively powerful machine,           performing each step yourself, you          Efficient BPM Applications
it negates the reason why OpenStack             learn more. When you create the             We were initially drawn to
has been so successful – the ability            tables used by Keystone in SQL, for         this because of the title
to scale from just a few machines to            example, you know what those tables         – BPM to us means beats
thousands. And while OpenStack’s                are doing and how they fit into the         per minute, and we can
                                                                                            think of lots of ideas for
documentation is very good, what                entire OpenStack ecosystem, slowly          creating some lovely
we really need are some practical               chipping away at its complexity.            crunchy beats. But no,
examples of various deployments.                    With all the ingredients covered, and   this isn’t that BPM, it’s
                                                keeping with the cookbook metaphor,         apparently Business
Cooking with OpenStack                          there are plenty of specific ‘recipes’      Process Management. If
                                                                                            you already knew that and
We didn’t have the space in the title           littered throughout the book. The cover     think we’re crazy for
above, but this is the third edition of a       mentions 110, and it does feel like         mentioning beats,
the OpenStack Cloud Computing                   almost every step gives an alternative      we’re guessing this book     BPM != Business Process
Cookbook. The ‘cookbook’ part is                example for each step. This is the          is for you.                  Management.
important, because OpenStack, in                most impressive part about the book,
particular, is very modular, and each of        although you’ll likely need a more
those modules can be thought of a               explanatory book if you want to take
single ingredient. To this end, the book        your OpenStack installations further.       Reunited States of America
starts off looking at each module in            Background information here is kept
                                                                                            What perhaps shoudn’t be
turn – Keystone, Glance, Neutron,               to a minimum so that you can rapidly        surprising is that this
Nova, and Swift. Starting with                  progress from one example to another,       book is being published by
Keystone, the authentication and                while providing only the bare details of    one of O’Reilly’s partners,
identification module, says a great             what each bit if text. But this level if    and could have some
deal about the attitude of the writers,         detail is perfect for our short attention   exposure in some of its
                                                                                            more technical audiences.
dealing with the vital and thorny               spans. There are some excellent             We’ll avoid the politics,
subject of security first, before moving        explanatory diagrams littered               but we’re always
on to the more practical modules.               throughout, and there’s a ‘How it           interested in ideas that
  The book uses the Ubuntu Cloud                works’ section after covering each          are designed to bring
Archive, which hosts the OpenStack              concept, but mainly, the book just          people together rather
                                                                                            than move then apart,
installation packages for Ubuntu. It’s          teaches you how to get on with it.          which is exactly what this
the same installation of Ubuntu we                                                          book promises to do.        Coming to America.
                                                An excellent way to get OpenStacked.
used for our own tutorial, and so the
code examples and the explanations



                                                                    www.linuxvoice.com                                                             49
     GROUP TEST PRIVACY DISTROS




GROUP TEST
Since Harry Potter’s invisibility cloak is of little use on the internet,
Mayank “Griffindor” Sharma checks out some distros that will do the job.



 On test                                                      Privacy distros
                                                              U
                                                                        p until the Snowden leaks,           still exposed to all sorts of privacy
 IprediaOS                                                              the proponents of privacy            leaks and security intrusions as
             URL www.ipredia.org                                        attacks were digital                 soon as we go online. The mere act
             Licence GPL and others                           outlaws firmly on the wrong side of            of surfing the web and using the
             Latest release IprediaOS 1                       the law. However, much to our                  various online file sharing services
             A live distro built on the I2P                   chagrin, we suddenly found                     and social networking sends out
             anonymous network.                               ourselves in the midst of an                   more information to unintended
                                                              information age where invading our             recipients than you can imagine.
 JonDo Live-DVD                                               privacy has not only become a                     Over the next few pages we’ll
             URL www.anonymous-proxy-servers.net/             state-sponsored practice but has               look at different Linux distros
             en/jondo-live-cd.html                            also become a mainstream                       that take steps to ensure your
             Licence GPL and others                           business model.                                anonymity and protect you against
             Latest release 0.9.88.2                             Despite the ensuing hue and cry,            inadvertent leaks and breaches.
             This distro offers multiple privacy tools.       apps and websites by vendors on                All these distros are designed
                                                              the IT high street continue to gather          with privacy protection as their
 Lightweight Portable Security                                information about us, usually
                                                              without our consent. As users of
                                                                                                             primary objective, but ensuring
                                                                                                             privacy often comes at the price of
             URL www.spi.dod.mil/lipose.htm
                                                              open source software, the all-seeing           usability. Since the distros on test
             Licence GPL and others
                                                              eye of the developer community                 take different approaches to privacy
             Latest release 1.6.4
             A privacy-centric distro from the US             shields us from the nefarious                  protection, we’ll be on the lookout
             Department of Defence!                           practice of bundling backdoors                 for the distro that guarantees
                                                              and malicious code prevalent in                utmost safeguards with minimum
 Tails                                                        closed source software. But we’re              disruptions to our way of working.
             URL www.tails.boum.org
             Licence GPLv3+
             Latest release 2.0.1
                                                                We’re exposed to all sorts of privacy
             The most popular distro for privacy
             seekers that anonymises via Tor.
                                                                leaks and security intrusions as
                                                                soon as we go online
 Ubuntu Privacy Remix
             URL www.privacy-cd.org                            Anonymity vs Privacy
             Licence GPL and others
                                                               Privacy and anonymity are two different       is when you are non-identifiable whereas
             Latest release 12.04r1
                                                               concepts that are often confused with         privacy is concerned with your ability to
             A modified Ubuntu distro for creating an          each other. While they are both becoming      cut off yourself selectively.
             isolated environment.                             increasingly necessary as our online             To illustrate, if you visit a website via
                                                               movements are constantly tracked,             Tor, that website will not be aware of your

 Whonix                                                        it’s vital to understand the differences
                                                               between them.
                                                                                                             real location, in essence concealing your
                                                                                                             identity. However, if you visit a site via
             URL www.whonix.org                                    Privacy is the ability to keep some       Tor and then log into your account, you
             Licence GPL and others                            things to yourself; in contrast, anonymity    are no longer anonymous. But by routing
             Latest release 12.0.0.3.2                         is when you want people to see what           your request via an encrypted network,
             Takes a unique virtualised approach               you do, just not that it’s you doing it. In   you haven’t revealed your destination to
                                                               terms of our digital existence, the most      any intercepting party (such as your ISP),
             to privacy.
                                                               important distinction is that anonymity       thus maintaining your privacy.




50                                                        www.linuxvoice.com
                                                                                           PRIVACY DISTROS GROUP TEST



Security Qubed
From virtualisation to compartmentalisation.


Q
         ubes OS is an interesting distro for       desktop. The install-only distro is based on        The VMs in Qubes are known as security
         security conscious users. The distro       Fedora and allows the user to install either     domains or AppVMs. Each of these has a
         divides the computer into a series of      KDE, Xfce or both the desktop environments.      different level of security and are defined
virtual machines or domains using Xen that             The architecture of Qubes is different        in a template. By default, Qubes installs
are cut-off from one another. Each virtual          from that of a chroot environment in which       with three domains – work, personal, and
machine only has access to the services             the systems share hardware resources             untrusted, though users can add more
that it needs to perform the designated             such as network cards. Besides the minimal       through Qubes VM Manager. The distro
function, thus limiting the potential security      graphical desktop, everything else in Qubes      takes some getting used to and new users
threat. Despite all that virtualisation wizardry,   including network cards and even disks, are      should read through its documentation to
Qubes offers a coherent and streamlined             separate virtual machines.                       wrap their heads around the distro.




Whonix
Whole new world.

W
              honix is very different from the
              other distros in this group test.
              The distro is in fact a pair of
Debian-based virtual appliances that you
must run simultaneously, in two separate
virtual machines. The Whonix-Gateway is
used for configuring Tor, and its only task is
to route traffic via the Tor anonymising
network. This machine has two virtual
network interfaces – one connected to the
internet via NAT, which is used to
communicate with the Tor network, and the
other network interface is connected to a           For an even more secure implementation, you can deploy the Gateway on the physical hardware of
virtual LAN. The other machine is the               one machine and run the Workstation on virtual hardware inside a different host altogether.
Whonix-Workstation, which is the desktop
you are supposed to use for browsing and            the Tor browser but doesn’t ship with one by     the Pidgin IM, not just for the installation
other tasks. The iptables rules on the              default; instead the icon brings up a script     instructions but for some best practices to
Whonix-Workstation force it to only connect         to download one from a list of stable, new       ensure anonymity and pointers to related
to the virtual internet LAN and redirect all        and hardened releases. There’s also Xchat        additional privacy-enhancing components.
traffic to the Whonix-Gateway. This scheme          for IRC but surprisingly no app for instant      In addition to information on the bundled
prevents apps from ever knowing the user’s          messaging. Then there’s the WhonixCheck          components inside the distro, the Whonix
real IP address or accessing any information        app, which scans the current installation and    wiki also makes for a good read for anyone
on the physical hardware.                           tests the Tor connection.                        interested in stopping inadvertent leaks.
   At first launch both Whonix-Gateway and            Be aware that installing updates will take        There are several Whonix variants. You
Whonix-Workstation take you through a               longer on Whonix than on other distros, as       can download the Gateway and Workstation
brief setup wizard to familiarise you with the      they are routed via the Tor network. While       as VirtualBox images and import them on
project and set up some components, such            Tor frowns upon using the network for            either Linux, Windows or Mac machines.
as the repository. If you have the resources,       certain activities like downloading torrents,    Instead of using VirtualBox, Linux users are
the Whonix developers suggest you run               they have no issues with Whonix using the        encouraged to instead download the two
multiple instances of the Workstation VM,           network for downloading updates.                 Whonix machines as KVM images.
one for each task.                                                                                      You can also install Whonix on top of
   Whonix doesn’t have very many apps but           Solid underpinnings                              QubesOS mentioned in the box above.
the ones it does are tuned for guaranteeing         The distro is based on Debian 8 Jessie,
privacy. For example, the IceDove email             whose repository you can use to install           VERDICT
client ships with the Enigmail extension            any additional packages. It’s a good idea to      A unique, albeit
                                                                                                      resource-intensive
for encrypting email. There’s also KGpg for         refer to the documentation on the project’s       solution to the problem.
managing keys. The distro has an icon for           website before installing components like



                                                                www.linuxvoice.com                                                              51
     GROUP TEST PRIVACY DISTROS


Ubuntu Privacy Remix
’buntu and privacy?


T
          he two biggest threats to              Talking of TrueCrypt, UPR has
          security and privacy are the        something known as Extended
          internet and the data-sniffing      TrueCrypt volumes. In addition to
trojans and scripts on your hard disk.        storing regular files the extended
The Ubuntu Privacy Remix (UPR) distro         volume also stores the configuration
is a radical solution that works by           and user data of LibreOffice, Evolution
cutting access to both of these. With         and GnuPG. This helps you overcome
UPR you get an isolated environment           the disadvantage of losing your
that can be used to work on sensitive         app settings that’s most commonly
documents or highly infected ones.            associated with Live distros. Another
   The developers have stripped               noteworthy customisation is the             Use the godmode boot option to gain superuser access
support for all sorts of networking           distro’s homebrewed front-end to            with the sudo su command.
hardware from the distro’s kernel, which      GnuPG, which focusses on encrypting
has also been tweaked to ignore all ATA       and decrypting files. To guard against                       UPR is an ideal platform for anyone
hardware such as hard disks. (You can         cold boot attacks, the distro wipes the                    looking for a system that’s truly
still read files from optical drives and      computer’s RAM when you shut down.                         off-the-grid and provides an isolated
removable USB drives.) If you plug in a          The distro has all kinds of apps, from                  habitat that segregates the working
USB drive, you can create an encrypted        LibreOffice and VirtualBox to the Gimp                     environment from the files on the
TrueCrypt volume on the drive using           image editor and the VLC media player.                     computer’s disk.
the distro to save and read documents.        The latest UPR is based on the Ubuntu
UPR mounts all removable media as             12.04 LTS release and uses the Gnome                         VERDICT
well as the TrueCrypt volumes with            2 desktop. It also bundles detailed                          A wonderful option for
                                                                                                           anyone looking for an
the noexec option, which prevents the         setup and getting started guides to                          isolated environment.
execution of programs from the media.         orient new users.




Lightweight Portable Security
Straight from the horse’s mouth.


T
         he Lightweight Portable              to use DNSCrypt, which prevents
         Security (LPS) distro is created     DNS spoofing by authenticating
         by the Software Protection           communications between the
Initiative (SPI) under the direction of the   computer and the DNS resolver.
US Air Force Research Laboratory                 LPS includes a handful of apps.
(AFRL) and the United States                  There’s the Firefox browser, which is
Department of Defense. They’ve                equipped with the HTTPS Everywhere
designed it for telecommuters who             and User Agent-switching extensions.
need to access secure government              There’s also a PDF reader and a
networks from unsecured remote                bunch of remote desktop software            The goal of the developers is to put out new LPS release
locations. To this end, the distro works      including the Citrix Receiver and VMware    at least once every quarter.
with DoD-issued Common Access Card            View. These are complemented
(CAC) and Personal Identity Verification      by a smattering of apps such as a                          decorations has been designed to ape
(PIV) smartcards for accessing                barebones text editor and an image                         the proprietary OS to give the DoD
restricted government websites.               viewer. The SPI also produces a Deluxe                     spooks the look and feel of a familiar
   Just like the Ubuntu Privacy Remix,        edition of the distro which is the same                    environment. For further assistance,
LPS also uses a modified kernel that          as the regular release but additionally                    the project’s websites contains
prevents interactions with the local          includes LibreOffice and Adobe Reader.                     thorough FAQs as well as a Quick Start
hard disk. The distro includes the               Although LPS uses the Xfce 4                            guide and a user’s manual .
public edition of the Encryption Wizard       desktop, it’s been tweaked extensively
app created by the AFRL, which can            to resemble Windows XP. Everything                           VERDICT
                                                                                                           A privacy-focussed distro
encrypt and decrypt individual files          from the layout of the desktop,                              with some fascinating
and even complete directories. There’s        complete with the Windows-                                   customisations and tools.
also an option to force the distro            hallmark Start button, to the window



52                                                             www.linuxvoice.com
                                                                                              PRIVACY DISTROS GROUP TEST


JonDo Live-DVD                                                                                     Be incognito on the go
Proximus prime.
                                                                                                   Privacy on a stick.


                                                                                                   F
                                                                                                           reepto is a Debian-based distro that’s
                                                                                                           available as a live image designed to be
                                                                                                           transferred on to a USB disk. The distro
                                                                                                   includes a tool to create an encrypted
                                                                                                   persistent storage partition on the free space
                                                                                                   in the USB disk. Freepto is chock-full of all the
                                                                                                   popular digital invisibility tools as well as the
                                                                                                   popular desktop productivity tools to enable
                                                                                                   you to use the distro as your everyday
                                                                                                   desktop. There’s everything from LibreOffice
                                                                                                   and Gimp to VLC and Audacity. For everything
                                                                                                   else, there’s the Synaptic package manager
                                                                                                   and Debian’s extensive repository of packages.
                                                                                                      Unlike with regular distros, software like
                                                                                                   Pidgin, Xchat and Filezilla are configured to
                                                                                                   work over the Tor network. The distro includes
                                                                                                   the Tor browser and also a regular Iceweasel
                                                                                                   installation that’s equipped with privacy-
                                                                                                   enhancing plugins such as Disconnect,
                                                                                                   Adblock Plus and HTTPS Everywhere.
You can use JonDo’s controller to select from any of the listed mix cascades.                         Freepto also contains a set of tools for the
                                                                                                   privacy-conscious users. There’s BleachBit for



J
        onDo Live is a Debian-based distro       proxy for anonymity, including Pidgin and         zapping temporary files, Gufw for tweaking the
        built on tools that are designed         Thunderbird. There’s also the privacy-            firewall, TorTP to force any app to route via Tor,
        specifically for masquerading your       enabled JonDoFox browser, which is                TrueCrypt to work with encrypted storage, MAT
identity online. The core piece of software      configured to route traffic via the JonDo         for stripping metadata from files, and tomb,
in the distro is the Java Anon Proxy (JAP)       proxy and also includes a number of               a command-line file encryption utility. The
more commonly known as JonDo. The                privacy and security themed browser add-          distro also includes a user’s guide, but it’s only
app anonymises your connections using a          ons. If you’re using the Tor proxy instead,       available in Italian and Spanish. This shouldn’t
proxy service in order to conceal your           there’s the Vidalia client for establishing       stop new users from experimenting with the
origins. The Java-based client for the           and managing the connection to the Tor            distro, since it’s pretty much like a standard
proxy is available for various platforms         network as well as apps such as the Tor           desktop distro and fairly intuitive.
including Linux, BSD, Windows and Mac.           browser and TorChat designed to facilitate
   The live distro offers users the option       communication over the Tor network.
of using the JonDo or the Tor proxy to
anonymise your network traffic. JonDo            Something for everyone
routes your traffic via encrypted channels       Besides these network-specific apps, the
through a mix of multiple servers.               distro also hosts several other privacy-
While this routing ensures privacy and           focussed and general purpose apps such
anonymity, hopping through the servers           as ZuluCrypt, KeePassX, Jitsi, Qtox,
means your surfing will take noticeably          LibreOffice, Gimp, Skype, VLC and more. To
longer. Although anyone can hop on the           avoid setting up account information
JonDo network via a free cascade, you            repeatedly on all these apps in a Live
can pay a small fee and instead use a            distro that can’t be installed to the disk, the
premium mix that in return promises              distro includes a nifty little app that rolls
increased speed and better anonymity             the configuration of several apps into a
by routing traffic via more servers.             compressed tarball. Ferry the tarball via a
Furthermore, the free mixes only allow           USB disk and upon reboot extract in inside
traffic on port 80 and 443 (for HTTP and         the home directory of the Live distro.
HTTPS). For everything else, such as 5222
for Instant Messaging and 21 for FTP, you          VERDICT
                                                   A good collection of
need to subscribe to the premium mix.              anonymous apps for                              Freepto is built using the Debian Live Build tools
   Many of the included apps in the distro         multiple proxy networks.                        by the hacktivist group Av.A.Na.
are preconfigured to use the JonDo



                                                                   www.linuxvoice.com                                                               53
     GROUP TEST PRIVACY DISTROS


Tails vs IprediaOS
Which one does a better Keyser Soze?


T
         he Debian-based Tails (The
         Amnesiac Incognito Live
         System) uses Tor to create an
encrypted channel to the internet to
preserve your privacy. You can install
Tails to a USB disk and use the
remaining free space to create an
encrypted persistent partition to store
settings and files.
   Tails has the usual cocktail of apps
that you’d find on a regular Linux distro,
as well as some unique ones such
as the Electrum Bitcoin wallet, the
Gobby collaborative editor, GtkHash to
generate and verify the checksums of
transmitted files and MAT (Metadata
Anonymisation Toolkit) for zapping
metadata information from files.
   Unlike many other distros however,        Tails doesn’t interact with a computer’s hard disk, so nothing is saved to the computer you’re running on.
Tails bundles the Synaptic package
manager for fleshing out the desktop.        the distro. Just like it does with Tor, the                   the biggest difference between I2P
This task requires admin access, which       distro will connect to the I2P network                        and Tor is that while Tor is used to
is disabled by default but can be set        in the background. When it’s done, fire                       anonymously browse the regular
up using the Tails Greeter app. The app      up the bundled I2P Browser in Tails,                          internet, the primary objective of I2P
can also be used to spoof your device’s      which takes you to I2P’s browser-based                        is to create and allow access to the
MAC address to avoid it being used to        control panel.                                                hidden network of eepsites. Again for
uniquely identify you. On shutdown,                                                                        comparison, eepsites with the .i2p TLD
Tails wipes the computer’s RAM to            To P or not to P                                              are what .onion sites are to Tor.
safeguard against cold boot attacks.         IprediaOS is to the I2P network what                             The distro includes a ready-to-go
   Another anonymising network that’s        Tails is to the Tor network. The distro                       webserver that’s online as soon as
occasionally pitted against Tor is I2P       can be used to connect to the I2P                             you’re connected to the I2P network.
(Invisible Internet Project). You can        network and also includes some tools                          Besides websites, the network hosts
access the I2P from Tails by passing         that can be used to access the various                        various services such as anonymous
the i2p boot parameter when starting         services on the I2P network. Perhaps                          email and anonymous file transfer.
                                                                                                           I2PSnark is the name of the network’s
                                                                                                           Bittorrent service, which can be
                                                                                                           accessed via the network’s Python-
                                                                                                           based client called Robert. Sharing
                                                                                                           torrents is a popular activity on the I2P
                                                                                                           network, unlike Tor, which frowns upon
                                                                                                           the use of the network for this purpose.
                                                                                                              IprediaOS uses the Gnome 3 desktop
                                                                                                           and is one of the few privacy-centric
                                                                                                           distros that can be easily installed
                                                                                                           to the hard disk. The distro however
                                                                                                           includes an older version of I2P, so
                                                                                                           your first order of business should be
                                                                                                           to update to the latest release before
                                                                                                           connecting to the network.

                                                                                                             VERDICT
                                                                                                             TAILS LINUX              IPREDIAOS
                                                                                                             A well-packaged distro   Built around I2P but
                                                                                                             Linux distro built       hasn’t been updated
                                                                                                             around Tor.              for quite some time.

To get the most out of IprediaOS, users are encouraged to peruse its documentation.



54                                                             www.linuxvoice.com
                                                                                                   PRIVACY DISTROS GROUP TEST



  OUR VERDICT
Privacy distros
T
         he requirements for digital              While we applaud Whonix’s
         privacy and anonymity are            compartmentalised approach to the
         highly subjective. You might         issues at hand, setting it up requires
prefer a secluded computer cut off            a fair amount of work. The distro
from the internet to work on and              comes with a learning curve that’s
pass along encrypted documents.               steeper than some of the other               You can easily combine JonDo with other anonymisation services
In such a case, your choice of distro         solutions on offer and also requires         such as Tor.
will be very different from a                 greater system resources.
whistleblower who wants to                        Tails is one of the best-known
anonymously email a bunch of                  distros for anonymity and privacy.            1st JonDo Live-DVD
documents without revealing his               It’s built on the Tor network, is
name or location.                             regularly updated and equips you              Killer feature: JonDo and Tor
   Given the US Government’s track            with the right tools for staying              www.anonymous-proxy-servers.net/en/jondo-live-cd.html
record when it comes to ensuring              invisible both online and offline.            Experience the best of two anonymising networks and a host of
privacy it’s difficult to suggest the             If you force us to pick one distro,       relevant tools.
Lightweight Portable Security distro          it’ll have to be JonDo, even though
to anyone, especially since there             to make the most of the JonDo
are far better alternatives on offer.         network, you’ll have to subscribe to          2nd Tails
Then there’s IprediaOS, which loses           a premium mix. A JonDo network
out simply for being outdated. If             offers several advantages over Tor            Killer feature: Tor and I2P
you do need to use the I2P network,           and I2P. For starters you can select          www.tails.boum.org
the Tails distro does a better job            your mixes. Secondly, although                If JonDo doesn’t impress you, then use this.
than IprediaOS. The Ubuntu Privacy            the servers don’t keep logs,
Remix has a very limited use case.            compromising one server in the mix
While its use of encrypted USB                will not reveal your identity, because        3rd Whonix
disks for securely ferrying files             of the architecture of the network.
means it’s not completely cut off             In case you’re still not convinced,           Killer feature: Unique architecture.
from the rest of the world, the lack          the distro can still be used to               www.whonix.org
of internet access limits its use for         connect to the Tor network, so you            A notable distro for the experienced privacy campaigns.
everyday online tasks.                        win both ways.

   Because of their nature, the                                                             4th Ubuntu Privacy Remix
   requirements for digital privacy                                                         Killer feature: Disconnected and isolated.
   and anonymity are highly subjective                                                      www.privacy-cd.org
                                                                                            A truly standalone distro for powering a secure workstation.


  The Freenet project
  Freenet is a peer-to-peer system            a Freemail email address and configure
                                                                                            5th IprediaOS
  designed to facilitate anonymous sharing    your email client to send mail via this
  of information on the internet. The         address. Similarly you can create an          Killer feature: I2P
  network enables users to communicate        account on Freenet’s Sone microblogging       www.ipredia.org
  using a platform that cannot be             service, the FMS forums, and the FLIP         An outdated distro for showing the I2P network.
  censored. It creates a distributed data     IRC client. You can then interact with
  store that houses information accessible    other members on the forums and
  by all members. Freenet also publishes      even create your own website. Besides
  several tools for anonymous publishing      creating a secret identity, you can browse    6th Lightweight Portable Security
  and communication.                          all kinds of websites on Freenet. The
     You can install Freenet on all desktop   network maintains a list of Freenet
                                                                                            Killer feature: Encryption wizard
  operating systems. Once it’s installed      websites with the most recently updated
                                                                                            www.spi.dod.mil/lipose.htm
  follow its guide to create an anonymous     ones at the top. Since the content on
                                                                                            Doesn’t offer anything uniquely different that’s not available
  identity using the WebOfTrust plugin.       Freenet isn’t filtered, be prepared to
  After creating an identity you can set up   encounter offensive and illegal content.
                                                                                            elsewhere.




                                                                     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
                                                                                                                                            Goldmembers
 28 APRIL                                                                                                                                   Steward of the Linux
                                                                                                                                            name, employer of
                                                                                                                                            some important
                                                                                                                                            kernel hackers – or
                                                                                                                                            corporate lackeys?
                                                                                                                                            Find out, as we go
                                                                                                                                            inside the Linux
                                                                                                                                            Foundation.

                                                                                                                                            Microsoft’s Linux
                                                                                                                                            The end of the world
                                                                                                                                            is nigh! Microsoft
                                                                                                                                            has released a Linux
                                                                                                                                            distro! We take a
                                                                                                                                            look, while dodging
                                                                                                                                            fire, brimstone,
                                                                                                                                            plagues of locusts
                                                                                                                                            and other portents.

                                                                                                                                            Rust never sleeps
                                                                                                                                            It’s been a year since


WHAT NEXT FOR UBUNTU
                                                                                                                                            Mozilla released the
                                                                                                                                            first stable version of
                                                                                                                                            its Rust
Once the world’s favourite distro, Ubuntu has                                                                                               programming

toned down the hype and got on with taking                                                                                                  language – high
                                                                                                                                            time we got our
over – and it’s coming to your TV!                                                                                                          hands on it, we think.




       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      Nothing in this magazine may be reproduced
andrew@linuxvoice.com            All code printed in this magazine is licensed   Floor, 5 Churchill Place, Canary Wharf,       without permission of the editor, until
Technical editor Ben Everard     under the GNU GPLv3                             London, E14 5HU                               December 2016 when all content (including
ben@linuxvoice.com                                                               Tel: +44 (0) 20 3148 3300                     our images) is re-licensed CC-BY-SA.
Editor at large Mike Saunders    Printed in the UK by                                                                          ©Linux Voice Ltd 2016
mike@linuxvoice.com              Acorn Web Offset Ltd                            Circulation Marketing by Intermedia Brand     ISSN 2054-3778
Creative director Stacey Black                                                   Marketing Ltd, registered office North Quay
stacey@linuxvoice.com            Disclaimer We accept no liability for any       House, Sutton Harbour, Plymouth PL4 0RA       Subscribe: shop.linuxvoice.com
                                 loss of data or damage to your hardware         Tel: 01737 852166                             subscriptions@linuxvoice.com

                                                                    www.linuxvoice.com                                                                               57
     FOSSPICKS




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

             Raised by endangered Tasmanian wolves, Ben Everard sniffs the air
             and howls at the latest and greatest Free Software releases.
Video player


MPlayer 1.3
V
         ersion 1.3 of this veteran     alternative front-ends for MPlayer.
         video player came out          This tells us two things about
         alongside the FFmpeg 3.0       MPlayer: that it’s well used and that
codecs, and the two work hand-in-       it’s default interface is rubbish.
hand. Because of this, the biggest          While MPlayer does have a GUI,
update in MPlayer 1.3 is that it now    it’s more commonly used as a
plays an even greater range of video    command line program. Its
                                                                                MPlayer is the ultimate
files. FFmpeg handles the low-level     popularity comes from a                                           lead to it being a little confusing to
                                                                                video Swiss Army Knife,
details of what a particular            phenomenal range of options that        but the command line      use – hence the range of alternative
file-format means, and MPlayer          enable it to not only play just about   options can be hard to    front-ends.
turns this into a useful player.        any piece of video known to man,        fathom.
                                                                                                            PROJECT WEBSITE
   A quick grep through the MPlayer     but also manipulate the video in
                                                                                                            www.mplayerhq.hu
website tells us that there are 292     any way you wish. This power does


Process monitor


htop 2.0
L
       inux is just a kernel – the      this through an ncurses terminal
       heart of the OS on top of        interface, which both looks good,
       which everything else sits.      and works well over SSH.
The kernel has its own special place       htop is the first program we turn
in memory and controls access to        to when investigating performance
the CPU and other resources. Every      on our Linux boxes – desktops and
other program that you run is a         servers. It doesn’t always have all
process, and it all starts with         the information we need, but it does
process 1, which initialises your       give a great overview of what’s
system. Every server you run, every     going on, and shows you where to
                                                                                Everything you need to know about your running processes in a
command you execute, every              drill down further.
                                                                                colour-coded terminal screen.
desktop application you open:              If you’re still using the bog-
they’re all processes.                  standard command top (the default
   Process viewers help you keep        process viewer on many Linux                                      overview of what’s going on, better
an eye on all the different processes   distros), then it’s time to switch to                             sorting of processes, and a tree
running on your machine, and htop       htop and be amazed by the neater                                  view to give a better view of
is one of the best. The main job of     interface and mouse controls. htop                                multi-process programs. With
htop is to give you an overview of      has colours to provide a quick                                    version 2.0, htop works on Linux,
what’s going on inside your                                                                               OS X and many BSDs, so you can
machine: which processes are
using the CPU, which are eating up
                                           It’s time to switch to htop                                    now enjoy the same interface on all
                                                                                                          your Unix-y boxes.
the memory, and how many free              and be amazed by the neater
resources are there. It manages all                                                                         PROJECT WEBSITE
                                           interface and mouse controls                                     http://hisham.hm/htop



58                                                           www.linuxvoice.com
                                                                                                                           FOSSPICKS


Windows-like OS


ReactOS 0.4
V
          ersion 0.3 of this Windows     made it to an impressive $48,000,
          clone came out in 2006,        but since then the project seems to
          and 10 years has brought a     have died. It’s a shame, because
lot of improvements, but ReactOS         confusion over licensing is holding
seems to us to still be stuck in         Windows back in the cloud, so an
no-man’s land. It’s more advanced        open source project that could
than most hobbyist OSes, but it’s        eradicate this problem while still
not yet advanced enough to be            being accessible to people who
useful as a main operating system        know the Windows environment
just yet. In order to make the jump,     could be very popular.
it needs to offer something tangible        ReactOS offers better support for
that Windows doesn’t.                    old software than modern versions
   This may seem like a tough ask        of Windows. This has improved in
                                                                                 Relive the glory days of Minesweeper with ReactOS.
for something that’s a clone, but        version 0.4 with the NT Virtual DOS
there are two areas where ReactOS        Machine (NTVDM) which enables
potentially could develop into a         old 16-bit applications to run on                                  gamers, the general support for
serious offering: simplifying cloud      modern processors. While this is                                   older Windows software could also
licensing and resurrecting dead          likely to be most useful to retro                                  find mainstream use. It could be
software. In the cloud, ReactOS                                                                             easier to keep a program written for
seems to be struggling to gain
interest. In 2014, the Thorium
                                            ReactOS offers better support                                   Windows XP running on ReactOS
                                                                                                            than port it to Windows 10.
project tried to raise $120,000 to          for old software than modern
fund development of a cloud                                                                                  PROJECT WEBSITE

desktop based on ReactOS. They              versions of Windows                                              https://www.reactos.org




Thought organiser


Cherry Tree
O
          h to have a brain like a       schema, because the simple truth
          computer. Wouldn’t it be       is that our wet, soggy brains can’t
          wonderful be able to           handle this level of data processing.
allocate memory and have it remain          Since the mushy data inside our
in one place, always retrievable?        heads isn’t formatted in anything
You could create an array of dates       approaching a normalised schema,
called birthdays, and just append        if we want some way to store our
new elements every time you met          thoughts digitally, it needs to be
someone new.                             able to adapt the chaos in our
   Perhaps it would be easier to set     minds. Cherry Tree is a hierarchical
your head up like a database and         note-taking application that tries to
create a table of people. This table     apply just enough order to allow our
could have columns for birthdays,        thoughts to be transferred to a
favourite food and other key facts.      digital medium and be usable. You
Properly referenced keys could then      can create a tree structure of text
                                                                                 Unload your brain into
refer to partners, children and other    notes, which nicely fits the flow of                               restore some order and make sure
                                                                                 your computer and
relationships… actually, we’d have to    human thought. One branch leads         never forget anything      your greatest ideas don’t
be a little careful with normalisation   to shopping lists, another goes to      again.                     accidentally get recycled at the
– it would probably be better to         your projects, another holds plans                                 bottom of a pile of old notes.
have a tables for families and           to take over the world.
households and reference those.             If your desk is under a sea of
   Alas, it’s useless designing the      post-it notes and scribbled on bits                                 PROJECT WEBSITE
                                                                                                             www.giuspen.com/cherrytree
perfect Boyce-Codd normal form           of paper, Cherry Tree can help you



                                                              www.linuxvoice.com                                                             59
     FOSSPICKS


Instant messenger


Kadu
T
        he world of instant               can chat with people on any other
        messaging may now be              server).
        dominated by huge                    Kadu supports all the usual
multinational companies that              features you’d expect from an
produce closed source software            instant messenger, such as the
with closed protocols designed to         ability to manage multiple
lock users into their platforms, but      accounts, buddy lists and file
we’re not yet ready to give up on the     transfers, and some more
idea of free and open                     advanced features such as Off The
communications. Kadu is an XMPP/          Record (OTR) encryption for added
Jabber client that enables you to         security. Perhaps the biggest
connect to any chat server that           feature of Kadu is support for the
supports these protocols. Once            Gadu-Gadu chat protocol, which is
                                                                                 French readers with poor spelling can enjoy this instant
upon a time that included Facebook        particularly popular in Poland.
                                                                                 messenger client.
chat, but alas, that is no longer
possible thanks to the social             Jak się masz                                                       to people looking for a Qt chat client
network dropping support for chat         The Qt 5 interface looks good, and                                 that doesn’t require the KDE
software other than its own.              works well. Kadu is most attractive                                framework to be installed. The
  If you don’t already have a chat                                                                           small set of dependencies make it a
account that supports an open
protocol, you can find a wide range
                                             Kadu is most attractive to                                      great option for lightweight
                                                                                                             desktops.
of public XMPP servers at                    people looking for a Qt chat                                     PROJECT WEBSITE
https://xmpp.net/directory.php
(with an account at one server, you          client that doesn’t need KDE                                     www.kadu.im




Download manager


uGet
I
     t seems to be a truth universally    your house is streaming a video
     acknowledged that our internet       when you suddenly come across a
     connection is always slightly        new distro that you want to
slower than we want it to be. Back        download. You could just download
in the mid 90s, 28.8Kbps was              the video and not worry about their
alright, but we would have loved an       video buffering, or you could try to
extra 10Kbps. Then, when ADSL             remember to download the distro
came out, we always wanted                later. With uGet, you can add it to
another 1Mbps. In 2016, we’re             your download queue, and set it to
eyeing up BT fibre internet, but no       start downloading in the middle of
doubt, next year we’ll want               the night. You don’t even need to
something even faster.                    worry about wasting electricity,
   Given that the internet is always,     because you can set uGet to shut       Mastering your downloads (and your anarchic downloads folder)
and will always be, too slow, we          down your machine when it’s            is key to getting the most out of your internet connection.
need software to help us make the         finished doing its work.
most of our connection. As a                 Download managers like uGet are                                 We’ll never be satisfied with our
download manager, uGet gives you          for voracious data hogs like us.                                   internet connection because the
lots of control over how you get                                                                             faster we can surf, the faster we
large files over the internet. It won’t
automatically speed up your
                                             The internet is too slow… we                                    can find more things we want to
                                                                                                             download.
internet, but it will help you use your      need software to help make
connection more intelligently. For                                                                            PROJECT WEBSITE

example, imagine someone else in             the most of our connection                                       http://ugetdm.com




60                                                            www.linuxvoice.com
                                                                                                                                 FOSSPICKS


Terminal image viewer


Termpix
I
    f you think really hard, it’s           does is interesting even if it’s
    possible to come up with a use          completely pointless. Essentially,
    for an image viewer that runs in        the program is really a converter
the terminal. Perhaps you might             between images (of any format
need one if you’re ever SSHed into a        supported by the Rust image
server and need to check what               library), and strings of ANSI text
pictures are available without              containing the characters for
downloading them. However, if this          half-block colours. This test is then
situation were to arise, installing a       printed on the screen to reveal a
new bit of software would probably          low-resolution version of the
be more hassle than just SCPing             original image.
the pictures to your local machine             The end result is something akin
– especially if you have to install the     to the charming graphics from 8-bit
dependencies (Rust) on the server.          computers. Maybe that’s a use for it
   Or maybe you’re the developer of         after all: creating graphics for retro
an operating system written entirely        games. Be on the lookout for a            Coming next issue [maybe]: Linux Voice in glorious ANSI-text-
in assembly language that has no            80s-style adventure game about a          rendered technicolour!
graphics system and can only                renegade group of Linux journalists                                  fighting against the forces of
handle text, and you need a method                                                                               proprietary software. It’ll be called
of converting images so they can
be displayed in this environment.
                                               Termpix caught our eye                                            Linux Vice.

   Whether or not Termpix has any              because what it does                                                PROJECT WEBSITE
real use is a little irrelevant to us. It                                                                          https://github.com/hopey-dishwasher/

caught our eye because what it                 completely pointless                                                termpix




Screen reader


Orca
F
        or most people, interacting         having text as well as icons make a
        with a computer means               big difference with Orca.
        looking at a screen, tapping           As it is, Orca works well for people
away at a keyboard and wiggling a           with some vision who need a little
mouse. However, humans don’t all            help. It could also be useful for fully
come from the same mould, and               blind people if used with carefully
not everyone has the same set of            selected software that’s been set
senses. The Orca screen reader              up with Orca in mind. Perhaps the
converts the text on screen to              most useful application for Orca,
spoken words so that people who             though, is for developers.
struggle to read a screen can still         Remember that not all of your
get the information off it.                 users have the same physical
   Orca sounds fairly robotic, but the      attributes as you, so while
                                                                                      You can change the
aim isn’t to produce perfectly              designing an interface, try using it                                  does someone who doesn’t know
                                                                                      default Orca setup by
human voice, but to make                    with Orca and see how it fares. If        pressing Insert +           the software already have? A few
computers usable for people with            you can’t use your application with       Keypad Insert + Space.      simple changes can make a huge
poor sight. Orca works well, but            a screen reader, then what hope                                       difference to some users – all it
ultimately, not many applications                                                                                 takes some thought.
are usable for someone without any
sight, because most user interfaces            The Orca screen reader
aren’t designed with visually                  converts the text on screen                                         PROJECT WEBSITE
                                                                                                                   https://help.gnome.org/users/orca/
impaired users in mind. Things like
the Tab order, keyboard control and            to spoken words                                                     stable




                                                                  www.linuxvoice.com                                                                    61
     FOSSPICKS


Display server


Wayland
2
       016 is slated to be the year      range of desktop shells on top of
       that the X windows graphical      Wayland including Weston, KDE and
       display server gets replaced.     one called Hawaii.
Actually, 2014 was supposed to be
the year X got replaced, then 2015       Crouching server
was, so we aren’t holding our            The difference between Wayland
breath. So far, the only distribution    and X is almost entirely behind the
to fully switch to a different display   scenes, and this is especially true
server is RebeccaBlackOS.                when using a desktop that runs on
  For those of you not familiar with     both display servers, such as KDE.
the starlet after whom this distro is      In theory, the version of KDE
named, she hit a small amount of         running on Wayland should be
                                                                                 We ran KDE on Wayland without problems, but heavy users may
fame in 2011 with the song Friday.       identical to the version running on X
                                                                                 still find it unstable.
This was followed two years later        except that it should perform better.
by the unimaginatively titled            This performance will be                                          playing video on it. Ideally, you
Saturday. Fortunately,                   particularly noticeable in areas that                             should see no screen tearing and
RebeccaBlackOS (RBOS) has                are tricky for a display server, such                             lower memory and CPU load. We
almost nothing to do with Miss           as scrolling a web page with a                                    found Wayland performed well on
Black other than the default                                                                               our machine, but until it’s used
username of beccaholic.
  As the only distro that’s ditched X
                                            The difference between                                         more widely, it’s hard to know how it
                                                                                                           will perform in the wild.
for Wayland, RBOS is far more               Wayland and X is almost                                         PROJECT WEBSITE
noteworthy for its display server
than its name. You can try out a            entirely behind the scenes                                      https://wayland.freedesktop.org




Linux installer


Calamares
I
    f you’ve been using Linux for a      any distribution, but that any
    while, you probably don’t give       distribution can adapt it for their
    too much thought to the distro       own needs rather than building their
installers. Once you’ve installed        own from scratch.
your favourite distribution a few           By sharing the same installer,
times, you can probably do it            distributions can also share the
without even thinking. However, we       effort needed to create and
should probably spare a thought for      maintain the installer, which should
the first time Linux users as it can     mean a higher-quality installer for
be a stressful time when you first       everyone while at the same time,
put a new OS on your computer.           leaving distro developers with more
                                                                                 The popular KDE distribution NetRunner uses Calamares rather
   There are a lot of options, and       time to focus on what makes their       than building its own installer from scratch.
they’re not always well laid out. Part   distro great rather than messing
of this problem comes from the           around with an installer.
fact that most major distros build          Quite a few Linux distributions                                Sabayon. Even Fedora is currently
their own installers, despite the fact   are already using Calamares,                                      evaluating its usefulness for future
that they all do the same basic job.     including NetRunner, Manjaro and                                  KDE remix versions. Keep an eye
Each installer works slightly                                                                              out and you might come across
differently, and the work on each is                                                                       Calamares on a distro near you in
duplicated.                                 Most major distros build                                       the near future.
   Calamares is a project to build a        their own installers, despite                                   PROJECT WEBSITE
distro-independent installer. This
doesn’t mean that you can use it on         them doing the same job                                         https://calamares.io




62                                                            www.linuxvoice.com
                                                                                                                          FOSSPICKS


  FOSSPICKS Brain relaxers
https://launchpad.net/pybik/
 Real-time action game


 OpenClonk
 C
          lonks are members of a         of commercial games that began in
          humanoid race who seem         1994. This series ran for an
          to be in need of a little      impressive 20 years and nine
 help. You can guide your clonks         different versions. These closed
 though a 2D world on various            source games are still available as
 missions as they build, mine and        freeware (not open source) from
 fight. Alternatively, you can play      www.clonk.de. After the lead
 against other users to see who is       developer left the project, the
 the mightiest Clonk controller.         company behind the game
                                                                                Dig, mine and fight your way to primitive humanoid supremacy
    Gameplay is a bit like a more        (Redshift) decided to discontinue
                                                                                as the ultimate Clonk leader.
 involved version of the arcade          the series. However, it released the
 classic Worms. Your Clonks can          source code for the game engine                                  language. The enables you to do
 collect different bits of               under an open source licence, so                                 everything from building your
 equipment, and you have to              the spirit lives on in OpenClonk.                                own levels to creating entirely
 direct them to use it. The                 As well as being a game in its                                new games. If you want to get
 missions, though, are more              own right, OpenClonk is an                                       stuck into creating your own
 complex and require more work           interpreter for the C4Script                                     Clonk world, you can find
 to complete. Don’t worry if this all                                                                     everything you need at http://
 sounds a bit confusing, there’s a
 full set of tutorials to help you get
                                            You can do everything from                                    wiki.openclonk.org/w/C4Script_
                                                                                                          Documentation.
 started.                                   building your own levels to
    OpenClonk is a direct                                                                                  PROJECT WEBSITE

 continuation of the Clonk series           creating entirely new games                                    www.openclonk.org




 Real-time strategy game


 Megaglest
 M
            egaglest is a 3D             British, Crusaders – and of course,
            real-time strategy           what open source game would be
            game in which you            complete without the ability to play
 build and train your army, then         as Penguins?
 enter battle against one or more           The graphics look a little dated,
 enemies. As the name suggests,          but we don’t believe that game
 Megaglest is built upon Glest, an       graphics correlate in any way with
 earlier open source game that is        the enjoyability of computer games.
 no longer developed.                    It doesn’t matter if you can
    Although there have been             ray-trace in real time, if the
 improvements across the board,          gameplay isn’t fun then the game
 from the player’s perspective, the      isn’t fun and conversely, horrendous
                                                                                The range of different
 biggest improvement in                  graphics with great gameplay still                               elaborate ways to downgrade the
                                                                                factions and scenarios
 Megaglest over Glest is the             make an enjoyable game. We’re          means that there’s        graphics to regain the lost
 increased amount of gameplay.           pretty sure that gaming reached a      plenty to keep even the   feelings of youth, there’s an online
 As well as the official game            peak with 8-bit CPUs, and if           most ardent engaged in    community of players, and there’s
 which includes six different            anything, Megaglest is a little too    Megaglest for some        usually a game on somewhere
 factions to play as (Tech, Magic,       realistic. Perhaps we could route      time.                     for you to join.
 Egypt, Indians, Norsemen,               the graphical output through
 Persian or Romans), there are a         Termpix for a retro experience.                                    PROJECT WEBSITE
 wide range of user-contributed             If you’d rather spend your time                                 https://megaglest.org

 expansions including Japanese,          being sociable than working out




                                                             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
Can be beaten by the Go AI on a particularly
sluggish Commodore 64
                                               Schedule your work to                                 Put your office suite in
                                               keep RSI at bay                                       the cloud, but stay private


O
                                               Ben Everard sometimes has sore hands, so he           You don’t have to hand over your data when you
          ne of the big milestones in          takes regular breaks from work to ease the strain.    put your office suite online. Valentine Sinitsyn
          artificial intelligence fell this    Workrave makes sure that he doesn’t forget.           uses OnlyOffice to build his own cloud.
          month. A computer beat a
world champion in Go, a board game
with simple rules but very complex
tactics. While this is an impressive feat
of computing, it’s always felt a little
hollow to me to attach the tag
intelligence to this sort of computing.
Intelligence isn’t the ability to be taught
how to strategise by analysing millions
of scenarios in a contrived environment,       Terminal velocity          72        OpenStack                    76    Let there be light             80
it’s the ability to thrive in new situations   Les Pounder introduces the           Not content with one computer,     The ever-illuminating
and apply novel approaches to solve            awesome power of the Linux           Graham Morrision runs 10 on a      Mark Crutch finishes his series
old problems.                                  command line interface.              single CPU.                        on light control with Linux.
    AlphaGo (the computer that won the
match) could only be considered to be
intelligent if it could take the lessons
learned from Go and apply them in
                                               Coding
other areas: chess perhaps, or business
strategy. Reprogramming the machine
to work in another area isn’t sufficient; it
has to be able to adapt by itself and
transfer the skills of one area to another
just as humans do every day.
    If computing’s going to really move
forward, we need to stop focussing all
our efforts on artificial intelligence and
start trying to develop actual                 Ready, steady ... Go!                         84      Languages of the future                           90
intelligence.                                  Trendsetter Amit Saha discovers a new language        Juliet Kemp enters her virtual tardis and sets forth
ben@linuxvoice.com                             from Google and likes what he finds.                  to find the programming languages of tomorrow.



                                                                 www.linuxvoice.com                                                                     65
     TUTORIAL WORKRAVE




EASE FINGER STRAIN
WITH WORKRAVE
Stay healthy and pain-free by taking breaks from work.

   BEN EVERARD
                               K
                                        eyboards, mice and monitors are the link            for as many years as possible (or at least until we get
                                        between people and computers – the                  a more robust human-computer interface such as a
                                        meat-space equivalent of a USB cable. Just          USB port directly in our cranium).
WHY DO THIS?                   like a USB cable, this interface can wear out if it's used      There are many aspects to taking proper care
• Keep eye- and wrist strain   too much or not looked after properly. We may be able        of our body, and in this tutorial we're going to look
  at bay                       to get new parts for our computers when they wear            at one: timing. All communications protocols have
• Go outside, smell the        out, but getting new hands and eyes if our bodies start      optimal timings, and the human-computer interface
  flowers, feel the rain and   to wear out is much more difficult. It's important, then,    is no different. The best option isn't just to blast the
  the sun on your vitamin
  D-deprived face.             to take the best possible care of our meaty interfaces       information across as quickly as possible, but to work
• Bear the lead-heavy          so that we can keep communicating with computers             in a way that minimises the strain on our joints.
  haunches of the toad and
  work more lightly
                               STEP BY STEP: LOOK AFTER YOURSELF
                               1
                                   Install Workrave                                         2
                                                                                                Take a Microbreak
                               Workrave is an activity monitor that's designed to           Microbreaks are the smallest counter on Workrave. By
                               interrupt your computer use to remind you to take            default, every three minutes, Workrave will prompt you
                               frequent breaks – these breaks are important for the         to take a 30-second rest. First, you'll see a popup
                               health of your hands and eyes. You might find it in          prompting you to take a break, and this will then
                               your distro's package manager, but if you don't you          monitor your keyboard use. If you stop using the
                               can download a tarball from the project's website            keyboard, Workrave will start a 30-second countdown,
                               (www.workrave.org). Installation is via the standard         during which you won't be able to access anything on
                               method of unpacking the tarball then running                 your computer. The three minutes between
                               ./configure, make and finally sudo make install in the       microbreaks only counts time you're actually using
                               unpacked directory..                                         your computer. If you stop using the mouse and
                                  If you're unfortunate enough to have to run               keyboard, then the countdown will pause.
                               Windows, you'll also find an install file on the                The key aspect of these short breaks is to briefly
                               project website. There's not currently a version of          rest the parts of you interacting with the computer,
                               Workrave for Apple's OS X, though there are some             that is, your hands and eyes. While your hands will
                               similar applications such as 20 Cubed (https://              automatically rest when not using the keyboard, your
                               chrome.google.com/webstore/detail/20-cubed/                  eyes will only rest if you look away from your screen.
                               geghmabifcdlkmpnkapfefbbfaonhcef) and Awareness              Ideally, you should find something much further away
                               (http://iamfutureproof.com/tools/awareness).                 from you than your screen to give your eyes a break.




66                                                             www.linuxvoice.com
                                                                                                         WORKRAVE TUTORIAL

3
    Take a rest break                                      4
                                                               Finish for the day
Rest breaks are 10-minute breaks that come about           No matter how many breaks you take, there's a limit to
every 45 minutes. During these, you should take the        how much computer use you do in a day before you'll
opportunity to stand up and get away from your             start run the risk of serious problems. Workrave
computer. By doing this, you'll stimulate the muscles      recommends four hours per day of actual computer
in your back and arms in ways that will relieve the        use (typing or mouse control). Again, this only counts
tensions that can build up while sitting at a desk. We     active computer use rather than all the time that your
like to use some of our rest breaks to do finger           computer is switched on. You can postpone this three
exercises that help to strengthen our hands and            times if you're just coming to the end of a critical piece
minimise the damage caused by typing.                      of work.
   You don't have to take your breaks exactly when            Finishing for the day means finishing computer
Workrave suggests: sometimes, you might need just          use. Depending on your job, there may be several
a few more minutes to finish working on something          things that you can do without using a computer.
while you still have the train of thought in your head.    For example, we like to proofread printouts, plan
For this, there's a Postpone button that enables you       projects on pen and paper and take care of anything
to delay the break in the same way a snooze button         that needs to happen in the real world. By limiting the
delays an alarm clock. You can't just delay indefinitely   amount of time you spend at the computer each day,
though, because you're only allowed three postpones        you can dramatically reduce the amount of strain on
per break before it becomes mandatory.                     your body.




5
    Configure Workrave                                     6
                                                               Other options
In truth, we're only just starting to understand the       Workrave isn't a complete solution to staying healthy
effect that long-term computer work has on the body.       while using a computer, it's just one tool to help in one
While most experts agree that taking rest breaks is        area. To ensure you have many years of productive
essential to ensuring your long-term health as a heavy     computer use a head, you need to ensure that you
computer user, there's no clear consensus on the best      properly take every possible precaution against
way to schedule your breaks. Workrave doesn't              computer-related injuries. The most basic is proper
mandate the periods of each break, and allows you to       desk setup where you ensure that you have your seat,
configure most how long to rest for and how                desk and monitor all at the appropriate height. Further
frequently to rest. You can enter the preferences          precautions include using ergonomic keyboards and
window by right-clicking on the Workrave window and        mice, and considering alternative desk setups such as
selecting preferences. If you're already suffering from    standing desks. There isn't a standard setup that's
RSI or some other strain, you may need to break            right for everyone, so you'll have to do some research
longer or more frequently. Alternatively, you might feel   to find out what works for you.
it more appropriate for your work to break less often.        Above all, the most important part of staying safe
   If you use multiple computers in the course of your     when using a computer is not ignoring any warning
work, you can also configure Workrave in network           signs. If you get any tingling, numbness or pain when
mode so that it takes into consideration your work on      working, you should immediately look to mitigate the
all your machines.                                         problem and ideally seek medical advice.




                                                               www.linuxvoice.com                                            67
          TUTORIAL ONLYOFFICE




    ONLYOFFICE: HOST AN
    OFFICE IN THE CLOUD
    Get all the power of online office suites without having to trust a third party.

VALENTINE SINITSYN
                                   M
                                               arketing guys say we live in a "cloud first"
                                               era, and they are probably right. Many of us
                                               rely on web-based, remotely hosted apps
    WHY DO THIS?                   for daily tasks, like reading email, writing texts or
    • Enhance privacy – your       working with spreadsheets. Having all your data in a
      data is yours.               single place accessible from everywhere is good for
    • Work from almost any         productivity, but bad for privacy. And if you are into
      device, anywhere.            Free Software, you probably care about privacy.
    • Explore free office suites      Is there a way to bring together the best of both
      beyond LibreOffice.
                                   worlds? The answer is yes – to a certain extent –           The OnlyOffice Document Editor displaying SAI
                                   and is often called self-hosting. You still use web         specification from Microsoft et al. Despite being free
                                   applications, but run them on your own servers. Your        (Apache v2), it comes in OO XML rather than PDF format.
                                   files are under your control, and you only need a web
                                   browser to access them wherever you are.                    SaaS first. The project's website is at https://www.
                                      OnlyOffice is a hosted alternative to online office      onlyoffice.org.
                                   suits like Google Docs, Microsoft Office Online or Zoho        OnlyOffice is actually an umbrella term for several
                                   Documents. It's also available in the cloud, if you wish,   interconnected products. At its core is the Document
                                   and best of all, it's free (as in speech). We reviewed it   Server, which is a family of online document editors.
                                   in LV017, and in this tutorial, we'll show you what is it   Document Server provides a word processor,
                                   capable of, and how to deploy it on your network with       spreadsheets and presentations, and that's it. To
                                   minimal efforts.                                            manage your documents, you'll need Community
                                                                                               Server, which also brings calendaring, CRM and
                                   Getting your feet wet                                       project management features. Put simply, Document
                                   OnlyOffice started in 2009 as Teamlab, a proprietary        Server is your traditional desktop office suite brought
                                   Windows-based product. Five years later it was              to a browser; Community Server is a collaboration/
                                   renamed, released under AGPLv3, and brought to              groupware tool built on top of it. Communications
                                   Linux, thanks to Mono. Today, OnlyOffice comes in           are supported via the Mail Server add-on, and
                                   three main flavours: Free, Enterprise and SaaS. We are      OnlyOffice Talk, an XMMP/Jabber service built into the
    The OnlyOffice Spreadsheet
    Editor showing a sample        going to cover the first; Enterprise is a commercially      Community Server itself.
    document with London           hosted solution, and SaaS is a cloud version (both free        There are several ways to deploy OnlyOffice;
    2012 Summer Olympics           and paid-for plans are available). They aren't identical,   we'd use Docker. Note that OnlyOffice has known
    stats.                         as new features often appear in the Enterprise or           incompatibilities with older Linux kernels. If you run
                                                                                               an LTS distribution, it's better to upgrade to the latest
                                                                                               kernel first. A system with dual-core 2GHz CPU
                                                                                               and 4GB RAM is recommended to run OnlyOffice in
                                                                                               production. For evaluation and testing, half of these
                                                                                               specs should probably suffice.
                                                                                                  Ensure you have Docker 1.4.1 or later installed. If
                                                                                               not, either use your package manager or get it directly
                                                                                               from www.docker.com. Document Server official
                                                                                               images are on Docker Hub, so you can get it running
                                                                                               with a single command:
                                                                                               $ sudo docker run -i -t -d -p 80:80 onlyoffice/
                                                                                               documentserver
                                                                                                Depending on how your host is configured, you
                                                                                               may not need the initial sudo. Document Server will



    68                                                             www.linuxvoice.com
                                                                                                                         ONLYOFFICE TUTORIAL


listen on port 80; change the first number in -p if you
want anything else. Now, open your web browser and
navigate to http://your-host-name-or-IP-address.
You could use localhost or 127.0.0.1 for now, but
Community Server gets confused with them. So, better
use a real (resolvable) hostname or the host's IP
address, like 192.168.1.x.

Meet the editors
By itself, the Document Server is really bare bones. You
can upload a file from a local PC, edit it and download
back – that's it. You can't create new documents,
                                                                                                                                        Before you can use the
delete them, or manage files in any way. There is                   at least for now. Comments and changes tracking
                                                                                                                                        Community Portal, some
also no access control. To make long story short,                   are also not in the Free edition yet, which is a pity.              things need to be tweaked.
Document Server is more of a technology demo than                   The equation editor may feel inconvenient, if you're                Make sure to enter a real
an online office suite. You'd want Community Server for             used to LibreOffice Math or Latex. Finally, automatic               email address.
any real deployment.                                                tables of contents aren't supported. This means
    The native document format for OnlyOffice editors               that OnlyOfficeis hardly suitable for editing large
is OO XML. This matches OnlyOffice to Microsoft's                   documents, like books or reports.
offerings but makes Richard Stallman sad. You can                      Two other OnlyOffice components hide no surprises.
upload documents in almost any format, including                    Even the ribbon stays almost the same. Formulas
OpenDocument, or legacy DOC, XLS and PPT. Behind                    in spreadsheets work, and various slide layouts and
the scenes, OnlyOffice calls LibreOffice to convert                 themes are available for your presentations. OnlyOffice
anything you throw at it to OO XML. It is also possible             Free doesn't seem to support macros, which is
to download your documents as OpenDocument files.                   understandable, yet may disappoint some business
OnlyOffice will even try to open PDFs for you, although
it never succeeded in our quick tests. Yet it handled
a complex DOCX file that LibreOffice failed to render
                                                                       At the core of OnlyOffice is the
properly – your mileage may vary.                                      Document Server, which is a family
    OnlyOffice has most of the features you'd expect
from an online office suite. You have all the usual text               of online document editors
formatting options on the first three ribbon palettes.
It is possible to insert images (either from a file or              users. It also turns out that the spreadsheet editor
URL), tables and charts and create autoshapes and                   doesn't play well with Firefox's "Find as you type"
hyperlinks. A useful option is "Insert text", which                 feature. When it is on, the search box appears at every
creates a text frame, as in desktop publishing                      keystroke, seizing the focus. You'd want to disable this
software. There is also a quite sophisticated                       feature during your OnlyOffice sessions.
equations editor, and some styling tools. For instance,
you can change the document's colour scheme                         Create a portal
(which affects charts, autoshapes and tables), or                   Community Server builds on the Document Server to
create a heading with one mouse click.                              add portal features like document management,
    Sometimes, OnlyOffice feels rather counter-intuitive.           access control, and third-party file hosting support.
To create a new style, you format some text the                     It also comes with extra tools, including a calendar, a
way you want, then save it as a style, not the other                project management solution, a CRM and OnlyOffice
way around. And it doesn't work in OnlyOffice Free,                 Talk, albeit we won't cover them in this tutorial.


  Your office, your way
  It is possible to embed OnlyOffice editors in your own            enough to view a document in any supported format. To save
  software. So, if you like the editors but dislike the Community   it, you should also provide some back-end, namely a callback
  Server, there's nothing to stop you from making your own          handler that runs when the document is saved. The idea is
  one that works exactly the way you want. That's what we like      that you implement a document storage service component,
  about Free Software.                                              which makes documents available to Document Server
      To embed the editors, you must have the Document Server       (subject to permissions check), and also downloads them
  up and running. The client builds on JavaScript (naturally) and   from the Document Server when anything changes.
  the HTML 5 Canvas element. The later is somewhat close to             OnlyOffice provides a rich API to customise the editors' look
  how desktop apps work, and sets OnlyOffice editors apart from     and feel, and also exposes an API for file format conversions
  many cloud office suits.                                          (this really calls into LibreOffice, you know). You will find a
      To embed OnlyOffice, you include a JavaScript library and     detailed reference documentation along with usage examples
  wrap a placeholder <div> element. Surprisingly, this is already   at http://api.onlyoffice.com.




                                                                      www.linuxvoice.com                                                                       69
     TUTORIAL ONLYOFFICE


The Documents module is
where you'll spend most of
your time. You can make
it a default start page for
that reason




                                 Official manuals suggest running Community Server                   If you agree to stick to official images, the process
                              in a separate Docker container linked to Document                   could be much simpler. First, you may use Docker
                              Server and Mail Server containers. We'll do it this way,            Compose to run all three containers (Document Server,
                              albeit without the Mail Server. In a nutshell, Mail Server          Community Server and Mail Server) with one command.
                              is just iRedMail plus Postfix, Dovecot, SpamAssasin                 Second, you don't have to type any commands at all:
                              and ClamAV wrapped as OnlyOffice add-on. It's really                you can use the OnlyOffice One Click Install (https://
                              optional, as Community Server should integrate well                 one-click-install.onlyoffice.com) automated service.
                              with your existing email infrastructure.                            We haven't tried this path ourselves; if you do, we
                                 Stop and remove the existing Document Server first,              strongly suggest you change the password or SSH
                              then recreate it with the explicit name and no ports                key you posted to One Click as soon as the installation
                              exposed:                                                            completes.
                              $ sudo docker run -i -t -d --name onlyoffice-document-                 In a similar vein, we don't recommend that you
                              server onlyoffice/documentserver                                    access OnlyOffice via HTTP in production. Setting up
                                 The official Community Server image at Docker Hub                HTTPS is simple; see the Community Server's README
                              is outdated (8.5 vs 8.7), and it didn't work well for us.           for details. Note that you should mount the Data/certs
                              So, we recreated it locally from the latest packages:               volume, not plain Data as the README suggests.
                              $ git clone https://github.com/ONLYOFFICE/Docker-                   Otherwise, Community Server won't be able to find its
                              CommunityServer                                                     static files (scripts and stylesheets).
                              $ cd Docker-CommunityServer
                              $ docker build -t communityserver:8.7                               Make yourself at home
                                This takes some time. When the process finishes,                  Now, open https://your-host-name-or-IP (remember
                              run the Community Server container with:                            not to use localhost!). Community Server takes some
                              $ sudo docker run -i -t -d -p 80:80 -p 5222:5222 -p 443:443         time to initialise, so if this page doesn't open, wait a
                              --name onlyoffice-community-server --link onlyoffice-               second and try again.
                              document-server:document_server -v /opt/onlyoffice/                    Community Server needs some initial setup. On your
                              Data/certs:/var/www/onlyoffice/Data/certs                           first visit, it will ask you for the administrator's email
                              communityserver:8.7                                                 and password, the language and the timezone. When
                                Here, we expose ports 80/443 for HTTP/HTTPS                       you'll get an email from OnlyOffice, follow the link to
                              access, and port 5222 for OnlyOffice Talk (XMPP).                   activate the Administrator's account. For testing, you
                              Mount volumes (-v) are needed to set up HTTPS (see                  may skip this step, but you won't be able to get portal
                              below).                                                             notifications or change your credentials then.


                                OnlyOffice isn't the only...
                                At the time of writing, OnlyOffice was arguably the most          and the server. Recently, an OwnCloud plugin for LibreOffice
                                mature free online office suite. But it's certainly not alone.    Online was announced.
                                    The first attempts to run LibreOffice in a browser date           The Document Foundation also seems to have no plans
                                back to 2011. The original prototype used a GTK 3 + HTML 5        to build a cloud service on LibreOffice Online, so it is likely
                                (Broadway) back-end. This approach didn't scale well, and was     a "hosted-first", not "cloud-first" solution. Yet you can try
                                tying clients to the server too much.                             it yourself, as Collabora provides CODE (Collabora Online
                                    So, in 2015 Collabora teamed up with IceWarp to build the     Development Edition) – an OpenSUSE-based VM image
                                new LibreOffice Online (LOOL). For starters, Writer, Calc and     containing the latest developments in the field. It also includes
                                Impress were included, but this list may expand in future. The    OwnCloud, so you can test both pieces of the puzzle together.
                                project reuses as much from the existing LibreOffice codebase     Download links and detailed instructions are on
                                as possible, and renders your documents for the web the same      https://www.collaboraoffice.com/code.
                                way it does for the desktop. The LibreOffice Online back-end          CODE is bleeding-edge, and not everything may work
                                calls into a thing called LibreOffice Kit, which draws document   properly. We got occasional socket errors, and were not able
                                tiles, much like map services do. These tiles are sent to the     to run the VM on IPv6 network. Yet we hope CODE will help
                                front-end communicating via a WebSocket connection. This          you to build a picture of the LOOL's state today. Give it a try,
                                means better scalability and less coupling between the client     file bug reports, send patches and stay tuned for the updates!




70                                                                www.linuxvoice.com
                                                                                                             ONLYOFFICE TUTORIAL

   When you log in to the portal, it will show you the
module choice page: go to Documents. To make
Community Server start from this page, click on the
gear icon, choose Common > Modules & Tools, and
set Documents as the default start page.
   To create a new document or folder, use the
menu just below the OnlyOffice logo. A button next
to it uploads documents from a local hard drive.
Remember that OnlyOffice converts documents you
upload to OO XML, although you may choose to keep
the original as well. My Documents is where you find
your own files, and Common Documents stores files for
all portal users. You can also share your private files
                                                                                                                           LibreOffice Online brings
with portal and non-portal users, and control access        choice here is OwnCloud (www.owncloud.org): it's
                                                                                                                           the office suite we all
at user or group level. The only file management            popular and free.                                              know and love to the web
feature we miss is a Recent Files list.                       We assume you already have OwnCloud running                  browser (OwnCloud app
   To open a document, click on its name in the list. An    on your network. If not, there are numerous manuals            included).
editor window will appear, and you can start making         available, not to mention an official Docker image.
changes. Documents are saved automatically. When            OwnCloud uses WebDAV for integrations, so you don't
you are done with the document, just close the tab or       need any API key. Just click on the icon and fill in
click the "Go to Documents" link in the top-right corner.   your OwnCloud login and password. The connection
   Note that you're working as Administrator now.           URL is found under the Settings link in the OwnCloud
To add some unprivileged users, choose People
from the drop-down near the logo. From the People
module, you can add users or groups, and import                If you already use an online office suite,
them from your cloud account or CSV file. You can
also simply send email invitations to those you want
                                                               you probably want OnlyOffice to access
to collaborate with.                                           your existing documents in the cloud
Add some storage                                            web interface. The name you use to connect to
If you already use some online office suite, you'd          OwnCloud should be in OwnCloud's trusted domain
probably want OnlyOffice to access your existing            list. Try to open it in your browser, and OwnCloud will
documents in the cloud. Community Server supports           guide you through the process. Remember not to use
integration with third-party file-hosting services          localhost, unless Community Server and OwnCloud run
like Google Drive, Dropbox, OneDrive, and Box.com           uncontainerised on the same physical machine.
(among others). You may have already spotted their              Third-party services are essential for collaboration.
icons at the bottom-left of the portal.                     This being said, Community Server is rather useless
   By default, CommunityServer can set up WebDAV-           at conflict resolution. It may happily overwrite the
based integrations only, as everything else needs API       file you changed outside the portal, or fail to upload
keys. So, navigate to Settings > Integration > Third-       your document to Dropbox for no visible reason. The
party Authorisation. You'll see numerous fields for         latest OnlyOffice document editors (not available in
authorisation keys related to different services. To        OnlyOffice Free yet) bring real-time collaboration, so
get the required credentials, you'll need to register a     these issues should go away some day. Until them,
developer's account with the service of your choice.        it'd be better to keep them in mind.
This is usually free yet is a somewhat tricky process.
Luckily, there are step-by-step guides available            A bit of summary
at http://helpcenter.onlyoffice.com (search for             We hope this tutorial helped you to build an
"Authorisation keys").                                      understanding of what OnlyOffice is. The technology
   When you fill authorisation keys for some service,       looks promising, albeit with some glitches that may
a respective icon will appear at the bottom-left of the     turn into blockers in specific use-cases. The free
portal. Click on it, and follow the on-screen prompts.      self-hosting edition is a real bonus, however it may
Remote services looks like folders at the Community         feel more like a teaser for OnlyOffice Enterprise than
Portal, and you have an option to make them                 a standalone product. We won't replace our good
common for all (or some) portal users. To change this       old LibreOffice with it just now, but we'll keep an eye
setting later, you'd have to delete the folder (your data   on OnlyOffice's progress. If you already use an online
is not affected) and re-create it from scratch, so think    office suite, OnlyOffice Free is a viable alternative.
carefully.
   Having a hosted office suite that stores documents        Dr Valentine Sinitsyn got addicted to office suites when he
in the cloud doesn't help your privacy much. You'd           was the editor of Linux Format Russia. These days, he runs
                                                             Vim or Python much more often.
also want a hosted document storage. A natural



                                                              www.linuxvoice.com                                                                  71
     TUTORIAL LINUX FOR LEARNERS




LINUX FOR LEARNERS:
TERMINAL BASICS
Les Pounder takes us on a journey into the Linux command line.

     LES POUNDER
                              W
                                           hen we think of the Raspberry Pi we
                                           initially think of robots, coding and making
                                           cool projects. But what is underneath all of
WHY DO THIS?                  these projects? Why, it's the humble Raspbian
• Learn Linux.                operating system. Raspbian is based upon Debian, a
• Update your Raspberry Pi.   solid Linux operating system that has powered
• Navigate the filesystem.    everything from PDAs to huge server farms.
• Create files and               The easiest way to install Raspbian on a Raspberry
directories.                  Pi is to use NOOBS (New Out Of the Box Software).
• Copy and move files.        For this you will need to download NOOBS on to a PC.
• Rename and delete files.    NOOBS comes as a Zip archive, which will need to be
• Add users to the system.    extracted to a FAT-formatted SD card with 8GB
• Add users to super user     capacity. With NOOBS on your SD card, insert it into
group.                        your Raspberry Pi and boot up. On first boot you'll be
                              asked to choose an operating system. Tick the box
                              next to Raspbian and then click Install. The installation   The new Raspberry Pi Configuration tool replaces the old
                              process can take around 10 minutes, so now is great         raspi-config menu and provides an easy to use tool for
TOOLS REQUIRED
                              time to get a cup of tea. Once completed, the Pi will       configuring every aspect of your Pi.
• A Raspberry Pi running
  the latest Raspbian         reboot and load the Raspbian operating system.
  release.                                                                                be very careful! To temporarily give a normal user
• An internet connection.     Expand the SD card                                          super powers we use a command called sudo before
                              With the Raspberry Pi booted to the desktop we'll now       the command that we wish to run with that power, so
                              perform a little maintenance. It's important that we        for example let's open LXTerminal and run the ifconfig
                              give Raspbian as much disk space as possible. From          command with super powers.
                              the Raspbian desktop you can see the menu in the            $ sudo ifconfig
                              top-left of the screen. Left-click here and navigate to        Using ifconfig as an example is quite safe, as the
                              the Preferences menu. In the new sub menu you can           basic command just lists the Wi-Fi and Ethernet
                              see the Raspberry Pi Configuration application. Click       connections for your Pi. We're not interested in the
                              on it. In the new window, you can see the Filesystem        output; this command is just to illustrate how to use
                              entry; left-click on Expand Filesystem To action. Once      sudo with a command. We'll use sudo for real later in
                              this is done, you will need to reboot for the actions to    this tutorial.
                              take effect.
                                 On a typical Raspbian install there is only one user,    Update your Pi
                              called "pi". This user has a home directory at /home/       It's essential to keep your Raspberry Pi up to date. By
                              pi. Your work, images, videos etc are all stored in this    updating you ensure that your Pi gets the latest
                              home directory. In this home you can create, edit,          software and important security updates. Only a user
                              delete and move anything without needing any                with super powers, sudo, can update the Raspberry Pi,
                              administrator powers. This is because it is full of your    as this is an administrative task that can affect the
                              files. Each user has their own home and typically can       entire system. To update the list of software that your
                              only work on the files contained in that home. But          Raspberry Pi can install we need to check our list of
                              there is one user who can do what they want, and that       software against a remote server. Open LXTerminal
                              is the "superuser" sometimes known as "root".               and type.
                                 The superuser can do anything: configure the             $ sudo apt-get update
                              system, delete any files and create users. But just like       You will see lots of text whizzing along the screen;
                              a Super Hero, with great power comes great                  this is your Pi talking to a remote server and updating
                              responsibility, and when using this power you should        the software list on your Pi. Now this action does not



72                                                            www.linuxvoice.com
                                                                                                 LINUX FOR LEARNERS TUTORIAL


update the software, for that we need to issue another
command, so in the same terminal, and after the                                                                                  The apt-get update
previous command has completed, type the following.                                                                              command generates a lot
                                                                                                                                 of text – here we can see
sudo apt-get upgrade
                                                                                                                                 the command contacting
  After a few moments the screen will update and tell
                                                                                                                                 all of the servers that
you what software requires upgrading. To confirm you                                                                             contain the Raspbian
are happy with this, press the Y key and then Enter.                                                                             software. This will update
How long the action will take depends on your internet                                                                           the list of installable
connection and how many updates are required.                                                                                    software.
  A top tip for this task is that you can chain the two
previous commands together. Once the first
command, apt-get update, is completed it is tested to
ensure that it has completed correctly. If that is the
case then the second command, apt-get upgrade, is                  tilde character "~", this is shorthand for that user's
run. We then add -y to the upgrade command to                      home directory, and it tells us where we are (by default
automatically upgrade the new software. The                        we're located in our home directory). Finally we see a
command to do this looks like this.                                Dollar sign, which tells us that our user has no super
$ sudo apt-get update && sudo apt-get upgrade -y                   powers.
  It's important to keep your Pi up to date and this
action should be done at least once per month.                     Moving around
                                                                   Lets try out a command that will tell us where we are.
Basic Linux skills                                                 It's called Print Working Directory (pwd), and to use it
There are many commands in Linux, some of which                    we type.
you'll use every day. So let's open up LXTerminal and              $ pwd
try them out.                                                      You will now see the absolute file path to your home
   First, when we open LXTerminal we will see a                    directory – think of it as the full address for where you
interface that looks something like this.                          are.
pi@raspberrypi ~ $                                                    To move around the system we need to know what
  So what does that all mean? Well first we can see                is around us, and to do this we need to list the
that our user is pi, the default user for a Raspberry Pi.          contents of a directory. In a terminal type
Next we can see raspberrypi, which is the name of the              $ ls
computer, often called the hostname. Next we see a                    You'll see lots of text appear on the screen, but what
                                                                   is important right now is that we can identify files
                                                                   from directories. You can see Desktop in blue; this is a
  Sneaky sysadmin skills                                           directory, so any text in that same colour also denotes
  Repeat the last command                                          directories. Let's go into the Desktop directory in a
  You can press the Up arrow to reverse search through your        terminal type.
  commands (pressing Down goes forwards). Once you find            $ cd Desktop
  the command, press Enter to action it.                              After pressing Enter we will move into the Desktop
  See all of the commands that you have used
  The history command records the commands entered in
                                                                   directory; to verify this, type in pwd and you should
  the terminal. You can type history into the terminal but         see /home/pi/Desktop. So we're now in the correct
  it will whiz along really quickly. So, using a pipe (a tool to   directory, take a look around using ls. To go up a level,
  redirect the output of one command to become the input of        by which we mean to navigate closer to the root of the
  another), we can pause the output and press the arrow keys       file system, type
  to go through the list.
                                                                   $ cd ..
  $ history | less
  Use a command from history                                          Now type in pwd –you should be back in your home
  When we used the history command you may have noticed            directory. Let's try and move into a directory not inside
  that the entries were numbered. These numbers can be             our home. In a terminal type
  used to run a command again, without typing it. All we need      $ cd /dev
  to do in a terminal is type an exclamation mark followed by
  the number of the command, for example.
                                                                      Now type in pwd and you will see that we are no
  $ !22                                                            longer inside our home, we are in the /dev directory.
  I forgot to run that command as sudo                             Take a look around using ls and you will see lots of
  We've all been there, we type in that command to change          files that represent devices, physical and virtual, that
  some aspect of the system, such as adding a new user to          are attached to our Pi. This directory is full of stuff and
  the system, but we forgot to add sudo to the start of the
  command. We pressed Enter and nothing happened. Fear
                                                                   right now we don't need to know too much about it so
  not! To repeat the last command but with super powers all        let's return to the safety of our home by typing:
  you need to do is type                                           $ cd
  sudo !!                                                          Now that we're back in our home directory, let's create
                                                                   a simple text file in the terminal type



                                                                     www.linuxvoice.com                                                                  73
     TUTORIAL LINUX FOR LEARNERS

                                                                                          identical copy of a file in the target directory, which in
                                                                                          this case was stuff/. Take a look inside the stuff
                                                                                          directory to verify that the copy has worked. Let's
                                                                                          return to our home directory by typing cd. We shall
                                                                                          create another file but this one shall be blank. To
                                                                                          create a blank file we use the command touch
                                                                                          followed by the name of the file, so in the terminal
                                                                                          type.
                                                                                          $ touch blank.txt
                                                                                             So now we have a file called blank.txt in our home
                                                                                          directory, but we don't want it there, so let's move it
                                                                                          into our stuff directory. Just like the copy command,
                                                                                          the move command is shortened, this time to mv. In
                                                                                          the terminal, type the following.
                                                                                          $ mv blank.txt stuff/
                                                                                            Now change directory to stuff using cd, and then
                                                                                          look inside using ls. Can you see the file? We can also
                                                                                          use mv to rename a file and it works like this. In a
                                                                                          terminal type:
We can use the pwd and ls
                              $ nano hello.txt                                            $ mv blank.txt renamed.txt
commands to learn where
we are in the file system        You will now see a very basic text editor called           From the output of the ls command you should see
and what is around us.        Nano. We can use Nano to create and edit text files in      that there are two files, one of which is called
These are basic building      any programming language, and we can edit system            renamed.txt.
blocks to our Linux skills.   files on our Raspberry Pi. For this example we shall
                              write a simple                                              Delete files and directories
                              Hello World!                                                So now we have a directory called stuff which we are
                                So now let's save our work… but where is the save         currently in, and it has two files inside of it. Let's do a
                              button? At the bottom of the screen you can see six         little housekeeping and tidy up the directory. The
                              columns of text, these comprise our menu. First we          command to delete files is called rm, and it should be
                              need to "WriteOut" our work, so press Ctrl+O to open        used with great care. There is no easy undelete or
                              the save dialog. You will be asked what filename you        recycle bin – once it is deleted, consider it gone
                              want to save the file as; we specified hello.txt. With      forever. We'll remove one of the files, renamed.txt, like
                              our work saved we now need to exit Nano, so press           so:
                              Ctrl+X to exit and return to the terminal. If you type ls   $ rm renamed.txt
                              now you'll see the file that we have just created. Would    Now use ls to look in the directory. You should see
                              you like to take a sneak peek inside the file without       only one file now.
                              using Nano? In the terminal type                               Let's delete an entire directory. Return to your home
                                                                                          directory and type the following into the terminal.

     There is no easy undelete or recycle bin.                                            $ rmdir stuff
                                                                                            What happened? Did you get an error?
     Once it is deleted, consider it gone,                                                rmdir: failed to remove 'stuff/': Directory not empty
                                                                                            So what does this mean? Well we can only use the
     forever.                                                                             rmdir command on empty directories, so how can we
                                                                                          delete directories and their contents? Well, the rm
                              $ less hello.txt
                                You will now see the contents of the file; to exit,
                              press Q.
                                We've created a file, now let's create a directory
                              called stuff. In the terminal type.
                              $ mkdir stuff
                                Type in ls to see the new directory, now try to
                              change the directory to the new stuff directory using
                              cd. Once you've finished return to the home directory.

                              Copy and move files
                              Now we have a directory called stuff let's copy our
                              hello.txt file into this new directory. In the terminal
                              type                                                        The /dev directory is full of devices (virtual and physical)
                              $ cp hello.txt stuff/                                       that we can use. Only skilled users with super powers
                              The copy command is shortened to cp and creates an          should really do any work in here.



74                                                             www.linuxvoice.com
                                                                                                 LINUX FOR LEARNERS TUTORIAL

                                                                                                                                  The adduser command is
  Controlling your Raspberry Pi over a                                                                                            rather helpful and asks
                                                                                                                                  us lots of questions in a
  Sometimes we cannot be sitting in front of our Raspberry
                                                                                                                                  steady manner.
  Pi, either we are working away or we need to remote
  control our Pi. Linux comes with SSH, a secure shell, that
  enables remote control in a secure manner. The Raspberry
  Pi comes with an SSH server ready to go – all we need to
  do is connect our Pi to the network and power it on. From
  our PC we can then use an SSH client to log in. For Linux
  users we have this built in to the terminal, as do Mac users.
  But for Windows you will need to download an application
  called Putty: http://portableapps.com/apps/internet/
  putty\_portable.
     For each operating system we need to know the
  username (normally pi) and our password (the default is
  "raspberry").                                                   provide the details of that user, name, phone number
     For Linux and Mac users, open a terminal and type            etc. This is not mandatory, so feel free to press Enter
  ssh pi@raspberrypi.local                                        to bypass. The last question asks if the information is
    For Windows users, install and open Putty. In the new
                                                                  correct, if so press Y then Enter.
  Window you will see "Host Name". Type in:
  raspberrypi.local
                                                                     Our new user, hacker, needs to have super powers,
     Windows users should click on Open, and you'll be asked      so without any radioactive spillages or elaborate back
  for your username, which is "pi".                               story we shall give them the power they need. It's
     For all operating systems you will be asked for your         rather easy to add a user to a group; we'll use the
  password. Press Enter and you are now in control of your
                                                                  same command as before but add the group name at
  Raspberry Pi, so any command issued in the terminal will
  be processed by the Pi and the output sent to your screen.      the end of the command. In a terminal type the
                                                                  following.
                                                                  $ sudo adduser hacker sudo
                                                                    So now we can test this user by switching our user
command can be used with directories, so to delete                to them. In a terminal type
stuff type the following.                                         $ su hacker
$ rm -rf stuff/                                                      You will need to use the password that we created
  The directory stuff and its contents will now                   earlier. Once this is entered you will see the terminal
disappear. You can use ls to look for it but you will             change to reflect that you are now logged in as the
never find it.                                                    user hacker. So can hacker use sudo? Let's try by
                                                                  repeating the ifconfig command that we used earlier.
Create users                                                      In a terminal type:
On a typical Raspberry Pi we have one user, pi, but               $ sudo ifconfig
what if we shared our Raspberry Pi with another user?                You should be able to see the network connections
Do we want them to access our work? Well the                      on your Pi plus lots of other text, if you see a rather
answer is clearly no, so let's create another user using          stern note that you have been reported to root for
the command adduser. In a terminal type                           trying to use sudo, then repeat the process to add
$ sudo adduser hacker                                             hacker to the sudo group.
  Now we used sudo, as creating a new user is a
system-wide activity. This command creates a new                  What's my IP address?
user called hacker and then proceeds to ask you to                Sometimes we need to quickly know the IP address of
create a password for this user. It next asks you to              a computer without faffing around with a GUI. We can
                                                                  use two commands: if you just want the IP address,
                                                                  type the following into a terminal.
                                                                  $ hostname -I
                                                                    But if you really need to know everything about a
                                                                  connection, for example the IP address for your Wi-Fi
                                                                  dongle, Ethernet connection and their MAC addresses
                                                                  then you can use.
                                                                  $ ifconfig
                                                                    Congratulations: you have taken your first and
                                                                  rather important steps with the Linux command line.
                                                                  Keep these skills sharp and they will help your future
                                                                  hacks.

Nano looks really basic but it hides a really powerful             Les Pounder divides his time between tinkering with
                                                                   hardware and travelling the United Kingdom training teachers
interface for working with text and files in the terminal.
                                                                   in the new IT curriculum.
There are other editors such as Vi and Emacs.



                                                                    www.linuxvoice.com                                                                   75
        TUTORIAL OPENSTACK AND JUJU




   GET STARTED WITH
   OPENSTACK AND JUJU
   You don’t need a Google-sized data centre to play with the revolution in the cloud.

GRAHAM MORRISON
                                   D
                                            espite the continued hype, ‘cloud computing’           applications themselves don’t exist on a single
                                            isn’t necessarily all that new. It’s very similar at   machine either, but rather on an abstraction of those
                                            a hardware level to what has always been               resources, effectively an OS for the cloud.
   WHY DO THIS?                    found in data centres: a collection of storage,                   OpenStack is perhaps the largest of these ‘operating
   • Create your own cloud         networking and computing resources. The difference              systems’. It’s a stack of open source software
   • Install Mediawiki (an         is in the way those resources are managed and used.             designed to control pools of resources, and it’s being
     more) with Canonical’s           Cloud infrastructure is very elastic – you don’t need        used everywhere, from PayPal and eBay, to CERN and
     JuJu                          to hog a single processor, Ethernet connection or hard          NASA. The difficulty has always been finding a way to
                                   drive. Instead, applications in a cloud can typically           play and install OpenStack yourself, when you don’t
                                   scale from tiny to huge, and they can scale                     have gargantuan computing resources at your
                                   dynamically according to demand, whether that’s                 disposal. Fortunately, if you’ve got a powerful enough
                                   more storage, RAM or computing power. The                       machine and Ubuntu 14.04, you now can.
   TOOLS REQUIRED
   • Any PC from the last 5
     years
   • More than 12GB RAM
                                   STEP BY STEP: INSTALLING AND RUNNING OPENSTACK
   • 2–3 hours for the installer
                                   1
                                       Find the hardware                                           2
                                                                                                       Install Ubuntu
                                   The biggest problem when it comes to playing with               The method we’re going to use to install OpenStack
                                   OpenStack is having a stack of computers handy.                 leans heavily on the work of Ubuntu and Canonical.
                                   Fortunately, to test out the technology, all you need is        We’re going to use their pre-built packages and
                                   a reasonably powerful single machine that’s capable             installers, as well as Canonical service orchestration
                                   of installing Ubuntu. You’ll also need a multi-core CPU         tool, JuJu. JuJu can be thought of as being a little like
                                   and lots of RAM. For reference, the machine we used             a package manager for cloud applications, enabling
                                   has 16GB of RAM and an Intel core i5-2500K CPU                  you to install (deploy, in cloud terminology) and tie
                                   from 2011. More RAM will help because we’re                     together services with just a few commands, very
                                   effectively going to create an OpenStack installation           much like apt. Of course, there’s a lot more going on in
                                   running across more than 10 Linux Containers (virtual           the background, but the end result is that JuJu
                                   machines) on a single PC. Each one of those                     enables you to easily add services to your own cloud
                                   containers will be asking for several GB of RAM, most           after you get it running. JuJu is even used by the
                                   of which they won’t need but your system will still             installer to create the OpenStack configuration. All of
                                   grind to a halt while OpenStack works out the RAM               which is a long way of saying you’ll need to install
                                   allocation. An SSD could help here, but our system              Ubuntu, and it works best if you can give it a fresh new
                                   eventually made it with ordinary spinning storage and           installation. We had best compatibility results with
                                   several cups of tea.                                            14.04 LTS, although 16.04 beta worked too.




   76                                                                www.linuxvoice.com
                                                                                         OPENSTACK AND JUJU TUTORIAL


3
    Add the packages                                        4
                                                                Start the installation
With Ubuntu installed, we’re going to use the ‘Ubuntu       Installing the dependencies is only the first step. The
Openstack Installer’ to grab all the latest packages        time-consuming part comes from running the installer
and dependencies. The current focus for these               and waiting for it to build a workable environment on
packages is Ubuntu 14.04, because of its long term          your system. To begin the process, type the following:
support status. But as 16.04 is also a long-term            sudo openstack-install
release, and imminent at the time of writing, it may be        The interface to this installer runs via curses on the
a better option. We did try the packages running on a       command line. We’re running version 0.99.27 of the
beta of 16.04 and they worked, but we’d still safely        installer (March, 2016), so there’s a small chance that
recommend 14.04 unless you’ve got a hardware                something may look different in a more recent
requirement only satisfied by a newer release. Open a       version, but the process should be identical. The first
terminal and type the following to add the cloud-           question you’ll be asked is what type of installation
installer package repository and install the                you’d like to perform, and you need to choose the
dependencies we found we needed:                            ‘Single’ option at the bottom. As the text describes,
sudo apt-add-repository ppa:cloud-installer/stable          this is the option for installation on a single machine.
sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install urwid --upgrade
sudo apt-get install openstack




5
    Put the kettle on                                       6
                                                                Make a cup of tea
After being asked for the installation type, you’ll next    In total, we waited over an hour for this step to
be asked for a username and password. This                  complete, although subsequent installations were a
username and password will be used to access the            lot quicker. This is the part where new virtual
account and the dashboard, which is the OpenStack           machines (containers) are spawned and slotted into
module used to provide a web management interface.          the OpenStack ecosystem. Each container is needed
The first stage of the installation will appear as in the   to perform a different task or run a different
screenshot, as the installer will download and pack all     OpenStack module, and they’ll all end up talking to one
the various tools required.                                 another to create the final configuration. Each will
   OpenStack is built with Python (which is why we          appear gradually on the terminal and go through a
made sure pip was installed earlier), and a lot of the      series of stages after starting off with ‘Pending,’ and
requirements will be for Python packages and the            it’s this step that will test your machine’s performance
creation of the first container. After that, you should     to the maximum. We’d recommend spending the time
see the ‘Bootstrapping JuJu’ message, which should          with a nice cup of tea and reading a little about what
kick off the second stage of the installation.              each module does in OpenStack.




                                                                www.linuxvoice.com                                      77
     TUTORIAL OPENSTACK AND JUJU


                 7
                     Nearing completion                                  8
                                                                              Horizon/Dashboard
                 From top to bottom, the modules that OpenStack          On the same machine, enter the login URL. This link
                 instantiates are Glance, Keystone, MySQL, Neutron/      will be an HTTPS connection, and you’ll need to ask
                 API, Controller, Compute, Dashboard and RabbitMQ.       your browser to make an exception for the self-signed
                 Briefly, Glance is used to discover and register disk   SSL certificate before you can continue. You’ll then be
                 and server images. Keystone is the identity and         asked for the username and password, as shown in
                 authentication service. Neutron handles the virtual     the installer terminal, which is now simply showing
                 networking. The ‘controller’ orchestrates everything,   the output from the openstack-status command. The
                 the ‘Compute’ module actually runs the instances on     dashboard defaults to an overview of the instances,
                 the hardware and the RabbitMQ server handles the        virtual CPUs, RAM units, IP addresses and security
                 messaging. There’s also the dashboard, which            groups being used by your cloud. There’s nothing
                 provides a web administration interface to the cloud.   useful to see because we haven’t added any of our
                 When the install has finished, the [INFO] text at the   own instances, but you can do this by switching to the
                 bottom will display ‘Status: Deployments complete,      ‘Images’ page of the Compute module, which should
                 Relations complete, Post-processing complete.’          list a single image name. First, we need some security.




                 9
                     Set up security                                     10
                                                                              Spinning up your own instance
                 Security is paramount when it comes to the cloud,       By default, you should see an image for the Ubuntu
                 and before you’ll be able to connect to any virtual     version you’re running on the Compute > Images
                 machines you’ll need to create an SSH keypair. This     page. New images can be added using the Create
                 can be done from the command line by typing             Image button, but for this example we’re going to spin
                 ssh-keygen -P "" -b 2048, but don’t let it overwrite    up the image already listed. This is as simple as
                 your current files. Put the new files somewhere safe.   clicking on the Launch Instance button. You need to
                 In the dashboard, go to the Compute > Access &          give your instance a name, select a Flavour (start
                 Security page, click on Key Pairs and use the Import    small) and choose your fresh security key from the
                 Key Pair button to open a panel where you can paste     Access & Security tab. When you’re happy with the
                 the contents of the id_rsa.pub file you just created.   options, click on Launch. The instances list will appear
                 Give the key a name and save it. You now need to        with a ‘Spawning’ status in the task field. Your new
                 enable SSH access through OpenStack’s firewall. Click   virtual machine is now being created and within a few
                 on the Security Groups tab followed by Manage Rules.    moments – not an hour this time – 'Spawning' will
                 Click on Add Rule and select SSH, making sure           change to ‘Running’ and your cloud will now be
                 Remote is set to CIDR. This will allow external SSH     hosting your very own instance, just waiting for you to
                 connects to find a route to your new instance.          connect to it and launch a startup business.




78                                              www.linuxvoice.com
                                                                                        OPENSTACK AND JUJU TUTORIAL


11
     Connecting to your new instance                        12
                                                                 Connecting to JuJu
Before we can connect, we need to attach the                Building your own applications running on top of your
instance to an IP address accessible outside the            own containers is obviously a very powerful step, but
cloud. You can do this by selecting ‘Associate Floating     there are other options that cut out manual labour.
IP’ from the drop-down Action menu. After a simple          Canonical’s JuJu is one of these, and it’s already being
panel, the floating IP address will appear in the IP        used by your system to deploy the various OpenStack
address field, and you should be able to SSH into your      modules on your machine. You can see JuJu running
new machine by typing the following, replacing id_rsa       by connecting to the container that’s currently
with the path to the private key we generated earlier:      orchestrating OpenStack by typing the following:
ssh -i id_rsa ubuntu@floating_ip                            sudo lxc-attach -n openstack-single-$USER
   After accepting the SSH fingerprint, SSH should          su ubuntu
automatically connect you to your fully fledged             % JUJU_HOME=~/.cloud-install/juju juju status
instance running on your very own cloud, and you can           The final command, juju status’ will produce output
install packages and do whatever you need just as           very similar to the openstack-status view we used
you would a real machine on a real server. Try              during installation, only this time JuJu is the tool doing
installing Apache 2, for example (and don’t forget to       all the hard work. Working with JuJu on the command
allow HTTP connections).                                    line is straightforward, but there’s also a wonderful
                                                            web interface that can be installed by typing juju
                                                            deploy juju-gui followed by juju expose juju-gui.




13
     JuJu GUI                                               14
                                                                 Installing Mediawiki
You should be able to see from the installation status      The JuJu store is like a package repository for cloud
terminal that JuJu GUI has been added as a new              applications. Some may need connections to be
service, usually at the bottom of the list where it will    made between resources after installation, which you
include a login URL. Enter this into a local browser        can do in the GUI, but you can get around this by
with the usual HTTPS caveat and use admin and your          installing an all-in-one bundle. To try the installation
password to enter the sandbox. The site that opens is       out, search for mediawiki, select it and click on ‘Add
a really impressive graphical overview of your current      To Canvas’. You’ll see it appear in the main view
cloud, as orchestrated by JuJu. You can see all the         (canvas). It needs to be connected to MySQL by
installed services and how they’re connected. You can       dragging from the MySQL icon to Mediawiki and
even drag them around and their elastic connections         selecting mysql:db mediawiki:db as the relation. Click
will follow. You can also use the list of services on the   ‘Commit Changes’ followed by ‘Deploy.’ Finally, select
left to isolate specific modules and see how they’re        Mediawiki and click ‘Expose’ followed by ‘Commit’ to
interconnected. It’s a great way of learning how            make the server live. Wait for the initialisation to finish
OpenStack is configured, but the real magic comes           and ‘juju status mediawiki’ to check its status and get
from clicking on the ‘Store’ button in the top-right.       the IP address after initialisation.




                                                                 www.linuxvoice.com                                       79
     TUTORIAL CONTROLLING PHILIPS HUE LIGHTS




ILLUMINATE YOUR LIFE
WITH LINUX PART 3
Take your next steps in home automation by using Linux to control your lights.

  MARK CRUTCH
                               O
                                         ver the past couple of issues we've been
                                         exploring ways to control Philips Hue and Lux
                                         “smart” bulbs using a Linux box. Last time we
WHY DO THIS?                   left you with a simple web page that would let you
• Control the colour of your   turn a light on and off, change its name and adjust its
  lights                       brightness. This time we're going to add some colour
• Learn about data-*           controls for Hue bulbs.
  attributes                      You could base your new code on the brightness
• Mix HTML and SVG             slider we used last time, but it's not a simple copy-
                               and-paste job. The API requires the hue value to be
                               specified in a range from 0 to 65535. That's easy
                               enough: just change the min and max attributes
                               on the new slider. The saturation value runs from 0
                               (white) to 254 (100% colour), but we prefer to have our
                               slider running in the opposite direction, so that white
                               is at the right-hand end of the scale. There are a few
                               ways that we could flip our scale to accommodate
                               this requirement, but we chose to just change the min        Our first pass at adding colour controls works, but looks
                               and max to run from -254 to 0, then negate the value         a little plain.
                               as it's passed to our new set_saturation() function.
                               This is the code we added to our HTML:                           fetch(sURL, {method: "PUT", body: sPayload});
                               <div id="div-hue">                                           }
                                   <label id="label-hue" for="hue">Hue:</label>                If you've got a mixture of Hue and Lux bulbs it
                                   <input id="hue" type="range" min="0" max="65535"         would be nice to hide the additional UI for those bulbs
                                      onchange="set_hue(this.value);" />                    that only support brightness changes. There are a few
                               </div>                                                       steps needed to achieve this: we need a way to show
                               <div id="div-saturation">                                    and hide the relevant parts of the interface; we have to
                                   <label id="label-saturation"                             store some extra information to indicate which bulbs
                               for="saturation">Saturation:</label>                         can change colour; and we need a function that fires
                                   <input id="saturation" type="range" min="-254" max="0"   whenever the currently selected bulb is changed.
                                      onchange="set_saturation(-this.value);" />               In the HTML page we decided to wrap our new
                               </div>                                                       controls in another <div>. We've given ours an ID
                                 And here's the extra pair of JavaScript functions we       of div-colour, and enclosed the div-hue and div-
                               call when these sliders are moved:                           saturation sections inside it. This gives us a single
                               function set_hue(nValue)                                     target to show and hide in order to suppress both
                               {                                                            controls at once. The <select> element also gets a
                                   var sURL = `${sBaseURL}/lights/${$("lights").value}/     new onchange attribute with a value of check_lamp_
                               state`;                                                      type(); – this will be the name we use for our new
                                   var sPayload = `{"hue":${nValue}}`;                      function. To hide the new <div> we'll set or remove
                                   fetch(sURL, {method: "PUT", body: sPayload});            a “hidden” class, and create a line in our CSS file that
                               }                                                            tells the browser what to do when the class is present:
                               function set_saturation(nValue)                              .hidden { display: none; }
                               {                                                              We now have the capability to hide the controls, but
                                   var sURL = `${sBaseURL}/lights/${$("lights").value}/     we still don't have any information about which lights
                               state`;                                                      need them shown and which ones don't. It's time to
                                   var sPayload = `{"sat":${nValue}}`;                      extract a little more information from our initial query



80                                                                  www.linuxvoice.com
                                                                                                CONTROLLING PHILIPS HUE LIGHTS TUTORIAL


to the Hue API in order to set a flag for those lights                                                                                                          By adding some CSS, our
that support colour. We'll determine this by testing for                                                                                                        colour controls actually
the presence of a hue property on the state object in                                                                                                           have some colour!
the JSON. Modify the for loop in your main() function
to look like this:
for (var sLightID of Object.keys(oJSON)) {
    var oOption = document.createElement("option");
    oOption.setAttribute("value", sLightID);
    if (oJSON[sLightID].state.hue !== undefined) {
        oOption.setAttribute("data-lamp_type", "colour");
    }
    oOption.innerHTML = oJSON[sLightID].name;
    oSelect.appendChild(oOption);
}
    The only addition here is that, when we create the
<option> elements inside our popup menu, we're
also adding a data-lamp_type attribute to any bulbs
that have a hue property in the JSON. As we're only                              these new additions together:
dealing with two possibilities here – colour or not                              function check_lamp_type() {
colour – we're just using the presence of the attribute                              var oOption = $("lights").selectedOptions[0];
to distinguish between them. Nevertheless, it makes                                  if (oOption.dataset.lamp_type === "colour") {
sense to give the attribute a sensible value to make                                     $("div-colour").classList.remove("hidden");
the code more readable.                                                              } else {
    We could simply have called the new attribute                                        $("div-colour").classList.add("hidden");
                                                                                                                                                 PRO TIP
lamp_type and browsers would have been perfectly                                     }
                                                                                                                                                 Download the example code from www.
happy. But it's possible (though unlikely) that some                             }
                                                                                                                                                 peppertop.com/hue.zip
future revision of HTML could introduce a lamp_type                                 First we get the currently selected
attribute to the standard that conflicts with our own                            option, then the next line checks the
version. To avoid problems like this, HTML 5 has a                               state of our new attribute, via the dataset property,
rule whereby you're safe to use your own attribute                               and adds or removes the class as necessary. Reload
names provided they're prefixed with data-. This                                 your page, and you should now find that the Hue and
becomes a kind of semi-private namespace that the                                Saturation controls are shown and hidden based on
HTML working group promises never to pollute with                                the type of bulb. This approach of pulling data from
their own additions. These data-* attributes can be                              the JSON and storing it in a data-* attribute is one
read and written using the normal getAttribute() and                             method that could be used to keep the controls in
setAttribute() methods, as we've used in the main()                              sync with the current state of the selected bulb, if you
code, but they're also accessible via a “dataset”                                want to create a more sophisticated interface.
property on your element, in which case the data-                                   The colour controls are visible unless we explicitly
prefix is dropped in the JavaScript, making things a                             hide them, but that only occurs when a new bulb
little more readable. You can see an example of this                             is chosen from the popup menu. What happens if
in the new check_lamp_type() function that will tie all                          our first bulb happens to be a Lux bulb? We would


        Working with RGB
        One omission in the Hue API is the ability to set                                                                      conversion function requires us to split the string
        a colour using RGB values. This requires the              if (maxRGB === r) {                                          into its hexadecimal components, then convert
        developer to do some additional work to convert               h = ((g-b)/c) * 60;                                      those to decimal. Here's a function that you can
        an RGB value to hue, saturation and brightness,           } else if (maxRGB === g) {                                   hook into the picker's onchange handler that does
        though the mapping isn't a simple one. We prefer              h = ((b-r)/c + 2) * 60;                                  the hard work for you using a regular expression
        to keep the brightness control separate from the          } else {                                                     and a few parseInt() calls:
        hue and saturation, so here is a cut-down function            h = ((r-g)/c + 4) * 60;                                  function colour_from_picker(sHexRGB)
        for just returning those components for a Hue bulb,       }                                                            {
        when given red, green and blue values in the range        h = (h < 0) ? h + 360 : h;                                       var aValues = sHexRGB.match(/^#(..)(..)(..)$/);
        0–255:                                                    // h is 0-360 degrees; map it to 0-65535 for Hue API             var r = parseInt(aValues[1], 16);
        function rgb_to_hs(r, g, b) {                             h = Math.floor(h * 183);                                         var g = parseInt(aValues[2], 16);
         var h, s, c;                                             s = Math.floor((maxRGB - minRGB)/maxRGB * 254);                  var b = parseInt(aValues[3], 16);
         r = r/255, g = g/255, b = b/255;                         return [h, s];                                                   var [h, s] = rgb_to_hs(r, g, b);
         var minRGB = Math.min(r,g,b);                        }                                                                    set_hue(h);
         var maxRGB = Math.max(r,g,b);                           The HTML 5 colour picker widget (<input                           set_saturation(s);
         c = maxRGB - minRGB;                                 type="color" />), returns its value as a hexadecimal             }
         if (c === 0) return [0, 0];                          number in the form #rrggbb. To use this with our




                                                                                         www.linuxvoice.com                                                                            81
     TUTORIAL CONTROLLING PHILIPS HUE LIGHTS

                                be showing the colour UI, even though it's not                  a first-class citizen in HTML5. This means that you
                                appropriate. The fix is quite simple: we simply need to         can throw a block of SVG code into any HTML5 web
                                call our new function once we've finished initialising          page without having to concern yourself with the
                                the UI. Just add a line to call check_lamp_type() after         complexities of combining two XML languages in
                                the for loop in the main() function, before the closing         a single document. Add the following SVG to your
                                brackets of the second then() method.                           HTML file, just before the closing tag of the “div-
                                                                                                colour” section (so that the new code is inside the
                                Improving the UI                                                <div>, just after the hue and saturation sections):
                                One issue with our user interface at the moment                 <svg id="svg" width="100%" height="100%"
                                is that there's no indication as to what colour any                viewBox="0 0 65535 254"
                                particular value for the hue slider will produce. We               preserveAspectRatio="none">
                                know it's red at either end, green a third of the way            <defs>
                                along, and blue at two thirds, but it would be better to          <linearGradient id="gradient-hue">
                                have a graphical representation of that. It is possible            <stop stop-color="red" offset="0%" />
                                to style HTML sliders, but the syntax is a little different        <stop stop-color="orange" offset="14%" />
                                for each browser; however, we only want to add some                <stop stop-color="yellow" offset="28%" />
                                colour to the “track” of the slider, and only for Firefox          <stop stop-color="green" offset="42%" />
                                and Chrome/Opera, since our JavaScript is too cutting-             <stop stop-color="cyan" offset="56%" />
                                edge for other browsers anyway. This results in a                  <stop stop-color="blue" offset="71%" />
                                relatively small amount of code to add to the CSS:                 <stop stop-color="purple" offset="85%" />
                                #label-hue { display: none; }                                      <stop stop-color="red" offset="100%" />
                                #hue::-moz-range-track {                                          </linearGradient>
                                    background: linear-gradient(90deg,                            <linearGradient id="gradient-saturation"
                                     red,orange,yellow,green,cyan,blue,purple,red);                  x1="0" y1="0" x2="0" y2="1">
                                    border: 1px solid darkgrey;                                    <stop stop-color="white" stop-opacity="1"
                                    height: 10px;                                                     offset="0%" />
                                    border-radius: 5px;                                            <stop stop-color="white" stop-opacity="0"
                                }                                                                     offset="100%" />
                                #hue::-webkit-slider-runnable-track {                             </linearGradient>
                                    -webkit-appearance: none;                                    </defs>
                                    background: linear-gradient(90deg,                           <rect x="0" y="0" width="100%" height="100%"
                                     red,orange,yellow,green,cyan,blue,purple,red);                 fill="url(#gradient-hue)" />
                                    border: 1px solid darkgrey;                                  <rect x="0" y="0" width="100%" height="100%"
                                    height: 22px;                                                   fill="url(#gradient-saturation)"
                                    border-radius: 5px;                                             onclick="svg_colour_selected(evt);" />
                                }                                                               </svg>
                                      We also added the same code a second time, but               That's a lot of code, but what it does is actually
                                   modified for the saturation control. Just replace every      quite simple: it draws two rectangles, one on top of
                                   instance of “hue” with “saturation”, and instead of a        the other, each filled with a different linear gradient in
                                   a linear-gradient running through the colours of the         order to provide a sweep of colours in one direction
                                                  rainbow, it just goes from black to white.    and saturation in the other. Let's look at it bit-by-bit to
PRO TIP                                           With both sets of additions in place, our     get a better understanding of what's happening.
If you can ssh into your home network,            UI is starting to look almost professional:      We start with our <svg> container. This tells the
use the -R option to forward port 80 from            HTML range inputs are one-                 browser that we're introducing a block of SVG code
your web server to a port on the local
machine, allowing you to control your
                                                  dimensional   widgets. They enable you        into the page, and that it should take up 100% of the
lights from anywhere in the world.                to change   a single value by moving a        available width and height in its parent container
                                                  slider along a fixed track. Another option,   (the div-colour block). That lets us adjust the size
                                                  when you have two related parameters,         of the parent in our CSS file, knowing that the SVG
                                   is a two-dimensional input widget that lets you click        will automatically resize to match. Within a block of
                                   anywhere within a plane in order to select a pair of         SVG it's possible to introduce a different coordinate
                                   coordinates.                                                 system to that used by the main page, using the
                                      There are several different ways to approach this,        viewBox attribute. This takes the x and y coordinates
                                   each with their own pros and cons, but we've chosen          of the top-left and bottom-right corners of the new
                                   to use SVG to draw the UI for our hue-saturation             coordinate system, allowing us to specify that, within
                                   selector. This is an XML-based language for drawing          the SVG world, our coordinates run from 0 to 65535
                                   vector graphics, and has been a W3C standard for a           in the x-direction and 0 to 254 in the y-direction,
                                   long time. Its take-up has been very slow, largely due       regardless of the “real-world” dimensions of the web
                                   to lack of support in Internet Explorer, but the last few    page. The preserveAspectRatio attribute ensures that
                                   years have seen a surge in its popularity, resulting not     our rectangles will fill the available space, even though
                                   only in IE gaining support, but also in SVG becoming         it means ignoring their native aspect ratios.



82                                                                 www.linuxvoice.com
                                                                        CONTROLLING PHILIPS HUE LIGHTS TUTORIAL

   Inside the SVG we have a <defs> section to hold                                                                           Throw in some SVG and
definitions for things we'll need later in the code. There                                                                   things really start to look
are a pair of linear gradients, each containing <stop>                                                                       fancy.
elements that define the colour stops. Unfortunately
SVG doesn't automatically space the stops for you,
so you have to specify the offset for each one. The x1,
y1, x2 and y2 values on the saturation gradient ensure
that it runs from top to bottom, rather than the default
of left to right. Notice also that the saturation gradient
runs from white to white, but with the opacity running
from 1 to 0.
   Finally we get to the rectangles we're drawing.
They're both positioned at the top-left corner of our
coordinate space, and extend to 100% of it in either
direction. Each is filled with a gradient from the defs
section by a reference to its ID. The “painters model”
that SVG uses means that later objects are drawn
on top of earlier ones, so our second <rect> is placed
on top of the first. Because the saturation gradient
is partially transparent, the hue gradient will show         {
through from the rectangle below. As it's on top, the            var oPoint = oSVG.createSVGPoint();
second rectangle is also the right place to put our click        oPoint.x = x;
handler – the first one never receives any clicks itself.        oPoint.y = y;
   If you reload the page at this point you'll be                var oMatrix = oSVG.getScreenCTM().inverse();
disappointed to see the new selector only appears                oPoint = oPoint.matrixTransform(oMatrix);
as a thin strip across the screen. This is because               return [Math.floor(oPoint.x), Math.floor(oPoint.y)];
we haven't fixed the height of the parent <div>, so          }
the SVG collapses down to the minimal amount of                 In an ideal world we would be able to pull our
vertical space it can. Let's hide the old sliders and        SVG coordinates straight out of the click event. The
give the new control some breathing room with this           x-coordinate could be passed straight to
addition to the CSS file:                                    set_hue() and the y-coordinate to set_
                                                                                                                PRO TIP
#div-hue { display: none; }                                  saturation(). Unfortunately the browser
                                                                                                                Another approach to laying out the web UI
#div-saturation { display: none; }                           only gives us the values transformed               is to use the new CSS flexible box model,
html { height: 95%; }                                        into the HTML coordinate system. The               which makes it easy to create widgets that
body { height: 100%; }                                       transformation takes place through a               grow and shrink as the page size changes.
#svg { border: 1px solid darkgrey; }                         matrix multiplication, and it's possible
#div-colour {                                                to query the <svg> element for the
    height: 50%;                                             specific coordinate transformation matrix that was
    margin: 0;                                               used via the getScreenCTM() method. The returned
}                                                            matrix has an inverse() method that gives us a matrix
    By setting the <html> to 95% we allow the page to        for transforming values in the opposite direction. By
fill most of the window, but not enough to cause scroll      creating an SVG point, setting its coordinates to the x
bars to appear. The <body> is set to use all that space,     and y values from the click event, then performing an
allowing plenty of room for our div-colour to fill. We've    inverse matrix multiplication, we can get the original
set that to a percentage height, allowing it to grow and     SVG coordinates back once more.
shrink as the window size changes.                              With our SVG-powered colour selector working,
    The last step is to add some JavaScript to handle        that concludes our short foray into the world of
clicks within the new control. The onclick handler on        smartbulbs. But we've only just scratched the
the second rectangle passes the click event to svg_          surface. The web interface has plenty of scope for
colour_selected() so let's add that, and another helper      improvements or new features, and the Bash and
function, to the JS file:                                    Python examples from part one offer a wealth of
function svg_colour_selected(e)                              possibilities for hooking the lights up to other data
{                                                            sources. As an unobtrusive notification system, your
    var oSVG = e.target.nearestViewportElement;              own house lights are hard to beat, so let us know on
    var [h,s] = convert_coordinates(oSVG, e.clientX, e.      the forums if you come up with any particularly good
clientY);                                                    ways to use these devices.
    set_hue(h);
    set_saturation(s);                                           Mark Crutch now has his Hue lights flashing around a
}                                                                spinning office chair, to recreate his childhood dream of
                                                                 becoming Joe 90.
function convert_coordinates(oSVG, x, y)



                                                                  www.linuxvoice.com                                                                   83
     TUTORIAL GO




WRITE AN IMAGE CROPPING
PROGRAM WITH GO
Learn the ropes of Google's excellent Go programming language.

        AMIT SAHA
                            G
                                    o (or Golang) is attractive because of its C-like
                                    syntax, static typing (but with a feel of being
                                    dynamic typed) and its rich standard library. In
WHY DO THIS?                this article, our aim is to introduce you to some of the
• Get to grips with one     features of Go. We do not assume that you know Go,
  of the languages of the   but assume familiarity with another programming
  moment.                   language. By the end of this article, you will have
                            written a command line program that can crop                Illustration of the program we will write by the end of this
                            images to your desired height and width. More               article. (The Go gopher was designed by Renee French.
                            importantly, you will have had a very short                 (http://reneefrench.blogspot.com).
                            introduction to the language and how to use
                            packages from the standard library as well as               environment variable to point to the workspace
                            third-party packages. This will hopefully inspire you to    directory, so set the following to your
                            go ahead and learn more about it. Let’s get started!        .bashrc or the file relevant to your shell, so that it is
                               Before we can write our first program, we will need      always set when you start a new terminal session
                            to install the Go tools, which includes the Go compiler     (Replace <user> with your username):
                            and other useful bits and bobs. On Fedora 23, we can        export GOPATH=/home/<user>/golang
                            install Go 1.5 using the distro's package manager:            Once you have set the above, start a new terminal
                            $ sudo dnf -y install golang                                session and type in
                               On other Linux distros, please download the Linux        $ go env GOPATH
                            binary and follow the instructions on the install page      /home/<user>/golang
                            at https://golang.org/doc/install. Once the                    If you see your GOPATH printed correctly similar to
                            installation steps are completed, open your favourite       above, we're all set to perform one final step before
                            terminal emulator and type go version and it should         our first program.
                            print a message similar to below:                              Execute the command mkdir -p github.com/
                            $ go version                                                linuxvoice/helloworld while in the src sub-directory
                            go version go1.5.2 linux/amd64                              we created above. The directory tree should look like
                                                                                        this:
     Functions in Golang are created using                                              `-- src
                                                                                         `-- github.com
     the func keyword, followed by the                                                      `-- linuxvoice

     function name and a list of arguments
                                                                                              `-- helloworld
                                                                                           The reason we do this is that since all the Go code
                                                                                        you write (or that of the third-party packages we use)
                               Now, we are ready to set up our workspace. Create        will live in the same src sub-directory, it is important
                            a sub-directory called golang in your home directory        we have distinct sub-directories where they live. It is
                            (/home/<user>) and a sub-directory, src, inside it. All     customary for the top-level sub-directory to be of the
                            the source code for Go programs will live in the src        same name as your code hosting site (here, github.
                            sub-directory. This includes the programs we write as       com), the next sub-directory to be the username (here
                            well as the third-party packages we will use (more on       linuxvoice), and finally the sub-directory for our code
                            this later).                                                itself (helloworld).
                               The directory tree for your workspace should look
                            as follows:                                                 Hello World
                            golang/                                                     The program below will print the customary "Hello
                            `-- src                                                     World" message when run. Type in the following
                            The go compiler and other tools expects the GOPATH          program to a file hello.go and place it in the



84                                                           www.linuxvoice.com
                                                                                                                          GO TUTORIAL


helloworld sub-directory we created above:
// This is a simple program which prints Hello World
package main
import "fmt"
func main() {
      fmt.Println("Hello World!")
}
    Your src directory should look as follows:
`-- src
    `-- github.com
      `-- linuxvoice
        `-- helloworld
          `-- hello.go
   Since Go is a compiled language, we first have to
compile it. To do so, we will use the build sub-
command of the go tool from the src/github.com/
linuxvoice/helloworld directory:
$ go build hello.go
  You should now see that a hello executable has
been created, which we can execute as follows:
$ ./hello
Hello World!
   Congratulations – you have successfully run your
first program. Let's now understand the program we
wrote above. The first line in the program above is a
comment, indicated by the beginning //. In the next
line, we declare a package for our program. Every
program in Go must declare a package to which it
belongs. The package main is special – it tells the Go                                                                     Flowchart showing the key
compiler that this is an executable program. The other                                                                     steps performed by the
kind of program we can write in Go is a package, or in                                                                     cropper() function
other words, a library which we use from another
executable program. The next line (import "fmt")            }
imports the fmt package from Go's standard library. It         Every variable declaration in Golang must specify a
implements the formatted Input/Output functions.            type, indicating the data type of the values that we
   Next, we write our main() function – this is where       will store in it. The statement, var shortMessage
the execution begins when you run a program in Go.          string declares a variable, shortMessage, which will
Functions in Golang are created using the func              store a string. Here we assign the string "Hello World"
keyword, followed by the function name and list of          to this variable. We then call the fmt.Println() function
arguments it accepts in parenthesis, and then the           with this variable. Go supports a short-hand form of
return values. The main() function is special, as it        variable declaration inside functions using the :=
neither accepts any arguments nor does it return            operator. Using that our above variable declaration
anything. Next, we start the function body with an          would become shortMessage := "Hello
opening curly brace and have a single statement in          World". This is however only valid when            PRO TIP
the body – fmt.Println("Hello World"). This line calls      we also specify the initial value of the           Using go run, we can combine the building
the Println() function in the fmt package passing the       variable.                                          and running steps into one. For example,
string "Hello World!" to it.                                   Besides the built-in data types such as         we can build and run fact.go as go run
                                                                                                               fact.go and you should see the output as
   The Println() function just prints the string followed   integers and floating point numbers,               above.
by a new line.                                              programs can define a new data type
   The closing brace ends the function body.                using struct. For example, let's say that
   We will now rewrite the program so that we can           in our image cropping program, we want to define a
change what message we print by having the                  data type that will store the image path, desired height
message stored in a variable:                               and width that we want the image to be cropped into.
// This is a simple program which prints a string           We would create a new data type as follows:
package main                                                type Config struct{
import "fmt"                                                    path string
func main() {                                                   height int
    var shortMessage string = "Hello World"                     width int
    fmt.Println(shortMessage)                               }



                                                                www.linuxvoice.com                                                                   85
     TUTORIAL GO

                                                                                  we return the value in fact using the return statement.
                                                                                     The program execution begins at main(), where we
                                                                                  declare a variable num initialised with 10, then call the
                                                                                  factorial() function with this variable as an argument.
                                                                                  The return value is stored in fact. Then, we print the
                                                                                  factorial using the Printf() function in the fmt
                                                                                  package. The Printf() function is used here because
                                                                                  we want to substitute the values of variables num and
                                                                                  fact string. Unlike Println(), Printf() doesn't
                                                                                  automatically add a new line at the end of the output,
                                                                                  so we have to do it ourselves.
                                                                                     Create a sub-directory fact in the sub-directory src/
                   The passed-in desired height and width creates a "crop         github.com/linuxvoice and type in the above program
                   box" on the image starting at the top-left position.           into a file fact.go. The linuxvoice sub-directory
                                                                                  structure should now look like as follows:
                     The above code creates a new data type – Config              linuxvoice/
                   – which has three fields: path, which is a string, height           fact
                   and width, both of type integers. We then create a                    fact.go
                   variable of this type as follows:                                   helloworld
                   image := Config{path:"/var/cat1.jpg", height:10, width:10}             hello.go
                     Note that we used the := operator here as well to              Let's build and run the program from the fact
                   create a variable of Config type. We can refer to each         sub-directory:
                   of the fields with the . (dot) operator. That is image.        $ go build fact.go
                   path, and so on. In our image cropping program, we             $ ./fact
                   will not be defining any new new type, but we will be          Factorial of 10 is 3628800
                   using variables of struct type.
                                                                                  Writing the image cropping program
                   Writing your own functions                                     Now that we have seen the absolute basics, we'll get
                   Except for the very rare cases, our program will               on to the image-cropping program. You can find the
                   usually be composed of functions other than the                entire source in the file, crop.go in the repository
                   main() function. The final program we write by the             https://github.com/amitsaha/linux_voice_1. Since
                   end of this article is a more practical example, but           this is a relatively long program, I will present and
                   here's a simple demonstration. The program below               discuss the source code referring to snippets of the
                   calculates the factorial of an integer (10):                   program from top to bottom.
                   package main                                                      The program starts with a block comment:
                   import "fmt"                                                   /* Simple command line program to crop images
                   func factorial(num int) int {                                  Usage:
                             fact := 1                                            $ go run crop.go --height=5000 --width=7000 <path to>/
                             for i := 1; i <= num; i++ {                          cat1.jpg <path to>cat2.png
                                         fact = fact * i                          The cropped images will be placed in the same directory
                             }                                                    as the
                             return fact                                          original images with the file names being
                   }                                                              cropped_<original_file_name>.<original_extension>
                   func main() {                                                  */
                             num := 10                                               When you have comments over multiple lines, you
                             fact := factorial(num)                               can have them as a block comment instead of
                             fmt.Printf("Factorial of %d is %d\n", num, fact)     prefixing each line with a // as we saw in our first
                   }                                                              program. The /* indicates the beginning of a block
                      We start by declaring the package and importing             comment and */ indicates the end.
                   the fmt package. The function factorial() accepts an              Similar to all our programs so far, our image-
                   integer parameter and returns an integer. It starts by         cropping program will be an executable program, so
                   creating a variable, fact, and initialising it to 1. Then we   we specify the package to be main and then import a
                   have a for loop. If you are familiar with C, C++ or Java,      number of packages from the standard library as well
                   this should seem familiar, but without the                     as the third-party package github.com/oliamb/cutter.
                   parentheses. The loop variable, i, is initialised with a       When you try to import a package that's not in the
                   value of 1 and continues until its value is greater than       standard library, Go will look for it in the src/ sub-
                   the number, incrementing by 1 in every step. The ++            directory we created in the beginning. Thus, in this
                   operator in Go is used to increment the value in i by 1        case, the cutter package should exist in src/github.
                   in place. In the body of the for loop, we have the             com/oliamb/cutter. We will see how we can do so
                   statement that actually calculates the factorial. Finally      before we run our program.



86                                                     www.linuxvoice.com
                                                                                                                          GO TUTORIAL

package main
import (
     "bufio"
     "bytes"
     "flag"
     "fmt"
     "github.com/oliamb/cutter"
     "image"
     "image/jpeg"                                             Since we don't care about the index in our final              Flags and options
     "image/png"                                           program, we use the throwaway variable, _,                       recognised by our program
     "io/ioutil"                                           (underscore) and use the variable t for the actual
     "log"                                                 element. In the body of the loop, we check if the
     "net/http"                                            incoming imageType is one of the recognised image
     "os"                                                  types using the If statement. If a match is found, we
     "path/filepath"                                       return true. If we haven't found a match after
)                                                          checking both the elements of the slice, we return
    Next, we have the first function in the program:       false.
func validateImageType(imageType string) bool {               The next function in the program is the cropper()
              recognizedImageTypes := []string{"image/     function, which performs the core functionality of the
jpeg", "image/png"}                                        program. It accepts three parameters: a string
              for _, t := range recognizedImageTypes {     containing the path to a image file and two integers
                        if imageType == t {                corresponding to the desired height and width. The
                                  return true              function then performs the steps outlined in Figure 2.
                        }                                  Steps 1,2 and 3 are carried out by the following lines:
              }                                            imageData, err := ioutil.ReadFile(inputFilePath)
              return false                                 if err != nil {
}                                                              log.Fatal(err)
   The validateImageType() function accepts a string       }
argument, imageType, and returns a Boolean,                imageType := http.DetectContentType(imageData)
specified by the bool return type. In the first            if ! validateImageType(imageType) {
statement, we create a slice of strings                         log.Fatal("Cannot handle image of this type")
recognizedImageTypes consisting of the two image           }
types that our program will be able to crop. A slice in       The first statement uses the ReadFile() function
Go is a data structure used to store a collection of       from the ioutil package to read the entire file into
elements of the same type. The position of an              memory. The function returns two values: the data as
element in the slice is referred to as the index and       bytes and an error value, which are stored in the
starts at 0. It is similar to an array in C. Go also has   variables imageData and err
arrays, but we shall not discuss them in this article.     respectively. If the value in err is not           PRO TIP
   Then we go over each element of the                     equal to nil (a special value indicating an        The Fatal() function essentially does two
recognizedImageTypes array using a for loop and the        absence of a valid value) or in other              things – it prints the message associated
                                                                                                              with the error – when it is called with a
range keyword. The range keyword returns the index         words, if there was an error when                  error value, else the string passed to it,
and the element itself for each of the elements in the     reading the file, we call the Fatal()              and calls the Exit() function from the os
slice. Here is a demonstration of how range works in       function from the log package passing              package, thus terminating the program.
this case:                                                 the error. This will print an error message
// Example of how range works                              and terminate the program execution.
package main                                                  Next, we detect the image type by using the
import "fmt"                                               DetectContentType() function in the http package.
func main() {                                              We call it passing the bytes we just read into
              recognizedImageTypes := []string{"image/     imageData as an argument. It returns a string
jpeg", "image/png"}                                        corresponding to the image type of the supplied
              for i, t := range recognizedImageTypes {     image. Once we have the image type, we call the
                        fmt.Println(i)                     validateImageType() function we wrote earlier. If the
                        fmt.Println(t)                     function returns false, we call the Fatal() function from
              }                                            the log package with a message, and our program will
}                                                          exit after printing the message.
    The above code will print:                                If, however, the image is one of the recognised
0                                                          image types, we proceed with Step 4, which is
image/jpeg                                                 implemented by the following code:
1                                                          reader := bytes.NewReader(imageData)
image/png                                                  img, _, err := image.Decode(reader)



                                                               www.linuxvoice.com                                                                    87
     TUTORIAL GO

                   if err != nil {                                              croppedFileName := fmt.Sprintf("%scropped_%s",
                                log.Fatal(err)                                  croppedFileDir, fileName)
                   }                                                            croppedFile, err := os.Create(croppedFileName)
                       The Decode() function in the image package is            if err != nil {
                   used to decode the bytes in imageData. However, the                       log.Fatal(err)
                   Decode() function expects the data as a Reader, and          }
                   hence we use the NewReader() function of the bytes           defer croppedFile.Close()
                   package to create a new Reader that will read from              The cropped image will be stored in the same
                   the bytes in imageData and then pass it to the               directory as the original image into a file
                   Decode() function. This function returns the decoded         cropped_<original_filename>.<original_extension>.
                   image of type Image, the format of the image as a            That is, if your original file was in /var/images/cat1.
                   string and an error value. Since we don't care about         jpg, the cropped image will be saved in /var/images/
                   the format of the image any more (we already know            as cropped_cat1.jpg. Hence, we will need to find the
                   it), we have used the underscore instead of using a          directory of the file supplied as well as the filename
                   variable. If the value of err is not equal to nil, we call   (and extension). We can get both using the Split()
                   the Fatal() function passing err to it, else we proceed      function from the path/filepath package. It returns
                   to the next step.                                            two values: the directory and the filename, which we
                       The following code implements Step 5 above:              store in croppedFileDir and fileName respectively.
                                                                                The directory name is returned with a trailing /. Now
     Our program will support cropping                                          that we have the directory and the filename of the
                                                                                original image, next we create a string,
     multiple images at once and expects                                        croppedFileName, using the Sprintf() function from
                                                                                the fmt package, whose value will be the location of
     the paths to the images as arguments                                       the cropped file. Then, we call the Create() function in
                                                                                the os package to create the file passing it the value in
                   croppedImg, err := cutter.Crop(img, cutter.Config{           the variable croppedFileName. It returns two values:
                                Height: cHeight,                                the first referring to the opened file, and the second an
                                Width: cWidth,                                  error value. We check for the value of err to see if there
                   })                                                           was any error while s the file and call Fatal()
                   if err != nil {                                              otherwise. The next statement uses the defer
                                log.Fatal(err)                                  statement to specify that just before the function
                   }                                                            returns, it should close this file using the Close()
                     We call the Crop() function from the cutter package        function.
                   passing the decoded image and a structure variable              Finally, we can implement Step 6 – encode the
                   of type Config (defined in the cutter package),              cropped image and write it to the above file:
                   indicating the desired height and width (Figure 3). This     croppedFileWriter := bufio.NewWriter(croppedFile)
                   function returns the cropped image and an error              if imageType == "image/png" {
                   value. Once again, we check if the err value returned is                  err = png.Encode(croppedFileWriter,
                   not nil and if so, we call Fatal() passing the err value     croppedImg)
                   so that it prints the error and exits.                       }
                     Before we can implement Step 6, we have to create          if imageType == "image/jpeg" {
                   a new file where we will store the cropped image:                         err = jpeg.Encode(croppedFileWriter,
                   croppedFileDir, fileName := filepath.Split(inputFilePath)    croppedImg, &jpeg.Options{100})
                                                                                }
                                                                                if err != nil {
                                                                                             log.Fatal(err)
                                                                                }
                                                                                croppedFileWriter.Flush()
                                                                                  The first statement creates a new Writer to write to
                                                                                croppedFile. This is required for the encoding
                                                                                operation. The encoding function we use will depend
                                                                                on the image type, and hence we use an if statement
                                                                                to check the image type and call the appropriate
                                                                                encoding function. If the image type is image/png, we
                                                                                call the Encode() function in the image/png package
                                                                                with two arguments: the writer where we want to
                                                                                write the cropped image to and the cropped image
                   Original image (Source: http://scienceblogs.                 that we want to encode. Similarly, if the image type is
                   com/gregladen/files/2012/12/Beautifull-cat-                  "image/jpeg", we call the Encode() function in the
                   cats-14749885-1600-1200.jpg)                                 "image/jpeg" package. The first two arguments to the



88                                                  www.linuxvoice.com
                                                                                                                               GO TUTORIAL

function are the same in this case, and there is an                                                                            Cropped image of height
additional argument – a variable of the jpeg.Options                                                                           and width set to 500 and
struct type indicating the quality of the encoding we                                                                          700 pixels respectively.
desire. Here we specify the quality as 100 (the highest
quality).
   Both the functions return an error value. Next, we
check if there was an error, calling Fatal if there was
one, else we call the Flush() function so that all the
data is written to disk.
   The final function in our program is the main()
function. It does the following things:
 1
   Set up the flags, which enables us to specify the
   input as command line flags and arguments.
 2
   Check if all the required input has been supplied to        The Args() function returns all the command line
   the program.                                              arguments that were not flags as a slice. We use the
 3
   Call the cropper() function above with each of the        len() function to find the number of arguments
   images specified and the desired crop height and          specified, and if it is 0 we terminate the program
   width.                                                    specifying an error message.
   Step 1 above is implemented by the following code:          The following code snippet implements Step 3:
cHeight := flag.Int("height", 0, "Crop Height")              for _, inputFilePath := range flag.Args() {
cWidth := flag.Int("width", 0, "Crop Width")                        cropper(inputFilePath, *cWidth, *cHeight)
flag.Parse()                                                 }
   The flag package is used to specify command line            As earlier, we use a for loop and range to go over
flags for our program. We expect both the height and         each of the image paths supplied as command line
width to be specified as integers. Hence, we call the        arguments. In the body of the loop, we call the
Int() function twice to set up the flags for height and      cropper() function with the input file path and the
width storing the returned value in cHeight and              cropping width and height.
cWidth respectively. The first argument to the
function is the flag that will be specified, the second      Cropping images
argument is the default value if not specified, and the      Now that we have gone through the entire program,
third is a short description of what the flag means.         it's time to get the code and run it. From your terminal,
The third line above calls the Parse() function, which       run the following command:
essentially looks at the command line arguments              $ go get github.com/amitsaha/linux_voice_1
supplied to the program when run and stores the                 You should now see two sub-directories under your
value of the flag in the correct variables above.            src/github.com sub-directory, amitsaha and oliamb.
   Next, we implement Step 2. The following code             Under amitsaha, you will see a linux_voice_1
snippet checks if both the flags were supplied and a         package which has our program, crop.go, along with
non-zero integer specified:                                  a few other files. Under oliamb, you will find the cutter
if *cHeight <= 0 {                                           package, which is the package we use to crop the
           log.Fatal("Must specify the crop height to be a   images. What we saw here is that go get was able to
positive integer")                                           find out that our code in crop.go used a third-party
}                                                            package and it downloaded that as well and placed it
if *cWidth <= 0 {                                            in the right location. This is why we need GOPATH to
           log.Fatal("Must specify the crop width to be a    be set (among other things). Now, cd into the github.
positive integer")                                           com/amitsaha/linux_voice_1 and run the program:
}                                                            $go run crop.go --height=500 --width=700 test_images/
   Note that we have used *cHeight and *cWidth to            cat1.jpg
refer to the values in the two variables instead of just       The original image (Figure 5) will be cropped and
cHeight and cWidth. This is because the Int() function       the cropped image will be placed in the test_images/
above returns the address of the values. If the value in     sub-directory as cropped_cat1.png (Figure 6).
any of the variables is not a positive integer, we             We started with the complete basics of Go in this
terminate the program.                                       article, and quickly went on to writing a non-trivial
   Our program will support cropping multiple images         command line program to crop images. Along the
at once and expects the paths to the images as               way, we learned about declaring variables, defining
command line arguments. So we need to check if at            data types, writing functions, handling errors and
least one was supplied. The next snippet does that:          working with several Go packages.
numImages := len(flag.Args())
if numImages == 0 {                                              Amit Saha is the author of Doing Math with Python (No
    log.Fatal("Must specify at least 1 image to crop")           Starch Press) and a software engineer. He blogs at https://
                                                                 echorand.me, and can be reached at amitsaha.in@gmail.com
}



                                                                  www.linuxvoice.com                                                                  89
     CODING COMPUTER LANGUAGES




THE FUTURE OF
COMPUTER LANGUAGES
The future is unknowable… but when it comes to coding we can have a good guess.

      JULIET KEMP
                               A
                                          fter looking at a few of the many computer       mainframes, virtual machines, and cloud computing)
                                          languages that have been invented over the       will be used to replicate the old hardware and run the
                                          last 50-odd years, it's time to polish up that   same code; that's actually easier, cheaper, and safer
WHY DO THIS?                   crystal ball and attempt to make some predictions           (from a project management point of view) to do than
• Speak expansively on the     about the next 50 years… or at least the next 20. Are       rewriting the code.
  future of programming in     the older languages that are still in use today coming         C, on the other hand, is actively used in modern
  your next job interview.     to the end of their useful life? What new languages are     development and still underpins large swathes of
• Inform your choice of your   coming up that are going to take the world by storm?        software. The Linux kernel is, of course, written in
  next language to learn.
                               What are the current big problems that modern               C. C is outstandingly good at what it does, and it's
• Learn from the past.
                               programmers and language designers are trying to            hard to imagine its dominance for close-to-the-metal
                               solve? And how is the practice of programming going         development disappearing any time soon.
                               to change in the future?                                       So would it be surprising if Fortran, C, and COBOL
                                 Looking at languages over the last 30–50 years, it's      code is still chugging along happily in particular niches
                               apparent that there are a bunch of 'old' languages that     in another 40 years? Not even slightly.
                               are still firmly in use. Fortran, COBOL, C, Ada, and           The middle-aged languages like Java, JavaScript,
                               others are still out there and aren't in danger of          and Python are all still under active development, and
                               disappearing any time soon, though some of them are         in very heavy use. The way that people are working in
                               perhaps a little more precarious than others.               these languages has changed (see section below); but
                                 Some older languages are in use primarily for             the languages themselves are well entrenched and
                               legacy systems (especially old mainframe software)          will more than likely still be around in 20 years time.
                               and it's possible that those systems might gradually        On the other hand, 15 years ago Perl was everywhere,
                               be ported over to newer languages. Since these              whereas now its profile is much lower; however,
                               languages don't see much new development, if that           there's still lots of Perl out there and it remains a
                               happened they would gradually become obsolete.              useful language. (And, of course, Perl 6 will surely
                               More likely however is that newer hardware (newer           arrive at some point and may change the scripting
                                                                                           landscape again.)
                                                                                              Older functional languages like Scala (2001) and
                                                                                           Haskell (1990) have recently risen in popularity.
                                                                                           Facebook and Google both use Haskell for some
                                                                                           of their work; and LinkedIn, Twitter, and Tumblr
                                                                                           all use Scala. This reflects a generally increasing
                                                                                           interest in functional programming, with functional
                                                                                           ideas and features appearing in other mainstream
                                                                                           languages (such as Java 8's introduction of lambdas).
                                                                                           Whether this is the start of functional programming's
                                                                                           forthcoming reign of glory (as functional
                                                                                           programming enthusiasts argue), or whether it's just
                                                                                           a brief flurry of functional ideas being pinched by
                                                                                           other languages, is as yet unclear. Perhaps most likely
                                                                                           is that as more people get to grips with functional
                                                                                           programming, it will become more popular for those
                                                                                           problems that it solves particularly well, but that other
                                                                                           languages and paradigms will continue to be popular
Are mainframes, and the                                                                    in their own niches. More generally, the trend suggests
software that runs on                                                                      that the same thing may happen to other languages
them, on their way out?                                                                    at various times, as their particular features become



90                                                             www.linuxvoice.com
                                                                                                COMPUTER LANGUAGES CODING


suddenly relevant to a modern problem (see the
concurrency section below).
  Another area of development hooks new (or
new-ish) things into existing, older, languages. More
and more languages are being written to run on the
Java Virtual Machine – Clojure, Groovy, JRuby and
Jython are the best-known, but there are a couple
of dozen others. Does this suggest a general move
towards a single platform that can be coded in
multiple languages? It's an idea with obvious practical
advantages if it works well; packaging and installation
become potentially easier, while programmers can
work with the higher-level language that best suits
them and their problem domain. It does mean
carrying the overload of an extra virtual machine, but
increasingly virtual machines (of whatever sort) are
part and parcel of how software is run.
                                                                                                                               Hello World in Erlang. Save
                                                                    any mutable shared data at all. This means that each       the file, then execute it in
Concurrency                                                         process has its own private state, and processes           the Erlang shell.
Concurrency is possibly the biggest issue facing                    change state based on their own behaviour or on
modern programmers. It exists when multiple                         explicit messages from other processes, not on
computations are executing at the same time, and                    a shared structure that any process can access.
may be interacting with one another. This can be on                 (Shared structures have the problem that they must
cores within a single chip, in threads on a processor,              be locked while being accessed; if a process dies
or on multiple processors/machines. Because the                     while it has a lock, this can cause issues for other
computations aren't just parallel, but may interact
(and share resources), there are numerous issues to
tackle for the process to be successful, including data
                                                                       The middle-aged languages like Java,
exchange, memory allocation, and scheduling.                           JavaScript and Python are still under
Concurrency is increasingly a big deal as it becomes
more common (and cheaper!) to run multiple threads/                    active development
cores/processors at the same time.
  Various potential solutions or resources to support               processes trying to access the same structure.)
solutions are available and/or under experimentation.               Erlang is also functional, and its focus is scalability,
Erlang (which dates back to 1986) has grown in                      high availability, and no downtime. This reflects its
popularity recently, being used for cloud-based high-               telecom industry origins; telecoms demand absolutely
performance computing that needs concurrency.                       minimal downtime. This makes it a good match
Erlang has concurrency 'baked in', with a set of                    for modern web and communications services
primitives that create processes and handle inter-                  (WhatsApp uses Erlang). The Erlang VM handles all
process communication; these processes form the                     the scheduling and load-balancing, meaning that the
basic structure of an Erlang program. Erlang also                   programmer doesn't have to.
avoids the problem of mutable shared data and lock                     Another approach to parallelisation is the language
access by only passing messages and not having                      CUDA (or the open-source OpenCL), which utilises the



  A, B, C... D?
  C and C++ have been around for a long time and are hugely
  successful, as discussed in the previous section. D is
  intended as a re-engineering of C++, keeping its good parts
  and in particular its performance, while making it more
  convenient for programmers, taking inspiration from the
  lessons learnt from practical programming experience in
  C++. It ditches some C++ features, and adds a bunch of
  extra ones, including unit tests, garbage collection, and
  various array features. It also adds an inline assembler;
  illustrating that, like C/C++, D is intended to allow the
  programmer to access low-level processor features as
  required. Its creators claim that D is suitable for everything,   Compiling D with the gdc compiler. (All those error
  from high-performance back-end code to quick-and-dirty            messages are just one missing semi-colon.) Note the
  scripting.                                                        need to specify output file with -o.




                                                                      www.linuxvoice.com                                                                91
     CODING COMPUTER LANGUAGES

                                                                                               Swift was released in mid-2014, is growing very fast
                                                                                           and is now open source. According to Apple, it's all
                                                                                           about "protocol-oriented programming". Protocols, in
                                                                                           Swift, are rather like interfaces; and in Swift, instead of
                                                                                           creating classes and subclasses, you are encouraged
                                                                                           to create protocols and then create types and structs
                                                                                           that use them. Protocols can also be extended with
                                                                                           default behaviours. This makes Swift highly flexible; in
This is a Swift playground
                              processors in modern graphics cards (GPUs) when              particular because a type can have multiple protocols
on OS X, with code on the
left, results on the right,   they're not in use for graphics, thus running in parallel.   very easily, whereas multiple class inheritance is not
and a pop-up box showing      This works really well for certain problems, and is          possible in all languages and can be top-heavy where
the result of a particular    popular with academics. Effectively, CUDA translates         it is possible. Protocols can also be used by more
line. Playgrounds aren't      the data into graphical form and then uses the GPU           than just class types. It's also easy to extend existing
(yet?) available on Linux,    to 'look' at and analyse it, as GPUs are optimised for       protocols using the extension keyword, at which point
though the language as a      image manipulation.                                          anything that conforms to this protocol now also
whole can be downloaded          Perl 6 and Clojure are also being promoted as             conforms to your extension.
from swift.org.
                              suitable languages for solving concurrency problems.             Conveniently, Swift co-exists with Objective C in
                              Clojure (a variation on Lisp) is intended to make it         the same app, so developers can move over to it
                              "simpler to design and implement parallel algorithms",       easily. It also includes a lot of interactive development
                              and compiles down to the JVM. Perl 6 introduces easy         technology, in particular the "playground" section
                              (or easier) concurrency in a dynamic programming             of the IDE, which enables the developer to try out
                              language. However, it's anyone's guess when Perl 6           pieces of code. (This is also explicitly aimed at helping
                              (or rather, a complete implementation of the Perl 6          people learn to code.) And there's a strong incentive
                              standard) is actually going to be released.                  for developers to move over to Swift, because there's
                                 Google's new language Go (unveiled in 2009) is            such a huge market for iOS/OS X software, and it has
                              designed to handle concurrency well, although the            such a low barrier to entry. If you're starting out in the
                              major aim was for Go to be hugely clean and "simple          Apple universe, you'd choose Swift over Objective-C,
                              enough to hold in one programmer's head". Go is              and even if you're already an Obj-C coder you might
                              compiled, statically typed, and aimed at systems             well jump ship.
                              programming. (As of this year, it's also available               Swift shows off a few modern coding ideas – high
                              for mobile device and smartphones, another nod               preference for flexibility and speed of development,
                              to the importance of mobile-first coding.) Go code           and a fondness for interactive development
                              is intended to be concise and readable, and, rather
                              like Swift (see below), it uses interfaces and type
                              embedding over virtual or non-virtual inheritance.
                                                                                             Big Data
                              Flexibility, fast development, and a certain kind of           The growing importance of big data means that R (a
                                                                                             statistical language, around since 1997) is becoming much
                              simplicity are important. See p84 for our tutorial!
                                                                                             more popular, and is used by companies such as Google,
                                                                                             Facebook, and the New York Times. However, it's suggested
                              Web-first and mobile-first                                     that it can be slow with big data sets and is better used for
                              The other big current coding issue is web-based and            prototyping than for building models. Matlab (a numerical
                              mobile-based coding. More and more software is run             programming language) has always been heavily used in
                                                                                             the scientific community but opinion is divided on whether
                              in browsers (the ultimate example being ChromeOS),
                                                                                             it is on the way out or not. The big recent improvements in
                              which makes JavaScript and other web languages                 Python's maths and statistical libraries may make Python a
                              increasingly important.                                        more appealing choice for numerical programming. IPython
                                 Currently JSON is the data-object format of choice,         and NumPy (designed to make Python competitive with
                              with libraries in every major language, and web                Matlab for numerical computing) are good for scratchpad
                                                                                             use, and Python's data community has many toolkits
                              services are RESTful; but 10 years ago it was all about
                                                                                             available. Matlab definitely still has its niches though,
                              XML and SOAP. So in another 10 years will we look              despite being an expensive piece of non-free software. Both
                              back from a similar distance on JSON and REST?                 Matlab and R have parallelisation packages available.
                              Web-coding is still moving pretty fast, so this is one of          Julia is similar to Python, but runs much faster. It's
                              the most likely areas for things to change noticably in        created specifically with scientific number crunching
                                                                                             in mind, with powerful concurrency and networked
                              the reasonably near future.
                                                                                             programming facilities, and interfaces available with
                                 The importance of mobile-first coding suggests              Fortran and C library routines. With the week-long runtimes
                              that Java will be around for a while, as Android (a            of some scientific computing, the increase in speed that
                              version of Java) has the majority of the smartphone            Julia provides is important (taking 1 second rather than
                              and tablet market. The other big chunk of that market          4 isn't a big deal; taking a week rather than four weeks
                                                                                             definitely is). Julia is super-fast, potentially more scaleable
                              belongs, of course, to Apple and to iOS; making Swift,
                                                                                             than Python, and easy to learn; but the community is in the
                              Apple's new iOS/OSX/watchOS language, which                    early stages, and currently it just doesn't have the libraries
                              replaces Objective C, one of the most important                and toolkits to compete with Python or R.
                              languages to watch.



92                                                            www.linuxvoice.com
                                                                                                 COMPUTER LANGUAGES CODING

                                                                     Automated testing, test-first coding, push-on-green,
  The Internet of Things                                          and other similar practices can also make for tighter,
  The Internet of Things is the newest buzz-phrase and no         more reliable code, if used properly, and thus for less
  one quite knows where that's going. Some applications           time spent fixing bugs after software deployment.
  are straightforwardly nonsense (the classic 'smart fridge',     Improvements in version control systems, commit
  for example), but the 'internet of things' covers a lot of
                                                                  hooks to fire off automated tests, and so on, certainly
  ground, and other parts of it do make more sense. This
  certainly has the feel of something that really could change    mean that a programming job looks different now
  dramatically in the foreseeable future, and if that happens,    from how it did 10 years ago (and still more compared
  then changes in coding languages, and perhaps in coding         to 30 years ago).
  practice, are very likely to follow. Might 3D printing evolve
  to the point where we need compilers that compile actual
                                                                  Farther Future
  objects, rather than code? What would that even look like?
                                                                  Is Moore's Law coming to a slowdown? Does this
                                                                  suggest that something else will take its place, the
environments and for code automation (the compiler                same way that integrated circuits replaced transistors
will make suggestions for you to improve your code).              (which in their turn had replaced relays and vacuum
                                                                  tubes)? Ray Kurzweil argues that this will happen, and
Coding: learning and practice                                     tips nanotubes for the most likely replacement. (He
There's a lot more available for younger coders than              also argues that computational capacity will continue
there used to be. Raspberry Pi and Scratch are both               to grow exponentially, which leads to a bunch of stuff
supporting different ways of learning to code, and                about the Singularity that I am not going to get into.)
learning for quite young children (especially Scratch).           Reconfigurable hardware is another idea being thrown
Robots Dash and Dot also aim to introduce the ideas               around, and is starting to be implemented in limited
behind coding to young kids, and then support them                ways. New hardware often drives new software, and
in learning slightly more complicated ideas and                   without knowing what exactly what that will look like
algorithms. The focus is on solving problems in a                 (if it happens), it's nearly impossible to make
coding-type way. A new generation of coders coming                predictions about it.
up from this background might tackle programming                      Looking at the last 40 years, however, hardware has
and languages in a brand new way.                                 changed a fair amount, and software has changed
    Coding jobs are also starting to look different. More         along with it, but we are still using some of the same
coding in the cloud and easier code-sharing means
that teams might be spread across the world and                      What's fascinating is the way that new
never or rarely meet one another. Cloud deployment
means that you might not know the sysadmins                          purposes and new problems will arise,
responsible for deploying and managing the software
you write in the same way that you might have done
                                                                     and how programmers will solve them
at one time. Then again, there's more scope now
for writing software that is accessed from your own               languages that were popular then. By extrapolation,
servers, rather than sending out disks to be installed            therefore, we'll still be using some of the languages
on a client's systems.                                            we're using now in another 40 years' time. Coding
    Various forms of increased automation give                    practices have changed, though, and the languages
programmers more time to focus on the important                   have often changed along with them. Modern Fortran
stuff. Libraries, frameworks, APIs and plugins mean               looks a fair bit different to original Fortran; Java 8 is a
that programming can now be more about sticking                   long way away from Java 1.
existing things together than about writing entirely                 The fundamental problem is that no single
new things – but that also frees you up to focus on               language can possibly have every feature any
the global application logic, and widely-used libraries           programmer could ever want, because some of them
and frameworks make for more exhaustive user-                     are incompatible with one another. So any vision of
testing and thus fewer bugs. Python's recent growth               the One True Programming Language is doomed
is partly a reflection of the expansion of its libraries,         from the start. (Though many languages compiling
making it easier to stick scripts together quickly. A             onto a single virtual machine that then runs on many
problem can be if multiple competing frameworks                   other machines is more feasible.) We'll always have
exist; knowing which to use may be a challenge, and               multiple languages for multiple purposes, and we'll
it reduces some of the advantages of having shared                always have multiple programming paradigms for
frameworks in that the user base for each framework               multiple purposes. What's fascinating is the way that
will be smaller.                                                  new purposes and new problems will arise, and how
    IDEs and other code extensions can also generate              new programmers will find new ways to solve them,
more code for you, especially in boilerplate-heavy                with languages both new and old.
languages. An example is JavaScript, where updates
like CoffeeScript and Less.js are making it easier to              Juliet Kemp is fluent in over 6,000,000 forms of
                                                                   communication, including esoteric languages such as Perl.
write JavaScript and complicated CSS.



                                                                    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.

                                  Asynchronous Disk I/O
                                  Spawn tons of disk I/O requests, and do something else while they
                                  are in flight. Just like with sockets, albeit without `epoll()`.


                                  B
                                          ack in LV016, we dealt with asynchronous                read(fd, buf, sizeof(buf));
                                          networking I/O. This way, network services                Here, read() won't return until it puts some data in
                                          serve one request while waiting for a database          buf, or an error occurs. Sequential execution is easy to
                                  to supply data for another. Asynchronous I/O greatly            reason about. The downside is this code can't do
                                  improves the service's capacity. No wonder it is a              anything useful while it waits for read() to complete,
                                  workhorse behind many popular web frameworks, like              and it can take time on a busy disk.
                                  JavaScript's Node.js or Python's Tornado.                         One can also set fd to non-blocking mode:
                                     But network services rarely exist in the void. The           int fd = open("somefile.txt", O_RDONLY | O_NONBLOCK);
                                  data they serve ultimately comes from some storage,                 Or, via fcntl() system call:
                                  often a file. If access to this file is blocked, it stops the   fcntl(fd, F_SETFL, O_NONBLOCK);
                                  entire event loop. This hurts performance and is                  In non-blocking mode, if read() can't complete
                                  something we'd rather avoid. Is there a way to treat a          immediately, it returns (-1) and sets errno to
                                  file asynchronously, like a socket? Meet a rather               EWOULDBLOCK, or EAGAIN if fd is a socket. It is quite
                                  obscure and often misunderstood Linux feature:                  common to check for both:
                                  asynchronous disk I/O!                                          res = read(fd, buf, sizeof(buf));
Blocking vs Asynchronous
I/O time diagram. The                Traditional file access is blocking. This doesn't scale      if (res < 0 &&
latter interleaves I/O and        very well, yet it makes code more straightforward:                  (errno == EAGAIN || errno == EWOULDBLOCK)) {
processing, resulting in          char buf[1024];                                                     /* handle gracefully */
better capacity.                  int fd = open("somefile.txt", O_RDONLY);                        }
                                                                                                    Of course, you can busy yourself waiting for the
                                                                                                  descriptor until read() succeeds, but it would be rather
                                                                                                  inefficient. You may think about feeding fd to epoll()
                  Blocking I/O                      Asynchronous I/O                              or similar (LV016) – it worked for sockets, didn't it?
                                                                                                  Bad news everyone: this time, it won't. With epoll(),
                                                                                                  you'll simply get an EPERM error. poll() and select()
                                                                                                  will run, but immediately report fd readable regardless
                                                                           read () #1             of whether the read would block or not.

         read ()                                                          processing              Using threads
                                                                                                  Perhaps a more traditional (and more popular) way to
                                                                           read () #2             non-blocking file I/O is via threads. Threads are worth
                                                                                                  a Core Tech of their own (please drop us a line if you
                                                                       handle read #1             are interested in this subject), but in a nutshell the idea
                                                                                                  is simple. When you want to read data from a file, you
   handle read ()                                                                                 spawn a new thread. This thread issues a blocking
                                                                       handle read #2
                                                                                                  read() and waits for it to complete, while the event
                                                                                                  loop continues normally in the original thread. When
                                                                                                  read() returns, the main thread gets some notification.
                                                                                                  Threads execute in parallel, so this is much like the
                                                                                                  behaviour we are after. No wonder many applications



94                                                                  www.linuxvoice.com
                                                                                                                             CORETECHNOLOGY

and frameworks take this route. Say, Node.js (or, more
precisely, libuv) behaves exactly this way.
  Threads have their own issues and arguably make
your code harder to debug, but it's only part of the
story. The real problem is that threads are a rather
costly abstraction to create and maintain. The latter is
usually mitigated with so called "thread pools": your
create a number of threads (say, 32) in advance and let
them idle. To defer something to a thread, one posts a
message to shared queue to which all threads "listen".
The first thread to "hear" the request handles it. If a
thread remains idle for some time, the application may
decide to kill it. Similarly, if the application detects that
                                                                                                                                Our samples print hash
threads in the pool are mostly busy, it may spawn               (which is recommended) at the beginning of main():
                                                                                                                                marks to show you they
additional ones to increase the capacity.                       struct aiocb request = { 0 };
                                                                                                                                can do something while
                                                                request.aio_fildes = fd;                                        data loads from the disk.
POSIX AIO                                                       request.aio_offset = 0;
Asynchronous file I/O (AIO) APIs in Linux come in two           request.aio_buf = buf;
flavours. Both provide a way to issue (or enqueue) an           request.aio_nbytes = LARGE_CHUNK;
I/O operation, to retrieve its status as it finishes, and       request.aio_sigevent.sigev_notify = SIGEV_THREAD;
to cancel the operation you are no longer interested            request.aio_sigevent.sigev_notify_function = &handle_
in. Both have some notification mechanisms to                   read;
tell your application the operation has completed               request.aio_sigevent.sigev_value.sival_ptr = &request;
(that's the main idea). The difference is in design,               Here, we set the descriptor (aio_fildes), the buffer to
implementation, and (naturally) interfaces (function            receive data (aio_buf), and the number of bytes to
names, structures and so forth).                                read (aio_nbytes), as in ordinary read(). aio_offset is
   The first API we are going to cover is POSIX AIO. As         file offset, as in pread(), but it's not optional here.
the name suggests, it's part of the POSIX standard              Asynchronous requests can complete in any order, so
and is available across many Unixes (which is good).            "current file position" doesn't make sense. There are
Note that POSIX dictates interfaces, not                        some additional fields you may want to fill; consult
implementations: we'll revisit this point later. On Linux,      aio(7) for details.
the POSIX AIO comes in librt (a part of Glibc) with             request.aio_sigevent.sigev_notify = SIGEV_THREAD;
other fancy stuff like POSIX message queues and                 request.aio_sigevent.sigev_notify_function = &handle_
process timers. Most POSIX AIO calls have the aio_              read;
prefix, and they are declared in aio.h.                         request.aio_sigevent.sigev_value.sival_ptr = &request;
   POSIX AIO has two main notification means: a                    Then comes the callback. Here, we opted for thread
signal, and a threaded callback. Neither are                    notify (SIGEV_THREAD), and send it a pointer to the
particularly convenient for applications built around           request (sival_ptr). Generally you shouldn't let pointers
event loops, albeit signalfd may help you a bit (see            to stack-allocated values leave the function, but for
boxout). Notifications are configured per I/O request.          this simple example, it will work fine.
For a signal, you choose a number (usually SIGUSRx).               Finally, we kick off the operation with:
For thread notifications, you supply a function which           aio_read(&request);
executes "as if" it were an entry point for some thread.                The callback (handle_read) runs when it completes:
Either case, you may choose a value to pass to the              static void handle_read(union sigval sigval)
callback. It could be an arbitrary integer or void *. The       {
latter is commonly used to send a pointer to some                   struct aiocb *request = sigval.sival_ptr;
application-specific structure. It is much like the this            int res;
pointer in an object-oriented languages like C++.                   res = aio_error(request);
   Let's dissect a simple POSIX AIO example. It reads               if (res < 0) {
some (presumably large) file and prints a hash mark                     /* Request is still in progress or cancelled */
simultaneously, to prove the operation is really                    } else if (res > 0) {
asynchronous. You'll find the complete sources on the                   printf("\nError: %s\n", strerror(res));
LV website.                                                         } else {
int fd = open(argv[1], O_RDONLY);                                       printf("\n%ld bytes read\n", aio_return(request));
  First, we open a file. Note that ordinary blocking                    /* Use request->aio_buf to read the data */
mode is used, as asynchronous I/O and non-blocking                  }
I/O are different things. Then, we prepare the request.             done = 1;
POSIX AIO represents requests with struct aiocb,                }
which is the same for reads, writes and sync                      First, it checks if the request completed
operations. We allocate one statically and zero-fill it         successfully. If this is not the case, aio_error() returns



                                                                        www.linuxvoice.com                                                              95
     CORETECHNOLOGY

                                                                                              Linux AIO is generic API, but it was likely designed
                                                                                          with databases in mind. As such, it expects your code
                                                                                          to meet some requirements, which may look strange
                                                                                          unless you write a DBMS. You must open files with the
                                                                                          O_DIRECT flag to disable caching at kernel level. O_
                                                                                          DIRECT expects that userspace buffers, their sizes and
                                                                                          file offsets are aligned on a 512-bytes boundary. All of
                                                                                          this sounds like Linux AIO is better suited for
                                                                                          accessing raw devices (say, /dev/sda1) than
                                                                                          filesystem data. If you miss O_DIRECT, the code would
                                                                                          still compile and run, but may eventually resort to
                                                                                          blocking I/O. These requirements are not a problem for
                                                                                          a database engine, which usually works on pages
                                                                                          rather than bytes, implements custom caching
MySQL (and its clones)
                             a positive integer which is the same as errno for            strategies, and often operates on raw disk partitions.
implements Linux AIO
support through the libaio   synchronous requests. Next, we print the number of           POSIX AIO doesn't dictate buffering rules though, so
wrapper.                     bytes read. aio_return() yields what would be the            one can't implement it on top of Linux AIO. Linux AIO
                             return value of synchronous read() or write(). Finally,      provides asynchronous equivalents of fsync()/
                             the callback sets the flag that tells main() to stop:        fdatasync(), and vectored read/write operations. Other
                             /* Simulate event loop */                                    syscalls, like fallocate(), are not part of AIO.
                             while (!done) {                                                  Linux AIO has two notification channels. When an
                                 fprintf(stdout, "#");                                    operation completes, the kernel can send your
                                 fflush(stdout);                                          process a signal, as in POSIX AIO, or deliver the event
                                 usleep(LOOP_TIMEOUT_USEC);                               via eventfd. The latter is a Linux-specific mechanism,
                             }                                                            which plays well with epoll() and friends. This means
                                Note that we ignored all possible threading issues        it's easy to plug eventfd into an existing event loop. As
                             for simplicity's sake. The aio(7) man page provides a        you may guess, this makes eventfd a preferred way to
                             much longer and more elaborate example. It uses              get Linux AIO notifications in your code.
                             signal notifications, and also shows how to cancel the           Let's rewrite our example using native Linux AIO. At
                             request.                                                     the beginning, we create the "context" with io_setup():
                                Frankly speaking, POSIX AIO is rather unpopular in        #include <libaio.h>
                             Linux, and you'll hardly meet it in the wild. One            #define NR_EVENTS 32
                             exception is the lighttpd web server (www.lighttpd.          int main(int argc, char **argv)
                             net), which proudly introduced AIO support in version        {
                             1.5. However, lighttpd 1.5 was a preview release which           io_context_t ctx = { 0 };
                             dated back to 2009 and never became stable.
                                One reason is that many applications don't really
                                                                                               When everything is a file
                             need asynchronous disk I/O. Database management
                             systems or similar software that juggles gigabytes of             If you want something to integrate nicely with event loops,
                             data under heavy load can benefit from it. For the rest           it should be available as a pollable file descriptor. That's
                                                                                               why Linux wraps many traditional concepts, like signals,
                             of us, the game is often not worth the candle. Another,           into file descriptors.
                             and perhaps more compelling reason, is that Linux                     We briefly touched this topic in LV016. Now, let's focus
                             provides no kernel support for POSIX AIO. Under the               on two mechanisms: eventfd and signalfd. Both can be
                             hood, Glibc implements this API entirely in user space            used together with Linux AIO (albeit eventfd is preferred);
                             via threads, so all the usual limitations apply. Leave            signalfd may also be helpful in POSIX AIO. Note these
                                                                                               mechanisms are Linux-specific, and you can't use them in
                             POSIX AIO for using in portable code (if at all); Linux           portable code.
                             has something else to offer.                                          Eventfd is a generic event notification tool. It maintains
                                                                                               a counter, which write() increases or sets, depending on its
                             Native AIO                                                        mode. read() either decrements the counter or resets it, and
                             Linux has introduced "native" AIO in version 2.6. This            blocks if the counter is zero. epoll() and friends report the
                                                                                               eventfd descriptor readable if it has an event pending. For
                             is true kernel space implementation, yet unsuitable               more details, see eventfd(2).
                             as a backbone for POSIX AIO, as we'll learn shortly.                  Signalfd works in a similar fashion. You create it with
                             Linux AIO is also missing from Glibc, leaving you                 signalfd() and specify which signals you want to receive
                             with two options. First, you may use syscall() to run             through the descriptor. Usually, you also block "normal"
                             Arch-specific system calls directly by their numbers.             delivery of these signals with sigprocmask(). The descriptor
                                                                                               becomes readable if there are any of these signals pending,
                             Or, there is the libaio library (https://git.fedorahosted.        and read() yields one or more struct signalfd_siginfo
                             org/cgit/libaio.git), which wraps everything for you.             instances. The latter is mostly analogous to siginfo_t a
                             The wrapper is in fact rather thin, so many developers            "normal" signal handler receives. Again, refer to signalfd(2)
                             prefer the former. Our example will use libaio though,            for details.
                             to hide some small yet unnecessary details.



96                                                            www.linuxvoice.com
                                                                                                                       CORETECHNOLOGY

 char *buf = NULL;                                                                                                        iotop gives quick and
 int fd;                                                                                                                  accurate answers to many
 io_setup(NR_EVENTS, &ctx);                                                                                               questions regarding disk
                                                                                                                          I/O in your system.
 fd = open(argv[1], O_RDONLY | O_DIRECT);
 posix_memalign((void **)&buf, 512, LARGE_CHUNK)
  NR_EVENTS is how many concurrent AIO
operations we want the context to support. libaio
uses io_context_t as the context type, but native
syscalls use aio_context_t. You must zero-fill either
one, or io_setup() will complain. We also open the file
and allocate a properly aligned memory buffer with
posix_memalign().                                                        if (n_events > 0) {
  Next step is to prepare the request. Linux AIO                             cb = (io_callback_t)event->data;
represents requests with struct iocb. Conceptually, it's                     iocb = event->obj;
the same as struct aiocb, but libaio provides helper                         cb(ctx, iocb, event->res, event->res2);
functions to fill it:                                                    }
io_prep_pread(&request, fd, buf, LARGE_CHUNK, 0);                    }
io_set_callback(&request, handle_pread);                         }
res_fd = eventfd(0, EFD_NONBLOCK);                           }
io_set_eventfd(&request, res_fd);                               We wait for eventfd to trigger, and resume pending
io_submit(ctx, 1, &request_ptr);                             events as soon as it can to let it trigger again. Then,
   We also create a non-blocking eventfd and                 io_getevents() is called. It can block if no I/O events
associate it with the request.                               are pending in the context, but as eventfd has fired, we
   Finally, io_submit() is called to submit the request.     know there is something in. io_getevents() accepts
The second argument is the number of requests to             the context, and a minimum and maximum number of
submit, so one can enqueue them in batches. A tricky         events to grab. It returns the number of events stored
part is that io_submit() can also block for various          in the array that the events argument points to. If it's
reasons, like allocating something in the kernel. In this    non-zero, we execute the callback. event->data comes
toy program, it's not an issue, but in real code you'd       from request.data, which io_set_callback() filled with
probably call it inside the event loop. Another nuance       a pointer to the handle_pread() function. As before,
is that you should never fork() with asynchronous            handle_pread() checks for errors and prints the
operation in flight if you allocate buffers from the heap.   number of bytes read. Refer to the sources for details.
   The only thing left is to start the event loop. With      At the end of the program, we call io_destroy() to
most of the epoll() machinery omitted (LV016 has all         deallocate resources the context owns.
details), it may look like this:                                Several open-source projects implement Linux AIO
while (!done) {                                              support in their software. MySQL does this via libaio
 n_ready = epoll_wait(epoll_fd, &epoll_event, 1, LOOP_       for the InnoDB storage engine. Rspamd (www.rspamd.
TIMEOUT_MSEC);                                               com) builds on the raw Linux AIO syscall interface. It
 if (n_ready > 0) {                                          doesn't actually use AIO anywhere in the code now,
  if (epoll_event.events & EPOLLIN) {                        but has the test suite providing nice usage examples.
   read(res_fd, eventfd_buf, sizeof(eventfd_buf));           Database heavyweights like Oracle support Linux AIO
   n_events = io_getevents(ctx, 0, 1, &io_event, NULL);      as well, albeit they won't let you learn from them.




Command of the month: iotop
You probably know the top utility, which builds nice         how much time the process or thread slept waiting for
stats on CPU usage. iotop does the same, but for disk        blocking I/O to complete. SWAPIN is the same, but for
I/O. You must run iotop as root for security reasons.        swap. Use arrow keys to change the sorting column
The main screen shows the overall system stats and           (the current one is marked with >), and R key to
the list of processes. TOTAL figures display the             reverse sorting order.
amount of data transferred to a kernel block device             By default, iotop displays an instant snapshot of the
subsystem. ACTUAL measures the exchange with                 system's I/O. To show accumulated values instead,
physical storage, and it may not be equal to TOTAL           run it as iotop -a or press A. This is useful to see which
because the kernel caches data and reorders I/O              task consumed most I/O bandwidth in the long run. It
requests for optimum performance.                            is also possible to run iotop in batch (non-interactive)
   Below it is per-process statistics. To toggle             mode and save its output to log files (LV025). In
processes not doing any I/O now, press O, or run the         interactive mode, press I to assign a thread different
tool as iotop --only. The IO column gives a clue on          I/O priority. ionice(1) describes the options.



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




Final thoughts, musings and reflections
                            Nick Veitch
                            was the original editor                                                                     I’m lucky enough to live by a
                            of Linux Format, a                                                                          river and work from a shed right
                            role he played until he                                                                     alongside.
                            got bored and went
                                                              I try to keep everything
                            to work at Canonical              else clutter-free.
                            instead. Splitter!
                                                                                                                                  Yes, it’s a Mac, but
                                                                                                                                  the build quality
                                                                                                                                  and battery life is
                                                                                                                                  exceptional.




S
         o, Microsoft has decided to port one
         of its flagship products, SQL Server, to
                                                               A worn Rubik’s cube,
         Linux. By 2017, you could all be
                                                               which I’m not great
querying MS’s finest for your WordPress                        at (2 mins),
blogs if you so wish (and want to stump up
the cash). We are expected to believe this is
part of some “Redmond Spring” where
friendly competition is embraced and not
compared to deadly diseases.
   It is perhaps just as likely though that the
not-so-evil empire has realised that for SQL                                             KDE is now running
                                                                                         mostly in tiled mode
Server to compete in future, it really has to                                            with 4 different
run on Linux. All of its main competitors do.                                            desktops.
And where once the argument could be
made that people choose services, not
operating systems, that doesn’t hold true in
the cloud to the same extent. And the cloud
is where everything is.
   Linux basically beats everything in the            MY LINUX SETUP
cloud (http://goo.gl/FFHpmI), and Linux
images are among the most popular even
on Microsoft’s own cloud platform, Azure.
                                                      TOM ORALS
So the decision to port SQL Server to what is         Regular reader and full time Linux user who lives by a river!
ultimately the only growing market segment
in which it can’t compete at the moment is a                What version of Linux are you                       It was Mandrake back in the late 90s.
bit of a no brainer. And the competition will               currently using?                                    I’ve used KDE ever since.
do everyone good – SQL Server is fast and                   I’m using Arch Linux. I know it’s
robust (at least on Windows), so no doubt                   become a little notorious for name                  What Free Software/open source
Oracle is examining its strategy and code             dropping, but I love the package availability             can’t you live without?
also. It’s such a good idea, and it’s interesting     and git-based AURs.                                       The kernel? Other than that, Bash,
to think of what might follow (Active                                                                           perhaps.
Directory anyone?). But still, there is a tingle              And what desktop are you using at
of that old Ice Fear – the hurrahs over this                  the moment?                                       What do other people love but you
announcement had barely died down when                        KDE – although the more I use it the              can’t get on with?
MS also revealed it had received its latest                   less of KDE I’m using. I mostly use it            I really don’t like Unity. There’s nothing
dollop of what it likes to euphemistically call       to tile windows.                                          visually appealing about the icons or
“IP licensing fees” from another Android-                                                                the palette. It looks and feels too clunky for
based tablet manufacturer. Microsoft                        What was the first Linux setup you           me, like a kiddie version of Linux.
certainly loves Linux, all the way to the bank.             ever used?



98                                                                www.linuxvoice.com
This is what we’ve done in the last 24 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