linux user

100
Use Openbox to optimise your desktop How safe is your network? Pentest your network like a pro Photo managers Find the perfect package in our super-test 10 Speed up your PC ALSO INSIDE » Learn MongoDB » Elementary OS interview exclusive RASPI PROJECTS MADE EASY CCTV camera • Media centre • Wi-Fi router • Retro console & more How to build a GUI in Python Easy UI creation with Tkinter www.linuxuser.co.uk FOR THE GNU GENERATION THE MONTHLY MAGAZINE MASTER PUPPET Hacking health care Can open source save it? Reviewed in this issue: Raspberry Pi Camera Module Embedded Pi • AV Linux ISSUE 129 30 PAGE RASPBERRY PI SPECIAL

Upload: alin-hricu

Post on 30-Nov-2015

141 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Linux User

Use Openbox to optimise your desktop

How safe is your network?Pentest your network like a pro

Photo managersFind the perfect package in our super-test

10Speed up your PC

ALSO INSIDE

» Learn MongoDB» Elementary OS

interview exclusive

RASPI PROJECTS

MADE EASYCCTV camera • Media centre • Wi-Fi router • Retro console & more

How to build a GUI in Python

Easy UI creation with Tkinter

www.linuxuser.co.uk

FOR THE GNU GENERATIONTHE MONTHLY MAGAZINE

MASTERPUPPET

Hacking health careCan open source save it?

Reviewed in this issue:Raspberry Pi Camera ModuleEmbedded Pi • AV Linux ISSUE 129

30 PAGE RASPBERRY PI SPECIAL

Page 2: Linux User

WorldMags.netWorldMags.net

WorldMags.net

Page 3: Linux User

Mihalis Tsoukalos has over 15 years of UNIX system administration and programming experience and has been using Linux since 1993. He is also proficient in Oracle database administration, Cisco IOS and Cocoa. See his first tutorial for Linux User about MongoDB, which starts on page 64.

Stuart Burns is an experienced Linux and virtualisation specialist for a Fortune 500 company and enjoys writing about Linux. This month he shows us how to make our life easier when it comes to caretaking multiple machines. You can fi nd his excellent Puppet tutorial starting on page 50.

Liam Fraser is the creator of the hugely popular RaspberryPiTutorials YouTube series and is a Linux server admin for the Raspberry Pi Foundation. This month Liam flexes his project-making muscles by creating two of our ten Raspberry Pi projects which start on page 24.

Joey Bernard has been using Linux at home for almost 20 years and he’s now getting paid for it as a computational research consultant with ACEnet. In this issue Joey gets serious about pentesting with a four-page tutorial demonstrating the power of Kali Linux (pages 46-49).

Gareth Halfacree is our new resident news

reporter and brings us news from all over the open source ecosystem starting on page 10. Find out why the EU is probing Google and what Sony has open-sourced. Also this month Gareth reviews both the Raspberry Pi Camera Module and the Embedded Pi.

Rob Zwetsloot studied aerospace engineering at university, using Python to model complex simulations in class. Among other things this issue, Rob explains no less than four of the projects for our Raspberry Pi cover feature and finds out which photo manager you should be using (page 70).

Issue 1293

Yo

ur

tea

m o

f L

inu

x e

xp

ert

s…

Get in touch with the team:[email protected]

Welcometo issue 129 of Linux User & Developer

Welcome to the latest edition of Linux User &

Developer, the UK and America’s favourite high-end

open source and Linux magazine.

We’ve spent a lot of time wondering over the power

and versatility of the Raspberry Pi in Linux User &

Developer. As an educational tool it has reignited

interest in real bare-metal computing in schools

around the world. As a platform for open source software

it’s inspired thousands to try Linux for the fi rst time. Best of

all, though, is that in its role as a development platform the

Raspberry Pi has empowered talented makers and tinkerers

from all walks of life to create some truly stunning projects.

We’re not all blessed with the tools and talent to take pictures

with our Raspberry Pis from the very edge of space, though, so

that’s what this month’s 22-page special feature is all about –

really useful projects we mere mortals can do in a day.

We’ve included almost everything you need to give them a

try and each guide is broken down into manageable bite-sized

chunks with full source code if it’s required.

Give them a try and get inspired to create your very own

Raspberry Pi project – next time it could be your project we’re

featuring in the magazine.

Russell Barnes, Editor

Buy online

Get Linux User

for £4.19 per issue

Page 22

» Speed up your PC» Pentest your network» Build a GUI with Python» Get practical with your RasPi

This issue

Visit us online for more news, opinion, tutorials and reviews:

www.linuxuser.co.uk

LinuxUserUK @linuxusermag

WorldMags.netWorldMags.net

WorldMags.net

Page 4: Linux User

Contents

Join us online for more Linux news, opinion and reviews www.linuxuser.co.uk

www.linuxuser.co.uk4

06 News The biggest stories from the

open source world

14 OpinionsThe latest from your favourite

free software columnists

85 BooksThe latest Linux reads

dissected

94 Letters Your views on the magazine

and the open source scene

OpenSource

96 Cover disc The very latest

distros on DVD!

On your free disc

Fedora 19

Knoppix

Linux Lite

Tails

Tutorials46 How safe is your network? One of the best forms of defence is offence.

Tear your network apart with Kali Linux

50 Keep all your machines in a line the easy way with Puppet Keep your networked machines in sync

54 Speed up Linux with Openbox Install and confi gure Openbox, the

lightweight window manager

Developer tutorials

Features06 Hacking health care

Can open source save it?

24 10 Raspberry Pi projects made easy Dust down your Pi and put it

to good use

70 Photo manager super-test Which open source solution

should you be using?

88 Q & A Your questions answered by

our panel of experts

06 Hacking health careThis month we’re asking the big question – can open source save the health-care system? Richard Smedley tackles the topic in this month’s news feature…

58 Build a GUI with Python Get to grips with Tkinter

64 Make a MongoDB database Master the NoSQL database system

Reviews

Subscribe today!

22 Save at least 30% on the shop price. US customers can subscribe via page 84

FEATURE

76 Raspberry Pi Camera Module

Snap happy?

78 Embedded Pi The ultimate companion?

81 LG Optimus L3 II One of the smallest

Androids available

82 AV Linux The best in open source

media editing?

24 Do something amazing with your Raspberry Pi today!

Software70 Photo manager super-testWhich of our open source choices

gets you the best results?

digiKam

gThumb

F-Spot

Shotwell

WorldMags.netWorldMags.net

WorldMags.net

Page 5: Linux User

Can you volunteer for Code Club?

We need people who know how to program computers to volunteer to run a club at their

local primary school, library or community centre for an hour a week.

We create the projects for our volunteers to teach, the projects we make teach children how

to program by showing them how to make computer games, animations and websites.

Get involved, let’s teach the next generation to code!

Code Club is a nationwide network of volunteer-led after school coding clubs for children aged 9-11.

Visit www.codeclub.org.uk to find out more

WorldMags.netWorldMags.net

WorldMags.net

Page 6: Linux User

6

When health care is struggling to meet demand, open source innovation could improve service and save money…

And caring, tooThe NHS has the relative luxury of a ring-fenced

budget. Adult social care has been hit with

unprecedented cuts, and local authorities (who

are responsible for most social care provision)

are dipping a toe in the open source waters and

fi nding them unexpectedly welcoming (see

‘DALLAS to Liverpool’ boxout).

It may not please all of the giant corporations

currently dominating the health and social care

industries, but the door is opening to small, agile

competitors and – from the FOSS world – hack

days are introducing free software coders and

startup businesses to health-care professionals

and decision-makers.

Health hack days bring together “developers,

designers, clinicians, health-care professionals,

marketers, project managers, researchers

and coders” to produce working technological

solutions to health-care problems in a

concentrated session of 24 or 36 hours – often

Maintaining or increasing real-terms spending

on health may be a brave decision in austere

times but, despite the public sector wage

freeze, budgets cannot keep pace with the rising

cost of health care and an ageing population.

However, from pressure to change the way we

do things to make budgets go further comes

opportunity for real innovation, and an entry for

the nimble (did someone say agile?) hackers of

the free and open source movement.

The fi gures are so high as to seem near-

meaningless – with 1,400,000 employees, a

budget of more than £100 billion, 2,300 hospitals

and 10,500 GP practices, the NHS deals with

over 1 million patients every 36 hours.

Costs are notably high across the sector. LUD

was told of a simple tray costing the NHS £75,

because it has to be ‘medical grade’ plastic.

Imagine instead 3D printers in every hospital

producing plastic parts to order from open

source designs.

6 News | 14 Opinion | 94 Letters

www.linuxuser.co.uk

Can open source save health care?

Following the pitches, pitchers had to hustle for developers

CC:

Cra

ig S

tron

g, fo

r NW

Hea

lth

Hac

k

CC: Craig Strong, for NW Health Hack

CC:

Cra

ig S

tron

g, fo

r NW

Hea

lth

Hac

kC

C: C

raig

Str

ong,

for N

W H

ealt

h H

ack

WorldMags.netWorldMags.net

WorldMags.net

Page 7: Linux User

www.linuxuser.co.uk7

The latest in the Linux community

News

OPEN SOURCE

running over a weekend. Special interest

groups like Health 2.0 (see boxout on page 9) are

bringing together innovators to collaborate on

health problems at events around the world. One

weekend this June, LUD attended Manchester

Health 2.0’s inaugural North West Health Hack,

at Barclays’ largest Global Technology Centre,

near Knutsford in Cheshire.

The Cheshire setBarclays hides over 3,000 techies away on

this campus, but recently it has been reaching

out to the local tech community – including

sponsoring the Manchester branch of TechHub

(part of a worldwide community of collaborative

spaces for technology entrepreneurs). Hosting

the North West Health Hack on behalf of

Manchester TechHub is a further step to

supporting the region’s tech community.

Barclays’ Julian Bucknall joined Pascal

Lardier, from Health 2.0 Europe, in compering

the event, supported by Ben Hookway of

TechHub, Idalia Dawidowska the Health 2.0

Manchester Chapter Leader, and a team of

TechHub and Barclays staff to keep everyone

supplied with coffee, pizza and all the other

accoutrements of an all-night hack.

Introductory talks included a useful

orientation to developing for health care in the

form of Quinec CEO Robbie Hughes’s ‘10 Rules

for Health Startups’ – such as “health care is

a system, not a market” – which encouraged

developers and entrepreneurs to try to

understand doctors and other clinicians, and

their working environment, in much the same

way that Linux advocates try to orient outsiders

into the FOSS world. However, the health world

is one of compliance and paperwork, and teams

need to allocate appropriate resources to this.

Professor Shôn Lewis had some interesting

statistics comparing the size of health-care

domains and the amount spent on research,

which showed mental health problems

disproportionately missing out. He introduced

mobile app ClinTouch, a way for people with

psychosis to keep track of any symptoms and

problems, to give users more control over

managing these through better awareness, and

to enable early intervention.

Ideas, pleaseWith judges for the apps including a clinician and

a venture capitalist, emphasis for the weekend

was on practical projects that could achieve

a place in the competitive mHealth/eHealth

market. There were also business mentors on

hand, to complement the more technical help.

Pitches were a pleasant surprise: of the 15

one-minute proposals given, the vast majority

were well-thought-out ideas for solving

problems, with viable products potentially in

sight by the end of the weekend. We heard them

summed up by one of the organisers as “proper

doctors trying to solve proper problems”.

Pitches were often from practitioners facing a

hurdle in their working day, but some were more

personal, from those who had encountered a

“The NHS deals with over one million patients every 36 hours”

Max Zadow organised the fi rst ever Adult Social Care Hack Day in the UK, in Liverpool, last year – with the co-operation of the local council. Although they were “quite scared by it” Zadow tells us, budget cuts in social care have left authorities genuinely open to new ideas. The council’s internal teams liked the event, as did small providers, and a further hack day was organised, as well as events in other regions.

From these events many collaborations arose. Zadow is now working with Mark Chapman on Staff Plan, his rostering software – it was “fun to meet a fellow enthusiast” Zadow told LUD, speaking of his collaborator’s interest in the project for its own sake, not as just another job.

As well as small-scale projects, technologies and ways of working and innovating demonstrated at the Liverpool events have played a big part in Merseyside gaining £7 million of Delivering Assisted Lifestyles Living At Scale (DALLAS) programme funding. As we go to press, Liverpool’s business festival, Accelerate, is hosting a fringe event on mHealth, built on the work done by partnerships formed from the Adult Social Care Hack Day events. There is a move, says Zadow, “to see Liverpool as a national centre of excellence for mHealth / eHealth / assisted living.”

Max Zadow leading the Liverpool Adult

Social Care Hack Day

Pair programming: practitioners and coders collaborating

DALLAS to Liverpool

CC:

Cra

ig S

tron

g, fo

r NW

Hea

lth

Hac

k

CR

EDIT

: Fél

ix B

rass

ier o

n be

half

of R

ed N

inja

.

WorldMags.netWorldMags.net

WorldMags.net

Page 8: Linux User

www.linuxuser.co.uk8

disease directly. Carey Cameron, of Digital mC2,

proposed a mobile app to ‘gameify’ screening

for bowel cancer – one of the top three cancers

by fatality in the UK, which is taking 16,000 lives

per year (and growing in incidence by 10 per cent

per annum) and costing the NHS more than

£1.1bn annually.

3Squared commercial director James Fox

and UX designer Alex Pawlak teamed up with

Cameron to produce ‘Gut Feeling’ – to raise

consumer awareness of symptoms of bowel

cancer; engage participation and motivation

among ‘at risk’ target groups; and improve

national screening uptake fi gures (currently only

9 per cent). It was singled out for praise by one

of the judges, Dr Ranjit Gill, chief clinical offi cer

from NHS Stockport, and came second overall.

Abstrakt & open dataChris Garrett’s team at multi-platform developer

Abstraktion is used to dealing with massive data

sets, so led a team investigating prescription

data to fi nd the best areas for recruiting for new

drug trials. By lunchtime on the fi rst day they’d

crunched through 15 million lines of data and

were discussing data visualisation ideas.

Catriona Kennedy, who had proposed a

more transparent view of patient data, giving

information about where the data is used,

teamed up with Idalia Dawidowska, who

Code is at https://github.com/taggr and a

short video of the app is at clickinnovate.com.

Back in the NHSWhile Health 2.0 has come from entrepreneurs

and coders, and the Liverpool Adult Social Care

events were initiated by service users and coders

(although both were well received by health

professionals), clinicians have also initiated

hack-day events.

Dr Carl Reynolds – with David Miller, and

coder Ross Jones – started NHS Hack Days last

year to get doctors talking to the free software

community about their needs. Events have

Your source of Linux news and viewsOpenSourcewww.linuxuser.co.ukFor the latest news and views

Email us directly…[email protected]

wanted to see patients having the “right data

at the right time”. They worked in an expanded

team to produce a system helping to empower

patients through self-management of data

about symptoms.

This combining forces on similar ideas is

not unusual at hack days and unconferences

– a fl exibility not enjoyed by events which are

timetabled and set in advance. However, while

agile working may be standard for software

startups, rapid pivoting is not an option for

many medical apps, according to Robbie

Hughes. Practitioners “need to be sure that

they’re working and tested, and then signed off,”

Hughes told us, adding they had to work with “a

waterfall/agile hybrid” of their own.

Tracking winnersThe eventual winner was the team from

Manchester-based developer Click Innovate,

who worked through the Saturday night to deliver

Taggr. It uses near-fi eld communication (NFC)

– the technology featured in new smartphones

that is poised to transform payment systems, and

much else, once security niggles are ironed out

– to track patients’ locations and their medical

needs, reducing the “administrative burden on in-

patient secondary care.”

In this case the NFC devices are a lightweight

type that can hold 40 bytes, and can be used

in place of stickers and wristbands which are

commonly used in NHS wards for tracking

patients and objects.

Medical student Vincent Simpson wants to end human error in drug dilution – the most preventable cause of patient harm

Taggr, the winner of NW Health Hack, starts life on the drawing board

The taggr.io user interface – using mobile to cut the bureaucracy burden

CC:

Cra

ig S

tron

g, fo

r NW

Hea

lth

Hac

k

CC:

Cra

ig S

tron

g, fo

r NW

Hea

lth

Hac

k

WorldMags.netWorldMags.net

WorldMags.net

Page 9: Linux User

www.linuxuser.co.uk9

Not all medical software has a political aim,

of course. oPortfolio – “a better NHS portfolio”

– is simply aimed at helping anyone progressing

through a medical career and fi nding themselves

hampered by the dreadful ePortfolio software

currently available to them.

Indeed the NHS’s ePortfolio is so notoriously

bad that Dr Laura-Jane Smith started the

“ePortfolio Data Liberation Front”, and at 2012’s

Liverpool NHS Hack Day spoke movingly on the

need to “liberate data” from it, inspiring an app

worked on with Python hacker Nicholas Tollervey,

and Dr Marcus Baw, that won a ScraperWiki prize.

Healthier, happierThere’s much energy and ingenuity going into

solving health problems, particularly in the North

West, but can hackers save health care? Not

on their own – the NHS has huge problems in

particular with management and training – but

the kind of agile, low-cost solutions that can

make practical differences to people’s lives is

coming out of hack days and free software.

Another product is the regional boost to

industry, as small tech companies thrive in this

new collaborative health ecosystem. This is

particularly the case in the North West, where

Connected Liverpool’s vision of public health as

included London, Liverpool and Oxford, and

generated solutions to help with everything

from collating faults in the UK health service

(NHSBugs.net) to fi nding out what NHS labs are

currently storing and where.

Sometimes only the simplest of apps are

needed to get round painful practices that NHS

inertia has been trapping doctors in for years, or

even decades. Haematologist Wai Keong was

having to count instances of 11 different types of

blood cells in samples using what is essentially an

abacus – but one with only eight levers! From the

NHS Hack Days came CellCountr, a JavaScript

webpage to turn the computer keyboard into an

abacus with enough levers.

Go to nhshackday.com for upcoming NHS

Hack Days, including Cambridge in September,

and get involved.

Open?Not untypically, the term ‘open source’ is

sometimes used ambiguously for open APIs

and open data in health care, while describing

software that is not free and open – a problem

acknowledged by Health 2.0 Manchester

with a forthcoming meeting on the topic.

Nevertheless, much of the innovative work

going on is with explicitly free and open source

software events – and NHS Hack Days, for

example, “support openness and invite you to

share code with us on GitHub.”

Out of these teams have come FOSS apps

like RandomiseMe.org, a platform that enables

“individuals and organisations to run trials of

varying sizes” – and backed by Ben Goldacre’s

BetterData.org.uk as it “helps to spread the idea

of randomised trials, advocate for their wider use,

and normalise them in the public imagination.”

The latest in the Linux community

News

OPEN SOURCE

a driver for smart cities through preventative

measures – “cities empowered by maker

communities to be healthier and happier”, in the

words of Max Zadow – is a thread running through

much of the assisted living development work.

It’s not just the North West – Health Hacks at

both ends of Ireland, and medical technology

startup companies across Britain, are showing

practitioners the way. In 2010, when the

comprehensive spending review was launched,

a Treasury spokesperson said: “Anyone who

thinks the review is just about saving money

is missing the point. This is a once-in-a-

generation opportunity to transform the way that

government works.”

However, ring-fenced budgets have protected

the NHS from this, despite pressure coming

from population factors and cuts to social care.

Given this, pressure for change must come from

below, too – and collaboratively produced work

of doctors and carers, with FOSS developers,

responding quickly to real needs, is convincing

many health and social care managers that

useful changes are not just desirable, but

actually possible. Words by: Richard Smedley

“Sometimes only the simplest of apps are needed to get round painful practices that NHS inertia has been trapping doctors in for years”

Health 2.0 LUD caught up with Idalia Dawidowska, the Polish doctor turned entrepreneur who leads the Manchester Chapter of Health 2.0. Centred on Manchester, the group attracts membership across the North, and contains around a third techies and almost as many clinicians, plus researchers, patient representatives and technology investors.

Dawidowska told us “an increasing number of technology companies want to provide to the NHS.” Health 2.0 is helping support an “ecosystem of people from the problem domain: clinicians, patients and NHS managers; meeting with technology people: designers and developers.”

They want to “inspire ideas” for solving the plentiful “burning health-care problems” through technology. In Dawidowska’s case, this is ineffi ciencies that can be overcome simply through access to data.

Idalia Dawidowska recruits team members for her transparent access to patient data project

CC:

Cra

ig S

tron

g, fo

r NW

Hea

lth

Hac

k

WorldMags.netWorldMags.net

WorldMags.net

Page 10: Linux User

Advertising and search giant Google is

once again facing the glare of an antitrust

probe from the European Union. This follows

complaints made by rivals in the mobile space,

including Windows Phone creator Microsoft and

its primary licensee Nokia.

The complaints, which first came to light

through documents provided to the Financial

Times, claim that Google provides licences

to its Linux-based Android operating system

at below cost level – an interesting claim,

considering that the bulk of Android is licensed

under a permissive licence as part of the

Android Open Source Project (AOSP) and

is therefore available for even commercial

exploitation free of charge.

More seriously, the Competition Commission

is looking into charges that Google has asked

those who do pay for an Android licence, in order

to gain access to the Google Play app store or

Google-specific applications such as Gmail

and Google Calendar, to cancel or at the least

delay launching smartphones based on rival

operating systems.

Google has been unwilling to comment on the

case so far, but did provide a statement which

roughly denies the claims made by Microsoft

and others. “Android is an open platform that

fosters competition. Handset makers, carriers

and consumers can decide how to use Android,

including which applications they want to use,”

the company stated, but refused to be drawn on

the details of the case.

www.linuxuser.co.uk10

GOOGLE

Google under EU antitrust probe

The EU is keeping Google’s Kent Walker busy

Competition Commission investigating complaints from Android competitors

“The internet is the greatest level playing field ever. More and more, people are voting with their feet – or at least their cursors” Kent Walker, Google

Your source of Linux news and viewsOpenSourcewww.linuxuser.co.ukFor the latest news and views

Email us directly… [email protected]

Microsoft, Nokia and others claim that Google giving away Android is anti-competitive

This isn’t the first time the EU has investigated

the company, which draws the bulk of its

revenue from advertising. In 2009, as the result

of a US-based class action lawsuit, Google was

forced to spend $125 million establishing the

Book Rights Registry service, but came under

the EU’s scrutiny due to its effect on European

authors and publishers.

The new probe comes as Google is already

facing the end of a two-year investigation into

allegedly anti-competitive behaviour relating

to its search engine, which competitors claim

unfairly promotes Google’s own products in

its results pages without properly marking

the results as being ‘promoted’ rather than

natural. While a settlement has been offered by

Google, complainants claim that the proposals

– which would see the company better

labelling promoted results – are inadequate

and should be reviewed by the EU Commission

once again.

Google, naturally, disagrees. “Our proposals

are meaningful and comprehensive, providing

additional choice and information while also

leaving room for future innovation,” claimed Kent

Walker, general counsel for the company. “As

we’ve always said, we build Google for users, not

websites. The internet is the greatest level playing

field ever. More and more, people are voting with

their feet – or at least their cursors. That free flow

of information means that millions of websites

– including ours – now compete directly for

business, bringing you more information, lower

prices and more choice.”

WorldMags.netWorldMags.net

WorldMags.net

Page 11: Linux User

www.linuxuser.co.uk11 www.linuxuser.co.uk11

Linux calendar

05

-11

Au

gu

st

20

13 Festival of Code

» Various

» Uk» youngrewiredstate.orgPart of Young Rewired State, the Festival of Code sees under-18s across the UK introduced to programming and the use of open data before meeting up in Birmingham on the Friday for talks, pizza and an overnight stay.

Flock » College of Charleston, South

Carolina» USA» flocktofedora.orgThe successor to the traditional Fedora Users and Developers Conference (FUDCon), Flock is a new conference for Fedora contributors with a focus on talks, networking, feature development, and – for the fi rst time – open hardware.

FrOSCon 2013» University of Applied Sciences,

St Augustin» Germany» froscon.deIn its eighth year, the Free and Open Source Software Conference has as its focus seamless computing, the role of free software in closed ecosystems, and the growing popularity of ‘mechanical turk’ systems for farming off repetitive tasks.

Fantec has been found guilty of breaching

the terms of the GNU General Public

License (GPL) with its 3DFHDL Media Player,

with the court ordering a penalty payment

and fees to be paid.

The case, brought by GPL-Violations.org

founder Harald Welte, accused the company

DebConf13 » Le Camp, Vaumarcus» Switzerland» debconf.orgThe annual Debian Conference, preceded by a week-long DebCamp starting on 6 August, features speakers from around the world and a defi nite technical bent to its schedule – including collaborative coding parties.

Sony’s SmartWatch products – wrist-

wearable computers designed to

communicate over short-range radio links

with an Android smartphone or tablet –

haven’t exactly taken the world by storm, but the

company is hoping to enlist some open source

help in turning its fortunes around.

As part of a company-wide programme

that has seen Android Open Source Project

(AOSP) ports for many of its products, including

the high-end Xperia Z smartphone and

Xperia Tablet Z, Sony has released code and

instructions for creating third-party fi rmware to

be installed upon its SmartWatch products.

Sony has already released one such fi rmware

publicly, providing compatibility with the Arduino

IDE following a hack-day collaboration between

the two companies in Malmö, Sweden in July.

Other fi rmwares are expected to appear shortly,

some of which will likely take advantage of the

near-fi eld communication (NFC) capability

introduced in Sony’s most recent watch model.

“With the Open SmartWatch project, we’re

opening up the device even more,” the fi rm

boasted in its announcement of the move, before

warning that the process “is only for advanced

developers [and] normal consumers are strongly

advised to keep the offi cial tested and verifi ed

Sony fi rmware” on their SmartWatches.

More details are available at:

tinyurl.com/sonyosw

HARDWARE

Company looks to interest hackers in its wares

Sony’s SmartWatch now supports third-party firmware, including one Arduino-compatible example

OPEN SOURCE

Fantec found guilty in GPL case

09

-12

Au

gu

st

20

13

24

-25

Au

gu

st

20

13

The latest in the Linux community

News

OPEN SOURCE

Sony opens its SmartWatch

of distributing fi rmware containing the

iptables tool without corresponding source

code. The court agreed with Welte in its

decision.

“It is great to see that the court

acknowledges the fact that vendors

themselves are responsible for checking

their products for GNU GPL compliance,”

said Welte of his victory.

“Every company distributing the software

has to comply,” added Matthias Kirschner

of the Free Software Foundation Europe.

“Companies obviously see the benefi t in

building upon free software, and they should

stick to these basic and simple rules.”

Fantec’s 3DFHDL Media Player has been found in breach of the GNU General Public License

11-1

8 A

ug

us

t 2

01

3

WorldMags.netWorldMags.net

WorldMags.net

Page 12: Linux User

Your source of Linux news and viewsOpenSourcewww.linuxuser.co.ukFor the latest news and views

Email us directly… [email protected]

www.linuxuser.co.uk12

Continues process of open-sourcing its tools

OPEN SOURCE

Video streaming giant Netflix has released

yet another of its internal tools under an open

source licence, this time the platform-as-a-

service (PaaS) tool Genie.

Used by Netflix to manage Hadoop clusters

on cloud computing services, Genie is designed

to provide a higher level of abstraction for

Hadoop, Hive and Pig jobs through a REST-ful

API without needing clients for the services or the

provisioning of new Hadoop clusters.

“Why did we build Genie, as opposed to using

something else that is already available? The

simple answer is that there was nothing that was

already out there in the open source community

that handled our requirements,” explained

Netflix’s Sriram Krishnan. “An API to run jobs,

abstraction of back-end clusters, an ability to

submit jobs to multiple clusters, and scalable

HARDWARE

Netflix continues to promote open source, releasing a Hadoop tool dubbed Genie

Netflix releases Hadoop ‘Genie’C

C : H

P S

chae

fer,

ww

w.r

eser

v-a-

rt.d

e

enough – horizontally or otherwise – to support

our usage.”

Genie is one of several tools Netflix has

released under the Apache Licence Version 2.0

in recent months, including the ‘Chaos Monkey’ it

uses to disable servers at random in order to test

for single points of failure in its infrastructure.

Netflix has positioned Genie as an alternative

to Templeton, part of the Apache HCatalog

project, but claims it has several advantages.

“Templeton doesn’t support concurrent job

submissions to more than one cluster, is still

evolving, and doesn’t appear quite ready for

production,” claimed Krishnan.

While Netflix is using a modified version of

Genie in production, the company warns that the

software is in the very early stages – described

in the documentation as ‘Version 0’ – and may

not be suitable for immediate deployment in

other infrastructures.

The Genie code, along with other projects, is

available from the Netflix Open Source Centre at:

netflix.github.io

City looks to save €100,000 over closed-source productsThe Italian Municipality of Genoa has issued

a report that changes how its information

management department will treat the

software tendering process, shifting from

an equal opportunities stance between

proprietary and open source software to

actively favouring the latter.

In a report published by the council (tellingly

in the Open Document Format), officials outline

a stance that will concentrate on the use of free

and open source software (FOSS) with a view to

saving a considerable portion of its budget.

The report, ‘Software Libero’, published by

the Direzione Sistemi Informativi (Information

Systems Management) division, outlines

numerous alternatives to commercial packages

– The Gimp in place of Adobe Photoshop,

7Zip instead of WinZip, PdfCreator in place of

Adobe Acrobat and, naturally, Linux in place

of Microsoft Windows. Other cost-saving

measures proposed by the report include

extending the lifespan of computer hardware by

switching to Linux over more resource-hungry

proprietary platforms, with older machines

being provided free of charge to schools with

educational packages pre-installed.

In future, the Municipality will be giving

stronger consideration to free and open source

Genoa backs open sourceprojects over their closed-source equivalents

when tendering projects. However, moving

existing systems and platforms across to FLOSS

packages won’t happen overnight, the report’s

authors warn.

“Given the breadth and complexity of the

information systems used by the Municipality,”

the report reads, “the introduction of

free software and open source should

be approached carefully, assessing the

