100

Click here to load reader

Linux User and Developer - 2013

Embed Size (px)

Citation preview

Page 1: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 1/100

www.linuxuser.co.uk

FOR THE GNU GENERATIONTHE MONTHLY MAGAZINE

NO.1 FOR RASPBERRY PI• PYTHON MASTERCLASS• BUILD AN ONION PI• INTEL VS RASPI

HAS THE

MET ITS MATCH?MinnowBoard: Review, Intel interview & spec face-off 

ALSO INSIDE»LaTeX docs with LyX»Master the Vim editor»14+ pages of reviews

Create adatabase withLibreOffice

The other halfof WordPress

Sync fileswith Unison

he story of co-creator Mark Little

he quick & reliableway to save data

StudioAndroid

Masterclassoogle’s new IDE is here – get started today!

Build ex t ensions f or  X BMC Mak e y our  ow n w it h P y t hon

VS

   I   S   S   U   E

   1   3   1

Page 2: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 2/100

• Full range of project 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 Guides

  F  R  E  E

  D  E  L  I   V  E  R

   Y

  C  o  n

  d   i  t   i  o

  n  s   a  p  p

   l  y, 

  v   i  s   i  t 

  c  p  c.  c  o

.  u   k 

cpc.co.uk 

Raspberry Pi

Get everything for your projects...

I nc  V  A T 

£ 2 7 .4 9  E  x  V a t 

£ 3 2 .9 9 c o d e  S C 1 3 1 3 0 5 8 

Model B - 512MB with

8GB NOOBS SD Card

5MP Raspberry Pi Camera£19.24 £16.03 Ex Vat 

code SC1302358

NOW IN STOCK!

 visit cpc.co.uk for more information

Page 3: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 3/100

Mihalis Tsoukaloshas over 15 years ofUNIX system administration andprogramming experience and hasbeen using Linux since 1993. He isalso proficient in Oracle databaseadministration, Cisco IOS andCocoa. In this issue Mihalis showsus how to sync files with Unison, auseful open source CLI tool (42-45).

Himanshu Arora is a software programmer,open source enthusiast and Linuxresearcher. His articles have beenfeatured on IBM developerWorksand Computerworld among others.He also blogs at mylinuxbook.com.This month he shows us how tomake the most of Vim with hisexpert guide starting on page 62.

Michael Reed is a technology writer, and he’sbeen hacking away at Linux forover 15 years. He specialises indesktop Linux solutions amongother things. In issue 131 Michaelshows us how to get started withdatabases using LibreOffice – it’seasier than you might think. Seehis work on pages 34-37.

Jon Masters is a Linux kernel hacker who hasbeen working on Linux for some18 years, since he first attendeduniversity at the age of 13. Jon livesin Cambridge, Massachusetts,and works for a large enterpriseLinux vendor. You can find hisindispensable Kernel Column onpages 22-23 this month.

Gareth Halfacree is our new resident newsreporter and brings us the latestfrom all over the open sourceecosystem, starting on page 14.Also this issue, Gareth speaks toIntel about its new dev platformMinnowBoard on page 6. You canalso find his review of this potential

RasPi-beater on pages 12-13.

Rob Zwetsloot studied aerospace engineeringat university, using Python tomodel complex simulations inclass. Along with tutorials, reviewsand more this issue, Rob tells uswhich IDE we should be using(pages 72-77) and walks us throughthe build process of an Onion Pi(pages 46-49).

Issue 1313

    Y   o   u   r    t   e   a

   m   o    f    L    i   n   u   x   e   x

   p   e   r    t   s …

Get in touch with the team:[email protected]

Welcometo issue 131 of Linux User & Developer

Welcome to the latest edition of Linux User &Developer, the UK and America’s favourite opensource and Linux magazine.

When you’re trying to make the best Linux and opensource read in the world, there’s nothing more usefulthan feedback from readers. There’s little point usbeing here if we don’t aim to give you a healthy dose

of what you want, so we pay close attention to what youhave to say. But what have you been saying? After collecting,formatting, graphing and a lot of stubble scratching, it’s clearmany of you want more tutorials, bigger reviews and moreintroductory and intermediate developer content.

As you’ll see this issue, we’ve dedicated more pagesto tutorials and guides than ever before and we’ve evenreformatted our distro reviews to make them more useful.We still need your help, though. If you’re keen to learn moreabout development in the open source field, we want to knowwhat languages and frameworks you care about. We’ve beenfocusing very heavily on Python in recent months and intendto continue with this, but would you like to see Qt, Vala andC++ here too, or something else entirely?

Let us know on Facebook and Twitter or simply drop me anemail directly at [email protected].

Russell Barnes,Editor

Buy online

GetLinux User

for £4.19per issue

Page 32

» MinnowBoard exclusive» Build add-ons for XBMC» Sync your files with Unison» Get started with Android Studio

This issue

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

www.linuxuser.co.uk

Facebook:Linux User & Developer

Twitter:@linuxusermag

Page 4: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 4/100

Page 5: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 5/100

NEW!PRE-ORDER

FREEWITH NO OBLIGATION!*

1and1.co.uk

Choose from over 700 new top-level domains! Create a short, memorableweb address that perfectly fits your business or website theme, like fashion.blog, kitchens.online or john-smith.london. You can also make your website easier

to find by getting new extensions for your current domain.With almost 20 million registered domains, 1&1 is Europe’s market leader fordomain registration. Thanks to integrated forwarding features, domainsregistered with us can be quickly and easily connected with any website, no matterwhich web hosting provider you use.

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 | MAIL | WEB HOSTING | E-COMMERCE | SERVERS

Page 6: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 6/100

www.linuxuser.co.uk6

We chat to Scott Garman about Intel’s first foray into the worldof Linux-powered open hardware development systemsScott Garman, the man Intel has appointed

as the ‘evangelist’ for its first steps into open

hardware development, has a history of

embedded development. “I’m not a hardcore

kernel hacker,” he tells us during an interview to

commemorate the launch of the MinnowBoard

single-board computer, “but a generalist who

enjoys working with the big picture in mind.”

A software engineer for the Yocto Project, a

collaborative effort to make the development

of Linux distributions for embedded platforms

as simple as possible, working under Intel’s

Intel’s big fishin a little pond

nScott Garman is a Yocto Project engineer

at Intel, and the company’s evangelist forthe MinnowBoard

Open Source Technology Center, Garman has

already given plenty back to the community. He’s

responsible for Yocto-related training materials,

including one of the most popular screencast

introductions to the project, and is now leading

the effort to introduce the rst open hardware

platform designed with Yocto rmly in mind: the

Intel MinnowBoard.

The MinnowBoard, reviewed on page 12,

owes a clear debt of gratitude to devices like the

Raspberry Pi and the BeagleBoard. Designed

around Intel’s ‘Queens Bay’ platform, which has

at its heart a low-power 32-bit Atom processor,

the board is designed as a development platform

to bring the exibility and familiarity of the

x86 instruction set architecture to embedded

systems – and to do so at a low cost.

Most surprisingly of all, the device is open

hardware: all specications, schematics, board

layouts and rmware packages are available for

download and reuse under a permissive licence

– a rst for an Intel hardware product. Clearly, this

is a departure from the norm, and one of which

Garman is understandably proud.

Intel’s big fish in a little pondExclusive

Page 7: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 7/100

www.liuxus.co.uk7

How did the MinnowBoard come about?

“I’d say development in earnest startedhappening at the end of 2012. MinnowBoard

was an unusual project because of the way

Intel and CircuitCo [the company behind the

BeagleBoard and BeagleBone development

platforms] collaborated on it. The Intel

Yocto Project team provided input to help

design the requirements for MinnowBoard

around performance, openness, exibility

and standards. CircuitCo then used an Intel

reference design – the ‘Queens Bay’ platform

– and adapted it as needed. They also

manufacture and sell the MinnowBoard, so

it’s primarily their product, not Intel’s. The result

is a win-win situation where our team got a

great development platform and more, and

CircuitCo has a compelling product platform

to sell.

“We’ve been really happy to work with

CircuitCo on this, because they understand

the open hardware/open community model so

well, but we both had plenty of things to learn

from each other during the process of bringing

up this rst board. It’s turned out to be a great

collaboration and we’re really pleased withthe results.

“In one sense, the Intel team working on this

is extremely small. At the same time, I wouldn’t

want to discount the contributions that many

people have done to help make this happen,

even if they weren’t involved with the project full-

time on a daily basis.”

What led to the decision to choose the Queens

Bay platform, with its ‘Tunnel Creek’ Atom

 processor, in the MinnowBoard?

“Two main issues led us to use Tunnel Creek

CPU for MinnowBoard. One, we were looking

for longevity of the platform. Going with an

open hardware model means that this is

going to be an attractive board for embedded

product companies to use and adapt for

commercial products. I can tell you from

experience, there is nothing more frustrating

“To my knowledge,MinnowBoard is

the rst hardwareplatform designed

with the YoctoProject in mind”

n The MinnowBoard itself

is compact yet powerful,

and boasts impressive

I/O capabilities

n Along with the power and reset buttons

on the right, the MinnowBoard boasts four

programmable buttons

n The MinnowBoard sits on four stilts to help aid the

passive cooling of its 1GHz Intel Atom processor

Th ophada momtnOpen hardware – an offshoot of

open source, where the schematics,

component lists, and even the individual

Gerber les for having printed circuit

boards made are released under

a permissive licence – is growing

increasingly popular. Although the

Raspberry Pi, one of the most popular

low-cost embedded development

platforms, is proprietary, many of its

competitors are more open: as well

as the MinnowBoard, the Gizmo, the

BeagleBoard and its smaller BeagleBone

offshoot, the Olimex OLinuXino family,and the microcontroller-based Arduino

range are all open hardware.

Open hardware can lead to rapid

advances in features and technologies

for the projects that adopt it, but as with

open source software there are risks:

the Arduino’s open nature has led to it

being one of the most copied projects

around, with Far Eastern factories

churning out illegitimate clones by the

dozen and misappropriating the project’s

trademark in direct contravention of its

otherwise extremely permissive licence.

InTervIew

How the MinnowBoard came aboutIntel’s big fish in a little pond

Page 8: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 8/100

www.linuxuser.co.uk8

standards.

The Intel

Atom CPU provides

plenty of performance for high

computational workloads. It also has

strong I/O performance due to PCI Express

powering its Gigabit Ethernet and SATA disk

features. We also make PCI Express available

through MinnowBoard’s expansion connector

to enable high-speed I/O to custom hardware

projects, for example interfacing with FPGAs or

other hardware.

“The MinnowBoard can be used for fun hobby

projects, yet scales up to higher workloads. It’s

expandable via several PC and embedded bus

standards, and offers an environment for custom

firmware development.

than developing a successful embedded

product and then finding out that your

components are about to enter end-of-life.

Queens Bay is a platform used in IVI [In-Vehicle-

Infotainment] devices, and was designed with a

long lifespan – since people tend to own cars for

a long time. It still has four to five years left in theproduct’s life cycle.

“Two, the time to execute was now, so

we weren’t about to wait for upcoming Intel

platforms to roll out. Tunnel Creek met our main

requirements and was available immediately, so

we ran with it.”

What advantages does the x86 architecture

used in the Atom processor offer in the

embedded space, compared to ARM or other 

RISC platforms?

“Compatibility is likely the biggest advantage.

Linux originated on the Intel 386, and whether

you’re working on embedded or desktop

applications, the toolchain, libraries etc were

designed on and are pretty much guaranteed to

work on x86.

“Performance is another significant one.

Countless person-years have been put into

optimising compilers such as GCC to take full

advantage of x86 platforms, so you can leverage

that to its greatest benefit.”

■ The MinnowBoard includes eight GPIO pinsand a dedicated expansion port for ‘Lures’

■ Larger and pricier than the

Pi, the MinnowBoard offersfull x86 compatibility

■ With Gigabit Ethernet and a real-time clock, it pulls aheadof the Raspberry Pi

Do you agree that the success of the ARM-

based Raspberry Pi has demonstrated a clear 

demand for low-cost development boards

from hobbyists?

“Yes, absolutely. One of the things I appreciate

and respect about the Raspberry Pi project

is that it’s introducing so many new people

to embedded Linux development. It used to

be that embedded was a niche thing that

software engineers specialised in, and now the

embedded Linux community is becoming much

more diverse, especially with younger people. I

love that.”

What does the MinnowBoard offer that other,

more established development boards lack?

“MinnowBoard stands out in its combination

of performance, flexibility, openness and

Intel’s big fish in a little pondExclusive

Page 9: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 9/100

www.linuxuser.co.uk9

“The open hardware model isvery attractive in empoweringyour customers”MinnowBoard includes PC architecture

standards including PCIe, USB and SATA,

as well as embedded standards such as SPI,

I2C, GPIO and even [a CAN bus] for automotive

applications. It was designed with the Yocto

Project in mind, which is an industry-widestandard for embedded Linux.”

The MinnowBoard is open hardware – how

important do you think that will be to its

success in the market?

“The open hardware model is very attractive

in empowering your customers and

allowing them to innovate in ways you

can’t anticipate. Since people

are free to reproduce

and customise the

MinnowBoard, the sky

is the limit with this

board’s potential. I thinkthis will be fundamental

to [its] success.

“Keep in mind that

open hardware is

meaningful not only if the

design files are available, but when

all the parts are available through accessible

distribution channels and the board’s price is

not subsidised. If someone wants to rebuild it,

or rebuild something similar, they can at about

the cost it’s being sold for now. Not many boards

can offer that potential.”

What made Intel get involved in hobbyist-level

embedded computing development?

“We wanted MinnowBoard to become a useful

platform for Yocto Project development that

encouraged experimentation and the pursuit

of fun projects in addition to more serious

embedded applications, as a board we would use

in Yocto Project training courses. And we needed

it to be flexible enough so you could do interesting

things in a classroom-style setting, which lines up

with what hobbyists want, too.”

With the board now in the hands of early 

adopters, have you seen any particularly 

innovative or exciting applications for the

MinnowBoard emerge from the community?

“It’s still a bit early for me to have good visibility

into this, as the board has only been available

for about three weeks [at the time of the

interview]. As I hear about community projects,

I do intend to highlight them on our social

media channels.“I am aware of someone who plans to use

a MinnowBoard as part of a quality control

system for 3D printers by making use of

computer vision capabilities. I’ve also heard

that folks in the FGPA design community are

quite interested in the MinnowBoard due to its

high-speed expansion capabilities. There’s also

a group of students interested in building out

learning exercises on the MinnowBoard, as a

way to advance their embedded design skills.”

Intel has something of a mixed history with the

open source community - in particular in failing

to release graphics drivers for selected Atom processor models. With the MinnowBoard being

truly open, does this signal a shift in attitude

towards the open source and open hardware

communities at Intel?

“The Open Source Technology Center at Intel

is full of incredibly talented, well-known and

passionate people who care deeply about

openness. In recent years this group has

grown dramatically in both size and influence,

and it reflects the reality of the increased

influence open source plays in the global

software ecosystem.

“Intel’s Core graphics have open source

drivers that work with hardware acceleration,

and the upcoming Bay Trail Atom platform

makes use of it. This will address the issue

you mentioned with graphics drivers on Atom.

I’m looking forward to this, and I think Intel

is definitely moving in the right direction in

this regard.”

Intel and CircuitCo have published a list of 

current and proposed add-on boards, dubbed

Lures, for the MinnowBoard. Is there a

 particular add-on you would like to highlight?

“One of the Lures that I’m sure will be quite

popular is the Trainer Lure – the one based on

an Arduino [microcontroller]. Combining the

computational power of MinnowBoard with

the embedded input/output capabilities and

community of Arduino will open up a lot of

interesting possibilities.”

How critical is Linux and the Yocto Project to the

MinnowBoard’s success?

“We designed the board to be a Yocto Project

development platform, and Yocto produces

embedded Linux distros. So it’s pretty core to our

purpose. It was the primary motivation behind the

project itself – to my knowledge, MinnowBoard

is the first hardware platform designed with the

Yocto Project in mind. But most people using

the MinnowBoard may have no knowledge of or

interest in the Yocto Project – that’s okay, too.”

Is the MinnowBoard likely to be the first in a

family of open development boards from Intel,

or is it merely an experiment for the company?

“There are a lot of people within Intel who are

excited about open hardware. I can’t speak

[about] any specific future product plans, but I

think the future is very, very bright.”

Queens BayThe code name for the combination of an

Intel Atom E6xx-series processor with

the EG20T controller hub (code-named

Tunnel Creek and Topcliff respectively),

Intel launched the Queens Bay platform

in 2010 with the embedded market firmly

in mind.

Initially, the company targeted in-car

computer systems for navigation

and entertainment – so-called

‘infotainment’ devices – but claimed

the platform would be equally at

home in gaming, communications,

point-of-sale, industrial and digital

signage applications.The Tunnel Creek family of processors

are not true system-on-chip designs,

offloading much of the circuitry to the

EG20T chip, but do include the CPU, a

graphics processor supporting up to

two simultaneous displays, an audio

controller and a hardware video codec

on a die some 46 per cent smaller than

its predecessors.

Until the launch of the MinnowBoard,

however, using Queens Bay in hobbyist

applications was almost impossible:

Intel’s official development board was

provided only to registered hardware

partners, and came with the expectation

that you would be placing an order for a

few thousand processors once you had

finished your design.

INTERVIEW

How the MinnowBoard came aboutIntel’s big fish in a little pond

Page 10: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 10/100

www.linuxuser.co.uk10

MinnowBoard vs Raspberry PiSpecifications

MinnowBoardIntel’s Atom-powered

development board is the

first to be Yocto Project-

compatible and runs

Angström Linux. While considerably more

expensive than the Raspberry Pi, it utilises the

x86 architecture so offers computational powermore akin to desktop and mobile computers.

It’s also a very complete package, offering both

Angström Linux on a microSD card and a properly

rated power supply in the box.

However, without decent driver support for

the Intel GMA 600 GPU and a DVI-over-HDMI

video interface (no HD audio or HDCP encryption),

it lacks the same multimedia appeal as the

Raspberry Pi.

■ SATA support bringsmass storage within easyreach of MinnowBoard

■ It has fewer GPIO pins,but includes two LEDs andfour buttons to control

■ Analogue audio input isa definite step up from theRaspberry Pi

■ Gigabit Ethernet meansfaster networking – greatif you’re planning a server

■ Four stilts and biggerdimensions mean ittowers over the RasPi

■ MinnowBoard needsa staggering 2.5A tokeep its lights flashing

  Price £162  Dimensions  106 x 115mm

  Weight 119g

Operating system  Angström Linux (Yocto certified)supplied on microSD

  Processor  32-bit Intel Atom E640Tsingle-core at 1GHz

  Video Embedded Intel GMA 600

Max resolution 1366 x 768 (no HDCP encryption)

  Memory 1GB DDR2 (shared),

  4MB SPI flash (firmwarestorage)

  Output DVI-over-HDMI (no audio),

analogue audio out  Input Analog audio in, 2x USB,

1x SATA-2, 1x micro-USB,1x mini-USB, 1x serial console,SD card slot, 1x micro-SDIO,8xGPIO pins

Networking 10/100/1000 Ethernet

Real-time clock Yes (no battery installed)

  Extras  Lure connector with CAN bus,HD audio, LVDS, IC, 3x PCIExpress, SATA-2, SDIO, SPI bus,UART, 2x USB

  Power 5V at 2.5A (adaptor included)

■ The stilts increase airflow to help keep the1GHz Intel processor (under heat sink) cool

■ The MinnowBoard supports tinkerers withtwo on-board LEDs and six buttons

MinnowBoard Specs

Page 11: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 11/100

Page 12: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 12/100

Intel MinnowBoard

www.linuxuser.co.uk12

Review

Clearly, the MinnowBoard is no Raspberry Pi. Measuring

102mm on its shortest side, it’s significantly larger, requires

a whopping 2.5A from a 5V power supply to run and costs

almost six times as much as the credit-card-sized Pi. The

MinnowBoard does offer something the Pi lacks, however:

full x86 compatibility.

At the heart of the MinnowBoard is one of Intel’s less

powerful processors: the Atom E640T. Running at 1GHz,

the single-core chip offers a 32-bit x86 implementation –

already putting it on the back foot compared to the dual-core

64-bit APU found on rival AMD’s Gizmo, the closest device

for comparison – while generating a surprisingly small

Intel’s answer to the Raspberry Pi is here – but at nearly sixtimes the price, can it tempt buyers back to x86?amount of heat, allowing for passive cooling through a

compact heat sink.

With 1GB of RAM, the MinnowBoard offers a surprisingly

powerful yet lightweight platform for embedded computing.

Peaking, during testing, at 7W from the socket, it scored a

respectable 95th percentile time of 11.49ms – almost five

times faster than the Raspberry Pi at 51.45ms, but still some

way behind the Gizmo’s impressive 9.87ms score. Add in the

fact that the Gizmo can run two threads simultaneously and

it’s clear Intel isn’t going to win on outright performance –

although it has included Hyper-Threading support in the

MinnowBoard for pseudo dual-core operation.

ProsPowerful, flexible,open; a familiarx86 environmentfor newcomersto embeddeddevelopment

ConsCompared to ARMequivalents it’sexpensive, and itsperformance lagsbehind AMD’s rivalGizmo device

Intel MinnowBoardDEV PLATFORM

£162.83($200)

■ An HDMI port offers DVI video

connectivity, but does not carry

digital audio

■ The Lure connector, for add-

on boards, carries everything

from CAN bus signals to three

PCI Express lanes

■ Two USB ports

provide connectivity for

external peripherals

■ Gigabit Ethernet gives

the MinnowBoard powerful

networking capabilities

Page 13: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 13/100

x86-based embedded development board

Intel MinnowBoard

REVIEW

www.linuxuser.co.uk13

Treating the MinnowBoard as a standard computer,

however, misses the point entirely. The device is designed for

embedded development, and to help Intel regain a foothold

in a market that has become almost completely dominated

by ARM-based systems. Accordingly, it includes eight

buffered general-purpose input-output pins, along with two

user-controllable LEDs and a set of four switches. Together,

these turn the MinnowBoard into a ready-to-run system

for developing embedded applications – and unlike with

ARM-based devices, those used to an x86 toolchain don’t

have to learn anything new.

The board also includes an expansion connector for add-

in daughterboards dubbed ‘Lures.’ Designed to be analogous

to the ‘shields’ of the Arduino microcontroller, the port gives

each Lure access to considerable potential: as well as three

PCI Express lanes, an SDIO channel, two USB channels and

more, the port carries everything from CAN to I²C buses.

Although there are no Lures available on the open market at

the time of writing, several are in development – including

one which will offer compatibility with Arduino shields.

That doesn’t mean the main board is bereft of connectivity:

a micro-SDIO slot for the boot device, two USB ports,

analogue audio connections, Gigabit Ethernet, and mini- and

micro-USB ports for acting as a USB device or as a debug

serial console are included. The board also features a SATA-2

port, offering up to 3Gbps of throughput to a mass storage

device – with a second port available through the Lure

expansion port if required. minnowboard.org

Moreinformation

At present, the MinnowBoard ships with a bare-bones

installation of Angstrom Linux – no friendly out-of-box

experience here. With full Yocto Project certification,

however, rolling your own OS isn’t a challenge and Intel is in

talks with distributions including Ubuntu to add support for

the board’s somewhat unique 32-bit UEFI firmware.

Using documentation – still in progress – from the

project’s founders, the MinnowBoard is quick to offer up its

GPIO capabilities. The only real disappointment comes from

the HDMI socket, which only carries a DVI signal and not the

audio required of a full HDMI implementation. There’s also no

support for HDCP encryption, although anyone considering

using the MinnowBoard as a media playback system has

probably missed the point of its design and features.

 Gareth Halfacree

Operating system Angström Linux (Yocto Certified)

Processor 32-bit Intel Atom E640T single-core at 1GHz

Video Embedded Intel GMA 600

Memory 1GB DDR2, 4MB SPI Flash (Firmware Storage)

  Dimensions 106 x 115mm

  Weight 119g (excluding PSU)

  Input/Output DVI-over-HDMI, Analogue audio in & out,

2x USB, 1x SATA-2, 1x USB device, 1x Serial

console, Gigabit Ethernet, 1x micro-SDIO

  Extras Lure connector with CAN bus, HD audio,

LVDS, I²C, 3x PCI Express, SATA-2, SDIO, SPI

bus, 2x UART, 2x USB 

Power 5V at 2.5A

Technical specs

SummaryThe MinnowBoard is a welcome foray from Intel into the worldof open hardware and offers considerable potential. While itsperformance may lag behind the rival Gizmo board, the Lureconnector holds promise for some impressive add-ons tocome – but its high price means the Raspberry Pi has little tofear from this upstart.

Sage Gizmo$199 (£154.29)Based on an embedded AMD

APU, it’s far more powerfulthan the MinnowBoard.Embedded graphics aidcomputer performance anda bundled expansion boardmakes getting started easy.It does, however, requiremore power under load.gizmosphere.org

Alsoconsider

Raspberry Pi£28.07The Pi’s ARMv6 processor isconsiderably less capablethan the MinnowBoard’sAtom – but at almost asixth the price, it’s easyto overlook this in favourof having spare cash foradd-on hardware andtinkering components.raspberrypi.org

■ A micro-SDIO slot plays host toa bundled SD card containing theAngström operating system

■ A small heat sink passivelycools the Intel AtomE650T processor

■ Bundled risers lift the board upin order to allow the processorroom to cool

■ Four switchescombine with two user-controllable LEDs to getusers started with the

board’s capabilities

Page 14: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 14/100

A collaboration between the Linux Foundation

and Selventa’s freshly opened OpenBEL

project could help push the ideals of open

source development further into the realms of

scientific research, the groups have announced.

Previously a closed-source proprietary

platform, OpenBEL – the Open Biological

Expression Language – was designed to help

users to capture, store, share and use life

sciences content through what its creators

describe as a “knowledge engineering

platform.” Addressing the difculties with

sharing and using data, the team behind

OpenBEL has been using it for ten years –but the platform was only opened up in June

last year, a move that the Linux Foundation is

claiming will be the making of the project.

“All of us are smarter collectively than any

one of us is by ourselves, and Linux is one

of the greatest examples of that principle,”

claimed Jim Zemlin, executive director at

The Linux Foundation. “We are able to take

what we know about Linux and collaborative

development and transfer that to new

industries. OpenBEL represents an amazing

opportunity for openness and collaboration to

advance science, and we’re happy to impart

our knowledge of collaborative software

development to leaders in the life sciences

industry. Successful open source projects

don’t just host code; they make use of a full

suite of open source best practices to quickly

gain adoption and collaboration. We aim to help

OpenBEL achieve even more success.”

“The Linux Foundation hosts the largest

collaborative project in the history of

computing: Linux,” stated Ted Slater, project

www.linuxuser.co.uk14

OE SEE

Linux Foundation leadsopen science initiativePartnership with OpenBEL will make sharing scientific data easier

“All of us aresmartercollectively thanany one of us is by

ourselves” Ted Slater

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

Email us directly…[email protected]

nOpenBEL provides a platform for the capture and collaborative analysis of life sciences data

lead for OpenBEL. “It is the standard by which

all open development projects measure

themselves. We know our industry can

learn a lot from this neutral steward of open

development and governance… Also, by

hosting OpenBEL at The Linux Foundation, we

have access to a variety of important services

to help facilitate collaborative development,

allowing our teams to focus on our subject

matter: life science.”

Hosting the OpenBEL platform with the

Linux Foundation, its creators hope, will boost

its adoption. Since going open source in June

2012, the project has already been adoptedby organisations as diverse as the Harvard

Medical School, the University of California

at San Diego, the Fraunhofer Institute, and

pharmaceutical giants Novartis and Pzer.

The groups hope that wider adoption of

OpenBEL will lead to a pooling of information

on life sciences, with the platform allowing

for easy dissemination and analysis using a

standardised set of computable networks and

application programming interfaces (APIs).

The deal with OpenBEL is the latest of the

Linux Foundation’s Collaborative Projects,

which include partnerships with the Yocto

Project, Xen Project, FOSS Bazaar, and mobile

platforms MeeGo and Tizen.

Details on the project, and links to the source

code, are available on the ofcial OpenBEL

