Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
20+ HOURS OF GUIDES | PLUS 16 FOSS PACKAGES, 4 DISTROS & TUTORIAL ASSETS
www.linuxuser.co.uk
RASPBERRY PI
UPGRADES
LINUX SHELL
10 awesome add-ons that you need to get now
www.linuxuser.co.uk
www.linuxuser.co.uk 3
Contents Terminal
Reviews
Subscribe 75 Minimal Twitter clients
& save! We test the leanest tools for tweeting
in both the terminal and the GUI
24 Save up to 50%
on the shop price.
US customers
can subscribe via
page 74
Rainbowstream Turses
ThelatestontheLinux
AG
Join us online for more Linux news, opinion and reviews www.linuxuser.co.uk
4
DOMAINS | MAIL | HOSTING | eSHOPS | SERVERS
NEXT GENERATION
1&1 CLOUD
SERVER
TRY FOR 1 MONTH FREE!
Then from only 9.99 per month*
1 TRIAL
TRY FOR
30 DAYS 1 CLICK
UPGRADE OR
DOWNGRADE 1 CALL
SPEAK TO
AN EXPERT
OPEN SOURCE
6
TOP FIVE
New features
in Fedora 22
1 New task-specic spins
The Fedora Project now offers three product lines,
each tailored for specic tasks: Fedora Workstation
for desktop and development use; Fedora Server for
traditional server platforms; and Fedora Cloud for
virtualisation and cloud use. This approach was rst
trialled with Fedora.next, on which Fedora 22
is primarily based.
BQ Aquaris E5 HD
or in bulk.
Ubuntu Edition
Bigger, better, but will it nally gain traction?
Canonical has announced that it is launching We have devised the BQ-Canonical
a successor to the BQ Aquaris E4.5 Ubuntu collaboration as a long term project. Our next
Edition smartphone dubbed the Aquaris E5 HD objective, which we are already working on, is
Ubuntu Edition, despite the lukewarm critical
reception of its predecessor.
convergence. We rmly believe in Ubuntu and
the philosophy behind it, added BQs chief
3 Boxes easier to use
Boxes, the stock application for handling virtual and
Based around a quad-core ARM Cortex-A7 executive ofcer Alberto Mndez of the ongoing remote machines, has undergone a signicant user
MediaTek processor running at 1.3 GHz, the new partnership between the two companies. We interface overhaul and now includes an improved
Aquaris has an improved 720x1,280 resolution share the same philosophy as them along with box creation assistant, the ability to send keyboard
IPS display, 16 GB of storage and 1 GB of RAM. the same commitment to the Open Source shortcuts and default-on display scaling for an
Optics are also considerably improved from its Initiative. At BQ, our goal is to help people improved experience.
entry-level predecessor, offering a 13-megapixel understand technology, encourage them to use
rear camera with Largan lenses and back-side it and inspire them to create it. That is why the 4 Builder IDE introduced
illuminated (BSI) sensor, and a ve-megapixel opportunity for creation that Ubuntu affords is Fedora Workstation now includes Builder, a new
front-facing camera. fundamentally important to us. integrated development environment for GNOME.
As with the original Aquaris E4.5 Ubuntu As with the original model, the BQ Aquaris As well as a vi editing mode and split-panel support,
Builder includes Markdown preview, API exploration
Edition, this device runs Canonicals Ubuntu E5 HD Ubuntu Edition is available to purchase
documentation and project creation, as well as
Touch smartphone platform. Bringing a new direct from BQ in a SIM-free, dual-SIM unlocked handling support.
operating system to market requires partners form, priced at 199.90 a 30 premium over the
who are willing to challenge the status quo
of the mobile industry, claimed Canonicals
smaller, lower-power version.
BQs Mndez has conrmed that his 5 Bi-annual releases
vice president of mobile Cristian Parrino of the company is working with Canonical to produce a From Fedora 22 onwards, the project has returned
to its bi-annual release cycle, permitting a more
launch. BQ is a fearless innovator whose risk convergent device capable of running desktop-
rapid development cycle than previously. As
with Ubuntu has already paid off the launch of class applications when connected to an external always, Red Hat will be contributing and using
this second device in Europe marks an amazing display, similar to the Ubuntu Edge concept Fedora as a proving ground for new technologies
milestone for both companies. smartphone, a feature missing from this launch. before integrating them into its offerings.
www.linuxuser.co.uk 7
OpenSource Your source of Linux news & views
8
DISTRO
SECURITY
DISTRO FEED
Top 10
(Average hits per day, 7 May 3 June)
6.
7.
CentOS
Manjaro
960
881
Microsoft accused
8.
9.
10.
Mageia
Arch Linux
elementary OS
875
771
717
of threatening MPs
Former strategy chief Steve Hilton speaks out
This month Software giant Microsoft has been accused We had the same from other tech companies
QStable releases (21) of threatening to close its facilities in the UK as well we had the stories from the MPs saying
QIn development (8) if members of parliament didnt block their [theyve] just had this call from sometimes a
plans to adopt open source software and open global CEO, phoning a Conservative MP saying
Fedora and openSUSE documents standards. we will close down this plant, Hilton continued.
continue to trade blows, Speaking at a publicity event for his book We just resisted. You have to be brave. You just
swapping fourth and
fth places since last attended by reporters from The Guardian, former have to say sorry: its the right thing to do.
month. Elementarys Conservative party strategy chief Steve Hilton While Microsoft remains a major supplier to
entry is surprising. described attempts by Microsoft to block a long- the UK government, its proprietary document
running plan to move government IT systems formats were rejected in July last year in favour
to open platforms and standards. When of the OpenDocument Format (ODF), PDF and
Highlights we proposed this [move], Microsoft phoned HTML formats, which are now the mandatory
Conservative MPs with Microsoft R&D facilities in document formats for all governmental
Fedora 22 their constituencies and said, we will close them departments in a bid to boost interoperability
This latest release of the Red Hat-based down in your constituency if this goes through, and also reduce dependence on proprietary
distribution comes in three branches: he claimed openly. software vendors.
Workstation, the desktop and developer build; Server,
for traditional use; and Cloud, a compact image for
deploymentonvirtualisationandcloudplatforms. UBUNTU
Tiny Core Linux 6.2
One of the smallest fully-functional Linux
distributions, the latest Tiny Core build gets
Kubuntu lead asked to step down
performance improvements and a 64-bit ISO capable
ofbootingonlegacyBIOSand(U)EFIplatforms. Jonathan Riddell accused of aggressive behaviour
Tails 1.4 The Ubuntu Community Council has asked The UCCs claim that it is entitled to choose
The amnesic Incognito Live System, a Jonathan Riddell to step down from his role as who they will recognise as their counterparts and
Debian-based privacy-enhanced bootable leader of the Kubuntu project in a move which representatives in sub-communities like Kubuntu
ISO, now includes a security slider used to modify the
hasriledothermembers. has led to backlash. I mention this as a warning
Tor Browser on-the-fly between ultra-secure and
ultra-functional as required. In an email to the Kubuntu Council, UCC to others in leadership positions in Ubuntu,
member elfy claimed that Riddell has become explained developer Scott Kitterman, who has
difficult to deal with, and that he was also stated he will leave the Ubuntu project as a result.
Latest distros argumentative to the point we feel he violated the You are very not free to criticise the [Ubuntu] CC.
code of conduct, listing several offences which Riddell has been reaffirmed on the Kubuntu
available: have resulted in an email requesting that he step Council and has indicated that he will continue
lesilo.co.uk asidefromleadershipintheUbuntuCommunity. in his role.
10
OPINION CODING
Finding anagrams
Learn to work with word signatures, and tackle programming
problems by identifying simpler sub-problems
Today we will focus on word anagrams. Now you just have to sort the letters of the @sign array.
You probably already know that an Please note that @sign can contain any letter multiple
anagram of a given word is a different times; the signature of panama should be aaamnp.
word that has exactly the same letters as the original. A simple run of the complete Perl program
Word anagrams have many applications, including (wordSignature.pl) produces the following output:
dictionaries, word processors, computer games,
scrabbles, password checking and more. Apart from $ ./wordSignature.pl
the practical applications, the whole problem is a Give me a string: persistent
good exercise for the mind because its important that The signature of persistent is eeinprsstt.
you see the problem from the right perspective before
trying to solve it. As wordSignature.pl implements the signature function,
The process is greatly simplied by introducing the you can easily use it and nd out if two words have the
concept of word signatures. The letters of the word same signature. Similarly, you can use the signature
sorted in alphabetical order compose the signature of function to correct or auto correct misspelled words.
a word. Signatures are the building blocks of anagrams To save processing time, you can pre-compute word
because words with the same signature are anagrams signatures for the dictionary le usually found inside
of each other! Therefore, hist, this and hits are Mihalis Tsoukalos /usr/share/dict on many Linux systems and store
anagrams; their common signature is hist. is a UNIX administrator, a them as (word, anagram) pairs. Then, a grep using the
programmer, a DBA and a
If you dont choose to use word signatures, nding a mathematician. He has used Linux signature of a given word will reveal its anagrams. You
solution will undoubtedly be very difcult, inefcient, since 1993 can also sort the words in respect of their signatures.
complex and slow. If you attempt to solve the problem by It is now time to look at the AWK implementation. The
nding all of the possible permutations of the letters in AWK script takes the same approach, so the AWK code
a given word, you might well fail miserably or develop a will remind you of the Perl code. The AWK script reads its
solution that would appear rather pathetic. A word with input from a text le as can be seen in the next output:
ten letters has ten (factorial) possible permutations, The presented
which is an enormous number. Checking which of the code will be in $ gawk -f signature.awk file_with_words
permutations are valid words would require many look- The signature of this is hist
ups to a dictionary, delaying the process even more. Perl because it The signature of that is ahtt
If you want to nd the anagrams of multiple words, is smaller than
then the whole process might take hours or even days The script ran using GNU AWK version 4.0.1 that is an
depending on the total number of words. C; you can try to improved version of the original AWK implementation.
The presented code will be in Perl because it is implement a C or Not only is the AWK version smaller than Perl, it also
smaller than C; you can try to implement a C or C++ processes every line of the input le without requiring
version as an exercise. As you will see at the end of the C++ version as any extra code! Nevertheless, the greatest advantage
column, you can even solve the problem using AWK! an exercise...you of AWK is that it makes you write clean code as you
From the denition of the signature term, you can can recognise by looking at the implementation of the
understand that you will need to be able to do some kind can even solve signature function. So, dont underestimate the power of
of sorting in your code; the presented code uses the Perl
sort function but you can use any algorithm you want.
the problem the AWK programming language.
Remember that sometimes you should simplify the
The following Perl code does most of the job as it using AWK original problem by transforming it into a simpler one.
separates the letters of a word and puts them into a new Where anagrams are concerned, the original problem is
variable named @sign: equal to two sub-problems: calculating a signature and
selecting words with the same signature.
for ($i = 0; $i < length($word); $i++) { You can nd the relevant source code at bit.
@sign = (@sign, substr($word, $i, 1)); } ly/1T0mcpj and at bit.ly/1KYLr5A.
www.linuxuser.co.uk 11
OpenSource Your source of Linux news & views
OPINION
12
KERNEL
Linux conferences
With the arrival of summer (in the northern hemisphere) comes not only
Linuss vacation, but also the 2015 Linux conference season. Over the
next few months, there is the usual range of Linux Foundation events
(these include LinuxCon, at which your author is a speaker once again),
as well as the Linux Plumbers Conference. Plumbers is the event where
plumbers those who are involved in making Linux go, and who
handle the glue between kernel and userspace get together to address
hot-button topics. This years event will be co-hosted with LinuxCon in
Ongoing Development Seattle, Washington. Its an event of the community, by the community
Paolo Bonzini began a very interesting thread titled KVM: and for the community, and is thoroughly to be recommended to anyone
x86: SMM support, which introduced support for SMM who is looking to get more involved in kernel work. You can find out more
(System Management Mode) on x86. SMM is a hidden about the tracks at linuxplumbersconf.org/2015.
feature of all x86 processors going back several decades. LinuxCon North America will be
It is used by platform vendors to hide various compatibility held on 17-19 August, with the Linux
glue, workarounds, hacks and things of this nature. For Plumbers Conference on 19-21
example, attempting to access a legacy x86 IO port August, and LinuxCon Europe will
for a floppy disk controller might trigger SMM code that be held in Dublin on 5-7 October.
emulates this via a USB device. SMM is also used by SMIs
(System Management Interrupts) to handle periodic
platform housekeeping (the NMI watchdog), as well as
certain government surveillance agencies who want to
hide spyware. If you wonder how SMIs are triggered, theyre
wired up in the LPC (Low-Pin Count Controller, formerly ISA
bus and part of the Intel PCH, or Platform Configuration
Hub, in modern x86 chipsets) and can be disabled entirely,
though in many cases this disables thermal management
and could cause your system to melt, catch fire or explode.
The operating system is typically completely unaware of
the presence of SMM, since it is at a higher privilege level
than even the kernel is operating at. Typically, entries into
and out of SMM mean only unaccountable time and extra
unwanted latency to the operating system (disclosure: the
author holds a United States patent on detecting SMM
OUR 24/7 POSTGRES SUPPORT
entry and exit precisely because of the latency concerns IS THE ULTIMATE SAFETY NET
and the need to demonstrate SMM/SMIs as a cause of
such) and thus it is more a necessary annoyance than
something kernel developers enjoy poking. But SMM is
also needed to handle secure roots of trust when booting
virtual guest operating systems. KVM will need to be able
to provide a certain amount of SMM emulation in order to
verify a trusted path for Secure Boot guest OSs.
Another hot topic this month (and every month in recent
times!) is that of how to handle persistent memory (on
non-volatile memory or NVM) storage. This new kind
of memory is directly mapped like RAM, but it might be
ginormous and hold its contents for decades at a time.
Consequently, there is a push to understand how to
support this memory without building a horrible house
of cards that will come crashing down within a few years.
Expert response guaranteed within 15 minutes
We will have a more detailed story on NVM in a future We offer unrivalled around-the-clock backup
issue (perhaps with a solution to the problems of how to to PostgreSQL users. Platinum Support
represent and handle it, if one is proposed by then). provides complete peace of mind.
The Fasthosts control panel completes the picture, with easy analytics and server management.
11.99
grade SSDs give you the highest throughput 1-24GB RAM (+ 33% bursts), up to
and lowest possible latency for the ultimate 16vCPUsand optional installed MS SQL
user experience. Server on Windows 2012 R2.
Terminal
command line with age will likely remember at the very least using the
infamous DOS prompt.
Now its 2015 and, even in Linux, you can spend
these essential
your entire time in the desktop environment and
never even touch the command line or terminal if
youre using the right distro. Thing is, youd be doing
yourself a disservice by not learning how to make the
controlling Linux
can use as well. So put on your best Nineties outt,
give yourself a bad nickname and get ready to look
like a movie hacker.
16
NEED TO KNOW
>_Get to grips with the
terminal before you take
on the advanced tools
>_001 ls >_009 Up
You can use ls to list the les and folders that Up on the keyboard has the very simple task of
Terminal
are inside the directory you are in. enabling you to pull up the last command that
was entered, to run it again or edit it.
>_002 cd
The cd command enables you to move >_010 Copy text
between directories on your system. Like the If youre in the terminal, you may want to copy
following, for example: text output to use somewhere. To do this, you
can use: Ctrl+Alt+C.
$ cd /home/user/
>_011 Paste text
>_003 cp If youve found a command online or need to
The copy command, or cp, can be used to paste some text into nano, you can enter any
copy les from one location to another. To do text on the clipboard with: Ctrl+Alt+V.
this use the command below: >_017 Search for hidden files
>_012 Open terminal and directories
$ cp file /home/user/Desktop/file This trick works in a lot of desktop environments: The ls command can be used in more than
a shortcut for opening the terminal can be done just the basic way of listing all the les in a
>_004 mv with: Ctrl+Alt+T. folder. To begin with, you can use it to list all
Similar to copy, mv instead moves the le to the hidden items along with the normal items
the new location, deleting the original le: >_013 sudo by using:
This lets you do commands as the super user.
$ mv file /home/user/Desktop/file The super user in this case is root and you just $ ls -a
need to add sudo to the start of any command.
>_005 rm
The rm command is for removing or deleting >_014 Access root >_018 Home directory shortcut
les and directories. You can use it like: The super user, or root, can also be accessed by The home directory is located at /home/user/
logging in as it from the terminal by typing su. in the absolute lesystem, but you can use
$ rm file You can enter the root user password and then the tilde (~) to signify the home directory when
run every command as root without having to moving between directories or copying, or doing
>_006 mkdir use sudo at all. mostly anything else like with the following, for
You can create directories with the mkdir example:
command using something like: >_015 Stop processes
If you have run a command and either its $ cd ~
$ mkdir folder paused, taking too long to load, or its done its
job and you dont need to see the rest of it, you >_019 Link commands together
>_007 nano can stop it forcefully by using either Ctrl+C or If you want to do a series of commands one after
Nano is one of the programs that enables you Ctrl+Z. Remember, only do this if the process the other, like updating and then upgrading
to edit text in les its vital for working and is not writing any data, as it is not safe in this software in Debian, for example, you can use
editing in the command line. You use it like so: instance and you could nd yourself in trouble. && to have a command run right after the one
before. For example:
$ nano file >_016 Access root
without password $ sudo apt-get update && sudo
>_008 Tab If your regular user is in the sudoers list (ie so apt-get install libreoffice
The Tab key enables you to auto-complete that they can use sudo in general to run things
commands and le names, and double- as root), you can access the su account by using >_020 Long terminal input
tapping lets you list all of the objects that sudo su. This uses your normal user password to Sometimes when using a list or anything else with
have a similar name. This auto-completion access root terminal functions. a long terminal output, you might not be able to
works with unambiguous le and command To add a regular user to the sudoers list, you read it well. To make it easier to understand, you
names. For example, r gives you refox would need to rst log in as the super user by can send the output to another command, less,
because no other commands begin with r. using su. Then, you would simply run adduser through the | pipe. It works like so:
If you get multiple hits, continue typing to username sudo (replacing username). Be
narrow the selection and then hit Tab again careful who you add to the sudoers list, though! $ ls | less
www.linuxuser.co.uk 17
Feature Master the command line
SYSTEM
ESSENTIALS
>_Go a step further and
learn how to control the
terminal that bit better
Terminal
Terminal
18
INSTALLATION
>_Managing your packages
and updating your system is a
key part of the command line
>_032 Debian: update repositories >_038 Debian: dependencies >_044 Red Hat: uninstall software
Debian-based (and Ubuntu-based) distros use Compiling differs between software and theyll Yum can also be used to uninstall any package
apt-get as the command line package manager. each have a guide on how to go about it. One you have on your system, whether you installed
One of the quirks of apt-get as a package problem you might face is that it will stop until it directly from yum or not. As long as you know
manager is that before upgrading or installing you can nd and install the right dependency. the package name you can uninstall with:
software, it does not check to see if theres a You can get around this by installing auto-apt
newer version in the repositories. Before doing and then using it during conguration with: $ sudo yum remove package
any installation in Debian, use:
$ sudo auto-apt run ./configure >_045 Red Hat: force install
$ sudo apt-get update The force install function on Red Hat and
>_039 Debian: force install Fedora-based Linux distros requires that you
>_033 Debian: install software Sometimes when installing software, apt-get have a package downloaded and ready to install.
Unlike a graphical package manager or software will refuse to install if specic requirements You can download things with yum and then
centre, you cant quite search for the kind of arent met (usually in terms of other packages force the install with:
packages you want to install, so you need to needing to be installed for the software to work
know the package name before installing. Once properly). You can force the package to install $ sudo yum install --downloadonly
you do though, try: even without the dependencies using: --downloaddir=[directory] package
$ sudo rpm -ivh --force package
$ sudo apt-get install package $ sudo apt-get download package
$ sudo dpkg -i package >_046 Red Hat: manual install
>_034 Debian: update software RPM is one of the package installers on Red Hat
You can upgrade the software in Debian from >_040 Debian: install binary distros and can be used to install downloaded
the terminal by rst performing the repository In Tip 39, we used dpkg -i to install the binary packages. You can either do something like in Tip
update command in Tip 32, followed by the installer package that we downloaded from the 45 and download the package from the repos, or
upgrade command below: repositories. This same command can be used download it from the Internet and install with:
to install any downloaded binary, either from the
$ sudo apt-get upgrade repos or from a website. $ sudo rpm -i package
>_035 Debian: uninstall software >_041 Debian: manual >_047 Red Hat: force
As part of package management, apt-get force install package manual installation
enables you to uninstall software as well. This If the advice in Tip 39 is still not working, you can As in Tip 45, you can use RPM to force install
is simply done by replacing install with remove force install with dpkg. To do this you just need packages if theres a dependency issue or
in the same command that you would use to to add the option --force-all to the installation something else wrong with any other packages
install said package (Tip 33). You can also use command to ignore any problems, like so: that you have downloaded. The same command
purge instead of remove if you want to delete any should be used as in Tip 45, with the -ivh and
cong les along with it. $ sudo dpkg --force-all -i package --force options present.
>_036 Debian: upgrade distro >_042 Red Hat: update software >_048 Fedora: distro upgrade
Debian systems can often update to a newer Unlike apt-get, the yum package manager for Yum has its own distribution upgrade command,
version, especially when its rolling or if theres a Red Hat/Fedora-based distros does not need but only in Fedora and they prefer you not to use
new Ubuntu. Sometimes the prompt wont show you to specically update the repositories. You it unless you have to. Nonetheless, you can use
up, so you can do it in the terminal with: can merely update all the software using: the fedora-upgrade package in yum with:
$ sudo apt-get dist-upgrade $ sudo yum update $ sudo yum install fedora-upgrade
www.linuxuser.co.uk 19
Feature Master the command line
SEARCHING
WITH GREP DEVELOPMENT
TIPS
>_Some terminal tricks for devs
to help your command line skills
>_Search within become more efcient
les using the grep
command to save time >_054 Stop a system service Terminal
and nd what you need A system service is the kind of background
software that launches at start up. These are
controlled by the system management daemons
>_049 Search a file for a term like init or systemd, and can be controlled from
The basic use of grep is to search through a file the terminal with the service command. First,
for a specific term. It will print out every line with you can stop a service using:
that term in, so its best to use it with system
files with readable content in. Use it with: $ sudo service name stop
20
FILE
>_063 Unpack a ZIP file >_070 Create a new SSH key
If youve downloaded a ZIP le and you did it from When you need to generate a strong encryption
the terminal or youre working from it, you can to key, you can always have a go at creating it in
PERMISSIONS
unpack it using the unzip command. Use it like so: the terminal. You can do this using your email
address as identication by entering the
$ unzip file.zip following into the terminal:
www.linuxuser.co.uk 21
Feature Master the command line
$ rhythmbox-client --next
Terminal
>_080 Pause video Terminal
You can use Mplayer to launch video from the
command line to watch. Its good for testing
a video with different settings that you can
afx to the video-playing command. What
you can also do is control the playing video
with keys specically, you can pause by
using the space bar.
>_081 More video control >_085 Current location >_086 Move directories
Mplayer gives you a few more controls while In the terminal you might nd yourself a When moving between directories you
playing in the command line. You can use little lost in the lesystem, or want a quick might want to be able to quickly return to the
Enter to skip to the next item in a list, and and easy way to pipe your current location previous one that you were using. Instead
otherwise, you can stop playback by using into something else. You can print out your of using cd for moving to the directory, you
Ctrl+C to end the process entirely. current absolute location using pwd. can instead use pushd to move and create a
stack of directories to move between.
22
TERMINAL JOKES
>_090 Change image formats
Instead of loading up an image editor like GIMP,
you can actually change images in the terminal
using the convert command. You can very
simply use it to change the letype or even
change the size. Do it with: >_Easter eggs, gags and other attempts by
$ convert image.jpg image.png patterless software engineers to be funny
www.linuxuser.co.uk 23
SPECIAL SUBSCRIPTION OFFER
OVERSEAS
READER SPECIAL
6 ISSUE
OFFER
EP GUIDES
STEP-BY-ST OJECTS
E ENTIAL
T
T-FILLED
Y PI PROJEC E
RASPBERRAZINE IN EVERY ISSU
MINI MAG
YOUR DETAILS
Title First name
EVERY
Surname
Address
ISSUE Postcode
Telephone number
Mobile number
Country
enterprise vendors
Name and full postal address of your Bank or Building Society Originators Identification Number
To: The Manager Bank/Building Society
5 0 1 8 8 4
Address
Creative Raspberry Pi
Reference Number
hardware reviewed
Bank/Building Society account number
Date
Banks and Building Societies may not accept Direct Debit instructions for some types of account A6 instruction form
Never miss an issue Please tick if you do not wish to receive any promotional material from Imagine Publishing Ltd by post Q
by telephone Q via email Q
Please tick if you do not wish to receive any promotional material from other companies by post Q
by telephone Q Please tick if you DO wish to receive such information via email Q
www.linuxuser.co.uk 27
Tutorial VPN server
Create
new keys
06 Enable the rewall
Once youve saved these new settings you can
nally enable ufw for use. To do this in the terminal youll
If you wish to give it a different name, youll have to start editing
the OpenVPN cong les that reference server.key and server.
crt. For now then, we will refer to it as server and you can
If you want to keep want to type: change it if and as you wish.
creating keys for
different clients then # ufw enable
you can just repeat
Step 15 and give a
It will ask you if you really want to enable ufw, to which you
different name to the
client. Try to keep can type y to conrm. It will inherit all of the settings weve
the names different just modied and added, which will ultimately enable us to
so that you wont get reroute trafc from a client system.
any clashes occurring
within the system.
07 Check the rewall status
You can check the status of the rewall using ufw
status at any time it will let you know whether its on or not
and what rules and actions are currently being taken on certain
ports. It only shows what the ports are doing when on, though. 11 Generate parameters
We need to generate a Dife-Hellman parameter
for the key exchangce this is a secure way of exchanging
# . ./vars
It will warn you that by running clean-all you will be deleting all
the current keys. As theyre old and we dont run them, we are
going to do exactly that:
# ./clean-all
09 Easy variables
We need to change the variables for RSA so we can
create keys for our specic purposes and location. To do
# ./build-ca
NAME line below these details. For the sake of making this
tutorial easy, change it to: 14 Turn OpenVPN on
We now need to move the keys to a location that
OpenVPN actually expects to see them; in this case its /etc/
export KEY_NAME=server openvpn. We need to do the move using:
28
15 Create a key for
the client
# cp /etc/openvpn/easy-rsa/keys/{server.crt,server.
key,ca.crt} /etc/openvpn Once youve set up a way to connect
Once thats done, you can nally start the server ready to
to the server from clients, you can
receive clients by using:
begin testing the server out
# service openvpn start
Use service openvpn status to check if its properly on or not. 17 Move les to client
Once all the keys and example les are set up, you
need to move certain les to whatever client you want to use
Again, dont give it a password or optional company info, and The other two les are used on every client, and they are:
make sure you agree to sign the certicate and commit it.
/etc/openvpn/easy-rsa/keys/client.ovpn
www.linuxuser.co.uk 29
Tutorial ERPNext
30
02 Set up users
and permissions
# wget https://raw.githubusercontent.com/frappe/
bench/master/install_scripts/setup_frappe.sh
ERPNext offers the complete
# sudo bash setup_frappe.sh --setup-production
spectrum of resource planning
The rst command downloads the script setup_frappe.
sh and the second command executes it on your system.
tools, from CRM and HR to asset
If everything is ne you will get a conrmation message.
You can then access ERPNext at http://localhost:80.
management and accounting
Note that the passwords are generated dynamically for
this installation process; you can nd them at ~/frappe_
passwords.txt. Now log in as admin using the username
Import
Administrator and password from the passwords le. After the data
the rst successful login, the setup wizard will ask you If you already have
to provide several details related to the admin user, your some ERP-related
company, taxes, customers and suppliers. You can either ll data from a previous
them or skip them to do later. tool or manual
entries, you can easily
import them into
www.linuxuser.co.uk 31
Tutorial ERPNext
Show/
Hide feature
ERPNext enables
you to manage
the applications
you want to be
shown on the home
page, so you can
keep the interface
uncluttered. To hide
an application, click
the All Applications 04 Price lists
All the products and items that you may need to
button on the home
page and a list of
all the applications
procure, or the nished products that your organisation
sells, need to have prices associated with them. Now, prices
are no longer just the function of cost; there are several
06 Make a brand
Branding is another very important aspect of a
business. As they say: act big, even if you are small. So, every
appears. Scroll to
other factors affecting them like customer, currency, region time you as a business communicate with an external entity,
the applications
that are not required and shipping costs. In such a dynamic scenario it is almost it is important to get your brand noticed. ERPNext has a
and uncheck the mandatory to have different price lists based on different feature called Print Format that will help you achieve this.
checkbox against parameters. Thankfully, ERPNext supports price lists and Print format lets you dene the format for a document type.
them. Then thats it! you can maintain as many different ones as you like. You This way, whenever a new document of that type is created,
The applications will can access price lists under the Buying, Selling or the Stock it automatically takes the form as dened in Print Format. To
be removed from the
sections. Just go to Buying/Selling/Stock>Setup>Price List get started, go to Setup>Printing and Branding>Print Format
home page.
to see the list of price lists. Note that there are two default to be able to see the list of predened print formats. To add
lists already created by the system. a new one, click on the New button in the top-right corner.
Now click the New button in the top-left corner. Fill in the On the next page, set the document type for which this print
details and tick the buying or selling checkbox based on the format is applicable. You will then need to write the HTML for
type. Then click Save and you have the new price list ready. the page; you can refer the Bootstrap CSS framework and
Jinja template designer documentation.
05 Workflow
Workows are an integral part of an organisation,
07 Buy
With the background set, lets head to the basic
business functions: buying and selling products. An
and ERPNext doesnt let you down in this area. Lets see how enterprise resource planning system must enable you to
to implement workows based on roles: the rst important properly manage these two things and ERPNext does that
thing to note here is that workows are applicable to too. While on the home page, click on Buying. The rst option
document types in ERPNext, and so you need to know the under Downloads is Supplier this works as the supplier
document on which your workow will be based. To add database, so add all your suppliers here. Once you click
a workow, go to Setup>Workows>New Workow, then on a supplier, all the related documents like quotations,
click on the Make a new workow button. Next, enter the purchase orders, receipts and invoices are shown along
workow name and the applicable document type. Now with their basic info, contact details and communication
you need to set the states of the workow and the roles history. So, this is your one-stop shop to deal with almost
allowed to edit the workow in that state. For example, in a everything related to suppliers. Next is the Material Request
typical leave application workow the states will be either list to help you add requests for a raw material, and then
approved, pending or rejected (the default states available), Supplier Quotation and Purchase Order follow this. The
and the role allowed to edit the workow will be the HR Contact and Address elds help you manage the contact
Manager. You can also add new workow states while details, and nally, Items is the place to nd or add the list
editing the row. The next step is to add the transition rules, of raw materials that you need to procure. Also, note that a
ie the steps that will change the state of the workow for few options here like Contact are accessible via different
example, the transition approve will change the state of a sections too, so if you make changes in one place then they
leave application from pending to approved. will be visible elsewhere as well.
32
09 Invoices
08 Sell
To manage sales, click on the Selling section on the
home page. The rst option here is Lead a database for Youll nd almost all the major HR
potential customers, similar to CRM tools, you can track
conversations and convert leads into customers. Second is
management features: employee
the Customer, for people/organisations who have already
bought something. The third option is Opportunity; the main
records, leave applications, expense
difference between a lead and an opportunity is that leads
are people or organisations that may buy, while opportunities
claims, attendances, salary slips
are leads that are denitely looking to buy. This means that
you can only create an opportunity if certain criteria are
met for example, the lead liked your product demo. Also,
an opportunity can only be created by using either a lead or
10 Human resource management
ERPNext is a huge tool and covers almost all of the
important aspects of a business. So talking of important
a customer. The fourth option is Quotation, for quotes to the aspects, we just cant ignore HR management. To nish,
customer or leads. Fifth is Sales Order, listing the conrmed lets see how to manage human resources in ERPNext.
orders. The last three options are same as the Buying section. As you log in, you can see the Human Resources section
on the home page. Click to enter and youll nd almost all
09 Invoices
In line with typical transaction types, there are
two types of invoices supported sales invoice (raised to
the major HR management features: employee records,
leave applications, expense claims, attendances, salary
slips, appraisals, and even job opening and applicant
customers) and purchase invoice (raised by suppliers). To management you have it all here. Next, click on the Tools
access sales invoices, go to Accounts>Documents>Sales link on the left sidebar; here you can nd the Process
Invoice and click on the Make a new sales invoice button. Payroll, Upload Attendance and the Leave Allocation tools.
In the form that appears, you can ll in the details or To process the payroll on the payroll freeze date, just click
even choose to populate it with data from sales orders or on the Process Payroll link and then ll in the details like
delivery notes. Similarly, to access purchase invoices, go to the concerned branch, department and designation, for
Accounts>Documents>Purchase Invoice and click on Make example. Optionally, you can also check the Send Email
a new purchase invoice. It is obvious that this has to be checkbox to send salary slips to all the employees via email.
raised by the suppliers, and so in real-world scenarios the The Upload Attendance eld enables you to upload the
supplier will have access to the system and raise the invoice. employee attendance via CSV les, and Leave Allocation
Note that a purchase invoice can be preloaded using the can be used to allocate designated leaves to the employees
data from a purchase order or a purchase receipt. during the beginning of the leave cycle.
www.linuxuser.co.uk 33
Tutorial Debian Live System
Above Easily create a custom Debian through your browser using the tools that are built into the distro
34
01 Find the
builder
04 Type of Debian
You have a bit of choice on what kind of distro you
06 Architecture choice
Choosing whether to have a 32 or 64-bit ISO is
entirely dependant on the use cases you have planned. A
create your ISO using
your current setup
as a base. It uses the
can create for the ISO. You can select between Debian 32-bit ISO (i386) will be more universal, working ne on older same commands and
option as the web
Testing (currently Stretch) and Sid for the image Sid is the systems as well. This can be good for general troubleshooting
version and builds
unstable image and you should probably stick with Testing. or maintenance. For getting the most out of a system though, it locally on your
Otherwise, you can also choose the desktop environment a 64-bit ISO (amd64) is preferable. You can always go back system. The package
to be used by default by the system theres a wide variety, and create a second ISO with a different architecture if you is called live-build.
along with having the option for no desktop at all. desire, though.
www.linuxuser.co.uk 35
Tutorial Debian Live System
10 Choose a
bootloader
Other
distro builders
10 Choose a bootloader
Live systems tend to use syslinux for live booting,
although it can depend on what kind of images are in the ISO.
Debian isnt the Multiple arch or kernel versions are easier to launch via GRUB.
only distro you can We wont be able to do that in this image, but if youre having
customise Fedora problems booting then you could always try building the image
and Ubuntu have with the different bootloader. For now, we recommend using
live builders that
syslinux and then changing it to GRUB if its not working in your
you can use, albeit
in various states of
maintenance. Theres 07 More architecture choices
As well as a basic architecture choice, you can drill
specic use cases.
08 Chroot lesystem
The root lesystem that you actually boot from can
be modied in the chroot-lesystem option, right above the 12 ISO options
The ISO labelled options are all for just labelling the ISO
linux-avours that we just talked about. Its set by default to in your own way. You can leave these be and it wont affect
SquashFS, which is the current standard, but if you need it to anything, or change them if you plan to distribute your version
be another lesystem type for older or different machines, of Debian and want some extra info to be in there. The volume
you can choose ext2 or plain. will appear on the actual ISO name, with the application being
used as the name of the distro elsewhere.
36
16 Use your
image
14 Source les
If you also want a source version of the distro once it is The process to build is supposed to
made, you can set the source option to true. By default, this
will create a TAR le with the source of the distro, but that can
take up to an hour, but in our tests it
be changed to a couple different options if you wish. For the
time being you can keep it set to false, but in the future if you
did take longer
nd that you need the source separately, it is denitely a good
idea to keep this option in mind.
16 Use your image
Once you get notied that your image is ready,
download it and anything else that you want. Load it into a
Above Keep note of
your exact setup so
virtual machine or onto a live-booting medium and then that you can check
check out your new distro. Make sure that any packages you your distro once its
wanted have installed by looking in the menus, and that you live booted
have the right architectures and options in the build itself.
www.linuxuser.co.uk 37
Tutorial RAID array
Above We recommend the reliable Seagate Barracuda drives that you can get from Ebuyer: bit.ly/1J23AlR
38
03 Striping and
mirroring
Left Striping, to
the left, splits the
data across drives,
whereas mirroring
duplicates it
www.linuxuser.co.uk 39
Tutorial RAID array
07 Hardware RAIDs
By far the better way to handle RAID, a hardware RAID
allows you to set up a RAID array on a hardware level, which
then presents Linux with a single hard drive that it can use as
normal. The RAID levels you can use depend on the RAID that
your motherboard or RAID card support. Not all RAID cards
have Linux drivers either, so you need to make sure you get the
exact right card for the job.
Setting up a RAID in this way is usually dependent on what
kind of card or BIOS youre using for it. Youll need to rst install
the drives while the system is off though, and then look for a
RAID setup utility during the POST part of when you turn the
system on. Refer to the user manual for your mobo or card to
nd the exact the steps to then set up each RAID type on the
provided hard drives.
Once thats complete, all youll need to do is format the drive
in Linux to use it as normal.
06 Other RAIDs
There are other RAID levels, however these four and
the combinations of them are the most common and useful
to make sure its loaded properly). Youll also need to install
mdadm, the multiple-disk administration tool:
out of them. RAID 2 and 3 can have excellent transfers rates # apt-get install mdadm
but are optimised for one operation at a time, and cannot
handle multiple requests very well these kinds of arrays You can use mdadm to not only create the software RAIDs,
are recommended for video editors that require the reading but also to manage them, redo them, rebuild them and even
and writing of large les often. more advanced RAID tasks.
40
10 Save and
format
RAID 10: Run cat /proc/mdstat again to see which arrays are now
listed in the le, and it should have the one youve just set
# mdadm -create --verbose /dev/md0 --level=10 up. If its there, all you now need to do is format to whatever
--raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 / lesystem you want using your command line or GUI tool of
dev/sde1 choice as the kernel is handling the RAID communication,
you wont have to worry about erasing any information. Add it
RAID 5: to /etc/fstab so it mounts at boot, and your RAID is complete!
Its worth digging into the man page for mdadm to learn
# mdadm -create --verbose /dev/md0 --level=5 how you can use it to manage your RAID in the future, and
--raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 keep it in top condition.
www.linuxuser.co.uk 41
Tutorial Kinect
sudo modprobe -r gspca_kinect Here we declare a set of signals that are to be emitted as frames
sudo modprobe -r gspca_main arrive from the sensor. Secondarily, we provide two struct
pointers that act as data storage classes for the Freenect library.
Importing freenect Finally, two flags named myDepthTaken and myColorTaken are
With that, its time to start up the trusty Qt Creator. Spawn a new implemented. We will look at their role in a few seconds.
project of the type QtGui. Its profile must be extended by the
following segment, which imports the freenect library and forces Working with freenect
the compiler to work in x86 mode: Initialising freenect is a relatively involved procedure with
similarities to classic imaging toolchains. We start out by
QT += core gui invoking freenect_init to allocate memory. Next, setLogLevel
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets is invoked it specifies the amount of information emitted to
TARGET = ImagineKinect the standard output. When this is done, Open Device is used to
TEMPLATE = app activate the first Kinect connected to the machine:
CONFIG +=i386
DEFINES += USE_FREENECT KinectHost::KinectHost(QObject* parent):
LIBS+=-lfreenect QThread(parent)
{
Freenect provides a simple C interface which must be myMutex=new QMutex();
implemented by hand to start our sensor. We will enclose mySelfRef=this;
the logic in a class called KinectHost. It must be derived from myDepthTaken=myColorTaken=false;
QThread and has the following structure: if(freenect_init(&myContext,NULL)<0)
{
class KinectHost:public QThread qDebug() << Could not initialize library;
{ }
Q_OBJECT freenect_set_log_level(myContext,FREENECT_LOG_WARNING);
www.linuxuser.co.uk 43
Tutorial Kinect
if(freenect_num_devices(myContext)<=0) {
Second { KinectHost::mySelfRef->internalizeDepth(depth);
generation qDebug() << No Kinect; }
freenect_shutdown(myContext); static inline void videoCB(freenect_device *dev,
Microsoft showcased
the incredible
} void *video, uint32_t timestamp)
scanning prowess if(freenect_open_device(myContext,&myDevice,0)<0) {
of the second-gen { KinectHost::mySelfRef->internalizeColor(video);
Kinect in a variety qDebug() << Kinect 0 blocked; }
of scenarios. Sadly, freenect_shutdown(myContext);
its high resolution } We use the static mySelfRef field in order to invoke the
cameras ensure a
gety and complex
myColorBuffer=(unsigned char*)malloc(640*480*3); internalise methods stored in the class itself. Since their code is
deployment: parsing freenect_set_video_callback(myDevice, videoCB); similar, we will print only the depth handler:
the huge data freenect_set_video_buffer(myDevice, myColorBuffer);
streams requires freenect_frame_mode myMode=freenect_find_video_ void KinectHost::internalizeDepth(void* depth)
the use of GPU mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB); {
acceleration and freenect_set_video_mode(myDevice,myMode); QMutexLocker aLocker(myMutex);
loads of USB 3.0
bandwidth. Linux
freenect_start_video(myDevice); if(myDepthTaken==true)
developers are {
unlikely to prot from The aforementioned binary break lurks in the setup of the unsigned char* mySecondBuffer=(unsigned
this pricey version. image processing toolchain. The rst generation of the char*)malloc(640*480*2);
library permitted you to specify the format of the stream memcpy(mySecondBuffer, depth, 640*480*2);
directly. In versions released after March 2011, the video emit depthHere(mySecondBuffer);
frame format must be declared in two steps: nd mode myDepthTaken=false;
returns a list of modes based on criteria, and setVideoMode }
uses it for actual setup. The initialisation of the depth
stream is done along the same scheme the only difference Our code starts out by locking the access Mutex. It then checks
involves the passing of freenect DepthRegistered. This whether the last frame was collected. If this is the case, we
constant species that the sensor is to return correlated proceed to allocating a new buffer of memory and copy the
values scaled in millimetres: data provided from the work area into the newly allocated
buffer. Finally, the signals above are emitted. Their parameter
myDepthBuffer=(unsigned short int*)malloc(640*480*2); is a pointer to the newly allocated buffer. Purists might wonder
freenect_set_depth_callback(myDevice, depthCB); about the reasons for this copying; Freenect works with two
freenect_set_depth_buffer(myDevice, myDepthBuffer); internal buffers which get reused as frames come in. We must
myMode=freenect_find_depth_mode(FREENECT_ copy the payload data out of the work area as fast as possible in
RESOLUTION_MEDIUM, FREENECT_DEPTH_REGISTERED); order to avoid race conditions.
freenect_set_depth_mode(myDevice,myMode);
freenect_start_depth(myDevice); Setting up the display
} With that out of the way, lets proceed to the implementation
of the QMainWindow responsible for displaying data. Its
Being a C library, freenect cannot provide itself with CPU constructor looks like this:
power. We solve this problem by regularly invoking freenect
ProcessEventfromtheQThreadsrunmethod: MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
void KinectHost::run() ui(new Ui::MainWindow)
{ {
while(1==1) ui->setupUi(this);
{ myHost=new KinectHost(this);
if(freenect_process_events(myContext)<0) connect(myHost, SIGNAL(colorHere(void*)),this,
{//Provide CPU power SLOT(colorHere(void*)));
qDebug() << Cant process events; connect(myHost, SIGNAL(depthHere(void*)),this,
} SLOT(depthHere(void*)));
} myHost->start();
} myHost->myColorTaken=true;
myHost->myDepthTaken=true;
Using theframes colorFlag=depthFlag=false;}
With that, its time to handle the frames provided by the sensor.
This has tobedoneintwoclassicCfunctions: We start out by creating a new instance of the Kinect host class.
Its signals are connected to the slots in the form. The thread is
static inline void depthCB(freenect_device *dev, then kicked off by a call to start the freenect library needs CPU
void *depth, uint32_t timestamp) time for handling the frames. Finally, both flags are set to true in
44
order to make the host provide data. Handling colour is easier Left For more advice
than handling depth. Due to this, we will start out by looking at on setting up your
the event handler responsible for incoming camera frames: Kinect, check out
openkinect.org
void MainWindow::colorHere(void* _data)
{
qDebug(Color here);
if(myColorImage!=NULL)delete myColorImage;
myColorImage=new QImage(640,480, QImage::Format_
RGB32);
unsigned r, g, b;
u_int8_t* myData=(uint8_t*) _data;
for(int x=1;x<640;x++)
{ myColorImage->pixel(x,y));
for(int y=0;y<480;y++) }
{ else
r=myData[3*(x+y*640)+0]; {
g=myData[3*(x+y*640)+1]; myCombinedImage-
b=myData[3*(x+y*640)+2]; >setPixel(x,y,qRgb(128,0,128));
myColorImage->setPixel(x,y,qRgb(r,g,b)); }
} }
} }
free(_data); }
colorFlag=true; free(_data);
myHost->myColorTaken=true; myHost->myDepthTaken=true;
} repaint();
}}
The Kinect provides frames which are an array of unsigned short
integers. Our loop must parse the data to find the individual pixel By and large, the depth frames are not too different from the
colours, which are then written into a QImage. When working colour ones. They are made up of unsigned 16-bit integers,
with practical code, it might be faster to use memCpy in order to representing the distance of the element from the sensors
save processing time. main plane. We determine this and then use the returned
Finally, the buffer allocated in KinectHost must be value to decide the colour of the image that is to be drawn. Our
released by invoking free. Not doing so creates a memory leak application will only draw objects at a distance between 1,500
signicant enough to bring down high-end machines in just and 3,000 millimetres. All other elements will appear in either
seconds. Finally myHost->myColorTaken is set to true in order black or pink. Redrawing elements is permitted only in response
to announce that the colour frame was destroyed and that to a paint event. Our depth event handler enqueues one by
a new one can be provided. Handling depth data is a bit more calling redraw its handling code simply writes the contents of
complex, as shown below: the bitmap to the screen as follows:
www.linuxuser.co.uk 45
Tutorial Linux shell
Tutorial les
available:
lesilo.co.uk
46
04 Get
input
you, try looking at the code of either ksh (Korn shell) or sh, commands and external Linux programs. In the former case,
because both have less features and therefore simpler you will have to execute the related C code that is included in Buffer
implementations than Bash. the shell, whereas in the latter case you will just enable Linux to overow
On a Debian system you can get the Bash source code by execute the command.
A buffer overow
executing apt-get source bash note that this command For now, the system(3) system call will be used for executing or buffer overrun is
does not need root privileges. external commands as its simpler. As you will see in part two, an inconsistency
the exec(3) family of functions is more appropriate for the job. where a program
04 Getinput
The single most critical task that a shell must
pay close attention to it. a shell, you should
always have security
perform is being able to effectively and reliably get input
from users. A while() loop, with the help of fgets(3), does the
job of reading user input in lud. There is also a ag variable
07 Supported commands
The difcult part after reading an input line is
determining whether it is a built-in command or not. The
in your mind!
named nish that is used for telling the while() loop to exit list of built-in commands supported by the shell is hard-
in case there is no input. The current version of the program coded. This means that if you want to add a new command,
does nothing but read user input line by line. you will have to edit and recompile the code. Also, built-
in commands have a higher priority over Linux utilities.
www.linuxuser.co.uk 47
Tutorial Linux shell
Code
polishing
08 Implement a shell command
The rst task is to be able to recognise a shell
command; the next task is to be able to execute it, taking into
11 More about UNIX environment variables
The presented C code illustrates the use of UNIX
environment variables by reading PATH and then printing its
consideration its parameters. value. However, we will show you how this technique is used
You may ask, Do
A very simplistic implementation with multiple if clauses in the lud shell implementation as part of the second tutorial
we denitely need
to improve existing will be used for distinguishing built-in commands; the next in the next issue.
code? The answer instalment will show you a better implementation. The
is a denitive, Yes! presented way is easy to read and works well for shells with a
Really, you should small number of built-in commands.
only try to improve
code that already
works as expected,
because there is no 09 More about command implementation
After nding out which built-in command you will
have to execute, it is time to run the actual C code of the
point in making buggy
code run any faster. command. If the built-in command takes any arguments
Additionally, only then the code will have additional steps to follow in order to
after making sure
that lud has all of the
required features
process the arguments.
The current implementation uses a more simplistic
approach you will have to wait until part two to see the
12 Compile the shell
Compiling the C code of the shell will be done as if it
was a usual C program. The full command is the following:
implemented should
you start thinking more sophisticated technique where each shell command is
about the main implemented in a separate C function. $ gcc -Wall -o lud l10ud.c
execution speed
that you need.
10 UNIX environment variables
A good way to dynamically customise a shell is with the
help of environment variables. Therefore lud must be able to
It is a very good idea to compile the code with all the compiler
warnings turned on in order to avoid any nasty and tricky
errors that can come afterwards.
successfully use them.
Should you wish to get the value of a specic environment
variable, you should use the getenv(3) C function instead of
directly accessing the whole environment variable. Other
13 Execute the shell
You can execute the lud shell as an ordinary
executable. If you wish to add it to the available Linux shells,
functions that deal with environment variables are putenv(3), you should include the full path of the lud binary inside the
setenv(3) and unsetenv(3). /etc/shells le.
48
14 Implement the
message of the day
Part two will present a better implementation, so sit tight and commands. It is also extremely important that it is secure.
the next instalment will be ready for you soon. For a shell to be valuable, it must also have easy-to-read
and useful documentation, and produce error messages
www.linuxuser.co.uk 49
A power over Ethernet (PoE) add on board (HAT) for
your Raspberry Pi with power management
PoE!
PRE-ORDER NOW!
pisupp.ly/PiPoE
LUDJULY15
Hurry! Expires on July 31st 2015
www.pi-supply.com
BECOME A
PROFESSIONAL DEVELOPER
in
12 WEEKS
makersacademy.com
THE ESSENTIAL GUIDE FOR CODERS & MAKERS
PRACTICAL
Raspberry Pi
It is a really nice input method
with a lot of potential Pimoroni
even have a video of a home-made
Ras Pi-based theremin
Contents
60 Add a battery
pack to your Pi 62 Monitor networks
with NagiosPi 64 Access your Pi via
VPN on Android 68 Build a Pi Glove
part 1: hardware 72 Optimising your
Python code
www.linuxuser.co.uk 51
Feature
Weve teamed
up with Pi Supply to
offer you the chance to
WIN some of these
Raspberry Pi
upgrades & more!
For competition details and
to enter now, head to:
bit.ly/1ehIxik
Portable &
solarpower
PiJuice
25 / $39 Available from:
bit.ly/1Fb1ywy
You can now get hold of an elegant little add-on board that watchdog timers and pl
lets you take your projects off-grid and away from mains useful features. The firm
power sources. PiJuice is compliant with the Raspberry Pi user interface) that comes with the PiJuice communica e
HAT (Hardware Attached on Top) specication and makes with the common ACPI (Advanced Configuration and Power
use of a slim, off-the-shelf mobile phone battery, and some Interface) battery and power APIs for tight integration with
intelligent charging and power circuitry, to make your Pi Raspbian. PiJuice only uses a I2C power sand one GPIO pin,
truly portable. Theres also a version called PiJuice Solar so most of the GPIO pin bank is left free for use with other
that enables solar recharging and is even capable of taking projects. It comes as standard with a stacking header to make
inputs from other renewable energy sources. it extremely simple to add other HATs or add-on boards on top.
PiJuice also has a powerful ARM Cortex M0 processor PiJuice will enable you to make a variety of awesome projects
that provides deep sleep functionality, a real time clock, check out the PiJuice Instructables page: bit.ly/1e2CoGE.
www.linuxuser.co.uk 53
Feature
Powerswitch& PiSupplySwitch
file-safeshutdown 15 / $23.10 Available from:
bit.ly/1RXHROn
The Raspberry Pi has been so popular, in part, very useful, and it is not until you do not have one
because of the extremely good value for money that you realise this!
of the hardware. It packs a lot of punch for the The Pi Supply Switch is a self-solder kit
price point and, because it is designed by a which provides an on, off and soft-off (le-
charity, they dont need to inate the price with safe shutdown) button to give you basic power
high prot margins as much as would be done management functionality for your Pi. With some
with a more commercial product. Unfortunately, provided sample scripts you can make sure
as with anything low-cost, some compromises your Pi is correctly shut down when you switch
had to be made in order to bring it in at such an off without the need to open any menus or
affordable and small form factor. issue any commands in the terminal and the
When comparing it to your more standard circuitry in the switch ensures that power is only
desktop or laptop computer, one thing that it is removed after the Pi has been shut down. As
obviously lacking is a power switch and power well as making it more convenient for you, it also
management functionality. It is surprising how reduces the possibility of corruption to your SD
something as simple as a power switch can be so card from prematurely pulling the power cable.
See in the
dark with infrared
NoIRInfraredCamera
16.80 / $29.95 Available from:
bit.ly/IQyeC4
54
Ras Pi upgrades
Movement for
your camera rig
Pi-Pan Pan Tilt
Mechanism
45.99 / $39.99 Available from:
bit.ly/1dwpEr2
High quality for the Raspberry Pi that enables you to articulate the camera
by an impressive amount 110 degrees from top to bottom
and 180 degrees from left to right. The kit includes a well
audio for your Pi considered array of hardware, including a servo driver board,
the servo motors required for the actuation and mounting
hardware for the camera and servos. On the software side,
there are libraries in Python and Scratch so it is easily exible
enough for most projects.
One of the most impressive applications you could use
HiFiBerryDAC+ this for is an OpenCV-based motion detection and face-
tracking camera. There is sample code available on the
openelectrons.com forum and it looks like a truly great
30 / $34.90 Available from:
bit.ly/1L1hh4T project to try (bit.ly/1JJpXLe).
www.linuxuser.co.uk 55
Feature
Super low-
power displays
PaPiRusePaper/eInkHAT
30-65 / $47-102 Available from:
bit.ly/1f2Lzaj
As computers of all sizes and powers are now being embedded into pretty
much everything, electronic parts have become even more commoditised
and, happily, this is ltering down to display technology as well. We now
have a wealth of offerings from your standard monochrome LCDs to TFT,
OLED and AMOLED offerings.
One of the most exciting and disruptive display technologies of recent
times is ePaper/eInk. You probably know it best as the screens that go into
e-readers like the Kindle and Kobo (fun fact: the Pebble watch is commonly
referred to as an ePaper watch, but it actually uses what is known as a
Memory LCD and a very clever marketing team). You may have wondered in
the past why your iPad barely lasts ve hours on a charge but your Kindle
lasts for over a week, and the answer is all to do with the display. ePaper
only uses power to update what is on the screen, which means that for a
High definition large number of applications where you dont need to change screen
contents particularly often, it saves a lot of battery power. It would be
pretty useless for playing videos, but for e-readers, monochrome graphical
display&audio info displays, digital price tags, bus and train station signage and many
more applications, it is by far the best choice.
PaPiRus brings the low power ePaper display technology you know and
love to the Raspberry Pi in a HAT-compatible format with screen sizes
ranging from 1.44 to 2.7 inches. The ePaper lm used in these screens is
Adafruit 10.1 actually identical to that in the popular e-readers mentioned above. You
can get your hands on one for around 35 and they come with a useful
Display & Audio Python and command line framework. They are worth trying out if you have
any display-driven projects!
Finding the right display for your project can often be a bit
of a pain. We have covered the HDMIPi in a previous issue
(146; bit.ly/1Gb9LNs), which is a fantastic 9-inch HD screen
for your Raspberry Pi, and it really was wildly successful on
Kickstarter (kck.st/1CuIjwd).
If you want to take things one step further, Adafruit have
a 10.1-inch offering that just cant be missed. It features a
beautiful 1280 x 800 (so slightly higher than 720p) resolution
IPS display with a very wide viewing angle. It has mounting
tabs to enable you to easily ush-mount it within your project
and it can accept a number of different input methods
HDMI, VGA and composite. Perhaps best of all, this display kit
also enables you to directly connect 2-, 4- or 8-Ohm speakers
without the need for a separate amplier or externally
powered speaker, which is very useful.
It is not the cheapest display around at $155 on the Adafruit
site, but if you need a high quality display in your project with
native audio capability then you should seriously consider
it. We are already daydreaming of a dedicated multiplayer
arcade emulator with built-in stereo audio, and were sure you
can come up with some cool applications too!
56
Ras Pi upgrades
Control your
plug sockets
Energenie Pi-mote
Control Starter Kit
19.99 / $31 Available from:
bit.ly/1L1kYHU
touch control use a lot of electricity when not properly turned off. This is
sound advice but is not always a practical solution as the
socket is not easily accessible. This is where the Energenie
Pi-mote control starter kit comes in. It contains two remote-
controlled plug sockets which can be turned on and off with
an RF remote. What does this have to do with the Raspberry
PimoroniSkywriterHAT Pi? Well you also get an add-on board to enable you to
control the sockets via software on the Raspberry Pi, which
unleashes whole new possibilities you could set your lamps
16 / $20.95 Available from:
bit.ly/1IFt9cg to turn on and off automatically at specied times when
you are away to avoid burglars, or create a basic web app to
For a lot of projects you undertake with the Raspberry Pi, you will want control your plug sockets remotely using your smartphone.
some kind of user interaction. When using the desktop GUI this is normally They only come in UK and EU plug types, so if you use a
done with a keyboard and mouse, but these are not always the most different plug then you may need to look for something else
intuitive input methods when you arent using a full desktop environment (and maybe send Energenie a request to make more versions).
and when you dont need to type anything.
The pirates over at Pimoroni have created a new HAT module called the
Skywriter that enables you to add near-eld 3D gesture and touch sensing
to your projects for a great price. There is a Python API provided that
provides full 3D position data and gesture information (swipes, taps and
so on). Play with this for a short while and you will realise that it is a really
nice input method with a lot of potential Pimoroni even have a video of a
home-made Ras Pi-based theremin (vine.co/v/OrUWTdd0Hlg).
There is even a larger non-HAT version of the Skywriter that is more
than twice the size and boasts a sensing distance of around 15 cm,
which means that you can mount it inside your projects behind a sheet
of acrylic or other non-conductive material and it will still work. This is
especially good if you want to convince people that your projects are
simply pure magic.
www.linuxuser.co.uk 57
Minecraft blocks The NFC
tags within have instructions on them. Componentslist
When scanned against the PN532, they
pass them on to the Minecraft API Q Raspberry Pi 2
Q Raspberry Pi GPIO Breakout
Q PN532 RFID/NFC Breakout
Q Breadboard
Q MIFARE Classic 1K cards
Q Printed and folded
Minecraft cubes
Above The range on NFC is tiny but it can Above Youll need a MIFARE Classic 1K or 4K to
pass through wood, plastic and anything use the PN532, as this board supports these
that other wireless signals can bypass the most efciently
58
My Pi Project
Minecraft NFC
Inpired by Amiibos, Tony DiCola makes
NFC-enabled papercraft blocks that can
be used to build inside Minecraft
Why did you decide to start working the wood block, this ID equals the TNT Classics, store 1KB of data and Im not
with NFC what was it that first block, etc. So the program just waits to actually even storing much data its just
interested you? see a block thats swiped and then, using the type of block, a byte or two. But you
I think it was a neat way to explore using the Minecraft API, it tells Minecraft to could actually create some arrangement
physical things with a game taking a create a new block wherever the player of blocks, like a pyramid or a house, up to a
device or an object and making it more is standing now. kilobyte, so youd have some restrictions in
interactable. I was a little bit inspired that each block will need a position. Youll
by Amiibos and Skylanders those So you wrote the library for the Adafruit probably need three or four bytes for that
little gures you can buy that have PN532 RFID breakout that you are using (or maybe even three or four 16- or 32-bit
NFC in them. So I was thinking, what in this project? values), so it could probably store maybe Tony DiCola
can I do to make something myself out Exactly the Python port of it. Theres 100 blocks or so in an arrangement on a works as an
engineer for
of this? Whats a DIY thing to try? And also an Arduino port and its pretty 1KB card. But there are bigger cards I Adafruit Industries
then I realised that the Raspberry Pi standard, a typical kind of embedded think there are 4KB ones. So it could be a and is passionate
has Minecraft and the cool thing about code. The nice thing with this breakout cool thing to support for the future, extend about open source
hardware like the
Minecraft Pi is that it has got a whole is that you dont really have to talk at a it to support a structure or something that Raspberry Pi. Hes
little Python API, so its really easy to use. super-low level with the different NFC you make ahead of time the tricky thing is thrilled to see
With a few lines of Python you can create protocols the chip on here takes care that youd need some kind of editor, ideally. the Raspberry
Pi become a tool
blocks and mess around in the Minecraft of that for you, so really the library is just Minecraft on the Pi is pretty basic, so you that inspires a
world, so I thought that was perfect I talking to the chip and saying, run the would have a bit of a tough time trying to new generation of
could just put both of these together listening command or run the read or define the structure without just dropping engineers.
and make some sort of physical thing to write command. It abstracts away how someone down to configuration and
interact with the Minecraft world.
Like it?
Check out Tonys
So how exactly does it work? I was a little bit inspired by Amiibos tutorial on the
Adafruit Learning
System if youre
Basically, it has a little NFC reader,
which is this circuit board that connects and Skylanders those gures up for having a
go yourself: bit.
to the Raspberry Pi and uses an SPI
connection (a typical connection for you can buy that have NFC in them ly/1d9oqSh. Also
give the PN532
guide thats
embedded devices), and then the Pi recommended on
has the GPIO ports, so you can get to initialise the device and it has a bit of saying, Okay, write out the exact position the intro page a
really good low-level access to devices a framing protocol when you send a of the blocks. But I guess if someone were read through, as its
very useful (written
with that. NFC is a wireless Near Field command it has a hash and other stuff really ambitious, they could make a little by Ladyada).
Communication protocol, so its kind associated with it to make sure it gets 3D editor or something to place the blocks.
of cool in that you can have these little the correct data, so the library takes Further
passive devices, like a tag or a card, and care of all that for you. You can just look Have you experimented using the PN532 reading
Up for something
you just hold them near the antenna on at the datasheet and it tells you all the in any Raspberry Pi projects outside of a little more
the RFID reader and itll energise them, different commands that it supports, and Minecraft up to now? challenging?
sending a few little bits of data between in order to send those commands you Not too much yet. I was kind of curious to The University
of Cambridges
them. So the NFC reader is connected have to frame them in the right way, but see if we could read Amiibos what do Computer
to the Pi and theres some Python code the library will do that for you. And even they actually store on the cards? and Laboratory has an
that I wrote a little library to interact above that there are some higher-level you can actually read them. Theres a excellent tutorial
on making your
with the NFC reader. Theres a little functions that just, for example, wait for community on Reddit trying to hack the own NFC coil and
program that you run (also in Python) a card, and then once you have a card Amiibos and actually gure out what then setting up
that basically talks to the NFC reader, theres a function that says give me all the data is, but its all encrypted by communication
protocols for it:
and its in a passive listening mode, so it the data from the card, so its meant to be Nintendo so you cant really understand
bit.ly/1FXYh4g.
just waits to see when a card is swiped. real simple and easy to use, really make it. I was hoping that maybe you could
Ahead of time, you build these little you able to be productive with it. actually clone an Amiibo but the 532
blocks and put NFC cards inside them unfortunately doesnt support writing
and then you scan those each one has How much information can you store to the Amiibo; they use special tags
a unique ID associated with it, so once in these NFC tags? Could you write the NTAG216, I think and its a weird format,
you get the ID then you can have a little layout for a Minecraft building on a chip? quite hard to nd. Nintendo didnt want
conguration that says this ID equals The cards that I was using, the MIFARE people to copy them, obviously!
www.linuxuser.co.uk 59
Tutorial
Christian
or living room, however, you can use it for mobile projects as Whatyoullneed
diverse as launching it into near-Earth orbit or monitoring and
Cawley Q AA battery box
is a former IT and automating your garden. bit.ly/1FDiJGa
software support Of course, to do this you will need batteries, but adding
engineer, and since battery power to your Raspberry Pi is simpler than you might Q 3-Amp UBEC
2010 he has written
for computer and have imagined. All that is required are six rechargeable AA bit.ly/1HLKih7
smartphone users, batteries (or single-charge alkaline), a battery box with space Q 3-Amp terminal strip
both online and in for the batteries and a UBEC. The latter is a Universal Battery
magazines
Elimination Circuit, a voltage regulator that will regulate the Q 6x AA rechargeable
power supply and prevent damage to the Raspberry Pi, and can batteries
be bought for under 10.
60
Battery pack
Use a
07 Measure uptime
You should have already set up your Pi for SSH use, so
connect to the device via Putty after giving it time to boot fully (at
UBEC
watch -n 60 uptime
It is possible
to power your
Raspberry Pi
with a micro USB power connector for easy connection to your directly from four
Raspberry Pi. However, if you bought one from eBay then there is This command will display the system uptime and also keep the or more batteries,
but without the
a strong chance that you will receive one with a 3-pin connector. Wi-Fi connection active. safety that the
UBEC provides
youre likely to burn
03 Change the UBEC connector pins
To use the UBEC with a 3-pin connector, alter the
position of the pins so that they occupy the two outer slots.
08 Judge your uptime results
Uptime results depend upon the type of battery you use
and the Raspberry Pi model. Single-charge batteries will last a
out the computer.
Unregulated
power can cause
Use a small jewellers screwdriver to lever up the small plastic little bit longer, but this is a more expensive option. Meanwhile, considerable
damage to your
catch and remove the red wire from the central slot, before newer models have greater power requirements but run for less Raspberry Pi, and
sliding into the unoccupied outer slot. time. For more power, add more batteries! as you increase the
current with more
batteries, the risk
www.linuxuser.co.uk 61
Tutorial
Whatyoullneed
Q NagiosPi
piimagehub.com/project/nagiospi
Q Win32 Disk Imager
bit.ly/L8JdYG
Q Disk Utility
bit.ly/1Lec9r5
Q Internet connection
Q 4 GB (or larger) SD card
62
Network monitoring
Left Raspcontrol
shows you the Pis
RAM and CPU usage,
CPU temperature,
uptime and more
www.linuxuser.co.uk 63
Use an Android device
as a Raspberry Pi screen
Connect to a Pi with your phone or tablet
using VNC as a secondary or actual display
There are a few ways to attach a display to a Raspberry Pi.
The ones that everyone is most familiar with are the HDMI
port, which can go straight into your monitor or TV, or via
01 Update your Raspberry Pi
Before starting, you should absolutely make sure that
your Raspberry Pi is up to date. With the limited resources on the
the GPIO ports with a portable screen. One avenue that is Pi, any optimisations can make the experience better. Youll rst
rarely pursued is using VNC software to remotely view the want to update the software by opening the terminal and using:
Raspberry Pi desktop using another computer entirely.
Its actually fairly simple and we are going to concentrate on $ sudo apt-get update && sudo apt-get upgrade
viewing your Pi screen via Android for maximum portability.
Rob With further tweaks you will be able to use this on the go if and then follow it up with a rmware upgrade by running:
Zwetsloot you nd yourself commuting and wanting to catch up on your
models complex
systems and is favourite program, for example. $ sudo rpi-update
a web developer There are a few things that you should be aware of when
procient in Python,
doing this project it can be quite taxing on the Pi and is
Django and PHP. He
loves to experiment likely to drain a bit of battery from your phone too. We will talk
with computing about some options to help take the strain off the Pi if the
connection seems a little laggy and how this method can be
Whatyoullneed
used on normal PCs as well, so you can use a range of devices Q TightVNC tightvnc.com
and get the most from your Raspberry Pi. Q VNC Viewer bit.ly/1jCzBRJ
64
Android VNC
Full code
FileSilo.c
o.uk
03 Start up VNC
Once everythings installed we can actually start up the
VNC server its probably a good idea to do so now and check to
06 Correct resolution
We created our test server with a resolution of 640 x 480,
just to get it running. However, this is unlikely to be the resolution
make sure its all working. Well do a test run with the following: of your phone. Luckily, this resolution is not xed every time, so
the best thing to do is to look up the resolution of your Android
$ vncserver :1 -geometry 640x480 -depth 16 device and then modify the line used to start up the server. For
-pixelformat rgb565 example, if you have a 1080p tablet, you would use:
As long as everything is installed correctly, it should start without $ vncserver :1 -geometry 1920x1080 -depth 16
any problems at all. -pixelformat rgb565
www.linuxuser.co.uk 65
Tutorial
08 Raspberry Pi IP
We need the IP address of your Raspberry Pi so that we
can connect to it. You can get it via two methods our preferred
method is to open the terminal and use ifcong to list the status
of the Pis network interfaces; this will include the IP address of
whatever is connected. If youre using wireless to connect, you
can also access the wireless cong interface (iwcong) and see
what the wireless has been assigned as an IP.
09 Connect to the Pi
Now that we have the IP address, we can look at
connecting to the Raspberry Pi. Open VNC Viewer and click the
+ sign to set up a new connection. Leave the name blank for the
moment, enter an IP address and choose Save password. It will
ask for the password when you attempt to connect, after which it
will then save it and not require it in the future.
10 Use VNC
If this is the rst time that you are using VNC software,
you will notice that there can be a little lag between what you
do and what happens on-screen. Luckily, you can use your
nger on the screen to move the mouse and tap to click, and
the Android keyboard can be used as the keyboard. It can take
a bit of getting used to and is not good for anything that you
need to do fast, but its still very useful.
Above VNC Viewer is made by RealVNC, the original developers of VNC technology $ sudo nano /etc/init.d/vncserver
66
Android VNC
www.linuxuser.co.uk 67
Build a Pi Glove part 1
Create your own Wearable Tech glove that places
control at your ngertips
The Pi Glove is our project name for a wearable, social
media-controlling glove were going to show you how to
build it this month and how to program it next month. With
the advent of Google Glass, Android and Apple smartwatches
and various other disruptive technologies, the devices
were beginning to use today point towards a future where
we may well one day wear all of the gadgets that enable us
to communicate with each other (before they are simply
embedded into our bodies). The more natural or ergonomic
this medium becomes, the more likely we are to use it, so
Dan Aldred were going to use a Raspberry Pi to create a powerful yet
is a Raspberry Pi
Certied Educator comfortable glove. Part one of this two-part tutorial covers
and a Lead School
teacher for CAS. He
is passionate about
the hardware setup so that you can make your own version of
the Pi Glove. Part two will cover the software to control music,
a camera and social media using your gloves buttons.
02 Attach the wires to the poppers
The next part is a little ddly, so take your time as you
work through each of the wires. First, you need to connect the
creating and hacking
projects, and uses wire to the popper whilst pinning the other end through the nger
projects like this to
engage the students
that he teaches 01 Strip and prepare the wires
Take the female-to-female jerky wires, select one end
and remove the plastic coating; this can be done by applying a
of the glove. Once through, close the two sides of the popper
together, ensuring that the wire is secured in-between. This is
easier if you turn each glove nger inside-out and then push the
little pressure on the plastic cover you can use your teeth but popper through. The key part of this step is to ensure that the
its better to use a set of pliers! The end will now consist of a small wire stays connected.
metal spike. Prepare the other wires using the same method.
Whatyoullneed
Q Raspberry Pi A+
Q Clothes poppers
Q USB Wi-Fi dongle
Q Small cable ties
Q Glove
Q USB battery charger
Q Pi camera module
Build a Pi Glove
Full code
FileSilo.c
o.uk
06 Checkpoint
At this stage you have the ve poppers attached
individually to a wire and through each of the individual ngers,
Wpa_
and also attached to the thumb. Each of these wires runs suppliant
through the inside or outside of the glove to the Raspberry Pi. The
Pi camera is also attached to the glove, with the lens exposed to
Wpa_supplicant is a
enable pictures to be taken. backgroundprogram
that runs and acts
as the component
to control wireless
connection. It
supports both text
and GUI interfaces.
www.linuxuser.co.uk 69
Tutorial
Above It wont t
onto your glove as
neatly, but you can
use the Model B+ or
08 Attach the wires to the GPIO pins
Now that all the hardware is attached to the glove, the
next step is to connect the nger and thumb wires to the GPIO
sudo nano etc/wpa_supplicant/wpa_supplicant.conf
SSID
09 Connect more wires to the GPIO pins
Using the same method as described in Step 8, take the
middle nger wire and connect it to pin number 11, the ring nger
Using the example network found in Step 12, you type
ssid=test-network and psk=testingPassword. Now save
the le by pressing Ctrl+X then Y, then press Enter.
to pin 21 and nally the little nger wire to pin 12 again, these
SSID is a case-
sensitive,
numbers are the physical pin numbers on the board.
14 Set up Wi-Fi in the command line, part three
On saving the le, wpa-supplicant will normally
alphanumeric,
32-character unique
identier attached
10 Boot up the Pi
The rst time you boot up your Raspberry Pi you will need
to set up your Wi-Fi connection. Connect the Pi to your HDMI
notice that a change has occurred and so it will try to make a
connection to the network. If it doesnt do this, you can either
manually restart the interface just run sudo ifdown wlan0
to the header of
packets sent over a
monitor and insert the Wi-Fi dongle. If you are using the newer A+ followed by sudo ifup wlan0 or instead reboot your Raspberry
wireless local area model, which only has a single USB, you may require a USB hub Pi with sudo reboot.
network (WLAN) that to enable you to add a keyboard and mouse. You could always To test that the Pi is successfully connected to your Wi-Fi,
acts as a password
set up the Wi-Fi on a B+ model, which offers more ports, then type ifcong wlan0. If the inet addr eld has an address beside
when a mobile
device tries to transfer the card to the A+. Add the USB mouse, keyboard and it, the Pi has connected to the network. If not, check that your
connect to it. power supply. Boot the Pi up. password and ESSID are correct.
70
Build a Pi Glove
Above Were using the brilliant Wi-Fi dongle from The Pi Hut,
which you can get for just 6: bit.ly/1LfkCgZ
Full code listing
###TeCoEd Test Version###
###Glove Button Test ###
###Project New York###
15 Disable the Wi-Fi power management
If left idle, the Wi-Fi power management system on the
Raspberry Pi may drop the Wi-Fi connection this may, for
example, occur if the glove is out of range of the router. To disable
import time the power management, load the terminal window and type:
import random
import os
sudo /etc/network/interfaces
import sys
import subprocess
import RPi.GPIO as GPIO At the end of the block of code, add the following line:
from sys import exit
wireless-power off
######Set up the GPIO Pins ######
GPIO.setmode(GPIO.BCM) This will ensure that the Wi-Fi stays connected whilst in range.
if GPIO.input(17) == 0:
17 Run the code
The test program will respond to each connection of
the ngers and the thumb, and display a message stating that
print You pressed button two
the respective button has been pressed like so: button one
if GPIO.input(9) == 0: has been pressed, button two has been pressed, etc. If this
print You pressed button three fails, check for the following errors: 1) incorrect wiring on the
GPIO pins, 2) loose wires not in contact with the poppers, and
if GPIO.input(18) == 0: 3) thumb and nger not in contact. Part two will cover how to
print you pressed button four develop a program that brings control to your ngertips.
www.linuxuser.co.uk 71
Python column
string, you need to make a new string and append(word) This makes the code clearer to read. It
Its the ofcial
language of the
copy both the old and new characters into also only involves a single type check to
Raspberry Pi. the new space. In those cases where you This type of checking also happens see whether a and b can be multiplied
Read the docs at are programmatically building up large whenever you use any kind of polymorphic together. The actual operation then gets
python.org/doc.
pieces of text, the moving of characters operator or function. So, if you wanted passed off to a C library, usually from
around in memory can be expensive. to use the + operator, Python needs some linked in linear algebra packages
Instead of using a construct like: to check both of the parameters being like BLAS or LAPACK. This provides a
added together to try and figure out what substantial speed increase because
str1 = version of + to use. If you do need to use a you can take advantage of all of the
for word in list: polymorphic operation inside a very large optimisation work that has gone into
str1 += word loop, it might well be worth your time to these external C or Fortran libraries.
look at solutions that use strictly defined There are some obscure ways of
you can use: data types to remove these checks. While speeding up your code, too. For example,
this flexibility in data types is a strength Python needs to regularly check to
str1 = .join(list) of Python, you may need to give up this see whether something else needs to
flexibility in very specific situations to be done. This something else may be
This builds up the string in a single step, maximise the speed of your code. looking to see if a different thread needs
for a reasonable speed-up. Since we are If you are doing numerical computation to run or whether a system call needs
looking at for loops anyway, we should of any kind, you need to start using to be processed. This can take quite a
study other things that we can do to make the NumPy module. NumPy provides bit in terms of resources. You can use
them faster. There is a lot of overhead functionality that signicantly improves the command sys.setcheckinterval()
involved when Python manages a for the performance of Python numerical to change how long Python waits to run
loop. If the code within it can be bundled code close to the performance you these checks. If you arent using threads
as a function, you can use the map would expect to see when using C or or making system calls that may be
command to have this function run for Fortran. The main way NumPy helps sending signals to your code, you can
each value stored in a list. In this way, you is by providing xed data types, as we set this to a higher value to improve the
can remove the overhead of the for loop mentioned above. The most basic data performance of your code. Another
72
Python column
Compiling to
machine code
While you have the ability to use an alternate language
within Python through Cython, for example you
can get optimised code and still stay with pure
use classes and objects. You your Python code to optimised machine code. Once you
install the Numba module, you can import the jit portion
with the following statement:
can write a script that denes from numba import jit
a class that contains method This provides a function decorator, @jit, that tells
Numba to compile the given function to machine code.
more obscure technique that optimises within Python. As an example, you can use Every time the compiled function is called, the machine
both memory and speed is to use the Cython to take optimised C code and make code version is the one that is executed, bypassing the
xrange command. If you need a list of it available within your Python program. virtual machine. By default, Numba needs to check the
integers, this is usually handled by the There are equivalent techniques for other types of any input variables and compile appropriate
command range. The problem with this languages used in high performance code. This means that you may end up with more than
command is that the entire list gets applications. There are several cases, one version of the compiled code. Also, you still have the
created in total and stored in memory; though, where the algorithm available overhead involved in doing the type checking when the
you access the list through an iterator in the alternate language is just not function is called. If you know what data types are going
and walk through each of the elements. easily translated to efficient code within to be handed in, you can skip this check by including type
The xrange command provides the list of Python. In these cases, you have the tools information in the decorator. For example, you could
integers through a generator. A generator available to leverage this previous work have something like:
does exactly what you think it does; it within your own code. We will be looking
generates the elements that iterate over at this particular technique in greater @jit(int32(int32, int32))
as they are needed. This means that detail next month. The last technique def f(x, y):
you only have one element of the list in available is to not use Python at all at return x + y
memory at any particular time. Also, you least, not the virtual machine. Python is an
dont have the wait while the entire list is interpreted language, which means that This compiles the one version you need. Numba also
being generated. If you are looping over a every program has the default overhead of uses lazy compilation, which means that it will only
for loop that has a few thousand cycles, having to run through the interpreter rather compile when the relevant function is rst called. This
or potentially even millions, this switch than running as machine code directly way, only the portions of code that you actually need go
to using xrange can provide a signicant on the hardware. A last resort that is through the overhead of the compilation step. You can
speed boost. If you are iterating over data available is to cross-compile your code to use the included pycc utility to compile your Python
in a le, you may actually want to do the machine code for the particular hardware code ahead of time and this will save you even more
opposite. Reading from a hard drive can you wish to use. There are a few different at runtime. There are limitations on which data types
be much, much slower than reading from projects available, such as Nuitka, that are supported, and how complex the code can be, but
memory. This means that you should read can generate this cross-compiled code. it is still effective enough to make it well worth your
in as much of a le as you can reasonably Sometimes, you need to give up portability time to give it a try. This follows a workow that is more
t into your available RAM in a single to get your code running as fast as possible reminiscent of a traditional compiled programming
operation to speed up manipulating on any particular piece of hardware. language, while letting you stay within Python.
this data. The last obscure method Now that we have looked at different
is to consider the scope of variables. ways of speeding up your code, hopefully
Whenever possible, you should use local this will give you the tools to do great
variables within a function rather than things with your Pi. Not long ago, these
global variables. Python is much more techniques were common it was the
FOR MORE ON PYTHON, CHECK OUT
efcient when accessing variables that only way to get work done. The resources
are within the same scope as the function available on the Raspberry Pi are limited
body, rather than having to move out one compared to modern standards. With
or more layers to whichever code body more thought, much computational work
actually called the function in question.
If all of these techniques dont work,
then you can always move to a different
can be done. Just remember the quote,
premature optimisation is the root of
all evil, and be sure you invest your time
ON SALE NOW
AVAILABLE FROM ALL GOOD NEWSAGENTS & SUPERMARKETS,
OR ONLINE AT WWW.IMAGINESHOP.CO.UK
language and use this alternate code where it will have the greatest impact.
www.lin 73
Special offer for readers in North America
Quote
Order hotline
Online at www.imaginesubs.co.uk/lud
SUMMER151
*Terms and conditions:This is a US subscription offer. You will actually be charged 37 sterling for an annual subscription. This is
for this
equivalent to $57 at the time of writing;exchange rate may vary. 3 free issues refers to the USA newsstand price of $16.99 for 6 issues being
$101.94,compared with $57 for a subscription.Your subscription starts from the next available issue and will run for 6 issues.This offer exclusive
expires 30 September 2015.
offer!
75 Group Test | 80 UltraBorg | 82 Solus Beta 2 | 84 Fedora 22
Rainbowstream Turses
Turpial Corebird
GROUP TEST
www.linuxuser.co.uk 75
Review Minimal Twitter clients
Rainbowstream Turses
Confusing whirlwind view of the Twitter The Turses interface delivers easy-to-
stream thats worth investing time in navigate, multi-column feeds
Q Operations are done to tweets by Rainbowstreams ID number for each post Q Turses congurable columns are controlled with simple and easily
here, favouriting a tweet by typing fav 65 learned keyboard shortcuts
Firstimpressions Firstimpressions
Firing up for the first time, Rainbowstream will open up your default browser You have to read the docs to see the keyboard shortcuts, but thats simple
to generate the Twitter auth token to enable the app access to your account. enough. For command line users, the hjkl navigation of Vim will be familiar
In our case, the browser was the command line Links2 and we chose to enough j and k to move down and up, and h and l to move left and right
paste the URL shown in the terminal into Firefox, where we were already between tabs (tweets, mentions and favourites); G and g move to the
loggedintothewebinterfacetoTwitter. beginningandtheendofeachtimeline,respectively.
Interface Interface
As colourful as the name implies perhaps a little too colourful on Open a new timeline (with + to open the timeline of the author of the
light-background terminals. Responsive and quick-scrolling, the rst tweet, for example) and it appears at the end e takes you there (like
command you will need is p, to pause the ow of tweets. Each tweet Ctrl+e in Bash). All straightforward, but you have to read the docs and
has an ID number, which are added by Rainbowstream, for you to digest them. An info bar appears along the bottom line of the terminal
specify in commands. when one of the timelines has updated.
Extras Extras
Rainbowstream stands out for its ability to handle Twitter lists, as much Turses may seem to offer only the basics, but with shortcuts to work
as its extensive list of commands to explore, tweet and interact with with hashtags and URLs, as well as following or opening timelines of
followers. Add in the Python interactive shell and an Easter egg, and particular authors only Twitter lists is missing. Key-switchable, multi-
were this not a command line app, it might be hard to call it minimalist. column layout is a nice feature. Turses also works with multiple accounts.
Overall Overall
7 8
The fast scrolling stream sets the tone to an immersive According to GitHub, Twitter lists are on the roadmap:
experience. Learn the commands and youll tame this if you can live without this one omission, then this fast,
torrent. This is the only one of our test subjects, apart stable, easy-to-use client could be the one for you leave
from Corebird, to handle Twitter lists. it running in GNU Screen on your VPS.
76
Turpial Corebird
This speedy client aims to please, but it Based on GTK+ 3, this client gives the
needs a little polishing interface a quiet corner of your desktop
Q Traditional GUI view of streams of posts which can be set up for more QCorebirds abilities extend to editing your Twitter accounts user
than one account, plus blown-up twitpics biography and other details
Interface Interface
The multi-column layout scrolls sideways as much as you like, so you A nice-looking interface with user-selectable options to scroll on new
can add several little-used accounts and just visit them when you need messages either individually or in batches. Easy switching back
to. You get a friendly audible tweet each time Turpial downloads a fresh to previous screens is handy. Corebirds one failure for us was some
batch of posts (as user adjustable intervals). A drop-down menu with a instability on Ubuntu 14.04s experimental GTK+ 3 packages other
choice of account makes tweeting with different identities easy. distros seem ne.
Overall Overall
7 9
We wanted to like Turpial. From its quick twitpic previews, Impossible not to like. Its simple, pretty (even on our
to seemingly limitless new columns for other Twitter tiling window manager) and straightforward to use. We
accounts, it worked to please us, and if Twitter lists arent particularly like the letterbox view onto twitpics and the
essential it may please you too. It just needs more polish. ability to edit user bio details.
www.linuxuser.co.uk 77
Review Minimal Twitter clients
First
impressions
up, but default theme
is hard to read on
lighter terminals
6 word intuitive with a
command line app?
Because it is
8 with, barring the
oddities on minimal
window managers
6 repository for Ubuntu
LTS but otherwise as
simple as it gets
8
An explosion of Simple, easy to Like the curates egg, Appealingly minimal
Interface
colour, which is
tamed by the
congurable theming
7 navigate and certainly
clear enough, but not
too pretty
7 good in parts. Nicely
realised multiple column
layout as well
7 and very navigable a
case study in getting
things right
10
Documentation and If youve used the Not at all difcult to Easy to explore and
Learning
experience
help pages get you
through a steeper
learning curve
7 command line long,
hjkl navigation is
second nature
9 learn, but it can be
a little frustrating
occasionally
7 learn, nothing gets
between you and the
Twittersphere
9
Good with lists, and Everything you need Great for multiple Lists, lters and access
Extras
even features a direct
Python interface. Not
so minimal, though
8 except Twitter lists.
Great with multiple
timeline columns
7 accounts, with
scheduled posts being
much appreciated
9 to editing your bio.
Everything you could
need, but no more
9
Fast and colourful, Easy to use, stable A tale of nearly there. Basic but totally
Overall
this one may divide
opinion but theres a
lot to like
7 and fast. For many,
this is simply all that is
needed in a client
8 Certainly worth a try
if you have multiple
accounts to use
7 sufficient. Elegantly
executed and a
pleasure to use
9
AND THE
WINNER IS
Corebird
Turpial is not a bad piece of software in fact,
its multi-column layout is great for multiple
accounts and Turses, despite the dreadful
name, was a very close runner up. Lacking
both the elegant minimalism of Corebirds user www.linuxuser.co.uk
78
BUILD A BETTER WEB
www.webdesignermag.co.uk
E s FREE
SU
EVERY IS
Available
RE
newsagents and
DS
DO supermarkets
WNLOA
ON SALE NOW
20 HTML5 tips, tricks & techniques | The perfect content strategy | Best GitHub projects
PRACTICAL TIPS BEHIND THE SCENES INDUSTRY OPINION
facebook.com/webdesignermag twitter.com/webdesignermag
Review PiBorgUltraBorg
ROBOTICS
PiBorg UltraBorg
Type
Add-On Board (Non-HAT)
Designed for Raspberry Pi robotics projects, does
Processor
PIC16F1824-I/SL
the expandable UltraBorg deliver on its promises or
Driver let us down?
Toshiba 16-bit PWM IC
TC62D723FNG
DesignedprimarilyfortheRaspberryPiyetcompatible devices like the Raspberry Pi Camera Module, can help
Outputs with any microcomputer or microcontroller that can with accurate positioning for the latter.
4x 5V PWM (Servo-compatible) speak inter-integrated circuit (I2C) including the While it cant help you with the camera side of things,
Inputs popular Arduino and compatible PiBorgs UltraBorg the UltraBorg is positioned as the ultimate one-stop device
4x 5V Ultrasonic Sensor is built with one task in mind: robotics. for budding roboticists. The board is split into two four-
Power Supply The majority of hobbyist-level robotic projects use channel groups: the first group provides input support
5V required for servo two major components: servos, controlled via pulse- for four ultrasonic sensor modules; the second group
use, not supplied width modulation (PWM) to move the robotic parts, and provides output support for four servos or other PWM-
Price ultrasonic sensors, which send out a pulse of inaudible controlled motors. All told, thats enough for a reasonably
From 15.99 ($25 approx) sound and listen back for the echo to measure distance proficient robot, but if you need more its possible to daisy-
Available from to solid objects. Combined, thats enough to build chain multiple UltraBorgs together to gain additional input
piborg.org everything from a simple two-wheel robot to a more and output channels, a handy feature tempered only by
complex robotic arm, although computer vision, aided by the 15.99 asking price per board.
80
Pros
Above PiBorg is behind the caravan-towing High-precision PWM control
DoodleBorg (bit.ly/1L1qgmL) and boards like combined with multi-channel
the XLoBorg motion and direction sensor ultrasonic sensor inputs make
getting started with robotics as
simple as possible for all
While it cant help you with the camera side of things, Cons
Those with more complex projects
the UltraBorg is positioned as the ultimate one-stop will nd that daisy-chaining
multiple UltraBorgs can get
device for budding roboticists expensive compared to lower-
precision 16-channel alternatives
The UltraBorg includes an on-board processor, a PIC, particular servos, while also limiting their minimum
which provides for real-time sensing and control while and maximum rotation points. When power is cut and
taking the pressure off the Pi more of an issue for the reapplied,theservoswillautomaticallyreturntothezero Summary
single-core Model B+ and Model A+ than the quad-core you have set. For protecting your build against damage
Raspberry Pi 2 while a Toshiba PWM controller provides from improper values or bad defaults, its a must-have. The UltraBorg is a
16-bit precision, an improvement on the 8- or 12-bit of its Although the UltraBorg isnt a Hardware Attached on marvellous device, with a
rivals. You dont need to know how to program a PIC to Top (HAT) standard device, it has been designed with compact size that belies
use the device as the chip arrives pre-programmed and piggyback mounting in mind. Screw holes on the board
its capabilities. The idea
of combining both input
sample code is provided for user-level interaction. itself are positioned to enable it to be attached above
and output onto one board
Installation of the UltraBorg is simple, taking up the or below any model of Raspberry Pi bar the Compute
means that its a literal
rst six pins of the GPIO header, although the use of Module or the very original Model B. These same holes
one-stop-shop for simple
multiple ultrasonic sensors or any number of servos will can also be used to mount the device elsewhere if you robotics projects, and the
require a separate 5V power supply, which is not provided are sacricing footprint for thinness or using it with a daisy-chaining support
with the board. This connects to a screw terminal and different microcomputer or microcontroller, a job made makes extending it simple.
can also supply power to the Pi itself, along with any easier thanks to the small size and weight of the board. However, sadly it is quite
additional UltraBorg boards, to make wiring as easy as PiBorg hasnt just launched the device blindly expensive compared to its
possible to conduct. either. The Pi-centric company has designed a range 16-channel competition
A particularly handy feature of the UltraBorg is the of accessories, including a BattBorg battery power thats available.
electrically erasable, programmable read-only memory supply, a 90-degree mounting bracket for the ultrasonic
(EEPROM) located within the PIC process, which is used sensorsandbundleswhich include quality servo motors,
to store start-up and limit values for the PWM outputs. sensors, and all the connecting cables.
Using this you can set a custom zero-point for your Gareth Halfacree
www.linuxuser.co.uk 81
Review Solus Beta 2
DISTRO
Solus Beta 2
A fresh distro built from scratch with a brand new desktop
environment called Budgie, Solus is designed to just work
CPU If the name sounds familiar, thats because the The rst thing youll notice is the custom-built
64-bit developer behind Solus Operating System, Ikey desktop environment, Budgie. The desktop is tightly
RAM Doherty (of Linux Mint Debian Edition fame), integrated with the GNOME stack, shipping out with
1 GB released a distro of a similar name in 2012: SolusOS. the 3.16.3 version in this second beta release (on top of
Unfortunately, SolusOS disappeared in 2013, which Linux 4.0.3). It is a refreshing, modern design, largely
Storage
was a shame because it came about in response to inspired by Chrome OS with some nods to GNOME and
4 GB
Ikeys work on LMDE, aiming to offer all the features OS X, and it manages to offer a fresh new experience
that Ikey believed should have been in Mints Debian rather than purely imitate the aesthetics of other
Edition, and it was rather good. Ikey has, however, desktops. That said, Budgie also has a GNOME 2
returned the rst beta of Solus arrived earlier theme if you want to use something more traditional-
this year under the name Evolve OS, which has looking. While this beta is still working through some
been changed to Solus Operating System due to a bugs, you can see that there is huge potential in this
trademark issue. While supercially similar, Solus and new desktop and it is undeniably gorgeous its
the original SolusOS are very different beasts while available in some of the repos if you want to test it on
the latter was based on Debian, the new Solus is built your main computer. Budgie also gives you a decent
completely from scratch. amount of conguration and control without you
82
Above Theres a welcome program to help get you started, though its software list is a little sparse right now
Pros
Beautifully made, a unique
Solus is specic to the desktop and 64-bit only, packaging system designed to
reduce developers workloads and
focusing on design, intuitiveness and software great out-of-the-box conguration
www.linuxuser.co.uk 83
Review Fedora 22
DISTRO
Fedora 22
Fedora branches into three distinct variants for its latest
release, building on the solid foundations laid in Fedora 21
CPU In the words of the developers, If this release had a this cycle, while the UI for Boxes has also been totally
1 GHz human analogue, itd be Fedora 21 after itd been to revamped with a better box creation assistant, new
RAM college, landed a good job, and kept its New Years preferences, default display scaling and a new feature
1 GB Resolution to go to the gym on a regular basis. that lets you send keyboard shortcuts through to a box.
Fedora 22 isnt a huge departure, but it does introduce In terms of software there are some other improvements
Storage
some great features and expands on those brought in with Fedora. KDE Plasma 5 and LXQt have both been
10 GB
for the previous release. There are now three separate packaged for this release, theres a brand new IDE for
editions of the distro, each tailored with packages GNOME called Builder, including features like split-
to suit its purpose: Cloud, Server and Workstation. panel editing and a Markdown preview, and theres a
Were focusing on the latter here, the desktop edition, new Preupgrade Assistant that assesses your system to
although there are some noteworthy features in the ensure its ready for the next upgrade. At the back end,
other two, including Docker images and Vagrant Boxes Fedora is now a step closer to running on Wayland, with
for Fedora Cloud and a default XFS lesystem on top the display server being used for the GNOME Display
of LVM for Fedora Server. Manager in this release (although the GNOME session
Vagrant has also been added to Fedora 22 still uses X), and the Elasticsearch indexing server has
Workstation, continuing the focus on virtualisation for been integrated with the Fedora repos.
84
Above For a full breakdown of Yum/DNF differences, check out http://dnf.readthedocs.org/en/latest/cli_vs_yum.html
Pros
The new GNOME 3.16 features and
DNF is an improvement over Yum, using the the DNF package manager are
highlights, and the three editions
dependency solver hawkey and then librepo for repo are well suited to their purposes
www.linuxuser.co.uk 85
Free
sample
issue
NETWORK BACKUP
PERMANENT KVM
1GBPS INTERNET
PRIVATE SUBNET
HARDWARE RAID
CONTRACT TERM
Whetheryoureahostingfirmor
ahappycustomerwhowantsa
CONNECTION
CPU CORES /
DISK SPACE
favouriteproviderlisted,dropus
MINIMUM
COST PER
PACKAGE
STORAGE
NUMBER
alinewiththedetails!
MONTH
PHONE
SPEED
linuxuser@imagine-publishing.co.uk
Dual Core
2200DC 0800 8085450 25 1 month 160GB N/A Raid 1
2.2GHz
Dual Core
3000DC 0800 8085450 40 1 month 2 x 250GB N/A Raid 1
3GHz
Intel 2.66GHz
2660QC 0800 8085450 65 1 month Quad Core Xeon 2 x 500GB N/A Raid 1
Processor
Bronze Managed
catalyst2 (www.catalyst2.com) 0800 107 79 79 199 1 month 1x 2.4GHz vCPU 50GB 99.90%
Dedicated Server
Silver Managed
catalyst2 (www.catalyst2.com) 0800 107 79 79 299 1 month 1x 2.4GHz vCPU 80GB 99.90%
Dedicated Server
Gold Managed
catalyst2 (www.catalyst2.com) 0800 107 79 79 399 1 month 2x 2.4GHz vCPU 150GB 99.90%
Dedicated Server
Dell PowerEdge R200
123-Reg (www.123-reg.co.uk) 0871 230 9525 69.99 12 months 4x 2.13GHz 2x 160GB 10Mbit 99.99% O
(Ubuntu Linux)
DellPowerEdgeR200
123-Reg(www.123-reg.co.uk) 08712309525 79.99 12months 4x2.13GHz 2x160GB 10Mbit 99.99% O
(WindowsWebEdition)
- full
Daily (www.daily.co.uk) Linux VPS Pro 0845 466 2100 29.99 1 month 2.27 Intel Quad Core 60GB 100Mbps * **
backup
- full
Daily (www.daily.co.uk) Linux VPS Max 0845 466 2100 59.99 1 month 2.27 Intel Quad Core 100GB 100Mbps * **
backup
- full
Daily (www.daily.co.uk) Windows VPS Pro 0845 466 2100 34.99 1 month 2.27 Intel Quad Core 60GB 100Mbps * **
backup
- full
Daily (www.daily.co.uk) Windows VPS Max 0845 466 2100 64.99 1 month 2.27 Intel Quad Core 100GB 100Mbps * **
backup
Daily (www.daily.co.uk) VPS Pro Hyper-V 0845 466 2100 44.99 1 month 2.27 Intel Quad Core 60GB 100Mbps * - 1GB **
Daily (www.daily.co.uk) VPS Max Hyper-V 0845 466 2100 74.99 1 month 2.27 Intel Quad Core 100GB 100Mbps * - 1GB **
Daily (www.daily.co.uk) VPS Ultra Hyper-V 0845 466 2100 139.99 1 month 2.27 Intel Quad Core 200GB 100Mbps * - 1GB **
Up to
Webfusion (www.webfusion.co.uk) Dell PowerEdge R210 0845 130 1602 79.99 12 months 2x 3.06GHz 250GB 99.99% Free O
100Mbit
Up to
Webfusion (www.webfusion.co.uk) Dell PowerEdge R210 0845 130 1602 119.99 12 months 4x 2.66GHz 2x 250GB 99.99% Free O
100Mbit
Up to
Webfusion (www.webfusion.co.uk) Dell PowerEdge R210 0845 130 1602 149.99 12 months 4x 2.66GHz 2x 500GB 99.99% Free O
100Mbit
O = Option
88
GET YOUR LISTING HIGHLIGHTED! CONTACT LUKE
luke.biddiscombe@imagine-publishing.co.uk
+44(0)1202 586431
Dedicated and Shared server listings
PHONE SUPPORT
SHOPPING CART
EMAIL SUPPORT
SERVICE LEVEL
WEB CONTROL
VIRUS FILTER
AGREEMENT
BANDWIDTH
WEB SPACE
ACCOUNTS
DATABASE
FIREWALL
MONTHLY
SUPPORT
PACKAGE
NUMBER
PHONE
PANEL
POP3
COST
NAME AND URL
Blacknight (www.blacknight.com) Minimus +44 (0)845 5280242 49.95 10GB 150GB 1,500
Blacknight (www.blacknight.com) Medius +44 (0)845 5280242 89.95 20GB 300GB 5,000
Blacknight (www.blacknight.com) Maximus +44 (0)845 5280242 149.95 30GB 600GB Unlimited
Digital Gibbon Ltd (www.digitalgibbon.com) Cheeky Chimp N/A Free 500MB Unlimited 5
Digital Gibbon Ltd (www.digitalgibbon.com) Digital Gibbon N/A 12 5GB Unlimited 10
eHosting (www.ehosting.com) Expert 0844 999 4100 95.88 5GB Unlimited 250
eHosting (www.ehosting.com) Virtual 0844 999 4100 227.88 50GB Unlimited Unlimited
Equiphase (www.equiphase.net) Platinum 0121 314 4865 114 1,200MB 40GB 200
Eurofasthost.com (www.eurofasthost.com) Premium 02380 249 823 250 10GB 25GB 100
Giacom (www.giacom.com) Business Pro 0800 542 7500 199 100MB 2GB 100
Heart Internet (www.heartinternet.co.uk) Starter Professional 0845 644 7750 29.80 2.5GB 10GB 1,000
Heart Internet (www.heartinternet.co.uk) Home Professional 0845 644 7750 89.99 10GB 50GB 10,000
Heart Internet (www.heartinternet.co.uk) Business Professional 0845 644 7750 129.99 Unlimited Unlimited Unlimited
Heart Internet (www.heartinternet.co.uk) Reseller Professional 0845 644 7750 299.99 Unlimited Unlimited Unlimited
NameHog (www.namehog.net) Email Only 0845 612 0330 11.75 25MB 1GB 5
NameHog (www.namehog.net) Standard Package 0845 612 0330 35.25 100MB 4.5GB 10
NameHog (www.namehog.net) Professional Package 0845 612 0330 58.75 250MB 8GB 25
NameHog (www.namehog.net) Expert Package 0845 612 0330 105.75 500MB 15GB 75
ServWise (https://www.servwise.com) Personal 0800 520 0716 25.20 1GB 10GB Unlimited
ServWise (https://www.servwise.com) Business 0800 520 0716 50.40 2GB 20GB Unlimited
ServWise (https://www.servwise.com) Reseller 0800 520 0716 126 4GB 40GB Unlimited
WebFusion (www.webfusion.co.uk) Fusion Professional 0845 130 1602 107.40 5GB 50GB 1,000
WebFusion (www.webfusion.co.uk) Fusion Business 0845 130 1602 179.40 10GB 150GB 1,500
WebFusion (www.webfusion.co.uk) Fusion Developer 0845 130 1602 227.40 20GB 300GB 5,000
WebFusion (www.webfusion.co.uk) Fusion Reseller 0845 130 1602 329.99 Unlimited Unlimited Unlimited
O = Option
www.linuxuser.co.uk 89
Questions Contact us...
Web: www.linuxuser.co.uk
& answers Email: linuxuser@imagine-publishing.co.uk
Q&A
Your questions
answered Send us your questions and well do our best to answer them!
FAQ
Linux media
centres
Q: Whats the difference between Kodi
and MythTV?
A: Kodi and MythTV work very differently,
although they can both perform similar
tasks. MythTV requires a back-end server
that enables it to power multiple front-end
TVs and other media devices, and it is a lot
more focused on recording content from
TV. Kodi will run without any assistance
from a server and specialises in playing
video les and streaming media. While
theres a lot less setup involved with Kodi,
if youre using it on more than one TV there
wont be any way to sync between them.
90
Steam
problems
Im running Xubuntu 15.04 and Ive tried to
download Steam from the Ubuntu Software
Center. It shows that Steam is there but when I
go to install it, it says its not.
I found Steam in the Synaptic package
manager and I was able to install it that way,
but when I did (I get a desktop icon and the
Steam icon is in the application menu) it would
not launch. I tried it from the command line
and got this error:
www.linuxuser.co.uk 91
Questions Contact us...
Web: www.linuxuser.co.uk
& answers Email: linuxuser@imagine-publishing.co.uk
92
I now have shares on both CentOS and the
Pi and I mount both of these on the F22 box. It sounds like what youre doing is following the
Initially I used rsync/ssh on F22 from the
CentOS share directly to the Pi (ie bypassing
symlinks from the backup directory rather than
samba at the Pi end). The existing share, which
I have been using for a while, is abc, and nabc is
having them change in unexpected ways
the new share on the Pi.
$ rsync -r -a -v -t -e ssh /mnt/abc/ This way, you dont need to mess around with to nd a way of querying the current session
pi@176.145.1.62:/mnt/extend/sharing/nabc/ samba and such, and the les will copy across from within the shell script to see if it was as a
as you expected without the slash in front of it! result of an su and then act accordingly.
all good. But that isnt what I wanted. I Many thanks!
wanted to copy from one share to the other: Sean
Above Whoami is an incredibly simple tool, but it does have its uses
www.linuxuser.co.uk 93
OpenSource Your source of Linux news & views
Contact us
Email us directly
linuxuser@imagine-publishing.co.uk
COMMENT
Your Letters
Questions and opinions about the mag, Linux and open source
Left Keep tabs on the Kickstarter campaigns
updates Next Thing will hopefully announce a
public launch date soon: kck.st/1APPBHs
Below As you can see, the CHIP really is quite a
tiny computer!
Cheap as CHIPs
Hello. Do you know when the CHIP computer is
coming out and why its so cheap? Its almost a
third of the cost of the Raspberry Pi!
Mark B
94
Look for
Twitter: Facebook: issue 155
on 30 July
@linuxusermag Linux User & Developer Want it sooner?
Subscribe THE MAGAZINE FOR
THE GNU GENERATION
today!
Imagine Publishing Ltd
Richmond House, 33 Richmond Hill
Bournemouth, Dorset, BH2 6EZ
+44 (0) 1202 586200
Web: www.imagine-publishing.co.uk
www.linuxuser.co.uk
www.greatdigitalmags.com
Magazine team
Editor Gavin Thomas
gavin.thomas@imagine-publishing.co.uk
01202 586257
Production Editor Siobhan Maguire
Designer Sam Ribbits
Features Editor Rob Zwetsloot
Photographer James Sheppard
Senior Art Editor Will Shum
Editor in Chief Dan Hutchinson
Publishing Director Aaron Asadi
Head of Design Ross Andrews
Contributors
Dan Aldred, Joey Bernard, Christian Cawley, Gareth Halfacree,
Tam Hanna, Richard Hillesley, Jon Masters, Aaron Shaw,
Richard Smedley, Nitish Tiwari, Mihalis Tsoukalos.
Advertising
Digital or printed media packs are available on request.
Head of Sales Hang Deretz
01202 586442
hang.deretz@imagine-publishing.co.uk
Advertising Manager Alex Carnegie
01202 586430
alex.carnegie@imagine-publishing.co.uk
Sales Executive Luke Biddiscombe
01202 586431
luke.biddiscombe@imagine-publishing.co.uk
Above Ubuntu and Kubuntu are excellent projects,
and we hope that they work this out amicably FileSilo.co.uk
Assets and resource files for this magazine can now be found
on this website.
Support filesilohelp@imagine-publishing.co.uk
Hi there. Im wondering if you can shed any light The KC requested specic information on International
on the recent fracas in Ubuntuland, because exactly how Jonathan had violated the CoC, Linux User & Developer is available for licensing.
Head of International Licensing Cathy Blackman
I saw the announcement that the Ubuntu stating that it saw no such evidence itself and
+44 (0) 1202 586401
Community Council had asked Jonathan Riddell that it was surprised these concerns hadnt licensing@imagine-publishing.co.uk
to step down from his position as leader on the been raised in the preceding 19th March Subscriptions
For all subscriptions enquiries
Kubuntu project and I am having trouble working meeting. Mark Shuttleworth then stepped in 0844 249 0282 (UK)
out what has actually happened. Thank you very on 24th May to reafrm the UCCs decision, +44 (0) 1795 418661 (Overseas)
Email: LUD@servicehelpline.co.uk
much in advance. explaining to Jonathan that this wasnt a 6 issue subscription (UK) 25.15
13 issue subscription (Europe) 70 (ROW) - 80
Oliver request and that they were simply informing him Circulation
that they no longer recognise him as the leader Head of Circulation Darren Pearce
01202 586200
Hi Oliver, of the Kubuntu community. What followed Production
Its a thorny issue and, at the time of writing, then was a protracted exchange between Production Director Jane Hawkins
still very much live. Essentially, Jonathan members of the KC (not all of them, since a great 01202 586200
Finance
Riddell, the Kubuntu project lead (although he many were ofine during the weekend these Finance Director Marco Peroni
does not hold a formal leadership position), exchanges occurred) and members of the UCC, Founder
Group Managing Director Damian Butt
has been in communication with the Ubuntu and the issue grew into a two-point fracas: the Printing & Distribution
Community Council since December 2013, KC wanted dialogue with the UCC on how to Printed by William Gibbons, 26 Planetary Road,
Willenhall, West Midlands, WV13 3XT
trying to get answers to questions he has progress with this issue, but on the condition
Distributed in the UK, Eire & the Rest of the World by:
about Canonicals intellectual property rights that they rst reverse their decision regarding Marketforce, Blue Fin Building, 110 Southwark Street
policy (see bit.ly/1dJ82ZH) and community Jonathan; the KC also took issue with the fact London, SE1 0SU
funding namely, the $140,000 in donations that the UCC made its decision behind closed 0203 148 3300
www.marketforce.co.uk
between 2012 and 2013 that cannot be doors and didnt seem to meet the CoC itself Distributed in Australia by:
accounted for by the UCC. The problem is in this case, simply demanding that Jonathan Network Services (a division of Bauer Media Group)
Level 21 Civic Tower, 66-68 Goulburn Street
ostensibly one of conduct rather than to do be removed despite the fact that the KC picked Sydney, New South Wales 2000, Australia
with the nature of Jonathans enquiries on and support him. On 26th May, the KC voted to +61 2 8667 5288
20th May, the UCC emailed both Jonathan reafrm Jonathans position on the Council. Disclaimer
The publisher cannot accept responsibility for any unsolicited material
lost or damaged in the post. All text and layout is the copyright of
and the Kubuntu Council mailing list to inform Much of the conversation was had in private, Imagine Publishing Ltd. Nothing in this magazine may be reproduced
in whole or part without the written permission of the publisher.
them of its decision to remove Jonathan from as it was felt that this was the best way to All copyrights are recognised and used specifically for the purpose
of criticism and review. Although the magazine has endeavoured
his leadership position, quoting a years worth resolve things at the time, but these emails have to ensure all information is correct at time of print, prices and
availability may change. This magazine is fully independent and
of perceived aggression, accusations and since been made public (see bit.ly/1EHEyjS). not affiliated in any way with the companies mentioned herein.
general disrespect to the UCC and Canonical as Both parties seem to agree that Jonathans If you submit material to Imagine Publishing via post, email, social
network or any other means, you automatically grant Imagine Publishing
evidence of a violation of the Code of Conduct. investigation into the IP policy and funding an irrevocable, perpetual, royalty-free license to use the material across
its entire portfolio, in print, online and digital, and to deliver the material
They asked Jonathan to step aside from his matters was important and necessary, so in to existing and future clients, including but not limited to international
licensees for reproduction in international, licensed editions of Imagine
KC leadership for a period of twelve months in large part it really does come down to the way products. Any material you submit is sent at your risk and, although
every care is taken, neither Imagine Publishing nor its employees,
order to gain some perspective on the issue, at that these two organisations and the people agents or subcontractors shall be liable for the loss or damage.
which point the KC rallied around Jonathan. within them interacted with each other.
Imagine Publishing Ltd 2015
ISSN 2041-3270
FileSilo
Tiny Core
Linux 6.2 Tails 1.4
LENGTH
OFVIDEO
TUTORIALS: 20HOURS
ALL THE
S
DISTROS, FOSAT
AND CO DE TH
YOU NEED TO
FOLLOW THE
MAGAZINE
96
FILESILO THE HOME OF PRO RESOURCES
DISCOVER YOUR FREE ONLINE ASSETS
A rapidly growing library No more broken discs
Updated continually with cool resources Print subscribers get all the content
Lets you keep your downloads organised Digital magazine owners get all the content too!
Browse and access your content from anywhere Each issues content is free with your magazine
No more torn disc pages to ruin your magazines Secure online access to your free resources
www.linuxuser.co.uk 97
FileSilo
HOW TO USE
EVERYTHING YOU NEED TO KNOW ABOUT
ACCESSING YOUR NEW DIGITAL REPOSITOR
ToaccessFileSilo,pleasevisitwww.filesilo.co.uk/linuxuser
01 Follow the
instructions
on-screen to create an
02 If youre a print
subscriber, you
can easily unlock all
03 You can access
FileSilo on any
desktop, tablet or
04 If you have any
problems with
accessing content on
account with our secure the content by smartphone device FileSilo, or with the
FileSilo system, then log entering your unique using any popular registration process, take a
in and unlock the issue Web ID. Your Web ID is browser (such as look at the FAQs online or
by answering a simple the eight-digit Firefox, Chrome or email filesilohelp@
questionabout the alphanumeric code Safari). However, we imagine-publishing.co.uk
magazine. printed above your recommend that you
You can address details on the use a desktop to
access the mailing label of your download content, as
content for subscription copies. It you may not be able to
free with your can also be found on download files to your
issue. your renewal letters. phone or tablet.
MORE TUTORIALS
AND INSPIRATION
Finished reading this issue? Theres plenty more free and open source goodness
waiting for you on the Linux User & Developer website. Features, tutorials, reviews,
opinion pieces and the best open source news are uploaded on a daily basis, coverin
Linux kernel development, the hottest new distros and FOSS, Raspberry Pi projects
and interviews, programming guides and more. Join our burgeoning community of
Linux users and developers and discover new Linux tools today.
98
Normal Use Heavy Use Back To Normal
ELASTIC CONTAINERS
from
3
a month
FREE TRIAL
www.elastichosts.co.uk
sales@elastichosts.com 020 7183 8250