impact on systems in use, compatibility,

complexity of migration, and potential costs

resulting from adjustments of systems and

training needs.”

Genoa’s council is to prioritise a shift to open

source software

WorldMags.netWorldMags.net

WorldMags.net

Page 13: Linux User

The latest in the Linux community

News

OPEN SOURCE

Oracle’s various products float on Microsoft’s Azure cloudRivals Oracle and Microsoft have signed an agreement that will see

the former’s products brought to the Azure cloud platform.

“This partnership will help customers embrace cloud computing

by improving fl exibility and choice,” claimed Satya Nadella,

Microsoft’s president of server and tools, of the deal. “As part of

this partnership Oracle will certify and support Oracle software on

Windows Server Hyper-V and Windows Azure.”

That includes, Nadella explains, Infrastructure Services instances

of preconfi gured Oracle Database and

Oracle WebLogic Servers, available to

those who do not have Oracle licences,

along with the ability to launch Oracle

Linux instances on the Azure cloud

platform. Oracle’s Java is also

to be integrated into Windows

Azure, the two companies

have confi rmed.

“The cloud computing

era – or, as I like to call it,

the enterprise cloud era –

calls for bold, new thinking,” stated

Nadella. “It requires companies to

rethink what they build, to rethink

how they operate and to rethink

whom they partner with.”

CLOUD

Oracle and Microsoft partner in the cloud

Sony’s next-generation PlayStation 4 games console will run a customised version of the Berkeley System Distribution (BSD,) it has been revealed. Orbis OS, based on FreeBSD 9.0, will include a revamped version of the company’s closed-source XrossMediaBar (XMB) user interface. The OS boots using GRUB, although this will almost certainly be locked down. While Sony has not offi cially commented, its decision to fork FreeBSD rather than a Linux distribution is thought to be related to BSD’s use of permissive licences. Using 64-bit x86 Jaguar processors from AMD, the PS4’s hardware is theoretically compatible with most modern operating systems and kernels.

GAMES

“[It] probably never will support anything other

than AT-hard disks, as that’s all I have” comes

at the end of the famous newsgroup post by

Linus Torvalds that originally announced Linux. In

hindsight, we know this couldn’t be further from

the truth; however, unlike most history, it’s fully

documented and permanently archived.

Documenting the rest of history is where

All About History comes in, delivering the most

accurate stories and facts from history in both

historic print form and futuristic digital editions.

In the fi rst issue, All About History looks at

DIGITAL

Delve into the past so that you’re not condemned to repeat it with our new sister magazine All About History, issue 1 out now

50 other events that changed the world. This

includes the American Civil War, which ultimately

led to the civil rights movement, along with

scientifi c and technological advancements that

allowed us to land on the Moon.

All About History issue 1 also delves into

revolution, a concept well known to free and open

source software advocates. Issue 1 is out now in

all good newsagents, from the Imagine Shop and

digitally via GreatDigitalMags.com. Find out more

at historyanswers.co.uk.

Get All About History – a historically factual magazine

PlayStation 4 to run BSD-based OS

Does your current database support provider guarantee a 15 minute response?

provides a guaranteed 15 minute (human) response, 4 hour

24 hours a day, 365 days a year.

2ndquadrant.com/support

. . . Training . .

WorldMags.netWorldMags.net

WorldMags.net

Page 14: Linux User

www.linuxuser.co.uk14

Your source of Linux news and viewsOpenSource

Simon Brew is a technology writer and editor, working across the Linux, Windows and Mac OS X platforms

Buying a new television is a minefield. Buying

a new television via an excursion to a high-street

electrical retailer tends to up the challenge to

that of an end-of-level boss. Clearly, as is often

the case, manufacturers have an agenda that

flies in the face of what an end consumer might

actually want. My last visit to an electrical

retailer was like walking into a bad science-

fiction film. A row of people were wearing

expensive-looking 3D glasses, glaring at screens

bearing expensive animations, while a young

man in a fine suit tried picking the exact and

proper word to extract them from their finances.

Never mind selling people a feature they actually

wanted: this was seemingly about hitting a

target for selling 3D tellies, ironically at a point

where at least one major broadcaster has given

up the ghost supporting them. Those kinds of

facts don’t get you Salesperson Of The Month

and a holiday to the Med, though.

Depressingly, the selling doesn’t stop when

you buy a device now. In the end, I plundered

my savings at a quieter online emporium

and took delivery of my new television set. I

tend to leave it five or six years between such

purchases, and thus the technological jump I

sit through when I switch my new set on tends

to be a bit more dramatic than if I were to swap

things out every year.

I switched on my newly acquired TV then

and was hit with an interface that looked as if

Windows 8 had invaded. Only I wasn’t allowed to

touch anything. To be fair, put a DVD in and the

set defaulted to playing it. But while my children

were sugar-filled with glee at the thought of new

menu items to play with and icons to press, I

wondered if I was getting old.

I gazed down at my remote control, for

instance, and it had the Netflix logo on it.

Netflix presumably has paid good money to

advertise on my remote control, which I don’t

feel the benefit of. Furthermore, it’s a button

that discriminates against those of a Lovefilm

persuasion. I frequent neither, so it was a bit of a

waste all round for me.

What surprised me, though, was how

accepting I was of all of that. Even a year ago

I would have felt myself getting really quite

irritated and rage-filled about it all. I feel like

they’re wearing me down. Still, no matter, there

was one more surprise that the manufacturer

concerned had laid on for me. A pop-up advert!

On my television! I was sat watching the start of

a programme, and an advert overlaid on it. The

television found itself back inside the box not

that long afterwards. I await the moment when

my fridge door starts trying to flog me some

Anchor butter or something next.

Can we, then, as end users, agree a point

with manufacturers when the selling can stop

and the using can start? This is probably the

more forlorn hope I’ve ever had in all the time I’ve

written these columns, and all the time you’ve

been suffering them. But it’s not just my age and

tolerance levels, I don’t think. Instead, I just think

that once you’ve bought the box, you’re entitled

to a bit of bloody peace and quiet…

THE OPEN SOURCE COLUMN

Simon bought a television. It put him in a bad mood…

Peace and quiet

“Clearly, as is often the case, manufacturers have an agenda that flies in the face of what an end consumer might actually want”

WorldMags.netWorldMags.net

WorldMags.net

Page 15: Linux User

www.linuxuser.co.uk15

The free software column

Opinion

OPEN SOURCE

THE FREE SOFTWARE COLUMN

Tim Berners-Lee invented the world wide

web in 1990, while working at CERN. It was

conceived as a means by which Berners-Lee

and his colleagues could share their research

across time and space. However, to its pioneers

the web also represented a dream of a better

future, where the sharing of global media would

shrink cultural and material differences and

bring the world together in a common purpose

for the betterment of all – an instant medium

where we can speak and share our vision with

our fellow citizens on the opposite side of the

globe, without the interference of spokesmen

or intermediaries. To this end, the internet can

be seen as a democratising force breaking down

the cultural, racial and religious boundaries that

divide us all – a medium for the free and open

exchange of ideas.

Of course, the universality of the web has

made it a target for corporate exploitation and

government control and, for their different

reasons, companies and governments have

sought to direct and control our experience of the

web to fit their own ends.

We know the governments of China and

Saudi Arabia limit and censor use of the web

by their citizens, and we know that a handful

of firms dominate our interactions, generating

huge profits in the process. We search with

Our web movements are being watched – allegedly for our own good – by governments and dissent is not approved

PRISM - a window into our lives

Google, we talk to each other through Facebook

and Twitter. We buy through Amazon, and look

and listen to music or TV through YouTube or

iTunes. Much of this is possible because these

companies track and refine our activities and

know more about us than we would like to know.

Few of these hubs of the internet have retained

the idealism of the early web.

So the revelation that the NSA and GCHQ are

mining the web and scrutinising our data is a

disturbing, if not entirely surprising, reflection of

the world we inhabit – and represents the flip side

of the dream of universal interconnectivity. We

are being watched – for our own good – (perhaps

with the help of Facebook and Google) and

dissent is not approved.

The convenience of the web as a resource

for the surveillance sector is that everything

we put out there can be mined and trawled,

and the problem for us is that there is no

way round it. Data that uses encryption or

anonymising software is retained and treated

by the NSA as suspicious – and the history

and purpose of GCHQ is that it specialises in

breaking and decoding unbreakable codes.

Historically, free and open source software is

more secure than its commercial rivals, but as

soon as we are on the web we are vulnerable

and there are no alternatives that are entirely

safe from unwarranted intrusion. The greatest

weapons in the fight for privacy are vigilance

and transparency.

At the same time we know little or nothing of

the other technological activities of our secret

services. We hear of hacker exploits undertaken

by Russian or Chinese hackers but know little

of similar practices by the British or Americans,

although exploits such as the Stuxnet virus

(en.wikipedia.org/wiki/Stuxnet), which was

used to sabotage the Iranian nuclear research

programme, may give us some clues.

It may be that all this data is used entirely for

good ends, for preventing random acts of violence

and subversion by other states, but experience

teaches us that there are few limits and almost

Richard Hillesley writes about art, music, digital rights, Linux and free software for a variety of publications

no democratic control over how our data may

be used in the future – and bureaucracy’s

definition of what constitutes good and bad

activity is notoriously unreliable. There are lots of

imponderables and few certainties.

It is often said that ‘if we have done nothing

wrong we have nothing to fear’ and our concerns

about privacy are a diversion from the greater

end of state security. The whistle-blowers are

demonised, but whistle-blowing is sometimes

the only break on the state’s intrusion into our

daily lives.

Whistle-blowers keep us aware of the limits on

our freedom and open a window onto the more

nefarious activities of our governments – and

as Bruce Schneier (bit.ly/15Otzqq) observes,

“whistle-blowing is vital… It’s necessary for

good government and to protect us from abuse

of power.”

Berners-Lee was troubled by the revelations,

and took the time out to tell the Financial Times

that “Unwarranted government surveillance is

an intrusion on basic human rights that threatens

the very foundations of a democratic society…

Over the last two decades the web has become

an integral part of our lives. A trace of our use of it

can reveal very intimate personal things. A store

of this information about each person is a huge

liability: Whom would you trust to decide when to

access it, or even to keep it secure?”

“The greatest weapons in the fight for privacy are vigilance and transparency”

WorldMags.netWorldMags.net

WorldMags.net

Page 16: Linux User

www.linuxuser.co.uk16

Your source of Linux news and viewsOpenSource

Follow along with the latest happenings in the Linux kernel community, including the release of the 3.10 Linux kernel and Google Glass…

JON MASTERS

Linus Torvalds announced the release of the

3.10 Linux kernel, noting that there had been

a little too much code churn for his liking late in

the RC stages, but that he had decided there

wasn’t enough reason to break the normal

pattern of “rc7 is the last RC before the release’’.

Linus notes that 3.10 is a “pretty typical” release,

and that while there are no new major new

subsystems or architectures, there are the usual

raft of new features. This was the busiest kernel

development cycle ever, with almost 13,500 non-

merge changesets pulled into the codebase.

With the release of the 3.10 kernel came the

usual near simultaneous opening of the ‘merge

window’ (period of time during which disruptive

no other applications waiting to get some CPU

time) 1,000 times per second.

Unwanted hardware interrupts also delay the

ability for the system to enter into a truly low-

power idle state. Modern CPUs will only enter their

lowest-power runtime states when they have

nothing to do and are not experiencing hardware

interrupts. Indeed, whenever a system CPU is

idle, it executes a special ‘idle’ kernel thread, the

sole purpose of which is to instruct the CPU that

it has nothing to do. On modern x86 systems, this

includes making a call to the MWAIT instruction,

which will tell the CPU to go into a low-power state

until it is awoken by an interrupt (for example

coming from another CPU that is instructing this

CPU to resume its activity). ARM uses a similar

process involving the WFE and WFI (Wait For

Event/Interrupt) sequence of instructions instead;

other architectures have similar concepts.

The challenge of unwanted hardware-timer-

driven interrupts was first tackled in the official

Linux kernel back in 2007, with the introduction

of ‘tickless’ code that stopped the timer tick

whenever a CPU was truly idle (had nothing to

do and was running only the idle thread). This

was a great improvement to overall system

power utilisation, but it arguably didn’t go far

enough. The timer will still be enabled at the first

sign of any CPU activity. By contrast, a suitably

configured 3.10 Linux kernel will keep the timer

disabled on a given CPU as long as there is only

one task (application process) running on that

Jon Masters is a Linux kernel hackerwho hasbeen working on Linux for some 18 years, since he first attended university at the age of 13. Jon lives in Cambridge, Massachusetts, and works for a large enterprise Linux vendor. He publishes a daily Linux kernel mailing list summary at kernelpodcast.org

The kernel column

changes are accepted for the following kernel

release) for 3.11. Initial new features in 3.11

include support for Xen and KVM on the 64-bit

ARM architecture known as AArch64 (or ‘arm64’

within the kernel). This is just the initial KVM code

needed for hardware virtualisation support. It

will be necessary to implement a full QEMU-

based device model in order to have guest virtual

machines actually make use of the KVM. That

work is already begun, and it will be interesting to

see it come to fruition.

A truly tickless kernelLinux 3.10 has a number of new features. The

most interesting of these is perhaps support for

a truly ‘tickless’ kernel. The kernel traditionally

relies upon a 1,000-per-second ‘timer tick’. This

is implemented using a small piece of hardware

known as the programmable interval timer (PIT).

The PIT is simply a countdown clock that counts

down at a programmable rate. Once it reaches

zero, it triggers a hardware interrupt. Upon

receiving this, the CPU stops running whatever

application code it is executing and switches

into the kernel so that the latter can get some

time to perform housekeeping activities, handle

the switching from one application to another,

and other things that kernels do. The problem

with this approach is that these interrupts are

expensive. They introduce unwanted latency

by disturbing the currently running application