website at openbel.org.

nOpenBEL’s Ted Slater extols the virtues of

Linux and collaborative development

Page 15: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 15/100

www.linuxuser.co.uk15 www.linuxuser.co.uk15

Linuxcalendar

    3

  -    5    O   c    t   o    b   e   r    2    0    1    3

Open World Forum ’13» Le Beffroi, Paris» France» openworldorum.orgThe frst European summitdesigned to bring togethertechnical experts and politicalrepresentatives, Open WorldForum includes speakers rangingrom Microsot’s Frederic Aatz tothe CIO o the French Culture and

Communication Ministry.

OggCamp» LJMU Art & Design Academy,

Liverpool

» England

» oggcamp.orgThe largest open source and reeculture event in the UK entersits fth year. Based around the‘unconerence’ ormat, there willbe three uid tracks along witha series o scheduled speakers

throughout the weekend.

CloudOpenEurope» Edinburgh International

Conerence Centre

» Scotland

» events.linuxfoundation.orgThe second annual CloudOpenconerence looks to build on thesuccessothe frst,helping pushorward the use o open sourcetechnologiesincloudcomputing.

The Foundation behind X.Org has lost itsstatus as a 501(c)(3) non-prot group in

the US, following a failure to le taxes withthe US Internal Revenue Service for three

consecutive years.

“Iwastakenbysurprise that the IRS hit

ussorudely,”FoundationaccountantStuart

Kreitmansaidatthecompany’smostrecent

board o directors’ meeting. “I’ve had little

issueswithmyownreturnsandhavealways

oundthemtobereasonableandriendly.”

Kreitman has, however, admitted that

the tax returns have not been fled, but

argued that the organisation has “never

fledreturns.”

LinuxCon Europe» Edinburgh International

Conerence Centre

» Scotland

» events.linuxfoundation.orgThe largest event covering Linuxin general – rather than specifcdistributions –comes toScotland,with over a hundred plannedsessions. Followed by the LinuxKernel Summit, Automotive LinuxSummit and Embedded Linux

ConerenceEurope,allinEdinburgh.

Open source hosting outt SourceForge has

been criticised for bundling selected binaryreleases in advertising-laden packages.

LaunchedinJulythisyear,DevSharebundles

sotware with add-ons such as AnchorFree’sHotSpotShield. SourceForge claims itprovides

an easy way or developers to monetise their

eorts; its critics claim it’s nothing more

thanmalware.

“SourceForge, once a mighty orce or

the good o open source, has allen ar rom

its previous loty heights,” opined Red Hatdeveloper Justin Cli in a post to the Gluster

Project blog. “I’m not againstmonetisation at

all,we all havelivesandneedtopayour bills.

Butnotthroughabusingusertrust.Notthrough

preyingontheunskilledorunwary.Tomisquote

MargeSimpson:‘Theynotonlycrossedtheline,

theythrewuponit.’”

SourceForge, now owned byDice Holdings,

has deended the initiative. “SourceForge will

always respect the rights oourusersandwe

willnever inringeon them.DevShareoersa

transparentinstallationowthatgivesusersall

the necessary inormation to make educated

choicesaboutwhatsotwaretoinstall.”The decision to launch the programme,

currentlyinbeta,hasledtocallsorhigh-profle

projects tomoveto alternativehosts; others –

including FTPclient FileZilla – have, however,

alreadysigneduptoDevShare.

OPE SOURCE

“They not only crossed the line, they threw up on it”

nThe DevShare programme introduced by

SourceForge owner Dice Holdings has drawn

strong criticism

OPE SOURCE

X.Org losesnon-profit status

    1

    9  -    2    0    O   c    t   o    b   e   r    2    0    1    3

    2    1  -    2    3    O   c    t   o    b   e   r    2    0    1    3

ThelatestintheLinuxcommunity

News

OPE SOURCE

SourceForge DevSharebranded ‘malware’

TheFoundationisnowconsideringjoining

anumbrellaorganisationinordertoreduce

thepaperworkrequiredoitsmembersand

prevent this sort o embarrassingsituation

romrecurring.

nThe X.Org Foundation is considering

letting others take care o its paperwork

in uture

    2    1  -    2    3    O   c    t   o    b   e   r    2    0    1    3

Page 16: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 16/100

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

Email us directly…[email protected]

www.linuxuser.co.uk16

Aims for a trillion devices sold by 2025

GOVERNMENT

Cambridge-based low-power processing giant

ARM is throwing its weight behind the Internet

of Things, forming a new IoT business unit with

the aim of selling a trillion devices by 2025, and

purchasing IoT specialist Sensinode Oy.

Claimed by its proponents to be the next logical

evolution of the internet, the Internet of Things

looks to equip everything possible with internet-

connected sensors and interactivity as the

means to making people’s lives easier.

ARM plans to integrate Sensinode’s 6LoWPAN

and CoAP standards with its own Cortex-based

mbed microcomputing platform, which it sells

both for embedded hardware development and in

breadboard-friendly format for hobbyist use.

“Sensinode is a pioneer in software for low-

cost low-power internet connected devices and

HARDWARE

ARM begins Internet of Things pushhas been a key contributor to open standards

for IoT,” claimed ARM’s John Cornish of the deal.

“By making Sensinode expertise and technology

accessible to the ARM partnership and through

the ARM mbed project, we will enable rapid

deployment of thousands of new and innovative

IoT applications.”

The move comes as industry analysts predict

a pending explosion in the number of connected

devices, with Bill Morelli of IHS offering an

estimate of 30 billion connected devices by

2020 – a figure that ARM is going to do its best

to exceed.

Small-scale IoT projects, including printers

that act as Twitter gateways and environmental

monitoring systems, often make use of ARM-

based microcomputing systems – most

frequently, these days, the low-cost and high-

performance Raspberry Pi or its more flexible

alternative the BeagleBone Black – while others

use lower-cost microcontroller devices from

Atmel, Texas Instruments and others.

Local government coffersalready €1.3 million richerThe Valencian regional government in Spain

has completed its planned switch from

proprietary software to LibreOffice.

The project to migrate to an open source

alternative began in 2012, and has already

been credited with saving the government

€1.3 million in software licensing fees.

“Apart from economic benefits, the

commitment to free and open source software

brings other advantages, including having

the solutions available in the Valencian

language as well as in Spanish, and ITvendor independence, which encourages

competition,” said Sofia Bellés, director general

of the Valencian government ICT department.

“We also have the freedom to modify and adapt

the software to our every need.”

Valencia has long been at the forefront

of open source adoption, having pushed a

programme of Linux adoption in schools back

in 2005. Covering 110,000 PCs installed across

all regional schools, the move to Lliurex Linux isclaimed to have saved over €30 million so far.

“Installation of the free office suite is

part of the regional government’s strategic

commitment to its use of free software. It will

not only help save costs for licences,” Bellés

ValenciacompletesLibreOfficeswitch

added, “but also boosts the development

of the local ICT sector, promotes the

use of Valencian in the digital world and

improves interoperability and security of the

administration’s IT systems.”The move has been lauded by the European

Commission’s JoinUp programme, which looks

to improve interoperability between public

administrations through standardisation,

suggesting other governments may follow suit.

ush

■Moving to LibreOffice has saved the Valencian government a small fortune

■ARM is pushing its technologies, including the

mbed prototyping platform, as the future of IoT

Page 17: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 17/100

Following his decision to name Linux 3.11

‘Linux for Workgroups,’ Linus Torvalds has

posted a nostalgic message celebrating its

nal release candidate.

“Hello everybody out there using Linux

– I’m doing a (free) operating system (just a

hobby, even if it’s big and professional) for

486+ AT clones and just about anything else

out there under the sun,” Torvalds wrote.“This has been brewing since April 1991, and

is still not ready.”

The message is an amusing echo of his

1991 initial Linux release notice, which

called for Minix users to try Linux and

claimed it “won’t be big and professional

like GNU.”

Tvald lbatinux 3.11

The latest in the Linux communityNews

ope sorce

Experts warn users to beware asmalware spreads

mre

Hand f Thif Tjantagt inux

Dvl 4 Ga ha nfid that fit-

n ht metro: last light i hading t

inux fllwing it dbut n indw ali

thi ya.

Due to arrive on Steam or Linux later this year,

Metro: Last Light  is one o the frst big-name

titles to be released on Linux in the same year as

its Windows counterpart – and marks a growingtrend or development houses to consider Linux

as a valid target market or their sotware.

Development o the Linux release was

perormed in-house at 4A Games, with the

company crediting its custom game engine or

making it easy to port to alternative platorms.

The game will also be launching on OS X around

the same time.

DeoGmes

Linux gaming no longer being ignored by triple-A developers.

“We are very happy with the results,” said 4A’s

CTO Oles Shishkovstov. “We hope that Mac and

Linux gamers will appreciate our eorts to create

the best possible version or their machines.”

mt: at ight had t inux

n4A Games has ported Metro: Last Light toLinux, for launch later this year

Tjan h, dubbd th Hand f Thif, ha bn divd

tagting inux u and attting t gab banking dntial

and th nitiv data.

The Trojan, discovered by RSA researchers, includes sophisticated

anti-monitoring and anti-virtualisation techniques which make

it hard to analyse. Sold or around $2,000 on underground sites,

the Trojan is claimed to be eective against all common Linux

desktop distributions.

Anti-virus experts are positioning the Trojan as proo that such

protective sotware is a requirement on Linux. “It’s yet another reason

why Linux users shouldn’t be complacent about their computer

security, and run an anti-virus program,” claimed ormer Sophos

consultant Graham Cluley. “The statement that the Linux platorm

is absolutely secure now seems even more illusive,” added Avast!’s

Peter Kálnai.

However, the Trojan can only install when provided with root access

– something the majority o modern desktop distributions shut o

behind a password. By being careul about what is installed and not

providing a password to an unexpected pop-up dialog, Linux users

should largely be protected rom its ravages.

Those who requently install sotware rom outside their

distribution’s ofcial repositories, however, should take heed: as

the popularity o Linux grows, sadly so too does its attractiveness

to criminals.

Does your current database support providerguarantee a 15 minute response?

2ndQuadrant’s Planum Producon Support for PostgreSQL

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

workaround and guaranteed bug x within 24 hours.

24 hours a day, 365 days a year.

PostgreSQL is used worldwide for mission crical applicaons. Now

you can choose this open source database, safe in the knowledge

that if you ever need help, it‘s less than 15 minutes away.

With guaranteed x mes and access to leading Postgres experts.

2ndquadrant.com/support

. PostgreSQL Development . 24x7 Support . Training . Services.

2ndQuadrant Ltd. 7200 The Quorum, North Side, Oxford Business Park, Oxford, OX4 2JZ, UNITED KINGDOM www.2ndquadrant.com TEL +44-870-766-7756

We do.

Page 18: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 18/100

The ree sotware columnOpinion

r

r r

robotics is a fascinating subject. It links

computers to the physical world, allowing them

to move around, sense their environment, and to

interact with it. Building your own robot, however,

has traditionally required that you spend a huge

amount o time and energy to get even the most

basic o robotic systems up and running. You

need mechanical engineering skills to build

the chassis or body, electronic engineering

skills to wire up the motors and the sensors,

and programming skills to animate the robot,

to control its body to get it to do what you want.

These barriers to entry mean that people entering

into the feld o robotics – either in search o a

stimulating pastime, or perhaps as part o more

ormal research – can quickly be overwhelmed

by the sheer amount o work required. The initial

dreams o building a robot to etch your beer or

to walk your dog get pushed urther and urther

back, as more and more time is sucked up just

getting the basics working.

Things are changing, however, and the barriers

to entry are alling. The relentless march o

progress in consumer goods means that a lot

Linux is increasingly being used or cutting-edge robotics – opening up thefeld to anyone interested in learning more

Linux is the platfomfo obotics

o commonly used robotics hardware – such as

cameras, accelerometers and communication

devices – are now both much cheaper and much

smaller than they were ten years ago. Actually

making use o electronic sensors, and motors, is

also a lot easier now, as platorms like the Arduino

make connecting electronic components to

your computer, and controlling them, both quick

and simple. On top o all this, small, powerul

computers such as the Raspberry Pi and the

BeagleBoard, to name but two, mean that you

can now cram much more processing power into

your robots at an aordable price.

In order to put this hardware to good use,however, you need sotware, and as luck would

have it, Linux is the platorm where the most

exciting developments in robotic sotware are

taking place. Writing the sotware or modern

robots can be one o the most involved and

complicated parts o the process. Sotware is

needed or controlling

motors, reading

values rom sensors

and, possibly most

importantly, to provide

high-level control

and AI. A number o

distributed sotware

environments have

been produced to try to ease the development

o robotic sotware. But the Robot Operating

System (ROS) produced by a company called

Willow Garage in Silicon Valley is arguably one

o the most successul. ROS is not actually an

operating system, but rather a BSD-licensed

open source sotware ramework which runs

on Linux. It allows interaces to be defned or

common bits o robotic sotware, such as the

drivers or cameras and motors, and it allows

this sotware to be run as a large number o

separate processes called ‘nodes’ – either all on

one machine, or transparently distributed over a

network o machines.

Alan oun is currently studyingor a PhD at the BristolRobotics Laboratory. He isalso the managing directoro Dawn Robotics Ltd –www.dawnobotics.co.uk

Over the last fve years, ROS has dramatically

eased the process o writing robotic sotware.

Now you can download a large number o pre-

compiled packages to quickly allow you to

hook up common sensors such as cameras or

Microsot’s Kinect. High-level services such as

inverse kinematics, map building and speech

recognition are easy to plug in, and ROS also

provides a great selection o visualisation tools

so that you can see what’s going on rom your

robot’s point o view. When you need to write your

own sotware, you can do it in the language you

choose. Low-level motor drivers can be written

in C and then communicate over ROS’s networklayer with high-level control processes, written in

a language such as Python or Java.

Not having access to robotic hardware is

no bar to entry, as ROS also provides support

or simulators such as Gazebo. ROS has been

embraced by the robotics research community

and so lots o

simulations o cutting-

edge robots are now

provided by the teams

who built them. So,

or absolutely no

cost at all, you can

get access to Willow

Garage’s PR2 robot,

NASA’s Robonaut and Boston Dynamics’ Atlas

robot. This last robot is currently being used in the

DARPA Robotics Challenge, which seeks to get a

humanoid robot to drive a car and move around a

disaster area, so it’s ambitious stu.

Now is an exciting time in robotics, and Linux

is the platorm on which some o the coolest

stu is happening. I you haven’t tried it yet, then

I would urge you to download and have a play with

ROS, start building yoursel a robot and join in all

the un!

“Not having accessto robotic hardware

is no bar to entry”

www.linuxuse.co.uk18

Page 19: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 19/100

Can you volunteer forCode 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 nd out more

Page 20: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 20/100

www.linuxuser.co.uk20

Your source of Linux news and viewsOpenSource

Simon Brew is a technologywriter and editor,working across theLinux, Windows and

Mac OS X platforms

I play games. I’ve always liked playing games,

and suspect I’ll continually sneak one or two in

for the rest of my days. If you talk to my editor,

he’ll obviously tell you that I’m the most reliable

hitter of a deadline that he’s ever met and that

my words arrive perfectly formed, requiring the

barest of edits before they’re laid before your

eyes. Scratch that: thanks to computer games,

I’ve slipped under the proverbial door seconds

before it slams shut more times than I’d care

to admit.But games are changing. For someone

who was brought up with the spirit of 8-bit

computing, where anyone could spend a day or

two locked up in their bedroom coding a game,

the current climate is all a little disconcerting.

Take Watch Dogs : this is a big game that a big

publisher is making, that before it’s even been

released has been put on the fast track for a big-

screen movie. Or the evil of Candy Crush Saga,

the mobile game revolution that doesn’t want

any money off you up front, but is happy to take

as much off you as it can once it’s got you cosy

and sitting on the sofa.

Games are interesting, and always have been,because they’re at the forefront of control. I

think back to sticking dongles in the back of my

Commodore Amiga to stop people pirating a

game (naturally, the only people inconvenienced

turned out to be the people who legitimately

coughed up), or lining up pictures on wheels.

Then, as technology evolved, so did the

methodologies of control. PC gaming, through

Windows, has taken things to scary levels. At

one stage, the publisher Ubisoft implemented a

system whereby you had to go online and prove

you were legitimate once a day, else you weren’tallowed to play the title that you’d legally bought.

Naturally, one day its servers weren’t working

properly and people weren’t allowed to play their

game. Those running pirates copies could.

Microsoft has tried to implement a similar

system with its upcoming Xbox One games

console, although it’s had to perform a

signicant U-turn when the volcano of public

opinion erupted. Still, those buying a game for

an Xbox One machine will need to ‘activate’

it. A friendly word that, isn’t it? It sounds so

reasonable and happy. Just do one thing and

everything will be active and working. What

could be easier? The truth, of course, is thatit’s a further eradication of users’ rights in the

proprietary software sector.

The problem is that what happens in

videogaming increasingly becomes a dry-run

for what we get in the broader technology

ecosystem. Publishers know that people will

endure a degree of hassle to play a game,

and they take advantage of it ruthlessly. Now,

we’re at a point where Adobe’s Creative Suite of

tools won’t even be sold in a box any more – it’s

the cloud version or bust, and a subscription.

Someone’s been looking at the World Of 

Warcraft model.

Even in the app sphere, where the spirit of the

bedroom programmer should still be alive and

well, there’s a corporate sheen that’s taking the

fun off things. That Candy Crush Saga model

has proven to be the proverbial grail for many,

in that the appearance of a free, open approach

is just a disguise for one of the most ruthless

gaming money-making machines I’ve seen in

recent times.

It’s why the good ones need supporting, of

course. But for all the marches of progress,

the loss of an ethos has become real

collateral damage.

th O SO OL

Simon fears the future of gaming is the future of technology

Fair game

nKing’sCandy Crush Saga – a ruthless money-making machine

Page 21: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 21/100

www.ix.co.uk21

The free software columnOpinion

en surce

he Free sFware clumn

no-pofit Fss ogitio soft

Fdo covy d

ib gt it sg to

t od fo sg’ xFa fi

yt div fo lix d t t of

t Gl. The exFAT driver code came to light

through its inadvertent release via GitHub

(lwn.net/Articles/560424/) and the use of a

binary version in a Samsung Linux-based tablet.

The Software Freedom Conservancy, led

by Bradley Kuhn, works with developers and

manufacturers to ensure compliance with the

GPL. The greater part of the job is to point out

the legal obligation to manufacturers and to

help them achieve compliance, and most will

happily comply.

Samsung is releasing the code for its exFAT le system driverfor Linux under the terms of the GPL. This is an importantbreakthrough because of the participation of both Samsungand the GPL Compliance Project for Linux Developers

a Gl bktog

As we all know, the GPL makes a simple pact

between the coder and the user. Anyone can take,

modify, copy, share and redistribute the software

and the code, but must pass on the same rights to

subsequent users of the software, including any

modications to the code.

The coder, who is usually (but not always) the

copyright holder, gains because enhancements

to the code are fed back through the development

process. The manufacturer gains because third-

party developers become involved who may

bring new dimensions to the code. The user gains

because the code remains free and the obligation

is mutual, meaning that every other user has thesame obligation to feed their changes back.

The only requirement of the GPL is that the

source code be made accessible to end users, but

this requirement is often ignored, especially when

the code is reused in rmware and embedded

devices. GPL code is used in thousands of

devices, but many don’t comply with the terms of

the licence.

The role of Software Freedom Conservancy is

to alert manufacturers to failures in compliance

and to help them to reach an amicable resolution.

Most violations are resolved without court

proceedings. In very rare cases this may involve

litigation but as Jeremy Allison, a board member

of Conservancy, observes: “The point is not

to punish people for making mistakes, but to

bring them into compliance. When people get

into trouble it’s usually down to laziness and

inconvenience. It’s usually a case of ‘I can’t be

arsed, and it’s too much effort to do it right, so I’ll

 just use it’.”

rid hiy writes aboutart, music, digital rights,Linux and free software fora variety of publications

The great majority of infringements are

not deliberate, and can be attributed to

misunderstandings and lack of attention to

detail. Manufacturers of mobile devices operate

in a rapidly changing environment with short

product cycles and shorter time-to-market. The

market for rmware and mobile devices is highly

competitive, and every new product comes to

market with a new range of features. Failure to

comply with the GPL is usually inadvertent, but

releasing the source code is a small price to pay

when set aside the considerable advantages of

cost-effectiveness, speed to market, and the

accessibility of pre-written and tested codethat free software offers, especially when it is

remembered that it is only the GPL’d code that

has to be made available to others.

Sharing the code is useful to everyone, but the

terms of the GPL haven’t always been enforced

because the coders have other things to do, or the

copyright has been assigned to corporate entities

who don’t care about the licence beyond their

immediate needs.

For this reason it is an important development

that signicant contributors to the Linux kernel,

in the shape of Conservancy’s GPL Compliance

Project for Linux Developers, have become

involved in helping to ensure compliance with the

terms of the licence, and that Samsung, a major

manufacturer, was not only a willing and amicable

partner in releasing the code, but was happy

‘to talk publicly about the matter’, which may

make it easier to achieve compliance from other

manufacturers in the future.

The drawback, in this instance, is that exFAT

is owned by Microsoft, is a proprietary le

format and has patent issues. The exFAT driver

code can only be deployed by manufacturers

or distributions that have obtained a licence

from Microsoft.

“Sharing the code is useful toeveryone, but the terms of the GPL

haven’t always been enforced”

Page 22: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 22/100

www.liuxus.co.uk22

You souc of Liux ws d viwsOpSouc

The latest developments in the kernelcommunity, including changes to Linux 3.11

JOn MaSerS

Lius ovlds oucd th ltst ls

cdidt of th 3.11 ‘Liux fo Wokgoups’

kl o th 22d ivsy of his oigil

‘Hllo vybody’ mil fist itoducig Liux

bck i 1991.

The last ew weeks have been largely quiet

in terms o changes merged into the mainline

kernel, typical both o late summer and o the

late stages in a kernel release cycle. It would

seem that temporary fxes or the ongoing

Windows 8 ACPI compatibility issues – which

cause display backlights (now managed directly

by certain Windows graphics drivers, rather than

in the ACPI frmware) to misbehave on some

laptops – will sufce or this release, but will be

your computer to provide many CPU cores or the

operating system) scales, it does not necessarily

do so in a linear ashion. The truth is that certain

memory DIMM banks are ‘closer’ to certain

CPU cores.

In an SMP system, every CPU can accessevery memory location in the system, which is

typically ‘coherent’, meaning that the underlying

hardware takes care o ensuring that memory

locations cached internally by other CPUs are

updated when a dierent CPU updates that

same memory. But accessing a given memory

location can be more expensive in terms o

latency i it is not ‘local’ to a given processor – ie

i the underlying hardware must take more steps

to reach a given location by routing access to that

location through an inter-processor local bus. To

an application (and a user) this maniests in terms

o slower perormance than could be achieved i

the memory or an application were strictly local

to a given processor.

Linux handles NUMA in various ways. To a

certain extent it can provide a level o transparent

support, by ‘migrating’ memory or applications

to be closer to the processors that are using it

(copying the underlying memory locations to

other locations more local to a given processor

and updating the virtual memory translation

tables accordingly), but special tools have been

written to allow administrators to be more

specifc about how a given application should

manage its memory. Mel Gorman, amous or

writing the defnitive book on Linux memory

management, has been working on NUMA

scalability problems recently, and both he and

Jo Msts is a Linux kernel hackerwho hasbeen working onLinux for some 18 years, sincehe rst attended universityat the age of 13. Jon lives inCambridge, Massachusetts,and works for a largeenterprise Linux vendor. Hepublishes a daily Linux kernelmailing list summary atklpodcst.og

h kl columraised again in the next cycle. I all goes according

to plan, the fnal release should be out very

shortly, in time or a summary in next month’s

issue oLinux User & Developer.

Every Linux release has a (code) name,

typically something very silly, and usuallywhatever Linus dreams up at the time he opens

the merge window (the period o time during

which disruptive kernel changes are allowed)

or a new kernel release. But rom time to time,

a release name has a deeper meaning. The

3.11 release came close to happening on the

20th anniversary o the original Windows 3.11

‘Windows or Workgroups’ release, but it was

not to be. Still, Linus had some un with the

celebration o the 22nd anniversary o his original

Linux announcement, posting a Google+ post

in which he parodied himsel, saying: “I’m doing

a (ree) operating system (just a hobby, even i

it’s big and proessional) or 486+ AT clones and

 just about anything else out there under the sun.

This has been brewing since 1991, and is still

not ready.”

nUMa dvlopmtLinux Weekly News recently noted that there

can oten seem to be themes to given periods o

kernel development, and that this past month

has had somewhat o a memory management

theme. This certainly seems to be the case.

But even more specifcally, this month’s theme

would seem to actually be that o NUMA (Non-

Uniorm Memory Access) development. NUMA

is all about dealing with the reality that as SMP

(symmetric multiprocessing, the kind used in

Page 23: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 23/100

www.lix.co.uk23

The kernel column – Jon MastersOpinion

en sure

Johannes Weiner have posted patches that aim

to better handle NUMA hinting and automatic

reconciliation of memory closer to where it

is used.

Beyond NUMA, other memory-scalability-

related topics were discussed at length over

the past month. Dave Chinner posted patches

that convert the kernel inode cache (an internal

kernel data structure responsible for caching

metadata about mounted le systems) to use

Paul McKenney’s famous (and IBM patented)

RCU (read-copy-update) memory accessoptimisation. This allows the inode cache to scale

more easily when Linux is run on very large NUMA

or non-NUMA systems without using a previously

global lock. Also scale related, Andy Lutomirski (of

a large banking corporation) began a discussion

concerning a new MADV_WILLWRITE ag that

can be used when setting up memory mappings

to inform the kernel that a given range of virtual

memory will denitely be written to later. This

allows the kernel to forgo its usual ‘copy on

write’ (deferred allocation of new virtual memory

regions until the rst use) and instead take the

(slightly more expensive) up-front hit of directly

allocating the memory in order to save a latency

hit later when that memory is touched by a

running application.

Memory management contributions this

month also included a virtualisation optimisation

from Martin Schwidefsky (of the IBM s390 team),

who provided patches that allow guest instances

to inform a host hypervisor that they are not using

pages (the fundamental unit of memory chunks

that the system uses to manage memory used

by applications, virtual machines, the kernel itself

and so on), which are automatically discarded

whenever they would be swapped out to disk, and

reinitialised when required later. Still further in

the realm of memory management, Michal Hocko

provided a patch that prevents the OOM (out of

memory) killer from being triggered on kernel

allocation faults – the kernel should itself be able

to handle memory allocations failures, or use

dedicated reserve memory pools.

ow cappig famwokBeyond memory management, Srinvas

Pandruvada (Intel) posted an initial RFC

(Request for Comments) patch – the rst

stage in developing a new idea into code –

series that implemented an in-kernel power

capping framework. The basic idea is to allowa given system (platform) to specify how much

power is available and for a precise cap to be

enforced across a variety of CPU and non-CPU

devices installed within the system. Using

this mechanism, it is hoped to provide certain

limits (such as the amount of power that can

be delivered by a battery, or power utility, or the

amount of power available if a battery is intended

to last for a certain time period, and so on) and for

devices to provide various performance trade-

offs within those constraints. But by providing

an overall framework, it is possible for the kernel

to make whole-system decisions that are not

isolated to a given subsystem or to a given device

in isolation.

Initial comments on the power capping

framework were favourable, although Greg

Kroah-Hartman (now of the Linux Foundation)

suggested that he wanted to see actual users

of the framework before it is merged – by which

he meant that he really wanted to see Intel post

code for its own CPUs and platforms to make use

of this framework. This seems to be in progress,

since comments on the mailing list implied that

such patches exist and have been reviewed by at

least a subset of developers to this point. It will be

interesting to see where this development leads,

especially in the mobile space, and also when

applied to other architectures.

“This month’s theme would

seem to actually be that of NUMA”goig dvlopmtBeyond NUMA and virtual memory, development

has included an initial implementation of UEFI

boot stub support for 32-bit ARM systems (which

previously used a less standard embedded

bootloader called U-Boot), a patch to allow per-

process control of transparent huge pages, a

x for PCIe reinitialisation when performing a

kernel crash dump (and kexec into a kernel that

must not have outstanding DMA operations

pending on boot), and optimisations from Andi

Kleen for the kernel build system known askbuild. Andi’s patches convert the ‘kallsyms’

stage of kernel compilation into a single-pass,

rather than being the multi-stage process that

has been the case. This is the point during kernel

compilation at which all of the symbols (function

names provided by the kernel for internal and

modular use) are resolved during the nal linking

of the kernel image. Andi has a series of cute

hacks proposed for dramatically speeding up

the process.

In this month’s kernel announcements, Ted Ts’o

reminded everyone that the 2013 Linux Kernel

Summit is coming up in Edinburgh next month,

and that there will be places reserved for those

who are strictly hobbyist developers. This seems

to have been a late decision since the deadline

for submissions came and went quickly, but it will

be worth keeping an eye on this next year, in case

such an invitation is repeated. Beyond the Kernel

Summit, there will be a number of kernel and non-

kernel developers present at the Linux Plumbers

Conference in New Orleans, at which several

other mini-conferences will run concurrently.

These include an ACPI/Power Management

gathering, a PCI mini-conference and this year’s

Linux Security Summit, among many others.

Page 24: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 24/100

Android StudioFeature

www.linuxuser.co.uk24

Get your head around the early access previewof the next stage in Android development

Announced earlier this year at Google I/O, Android

Studio will be the replacement for the current

Android development solution in Eclipse. This

Eclipse setup is part of the Android Developer Tools, and

takes advantage of the IDE’s Java-based development

environment and plug-in support to currently create the

development portion of Android apps. With the rest of the

SDK, virtual devices can be created and used to test code

before deployment onto real devices.

The Android Studio aims to be an all-in-one solution for

development and testing. Coming with the entire SDK, and

not even requiring traditional compiling or installation on

Linux, Android Studio is an incredible easy and quick way

to get straight into coding your apps – whether you’re an

experienced Android/Java dev working directly in code,

or a novice looking to use the graphical, drag-and-drop

approach to app creation.

Android Studio is still currently in beta as a free early

preview – we’ll cover some of the current quirks with the

software. However, it’s a denitely a great way to get used

to using the software before the nal switchover occurs.

We’ll also cover how you can export from Eclipse if you’ve

already been using that, and how to then distribute your

app once it’s nally complete.

Android

Studio

Get started with

Page 25: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 25/100

Fat

Get to grips with the new IDE for Android development

Android Studio

www.linuxuser.co.uk25

Page 26: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 26/100

Android StudioFeature

www.linuxuser.co.uk26

01DownloadHead over to the Android Developers

website and grab yourself a copy of the early

access preview to Android Studio from here:

bit.ly/1bWrFXz

You’ll need to then extract the contents –

put it in a folder you have easy access to, as

you need to run the Studio from the folder.

02RuntimeUse cd in the terminal to navigate to

the folder you just created, specifically the

android-studio/bin/  directory. To launch

Android Studio, enter into the terminal:

$ ./studio.sh

If it asks about your Java settings, for

now press Enter, as we can fix that later if it

becomes a problem.

03First runIf this is your first time using Android

Studio, you can safely ignore the prompt

to import any settings. Otherwise, find the

file you created from before, or your old

installation folder, to get previous settings.

We can import from Eclipse later on.

Introducing Android Studio

Installation

The new Android Studio is based on IntelliJ IDEA, a much

smaller and streamlined IDE than Eclipse. Android Studio

utilises its features to create an all-in-one Android development

environment with a smart visual view that is great for people

 just getting into app development, and the standard text editor

for those who know their way around Java and the Android API.

Installation is very simple as well – the files contain both the IDE

and the SDK you’ll need to create your apps, so you won’t need

to install the SDK via ADT separately like you will have done with

Eclipse if you’ve developed for Android in the past. The Studio

allows you to edit how the SDKs are utilised, how imports and

exports work, and even has a plug-in manager.

■  Recent Projects

The recent projects viewallows you to go straight

into any project youwish to work on without

having to look in theOpen Project prompt

■  Check for updates

Android Studio has itsown update manager,

allowing you to keep it

up to date. It will notifyyou when a newer

version is available

■  New Project

Start a new project bygoing through the handy

Android new projectwizard, selecting API

levels and settingthe icon

■  Docs and How-Tos

Some tips and how-tos

for IntelliJ, the baseof Android Studio, are

available straight fromthe welcome screen

Page 27: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 27/100

Get to grips with the new IDE for Android development

Android Studio

www.linuxuser.co.uk27

Helpful shortcuts

Virtual devicesTest your apps on a virtual

device that you define, either

by using settings for the main

Nexus devices, or by using

generic settings for different-

sized Android phones ortablets. You can edit the

system settings to limit or

increase RAM, and even allow

it to use the system GPU if

you need it to. It’s not perfect,

but it’s a great way to quickly

test functionality.

Development viewsAs the Java for the Android

apps is split into visual and

function elements, you can

use a visual WYSIWIG editor

for the XML code, allowing

you to place buttons and

text and other UI elements

wherever you want on the

screen. The text part is a full

IDE, with code navigation,

debugging, syntax

highlighting and a smart

code analyser that warns you

of any obvious issues with

what you’ve written.

Eclipse migrationFor existing Android developers, it’s easy to

migrate from Eclipse and the ADT to Android

Studio. The tools are already in place to

export the necessary files from Eclipse, and

Android Studio includes a handy feature

that allows you to then import them, and any

other Studio file. This is helpful now and will

be essential when it replaces Eclipse.

DebuggingA specific debugger can analyse the code as

it runs and give you a full rundown of what’s

happening when, allowing you to go through

the logs and figure out any possible issues,

or work out where problems are already

occurring. You can pause the program at any

point to isolate issues, instead of having to

search through code as it continues to run.

FEATURE

Key featuresAndroid Studio has handy, configurablekeyboard shortcuts. Here’s a list of themost common to get you started…

Command look-up(autocomplete command name)

Ctrl + Shift + A

Project quick fix

Alt

+Enter

Reformat code

Ctrl + Alt + L

Delete line

Ctrl + Y

Build

Ctrl + F9

Search by symbol nameCtrl + Alt  

+ Shift + N

Jump to source

F4

Navigate open tabs

Show docs for selected API

Ctrl + Q

Show parameters for selected method

Ctrl + P

Generate method

Alt

+Insert

 

Build and run

Shift + F10  Toggle project visibility

Alt

+1

Alt +Alt +

Page 28: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 28/100

Android StudioFeature

www.linuxuser.co.uk28

05Project structureAndroid Studio will create a lot o fles

or what will be a simple app – luckily we just

need to pay attention to MainActivity.java

and Main_Activity.xml or the moment. The

interace is also initially set up to allow or

WYSIWYG visual development.

06ViewsThe deault view is the visual

development interace – it includes elements

down the side that allow you to drag and drop

unctionality. You can also click the Text tab at

the bottom to get straight into the Java code,

with a live preview updating as you type.

FAQSince Android Studio is still under some

development, there are some bugs that

still need to be ironed out. Here are a

couple of known issues with Android

Studio that you can work around.

1) Error: Gradle project refresh failed

Android Studio has a newer version

o Gradle that has some backward

compatibility issues. These can be fxed by

frst clicking the link to search build.gradlerom the error dialog. From there, double-

click the line under the build.gradle usage,

opening the project build.gradle fle. Edit

the classpath to change the gradle version

to “0.5.+”. Finally, save the fle and rebuild

your project.

2) Error: Failed to import Gradle project

This can be a problem ater upgrading

Android Studio, as the project fles may

point towards an SDK element that

no longer exists. To fx this, you’ll need

to quickly install the Android Support

Repository. First, open Android SDK

Manager, fnd and expand Extras, and

install Android Support Repository.

01Create New ProjectFrom the Welcome screen, click on

Create New Project to open up the dialog

window. Name the project HelloWorld – we’ll

be creating the code or that shortly. Leave all

the other deault settings – they relate to what

versions o Android will be able to use the app.

03Activity selectorFor now, we’ll just use the blank

activity. When making other apps, this activity

selector can help you choose how the app with

behave – such as being ull-screen or having a

multi-column ow to view several items.

02Set imageHere you can set your image,

giving you a nice preview o how it will look

on dierent types o devices. You can set

padding, background colour and more to your

app icon. For now, click Next, as we don’t need

an icon or the sample project.

04Activity nameHere you can name the activity and

customise the way it works, with tabs, drop-

down menus and other actions. For now, we’ll

leave this as is. Hit Finish and the project will

be built. It may take a little while to do this.

MigrationIt’s quite easy to export existing projects

from Eclipse and then import them into

Android Studio. First of all, make sure your

ADT plug-in is up to date, then select File

and Export. Open Android from there and

select Generate Gradle les, then your

projects to export before clicking Finish.

In the basic Android Studio window, click

on ‘Import project’, nd the build.gradle

le and then press OK at the pop-up. You

should then be able to start development

on the project within Android Studio.

Create a new projectAndroid Studio offers a quick way to start your

app: name, package name, theme, advanced

icon options and the ability to select between

dierent Android APIs. The latter allows you

to put together an app with specifc versions

o Android in mind, making newer API objects

available or some. We’ll look at a basic setup

frst so we can make our Hello World app later.

Page 29: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 29/100

Useful resources

Get to grips with the new IDE for Android development

Android Studio

www.linuxuser.co.uk29

There are plenty of online resources you can

use to help you with your development –

whether you need to figure out a more elegant

method to create a specific function, or need

to wrestle with some bugs. Here’s a list of some

of the places you should visit.

 Android Developer Site –

developer.android.com

As well as the place to get Android Studio, the

Developer site has regular posts on interesting

projects, updates to the SDK, and some

troubleshooting tips.

Stack Overflow – stackoverflow.com

One of the best places on the internet to get

advice on an issue – either by searching for a

related question or submitting your own.

IntelliJ IDEA Support – 

intellij-support.jetbrains.com/home

Support for IntelliJ IDEA, the base for Android

Studio. Some of the support questions may be

more suited to the IntelliJ side of things.

 XDA Developers –

www.xda-developers.com/

A community built around smartphone

development, the XDA forum is a good way to

find out about Android-specific tips and tools,

and even to promote your application.

FEATURE

A view to develop

■  Layouts & widgets

Drag and drop different layouts

and functions to create your

app visually – a great way for

novices to get started

■  Live preview

See a live preview of

the way your app will

look, even while using

the text mode

■  Toolbar

Quick access to preview and

debugging tools, along with the ability

to change the theme, activity type and

the device preview

■  Component tree

Even in the visual view, you can

break down the code in the

individual components to see

how they work

The two views for Android Studio serve different purposes –

and people. The default visual view allows you to drag and drop

functions onto the interface, with guidelines to make sure you

keep them aligned with other UI elements. This then adds the

elements to the code, so you can edit them further in there.

The text view works like any good IDE, with a hierarchical view

of code, code navigation tools, autocomplete and, of course,

proper syntax highlighting.

Whichever view you use is up to you – however, you will

ultimately have more control with the text view.

Page 30: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 30/100

Android StudioFeature

www.linuxuser.co.uk30

01 VisuallyTo do it visually, simply select Plain

TextView, and place it on the display. Double-

click it and type in ‘Hello World!’. All static text

can be placed this way onto the interface, and

it will create the necessary code in the text

view as well.

02 Relative textThe relative layout should be included

in the code by default. Create a text parameter

by opening up triangle brackets with:

<TextView

…which we will use to display ‘Hello World’.

03 Hello codeTo add ‘Hello World’ to the Text

parameter, we put in:

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”

android:text=”Hello World!”

android:id=”@+id/textView”/>

The layout variables can also be set as fixed

pixel width/height.

04 Quit buttonThe file we’re editing now is just the

display. To do something, we need to start

editing the .java file. While we’re still in the .xml,

place a button and give it the caption ‘Quit’.

Open up MainActivity.java from the Projects

column before we continue.

05 ImportedNow add these imports to the top of

the code:

import android.view.View;

import android.view.View.

OnClickListener;

import android.widget.Button;

This allows us to use some extra Android

functions to press and use the Quit button.

06Coded actions

Add the following code below the line“setContentView(R.layout.activity_main);”:

Button button = (Button)

findViewById(R.id.button)

button.setOnClickListener(new

OnClickListener() {

 

@Override

public void onClick(View v) {

finish();

System.exit(0);

}

});

Make your first applicationCreating your first app in Android Studio is easy, and we’ll

start with the simplest one of all – the classic Hello World.

All basic apps, when created, have Hello World already displayed

within them – what we’re going to do here is learn how to simply

make Hello World in Android, and what other simple tasks we can

do in it.

■  Quit button

The section containing the code to make sureour button (with id button) properly quits the appwith System.exit

■  Main layout

This sets what the main layout, and displays it

■  Settings menu

This creates the Android settings menu that appears

at the top of the app

package com.linuxuser.helloworld;

import android.os.Bundle;

import android.app.Activity;

import android.view.Menu;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

public class MainActivity extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Button button = (Button) findViewById(R.id.button);

button.setOnClickListener(new OnClickListener() {  @Override

  public void onClick(View v) {

finish();

System.exit(0);

}

});

}

@Override

  public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if

it is present.

getMenuInflater().inflate(R.menu.main, menu);

  return true;

}

}

Code listing■  Package name

The name of your package according to theAndroid system

■  MainActivity class

The MainActivity class includes all the functions

in our main activity that we created

■  import functions

Import the various functions we need to get thecode to work on an Android device

Page 31: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 31/100

Get to grips with the new IDE for Android developmentAndroid Studio

www.linuxuser.co.uk31

FEATURE

01Virtual device managerFrom the Project View, find the

Android Virtual Device (AVD) manager icon

along the top and click it. From here you can

create and edit a range of devices for testing

your apps on. Click on New so that we can

get started.

02New deviceIn the pop-up dialog, name the virtual

device, select the device you wish to emulate

and then the target API level. Some devices

will have a minimum Android version target.

Your can edit this later, but for our app we won’t

need to change any other settings.

03Virtual realityClick OK and Android Studio will

confirm the options you’re using. Press Start

while the device is selected and choose

whether you want to get a pixel-accurate

screen, or a scaled version. It will then boot

up a virtual phone or tablet you can test on.

Working with virtual devices

DebuggingAndroid Studio includes tools to debug

the apps you create. To use them, first

make sure a device is running to emulate

the app. Then, click the Debug button –

in the shape of a green bug – and the file

will rebuild and launch on the device. This

time, though, it will bring up a full logging

window, a console and a debugger with

full tools to figure out where problems

may be occurring in your apps.■Use Android Studio’s debugging tools to analyse your code

■  Home screen

Emulate a list of Android

devices, from Nexus

phones and tablets to

generic phones defined

by screen resolution

■  Android buttons

Software buttons are

included on the virtual

device, as they are part

of modern Android

■  Physical buttons

There’s a range of

physical buttons you can

use that work on certain

devices, with power and

volume working on all

■  Hardware specs

Edit specific hardware

variables to better

emulate certain aspects

of a device, or give it

more power via your

host system

Create a virtual Android device to test and debug your Android apps, choosing from a selection of generic phones and tablets

Page 32: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 32/100