(which might not need to be switched if there are

WorldMags.netWorldMags.net

WorldMags.net

Page 17: Linux User

www.linuxuser.co.uk17

The kernel column – Jon Masters

Opinion

OPEN SOURCE

CPU at a given time. Once there is more than one

task to run on a given CPU, it will be necessary

to resume the timer in order to allow the kernel

scheduler code to run (to switch tasks). There

is also a need to have a designated ‘boot’ CPU

that is always running the timer code such that

system housekeeping tasks can still make

progress. It is likely that further optimisation will

occur in the future.

Google Glass (notle)This author was recently among the lucky few to

be given the chance to pick up a pair of Google

Glass(es). This is a new augmented reality HUD-

driven system from Google (and powered by

Android) that effectively straps cellphone-level

processing capability directly to your head.

Interaction is driven largely by a combination of

voice commands (“Okay Glass, Google ‘Linux

User’ ”), and by tapping and swiping on the

special-purpose Synaptics touchpad surface

that forms one entire side of the unit. Fun though

it certainly is to have an unobtainable tech toy (as

an aside, it turns out to be a surprisingly unlikely

way to meet women, as everyone wants to try it

out!), it also has shown tremendous promise for

what the future might look like.

The current units are expensive ($1,600), the

battery life is terrible (an hour of constant use, a

few hours of light use) and the tilt/touch wake-

up is far from ideal (wink or similar sensing), but

very feature-rich and exciting apps are already

beginning to appear. As a first-generation

device, it’s already living up to the typically high

standard that Google sets for itself. But perhaps

more interesting is that since it runs Android,

the technical specifications and source code

powering the technology are available to a wider

audience than just those of us with units. In fact,

I pulled down the Android source code for ‘notle’

(the Google codename for the Glass unit) in

advance of getting the hardware itself and took

apart the kernel port in an effort to understand

what Google had done to put this together.

Notle is effectively an almost ‘Galaxy Nexus’

class cellphone device. Like the Nexus, it is

powered by the Texas Instruments 32-bit ARM-

based OMAP4 processor family (in this case,

the OMAP4430). This is the same processor that

powers the TI PandaBoard (which retails for

several hundred dollars and is widely supported

by Android and other Linux distributions). It’s also

several years old. In fact, this is generally true of

the codebase that is powering notle. It’s based

upon Linux kernel 3.0.31 (which is ten releases

old now), as released in Android 4.0.4 (Ice Cream

Sandwich). The notle platform-specific code

is actually based upon the same TI code that

powers the PandaBoard. Reading the code, it is

apparent that there have been four hardware

revisions so far and that the most recent, ‘EVT2’,

had a whole bunch of cleanups, including the

addition of an FPGA (for some kind of glue/fixup

logic), and fixes to the temperature sensors within

the unit. It’s also clear that there is hardware

which is not yet being heavily used – and there

is rumoured to be an ability to implement wink

sensing later, to make use completely hands-free.

We’ll write more about the kernel that powers

Glass in a future issue. In the meanwhile, you can

take a look at the kernel source code for yourself

by visiting: https://android.googlesource.com/kernel/omap/+/glass-omap-xrr88

Ongoing developmentThe last few years have seen the gradual

introduction of, and transition to, UEFI as

the system boot firmware of choice for both

x86 and non-x86 systems alike. UEFI brings

many benefits in form of greater system

“New 3.10 features include support for a truly ‘tickless’ kernel”

standardisation (especially in the non-x86 case),

but it does introduce new challenges for Linux

kernel support. One of those is how to handle

the runtime services interface provided by the

firmware. In the new world order, UEFI abstracts

the notion of a ‘System Volume’ containing

bootable OS kernels and the like such that

an UEFI-enabled operating system can use

standardised methods to request the installation

of a new kernel, and so on, without needing to

know exactly how (or where) that is being stored

– on flash, disk, wherever. To make this work,

certain ‘runtime services’ must remain accessible

to the kernel after initial booting (and a call to

ExitBootServices) has been completed. This

means that a ‘small’ amount of UEFI code must

remain in memory so that it can be called upon by

the kernel to provide assistance.

Once the kernel has booted, it takes control of

system memory management. It needs to find

a location for the UEFI code to live permanently

in kernel virtual memory such that it can be

called upon later without interfering with normal

activity. To do this, a special ‘Remap’ function

is called that moves the supporting UEFI code

in memory and ‘relocates’ it – patches the

instructions such that they now run at a new

location. Unfortunately, many of these features

only see aggressive testing by system vendors

on Windows. This means that if Linux differs too

much in behaviour from the way that Windows

does things, it may lead to unforeseen problems.

Consequently, a spirited debate has been taking

place with regard to how much like Windows the

Linux UEFI code should behave, especially with

regard to the remapping of UEFI for use with post-

boot Runtime Services.

WorldMags.netWorldMags.net

WorldMags.net

Page 18: Linux User

An introduction to Elementary OSInterview

www.linuxuser.co.uk18

Is it really possible to build an entire OS from an

icon set? The answer, it seems, is elementary…We recently caught up with three key members of the

Elementary project to see how they’re getting on with the

latest build of Elementary OS, ‘Luna’.

As you might already be aware, Elementary started life

as little more than a popular icon set. From that set came

grander plans with themes, then a suite of apps built using

Elementary’s strong design and usability ethics. In May this

year the team released their second beta of a fully fledged

Linux distro, Elementary OS, that puts those years of hard

work to ultimate use. It’s already making waves in the Linux

world thanks to its Apple-esque design approach to the

Linux desktop.

At first glance it would be easy to dismiss Elementary

OS as a yet another Ubuntu respin with trendy desktop

backgrounds and whiz-bang icons, but this could hardly be

further from the truth.

Elementary OSElementary OS’s home-grown application suite and

design ethics are all very deeply rooted. Plank (its dock,

based on Docky), window manager Gala, an application

launcher built to complement a bespoke top panel –

every aspect is built to very specific design guidelines.

Unsurprisingly, the core Elementary team are a

young and dynamic group who, while geographically

disparate, are very much on the same wavelength when

it comes to what they want from a modern desktop

operating system.

After following development in the form of both

betas and lengthy stints stalking the team on their

well-populated and lively IRC channels, we managed to

catch up with team Elementary to learn more about the

first distro since Linux Mint to reinvigorate our love for

desktop computing…

Introducing

Daniel ForéAge: 24

Location: California, USA

Occupation: Self-taught interaction designer.

Position on team: Founder of Elementary

LLC. I work closely with software engineers

and designers to create and enforce

code standards, human interface design

guidelines, and clear consistent copy.

Cassidy James Blaede

Age: 21

Location: Iowa, USA

Occupation: Full-time student and self-taught

UX designer. Currently studying Interactive

Digital Studies.

Position on team: I’m currently the community

manager, lead writer, a UX designer, and a

council member of Elementary.

Cody Garver

Age: 23

Location: Mississippi, USA

Occupation: Full-time student doing an

associate degree in computer networking.

Position on team: I lead the Elementary

development team and am also OS engineer on

the project.

WorldMags.netWorldMags.net

WorldMags.net

Page 19: Linux User

INTERVIEW

A chat with the team behind this exciting new Linux distro

An introduction to Elementary OS

www.linuxuser.co.uk19

In your own words, what is Elementary? How would you explain it to a friend in a bar?Cassidy James: Elementary is both an idea and

a project. It’s the idea that computing should

be fast, easy, beautiful and free. It’s a project

that includes an icon set, a suite of apps and an

operating system (Elementary OS).

Elementary OS, specifi cally, is an open source

operating system that adheres to those ideas.

It’s the best-of-the-best from Elementary. It’s

both powerful under the hood and beautifully

simple. We really don’t like to think of Elementary

OS as ‘yet another distro in the Linux world’.

Elementary OS is an operating system that’s just

as good for your grandma as it is for an IT guy.

What niche in the distro ecosystem does it fi ll? What sets it apart from the crowd?Daniel Foré: When talking about the role

of Elementary in the Linux ecosystem,

I like to compare it to an album. There’s

a lot of ‘Top 10’ and ‘Greatest Hits’

distros out there. But Elementary is

one of the few that have produced the entire

experience from beginning to end. We build

a coherent experience with a whole new

home-grown interface.

Cody Garver: Elementary OS adheres to strict

ideas and rules for how an operating system

should interact with users. The ideas and rules

are defi ned in our Human Interface Guidelines or

otherwise decided on by the design team.

What inspired you to be involved in the creation of both Elementary and the resulting OS?CJ: I got involved with Elementary a couple of

years ago. I’d seen and used the icons and a few

of the apps, but wanted to help out. The cohesive

sense of design drew me in and I stayed because

of the heavy emphasis on user experience.

DF: For me, Elementary OS came about because

Windows and OS X just weren’t perfect, and yet

there was nothing that could be done about

it. I wanted a professional, consumer-ready

desktop in which I could actually effect change.

Do you feel like you’ve been at all successful in effecting that change?DF: I think we’ve been 100 per cent successful.

We’re a super-open community and everybody

has a voice here. While we do have an

overarching vision and we have to stay focused

on our goals, I think it’s very easy for any

developer or designer (of any skill level) to get

into contact with the right people and effect

change on our desktop.

In addressing consumer-readiness, I’m

always excited to hear stories from our

users about Elementary being installed for

stereotypically less experienced users (read:

mom and dad). We had someone tweet at us

recently that they installed Elementary on their

daughter’s computer and she promptly went off

to school and converted three of her classmates.

I think that’s pretty good for a public beta.

CJ: By taking something that’s powerful

and distilling the interaction down to what’s

necessary, we enable ordinary users to tap into

that power.

It must be hard to draw a line between power and simplicity. How do you strike a balance?DF: I think traditionally, power has been equated

with complexity. But for me, a piece of software

is truly powerful when it’s enabling users to do

things they were never able to do before. So for

people like my grandparents, power means

being able to send email. It’s an incredibly simple

task with a traditionally incredibly high barrier

to entry. The more tasks that we can lower the

barrier to entry on, the more powerful our

users become.

CJ: By having a disciplined user interface,

we’re able to better expose that power to

the user. For example, instead of offering

the kitchen sink of customisation options,

we force ourselves to fi gure out how to

design it in a way that works best.

How would you compare the way you’re ‘designing it in a way that works best’ with, say, Canonical or GNOME?CJ: I think we have a much tighter focus on the

user. I don’t want to bad-mouth anyone here,

but Canonical have their corporate interests,

are focusing on servers, and are going out of

their way to do their own thing. They seem to be

thinking more, ‘what’s the most effective market

strategy?’ where we’re thinking, ‘what the best

Slingshot, the application launcher, can be pivoted and searched

The team are working on their own AppCenter, but it’s not available yet

The installer is typical Ubuntu – fast and very easy to work with

“An OS that’s just as good for your grandma

as it is for an IT guy”

WorldMags.netWorldMags.net

WorldMags.net

Page 20: Linux User

www.linuxuser.co.uk20

user experience?’. GNOME’s newer design kick

actually overlaps with ours here and there, but I

think their focus is really on providing a base for

other distros.

DF: To go further on what Cassidy just said, I

think we’re sitting at a sweet spot between the

two. We still care about desktop, but we’re also

into innovative design.

What’s an average day for you on Elementary? What are your main focuses at the moment?CG: This is how things work for the most part at

Elementary: deluge of bug reports come in (from

users or team members or automated crash

report). A team member (usually me) looks at each

bug and if it’s design related, the design team

sees it and makes a decision; otherwise the bug

is marked Confirmed or Won’t Fix or Duplicate of

another report. If it’s confirmed, it gets assigned

to a milestone that determines (very roughly and

tentatively) when it should get addressed.

DF: My current focus at this point in the cycle

is smoothing out any visual design issues. I’m

looking for inconsistencies, oddities etc.

CJ: Our focus at this exact second is getting

Luna out the door. Our overall focus, however, is

on getting Elementary to a point where everyday

An introduction to Elementary OSInterview

people can sit down and use it for everything

they want to do. We’re quickly approaching that

point and have some nice anecdotes from users

which back that up.

A huge focus from there forward is on

developers; we are building an infrastructure

for devs to build apps on Elementary, distribute

them and get paid. We already have a lot of

unique under-the-hood technologies in place,

like Granite and Contractor, that enable devs

to more easily make apps that both tie into

the system and follow our Human Interface

Guidelines. We’re also working on AppCenter,

an app store and distribution service, but I can’t

announce specifics at this point I’m afraid.

DF: The team will tell you that we use

Launchpad, Google Docs and other online tools

extensively – they’re all integral tools to working

together efficiently and effectively.

Is Luna progressing how you’d like? We’ve played with it extensively and found it to be very polished and usable day-to-day.CJ: Absolutely. We’re really close, and I think

getting Luna out the door will allow us to show

people what we’re capable of doing. Luna

was a huge undertaking: we started virtually

from scratch. We switched over to the Vala

programming language, the GTK3 toolkit, and

really nailed our design. We also built an entire

desktop environment and suite of apps this

cycle. From there, we can really continue to

impress by building on this solid foundation.

There are always pain points in any project – what are yours?CG: There’s never enough time. Developers don’t

have enough time to work on Elementary; tech

moves too fast for things to get perfected before

it’s either objectively or subjectively outdated.

DF: I think our biggest problem is lack of

support from major third-party developers. It’s

always awful to talk up Elementary to someone

and you both get really excited and then they

ask about Netflix.

CJ: Time, money and collaboration are all

challenges we face every day. We have a limited

amount of contributors trying to fit working on

Elementary in between their everyday lives. We

don’t have a massive pool of money to throw at

them or to invest into the project, as much as we’d

like to. And as Dan said, collaborating with third

parties is difficult at this point; I think we’re not

as established in the OS world as we’d like to be.

Which makes sense, really, seeing as how we’ve

only had one release, and that was years ago.

What’s the way forward? How do you factor this in and work with it?DF: I think the only real way forward on this is

as an entire Linux community. We owe a lot to

Canonical and Ubuntu when it comes to courting

big gaming and the like. But overall, I think the

more users get behind Linux-based operating

systems, the more support we’ll see from big

names. It’s all up to our early-adopter crowd and

how much noise they make.

What’s worse for a project like yours – a lack or time or a lack of money?CJ: I think time and money go hand-in-hand. If we

had more time, we could push things out faster.

If we had more money, we could pay devs so they

[had a] lot more time to push things out faster.

Learn more about Elementary and Elementary

OS by visiting their community page at

www.elementaryos.org/get-involved

The team and its community are very active on

IRC (freenode – search for #elementary).

You can also follow the project’s progress at

https://launchpad.net/elementary

Author: Russell Barnes

Elementary OS’s defaults

Here’s a rundown of the core default programs

that ship with elementary OS Luna. Most of

them are themselves part of the elementary

project family:

Session manager: Pantheon Greeter (based

on LightDM)

Top panel: WingPanel

Application launcher: Slingshot

Dock: Plank (based on Docky)

Settings manager: Switchboard

Web browser: Midori

Email client: Geary

Calendar: Calendar (formally known as Maya)

Audio player: Music (formally known as Noise)

Text editor: Scratch

Terminal emulator: Pantheon Terminal

File manager: Pantheon Files

Daniel Foré founded Elementary Cassidy testing Elementary OS

WorldMags.netWorldMags.net

WorldMags.net

Page 21: Linux User

1and1.co.uk

Create your perfect web address with over 500 new top-level domains from 1&1! Short, memorable domains like fashion.blog and kitchens.online are ideal for getting your website found easily. Pre-order your preferred domain for free, with no obligation! With regular updates from 1&1, you‘ll stay fully informed and be in the best position to register your domain with new domain extensions! Find out more at 1and1.co.uk

* Pre-ordering a domain name is not a guarantee that the domain will be registered. If your requested domain has already been pre-ordered, you will be added to a waiting list for that domain.

DOMAINS

DOMAINS | E-MAIL | WEB HOSTING | eCOMMERCE | SERVERS

PRE-ORDER

FREEWITH NO OBLIGATION!*

WorldMags.netWorldMags.net

WorldMags.net

Page 22: Linux User

Subscribe today and get your first three issues for £1 (and save £17.00)

Pay only £4.19 for every future issue – a 30% saving on the store price Free UK delivery to your door Never miss an issue Money-back guarantee

FANTASTIC SUBSCRIBER OFFER

SUBSCRIPTION VOUCHERYES I would like to subscribe to Linux User & Developer

YOUR DETAILSTitle First name Surname Address Postcode Country Telephone number Mobile number Email address

DIRECT DEBIT PAYMENTUK Direct Debit Payment

I will receive my first three issues for just £1, I will then pay only £25.15 every six issues thereafter. If, however, I do not love what I see, I can cancel at any time.

PAYMENT DETAILSYOUR EXCLUSIVE READER PRICE, ONE YEAR (13 ISSUES)

UK: £62.40 (Save 20%) Europe: £70.00

World: £80.00

Cheque

I enclose a cheque for £(made payable to Imagine Publishing Ltd)

Credit/Debit Card

Expiry date

Visa MasterCard Amex Maestro

Card number

Security number (last three digits on the strip at the back of the card)

Issue number (if Maestro)

Signed

Date

Code: PCG129

Please tick if you do not wish to receive any promotional material from Imagine Publishing Ltd by post by

telephone via email

Please tick if you do not wish to receive any promotional material from other companies by post

by telephone Please tick if you DO wish to receive such information via email

Terms & Conditions apply. We publish 13 issues a year, your subscription will start from the next available issue unless otherwise indicated. Direct Debit guarantee details available on request. This offer expires without notice.

I would like my subscription to start from issue:

Return this order form to:

Linux User & Developer Subscriptions Department, 800 Guillat Avenue, Kent Science Park,

Sittingbourne, ME9 8GU or email it to [email protected]

You will be able to view your subscription details online at www.imaginesubs.co.uk

Please complete your email address to receive news and special offers from us

Terms & ConditionsThis offer entitles new UK direct debit subscribers to receive their fi rst three issues for £1. After these issues, subscribers will then pay £25.15 every six issues. Subscribers can cancel this subscription at any time. New subscriptions will start from the next available issue. Offer code PCG129 must be quoted to receive this special subscription price. Details of the Direct Debit guarantee are available on request. Offer expires 30 November 2013. Imagine Publishing reserves the right to limit this type of offer to one per household.Source Code PCG129Web address: www.imaginesubs.co.uk/lud. Tel: 0844 249 0282

HU

RRY

ORD

ER N

OW

Instruction to your Bank or

Building Society to pay by Direct Debit

Signature(s)

Date

Bank/Building Society account number

Banks and Building Societies may not accept Direct Debit instructions for some types of account A6 instruction form

Instructions to your Bank or Building SocietyPlease pay Imagine Publishing Limited Direct Debits from the account detailed in this instruction subject to the safeguards assured by the Direct Debit guarantee. I understand that this instruction may remain with Imagine Publishing Limited and, if so, details will be passed on electronically to my Bank/Building Society

Branch sort code

Originator’s Identification Number

Name(s) of account holder(s)

To: The Manager Bank/Building Society

Address

Postcode

Reference Number

5 0 1 8 8 4

Name and full postal address of your Bank or Building Society

Please fill in the form and send it to: Linux User and Developer Subscriptions Dept, 800 Guillat Avenue, Kent Science Park, Sittingbourne ME9 8GU

WorldMags.netWorldMags.net

WorldMags.net

Page 23: Linux User

1. Onlinewww.imaginesubs.co.uk/ludAnd enter PCG129

2. Telephone0844 249 0282And quote PCG129

3.Post or emailPlease complete and post the form to

Linux User & Developer

Subscriptions Department

800 Guillat Avenue

Kent Science Park

Sittingbourne

ME9 8GU

Or alternatively, you can scan and email the form to

[email protected]

THREE EASY WAYS TO SUBSCRIBE

ISSUES OF LINUX USERFOR JUST

Get your first 3 issues for just £1, then save 30% on the shop price

Readers in the US see page 84 for exclusive

offer

3 1

WorldMags.netWorldMags.net

WorldMags.net

Page 24: Linux User

Everything you need to make technology come to life with our amazing ideas to try with your Pi!

www.linuxuser.co.uk24

10 amazing Raspberry Pi projects

Around six months ago we put together an

article featuring ten of the most amazing

Raspberry Pi projects in the world. Those

projects featured lofty goals (like taking pictures

from the edge of space) achieved by some

devilishly clever people that we could only dream

of emulating. As well as proving the power and

versatility of the Raspberry Pi, these projects

served as inspiration for the rest of us.

This time we’re getting practical. We want you

to pick up the gauntlet and actually get building

and we’ve hand-picked another ten amazing

projects, but each one of these can be put

together in a day – some in just an afternoon of

light tinkering. In fact, most need little more than

the technology you’ve already got in your home

– a TV, a camera, a mobile phone or videogame

controller. Even for the few projects that do need

a bit more practical hacking, the bits and bobs

you need are unlikely to cost much more than

£10 or £15 – a small price to pay for the gadgets

you’ll get in return.

Hopefully these projects will give you just

enough expertise and practical experience to

allow you to take things even further and come

up with projects of your own. Perhaps you could

monitor the temperature of your bedroom and

trigger an electric blanket to come on for an hour

in those chilly winter evenings. Or maybe you

could sample the soil moisture of a houseplant

and have it tweet you when it’s thirsty. Many of

the techniques featured in the following pages

(and even entire chunks of code) would translate

perfectly to projects just like these – all you

need is an idea and a little bit of know-how.

In another six months we’re going to lay down

the gauntlet all over again, but next time we

want to show off your projects in these pages.

Get hacking and show us what you can do!

WorldMags.netWorldMags.net

WorldMags.net

Page 25: Linux User

www.linuxuser.co.uk25

Practical Raspberry Pi projects to amaze and inspire

10 Raspberry Pi projects made easy

028 - 029Portable internet radio

026 - 027Complete media centre

032 - 033Time-lapse camera trigger

034 - 035Retro games console

042 - 043Wireless access point

040 - 041VoIP server

036 - 037File server

030 - 031

Always-on torrent box

038 - 039

Security camera

044 - 045

Voice-control Your Pi

WorldMags.netWorldMags.net

WorldMags.net

Page 26: Linux User

www.linuxuser.co.uk26

Create a complete media centreTurn your Raspberry Pi into the perfect media centre with some simple software and tweaks

There are a few ways to use the Raspberry Pi as an HTPC, with some of the best being

XBMC-powered distros. OpenELEC is a great, lightweight way to use the Pi for that sole

purpose, but we’re going to cover the more customisable Raspbmc, based on Debian.WHAT YOU'LL NEED

NAME:ROB ZWETSLOOT

OCCUPATION:TECH WRITER

Rob models complex systems and is a web developer profi cient in Python, Django and PHP. He loves to experiment with computing

» Internet connection

» External hard drive

» VESA mount

» HDMI cable

MAKER PROFILE

The Raspberry Pi makes the perfect media centre, and there’s software to take advantage of it

Choose between different HTPC solutions with different advantages and disadvantages

The complete Pi media centre

Watch local and network videos at full

1080p resolution, along with music and pictures

Get popular streaming apps for web-based video to run directly

from your Raspberry Pi

WorldMags.netWorldMags.net

WorldMags.net

Page 27: Linux User

www.linuxuser.co.uk27

01 Install Raspbmc

Raspbmc has a downloadable installer

that always gets the latest image for your Pi.

Create a new directory and then download it with:

$ wget http://svn.stmlabs.com/svn/raspbmc/release/installers/python/install.pyMake it executable with:

$ chmod +x install.pyAnd then run it with:

$ sudo python install.py

Follow the on-screen instructions and it will then

install onto your Pi.

06 Web remote

In Settings, go to Services and then

Webserver. Enable it and you will now be able to

control your Raspberry Pi using a web browser.

To access the web browser remote, enter the

IP address – found in System Info under the

home screen’s Settings tab – into your browser,

followed by ‘:80’.

07 Android Remote

There’s an offi cial Android Remote app

on the Google Play Store that can control XBMC

once the web server is enabled. Download it to

your phone and launch it. Go to the Settings, add

new host, and enter the IP address and port (80

by default) like in the previous step.

08 Using CEC

If your TV supports it, CEC can be used

over HDMI to control your XBMC-powered Pi. CEC

should be enabled by default, which means you

can control your entire setup with only one remote

control. Refer to the XBMC wiki to see if your TV

supports CEC, and how you can take advantage

of it: bit.ly/18kdVHf

09 Traditional

remotes

XBMC supports a large

number of universal

remotes that include,

or support, USB IR

receivers. One of the

best devices for this

is the FLIRC, a fully

programmable USB

IR receiver that allows

you to use any remote

with the Pi.

05 Get some apps

On any content tab, go to Add-Ons. It will

display the apps you already have, which is none

by default. By selecting Get More, the full list of

available apps will be shown and you can install

them with one button click from there.

03 Network sharing

You can add fi le sources to XBMC by

fi rst of all going to Video, then Add Source. Go to

Browse and you can add local or networked fi les.

For network shares, choose either UPnP or SMB

shares to see what’s visible on the network, or

‘Add network location’ if you know the direct path.

This works the same for Music and Pictures.

02 Setup

By installing Raspbmc this way, the distro

will then download the latest image and updates

to run on your Pi on fi rst boot. This will take a

while, and involve a couple of restarts, but will

only happen the fi rst time. Select your language

in XBMC and you’re done.

Raspbmc will download the latest image on its initial boot

04 Scrape your media

After selecting a source, you can choose

what service to scrape information from. This

gives you more info on the fi les you’re watching,

such as episode summaries and proper names.

Make sure your fi lms have the year appended to

them, and that your TV shows do too.

Practical Raspberry Pi projects to amaze and inspire

10 Raspberry Pi projects made easy

WorldMags.netWorldMags.net

WorldMags.net

Page 28: Linux User

Portable internet radio

www.linuxuser.co.uk28

Build a portable internet radioTurn your Raspberry Pi into a portable Wi-Fi streaming radio

There are thousands of free radio stations on the internet, and with this project you can

listen to all of them from one tiny little box. So let’s build our streaming radio using a

Raspberry Pi, a speaker and a few odds and ends…

WHAT YOU'LL NEED» A wireless internet connection

» 2 x momentary switches

» 4 x female-to-male leads (to connect your Pi to a breadboard)

» 2 x 220-ohm resistors

» 4 x male-to-male leads

» Speakers connected to 3.5mm headphone jack

01 Let’s get set up

Firstly, we need to prepare our Pi. Using

Raspbian, and a Pi connected to the internet,

open a terminal and switch to the root user:

sudo suAnd update your list of packages, then

upgrade your Pi to the latest software:

apt-get update && apt-get upgrade -y

The completed project, with momentary switches to control stations

02 Install some extra packages

We need to install the Python packages

to access the GPIO. In a terminal, logged in as

root, enter the following.

apt-get install python-rpi.gpioNow install MPlayer, which is what will be

playing our audio.

apt-get install mplayer

Connect your speaker(s) to the 3.5mm audio out jack on the Pi

The circuit is very straightforward with just two buttons

We’ve used the Pi Cobbler, but it’s not a requirement

MAKER PROFILE

NAME:LES POUNDER

OCCUPATION:FREELANCE

SYSTEM

ADMINISTRATOR

Les has been a strong advocate of Linux and free software since 1999 and loves to tinker with hardware and software projects

WorldMags.netWorldMags.net

WorldMags.net

Page 29: Linux User

Practical Raspberry Pi projects to amaze and inspire

www.linuxuser.co.uk29

07 Make it executable

Save and exit radio in /etc/init.d by

pressing Ctrl+X and then answering yes to

the prompt.

Now make radio executable by typing (as root):

chmod 755 radioThen, as root, register radio to start on boot by

typing in a terminal:

update-rc.d radio defaults

08 Raspi-config

In a terminal as root, use

raspi-confi g to change the boot behaviour of

your Pi. We don’t want it to load the desktop,

09 First test

Once the Pi has fi nished loading, press

one of the buttons on your breadboard. In a

few seconds you should hear the audio come

through the speakers that you attached to the

3.5mm headphone jack.

That’s it, you have a wireless internet radio.

Why not add a mute function using amixer

(manpages.ubuntu.com/manpages/gutsy/man1/amixer.1.html) and another momentary

switch. Or even add an LCD screen (www.rpiblog.com/2012/11/interfacing-16x2-lcd-with-raspberry-pi.html) to show the station details.

04 Set up the software

Copy radio.py from the cover disc to

your home directory – we’ll use the code as is for

this guide, but feel free to edit the code to suit

your needs later on.

Now open a terminal and switch to root, and

edit your network interface confi g:

nano /etc/network/interfaces

05 Wi-Fi configuration

We want the Pi to automatically connect

to your router via Wi-Fi during boot.

Edit your /etc/network/interfaces fi le to

resemble this:

auto loiface lo inet loopbackiface eth0 inet dhcpallow-hotplug wlan0auto wlan0iface wlan0 inet dhcpwpa-ssid “ssid”wpa-psk “password”

Replace the “ssid” and “password” with your

own details, but keep the quotation marks.

03 Make the files executable and Install

To install the tools, we need to navigate

to PiAUISuite-master/Install.

We now need to make InstallAUISuite.sh

executable for all users, so use:

chmod 777 InstallAUISuite.sh

Now that the fi le is executable, let’s install:

sudo ./ InstallAUISuite.sh

There are thousands of free radio stations on the internet, and you can listen to them with this project

06 Configure the radio to start at boot

In a terminal, as root, navigate to

/etc/init.d/ and then create a fi le called radio

using nano.

nano radioIn that fi le, type in the following:

#! /bin/bashmodprobe snd_bcm2835amixer cset numid=3 1python /home/pi/radio.py

This loads the kernel module for the sound card

Amixer sets the output to the 3.5mm headphone

jack (that’s what 1 means, HDMI is 2). Lastly it

calls the Python script.

#!/usr/bin env pythonimport time import sleepimport osimport RPi.GPIO as GPIO# I found loads of BBC Radio streams from http://bbcstreams.com/GPIO.setmode(GPIO.BCM)GPIO.setup(23 , GPIO.IN)GPIO.setup(24 , GPIO.IN)while True: if GPIO.input(23)==1: os.system(‘sudo killall mplayer’) os.system(‘mplayer -playlist http://bbc.co.uk/radio/listen/live/r1.asx &’) if GPIO.input(24)==1: os.system(‘sudo killall mplayer’) os.system(‘mplayer -playlist http://bbc.co.uk/radio/listen/live/r6.asx &’) sleep(0.1);GPIO.cleanup()

We import the RPi GPIO library and set it to use BCM numbering system

Here we set up pins 23 and 24, which control the radio station selection

Here we say that if the button is pressed for 23, run the command below

Here we see the script kill any open MPlayer processes and then load the radio station

This code is the glue that links the GPIO to MPlayer, which handles audio playback

–a terminal is all we need, as the project will

not require a screen for future use..

Once complete, reboot the Pi and watch as the

output from boot whizzes across the screen.

10 Raspi projects made easy

WorldMags.netWorldMags.net

WorldMags.net

Page 30: Linux User

www.linuxuser.co.uk30

Build an always-on torrent boxGet the latest distros, packages and test builds faster with a low-power, mini torrent box

Torrenting your open source software has a

number of advantages – it can be faster, alleviates

bandwidth and allows you to share back with the

community. Distros, packages and more are available via

torrents, and the Raspberry Pi makes for a tiny, low-wattage,

always-on torrent box to better manage your fi les.

WHAT YOU'LL NEED» A portable hard drive

» Raspbian www.raspberrypi.org/downloads

» PC with a desktop environment and Deluge installed

NAME:ROB ZWETSLOOT

OCCUPATION:TECH WRITER

Rob models complex systems and is a web developer profi cient in Python, Django and PHP. He loves to experiment with computing

MAKER PROFILE

Faster, alleviates bandwidth and allows you to share back with the community

Store completed fi les on an external hard

drive, for more space or easy transport

You’ll be transferring large amounts

of data, so wired networking is a must

Always-on torrent box

An always-on torrent box you can hide in a (well-

ventilated) small space

WorldMags.netWorldMags.net

WorldMags.net

Page 31: Linux User

www.linuxuser.co.uk31

01 Install Raspbian

Raspbian works just fi ne for our torrent

box. Install the image on an SD card and go

through the basic setup process, making sure

to enable SSH in the advanced options and to

disable the desktop.

06 Remote connection

Now you’re in the client, type the

following three commands:

config -s allow_remote Trueconfig allow_remoteexit

Restart the Deluge daemon with:

$ sudo pkill deluged && deluged

Now open the graphical client on your Linux PC.

07 Remote interface

Go to Edit>Preferences>Interface, then

disable Classic Mode and restart Deluge. Click

Add on the Connection Manager, and enter the

IP in Hostname and the user we set up earlier.

Click Connect to see any torrents you have

downloading or uploading.

08 Download location

Go again to Edit then Preferences,

and change to the Downloads tab if it’s not on

there already. Set the download location to the

directory we mounted the hard drive to, and

enable ‘Auto add .torrents’, setting it to any

destination if you plan to dump torrent fi les to

the Pi.

09 Start on boot

An init script from Ubuntu can be used to

have Deluge start on boot. Download it with:

$ sudo wget -O /etc/default/deluge-daemon http://bit.ly/13nKOSj

Open /etc/default/deluge-daemon with nano

and change the username to the one we set up

earlier. Save it, then download the full init script

and update with:

$ sudo wget -O /etc/init.d/deluge-daemon http://bit.ly/13nKKlz$ sudo chmod 755 /etc/init.d/deluge-daemon$ sudo update-rc.d deluge-daemon defaults

05 Basic configuration

Edit the fi le with:

$ nano ~/.config/deluge/auth

And add to the bottom:

[user]:[password]:10…to restrict access.

Now start it up with:

$ deluged$ deluge-console

03 Mount hard drive

Unless you plan to reformat your portable

drive, you’ll need to install NTFS support onto

your Pi. Type:

$ sudo apt-get install ntfs-3gAdd the hard drive to /etc/fstab (open it with

sudo nano /etc/fstab) by adding the line:

/dev/[hard drive address] [mount point] auto noatime 0 0Use fdisk to fi nd the name of the storage, and

create a mount point such as /home/pi/torrents

with mkdir. Reboot for it to mount.

02 Remote access

Type ifconfig into your Pi’s command

line to fi nd the IP address. At this point you can

unplug the monitor and set it up remotely, but

either way you can now access the Pi by typing:

$ ssh [user]@[IP address]…and entering your password to log in.

04 Install Deluge

We’ll use Deluge for our torrents. Install

it with:

$ sudo apt-get install deluged deluge-console

Now start and then stop Deluge so it creates a

confi g fi le we can edit with:

$ deluged$ sudo pkill deluged

And fi nally, run the following to copy the confi g fi le

in case we mess up:

$ cp ~/.config/deluge/auth ~/.config/deluge/auth.old

Practical Raspberry Pi projects to amaze and inspire

10 Raspi projects made easy

WorldMags.netWorldMags.net

WorldMags.net

Page 32: Linux User

www.linuxuser.co.uk32

Create a time-lapse camera triggerMake shooting time-lapse video with your DSLR camera a cinch with our expert advice

You’d be forgiven for thinking that creating

mesmerising time-lapse videos like those of

Vincent Laforet (www.laforetvisuals.com)

or John Eklund (www.theartoftimelapse.com) might

be out of reach of the Average Joe, but with the help of

the Raspberry Pi and a sprinkling of Python code, that’s

no longer the case. In this guide we’re going to use our

Raspberry Pi to trigger our run-of-the-mill DSLR camera

(in this case a Canon EOS) to create pixel-perfect time-

lapse imagery for little more than £10. Here’s how…

01 Set up the Raspberry Pi

For this tutorial we’re assuming you’re using

a recent build of Raspbian, available both on the disc

and via www.raspberrypi.org/downloads. With the

Raspberry Pi set up with a keyboard, mouse and

monitor, open the terminal and type:

sudo apt-get update

02 Install the RPi.GPIO library

Next we want to make sure your development

environment is set up. Users of Raspian should be set

up already, but you should follow these steps anyway to

make sure. In the terminal, type:

suda atp-get install python-dev Then: sudo apt-get install python-rpi.gpio

WHAT YOU'LL NEED» Breadboard, connectors,

jumper wire

» DSLR camera

» Compatible shutter cable

» Raspbian with Python 2.7

NAME:RUSSELL BARNES

OCCUPATION:EDITOR, LINUX USER

Russell has been an open source advocate and technology writer for 15 years. He is a keen RasPi and Arduino project maker

MAKER PROFILE

Time-lapse camera trigger

We’re using a cheap Canon EOS DSLR, so to trigger the shutter with the Raspberry Pi, all we need is a simple 2.5mm to 3.5mm cable

We’re using the Pi Cobbler as a breakout for the Pi’s GPIO pins, making the build process easier (though it’s not required)

Using a basic 3.5mm audio jack, we can pulse the shutter trigger simply by applying voltage to the

cable ‘head’

We wont be controlling the autofocus with our Python app, so set the focus to manual and select your camera settings in advance of the shoot

WorldMags.netWorldMags.net

WorldMags.net

Page 33: Linux User

www.linuxuser.co.uk33

06 Creating a video from the images

With your camera packed with images,

we need to now collect and output them as a

video fi le. While it’s technically possible to do on

the Pi, we’d recommend copying them to an easily

accessible folder on a separate Linux PC since

there will be quite a lot of heavy lifting involved.

We’re going to use FFmpeg. With the terminal

open in the folder where your images are stored,

type: ffmpeg -f image2 -i image%04d.jpg -vcodec libx264 -b 800k video.avi. This

obviously assumes you have libx264 installed on

your machine and the ‘image%o4d.jpg’ assumes

the fi le format and the number of digits it’s

dealing with (in this case: ‘picture0001.jpg’). See

ffmpeg.org/ffmpeg.html for full documentation

of FFmpeg’s incredible capabilities, but the fl ags

we’ve selected should make for good results.

03 Set up the Pi Cobbler

With the development environment set

up, we can turn our attention to the hardware.

For this tutorial we’ve used a cheap prototyping

breadboard and an Adafruit Pi Cobbler

(learn.adafruit.com/adafruit-pi-cobbler-kit/overview) to give us easy access to the Raspberry

Pi’s GPIO pins. As you can see from the picture,

the Cobbler straddles the centre-point of the

breadboard and a ribbon cable connects the two.

04 Configure the breadboard

For the Raspberry Pi’s GPIO to control

the camera, we need to create a circuit between

a pin on the GPIO (in this case pin 23 on the

Cobbler – but it’s actually physical pin 16) and

the pin that connects to the ‘head’ or ‘tip’ of the

camera cable that activates the shutter when

connected. We’ve also used a resistor, but it

isn’t required. The base of the connector cable

is always ground, so make sure you ground the

‘GND’ pin on the Cobbler and the middle pin on

the audio jack. It’s very simple stuff. With the

circuit complete, we can focus on the code.

05 The Linux User Time-lapse

Photography Tool

We’ve created a small 55-line Python utility

called The Linux User Time-lapse Photography

Tool, which asks the user to input how many

shots they’d like to take and the frequency they’d

like them taken. It then takes that information

and uses it in a For loop to activate the shutter

using GPIO pin 16 . If you’d like to use the project

‘in the fi eld’ we’d recommend using the Android

app ConnectBot to SSH into your RasPi for input

and feedback. Don’t forget to start your script

with sudo python time_lapse_camera.py

Practical Raspberry Pi projects to amaze and inspire

10 Raspi projects made easy

import RPi.GPIO as GPIOimport time

print ‘\nWelcome to the Linux User Time-lapse Photography Tool.’print “Just tell us how many shots you’d like to take and the interval between them.\n”print “Try googling ‘time-lapse interval calc’ if you need help deciding.\n”

def main(): shots = raw_input(‘How many shots would you like to take?\n ->’) interval = raw_input(‘How frequently do you want to take them (in seconds)?\n ->’) if shots.isdigit() and interval.isdigit(): shots = int(shots) interval = int(interval) print “You’ll be shooting for %d minutes.\n” % (shots * interval / 60) answer = raw_input(‘Are you ready to proceed?(yes/no):’) confirm = answer.lower() in [‘yes’, ‘y’] if confirm: GPIO.setmode(GPIO.BOARD) GPIO.setup(16, GPIO.OUT) taken = 1 print print ‘Starting a run of %d shots’ % (shots) for i in range(0, shots): print print ‘Shot %d of %d’ % (taken, shots) taken +=1 GPIO.output(16, GPIO.HIGH) time.sleep(0.5) GPIO.output(16, GPIO.LOW) time.sleep(interval) GPIO.cleanup() else: print “Let’s try again (or press Ctrl + C to quit):\n” main() else: print “Oops - You can only enter numbers. Let’s try again:\n” main()

print print ‘Done. Thanks for using the Linux User Time-lapse Photography Tool!\n’ again = raw_input(‘Would you like to do another time-lapse? (yes/no):\n -> ‘) proceed = again.lower() in [‘yes’, ‘y’] if proceed: main() else: print ‘\nSee you next time!\n’ quit() if __name__ == ‘__main__’: main()

Time-lapse trigger code listing It’s a simple script so the imports are meagre. We need to import the GPIO

module to control the shutter pin and the Time module helps us deal

with the interval between shots

Be mindful of (GPIO.BOARD) – this tells you we’re using

physical pin number 16, as opposed to the documented

number (which in this case is 23)

This is the main loop of the script

that loops over your total shot count

and factors in your time interval

With the main If and For loops complete,

the script uses a further If / Else to ask if you’d like to

shoot again, or quit

WorldMags.netWorldMags.net

WorldMags.net

Page 34: Linux User

www.linuxuser.co.uk34

Make your own retro games consoleGet your retro gaming fi x with RetroPie, a distro for getting the games of yesteryear onto your Raspberry Pi

There’s a growing trend for people to create their own arcade cabinet or hack together

their own retro console, and the Raspberry Pi’s size and power makes it perfect for this.

Follow our tutorial to turn your Pi into a fully functional emulating powerhouse.

Retro games console

Turn your Raspberry Pi into the ultimate

portable retro games console

Confi gure RetroPie for more

power control

WHAT YOU'LL NEED

NAME:ROB ZWETSLOOT

OCCUPATION:TECH WRITER

Rob models complex systems and is a web developer profi cient in Python, Django and PHP. He loves to experiment with computing

» RetroPie blog.petrockblock.com/download/retropie-project-image/

MAKER PROFILE

Properly confi gure USB and PS3 controllers out of the box

Install drivers to use the Xbox 360 controller

WorldMags.netWorldMags.net

WorldMags.net

Page 35: Linux User

www.linuxuser.co.uk35

01 Install RetroPie

Download the latest RetroPie image

from the website and unzip it. Like installing

other Raspberry Pi distros, you simply need to

write the image to the SD card with:

$ sudo dd bs=4M if=[path to image] of=/dev/[path to sd card]

06 Add some games

Adding games to your Raspberry Pi is

fairly simple. Grab the SD card from the Pi and put

it in your PC. Move any ROMs or compatible PC

fi les to the relevant folders in:

[path to SD card]/home/pi/RetroPie/roms/

07 Navigate RetroPie

RetroPie will automatically know if there

are games for a specifi c emulator and allow

you to access it. Pressing left or right will move

between the emulators, which then have options

to load the games on the SD card.

08 Two players

For multiplayer gaming, it’s best to use

two controllers of the same type to avoid confi g

issues. Go to the bottom of ~/RetroPie/confi gs/

all/retroarch.cfg and copy and paste the code

from input_player1_joypad_index = “0”

to the bottom. Change each instance of player1

to player 2, and a second controller will now work.

09 Safe restart

Some of the emulators can’t be quit

out of, meaning you’ll need to physically reboot

your Pi by unplugging it each time. We can add

a hotkey to exit the emulators by again going to

retroarch.cfg and adding to the end:

input_enable_hotkey_btn = “X”input_exit_emulator_btn = “Y”…with X and Y being the corresponding numbers

of buttons on your controller.

04 Using an Xbox 360 pad

To use a wired or PC-compatible

Xbox 360 controller, you’ll fi rst need to install the

correct drivers:

$ sudo apt-get install xboxdrvThen edit /etc/rc.local by adding:

xboxdrv --trigger-as-button --wid 0 --led 2 --deadzone 4000 --silent &sleep 1

…before exit 0. Change --wid to --id if it’s a wired

controller. Reboot.

05 Recognising the 360 controller

Add the 360 pad to your confi guration fi le

by fi rst going to tools with:

$ cd ~/RetroPie/emulators/RetroArch/toolsThen type in the following:

$ ./retroarch-joyconfig -o p1.cfg -p 1 -j 0And fi nally add the fi les to RetroArch with:

$ sudo cat p*.cfg >> ~/RetroPie/configs/all/retroarch.cfgSave and reboot.

03 Calibrating controllers

Press the menu button you set up, and

go to exit. You’ll get to a command line. Connect a

USB controller and enter the following:

$ cd RetroPie/emulators/RetroArch/tools…and then:

$ ./retroarch-joyconfig >> ~/RetroPie/configs/all/retroarch.cfg

Follow on the on-screen instructions to properly

confi gure your controller.

02 Initial setup

On the fi rst boot, you’ll be asked to

confi gure a controller, which can be done with

a keyboard, a standard USB controller or a PS3

controller. The initial setup on RetroPie is for

very limited controls, and you’ll need to launch a

separate tool for better confi g.

Practical Raspberry Pi projects to amaze and inspire

Adding games to your Raspberry Pi is fairly simple

10 Raspi projects made easy

WorldMags.netWorldMags.net

WorldMags.net

Page 36: Linux User

File server

www.linuxuser.co.uk36

Build a file serverSick of using fl ash drives or email to share fi les between computers? Turn your RasPi into a server and your problem’s solved!

Access your shares from Windows,

Linux or Mac!

Having a central fi le server in your house will make life easier. You’ll no longer have to

struggle to share fi les between computers, as you can just save everything in your own

mini-cloud on your home network. The Raspberry Pi is perfect for this!

WHAT YOU'LL NEED» A router or switch on your

network to plug your Raspberry Pi into

» (Optional) External storage –

an external hard drive or fl ash drive

» Powered USB hub (if using external hard drive)

» Raspbian latest version

MAKER PROFILE

NAME:Liam Fraser

OCCUPATION:Programmer and

Sysadmin at Web

Hosting company

Liam is the creator of the RaspberryPiTutorials YouTube series and volunteers as a Linux server administrator for the Raspberry Pi Foundation

01 Installing the required software

Log into the Raspbian system with the

username Pi and the password ‘raspberry’. Get

the latest package lists using the command

sudo apt-get update. Then install the

required packages with the command sudo apt-get install samba. Samba will be used

to serve fi les and also comes with software to

advertise fi le shares on the network.

02 Connect external storage

If you have any external storage, you’ll

need to prepare it for use with Linux. Note that

The Raspberry Pi will automatically advertise its shares on the network – no need to remember IP addresses

you will only be able to read the storage device

on other Linux computers unless you reformat it.

If you connect the device, you’ll be able to use the

dmesg command to fi nd out what the device is

called. (Piping that into tail -n 3 prints the last

three lines.) It’s probably /dev/sda.

pi@raspberrypi ~ $ dmesg | tail -n 3

[ 1707.371370] sd 1:0:0:0: [sda] No Caching mode page present[ 1707.371403] sd 1:0:0:0: [sda] Assuming drive cache: write through[ 1707.371422] sd 1:0:0:0: [sda]

Attached SCSI removable disk

Each Samba user gets access to their home folder, as well

as a folder shared between all users

WorldMags.netWorldMags.net

WorldMags.net

Page 37: Linux User

Practical Raspberry Pi projects to amaze and inspire

www.linuxuser.co.uk37

06 Create a shared directory

We’re going to create a directory that

any users in the sambashare group can access

and change. Setting the setgid permission on

a directory (chmod g+s) causes new fi les and

subdirectories created within it to inherit its group

ID. This means that each user in the sambashare

group can access and change the fi les.

pi@raspberrypi /home $ sudo mkdir /home/alluserspi@raspberrypi /home $ sudo chown

07 Confi guring Samba

Open /etc/samba/smb.conf in an editor

using sudo. Scroll down to the Authentication

section and uncomment the security = user line. Then scroll down to the Share Defi nitions

section and change read only to no in the

[homes] section.

Finally, scroll down to the bottom of the fi le and

add a section for the shared folder.

[allusers] comment = Shared Folder path = /home/allusers read only = no guest ok = no browseable = yes create mask = 0770 directory mask = 0770

Restart Samba with

sudo /etc/init.d/samba restart

08 Connecting to the shares

The Raspberry Pi will advertise its shares

automatically. Each user will get access to their

home folder, as well as the allusers directory.

If the user isn’t in the sambashares group, they

won’t be able to get it. The syntax for accessing

Samba shares is as follows:

Windows: \\raspberrypi\share_name

Mac: smb://raspberrypi/share_name

Linux: smb://raspberrypi/share_name

The share name is optional – you should be

able to browse for them. In fact, you shouldn’t

even need to use these; you just need to go to

the Network section of your fi le manager and

select ‘raspberrypi’.

04 Mount external storage

We’re going to move /home onto our

external storage. We’ll do that by mounting it on

/mnt/storage, moving the fi les from /home to

/mnt/storage, and then mounting the partition

on the now empty /home.

pi@raspberrypi ~ $ sudo suroot@raspberrypi:/home/pi# cd /root@raspberrypi:/# mkdir /mnt/homeroot@raspberrypi:/# mount /dev/sda1 /mnt/home/root@raspberrypi:/# mv /home/* /mnt/home/root@raspberrypi:/# umount /mnt/home/root@raspberrypi:/# rmdir /mnt/home/root@raspberrypi:/# echo ‘/dev/sda1 /home ext4 defaults 0 1’ >> /etc/fstabroot@raspberrypi:/# mount -aroot@raspberrypi:/# mount | grep sda1/dev/sda1 on /home type ext4 (rw,relatime,data=ordered)root@raspberrypi:/# ls /homelost+found piroot@raspberrypi:/# exit

05 Create users for Samba

We now need to create some users to log

into Samba shares with. Do the above steps for

as many users as you’d like to have on the server.

Only do the usermod step if you want the user to

be able to use a shared directory for all users.

pi@raspberrypi ~ $ sudo adduser liamAdding user `liam’ ...Adding new group `liam’ (1002) ...Adding new user `liam’ (1001) with group `liam’ ...Creating home directory `/home/liam’ ...Copying files from `/etc/skel’ ...sh: 0: getcwd() failed: No such file or directoryEnter new UNIX password: Retype new UNIX password: passwd: password updated successfullyChanging the user information for liamEnter the new value, or press ENTER for the default Full Name []: Liam Fraser Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y

pi@raspberrypi ~ $ sudo usermod -a -G sambashare liam

pi@raspberrypi ~ $ sudo pdbedit -a -u liamnew password:retype new password:Unix username: liamFull Name: Liam FraserHome Directory: \\raspberrypi\liam

03 Format external storage

Use Parted to create a new partition

table on your external storage device and make a

single partition the full size of the device. Then run

partprobe to reload the partition table, and make

an ext4 fi le system on the new partition. This will

destroy all existing data on the disk.

pi@raspberrypi ~ $ sudo parted /dev/sda(parted) print Disk /dev/sda: 16.1GB(parted) mktable msdos Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?Yes/No? Yes(parted) mkpart Partition type? primary/extended? primary File system type? [ext2]? ext2Start? 0GBEnd? 16GB(parted) quitpi@raspberrypi ~ $ sudo partprobepi@raspberrypi ~ $ sudo mkfs.ext4 /dev/sda1

root:sambashare /home/allusers/pi@raspberrypi /home $ sudo chmod 770 /home/allusers/pi@raspberrypi /home $ sudo chmod g+s /home/allusers/

10 Raspi projects made easy

WorldMags.netWorldMags.net

WorldMags.net

Page 38: Linux User

Security camera

Build a security cameraWant to keep an eye on something from the comfort of your web browser? All you need is a Pi and a webcam!

This article will teach you how to use the MJPG-streamer software to stream video straight from a

webcam to your web browser. You could record the stream, and also display multiple streams from

multiple Raspberry Pis on one page. The streams can also be viewed from mobile devices and tablets.

MAKER PROFILE

WHAT YOU'LL NEED

NAME:Liam Fraser

OCCUPATION:Programmer and

Sysadmin at Web

Hosting company

Liam is the creator of the RaspberryPiTutorials YouTube series and works as a Linux server administrator for the Raspberry Pi Foundation

» A router or switch on your network to plug your Raspberry Pi into

» A Linux-compatible webcam

(we used a Logitech C270)

» Powered USB hub (the webcam might not have enough power without one)

» Latest Raspbian Image

www.raspberrypi.org/downloads

01 Network investigation

We’ll want to investigate the network

that the Pi is on, so we can assign it a static IP

address. That way, we’ll always know where it is

on the network.

pi@raspberrypi ~ $ ip addr show dev eth0 | grep inet inet 172.17.173.94/24 brd 172.17.173.255 scope global eth0pi@raspberrypi ~ $ ip route | grep defaultdefault via 172.17.173.1 dev eth0pi@raspberrypi ~ $ cat /etc/resolv.confnameserver 172.17.173.1

06 Start MJPG-streamer at boot

Edit the /etc/rc.local fi le (you’ll need to

07 Recording the stream

You can easily download a motion JPEG

stream and convert it to a more useful format

using VLC:

cvlc http://172.17.173.94:8080/?action=stream --sout file/mp4:stream.mp4Alternatively, you can just download the stream

URL with wget like so:

wget http://172.17.173.94:8080/?action=stream

04 Compile MJPG-streamer

Download and compile MJPG-streamer

as shown below:

pi@raspberrypi ~ $ svn checkout svn://svn.code.sf.net/p/mjpg-streamer/code/ mjpg-streamer-codepi@raspberrypi ~ $ cd mjpg-streamer-code/mjpg-streamerpi@raspberrypi ~/mjpg-streamer-code/mjpg-streamer $ make clean all

05 Testing it out

Start MJPG-streamer as follows:

export LD_LIBRARY_PATH=../mjpg_streamer -i “input_uvc.so” -o “output_http.so -w ./www”

You have to export the library path variable

to the current directory (.) so that the various

input and output plug-ins can be used. Type

your Raspberry Pi’s IP address followed by

:8080 into a web browser. Click the Stream tab

to view the stream. If the Stream tab doesn’t

work, try the example that uses JavaScript, as

that should work on most browsers, including

the Android browser.

03 Installing the required software

Log into the Raspbian system with the

username ‘pi’ and the password ‘raspberry’.

The MJPG-streamer software isn’t packaged

for the Raspberry Pi, so we’ll need to compile

it ourselves. Update the package index with

the command sudo apt-get update. We

need to install Subversion, which we’ll use to

download source code. We’ll also need libjpeg,

02 Assign a static IP address

Now that we have the

network confi guration, we can

assign a static IP address. Open

/etc/network/interfaces in an editor such as

nano, and change the line:

iface eth0 inet dhcp to a confi guration similar to our expert’s. Reboot

to load the new confi guration.

iface eth0 inet static address 172.17.173.94 netmask 255.255.255.0 network 172.17.173.0 broadcast 172.17.173.255 gateway 172.17.173.1

Stream video straight from a webcam to your web browser

and imagemagick, both of which are required by

MJPG-streamer. You can install these with

sudo apt-get install subversion libjpeg8-dev imagemagick

use sudo) to include the following lines, ensuring

that it still ends with exit 0:

export STREAMER_PATH=/home/pi/mjpg-streamer-code/mjpg-streamerexport LD_LIBRARY_PATH=$STREAMER_PATH$STREAMER_PATH/mjpg_streamer -i “input_uvc.so” -o “output_http.so -w $STREAMER_PATH/www” &s

Reboot the Pi to check that it comes back up

happily and starts the stream.

www.linuxuser.co.uk38

WorldMags.netWorldMags.net

WorldMags.net

Page 39: Linux User

Practical Raspberry Pi projects to amaze and inspire

08 Multiple streams at once

Here is an example of how to put

multiple streams on a single webpage. These

streams could come from a number of different

Raspberry Pis all over the house.

<html><h1>Streaming Example</h2><table border=”1”>

Stream from a webcam straight to your web browser

MJPG-streamer also allows you to capture still images, which could be useful if put in a script

MJPG-streamer comes with many different methods of accessing the stream, with examples for each

Most USB cameras should work pretty much ‘out of the box’, but it’s worth checking compatibility fi rst

Depending on your webcam, you may need a powered USB hub to get it working

It even works from mobile devices

and tablets!

<tr><td><h2>Stream 1</h2></td><td><h2>Stream 2</h2></td></tr><tr><td><img src=”http://172.17.173.94:8080/?action=stream”/></td><td><img src=”http://172.17.173.94:8080/?action=stream”/></td></tr></table> </html>

09 Extensions and improvements

This example setup is very basic and

has a few fl aws. There is no authentication

or SSL encryption, which means the streams

are insecure and shouldn’t be shared over the

internet. The HTTP module that comes with

MJPG-streamer is quite simple, so you could

get SSL by using a reverse proxy, such as Pound.

You’d be able to do SSL for each Pi you had with

a single Pound instance and access the different

Pis by having something like ‘stream1, stream2’

in the URL.

www.linuxuser.co.uk39

…if you want the raw data. However, playing it

back is tricky because you need to specify the

number of frames per second to display.

10 Raspi projects made easy

WorldMags.netWorldMags.net

WorldMags.net

Page 40: Linux User

VoIP server

www.linuxuser.co.uk40

Build a VoIP serverUse your Raspberry Pi as a voice over IP server, perfect for phone calls in the home or a small business

RasPBX is a project that brings Asterisk – industry-standard voice over IP

software – to the Raspberry Pi. There are VoIP clients for many platforms,

including hardware that converts VoIP to a conventional telephone line. Each

client gets a phone number and can call other clients. You can also have conference calls,

perfect for meetings over the phone. As an extension of this article, you could also share the

VoIP server over the internet, allowing remote clients to connect.

WHAT YOU'LL NEED» A router or switch on your

network to plug your Raspberry Pi into

» Smartphones, computers,

or VoIP phones on the same network to use as clients

» Powered USB hub (if using external hard drive)

» The latest RasPBX image

www.raspberry-asterisk.org/downloads

MAKER PROFILE

NAME:Liam Fraser

OCCUPATION:Programmer and

Sysadmin at Web

Hosting company

Liam is the creator of the RaspberryPiTutorials YouTube series and volunteers as a Linux server administrator for the Raspberry Pi Foundation

01 Initial setup

RasPBX is good to go as soon as the

image is fl ashed to your SD card: there is a web

interface for confi guration, and SSH is included

for remote login. As this will be a server, we’ll log

in with the user ‘root’ and password ‘raspberry’

and change the IP address to a static one so we

always know where it is on the network.

root@raspbx:~# ip addr show dev eth0 | grep inet inet 172.17.173.94/24 brd 172.17.173.255 scope global eth0 inet6 fe80::ba27:ebff:fef3:9016/64 scope link root@raspbx:~# ip route | grep defaultdefault via 172.17.173.1 dev eth0 root@raspbx:~# cat /etc/resolv.confnameserver 127.0.0.1nameserver 8.8.8.8nameserver 8.8.8.4

03 The web Interface

Type the static IP address of your

Raspberry Pi into a web browser. You’ll be taken

to the FreePBX web interface for confi guring

Asterisk. Click the FreePBX Administration

button and use the username ‘admin’, and

password ‘admin’. The User Control Panel allows

users to listen to their voicemails.02 Assign a static IP address

iface eth0 inet static

04 Add extensions

Each device that will be connected needs

its own extension. To add an extension, hover over

the Applications tab, then select Extensions.

Select Generic SIP Device as the device type and

click Submit. The User Extension is the number

to call to get to that device. The Display Name can

either be the name of a person or just the same as

the User Extension. The only other thing that you

need to fi ll in is the secret, which is a passphrase

that allows the device to connect. One of these

will have been generated, but you can change it

if you like. Scroll to the bottom and click Submit.

Add as many extensions as you like.

address 172.17.173.94 netmask 255.255.255.0 network 172.17.173.0 broadcast 172.17.173.255 gateway 172.17.173.1

Now that we have the network confi guration,

we can assign a static IP address. Open

/etc/network/interfaces in an editor such as

nano, and change the line:

iface eth0 inet dhcp to a confi guration similar to our expert’s. We

don’t have to worry about DNS as Google’s

nameservers are being used. You can load the

new network confi g using

sudo /etc/init.d/networking restart

WorldMags.netWorldMags.net

WorldMags.net

Page 41: Linux User

Practical Raspberry Pi projects to amaze and inspire

10 Raspi projects made easy

www.linuxuser.co.uk41

08 Trying a conference call

Call the conference number that you

set up from one of the devices. You’ll need to

enter the PIN code you set followed by the # key.

You’ll be told that you are the only person in this

conference, and will hear a notifi cation whenever

anyone else joins and leaves the conference.

05 Add a conference extension

Go to the Applications section and select

Conferences. Choose a number and name for the

conference, and a PIN number if you’d like users

to require a PIN to join. Click Submit Changes

once you’re done.

06 Apply config

Changes such as adding extensions and

conferences are not made until the Apply Confi g

button is pressed, so be sure to do that before

closing the web interface.

07 Trying it out

If you’re using an Android phone, we

recommend CSipSimple, which can be found

on Google Play. We recommend Linphone for

Linux clients. We’ll use two Android phones as an

example. When adding an account in CSipSimple,

scroll down to the Generic wizards section and

select Basic. Then fi ll in the information as shown

in the image (right). Once you have two devices set

up, try calling between the two.

Call other VoIP numbers and have their phone ring just like a normal call

Each client gets a phone number and can call other clients. You can also have conference calls

The Raspberry Pi makes the perfect server for

this kind of project

We recommend using wired networking,

especially if you want to ‘set and forget’

your VoIP server

WorldMags.netWorldMags.net

WorldMags.net

Page 42: Linux User

Portable wireless access point

www.linuxuser.co.uk42

Create a portable wireless access pointWith the help of a Wi-Fi adaptor, you can turn your Raspberry Pi into a wireless access point for other devices

The Raspberry Pi’s portability makes it ideal for carrying around as an emergency

wireless router and access point – great for some hotels and visiting less tech-adept

friends and family.

WHAT YOU'LL NEED» Model B Raspberry Pi

» Compatible Wi-Fi adaptor

www.adafruit.com/products/814

» Raspbian www.raspberrypi.org/downloads01

Install Raspbian

For this project, we can use Raspbian to

power our access point. Install the image on an

SD card and go through the basic setup process,

making sure to enable SSH. You can also turn off

the desktop during setup as well if you don’t plan

to use it.

NAME:ROB ZWETSLOOT

OCCUPATION:TECH WRITER

Rob models complex systems and is a web developer profi cient in Python, Django and PHP. He loves to experiment with computing

MAKER PROFILE

Use a Wi-Fi adaptor to turn your Pi into a wireless access point

Create wireless internet wherever there’s an available internet connection

No need for extra setup with a monitor

once confi gured

02 Connect through SSH

Find the IP address of your Raspberry

Pi by typing ifconfig into the command line,

and make a note of it. Turn off the Pi, plug in

your wireless adaptor, and turn it back on. In a

networked computer’s terminal, type:

$ ssh [user]@[IP address]

Enter your password to then log in.

03 Install DHCP

Install a DHCP server to your Pi with:

$ sudo apt-get install hostapd isc-dhcp-server

Now we need to set it up. Edit the confi guration

fi le with:

$ sudo nano /etc/dhcp/dhcpd.conf

And start by putting a # in front of the two option

domain-name entries, then remove the # in

front of ‘authoritative;’, seven lines down

WorldMags.netWorldMags.net

WorldMags.net

Page 43: Linux User

Practical Raspberry Pi projects to amaze and inspire

10 Raspi projects made easy

www.linuxuser.co.uk43

09 Finish up

So that this works after a reboot, type:

$ sudo sh -c “iptables-save > /etc/iptables.ipv4.nat”

Then add up iptables-restore < /etc/iptables.ipv4.nat to the end of the

/etc/network/interfaces fi le.

Finally, set it up as a daemon with:

sudo service hostapd startsudo service isc-dhcp-server startsudo update-rc.d hostapd enablesudo update-rc.d isc-dhcp-server enable

04 Server address

At the end of the confi guration fi le, add

these lines:

subnet 192.168.42.0 netmask 255.255.255.0 {range 192.168.42.10 192.168.42.50;option broadcast-address 192.168.42.255;option routers 192.168.42.1;default-lease-time 600;max-lease-time 7200;option domain-name “local”;option domain-name-servers 8.8.8.8, 8.8.4.4;}

Save and exit.

05 Disable Wi-Fi

Edit the server more with:

$ sudo nano /etc/default/isc-dhcp-server

Set INTERFACES to ‘wlan0’ and save. Now open:

$ sudo nano /etc/network/interfaces

Put a # in front of ‘iface wlan0’ and the following

lines with ‘wpa roam’, ‘iface default’ and any

others affecting wlan0.

06 Enable access

After the line ‘allow-hotplug wlan0’, enter

the following:

iface wlan0 inet static

07 Wireless networking

Create your wireless network with the

following code:

interface=wlan0driver=rtl871xdrvssid=[access point name]hw_mode=gchannel=1macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0wpa=2wpa_passphrase=[password]wpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMP

The Raspberry Pi’s portability makes it ideal for carrying around as an emergency wireless router

08 Network Addressing

Run:

$ sudo nano /etc/sysctl.confAnd add net.ipv4.ip_forward=1 to the

bottom of the fi le.

Save this, and then fi nish by running:

$ sudo sh -c “echo 1 > /proc/sys/net/ipv4/ip_forward”

Run the following three commands to make sure

the internet is forwarded correctly:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEsudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPTsudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

address 192.168.42.1 netmask 255.255.255.0

Save and exit, then set wlan0’s address with:

$ sudo ifconfig wlan0 192.168.42.1

Now create a new fi le to use to start creating the

wireless network:

$ sudo nano /etc/hostapd/hostapd.conf

Save and exit. Now edit hostapd to point it to this

new fi le with:

$ sudo nano /etc/default/hostapd

And then add:

/etc/hostapd/hostapd.conf to DAEMON_CONF=””

WorldMags.netWorldMags.net

WorldMags.net

Page 44: Linux User

Voice-control your Pi

www.linuxuser.co.uk44

Voice-control your PiControl your Raspberry Pi using just your voice

Ever since Captain Jean-Luc Picard fi rst spoke to the Enterprise computer, there has been

a fascination with verbally interacting with a computer by voice alone. Now you can do the

same with your Raspberry Pi. Special thanks to Steve Hickson and his PiAUISuite…

MAKER PROFILE

WHAT YOU'LL NEED

NAME:LES POUNDER

OCCUPATION:FREELANCE

SYSTEM

ADMINISTRATOR

Les has been a strong advocate of Linux and free software since 1999, and loves to tinker with hardware and software projects

» USB microphone

(check compatibility – your expert used a Zoom H2)

» Powered USB hub (particularly if using an external hard drive)

» Source code available from https://github.com/StevenHickson/PiAUISuite

01 Download the software

We start by downloading the suite

of software from the repository on GitHub:

https://github.com/StevenHickson/PiAUISuite/archive/master.zip

What you are downloading is a suite of

software for the Pi; however, we will focus solely

on voicecommand.

In a terminal, navigate to the download folder

and unzip the fi le using unzip master.zip. You

will now have a folder called PiAUISuite-master.

03 Make the files executable and install

To install the tools, we need to navigate

to PiAUISuite-master/Install.

We now need to make InstallAUISuite.sh

executable for all users, so use

chmod 777 InstallAUISuite.sh

Now that the fi le is executable, let’s install:

sudo ./ InstallAUISuite.sh

Practically any USB microphone should work, but always check compatibility

We recommend using a powered USB hub for your microphone and any storage you might use

02 Download the dependencies

You will need to install a few

dependencies to build your project, so open a

terminal and run the following:

sudo apt-get install libboost1.50-dev libboost-regex1.50-dev youtube-dl axel curl xterm libcurl4-gnutls-dev mpg123 flac sox libboost1.46This will take a bit of time, so go grab a drink.

We’ve used a VESA mount to fi x the RasPi

to the back of the monitor. See

shop.pimoroni.com

WorldMags.netWorldMags.net

WorldMags.net

Page 45: Linux User

Practical Raspberry Pi projects to amaze and inspire

10 Raspi projects made easy

www.linuxuser.co.uk45

06 Setting up our commands

You will now see an empty nano session.

Commands take the format of:

WORD==COMMAND

So, for example, to open a browser use

Internet==midori &

Or a new terminal using

Terminal==xterm &

Try those both out, then use Ctrl+O to save, and

Ctrl+X to exit nano.

Note: Appending a command with ‘&’ will make it

run in the background.

07 Plug in the microphone

Plug in your powered USB hub and then

attach your USB microphone. Give the Pi a few

seconds, then use the command lsusb to

ensure that your mic is listed. Your expert used a

Zoom H2, which has superb Linux compatibility.

Your microphone should just work with the

Raspberry Pi, but if you need to check, install

Audacity (sudo apt-get install audacity)

and do a test recording.

08 Little bit of housekeeping

There are a few fi les that need to be

made executable by everyone to work.

In a terminal type in the following.

sudo chmod 777 /usr/bin/voicecommandsudo chmod 777 /usr/bin/speech-recog.shsudo chmod 777 /usr/bin/X11/speech-recog.shThis now completes the confi guration.

09 Our first words

Voicecommand listens for a keyword

to work; by default, that keyword is Pi, so in a

terminal type in voicecommand -c. This will

launch voicecommand in continuous mode.

Now say “Pi” clearly; you will see the terminal

print Found Audio followed by Recording WAVE

‘stdin’… – this means that it has acknowledged

your voice. Now clearly say “Internet”.

10 Taking it further

Your Raspberry Pi should now launch the

Midori web browser.

Congratulations, you just used your voice to

control your Pi!

Remember we said that this was a suite

of voice-based tools? Well, head on over to

stevenhickson.blogspot.co.uk/2013/05/voice-command-v20-for-raspberry-pi.html and learn

more about what these tools can do to enhance

your future projects. Good luck!

04 The install process

Once you run the script, you will be

asked to install dependencies, answer yes to

this and it will install them. You may get an error

about libboost – ignore it.

You will next be asked what tools you

would like to install; answer No to all, except

voicecommand, which is the last choice.

05 Configuring voicecommand

The script will ask you if you wish to

automatically confi gure the tool; answer No to

this. The script will now end and leave you at the

terminal. Now we can edit the confi g fi le using

Voicecommand listens for a keyword to work

the command:

voicecommand -e

Read the text shown, before pressing Enter.

WorldMags.netWorldMags.net

WorldMags.net

Page 46: Linux User

www.linuxuser.co.uk46

How safe is your network?Tutorial

One of the best ways to test your security is to try to tear it apart, and you can do just that with Kali Linux…

How safe is your network?

Security is something that everyone needs to

be aware of and something that everyone needs

to deal with. While you can go out and collect

a number of tools and utilities to help you out,

there is an easier path. There are several Linux

distributions out there that provide an entire suite

of tools to fit your security needs. One of the more

popular ones is Kali Linux (originally BackTrack).

There are other ones, like BackBox or Lightweight

Portable Security, which may fit specific needs

better. You can run these off of a bootable DVD

or USB drive, allowing you to run forensics on a

compromised machine. Alternatively, you could

install it on a box and set it up on your network for

a more permanent security solution.

In this tutorial, we’ll use Kali Linux to go

through one possible set of steps to analyse and

test your local security. We will only be able to

cover a subset of all of the tools available in Kali

Linux, but you will learn some basic techniques

to monitor your systems and to test your

defences of them.

ResourcesKali Linux: www.kali.org

Metasploit: www.metasploit.com

Kali starts up with a top-level menu entry. Almost all of the tools available will be listed here, making it easy to start testing your security

The top ten applications that are used most often have their own menu entry. This saves you having to hunt in the submenus

Each application has an entry in the menu. If it is a console-based application, it opens in a new terminal with a listing of the options for that tool

AdvisorJoey Bernard As a true renaissance

man, he splits his time between building furniture, helping researchers with scientific computing problems and writing Android apps. When the kids let him have some time, that is

WorldMags.netWorldMags.net

WorldMags.net

Page 47: Linux User

Use Kali Linux to test your system security

How safe is your network?

TUTORIAL

www.linuxuser.co.uk47

01 Download and install

The fi rst step is to get a copy of Kali Linux

to work with. The main download page provides

downloads in several different formats and for

several different architectures. The usual thing to

do is to download an ISO and either burn it to a CD

or create a bootable USB drive.

02 Hardware detection

One cool extra that Kali Linux provides

is the ability to take a look at your hardware

before booting up. It is always a good idea to

get a lay-of-the-land look at the hardware you

want to investigate. This is a boot option when

you start up Kali.

04 Tcpfl ow

Once you have a list of hosts, then

you will probably want to look at what kind

of communication is happening. Tcpfl ow will

03 Netdiscover

One of the fi rst things to do is to fi nd out

who, or what, is on your network. Netdiscover

gives you a tool to do IP address mapping on

your network. This is especially useful on Wi-Fi

networks that aren’t using DHCP.

05 Intrace

Once you know what kind of

conversations are occurring on your network,

you may be interested in fi nding out what routes

those conversations are taking. Intrace gives you

a traceroute-like listing of packet paths by looking

at the TCP packets fl owing on your network.

06 Zenmap

After identifying the hosts on your

network, you will probably need to see what

ports are open on them, and what OS is running

there. The go-to application for this is Nmap. The

usual GUI front-end used for Nmap is Zenmap.

07 Sqlninja

Now we need to start poking at

security. Microsoft is always a punching bag

when it comes to security, and SQL Server is

no exception. Most corporate networks use

Microsoft software, so you need to test how they

are confi gured. Sqlninja is the tool to beat on SQL

Server, using techniques like SQL injection.

monitor the traffi c occurring on your network and

construct conversations that you can analyse to

see what your network is being used for.

08 Acccheck

Another service that can prove to be a

weak point in your systems is SMB, or Samba fi le

sharing. The utility acccheck can be used to run a

dictionary attack on account passwords, trying to

break through Windows authorisation.

WorldMags.netWorldMags.net

WorldMags.net

Page 48: Linux User

www.linuxuser.co.uk48

11 Guymager

In some cases, the machine in question

may be too important to leave offline. In these

cases, the only option is to make an image of

the drive to investigate later before rebuilding.

Guymager is one of the tools available to make

images for this purpose.

12 Chkrootkit

One of the tings you will need to look for

during an investigation is whether a rootkit has

been installed, providing a back entrance to the

bad guys. One of the tools you can use to do this

is chkrootkit. This utility looks for evidence of

common rootkits used for taking over machines.

14 Exploit databases

Along with testing the social aspect, you

also need to test the security of the machines

How safe is your network?Tutorial

09 Forensics mode

If you do find a machine that you think

may have been compromised, you want to be

careful when you try to investigate it. Kali Linux

provides a forensics mode on bootup that simply

boots up and leaves all local drives unmounted

and untouched. That way, you can run tests

without changing the state of the system.

10 Offline password cracking

One of the things you will want

to investigate is if the machine has been

compromised due to weak password selections.

There are several tools that can be used to try

to crack password hashes. Most of these, like

John the Ripper, use dictionary attacks to dig

out passwords.

Once you have your network secured, that is only the beginning

13 Social engineering

One aspect of security that gets

neglected is the social aspect. All of the

security in the world won’t help if your users

aren’t computing safely. Kali Linux provides a

social engineering toolkit that you can use to do

things like trying out spear-phishing attacks.

WorldMags.netWorldMags.net

WorldMags.net

Page 49: Linux User

www.linuxuser.co.uk49

15 Metasploit

The usual tool used to test a system is

Metasploit, which provides a full framework

for putting together complete attack vectors.

These include intrusions, compromises and

channels to allow for remote access of a

compromised machine. Within Kali Linux,

there are menu items that allow you to start up

the Metasploit server. There’s also an entry to

grab a dump of diagnostic logs, in case you run

into issues. Metasploit runs in a client-server

model, so once you start up the server, you

will need to connect with a client in order to try

some exploits against the machines that you

are responsible for.

17 p0f

Once you have your network secured,

that is only the beginning. You need to keep up

with what is happening on your system. The p0f

19 DDMS

DDMS is a debugging monitor that gives

you low-level access and control of Android

machines. You simply need to plug your device

into a USB port, start up DDMS and check

out what is happening on the device. You do

need to install an SDK for a specific version

before starting.

21 Bluetooth

You also have another possible security

hole. The Bluetooth protocol is used for mice,

keyboards and other bits of hardware. But

security was never really thought of in any major

sense. Kali Linux provides several tools to look at

the Bluetooth signals travelling around.

16 Armitage

One of the graphical interfaces

available to you is Armitage. If you have

already started Metasploit, then you can tell

Armitage to connect to this already-running

server. Otherwise, Armitage can start up a new

Metasploit server for you to play with.

20 Android exploits – apktool

Once you have your Android device

attached, you can run various exploits to get

root access. These vary, based on what kind of

hardware your Android is running on. One type

of exploit may need apktool, in order to open

and edit the APK files on your Android device.

22 Install on ARM

Support from the Kali developers has

provided for an ARM architecture version.

You can find it on the main download page.

There are even instructions on how to install

it on a Galaxy Note 10.1 device, including an

installation image.

23 Conclusion

Hopefully, if you follow these steps, you

can start to get a handle on the security needs

for your system. This is only a start, though.

There are lots more tools available in Kali Linux

than we covered here, so don't be afraid to

check out what else is available.

Use Kali Linux to test your system security

How safe is your network?

TUTORIAL

18 Hardware exploits

One set of tools that Kali provides that

is unique is the ability to test other hardware.

There are tools to poke into Android devices,

Bluetooth protocols and Arduino systems.

tool passively monitors a network to see what

machines exist and what OS they run, without

letting them know that you are listening.

to find any holes. You do this by trying known

exploits. Luckily, there is a database full of

known exploits online.

WorldMags.netWorldMags.net

WorldMags.net

Page 50: Linux User

www.linuxuser.co.uk50

Keep all your machines in line the easy wayTutorial

Set up your machines to be configured using Puppet so you can keep them in a consistent and workable state

Puppet – keep all your machines in line the easy way

Keeping track of two machines, keeping

them in sync is quite easy – for example, repo

files and config files. However, once you start

scaling past a machine or two, keeping files

aligned over tens, hundreds and thousands

of machines, it becomes a nightmare. If there

is one thing a network manager likes, it is

configuration standards.

This is where Puppet comes in. Puppet

allows users to use extend control over the

contents of their files and keep them in sync

across your estate. In this how-to guide to

implementing a basic Puppet setup, we show

how to keep all your files in sync.

This tutorial covers the basics of creating a

basic Puppet server and client setup, through to

setting up a few sample configurations that can

be deployed, applying different configurations to

different machines and configuring to clients in

a standard manner.

ResourcesTwo networked servers Ubuntu 12.04: www.ubuntu.com

Static IPs and full DNS entries

AdvisorStuart Burns is an

experienced Linux and virtualisation specialist for a Fortune 500 company and enjoys writing about Linux

Stats on the left give a quick overall health status

Manually add nodes and groups using the buttons on the left-hand side

Puppet dashboard showing daily status with our node showing compliant

Using the tabs, you can filter all the machines and review all those in a particular state

WorldMags.netWorldMags.net

WorldMags.net

Page 51: Linux User

Use the Puppet configuration management system

Keep all your machines in line the easy way

TUTORIAL

www.linuxuser.co.uk51

01 Set up the Puppet master

Puppet comes in two parts – master

and agent nodes. The master node, as the name

implies, is in charge. This server holds all the

config file goodness (also known as manifests).

For this tutorial we are running Ubuntu 12.04

LTS. Installing Puppet is really straightforward.

Choose one of the hosts and install the Puppet

master. Type the command:

sudo apt-get install puppetmaster

The setup requires the file site.pp to be present

(more on what it is later). Do this by using:

sudo touch /etc/puppet/manifests/site.pp

This installs all the prerequisites of the server.

02 Set up the Puppet agent

The agents sit on the machines that

we want to effectively manage. To install all the

components, use the command:

sudo apt-get install puppet

Again, this installs all the requirements for

the agent or client. It is suggested that you

do not set Puppet to autostart on boot. If you

do this, by default the agent will contact the

Puppet master and update its configuration, if

needed, every 30 minutes. We are going to run

ours manually, so that there is no waiting to see

the changes take effect.

03 Configure the Puppet

infrastructure

The next step is to set up the secure

communication between the servers. To do

this, log into the Puppet agent server and issue

the command:

sudo puppetd --server puppetmaster.test.local --waitforcert 60 --test

04 It's good to talk SSL

The next step is to enable secure

communications between the master and agent.

Type sudo puppetca --list. This will

show all the client machines that are trying to

connect to the server to service their requests. In

order for them to be given access, we must allow

them to do so, using the command:

sudo puppet cert --sign clientname

Look at the agent console while doing this

and see the handshake that is going on as the

machines are joined together.

To test if an agent system can see the server,

there is a command that can be used to test.

05 Introducing some Puppet basics

Before all the interesting code creation,

you need to understand how Puppet works. All

the configurations are held in manifest files.

Manifests are just source files are what we can

edit. All source files end in .pp

The whole point of having a Puppet setup is to

ensure that the machines on the site are all the

same (we can differentiate between server types

You will have to edit the server name to reflect

your setup. Leave the --test switch on as it’ll show

exactly what is happening in the foreground,

making life easier if there’s a need to debug.

If you run the command and you get an

error ‘warning: Could not retrieve fact fqdn’, it

means you have not set up your DNS properly.

It is strongly recommended that this is fixed

before proceeding.

later!). To help with this aim, Puppet thoughtfully

created a site-wide basic config file called

site.pp. This is a basic file that is used to create

the configurations.

To create changes on systems, a manifest is

used. A manifest is a number of (or just one) text

files. Within these manifests are the details that

configure each part of the system that can be

edited and customised.

Looking at a very, very basic manifest – it is

fairly clear as what it does…

file {'myfile': path => '/tmp/myfile', ensure => present, mode => 0640, content => "This could be anything.", }

The first line is termed a resource. Resources

are groups of similar things that can be

configured to meet a desired standard. Examples

of resources include directories, services and

files. In other words, basically groups of items

that share a commonality.

The bit after the file resource is what is known

as the title. It can be thought of as the unique

identifier. The bits that follow the identifier are

properties and values. To explain it a bit better,

the resource ‘file’ has a number of properties,

such as the path and the file rights.

WorldMags.netWorldMags.net

WorldMags.net

Page 52: Linux User

www.linuxuser.co.uk52

10 Assembling all the parts of Puppet

How do we group machines together and

apply specifics? It’s quite straightforward. Use

the ‘node’ prefix. Again it goes into site.pp.

An example of adding specific machines is:

09 Making the class useful!

Once the class is created, it can be

referenced in the site.pp file. To make it work,

the classes need to be included in the latter.

Go back to site.pp and modify it to include the

following text:

# /etc/puppet/manifests/site.ppimport "classes/*"node default { include webserver}

To import the classes, we just use the import

command. The ‘default’ means it is applied to all

nodes. Notice how we use ‘include webserver’

and the class is called webserver? Basically, the

class can be called by using ‘include’ suffixed by

the class created that is to be referenced.

The default node is applied to all the nodes. It

is possible to create nodes with special uses and

work only on specific nodes. These nodes are

the same layout as the default, except they have

different names. Again, the include can be used

to apply several configurations to all new nodes.

08 Doing it cleanly with classes

Putting all these entries in one file is

going to get messy, right? Also what if there are

several different configurations? This is where the

system can be used to differentiate. Use classes

to group together bits of code that need to run,

but reference it rather than putting all the code

directly into site.pp.

If there was a need for a separate a web server

config and a database configuration, they will

have some commonalities and some differences.

So create a folder called classes under the

manifest folder.

07 Doing useful stuff with the

manifest

It was mentioned before that we could do useful

things with Puppet. For example, it can be made

to install an application. This can be done by

defining the Resource; this time the resource

is ‘package’ and using the ensure property

followed by ‘ensure’ to make sure it is installed or

06 Testing the Puppet manifests

Manifests can be tested on the local

Puppet master machine if you want to (not

best practice, but will suffice for the tutorial

needs). Simply save the above into a file, for

example test.pp. Once you have done that, use

the command:

sudo puppet apply /path/to/test.php

One item by itself is not very useful, so we

could group together several items in one file.

However, it makes more sense to split down the

manifests into the jobs they do – or, to use the

proper term, classes. That way you can modify

the manifests to meet the requirements for

multiple groups.

The whole point of having a Puppet setup is to ensure that the machines on the site are all the same

‘absent’ to make sure it is not!

package { "apache2": ensure => "present"}

With a simple addition, that basic start can be

built up to autostart. The resource this time is

‘service’ . Following on from the above, add:

service { "apache2": enable => 'true'}

Keep all your machines in line the easy wayTutorial

Create a new file under classes, call it

webserver.pp and put in the following:

class webserver {package { "apache2": ensure => "present";}package { "php5": ensure => "present";}service { "apache2": enable => 'true'}}

WorldMags.netWorldMags.net

WorldMags.net

Page 53: Linux User

www.linuxuser.co.uk53

11 Installing the web report interface

There is also a web management

interface that can be installed to make

reporting and management easier. It is not

straightforward, but using it makes for a more

interesting and GUI experience. Installing the

Puppet dashboard on the Puppet master for

evaluation is okay.

Because of the dependencies you may

encounter, your life will be much easier if you

install it from the Puppet Labs repository.

Enabling it is quite straightforward, as is

shown below.

On the Puppet master, use the following

command to get the repository details:

wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb

cd /usr/share/puppet-dashboardrake RAILS_ENV=production db:migrate sudo -u www-data /usr/share/puppet-dashboard/script/server -e production

This will load the Puppet server in the

foreground. Watch the console for any errors

that are thrown up.

The file /etc/puppet/puppet.conf will need to

be edited. On the client, edit it with these values:

[agent]report=true

Edit /etc/puppet/puppet.conf on the master to

add to the ‘[master]’ section:

reports = store, httpreporturl = http://puppetmaster.test.local:3000/reports/upload

The web server can be accessed using the

following URL: http://puppet-server:3000Log into the client and then rerun the Puppet

agent. Once this is done, if the foreground agent

is run and the server is active, you will see there

is a pending task.

Log into the Puppet master and run the

following command:

cd /usr/share/puppet-dashboardsudo -u www-data env RAILS_ENV=production script/delayed_job -p dashboard -n 4 -m start

This will run a background collection script

that will populate the web server with collected

data. And there you have it.

Use the Puppet configuration management system

Keep all your machines in line the easy way

TUTORIAL

node 'puppetclient2.test.local' inherits database…stating the node with its fully qualified name,

and stating that it inherits, or takes on, the setup

that is contained in the database class. In this

example, puppetclient2 would get all the database

configurations defined in the following way:

node database { include mysql-server}

Then, when we have a database server, it will

read all the classes defined in the node. So, for

example, the database nodes get all the class

setups contained within MySQL, Apache and

phpMyAdmin with their potentially customised

configuration. So we can essentially chain together

several classes into one node. Note, though, that

the default class must always come first! Followed by installing the repository:

sudo dpkg -i puppetlabs-release-precise.debsudo apt-get update

Now that we have the repository installed,

the dashboard can be installed using the

command below. It will also install all the other

dependencies needed:

sudo apt-get install puppet-dashboardsudo apt-get install mysql-server

Now that the files are installed, you will need

to set up the database. Run MySQL as root (just

while we create the database and users). Each

line needs to be entered one line at a time.

CREATE DATABASE dashboard_production CHARACTER SET utf8;CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON dashboard_production.* TO 'dashboard'@'localhost';

Once the database is set up, take the

password used above and edit the config file

with the command:

sudo vi /etc/puppet-dashboard/database.yml

You will see an a series of text lines, one

headed with the item ‘Production’. Fill in the

password field with my_password.

12 Configure the data collection

Once the database is created, it needs

to be populated. This is done using the following

set of commands:

WorldMags.netWorldMags.net

WorldMags.net

Page 54: Linux User

www.linuxuser.co.uk54

Speed up Linux with OpenboxTutorial

Learn how to install and properly configure the lightweight window manager Openbox and speed up your day-to-day computing without sacrificing usability

Speed up Linux with Openbox

We’re always looking for ways to speed up our

systems. Whether we’re trying out lighter distros

or desktop environments, building from scratch

or selecting the perfect array of apps, there are

many ways to accomplish this. One of the ways

that can sometimes get overlooked, though,

is changing your window manager – the set of

packages that handles the actual windows of

your desktop.

One of the most popular and lighter window

managers is Openbox. It’s one of the main

window managers in LXDE, and readily available

to a lot of distros either through their repos or

via the website. It can noticeably speed up your

desktop, especially if you’re using GNOME, KDE

and the like.

Openbox can also be used as your main,

supercharged and minimal desktop environment.

It uses a much simpler layout than some of the

more popular desktop environments; however,

it’s perfectly usable with a few tweaks and may

just greatly increase your workflow.

The best part is, you can go back easily to your

old desktop or windows manager whenever,

thanks to the way Linux login managers handle

desktop sessions.

ResourcesOpenbox: openbox.org/wiki/Openbox:Download

AdvisorRob Zwetsloot models complex

systems and is a web developer proficient in Python, Django and PHP. He loves to experiment with computing

Speed up a core part of your system by using Openbox instead of the standard window manager

Use Openbox as a desktop environment for super-speedy

and customisable workflow

Personalise Openbox to make it more usable in the way you wish with

docks, taskbars and extra menus

Maintain the other aspects of your favourite desktop environment while using the lighter, faster Openbox

WorldMags.netWorldMags.net

WorldMags.net

Page 55: Linux User

Configure the Openbox lightweight window manager

Speed up Linux with Openbox

TUTORIAL

www.linuxuser.co.uk55

01 Install Openbox

Installing Openbox to your system is very

easy. You can find it in your graphical package

manager or software centre, or install it with the

following for Debian-based systems:

$ sudo apt-get install openbox…and for Fedora it’s:

$ sudo yum install openbox

02 Use Openbox

Log out of your distro. MDM, GDM,

LightDM and KDM will all allow you to select a

session at the login screen – open the selection

and you’ll see that you now have the option to use

GNOME/Openbox or KDE/Openbox.

03 Basic configure

Openbox is highly configurable, and the

most basic configuration can be found in the

graphical manager for this. Here you can change

the windows theme, the way the windows react

during your workflow, and whether or not you

want to use a dock.

05 System tray

To get a panel with open windows and

system trays, your best bet is to install tint2. To

do this, you’ll need to simply install it using the

terminal we just opened. The package is called

tint2, so for Fedora it would be:

$ sudo yum install tint2

08 Backgrounds

To be able to set a background image and

fully customise your Openbox desktop, the best

package for the job is Nitrogen. It comes with a

graphical interface to choose backgrounds and

can be installed with:

$ sudo apt-get install nitrogen

09 Saving screens

You can install a screensaver to Openbox

by using the basic xscreensaver. Install it with

something like:

$ sudo yum install xscreensaver xscreensaver-glTo modify it, run xscreensaver-demo

from the terminal. This also adds power

management options.

10 Autostarting

These will not automatically start when

logging into Openbox, so we need to create an

autostart script to deal with it. Create a config

directory with:

$ mkdir ~/.config/openbox…and then open a new autostart file with:

$ nano ~/.config/openbox/autostart

04 Log into Openbox

Log back out and select the Openbox

desktop from your session manager. After

logging back in, you’ll be presented with a

basic grey desktop and not much more. Right-

clicking will open up some options; for now,

open the terminal.

07 Desktop compositing

For Docky to work properly, there needs

to be some degree of desktop compositing. One

of the best ways to do this while still keeping

a quick system is to use xcompmgr. Install on

Fedora with:

$ sudo yum install xcompmgr

06 Docking

You can create a shortcut dock for apps

to live on, similar (but better) than what you get

in OS X. It was used in Fuduntu, and is nice and

lightweight. To install Docky in something like

Debian, use:

$ sudo apt-get install docky

WorldMags.netWorldMags.net

WorldMags.net

Page 56: Linux User

www.linuxuser.co.uk56

14 Python imports

Set up the script so we can use the

necessary Python elements with:

#!/usr/bin/env python

import pygtkpygtk.require('2.0')import gtkimport osimport getpass

13 Shut down

Openbox doesn’t have a specific

menu that lets you shut down graphically.

Crunchbang, a Linux distro that uses Openbox,

has a great Python script for this that we can

borrow from. First of all, create the shutdown

menu script with:

$ sudo gedit /usr/bin/cb-exi

12 Numlock on

By default, the numlock will not be kept

on when logging into Openbox. To get this to

happen at startup, install the numlock x package

with yum or apt-get, and then add this line to the

autostart script:

numlockx on &

Speed up Linux with OpenboxTutorial

11 Start script

Add the individual elements to the

autostart script like so:

nitrogen --restore &tint2 &xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &docky &xscreensaver -no-splash &

Press Ctrl+X and save the script.

15 Shutdown confirmed

For a simple shutdown button, you'll

need to do the following in the script:

class cb_exit: def disable_buttons(self): self.shutdown.set_sensitive(False) def shutdown_action(self,btn):

self.disable_buttons() self.status.set_label("Shutting down, please standby...") os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop") def create_window(self): self.window = gtk.Window() title = "Shut down " + getpass.getuser() + "? Choose an option:" self.window.set_title(title) self.window.set_border_width(5) self.window.set_size_request(500, 80) self.window.set_resizable(False) self.window.set_keep_above(True) self.window.stick self.window.set_position(1) self.window.connect("delete_event", gtk.main_quit) windowicon = self.window.render_icon(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU) self.window.set_icon(windowicon)

WorldMags.netWorldMags.net

WorldMags.net

Page 57: Linux User

www.linuxuser.co.uk57

19 Cancel button

You can add a cancel button by defining

cancel_action like so:

21 Add button

Open obmenu, and expand the

Openbox 3 arrow. Choose a place to add the

button and press New Item. Give it any label you

wish, such as Shutdown, make sure Action is set

to Execute, and set the Execute command to

/usr/bin/cb-exit.

20 Menu button

To add this shutdown menu to the

Openbox menu, you'll need to install obmenu.

This graphical tool can help you add apps and

scripts to the menu, and is easy to use and very

customisable. Install it with something like:

$ sudo yum install obmenu

22 Extra menus

From here you can add extra buttons,

apps and functions to the right-click menu

and customise your experience. There’s a lot of

extra customisation you can do with Openbox in

general as well, with theming options, behaviour

options and much more.

16 Shutdown button

That’s the function of the button set up;

now for the window and button:

self.button_box = gtk.HBox() self.button_box.show() self.shutdown = gtk.Button("_Shut down") self.shutdown.set_border_width(4) self.shutdown.connect("clicked", self.shutdown_action) self.button_box.pack_start(self.shutdown) self.shutdown.show()

17 Shutdown window

Finally, we finish off the script like so:

self.label_box = gtk.HBox() self.label_box.show() self.status = gtk.Label() self.status.show() self.label_box.pack_start(self.status)

18 Restart button

To add a reboot button involves almost

the same code as the shutdown button. While

defining reboot_action, make it the same

as shutdown_action, but make sure to use

the .Restart function from the ConsoleKit.

Create the reboot button by simply replacing

‘shutdown’ with ‘reboot’ in the same code.

Configure the Openbox lightweight window manager

Speed up Linux with Openbox

TUTORIAL

self.vbox = gtk.VBox() self.vbox.pack_start(self.button_box) self.vbox.pack_start(self.label_box) self.vbox.show() self.window.add(self.vbox) self.window.show() def __init__(self): self.create_window()def main(): gtk.main()if __name__ == "__main__": go = cb_exit() main()

def cancel_action(self,btn): self.disable_buttons() gtk.main_quit()

And then adding the button with:

self.cancel = gtk.Button(stock = gtk.STOCK_CANCEL)self.cancel.set_border_width(4)self.cancel.connect("clicked", self.cancel_action)self.button_box.pack_start(self.cancel)self.cancel.show()

WorldMags.netWorldMags.net

WorldMags.net

Page 58: Linux User

The start Here we’re doing some minor setup, including getting a new module that helps us create a simple graphical interface

The imports We’re importing the three games we created in past issues so we can call upon or use them

The window Create a graphical window and give it a name so we can add some functions to it

The frame Define the dimensions of the window and give a rough guide to placement of the objects within

The welcome Print a message in the window and place it in a specific orientation. This works a little differently to print

The button The focus of this month’s tutorial is making Rock-Paper- Scissors work in a graphical interface, so we’re calling a new function we’re creating

The interface Creating and formatting buttons to start the other two tutorial games in the command line or shell

The exit Here we create a button that quits the window and ends the script. We’ve also placed it specifically at the bottom of the window

The loopThe mainloop allows the main window to continue to work and be updated without exiting the program unless specified

Tutorial Python for beginners: A graphical interfaceTutorial

www.linuxuser.co.uk58

#!/usr/bin/env python2

#Linux User & Developer presents: Mega Microgrames Collection

from Tkinter import *

import rockpaperscissorsimport hangmanimport pokerdice

root = Tk()root.title (“Linux User & Developer’s Mega Microgames Collection”)

mainframe = Frame(root, height = 200, width = 500)mainframe.pack_propagate(0)mainframe.pack(padx = 5, pady = 5)

intro = Label(mainframe, text = “””Welcome to Linux User & Developers Mega Microgames Collection.Please select one of the following games to play:“””)intro.pack(side = TOP)

rps_button = Button(mainframe, text = “Rock, Paper, Scissors”, command = rockpaperscissors.gui)rps_button.pack()

hm_button = Button(mainframe, text = “Hangman”, command = hangman.start)hm_button.pack()

pd_button = Button(mainframe, text = “Poker Dice”, command = pokerdice.start)pd_button.pack()

exit_button = Button(mainframe, text = “Quit”, command = root.destroy)exit_button.pack(side = BOTTOM)

root.mainloop()

Main Interface Code Listing

Bring everything together with a Python GUI and take the next step in programming your own software

Python for beginners: A graphical interface

Over the last few issues we’ve created three

basic games in Python; however, they all ran

in the command line or via IDLE, a Python

IDE. While this allowed us to show off different

ways to use Python code, we didn’t show you

how to present it. In this tutorial, we will take all

three games and put them all into one unified

graphical interface.

To this end, we’ll be making use of the small

line of code we added at the bottom of each

previous tutorial so we can import them as

modules into our main graphical script. We’ll

also modify the existing code to add some

graphical elements. To do all this we’ll be using

Tkinter, a default module available in Python

that allows you to create windows and frames

with fairly simple code.

All you need for this tutorial is an up-to-date

copy of Python, from your distro’s repository

or the website, and the IDLE development

environment. This will also work great on

Raspberry Pi distros, such as Raspbian.

Rob Zwetsloot models complex systems and is a web developer proficient in Python, Django and PHP. He loves to experiment with computing

AUTHOR

ResourcesPython 2: www.python.org/download

IDLE: www.python.org/idle

WorldMags.netWorldMags.net

WorldMags.net

Page 59: Linux User

New importsImport new modules that allow us to create the GUI part of Rock, Paper, Scissors, as well as removing the modules we no longer need

New interfaceOur new main function allows us to call the majority of the game script when the rps_button is pressed. This contains the game components and the graphical components

New startWe’ve changed the start function so that it no longer goes to the score function after it’s finished. We’ve also removed the score function, as we track that differently so it can be displayed properly

New gameWe’ve changed the game function so that it now takes the input from our graphical interface. We use a new variable to do this that works with the GUI, otherwise it works roughly the same as before

New resultsThe result function remains largely unchanged, only now it sends the outcome message to a variable we use for the interface, and generally uses the new GUI’s variables

New windowWe create the game window with a slightly different method due to already having a ‘mainloop’ root window. We’re also giving it a name so you can identify it properly

New variablesOur new variables are set up so they can interact with both the game code and the interface code properly. We’ve also made sure to have a default selection for the player so that the code runs properly

New frameDetermine the size and layout of the window for the game using a slightly different method than before. We’ve also allowed for elements to be anchored in certain positions around the window

New choiceHere we place radio buttons in a specific configuration in the window, giving the user the choice of three moves. This is then passed along to the variable and used by the game code

New moveHere we allow for the computer’s move to be displayed under the ‘Computer’ label

New buttonPressing the Play button we’ve put here runs the game script, prints out the scores and finally a message based on the outcome

New endingWe’ve changed this so that the main script begins with gui now rather than the start function

Create a GUI for the three games we made in previous tutorials

Python for beginners: A graphical interface

TUTORIAL

www.linuxuser.co.uk59

#!/usr/bin/env python2

# Linux User & Developer presents: Rock, Paper, Scissors: The Video Game: The Module

from Tkinter import *from ttk import *import random

def gui(): rock = 1 paper = 2 scissors = 3

names = { rock: “Rock”, paper: “Paper”, scissors: “Scissors” } rules = { rock: scissors, paper: rock, scissors: paper }

def start(): while game(): pass

def game(): player = player_choice.get() computer = random.randint(1, 3) computer_choice.set(names[computer]) result(player, computer)

def result(player, computer): new_score = 0 if player == computer: result_set.set(“Tie game.”) else: if rules[player] == computer: result_set.set(“Your victory has been assured.”) new_score = player_score.get() new_score += 1 player_score.set(new_score) else: result_set.set(“The computer laughs as you realise you have been defeated.”) new_score = computer_score.get() new_score += 1 computer_score.set(new_score)

rps_window = Toplevel() rps_window.title (“Rock, Paper, Scissors”)

player_choice = IntVar() computer_choice = StringVar() result_set = StringVar() player_choice.set(1) player_score = IntVar() computer_score = IntVar()

rps_frame = Frame(rps_window, padding = ‘3 3 12 12’, width = 300) rps_frame.grid(column=0, row = 0, sticky=(N,W,E,S)) rps_frame.columnconfigure(0, weight=1) rps_frame.rowconfigure(0,weight=1)

Label(rps_frame, text=’Player’).grid(column=1, row = 1, sticky = W) Radiobutton(rps_frame, text =’Rock’, variable = player_choice, value = 1).grid(column=1,

row=2, sticky=W) Radiobutton(rps_frame, text =’Paper’, variable = player_choice, value = 2).grid(column=1,

row=3, sticky=W) Radiobutton(rps_frame, text =’Scissors’, variable = player_choice, value =

3).grid(column=1, row=4, sticky=W)

Label(rps_frame, text=’Computer’).grid(column=3, row = 1, sticky = W) Label(rps_frame, textvariable = computer_choice).grid(column=3, row=3, sticky = W)

Button(rps_frame, text=”Play”, command = start).grid(column = 2, row = 2)

Label(rps_frame, text = “Score”).grid(column = 1, row = 5, sticky = W) Label(rps_frame, textvariable = player_score).grid(column = 1, row = 6, sticky = W)

Label(rps_frame, text = “Score”).grid(column = 3, row = 5, sticky = W) Label(rps_frame, textvariable = computer_score).grid(column = 3, row = 6, sticky = W)

Label(rps_frame, textvariable = result_set).grid(column = 2, row = 7)

if __name__ == ‘__main__’: gui()

Modified RPS Code Listing

Perfect for your Raspberry Pi

WorldMags.netWorldMags.net

WorldMags.net

Page 60: Linux User

www.linuxuser.co.uk60

01

02

03

04

07

08

09

06

05

01 First line

As we’ve done before, we use this line

to enter the path to the Python interpreter. This

allows us to run the program inside a terminal or

otherwise outside of a Python-specific IDE like

IDLE. Note that we’re also using Python 2 for this

particular script.

06 Introductions

We create the intro variable as a label

that lives in the main frame. We give it text to

introduce the interface, using the triple quote

marks to have it go across multiple lines and

format better. We then use pack to display it, and

tell Tkinter to put it at the top of the interface.

07 Rock, Paper, Scissors

We create a button for the Rock, Paper,

Scissors game using the Button function. We

attach to it the main frame, give it a label using

02 Import graphics

Tkinter is the graphical interface we’re

using and while it’s a standard Python function,

you’ll need to import the module so you can use it.

We’ve used the ‘from [module] import *’ method

so that we can use the functions from it without

having to add Tkinter at the beginning.

04 Root window

Using the Tk() function creates the

window we’re going to be placing everything in.

We’ve called it root for now; however, you can

call it anything, as long as you’re consistent.

We’ve also named it using the title command

from Tkinter and a string of text.

05 Main frame

The first line has us set the variable

mainframe as a Frame in the interface. We’ve

attached it to root, the main window, and given 03 Import games

We’re importing the modules for the

MAIN WINDOWThe main interface window that this code creates is fairly basic, but contains the functions we require. The window exit button will do the same job as the Quit button, and the Hangman and Poker Dice buttons run the old scripts in the Python shell.

Tutorial Python for beginners: A graphical interfaceTutorial

#!/usr/bin/env python2

#Linux User & Developer presents: Mega Microgrames Collection

from Tkinter import *

import rockpaperscissorsimport hangmanimport pokerdice

root = Tk()root.title (“Linux User & Developer’s Mega Microgames Collection”)

mainframe = Frame(root, height = 200, width = 500)mainframe.pack_propagate(0)mainframe.pack(padx = 5, pady = 5)

intro = Label(mainframe, text = “””Welcome to Linux User & Developers Mega Microgames Collection.Please select one of the following games to play:“””)intro.pack(side = TOP)

rps_button = Button(mainframe, text = “Rock, Paper, Scissors”, command = rockpaperscissors.gui)rps_button.pack()

hm_button = Button(mainframe, text = “Hangman”, command = hangman.start)hm_button.pack()

pd_button = Button(mainframe, text = “Poker Dice”, command = pokerdice.start)pd_button.pack()

exit_button = Button(mainframe, text = “Quit”, command = root.destroy)exit_button.pack(side = BOTTOM)

root.mainloop()

it a minimum height and width in pixels. We

use pack_propogate to create the window, and

then make sure it’s the size that we’ve defined.

We’ve then used pack to pad the borders,

allowing the contents of the window to not

touch the sides of it.

three games. We added the line at the bottom

of each script so we can do this. To make sure

to differentiate the functions in each game, we

will have to specify [module].[function] so there

are no errors in the code.

WorldMags.netWorldMags.net

WorldMags.net

Page 61: Linux User

www.linuxuser.co.uk61

#!/usr/bin/env python2

# Linux User & Developer presents: Rock, Paper, Scissors: The Video Game: The Module

from Tkinter import *from ttk import *import random

def gui(): rock = 1 paper = 2 scissors = 3

names = { rock: “Rock”, paper: “Paper”, scissors: “Scissors” } rules = { rock: scissors, paper: rock, scissors: paper }

def start(): while game(): pass

def game(): player = player_choice.get() computer = random.randint(1, 3) computer_choice.set(names[computer]) result(player, computer)

10

11

12

13

14

09 Break the loop

The exit button works similarly to the

other buttons we’ve created, but instead it uses

the command root.destroy. This ends the loop

that we’ve created with root.mainloop(), which

allows the interface code to continue looping,

allowing us to continually use it. We place the

exit button at the bottom of the window with

‘side = BOTTOM’.

12 Game variables

The variables are staying the same

so that we can do the same comparisons we

made in the original code. We’ve put them into

the function itself so that they don’t affect the

other imported code into the main interface –

and so that when calling just this function, we

don’t need to use global to bring them in.

14 Game function

The game function has had a few

modifications to make sure it works with

the interface. First of all, the player variable

is retried using get() on the special variable

we’ve created to contain the player choice.

We do a similar thing for the computer, using

‘set’ to change the variable in our interface-

friendly computer_choice value. We still use

the name variable to set the text that goes into

computer_choice. This then passes the player

and computer variables along in the same way

we did before.

13 Start function

We’ve removed the part that calls

the score function from the start function,

as we have the interface handle the scoring

now. It still calls upon the game function,

though, putting it into a loop so it can be

used continuously. This function is called by

the interface to begin the game by setting a

computer move and then comparing it to the

player’s choice.

10 Game code

Nothing much has changed in the start of

this code, other than a few import changes. The

code for running it in the command line is still

PYTHON SHELLOur other code will run in the shell or via a command line in the same way as before when the buttons are pressed.

Create a GUI for the three games we made in previous tutorials

Python for beginners: A graphical interface

TUTORIAL

08 Other games

For the other two games, the code is

mostly the same; however, we call upon the start

function in both of them. In the final interface,

this will cause the games to run in the shell or

command line as they’ve been running before.

11 Game interface

One of the biggest changes we’re making

to this script is having it all contained in one

function, ‘def gui’. The interface code needs to

be put into a function, otherwise it will be run

during import. While we’ve chosen to put the

entirety of the code in a function, you can also

try just having the graphical interface code in

one. All our variables are kept in here so that

they still work properly.

there, and with a few modifications the code will

run independently of the main interface. We’ve

removed the time module, as we no longer need

it, and imported not only the Tkinter module,

but the ttk module. The ttk module allows us to

arrange the GUI in a grid, which will be slightly

easier to use and understand.

text that appears on the button, and then have

it run a command. In this case, we use the

modified rockpapershotgun.py code that has a

gui function, hence rockpapershotgun.py. We

then use pack to place it in the window

WorldMags.netWorldMags.net

WorldMags.net

Page 62: Linux User

www.linuxuser.co.uk62

def result(player, computer): new_score = 0 if player == computer: result_set.set(“Tie game.”) else: if rules[player] == computer: result_set.set(“Your victory has been assured.”) new_score = player_score.get() new_score += 1 player_score.set(new_score) else: result_set.set(“The computer laughs as you realise you have been defeated.”) new_score = computer_score.get() new_score += 1 computer_score.set(new_score)

rps_window = Toplevel() rps_window.title (“Rock, Paper, Scissors”)

player_choice = IntVar() computer_choice = StringVar() result_set = StringVar() player_choice.set(1) player_score = IntVar() computer_score = IntVar()

15

16

17

19

20

18

GAME WINDOWIn its default state, the game window will have rock selected and no message will be displayed. Once the player makes a move, the message will be displayed at the bottom and the computer’s move will be printed. There’s no quit button on this menu, but clicking the window exit will bring you back to the main interface.

Tutorial Python for beginners: A graphical interfaceTutorial

15 Result function

The result function still takes the same

two variables as before, which we set in the

game function. While technically we can use

the variables set up for the interface, these

are not pure integers and can cause an error if

not handled correctly. With that in mind, we’ve

created an empty new_score variable that we

can use to effectively clean the interface value

before adding it back into it.

20 Interface variables

Here is the reason we had to call and

change the variables in a different manner.

For Tkinter, we need to let the interface know

whether or not a variable is an integer or a text

value. IntVar and StringVar allow for these

respectively. We’ve also set the player_choice

variable to be one, which we have already set as

the choice for rock. This means there will at least

be a default choice when the game is started,

and it won’t cause an error.

21 Game frame

We’ve created the frame for our

interface items slightly differently. Instead

of using the pack command in the main

interface, we’re using grid to make sure they’re

orientated in such a way that makes sense

for the user. Padding does just that, setting

up values to make sure the items in the frame

don’t touch the edge of the window. Using the

.grid command, we then create this frame.

The row and column variables allow for rows

and columns to be included in the structure of

16 Tie

The logic for determining the result is

the same as before. We first do the easy check –

whether or not the numeric value for the player

and computer variable is the same. What changes

this time is that, instead of printing the text,

we send the “Tie game” message to our result

variable using the set function from Tkinter.

18 Lose

This part of the overall if statement

works in the same way as before, by assuming

that if it isn’t a tie or a win, it’s a loss. Like the

new version of the win code, it then uses set

to change the message that will be displayed

to the player, and calls upon and changes

the computer score by putting it through the

new_score variable.

19 New window

As the original window is part of the

mainloop, we cannot have the window be

created using Tk() like in the main interface

code. As this window is coming off it, though,

we instead create it using Toplevel(). This

allows the window to run separately and on

top of the main window. We’ve also given

17 Win

The if statement continues by seeing if

the player has won. Like before, we use the rules

we set to make the comparison for the code to

it a name, which will not change the main

window’s name in the process.make. We set the result_set like we did in the

tie game, with a different message to the user.

Finally, we set the new_score variable to be the

current player score, using the get function to

obtain it, plus one to the score, and then use

set again to put it back into the player_score

variable. We can’t use += with the player_score

variable, as it is not a standard variable.

WorldMags.netWorldMags.net

WorldMags.net

Page 63: Linux User

www.linuxuser.co.uk63

rps_frame = Frame(rps_window, padding = ‘3 3 12 12’, width = 300) rps_frame.grid(column=0, row = 0, sticky=(N,W,E,S)) rps_frame.columnconfigure(0, weight=1) rps_frame.rowconfigure(0,weight=1)

Label(rps_frame, text=’Player’).grid(column=1, row = 1, sticky = W) Radiobutton(rps_frame, text =’Rock’, variable = player_choice, value = 1).grid(column=1, row=2,

sticky=W) Radiobutton(rps_frame, text =’Paper’, variable = player_choice, value = 2).grid(column=1, row=3,

sticky=W) Radiobutton(rps_frame, text =’Scissors’, variable = player_choice, value = 3).grid(column=1,

row=4, sticky=W)

Label(rps_frame, text=’Computer’).grid(column=3, row = 1, sticky = W) Label(rps_frame, textvariable = computer_choice).grid(column=3, row=3, sticky = W)

Button(rps_frame, text=”Play”, command = start).grid(column = 2, row = 2)

Label(rps_frame, text = “Score”).grid(column = 1, row = 5, sticky = W) Label(rps_frame, textvariable = player_score).grid(column = 1, row = 6, sticky = W)

Label(rps_frame, text = “Score”).grid(column = 3, row = 5, sticky = W) Label(rps_frame, textvariable = computer_score).grid(column = 3, row = 6, sticky = W)

Label(rps_frame, textvariable = result_set).grid(column = 2, row = 7)

if __name__ == ‘__main__’: gui()

21

22

23

23

24

25

Create a GUI for the three games we made in previous tutorials

Python for beginners: A graphical interface

TUTORIAL

22 Player’s choice

We create a label for the player’s move

and assign it to a grid location, on the first row,

on the first column. We also justify it to the left

using ‘sticky = W’. We then add the radio buttons

for the player’s move, each on the same column

but the following row down. We give each choice

a name, then assign it to the player_choice

variable. We then make each choice have a

numerical value that corresponds to the moves

we’ve determined in the first set of rules.

23 Computer’s move

We display the computer move here.

First of all, we label what this is and then create

24 Press Play

The running of the code all hinges on

the Play button. It’s very simple: we put it in the

row between the Player and Computer move as

part of our three-column system; and it runs the

start function using the command option. Due to

the loop of the interface, we can keep pressing

this without needing to be asked to play again.

Simply exiting the window will go back to the

main interface window as well, meaning we do

not need a specific quit button.

25 Running score

We have two sets of scores to display

– one for the player and the other for the

26 End game

The final part of the code allows for

the script to be used by the main window, and

also allows for it to run on its own when used

in the command line or shell. You’ll need to

perform some modifications to make it run on

its own, such as making it the mainloop and not

a Toplevel window. However, it will run just fine

from both without the need to be launched from

the main interface.

the window, and the sticky allows us to justify

items with specific directions – in this case top,

left, right and bottom justification. Finally, we

then make sure each column and row is treated

equally by giving them the same weighting, and

starting from zero.

a second label to display the actual move. We

do this by adding the textvariable option to

Label, and using the computer_choice variable

we updated earlier in the game function. This

merely prints the text from the names list and

justifies this to the left.

computer. We label these the same way we’ve

done with labelling the Player and Computer

move, having them on a lower row but still in

the relevant columns. Below that, we use the

textvariable option again to get the numerical

score we assigned to the separate score

variable. Finally, we create another label to

display the message for the game’s outcome

WorldMags.netWorldMags.net

WorldMags.net

Page 64: Linux User

Tutorial Create and save data with a MongoDB databaseTutorial

www.linuxuser.co.uk64

Forget about joins and SQL and try NoSQL databases – specifi cally MongoDB, the leading example

Create and save data with a MongoDB database

MongoDB is an open source document-

oriented database system written in C++ by

Dwight Merriman and Eliot Horowitz. It runs

on UNIX machines as well as Windows and

supports replication and sharding (aka horizontal

partitioning) – the process of separating a single

database across a cluster of machines.

Many programming languages – including C,

C++, Erlang, Haskell, Perl, PHP, Python, Ruby

and Scala – support MongoDB. It is suitable for

many things, including archiving, event logging,

storing documents, agile development, real-time

statistics and analysis, gaming, and mobile and

location services.

This article will show you how to store Apache

log fi les in a MongoDB database with the help

of a small Python script. We’ll also demonstrate

how to implement replication in MongoDB.

ResourcesMongoDB: www.mongodb.org

Pymongo: api.mongodb.org/python/current/

AdvisorMihalis Tsoukalos has over 15 years of UNIX sysadmin and programming experience and has been using Linux since 1993. He loves learning new things

The replica set consists of nodes 192.168.2.4 (port 27019), 192.168.1.10 (port 27019) and 192.168.2.3 (port 27018)

The replica set is recovering

Synchronising data to node 192.168.2.3

Which is the primary node

WorldMags.netWorldMags.net

WorldMags.net

Page 65: Linux User

Store Apache log fi les and implement replication in MongoDB

Create and save data with a MongoDB database

TUTORIAL

www.linuxuser.co.uk65

01 Connecting to MongoDB for the

fi rst time

Your Linux distribution probably includes

a MongoDB package, so go ahead and

install it. Alternatively, you can download a

precompiled binary or get the source code from

www.mongodb.org and compile it yourself.

After installation, type mongo --version to

fi nd out the MongoDB version you are using and

mongo to run the MongoDB shell and check if

the MongoDB server process is running.

02 MongoDB terminology

NoSQL databases are designed for

the web and do not support joins, complex

transactions and other features of the

SQL language. You can update a MongoDB

database schema without downtime, but you

should design your MongoDB database without

joins in mind.

Their terminology is a little different from the

terminology of relational databases and you

should familiarise yourself with it.

03 The _id fi eld

Every time you insert a BSON

document in MongoDB, MongoDB

automatically generates a new fi eld

called _id. The _id fi eld acts as the primary

key and is always 12 bytes long. To fi nd

the creation time of the object with _id

‘51cb590584919759671e4687’, execute the

following command from the MongoDB shell:

> ObjectId("51cb590584919759671e4687").getTimestamp()ISODate("2013-06-26T21:11:33Z")Note: You should remember that queries are

case-sensitive.

04 Inserting an Apache log fi le into

MongoDB

Now that you know some things about

MongoDB, it is time to do something interesting

and useful. A log fi le from Apache will be

inserted inside a MongoDB database using a

Python script.

The Python script is executed as follows:

$ zcat www6.ex000704.log.gz | python2.7 storeDB.py …where www6.ex000704.log.gz is the name of

the compressed (for saving disk space) log fi le.

05 The storeDB.py Python script

The storeDB.py script uses the PyMongo

Python module to connect to MongoDB. The

06 Connecting to MongoDB using

PyMongo

You fi rst need to connect to MongoDB using:

connMongo = pymongo.Connection('mongodb://localhost:27017')You then select the database name you want

(LUD) using the following line of code:

db = connMongo.LUDAnd fi nally you select the name of the collection

(apacheLogs) to store the data:

logs = db.apacheLogsAfter fi nishing your interaction with MongDB

you should close the connection as follows:

connMongo.close()

MongoDB server is running on localhost and

listens to port 27017. For every inserted BSON

document, its _id fi eld is printed on screen.

Finally, the script prints the total number of

documents inserted in the MongoDB database.

The host and its port number are hard-coded

inside the script, so change them to match yours.

MongoDB is supported by many programming languages

WorldMags.netWorldMags.net

WorldMags.net

Page 66: Linux User

www.linuxuser.co.uk66

09 Running the three MongoDB

servers from the command line

For this example, you need three MongoDB

server processes running.

We ran the three MongoDB servers, on their

respective machines, as follows:

$ mongod --port 27018 --bind_ip 192.168.1.10 --dbpath ./mongo10 --rest --replSet LUDev$ mongod --port 27019 --bind_ip 192.168.2.6 --dbpath ./mongo6 --rest --replSet LUDev

10 More information about the three

MongoDB servers

You should specify the name of the replica set

(LUDev) when you start the MongoDB server

and have the data directory, specifi ed by the

--dbpath parameter, already created. You

do not necessarily need three discrete Linux

machines. You can use the same machine (IP

address) as long as you are using different port

numbers and directories.

TutorialTutorial

08 A replication example

Imagine that you have your precious

data on your MongoDB server and there is a

12 Information about replication

• Any node can be primary, but only one

node can be primary at a given time.

• All write operations are executed at the

primary node.

• Read operations go to primary and optionally to

a secondary node.

• MongoDB performs automatic failover.

• MongoDB performs automatic recovery.

• Replication is not a substitute for backup, so

you should not forget to take backups.

11 The rs.initiate() command

Once you have your MongoDB server

processes up and running, you should run the

rs.initiate() command to actually create

and enable the replica set.

If everything is okay, you will see similar output

on your screen. If the MongoDB server processes

are successfully running, most errors come from

misspelled IPs or port numbers. The rs.initiate()

command is simple but has a huge impact!

Create and save data with a MongoDB database

Replication is not a substitute for backup

07 Displaying BSON documents from

the apacheLogs collection

Type the following in order to connect to the

MongoDB shell:

$ mongoSelect the desired database as follows:

> use LUDSee the available collections for the LUD

database as follows:

> show collectionsapacheLogssystem.indexesLastly, execute the following command to see all

the contents of the apacheLogs collection:

> db.apacheLogs.find()If the output is long, type ‘it’ to go to the next screen.

$ mongod --port 27018 --bind_ip 192.168.2.5 --dbpath ./mongo5 --rest --replSet LUDevNote: You are going to see lots of output on

your screen.

power outage. Can you access your data? Is your

data safe?

To avoid such diffi cult questions, you can

use replication to keep your data both safe

and available. Replication also allows you to do

maintenance tasks without downtime and have

MongoDB servers in different geographical areas.

WorldMags.netWorldMags.net

WorldMags.net

Page 67: Linux User

TUTORIAL

15 Selecting a new primary node

If you shut down the primary MongoDB

server (by pressing Ctrl+C), the logs of the

remaining two MongoDB servers will show the

failure of the 192.168.1.10:27018 MongoDB server:

Mon Jul 1 11:21:29.371 [rsHealthPoll] couldn't connect to 192.168.1.10:27018: couldn't connect to server 192.168.1.10:27018

Mon Jul 1 11:21:29.371 [rsHealthPoll] couldn't connect to 192.168.1.10:27018: couldn't connect to server 192.168.1.10:27018

It takes about 30 seconds for the new primary

server to come up and the new status can be

seen by running the rs.status() command.

Important note: Once a primary node is down,

you need more than 50 per cent of the remaining

nodes in order to select a new primary server.

17 Useful MongoDB commands

• Delete the full apacheLogs collection:

db.apacheLogs.drop()• Show available databases: show dbs• Find documents within the apacheLogs

collection that have a StatusCode of 404:

db.apacheLogs.find({"StatusCode" : "404"})• Connect to the 192.168.1.10 server using port

number 27017: mongo 192.168.1.10:27017

18 Hints and tips

• It is highly recommended that you fi rst

run find() to verify your criteria before actually

deleting the data with remove().

• Should you need to change the database

schema and add another fi eld, MongoDB will

not complain and will do it for you without any

problems or downtime.

• The way to handle very large datasets is

through sharding.

• Mongo has its own distributed fi le system

called GridFS.

• The name Mongo comes from ‘humongous’.

16 Trying to write data to a non-

master node

If you try to write to a non-master node,

MongoDB will not allow you and will generate an

error message.

14 The rs.status() command output

The rs.status() command shows you

the current status of your replica set. It is the fi rst

command to execute to fi nd out what is going on.

13 More information about replication

• The former primary will rejoin the set as

a secondary if it recovers.

• Every node contacts the other nodes every few

seconds to make sure that everything is okay.

• It is advised to read from the primary node

as it is the only one that contains the latest

information for sure.

• All the machines of a replica set must be

equally powerful in order to handle the full load of

the MongoDB database.

www.linuxuser.co.uk67

Store Apache log fi les and implement replication in MongoDB

Create and save data with a MongoDB database

Apart from primary and secondary nodes,

a third type of node exists. It is called arbiter. An arbiter node does not have a copy of the

data and cannot become primary. Arbiter

nodes are only used for voting in elections for a

primary node.

WorldMags.netWorldMags.net

WorldMags.net

Page 68: Linux User

facebook.com/webdesignermag twitter.com/webdesignermag

DESIGN INSPIRATION BEHIND THE SCENES STEP-BY-STEP ADVICE

BUY YOUR ISSUE TODAYPrint edition available at www.imagineshop.co.uk

Digital edition available at www.greatdigitalmags.com

Available from all good

newsagents and supermarkets

ON SALE NOWUX: Psychology of great design | Expert guide to HTML5 video | eCommerce with Stripe

PRACTICAL TIPS INDUSTRY OPINION

BUILD A BETTER WEBwww.webdesignermag.co.uk

Available on the following platforms

WorldMags.netWorldMags.net

WorldMags.net

Page 69: Linux User

www.linuxuser.co.uk69

Essential kit, software and resources for the open source scene

Review index

REVIEWS

How we reviewOur experts thoroughly test

the kit and grade it using the

following criteria

Avoid at all costs

A designer/developer’s bad day

Good but could do better

Get this. It won’t disappoint

Software or hardware nirvana

Software

Embedded Pi

“Its support for selected Arduino shields is handy, but most users

will likely ignore the on-board STM32 processor”

70 Photo managersWhich of our open source choices

gets you the best results?

digiKam

gThumb

F-Spot

Shotwell

HardwareGroup Test Books

81 LG Optimus L3 II One of the smallest

Androids available

85 The latest Linux

reads dissected

78 Embedded Pi The ultimate

companion?

76 Raspberry Pi Camera Module

Snap happy?

82 AV Linux The best in media editing?

WorldMags.netWorldMags.net

WorldMags.net

Page 70: Linux User

SUPER TEST

www.linuxuser.co.uk70

Photo manager super-testReview

and searching for specifi c events or items in your

photo stream.

There are a lot of powerful yet easy-to-use

tools around to help touch up and enhance

your photos, but going through GIMP with each

individual photo for some basic edits can get

tedious. A few of the photo management apps

we’re looking at today also include editing

Sort and edit your photos, from holiday snaps to hardware shots, as we fi nd out the very best photo-managing tool on LinuxIn the digital age we live in, with camera-phones,

prosumer photographers with their DSLRs and

everything tagged on Facebook, there are a

lot more photographs fl ying around than there

were in the days of Kodak fi lm being developed.

Organising your photos can be a huge task, with

a wealth of metadata and tagging that you can

edit on your images to aid with album creation

Photo managers

functions that allow you to perform simple,

batch processing tasks like colour correction on

a selection of images rather than one at a time.

We’ve chosen the best and most popular

applications for comparison here. Others that

didn’t make the cut include Fotoxx, Darktable

and showFoto, the last two being more about

image manipulation than photo management.

WorldMags.netWorldMags.net

WorldMags.net

Page 71: Linux User

Shotwell is the one application on our

test that is used by default in the likes of

Ubuntu or Fedora. It’s popular in GNOME-

based distributions and other GTK desktop

environments, although of course it works fi ne

in KDE and the like. It’s a straightforward photo

manager that requires little confi guration and

is fairly lightweight to begin with, much like the

other Yorba applications.

When we say the interface is straightforward,

what we mean is that there’s only a simple

thumbnail view of your pictures. While you

can increase the size of the thumbnails in this

view, this of course reduces the amount of

images you can see at once, and is not a true

preview like you would get with something

like a fi lmstrip view – that kind of view is great

for quickly scanning through pictures for

either yourself or showing off to others, so its

absence is a bit odd.

The interface does have its perks, though,

allowing you do a few batch operations such as

tagging, placing in events, and using the ‘enhance’

button to do some autocorrection on lighting and

colouring – it won’t instantly make things look

amazing, but it’s subtle enough that it doesn’t

overdo anything. Events are treated like albums

in the interface and you can only assign one to a

photo, while multiple tags can be assigned. This is

enough to differentiate their usage, as you might

have hundreds of tags but only a few events.

Image editing in Shotwell is also very basic,

allowing you normal things such as cropping

Four of the best photo managers battle it out

Photo manager super-test

REVIEW

www.linuxuser.co.uk71

Shotwell

There’s only a thumbnail view for photos

Publishing online is a great feature

SCORES

Installation

A lot of dependencies required; however, it’s a default application on some distros

8

Ease of use

A fi lmstrip view would be nice, but otherwise it’s very straightforward 9

Editing

The most basic tools to crop and rotate images, along with a magic enhance button

4

Features

Quite basic; however, the online publishing feature stands out among all the other photo managers

6

Overall

A decent photo manager

that can do all the basic

tasks you’d want from

such an application, but

not much more

7

“There’s only a simple thumbnail view of your pics”

and rotating, along with red-eye removal and

a manual colour balancing tool. That’s about it,

though, and if you want to do some other effects

or manipulations you’ll need to fi re up the GIMP.

Shotwell is a very serviceable photo

manager, doing the semi-basics well enough

so that while it might be easier to use other

apps in this test, you’ll be able to get the job

done. It does come with a great function that

allows you to publish photos online, though

– this includes posting to Facebook or Flickr

accounts, and is a good way to sort out all your

photos before uploading them.

www.yorba.org

WorldMags.netWorldMags.net

WorldMags.net

Page 72: Linux User

www.linuxuser.co.uk72

Plenty of photo information can be changed in gThumb

We were actually a little surprised by gThumb,

especially as it’s a GNOME-made application.

With the recent move to simplifying all parts

of GNOME, we were wondering whether its

popularity was misplaced; however, it looks

like all the changes to the GNOME Shell haven’t

affected the way gThumb works.

It’s not to say it’s a super-advanced, though –

it features a fairly straightforward interface that

we’d want from a photo manager. By default, it’s

a thumbnail view, displaying the Picture folder in

the home directory. Instead of importing photos

from specific albums, you merely navigate

through the directory structure. This means

that instead of having specific albums to create,

you’ll need to organise those photos yourself in a

file manager or terminal.

Clicking on the Edit file button in the top right

opens up the image editor, and a sort of limited

filmstrip view as well. You can click between

photos in the stream on the bottom to edit

them individually, although you can’t move

between them with arrow keys. The editor is

a little more advanced than what you get with

Shotwell, allowing for more manual colour and

balance corrections, as well as anti-blurring,

desaturation and negative filters. There isn’t any

red-eye removal, though, and no paintbrushes

or anything to do that, meaning you’ll need to

open GIMP for those kind of operations.

You also can’t do batch autocorrection for the

images, but you can do batch tagging. You can

drag a box over the images to select them, or

press Ctrl/Shift with click, and you’ll be able to

add, remove or assign tags in batches. You can

gThumb

gThumb lets you navigate the directory structure

edit information in batches as well; however,

you’ll likely want to do that individually. Images

that have been edited in this way get a date

added to them, letting you know when they were

last modified by gThumb.

Like Shotwell, gThumb also has online

publishing tools, with similar services such as

Facebook, Twitter, Flickr etc. It’s nice that these

tools exist, as these services don’t have touch-

up options, allowing for mass uploading of

holiday photos and the like.

gThumb is a great little application and while

it doesn’t quite have everything we want, it’s

definitely a step up from Shotwell.

live.gnome.org/gthumb

SCORES

Installation

Easy to obtain, but also requires a few GNOME packages 8

Ease of use

Generally very easy to use; however, the edit/filmstrip view is confusing 8

Editing

Decent amount of editing tools, although no red-eye removal 7

Features

While not particularly feature-heavy, it’s got enough to properly manage your images

7

Overall

A very strong showing

from gThumb, a photo

manager with plenty of

features, although it could

do with some batch image

touch-up options

8

Photo manager super-testReview

“The editor is a little more advanced than Shotwell’s”

WorldMags.netWorldMags.net

WorldMags.net

Page 73: Linux User

www.linuxuser.co.uk73

F-Spot was replaced by Shotwell in Ubuntu

a few years ago. However, the application has

stuck around, albeit without an update in over

two years. This simple image editor actually

comes with an interesting variety of features,

although they’re not all that useful in the long run.

The first time you start it up, you’ll need to

import photos from a directory. This is a pretty

straightforward process, although it initially

looks like you’ll need to change settings on each

individual image in selected folders. It quickly

imports into the library, displaying a thumbnail

view, some basic metadata, a histogram and a

sort of timeline for basic filtering of your photos.

The timeline breaks are used to show a graph of

photos taken per month along the top, allowing

you to select each month from there. You can

also filter by tags and such in the main view, as

well as adding extra tags and dates to the filters

to find exactly what you need.

The thumbnail view is quite basic, and you can

increase the size of the thumbnails in the view.

Double-clicking a picture enters the edit mode,

which you can also select from the top bar, and

this includes a filmstrip view that you can key

between with arrow keys on the keyboard. The

editor is a little simplistic, with some basic

autocorrection tools, although they seem to do

very little to the photos we tried them on.

The main browsing interface can be a little

confusing as well, especially once you start

filtering images. It’s not always clear how you’re

F-Spot

The timeline can help filter some images

supposed to get back to the standard view if

you want to, and you need to completely reset

the filters to remove any. Tagging is a little

weird as well, since you need to create the tags

before you can even apply them to anything,

even if you have the images you need to tag

already selected.

While there are some good parts to F-Spot,

in general it’s not as complete or as easy to use

as we would have liked. The interface has a few

ease-of-use issues that are not encountered

with the other photo managers, too.

The editor and file strip view are quite nice, but could do more

f-spot.org

SCORES

Installation

Generally easy to get, although it’s a little older now and requires older dependencies

7

Ease of use

Basic navigation is great, but can get a little counter-productive with more advanced searches

5

Editing

Has a small selection of autocorrection buttons, but they do very little 6

Features

A decent variety of features, but not all of them work quite as well as they should

6

Overall

F-Spot is showing its age

and is just not as good as

the others in this test. A

newer update could fix the

problems, but that may

never come

6

Four of the best photo managers battle it out

Photo manager super-test

REVIEW

“The main browsing interface can be a little confusing”

WorldMags.netWorldMags.net

WorldMags.net

Page 74: Linux User

www.linuxuser.co.uk74

Light table allows you to compare photos to find which is best

The KDE-developed image organiser is now

in version 3.x, receiving a few upgrades over

the past two years since it hit version 2.0

and became one of open source’s premier

photo managers. It comes with a full range of

functions, including the standard preview and

filmstrip view we’re looking for, batch tag and

data editing, editing software, and even a light-

table function.

Although built for KDE, digiKam works just

fine with GTK-based desktop environments and

has a more neutral design aesthetic than KDE,

allowing it to not stick out on other desktops.

It can also be found in all major package

managers thanks to its popularity and ties to

KDE, although options to compile from source

via a tarball or GitHub are just as available.

Initial startup involves a quick but thorough

setup wizard, going through basics such as

photo library locations, the manner of importing

RAW files and a few more options. While a lot

of people can mostly ignore these and have a

decent default selection, they are useful for

people with more specific needs. Any changes

you make during this wizard can of course be

altered in the main program’s settings and such,

and there’s a lot of extra customisation you can

do to digiKam as well.

The main window allows you to view your

photo library in a stream, with thumbnails and

previews, as well as by their geotags if they

have any. It’s here you can edit tags, geotags

etc, as well as looking up metadata and colour

maps for the images. The interface aids in this,

allowing you to select multiple images with

the plus symbol that appears as you hover

over thumbnails, although Ctrl and click also

still works.

Selecting an image then allows you to enter

the image-editor window or the light-table

view. In the image editor, there are a lot of

functions for adding effects and general image

manipulation, although it’s mostly hidden away

in drop-down menus, making it a bit tricky to

use. The light table is a great feature, allowing

you to compare and contrast a couple of photos

in case you need to select from multiple images

of the same angle and subject.

digiKam has a selection of different views

It’s a really comprehensive piece of software,

offering just about everything we’d want from a

photo manager and more, especially for those

that need it in a professional capacity.

Photo manager super-testReview

digiKamwww.digikam.org

SCORES

Installation

Requires some extra packages from KDE, but easy to install otherwise 8

Ease of use

The main window is easy enough to use, although the image editor is a little confusing

7

Editing

Not quite at the level of GIMP, but more than good enough for a photo manager

9

Features

digiKam is overflowing with a variety of features to make it easier and better to use

9

Overall

A fantastic overall

package that offers

specialised tools to

organise, analyse and edit

your photo library

9

“Everything we’d want from a photo manager and more”

WorldMags.netWorldMags.net

WorldMags.net

Page 75: Linux User

Shotwell gThumb F-Spot digiKam

Installation

Easy to fi nd and install

on most major distros 8GNOME-using distros

will easily be able to

install it 8Using a few older

packages, F-Spot

is generally easy

to install7

Requires a few

KDE packages,

but available in all

major repos8

Ease of use

Very easy to use,

although it may be a

little simplistic 9Nice and easy to use,

although a proper

fi lmstrip view would

be welcome8

Basic browsing is fi ne,

but add searches and

fi lters and it becomes

a mess5

A little bit complex

in some ways, but

generally fi ne to use 7

Editing

Only a couple of

autocorrection editing

functions 4A good variety

of manual and

autocorrection

functions – no

red-eye though

7A selection of editing

tools that do very little

to the photo 6Fairly advanced

editing options,

although GIMP can

do more 9

Features

Low on features, but

it has the necessities

plus online publishing 6A decent selection of

features to manage

your photos 7While it has some

great features, they

generally don’t work

so well6

Brimming with

features to perfectly

manage your photos

on your system9

Overall

Shotwell is decent

enough for some of

the basics of photo

management7

gThumb is a great

piece of software

that does just about

everything you’d want8

F-Spot is showing

its age now and

could do with a bit of

an overhaul6

A fantastic piece of

software that does

everything you’d

want and more9

digiKamWe very much like digiKam. It’s a fantastic

suite with a huge variety of functions that we

fi nd really help when sorting through a lot of

photos. The different views are great, the light-

table function is good for more professional

photographers and the image-editing part is

fully featured. It can be a little dense for its own

good, though, taking a little time to work your

way around the interface. However, it’s worth

the effort and not only will your images be

organised in a much more logical way, they may

just look better as well.

We were also very pleased with gThumb,

a fairly lightweight equivalent that is a little

easier to use. With GNOME’s recent push to

simplify all its applications, gThumb doesn’t

really seem to have been negatively affected

like other parts of GNOME. Shotwell is still

good, but lacking some features when

compared to the rest, and F-Spot is just

nothing in comparison to digiKam.

Rob Zwetsloot

AND THE WINNER IS…

In brief: Compare and contrast our verdicts

digiKam is highly customisable, with plenty of advanced options

www.linuxuser.co.uk75

www.linuxuser.co.uk

GROUP TESTWINNER

Four of the best photo managers battle it out

Photo manager super-test

REVIEW

WorldMags.netWorldMags.net

WorldMags.net

Page 76: Linux User

The Camera Module is the first piece of add-

on hardware to come out of the Raspberry Pi

Foundation itself – and it addresses a real need

in the Pi community. Many users are looking to

use the Pi for computer vision projects ranging

from near-space balloon launches – in which

the Pi provides a live stream of its journey while

storing higher-resolution snapshots for when it returns to the

ground – to burglar alarms and home automation systems.

The official Camera Module dodges issues encountered

using webcams on a Pi – thanks to its esoteric USB

implementation – in a couple of clever ways. First, it bypasses

Raspberry Pi Camera Module

MODULE

www.linuxuser.co.uk76

Review

ProsCompact and lightweight, this Pi accessory is a must-have for remote monitoring applications and offers surprising flexibility

ConsThe software is in the very early stages of development, and there’s no Video4Linux support for existing applications to use the module

Raspberry Pi Camera Module £19.87

the USB part of the Pi altogether by connecting to the

previously unused Camera Serial Interface (CSI) located near

the USB socket. Second, it taps into the graphics processing

unit (GPU) of the Broadcom BCM2835 chip that powers the Pi

– giving it vastly more computational power than devices that

use the Pi’s relatively weedy CPU.

The result is a camera that draws surprisingly little power,

weighs just 3g, has the footprint of a postage stamp and yet is

capable of capturing 5-megapixel still images and 1080p high-

definition video at 30 frames per second. Better still, it does

all this for less than £20. Granted, that’s around the same as

you’d pay for a Raspberry Pi Model A to which the camera can

be connected – but given its capabilities, it’s still a bargain.

Does the Raspberry Pi’s first official accessory live up to its high-resolution hype, or is its outlook blurred?

The ribbon cable is thin and quite easy to

damage, so care should be taken not to fold it

Some cases now come with camera-mounting

sections, but existing cases will need the

camera module to be retrofitted by hand

The camera comes with a protective piece

of plastic over the lens, which needs to

be removed before use

WorldMags.netWorldMags.net

WorldMags.net

Page 77: Linux User

www.raspberrypi.org

More information

First official Pi hardware add-on

Raspberry Pi Camera Module

REVIEW

The Camera Module arrives, in traditional Foundation

fashion, as a bare circuit board with a small, 15cm ribbon

cable as the only accessory. Gently inserted into the CSI port

on the top of the Pi, the camera is ready to go – once you’ve

updated your Raspbian installation. Those who have chosen

alternative operating systems for their Pi are, at this point, left

out in the cold: currently, it’s Raspbian or nothing.

Even fully updated, the software to drive the camera is

in a very early stage. Many functions – such as the ability to

record EXIF tags into image files – simply don’t work. Other

features work incorrectly: attempting to capture any image

above 1920x1080, for example, makes the camera take a Full

HD cropped image and then resize it rather than capturing

the full frame of the sensor – a problem the Foundation’s

development team is working to resolve.

Another issue, less likely to be fixed any time soon, comes

in how the camera is driven. While webcams are supported

on the Pi through Video4Linux, allowing them to interact with

various third-party software packages, there’s no such driver

www.linuxuser.co.uk77

for the official Camera Module. As a result, the only way to

drive it is to use two command-line packages – raspistill and

raspivid – the source code for which is available.

The software is easily the worst part of the camera, but

it’s also the part that will change most rapidly. Even between

the writing of this review and its publication, the Foundation

has likely fixed several of the bugs mentioned here – and will

continue to improve the software.

When used within the constraints of the software, the

camera certainly delivers: still images are crisp, providing

they don’t hit the Full HD crop limit, and video is impressive

– although prone to banding if your power supply isn’t up to

scratch. The fixed-focus lens is a slight drawback, with objects

any closer than two to three metres appearing blurred – but

if you’re willing to hack the camera apart, you can remove the

glue from the lens and adjust the focus manually with a twist.

Gareth Halfacree

Logitech HD Webcam C270

£17.49 One of the most Pi-friendly webcams on the market, the Logitech C270 is a cheaper alternative to buying the official Pi Camera Module. Unfortunately, it doesn’t use the GPU acceleration features on offer so video capture is limited to low resolutions at around five frames per second.www.logitech.co.uk

Also consider

Toshiba TCM8240MD CMOS Camera£7.93Capable of capturing 1.3-megapixel still images at 15 frames per second, the Toshiba CMOS sensor does on-board JPEG compression – taking the strain off the Pi’s CPU. It can’t do video, though, and users will need to write their own I2C drivers to use it.www.proto-pic.co.uk

Sensor Omnivision 5647, 5-megapixel Lens 3.6mm F/2.0 fixed-focus Dimensions 21.6 x 25 x 8.65mm (excluding cable) Weight 3g (excluding cable) Cable Length 150mm (15-core 1mm pitch ribbon cable) Connection Camera Serial Interconnect (CSI) Max Still Resolution 2592x1944 (currently limited to 1920x1080) Max Video Resolution 1920x1080 (1080p) @ 30fps

Technical specs

The Omnivision 5-megapixel sensor is found behind a fixed-focus 3.6mm lens, but you can adjust the focus with a little hacking

A Camera Serial Interface (CSI) connector attaches

the module to the Pi, via a bundled 15cm ribbon cable

Mounting holes are included for bolts or screws, but the light weight of the camera means sticky tape or even Blu-Tack is an option

SummaryThere’s no denying that the Raspberry Pi Camera Module is a bargain, despite costing nearly as much as the Model A itself. The software needs serious work and the lack of Video4Linux support is disappointing, but its small size and high-resolution sensor will likely find it a home in many imaging-related projects.

WorldMags.netWorldMags.net

WorldMags.net

Page 78: Linux User

The brainchild of CooCox, a specialist in

development tools for ARM Cortex-class

microcontroller units (MCUs), the Embedded

Pi is described as the first triple-play accessory

for the Raspberry Pi. Like rival devices, it extends

the capabilities of the Pi’s general-purpose

input/output (GPIO) port, but it also runs

independently of the Pi thanks to an on-board

STMicroelectronics Cortex-M3 STM32 microcontroller.

This on-board microcontroller can be loaded with a

program, which will run in real-time when connected to power

– even if the board is detached from the Pi itself, in what

CooCox describes as Standalone Mode.

Embedded Pi

I/O BOARD

www.linuxuser.co.uk78

Review

ProsA flexible piece of equipment, and its powerful STM32 processor makes for a capable standalone development board

ConsThe official development tools are Windows-only and entirely useless for the Pi, making it difficult to unlock the board’s true potential

Embedded Pi £25.50

The second mode available is ST-Adapter Mode, in which

the STM32 drives various ports on the board but cedes control

to the Pi’s own GPIO port – providing a handy command-and-

control channel without tying up a USB port.

Finally, the Ras-Pi Mode acts as a dumb expansion board,

disabling the on-board STM32 processor in favour of merely

extending the Pi’s own GPIO capabilities.

In all these modes, the Embedded Pi can communicate

with a number of add-on boards originally developed for the

Arduino microcontroller platform. Dubbed ‘shields,’ these

boards – which offer everything from motor control to GPRS

mobile data connections – can be connected directly to the

Embedded Pi without modification.

That’s a feature list that covers almost every eventuality,

but one that isn’t without its problems. By far the biggest

is in software support: despite designing the Embedded Pi

specifically for use with the Raspberry Pi, the official manual

– provided as a downloadable PDF – requires the user to

run CooCox’s own CoIDE software on a Microsoft Windows

machine in order to do anything with the STM32 processor. If

Designed to bridge the Arduino and Raspberry Pi worlds, will the Embedded Pi drive the low-cost microcomputer to new heights?

On-board voltage regulators accept 7V to 12V input without harming any connected hardware

The pins on the Embedded Pi are laid out for compatibility with Arduino ‘shield’

add-on boards

The STM32 microcontroller provides the Embedded Pi with flexibility, but the included software is Windows-only

Jumpers allow the three modes – Standalone, Adapter and Ras-Pi – to be selected

WorldMags.netWorldMags.net

WorldMags.net

Page 79: Linux User

cpc.farnell.com

More information

Arduino-compatible I/O board for Raspberry Pi

Embedded Pi

REVIEW

you’re a Linux user, or want to do development directly on the

Raspberry Pi itself, you’ll be stuck with using the Embedded

Pi in Ras-Pi Mode – missing out on the chance to use the

powerful STM32 processor for real-time tasks.

It’s a major oversight on the company’s part. While

it’s possible to program the STM32 from Linux – several

toolchains exist, thanks to STMicroelectronics releasing a

range of low-cost STM32-based development boards some

years ago – this will require additional hardware and a degree

of technical knowledge that will put most beginners off before

they’ve even started their project.

Even assuming that the user is willing – or able – to use a

Windows box to write, debug and upload their program to the

STM32, the list of supported shields is short. Specifi c drivers

need to be written for the Embedded Pi to communicate with

Arduino shields, and so far only nine shields – including the

offi cial Motor Shield and Wi-Fi Shield – are supported, from a

list of many hundreds from numerous manufacturers.

This isn’t to say the Embedded Pi isn’t without its charms:

the compact board takes up a lot less room than a Gertboard

www.linuxuser.co.uk79

and is remarkably capable even when used in its simplest

Ras-Pi Mode. Those willing to take the time to learn how to

develop and fl ash STM32 applications from within Linux

will unlock its true powers – and, should a community build

up around the device, packages to do exactly that will likely

become readily available.

For now, however, the Embedded Pi is diffi cult to

recommend unless you’re a Windows user. For Linux fans who

are looking for a way to use Arduino shields with a Raspberry

Pi, a better option may be to simply use an Arduino connected

either over USB or to the Pi’s UART for serial control – and in

doing so save around £5.50 to spend on parts for their project…

Gareth Halfacree

Arduino Leonardo£19.00 Although it can’t easily make use of the Pi’s existing GPIO port, an Arduino offers easy USB-connected expansion for hardware projects. Like the Embedded Pi, its on-board processor – an Atmel microcontroller – also allows for standalone use.www.arduino.cc

Also consider

Gertboard£36.00Designed by engineer Gert van Loo, the Gertboard offers a vast array of GPIO expansion for the Raspberry Pi. Originally supplied as a self-assembly kit, the new Gertboard arrives ready to use – but isn’t particularly user-friendly.cpc.farnell.com

Processor STMicroelectronics STM32F103 (72MHz Cortex-M3 MCU)

Memory 20KB RAM, 128KB fl ash ROM Dimensions 53.4 x 110 x 19.2mm Weight 35g GPIO 2x SPI, 2x I2C, 3x UART, CAN, 2x 12-bit

16-channel ADC, 4x PWM, Arduino-compatible headers

Power Mini-USB, 7-12V DC, or Raspberry Pi GPIO-provided

Extras 1x 26-way ribbon cable, 1x 10-way ribbon cable, 4x plastic raisers

Technical specs

A JTAG header is included, which will be handy for debugging or fl ashing the STM32 from Linux

Connection to the Raspberry Pi is via a

ribbon cable that links to its GPIO header

The USB port is used to program the STM32, and can also power the board

A handy quick-reference table of pin-outs is included on the

bottom of the Embedded Pi

SummaryCreating a Pi accessory that requires a Windows machine to unlock its full potential isn’t a great business idea – which is a shame, as the Embedded Pi shows signs of brilliance. Its support for selected Arduino shields is handy, but most users will likely ignore the on-board STM32 processor.

WorldMags.netWorldMags.net

WorldMags.net

Page 80: Linux User

HARDWARE REVIEWS ANDROID HACKING HELP & ADVICE APP REVIEWS

UNLOCK THE POWER OF ANDROID

ON SALE NOW> Galaxy supertest > 25 quick upgrades > Sony Tablet Z > Amazing hacks

w w w . l i t t l e g r e e n r o b o t . c o . u k

TIPS & TRICKS

BUY YOUR ISSUE TODAYPrint edition available at www.imagineshop.co.uk

Digital edition available at www.greatdigitalmags.com

facebook.com/littlegreenrobot twitter.com/lgrobot

Available on the following platforms

Available from all good

newsagents and supermarkets

WorldMags.netWorldMags.net

WorldMags.net

Page 81: Linux User

LG Optimus L3 IIReview

www.lg.com

More information

One of the smallest Android phones ever, it also comes with a few attractive features…You don’t have to look too far with the LG Optimus L3 II

to fi nd one of the things that’s been sacrifi ced for the

low price tag. The screen stares out at you as low-cost

technology and, sadly, it really lets the phone down.

The screen is very small at 3.2 inches. That enables the

LG Optimus L3 II to be a little phone – it measures just

102.6mm tall, which is among the smallest we’ve seen. But

it is surprisingly wide at 61.1mm. Even the Samsung Galaxy

S4 with its gigantic fi ve-inch screen is not much wider at

69.8mm. And the LG Optimus L3 II is a chunky phone too, at

11.9mm thick. It feels very substantial in the hands – though

that is matched by a solid build that makes it diffi cult to bend

and bow in the hands.

However, let’s get back to the screen. Its small size means

it is always going to be diffi cult to view complex things like

webpages, and it is not going to be showing off its best side

for video viewing. But its low resolution of 240x320 pixels

does it no favours at all. LG lets you select from a small choice

of fonts and one of two font sizes, but neither helps much

with readability.

The internal specifi cations aren’t a disaster for such a low-

cost handset, though. Android 4.1 is a pleasant surprise, and

the 1GHz processor with 512MB of RAM is no less than we’d

expect to see here. There is 1.6GB of free storage (from the

4GB that’s installed) and you can slot a microSD card in under

the backplate to augment this.

So far, so dull, but there are some good things to be found

on this device as well. If you like alert lights you will love the

LED surrounding the long, thin physical Home button. You can

set this to pulse in different colours for alerts, alarms and as a

battery charge indicator.

More useful on an everyday basis is the lock screen which

lets you open up into one of four apps, access anything on the

notifi cations bar or sweep inwards from either bottom corner

to open into the last screen you were using. Given the way

the phone’s compact size aids one-handed use, this makes it

really easy to navigate your way around the Optimus L3 II.

SMS fans will like that incoming messages show on screen

until they are dismissed, and a quick tap is all you need to

get into the messaging app and craft a reply. There’s also

a little Quick Memo app you can call up to take handwritten

notes. These can use the app you are in or a blank page as a

background, and are saved as image fi les so they are easily

shared. The screen size doesn’t let you make the most of this

app as there’s not space to write much, but it is a nice addition.

Sandra Vogel

MOBILE

Operating System Android 4.1 Processor 1.0GHz single-core Storage 4GB Dimensions 102.6 x 61.1 x 11.9mm Weight 106.4g Display Size 3.2-inch Display Resolution 240 x 320 Expansion Slot microSD

Technical specs

The LG Optimus L3 II is quite a thick handset, but overall it is small and it does fi t in the hand quite nicely, especially for one-handed use

The small, low-res screen is not great for viewing video or reading text. This restricts some of the things you can do with the device

LG Optimus L3 II £69.99

ProsSurprisingly powerful considering it’s one of the smallest Android handsets to be released

ConsThe screen resolution really lets it down – if you want to watch video, you’d better look elsewhere

www.linuxuser.co.uk81

SummaryWhile the screen might let the LG Optimus L3 II down rather, there are some features that help it to stand out from the low-cost crowd – such as its diminutive size, lock-screen gestures and alert lights.

A light around the Home button can alert you to SMS, alarms and more. It’s a neat touch that helps you identify when things are happening

WorldMags.netWorldMags.net

WorldMags.net

Page 82: Linux User

AV Linux 6.0.1

www.linuxuser.co.uk82

Review

AV Linux 6.0.1

AV Linux 6.0 came out towards the end of last year after

an apparently difficult development period. AV Linux does

take a while to iterate, though, and there were some big

changes from version 5 to 6 – such as switching from Linux

kernel 2.x to 3.x for better hardware support, and some

major updates to all the packages. A point update has been

released for 6.0 now, which includes some minor upgrades

and bug fixes throughout the distro and its apps.

AV Linux comes as a fully functional, live-booting OS,

perfect for writing onto a USB stick or live CD and using it

where you can. It does also include a fairly basic installation

function, which gives you just enough control to partition

your system and then install the distro to it. While it isn’t as

A highly customised Debian designed for video and audio professionals, how exactly does it differ from other distros? And does it deliver?

pretty or user-friendly as some of the major distros, it does

the job and explains what you need to be doing at each of the

steps. This includes giving instructions on how it wants the

hard drive partitioned before letting you launch into GParted

to do it. The biggest hassle during installation in general is

changing locale and keyboard if you’re not American.

Live performanceOne of the things that make it great as a live distro is its many

extra drivers for a lot of proprietary audio and video hardware,

such as sound cards, graphics cards, MIDI controllers and

more. These are all carried over through to the installed

version and you can then start customising which versions

ProsA real-time kernel for reduced audio latency, and every major media editing application available as default

ConsThe installer is a bit basic, and the real-time kernel can be a resource hog if you don’t specifically need it

DISTRO

Utilities have been split up in the menu now, allowing for easier access to the hardware tools

AV Linux uses LXDE with Openbox so that you can get the most amount of power out of your system

The AV Linux Control Panel allows for a lot of customisation of the distro, including creating

a special Hybrid ISO for USB

Minimum Specs: CPU Pentium II RAM 256MB STORAGE 4GB (USB Stick)

New features: Kernel 3.6.11.2 • Utility menus • Skype • EasyTag • Scribus

Best for: Media editing

CHOICE

www.linuxuser.co.uk

EDITORS’

WorldMags.netWorldMags.net

WorldMags.net

Page 83: Linux User

Highly specialised media-editing distro

AV Linux 6.0.1

REVIEW

www.linuxuser.co.uk83

The real-time kernel allows for a much lower latency while recording audio

The selection of sound mixers and audio drivers don’t work in harmony, but they offer a lot of control over a sound card when you need it the most

Installation is more manual than some distros, including using GParted to set up your hard drive. The process has clear and concise instructions, though

www.bandshed.net

Dowload now

are joined by 3D modellers like Blender, and other video

editors for different skill levels such as OpenShot and

Kdenlive. The full LibreOffice suite is also available in case

you need to write or present something, and of course a full

complement of internet browsers, messaging clients and

media players are included to round out the experience. All

this is especially helpful for the live version of the distro, as

it’s all there without preconfiguring, and there’s a lot of extra

utilities and tools that would take a long time to set up and

customise to this extent. However, you can make a hybrid

bootable USB key using current system settings to create a

more personalised version of the live distro, with software

installed or removed using the standard Debian packages

it’s based on.

All inclusiveIt’s generally a fantastic editing suite. The use of LXDE and its

policies on screensavers means it can eke every bit of power

from your system to make sure latency and rendering are the

best possible. And on top of that, it gives you a huge amount

of control over the way the hardware interacts with the

distro to optimise the system even further. It does use a lot

of non-free software to achieve this, though – unfortunately

this is more of a problem with the entertainment industry

than anything else, but allows people to do the kind of work

they want to use AV Linux for.

Rob Zwetsloot

of the drivers you want to use, and keep them. This allows

you to get the most out of your system for AV work without

having to set it up every time. There are also a lot of sound-

card utilities that allow you to edit the levels through a variety

of different applications with different effects to the sound

input, although it seems to prefer you use one at a time rather

than a combination of drivers and tools.

Speaking of sound input, AV Linux’s real-time kernel is one

of the distro’s best features for professional audio engineers.

The real-time tag on boot allows for a much lower latency

while recording audio, keeping things a lot more accurate

than the standard Linux kernel. You can remove this if

needed, though, as the real-time kernel does take up a few

more resources than usual, noticeably slowing down our test

machine while it was activated.

Modifying defaultsThere are several boot-time cheat codes that you can apply

on boot, one of which is the -rt option that enables the real-

time kernel. By default, there are options to enable threaded

IRQs, which aids in the audio latency, as well turning off

the hugepages memory management feature. Disabling

hugepages is apparently another step in keeping the latency

low, but it causes memory-heavy applications such as video

editors to not work as smoothly. There’s also an option known

as noautogroup that allows for the desktop to work a little

better, even when CPU-intensive operations are under way.

One of the upsides of AV Linux is the sheer amount of

audio, image and video editing software pre-installed onto

the distro. Mainstays such as GIMP, Audacity and Cinelerra

Possibly the perfect audio editing suite based on Linux, especially for one that’s ready out of the box so to speak. The real-time kernel option is a great feature for sound engineers, reducing audio latency, and there’s a lot of driver and hardware control for everyone else.

Screenshot Gallery

bit.ly/LUDAVL6

Summary

WorldMags.netWorldMags.net

WorldMags.net

Page 84: Linux User

Subscribe today & start savingSubscribe

• Subscribe today and pay just $122 for 13 issues*

• Pay as little as $9.39 an issue – usually $15.99 in stores

For more information and to order visitwww.imaginesubs.co.uk/ludOr call +44 (0) 1795 418661

Exclusive subscriber benefits

*Terms and conditions: This is a US subscription offer, please don’t forget to quote USA when ordering. You will actually be charged £80 sterling for an annual subscription. This is equivalent to $122 at the time of writing, although the exchange rate may vary. Five free issues refers to the newsstand price of $15.99 for 13 issues being $207.87, compared with $122 for a subscription. Your subscription will start from the next available issue. This offer expires 30 November 2013.

Imagine Publishing publishes more than 20 monthly magazines, some of which have been running for over 10 years, reaching over 4 million readers every year

Non-USA readers see page 22

5 free issues*today and get

Subscribe

USA special offer

84 www.linuxuser.co.uk

Your exclusive

offer code:

USA

WorldMags.netWorldMags.net

WorldMags.net

Page 85: Linux User

www.linuxuser.co.uk85

Latest Linux books revealed

Book Reviews

REVIEWS

Updated for the 3.x kernels, Love’s classic work

on POSIX and Linux coding features a new chapter

on multithreading, and numerous updates, but

still shows you how to write code that, in the

words of Greg Kroah-Hartman’s introduction,

“doesn’t suck.”

Providing you’re happy with C, and the basics of

the GNU compiling and debugging tools, this work

gives you all you need to get started writing at a

low level for our favourite OS. This is about systems

programming, not higher-level applications

programming where APIs abstract away many

challenges for you.

Love is experienced at working directly with

the kernel and the C library, covering both general

UNIX and specifi cally Linux calls, and then diving

into where behaviour varies between theory and

practice. By the end of the book, you’ll fi nd yourself

with an understanding of Linux which will help in

higher-level coding – and in adminning, too.

Absolute OpenBSD: UNIX for the Practical Paranoid 2nd Edition

OpenBSD is successful at being a highly secure, UNIX-

like operating system. If it is not successful at building an

evangelising, open community – in the manner of GNU/Linux

– that’s because that’s not what the OpenBSD developer

community wants to concentrate on. Their single-minded

devotion to security makes it the best OS for some jobs.

Michael Lucas, with trademark dry humour, acknowledges

this position, but seeks to guide new users through the

operating system and the community until they are in a position

to ask the right questions.

Security is a process, not a simple set of recipes, and your

reasons for trialling OpenBSD may be diverse, but in all cases

there’s much fundamental knowledge to absorb. If you’re used

to the GNU/Linux way, the journey may not be easy, but Lucas

is an able guide with a comprehensive knowledge, and along

the way you’ll pick up nuggets of wisdom you’ll use in adminning

non-BSD machines, too.

Linux System Programming: Talking Directly to the Kernel and C Library

Powerful Android development without the pain of Java

Classic intro to coding Linux system software

Try a more secure UNIX

Processing – a language popular with artists

and educators – has been available for

producing Android apps since 2.0 in 2010. If you’re

not already familiar with Processing – it’s popular

in hackspace projects on Arduino for example –

you’re in for a treat. Designed to have “a low fl oor

and a very high ceiling”, you’ll be working with the

Android hardware in a few short steps.

A quick tour of setting up the IDE (far speedier

than starting up Eclipse for Java on Android) and

it’s on to the accelerometer to make a motion-

based colour mixer. The rest of the book divides

into four parts. First, working with the camera(s)

and location devices. Next, networking, using

Wi-Fi and Bluetooth to make collaborative apps

like surveys, and working with NFC tags. After

data and storage, using SQLite, the last part

brings in 3D graphics, and covers writing cross-

platform desktop apps and web apps through

processing.js. Practical, enjoyable, useful.

Author Michael W LucasPublisher No StarchISBN 978-1593274764Price £40.99Score

Author Rajesh P N RaoPublisher CambridgeISBN 978-0521769419Price £50.00Score

Authors Paul Gries, Jennifer Campbell, Jason Montojo

Publisher Pragmatic Bookshelf

ISBN 978-1937785451Price £28.99Score

Author Hector CuestaPublisher PacktISBN 978-1783280995Price £48.99Score

Author Daniel SauterPublisher Pragmatic BookshelfISBN 978-1937785062Price £26.99Score

Authors Robert LovePublisher O’ReillyISBN 978-1449339531Price £38.50Score

Essential background

in neuroscience,

brain recording

and stimulation technologies, signal

processing, and machine learning. Detailed

description of the major types of BCIs in

animals and humans, including invasive,

semi-invasive, non-invasive, stimulating,

and bidirectional BCIs. In-depth discussion

of BCI applications and BCI ethics.

This book is for anyone

who wants to understand computer

programming. You’ll code along with the

book, writing programs to solve real-world

problems as you learn the fundamentals

of programming using Python 3. You’ll

learn about design, algorithms, testing

and debugging, and come away with all the

tools you need to produce quality code.

From learning data

visualisation with D3.js,

to building simulations

for econometrics, harnessing the power

of open source data analysis technologies

can lead to better customer service, the

visualisation of customer needs, or even

the ability to obtain fresh insights about the

performance of previous products.

Brain-Computer Interfacing An Introduction

Practical Data Analysis: RAW

Practical Programming, 2nd Edition: An Introduction to Computer Science Using Python 3

Rapid Android Development: Build Rich, Sensor-Based Applications with Processing

WorldMags.netWorldMags.net

WorldMags.net

Page 86: Linux User

Classifi ed Advertising

TM

ProtoArmour

www.protoarmour.com

Rock solid protection for Raspberry Pi.

Machined Aircraft Alumin umIntegrated Camera OptionAnodized Colo r Options

Security FeaturesPassive Cooling

Raspberry Pi is a trademark of the Raspberry Pi Foundation

u

i

MAGAZINES BOOKS DVDS DOWNLOADS GIFTS

Read anything good lately?

Shop for quality magazines, books and DVDs from

Imagine Publishing

Follow@imagineshopuk

on Twitter for exclusive

discountcodes

[email protected]

To Advertise In

Contact Rhian on 01202 586421

WorldMags.netWorldMags.net

WorldMags.net

Page 87: Linux User

01202 586421

Available From:http://pibow.com/http://shop.pimoroni.com

The neat little layer casefor your Raspberry Pi®

RainbowNinjaCrystal AdafruitToxic

Introducing the Pibow ModelA forthe low-profile Model A

A hacker’s delight!

WorldMags.netWorldMags.net

WorldMags.net

Page 88: Linux User

Send us your questions and we’ll do our best to answer them!

Russell Barnes has been a computer and technology journalist for nearly 15 years

Questions & answers

This month your questions were answered by…

ASK THE EXPERTS

Rob Zwetsloot studied aerospace engineering, using Python to model simulations

www.linuxuser.co.uk88

answeredYour questions

Contact us...Email: [email protected]

Web: www.linuxuser.co.uk

Become a fan on

Linux User & Developer

Contact us @linuxusermag

Kunal Deo is a veteran developer of many open source projectes

Richard Smedley spends 90% of his screen time shelled into servers in the UK and USA

Here’s the end of the code as it should look

Python problemsThank you for your piece in the current issue of

your magazine about programming a game of

hangman. I have enjoyed following and learning

from it as I am new to programming and this is the

first thing I have done. This is also the first copy of

Linux User I have purchased too, so unfortunately

I haven’t seen your previous pieces to learn from.

I’m sorry to say I am having an issue in running

the finished project. When I do run the program,

the Python shell just shows three lines. These

lines are:

=========RESTARTING=========

>>>

>>>

I have followed your coding exactly and the

only change I needed to make was to the last

line, which was putting an indentation before

‘start()’. This was due to an error message telling

me it expected an indent.

I am running Python on Mac OS X 10.5.8.

Would this make a difference to running Python

on a Linux operating system? I am aware Mac

OS X and Linux are both derived from UNIX. I

noticed I can run the included version of Ubuntu

on my MacBook when I ran it directly from the

included DVD. Do you believe I would get better

results on this project were I to install that

version of Ubuntu on a separate partition?

Any advice you could give me would be much

appreciated as I have never done anything like

this before, but I am keen to learn how to program.

Thanks in advance.

Matthew Steele

There seems to have been a small problem with the code printed in the magazine that will cause this to happen, unfortunately. The last two lines are printed like this:

if __name__ == ‘__main__’: start()The if statement was indented by mistake in

WorldMags.netWorldMags.net

WorldMags.net

Page 89: Linux User

All your technical problems solved

Questions & answers

www.linuxuser.co.uk89

Q/A

Batch filesI’m running an enterprise batch scheduler

on RHEL 6.3. I have a batch utility called a

‘File Watcher’ that simply monitors for the

presence of a fi le. I run it as a batch job and

if the fi le is not found, it is supposed to fail

with a return code of 7. File found = return

code zero success.

I’ve been testing it with a fi le that doesn’t

exist, and weirdly, the fi le is not found by my

utility, but it’s returning a success return

code. I have never had this occur on any

platform but RHEL, and it is happening on

all of our Linux servers.

The vendor says the PAM (pluggable

authentication module) is being invoked but

failing on the session close. They had me run

an strace on the batch utility.

Basically, I’m getting a success from

batch jobs when they should be returning

back a non-zero return code (failure). Any

help would be much appreciated.

Geoff Burtt

This is a documented bug in Red Hat and there are a couple of workarounds for it at the moment. The best one to use is the following, although it

involves modifying the system-auth-ac fi le.You can fi nd this fi le in /etc/pam.d – open

it with your favourite text editor. Look for this line:session optional pam_sss.so…and add a line above it as follows:session sufficient pam_localuser.soSave the fi le and recycle sssd with this to be on the safe side:$ service sssd restartThat’s it. Hopefully, the bug should be fi xed soon, though.

the printing process, and should instead look like this:if __name__ == ‘__main__’: start()

The code on the disc and on the website has this part coded correctly, and it’s usually a good idea to check between the two for any errors like this.

Python is platform agnostic, so even if you used this on Windows, which doesn’t have any ties to UNIX, it should also work. Although of course, we recommend using Linux as much as you can.

Merger issueI hope you guys can help me. I encountered a

curious exit status with pacman when I was trying

to upgrade my packages. I am running Arch, and

what I used was the ‘pacman -Syu’ command.

This is what I got:

(251/251) checking for file conflicts [######################] 100%error: failed to commit transaction (conflicting files)filesystem: /bin exists in filesystemfilesystem: /sbin exists in filesystemfilesystem: /usr/sbin exists in filesystemErrors occurred, no packages were upgraded.

This is weird, considering the fact that bin and

sbin dirs are always there. What could be the

problem with this?

Kim Hu

Due to changes in the Arch packages thanks to a merge, you need to do some updating to your Arch distro and pacman to get it to work properly. These are the steps

to follow to fi x it:Firstly, to fix any non-official packages with files

in /bin, /sbin or /usr/sbin by putting those files in /usr/bin. The list of packages that are not in a repo that need to be fixed can be generated using:$ pacman -Qqo /bin /sbin /usr/sbin | pacman -Qm -

Also check packages installed from non-offi cial repos using:$ paclist <repo> | awk ' { print $1 } ' | pacman -Ql - | grep ' /s\?bin/\| /usr/sbin/'

Secondly, make sure any packages in IgnorePkg or IgnoreGroup do not have fi les in /bin, /sbin or /usr/sbin. Fix them if necessary.

Next, if you have fi les in /bin, /sbin or /usr/sbin that are unowned by any package, you need to move them. Find a list using:$ find /bin /sbin /usr/sbin -exec pacman -Qo -- {} + >/dev/null

Finally, ensure all partitions are mounted if using autofs. They may not automount when needed later in this update. Then update safely using:$ sudo pacman -Syu --ignore filesystem,bash$ sudo pacman -S bash$ sudo pacman -Su

This should fi x the problem now that the merge has happened.

You’ve got mailDo you know of any software that notifi es when

a new email arrives to a given email account?

I’m currently using aMSN on KDE with a plug-

in for Gmail and another for Yahoo, so I can

know when I get new email. The problem is that

now the Windows Messenger protocol has

discontinued, aMSN does not work so well any

more, especially for these notifi cations.

Basically what I need is a program (or some

desktop widget) that notifi es me when I get new

email on webmail services and that shows a

counter with the number of unread emails on

each one. Does an app like this exist?

George Burton

For KDE, there’s a nice plasmoid called kde-plasma-mail-checker. This allows for multiple accounts, and notifi cations for them, and it supports both POP and IMAP.

This means it will work with Yahoo mail as well as the others.

The Red Hat team are usually very good at fixing bugs such as this

The KDE mail checker is highly customisable

WorldMags.netWorldMags.net

WorldMags.net

Page 90: Linux User

Questions & answers

www.linuxuser.co.uk90

Become a fan on

Linux User & Developer

Contact us @linuxusermag

description run devil’s pie on startupstart on startupstop on runlevel [016]respawnexec su - ben -c “devilspie”

I wanted to test it first by seeing if I could

run it manually, but I couldn’t understand the

output. Either way, it seems that Devil’s Pie is not

running - it’s not listed in the running processes

of System Monitor.

Ben Darrington

As Devil’s Pie is a graphical program, you probably don’t need to be putting it in upstart. As you’re using GNOME, there’s the startup application manager

called autostart that allows you to add graphical programs that will launch after GNOME loads up. Add the path to devilspie in the new entry form, reboot, and it should work fine.

Audio splitHi there. For some strange reason all the music

files in one of my directories repeat themselves

twice, as in the files are twice as long and

contain each track twice in them. Perhaps I

unwittingly merged them when restoring a

backup or something.

In any case I have a question: is there a way to

run FFmpeg or some other tool to cut my double

MP3 files in half? The solution needs to be

GIS queryHi there, I’m looking for recommendations of

specialised GIS software. In my IT department,

ArcGIS is commonly used and it’s important

that this new software be able to process the

data that ArcGIS creates, which is in .mxd

files. These also need to support some other

requirements set out by my company.

Are there any feature-rich GIS solutions that

will be able to do this for me?

Thanks.

Den Sanchez

Well there are a few things you should try out that might solve your problem, although without knowing your special requirements we can’t give a

better recommendation.Start with the beta versions of

‘FWTools-x86_64-3.1.0’. FWTools contains GDAL as Python wrappers, which helps with ArcGIS.

You could also try out GRASS, which supports ArcGIS through GDAL as well, and is in the repos of most distros.

If none of that works, IDL is another option that should do everything you need and may be worth checking out anyway. Hope one of these works for you.

GIS allows for geographical data to be analysed

GNOME’s Startup Applications helps you with graphical programs

Pie solutionI have a problem with Adobe Flash player that

apparently can be fixed using Devil’s Pie as a

workaround, making it autostart in Lubuntu

13.04 with GNOME Shell.

Here’s what I tried to achieve after following

the instructions I was pointed towards. I first

made a file /etc/init/devilspie.conf with the

following content:

WorldMags.netWorldMags.net

WorldMags.net

Page 91: Linux User

All your technical problems solved

Questions & answers

Q/A

dynamic; that is, the program needs to measure

the individual length of each MP3 fi le and fi nd

out by itself where the 50% mark is.

I could always do this manually in Audacity,

but there are hundreds of sound fi les affected,

so this would take forever. Any help on this would

be greatly appreciated.

Dan Simons

That’s an odd problem you seem to have there, but you’re right: there’s a way to do it in FFmpeg that will do a batch process for any MP3 in a directory – although

we need to create a script ourselves to handle it:#!/bin/bashmkdir unchoppedfor file in *.mp3domv -v $file unchoppedffmpeg -i unchopped/”$file” -t $(echo $(mp3info -p %S “$file”)/2 | bc -l | cut -f1 -d.) $filedone

This won’t do any analysis on the fi le, though, so if the halfway mark isn’t what you want to split from, you might be in trouble. A slightly faster method of loading MP3 fi les so you can do it graphically is using mp3splt.

Getting backportedI am using Debian (Squeeze) and I am trying to

install Iceweasel from backports. I have added:

deb http://mozilla.debian.net/ squeeze-backports iceweasel-release…to my /etc/apt/sources.list and issued an

‘apt-get update’ command. Then, I tried to install

Iceweasel and received an error about missing

dependencies like this:

iceweasel: Depends: xulrunner-14.0 (>= 14.0.1-1~bpo60+1) but it is not

going to be installedDepends: libsqlite3-0 (>= 3.7.12-1~) but 3.7.3-1 is to be installed

How can I fi x this? Is there a way to fi x this?

Conner Truman

Well the easy solution to this is to use the actual backport repository for Debian. You can install the

The mp3splt tool does not decode audio files, allowing

the process to be a bit faster

Iceweasel, now IceCat, is Firefox for Debian

backported version with:$ sudo apt-get install -t squeeze-backports iceweasel

You need to make sure that the backports repo is added like you have done, of course. The problem is the different information Apt is now getting; however, installing it that way will get it done.

In FFmpeg we can do a batch process for any MP3 in a directory

WorldMags.netWorldMags.net

WorldMags.net

Page 92: Linux User

Whether you’re a hosting firm or a happy customer who wants a favourite provider listed, drop us a line with the details!

Got a deal you think we should list?

[email protected]

www.linuxuser.co.uk92

HA

RD

WA

RE

RA

ID

PR

IVA

TE

SU

BN

ET

24

/7 P

HO

NE

SU

PP

OR

T

UP

TIM

E G

UA

RA

NT

EE

CP

U C

OR

ES

/

SP

EE

D

DIS

K S

PA

CE

RE

MO

TE

PO

WE

R R

EB

OO

T

NE

TW

OR

K B

AC

KU

P

ST

OR

AG

E

PE

RM

AN

EN

T K

VM

MIN

IMU

M

CO

NT

RA

CT

TE

RM

CO

ST

PE

R

MO

NT

H

PH

ON

E

NU

MB

ER

1G

BP

S I

NT

ER

NE

T

CO

NN

EC

TIO

N

PA

CK

AG

E

NAME AND URL

Dedicated server listings

O = Option

PoundHostwww.poundhost.com

FlexServer2 01628 777730 From £2912 months

Dual/Quad Core

160GB to 2TB

10Mbps 99.90% 10 GB

BudgetBox III 01628 777730 £36 1 month Intel Xeon 3065 1 x 250GB100

Mbps99.90% 10 GB

SSD 4 01628 777730 £60 1 monthQuad Core Intel

Xeon X3430120GB Intel

520 SSD100

Mbps99.90% 10 GB

Merlin 01628 777730 £199 1 month2 x Intel Xeon

Quad Core 2 x 500GB

SATA II100

Mbps99.90% 10 GB

DS6.5 01628 777730 £295 1 month2 x Intel Xeon

Hex Core4 x 1TB SATA III

100 Mbps

99.90% 10 GB

Cloud Server 01628 777730 £52 1 month 2 vCPU (4GB) 40GBGbit

shared / node

n/a 99.90% O

Cloud Server 01628 777730 £98 1 month 4 vCPU (8GB) 40GBGbit

shared / node

n/a 99.90% O

Bravo14 (http://bravo14.co.uk) Starter Linux N/A £20 N/A N/A 2,000MB N/A

Bravo14 (http://bravo14.co.uk) Starter Windows N/A £20 N/A N/A 2,000MB N/A

Bravo14 (http://bravo14.co.uk) Business Linux N/A £45 N/A N/A 4,000MB N/A

Bravo14 (http://bravo14.co.uk) Business Windows N/A £45 N/A N/A 4,000MB N/A

Bravo14 (http://bravo14.co.uk) Ultimate Linux N/A £60 N/A N/A Unlimited N/A

Bravo14 (http://bravo14.co.uk) Ultimate Windows N/A £60 N/A N/A Unlimited N/A

Heart Internet (www.heartinternet.

co.uk/dedicated-servers)Linux Dual Core 0845 644 7750 £79.99 12 months

Dual Core Xeon

2.33GHz160GB

99.99%

24/7 Ticket

support

Heart Internet (www.heartinternet.

co.uk/dedicated-servers)Windows Dual Core 0845 644 7750 £89.99 12 months

Dual Core Xeon

2.33GHz160GB

99.99%

24/7 Ticket

support

Heart Internet (www.heartinternet.

co.uk/dedicated-servers)Linux Quad Core 0845 644 7750 £129.99 12 months

Quad Core Xeon

2.5GHz250GB

99.99%

24/7 Ticket

support

Netcetera www.netcetera.co.uk/linux

2200DC 0800 061 2801 £50 1 monthDual Core

2.2GHz160GB N/A Raid 1

3000DC 0800 061 2801 £80 1 monthDual Core

3GHz 2 x 250GB N/A Raid 1

2660QC 0800 061 2801 £130 1 monthIntel Quad Core

2.66GHz2 x 500GB N/A Raid 1

Developer 0800 061 2801 £32.89 1 month N/A 1GB N/A

One 0800 061 2801 £109.99 1 month N/A 5GB N/A

Reseller 0800 061 2801 £274.89 1 month N/A Unlimited N/A

Zyma www.zyma.com

Unlimited 0208 123 2730 £1.7912 months

Quad Core Xeon

Unlimited N/A N/A 99.9% N/A N/A

Unlimited 0208 123 2730 £7.95 3 monthsOcto Core

Xeon Unlimited 99.9%

Sponsorship opportunityBring attention to your brand by sponsoring this section. Contact Rhian Carter on +44(0)1202586421Hosting listings

WorldMags.netWorldMags.net

WorldMags.net

Page 93: Linux User

www.linuxuser.co.uk93

SH

OP

PIN

G C

AR

T

NAME AND URL

PA

CK

AG

E

DA

TA

BA

SE

SU

PP

OR

T

PH

ON

E

NU

MB

ER

CO

ST

WE

B S

PA

CE

MO

NT

HL

Y

BA

ND

WID

TH

PO

P3

AC

CO

UN

TS

VIR

US

FIL

TE

R

FIR

EW

AL

L

PH

ON

E S

UP

PO

RT

EM

AIL

SU

PP

OR

T

WE

B C

ON

TR

OL

PA

NE

L

SE

RV

ICE

LE

VE

L

AG

RE

EM

EN

T

eHosting (www.ehosting.com) Starter 0844 999 4100 £23.88 1GB 25GB 10

eHosting (www.ehosting.com) Personal 0844 999 4100 £59.88 2.5GB Unlimited 50

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) Bronze 0121 314 4865 £30 200MB 2GB 10

Equiphase (www.equiphase.net) Silver 0121 314 4865 £42 400MB 5GB 20

Equiphase (www.equiphase.net) Gold 0121 314 4865 £72 800MB 10GB 100

Equiphase (www.equiphase.net) Platinum 0121 314 4865 £114 1,200MB 40GB 200

Eurofasthost.com (www.eurofasthost.com) Email Only 02380 249 823 £40 1GB 2GB 10

Eurofasthost.com (www.eurofasthost.com) Essential 02380 249 823 £75 2GB 5GB 10

Eurofasthost.com (www.eurofasthost.com) Superior 02380 249 823 £140 5GB 10GB 25

Eurofasthost.com (www.eurofasthost.com) Premium 02380 249 823 £250 10GB 25GB 100

Evohosting (www.evohosting.co.uk) Starter N/A £29.99 500MB 1GB 3

Evohosting (www.evohosting.co.uk) Home N/A £54.99 2.5GB 30GB 50

Evohosting (www.evohosting.co.uk) Business N/A £79.99 6.5GB Unlimited Unlimited

Evohosting (www.evohosting.co.uk) eCommerce N/A £159.99 30GB Unlimited Unlimited

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

Hostway (www.hostway.co.uk) Silver 0808 180 1880 £79.50 150MB 3GB 5 O

O = Option

Dedicated and Shared server listings

Fasthosts www.fasthosts.co.uk

Personal 0808 168 6777 £32.87 5GB Unlimited 50

Business Bronze 0808 168 6777 £58.38 50GB Unlimited 500 O

Business Silver 0808 168 6777 £76.39 Unlimited Unlimited Unlimited O

Business Gold 0808 168 6777 £101.89 Unlimited Unlimited Unlimited

WD Starter 0808 168 6777 £149.99 20GB Unlimited Unlimited O O

WD Advanced 0808 168 6777 £199.99 Unlimited Unlimited Unlimited O O

Blacknight www.blacknight.com

Minimus Linux / Windows

+44 (0)845 5280242 €49.95 10GB 200GB Unlimited

MediusLinux / Windows

+44 (0)845 5280242 €89.95 20GB 400GB Unlimited

MaximusLinux / Windows

+44 (0)845 5280242 €149.95 30GB 600GB Unlimited

LISTINGS

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

Eco Web Hosting (www.ecowebhosting.co.uk) Starter N/A £29.99 200MB 2GB Unlimited

Eco Web Hosting (www.ecowebhosting.co.uk) Standard N/A £54.99 1GB 10GB Unlimited

Eco Web Hosting (www.ecowebhosting.co.uk) Advanced N/A £119.99 20GB 24GB Unlimited

Eco Web Hosting (www.ecowebhosting.co.uk) Reseller Unlimited N/A £199.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

Hosting [email protected]+44(0)1202586421

GET YOUR LISTING HIGHLIGHTED! CONTACT RHIAN

WorldMags.netWorldMags.net

WorldMags.net

Page 94: Linux User

www.linuxuser.co.uk94

Your source of Linux news and viewsYour viewContact us…Register and post your comments…www.linuxuser.co.uk/forum/

Email us directly… [email protected]

YOUR VIEW

Linux User Letters

Our exclusive interview with Clement Lefebvre and the rest

of the Linux Mint team revealed a very important new fact

– Cinnamon 2.0 will be in the next Mint, and GNOME will be

removed. A lot of people were excited when we broke the news

on our website. Join in on the conversation at: bit.ly/ZIEaE3

Nick said:I’ve poked tentacles into Mint since 12 & 13, and not been able to

settle with it. But with a dedicated Cinnamon and what that may

promise. Lighter and hopefully more stable. That might just be the

turning point.

Looking forward to this release.

JIM said:I left Mint because Mint wouldn’t leave Ubuntu and their Debian

rolling release barely rolls, with updates every six months. Now, I am

on Manjaro with Cinnamon loaded. 1.8 Cinnamon, which is newer than

Clem’s own LMDE version. And it actually rolls with 3.9 kernel and

everything else always staying spanking brand new while still being stable.

Arch is sweet!

Chezbutt said:Ohhh… That sounds again like a huge heap of duplicate work.

I wonder how this will turn out, as GNOME is so much more than

the desktop/file manager/window manager; there is a lot of work done in

Your opinions about the magazine, Linux and open source

underlying technologies. Clem will need to gather a much bigger team, I

guess, which seems problematic.

We’ll see. I HATE to see this duplication of work (DEs, distros etc) but I

feel GNOME is moving in a really bad direction, as well as Ubuntu (even if,

again, the underlying work benefits everyone).

As a KDE user, pretty happy because it’s SO advanced and features-

complete, but still a bit annoyed by the fact it lacks manpower to polish it

properly, I don’t know what to think. Will we have yet another half-baked

environment ? (Promising, with many qualities, but lacking the amount of

support really needed to make it perfect)…

It’s silly when you consider that if you could combine the qualities of all

those environments you would get something amazing.

Well, I’m lost but somehow I think the Linux Mint team has very sane and

pragmatic reasoning :-)

Cinnamon won’t look different, but the core will have changed

I read your review of the RSS readers, and I just

wanted to suggest another alternative. I use

the Tiny Tiny RSS reader which runs as a local

feed aggregator daemon, storing everything in

a database, giving you access via a web server.

From the look and feel, it is literally like hosting

your own Google Reader server at home. Beside

the bigger overhead of setting up a database

and configuring a web server, you have the great

benefit of accessing the feed from multiple

systems. For example, I’m syncing my feeds also

to my Android tablet to have them ready for offline

reading when I’m out of the house.

Felix Simpson

Reader replacement

Tiny Tiny does get around some of the syncing problems. However, Digg has just released its own RSS reader service that is in a lot of ways similar to Google Reader. This, of course, might mean it will get shut down along the line, and Tiny Tiny will last as long as your system will. It’s great to have options.

Google Reader will be sorely missed by us at Linux User

THREAD BARE

GNOME no more

WorldMags.netWorldMags.net

WorldMags.net

Page 95: Linux User

Tiny Tiny RSS reader, Mint & Cinnamon 2.0, Chrome privacy concerns

Your view

LETTERS

The website for the GNU Generation

The ultimate resource for open source enthusiasts and professionals

Never miss an updateSubscribe to our RSS feed today!

• Latest news • Reviews • Tutorials • Opinion

Become a fan on

Linux User & Developer

Contact us @linuxusermag

Web DesignerDevelopment for the

web is a huge part of

modern computing,

with the majority of

services available

online and in the

cloud. While we pride

ourselves on having

some fantastic open

source web design

tutorials, our sister magazine Web Designer is dedicated to bringing you many more of

these features at the same level of quality.

Regularly covering the newest technologies

such as HTML5, CSS3, jQuery, WordPress,

and mobile apps, Web Designer is the best

choice for hobbyists and professionals that

want a more dedicated web development

magazine. You can fi nd out more about it at

www.webdesignermag.co.uk

I’ve heard the news that again Canonical are

considering replacing Firefox with Chrome

or Chromium as the default browser in the

next version of Ubuntu. After all the remarks

about the NSA and specifi c mention of Google

in the reports, I’d be inclined to use Firefox

regardless. Not to mention Mozilla is putting

up quite a front in regards to this whole

ordeal. Maybe Google is completely innocent

in the matter, but is it really worth the risk?

Since Chromium and Chrome are so closely

Chrome concernsrelated to Google (in the aspect of storing

bookmarks, online integration), it’s just easier

for me to stick with Firefox and not worry about

the scandal altogether. Just my two cents. But

the good thing is we all have the freedom to

choose whatever browser we want regardless

of what is installed by default.

Dave Crane

It’s not just the Google services we’d worry

about – remember, by default Ubuntu has the

Amazon and online search function activated,

which also has privacy implications.

While Amazon is not allegedly part of the

PRISM program, the data sent to it is not

anonymous. If you want to truly make sure

you’re secure, you should check out the

Electronic Frontier Foundation’s PRISM

Break website (prism-break.org) to make

sure you’re using non-invasive software.

PRISM Break is a great resource for secure, free/libre and open source software

WorldMags.netWorldMags.net

WorldMags.net

Page 96: Linux User

iPad iPhone Android phone Android tablet Apple Mac Windows PCWorldMags.netWorldMags.net

WorldMags.net

Page 97: Linux User

To get the most out of your digital editions, be sure to enjoy all of our fantastic features, including:

Many of the fi les you’re looking for can be found on the magazine’s website

WorldMags.netWorldMags.net

WorldMags.net

Page 98: Linux User

98

What’s coming up…Next issue Look out for issue 130

on sale 29 AugWant it sooner? Subscribe

today!

www.linuxuser.co.uk

Imagine Publishing LtdRichmond House, 33 Richmond HillBournemouth, Dorset, BH2 6EZ

+44 (0) 1202 586200Web: www.imagine-publishing.co.uk www.linuxuser.co.uk www.greatdigitalmags.com

Magazine team Editor Russell [email protected]

01202 586272Staff Writer Rob ZwetslootDesigner Stephen MathewsPhotographer James SheppardSenior Art Editor Andy DownesEditor in Chief Nick JonesHead of Publishing Aaron AsadiHead of Design Ross Andrews

ContributorsStuart Burns, Phil King, Simon Brew, Jon Masters, Liam Fraser, Richard Hillesley, Joey Bernard, Michael Reed, Richard Smedley, Gareth Halfacree & Mihalis Tsoukalos

AdvertisingDigital or printed media packs are available on request.Head of Sales Hang Deretz

01202 [email protected] Manager Jennifer Farrell

01202 [email protected] Manager Rhian Carter

01202 [email protected]

Cover discMultimedia Editor Steve [email protected]

InternationalLinux User & Developer is available for licensing. Contact the International department to learn more.

Head of International Licensing Cathy Blackman +44 (0) 1202 586401

[email protected]

SubscriptionsHead of Subscriptions Gill Lambert

For all subscriptions enquiries 0844 249 0282 (UK) +44 (0) 1795 418661 (Overseas)

Email: [email protected] issue subscription (UK) – £25.1513 issue subscription (Europe) – £70 (ROW) - £80

CirculationHead of Circulation Darren Pearce

01202 586200

ProductionProduction Director Jane Hawkins

01202 586200

FoundersGroup Managing Director Damian ButtGroup Finance & Commercial Director Steven BoydGroup Creative Director Mark Kendrick

Printing & DistributionPrinted by William Gibbons, 26 Planetary Road,Willenhall, West Midlands, WV13 3XT

Distributed in the UK & Eire by Seymour Distribution, 2 East Poultry Avenue, London, EC1A 9PT.

0207 429 4000

Distributed in Australia by Gordon & Gotch, Gordon & Gotch Corporate Centre, 26 Rodborough Road, Frenchs Forest, NSW 2086.

+ 61 2 9972 8800

Distributed in the Rest of the World by Marketforce, Blue Fin Building, 110 Southwark Street, London, SE1 0SU.

0203 148 8105

DisclaimerThe publisher cannot accept responsibility for any unsolicited material lost or damaged in the post. All text and layout is the copyright of Imagine Publishing Ltd. Nothing in this magazine may be reproduced in whole or part without the written permission of the publisher. All copyrights are recognised and used specifi cally for the purpose of criticism and review. Although the magazine has endeavoured to ensure all information is correct at time of print, prices and availability may change. This magazine is fully independent and not affi liated in any way with the companies mentioned herein.

If you submit material to Imagine Publishing via post, email, social network or any other means, you automatically grant Imagine Publishing an irrevocable, perpetual, royalty-free license to use the images across its entire portfolio, in print, online and digital, and to deliver the images to existing and future clients, including but not limited to international licensees for reproduction in international, licensed editions of Imagine products. Any material you submit is sent at your risk and, although every care is taken, neither Imagine Publishing nor its employees, agents or subcontractors shall be liable for the loss or damage.

THE MAGAZINE FOR THE GNU GENERATION

ALSO INSIDE:>> System admin with Webmin>> A brief history of MySQL>> Your questions answered+14 pages of reviews

Python code listingsMore Python projects to test and modify

COMING IN THE NEXT ISSUE

Command line bluffer’s guide

How to build a pro-grade firewall

Become an overnight CLI sensation

Can pfSense save your bacon? © Imagine Publishing Ltd 2013

ISSN 2041-3270

EVER MADE

THE HOTTEST

DISTROSCounting down the best in open source

WorldMags.netWorldMags.net

WorldMags.net

Page 99: Linux User

Raspberry Pi

Raspberry Pi XBMC Starter KitThe Raspberry Pi XBMC home entertainment system is the idealsolution for playing your media. Supplied with the Raspbmc OSpreloaded SD Card, offering a whole host of entertainmentfeatures including playing a wide range of HD formats with DTS,photo slideshows and music.

The ultimate XBMC starter kit solution includes:• Raspberry Pi Model B 512MB RAM• 4GB SD Card with RASPBMC Preloaded• WiPi USB Dongle • Ethernet Cable• HDMI and Power Cables

STREAM YOUR FAVOURITE MOVIES, TV SHOWS, VIDEOS, MUSIC AND MORE TO YOUR TV USING RASPBERRY PI

Turn your TVinto a Smart TV...

order code SC1301244£50 Inc VAT

Get everything for your Raspberry Pi project...• Raspberry Pi and full range of accessories• Kits and Cases• Expansion, Breakout and Prototyping Boards• Vast Range of Components• WiFi Dongles & HDMI to VGA Adaptors• Video and Audio Leads• Keyboards, Mice and Monitors• GPIO Ribbon Cables• Programming and User Guidescpc.co.uk FR

EE

DEL

IVER

Y

Condit

ions a

pply,

visit

cpc.c

o.uk

WorldMags.netWorldMags.net

WorldMags.net

Page 100: Linux User

WorldMags.netWorldMags.net

WorldMags.net