Subscribe today and getyour first three issuesfor £5 (and save £13.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

FANTASTICSUBSCRIBER

OFFER

Terms & ConditionsThis offer entitles new UK direct debit subscribers to receivetheir first three issues for £5. After these issues, subscriberswill then pay £25.15 every six issues. Subscribers can cancelthis subscription at any time. New subscriptions will start fromthe next available issue. Offer code PGG134Q must be quotedto receive this special subscription price. Details of the Direct

Debit guarantee are available on request. Offer expires 31 March2014. Imagine Publishing reserves the right to limit this type ofoffer to one per household.Source Code PGG134QWeb address: www.imaginesubs.co.uk/lud. Tel: 0844 249 0282

   H   U   R   R    Y 

   O   R   D   E   R    N

   O    W

SUBSCRIPTION VOUCHER■ YES 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 PAYMENT

■ UK Direct Debit PaymentI will receive my first 3 issues for £5, I will then pay only £25.15 every 6 issues thereafter.

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

■Visa ■ MasterCard ■ Amex ■ MaestroCard number

Expiry date

Issue number■■ (if Maestro)

Signed

Date

Code: PGG134QPlease 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 issueunless 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

Instruction to your Bank orBuilding 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 thisinstruction subject to the safeguards assured by the Direct Debit guarantee. I understandthat this instruction may remain with Imagine Publishing Limited and,if so, details will bepassed 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

Page 33: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 33/100

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

2. Telephone

0844 249 0282And quote PGG134Q

3.Post or emailPlease complete and post the form toLinux User & DeveloperSubscriptions Department800 Guillat AvenueKent Science ParkSittingbourne

ME9 8GUOr alternatively, you can scan and email the form to

[email protected]

THREE EASY WAYS TO SUBSCRIBE

ISSUES OF LINUX USERFOR JUST

Get your first3 issuesfor just£5, thensave 30%on the shop price

Readers inthe US see

page 84 forexclusiveoffer

3 5

Page 34: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 34/100

www.linuxuser.co.uk34

Make a small business database with LibreOfficeTutorial

Create a database that combines an easy-to-use,orm-based ront-end using LibreOfce with a portable,

networked MySQL back-end

Make a small business

database with LibreOffice

We’re going to show you how to put together

a typical database for small business use: a

database of customer details. It will be possible

to both export and import contact data rom

in standard ormats by making use o Calc,

LibreOfce’s spreadsheet module. We’ll use

Gmail contacts as our source, but you can use

any sotware that can export CSV fles – and

pretty much everything can.

We’ve added a ew twists to keep things

interesting. This project uses the Base module

o LibreOfce as the ront-end, and this provides

a GUI or setting up the database, creating the

orms or data entry and the actual business

o entering data. For the back-end, we will be

using the industry-standard MySQL. This allows

us to locate the back-end on a central server.

This, in turn, allows multiple users to access

the database.

For initial creation o the MySQL database,

we’ll use phpMyAdmin thanks to its riendly

web interace, although the actual database

design will be carried out rom within Base. By

the end o the project, you will have a GUI system

or browsing and editing the database with a

portable, networked back-end.

ResourcesLibreOfce: www.libreofce.org

At least one Ubuntu Linux PC

phpMyAdmin oers aweb-based ront-end or the

creation and maintenance oMySQL databases

You import and export datato and rom LibreOfce

Base by using Calc, thespreadsheet module. Thisenables access to mostcommon data ormats

Data entry iscarried out via an

easy-to-use orm inBase, the ront endto our database

All o the actualdatabase design

(felds, orm layoutetc) is carried outrom within Base

AdvisorMichael Reed is a technology

writer, and he’s beenhacking away at Linuxor over 15 years. Hespecialises in desktopLinux solutions

Page 35: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 35/100

Use LibreOffice and MySQL to create a customer databaseMake a small business database with LibreOffice

TUTORIAL

www.linuxuser.co.uk35

01 Install LibreOfficeAt time of writing, the major Linux

distributions haven’t moved over to LibreOffice 4

and are still offering 3.x. This means that you may

have to install LibreOffice 4 manually. Visit the

LibreOffice website (www.libreoffice.org) and

follow the instructions. On Ubuntu, this consists

of unpacking the archive and runningsudo dpkg

-i *.debon the contents.

04 Install the MySQL ServerType sudo apt-get install mysql-server to begin installation. Before long, you

should be prompted to set a root MySQL password. Note that this isn’t the same as the administrator

account of your system, which is also called ‘root’. Choose a password and make a note of it.

03 Install Java and additional classesConnectivity between Base and MySQL

makes use of a Java class. Type sudo apt-get

install default-jdk to install the Java

runtime. Type sudo apt-get install

libmysql-java to install the needed additional

Java classes.

02 Install the Apache web serverWe’ll install Apache early on and with

its own command because some of the other

packages need to be able to configure a working

Apache installation. Carry out the installation

withsudo apt-get install apache2. Test

it by navigating a web browser tohttp://localhost.

05 Install and test phpMyAdminType sudo apt-get install

phpmyadmin to begin installation. When

prompted to choose a web server, choose

Apache2, select it with the space bar and press

Return. When requested, give it the MySQL

root password and then choose a password for

phpMyAdmin and make a note of it. Navigating

to http://localhost/phpmyadmin/ should take

you to a functioning login page. Log in using the

MySQL root username and password. We’ll

use MySQL to set up and maintain the actual

database, although we’ll create the fields fromwithin LibreOffice later on.

06 Create databaseWithin the phpMyAdmin web interface,

select the Databases tab. Now create a new

database by entering the name ‘customer’ into

the text box and clicking on Create. This database

will contain our customer data.

07 Add JDBC in LibreOfficeWe now need to tell LibreOffice where

to find the JDBC class file. Start LibreOffice

and go to LibreOffice>Options>Advanced. In

the Java Options section, select Class Path and

then Add Archive. The file you need is located at:

/usr/share/java/mysql-connector-java.jar .

Select it and restart LibreOffice.

Page 36: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 36/100

www.linuxuser.co.uk36

Make a small business database with LibreOfficeTutorial

08 Connect the databaseWe now need to connect our ront-

end (LibreOfce) to the back-end (MySQL) o

our database. Start LibreOfce and launch the

Base module. In the dialog that pops up, select

‘Connect to an existing database’. From the drop-

down menu below this, select MySQL as the

database type.

10 Save the databaseYou can accept the deaults on the next

page, so click on Finish. When prompted, give

the database a name and save it. Remember

that this fle contains the connection inormation

or access to our MySQL database – it doesn’t

contain the actual records.

12 Create form from template

Select Forms rom the sidebar. Click on‘Use Wizard to Create Form’ in the Tasks window.

In the table wizard, click on the >> symbol to copy

across all o the felds in the database.

13 Finalise formAccept the deaults in sections 2, 3 and 4,

but select the frst arrangement icon in section 5,

‘Arrange controls’. You should now see a preview

o our entry orm in the main window. Select

deaults on the other sections and then click

on Finish.

14 Test data entryTo enter data into the database, use the

orm that we created. Select Forms in the sidebar

and then double-click on the name o the orm in

the main window. This brings up the GUI record-

editing interace. The orm can still be tweaked

and edited by right-clicking on its name in the

main window.

11 Create elds from a templateYou may want to create a custom set o

felds or your customer records, but to save

time we’re going to use the one o the templates

that is built into Base. Select Tables rom the

side menu and then ‘Use Wizard to Create Table’.

Using the Sample tables pull-down menu, select

Customers. Use the >> button to copy all o themacross. On the next page, you can tweak the felds

that you have included and add new ones. Select

the deaults on the next two pages and then click

on Finish.

09 Congure BaseOn the next page, select ‘Connect using

JDBC’. On the next page, click on ‘Test class’ to

ensure that the Java RT is working. Now enter

the name o the database that we created,

customer, and enter localhost into the Server

feld. On the next page, addRootas the username

and tick ‘Password required’. Now click on the

‘Test connection’ button and enter the rootMySQL password, when asked or it, to test the

connection between LibreOfce and the local

MySQL server. Presuming that this completes

without errors, click on Next.

Remember that this file containsthe connection information for accessto our MySQL database – it doesn’t

contain the actual records

Page 37: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 37/100

www.inuxuser.co.uk37

Use LibreOfce and MySQL to create a customer databaseMake a small business database with LibreOffice

TUTORIl

15 Export your contacts from GmaiSwitch rom the Gmail contacts view

using the pull-down menu in the top-let corner,

underneath the Gmail logo. From here, clickon the More icon pull-down menu and select

Export… Click on Export.

16 Cean up the data and create a keyStart a new spreadsheet and open the

CSV fle that you exported rom Gmail. Use

Ctrl-mousewheel zooming to get an overview.

Typically, a lot o the felds will be completely

blank, so select these columns (click on the

column letter at the top o the window) and

remove them (Edit>Delete cells). We have to

create a key or each record. Label a column ID.

Select the frst cell in the column and then select

the fnal cell by Shit-clicking on it. Use the fll

eature (Edit>Fill>Series).

17 Import the data into BaseWhen you’ve cleaned up the spreadsheet,

select the data (including the column headers)

by clicking on the top-let cell and then Shit-clicking on the bottom-right cell. Right-click and

select Copy. Select Tables rom the side menu o

the Base module. From here, right-click on the

customers table and click on Paste. This should

bring up the import wizard. Select ‘Append data’

and ‘Use frst line as column names’ options, and

click on Next.

18 ign the edsThe feld names rom our imported data

don’t quite match those o the database and so

we need to use the second page o the wizard

to line them up. To do so, click on a feld name

and use the up and down icons in the other list

to create the correct attachments. Then click

on Create.

19 Create a new database userTo access the database rom more than

one machine, you must create additional users.

Log back into phpMyAdmin, click on the Users

tab and select ‘Add user’. From here, create a

new user with the name and password o your

choosing and make a note o it. Click on ‘Check all’

in the ‘Global privileges’ section.

20 Redistribute the databaseIn the Base module, re-save the

database under a new name. In this new version

o the fle, we have to alter a ew details. Select

Edit>Database>Properties and enter the name

o the new database user. Click on the Additional

Settings tab and enter the IP address o the

machine with the MySQL database.

Page 38: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 38/100

www.linuxuser.co.uk38

Write LaTeX documents with LyXTutorial

LyX lets you to get your document written without having to

deal with LaTeX’s steep learning curve. Here’s how…

Write LaTeX documentswith LyX

LaTeX is a typesetting system that gives you full

control over how everything in your document is

rendered. The problem is its really steep learning

curve. One option is to use a basic text editor and

learn all the markup you need for your document.

The other option is to use an application that

wraps the markup to some degree. LyX does this

very nicely. While a fully WYSIWYG editor for LaTeX

doesn’t make sense (since your doc isn’t fully

rendered until sent to an output device), LyX does

provide a pseudo-WYSIWYG interface where you

can see how different regions will be rendered.

In this tutorial, you’ll learn how to create a new

document and create various content sections,

like images, tables and lists. You will also learn

how to use various document settings, like the

document class, to control the overall options

used during document rendering. Since LaTeX

is a typesetting system, LyX will let you output

to several formats, like PDF, Postscript, HTML,

plain text and OpenDocument les. Regardless of

whether you are writing a book, a journal article or

a set of presentation slides, LyX will help you get

your work done with minimal fuss.

ResourcesLyX: www..lyx.org

LaTeX: www.latex-project.org

The toolbar gives you

shortcuts for items like

lists, images, tables and

maths formulae

The main window is where

you type your text. This

is also where your text

gets rendered

You can always see what

the actual LaTeX source

code looks like for your

document. Nothing is

hidden from you in LyX

You can view what your

document will look like by

rendering it to a PDF le.

Don’t forget to refresh it

after making edits

AdvisorJoey Bernard As a true renaissance

man, he splits his time betweenbuilding furniture, helpingresearchers with scienticcomputing problems and writingAndroid apps. When the kids lethim have some time, that is

Page 39: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 39/100

Use LyX to lay out your LaTeX documents with ease

Write LaTeX docs with LyX

TUTORI

www.linuxuser.co.uk39

01 InstallationThe frst step is to get LyX installed on

your system. Most distributions should have a

package available. For your non-Linux riends,

there are binaries available or Windows, Mac

OS X, and even OS/2 and Haiku. As always, you

can download the source code and build rom

scratch in the worst-case scenario.

04 Text layoutWhile the document class sets the

deaults or your document, you still have ull

control to change anything in the document.

The Text Layout option lets you change the

indentation size to a custom increment. The

vertical spacing and line spacing can also be

customised. You also have the option to make

your document two-column here.

06 Numbering and the TOCDocuments are broken down into several

nested subregions. How these regions are

handled in the layout is decided by the document

class. You can also set whether these regions are

numbered or not, and whether they show up in

the generated table o contents.

05 Page layoutLaTeX fgures out the actual rendering

o your document based on a page layout. You

can select one o a number o standard page

ormats, or set a custom page size. You can set

whether the page is oriented as either portrait or

landscape mode.

07 View sourceNow that your document is set up,

you can start typing. LyX gives you a pseudo-

WYSISYG display o the text. But LaTeX is a purely

text-based markup language, so you can always

see the actual source code to veriy what LyX is

putting into your document. To see the source,

 just click on the menu itemView>View Source.

02 Opening a new documentWhen you frst start up LyX, the main

window opens up with a splash screen image

displayed. You actually have to tell LyX that you

want to start a new document beore you can

start writing. You can start a new document by

clicking the menu item File>New.

03 Setting the document classMany o the layout properties or your

document are set to deaults based on the class

o your document. You can set this by clicking the

menu item Document>Settings. This will pop up

a dialog window that we’ll use or the next ew

steps. The drop-down list will give you a very ull

list o possible document classes.

Page 40: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 40/100

www.linuxuser.co.uk40

Write LaTeX documents with LyXTutorial

08 TitleThe rst item your document will need

is a title. In LaTeX, you need to worry about whata particular piece of text is supposed to be, not

what it will look like. So at this stage, you can type

in your title text. To identify it as a title, you can

click the drop-down at the top right of the toolbar

and select Title.

10 DatesYou should have noticed that there is a

date option in the drop-down. You don’t need touse this if you don’t wish to. LyX will automatically

add the current date when you actually render the

document into an output format.

12 SectionsIn most documents, you will probably

want to break the text down into sections, and

possibly subsections. Sections are dened

by giving them a title. For instance, if your rst

section is going to be an introduction, then you

would type the section title as ‘Introduction’ and

set the type in the drop-down to Section. Theactual text for this section would be set to the

type Standard.

11 AbstractsIf you are writing an article, or a report, you

may need to include an abstract of the subject

matter being covered. If you have already written

your abstract, you can highlight the region with

your mouse and select Abstract from the drop-

down. This adds the title ‘Abstract’ and changes

the format of the text.

13 Mathematical formulaeMathematical formulae are always a

problem area in document typesetting. Many

people in the sciences rst move to LaTeX

because of the ability to fully control equations by

explicitly laying out all of the elements. However,

for more complex equations, this can still be

confusing. Therefore LyX provides an equation

writer tools that helps you create the LaTeX

required to lay out your formula in your document.

You can set the type of maths to be either inline

with your text, or to be centred and displayed on

its own.

Many of thelayout propertiesfor your document

are set to defaultsbased on the classof your document

09 AuthorHitting Enter will give you a new line, with

the type back to Standard. You can here enter

your name and set the type to Author, again with

the drop-down at the top right of the toolbar.

Where and how this will get rendered depends on

the document class and the output format.

Page 41: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 41/100

www.inuxuser.co.uk41

Use LyX to lay out your LaTeX documents with ease

Write LaTeX docs with LyX

TUTORIl

14 listsThere are several dierent types o

lists available or your use. Both numbered and

unnumbered lists are available as buttons on the

main toolbar. To start a list, click on one o the

buttons and start typing the frst item. Hitting the

Enter key will give you a new item to enter. Hitting

Enter on an empty item will drop you out o the

list section.

16 ImagesClicking on the menu item

Insert>Graphics opens a dialog window where

you can select an image fle to insert into your

document. You can either set a scaling actor, or

an explicit width and height or its display. You

can also rotate your image through X degrees.

You also have the option to control i and how the

image gets clipped to a bounding box.

18 SpecheckingMost people need help when it comes

to making sure everything is spelled correctly. I

you want to use the system deault spellchecking

engine, you can simply click on the menu

item Tools>Spellchecker. You can change

the engine being used by selecting it in the

options window.

19 FontsLinux users have had problems,

traditionally, when dealing with onts. This

extends to applications like LaTeX. LyX includes

options that help you correctly set up TrueType

onts, allowing you to use onts other than those

20 Output formatsNow that you have your document

fnished, you will want to render it to some

fnal output ormat. A common choice is either

PostScript or PDF. This way, you know that it willlook the same, regardless o who you give it to.

But you have several other options available, too.

You can output to HTML, rich text, plain text or

even OpenDocument.

17 PreviewingNow that you have a bunch o content in

your document, you probably want to get an idea

o what it will look like once it is ully rendered.

You can get LyX to generate a PDF or viewing

by clicking the menu item View>View [PDF

15 TabesYou can add a table by clicking on the

menu item Insert>Table. A dialog will appear

where you can set the number o rows and

columns. The frst row is set aside as a header

or the columns, but you can change this in the

LaTeX source.

(pdfatex)]. There are also other viewing options,

in case you want to render your document using

other methods.

provided by your LaTeX installation. This is

defned in the Document Settings dialog, where

you can set the amily, encoding and onts to use

or Roman, Sans Seri and Typewriter.

Page 42: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 42/100

www.linuxuser.co.uk42

Synchronise your files with UnisonTutorial

Learn how to use the Unison command-line tool tosynchronise les between computers quickly and reliably

Synchronise your files with Unison

Unison is an open source file synchronisation

tool for both text and binary files. It also has

a GUI, but here we’re focusing on the only the

command-line version because it’s quicker and

gets the job done cleanly. Unison really shows

its capabilities when you are working with more

than one computer and you need synchronisation

across all of them.

Benjamin C Pierce led the creation of Unison at

the University of Pennsylvania and it started life

as a research project. It can be used through the

SSH service and works equally well on both UNIX

(Linux, Mac OS X etc) and Windows machines.

It should be apparent that Unison was inspired

by the rsync utility. Unison differs from rsync

in that the latter is a mirroring tool that needs

to know in advance where the willing-to-keep

versions of the les are, whereas Unison is a

synchronisation tool that identies the les that

have been changed since the last sync process

and decides the way that the changes are going to

be propagated. In short, it’s smart.

ResourcesUnison: www.cis.upenn.edu/~bcpierce/unison

Two networked UNIX machines

Unison synchronises les

between computers – here

we’re using the command-

line version of the tool

This line indicates that

Unison has nothing to sync

at the moment, since no

les have changed

This error message

shows that there is a

lock le that needs to be

manually removed

The network connection

is broken so Unison

cannot synchronise les

AdvisorMihalis Tsoukalos has over 15 years of UNIX

system administration and programmingexperience and has been using Linuxsince 1993. He is also procient in Oracledatabase administration, Cisco IOS,Cocoa and iOS programming. He alwayslearns new things

Page 43: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 43/100

Use the Unison command-line tool to sync les between computersSynchronise your files with Unison

TUTORI

www.linuxuser.co.uk43

01 Installing UnisonMost Linux distributions have Unison

as a package ready for installation so that you

do not have to compile it. At the time of writing,

the current stable version of Unison is 2.40.102.

Note that every machine that is part of the

synchronisation process must have a copy of

the command-line version of Unison installed.

Additionally, this copy of Unison should be located

inside one of the directories of the default PATH

shell variable. Assuming you’re on a Debian-

based system, simply type:

sudo apt-get install unison

To nd the version of Unison you are using, just

type the following command:

unison -version

03 Synchronising fles on thesame computer

Although Unison was initially developed with

synchronising les located on different machines

in mind, you can synchronise les located on

the same computer using one of the following

two methods:

• Using localhostas the remote machine name.

• Using only local directory paths for both

root = lines.

Your advisor prefers the second way as it does not

require the SSH server be up and running.

The Unison prole le is called localFiles.prf

04 Synchronising fles with

another computerGiven a prole name called articles.prf that

is located inside the ~/.unison directory, you

can tell Unison to use it by executing the

following command:

$ unison articles

The remote machine declaration starts with

root = ssh://.

There are rare occasions – usually when the

user changed a le on both computers before

synchronising – where Unison will not be able

to determine whether a le or directory has

changed on the local or the remote server. In

such situations, Unison kindly asks for your help

so that it will not mistakenly proceed using thewrong version.

02 Unison profle flesUnison can run from the command line

without using any conguration les (proles),

but using a prole greatly simplies its use –

having a prole le does not prevent you from

adding extra command-line options (although

this article will not deal much with such options).

In the rare event that you have troubles working

with Unison, you may run it using the ‘-debug all’

command-line option so that you can better trace

and resolve errors.

and is located inside the ~/.unison directory. The

following two lines to work on the same machine,

as they do not include a remote machine:

root = /Users/mtsouk

root = /tmp

Page 44: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 44/100

www.linuxuser.co.uk44

Synchronise your iles with UnisonTutorial

05 Running Unison using a simpleprofle fle

Some basic things you need to know about

Unison proles are:

• The default backup level is 2, which controls

how many previous versions of each le are kept

not including the current version of the le. So the

default backup level keeps two backup copies of

a le. The parameter for setting the backup level

is called maxbackups.

• You can tell Unison not to keep le backups by

not adding any backup options inside a Unison

prole le.

• Unison prole les support Unicode characters.

• The logle option tells Unison to keep a log le

called unison.log inside the .unison directory.• Sometimes, network problems prohibit le

synchronisation, but Unison’s error messages are

denoting the problem:

$ unison articles

Contacting server...

Connection closed by 109.xxx.yyy.zzz

Fatal error: Lost connection with

the server

07 The .unison directoryMost of the Unison housekeeping

happens inside the .unison directory which

resides in the user’s home directory.

Unison keeps the following data there:

• Its prole les including the default prole

called default.prf.

• Its backup les, if you decided to have central

backups.

• The status le for each used prole.

• The Unison log le, should you tell it to keep one.You can put it anywhere you want but it is very

convenient for it to reside there.

• Unison creates lock les there, during

synchronisations, which it deletes when nished.

Note: It is not recommended to synchronise the

whole .unison directory. Synchronising just the

proles is okay.

08 A more advancedUnison profle fle

The contents of the advanced.prf le are as

follows:

root = /Users/mtsouk

root = ssh://linode//home/mtsouktimes = true

batch = true

# Log file

logfile = /Users/mtsouk/.unison/

unison.log

# Paths to synchronize

path = code/C

# Backup files

backup = Name *

backuplocation = central

maxbackups = 3

ignore = Name {Thumbs.db}

ignore = Name {.DS_Store}

ignore = Path {Samples.lnk}

06 Explaining the profle fleLines starting with a # denote

comments and are not processed any further.

Exactly two lines must start with root =. They

declare the machines (one is always the local

computer) that are going to participate in the

syncing process as well as the directories that are

considered the root directories for each machine.

After those important declarations, the actual

directories that are going to be synced are listed.

In this example we have just one directory (one

path = line). Its full path is /Users/mtsouk/docs/

article/workingfor the local machine and /home/

mtsouk/docs/article/working for the machine

called linode (an IP alias inside /etc/hosts). You

can have as many path entries as you want. All

les are synced except the ones that match

the ignore option. You can also have as many

ignore = lines as you want and can use regular

expressions in them. The backup option tells

Unison to keep backups of all les.

Page 45: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 45/100

www.inuxuser.co.uk45

12 Unison hints nd tipsThe rst two or three times you use a

new prole, double-check if everything works

as expected.

• You do not need to use every parameter that

Unison supports, just the ones that will do

your job!

• You can troubleshoot Unison using the

-debug all command-line option. It will

generate lots of output useful for debugging.

• The more you use Unison, the more you will

understand its practicality.

• You should be very careful with your backup

options, especially maxbackups, as it can take

up too much space on your computer.

• You can use Unison to securely exchange les

between computers.

• If a Windows machine is involved in the

synchronisation process, be careful with le

and directory permissions.

• For non-critical data les you may run Unison

once a day, but for critical data you should run it

more often.

• Unison cannot replace regular backups!

• When you are making a new prole, either

start simple or use an existing one as a starting

template. Add the extra functionality and

features while making sure that you always

have a working prole.

Use the Unison command-line tool to sync les between computers

Synchronise your files with Unison

TUTORIal

09 Expining the dvncedprofe fe

• The times  =  true line tells Unison to

synchronise modication times.

• The maxbackups = 3 line tells Unison to keep

the current le version plus three backups of it.

• The backup  =  Name * line tells Unison to

back up every le.

• The backuplocation  =  central, which

is the default option, tells Unison to keep all

backups in a central location. If neither the

backupdir preference nor the environment

variable UNISONBACKUPDIR are set, the

.unison/backup directory is used as the

backup location. If set to local, then all backups

will be kept in the same directory as the

original les.

• The batch = true option is a little tricky and

you should be careful with it as Unison will ask

no questions at all and non-conicting changes

will be propagated whereas conicts will be

skipped. Nevertheless, it is an essential option

if you want to use Unison as a cron job.

• The ignore  =  Name  {.DS_Store} line tells

Unison to not synchronise les that end with

.DS_Store. 11 Two common Unisontroubeshooting techniques

There are times when things do not work as

expected. Unison offers you many options that

can help you both nd and solve problems.

The rst option to try is the -testserver

option that just connects to the remote server

and then exits without synchronising any les.

The second thing to do is run the

following command:

$ ssh remote.machine.domain 'echo

$PATH'

The aforementioned command let you see

whether the PATH is the same as when you

log in using ssh remote.machine.domain.

If the problem is with the PATH, check if the

option PermitUserEnvironment in /etc/ssh/

sshd_cong is set to ‘no’ and change it to ‘yes’.

10 Using SSH withoutgiving pssword

The single most time-saving thing you can

do is to set up SSH so that you will not need

to enter your password each time you want

to synchronise your les and directories. The

procedure is easy and involves the following

three steps:

1.Runssh-keygen -t rsa

You will have to enter a passphrase twice, so

please do remember the passphrase! Two new

les are going to be created: ~/.ssh/id_rsa and

~/.ssh/id_rsa.pub.

2. You may need to create a directory called

.ssh on the remote server if it does not

already exist.

3. Copy the contents of the ~/.ssh/id_rsa.pub 

le from your local server into the le

~/.ssh/authorized_keys found on the remote

server. One way of doing it is by executing the

following command:

$ cat ~/.ssh/id_rsa.pub | ssh linode

'cat >> .ssh/authorized_keys'

The next time you try to log into the remote

Linux server using SSH, you will be asked for

the passphrase of step 1 for the last time.

From now on, you can log into the remote

Linux server by just typingssh linode:

$ ssh linodeLinux (none) 3.9.3-x86_64-linode33

#1 SMP Mon May 20 10:22:57 EDT 2013

x86_64

.

.

.

Last login: Wed Jul 31 18:46:23 2013

from ppp-94-64-21-97.home.otenet.gr

mtsouk@li140-253:~$

The rst time you log into the remote server

without typing your password, the following

informative message will be on the screen:

Identity added: /Users/mtsouk/.ssh/id_rsa (/Users/mtsouk/.ssh/id_rsa)

Page 46: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 46/100

www.linuxuser.co.uk46

Browse privately with Onion PiTutorial

Turn your Raspberry Pi into a highly secure andvery portable router to keep your system safe andyour browsing anonymous, wherever you are

Browse privatelywith Onion Pi

We showed you in issue 129 how

to turn your Raspberry Pi into the

ultimate portable wireless router,

requiring very little power and giving

you a wireless network wherever

there’s the most basic of internet

connections. What if it’s not enough to

know you can search the web, though?

What if you want to be wholly secure

as you do it? Then it’s time to upgrade

the router with Tor to protect your

privacy on the internet.

This ‘Onion Pi’, as dubbed by

Adafruit, combines Raspbian and

Tor to create and secure a wireless

access point using just a Raspberry Pi.

This project is fairly straightforward:

after setting up the wireless access

point, we install Tor and do some basic

setup tasks so that it routes traffic

properly, and securely. This will keep

you anonymous online – a handy

feature in a time of privacy concerns

all around the web.

When the Pi is not connected to

the internet, it should still function as

a wireless router, allowing at the very

least a wireless LAN in your location.

ResourcesA Raspberry Pi

Raspbian: www.raspberrypi.org/downloads

Compatible Wi-Fi adaptor: www.adafruit.com/products/814

Using not much more than a

Raspberry Pi, you can route

one or more systems through

a Tor-enabled access point,

guaranteeing anonymity

Hook into the internet just

about anywhere there’s

an internet connection – a

relative’s house, hotel

rooms and more

Connect everything

over a wireless

network – no need to

directly connect to

the Pi with a cable

This isn’t a

hardware hack – a

spare SD card can

be used for the Tor

router, and other

SD cards can be

used for different

functions without

any problems

AdvisorRob Zwetsloot models

complex systems andis a web developerproficient in Python,Django and PHP. Heloves to experimentwith computing

Page 47: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 47/100

Turn your Raspberry Pi into a Tor-enabled wireless router

Browse privately with Onion Pi

TUTORIAL

www.linuxuser.co.uk47

01 Install Raspbian

Raspbian is the Raspberry Pi distro

we’ll be using for the Onion Pi. Download the zip

file, extract the image and then apply it to an SD

card using:

$ dd bs=4M if=[version number]-

wheezy-raspbian.img of=/dev/[SD card

location]

You can also use NOOBS to install Raspbian if

you wish.

02 Set up Raspbian

Go through the initial Raspbian setup

and make sure to turn on the SSH server, and to

disable autoboot to desktop – this is unnecessary

and will only use extra power. You can also tell it to

fill up the rest of the card if there’s room for it.

04 SSH connection

Plug your USB wireless adapter into

the Pi and turn it back on. On another computer

connected to the same network, open a terminal

or type into the command line:

$ ssh [user]@[IP address]

Then enter the password for your Raspbian if it

asks for it.

05 Install DHCP

To make life easier for any system

connecting to the Pi access point, we need to

install a DHCP server to it. We do this with:

$ sudo apt-get install hostapd isc-

dhcp-server

DHCP will automatically assign IP addresses to

network-attached devices, meaning you won’t

need static IPs.

06 Set up DHCP

Now we need to configure the DHCP

server. Edit the configuration file with:

$ sudo nano /etc/dhcp/dhcpd.conf

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

domain-nameentries, then remove the # in front

ofauthoritative, seven lines down.

07 Server address

At the end of the configuration file, add

the following:

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.

08 DHCP server

Edit the server configuration files

so that it’s set to work in conjunction with the

wireless adaptor:

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

server

Scroll to INTERFACESand change it to:

INTERFACES="wlan0"

03 

Pi IP

We’ll be accessing your Raspberry Pi viaSSH to set it up. To do this we need to know its IP

address – you can find it by typing ifconfig into

the command line. Make a note of it and turn off

your Pi.

Page 48: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 48/100

www.linuxuser.co.uk48

Browse privately with Onion PiTutorial

09 Incoming Wi-FiWe need to set up the Wi-Fi adaptor to be

both static and accept incoming signals. First:

$ sudo nano /etc/network/interfaces

Put a # in front of iface wlan0 and following

lines with wpa roam, iface default and any other

affecting wlan0.

13 HostapdAfter saving and exiting, we need to edit

hostapdto point it to this new le. Open it with:

$ sudo nano /etc/default/hostapd

And then nd the line #DAEMON_CONF="".

Remove the #, and change it to:

DAEMON_CONF="/etc/hostapd/hostapd.

conf"

14 Network addressingSetting up a NAT will allow multiple clients

to connect. To do this, run:

$ sudo nano /etc/sysctl.conf

And add to the bottom of the le:

net.ipv4.ip_forward=1

Save this, and then nish by running:

$ sudo sh -c "echo 1 > /proc/sys/

net/ipv4/ip_forward"

15 IP tablesRun the following three commands to

make sure the internet connection is forwarded

correctly:

sudo iptables -t nat -A POSTROUTING

-o eth0 -j MASQUERADE

sudo iptables -A FORWARD -i

eth0 -o wlan0 -m state --state

RELATED,ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i wlan0 -o

eth0 -j ACCEPT

16 Apply confguration

So that this still works after a reboot, type:

$ sudo sh -c "iptables-save > /etc/

iptables.ipv4.nat"

Then add to the end of /etc/network/interfaces:

up iptables-restore < /etc/iptables.

ipv4.nat

12 WLAN confgurationinterface=wlan0

driver=rtl871xdrv

ssid=[access point name]

hw_mode=g

channel=1macaddr_acl=0

auth_algs=1

ignore_broadcast_ssid=0

wpa=2

wpa_passphrase=[password]

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

10 Static IPNow give the wireless interface a static

IP – after the line allow-hotplug wlan0, enter

the following:

iface wlan0 inet static

  address 192.168.42.1

  netmask 255.255.255.0

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

$ sudo ifconfig wlan0 192.168.42.1

11 WLAN creationWe need to create a new le that holds all

the information for our wireless network. We are

going to make it password protected so that only

the people we want to can access it. To create the

le, start with:

$ sudo nano /etc/hostapd/hostapd.

conf

And then enter the text from the next step.

Page 49: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 49/100

www.inuxuser.co.uk49

Turn your Raspberry Pi into a Tor-enabled wireless router

Browse privately with Onion Pi

TUTORIl

17 Wi-Fi fnaFinally, set it up as a daemon so it runs

at boot with the following commands:

sudo service hostapd start

sudo service isc-dhcp-server start

sudo update-rc.d hostapd enable

sudo update-rc.d isc-dhcp-server

enable

And the wireless access point part will be

nished.

18 Insta Tor

After a reboot, we now need to installTor. Do this simply with:

$ sudo apt-get install tor

Once it’s installed, you’ll need to edit the Tor

cong le with:

$ sudo nano /etc/tor/torrc

Follow the next step to add all the necessary

information to it.

19 

Tor confgurePut this below the FAQ comment:

Log notice file /var/log/tor/

notices.log

VirtualAddrNetwork 10.192.0.0/10

AutomapHostsSuffixes .onion,.exit

AutomapHostsOnResolve 1

TransPort 9040

TransListenAddress 192.168.42.1

DNSPort 53

DNSListenAddress 192.168.42.1

24 Secure the router

Finally, we can activate the Tor serviceso that we can start using the access point

securely with:

$ sudo service tor start

You can check this if you wish with:

$ sudo service tor status

To make it turn on at boot, you simple add it to

rc.d with:

$ sudo update-rc.d tor enable

23 loggingWe should create a log le in case

you need to debug later. To do this, use thesethree commands:

$ sudo touch /var/log/tor/notices.

log

$ sudo chown debian-tor /var/log/

tor/notices.log

$ sudo chmod 644 /var/log/tor/

notices.log

You can also check it with:

$ ls -l /var/log/tor

22 Check and saveYou can check the table setup with:

$ sudo iptables -t nat -L

If you’re happy with it, save it to the NAT le like

before with:

21 RerouteRoute all DNS trafc rst, using:

$ sudo iptables -t nat -A PREROUTING

-i wlan0 -p udp --dport 53 -j

REDIRECT --to-ports 53

And then route any TCP trafc with:

$ sudo iptables -t nat -A PREROUTING

-i wlan0 -p tcp --syn -j REDIRECT

--to-ports 9040

20 Tabe ushWe now need to ush the current IP

tables so that we can get the routing to go

through Tor. First of all, do:

$ sudo iptables -F

$ sudo iptables -t nat -F

If you want to keep SSH open to connect

remotely, you’ll need to make an exception for

that with:

$ sudo iptables -t nat -A PREROUTING

-i wlan0 -p tcp --dport 22 -j

REDIRECT --to-ports 22

$ sudo sh -c "iptables-save > /etc/

iptables.ipv4.nat"

Page 50: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 50/100

• WEEEcomplianceguaranteed

• 0%tolandllpolicy

• Alllegalliabilitiescovered

• DatawipedtoUKmilitarystandardsonallPCs

Haveyougot

unwantedmonitors?

4,000monitorsneededforschoolsinAfricaandLatinAmerica

www.computeraid.org/donate

020 8361 5540

[email protected]

Or fnd us on...

Registered Charity No. 1069256 Registered Company No. 3442679

Page 51: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 51/100

 If it wasn’t

open source, if itwasn’t GPL, therewouldn’t be the

 20,000 plug-insthat have been

written for it Mark Little talking about

WordPress

 51

The only Linux magazine for open source developers

100% FOSS focused» Features » Tutorials » Sample code

Page 52: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 52/100

www.linuxuser.co.uk52

We are on a tram to

Manchester, tapping awayon our phone as we update

one of our blogs, engrossed

in the words and thinking

little about the underlying

code which is making all of this possible. Just

as the last few words are written, the tram

stops and we make our way up the escalator

to Piccadilly Station about to meet the man

who created the behemoth that is WordPress,

the very blogging platform we had been using

throughout the journey.

Our meeting is being held at a railway station

because Mike Little, who is from Stockport, is

a busy man. He has already had one meeting

before we shake hands and he is due to have

another. We decide to sit in a coffee shop and

he grabs a sandwich before telling us about

his latest venture, which is – unsurprisingly

given the software is used by 18.9 per cent of

the top 10 million websites – very much related

to WordPress.

Little is currently working on a series of

screencasts which showcase how WordPress

can be used, explaining the fundamentals of it

to encourage more people to get involved with

blogging using the platform. It’s a slow process

– “it takes about an hour to edit a minute’s

footage,” he says – but he’s getting there. The

idea is that the screencasts will form a paid-for

online course. “I want them to be better than

anything else that is out there, so they have to

be done right,” he says. “There is a lot of rubbish

■ Mike Little celebrates receiving his outstanding contribution award

being made where you get someone just filming

what they are doing and there are lots of ums

and ahs and backtracking. My screencasts

won’t be like that and people will certainly get

value for money.”

Little, who also teaches WordPress to classes

face-to-face, continues to work with WordPress

for professional clients too. After all, if he

cannot produce a killer website for companies

and organisations using the software, then

nobody can. It is fitting, then, that he has worked

with Downing Street on government sites. He

appears most proud of a science-engagement

site for children called I’m A Scientist, Get

Me Out Of Here, which has spun off into I’m

An Engineer. “I really enjoy doing these,” he

says, explaining that his entire freelance

With ten years under its belt, WordPress has firmlycemented its place in the hearts of bloggers. But what nextfor its co-founder Mike Little? David Crookes finds out…

The other half

of WordPress

Page 53: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 53/100

www.linuxuser.co.uk53

Mike Little is a long-term user of Linux. “I’ve

been into Linux since the early days,” he

recalls. “I could see that the openness, the

ability to look at code, to modify [it]… was

making better software… So I’ve always been

passionate about it and I just absolutely think

it’s the right thing to do.”

He has fond memories of the days when

Linux needed to be downloaded from FTP

sites and stuck on several 3.5-inch floppies.

“I’m going back to 1.something series kernels,so right from when there probably were only

three or four distributions. Slackware was one

but I don’t even think the likes of Debian had

started in the early days. I remember Red Hat

starting so I was into it before that.”

Little had been involved in a project called

DJGPP, which was a port of the GNU Compiler

Collection onto 16-bit DOS. It is, he concedes,

a ridiculous undertaking in hindsight, but

it meant developer tools could be obtained

on DOS without having to shell out money. “I

think that was before I even got the world wide

web, so at that time I had a modem but I was

dialling up to bulletin boards… and gettingsoftware that way,” he explains.

“And then when I got onto the internet

I just kind of continued in that vein. So I’d

already understood that this DJGPP was a

port of these GNU tools so… I started looking

at what they were and how I could use those

and eventually got brave enough to partition

my Windows machine and get Linux booted

on that. Before that I used to boot it from a

floppy… but yes, eventually I went over to dual

booting into Linux and in 1998 I went over at

home full-time to Linux… By the time I had a

decent laptop, I started with Debian but my

last three laptops have run Ubuntu.”

LITTLE AND LINUX

domain that was up for renewal.

Another programmer, Matt

Mullenweg, also used b2/

cafelog, or, as it was more

commonly known, b2,

and he was concerned

not only about Valdrighi’sdisappearance but

also about the lack of

development of b2. He

posted an article on his blog

called The Blogging Software

Dilemma which discussed how

he had come to be using b2, primarily

because it was the best of the bunch and

something he was able to develop. Mike Little

spotted this blog post and responded, asking

Mullenweg if he would be interested in forking

b2. Mullenweg said he would. The pair then got

together, albeit remotely over the internet.

“I’d communicated with Matt a couple of

times before because he had a website with

a really good gallery on it and I’d emailed him

to ask him about the software,” recalls Little.

“I’d actually communicated with him on the b2

forums as well, but I didn’t know he was the

same person as the one who ran the gallery

site. So when I saw his blog post about b2,

I was interested. As it turned out, I was the

only person who responded to his posting at

the time.”

Version oneMullenweg and Little took the b2 software

and began to work on it, fixing bugs and adding

extra features. Then Valdrighi reappeared. He

career has been based around

WordPress since he left full-time

employment in 2008.

WordPress has, therefore,

shaped his life. In between

mouthfuls, he tells us

all about the WordPressproject, barely pausing for

breath, and there is little

doubt that he is proud of the

part he played in the initial

years of WordPress’s inception.

If there was any doubt, then the

snazzy WordPress T-shirt he’s wearing

at our meeting certainly puts paid to that.

Before WordPressLittle has been programming professionally

since 1990. His first six years were spent at

an industrial software house called Pantek

in Stockport, where he became responsible

for a team of six and developed Visual Basic

apps, learned C++ and gained experience in

DOS, Windows SDK, assembler, Novell, TCP/IP

and Microsoft networks. After leaving Pantek,

he went on to work at various other software

companies in the Greater Manchester area, but

he was also an early blogger.

He used software called b2/cafelog which

had been written by Michel Valdrighi, the first

Corsican blogger. A small community had built

up around the software with around 2,000 active

users on the forum, but development of b2/

cafelog suddenly ground to a halt when Valdrighi

disappeared, leaving behind an app that had

a few bugs, a couple of security issues and a

66%Proportion of allWordPress sites

that are inEnglish

■ Matt Mullenweg’s WordPress.com website is run by his company Automattic

“That first releaseof WordPress had

a couple of extrafeatures I’d already

created for b2”

The story of WordPress co-founder, Mark Little

The other half of WordPress

Page 54: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 54/100

www.linuxuser.co.uk54

declared Mullenweg and Little’s software as

the official successor to b2. “It turns out he’d

been made redundant or something like that,

had to give up his flat, gone back to his parentswho didn’t even have internet and so on,”

smiles Little. “So it was just the real world was

much more important than a bit of software.”

WordPress was thus born.

It was January 2003. Little had been learning

PHP and he felt he would work his way around b2

and make alterations. “No software is perfect,

so it was just a case of thinking of things that

we wanted to add to it,” says Little. “That first

release of WordPress had a couple of extra

features that I’d already created for b2 and

the same for Matt: he’d had a couple of extra

features that he’d added to b2. We’d shared

these things on the forums and we kind ofincorporated those into the core project. And

yeah, we just took it from there.”

One of the biggest changes was the

introduction of Pages, which made a massive

difference to WordPress and set it apart from

its rivals at the time. It enabled WordPress to

become more than blogging software. But the

‘killer’ feature, Little says, came in the guise of

hooks. “It meant you could write additions to

the product without having to modify the code,

and that was something that only really biggrown-up software did, like some of the Java

Stacks,” says Little. “This ability to actually

change the way it behaves and add things to

it without having to touch any of the core files

was crucial. It’s still the hardest thing, I think, for

new developers to get their heads round how it

works, but I think that’s what made it

so much easier.”

He said it made the process

of updating the software so

much easier. “Prior to that,

with anything like Drupal

or any of those tools,

whenever there was anupdate you were in danger

of losing your changes

because you’d modified

original files to call your stuff

or to add somebody else’s stuff

in. You’d stick these function calls in

there. It meant that as soon as you got the

new version, if you just literally FTPed the new

one over the top of the old one, you were going to

lose your stuff and lose your modifications. So I

think that was probably one of the key features

and I don’t think it’s necessarily something

that people appreciate because these days

they just never see the problem. They update

WordPress or they update the plug-ins and oh,

it’s the new version, and nothing’s gone wrong.

And yet before then you had to save those

files you modified before you updated to the

new software.”

Mullenweg and Little continued to work on

WordPress and the first release came in May of

that year.

User-friendlinessLittle and Mullenweg saw WordPress as

an evolving product. Little worked on doing

what he could to eliminate the ability to makemistakes, which he believes was a crucial step

forward. “With the original b2, you could lose

your settings,” he says. “But with WordPress, I

added the config sample PHP and it just took

that ability to make a mistake away. I took what

was the original b2 settings file and created an

Options interface for it. It was another

file, you didn’t have to fiddle with

it - you didn’t have to know how

to edit these files and FTP

them back up to your server

and stuff like that. I think

all those bits helped make

it easier, made it harderto cock up and I think that

all helped.”

The need to be user-

friendly was at the forefront

of the minds of both developers.

It was also important for them that

WordPress, like b2, was an open source

project. They loved that b2 operated under a

General Public License, which meant they had

the freedom to take the code, change it and

distribute it to other people. They loved that

it was free too. “I’ve always been a huge open

source advocate,” says Little. “Matt was kind of

new to the open source idea, but that was one of

the reasons behind him choosing to use b2.”

Little attributes the popularity of WordPress

to its open source nature (“if it wasn’t open

source, if it wasn’t GPL, there wouldn’t be the

20,000 plug-ins that have been written for it or

the 10,000 themes,” he says) and it matters not

to him that he has not made any direct money

from WordPress. “Nobody does,” he says. “It’s

WordPress was not created in isolation.

Although Little and Mullenweg worked on

their own, with the expanse of the Atlanticocean separating them, they did look at other

blogging software being created at the time

and they took inspiration from it.

“There was definitely a lot of studying

of rivals and playing catch-up, seeing what

other people were doing,” Little says. “For

a very long time there was a lot of blogging

software and certainly you would see Blogger

or Moveable Type with features that were

cool and that we thought we might add to

WordPress. Eventually it started going the

other way round as well and these other apps

were copying features that had been added

to WordPress.”

TAKING INSPIRATION

18.9%The percentage

of the 10 millionwebsites in theworld that run

WordPress

“If it wasn’t open source, if it wasn’t GPL,there wouldn’t be the 20,000 plug-ins that

have been written for it”

Page 55: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 55/100

www.linuxuser.co.uk55

At SASCon 2013, Mike Little was presented

with the inaugural ‘Outstanding Contribution

to Digital’ award for his part in co-founding

and developing WordPress.

The award, which was handed out at

a conference at the new Manchester

Metropolitan University Business School,

acknowledged his instrumental role in

setting up and developing the rst version

of WordPress, which has become the most

popular content management system on

the internet.

Richard Gregory, one of SAScon’s

founders, said: “There isn’t a single digital

marketing agency that hasn’t made

generated income by building WordPress

websites, and we are honoured to be able to

recognise him with this award.”

OUTSTADGCOTRBUTOTO DGTAL

not sold and yes, I continued in my day job. Mattwent [to work] for CNET, which had just started

using WordPress for just a couple of things, and

they actually had him doing a standard software

development job. But they paid for him to work

one day a week on WordPress itself and I think

it was through working there that he met a guy

called Tony Schneider, who had just

sold some software to Yahoo! for

£25m or something like. Matt

had started Automattic at

this point. Schneider later

managed to help raise

funding for him and joined

the service that eventually

became WordPress.com.

But me, I continued in

my day job up until 2008.”

Carrying onLittle considered becoming

part of WordPress.com, which is a

blog web hosting service provider owned by

Automattic, but this was prior to the funding

and the company couldn’t afford to pay him a

wage. Today it is nancially supported via paid

upgrades, VIP services and advertising and can

pay wages, but in the early days there wasn’t

much cash for this and the bulk of the fund-

raising efforts went on infrastructure.

n The original posting, The Blogging Software Dilemma, on Mat Mullenweg’s website – and

Mike Little’s response

Up until the rst release, the developmentteam consisted of just Mullenweg and Little, but

ve people were working on the project by the

end of 2003 and it continued to grow after that.

By the end of 2005, Little wasn’t able to stay

involved. “I had issues at home, real-life issues

which meant that I couldn’t spend the time

working on this thing voluntarily,” he

says. “It was still a very techy thing,

a very geek thing, it wasn’t as

good and as user-friendly

as it has become today

and it certainly wasn’t

as prominent.”

Cash, he insists, is

something that does not

motivate him, however. “I

need to pay the bills and we

need to eat,” he says. “I am

the breadwinner of the house

and I always have been, but I just

wish I could put that side of things in

place and do what interests me from that point

on. There’s no doubting my passion for open

source computing.”

Indeed, he has read up on the philosophy

behind the General Public License and he has

devoured Richard Stallman’s story of how he

created the free software movement. “I not only

found it very inspiring,” he says, “it just seemed

the morally right thing to do, for me. The factis that, at the time, in the 1970s and 1980s,

software companies were effectively creating

articial scarcity, based on intellectual ideas

that were almost free to reproduce. Back then

rms were making oppy disks and putting

them in boxes and getting manuals printed and

they were charging £500 or £600 for a product

that had just £30 or £40 worth of materials.

As things moved on, it got easier and easier to

distribute software online where the distribution

costs and the reproduction costs approach zero,

so to then charge articial amounts on top of

that just seemed like the wrong thing to do.”

He hopes that future generations go down the

same path and release open source software.

“But rst, he says, “I think it is crucial that we

 just get kids learning how to code. There are

some good moves in that direction and I love

what is being done with the Raspberry Pi.

Suddenly, a school can’t say it cannot afford to

buy lots of computers to experiment with. These

are costing £25 each. It’s a great time to be in

computing and I feel it’s good to be putting back

in and helping people learn.”

Mike Little’s new website is at mikelittle.org 

but he also runs his company site, zed1.com.

 4billionThe number of page

views of WordPresswebsites from

April 2012 toApril 2013

The story of WordPress co-founder, Mark LittleThe other half of WordPress

Page 56: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 56/100

Tutorial MakeextensionsforXBMCwithPythonTutorial

www.linuxuser.co.uk56

Python is the world’s most popular easy-to-use open sourcelanguage. Learn how to use it to build your own features forXBMC, the world’s favourite FOSS media centre

MakeextensionsforXBMCwithPython

XBMCisperhapsthemostimportantthingthathasever happened intheopen sourcemedia

centre space. It started its lie on the original

Xbox videogames console and since then it has

become the de acto sotware or multimedia

afcionados. It also has been orked into many

other successul media centre applications such

as Boxee and Plex. XBMC has ultimately grown

into a very powerul open source application with

a solid community behind it. It supports almost

all major platorms, including dierent hardware

architectures. It is available or Linux, Windows,

Mac OS X, Android, iOS and Raspberry Pi.

In these pages we will learn to build extensions

or XBMC. Extensions are a way o adding

eatures to XBMC without having to learn the

core o XBMC or alter that core in any way. One

additional advantage is that XBMC uses Python

as its scripting language, and this can be also

used to build the extensions. This really helps

new developers get involved in the project since

Python is easy to learn compared to languages

like C/C++ (rom which the core o XBMC is made).

XBMC supports various types o extensions (or

Add-ons): Plugins, Programs and Skins. Plugins

add eatures to XBMC. Depending on the type

o eature, a plug-in will appear in the relevant

media section o XBMC. For example, a YouTube

plug-in would appear in the Videos section.

Scripts/Programs are like mini-applications or

XBMC. They appear in the Programs section.

Skins are important since XBMC is a completely

customisable application – you can change

ResourcesXBMC: www.xbmc.org/download

Python2.7xPythonIDE(optional)

List ofinstalledplug-ins

Current mediaselection

Rating (only available forhosted plug-ins)

Congurelauncher

Openschangelog forthe plug-in

Localiseddescription string

AdvisorKunalDeois a veteran open source developer.

Currently he is leading two opensource projects: WinOpen64 andKUN Wiki. He is also a KDE developer.He has contributed to many opensource projects, including KDE-Solaris, Belenix and Openmoko

the look and eel o just about every acet o

the package.

Depending upon which category your

extension fts, you will have to create the

extension directory accordingly. For example…

Plug-ins:

plugin.audio.ludaudi: An audio plug-in

plugin.video.ludvidi: A video plug-in

script.xxx.xxx: A program

In this tutorial we will build an XBMC plug-in

called LUD Entertainer. This plug-in will provide a

nice way to watch videos rom Reddit rom within

XBMC. Our plug-in will show various content such

as trailers and documentaries rom Reddit. We’ll

also allow our users to add their own Subreddit.

Each video can then be categorised as Hot, New,

Top, Controversial etc. With this plug-in we will

demonstrate how easy it is hook into XBMC’s

built-in method to achieve a very high-quality

user experience.

Due to space limitations, we aren’t able to print

the ull code here. You are highly recommended

to explore the cover disc to access the complete

code, which has many other amazing unctions.

Page 57: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 57/100

Use Python to create a new plug-in for XBMC

Make extensions for XBMC with Python

TUTORI

www.linuxuser.co.uk57

01PreparingthedirectorystructureAs we have mentioned previously, each

XBMC extension type follows a certain directory

naming convention. In this case we are building

a video plug-in, so the plug-in directory name

would be plugin.video.ludlent . But that’s just the

root directory name – we will need several other

folders and les as well.

The following describes the directory structure of

LUD Linux Entertainer:

plugin.video.ludent – Root Plugin directory

|-- addon.xml

|-- changelog.txt

|-- default.py|-- icon.png

|-- LICENSE.txt

|-- README

`-- resources

|-- lib

`-- settings.xml

02Creatingaddon.xmlAn addon.xml le needs to be created in

the root of the extension directory. The addon.xml

le contains the primary metadata from a XBMC

extension. It contains overview, credits, version

information and dependencies information about

the extension.

The root element of addon.xml is the <addon> 

element. It is dened as:

<addon id="plugin.video.

ludent" name="LUD HSW Viewer"

version="0.0.1" provider-

name="LUDK">

rest of the content is placed here

</addon>

Here, id is the identier for the plug-in, so

it should be unique among all the XBMC

extensions, and id is also used for the directoryname; version tells XBMC the extension

version number, which helps in its ability to

deliver automatic updates – XBMC follows the

Major.Minor.Patch versioning convention;name is

the English title of the plug-in.

Note:Steps 3 to 5 cover entries that need to be

added within the addon.xmlle.

03ddingdependencyinformationDependency inside an extension is

managed using the <requires>element.

<requires>

<import addon="xbmc.python"

version="2.1.0"/>

<import addon="plugin.video.

youtube" version="3.0.0"/>

<import addon="plugin.video.vimeo"

version="2.3.0"/>

<import addon="plugin.video.

dailymotion_com" version="1.0.0"/>

</requires>

In the above code we have added a dependency

to a library called xbmc.python version

2.1. Currently it is added as a mandatory

dependency. To make the dependency

optional you will need to add optional="true";eg <import  addon="kunal.special" version="0.1.0" optional="true" />

In the above example we have added core

dependency xbmc.python to 2.1.0 because it’s

the version shipped with XBMC version Frodo

12.0 and 12.1 . If you were to add xbmc.python

to 2.0 then it would only work in XBMC Eden 11.0

and not in the latest version.

For the current version of XBMC 12.1, the

following versions of core XBMC components

are shipped:

xbmc.python 2.1.0

xbmc.gui 4.0.0

xbmc.json 6.0.0xbmc.metadata 2.1.0

xbmc.addon 12.0.0

In addition to xbmc.python we are also adding

some third-party plug-ins as dependencies,

such as plugin.video.youtube. These plug-ins

will be installed automatically when we install

plugin.video.ludent.

04SettinguptheproviderandentrypointOur extension is supposed to provide the video

content for XBMC. In order to convey that, we

have to set up the following element:

<extension point="xbmc.python.

pluginsource" library="default.

py">

<provides>video</provides>

</extension>

Here, the library attribute sets up the plug-in

entry point. In this example default.py will be

executed when the user activates the plug-in.

The <provides> elements sets up the media

type it provides. This also gets reected in the

placement of the plug-in. Since ours is a video

plug-in, it will show up in the Videos section

of XBMC.

05Settingupplug-inmetadataMetadata about the plug-in is provided in

<extension point="xbmc.addon.metadata">. The

following are the important elements…

<platform>: Most of the time, XBMC extensions

are cross-platform compatible. However, if you

depend on the native platform library that is only

available on certain platforms then you will need

to set the supported platforms here. Accepted

values for the platform are: all, linux, osx, osx32,

osx64, ios (Apple iOS) , windx (Windows DirectX),

wingl (Windows OpenGL) and android.

<summary lang="en">: This gives a brief

description of the plug-in. Our example sets the

language attribute as English, but you can use

other languages too.

<description>: A detailed description of the

plug-in.

<website>: Webpage where the plug-in is hosted.

<source>: Source code repository URL. If you are

hosting your plug-in on GitHub, you can mention

the repository URL here.

<forum>: Discussion forum URL for your plug-in.

<email>: Author email. You can directly type email

or use a bot-friendly email address like max at

domain dot com.

06Settingchangelog,icon,fanartandlicenceWe need a few additional les in the plug-in

directory…

changelog.txt: You should list the changes made

to your plug-in between releases. The changelog

is visible from the XBMC UI.

An example changelog:

0.0.1

- Initial Release

0.0.2- Fixed Video Buffering Issue

icon.png: This will represent the plug-in in the

XBMC UI. It needs to be a non-transparent PNG

le of size 256x256.

fanart.jpg (optional): The fanart.jpg is rendered

in the background if a user selects the plug-in

in XBMC. The art needs to be rendered in HDTV

formats, so its size can range from 1280x720

(720p) up to the maximum 1920x1080 (1080p).

Page 58: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 58/100

www.linuxuser.co.uk58

Tutorial MakeextensionsforXBMCwithPythonTutorial

License.txt: This le contains the licence of

the distributed plug-in. The XBMC project

recommends the use of the Creative Commons

Attribution-ShareAlike 3.0 licence for skins,

and GPL 2.0 for add-ons. However, most of the

copyleft licences can be used.

 

Note: For the purpose of packaging, extensions/

add-ons/themes/plug-ins are the same.

07Providingsettingsfortheplug-inSettings can be provided by the le

resources/settings.xml. These are great for user-

congurable options.

Partial:resources/settings.xml

<settings>

<category label="30109">

<setting id="filter" type="bool"

label="30101" default="false"/>

<setting type="sep" />

<setting id="showAll" type="bool"

label="30106" default="false"/>

<setting id="showUnwatched"

type="bool" label="30107"

default="true"/>

<setting id="showUnfinished"

type="bool" label="30108"

default="false"/>

<setting type="sep" />

<setting id="forceViewMode"

type="bool" label="30102"

default="true"/>

<setting id="viewMode" type="number"

label="30103" default="504"/>

</category>

<category label="30110">

<setting id="cat_hot" type="bool"

label="30002" default="true"/>

<setting id="cat_new" type="bool"

label="30003" default="true"/>

</category>

</settings>

Here, label denes the language id string which

will then be used to display the label. id denes

the name which will be used for programmatic

access. type denes the data type you want

to collect; it also affects the UI which will be

displayed for the element. deault denes the

default value for the setting. You should always

use a default value wherever possible to provide a

better user experience.

The following are a few important settings

types that you can use…

text:Used for basic string inputs.

ipaddress: Used to collect internet addresses.

number: Allows you enter a number. XBMC will

also provide an on-screen numeric keyboard for

the input.

slider: This provides an elegant way to collect

integer, oat and percentage values. You can get

the slider setting in the following format:

<setting label="21223" type="slider"

id="sideinput" default="10"

range="1,1,10" option="int" />

In the above example we are creating a slider with

min range 1, max range 10 and step as 1. In the

option eld we are stating the data type we are

interested in – we can also set option to "oat"

or "percent".

bool: Provides bool selection in the form of on

or off.

fle: Provides a way to input le paths. XBMC will

provide a le browser to make the selection of le.

If you are looking to make selection for a specic

type of le you can use audio, video, image or

executable instead of le.

older: Provides a way to browse for a folder…

Example:

<setting label="12001" type="folder"

id="folder" source="auto"

option="writeable"/>

Here, source sets the start location for the

folder, while option sets the write parameter for

the application.

sep & lsep: sep is used to draw a horizontal line

in the setting dialog; lsep is used for drawing

a horizontal line with text. They do not collectany input but are there for building better user

interface elements…

<setting label="21212" type="lsep"

/>

08LanguagesupportLanguage support is provided in

the form of the strings.xml le located in

resources/languages/[language name]. This

approach is very similar to many large software

projects, including Android, where static strings

are never used.

resource/language/english/string.xml

example:

<?xml version="1.0" encoding="utf-8"

standalone="yes"?>

<strings>

<string id="30001">Add subreddit</

string>

<string id="30002">Hot</string>

<string id="30003">New</string>

<string id="30004">Top</string>

<string id="30005">Controversial</

string>

<string id="30006">Hour</string><string id="30007">Day</string>

<string id="30008">Week</string>

<string id="30009">Month</string>

<string id="30010">Year</string>

</strings>

As you may have seen in the settings.xml

example, all the labels are referring to string

ids. You can have many other languages as

well. Depending upon the language XBMC is

running in, the correct language le will be

loaded automatically.

Post XBMC Frodo (12.1), strings.xml will be

deprecated. Post Frodo, XBMC will be movedto a GNU gettext-based translation system;

gettext uses PO les. You can use a tool called

xbmc-xml2po to convert strings.xml into

equivalent PO les.

09Buildingdefault.pySince our plug-in is small, it will all be

contained inside deault.py. If you are developing

a more complex add-on then you can create

supporting les in the same directory. If your

library depends upon third-party libraries, you

have two ways to go about it. You can either place

the third-party libraries into the resources/lib 

folder; or bundle the library itself into a plug-in,then add that plug-in as the dependency in the

addon.xml le.

Our plug-in works with reddit.tv. This is the

website from Reddit which contains trending

videos shared by its readers. Videos posted on

Reddit are actually sourced from YouTube, Vimeo

and Dailymotion.

We will be starting default.py with the following

imports:

import urllib

import urllib2

import xbmcplugin

Page 59: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 59/100

www.inuxuser.co.uk59

Use Python to create a new plug-in for XBMC

Make extensions for XBMC with Python

TUTORIl

import xbmcgui

import xbmcaddon

Apart from xbmcplugin, xbmcgui and

xbmcaddon, the rest are all standard Python

libraries which are available on PyPI (Python

Package Index) via pip. You will not need to install

any library yourself since the Python runtime for

XBMC has all the components built in.

urllib and urllib2 help in HTTP communication.

socket is used for network I/O; re is used

for regular expression matching; sqlite3 is

the Python module for accessing an SQLite

embedded database; xbmcplugin, xbmcgui andxbmcaddoncontain the XBMC-specic routine.

10InitiaisingDuring the initialisation process, we will

be reading various settings from settings.xml.

Settings can be read in the following way:

addon = xbmcaddon.Addon()

filterRating = int(addon.

getSetting("filterRating"))

filterVoteThreshold = int(addon.getS

etting("filterVoteThreshold"))

In order to read settings of type bool you will need

to do something like:

filter = addon.getSetting("filter")

== "true"

We are also setting the main URL, plug-in handle

and the user agent for it:

pluginhandle = int(sys.argv[1])

urlMain = "http://www.reddit.com"

userAgent = "Mozilla/5.0 (Windows NT

6.2; WOW64; rv:22.0) Gecko/20100101

Firefox/22.0"

opener = urllib2.build_opener()

opener.addheaders = [(‘User-Agent’,userAgent)]

11ReadingocaisedstringsAs mentioned, XBMC uses strings.xml to

serve up the text. In order to read those strings,

you will need to use getLocalizedString.

translation = addon.

getLocalizedString

translation(30002)

In this example, translation(30002) will return

the string "Hot" when running in an English

environment.

12BuidingheperfunctionsIn this step we will look at some of the

important helper functions.

getDbPath(): This returns the location of theSQLite database le for videos. XBMC stores

library and playback information in SQLite DB

les. There are separate databases for videos

and music, located inside the .xbmc/userdata/

Database folder. We are concerned with the

videos DB. It is prexed with ‘MyVideos’…

def getDbPath():

path = xbmc.

translatePath("special://userdata/

Database")

files = os.listdir(path)

latest = ""

for file in files:if file[:8] == ‘MyVideos’

and file[-3:] == ‘.db’:

if file > latest:

latest = file

return os.path.join(path,

latest)

getPlayCount(url): Once we have the database

location, we can get the play count using a

simple SQL query. The MyVideo database

contains a table called les, which keeps a

record of all the video les played in XBMC by

lename. In this case it will be URL.

dbPath = getDbPath()

conn = sqlite3.connect(dbPath)

c = conn.cursor()

def getPlayCount(url):

c.execute(‘SELECT playCount FROM

files WHERE strFilename=?’, [url])

result = c.fetchone()

if result:

result = result[0]

if result:

return int(result)

return 0

return -1

The above table is an example of a les table.

addSubreddit():Our plug-in allows users to add

their own Subreddit. This function takes the

Subreddit input from the user, then saves it inthesubredditsle inside the addon data folder.

The following sets the subreddits le location:

subredditsFile = xbmc.

translatePath("special://profile/

addon_data/"+addonID+"/subreddits")

this translates into .xbmc/userdata/

addon_data/plugin.video.ludent/

subreddits

def addSubreddit():

keyboard = xbmc.Keyboard(‘’,

translation(30001))

keyboard.doModal()if keyboard.isConfirmed() and

keyboard.getText():

subreddit = keyboard.

getText()

fh = open(subredditsFile,

‘a’)

fh.write(subreddit+’\n’)

fh.close()

This function also demonstrates how to take

a text input from the user. Here we are calling

the Keyboard function with a text title. Once it

detects the keyboard, it writes the input in the

subreddits le with a newline character.

getYoutubeUrl(id): When we locate a YouTube

URL to play, we pass it on to the YouTube plug-in

(plugin.video.youtube) to handle the playback. To

do so, we need to call it in a certain format…

def getYoutubeUrl(id):

url = "plugin://plugin.

video.youtube/?path=/root/

video&action=play_video&videoid=" +

id

return url

idFie idPath strFiename payCount astPayed datedded

1 1 plugin://plugin. 2013-08-06 23:47

2 2 plugin://plugin. 1 2013-08-07 22:42

3 2 plugin://plugin. 1 2013-08-08 00:09

4 2 plugin://plugin. 1 2013-08-08 00:55

5 2 plugin://plugin. 1 2013-08-08 00:58

Page 60: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 60/100

www.linuxuser.co.uk60

Tutorial MakeextensionsforXBMCwithPythonTutorial

Similarly for Vimeo:

def getVimeoUrl(id):

url = "plugin://plugin.video.

vimeo/?path=/root/video&action=play_

video&videoid=" + id

return url

And for Dailymotion:

def getDailyMotionUrl(id):

url = "plugin://plugin.video.

dailymotion_com/?url=" + id +

"&mode=playVideo"

return url

Once we have the video URL resolved into the

respective plug-in, playing it is very simple:

def playVideo(url):

listitem = xbmcgui.

ListItem(path=url)

xbmcplugin.

setResolvedUrl(pluginhandle, True,

listitem)

13Populatingplug-incontentlistingxbmcplugin contains various routines

for handling the content listing inside the

plug-ins UI. The rst step is to create directory

entries which can be selected from the XBMC

UI. For this we will use a function called

xbmcplugin.addDirectoryItem.

For our convenience we will be abstracting

addDirectoryItem to suit it to our purpose, so

that we can set name, URL, mode, icon image

and type easily.

def addDir(name, url, mode,

iconimage, type=""):u = sys.argv[0]+"?url="+urllib.

quote_plus(url)+"&mode="+str(mode)+"

&type="+str(type)

ok = True

liz = xbmcgui.ListItem(name,

iconImage="DefaultFolder.png",

thumbnailImage=iconimage)

liz.setInfo(type="Video",

infoLabels={"Title": name})

ok = xbmcplugin.

addDirectoryItem(handle=int(sys.

argv[1]), url=u, listitem=liz,

isFolder=True)

return ok

On the same lines, we can build a function to

place links as well…

def addLink(name, url, mode,

iconimage, description, date):

u = sys.argv[0]+"?url="+urllib.

quote_plus(url)+"&mode="+str(mode)

ok = True

liz = xbmcgui.ListItem(name,

iconImage="DefaultVideo.png",

thumbnailImage=iconimage)

liz.setInfo(type="Video",

infoLabels={"Title": name, "Plot":

description, "Aired": date})liz.setProperty(‘IsPlayable’,

‘true’)

ok = xbmcplugin.

addDirectoryItem(handle=int(sys.

argv[1]), url=u, listitem=liz)

return ok

Based on the abstractions we have just created,

we can create the base functions which will

populate the content. But before we do that,

let’s rst understand how Reddit works. Most of

the Reddit content lters are provided through

something called Subreddits. This allows you to

view discussions related to a particular topic. In

our plug-in we are interested in showing videos;

we also want to show trailers, documentaries

etc. We access these using Subreddits. For

example, for trailers it would be reddit.com/r/

trailers. For domains we can use /domain; for

example, to get all the YouTube videos posted

on Reddit, we will call reddit.com/domain/

youtube.com. Now you may ask what is the

guarantee that this Subreddit will only list

videos? The answer is that it may not. For that

reason we scrape the site ourselves to nd

videos. More on this in the next step.

The rst base function we’ll dene is index().

This is called when the user starts the plug-in.

def index():

defaultEntries = ["videos",

"trailers", "documentaries",

"music"]

entries = defaultEntries[:]

if os.path.

exists(subredditsFile):

fh = open(subredditsFile,

‘r’)

content = fh.read()

fh.close()

spl = content.split(‘\n’)

for i in range(0, len(spl),

1):

if spl[i]:

subreddit = spl[i]

entries.

append(subreddit)

entries.sort()

for entry in entries:

if entry in defaultEntries:

addDir(entry.title(),

"r/"+entry, ‘listSorting’, "")

else:

addDirR(entry.title(),

"r/"+entry, ‘listSorting’, "")

addDir("[ Vimeo.com ]",

"domain/vimeo.com", ‘listSorting’,"")

addDir("[ Youtu.be ]", "domain/

youtu.be", ‘listSorting’, "")

addDir("[ Youtube.com

]", "domain/youtube.com",

‘listSorting’, "")

addDir("[ Dailymotion.com

]", "domain/dailymotion.com",

‘listSorting’, "")

addDir("[B]-

"+translation(30001)+" -[/B]", "",

‘addSubreddit’, "")

xbmcplugin.

endOfDirectory(pluginhandle)

Here, the penultimate entry makes a call to

addSubreddit. listSorting takes care of sorting

out the data based on criteria such as Hot,

New etc. It also calls in Reddit’s JSON function,

which returns nice easy-to-parse JSON data.

We have created a settings entry for all the

sorting criteria. Based on what is set, we go

ahead and build out the sorted list.

def listSorting(subreddit):

if cat_hot:

addDir(translation(30002),

urlMain+"/"+subreddit+"/hot/.json?limit=100", ‘listVideos’, "")

if cat_new:

addDir(translation(30003),

urlMain+"/"+subreddit+"/new/.

json?limit=100", ‘listVideos’, "")

if cat_top_d:

 

addDir(translation(30004)+":

"+translation(30007),

urlMain+"/"+subreddit+"/

top/.json?limit=100&t=day",

‘listVideos’, "")

xbmcplugin.

endOfDirectory(pluginhandle)

Page 61: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 61/100

www.inuxuser.co.uk61

Use Python to create a new plug-in for XBMCMake extensions for XBMC with Python

TUTORIl

In the code listed to the left here, we are

opening the URL, then – based on regular

expression matches – we are discovering

the location title, description, date, ups,

downs and rating. We are also locating

video thumbnails and then passing them on

to XBMC.

Later in the code, we also try to match the

URL to a video provider. With our plug-in we are

supporting YouTube, Vimeo and Dailymotion.

If this is detected successfully, we call the

helper functions to locate the XBMC plug-

in based playback URL. During this whole

parsing process, if any exception is raised, thewhole loop is ignored and the next JSON item

is parsed.

15Instaing&runningtheadd-onYou can install the add-on using one of

the following two methods:

• You can copy the plug-in directory to

.xbmc/addons.

• You can install the plug-in from the zip le. To

do so, compress the add-on folder into a zip le

using the command:

$ zip -r plugin.video.ludent.zip

plugin.video.ludent

To install the plug-in from the zip le, openXBMC, go to System then Add-ons, then click

‘Install from zip le’. The benet of installing

from a zip le is that XBMC will automatically

try to install all the dependent plug-ins as well.

Once you have the plug-in installed, you can

run it by going to the Videos Add-ons section of

XBMC, selecting Get More… and then clicking

on LUD Reddit Viewer.

You can access the settings dialog of the

plug-in by right-clicking the LUD Reddit Viewer,

then selecting ‘Add-on settings’.

So, you have seen how robust and powerfulXBMC’s extension system is. In this example,

we were able to leverage the full power of

Python (including those magical regular

expression matches) from within XBMC.

XBMC itself also offers a robust UI framework,

which provides a very professional look for

our add-on.

As powerful as it may seem, we have only

built a video plug-in. XBMC’s extension system

also provides a framework for building fully

edged programs (called Programs). We will

cover this in a later issue.

14Popuatingtheepisodeview(istingvideos)At this point we have the URL in hand, which returns JSON data; now we need to extract the

data out of it which will make sense to us.

By looking at the JSON data, you can see there’s a lot of interesting information present here. For

example, url is set to youtube.com/watch?v=n4rTztvVx8E; title is set to ‘The Counselor – Ofcial

Trailer’. There also many other bits of data that we will use, such as ups, downs, num_comments,

thumbnail_url and so on. In order to lter out the data that we need, we will use regular expressions.

There is one more thing to note: since we are not presenting directories any more but are ready to

place content, we have to set the xbmcplugin.setContent to episodes mode.

def listVideos(url):

currentUrl = url

xbmcplugin.setContent(pluginhandle, "episodes")

content = opener.open(url).read()

spl = content.split(‘"content"’)

  for i in range(1, len(spl), 1):

entry = spl[i]

  try:

match = re.compile(‘"title": "(.+?)"’, re.DOTALL).findall(entry)

title = match[0].replace("&amp;", "&")

match = re.compile(‘"description": "(.+?)"’, re.DOTALL).

findall(entry)

description = match[0]match = re.compile(‘"created_utc": (.+?),’, re.DOTALL).findall(entry)

downs = int(match[0].replace("}", ""))

rating = int(ups*100/(ups+downs))

if filter and (ups+downs) > filterVoteThreshold and rating <

filterRating:

  continue

title = title+" ("+str(rating)+"%)"

match = re.compile(‘"num_comments": (.+?),’, re.DOTALL).

findall(entry)

comments = match[0]

description = dateTime+" | "+str(ups+downs)+" votes:

"+str(rating)+"% Up | "+comments+" comments\n"+description

match = re.compile(‘"thumbnail_url": "(.+?)"’, re.DOTALL).

findall(entry)thumb = match[0]

matchYoutube = re.compile(‘"url": "http://www.youtube.com/

watch\\?v=(.+?)"’, re.DOTALL).findall(entry)

matchVimeo = re.compile(‘"url": "http://vimeo.com/(.+?)"’,

re.DOTALL).findall(entry)

url = ""

  if matchYoutube:

url = getYoutubeUrl(matchYoutube[0])

  elif matchVimeo:

url = getVimeoUrl(matchVimeo[0].replace("#", ""))

  if url:

addLink(title, url, ‘playVideo’, thumb, description, date)

  except:

  passmatch = re.compile(‘"after": "(.+?)"’, re.DOTALL).findall(entry)

xbmcplugin.endOfDirectory(pluginhandle)

  if forceViewMode:

xbmc.executebuiltin(‘Container.SetViewMode(‘+viewMode+’)’)

Page 62: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 62/100

Tutorial Master Vim in easy stepsTutorial

www.linuxuser.co.uk62

Take a step ahead, learn some advanced featuresand get more productive with the Vim editor

Master Vim in easy steps

Thanks to a steep learning curve, many people

either avoid using Vim or use it on a very basic

level. I you’re guilty o either o these then you’re

really missing out.

Vim, frst released in November 1991, is

a command-line-based text editor that was

developed by Bram Moolenaar as an improved

Vi clone or Amiga platorm. Besides including

all the eatures o the popular Vi editor, it also

contains a lot o new eatures and so derives

its name – rom ‘Vi improved’. As well as being

a text editor, Vim can be used as an integrated

development environment by sotware

programmers. Vim provides a wide range o

eatures, but as it is a command-line utility it has

a steep learning curve. Please note that Vim is not

a word processor, which means that you cannot

do layout-related changes with it.

While you will get to know about the real

strengths o the Vim editor once you master it,

on the whole some o the prominent pros include

ast text editing (because o little to almost no use

o the mouse) and easy execution rom anywhere

on the command line. There are also many GUI

ront-ends (like gVim) available or Vim.

Although it is command-line based, Vim has a

loyal ollowing and is extensively used by system

administrators and sotware programmers.

Though it is hard to learn and understand all the

eatures that Vim provides, in order to reap its real

benefts it is essential to master Vim or your day-

to-day work.

Through this article you will learn how to work

with multiple fles, how to indent and old code,

how to search and replace keywords, how to split

the Vim window horizontally/vertically, and many

other related eatures provided by Vim.

Note: This article assumes that you have some

basic knowledge (opening, editing, saving and

closing a fle) o the Vim editor.

ResourcesVim: www.vim.org/download.php

AdvisorHimanshu Arora is asoftware programmer, opensource enthusiast and Linuxresearcher. His articles have beenfeatured on IBM developerWorks,Computerworld and inLinux 

Journal . He (along with someother Linux freaks) blogs atmylinuxbook.com  

All the examplespresented in thisarticle are tested forVim version 7.3.547on Ubuntu 13.04

Just type :help andVim displays somevaluable info fornewbies, such asnavigation keys andkeyboard shortcutsto enable themouse in xterm orGUI etc

Type :help iccf and Vim displays

information(including weblinks)related to donations

for the needy inUganda as well as for

the development ofthe Vim editor

Page 63: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 63/100

Learn some advanced eatures o VimMaster Vim in easy steps

TUTORIa

www.linuxuser.co.uk63

01 Work with multiple flesWhile most regular users use Vim to

edit one fle at a time, it can also be used to edit

multiple fles in parallel. To open multiple fles

with the Vim editor, just provide names o all

these fles as arguments to the vim command.

The frst fle is displayed by deault. Type :n to

switch to the next fle, :prev (or :N) to switch

to previous fle, :b to switch to frst fle, :bl to

switch to last fle and :bwto close the fle.

02 Work with multiple flesSometimes it is required to open a

new or an existing fle while editing an already

opened set o fles. Well, this can be done by

typing :e ollowed by the flename (along with a

complete path i it’s not located in the current

working directory).

03 Get list o currently opened flesin Vim

To get the list o fles currently opened in the

Vim editor, just type :ls. This will display list o

opened fles along with other inormation like

the current line number o the cursor in a fle,

fle in current active window (represented by

%a), fle in previous active window (represented

by #) etc. Switch between current and previous

active windows by typing :b#.

04 Use wildcrd chrctersVim also supports wildcard characters

(like *, ? etc) while opening multiple fles at a

time. This is especially useul in cases where

multiple log fles begin with a common set o

characters like the current date (2013-08-05--

--.log), or where multiple programming source

fles have same language extension such as

.c or .cpp.

05 Copy-pste cross the flesAnother requent requirement is to

copy rom one fle and paste into another. For

this, you need to split the Vim window to open

both fles. This can be done either by using

the -o option with the vim command (vim  -o <file1-name> <file2-name>); or by opening

a fle with vim  <file1-name>, then opening

the second fle in split window mode rom

within the active Vim window with :split <fle2-

nme>. To switch cursor control between the

two windows, press Ctrl+w (a couple o times).Copy-paste operation across the fles can

be done as ollows: open fles in split mode (as

explained above); copy the required text rom

one fle; press Ctrl+w to switch the control to

the other fle; then paste the copied text.

You can also split a Vim window vertically.

All you need to type is :vsp <fle-nme> rom

within an active window.

Page 64: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 64/100

www.linuxuser.co.uk64

TutorialTutorial Master Vim in easy steps

09 Manual indentingAnother important feature that

Vim provides is code indentation. Software

programmers are required to indent their

code and Vim provides easy steps for code

indentation. To indent a single line of code,

you can use >> or << to indent the line to the

right or left respectively. Multiple lines can

also be indented using [number-of-lines]>> or

08 Fold blocks of codeAnother frequent requirement – which

software programmers usually have – is to fold

some blocks of code in order to save window

space. This helps them to focus on the required

code blocks. Vim does support block folds. For

this, the rst step is to bring cursor inside the

07 Close les without closing VimNormally, when the last open le is

closed, the Vim application also exits. But, if it

is required to close the last open le without

closing the application, then just type :bd.

This closes the current le and opens anempty buffer.

06 Close all lesTo close all the opened les in one go,

add ‘a’ to regular close options like :q, :wq or

:q!. So, to close all the les in a single shot, do

something like :qaor :wqa or :qa!. While most

regular usersuse Vim to editone le at a time,

it can also beused to editmultiple flesin parallel

braces of the function denition. For example,

bring the cursor to the rst line of the function

body. Once there, just type va}zf. As you type

this, you will observe that va is used to activate

visual mode in Vim, while } selects the complete

block including curly braces and zf enables

the fold.

To open the fold, press zo; to close it, press

zc. Make sure that the cursor is within the block

while performing fold open and close. Typing

va}zf creates a fold (that is invisible). zo and zc work only when a fold is created. An existing

fold can be deleted by typing zd.

Page 65: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 65/100

TUTORI

www.linuxuser.co.uk65

Learn some advanced features of VimMaster Vim in easy steps

12 Replace wordsVim also supports search and

replace operations. To execute a basic

replace operation, just type :%s/[keyword-to-search]/[keyword-to-replace-with] to

replace keyword-to-search with keyword-to-

replace-with.

This trick is good if you want to replace all

the occurrences of a searched keyword, but

what if it is desired to replace only selected

occurrences? Well, there is a way through

which you can run a search and replace

operation in interactive mode. This means

that Vim will conrm before replacing the

keyword each time. This can be done through

:%s/[keyword-to-search]/[keyword-to-

replace-with]/c.

The rst occurrence is always highlighted

and Vim displays a prompt (in green, at the

bottom) where you can input your choice of

whether you want to replace this occurrence

or not. Here, y = Yes, replace this occurrence;

n = No, skip this occurrence; a = Replace

this and all other occurrences; q = Quit the

command; l = Replace this match and then quit

the command.

Use Ctrl+e (^E) and Ctrl+y (^Y) to scroll the

window up and down in this mode. Also, use i 

and I (along with /c, for example /ci or /cI) for

case-insensitive and case-sensitive search.

11 Search wordsTo search for a word in the active

window, simply type /[search keyword]. This

will enable Vim’s search mode and nd the

rst occurrence of the searched keyword.

Use n (just press n) in order to search more

occurrences of the keyword. Note that you

cannot do a backward search here.

If you need to do a backward search then

 just type :?[search keyword]. This will enableVim’s backward search mode. Again, use n to

continue the search, but backwards this time.

Sometimes the keyword is present in the

text/source le and it is desired to nd other

occurrences of that word in the current text/

source le. In this case, just put the cursor

below that word and press * (ie Shift+8). This

way, you can search for a word without even

typing it.

10 utomatic indentationFor those programmers who want

everything automated, Vim also provides anauto-indenting feature. For example, to enable

auto-indenting for C code, use :set autoindent 

and :set cindent. Now, try writing some C

code and you will see that Vim automatically

produces indentation as you write it.

Sometimes, depending upon the existing

settings of your Vim editor, lines might get

indented to a number of spaces other than

four spaces or any other default value that

you desire. As a solution to this, you can

set the number of spaces to indent using

:set shiftwidth=<number-of-spaces>. For

example, use :set shiftwidth=4 to indent lines

by four spaces.

 For those programmers who wanteverything automated, Vim alsoprovides an auto-indenting feature

[number-of-lines]<<; for example, 10>> or 10<<.

This is a better technique than indenting each

line, but you still need to count the number oflines to indent. This could prove frustrating,

especially if the number of lines is very large.

Fortunately, there is another trick: to select

the lines by working with Vim in visual mode. In

order to do this, you rst need to bring Vim into

visual mode. This (as mentioned previously) can

be done using va. Once in visual mode, use the

arrow keys to select all the lines that you want

to indent in one go. After this, all you need to do

is press > or < and the whole selected area will

be indented accordingly.

Page 66: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 66/100

Tutorial Make a Python Twitter clientTutorial

www.linuxuser.co.uk66

Learn the basics of the Twitter API using Python libraries andcreate a simple Twitter client to make and monitor tweets

Make a Python

Twitter clientPython has many strengths, and one of them

is the way you can use it to create lightweight

desktop software and packages for the

Internet of Things. One o the services used or

this is Twitter, which has a ew Python APIs you

can make use o in a Python script to check and

post the tweets rom a specifed user.

With this you can create a standard Twitter

client in the command line, or make a UI or it

with Tkinter (rom previous issues o LUD). You

can also speciy the login details you’d normally

ask or rom a client and then use it to check or

specifc words on Twitter, retweets, messages

received, or i a specifc person is sending tweets.

For this tutorial we’ll be using Twython, which

provides a pure Twitter interace or Python, and

show you how to get your own unique API key to

use it with Twitter itsel.

ResourcesA Twitter account

Python 2: www.python.org/ 

AdvisorRob Zwetsloot modelscomplex systems and is a webdeveloper procient in Python,Django and PHP. He loves toexperiment with computing

Access the entire dataset of Twitter via

the Python wrapper, allowing you to grab

timelines, lists and user proles among others

Write your own tweets in Python

using the Twython module to access

components from the Twitter API

Create your authentication keys

for your user and OAuth, letting

you tap into the Twitter API

Create your own app details by using

the Twitter Developer account tools,

either for personal use or for an app

you intend to release

Page 67: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 67/100

Create a simple Twitter client to make and monitor tweets

Make a Python Twitter client

TUTORI

www.linuxuser.co.uk67

01 ccountabilityTo create a Twitter app, you need a

Twitter account. Sign into your account, or

create a separate one if you want to split up

personal and development accounts on the

service. Once that’s done, go to dev.twitter.com

and log in using your desired account.

02 New beginningsGo to ‘My applications’ and click ‘Create

a new application’. Here you’ll need to enter the

app’s name, a short description and a website

where more details about yourself and/or

the app can be found. Names of apps are not

allowed to use the word Twitter in them.

03 PrivilegesAfter this has been created, you’ll be

brought to the details page of the app. Before

we go any further, click on Settings and select

Read, Write and Access Direct Messages under

Application Type so that we can use it properly

as a Twitter client.

04 ccess tokenWe can now create an access token

for the application to work with your Twitteraccount. Go back to the details once the read

and write permissions have been changed,

and scroll down to the bottom. Click ‘Create my

access token’ to retrieve it.

05 Install PipWe’ll install the latest version of python-

twitter from its website. To do this, rst install pip

on your system, available in repos as python-pip.

As we’re using Debian, this looks like:

$ sudo apt-get install python-pip

…which allows us to set up Python modules.

06 Install TwythonNow that we have Pip installed, we

can go ahead and install Twython. To do this,

continue in your terminal and put:

$ sudo pip install twython

This will get the Twython module, and all the

OAuth packages you need to log into your

account with tokens we created.

08 pp keysAdd the following to your code:

APP_KEY = 'YOUR_CONSUMER_KEY'

APP_SECET = 'YOUR_CONSUMER_SECRET'

…replacing YOUR_APP_KEY and YOUR_APP_

SECRET with your own consumer key and

consumer secret respectively.

07 uthentication fleWe need to create a Python le to hold

all our authentication details. Start up IDLE, or a

text editor of your choice, and start by importing

Twython with:

from twython import Twython

Make sure you have the keys we created earlier

handy to add in the next parts.

If the output is long, type ‘it’ to go to the next screen.

 We need tocreate a Pythonfle to hold all ourauthenticationdetails. Start

by importingTwython

Page 68: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 68/100

www.linuxuser.co.uk68

10 VerifcationNow’s a good time to verify if what

you’ve done so far actually works. Enter the

following at the bottom of the script:

twitter = Twython(APP_KEY, APP_SECRET,

OAUTH_TOKEN, OAUTH_TOKEN_SECRET)

twitter.verify_credentials()

And run. If it doesn’t come up with any errors, it’s

all working ne.

TutorialTutorial

12 Write a postLet’s create a simple way to post tweets

to your timeline via our script. We’ll use human

input like so:

post = raw_input("Write your tweet: ")

…which will store our tweet as a string in post.

15 Full timelineWe can access the account’s full timeline

by using theget_home_timeline variable like so:

twitter.get_home_timeline()

If you printed this out, it would display all the

unltered data from the last 20 tweets on

your timeline. You can modify the amount of

tweets by adding the count parameter to the

get_home_timeline. We’ll set it to ve for now:

twitter.get_home_timeline(count = 5)

We’ll need to parse the data to make sure we

get something coherent and recognisable as

a timeline.

14 TimelineTo access the timeline of our account

tweets, we use the following:

twitter.get_user_timeline()

This accesses the past 20 posts our account has

made. You can specify which timeline to check as

well by adding the screen_name option:

13 UpdateTo post this, we use the update_status 

bit from before, only it now uses the string from

post to update our timeline. Add:

twitter.update_status(status=post)

And then save the le. Run it, and test the

code again.

11 Test postAs it all seems to be working, you could

try making a test post straight to Twitter. At the

bottom of our code, enter:twitter.update_status(status='Test')

And then run it again. If it’s successful, there will

be no errors and it will show up on your timeline.

 Create a simpleway to posttweets to your

timeline

09 Access keysNow we add the access tokens that we

created to the script with:

OAUTH_TOKEN = 'YOUR_ACCESS_TOKEN'

OAUTH_TOKEN_SECRET = 'YOUR_ACCESS_SECRET'

…where again you’ll need to replace YOUR_

ACCESS_TOKEN and YOUR_ACCESS_SECRET

with the relevant numbers.

Make a Python Twitter client

twitter.get_user_timeline(screen_name

= 'username')

Page 69: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 69/100

TUTORI

17 FollowTo follow someone on Twitter, we use the

create_friendships function. We need either the

screen name or numerical ID of the Twitter user

you want to follow – you’ll most likely be using the

screen name, so we’ll write it like so:

twitter.create_friendship(screen_name

= 'LinuxUserMag')

18 RetweetingAs retweets are an integral part of Twitter,

the function for this is simply retweet. We require

the tweet ID for this, the numerical string used for

each tweet and displayed in the URL for a tweet.

We use it with:

twitter.retweet(id = '12345')

19 FavouritingThis works very similar to retweets, using

the unique ID for the tweet used in the URL to

determine which tweet to favourite. The function

for this is create_favorite, and is written as:

twitter.create_favorite(id = '12345')

Make sure to use the American spelling (favorite)when doing this.

16 Search tweetsWe can search Twitter for specic

keywords using the following:

twitter.search(q='linux')

This will return a mixed result of tweets relating

to the word Linux. You can lter them with the

result_type parameter, by setting it as mixed,

recent or popular.

20 

Retrieve favouritesAll of a user’s favourites are stored by

Twitter so that you can recover them at any time.

You can either get your own, or specify a user to

get the favourites from. The basic code is:

twitter.get_favorites()

…which will get your own favourites. As

before, you can specify the user ID number or

screen name with user_id and screen_name

respectively to get a specic list.

21 MentionsYou can also access the list of mentions

for your authenticated account. To do this,

use the get_mentions_timeline function. This

works like the other timelines, allowing you limit

the amount of posts you get from the selection.

Limit it to ve like before with:

twitter.get_mentions_

timeline(count='5')

22 Trending topicsEveryone knows what everyone else

is talking about thanks to Twitter’s trending

topics, whether it’s a young Canadian musician

or important world events. You access the

trends with:

twitter.get_place_trends(id = '1')

An ID of 1 returns global trends. You can specify

different IDs for different locales.

23 Retrieve listIf you prefer to use Twitter by curating

lists of people, you can get the contents of any

list using the get_list_statusesfunction:

twitter.get_list_statuses(id =

'12345')

Each list has a unique ID, or a slug, that you can

use. You can also call members of any list, or

anyone that subscribes to it.

24 The endWith all these functions, you can start

picking and choosing data and making our code

do a lot more than just post tweets. Getting

specic attributes from the timeline functions

will allow you to display a coherent timeline, and

it also includes the details needed to follow the

links to the users and their links.

www.linuxuser.co.uk69

Create a simple Twitter client to make and monitor tweetsMake a Python Twitter client

Page 70: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 70/100

Page 71: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 71/100

www.linuxuser.co.uk71

Essential kit, software and resources for the open source scene

Review index

REVIEWS

How we reviewOur experts thoroughly testthe kit and grade it using thefollowing 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

Software82 Sparky Linux 3.0

One of the first distros to useDebian 7.0 ‘Jessie’

Wireless Inventors Kit

“An easy way to getstarted with wireless

microcontroller

development”

79 Nook HD+The perfect mix of lowcost and high performance?

Hardware

 85  The latest Linuxreads dissected 

Books

12 MinnowBoard Has the Raspberry Pireally met its match?

72  IDE

super-test Enhance your workflowwith the best devenvironments…

Code::Blocks

Eclipse

Geany

Netbeans

Group Test

Page 72: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 72/100

GROUP TEST

www.linuxuser.co.uk72

Integrated development environment group testReview

In this test, we’ll be looking at the more fully

featured, multi-language IDEs, rather than

specialised single-language environments

or lightweight equivalents. We’re also testing

these IDEs for their abilities to be expanded

through plug-ins and add-ons – either for other

languages, or different interface effects.

We pit four of the best IDEs against each other to find out which is the best

way to streamline and enhance your workflowThe humble IDE can be a very powerful tool for

any coder – whether it’s for hobby programming

or used professionally. With all the various

programming languages one can use, there’s

an even greater number of IDEs that can help

you write code in them – each with their own

advantages and disadvantages.

Integrated developmentenvironments

We’ve chosen Eclipse, Code::Blocks, Geany

and Netbeans for this review. While they’re

not included, KDevelop and Anjuta are other,

desktop-environment-specific IDEs that are

also great. We’ve chosen platform-independent

IDEs for this test, although those two will

generally work fine on other desktops.

Page 73: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 73/100

A relatively new IDE, Code::Blocks was first

released in early 2008 after three years

of release candidates. Although a C++ IDE

by default, it has plug-in support to extend its

functionality to allow for building and testing

of other languages. However, for pure coding,

Code::Blocks can be used to write scripts in

various languages thanks to support for syntax

of a variety of different languages. However, you

cannot test these without add-ons.Unfortunately, the plug-in scene for

Code::Blocks is fairly immature and there isn’t

even proper support for Python and other

interpreted programming languages. Plug-ins

are found via the Code::Blocks wiki and are not

particularly well laid out at the moment. Plug-ins

are installed manually, which would be fine

normally, but the other IDEs in the test have some

interesting ways of managing plug-ins that make

this method seem somewhat archaic.

While you won’t be able to properly debug

test code, the interface for Code::Blocks is still

very nice for actually writing your code. Projects

are handled via proprietary projects files whichlink to specific folders. Projects don’t need to be

created with a specific language in mind and, like

some text editors, it will smartly know to highlight

the syntax for different languages. Browsing

doesn’t always work for all functions and classes;

however, it will allow you to perform simple code

editing to test elsewhere if you specifically like

the interface.Code::Blocks is also quite customisable,

allowing you to change the look and behaviour of

the editor, the way the compiler works and even

editing the startup script for the application itself.

Four of the best IDEs go head to head

Integrated development environment group test

REVIEW

www.linuxuser.co.uk73

Code::Blocks

■ There are a few first-party plug-ins available, but not many third-party

■The interface is nice and aids workflow

SCORES

Installation

Available in repos, but

binaries and source

code is easily accessible

elsewhere8

Workflow

Code::Blocks’ interface

is generally good for

workflow, although

it doesn’t support alllanguages properly 7

Features

A great selection of

features that can all be

heavily customised 7

Plug-insupport

Very limited right now,

meaning that not all

languages are

properly supported4

Overall

Code::Blocks has a great

interface, and some great

ideas on how to code and

manage projects, but the

plug-in selection needs to

be improved

6

“Unfortunately, the plug-in scene forCode::Blocks is fairly immature”

Code::Blocks is a nice piece of software,

although due its immaturity it doesn’t quite have

the best plug-in support of the other IDEs in this

test – especially if you want to use it for multi-language programming. It’s a bit lighter than

Eclipse at least, and the interface is well laid out,

but it may still be a few years before it becomes

preferable to the others.

A more open IDE originally for C++, butnow able to do a bit more

Page 74: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 74/100

www.linuxuser.co.uk74

n The native languages are supported quite well with compilers and such

Geany is sometimes mistaken or a glorifed

text editor. In reality, it’s a ull IDE, albeit slightly

more lightweight than most.

Geany has multi-language support out othe box, with easy options to create fles that

use dierent languages as part o the main

interace. Projects are kept in specifc olders,

like Eclipse, although there is a fle to go with

them that Geany can read to manage the

projects. Multiple projects can be viewed and

edited at a time, all in dierent languages. There

are also debuggers and builders or the various

languages that support them, and you can run

and test stu like Python that doesn’t need

compiling as such.

The rest o the interace or Geany is clean and

well labelled. Code is automatically highlighted

with the correct syntax and there’s a smarttab in the let column that allows you to track

and view the dierent variables, unctions and

classes in the projects and code. Navigation

through the code is airly simple via context-

sensitive menus and nice options within the

rest o the interace, and the usual code-editing

tools such as commenting out a selection or

indenting are all present.

Sadly, Geany’s plug-in support is pretty dire.

Some plug-ins extend the basic unctionality or

a ew o the languages, but there’s not the kindo depth as Netbeans or Eclipse in the sheer

number o available plug-ins.

There are a lot o ways to customise

Geany with the standard tools and menus,

though. Almost every part o the interace

and workow is editable, with ways to

even change the characters required or

autocomplete suggestions.

Geany

nGeany’s interace is smart and easily breaks down code or workfow purposes

Geany is a very smart IDE, with a low barrier

to getting your project started straight away. It

does lack in some o the eatures o some othe bigger IDEs, such as more advanced unit

testing and debugging, although it will let you

browse compile errors. The plug-in selection is

also pretty poor, so it may not be extensible or

specifc unctions.

A ully eatured IDEthat’s a little morelightweight than most

SCORES

Installation

Readily available in

most repos and requires

minimal dependencies 9

Worklow

Workfow is superb or

the variety o dierent

languages included

9Features

No proper debugger,

but a great selection

o build and project

management unctions7

Plug-insupport

Although it doesn’t quite

need it like the others,

there are very ew

plug-ins available4

Overall

Geany is a great,

lightweight IDE with

good native support or a

variety o languages, but

there’s not much room

or expansion

8

Review Integrated development environment group test

“Code is automatically highlighted withthe correct syntax”

Page 75: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 75/100

www.linuxuser.co.uk75

Eclipse is one of the most popular developmentsuites around, and at first glance it’s easy to see

why. While created mainly for Java development,

Eclipse is highly customisable through plug‑ins.

Thanks to its popularity and community, this

has resulted in a great selection of add‑ons

that enables Eclipse to work with just about

any language. These plug‑ins allow for more

than that, with a marketplace full of interface

and behavioural modications alongside the

language elements.

Eclipse has great project management

tools as well, with a smart tabbed interface,

and plug‑in‑specic menu entries for starting

projects in different IDEs if needed. Projects arelocated in plain folders in the location of your

choice, allowing for easy access of source code if

you need it, instead of being inside a proprietary

le. The function search ability works well and

the interface has plenty of tips and warnings for

anything that might be inefcient in terms of the

code. There are plenty of editing tools too, such

as simple indent or dedent options.

The debug suite in Eclipse is fully featured,

with various ways to run, check and unit‑test

code, although this depends on the plug‑ins to

some degree. The tools are there, though, and

most of the major plug‑ins seem to use them.The plug‑ins are handled by a repository

system, which lets you keep any add‑ons

up to date. While there aren’t a huge amount

available by default, it’s easy enough to add

more to the plug‑in manager and you can even

Eclipse

select which extensions to install from each of

the repositories.

Eclipse is customisable in other regards, with

an expansive properties and settings menu

that lets you edit a huge amount of the native

behaviour of the IDE, from the way patches

are viewed to little things like key bindings and

other shortcuts. Eclipse is a fairly big suiteof packages, though, and easily the biggest

resource hog out of all of the IDEs we’re testing.

It does have probably the best extensibility of all

these IDEs, however, meaning it also probably

has the most to offer those who work on a lot of

differing projects.

n Code navigation and highlighting aids your workflow

n Plug-in support for Eclipse is top-notch

The ubiquitousEclipse is an industrystandard – how doesit fare against morecommunity-run efforts?

SCORES

Installation

Eclipse requires a lot of

dependencies; however,

it’s available in most

major repos7

Workflow

Smart interface design

that lets you easilynavigate projects

and code 9

Features

A great set of features by

default, although mainly

for handling Java 8

Plug-insupport

The best support around,

with a great repo system

offering a wealth of

add-ons10

Overall

Eclipse is popular for a

reason – its got a great

selection of features that

are easily extensible to

suit almost any need

9

REIEWFour of the best IDEs go head to head

Integrated development environment group test

“A great selection of add-ons enables it towork with just about any language”

Page 76: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 76/100

www.linuxuser.co.uk76

nThe interface is not particularly well laid out

Netbeans started life as a humble student

project to make a Java IDE in Prague. Within a

few years, a company had been set up around

the IDE, and then had been bought by SunMicrosystems. The rest is history and after

over 15 years of development, Netbeans is on

version 7.3.

Netbeans has a very similar feature-set to

Eclipse, with debuggers, compilers, unit testers

and the like, although by default Netbeans

has support for PHP and HTML as well as its

Java-specic features. Netbeans also has a

huge database of plug-ins to call from, allowing

you to extend its features to just about any

programming language. These plug-ins are

nicely arranged in a database format on the

Netbeans website, with simple search functions

and a fairly easy way to install the plug-ins to thesystem. There’s no repository function for the

plug-ins like Eclipse, but the database displays

enough information to know if you’re getting the

latest version of the plug-in.

The interface is a little confusing – not very

well streamlined and aesthetically a little dated.

While the splash screen is nice for starting new

projects, the rest of the interface is cluttered

nNetbeans has a nice welcome screen to start new projects

Review

NetbeansThe Oracle-developedJava developmentplatform that multitasks

SCORES

Installation

Packages are readily

available for Netbeans

and it requires a

Java install8

Workflow

The interface is a little

cluttered and convoluted,but there are some decent

options to be found 7

Features

A similar feature-set to

Eclipse, but not as much

customisation 7

Plug-insupport

A fairly large selection

of plug-ins are available

for it within an easy-to-

search database8

Overall

Netbeans just misses the

mark with a slightly dated

interface, but it’s made up

for somewhat with a good

selection of plug-ins

7

Integrated development environment group test

and some functions are hidden away in weird

menu options. The code view is not particularly

well handled, with syntax highlighting a littlesparse. The function navigator is fairly nice,

though, with the sidebar allowing you to track

the hierarchy a little better than some.

Customisation in Netbeans is handled with a

nice-looking options menu, but there just isn’t

quite the same level of customisation as Eclipse

or the others. However, for similar customisation

tasks, it’s a little better laid out than Eclipse.

Overall, Netbeans seems like it’s a little

behind the times, with an interface that needs

a small overhaul and a better selection ofcustomisation options. It’s by no means a

bad IDE, with a great suite of debugging and

testing options to use on code. On the other

hand, Eclipse is equal or better in almost

every regard.

“There just isn’t quite the same level ofcustomisation as Eclipse or the others”

Page 77: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 77/100

Installation

Available in repos andvia binaries on thewebsite 8

Requires fewdependencies andeasy to come by 9

A big suite ofpackages, but readilyavailable 7

In most major reposand doesn’t havemany dependencies 8

Workfow

Good for thelanguages that aresupported 7

Great workowideas, with easy codenavigation 9

Project managementis excellent and codenavigation is good 9

A nice workowview, but theinterface is alittle dated

7

Features

A decent selection of

features for C++

7There’s not a proper

debugger for Geany

7Eclipse is a feature-

full IDE and is highlycustomisable 8

A decent debugger

and reasonablecustomisation 7

Plug-in

support

Code::Blocks’ plug-insupport is immatureand badly distributed 4

Geany does nothave many availableplug-ins 4

Eclipse has the bestselection of plug-ins inthis test by a long way 10

A huge database ofplug-ins, althoughsome are a bit old 8

Overall

A bit disappointingas of yet, butCode::Blocks showssome potential

6A great lightweightIDE that may not bethe best, but it’s stillrecommended

8Ubiquitous for areason, Eclipse hasa lot of things goingfor it

9Netbeans just fallsshort of the otherIDEs with somemissing features

7

EclipseWe were actually a little surprised that Eclipse

was this good compared to the other IDEs

in this month’s group test. It offers excellent

project management features, while its hugely

expansive plug-in list means that you can make

it work just about any way you want it to – much

more so than Geany or Code::Blocks.

Geany is denitely a close runner-up,

though, and while we’re not specically looking

at lightweight IDEs this time, it does have a

great selection of features while being light on

system resources. The only thing that really

let it, and Code:Blocks, down was its lack of

plug-in support.

Code::Blocks still needs some development

time, and more community involvement, to

make it a truly great IDE. It’s good to work

with for C++ for now, and we’d recommend

it for that, but it just doesn’t have enough to

recommend it for multi-language work.

Eclipse, on the other hand, has a great

balance of all the aspects we’re looking for in a

multi-language IDE and that’s why it takes the

editor’s choice award.

 Rob Zwetsloot

AND EWINNE I…

In brief: Compare and contrast our verdicts

nEclipse can be anything you want it to be

www.linuxuser.co.uk77

www.linuxuser.co.uk

GROUP TEST

WINNER

EIEWFour of the best IDEs go head to head

Integrated development environment group test

“Oers excellent projectmanagement eatures and ahugely expansive plug-in listto work any way you want”

Code::Blocks Geany Eclipse Netbeans

Page 78: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 78/100

Page 79: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 79/100

www.linuxuser.co.uk79

REVIEW

Nook HD+Low-cost Android tablet

www.nook.co.uk

Moreinformation

With the future of the Nook brand looking decidedly murky,

it may not seem like the best time to be investing in one of

its tablets. Or maybe it is. With price drops aplenty, Barnes

and Noble’s answer to the Kindle Fire represents perhaps

the cheapest way to get a high-quality tablet – hi-res display,

fast performance and full Play Store access. It’s also fully

hackable, so even if you don’t like the Nook’s UI you can

switch it to proper Android.

The Nook HD+, with its 9-inch display, feels pretty good in

the hand with solid construction and weighty feel. The design

is distinctive in good and bad ways. A large bezel around the

screen is not as offensive as it might have been, while the ‘n’-

shaped Home button gives the tablet subtle branding. On the

downside is the weird hole in the bottom corner that serves

no apparent purpose. It looks as though you’re supposed to

attach a lanyard, but the tablet is far too big and heavy for

that to be practical.

The screen is the Nook’s standout feature. With a

resolution of 1920x1280, a pixel density of 257ppi, it is close

to the level of the Retina display on the iPad and is wonderful.

Text is sharp and crisp and it is very easy on the eyes. We did

find the screen to be lacking in brightness, however. Perhaps

this is because the tablet is intended primarily as an eReader

and so needs to have less glare, but for general use we

had the brightness cranked up to the max, and would have

preferred even more.

The software is also built for eBooks. Like Amazon’s Kindle

Fire series the bulk of the UI is built around encouraging you

to buy content, but unlike with the Kindle you do get the full

set of Google apps, and Play Store access as well. There

are a number of apps pre-installed, ranging from Spotify

to Pinterest to a crosswords app, and none of these can be

removed. You will need a Nook account before you can start

using the tablet, and will also need your Google account

details to access the Play Store.

With a bit of work you can get the Nook looking pretty much

like a normal skinned Android 4.0 tablet. We wouldn’t count

on getting OS updates, but it is rootable and there are Jelly

Bean ROMs available. There’s a good chance there will be

KitKat (Android 4.4) ROMs in future too.

 Sandra Vogel

Operating system Android 4.0

  Processor 1.5GHz dual-core

Memory 1GB RAM, 16-32GB storage

Dimensions 240.3 x 162.8 x 11.4mm

  Weight 515g

Display size 9-inch 

Display resolution 1920 x 1280 pixels

Expansion slot microSD

Technical specsTABLET

Nook HD+ £179

ProsGreat screen andexemplary battery life;quite hackable too

ConsPre-installed apps can’tbe removed; some strangedesign decisions

www.linuxuser.co.uk79

SummaryThe Nook HD+ is a pretty good device. With nice hardware

and a good display, it’s surprisingly flexible: you can use it as a

casual eBook optimised tablet, for the full set of Android apps,

or open it up to hacks and tweaks.

Is this low-cost, hi-res tablet alternative to the Kindle Fire anAndroid hacker’s dream device?

■ The display has a

high pixel density

and is great for

reading eBooks and

watching videos.

We would have

preferred a bit more

brightness to it

■ The Nook has a fully customised skin, but does have

access to the full range of Google apps, plus the Play Store,

so you can Android-it-up a bit more

■ The hole in the

corner is a Nook

trademark. We

can’t say whether

it is supposed to be

functional or not

Page 80: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 80/100

RasWIK

www.linuxuser.co.uk80

Review

While it’s easy to see the Arduino and the Raspberry Pi

as competitors – they’re both low-cost electronic devices

aimed at the hobbyist market, after all – in truth they’re

extremely complementary: the Arduino excels at real-time

control and sensing, while the Pi provides cheap network

connectivity and powerful data processing capabilities.

That’s clearly been the thinking of Ciseco in designing the

Raspberry Pi Wireless Inventors Kit, or RasWIK: a bundle of

components and accessories, it’s designed to make working

with the Arduino on the Raspberry Pi as simple as possible

and showing users just what potential is opened up when the

two are connected over a radio link.

Designed to mate a wireless Arduino microcontroller with

the Raspberry Pi, is the RasWIK what budding developershave been waiting for all this time?

Getting started couldn’t be easier: the kit includes a 4GB

SD card with a customised version of the Raspbian operating

system. Simply slide this into the Pi, pop the bundled Slice of

Radio board onto the GPIO header and apply power.

The SD card includes an open source example utility for

controlling the included Arduino clone, a radio-equipped

microcontroller dubbed the XinoRF. Using this tool, a visual

representation of the board appears on screen – and allows

the user to turn outputs on and off, or read values from digital

or analogue input pins.

With nothing connected to the Arduino, that would

soon get pretty boring, but the kit also includes numerous

ProsThe easiest wayto get startedwith wirelessmicrocontrollerdevelopment usingthe Raspberry Pi

ConsThe LLAP wirelessprotocol offers noencryption; Sliceof Radio blocksunused pins on thePi’s GPIO header

n There is no pass-through for the Pi’s spareGPIO pins, sadly

n The small ceramicantenna can be replacedwith a wire whip toboost range

n A small chipprovides the Pi witha radio for wireless

communications

Raspberry PiWireless InventorsKit

PRIPRA

£49.99

CHOICE

www.linuxuser.co.uk

EDITORS’

n While small, the Sliceof Radio does block the

little-used Display SerialInterface (DSI) connector

Page 81: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 81/100

Wireless microcontroller connection kit for PiRasWIK

Rvw

www.linuxuser.co.uk81

components and instructions for various experiments and

small projects. Using the bundled compact breadboard, it’s

possible to get building simple circuits – remote buzzers,

trafc lights, even a light and temperature sensor – in

mere minutes.

The RasWIK has a serious trick up its sleeve once your

device is built: an embedded radio on the XinoRF connects

to the Slice of Radio with no effort, allowing you to place

the XinoRF almost anywhere in the same building as the

Raspberry Pi and still take control of it. The system uses

the Lightweight Local Automation Protocol (LLAP), which

allows for multiple devices on the same radio network –

more XinoRFs, more Raspberry Pis, or some of the LLAP-

compatible accessories also sold by Ciseco.

It’s here where the only real downside of the kit comes to

light, however: LLAP is extremely lightweight, as you might

expect from a protocol designed for a microcontroller with

around 32KB of program storage. Accordingly, it includes

no protection against intrusion; so if your neighbour buys a

RasWIK kit, he or she would be quite able to take control of

anything you build.

For the experimenter, though, it’s a minor point. While the

kit runs LLAP out of the box, the radio can also be used as a

point-to-point serial connection, and you can write your own

protocol to run over the top if you desire robust security.

That minor issue aside, there’s little not to like about the

RasWIK kit. The radios offer surprising range, and the Slice ciseco.co.uk

Moreinformation

of Radio in particular is a very clever bit of design and sits

happily on top of the Pi’s GPIO port without increasing its

dimensions – meaning it can be used in conjunction with the

vast majority of non-metal cases on the market.

The only real downside for those who enjoy experimenting

with the Pi’s GPIO hardware is that the Slice of Radio does not

include pass-through connections for the other pins on the

header, despite only using power and the UART connection

itself. Careful work with a soldering iron will allow you to x

that, but if you’re not happy with such modications and have

only one Pi, you’ll soon grow tired of removing the radio board

in favour of other GPIO-connected devices you may have.

 Gareth Halfacree

Operating system RaspianLinux

 Dimensions (XinoRF) 70.9x53.3mm

weight (XinoRF) 25g Dimensions

(Slice of Radio) 30.3x34.3mm

weight(Slice of Radio) 7g

xtras 4GBSDcard,USBcable,

smallbreadboard,5xred,

yellowandgreenLEDs,

30xresistors,lightsensor,

thermistor,piezoelectric

buzzer,3xpush-button

switches,25xjumperwires

Technical specs

SummaryAlthoughitwouldbeeasytomarktheRasWIKdownforits

insecureprotocol,todosomissesthepoint:it’saneasyway

togetstartedwith wirelessmicrocontroller development,

andprovidesagreatplatformforaddingsensorsoractuators

toaRaspberryPi.Ifsecurityisaworry,userscanalwaysroll

theirownprotocol.

ARDX xperimenter’sKit £62Anopensourcekit,

Oomlout’sARDXisthebestwaytogetstartedwithArduinodevelopment.WhileitincludesmorecomponentsthantheRasWIK–includingamountingplate,servoandmotor–itdoesnotincludeanywirelesscapabilitiesasstandard.Thesecan,however,beaddedatalaterdate..oomlout.co.uk

Alsoconsider

Gertboard£31.12Oneoftherstadd-onboardsdevelopedforthePi,theGertboardisawiredGPIOexpansionmodule.Notentirelysuitableforbeginnersduetoinaccessiblecodeexamplesandawkwardhardware,it’sstillanaffordablewayofincreasingthePi’sGPIOcapabilities–but,again,hasnointegratedwirelesshardware.uk.farnell.com

nMost

existing

Arduino

shieldswork

newiththe

XinoRF

nTheXinoRFcanbe

poweredbyamains

adaptororthrough

mini-USB

nThesamecompact

radioboardisfoundon

theXinoRFasonthe

SliceofRadio

nTheAtmel

Atmega-328

provides

fullArduino

compatibility

Page 82: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 82/100

SparkyLinux 3.0

www.linuxuser.co.uk82

Review

SparkyLinux 3.0

SparkyLinux is a relatively new distro, with its frst version

only coming out in May o last year. Since then, its gone

through a few major upgrades and number changes and is

now on its third iteration. The idea is to create a lightweight

distro that computers both old and new can use – with

modern aesthetics and graphical features available for those

with high system specs. In case you don’t need graphics at

all, though, there is a handy CLI image that reduces the specs

down further – another rst for a Debian 7.0-based distro.

Graphical images come in several avours: the standard

lightweight LXDE image, a purely Openbox-based image, a

MATE image and a Razor-Qt running edition. These are all

customised to t the needs of Sparky, with a dock added

One of the first distros using Debian 7.0 ‘Jessie’, SparkyLinux is

positioning itself as a lightweight system for any userin most cases, along with a nice custom theme. All of the

live images include both a graphical and a command-line

installer – as used in the CLI version. Both work exactly

the same way with the exact same options; however, the

command-line version uses cfdisk for partitioning, and the

graphical installer used GParted. It’s a minor difference that

can actually cause a unique issue – SparkyLinux can’t detect

partitions on a hard drive that uses GPT. This means that

systems with UEFI may need to be wiped before installing. As

GParted can work with GPT, you may never know that this is

an issue, as no warning messages or errors are thrown up.

This also means that partitioning for SparkyLinux is

completely manual. It does explain what it needs to run, and

ProsLightweight distrobased on newtesting branchof Debian; niceaesthetic; greatselection of images

ConsDoesn’t play nicewith all desktops;some issues withFlash and JS onnon-Iceweaselbrowsers

SR

n Customiseddesktopenvironmentssuch as LXDE,Openbox andMATE areavailable

n The SparkyCenter is a nicelittle app for controlling your

system, although it could do withbetter navigation

n The presetConky displaygives a lot ofinformationabout yoursystem, all ofit relevant

Minimum Specs: CPU1GHz i486RAM256MB (128MB for CLI Edition) SRA5GB (2GB for CLI Edition)

New eatures: Debian 7.0•Linux kernel 3.9.8 •GNOME 3.8 compatible

Best or: Home fce

Page 83: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 83/100

Debian 7.0-based lightweight distro

SparkyLinux 3.0

Rvw

www.linuxuser.co.uk83

 Partitioning forSparkyLinux iscompletely manual

nUnlike a lot of modern distros, the installer has you manuallypartition the hard drive – although there are decent instructionson how to do it

nSynaptic grants you access to the entire Debian repos – although we had some issues withusing apps and other packages we installed to it

n It’s a rolling releasebased on testingDebian, so all the latestsoftware is available touse in Sparky

sparkylinux.org

Doload no

are featured on the dock with a couple of other apps, and

Synaptic is used as the main package manager. While we

had no issues with Iceweasel on some websites, when we

tried using Chromium, Flash or JavaScript, heavy sites would

basically break the browser – including even the Chromium

store. Tabs could be exited and reopened; however, the same

problems would happen consistently.

t shouldn’t happenThat also wasn’t the only extra package we had issues with

– trying to install Cinnamon went terribly, with only a patchy

black screen showing up when trying to boot into it. This

really shouldn’t happen, even if its not available as a default

desktop. At the very least, the default desktops all work well,

especially the Razor-Qt offering which is fast becoming one

of our favourite lightweight desktops.

Being Debian based, the repos are of course full of all the

latest and greatest software. The reason SparkyLinux has

iterated so much is because it’s considered a rolling release

– basically updated with snapshots from Debian testing at

specic intervals. This should mean that Sparky is always

up to date if you like to be on the cutting edge. However, we

don’t think it’s worth it. Being severely limited to basically the

default applications and desktops, however good they are, is

not the Linux way. It’s worth a look, but don’t get your hopes up.

Rob Zwetsloot

the Sparky website has some nice instructions to help you

along the way, but the graphical installer could be improved

by having the auto-partitioning of other modern distros.

Other than these issues, installation is quick and relatively

painless and while the majority of people won’t face the GPT

problem, it’s something that will become more problematic

as more and more systems use it.

Unique aestheticThe default login manager is very simple: a drop-down list

for users, and a few options in the corner hidden away that

let you change the locale and desktop session. Nothing

fancy. However, the default desktops each have an aesthetic

quality unique to SparkyLinux. A nice use of monochrome

icons and colours class up the desktop, and the dock

included with LXDE increases its usability. There’s also a

precongured Conky display that gives a great selection of

system information. This is also present in the live image, just

in case you need to keep an eye on your system.

SparkyLinux has a great graphical system manager, similar

to the likes of Mageia, albeit not as well laid out or as deep.

The SparkyCenter gives you access to change the theme and

overall look of the distro, software sources, Flash and Java

settings, default applications, hard drive management etc.

The interface is presented in icons that move into different

layers and while there’s no back button, exiting the window

will take you back a step.

The default app selection was nice, although with no

commitment to truly free software. VLC, GIMP and Iceweasel

There are some

great ideas inSparkyLinux, and

it works very well –

unless you decide

to step a bit outside

the predened

barriers of apps

and desktops. Well

worth a look, but it’s

not for everyone.

ScreenshotGallery

bit.ly/LUDSL3

Summary

Page 84: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 84/100

Subscribe today & start savingSubscribe

• Subscribe today and pay just $122for 13 issues*

• Pay as little as $9.39 an issue –usually $15.99 in stores

For more information and to order visit

www.imaginesubs.co.uk/ludOr call +44 (0) 1795 418661

Exclusive subscriberbenefits

*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 equivalentto $122 at the time of writing, although the exchange rate may vary. Fi ve 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 31st December 2013.

Imagine Publishing publishes more than 20 monthly magazines, some of whichhave been running for over 10 years, reaching over 4 million readers every year

Non-USA readers see page 32

5 free issues*today and getSubscribe

USA special offer

84 www.linuxuser.co.uk

Your

exclusiveoffer code:

USA

Page 85: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 85/100

www.linuxuser.co.uk85

Latest Linux books revealedBook Reviews

REVIEWS

A profession – an agreed-upon set of minimalstandards, and a clear path of entry – is not a way

of describing software development, but Scott

Bain would like it to be and, with Emergent Design ,

sets out his view of the standards to “improve our

lot as creators of software”.

To make (inevitable) change an opportunity,

Emergent Design leans heavily on Gang-of-

Four patterns and refactoring (with attention

to coupling, cohesion, redundancy, readability,

testability) – so Bain concentrates exclusively on

object-oriented languages and techniques.

Missing is the functional programming view

(most G-o-F patterns are unnecessary in FP

languages), but this book is valuable for the

questions it asks, and its (practical) optimism:

“An old concept that I used to accept – code must

inevitably decay over time – fades away in favour

of something more hopeful: code can evolve over

time, getting better and better every time I touch it.”

Scala in Action

Scala is gaining many new users, attracted by its convenience

(runs on JVM and .NET); OO implementation (modelled on

Smalltalk and Eiffel); functional programming features (though it

does not force any aspect of this – such as immutable data – on

the coder); scalability (readily extensible, yet suitable for smaller

scripting jobs); sane concurrency (through Erlang-style Actors

implemented in libraries); productivity (say goodbye to ugly Java

boilerplate); type inference; and compatibility with Java libraries.

Raychaudhuri evangelises these features, but quickly

gets you to practical appreciation as in chapter 2 you builda command-line REST client, and in chapter 3 you code a

MongoDB driver using Scala classes and traits. Functional

data structures make a logical stepping stone to functional

programming, and the book stays practical with web apps,

databases and concurrent programming.

Testing, Java interoperability, and scalable distribution with

Akka round off this excellent, fast-paced (if you want good-but-

gentle, try Odersky) tutorial.

Emergent Design:The Evolutionary Natureof Professional SoftwareDevelopment

Fun and imaginitiveArduino inroduction

Improve old code& professionaliseprogramming

Fast-paced real-world Scala tutorial

Framing an Arduino tutorial in a science-fiction

story is a big risk. Fortunately, Timmis and Kelly

have made both story and tutorial work, as their

engaging characters get caught in an adventure

that can only be survived with the help of some

creative, breadboard-based, hardware hacking

– something they must learn from scratch, along

with the reader.

An imaginative way of justifying the various

beginner projects which can build knowledge

both of electronics, and of Arduino programming,

this book should carry young minds easily past

some new concepts, and through the acquisition

of a number of skills.

Fiction, theory, hardware and software

through eight challenges, from simple

potentiometer and LED projects, through

temperature and motion detection, to building

your own robot. Rounded off by a comprehensive

parts list for each project, and the advice: “Never

stop learning.” Recommended for any beginner,

of any age, wanting to start learning Arduino.

Authors Nilanjan Raychaudhuri

Publisher Manning

ISBN 978-1935182757

Price £28.99

Score 

Authors Michael Janda

Publisher New Riders

ISBN 978-0321918680

Price £22.99

Score

Author MitchellHashimoto

Publisher O’Reilly

ISBN 978-1449335830

Price £22.99Score

Author Michael Fogus

Publisher O’ReillyISBN 978-1449360726

Price £22.99

Score

Authors  James Floyd Kelly

& Harold Timmis

Publisher APress

ISBN 978-1430246053

Price £23.50

Score 

Author Scott L Bain

Publisher Addison Wesley

ISBN 978-0321889065

Price £38.99

Score 

Sage advice for

all creatives –

programmers and web

designers, not just artists and illustrators –

that should be common sense, but comes

(if at all) from decades of experience. It’snever too late to learn – improve your work

and your workplace with Janda’s blog-

post-sized bites of wisdom.

The near-ubiquity of JavaScript in

the web age makes it a good platformfor teaching functional programming

techniques, while applying functional

concepts to JavaScript will improve your

apps in many ways – though functional

programming people looking to learn JS

may need an additional guide.

Burn Your Portfolio:Stuff They Don’t Teach You inDesign School, But Should

Functional JavaScript:Introducing FunctionalProgramming with Underscore.js

Vagrant: Up and Running

Arduino Adventures:Escape From Gemini Station

Virtual development

environments the

easy way, with twocommands to get a

virtual machine up, then easy sync of

complex development environments. 

Automated provisioning includes Chef,

Puppet and shell script options. Vagrant

creator Hashimoto expounds, explains,

and expands – including a section on

writing plug-ins.

Page 86: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 86/100

Classified Advertising

Page 87: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 87/100

01202 586421

 TM

Proto

Armour

www.protoarmour.com

Rock solid protectionfor Raspberry Pi.

Machined Aircraft Alumin um

Integrated Camera Option

Anodized Colo r Options

Security Features

Passive Cooling

Raspberry Pi is a trademark of the Raspberry Pi Foundation

u

i

To Advertise In

Contact Rhian on 01202 586421

 [email protected] MAGAZINES BOOKS DVDS DOWNLOADS GIFTS

Readanything

 good lately?

Shop for qualitymagazines, books

Imagine Publishingand DVDs from

Page 88: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 88/100

Send us your questions and we’ll do our best to answer them!

Russell Barnes has beena computer and technology journalist for nearly 15 years

Questions& answers

This month your questionswere answered by…

ASK THE EXPERTS

Rob Zwetsloot studiedaerospace engineering, usingPython to model simulations

www.linuxuser.co.uk88

answeredYour questions

Contact us...Email: [email protected]: www.linuxuser.co.uk

Kunal Deo is a veterandeveloper of many opensource projects

Richard Smedley spends

90% of his screen time shelledinto servers in the UK and USA

■Clonezilla is a powerful disc imaging tool

How do I compilesoftware?Compiling software from source code isn’t that

difficult – all it requires are simple build tools

available in all repos. To make sure you have the

correct build tools installed, do the following in a

Debian-based system:

$ sudo apt-get install build-

essentials

Alternatively, for other systems, use:

$ sudo yum groupinstall

'Development Tools'

Once you have the necessary source code for the

software you want to compile, navigate to the

folder in the terminal and type:

$ ./configure

…to build the files, and follow up with:

$ make

….to compile it.

Ghost editingHi there. I’ve been playing around with my

system recently, and decided to do a small

overhaul of my disc setup. I created a ghost of

my main hard drive, which was not full, and am

now attempting to apply it to a smaller space

than it was originally on.

I figure because the image wasn’t full up

anyway (and there was no important data I’ll lose

if I start messing about with it) that I can make

some changes to the file and be able to apply it

to the new disc I want it to be on? Hope you have

some answers.

Joe O’Reilly

Facebook:Linux User & Developer

Twitter:@linuxusermag

Page 89: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 89/100

All your technical problems solved

Questions & answers

www.linuxuser.co.uk89

Q/A

Minty AppleMy parents have nally decided to join this

century and get a proper computer rather

than relying on me or library computers

to get their information. As family tech

support, I’ve told them I’ll get them set up

with a new system they can use for emails

and such. Because they’ve never really used

computers much at all, I wanted to set up a

Linux Mint system for them. However, the

only issue I have is nding spare hardware

to get that going. I did nd that I have a MacMini lying around, though… so I thought

about putting Linux on that. However, I seem

to recall it’s not as easy as just putting the

live disc in and installing as I found out.

I’m not too bothered about losing OS X,

and would much prefer my parents use Mint

anyway. How do I get it installed on there?

Jeff Vincent

While Mint and its Ubuntu base

have tools to install on Secure

Boot systems that use UEFI, it

requires the use of legacy modes to get it work normally.

But we don’t have that luxury with a Mac, so

 you need to do a little more. The main issue is

that it uses a different partition table that

won’t work with Mint, so the easiest thing to

do if you don’t mind losing OS X is convert it

to something more Linux friendly.

Make sure any les you want to keep are

backed up, as this method will format the

hard drive. Burn a live CD or DVD of Mint

and put it in your optical drive. Restart the

Mac and hold down the Option key to bring

up the boot selection screen, and of course

select CD. Boot into the live environment by 

choosing Try Linux Mint.

When Mint loads up, you’ll next need to

open GParted. By default it should select the

Mac’s hard drive, so click Device on the menu

bar and then go to Create Partition Table.

 A warning will pop up, and then you’ll want

to click the Advanced triangle. From here

 you’ll be able to create a new partition table

format, this time as MS-DOS.

 After that is done, you can install Linux 

Mint however you wish. We’d suggest using

Cinnamon if your parents are more used to

Windows systems, and show them how to

install apps from the Software Centre.

It’s certainly possible to do this,

and it doesn’t require a huge

amount of messing around to

accomplish either. First of all,

boot into a live Linux environment

from a disc or USB storage.

Use fdisk  -l and make a note of the

cylinders, heads and sectors, and then edit the

image le sda-chs.sf  with these new details.

Next, use:

$ parted /dev/sda 'unit s' print

…noting down the rst few lines, and then edit

the lesda-pt.parted to match this.

Finally, sync/restart and the restore theimage with Clonezilla and you should be all set.

Next time, you could always shrink a partition

to t the destination before cloning, which

should make it a little easier.

ConvertedI’ve been trying to follow a guide on converting an

MKV to an AVI using MEncoder. It seems to work

 just ne, but I keep getting problems where it just

plays the audio on some devices. Here’s what I’m

doing to convert the video, by the way:

$ mencoder abc.mkv -oac pcm -ovc

xvid -xvidencopts bitrate=886 -subITC0101.srt -subfont-text-scale 3 -o

zzz.avi

It works ne on my PC, but on my DVD player,

which has no problem with these codecs usually

as far as I’m aware, it just doesn’t work.

Am I missing something with my command,

or is there another way I should be going about

doing this?

Tim Daley

No, your command seems to be

ne, it’s most likely an issue with

MEncoder and the limited codecs

on the DVD player. You might be

better off trying FFmpeg, though,

and you can do so with the following commands:

$ ffmpeg -i input.mkv -vcodec

libxvid -qscale 5 -s 640x272 -aspect

40:17 -r 23.976 -g 240 -bf 2 -acodec

libmp3lame -ab 160k -ar 48000 -async

48000 -ac 2 -pass 1 -an -f rawvideo

-y /dev/null

$ ffmpeg -i input.mkv -vcodec

libxvid -qscale 5 -s 640x272 -aspect

40:17 -r 23.976 -g 240 -bf 2 -acodec

libmp3lame -ab 160k -ar 48000

-async 48000 -ac 2 -pass 2 -f avi

outlander-q5.aviThis should give you a little more control over 

what you’re outputting, and hopefully work a bit

better with your DVD player.

Batch downloadEvery now and then I come across a website

directory that has a load of individual les I need

to download residing within it. I used to use a

Firefox add-on to select and download them

all in one. However, I wanted to know if there’s a

more universal way of me doing it without having

to get extra add-ons for my browser?

Colin Still

nWeb directories can be easily downloaded

from using wget

nNot everything has the latest codecs

 It’s most likelyan issue withMEncoder and thelimited codecs on

the DVD player

Page 90: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 90/100

Questions& answers

www.linuxuser.co.uk90

Now you need to run some specific commands

to update the system Java info, allowing you to

then switch to it. First of all do:

$ sudo update-alternatives --install

"/usr/bin/java" "java" "/usr/lib/

jvm/jdk1.7.0/bin/java" 1

$ sudo update-alternatives --install

"/usr/bin/javac" "javac" "/usr/lib/

jvm/jdk1.7.0/bin/javac" 1

$ sudo update-alternatives --install

"/usr/bin/javaws" "javaws" "/usr/

lib/jvm/jdk1.7.0/bin/javaws" 1

Now, correct the file ownership and the

 permissions of the executables with:

$ sudo chmod a+x /usr/bin/java

One method we’d recommend

using on Linux would be wget, the

standard downloading tool for 

the command line. You can

download the contents of a web

directory with something like:

$ wget --mirror -p --convert-links

-P /destination/folder/ http://www.

websitre.com/directory/

You can also use curl as well. This can also

be used with single files if you find yourself 

without a browser to use.

Assault onbatteryI want to have a notification show up in the

event that my laptop battery charge falls below

10%, as I regularly move around when working

on it. I guess that most desktop environments

provide a notification of this sort, but I use

xmonad with a few other programs, so I just

need something like a notification daemon

and front-end. I’ve had a few close calls while

working so far, and I’d really rather not go backto a desktop environment if I don’t have to.

Can you suggest any notification tools?

I would prefer a lightweight package that

I can extend with other notifications, but

any suggestions are welcome. If there are

any DE notification tools that work well

outside of their environments, that would

also do.

Chris Dodd

There’s actually a couple of great

tools you can use on xmonad to

 get this type of functionality. You

can use i3, which is a tiling window

manager, which can be used on its

own or in conjunction with twmn. Both offer 

tiling notification windows, and i3 is specifically 

designed to work with the xmobar as well.

i3 is also very extendable, and it can be used

for a lot more than just battery notifications.

Hope this helps.

Oracle of JavaSo I have the OpenJDK installed on my system,

and it turns out I need to use the official Oracle

JDK for a project I’m working on. Only, it seems

like I can’t just install it and expect it to work –

■Make sure Java knows where itself is located

■Battery management is not always easy

how do I go about setting up my system to use

the Oracle JDK? I’m currently running Ubuntu.

Thanks.

Peter Chan

Okay, so the process for doing this

is a two-step one. Firstly, you

need to download the JDK files

from the Oracle website, which

come in a tarball. Extract these

and this will create a ./jdk.1.7.0_0x  directory in

the location of your choosing.

Now create a new directory for it and move into

it with:

$ sudo mkdir -p /usr/lib/jvm

$ sudo mv ./jdk.1.7.0[Current

Version] /usr/lib/jvm/jdk1.7.0

Facebook:Linux User & Developer

Twitter:@linuxusermag

Page 91: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 91/100

All your technical problems solved

Questions & answers

Q/A

nThe right drivers don’t always produce the right response

nWhen connecting remotely, some settings

are different for displays

$ sudo chmod a+x /usr/bin/javac

$ sudo chmod a+x /usr/bin/javaws

$ sudo chown -R root:root /usr/lib/

jvm/jdk1.7.0

Now we need to select the new JDK by running:

$ sudo update-alternatives --config

java

You’ll be shown a list with numbers from which

to choose the new JDK from – make sure to

choose the one we’ve been setting up. Now we

can make sure it’s done properly by checking

the Java version with:

$ java -version

You can now also switch back to OpenJDK, if you

need to, with theconfig java command.

Graphical JavaI’ve just upgraded my box to the Radeon drivers,

and it’s so far proved to be a good idea. The box

runs smoothly now. There are some issues with

Java OpenJDK, though.

How do I get it to use OpenGL? There may well

be the option to use Sun’s Java, but it needs

AOSS – so, either I tweak the OpenJDK to not

crash and use OpenGL/acceleration; or I use

Sun’s JRE, but it would involve installing OSS.

Chris Kimpton

You’re going to have to use a little

hack so that Java knows where

it’s located. Create it with:

$ nano /etc/ld.so.conf.d/

javaworkaround.conf

…and then enter the following into it:

/usr/lib/jvm/java-7-openjdk-amd64/

jre/lib/amd64

/usr/lib/xulrunner-17.0

…and run ldcong as root. Choose  /home for 

the user  and libnpjp2.so le locations. The

Oracle and OpenJDK versions of Java are linked

to PulseAudio, so sound-wise you’re better off 

using PulseAudio.There’s some Java OpenGL packages, too,

that you might want to install with:

$ dpkg-query --load-avail -l

'*jogl*'

Hopefully that should x things up for you.

Terminal troubleI’m experiencing a very weird problem – every

now and then I need to do some work in the

terminal on my system. However, whenever I try

and open the terminal emulator, it opens for a

brief instant and then automatically closes.

The system in question is CentOS, which I

have to access remotely via VNC. It’s using Xfce

as a desktop environment as well. The weird

thing is, it works just ne if I’m logged in as root,

so I can only assume it’s a problem with the

user type. Obviously, I don’t want to make some

of the normal users have full root privileges,

and I’d much rather not log in as root every

time I work on this system. Have you heard of

anything like this before? Is there something

fairly obvious that I’m missing?

Thanks for any help.

Thomas Reid

 Open theterminal whilelogged in as root,

and then changeto another user

 As root works, here’s a little thing

 you can try – open the terminal

while logged in as root, and then

change to another user with:

$ su -l <user>

This will allow you to open another shell to log

in with and then try to open the terminal. Any 

errors will show up in the root terminal. What

may likely happen is that you cannot even load

into the shell.

This is because the user will not have access to

connect to the X server because you’re using it

via VNC. To solve this, you just need to add the

relevant users to the list that are allowed to

make this connection. You can do this with xhost

by typing:

# xhost local:<user>

…as root. Give the system a reboot and it should

now be working ne.

www.linuxuser.co.uk91

Page 92: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 92/100

Whether you’re a hosting firm ora happy customer who wants afavourite provider listed, drop usa line with the details!

Got a dealyou think weshould list?

[email protected]

www.linuxuser.co.uk92

    H    A    R    D    W    A    R    E    R    A    I    D

    P    R    I    V    A    T    E    S    U    B    N    E    T

    2    4    /    7    P    H    O    N    E    S    U    P    P    O    R    T

    U    P    T    I    M    E    G    U    A    R    A    N    T    E    E

    C    P    U    C    O    R    E    S    /

    S    P    E    E    D

    D    I    S    K    S    P    A    C    E

    R    E    M    O    T    E    P    O    W    E    R    R    E    B    O    O    T

    N    E    T    W    O    R    K    B    A    C    K    U    P

    S    T    O    R    A    G    E

    P    E    R    M    A    N    E    N    T    K    V    M

    M    I    N    I    M    U    M 

    C    O    N    T    R    A    C    T    T    E    R    M

    C    O    S    T    P    E    R

    M    O    N    T    H

    P    H    O    N    E

    N    U    M    B    E    R

    1    G    B    P    S    I    N    T    E    R    N    E    T

    C    O    N    N    E    C    T    I    O    N

    P    A    C    K    A    G    E

NAME AND URL

Dedicated server listings

O = Option

PoundHostwww.poundhost.com

FlexServer2 01628 777730 From £2912

months

Dual/Quad

Core

160GB

to 2TB10Mbps ✗ ✓ ✓ 99.90% 10 GB ✗ ✓

BudgetBox III 01628 777730 £36 1 month Intel Xeon 3065 1 x 250GB100

Mbps✗ ✓ ✓ 99.90% 10 GB ✗ ✓

SSD 4 01628 777730 £60 1 monthQuad Core Intel

Xeon X3430

120GB Intel

520 SSD

100

Mbps✗ ✓ ✓ 99.90% 10 GB ✗ ✓

Merlin 01628 777730 £199 1 month2 x Intel Xeon

Quad Core

2 x 500GB

SATA II

100

Mbps✓ ✓ ✓ 99.90% 10 GB ✗ ✓

DS6.5 01628 777730 £295 1 month2 x Intel Xeon

Hex Core

4 x 1TB

SATA III

100

Mbps✓ ✓ ✓ 99.90% 10 GB ✗ ✓

Cloud Server 01628 777730 £52 1 month 2 vCPU (4GB) 40GB

Gbit

shared /node

✓ ✓n/a 99.90% O

✗ ✓

Cloud Server 01628 777730 £98 1 month 4 vCPU (8GB) 40GB

Gbit

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 monthsDual Core Xeon

2.33GHz160GB ✓

 ✓ ✓ ✗ 99.99% ✓ ✗

24/7 Ticketsupport

Heart Internet (www.heartinternet.co.uk/dedicated-servers)

Windows Dual Core 0845 644 7750 £89.99 12 monthsDual Core Xeon

2.33GHz160GB ✓

 ✓ ✓ ✗ 99.99% ✓ ✗

24/7 Ticketsupport

Heart Internet (www.heartinternet.co.uk/dedicated-servers)

Linux Quad Core 0845 644 7750 £129.99 12 monthsQuad Core Xeon

2.5GHz250GB ✓

 ✓ ✓ ✗ 99.99% ✓ ✗

24/7 Ticketsupport

Netceterawww.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 ✓ ✓ ✓ ✓ ✓ ✓ ✓

Zymawww.zyma.com

Unlimited 0208 123 2730 £1.7912

months

Quad Core

XeonUnlimited ✓ N/A ✓ N/A 99.9% N/A N/A ✓

Unlimited 0208 123 2730 £7.95 3 monthsOcto Core

XeonUnlimited ✓ ✓ ✓ ✓ 99.9% ✓ ✓ ✓

Sponsorship opportunityBring attention to your brand by sponsoring thissection. Contact Rhian Carter on +44(0)1202586421Hosting listings

Page 93: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 93/100

www.linuxuser.co.uk93

    S    H    O    P    P    I    N    G    C    A    R    T

NAME AND URL

    P    A    C    K    A    G    E

    D    A    T    A    B    A    S    E

    S    U    P    P    O    R    T

    P    H    O    N    E

    N    U    M    B    E    R

    C    O    S    T

    W    E    B    S    P    A    C    E

    M    O    N    T    H    L    Y

    B    A    N    D    W    I    D    T    H

    P    O    P    3

    A    C    C    O    U    N    T    S

    V    I    R    U    S    F    I    L    T    E    R

    F    I    R    E    W    A    L    L

    P    H    O    N    E    S    U    P    P    O    R    T

    E    M    A    I    L    S    U    P    P    O    R    T

    W    E    B    C    O    N    T    R    O    L

    P    A    N    E    L

    S    E    R    V    I    C    E    L    E    V    E    L

    A    G    R    E    E    M    E    N    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 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓

Eurofast ho st.c om (w ww.eurofasthost .com) Email Only 02380 24 9 823 £ 40 1GB 2GB 10 ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓

Eurofasthost.com (www.eurofasthost.com) Essential 02380 249 823 £75 2GB 5GB 10 ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓

Eurofast ho st.c om (w ww.eurofasthost .com) Superior 02380 249 823 £140 5GB 10GB 25 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓

Eurofast hos t.co m (w ww.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 ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓

Ev oh os tin g ( ww w. ev oh os tin g. co .uk ) Bu si ne ss N/A £ 79. 99 6 .5 GB U nl imi te d Unl imi te d ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓

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 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓

H ea rt Inter ne t (www.he ar tinter ne t.co.u k) Sta rter Profe ss iona l 0845 644 7750 £29.80 2.5GB 10GB 1,000 ✗ ✗ ✗ ✓ ✗ ✓ ✓ ✓

H ea rt Inter ne t (www.he ar tinter ne t.co.u k) H ome Profe ss iona l 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

Fasthostswww.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 ✓ ✓ ✓ ✓ ✗

Blacknightwww.blacknight.com

Minimus

Linux / Windows+44 (0)845 5280242 €49.95 10GB 200GB Unlimited ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗

Medius

Linux / Windows+44 (0)845 5280242 €89.95 20GB 400GB Unlimited ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗

Maximus

Linux / Windows+44 (0)845 5280242 €149.95 30GB 600GB Unlimited ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗

LISTINGS

We bFu si on (w ww.w eb fus io n. co .uk ) Fus io n P ro fe ssi on al 0 84 5 130 16 02 £107. 40 5 GB 5 0G B 1, 00 0 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✗

We bFu si on (w ww.w eb fus io n. co .uk ) Fus io n Bu si ne ss 0 84 5 130 16 02 £17 9. 40 10 GB 15 0G B 1, 50 0 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✗

We bFu si on (w ww.w eb fus io n. co .uk ) Fus io n D ev elo pe r 0 84 5 130 16 02 £ 227. 40 20 GB 30 0G B 5, 00 0 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✗

Web Fu sion (www.we bf us ion.co.u k) F us ion Res el le r 0845 130 1602 £329.99 U nl imited U nl imited U nl imited ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✗

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 (w ww.ec owebhost ing.co.uk) A dvanced 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) S tandard Package 0845 612 0330 £ 35.25 10 0MB 4.5GB 10 ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓

NameHog (www.namehog.net) Professi onal Package 0845 612 0330 £ 58.75 25 0MB 8GB 25 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓

Hosting [email protected]+44(0)1202586421

GET YOUR LISTING HIGHLIGHTED! CONTACT RHIAN

Page 94: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 94/100

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 UserLetters

Things are heating up in the display server space, as both

Wayland and Canonical’s Mir are set to try to replace the

X server shortly. Richard Hillesley’s piece on Wayland in issue

127 inspired some debate on the website about replacing X. Join

in the conversation here: bit.ly/LUDWay

Henrik Danielson said:Wayland was supposed to be that common protocol/API. As far as

I can tell, one problem is that Mir is intentionally incompatible

with Wayland.

Bob Robert said:I use the network display functionality of X on a regular basis. The

switch to Wayland is fine by me (I’m a user, not a programmer) so

long as I can still ‘ssh -Y’ and launch GUI applications that display on my

local machine. That X did network transparency ‘mainline’ and Wayland

would do it with a ‘plug-in’ is actually unimportant to me. What matters is

that it DOES it. It is functionality I use, and want.

bwat47 said…I don’t think the situation is quite as bad as it seems. Both Mir

and Wayland have several major similarities in their architecture,

such as using EGL. For drivers, theoretically it should not be difficult to

support both as long as they provide EGL support. For applications

Your opinions aboutthe magazine, Linux

and open source

things shouldn’t be that bad either, because Mir/Wayland support is at

the toolkit level. The biggest burden will probably be on the toolkits,

though: having to have and support two back-ends in addition to X

(because X will not be totally going away any time soon).

Gene Mosher said:Keith Packard asks: “How many of these applications care about

network transparency, which was one of the original headline

features of X? How many of them care about ICCCM compliance? How

many of them care about X at all? The answer to all of those questions, of

course, is ‘very few’.” And if we all are among the ‘very few’, then what

does the future hold for us, Keith?

■Wayland is intended as a simpler replacement for X

I remember a while ago you talked about Pisi

Linux, an alternative to Pardus that was a bit more

like the original. I was sad to see that DistroWatch

refuses to even list Pisi Linux because someone

trolled them, telling them it was not active,

setting up fake Pisi Linux sites etc. DistroWatch

apparently decided they would remove it from

their lists. Very sad and disappointing on the

part of DistroWatch. I hope that when it finally

reaches stable release they’ll add Pisi back to the

database, as the older Parduses were some of my

favourite distros!

Mark Doyle

It’s a shame that DistroWatch took the

stance. Going by the Pisi team’s side of the

Piece of Pisi

story, it seems like DistroWatch were duped;

however, the folks over at DistroWatch

haven’t responded to the Pisi team since their

explanation. The beta for it is out now, but

Pisi is not back on DistroWatch just yet. Look

out for a review of the full version when it’s

finally released.

■ Pisi Linux is currently in beta

THREAD BARE

Way of the future

Page 95: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 95/100

Pisi Linux, Wayland vs Mir, Specialist distros, Pi projects

Your view

LETTERS

Android MagazineWith more and more

Android features being

merged back into

the Linux kernel, it’s

becoming easier to

develop for one of the

most popular mobile

operating systems

around. With over 25

billion app downloads,

and over 500 million Android devices worldwide,

there’s a huge audience ready to consume

apps. For a more Android-driven editorial,

look to our sister mag Android Magazine, theonly publication dedicated to the platform.

Along with news and reviews to keep you

up to date on everything Android, there are

also tutorials and advice on developing and

hacking your hardware. Find out more at

www.littlegreenrobot.co.uk .

Specialist distrosOkay, I am a little confused with the whole distro

designed for specific job trend. If I want to run

audio applications in Windows, Mac or any other

OS, I install the programs I want.

Why oh why with Linux do we see thisapproach of “just install the audio distro for the

best audio environment”. What a waste! Instead

of customising an existing distro and having a

nice ‘aptitude/yum install audio-env’ we get

all the overhead of maintaining a distro just for

the applications?

Isn’t it time we separated the application from

the OS and ignored any attempts by people to

integrate the two?

Colin McDermott

There’s no specific reason why you can’t do

this anyway – a lot of people will probably be

fine with a standard Fedora or Ubuntu install

for any of their specialised needs. However,

some distros do more than just come with

a selection of themed default packages –

distros like AV Linux go the extra mile and

customise the kernel specifically for AV

software. Not everyone has the skills to do

that in Linux, so these kind of distros do serve

a purpose. The same with some lightweight

distros. It’s about choice, and this offers a lot

more choice for people.

More PiI’ve just finished reading issue 129 of your

magazine and was very inspired by the ten

Raspberry Pi projects you had. I tried out a

couple of them and was pleased with the

results; there are really so many things you

can do with the Raspberry Pi! I now use my

Raspberry Pi for all my media centre needs and

haven’t looked back – I even have a spare SD

card for using it as a portable access point forwhen I go travelling. Will you be doing another

feature like this in the future? If so, will I be

able to suggest some projects? I have a few in

mind which I feel will properly make use of the

Raspberry Pi.

Thanks again,

Phillip Cordaro

■ Some specialist distros are more than a selection of apps

■ Raspberry Pi projects

bring out the practical

side of Linux

We’re glad you enjoyed the projects, Phillip.

We always love to hear about Raspberry Pi

projects ideas from all of our readers, even

 just to feature on their own in the magazine.

We usually try to get at least one Raspberry

Pi related tutorial or feature in the magazine

every month – for example, in this issue youcan find out how to turn that portable access

point into a secure router with our Onion Pi

tutorial starting on page 46. You can send

any ideas to the email address at the top of

this page.

Facebook:

Linux User & Developer

Twitter:

@linuxusermag

Page 96: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 96/100

Page 97: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 97/100

Page 98: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 98/100

98

What’s coming up…Next issue Look outfor issue 132

on sale 24 OctWant it sooner?

Subscribetoday!

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.ukwww.greatdigitalmags.com

Magazine teamEditor Russell [email protected]

☎ 01202 586272

Staff Writer Rob Zwetsloot

Photographer James SheppardSenior Art Editor Will ShumEditor in Chief  Nick JonesHead of Publishing Aaron Asadi

Head of Design Ross Andrews

ContributorsPhil King, Richard Smedley, Jon Masters, Himanshu Arora, Richard

Hillesley, Michael Reed, Gareth Halfacree, Joey Bernard, Simon Brew,

Sandra Vogel, Steve Mumby, Mihalis Tsoukalos, Eden Frankham,

Kunal Deo, Abbi Denney & David Crookes

AdvertisingDigital or printed media packs are available on request.

Advertising Director Matthew Balch

☎ 01202 586437

[email protected]

Head of Sales Hang Deretz

☎ 01202 586442

[email protected]

Advertising Manager Jennifer Farrell

☎ 01202 586430

 [email protected]

Account Manager Rhian Carter

☎ 01202 [email protected]

Cover discJunior Web Designer Steve Dacombe

[email protected]

InternationalLinux User & Developer is available for licensing.

Contact the International department to learn more.

Head of International LicensingCathy Blackman

☎ +44 (0) 1202 [email protected]

SubscriptionsHead of Subscriptions Gill Lambert

For all subscriptions enquiries

☎ 0844 249 0282 (UK)☎ +44 (0) 1795 418661 (Overseas)Email: [email protected]

6 issue subscription (UK) – £25.15

13 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 specically 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 afliated 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 FORTHEGNU GENERATION

ALSO INSIDE:>> Master the RasPi camera>> LTE Open Phone reviewed>> Visualise data with Graphviz

>> Protect your network with FOSS

Scrape Wikipediawith PythonGet a taste for BeautifulSoup in our coding guide

COMING IN THE NEXT ISSUE

Build your ownRaspberry Pi robotMake all your childhooddreams come true…

Master Git ineasy stepsThe world’s favourite version controlsystem isn’t as easy as it could be © Imagine Publishing Ltd 2013

ISSN 2041-3270m

CLOUDSTORAGE

SUPER-TESTThe ultimate Linux solution revealed

Page 99: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 99/100

Page 100: Linux User and Developer - 2013

7/27/2019 Linux User and Developer - 2013

http://slidepdf.com/reader/full/linux-user-and-developer-2013 100/100