NO. 1 FOR RASPBERRY Build a smart alarm clock • PLUS 14 pages

www.linuxuser.co.uk

FIND ALL THE TUTORIAL FILES YOU NEED www.linuxuser.co.uk/tutorial-files

KDE Plasma 5 Gnome | LXDE | Unit | Cinnamon & more ESKTOPSTESTED Launch Linux from a network Configure an NFS server for diskless booting

34

Pages of expert Linux tutorials

» Shell scripts pt 3 » Nginx » Awk & Sed

Handle email with Node.js Send and receive mail and reports ALSO INSIDE

» Program Arduino from Ras Pi » Android-x86 distro reviewed » Screenwriting software tested

GET L ANDROID and unrooted devices

Jetson TK1 Is the Nvidia Jetson TK the SBC of the future?

ISSUE 144

Code Club is a nationwide network of volunteer-led after school coding clubs for children aged 9-11. 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!

Visit

to find out more

Welcome YourteamofLinuxexperts…

toissue144ofLinuxUser&Developer RobZwetsloot studied aerospace engineering, using Python to model complex simulations. A compromise was reached with Robot-chan and this month Rob reprogrammed the Arduino-based tank from his Pi (page 70). Robot-chan is now mixing avant-garde minimal techno with Liam Fraser’s PiSampler (page 62).

RichardSmedley started using computers long before WYSIWYG and still maintains that the command line, and Emacs, is the most productive working environment. Richard begins a new column on open source start-ups this month (page 13) and concludes his shell scripting series with a guide to refactoring code (page 34).

NitishTiwari is a software developer by profession and an open source enthusiast by heart. As well as writing for leading open source magazines, he helps firms set up and use open source software. Nitish walks us through enterprise content management with Alfresco in this issue (page 54).

Mihalis Tsoukalos is a UNIX system administrator with expertise in programming, databases and maths. He has been using Linux since 1993. This month, Mihalis shows us how to work with text files faster at the command line using Awk and Sed (page 38) and how to serve a website with Nginx (page 50).

JonMasters is a Linux kernel hacker who has been working on Linux for some 18 years, since he first attended university at the age of 13. Jon lives in Cambridge, Massachusetts, and works for a large enterprise Linux vendor. You can find his brilliant Kernel Column on pages 14-15 this month.

Gareth Halfacree is our resident news reporter and brings us the latest developments from all over the open source world, starting on page 6. Gareths tests out the new Nvidia Jetson TK1 over on page 80 to see if this really is the singleboard computer of the future.

This issue

Get Linux User cheaper every issue

» Run Linux on Android Page 32 » Configure an Nginx server » Reviewed: Nvidia Jetson TK1 » Diskless booting over a network

Welcome to the latest edition of Linux User & Developer, the UK and America’s favourite Linux and open source magazine. Linux is all about choice, and one of the key choices to make as a user or developer is which desktop environment to use. Attitudes have changed since we last asked which desktop is right for you, with the face-off between GNOME and KDE evolving into a much more diverse battle for your screen. There’s now a desktop for every type of user and workflow preference, so to help you make sense of it all we’ve tested the ten best desktops and picked out their pros, cons and uses (page 16). Once you decide which one you like, just grab it from your free disc –we put all ten of them on there for you. And if you’d like to see a Linux desktop on a much smaller, more portable screen then turn to page 26. This issue we show you how to install Linux on your Android phone or tablet – regardless of your rooting situation –and take advantage of your favourite tools right from your go-to mobile device. Once your screen’s all set, check out this month’s tutorials line-up – as well as shell scripting, Nginx and NFS servers, we have some more great Pi projects for you if you’re looking for something to get your teeth into this weekend. Have fun! Gavin Thomas, Deputy Editor

Getintouchwiththeteam: [email protected] Facebook:

Twitter:

Linux User & Developer

@linuxusermag

Buyonline

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

www.linuxuser.co.uk 3 Issue 144

Contents

Reviews 75 Screenwriting software super test We test focused tools and pro suites in search of the perfect writing desk

Trelby

LibOScreenplay

Celtx

FadeIn

16 KDE Plasma 5 vs GNOME, Unity… Which of the 10 best desktops is worth your screen space?

OpenSource Tutorials 06 News The biggest stories from the open source world

12 Opinion Columns Expert views on open source and free software

14 Kernel Column ThelatestontheLinux KernelwithJonMasters

Your views on the magazine and the open source scene

Features

16 KDE Plasma 5 vs GNOME, Unity… Discover the strengths of each and how to use them

26 Install Linux on Android devices Get Linux, regardless of root

34 Write useful shell scripts – part 3 Richard concludes his brilliant Bash series

88 Q & A Your questions answered

Work faster with in the terminal by mastering Awk and Sed tricks for text files

Is the Jetson TK1 the singleboard computer of the future?

82 Android-x86 Does the first stable release of the Android 4.4 (KitKat) port impress?

42 Launch Linux from a network Learn to set up an NFS server so that you can boot Linux disklessly over a network

46 Send and receive emails using Node.js

84 Synology DS115j The perfect entry-level storage and backup box for home users?

Handle emails and crash reports using the Nodemailer and Node IMAP modules

AG I-M IN M

94 Letters

38 Process text faster by using Awk and Sed

80 Zotac Nvidia Jetson TK1

50 Serve a Joomla! site using Nginx Find out if Nginx is a viable alternative to Apache by setting it up for yourself

54 Enterprise content management with Alfresco Manage files, workflows, teams and more

On your free disc 96 Cover disc Four of the latest distros for you to try out on this issue’s DVD!

ElementaryOS Android-x86 PCLinuxOS LXLE

59 Practical Raspberry Pi Make a sampler that loops audio, set up a smart alarm clock, program Arduino from Raspberry Pi (using a Makeblock robot!) and find out how to freeze time with a Pi.

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

06 News | 12 Opinion | 94 Letters TRAINING

Linux Foundation launches new Certification Programme Online performance-based exams to certify Linux professionals The Linux Foundation has announced the immediate launch of its Linux Foundation Certification Programme, which it states is designed for both early-career and engineerlevel system administrators looking to confirm theirknowledgeoftheplatform. Following industry reports that demand for Linux knowledge is on the rise in the global job market, the Foundation’s new certification programme is designed to follow on from the Introduction to Linux open online course (MOOC) it launched earlier this year. Participants will be able to take exams that result in the qualifications of Linux Foundation Certified System Administrator (LFCS) and Linux Foundation Certified Engineer (LFCE) at a cost of $300 per exam, taken online fromanywhereintheworld. “Our mission is to address the demand for Linux that the industry is currently experiencing. We are making our training program and Linux certification more accessible to users worldwide, since talent isn’t confined to one geography or one distribution,” claimed Jim Zemlin, executive director at The Linux Foundation, at the launch. “Our new Certification Programme will enable employers to easily identify Linux talent when hiring and uncover the best of the best. We think Linux professionals worldwide will want to proudly showcase their skills through these certifications and that these certificates will become a hallmark ofqualitythroughoutourindustry.” TheFoundationclaimstohaveworkedtoensure that both LFCE and LFCS exams are suitable for a number of distributions, with students able to take the exam in one of three flavours: CentOS, openSUSE and Ubuntu. Exams are performance-

based, testing the student’s ability to solve real-world problems at a simulated command line rather than using theory or multiple-choice questioning. The exam must be retaken each year tomaintaincertification. Canonical, whose Ubuntu distribution has been chosen as one of the three for which the exams will be offered, has come out in support of the programme. “The Linux Foundation’s certification program will open new doors for Linux professionals who need a way to demonstrate their know-how and put them ahead of the rest,” claimed Mark Shuttleworth, Canonical founder. “The timing is perfect for this, as demand for Linux talent is on the rise and we need ways to expand thepoolofqualifiedcandidatestosupportLinux.” Employers, too, have been supportive of the launch. “Linux provides a stable foundation for Yahoo’s systems, helping us run one of the largest cloud infrastructures in the world. Skilled Linux professionals are key to our success,” explained Sven Dummer, director of OS & UNIX System Infrastructure at Yahoo. “The Linux Foundation Certification Programme focuses on the latest technologies. The annual requirements to maintain certification will help bring more qualified talent into the marketplace, and support Linux professionalsinkeepingtheirexpertiseuptodate.” Details of the programme are available at training.linuxfoundation.org/certification. Top right Successful users will receive an official badge to display on their CVs and profiles Right Jim Zemlin, executive director of the Linux Foundation, claims the new Certification Programme is “more accessible”

We are making our training program more accessible to users worldwide 6 www.linuxuser.co.uk

News

The latest in the Linux community

OPEN SOURCE

QThe mainline and stable kernel repos now require two-factor authentication dongles

malicious hands, however, have resulted in the adoption of a two-factor authentication system powered by the popular YubiKey hardware tokens – helped by a donation of 100 YubiKeys, distributed freely to active participants. “We wanted to further tighten our access requirements, but without causing undue difficulties for the kernel developers. We needed a solution that would allow people to enrol their own devices remotely and do most token management on their own,” explained Konstantin Ryabitsev. “At this time, both the mainline and stable Linux kernel repositories are already protected requiring two-factor authentication before a git push is accepted. “We are hoping that many more [developers] will choose to turn on two-factor authentication on their own repositories hosted at kernel.org,” he added, “to make it that much more difficult for an attacker to sneak in a malicious commit.”

LINUXCON

Torvalds still hoping for desktop dominance Linus Torvalds, creator of the Linux kernel, has indicated that he still hasn’t abandoned the hope of seeing his creation dominate the desktop market in the same way it has dominated the server, high-performance computing, mobile and embedded sectors. Responding to a question from kernel developer and moderator Greg KroahHartman at the LinuxCon North America kernel panel about where the platform should target next, Torvalds stated clearly: “I still want the desktop. “The challenge on the desktop is not a kernel problem. It’s a whole infrastructure problem,” Torvalds explained. “I think we’ll get there one day.” Asked whether this could be the “year of the Linux desktop”

by Kroah-Hartman, a regularly occurring prediction that has yet to prove true for any given year, Torvalds laughingly replied “I’m not going there!”

QThe year of the Linux desktop has been

‘around the corner’ for almost 20 years…

13th – 15th October

The official Git repository for Linux kernel development has moved to a two-factor authentication system to protect the source code from malicious modification. Currently, the Git repositories require that maintainers and contributors use SSH key pairs to authenticate with the server. Concerns over the possibility of said keys finding their way into

13th – 15th October

YubiKeysusedtoprotectGitrepository

LinuxCon Europe

Embedded Linux Conference Europe

13th – 15th October

Kernel adopts twofactor authentication

Linuxcalendar

CloudOpen Europe

15th–17thOctober

DEVELOPMENT

» Congress Centre Düsseldorf » Germany » events.linuxfoundation.org Bringing together sysadmins, developers, architects and more from across Europe, LinuxCon aims to educate and encourage collaboration on problem-solving to further the Linux platform.

» Congress Centre Düsseldorf » Germany » events.linuxfoundation.org Taking place alongside LinuxCon, ELCE is specifically for those interested in embedded Linux and includes sponsorship from Yocto Project, Google and open hardware specialist Olimex.

» Congress Centre Düsseldorf » Germany » events.linuxfoundation.org As well as LinuxCon and ELCE, Congress Centre Düsseldorf plays host to CloudOpen at this time, which includes keynotes from Linus Torvalds, Jono Bacon and Joanna Rutkowska.

Linux Plumbers Conference » Congress Centre Düsseldorf » Germany » linuxplumbersconf.org If you can spare a couple of extra days in Düsseldorf, the Linux Plumbers Conference offers topics focused on the platform’s inner workings: kernel subsystems, core libraries, windowing systems and the like.

7 www.linuxuser.co.uk

OpenSource

Your source of Linux news and views www.linuxuser.co.uk For the latest news and views

Email us directly… [email protected]

DEVELOPMENT

Nvidia launches CUDA 6.5 Claims ARMv8 support will bolster HPC Nvidia has launched the latest version of its Compute Unified Device Architecture (CUDA) toolkit, version 6.5, adding support for the latest ARMv8 instruction set ahead of the public availability of its Project Denverbased Tegra K1 64-bit dual-core system-onchip (SoC) parts. Designed to allow rapid development of graphics processor-powered parallel applications, but compatible only with Nvidia’s own GPU hardware, CUDA 6.5 offers support for the new 64-bit ARMv8 instruction set for the first time. With Nvidia planning to launch a 64bit dual-core variant of its Tegra K1 processor, which will include 192 Kepler-class graphics processing cores offering a claimed total of 300 gigaflops of single-precision floating-point compute performance, the launch is well-timed.

“The heritage of ARM64 [ARMv8] is in low-power, scale-out data centres and microservers, while GPUs are built for ultra-fast compute performance. When we combine the two, we have a compelling solution for HPC [high-performance computing,]” claimed Nvidia’s Mark Harris at the CUDA 6.5 launch. “ARM64 provides power efficiency, system configurability, and a large, open ecosystem. GPUs bring to the table high-throughput, power-efficient compute performance, a large HPC ecosystem and hundreds of CUDAaccelerated applications. For HPC applications, ARM64 CPUs can offload the heavy lifting of computational tasks to GPUs. CUDA and GPUs make ARM64 competitive in HPC from day one.”

QCUDA 6.5 supports the latest 64-bit ARMv8 instruction set ahead of the Tegra K1 launch

CUDA 6.5 is available for download now following free developer registration, while the 32-bit Tegra K1-based Jetson TK1 development board is on sale now for £199.99 (reviewed on page 80). Nvidia has not yet offered a launch date for its 64-bit equivalent.

OPEN SOURCE

Munich to evaluate LiMux success Return to Windows a possibility following claims of complaints The City of Munich is evaluating its IT system and could abandon its pioneering opensource adoption programme, restoring its systems back to Microsoft’s proprietary Windows platform following what are claimed to be user complaints about the Linux systems currently in use. According to a report from local news outlet Süddeutsche, Munich’s deputy mayor Josef Schmid is considering replacing around 15,000 Linux-based systems with Windows. “No matter which department I see, everywhere I get told that employees suffer [from using Linux,]” Schmid is quoted as saying. “We have to change.” An independent expert group has been appointed to analyse the situation. “If the experts recommend a return to Microsoft,” he told the outlet, “this is not impossible for me

8 www.linuxuser.co.uk

to do.” Schmid also claimed that the total cost of ownership for Linux has not been proven as being less than its proprietary alternatives. “We have the impression that Linux is very expensive,” he added, “because a lot has to be programmed ourselves.” However, this is not to say that the focus is on LiMux alone. Rather, the council’s recently elected mayor Dieter Reiter has commissioned a report into the future IT system for the council. In an interview with TechRepublic, council spokesperson Stefan Hauf clarifies, “Not only for LiMux but for all of IT. It’s about the organisation, the costs, performance and the usability and satisfaction of the users.” The City of Munich was one of the first governments to look towards a shift away from proprietary software, having begun its

QThe City of Munich has appointed experts

to rule on whether it should abandon LiMux migration to the custom-developed LiMux distribution in 2004. Schmid’s reported claims aside, the move has generally been reported as a major success.

News

The latest in the Linux community

OPEN SOURCE

ANDROID

Intel pushes for x86 Android gaming Partners with Unity to improve developer tools

QUnity developers will be able to access Intel graphics technology

Intel, whose system-on-chip processor designs are struggling to gain ground against industry incumbent ARM, has announced a partnership with game engine company Unity to bring native support for its software to x86-based Android handsets. Currently, many popular applications – especially in the gaming market – are available exclusively for ARM-architecture devices, with the relatively rare x86 instruction set architecture being largely ignored when it comes to software that requires native compilation. The partnership with Unity will, Intel has claimed, allow developers to quickly port their Unity Engine projects to Android on x86 chips without compatibility issues. “We’ve set a goal to ship 40 million Intel-based tablets this year and expect more than 100 Android tablet designs on Intel in the market by the end of this year,” claimed Intel’s Doug Fisher. “Our collaboration with Unity will give its nearly 3 million developers the necessary software tools and support to build amazing Android experiences on Intel architecture.”

SECURITY

Synology hit by SynoLocker malware

GIVE YOUR DATABASE AN INFORMATION IMPORT.

Encrypts files, demands Bitcoins Synology network-attached storage devices have been hit by a selfpropagating ‘ransomware’ package dubbed SynoLocker, leaving users locked out of their files unless they pay an ever-increasing ransom. Based on the publicised source code of CryptoLocker, SynoLocker exploits a vulnerability in Synology’s Linux-based DiskStation Manager (DSM) software to gain access to internet-connected DiskStation devices and encrypt all drive contents. Once encryption has begun, the administration page is replaced with a demand for the payment of 0.6 Bitcoins – around £210 – to gain access to the decryption key, with delay in payment causing the fee to rise over time. Synology has indicated that the vulnerability used by the attack was patched in December 2013, and only users running DiskStation Manager 4.3 and earlier without the December patch installed are vulnerable to attack. Updating to the currently available releases of DiskStation Manager will close the vulnerability but not restore access to encrypted files. The attacker or attackers behind SynoLocker have indicated that they will close the site offering decryption keys, promising to sell the entire database for 200 Bitcoins (around £61,000). At the time of writing, however, the site remained active and keys were still being made available for individual purchase by affected users.

We'll share our knowledge to improve yours. 100% of our clients rate our PostgreSQL training courses as excellent. Book your place and gain access to unrivalled knowledge of the core code.

+44 (0)870 766 7756 2ndquadrant.com/knowledge

OpenSource

Your source of Linux news and views www.linuxuser.co.uk For the latest news and views

Email us directly… [email protected]

NEW EVENT

Linux Foundation announces Vault conference Addresses Linux-based storage and filesystems Aiming to bring the world’s leading developers in filesystems and storage within the Linux kernel together with related projects, The Linux Foundation has launched the Vault conference. Vault will take place on 11-12 March 2015 in Boston, alongside the exclusive Linux Storage, Filesystem and Memory Management Summit. The Linux Foundation hopes to drive innovation in Linux-powered storage hardware and filesystems by creating a space for dialogue and extending the existing collaboration between software developers and hardware vendors. “90 per cent of the world’s data has been created in the last few years and most of

VAULT LINUX STORAGE AND FILESYSTEMS CONFERENCE Above You can submit a speaking proposal for Vault on the Linux Foundation website that data is being stored and accessed via a Linux-based system,” said Linux Foundation chief marketing officer Amanda McPherson. “Now is the ideal time to bring the open source community together in this new forum, Vault, to collaborate on new methods of improving

Get hands-on with your Raspberry Pi Thanks to your help, the first issue of our new digital-only siste RasPi – launching with a special guide to programming you drone – has really taken off and made a buzz in the Pi comm And if this is news to you, head over to iTunes and take a look gorgeous app for yourself. The dedicated magazine for those who flick straight to the red-edged pages of this one each m RasPi has been created to give you the best possible re experience on your iPad. Full of sharp photography, smart and all the Fritzing diagrams you could want, each issue w you through one big project and a host of tutorials designed to your making and coding skills to the next level. There’s a free to building a Pi-powered buggy inside the app, so if you want taste of the Raspberry Pi goodness then get it now from iTune bit.ly/1ogR86l

capacity, efficiency and security to manage the huge data volumes envisioned in the coming years. By bringing together the leading minds of Linux file systems and storage and our members who are pushing the limits of what is possible, Vault should expand the state of the art in Linux.”

UNLOCK

POWER F AND OID

Available from all good newsagents and supermarkets

ON SALE NOW

> Android Wear smartwatches > Chromecast alternatives > Moto G 4G review HARDWARE REVIEWS

ANDROID HACKING

TIPS & TRICKS

APP REVIEWS

HELP & ADVICE

BUY YOUR ISSUE TODAY Print edition available at www.imagineshop.co.uk Digital edition available at www.greatdigitalmags.com Available on the following platforms

facebook.com/littlegreenrobot

twitter.com/lgrobot

OpenSource

Your source of Linux news and views

THE FREE SOFTWARE COLUMN

Self-documentation of code Richard examines the inadequacy of documentation for free software and asks whether there’s a better way of producing it

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

The inadequacy or lack of documentation of software is a recurring issue. This applies just as often to proprietary software as it does to free software. Documentation of code has two main purposes: to make the code readable for other programmers, and to make the code useable. Good documentation of free software is vital for users, and contributing to the documentation (or translation to a minority language) of a free software project is a good way to get involved for those who don’t know where to start, or how to program, and want to know how it’s done. The problem is a shortage of recruits. Good code is self-documenting and looks right even when you don’t know its purpose. Good code just works, and even when it fails, is easy to fix. Code that doesn’t feel right at a glance is almost certainly better rewritten from scratch, or you’ll never get to the end of the problem. Code that doesn’t contain some level of internal documentation is hard to follow and maintain. Or, as Linus Torvalds puts it in his own coding style guidelines for the Linux kernel, “You know you’re brilliant, but maybe you’d like to understand what you did two weeks from now.”

12 www.linuxuser.co.uk

He also suggests the reader of his coding guidelines begins by first “printing out a copy of the GNU coding standards, and not read[ing] it. Burn them, it’s a great symbolic gesture.” Torvalds is sceptical of rules and guidelines, but his own document on coding style is a tacit acceptance of the fact that a bit of documentation makes a lot of things a lot easier. We like the source code, but reading the source code isn’t always the best way to discover the coder’s intentions – just as the coder’s intentions are not always the same as what the code actually does. Code is about style, and good code not only solves the immediate problem but leaves a solution in place for the next sequence of problems that might arise. In the broadest sense, documentation and usability are interchangeable notions. A program without a clear description of its purpose and parameters is incomplete. Good documentation is even more vital at the user level, and isn’t always reliable, whatever its source. Documentation suffers bugs and errors just like the bugs and errors that afflict both good and bad code – probably more so, because the programmer, the one who is most likely to know what the code actually does, isn’t always involved in the production of the end-user documentation. Linus Torvalds once declared: “Stacks of papers, diagrams and rules are absolutely worthless if you can’t just understand the fact that documentation is nothing more than a guide-line… Once you realise that documentation should be laughed at, peed upon, put on fire, and just ridiculed in general, then, and only then, have you reached the level where you can safely read it and try to use it”, he wrote. “I’m continually

amazed and absolutely scared silly by your blind trust in paperwork, whether it be standards or committees or vendor documentation.” The internals of the Linux kernel are of primary concern to system level programmers, and as such are not typical. System and userland code have very different purposes, and system level and userland documentation will also tend to have very different audiences, but documentation gives both the user and the coder an entry point into the code and its purpose. Projects like Gimp or LibreOffice require specialist documentation because there are so many variables, but typically, software written to a Unix model is modular and has a single purpose, and requires little documentation other than a lucid description of its purpose and the effect of its inputs and outputs. The person who knows the code best is the programmer, and there is an argument for saying that software, with headers written by the programmer to a coding style and flexible syntax rules, and I/O written to strict I/O guidelines (such as KDE programs might be), can be truly selfdocumenting. Software can be used to parse program headers and I/O descriptors and generate formatted documentation to a given standard. This is not an original idea, and is not as unrealistic or as prescriptive as it may seem. The immediate results may be imperfect, but practice can only improve the outcome, and it has been done before – but can only work if a project has a good set of rules on internal documentation and acceptance of code.

“Goodcodeisself-documenting and looks right even when you don’t know its purpose”

Opinion

The latest in the Linux community

OPEN SOURCE

THE OPEN START-UPS COLUMN

Manchester’s start-up scene Free software and an open community kick-start tech entrepreneurs in Manchester

Left SpacePortX replaced TechHub Manchester as an open space for start-ups in the city

Richard Smedley is a Unix and networking jack-of-all-trades, specialising in free and open source software

Look beyond London, and one of the largest concentrations in Europe of all things innovative in IT is Manchester, which – despite having a quarter of London’s population, and little of the media and government attention – has a thriving tech start-up scene supported by a range of groups covering every technology or business methodology; the Lean Agile Manchester meet-up group alone has nearly 400 members. The history of computing in Manchester University goes back to the Forties, and an Alan Turing memorial statue sits in Sackville Park – every summer a Geek Pride event is held in his memory. But it’s away from the university, in the bohemian Northern Quarter, that techies followed the artists in colonising low rent buildings for shared office space or, for those bootstrapping businesses on a real shoestring, looking around the cafés for the tables where they can plug in their laptop chargers and work all day for the price of a few coffees. An informal community has grown up around these nomadic knowledge workers, with the more formal getting together through co-working events, often at

MadLab, the Manchester Digital Laboratory, “bringing together the various communities of doers and thinkers that make this city brilliant and see what comes of it.” With more capital behind it, TechHub Manchester was “a community and workspace for tech entrepreneurs and startups” holding events like TechHub Startup 101 (“Launching a hardware product”) and, while Barcelona startups meet to play volleyball tournaments, even a “Startup Yoga” event. This summer the space declared independence from the global TechHub network and relaunched as the playfully-named SpacePortX. Meanwhile, Founders’ Assembly gives you a chance to review progress with peers, and get helpful suggestions and connections – while CollaborationBoutique allows budding entrepreneurs to post their interests and skills, or find more experienced collaborators. None of this would be possible without the benefits of Free and Open Source software. Start with the platform: Ruby-on-Rails is “a good way to get an MVP (minimum viable product) up fairly quickly, and start engaging with the customer,” Ian Moss told LU&D. Moss is founder of travel start-up 196 Destinations and, along with Capital Relations owner Coral Grainger, collates the longrunning Manchester StartUpDigest newsletter. R-o-R is widely used in Manchester: at homecare schedulers (and Northern Tech

Awards 2013 winner) Malinko, and recruitment platform Volcanic – as well as being at the heart of operations for Manchester developer outfits like Stardotstar, Hedtek and Linked Data experts Swirrl. The latter recently released Tripod – the RDF and SPARQL ORM it developed for use in Rails apps – under an MIT licence. You can see Rails in use at companies that started up in Manchester a decade ago, like social ticketing company Fatsoma. Hosting company ByteMark also choose Ruby as their scripting language, but are particularly notable for the use of FOSS throughout their infrastructure, contributing back to projects and sponsoring community events. The NW Ruby Users Group meets regularly in Manchester, offering talks, practical introductions to technology and social events. Start-ups in the UK and around the world wouldn’t be able to do the amazing things that they do without a world of free and open source software. We’ll be reporting here on start-ups using and producing free software from around the world and we’d love to hear from you about your start-up’s involvement with open source. Next month we’re asking why all this free software use doesn’t necessarily lead to free and open products.

13 www.linuxuser.co.uk

OpenSource

Your source of Linux news and views

JON MASTERS

Thekernel column Jon Masters summarises the latest happenings in the Linux kernel community, including ongoing work towards the 3.17 kernel

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

Linus Torvalds announced the first release candidate 3.17 kernel (RC1) just ahead of this year’s Kernel Summit. Noting that he would be travelling (and thus not able to keep up with a massive influx of patches), he had closed the “merge window” (the period of time during which disruptive churn is allowed in any kernel development cycle) for 3.17 one day early. He also noted that, typically of northern hemisphere summers, this merge window had been “slightly smaller than the last few ones”. New features pulled into 3.17-rc1 were spread all over the kernel. They include the getrandom() system call, and support for the “memfd” and “file sealing” features needed for kdbus.

14 www.linuxuser.co.uk

We covered getRandom in LU&D a few issues ago. It provides a new resource-safe API for obtaining random numbers (entropy) that is even safe against very low availability of resources (starvation) that can occur, or be arranged to occur by an attacker, on some systems. In the absence of sufficient resources available to open /proc and /dev filesystem entries, it might be that programs such as the OpenSSL library and the OpenSSH system service are unable to use the traditional /dev/random style interfaces for obtaining the random numbers used to seed the cryptographic algorithms that power secure sessions. The new system call provides an always-available random number source, such as has been available on BSD systems for years, because a lack of free file descriptors does not affect the ability to use syscalls. Thus, a possible attack vector is mitigated and tools can begin to use the new system call on Linux kernels greater than or equal to 3.17. More specifically, library functions that provide entropy can choose to do so. At the architecture level, 3.17 adds fourlevel page table support to the 64-bit AArch64 (arm64) architecture, which brings it on par with x86 in terms of the addressable physical memory that can be used by Linux on such hardware. Though there is no way that systems with that much physical memory to explicitly require addressability of the full physical 64-bit range (actually 2^48, which is 256 Tebibytes) will exist for a long, long time, there can be value in being able to have a sparsely-populated physical memory map on 64-bit systems (mixing memory and IO devices). 3.17 removed support for several ancient architectures that are no longer in widespread use. As is typically the case, no formal planning was in place to remove such architecture support, but rather, breakage went unfixed for long enough to make it obvious to

the kernel community that there were no actual users with an interest in support.

Preparing for kdbus Preparation work landed in 3.17 for the forthcoming “kdbus” in-kernel implementation of D-BUS. D-BUS is an IPC (Inter-Process Communicaton) system originally defined by the FreeDesktop, and GNOME communities (and also now used in KDE as of QT4). D-BUS allows system services to register themselves using an assigned name within a global namespace and then to send and receive messages to other services. Services can be activated in response to messages, which is how many of the modern Linux desktop capabilities are provided. In a typical implementation, there is one specially privileged “system channel” provided upon which various core services communicate, and one “session channel” per login session for system users. Typically, K-BUS is implemented using the (now venerable) dbus-daemon, but work is underway to roll much of this into the all-consuming systemd service. As part of that effort, another broader effort is underway to enhance performance using a kernel mechanism. Kdbus aims to reduce the number of different interactions required in order for one service to send a message to another using the D-BUS mechanism. As a purely userspace service, the existing services necessitate that a sending process make a system call to transit a message, which is then handled by a (lightweight, but still in the middle) dbus-daemon, and finally received by the intended recipient of the message via yet more round trips into and out of the kernel. Rather than requiring so many context switches between various processes (known as “tasks” within the kernel), kdbus obviates the need for a special daemon in many cases. Instead, messages can be directly sent and received in the fast-path

Opinion

The kernel column – Jon Masters

OPEN SOURCE

“Affected systems will believe they are reliving the Seventies all over again” previously described. In some other cases, more heavyweight handling might be required, so a system service will remain, especially for legacy applications. In order for kdbus to operate, some changes to the kernel are required (beyond simply providing kdbus itself). These include the (newly merged) “memfd” mechanism that provides for zero-copy sharing of trackable memory regions between processes (using a memory file descriptor as one would use a traditional file descriptor). The “file sealing” capability works hand in hand with “memfd” since it is necessary to allow a message sent within a shared memfd to be decoded and interpreted by a receiving process without risk of a sending process trying to modify the content after it has been sent, thus the “sealing” part. Once a memfd is sealed it cannot be changed by the sending process. A typical kdbus message transmission will take the form of a process allocating a memfd, building a message into that newly allocated memfd, sealing it and then passing it to kdbus for transmission. Since kdbus is an in-kernel mechanism, that transmission can take place in a very lightweight “zero copy” fashion, in so much that the kernel can play a few classical memory management tricks to directly share the memfd buffer.

Ongoing development A number of increasingly urgent conversations have taken place over the past few months about Linux readiness for the 2038. These culminated in a (lengthy) “discussion fodder” post from John Stultz on the topic ahead of the 2014 Kernel

Summit. John proposed a number of responses to the “end of time for 32-bit architectures”, such as the introduction of a new special sub-architecture variant of the popular 32-bit architectures with a newer ABI supporting full 64bit time quantities, as well as other less drastic options. 2038 is special for Unix and Unix-like operating systems in that just after 3am UTC on 19 January 2038, 32-bit Unix time_t quantities representing the number of seconds since the Unix epoch (birth) in 1970 will overflow, and affected systems will believe they are reliving the Seventies all over again. There is some time (pun intended) to address this problem, but not as much as readers may think. While most financial systems (calculating interest on mortgages 25 and 30 years out, for example) have long since been upgraded to 64-bit (or have other solutions that are unaffected), other embedded or less critical systems having to represent future dates will take many years to be replaced, so the sooner a solution is in place (other than “just go 64-bit”) the better for everyone. Matt Fleming, Yinghai Lu, Harold Hoyer, and Mantas Mikulenas had a discussion around support for loading kernel initramfs (initrd) image files above the 4GB boundary in physical memory on 64-bit EFI-based x86 systems. Traditionally, such support has been limited due to various assumptions that might be in place within system firmware and kernel code around the venerable x86 PC platform. Although the kernel handles this well, and UEFI is more than capable, the introduction of a patch allowing for an initramfs above 4GB resulted in breakage for Mantas due

to “buggy firmware” on his system. Yinghai noted that his request for introducing the patch in the first place had been to support multi-GB sized initramfs images, which generally are rare corner cases today. Daniel Thompson posted patches allowing “selective reduction in capabilities” within kdb (the optionally built-in Linux kernel debugger) that can be used for so called “kiosk mode” applications in which physical system access might be made available to those who should not be able to trivially launch a kernel debugger through a few physical keypresses. This is similar to work done to restrict general use of the kernel’s “magic sysrq” key combinations such that users can’t arbitrarily reboot the system or cause kernel diagnostic output. Mitchell Joblin of the University of Passau posted to the Linux Kernel Mailing List (LKML) noting that the university is conducting research into various “Linux Development Collaboration Patterns” concerning social interaction between developers in open source communities. He solicited for feedback in a survey hosted at http:// rfhinf067.hs-regensburg.de:8080/login.html. Finally this month, Stephen Rothwell followed up to the Linux 3.17-rc1 release with his usual set of linux-next statistics for the preceding cycle. Linux-next is the feeder for many features that end up in future kernels; this is supported by the fact that 90.7 per cent of the changes in 3.17-rc1 had previously been listed in linux-next.

15 www.linuxuser.co.uk

Feature

KDE Plasma 5 vs GNOME, Unity… The 10 best Linux desktop environments tested

KDE Plasma 5 Gnome | LXDE | Unity | Cinnamon & more We pit Plasma 5 against the other nine best desktop environments to see if KDE comes out on top, and which is the best fit for you Roll back a few years and the Linux landscape looked very different. The last time we took a good look at desktop environments to see which was worth your screen space, it really was just a two-horse race between GNOME and KDE. Since then, GNOME has changed drastically, giving rise to a touch-oriented desktop that catalysed the emergence of MATE for those who longed for the good ol’ days of GNOME 2, while KDE had a slightly less than smooth transition from Plasma 3.5 to Plasma 4 that left many nervous about Plasma 5. As a result of both of these evolutions and the emergence of some compelling alternatives, the arena is no longer dominated by these two heavyweight desktops alone. But despite this, the recent launch of KDE Plasma 5 was one of the most exciting and talked-about desktop environment releases in a long while, putting the spotlight again on the GUI. With KDE being the mainstay of many

a Linux user’s machine, the real question now is whether or not Plasma 5 is the best desktop available today – and if not, why not, and what are the viable alternatives? So, over the next few pages we’re going to be running through the competition and showing you that in addition to the heavyweights, there are also some lightweights, newcomers and underdogs that are worthy of consideration the next time you decide to refresh your computer with a brand new desktop environment. To help you decide which one is right for you, we’re going to be analysing each desktop in terms of its design, workflow, ease of use and its philosophy, as well as identifying which types of use each is most useful for. So if you’re ready to renew your desktop, read on to see how our ten champions fare in this desktop battle royale!

12:29

Feature

The Heavyweights

KDE

Pros

Beautiful design, unique approach to app and file management

The beautiful desktop p has jus st received a ma ajor upgrade th hat n aesthe etics s reflects more modern Best for Home leisure Associated distros Kubuntu, openSUSE, Mageia Workflow Uses the traditional desktop metaphor, with a window bar and program menu. Files, folders and widgets can be organised on the desktop as well

http://kde.org/

To us, KDE has always been the desktop that has had the best aesthetics. Everything is uniform and beautiful. However, the designs sometimes get stuck in the time they were made in, and KDE Plasma 4 looks a little bit dated in 2014. However, that's all about to change as Plasma 5 has launched with a brand new look and a slightly different workflow. KDE versus GNOME was the desktop battle of the previous decade, with sides apparently leaning towards GNOME but with plenty of reasons why you should check out KDE. In the end, neither really won and, while still very popular, they’re no longer in the zeitgeist like your Cinnamons or Unitys. Plasma 5 may not be quite the spark to get the old rivalry going again but it's definitely an interesting update to the desktop environment. Firstly, the workflow is roughly the same: a mouse-led workflow for organising windows on the desktop and on the bottom panel, listed in the traditional method. KDE popularised widgets on the Linux desktop and they remain in the latest version of the desktop, including the interesting folder view

Cons

Oneofthemost resource-heavy desktopswithweak searchcapabilities

from Plasma 4. While this is not activated by default like the previous KDE, it can be added like any other widget to better organise your files and desktop. The new aesthetics for Plasma 5 are really very nice. Crisp, clean straight lines of modern computers and extremely well-labelled in the process. It’s absolutely wonderful to use when it’s working and reminds us of using Cinnamon for the first time when that was the king of design, and KDE 4 before that. It is still a touch buggy, though, and doesn’t play nicely with other installations of KDE 4 on the same distro. It's also not readily available through repositories yet, so you’ll have to go looking on Google for instructions on how to install it – for major distros this usually involves downloading installation files, or adding a repository/PPA to your system and then installing it from there. Otherwise you need to look into compiling it from source. Plasma 5 is definitely one to keep an eye on as it matures over the next six months, and we’re interested to see if new usable features will be added rather than design overhauls.

Plasma 4 Plasma 5 is still brand new and may take an iteration or two of your favourite distro for it to make it into the repos. It’s also not 100 per cent stable at the moment so you may have better luck trying out the previous version of KDE: Plasma 4. It’s still being developed and updated, and includes a very interesting way of organising open folders on the desktop for quick access and tidying. Right now, Plasma 4 is the version of KDE you'll find in most of your repos under KDE. Above The KDE design is beautiful, taking the clean lines of other modern desktops across all platforms

KDE & GNOME

The 10 best Linux desktop environments tested

GNOME

Pros

A stable, mature codebase popular among developers

The veteran de esktop environ nmentt is forging a ne ew path of its own h that not everyyone agrrees with

Cons

Aquitedifferent interfaceseemingly designedfortouch devices

Best for Development, touchscreens Associated distros Fedora, Red Hat Enterprise Linux Workflow The system is designed for both touchscreens and keyboard-heavy navigation via shortcuts, reducing the emphasis on the mouse

www.gnome.org

Common shortcuts Above The search function in GNOME was one of the first to be implemented into a Linux desktop environment

The GNOME desktop is probably the most well-known desktop in all of Linux, in no small part due to its extreme popularity during the last decade. It was the desktop of choice for a lot of distros, although there wasn’t as much choice as there is now, meaning most Linux users active in the Noughties will have encountered it at least once in their lifetime. Things change, though, and GNOME received a radical overhaul in 2011 that didn’t go down so well with several vocal members of the community. The all-important workflow of GNOME 2 was dropped for a brand new design that relies heavily on keyboard shortcuts along with mouse control. Over the intervening years, features have been added that imply a touchfocused interface reminiscent of the way you’d control running apps and windows on a smartphone or tablet. The current philosophy behind GNOME seems to be a drive towards simplicity. Many native apps only contain the bare minimum features for the task they perform, such as the GNOME browser and the network managing tools. When maximised, windows

Windows button/super key Opens the Activities overlay, which accesses the different apps and gives an overview of the desktop. You can immediately search for software and files or quickly close/move between windows Alt+` Switches between windows of the same application – this is handy if you have Alt+ Tab switching between apps Ctrl+Alt+Up/Down arrow Switches between workspaces

Above Exposing the desktop with the windows button is a key part of a quite different workflow process

lose the ability to be exited via the classic x symbol in the corner. In fact, normal windows do not have a maximising or minimising button. Toolbars are accessed from the top panel in an effort to keep things neat and tidy, to possibly increase screen real estate, and generally give the whole desktop a more smartphone-esque appearance. There are a number of issues that this can cause. As the design goes against the traditional ‘desktop metaphor’ seen in most desktop environments, it can take some time for people to adjust – especially if you sometimes need

Ctrl+Alt+T Opens a terminal emulator

to go back to more traditional desktops in the meantime. The reliance on keyboard shortcuts also means that mousing around the desktop requires many more actions than before. With a bit of practice and know-how, learning the new workflow and switching out the default apps can lead to an excellent desktop with advanced search capabilities. It will still have a few quirks about it, and there’s no real way to use it on a touchscreen just yet, but it may well be a forwardthinking move if technology does go that way.

12:29

Feature

The Newcomers

Unity

Pros

Desktop search hooks into online services and system tools

Ubuntu’s desk ktop envvironm ment is part of a dis stro and d devic ce-spanning conc cept Best for Family computer, media PC Associated distros Ubuntu, LXLE Workflow Use of search and the HUD to perform actions as well as regular browsing of the side bar to click between apps. Good for touchscreens

https://unity.ubuntu.com/

Unity shortcuts Windows button/super key Opens the search bar and lens as well as bring up the sidebar if you have it set to hide. You can type to search or click around to get what you need from there Alt Activates the HUD to search for commands with the toolbar of open applications or in-focus windows Alt+` Switches between windows of the same application, as Unity sets software switching by default for Alt+Tab Ctrl+Alt+Up/Down/Right/Left arrow Switches between workspaces which are organised in a square grid pattern once they’ve been activated Ctrl+Alt+T Opens a terminal emulator

Right The Unity search uses different scopes to make searching easier – these can be customised and more scopes can be added

One of the most controversial desktops to date, Unity is part of Canonical’s grand vision for an overarching Linux distro – in this case Ubuntu – across several types of devices. Being familiar with the desktop means you should be able to get started straight away on the phone interface as well, or at least that’s the theory. Launched in 2010 and becoming Ubuntu’s default desktop in 2011, Unity is a graphical shell that sits on top of GNOME and was originally implied as an alternative to GNOME 3 when it was released (to divisive reception around the same time). Unity takes the search aspect of modern desktops and tries to split it up into categories for easier navigation, which is particularly handy if you’re not sure exactly what you’re looking for. What kind of music are you feeling in the mood to listen to today? Maybe you should scroll through the music tab to find out. Even if you do search, you can then easily drill down between these lenses and even add more as you see fit. The launcher on the side acts as a quick launch and a way to switch

Cons

Advertisingisbuilt intothesystemand thereareprivacy concerns

between open applications, with a focus on application-switching rather than windowswitching by default. There are also some extra minor features like the HUD, a way to access items in the toolbar of any open or in-focus applications instead of mousing through menus. It’s an interesting system but, as a lot of workflow is based on muscle-memory or only remembering the vague description of menu items, it’s not always helpful. It’s very much one of the more touch-friendly desktops, so much so that it almost makes the mouse seem like a hindrance to the operation of the desktop. Much like GNOME it can be keyboard-heavy in a lot of senses, however it generally feels a little more usable than the current GNOME shell because the mouse isn’t completely obsolete. While Unity is heavily tied to Ubuntu it is open source and said source is available for you to use. It’s not regularly packaged in repos, though, so you will have to find a third-party repository or build it from scratch.

Unity & Cinnamon

The 10 best Linux desktop environments tested

Cinnamon

Pros

Straightforward and smart design using traditional desktop metaphor

The former GNO OME fork that ha as emerged as one e of the more pow werfull ktop environments s and flexible desk

Cons

Stillnotavailable everywhereand canalsobequite resourceheavy

Best for Office, everyday computing Associated distros Linux Mint, Antergos Workflow Traditional desktop metaphor relying on mouse navigation with windows on a taskbar but with extra keyboard shortcuts to facilitate navigation

http://cinnamon.linuxmint.com

Above Cinnamon started as the GNOME shell in a more traditional configuration and has evolved into a unique thing

Linux Mint has been around longer than the GNOME shell or Unity, and in fact used GNOME 2 as its default desktop for a time. Like Ubuntu, once GNOME updated the desktop to its current version, the team at Linux Mint decided they wanted to use something slightly different. After trying out a release with the Mint Gnome Shell Extensions (MGSE) to bring the desktop to a more recognisable state, the team forked GNOME to create the Cinnamon desktop for the following release. The design ethos of Cinnamon has been to take the advanced features of GNOME – namely notification integration and desktop search – and package them in the more familiar format of the so-called traditional desktop metaphor. This includes an application menu and open windows listed on the panel at the bottom. In addition to these basic features is a highly customisable applets section that lists and accesses specific services such as networking, updates, notifications, display resolution, and more. Features can be added and removed from here and in recent updates they will smartly sense when a different application is handling

some of these core tasks and make sure icons don’t double up. Cinnamon is very much about not compromising. There are no features included just for the sake of a philosophy or corporate deal. There is no unnecessary branding, and the interface is quite minimalist in size but not function. Everything is neatly labelled and presented to maximise finding your way around the desktop and file manager. It's most certainly not touch-friendly, though. Menus are small and designed to maximise screen real estate, making buttons difficult to press if that’s how you want to use them. In terms of keyboard shortcuts, the basic super key to open the search and Ctrl+Alt+direction key still work as they do in GNOME. However, Down and Up expose everything on the workspace or across all workspaces respectively. Cinnamon is now no longer a fork of GNOME, having become its own desktop and not just a shell around this time last year. This means it can grow beyond the boundaries set by GNOME and optimise the underlying code a bit more. However, it does result in a slightly less mature codebase. There are no major issues with it now, though.

Desktop exposure Using Ctrl+Alt+Up or Down simulates the effect of the Windows or super key in GNOME, bringing up an overview of the desktop. Pressing Up allows you to look across all the desktops and what windows are open in each – you can even name desktops from here or add more. Pressing Down or moving your mouse to the hot corner in the top-left will arrange all the open windows on the current desktop in a grid, allowing you to choose between them or quickly close them down.

12:29

Feature

The Lightweights

XFCE

Pros

An interface designed for the GNOME 2 generation

The first major lig ghtweightt deskto op take es some design note es from GNOME 2 but ath forges its own pa Best for Old computers, veteran users Associated distros Xubuntu, Debian Workflow A simplistic design utilising panels and a program menu that’s best manipulated by mouse, with open windows listed separately

www.xfce.org

With its built-in GTK+ 2 toolkit like the previous version of GNOME, XFCE apes its panel layout and basic workflow. It’s one of the oldest lightweight desktop environments around and more than likely popularised the concept once it was used for Xubuntu in the late Noughties. It’s not the most well-known light desktop, with LXDE winning the popularity contest between the two these days. XFCE still has its loyal followers, though, due to being reminiscent of the older GNOME 2 design and being one the few desktops with a dock bar. XFCE is comprised of said dock bar as well as a main panel on the top of the screen. This includes a program menu that not only includes the main software categories but also contains separate categories for system settings and preferences. Open windows are listed on this top panel while quick links to a customisable selection of apps is located on the dock bar. The dock bar doesn’t hide by default; it acts like a border for open windows, reducing screen real estate unless it’s removed or the hiding feature activated. You can also make the top panel hide to truly maximise screen real estate.

Cons

Limitedbybeing lightweight,lacks anyfancysearchor desktopeffects

As for lightness, recent benchmarks put XFCE at about 89 MB of memory, which is slightly higher than LXDE. XFCE is slowly making the update to GTK+ 3, which will increase this number. For now, though, it’s still a lot lighter than the likes of KDE and Cinnamon and will likely still be significantly less resourceintensive even when on GTK+ 3. It’s also slightly more functional than LXDE, with more going on in terms of the panel and the dock bar and more. Choosing between the two is very much a balancing act and depends on whether or not your system can spare a few more megabytes for a slightly more usable desktop.

Above The dock bar can cause screen real estate issues if you don't change it to autohide

Dock options The dock may not be to everyone’s liking – either you find it unnecessary or you want to make it hide when not in use. To do this, you need to find the panel settings menu in the XFCE settings; open this and select Panel 2 from the drop-down list. From here you can select the option to ‘Automatically hide and show panel’ which will remove it when it’s not in use, or remove the panel entirely by clicking on the minus symbol when it’s selected.

Above XFCE will look familiar to GNOME 2 users. You can switch out the dock bar for a panel to simulate it better

XFCE & LXDE

The 10 Best Linux desktop environments tested

LXDE

Pros

The lightest distro with the most recognisable interface

The lightest de esktop that doe esn’’t sacrifice usab bility for the sa ake e off a few extra cyycles

Cons

Somebasic,albeit non-essential featuresare removed

Best for Very old systems, underpowered and single-board computers Associated distros Lubuntu, Raspbian, Knoppix Workflow LXDE uses a minimal traditional desktop metaphor, with a panel at the bottom with access to programs and a mouse-orientated navigation system

www.lxde.org

Above Window managers can be changed to eke out every last megabyte, but the default one is pretty good itself

LXDE is so ubiquitous with being lightweight it's in the name. The Lightweight X11 Desktop Environment is newer software than XFCE, debuting in the late Noughties when GNOME and KDE were still the top two desktops around. Like XFCE it’s built on GTK+, but it resembles KDE 3 more with its take on the desktop. It’s about as minimalist you can get without actively losing the features of a standard or traditional desktop. It’s so concerned with resource use that a CPU monitor is incorporated into the panel by default. LXDE is a very mouse-driven desktop. There are no important keyboard shortcuts and everything needs to be accessed via point-andclick. Windows are typically arranged on panel and the window styling is incredibly minimalist. The program menu holds the standard range of categories for programs and access to settings and such. All the default LXDE apps are quite basic but they’re all quite customisable in the process. There’s nothing really quantifiably special about LXDE in terms of workflow – it’s just that it has a good basic workflow while being as lightweight as it is.

Specifically, LXDE uses only 78MB of RAM, which is 20MB on top of Openbox as a pure window manager. While this is only 11MB less than XFCE, if you're only running on 256MB of RAM, that’s a big enough amount to care. This is why LXDE is used on Raspbian, as the Raspberry Pi really cannot handle much. In terms of eking out every last drop of a more powerful system, the gains made between XFCE and LXDE are extremely negligible as you’re getting into serious diminishing returns when you’re concerning yourself over ten megabytes on an eight gigabyte system.

New file manager LXDE can be further modified to make it even lighter than its standard version, namely by changing the file manager. While Openbox is plenty light itself, there are other file managers that do just about enough and save on a few extra megabytes. Here are some suggestions on alternate file managers: IceWM A lightweight manager sometimes paired with LXDE on extremely lightweight systems FVWM A much older windows manager that was made in a time when resources were much more precious Enlightenment We talk about this later as a full-blown desktop but it can also be used as a lightweight windows manager in LXDE itself

Left Another simplistic program menu that does no more than it needs to

12:29

Feature

The Underdogs

MATE

Best for Veteran users looking for modern features Associated distros Linux Mint, Snowlinux

A fork and co ontinuattion off th he GNOME 2 cod de

http://mate-desktop.org

Cinnamon’s lighter counterpart is the continuation of the older GNOME 2 line, forking the code when some users were unsatisfied with the direction of the GNOME Shell. The MATE team’s design goals are to keep the GNOME 2 style of desktop alive and up-to-date, incorporating modern desktop features such as notifications and application/file search. It’s best for veteran users that prefer the workflow style of the classic GNOME 2 desktop: everything accessible from the top bar without hunting through separate apps, windows displayed on the bottom panel and a mouse-centric design. It’s currently in a fair few distros and is being added to more all the time. It’s much lighter than the likes of GNOME, KDE and Cinnamon too, but can’t really compete with LXDE or XFCE.

Above By default you can make MATE look exactly like the old GNOME 2, although Linux Mint uses a slightly different configuration

Pros

A lightweight continuation of the popular GNOME code

Cons

Alittle stuckinthe pastforsomeusers andcan'tcompete withLXDEorXFCE

Enlightenment An alternative lig ghtweigh ht optio on with h a unique yet fam miliar look k Pros

Lightweight and unique with a focus on usability and options access

Cons

Uniqueinterface maybeconfusingto utiliseforsomeof theusers

Enlightenment relies on a slightly atypical panel on the screen that contains system info and a list of open windows. The program menu is accessible from this panel, but right-clicking anywhere on an empty part of the desktop will also bring up the options. As the panel doesn’t properly take up the whole bottom of the screen it actually seems like you’re missing out on screen real estate, but Enlightenment uses it quite well. It’s very fast, light and mouse-heavy in its use. Due to the way the program menu is hidden away, it’s not the best candidate for a touchscreen, and it doesn’t really have a range of useful keyboard shortcuts either. It’s a very overlooked desktop that doesn’t use GTK or Qt to power it, making it much better at running a mixture of differently coded apps.

Best for Highly custom, light setups Associated distros Bodhi Linux, Elive

www.enlightenment.org

Above You can access the application menu from anywhere you want, just in case you can’t quite get down to the panel

MATE, Enlightenment, LXQt & Openbox

The 10 Best Linux desktop environments tested

LXQt The Qt port of the lightweight deskto op has some visuall differences s

Openb The window w manag ger ca an easily be use ed as a hype er-minimalist desktop p

Above The aesthetics of LXQt are closer to KDE than anything else, but despite that it's still LXDE

A port of the excellent LXDE to Qt instead of the GTK it’s currently built on, LXQt is also the Lightweight and successor to a desktop called RazorQt that we the same old LXDE had the pleasure of using for a period last year. with a fresh coat of paint It certainly rates as one of our favourite desktops. LXQt takes some of the aesthetic flourishes of KDE and other Qt apps and applies it to the Cons LXQtisactually LXDE framework – perfect for if you’re the sort alittleheavieron of person who uses a lot of Qt apps and would resourcesthan LXDE prefer a lightweight desktop, as it’s the only lightweight Qt-based one around. Recent benchmarks show RAM usage around 96MB, which puts it slightly higher than XFCE and significantly above LXDE. However, the developers of LXDE admit that with some better optimisation this number Best for will surely go down and will Old computers, test machines definitely be lower than a GTK+ 3 XFCE. Associated distros The workflow is basically None the same as LXDE, so moving over from one to www.lxqt.org the other isn’t a big hassle.

Pros

Above Openbox is really just a window manager and its minimalist design shows when used as a desktop

Openbox is usually thought of as more of a window manager – the thing that controls the Pros lightest way window’s aesthetics and placement within The to use a graphical the desktop environment. However, Openbox interface and can can also be used entirely on its own without be used on its own any other desktop overlay for the most minimal desktop imaginable, using the lowest amount of Cons Sacrificesuser resources possible. friendlydesignin There are no panels by default, although if favourofresources you want to then you can add some with other makingitimpractical software, and clicking on the desktop opens a program menu that lets you access the different apps and some of the settings. However, Openbox can be not only quite impractical but difficult to get used to if you don’t add any extra UI elements. Best for If you’ve installed Developer systems LXDE then it will usually show up as an alternate Associated distros desktop environment CrunchBang Linux, Lubuntu on login and is the main window manager of the www.openbox.org lightweight desktop.

12:29

Feature

Run Linux on your Android device Want an ultra-portable version of Linux? Then put it on your phone

26

Run Linux on your Android device

Install an ultra-portable version of Linux

FEATURE

oting questions s and outs of rooting an Android device ooting? it is gaining root access to control the Android system’s secure features. lves unlocking the device’s bootloader, g the recovery system with a custom and installing a superuser app. nefits does it offer? ges include the ability to modify every of the Android system, install custom verclock the CPU, install extra apps, OEM bloatware and, of course, run a wn Linux distro. ficult is it to do? cess differs for every Android device, n entails connecting it to a computer. the device must have USB Debugging in Settings>Developer Options, which when you tap the Build Number seven the About Phone/Tablet screen. If the command-line method using the ADB tboot tools is too daunting, there are

If you can’t wait for the launch of the official Ubuntu smartphones (the first models are supposedly due later this year), don’t want to shell out for a new phone anyhow, or would prefer to use a different version of Linux on a portable device, there is an alternative. It’s possible to run a variety of popular Linux distros on a standard Android smartphone or tablet – everything from a simple BusyBox toolset right up to a full distribution with a desktop environment. You don’t even need to root your phone for some of the methods that we explore in this feature. The advantages of running Linux on an Android device are manifold. As well as being able to SSH into other computers, you’ll have access to all your favourite Linux tools and you can also run a desktop GUI with most methods. The possibilities are endless. You could potentially even turn your Android device into a LAMP server to run web apps! So, if you’ve got an ageing Android phone or tablet kicking around, why not give it a try?

No rooting required As mentioned, some solutions for running Linux on an Android phone don’t even require you to root the device to circumvent Android’s security features and gain superuser privileges – although we’ll take a look at that process later. The first

and simplest of these is Kevin Boone’s KBOX2 project (see boxout to the right), a port of BusyBox packaged with a number of Linux utilities. As with most of the solutions we explore in this feature, it can be installed via an Android app available in the Google Play Store. Another simple non-root solution is the Limbo PC Emulator, a port of the QEMU hypervisor. The Android app can be downloaded in APK from from the project website (sourceforge.net/projects/ limbopcemulator). Download an ISO for the desired distro and you can then run it in a virtual machine created by the app. Since the app is emulating x86 architecture on an ARM-based device, however, it’s a bit on the slow side. Possibly a more useful alternative is the Debian noroot app, available from the Play Store (goo. gl/3XsbOV). While the app actually provides a compatibility layer rather than a full Debian OS, it does enable you to run Debian applications on your Android device. If you’re after a more fully-featured distro without rooting, however, the best solution currently available is the GNURoot app by Corbin Champion. Downloadable for free from the Play

numerous desktop utilities available to simplify the process. There’s even an Android app, Towelroot (https://towelroot.com), that can root many devices with a single button tap. What are the downsides? You’ll almost certainly void your warranty and there is a low risk of soft-bricking your device (ie it won’t boot up properly), but you should be able to restore it to working order using a connected computer with the adb and fastboot tools to re-flash the original Android ROM. Also, unlocking the device’s bootloader will perform a factory reset that wipes the device’s data and downloaded apps, so you’ll want to be sure they’re backed up first. While, by default, app data is backed up to your Google account in the cloud, it’s not exactly transparent and you’ll need to re-download the apps afterwards, so you might want to do a further computer backup. A good way to do this on a non-rooted phone is with ClockworkMod’s Helium Android app (goo.gl/Dq3o4F) and desktop client.

KBOX2 BusyBox An easy-to-install BusyBox with some standard Linux tools The KBOX2 project (kevinboone.net/kbox2. html) works by constructing a minimal Linux root file system within the private data area of the hosting terminal emulator app, so you’ll need to download one to use it – try Android Terminal Emulator by Jack Palevich (goo. gl/p8RPH2). While you can install KBOX2 manually from that app’s command line, it’s easier to use the OneBox Package Manager app (goo.gl/396OT0) – you’ll need to buy a companion app (£2.03/$3.10). Just follow the in-app directions and it’ll run the setup script for KBOX2 within the terminal emulator. Now go to the latter and enter: /data/data/ jackpal.androidterm/kbox2/bin/kbox_shell. The prompt should change to /home/kbox $. You can then download the packages you need from the KBOX2 site (via the device’s web browser) and install them with: dpkg -i /sdcard/Download/{package}.deb. Compatible packages include Perl, Dropbear (SSH support), GCC, Vim and rsync.

27 www.linuxuser.co.uk

Feature

Launch a distro with GNURoot he GNURoot app makes it easy to run several distros in a terminal emulator…

01

Search for GNURoot in the Play Store on your Android device. Install the main NURoot app, then the helper app of whichever stro you want to run with it.

05

First, to ensure everything’s up to date, use the commands apt-get update and apt-get upgrade in Wheezy. If using Fedora, instead use yum update.

02

Open the GNURoot app and choose the distro for the helper app you’re using from e top drop-down menu. Then tap the Create ew Rootfs button to unpack it – this can take a w minutes.

03

Once done, select that distro from the second drop-down and tick the ‘Launch Fake Root’ box (so you can use apt-get and her root commands), then tap Launch Rootfs.

04

It may a take a while to start the first time, resulting in a black screen before familiar command-line terminal appears. You e now ready to use the downloaded distro.

Torunprogramsrequiringwindows, you’ll need a GUI. Fortunately,GNURoot doesofferawaytoimplementone ARM-less devices Running Linux on x86-based Androids For this article, we’ve focused on installing Linux on ARM-based devices. However, some Android devices, such as the Samsung Galaxy Tab 3, are based on the x86 architecture. So, since nearly all Linux distros are based around x86, in theory they should easily run on these devices – sing a live USB USB2Go) or a full ou may need to ettings to get some s working, such e virtual keyboard screen rotation. ntu and openSUSE h its TabletPC ttern) seem to be he best options.

28 www.linuxuser.co.uk

Store (goo.gl/rQwvTE), it works on non-rooted devices by using a ptrace container implemented via the PRoot utility. No need to worry about any technical jargon, however, since the app does all the nitty-gritty for you and is very easy to use. After downloading and installing the main GNURoot app, you then need to download and install one of the ‘helper’ apps available for different ARMbased distros: (Debian) Wheezy (goo.gl/nP09Ex), Fedora (goo.gl/ZGZj4N), Aboriginal (a lightweight BusyBox variant, goo.gl/7K4Dec) and Gentoo (goo. gl/T4Y8Ja). There’s also an x86 version of Wheezy available if you have an x86-based device (goo. gl/6qr9ot). The downloaded distro can then be unpacked and launched using the simple menu system in the main GNURoot app, which does all the hard work and eventually places you in a command-line terminal emulator (see ‘Launch a distro with GNURoot’ boxout above for more details). You’re then all set to go and should be able to install any packages from the distro’s repo

in the usual fashion, using the relevant package manager, such as apt-get or yum. You can create extra terminal windows by tapping the ‘+’ button at the top, then switch between them via the topleft drop-down menu. The top-right (three-dots) icon also brings up a menu for various settings, including font size (you might well want to increase it to see the text more easily on a small screen) and a list of special keys accessed via various volume button combinations.

Getting graphical While useful for running various Linux tools and utilities, one obvious limitation of GNURoots’ four main distro options is that they only run via the command line. To run programs requiring windows, you’ll need a GUI. Fortunately, GNURoot does offer a way to implement one, using the helper app called ‘GNURoot Wheezy X (xterms)’, which launches a VNC server for this purpose (goo.gl/P0ezIJ). To see the GUI, you’ll also need to download one of the many VNC clients available in the Play Store – we used VNC Viewer. The WheezyX distro launches in a terminal window. After updating and upgrading, as before, note the address of the VNC server at the top – it should be ‘localhost:1’ the first time. You can then open the VNC Viewer app and point it to this address, entering the password as ‘password’. A virtual desktop will then launch – note that there’s no proper desktop environment

Run Linux on your Android device

Install an ultra-portable version of Linux

FEATURE

Left Here’s Debian Wheezy for GNURoot running the Xfce desktop environment

Boot a PC from your Android Use DriveDroid to boot into Linux

by default; just an xterm terminal window for Wheezy. By swiping around the screen, you can move the mouse pointer onto this window and tap to select it. You can use the keyboard icon in the pop-up top toolbar to start typing into the terminal, and use the handy row of special keys above the on-screen keyboard for things like Ctrl, Alt, the cursor arrows and function keys. From this terminal window you can install and launch programs to run within windows on the desktop. Using the mouse pointer, windows can be dragged around and resized. While a bit fiddly, the system works pretty well, although you may get the odd error and applications may well be missing audio (a common problem when using VNC viewers). You can also install a desktop environment via the terminal. We managed to get Xfce working by installing it with: apt-get install xfce4. We then launched it from the VNC Viewer terminal with: startxfce4. For some reason, the main desktop launched inside a window of its own, but could be dragged into position to fill the screen. There’s an application menu at the top for launching programs, although some items don’t work by default. So you may need to tinker around with the system to get it working better for you.

Full installation If you want to make full use of Linux on your Android device, the best solutions require rooting it and unlocking its bootloader (see ‘Rooting questions’ boxout on the previous page). Whichever way you do it, this a major step as it will void your warranty and also runs a risk of ‘soft-

bricking’ the device – although it can be made to work again if that happens. Another drawback is that unlocking the bootloader will factory-reset your phone and erase all its apps and data, so ensure that you make a backup beforehand. Once you’ve rooted your phone and unlo the bootloader, you are able to install run a compatible Linux distro within a ch environment on the device. The easiest way t this is by using one of the installer apps avail in the Play Store. We tested out Complete L Installer (goo.gl/Js6wnL) and Linux Deploy (g gl/cdp6FO). Both of them enable you to run run a selection of popular Linux distros within chroot environment on the Android device – i not a virtual machine since they run directly o the ARM architecture. You can then access th running distro from an SSH/terminal app or, using a GUI, a VNC viewer. While, in theory, the Complete Linux Installer’s built-in guides and easy-to-use interface make it possible to install and launch a distro – choose from various flavours and sizes of Ubuntu, Debian, ArchLinux, Kali Linux, Fedora and openSUSE – with just a few button taps, we experienced a few problems getting most of them to work. Still, the team behind it are currently alpha-testing an improved version three, so you might want to give that a try when it’s ready. However, here we’ll focus on Linux Deploy, which proved more reliable. Launching the app takes you to a simple black screen with your

If you prefer to use Linux on a PC then a live CD or USB stick always comes in handy for booting it up wherever you go. Even better, the DriveDroid app (bit.ly/1ttEmEO) will enable you to do so from your (rooted) Android phone, on which you can carry several distros. Just download and enable an ISO or IMG file in the app, connect via USB to the PC, then reboot the latter (having placed your device at the top of the booting order in its BIOS). It’ll then boot i chosen di

Feature

Run a distro with Linux Deploy Easily install the distro of your choice on a rooted Android device

01

Launch Linux Deploy and tap the downarrow icon at the top to access the settings. First, tap Distribution to choose a distro. Then tap ‘Distribution suite’ to choose a version, and Architecture if you want to change that too.

02

Scroll down the settings and tap ‘Desktop environment’ to choose one. SSH and GUI are enabled by default. Tap GUI settings to alter the width and height settings to suit your screen (you can always change them later).

03

When all the settings are made, tap Install at the top to begin the installation. After making the .img file, all the

installation processes will be detailed screen. When you see ‘<<< end: install’, the dis is ready to launch. Tap Start.

04

To access the distro from a termi launch your SSH app and (if us default settings) log into android@ with the ‘changeme’ password. can now enter standard Linux commands fr the terminal.

05

To use a GUI, launch your VNC vie app. Use ‘localhost:0’ as the addre port 5900 and the ‘changeme’ defa password. Once connected, the desktop appear – if not sized correctly, change the settings in Linux Deploy, then Stop and Start

Remote control Control your PC from your phone Another way of using your Android device with a PC is as a remote control. The Linux Remote Control web app enables you to access any Linux box on the same network with the desktop client installed. You can control things like music and video playback, the mouse pointer, restart and shut down, and send custom commands to run on it. Alternatively, the Remote Launcher Android app can launch applications on any PC running the Java Runtime Environment. While not as versatile as SSH or VNC, both apps are easy to use.

30 www.linuxuser.co.uk

device’s IP address and some options a top (see ‘Run a distro with Linux Deploy’ boxout above). Tapping the down-arrow icon takes you the settings screen where you can choose a distro to install: Debian, Ubuntu, Arch Linux, Fedora, openSUSE, Kali Linux and Gentoo are available, plus a RootFS option. Further settings enable you to change the version and architecture (useful if your device doesn’t have an ARMv7 CPU). You can also choose a desktop environment (LXDE, Xfce, GNOME, etc) and alter VNC display settings to suit your screen resolution. When ready, hit the Install option at the top and Linux Deploy will begin installation – by default, to an IMG file. Naturally, this may take some time – usually 30 to 60 minutes, depending on the distro and your Wi-Fi connection speed (don’t do it over 3G!) – with all the processes shown on screen. You’ll know it’s finished when you see the ‘<<< end: install’ line. So long as it didn’t fail, you’re ready for launch. Hit the Start button to boot the Linux instance; SSH and VNC servers will be launched by default. Note that you can’t enter any commands from Linux Deploy itself – you need to connect from an SSH app, such as VX ConnectBot or JuiceSSH. You can then enter standard Linux commands from the terminal. To access the GUI and desktop environment, you’ll need to use a VNC app such as VNC Viewer. If the desktop has the wrong dimensions, just go

troubles. If the distro installation fails for some reason, in most cases simply hitting Stop and then reinstalling fixes the problem. We also sometimes got a ‘failed to truncate’ error when Linux Deploy was making an IMG file at the start of an installation; we found that reducing the image size solved this, though it’s not ideal as it reduces the space for the distro. Indeed, a limitation is that Android’s FAT32 file system for SD cards has a maximum file size of 4GB, so you can’t install a distro .img file greater than this. A solution is to create two partitions on the card – FAT32 and ext2/3/4 – and then install the distro to the latter (either as a file or partition); if your device only has internal storage, you may be able to use a workaround involving a USB2Go cable and pen drive.

Magic touch While it’s great to be able to run a desktop distro on your phone, navigating it with a mouse pointer and virtual buttons can be fiddly. So you might want to give Ubuntu Touch a try. Not to be confused with Ubuntu for Android (which is used via a monitor and physical keyboard), Touch puts a special touch-screen version of Ubuntu on your device. Unlike the other methods for running distros, it doesn’t run in a chroot environment within Android – instead, you install it as a standalone OS in the recovery partition of your

Run Linux on your Android device

Install an ultra-portable version of Linux

FEATURE

Why do it? The key benefits of running Linux on Android • It’s portable and convenient. No need to carry around a Linux laptop when you can run Linux on your Android phone instead. • Access the command line from a terminal emulator and use all of your favourite Linux tools. • Or use a VNC viewer to run a desktop GUI and windowed applications. • Gain access to thousands of Linux applications. Many of these are more powerful and more customisable than their Android equivalents.

Above Like the other Linux Deploy distros, Kali comes with a basic set of desktop applications

While we enjoyed considerable success using Linux Deploy, we did encounter a few teething troubles device and you can then dual-boot it with Android via the fastboot menu. While officially, Ubuntu Touch only supports certain Samsung Galaxy and Google Nexus devices, it can be made to run on others. See the website for more details: https://wiki.ubuntu. com/Touch/Devices. Installation is surprisingly easy if you’ve already rooted your device and unlocked its bootloader. Simply download the Ubuntu installer ZIP file (bit.ly/1oZC2xJ) and move it to the root of your SD card. Then put your device into fastboot mode: turn it off, then hold the power and volume-down buttons until you see the green robot screen with a large Start option. Use the volume-down button to switch to Recovery mode and then press the power button. Now use the menus to install the Ubuntu installer ZIP from your SD card (in the /0 directory). Reboot the device and you should find the Ubuntu Dual Boot app in your Android apps menu. You’ll need to ensure you can run apps from unknown sources (under Settings>Security). Now tap the app icon, then ‘Choose which channel to install’ to select a version of Ubuntu. You’ll need to wait quite a while for the app to download and be installed.

When it’s finished, tap the ‘Reboot to Ubuntu’ button to launch Ubuntu Touch on your device. The gesture-based navigation system is easy to use: swipe from the left edge to open the launcher, from the right for the app switcher, from the top for a quick settings panel, and from the bottom for extra options. Linux comman can be entered via the Terminal app. Note th since Touch is still in beta, there are a few issu depending on the device, but it’s usable and giv you a good preview of how the finished syste will work. To return to Android, simply power down, the hold the power button to launch it. To resta Touch from Android, open the Ubuntu Du Boot app and hit the reboot button. You can al uninstall it from the settings menu here. As we have demonstrated, there are ma ways to install Linux on your Android device, ea with its own pros and cons. There are also ma things you can do with it once installed – see t ‘Why do it?’ boxout to the right for some ideas. S why not get Linux onto your phone and take it wi you wherever you go?

• It’s particularly useful for power users and software developers; in order to build ARM software, and have real git-annex repositories, for instance. • You could even run a LAMP server from your device, to run web apps. It’s relatively straightforward to configure. • A Linux-running Android device could be used in hardware projects, such as robots – either in place of a Rasberry Pi or as a remote control unit. • Gain all the benefits of running Linux without harming your standard Android environment, giving you the best of both worlds on one portable device.

Right It’s easy to install Ubuntu Touch using the Ubuntu Dual Boot app on a rooted device

31 www.linuxuser.co.uk

YES I would like to subscribe to Linux User & Developer Q YOUR DETAILS Title Surname Address

OR H DEUR R RY N OW

SUBSCRIPTIONVOUCHER First name

Postcode Telephone number Mobile number

Country

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

DIRECT DEBIT PAYMENT Q UK Direct Debit Payment I will pay only £18 for 6 issues (saving 50%*)

Instruction to your Bank or Building Society to pay by Direct Debit Please fill in the form and send it to: Linux User and Developer Subscriptions Dept, 800 Guillat Avenue, Kent Science Park, Sittingbourne ME9 8GU Name and full postal address of your Bank or Building Society To: The Manager

Originator’s Identification Number Bank/Building Society

5

0

1

8

8

4

Address Reference Number

Postcode Name(s) of account holder(s)

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

Branch sort code

Bank/Building Society account number Date A6 instruction form

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

PAYMENT DETAILS YOUR EXCLUSIVE READER PRICE, ONE YEAR (13 ISSUES)

Q UK: £62.40 (Save 20%) Q Europe: £70.00 Q World: £80.00

FANTASTIC SUBSCRIBER OFFER

Subscribe today and save 50%

Cheque

Q I enclose a cheque for £

(made payable to Imagine Publishing Ltd)

Credit/Debit Card

Q Visa Card number

Q MasterCard

Q Amex

Q Maestro

Expiry date Issue number QQ (if Maestro) Signed Date Code: PAL143Q Please tick if you do not wish to receive any promotional material from Imagine Publishing Ltd by post Q by telephone Q via email Q Please tick if you do not wish to receive any promotional material from other companies by post Q by telephone Q Please tick if you DO wish to receive such information via email Q

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

Q Pay only £3 for every future issue – a 50%* saving on the store price Q Free UK delivery to your door Q Never miss an issue Q Money-back guarantee *Terms & conditions: Pricing will revert to our standard offer of £25.15 every 6 issues on the third payment made. Subscribers can cancel this subscription at any time. New subscriptions will start from the next available issue. Offer code PAL143Q must be quoted to receive this special subscription price. Details of the direct debit guarantee are available on request. Offer expires 31st January 2015. Imagine Publishing reserves the right to limit this type of offer to one per household.

SUBSCRIBE

50% *

TODAY

& SAVE

Readers in the US see page 79 for exclusive offer

THREE EASY WAYS TO SUBSCRIBE 3.Post or email 1.Online www.imaginesubs.co.uk/lud And enter PAL143Q

2.Telephone

0844 249 0282 And quote PAL143Q

Please complete and post the form to Linux User & Developer Subscriptions Department 800 Guillat Avenue Kent Science Park Sittingbourne ME9 8GU Or alternatively, you can scan and email the form to

[email protected]

Tutorial

Time to refactor the quick‘n’dirty script from Part I of the tutorial – out with the deprecated backticks…

We’ll introduce command substitution, which won’t break when somebody writes a filename with spaces in

We’ve just skimmed the surface of Bash here – so we’re also pointing you to some great resources

Shellcheck.net can tell you where you’re going wrong, and is great for help tidying up hastily written scripts

Writeusefulshell scripts–part3 We consider functions, refactoring, and a few exotic branches of Bash syntax, and when to consider alternatives to Bash Advisor

Richard Smedley A Unix jack-of-all-trades, Richard doesn't spend enough time in any language to get truly proficient, but always has a shell open so learnt scripting by osmosis

Resources Bash shell Your favourite text editor

34 www.linuxuser.co.uk

Who wants to repeat work when we have machines to do the job? Functions let us package up succulent parcels of code that can be called upon whenever we need them. They’re not quite as sophisticated as those in other languages, but they will make your longer scripts more maintainable. Meanwhile, you’ve seen rough-and-ready code over the past two months – the sort that Bash lets you do so well – but let’s tidy up our backup script and make it something we needn’t hide away from other coders. Refactoring Part 1’s backup code, looking for problem areas, we find deprecated but still

common habits like quoting with backticks – very portable to older (pre-POSIX!) platforms, but not so good for nested use, and not totally consistent on all shells. We also find unquoted variables – fine for prototyping, and running the backup script over nicely-named files, but when a filename contains a space, our script sees two names. Lastly, as this is the final part, we’ll show you where to go to get more detailed shell scripting knowledge, as well as alternatives to Bash – there’s no single correct scripting language and, as support is important, your best choice may depend upon what’s popular around you.

Write useful shell scripts – part 3

Functions, refactoring and a few exotic branches of Bash syntax

TUTORIAL

Let’s make our backup script something we needn’t hide away from other coders

01

Quote, unquote

02

Blame the GUI

The dollar parens style – $(..) – is not just more consistent that the good old backtick method of quoting – `..` – it’s also lexically consistent with other (..) subshell use. Backticks are not dead yet, but you may never need to use them in preference yourself.

Some people will insist on writing filenames through a GUI, and not consider the poor commandline user trying to interpret whitespace – as there’s no avoiding filenames with spaces, you must work around it…

04

Keep testing

As you make changes, the same rules apply – test that it’s still flowing through the code the way you think it should. A few echo statements now and then are a lot less work than tracing a problem after dozens of changes.

05

Echo

Echoes can also give you a chance to try passing different parameters to check the code behaves under various circumstances. The output of the echo statements shows both that Bash has reached various parts of the script, and in what state (eg is it looking at the correct folder?).

03

Spaced out

Using the output of ls directly in a for loop may give surprises – so we’ll further refine this later (step 7) – but our priority is getting it out of backticks, so that the shell doesn’t interpret spaces in filenames as spaces between filenames.

06

Reinterpreted variables

An unquoted variable is subject to filename expansion (globbing). Once again, if all of your file and directory names cannot be split, you have no problem. But for real world names, quote your variables – however tedious the task.

07

Forlooping…

08

Dash it

09

Double dashed

With command substitution, we also have potential problems with filenames, so we use globbing to get the filenames – the shell expands them for us – then quote them and use them safely.

We also put the ./ – for the current directory – before the * wildcard expansion, so that any filenames beginning with a dash are not interpreted by the command to which they’re passed.

For cp, we can also put two dashes in – to stop it interpreting any further dashes as command line switches. Using the relative (“./$f”) or absolute pathname is also safe with cp and filenames beginning with dashes.

10

Redundant

We should also look out for redundant code which can potentially add errors unnecessarily. Our script removes .bak files at the end, so why bother trying to match them here?

35 www.linuxuser.co.uk

Tutorial

15

11

Validation

12

Not found

A function or two

But that piece of programming logic can be swapped around to act on directories that do contain a particular suffix (passed as the second parameter at the command line), for backing up specific filetypes…

…and act as validation by exiting with an error if the suffix is not in the filenames in the directory.

15

A function or two

Parcelling out jobs to a function allows it to be called as needed. It also allows easy creation of variations on a theme – as here for backing up files of only one type. But oh dear! More repetition. Last month’s parameter substitution comes to the rescue here. Call with:

backitup aac And change the for line to:

13

Where to?

Another piece of code crying out for improvement is setting the options for where to back up to. We could use some of the interaction options from last month’s tutorial which, combined with a choice of filetypes to back up.

14

Crontab

But these interaction options are no use if we’re just going to run the script automatically through cron. As always, change the code to best match your circumstances. If you want to back up just certain types of files, you can…

Where Bash is forgiving and easy, Python is a little stricter – but it’s not too hard 36 www.linuxuser.co.uk

for f in ./*.”$1”; do And you can dump all the separate versions.

16

Pass it in

We now replace the chunk of code in our script with the function call, adding in $SUFFIX as the value that will be seen inside the backitup function as the $1 parameter.

Write useful shell scripts – part 3

Functions, refactoring and a few exotic branches of Bash syntax

TUTORIAL

21

shellcheck.net

22

Follow the guide

23

Python

24

What you need

The Advanced Bash-Scripting Guide (ABS), from the Linux Documentation Project (www.tldp.org) – an in-depth look at “the art of shell scripting”, by Mendel Cooper – is wonderful on many levels. Working through it will bring understanding, as well as practical know-how.

Where Bash is forgiving and easy, Python is a little stricter – but it’s not too hard. As well as programming your Raspberry Pi and being a great coding language for everything from games to Web frameworks, Python is a very good choice for maintainable shell scripts.

17

In its place

18

To-do

And here’s our function sitting inside the script. It must be placed before the call is made to the function further down the script – Bash likes to take things in their proper order.

Now we have a working script – but there are always to-do items left. These we leave as an exercise for the reader – but we’re not abandoning you entirely to your own devices.

19

Changes

Having started with rough and ready code, and improved it, we hope you can carry this not just to your own scripts, but to snippets you find on the web. Don’t be afraid to change other people’s code – and there’s plenty of further help available.

20

Stack Overflow

If you program, then Google will have led you to StackOverflow answers for many of your searches. Nine times out of ten you’ll find your question already asked and answered. It’s a rich source of Bash wisdom.

21

shellcheck.net

We were happy with our refactored code, but running it through Shellcheck picked up a couple of areas to improve (put Part 1’s quick’n’dirty code through to really see some complaints!). Keep a tab open on this for all of your scripts.

Or pick Perl or Ruby, if inclination and local support make them a more obvious choice. Even newLISP would make a good choice, if you’re also using it elsewhere. But read the ABS, and you may find Bash answers all of your needs.

37 www.linuxuser.co.uk

Tutorial

An Awk script that counts the number of times two IP addresses appear on a log file

Important Awk built-in variables

Generating random numbers using Awk

The BEGIN and END patterns

Processtext faster with Awk and Sed Make your life easier by using Sed and Awk to work with text from the terminal Advisor

Mihalis Tsoukalos is a UNIX system administrator also proficient in programming, databases and mathematics. He has been using Linux since 1993

Resources Gawk www.gnu.org/software/gawk/ Mawk http://invisible-island.net/mawk/

38 www.linuxuser.co.uk

Sed and Awk are two famous and characteristic UNIX command line tools. The name Sed comes from “stream editor”, and the tool was developed from 1973 to 1974 by Lee E. McMahon. Sed processes its input line by line and is mainly used for text substitution. The name Awk is derived from the surnames of its three authors – Alfred Aho, Peter Weinberger and Brian Kernighan – and is a handy pattern matching programming language that is Turing-complete. Sed can handle and quickly process arbitrarily long inputs – its processing capabilities are similar to the capabilities of the ed editor

(including regular expression support). Nevertheless, its abilities are limited because it only makes one pass over the data, cannot go backwards and cannot manipulate numbers. Awk resolves most of the limitations of Sed because it is based more on the C programming language than on the ed text editor. Awk reads its input line by line and will then automatically split each line into fields. It allows you to do analyis, extraction and the reporting of data as well as supports arrays, associative arrays and regular expressions. Neither of these two utilities alter their input files, and they’re a powerful tool in tandem.

Process text faster with Awk and Sed

Make your life easier by working with text from the terminal

TUTORIAL

04

01

A Sed example

Install Awk and Sed

The good news is that every Linux distribution comes with Sed and at least one version of Awk already installed so you do not have to install any of them. Nevertheless, if you want to install a different Awk variant, you may need to do it either manually or by using the package manager of your Linux version.

03 02

Using Sed

The following Sed code globally replaces a given string with another in a text file:

$ sed ‘s/string1/string2/g’ textfile If you want to save the original file contents to a new file and the changed version to the original file, you should use the -i option as follows:

$ sed -i.bak ‘s/three/3/g’ text The previous command replaces every occurrence of the word “three” with “3”, saves the output to the file “text” and keeps the original content inside “text.bak”. If you want to perform a case insensitive global search and replace, you should use the following command:

$ sed -i.bak ‘s/three/3/gi’ text

Using Awk

The “Hello World!” program in Awk can be written in two ways. The first one is the command line version and the second one is by storing the Awk code inside a separate file. It is better to store your Awk code on a separate file especially if you are going to reuse it. By default, Awk splits input lines into fields based on whitespace (spaces and tabs). You can change the default behaviour by using the -F command line option and providing another character.

04

05

An Awk example

If you want to print the first and third columns of a text file, you should run the following Awk command:

awk < file ‘{ print $1, $3 }’ If you want to print the second and third columns in reverse order, just execute the following command:

A Sed example

Sed allows you to make changes to multiple files. The following example changes the path of the Perl binary from “/usr/local/bin/ perl” to “/usr/bin/perl” in multiple files:

awk < file ‘{ print $3, $2 }’ To print the last two columns of the input, use:

$ awk ‘{print $(NF - 1), $NF}’ $ sed ‘s/\/usr\/local\/bin\/perl/\/usr\/ bin\/perl/g’ *.pl Note that you have to use the escape character “\” in order to use the “/” character as a normal character. Always remember that once a line is read by Sed, the previous line is gone forever.

Here, NF is a variable that holds the number of fields in the current line and $NF is the last field on the current line. The $0 variable represents the current line.

39 www.linuxuser.co.uk

Tutorial

08

Awk built-in functions

an Awk program, but Awk allows you to do additional processing of the data. The FILENAME built-in variable holds the filename of the file currently being process but you cannot use it inside the BEGIN block because it is not defined yet.

08

Awk built-in functions

09

Pattern matching

Awk has built-in functions for string, number, time and date manipulation. You can easily generate random numbers using Awk but be warned that Awk’s rand() function can generate repeatable output. The presented example uses an array named rnd to store the generated random numbers.

The following Awk code identifies if the input is an integer, a string or an empty line:

/[0-9]+/ { print “This is an integer” } /[A-z]+/ { print “This is a string” } /^$/ { print “This is an empty line!” } Please note that input can match more than one rule. An Awk script can become a program by changing its permissions and inserting the following line at its start (similar to a Perl script):

07

Doing simple things with Awk

The following command finds the number of unique IPs stored on an Apache log file:

$ cat access.log | awk ‘{print $1}’ | sort | uniq | wc -l

06

Awk variables

Awk has built-in variables but also supports user-defined variables. The following Awk code uses the n variable to count the number of lines that contain a given string:

$ awk ‘/three/ { n++ }; END { print n+0 }’

The Awk ‘{print $1}’ command prints the first column of each line, which is the IP address of the client machine. The next command finds the total Mbytes transferred by summing up the contents of the tenth field:

You might say that if you combine grep and wc, you can achieve the same task without writing

$ awk ‘{ sum += $10 } END { print sum/1024/1024 “ Mbytes” }’ access.log

40 www.linuxuser.co.uk

#!/usr/bin/awk -f

10

Processing Apache Log files using Awk

The next command uses many UNIX command line utilities to calculate the total number of requests per hour found on an Apache log file:

$ cat access.log | cut -d[ -f2 | cut -d] -f1 | awk -F: ‘{print $2}’ | sort -n | uniq -c | awk ‘{print $2, $1}’ > timeN.txt First, it prints the log file on the standard output (cat access.log) and uses it as the input to the next command (cut -d[ -f2) that deletes everything from the beginning of each line to the

Process text faster with Awk and Sed

Make your life easier by working with text from the terminal

TUTORIAL

13

MoreApacheLog fileprocessing

first “[“ character. The next command (cut -d] -f1) does something similar: it deletes everything from the first “]” character found in the line to the end of the line. So, up until now the output looks similar to the following:

27/Jul/2014:06:34:09 +0300 The awk -F: ‘{print $2}’ command defines the “:” character as the field separator and prints the second field that contains the hour of the request. The “sort –n” command sorts the output numerically and not alphabetically. The “uniq” command omits repeated lines but when used with the “-c” option it prefixes lines by the number of occurrences. Finally, awk ‘{print $2, $1}’ swaps the data in the two columns of the output. The “> timeN.txt” part saves the output to a file named timeN.txt. If you sort the output by the second column, you can find the busiest hours of the day.

If you want to remove all characters except letters, numbers and spaces you should filter your input using Sed:

$ sed ‘s/[^a-zA-Z0-9 ]//g’ text | ./ wordFreq.awk | sort -k3rn Last, if you want to convert all words to lowercase to avoid duplicates, the following Awk code will do the job:

$i = tolower($i)

$ cat access.log | grep `date ‘+%e/%b/%G’` | awk ‘{print $1}’ | sort | uniq -c | wc -l The following command finds the top ten requests on a log file, grouped by the IP address:

$ cat access.log | awk ‘{print “requests from “ $1}’ | sort | uniq -c | sort -nr | head The following command prints the total number of requests grouped by the status code, sorted by the numeric value of the status code:

$ awk ‘{print $9}’access.log|sort-rn|uniq -c

14

11

Word counting

This is a relatively challenging example that shows some of the advanced capabilities of Awk. The presented Awk script (wordFreq.awk) reads a text file and counts how many times each word appears in the text file with the help of associative arrays.

12

Nawk,GawkandMawk

13

More Apache Log file processing

On a Linux system, Nawk is usually a symbolic link to either Gawk or Mawk. The biggest difference between the various variants and the original version of Awk is that the variants do support a larger set of builtin functions and variables. Nowadays, every Linux system uses an improved version of the Awk utility.

Plantosucceed

Awk may not be a complete replacement for either Perl or Python but, as you can see here, it does its job well and allows you to work efficiently with text files. Try to write the “Word Counting” program or to process Apache log files using C and you are going to appreciate Awk. Also, Awk programs are easier to debug because they are smaller. On the other hand, if you want to store the results in a MySQL database, Perl or Python would be a smarter choice because they can communicate directly with a MySQL database. The main point here is that learning and using Sed and Awk can be very beneficial for every Linux user or administrator.

Another trick for you – to find the total number of unique IP addresses of the current day, you should execute the following command:

41 www.linuxuser.co.uk

Tutorial

Keep your software and files between systems, as they’re stored on the server and not local storage

Connect remotely to a fully working Ubuntu distro from any networked computer

The distro is installed to the server that is always on. It can be used on multiple systems if set up correctly

BootLinuxfroman NFS server Advisor

Rob Zwetsloot models

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

Resources An Ubuntu server

42 www.linuxuser.co.uk

Diskless booting allows you to access the same distro from multiple locations on a network without juggling files While movies like to think they’re still common, the concept of a mainframe with dumb terminals is a bit of an obsolete concept now. The proliferation of high-powered machines made it easier to give everyone their own system and that hasn’t really changed. What has changed, though, is the way we treat data, which is now backed up to the cloud so it’s ever-accessible, or jostling around in our pocket on tiny USB storage devices with more memory than you’d ever need for word processing documents. If you’re often moving

between different computers within the same network, a more updated version of the classic mainframe solution may prove beneficial. With NFS booting, the core kernel and file systems are kept on a central server and then pushed out onto client systems to be booted on there. That means your files and desktop will always be available wherever you want to log in. This tutorial needs a server that’s dedicated to hosting the distro and is always on – specifically an Ubuntu server – to be able to serve Ubuntu around a network.

Boot Linux from an NFS server Launch a distro from multiple locations on a network

TUTORIAL

04

01

Configure PXE options

First installation

The first job is to install some specific packages on the server side. Open up the terminal DHCP, NFS tools and a few other things with:

$ sudo apt-get install dhcp3-server tftpd-hpa syslinux nfs-kernel-server initramfs-tools

02

Configure DHCP

The server will need to have a DHCP server set up. To do this, open the terminal and get to the DHCP config file by typing sudo nano /etc/dhcp/ dhcpd.conf. Start by adding the following lines to the end of the file:

allow booting; allow bootp;

host pxe_client { hardware ethernet xx:xx:xx:xx:xx:xx; fixed-address 192.168.x.xxx; }

05

RestartDHCP

Save the file to confirm the changes – they can always be modified further at a later date if any settings change. Before moving on, the server needs to be restarted by using:

$ sudo service isc-dhcp-server restart

03

Add this next:

Changing the ‘x’ placeholders to your network.

Configure PXE options

Finish it off with a PXE instruction to force the client to these settings. This works especially well if you plan to use multiple disc images.

Create a TFTP directory

There needs to be a root directory for some of the TFTP files for the setup to work properly. This is linked with PXE booting protocols so this directory and the initial file needs to be created with:

Configure the subnet and IPs

subnet 192.168.x.0 netmask 255.255.255.0 { range 192.168.x.xxx 192.168.x.xxx; option broadcast-address 192.168.x.255; option routers 192.168.x.xxx; option domain-name-servers 192.168.x.xxx; filename "/pxelinux.0"; }

04

07

$ sudo mkdir -p /tftpboot/pxelinux.cfg

06

Create a TFTP server

There needs to be a way to transfer boot files and this can be done with a TFTP server. Open up the config file with sudo nano /etc/default/ tftpd-hpa and add the following to the file:

08

TFTP bootfiles

The current PXE boot configuration files need to be copied over to the TFTP directories so they can be used by the server. This is done with:

$ sudo cp /usr/lib/syslinux/pxelinux.0 / tftpboot

RUN_DAEMON="yes" OPTIONS="-l -s /tftpboot"

43 www.linuxuser.co.uk

Tutorial

11

11 09

Default kernel configuration

Create a new file with sudo nano / tftpboot/pxelinux.cfg/default and add the following with the necessary details:

LABEL linux KERNEL vmlinuz-[kernel number] APPEND root=/dev/nfs initrd=initrd. img-[kernel number] nfsroot=192.168.1.2:/ nfsroot ip=dhcp rw

10

FinishupTFTP

The final step is to get the TFTP server working properly. To do this, the correct permissions need to be set with:

sudo chmod -R 777 /tftpboot

Root files

There needs to be a folder to hold the files for the client OS, make this with sudo mkdir /nfsroot. Export nfsroot by using sudo nano /etc/exports and add the following line:

/nfsroot 192.168.x.xxx(rw,no_root_ squash,async,insecure)

Modify the init file

Some boot flags need to be changed so the system knows to boot from the network. Open up the config file with sudo nano /etc/initramfs-tools/ initramfs.conf and make sure the following two variables read as below:

BOOT=nfs MODULES=netboot

Save and sync it all with sudo exportfs -rv

12

Client setup

13

Client kernel

The client system needs to start out having a hard drive installed into it. Get the version of Ubuntu you want to use and install it with standard settings to the system. Once the tutorial is finished, remove the hard drive.

…which finally means the TFTP server can be started using:

For the moment stay on the client and open the terminal. Copy kernel version to the home directory in case it needs to be restored a bit further down the line to fix an issue. Do this with:

$ sudo /etc/init.d/tftpd-hpa start

$ sudo cp /boot/vmlinuz-`uname -r` ~

44 www.linuxuser.co.uk

14

Root files

15

Modules and making

Find out what modules you’ll need for your network adapter and add them to the network modules file which can be accessed sudo nano /etc/initramfs-tools/modules. Once finished, save the file and finish the boot files by typing:

$ mkinitramfs -o ~/initrd.img-`uname -r`

16

CopyOStoserver

Now that the client is completely set up, you can start transferring the files across to the server. Do this by typing in the following three commands:

Boot Linux from an NFS server Launch a distro from multiple locations on a network

TUTORIAL

18

$ mount -t nfs -onolock 192.168.1.2:/nfsroot/mnt $ cp -ax /. /mnt/. $ cp -ax /dev/. /mnt/dev/.

17

Backtoserver

After everything has finished transferring over from the client, return to the server and open back up the terminal. The kernel and init files need to be copied to the tftp directories with:

$ sudo cp ~/vmlinuz-`uname -r` /tftpboot/ $ sudo cp ~/initrd.img-`uname -r` /tftpboot/

18

Networkmodifications

To ensure the DHCP settings remain constant, the network interfaces config file needs to be updated. Edit it with sudo nano /nfsroot/etc/ network/interfaces and change these lines:

auto lo iface lo inet loopback iface eth0 inet manual

19

Network modifications

Update the fstab Open up fstab (sudo nano /nfsroot/etc/fstab) and make sure it looks like this:

proc /dev/nfs none none none none /dev/hdc

/proc / /tmp /var/run /var/lock /var/tmp /media/cdrom0

20

Client BIOS

21

Boot over the network

proc nfs tmpfs tmpfs tmpfs tmpfs udf,iso9660

Reboot the client system, and enter the BIOS to find the boot menu settings. Make sure network boot is moved up to the first option and if that can be modified further choose PXE.

Reboot the client and it will begin the initial boot process, taking the kernel and PXE image from the server. This will work across multiple systems as long as they’re set up correctly.

22

defaults defaults defaults defaults defaults defaults user,noauto

0 1 0 0 0 0 0

0 1 0 0 0 0 0

Benefits

Everything working fine on the clients? You can now remove their hard drives if you never plan to use them for extra storage and put them to be better use on a file server, or as extra space in the main PXE server. The computers will now boot over the network without needing any internal storage.

45 www.linuxuser.co.uk

Tutorial

Send and receive emails using Node.js Using Nodemailer and Node IMAP, we’ll look at using emails to send error reports, as well as storing recent emails offline Advisor

Sean M Tracey is a creative technologist at a leading digital agency. He spends a lot of his time living inside of Node.js, Python and Arduino

Resources Node.js 10.0.* www.nodejs.org Nodemailer 1.1.1 www.nodemailer.com Node IMAP 0.8.12 www.github.com/mscdex/node-imap

A mail server with IMAP Your favourite text editor Email is one of the oldest technologies we’ve got bouncing around and it is still very much a part of our everyday lives. Despite the rise of social networking behemoths such as Facebook or Twitter, email has held on as the main way to get large bodies of text and media across the web to another person. As developers, emails are something we’re aware of most of the time; you most likely maintain your own mail server – you probably even set it up – but when was the last time you played around with it? In contrast, Node.js is very much the hot new thing in the technology world; it’s only been around for a couple of years and already services, platforms and programming conventions are being built on or shaped around it. In this tutorial, we’re going to take a look over two of the more popular IMAP modules for handling emails with Node.js – Nodemailer and Node IMAP. Nodemailer is a module that will allow us to hook into an email server with IMAP and send out generated messages to selected recipients, and Node IMAP will let us access our mail servers and read some of the most recent messages we’ve been sent by others.

46 www.linuxuser.co.uk

Above You can combine Nodemailer with whichever email server you choose

01

Install Node modules

Those of you familiar with Node may have already guessed how we’re going to install Nodemailer and Node IMAP – that’s right, with NPM. Create a new project folder and then run the following command inside:

npm install nodemailer npm install imap So, what does each module do? Nodemailer is our module for sending email using an exising IMAP/POP3 email service and Node IMAP is the library we’ll be using to retrieve emails from our email server. First, because it’s a little simpler to get started with, we’re going to look at sending emails with Nodemailer.

02

Set up to send an email

Create a new file called ‘send.js’, open it for editing and require Nodemailer like so:

var nodemailer = require(‘nodemailer’); This on its own won’t do a great deal for us; in order to send an email we need to tell Nodemailer how to connect to our email server and we do that with a transporter. Now, we have two options here:

we can either use one of the preset transporters put together for us by the Nodemailer library to connect with popular email services or we can create our own custom transporter that we can use to connect to any correctly configured email server anywhere. For this demo, I’ll be using Gmail to send and receive emails, but we’ll look at both approaches here. However you choose to connect to your email server is up to you; the decision won’t affect the tutorial beyond this setup point. (Fig. 01) Let’s look at what’s going on so far. First, in both instances, we create a variable that will contain our transporter. In our preconfigured instance (the first of the two examples), simply passing 'service : “SERVICE NAME"' will tell Nodemailer how it should connect to that service and all that will be required for a connection is the username and password. In our custom instance, you may have noticed that we included an extra module: the nodemailer-smtp-transport module is a little helper that will build a suitable transporter for us based on the variables passed. In this case, we wrap the variables we pass through into nodemailer.createTransport in smtpTransport(). This time, we’ll need the host, port number and the maximum number of allowed connections to connect to our server, as well as the auth credentials that we passed before.

Send and receive emails using Node.js

Use Node.js modules to send error reports and storing mail offline

TUTORIAL

How old is email? That’s a big question… you can date modern email – or at least the beginnings of it – back to the early Seventies. Computerised point-to-point messaging systems had been knocking around since the Sixties but a standardised system that let users communicate with different computers across a network was a pretty awesome idea. The @ sign has been around for a lot longer; there are widespread uses back to the 17th Century and it occasionally crops up in some 14th Century manuscripts. Now that little key is hit more times in a day across the world than there are people to push it. Why do we use it in emails? Well, a chap called Ray Tomlinson picked it seemingly on a whim to help determine a user on a separate machine to send a message to rather than just the local box.

03

Sending our first email

Right, so now we’re set up to send emails. Let’s test that out. The transporter that we just created has a method ‘sendMail’; odds are that’s the method we’ll be using to send an email, so let’s give it a try. transporter.sendMail() accepts two arguments: the first is an object that includes fields describing where the email is going, coming from, what the subject line is and the body of the message. The second argument is a callback that will fire after the email has successfully sent (or failed, if it’s gone wrong). One thing to take of note of is that we don’t need to create a new transporter for every message we want to send, we can use the same one again and again and again. The object we pass through to sendMail requires at the very least a ‘to’ and a ‘from’ field, but we’re going to go ahead and make a body too in Fig. 02. You’ll see that we have a text and a html key in our object. The text is our plaintext message and our html is our HTML body for our mail message. You can include one or the other – or both, if you need a fallback for older email clients – but they don’t have to equate to one another. For now, set the ‘to’ field to something you can quickly check. Now, let’s send that email (Fig. 03). And if you open your email client, you should see a shiny new email sitting in your inbox. Neat, huh?

Node.js is very much the hot new thing in the technology world Fig 01

//Using a preconfigured service var transporter = nodemailer.createTransport({ service : “Gmail”, auth : { user : “[GMAIL USER]”, pass : “[GMAIL PASSWORD]” } }); //Using a custom configured service var smtpTransport = require(‘nodemailer-smtp-transport’); var transporter = nodemailer.createTransport(smtpTransport({ host: ‘[EMAIL SERVER]’, port: 25, auth: { user: ‘[EMAIL USERNAME]’, pass: ‘[EMAIL PASSWORD]’ }, maxConnections: 5, maxMessages: 10 }));

Fig 02 var messageOptions{ to : “[email protected]”, from : “Node Mailer “, subject : “’Tis a test of Nodemailer”, text : “Mary had a little lamb, with fleece as white as snow”, html : ‘and everywhere that Mary went, the lamb was sure to go…‘ } transporter.sendMail(messageOptions, function(err, response){

Fig 03

if(err){ throw err; } else { console.log(response); } }); imap.once(‘ready’, function(){ console.log(“I am ready!”); });

Fig 04

imap.once(‘error’, function(err){ console.log(“There was an error connecting to the mail server…”, err); }); imap.once(‘end’, function(){ console.log(“Connection closed”); });

47 www.linuxuser.co.uk

Tutorial imap.once(‘ready’, function(){

Fig 05

console.log(“I am ready!”);

04

So, we’ve sent an email. That’s great, but we’re going to leave it there for a little while and quickly look at retrieving mail from a server too. Don’t worry, we’ll get back to sending emails shortly. Retrieving an email is a little trickier than sending one; with Node IMAP, everything we request is sent back to us as chunks in a stream, and we need to put those chunks back together when our stream has closed to get the data we want. In your project directory create a new file called ‘retrieve.js’ and add the following to the top of the file:

imap.openBox(‘INBOX’, true, function(err, box) { if(err){ throw err; } console.log(box); }); });

Retrieving an email is a little trickier than sending one fetch.on(‘message’, function(msg, sequence){

var node-imap = require(‘imap’); As with Nodemailer, we need to tell Node IMAP how to connect to our server. And just like Nodemailer, this is really simple.

Fig 06 var imap = new Imap({ user: ‘[YOUR IMAP USERNAME]’, password: ‘[YOUR IMAP PASSWORD]’, host: ‘[IMAP HOST]’, port: 993, tls: true });

}); fetch.once(‘error’, function(err){ throw err; }); fetch.once(‘end’, function(){ console.log(“All messages received…”); imap.end(); });

fetch.on(‘message’, function(msg, sequence){ msg.on(‘body’, function(stream, info) { var buffer = ‘‘, count = 0; stream.on(‘data’, function(chunk) { count += chunk.length; buffer += chunk.toString(‘utf8’);

Connect to a mail server

Fig 07

Naturally, fill out the details according to your setups requirements. As we mentioned before, this IMAP module is based around streams and events, so before we open up a connection let’s bind some listeners to our imap variable (Fig. 04). Let’s look at these listeners very quickly. The ‘error’ event will fire if there’s an error connecting to our server and ‘end’ will fire when we close our connection to the server, not when we finish our request. For us, ‘ready’ is where the magic happens. When we open our connection, from within the ‘ready’ event is where we’ll make our requests to our email server. If you run this code, not a great deal will happen, and that’s because we haven’t opened a connection to our server yet.

imap.connect();

}); stream.once(‘end’, function() { console.log(“The message stream has ended”); console.log(buffer); }); }); });

48 www.linuxuser.co.uk

… will sort that out for us. We don’t need to pass anything to it as we passed through our connection settings when we instantiated the new Imap object. If you run your code now, “I am ready!” should be printed out in your console.

05

Requesting mail items

Right, so we’ve managed to connect to our server – now we need to get stuff out of it. After the ‘console.log(“I am ready!”);’ console. log, insert the lines in Fig. 05.

Send and receive emails using Node.js

Use Node.js modules to send error reports and storing mail offline

TUTORIAL So what have we done here? As soon as a connection we’ve opened is ready we use ‘openBox’ to request the some statistics for our mailboxes, in this instance, our ‘INBOX’. Now, every request we run from inside this callback will be applied to and will result in mail from our inbox. You’ll see that we’ve logged out the variable ‘box’. This ‘box’ is useful as it gives us stats about the mailbox we’ve just opened. So, let’s get a couple of items from our inbox, say the first ten items. What we’ll do is tell imap to fetch a sequence of messages from the newest to the tenth newest and then log it out. We need to create a new variable, fetch, to do this.

var fetch = imap.seq.fetch(‘1:10’, { bodies: [‘HEADER.FIELDS (SUBJECT)’, “TEXT”], });

06

details.to = “[email protected]”; details.from = “[email protected]”; details.subject = “A Node app has crashed…”; transporter.sendMail(details, function(error, info){ if(error){ console.log(error); }else{ console.log(‘Message sent: ‘ + info.response); if(callback !== undefined){ callback(); } } }); }

Handling data streams and events

The fetch variable lets us pass through the amount of messages we’d like to retrieve and the parts of those messages that we’d like to receive. In this instance we’re grabbing the text and subject line of the first ten messages. When this method is executed, a stream of data will be received from our server. We need to add some listeners to fetch to build up the content of this stream until we have all of the data we’re expecting (Fig. 06). As you can see, once we’ve received all of the messages we’ve asked for, we can close the connection to our IMAP server. Inside fetch. on(‘message’) we need to listen for the ‘body’ event to be dispatched so that we can hook into the data stream that’s passed through and add all of the data chunks together to get the entirety of our message (Fig. 07). As we receive data, we encode the stream to UTF-8 encoding inside our stream.on(‘data’) and add it to our buffer. Once our stream ‘end’ event is fired we have our message, so we can now log out our buffer and see our received email body. Great stuff.

07

Fig 08

function sendReport(details, callback){

Make something useful

So, now we have the tools to send and receieve as many emails with Node as we like, but that doesn’t do much for us on its own. Let’s make something that can be useful to us before we wrap up. We’re going to write a little Node module that will run along side other Node apps and will email us a report when that app crashes. Create a new file called ‘crash_mail. js’. Just as with ‘send.js’, we’re going to require Nodemailer in this script and, just like before, we need to create a transporter for any email we may send. However, this time, rather than

Fig 09

process.on(‘uncaughtException’, function(exception) { console.log(exception); sendReport({ html : “One of your Node apps has crashed. The error was:

“ + exception + ““ }, function(){ process.exit(1) }); }); send an email as soon as the script runs, we’re going to create a function that will be triggered whenever an uncaughtException occurs. Create a function called sendReport() and add the code in Fig. 08. Just as before, we’ve set up Nodemailer to use the transporter that we defined earlier. This time, however, we’re editing details so that any message passed through to it will be sent to a mail address to handle error reports. Now that we can send reports of exceptions we’ll set up Node to actually handle those exceptions and pass them on to our sendReport function; (Fig. 09) All we’re doing here is setting up a process event to capture any ‘uncaughtException’ that a Node app may trigger. We take that exception and add it into a little bit of HTML that will warn the receiver of our email that our app has received an error. We’ll also pass through a callback for when our email has finished sending, process.exit(1). This will end our Node app with an error code that our Linux system will be able to recognise and handle, rather than failing silenty. Now, if you include crash_ mail in the root of any Node project and require it with something like…

crash = require(‘./crash_mail.js’) … whenever an exception crashes your app, you’ll get an email about it. Go on, test it with throw “A big error” and check your inbox.

08

Rounding up

And that’s our quick waltz through handling email with IMAP. Hopefully it’s shown you that you don’t have to rely on traditional methods of email. We’ve covered sending messages based on system inputs, how those messages are constructed, the function of a transporter in sending email and handling event-based read streams to read data from a server. The key benefits of using email to alert someone two something are the reliability of the protocol and the unprecedented level of integration in almost all digital devices. These two factors make it almost impossible for an important server message to go missing, unlike SMS or push notifications which get lost in the ether all too often.

49 www.linuxuser.co.uk

Tutorial

Nginx log file sample

The Joomla configuration file

The www.conf file for PHP support

Nginx serving three different sites

Serve a Joomla! website using Nginx Learn to configure Nginx to serve simple websites and discoverwhyit’saseriousalternativetoApache Advisor

Mihalis Tsoukalos is a UNIX system administrator also proficient in programming, databases and mathematics. He has been using Linux since 1993

Resources Nginx www.nginx.org Joomla! www. joomla.org Apache www.apache.org

50 www.linuxuser.co.uk

Nginx (pronounced Engine X) is a web server developed in Russia by Igor Sysoev back in 2002. In this article you will learn how to install and run Nginx on a Linux machine, how to configure it and how to install and use Joomla with Nginx. The first two questions you might want to ask are “Is there a real need for another web server?” and “What’s wrong with Apache?”. The answer to the first question is that different web servers have different capabilities, so having multiple options is always a good thing. The answer to the second

question has to do with the fact that Apache is a process-based server: when serving simultaneous connections, each connection requires its own dedicated thread. Nginx uses asynchronous sockets that allow it to handle more requests per process without spawning too many processes. As a result, fewer Nginx processes can serve larger amounts of HTTP requests compared to Apache. Also, the memory consumption of Nginx is very low when serving static pages and its configuration files are simpler to read, use and modify than the configuration files of Apache.

Serve a Joomla! website using Nginx

Configure the Apache alternative to serve simple websites

TUTORIAL

03

Serving your first site with Nginx

04

Serve two different sites with Nginx

Although it looks like you will need to make changes to the nginx.conf file to configure Nginx, it is better to create two new files inside /etc/ nginx/sites-enabled. All the contents of the files inside /etc/nginx/sites-enabled directory are automatically included in the nginx.conf file because of the following command found inside /etc/nginx/nginx.conf:

include /etc/nginx/sites-enabled/*; For our example, the two subdomains will be named lud1.mtsoukalos.eu and lud2. mtsoukalos.eu respectively. You should also update your DNS records in order to create the two new subdomains.

01

Install Nginx

Installing Nginx on a Debian 7 system is as simple as executing the following command with root privileges:

# apt-get install nginx Debian 7 installs an older version of Nginx (1.2.1) but you can still do your job with it. You can manually install a new version of Nginx if you want though. The default root HTTP directory of Nginx on a Debian 7 machine is /usr/share/ nginx/www, which comes with the following files inside it:

# ls -l /usr/share/nginx/www/ total 8 -rw-r--r-- 1 root root 383 Jul 7 2006 50x.html -rw-r--r-- 1 root root 151 Oct 4 2004 index.html

02

Nginx configuration files

On a Debian 7 Linux system, the configuration files of Nginx are located inside / etc/nginx. The contents of /etc/nginx are similar to the contents of the directory where Apache puts its own configuration files (/etc/apache2). It is considered good practice to create a separate configuration file for each domain or subdomain you are going to serve and put them inside the sites-enabled directory.

Nginx comes with a sample configuration file, called default, that is located inside /etc/ nginx/sites-enabled and can be used as a starting point when creating virtual hosts.

03

Serving your first site with Nginx

If you try to run Nginx on a machine where Apache is already running, it is very likely that you are going to get some error messages. The problem is that only a single server process can use a given TCP port and, as you can imagine, Apache is already using port number 80 for its own purposes; therefore you should change the default port number of Nginx. You can use any port number you want as long as it is not already in use by another process. As you will no longer be using the default port number (80) of the HTTP service, you must manually include the selected port number at the end of the URL so that Nginx can know it. Nginx uses worker process for serving HTTP requests and their total number is defined inside the nginx.conf file using the worker_ processes variable:

# grep -i worker_processes nginx.conf worker_processes 4; A good practice is to start with two worker processes and add more if you find out that two are not enough. Fewer worker processes means less memory used by Nginx.

05

The Nginx configuration explained

06

Nginx rewrite rules

Two files were created inside /etc/ nginx/sites-enabled, named lud1 and lud2, that hold the configuration for each subdomain.The supported subdomains are defined using two different server blocks, and alhough they have different access and error log files, both of them still use the same IP address as defined by their DNS records. As you can see, both sites listen to port number 8084 (the value of the listen variable) although it is not necessary to use the same port number. You now need to create two index.html or index.htm files, one inside /srv/www/lud1/ public_html and another inside /srv/www/lud2/ public_html and you are done! As you may understand, both lud1 and lud2 configuration files contain a minimalistic configuration for a static HTML site; therefore if you try to run a PHP script using the aforementioned configuration files, your web browser will try to save the PHP file instead of executing it.

Nginx does not support .htaccess files! The functionality of a .htaccess file is embedded in the configuration file of each individual virtual domain or subdomain. The good thing is that the equivalent rewrite rules in Nginx are usually fewer and less complex than the ones used in an Apache .htaccess file. Although converting an .htaccess file into the equivalent Nginx format looks like a lot of work, you only have to do it once. As you become more experienced with rewrite rules, you will appreciate Nginx rules and stop thinking about .htaccess files.

51 www.linuxuser.co.uk

Tutorial

08

07

Using Nginx and PHP

Nginx does not support PHP by default. You will have to install a module to get PHP support (but Apache does the same with PHP support anyway). You should install the php5fpm package, configure it (if needed) and run the php5-fpm server process for PHP to work. The most important setting is the php5-fpm socket value because you will use it in your Nginx configuration file – PHP support will not work without a correct php5-fpm socket value. It is defined inside /etc/php5/fpm/pool.d/www.conf:

# grep php5-fpm /etc/php5/fpm/pool.d/ www.conf listen = /var/run/php5-fpm.sock If there is an error with your php5-fpm socket configuration, the error messages generated by Nginx will be similar to the following:

52 www.linuxuser.co.uk

2014/03/24 12:53:27 [crit] 7938#0: *1 connect() to unix:/tmp/phpfpm.sock failed (2: No such file or directory) while connecting to upstream, client: 2.86.29.245, server: lud1.mtsoukalos. eu, request: “GET /install.php HTTP/1.1”, upstream: “fastcgi://unix:/tmp/phpfpm. sock:”, host: “lud1.mtsoukalos.eu:8000”

08

Install Joomla!

The configuration file for the Joomla installation is named joo.conf and it will use the joo.mtsoukalos.eu subdomain for hosting the Joomla site. Its files will be located in the /srv/ www/joo directory. Before continuing with the rest of the article, make sure that the directories mentioned in your joo.conf configuration file are created and have the correct UNIX permissions. Usually, a running nginx process uses the same UNIX user and group as Apache: www-data and root respectively. Also, make sure that you have your DBMS up and running.

Installing Joomla!

If the configuration file is correct and the Joomla installation begins, it means that everything with your Nginx setup is okay. You only need to have the database related information nearby in order to finish your Joomla installation. If you want to check the syntactical correctness, validity and integrity of your current Nginx configuration, you should run the following command:

# nginx -t In case of an error, you will get a helpful error message:

nginx: [emerg] unknown log format “ma” in /etc/nginx/sites-enabled/lud1:7 nginx: configuration file /etc/nginx/ nginx.conf test failed If your nginx.conf file or one of the included configuration files has multiple errors, the

Serve a Joomla! website using Nginx

Configure the Apache alternative to serve simple websites

TUTORIAL

11

NginxFAQ

Nginx versus Apache

Here’s a simple breakdown of some of the key terms you'll encounter with Nginx Event-driven Event-driven means that notifications or signals are used to mark the initiation or completion of a process; therefore resources can be used by other processes until a process initiation event is triggered. As a result, memory and CPU usage are optimised with Nginx-served sites.

Asynchronous Asynchronous means that threads are running concurrently and do not block each other while serving many requests, meaning Nginx can handle a lot more.

Single-threaded Single threaded means that a single worker process can server multiple clients because the resources are not blocked. It does this asynchronously with one thread, rather than multi-threaded programming.

Nginx handles requests using as few threads as possible output of “nginx -t” will only show the first one. You have to correct the first error and rerun the command to make sure that no additional errors exist.

09

10

log_format FORMATNAME ‘$remote_addr $remote_user [$time_local] “$request” ’ ‘$status $body_bytes_sent “$http_ referer” ’ ‘“$http_user_agent” “$http_x_forwarded_ for”’; The error_log directive defines the name, the location and the logging level for the error log whereas the access_log directory defines the name, the location and the preferred format for the access log file. By default, the error log works globally; if you want to override this, place the error_log directive in the main context.

Usually, Nginx rules are easier to read and understand than Apache rules, but you need to train yourself in order to be able to fully translate an .htaccess file.

More about Nginx rewrite rules

You will now learn how to convert the single most useful set of Apache rules into the equal Nginx setup. The Apache rules are the following:

Nginx Log files

You can define you own log file format as follows:

if ($request_filename ~* .(aspx|jsp)$) { return 404; }

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L] The above rules dictate that when the filename specified in the URI is neither a file nor a directory that is physically on disk, the request is passed to index.php. This is a very popular technique as it is being used by most Content Management Systems. All three Apache rules can be translated into just one Nginx rule:

try_files $uri $uri/ /index.php?q=$uri;

11

Nginx versus Apache

The only reason for Nginx to use multiple processes is to make full use of multi-core, multi-CPU and hyper-threading systems. On the other hand, as Apache uses synchronous I/O, it is obligatory to serve each request using a separate thread in order to avoid blocking. What you should also remember is that a process-based server requires more RAM to operate, especially when trying to serve thousands of simultaneous requests whereas an asynchronous server such as Nginx is eventdriven and handles requests using as few threads as possible. If you are thinking of building a site from scratch, then you should definitely consider using Nginx because building a new site gives you more time for experimentation and learning, but for an existing site it is safer to leave it as it is.

If you want to deny access to all ASP and JSP pages, you will have to use the following Nginx rule that uses regular expressions:

53 www.linuxuser.co.uk

Tutorial All of the primary tools and options are accessible through the main menu bar

Dashboard and dashlet settings can be found via this cog icon beside the dashboard title

This My Sites dashlet shows all of your active sites in one place

A tasks list and workflow creation tool are also available as a dashlet

User-specific settings can be made by different team members

Recent or favourite documents are displayed here, and can be filtered

Manageyourbusinnessin the cloud using Alfresco Alfresco is an open source ECM system packing scores of features to help simplify the running of your enterprise Advisor

Nitish Tiwari is a software developer by profession and an open source enthusiast by heart. As well as writing for leading open source magazines, he helps firms set up and use open source software for their business needs

Resources Alfresco community page www.alfresco.com/community

54 www.linuxuser.co.uk

People frequently talk about managing their time better – but the age we live in demands managing your focus as well, and cutting out the distractions is the most important way to remain focused. But, like most work environments (especially office-based), your workplace is probably very distracting at times. There are several reasons for it, like having to manage several tools for various activities – a tool for workflow, another tool for managing documents, another tool for collaboration and so on. Wouldn’t it be better to do stuff at a single portal? Another classic example of distraction in play are the numerous emails you may be

receiving about topics you aren’t interested in. Wouldn’t it be better if you could look up information you wanted from a single window? Alfresco is a great way to cut out all these distractions. It can help you stay productive while managing the necessary evils of enterprise working – such as workflow management, record management, document management and much more – all in one place. The latest community version available is the 5.0.a, which has bug fixes over the last stable version 4.2.e. But the latest version (as the Alfresco website says) has undergone limited testing, so we have used version 4.2.e for this tutorial.

Manage your business using Alfresco

Simplify the running of your enterprise with an open source ECM

TUTORIAL

04

01

Installation

The installer comes bundled with the webserver and other components required for Alfresco, so you just need to download the installer for your platform and then go through the usual double-click installation. During the installation, you’ll have to set the admin password. If you need to, you may also change the ports for different services during installation. Once installation is done, you need to start the server and other services related to Alfresco. You can do this via a GUI tool called the application manager, or the alfresco.bat or alfresco.sh file in the Alfresco installation folder. Running the batch file looks like this:

/Applications/alfresco-4.2.e/alfresco.sh start After the services are started, you can access Alfresco via a browser at this address: http:// localhost:8080/share/page/. If you want to access it from other PC, just replace the “localhost” with the IP address of server (where you installed Alfresco). For more info, run this script with the argument “help”.

02

search and add users manually or via a CSV file. After you’ve added a few users, separate them out into groups, as they would be in a real worldscenario. Adding groups is easy; just click on the “Groups” and follow the steps mentioned. In our system, we have added users James, Richard, and Clark, with James and Richard in the Employee-Level1 group and Clark in Employee-Level2. Later, when you set permissions for documents, you can set them based on groups or individuals.

Add users and groups

The first step to get started with different features of Alfresco is to list users in the system. Even if you are just evaluating Alfresco, adding users will make sure you see the teamwork tools in action. To add users, log in to Alfresco as admin and click on the “Admin Tools”, listed in the top menu. Then click “Users” listed in the bottom of the left pane. On this page you will see options to

03

Dashlets

Document management

a collection of smaller dashlets. Dashlets are dynamic information blocks, which can be added/removed from your home page. So, say you want to see the information about your documents, your sites and your calendar only, you would click Customize Dashboard (gear icon next to text Dashboard) and add relevant dashlets to your dashboards and delete all others. You may even choose to change the layout of the dashboard. Note that this feature is available to users of all privilege levels and not only admins.

04

Document management

As an ECM, Alfresco provides a tight integration of documents with other features such as workflows and sites. So, any document that you upload to Alfresco can be very easily linked to a workflow or a site and still maintains its own identity. Now that we have users, groups and dashboard in place, lets see how to configure Alfresco to manage our documents. To upload documents go to the “My Files” link on the top menu. Then select “My Files” on the left side. This will show you the drag-and-drop interface to upload files. Once you upload a file, you can see options on the right hand side, if you highlight the row. Here you can edit the properties, copy or move the file to a different location like a site or a shared folder, edit the file and much more. More options related to a file are revealed if you click on the file name. Let’s take a look at these in a little more detail.

After users are set up, you can then move on to set up your home page. The home page – or Dashboard in Alfresco – is essentially

55 www.linuxuser.co.uk

Tutorial

05

05

Document management continued

The first few options are selfexplanatory. We started with the “Edit Offline” option – it locks the file and downloads it in just one click, so that you can edit it offline. Once done, you can upload the new version or cancel the editing to unlock the document. Then there is the “Edit in Google Drive” option, if the file type is editable in Google Drive. This comes in handy if you want to edit the document online: just authenticate using your Google credentials. The “Copy to” and “Move to” options let you move the file across different sites, repositories and your own My Files folder. Also, you can move/copy files to a shared folder, if you don’t want to add it to a site. The “Start Workflow” option lets you create a workflow with the document as an attachment (more on this in the next step). “Manage Permissions” lets you set permissions for individuals or groups, and in case you don’t set permission, default permission will be inherited from the folder containing the document. “Publish” lets you share your file to social media once you set up proper channels.

06

Collaborative editing

Workflow

The “Tasks” menu item has options to view assigned workflows and the workflows started by the user. However, you can start

56 www.linuxuser.co.uk

workflows from both of the pages, or via the options available after you upload a document. The basic difference between the two options available under “Task” link is that the “My Tasks” page shows the active tasks currently assigned to you or available in the pool of tasks, and helps to manage tasks assigned to you. On the other hand, “Workflows I’ve Started” lets you manage the workflows you’ve started even if they’re pending on someone else’s desk. However both the pages allow filtering based on criteria such as due date, priority and other page specific criteria.

07

Workflow continued

There are six types of workflows available in Alfresco, we will now pick one of them and try to get a feel of how workflow and related tasks move in the system. Let’s take for example the “Review & Approve” type of workflow. After you click the “Start Workflow” button and select the workflow type, you will have to fill the relevant details like due date, priority, reviewer and the item to be reviewed.

Among these, only the reviewer must be filled out. In cases where you are not really sure who should review you can select the “Pooled Review & Approve” Option. Once the details are filled, the workflow gets created and gets assigned to the relevantperson.

08

Minisites

Sites are a great way to work with others. While reducing the costs of publication and distribution, sites provide a defined way of collaboration; you can also reduce or eliminate the need to print/fax/email your documents. Once you create a site, you become the default manager for the site, although you can add other members as managers. When creating the site, you can choose the visibility – ie access to all users, moderated membership or private. If you choose moderated membership, you will need to manually invite the intended members with the proper privilege level – ie “Manager”, “Collaborator”, “Contributor” or “Consumer”.

Manage your business using Alfresco

Simplify the running of your enterprise with an open source ECM

TUTORIAL

08

They can access the site when they accept the invite that appears in their tasks. This works the other way round too, so users can also request access to a site. Mind that only users with access levels of “Collaborator” or above can add documents to the site’s document library.

09

Record management

This is a relatively new feature from Alfresco, which lets you manage records for your organisation. As per the Alfresco website, the record management is DoD 2015.02 certified too. Unfortunately, the community edition of Alfresco doesn’t support record management out of the box. So let’s see how to install the plugin or Alfresco Module Package (.amp) to enable document management. First, download these two .amp files from the Alfresco Wiki: alfresco-rm-.amp and alfresco-rm-share-.amp (look beside "Records Management AMPs" at bit.ly/1rv2G7d). Go to the Alfresco installation folder on your system and paste the alfresco-rm-.amp file to the amps directory, and then paste the the alfresco-rm-share-.amp into the amps_ share directory. Stop the Alfresco servers (using the GUI or the command line option discussed in beginning of this article). Delete the tomcat temporary folders “alfresco” and “share” in the directory tomcat/

Minisites

Peopletalkaboutmanagingtheir time–buttheageweliveindemands managingyourfocusaswell webapps. Browse to the /bin directory in the command prompt and run the below commands:

java -jar alfresco-mmt.jar install / Applications/alfresco-4.2.e/amps/alfrescorm-2.1.0-621.amp /Applications/alfresco4.2.e/tomcat/webapps/alfresco.war      java -jar alfresco-mmt.jar install / Applications/alfresco-4.2.e/amps_share/ alfresco-rm-share-2.1.0-621.amp / Applications/alfresco-4.2.e/tomcat/webapps/ share.war Note that \ instead of / should be used if you run this on a Windows system. You can then restart the Alfresco servers and complete the installation. After installation you can create a record management site in the same way as a collaboration site.

10

Desktop sync

Alfresco lets you sync files between your desktop and the server, which is a similar concept to other file sync tools out there made by cloud storage providers. It is very much available as an add-on on the Alfresco website, so make sure you visit the URL: https://addons.alfresco.com/addons/desktopsync-alfresco. You can then download and install the tool to your system just like any other desktop application. After installing the tool, you can log in to it using your Alfresco account credentials. Fill the URL in this format: http://ip:port/ alfresco/api (\t "_blank" http://127.0.0.1:8080/ alfresco/api). You’ll find the files that are being synchronised in the “my documents” folder.

57 www.linuxuser.co.uk

NEW

From the makers of

Every issue different, every issue amazing The unique new monthly magazine On sale now!

Factp

acked pages burst ing w ith intere sting info

Where to get your copy O

All good newsagents & supermarkets Online at imagineshop.co.uk n your iPhone, iPad & Android by isiting greatdigitalmags.com Available on the following platforms

THE ESSENTIAL GUIDE FOR CODERS & MAKERS

PRACTICAL

Raspberry Pi 66

“You can interface a Raspberry Pi with Arduino components – now learn how to program them from the Pi”

Contents 60

Bullet Pi –freeze time with 48 Pis

62

Make a Raspberry Pi sampler

66

Build a smart alarm clock

70

Program Arduino from your Pi

72

What is Python?

59 www.linuxuser.co.uk

Camera 48 Raspberry Pi Cameras make up Bullet Pi, with each one sitting in the lower half of each piece of the frame composing the ring

Frame While the shots for each set of Bullet Pi images can be adjusted, they’re kept level with a custom laser-cut frame

Ring Bullet Pi uses a ring setup so that you can rotate around a subject frozen in time once the photos are stitched together

PiFace The Control and Display module has anLEDscreenfortwo 16-characterlines,fivecontrolbuttons, anavigationswitchandIRreceiver

Cables About half a kilometer of network cable was used to build Bullet Pi – the PiFace modules were a godsend during debugging

Componentslist Q 48 Raspberry Pi Model Bs Q 48 Raspberry Pi Cameras Q 48 PiFace Control and Display modules Q 48 NOOBS SD cards Q 48 5V PSUs Q 500m of network cable Q 2 x 24 port switches Q Wireless router

60 www.linuxuser.co.uk

Above Many people wondered if Andrew and the team were building a Large Hadron Collider when the first few photos were teased online Left Liz Upton, head of communications at the Raspberry Pi Foundation, tests out Bullet Pi at the Manchester Raspberry Jam in 2013

My Pi Project

Bullet Pi

PiFace creator Andrew Robinson shows us how you can freeze time by chaining 48 Raspberry Pi cameras

What was the inspiration behind Bullet Pi? So I’d seen The Matrix and also a BBC programme called Supernatural: The Unseen Powers Of Animals, where they shot dolphins jumping out of the water and they could just freeze time, and then spin round so you saw the water drops, and I thought that was a really amazing effect. And reading how it was done, it was with a whole array of cameras and it seemed quite simple. So I had the Raspberry Pi and a couple of cameras sat on my desk, and it was sort of like, ‘Well, if it seems that simple, then surely if we just got a whole load of Raspberry Pis and cameras – and they’re not that expensive – why shouldn’t we just be able to build it?’ It was one of those moments where you think it should work but you don’t actually know. So what I did was buy four cameras and I tried it, and that looked like it would work – it gave us a tantalising glimpse that we could do it. So it was a good concept test? Yeah, but even so it wasn’t conclusive – it just told us that it’s possibly likely but we still didn’t actually know. So then it was just a case of buying a few more cameras. You get to the stage where all you can think is, ‘Right, let’s go for it. Let’s have a full set of 48 cameras and just build it.’ It was only really when we got the first set of images out, and then stitched that together, that you could see having a whole load of cameras and firing them at once is pretty much all we needed. It was one of those things where ‘Wouldn’t it be cool if…?’ became ‘You know, we might be able to…’ and then ‘Oh, we’ve done this!’ That’s where the best Pi projects come from! So how do you set it off? It’s gone through a few iterations and, as we’ve tried it, we’ve made a few refinements. In the latest setup, we’ve got all the Pis booted into Raspbian and, on boot, they run a little Python script we’ve got. We’ve fitted them so every Pi’s got a PiFace Control and Display module that you can have simple interactions

with using buttons – it just drives a menu. So that lets us know that all the Pis have booted up, because if you’ve got 48 Pis and a network cable comes out, it’s tricky to find out which one when they all look the same. So that was really just a luxury in terms of helping to debug, and it also means we can reconfigure the array if we wanted to do a lateral version. What are you using to stitch the images? That’s FFmpeg. We have had to do some things with the alignment just so you get a smooth video out, because some of the cameras are at slightly different angles and if you don’t then the picture tends to go up and down. So basically we take a set of images with each calibration and work out whether there’s a positive or negative offset to each frame, and then when we stitch them together we effectively chop off the top and the bottom and just use the middle of the frame. Is that handled by a script or do you do it manually once you’ve taken the shots? We actually trigger it as two points, but there’s nothing to stop the two scripts being put together in the command line and all being run at once. The only reason we run it twice is that the script to stitch the images together takes about a minute and sometimes, if you take an image and then the person you’re taking the image of says ‘I don’t like that, let’s do it again’, it saves cancelling something that’s already started. So for logical reasons we run it as two separate operations but effectively they’re just two commands: one command to take the images and one command to stitch the images, and there’s nothing to stop it all being automated. You could put a pressure pad in there so that when people stood in the middle of the bullet rig it would automatically trigger. Is the PiFace a crucial component or was it just something you wanted to use? It was a luxury for us that we had it kicking around. It turned out to save us time when we were debugging. It’s not essential –

you can build it without – but it made life much easier. We’ve also tried it in other configurations, and when you put it in other configurations, just being able to go through a menu on each Pi and then set where it is in the sequence is a lot easier if you can actually relate to the Pi that you’ve got in your hand, rather than having to look at what number it is, SSH into it and set a file. What configurations have you tried? We tried semicircles and also we’ve tried ones in straight lines, and that way you get the effect of the camera panning along as opposed to spinning around a point. We’ve got future plans, which do involve taking it into more wild and wacky situations. So far we’ve learned from the examples we’ve done inside, and then as we’ve got the setup faster and more automated and got all the little tweaks and experiences from it, we’re becoming more ambitious with it. There are definite plans to mount it on impressive things outside and get some sports photography going with it. There’s one person who actually booked us for their wedding after they’d seen it – they wanted photographs of their guests and it would be different, something unusual to capture the guests in a 360-degree spin. That’s the other nice thing about it – community. You put something out there online and suddenly it goes off in a different direction.

Andrew Robinson is an honorary research fellow of the University of Manchester, and the creator of PiFace Control and Display (learn more at piface.org.uk)

Like it? If you’re thinking of using PiFace Control and Display in one of your own projects, check out the excellent tutorials provided by the team over at: piface.org.uk/ guides

Further reading To see Bullet Pi in action, check out this video from its first outing at the Manchester Raspberry Jam in 2013: bit.ly/1wIoP6y

Do you plan to take it to any more Jams? I think we’d like to do more things with it. One of the things I’d like to do is try and play around more with fusion of movements. So rather than having someone standing in the circle and then performing in the circle, see whether we could actually get a portable version and take the rig around – that way you could follow the action, if you like, and also get the video coming out of the Raspberry Pis. I would also like to experiment with background motion blur, things like that. We also think fireworks could be quite interesting, come November time.

61 www.linuxuser.co.uk

Tutorial

Make a Raspberry Pi sampler Build your own looping drum machine with only 200 lines of code!

Left Extra breadboards are used here to keep the main breadboard as free from wires as possible

Whatyou’llneed Q Latest Raspbian image raspberrypi.org/downloads

Q At least one breadboard Q Push buttons Q LEDs Q Female-to-male GPIO jumper cables Q Male-to-male GPIO jumper cables

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

In this tutorial we combine electronics, music and programming knowledge to create a simple sampler with looping capabilities. The implementation used in this article has three drum sounds as the samples, but it is trivial to add more until you run out of GPIO pins. Before we start, I’ll cover some basic musical terms. Music is split into bars. There are a certain number of beats in a bar. This sampler uses the 4/4 time signature, which means there are 4 beats in each bar. Tempo is the speed at which music is played, and it is measured in beats per minute (bpm). A metronome is an audible tone that is heard at the start of every beat. Quantization is the process of aligning notes to beats, or exact fractions of a beat, and a quantization value is usually given in the form 1/8. This means that there are eight possible places in a bar where a note can be played. When the sampler is recording and a sample button is pressed, we store the sample at the current position in the bar with the accuracy of the quantize value. There’s a lot to cover, so let’s get started.

62 www.linuxuser.co.uk

01

Connect LEDs

The circuit diagram is an LED that can be turned on and off with a GPIO output. The orange wire is the connection from the GPIO output. This then goes through a 220û resistor to limit the current draw to a safe level. This current flows through the positive leg of the LED and then back to ground. We need nine LEDs for this project.

Make a Raspberry Pi sampler

02

Wire up buttons

The second circuit we need is a push button. The purple wire goes to a GPIO input. There is a 10Kû pull down resistor to ground, which represents a logical 0. When the push button is pressed, the 3.3V supply representing a logical 1 is connected to the purple wire. The electricity takes this path because it has less resistance than the path to ground. We need two buttons for record and undo, and then as many buttons as you like for samples (three drum samples are provided).

03

Full code listing Step 04

Step 05

Create a few folder for the project called pisampler. Then download and unzip the sounds:

mkdir pisampler cd pisampler wget http://liamfraser.co.uk/lud/ pisampler/sounds.zip unzip sounds.zip

04

Import required libraries

Create a file called pisampler. py in your favourite editor. The first thing we need to do is import the required libraries and set some configuration values. A key option is debounce: the time to wait before a button can be pressed again to stop accidental presses from contact bounce.

05

Create a sample class

We’re going to use a class to represent each sample. It's going to need a few things: the pin that the sample button is connected to, the name of the sound file, and a reference to the instance of the sampler class. We haven’t created the sampler class yet, but the sample will need to be able to tell if the sampler is recording or not, and have access to the data structure that recordings are stored in to add itself to it if necessary. The other thing that we need to do is set the GPIO pin to an input, and add an event listener for when the button is pressed. We set callback (the function to be executed when the button is pressed) to a function called self.play_btn, which

RPi.GPIO as GPIO time pygame os

beat_leds = [2, 3, 4, 17] bar_leds = [27, 22, 10, 9] record_led = 11 record = 19 undo = 26 debounce = 200 # ms

Download samples

There will now be a folder called sounds with some samples in. The file format for samples is .wav audio, Microsoft PCM, 16 bit, stereo 44100 Hz. Mono will work too. Any samples can be converted to this format with Audacity by exporting them as a .wav file.

import import import import

(Cont. on next page)

class Sample(object): def __init__(self, pin, sound, sampler): self.sampler = sampler self.name = sound self.sound = pygame.mixer.Sound(os.path.join('sounds', sound)) self.pin = pin GPIO.setup(pin, GPIO.IN) GPIO.add_event_detect(self.pin, GPIO.RISING, callback=self.play_btn, bouncetime=debounce) def play_btn(self, channel): self.sound.play() s = self.sampler if s.recording: s.recording_data[s.bar_n][s.quantize_n].append({'loop' : s.loop_count, 'sample' : self})

Step 06

class PiSampler(object): def __init__(self, tempo=80, quantize=64): pygame.mixer.pre_init(44100, -16, 1, 512) pygame.init() self.quantize = quantize self.tempo = tempo self.recording = False self.record_next = False self.metronome = False self.met_low = pygame.mixer.Sound(os.path.join('sounds', 'met_low.wav')) self.met_high = pygame.mixer.Sound(os.path.join('sounds', 'met_high.wav')) self.met_low.set_volume(0.4) self.met_high.set_volume(0.4) self.samples = [] self.recording_data = [] for i in range(0, 4): bar_arr = [] for i in range(0, quantize): bar_arr.append([]) self.recording_data.append(bar_arr) GPIO.setmode(GPIO.BCM) for pin in beat_leds + bar_leds + [record_led]: GPIO.setup(pin, GPIO.OUT) GPIO.setup(record, GPIO.IN) GPIO.add_event_detect(record, GPIO.RISING, callback=self.record_next_loop, bouncetime=debounce)

63 www.linuxuser.co.uk

Tutorial

Full code listing Step 06

Step 07

(Cont.)

GPIO.setup(undo, GPIO.IN) GPIO.add_event_detect(undo, GPIO.RISING, callback=self.undo_previous_loop, bouncetime=debounce) @property def tempo(self): return self._tempo @tempo.setter def tempo(self, tempo): self._tempo = tempo self.seconds_per_beat = 60.0 / tempo self.quantize_per_beat = self.quantize / 4 self.quantize_seconds = self.seconds_per_beat / self.quantize_ per_beat

Step 08

def add(self, sample): self.samples.append(sample) @property def recording(self): return self._recording @recording.setter def recording(self, value): self._recording = value GPIO.output(record_led, value) def record_next_loop(self, channel): self.record_next = True

Step 13

def play_recording(self): for sample_dict in self.recording_data[self.bar_n][self. quantize_n]: if sample_dict['loop'] != self.loop_count: sample_dict['sample'].sound.play() def undo_previous_loop(self, channel): if len(self.last_recorded_loop) == 0: print "No previous loop to undo" return print "Undoing previous loop" loop = self.last_recorded_loop.pop() for bar in self.recording_data: for quantize in bar: removes = [] for sample in quantize: if sample['loop'] == loop: removes.append(sample) for sample in removes: quantize.remove(sample)

Step 11

def do_leds(self, leds, n): count = 0 for led in leds: if count == n: GPIO.output(led, True) else:

64 www.linuxuser.co.uk

will play a sound and add it to the recording data if we are recording. It will become clear how this works once we’ve written the sampler class. Note that the GPIO event handler passes the pin that the event handler was triggered on, hence the channel variable that is present but never used.

06

The sampler init method

07

The tempo property

08

Helper functions

09

Start the main loop

Here’s the start of the sampler class. The last value in the Pygame mixer init is the buffer size. You might need to increase this to 1024 or higher if you have audio dropouts. We create some variables to store recording state. Metronome sounds are then added and their volume lowered. We also create a list to hold our samples in. We create nested arrays to represent recorded sample presses. There is an array for each bar. Each bar has an array for each possible quantize value. The default value of 64 gives us 64 possible places to store a sample hit per bar. Finally, we set up the LED pins, and the pins for the record and undo buttons.

The tempo variable is actually a property with a custom setter. This means when a value is assigned, it does a custom action. In our case, we need to calculate how often we need to check for recorded notes to play in the main loop that we’ll write later.

There are a few helper functions in the class. One of them simply adds a sample to the list of samples. Another sets a variable to trigger recording at the start of the next loop. There is also a function which turns the red LED on when the recording variable is set to true. Now we'll jump forward and take care of the main loop towards the end of the full code listing.

The main loop doesn’t actually have to do any work at all to play sounds, as that’s done by the GPIO event handlers. The main loop is used to play the metronome, update the state about which bar/beat/ quantize we are currently on, update the LEDs and deal with recording if necessary. Before the loop, we create variables to track the state. The last recorded loop is a list that we will use as a stack. A stack is a last in/first out data structure, allowing us to undo recordings multiple times by removing each sample that was recorded when the loop count was the value on the top of the stack. If we’re at the start of a new beat then we use a function called do_leds that we haven’t created yet. As the LEDs work in the same way (a block of four LEDs where only one is turned on), we can use the same function twice and just pass a different set of pins, and the index of the LED we want to turn on. We then call the do_metronome function which will play the appropriate metronome sound. We then do some recording logic which starts recording if we should be recording, and stops recording if we have just been recording, adding the

Make a Raspberry Pi sampler loop number to the last_recorded_loop stack. We increment the loop count after doing this.

Full code listing Step 11

10

(Cont.)

GPIO.output(led, False)

Main loop continued

This code is at the indentation level after the “while True:” statement. After dealing with the recording logic, we need to play any notes that have been previously recorded. We’ll work out how to do that later on. After that, we can sleep until the next quantize change is due. Once this happens, we have to do logic that deals with the quantize and any related variables such as the beat or bar if necessary, either incrementing them or resetting them if necessary.

11

Lighting LEDs

12

The metronome

13

The recording code

The LED code is simple. It simply goes through each pin in the list you provide it with and lights up the appropriate LED, ensuring that all of the others are turned off.

count += 1 Step 12

if self.beat_n == 0: self.met_high.play() else: self.met_low.play() Step 09

The metronome simply plays a high tone on the first beat or a lower tone on the remaining beats if the metronome variable is set to true.

Looking back at the sample class we created at the start, you can see that if recording is enabled, and a note is pressed, then we add a dictionary to the list of samples for the current bar at the current quantize point. The dictionary contains a reference to the sample so that it can be played, and also the loop that it was added on so that it can be removed if necessary. The code for playing and undoing recordings can be seen below. Note that we directly play the sound rather than using the btn_play function so that we don’t trigger the recording logic when playing recorded sounds. The pop function in undo_previous_loop removes the last thing that was added to the stack, which will be the loop count. We then go through every possible recording data point and remove anything recorded on the loop we want to remove.

14

Finishing it off

15

Possible improvements

def run(self): self.loop_count = 0 self.last_recorded_loop = [] self.bar_n = 0 self.beat_n = 0 self.quantize_beat_n = 0 self.quantize_n = 0 while True: if self.quantize_beat_n == 0: self.do_leds(beat_leds, self.beat_n) self.do_leds(bar_leds, self.bar_n) self.do_metronome() if self.quantize_n == 0 and self.bar_n == 0: if self.record_next: self.recording = True self.record_next = False elif self.recording: self.recording = False self.last_recorded_loop.append(self.loop_count) self.loop_count += 1

Step 10

self.play_recording() time.sleep(self.quantize_seconds) if self.quantize_beat_n == self.quantize_per_beat - 1: self.quantize_beat_n = 0 self.beat_n += 1 else: self.quantize_beat_n += 1

To finish it off, we need to add a main function where we load some samples in and then start the main loop. Remember that you need to run the code with sudo python2 pisampler.py because we need sudo to access the GPIO. Happy jamming!

There are a number of improvements that could be made to the sampler. Here are a few to get you started: • A button to turn the metronome on and off • The ability to time stretch samples (such as chords) to fit with the tempo • The ability to pitch shift samples on the fly • Using a shift register to use less pins when lighting the LEDs, allowing more inputs • The ability to save recorded beats so that they can be loaded and played back

def do_metronome(self): if not self.metronome: return

if self.quantize_n == self.quantize - 1: self.quantize_n = 0 else: self.quantize_n += 1 if self.beat_n == 4: self.beat_n = 0 self.bar_n += 1 if self.bar_n == 4: self.bar_n = 0 Step 14

if __name__ == "__main__": sampler = PiSampler(tempo=140) sampler.add(Sample(05, 'kick01.wav', sampler)) sampler.add(Sample(06, 'snare01.wav', sampler)) sampler.add(Sample(13, 'clhat01.wav', sampler)) sampler.metronome = True sampler.run()

65 www.linuxuser.co.uk

Tutorial

Smart alarm clock Turn your Raspberry Pi into a better alarm clock using Python and a single button Whatyou’llneed Q Speakers or some form of audio output Q Push-button switch

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

Advancements in alarm clock technology are hardly exciting news reports you’d see on the ten o’clock news but it’s something very real in this day and age. Anyone with a smart phone has access to a world of apps tailored to helping users get a better night’s sleep, through sleep-cycle sensing and a gradually increasing alarm volume to softly wake them up. If you don’t have a smartphone or find the current selection too limited, you can always make your own smart alarm clock using a Raspberry Pi. In this tutorial we’ll show you how to program the Pi to play a bit of white noise, use a custom alarm sound and have it wake you gently.

The alarm clock will also support playlists if you prefer listening to music

66 www.linuxuser.co.uk

01

Update your Pi

To make sure the Raspberry Pi will work as expected, it’s best to get it updated first of all. Do this with:

sudo apt-get update && sudo apt-get upgrade This will also mean that when installing new software the latest version is installed as well.

Smart alarm clock Clock case

04

More Pi preparations

Once the button is wired up, turn the Raspberry Pi back on; it should boot normally if everything is wired up correctly. Once the desktop has loaded, create a new folder in home called alarm. In the version of the code we have created, this is where the necessary mp3s should be held.

05 02

Install audio playback

For this tutorial, we’ll be using VLC to playback the white noise and the alarm sound. It can be used quite easily by Python for the tasks we want it to perform. Install it in the terminal using:

Get the code ready

We’ve got the full code listing on the next page, complete with annotations so you know exactly what means what. You can either type it up and edit it in the process or download it directly from the internet using:

Breadboards are excellent for prototyping circuits but if you want to start keeping your Raspberry Pi by your bed, it might be better to get a case and get rid of the breadboard. As the wiring is incredibly simple, you could easily solder it up and connect it to the GPIO ports directly. Drilling a hole in a case will keep the whole thing tidy.

$ wget http://www.linuxuser.co.uk/wp-content/ uploads/2014/09/alarm.zip

$ sudo apt-get install vlc

06

Set your alarm

07

Audio choices

08

Keep upgrading

In the alarm code there are two variables: alarm_hour and alarm_minute. These determine when the alarm goes off and operate on a 24-hour input. The default is set for 7:30am, so change it to the time at which you wish to be woken up.

You can use whatever you wish for both the white noise and alarm sound. These need to be placed in the directory we created for the alarm clock files and either named the way they are in the code unless you plan to modify that particular part. The alarm clock will also support playlists if you prefer listening to music to fall asleep to.

03

Wire up your button

Follow along with the Fritzing diagram above – don’t worry, the wiring is very simple and simply requires a button and a breadboard. In the current example, we’ll only be using one button to shut off the alarm but we’ll cover how you could add a snooze button later on.

While it is a smart alarm clock, there are definitely things that can be done to improve it. Have a look over the code on the next page and give it a test to make sure the volume levels and increments are to your liking, and once you’re happy we’ll give you some ideas on how to further improve it.

67 www.linuxuser.co.uk

Tutorial

Full code listing Step 01

#!/usr/bin env python import time import subprocess import RPi.GPIO as GPIO

Step 02

alarm_hour = 7 alarm_minute = 30 alarm_volume = 10 Step 03

subprocess.call(‘amixer set PCM 10%’, shell=True) subprocess.Popen(‘vlc-wrapper /home/pi/alarm/whitenoise.mp3 --repeat -I dummy’, shell=True)

GPIO.setmode(GPIO.BOARD)

02

The basic alarm settings are kept here. The time is in 24 hours for the hour variable, and the volume is a percentage value. Change these to suit your needs.

03

The white noise file begins to play. It uses the vlcwrapper and is called within a shell. The repeat option is important to make sure it plays all night long.

This sets up the GPIO port to accept an input from the button, which will be used to kill the alarm clock. No snooze yet!

while(True):

06

current_minute = current_time[4] if current_hour == alarm_hour and current_minute == alarm_minute: subprocess.call(‘killall vlc’, shell=True) subprocess.Popen(‘vlc-wrapper /home/pi/alarm/alarm.mp3 --repeat -I dummy’, shell=True) time.sleep(2.5) while True: if GPIO.input(3)==0: subprocess.call(‘killall vlc’, shell=True) Step 08

Only basic modules are needed for the code – the time for the alarm, GPIO for the button, and system for the process of calling VLC and changing volume.

05

current_hour = current_time[3]

Step 07

01

GPIO.setup(3 , GPIO.IN)

current_time = list(time.localtime())

Step 06

Our smart alarm code for your Raspberry Pi, using Python, VLC and a button.

04

Step 04

Step 05

PiAlarmcode

The while loop is created so that the code can keep track of the time, using localtime as part of the process.

Using the if statement, the code makes sure the current time is the same as the alarm time before activating. The sub-processes use the command line to first kill VLC, which stops the white noise, before restarting it to play the alarm again in repeat.

07

If the button is pressed, VLC is killed. This simply stops the alarm and you can wake up.

08

If the button isn’t pressed, the value for alarm volume is increased by five and this value is then passed on to the amixer command line function to increase the volume by 5 per cent. It then waits 2.5 seconds before the volume is increased again.

09

The sleep value dictates how long the button needs to be pressed, and the GPIO cleanup function makes sure the GPIO ports are properly deactivated when everything is finished.

else: alarm_volume += 5 new_volume = ‘amixer set PCM ‘ + str(alarm_volume) + ‘%’ subprocess.call(new_volume, shell=True) time.sleep(2.5) time.sleep(0.2);

Step 09

GPIO.cleanup()

68 www.linuxuser.co.uk

The code makes sure the current time is the same as the alarm time before activating

Smart alarm clock Make it smarter

These upgrades can improve the alarm clock to make it more useful and allow you to get rid of your phone as an alarm clock

Snooze button

Screen

Motion sensing

The snooze button is a time-honoured tradition of getting just five more minutes in bed. While a lot of movement-based alarms aim to get around this, it’s still a feature a lot of us like to use, and we’d be lying if we said it wasn’t a vital part of a functional alarm clock as far as we’re concerned. As this alarm doesn’t have the ability to sense movement (yet) adding a snooze button is perfectly fine. Adding another push button is fairly simple, wiring it up as in the Fritzing diagram. The input needs to be set up like the alarm off button and an elif statement can be added to the final while loop to deactivate the alarm and add a few extra minutes to the alarm time. If you want the white noise to reactivate you’ll have to create another subprocess.popen to play the file again for the duration of the snooze.

There’s one flaw in the current alarm clock: there’s currently no visible clock when the system is running. It would likely not help your sleep if a monitor is hooked up to the Raspberry Pi all night just to squint at the time in the corner. The PiTFT is an accessory we’ve talked about before in the magazine: it’s roughly the size of the Raspberry Pi and there are cases that allow it to fit snugly on top as one compact Raspberry Pi system. Using Tkinter or Pygame you can create a simple interface that displays the time, or even go further and have it flash when the alarm is going off and display data such as the weather or appointments. The screen also supports touch functionality, so you could make it even more like its smartphone counterparts with snooze/stop buttons on screen.

The motion sensing functionality on a lot of smartphones is relatively easily implemented as Android phones usually have gyros and magnetometers to register movement. These are very sensitive and with the right code and analysis they can be used to figure out what sleep cycle you’re in, choosing the right time to wake you up. The Raspberry Pi is a slightly different beast. The XLoBorg from PiBorg is a motion-sensing device that can be wired up to the Pi for a number of functions. In this case it could be hooked up to record movement during sleep, lying beside you on a bed. With the right level of testing and coding you can use it to create a sleep profile, though it requires a bit of trial and error and some research into sleep cycles to understand exactly what’s going on.

Snooze time How much time you spend snoozing is up to you. Five minutes and ten minutes are normal on a lot of clocks, but if you're feeling adventurous you could set one for 45 minutes. This gives you enough time to get some REM sleep if you're still tired before the next alarm goes off; of course, you'll need to change your alarm times to compensate.

Above Once you’ve added all the features you want, try putting everything into a more bedside-friendly case

co.uk

Tutorial

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

Program Arduino on the Raspberry Pi You can interface a Raspberry Pi with Arduino components – now learn how to program them from the Pi and control the Makeblock

Whatyou’llneed Q Makeblock robot starter kit www.makeblock.cc/starter-robotkit-v2-0-blue-with-electronics/

70 www.linuxuser.co.uk

Learning to code is one of the best things about owning a Raspberry Pi for a lot of people. Python and C are easy enough to start with on the Pi and you can get great results in a short time. When it comes to physical computing and making, though, not much beats using the Arduino IDE to control the open source controllers, servos and sensors associated with the system. Once set up, we can also use the Pi to program the Makeblock robot we reviewed in issue 142 of Linux User & Developer, using either the built-in commands or your own code.

01

Update your Pi

Always make sure your Raspberry Pi is up to date. This tutorial is based around Raspbian so set up an SD card if you don’t have one, and then do an update with sudo apt-get update && sudo apt-get upgrade. Make sure the firmware is up to date as well with a sudo rpi-update.

Program Arduino on Pi

02

Install Arduino IDE

Next you’ll need to install Arduino to the Raspberry Pi – luckily it’s in the repos for Raspbian so all you’ll need to is open a terminal and type:

$ sudo apt-get install arduino

03

Install Arduino libraries

To get everything working on your Pi you’ll also need to get the relevant libraries as well. These will allow you to connect to various Arduino boards, especially the Makeblock kit. Do this with:

06

Install Makeblock examples

07

Prepare your robot

08

Program your robot

09

More programming

Turn off the Arduino IDE, if you haven’t already, and find the ‘sketchbook’ folder in the home directory. Create a new folder inside called libraries and copy and paste the ‘makeblock’ folder from the unzipped files into this new directory to effectively install it to Arduino.

$ sudo apt-get install avr-libc libftdi1 avrdude openjdk-6-jre librxtx-java

04

Using Arduino

Now everything is ready you can open up the Ardunio IDE. It can be found in the new Electronics section of the programs menu. It will create a new sketchbook folder in the home menu where all your projects will live.

Once you’ve built your Makeblock robot, unplug the battery and plug the control board into the Raspberry Pi via a micro USB cable. Restart the Arduino IDE and go to Tools, Board and select Arduino Leonardo. Also check to make sure the right Serial Port is selected.

Now you can load an example code to make sure everything is working. Click on File, Examples and find the ‘makeblock’ menu. Go to the Starter Kit option and select IR Control example. Upload it to the Makeblock, unplug it from the Pi and give it a go with the remote control.

05

Makeblock starter kit libraries

To program the Makeblock, it’s best to grab the example code so you can get an idea of how it works. The zip for these can be downloaded from https://github.com/ Makeblock-official/Makeblock-Library/archive/master.zip. Unzip it to a separate folder before continuing.

Now you can modify the example codes to change the functionality of the Makeblock. This will allow you to understand how the robot, and other Ardunio devices, are programmed so that you can start writing your own custom code for it.

71 www.linuxuser.co.uk

FAQ What is Python?

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

If you like this… The Raspberry Pi foundation has a wonderful introduction guide to Python that can get you started learning the basics of the language: bit.ly/1lJJiDe

Further reading

We have Raspberry Pi-related Python tutorials aplenty on the Linux User & Developer website (linuxuser.co.uk), as well as a digital magazine dedicated to Raspberry Pi projects called RasPi

What is Python? The popular programming language used on the Raspberry Pi. What makes it so special? There’s a lot of focus on Python for programming on the Raspberry Pi. Is this because it’s the only way to program the Raspberry Pi? No, not at all. As we’re generally using Linux on the Raspberry Pi, just about every major programming language can be used. C, C++, Ruby, Perl and more are all completely compatible with the Raspberry Pi. You’re not really programming the Raspberry Pi with them either – you’re creating programs that will run on the Raspberry Pi. That’s good to know, then. If that’s the case, why concentrate on Python as much as you guys and the Raspberry Pi folk do? It really all comes back to the core mission of the Raspberry Pi Foundation: to help educate school children in computer

72

user.co.uk

science. This involves coding, and Python is considered an easy language to learn. It’s a language a lot of people know anyway. Plus, we have a bit more expertise in Python on the magazine, and we’re also very happy to promote the Raspberry Pi Foundation’s objectives. What makes it so easy to use over the other languages? Python is ‘readable’. Core variables and functions are named plainly, the structure is designed to handle a lot of white space and everything is written a lot more straightforwardly than other programming languages. What it all means is you can quickly scan some Python code and make more sense of it than other languages, which can sometimes look like a cat took a walk across a keyboard.

So readable means anyone can just look at it and understand what’s going on? That’s not quite what it means; you would still need a basic understanding of coding and Python to recognise what specific parts mean. These can include the difference between a tuple or a list or a class and a function. These can easily be learned, though, and are generally easier to pick up than with the other languages. It’s easy enough to teach to children? Absolutely. It’s very similar to maths in that you’re teaching rules and methods that you can immediately produce an answer or output from. With the correct lessons, different concepts can be introduced and built upon just like anything taught in school. In

FAQ It’s similar to maths in that you’re teaching rules and methods that you can immediately produce an answer or output from fact, the incoming changes to the UK curriculum will cover coding in this exact way. If Python’s such a simple language, does this mean it’s not very useful in the real world of programming? That’s not the case at all – Python is used by companies around the world in ‘real programming’. It’s not the only language, though, and some companies won’t even use Python – at the very least, it sets people up to learn the intricacies of programming languages and makes learning others a little bit easier. Can Python interact with other programming languages? It largely depends on the language but the quick answer is not really. There are very few, if any, projects where you’ll need to use different languages, unless they handle completely different aspects of the software. A database could be created and maintained using SQL but that’s something Python can’t handle itself anyway. How do I create a Python program? Like a lot of programming, you need to create a script: a file that contains all your code and tells a Python interpreter what to do when the code is run properly. You can create them in a plain text editor like gedit or even nano on the terminal and save them as .py files before testing them. The best way is to create it in an IDE though. What is an IDE? How do I get one on the Raspberry Pi? An integrated development environment is software that lets you create and test scripts in specific languages. You usually have a few more ways to debug your files with them as well. In the case of Python on the Raspberry Pi, you can use IDLE which is already installed and available from the desktop.

Ourfavourite Pythonprojects Look out for these projects in previous issues to get to grips with Python

Wait… IDLE? Python? Is that an intentional reference? Yep, IDLE is named after Monty Python alumni Eric Idle because everyone in tech is a nerd. I see on the Raspberry Pi that there are multiple IDLEs. One is just called IDLE and the other is called IDLE 3. What does this mean? The standard IDLE uses Python 2, while IDLE 3 uses Python 3. They’re both two slightly different versions of Python, with 3 having a few more and different functions. Due to the popularity of Python 2, though, it’s still prevalent in tutorials and projects and included on the Raspberry Pi.

Program Minecraft Pi Issue 140

Customise Minecraft on the Raspberry Pi using Python and some special libraries made specifically for the Raspberry Pi version of the game. It’s a great way to get kids involved and to learn a bit about coding for videogames

Which one should I be using? It’s best to stick to Python 2 and therefore the normal version of IDLE. Going from 2 to 3 is not a huge deal so when the big switchover finally occurs you’ll be in a good position to learn the changes as you go. Will the code I create on the Raspberry Pi work elsewhere? The code is not platform-specific, so as long as you have the same modules and files on the PC you want to transfer it to it will work just fine. Some modules may be slightly different between different types of PC, depending on what’s compatible on the Pi and PC, but 99 per cent of the time you shouldn’t have a problem.

Audiobook/portable internet radio Issue 143 The beauty of this project is that you can create a physical device that does two jobs, with only one line of code needing to be modified to switch it between the two, or the addition of a few more lines to make it work as both at once

Python Masterclass Issue 126

Above Popular for a reason, Python is very readable and easy to learn

All the way back in issue 126 we did a breakdown for beginners on how to get into Python, starting with the very basics and a bit beyond. It’s also included in the Python digital edition inside our iTunes app

73 www.linuxuser.co.uk

Digital magazine for Raspberry Pi makers Free sample issue

PROJECTS

INTERVIEWS

TUTORIALS

EXPERT ADVICE

Download the free app on iTunes for iPhone and iPad now www.linuxuser.co.uk/RasPiCode

facebook.com/LinuxUserUK

#raspimag

75 Group Test | 80 Nvidia Jetson TK1 | 82 Android-x86 | 84 Synology DS115j

Trelby

LibOScreenplay

Celtx

Fade In

GROUP TEST

Screenwriting software We put pro suites and no-frills tools to the test in search of the perfect place to write a script

LibOScreenplay

Celtx

Fade In

A multi-platform software with a minimalist aesthetic, Trelby is clean enough to help you focus on the task at hand but still packs a surprising amount of tools and options into its interface, with autoediting and formatting features alongside a character name database, reports, charts and more.

Not a program like the others, LibOScreenplay is actually a template for LibreOffice Writer, created for film-makers. LibOScreenplay and other auto-styling templates can be a good option for those wishing to keep things simple rather using dedicated programs, or just keep a low profile system altogether.

Both an online studio and a free desktop application, Celtx is a fullyfeatured screenwriting tool backed up by a subscription service that gives you lots of production tools. Among these are cloud storage, office and management facilities, scriptwriting and storyboarding tools, budgets and shot lists.

Pitched as the pro tool, Fade In does have a premium feel to it that’s supported by an extensive range of customisations and detailed options, plus cloud storage and good support for other formats. Another advantage is the Fade In Mobile suite of apps that lets you import and edit your scripts on the go.

Documentation: bit.ly/1rOejbL

Download: bit.ly/1u3ofMZ

Download: bit.ly/SFTqQ1

Download: bit.ly/1ndA5TD

Trelby

75 www.linuxuser.co.uk

Review

relby

LibOScreenplay

Adedicatedscreenwritingtool withamoreminimalistdesign

Grab a template for the best Office suite and reduce your extra software

Q A complete database of common names, just in case you need a helping hand

Q The templates include a small selection of essential styles that follow the standards for scripts

Features

Features

Compared to the other screenwriting tools in this test, Trelby is quite feature-light. The behaviour of the app – in terms of how it handles changes between dialogue, scenes, and more – cannot be changed. There are also no templates for different types of screenplay or a notes feature.

As a basic template, LibOScreenplay merely contains the basic formatting styles of the essential fields you’d need. These can be accessed individually from the Style menu and it will try and automatically change between them as you write. Otherwise, you’re using the word processing features of Libre Office Writer, which aren’t always designed for the task.

Formatting

Formatting

Despite having no way to change its own formatting behaviour, Trelby is extremely smart in its way of handling structure. It makes reasonable guesses between Action, Character and Dialogue; for example, going back to Action from Dialogue after a line break but allowing you to tab back into Action.

The template guesses fairly well in regards to changing cases or styles, however there’s no option to substitute tab or extra line breaks to automatically change the style again. You’ll find yourself manually changing the styles on a regular basis to keep the text correct.

Management

Management

Trelby will remember characters and scenes and such, bringing you a drop down when necessary. However there are no built-in columns of structural view to browse between them all on the fly throughout the interface. You can find hidden databases within the saved files for them, but it’s not as quick or useful as having them right there.

Word processors, and especially Writer, do have some pretty powerful indexing and finding tools. However, there are no drop-down lists or databases for the different scenes, characters or locations. You’ll have to set up an index and keep updating it as you go on to get anything close to these features.

Installation

Installation

The source is freely available for the software but it’s not currently in any or many repositories for major distros. However, if you don’t think you can quite handle compiling from source, there are binaries for Debian and Ubuntu-based distros for the large portion of users that use them.

LibreOffice is easier to install than any of the applications on this list – usually included by default on a large number of distros – and the template is simply an OTT file that opens in Writer. You’ll have to manually install some fonts that come with the template but in a lot of distros that’s easy.

Overall

Overall

Trelby is solid and definitely better than any basic word processor, however it could do with some extra features especially in management and navigation. Installing it from source is not for everyone either.

76 www.linuxuser.co.uk

6

The only thing this and other templates have going for it is that it’s a lot better than trying to write out and manually format a script yourself. It doesn’t save enough time to consider it over the others though.

3

Screenwriting software

Where’s the best place to write a script?

REVIEW

Celtx

Fade In

The multi-platform and very popular online and offline scriptwriter

Another multi-platform app. How does it compare to Celtx on Linux?

Q Celtx has many options for writing several different types of scripts, whether it’s films, plays or books

Q There are limited extra options to create better templates for different script types

Features

Features

The most feature-full of this test, Celtx not only has a vast selection of script types, but it’s quite customisable as well. Add this to an online service you can pay for (a free 15-day trial is available) that will sync your files and allow you to edit them on the go and you have a truly modern piece of software.

For pure film and TV scripts, Fade In has all the major features of the other applications in this test and is fairly customisable as well. We say scripts, as unlike Celtx there are no options for novels et al; it also does not have the excellent online service attached to it.

Formatting

A good method of changing styles and cases as you type, with some light modification available in case your workflow becomes more action or dialogue heavy. The different styles are also quickly accessible from the side column if you find the need to change it drastically at a moment’s notice.

Celtx does well to guess what you’re trying to write at any given moment, however it’s not quite as good at the workflow as Trelby is; to make up for this, the interface clearly labels how pressing return or tab will change the style of the text.

Formatting

Management

Management

The important aspects for the main script are kept up front as part of an info bar along the side, such as scenes and notes. It’s a bit trickier to find a character database but it’s there, along with easily accessible reports so you can keep an eye on the action-to-dialogue ratio.

A very solid database structure that is accessible via the main interface for quick references to characters and locations, as well as a decent method of searching through scenes via a navigation panel. However you cannot use a search function in these fields to make looking through them easier.

Installation

Installation

Celtx is limited to Debian and Ubuntu, although the online version is available anywhere. You need to sign up for a free account before you actually install the desktop version though, and the online equivalent is a subscription-based service. At the very least there’s no installation for the desktop version – it will run directly from the files.

Not available in any repos right now, and you’re limited to using RPM and DEB binary files, or a manual install that’s not done from source. RPMs and DEBs will obviously cover a wide variety of distros, but it still makes it a limiting factor, especially if you ever need to update it.

Overall

Overall

There are some minor issues with the operation of Celtx and some less minor annoyances getting it installed that prevent a top score, but it’s overall a fantastic piece of software that makes writing scripts as easy as possible.

8

We really like Fade In. It’s an excellent piece of software and the management is good for simple scripts. However, for larger projects it doesn’t quite have the same appeal as something like Celtx.

7

77 www.linuxuser.co.uk

Review

Screenwriting software

In brief: Compare and contrast our verdicts Trelby

Features

App behaviour can’t be changed and there are no templates for different projects

Formatting

Despite the lack of customisation, autoformatting is smart and recognises what you’re doing

Management

No easy way to see and browse through saved information in a macro-level interface

Installation

Not in many of the major distros’ repos, so need binaries or to compile

Overall

Not the easiest to install and missing key management/ navigation features

LibOScreenplay

6

Only holds basic formats in the Styles menu, though it tries to set them automatically

8

Auto-formatting is pretty good but the preset Styles can only be customised caseby-case

3

Powerful indexing and searching tools but no dedicated lists or databases

5

LibreOffice is widely available in repos and the template is an OTT for Writer

6

While it’s better than a regular Writer document, it’s not really a time-saver

Celtx

2

Plenty of customisable templates and a paidfor syncing service built-in

4

Though Celtx isn’t quite as smart as Trelby, it’s still much easier to pick up due to good labelling

3

Visible info bar, slightly less visible character database and useful reports

9

Limited to Debian and Ubuntu unless you subscribe to the online service

3

Fantastic software let down a little by installation and operation

Fade In

10

Good range of fairly customisable, though limited to TV and film only

8

8

Easily accessible styles drawer and plenty of good options to switch and modify them

8

8

Solid database and navigation feature for it, though no direct search function

7

5

Not available in any repos, so RPM or DEB binaries are needed here

7

8

Excellent for simple scripts but not quite enough for larger projects

7

AND THE WINNER IS… Celtx There’s a lot to be said for the simpler interfaces provided by the Trelby program and the LibOScreenplay template, but in the end it was the excellent Celtx software and its suite of cloud-based tools that won us over. One of the key advantages here was its range of built-in script templates, with Celtx catering for novels, comic books and audio plays as well as scripts for film and theatre – Trelby was great for its workflow and auto-formatting features but didn’t allow you to change between different script types, while Fade In was a really compelling choice but was unfortunatelylimitedtojustfilmandTVscripts. That aside, Celtx still had the edge on Fade In when it came to the scriptwriting itself, with its clear interface offering up all the tools you could want but without crowding your clean writing space (Trelby scored good points for this too). We really wanted to like Fade In, but when it came down to actually writing our scripts we found that the workflow was just better when using Celtx.

78 www.linuxuser.co.uk

www.linuxuser.co.uk

GROUPTEST

WINNER

Q Fully-featured with a range of templates and supporting services, Celtx impressed us

Get to know the simple rules for switching sections using the Tab and Enter keys, and you’ll find that Celtx is designed to help you get your thoughts down in no time at all. Hit Enter from a Scene Heading section and you switch to Action, hit Enter again to start another Scene Heading. Hit Tab from an Action section to switch to Characters, and hit Enter from

there to start Dialogue. When you add in the cloud infrastructure to support multiple writers collaborating on a project, complete with file storage and management, plus production tools to simplify the related aspects of creative writing for entertainment such as storyboarding and photography,you’llfind it’s the complete package. Rob Zwetsloot

Subscribe

Subscribe today & start saving Non-USA readers see page 32

USA special offer

Subscribe today and get * 5free issues Exclusive subscriber benefits • Subscribe today and pay just $130 for 13 issues* • Pay as little as $10 an issue – usually $16.99 in stores

Your exclusive offer code:

USA

more information and to order visit

www.imaginesubs.co.uk/lud Or call +44 (0) 1795 418661

Imagine Publishing publishes more than 20 monthly magazines, some of which have been running for over 10 years, reaching over 4 million readers every year

*Terms and conditions: This is a US subscription offer, please don’t forget to quote USA when ordering. You will actually be charged £80 sterling for an annual subscription. This is equivalent to $130 at the time of writing, although the exchange rate may vary. Five free issues refers to the newsstand price of $16.99 for 13 issues being $220.87, compared with $130 for a subscription. Your subscription will start from the next available issue. This offer expires 31st January 2015.

79 www.linuxuser.co.uk

Review

MINI PC

Zotac Nvidia Jetson TK1

With five Cortex-A15 processor cores, a customised Ubuntu OS and 192 CUDA GPU cores, is the Jetson TK1 the SBC of the future? Pros

The pre-installed Ubuntu-based operating system is friendly, and the Tegra K1 processor puts rival boards to shame

Cons

It’snotcheap,the GPIOisn’thobbyistfriendly,andNvidia hasoptednotto includeOpenCL supportdespiteits presenceonthechip

The Jetson TK1, Nvidia’s first development board to be marketed at the general public, has taken a circuitous route to our shores. Unveiled at the company’s Graphics Technology Conference earlier this year, the board launched in the US at a headline-grabbing price of $192 but its international release was hampered by export regulations. Zotac, already an Nvidia partner for its graphics hardware, volunteered to sort things out and has partnered with Maplin to bring the board to the UK. Indoingso,however,thepricehasbecomealittlemuddled, $192, a clever dollar per GPU core, has become £199.99. Compared to Maplin’s other single-board computer, the sub£30 Raspberry Pi, it’s a high-end item that could find itself priced out of the reach of the company’s usual customers. A glance at the specifications reveals why the Jetson is so highly priced: its heart is the latest-generation Tegra K1 processor, a 32-bit ARM Cortex-A15 implementation

80 www.linuxuser.co.uk

which packs four 2.3GHz CPU cores and a fifth lowpower ‘Shadow Core’ that takes over during background processing to reduce average power draw. Its biggest feature, however, is the chip’s 192 Kepler GPU cores, based on the same technology as Nvidia’s desktop and laptop graphics chips and boasting full support for the Compute Unified Device Architecture (CUDA) general-purpose GPU offload language. Using CUDA, developers are able to take tasks that are highly parallel in nature and run them on the GPU cores rather than the CPU. It’s a technique that is well-used in supercomputing, but that can accelerate everything from cryptography to computer vision. It’s also the only GPGPU language supported by the Jetson: despite the Tegra K1 itself boasting fully certified OpenCL support, this is not implemented in the Jetson, leaving Nvidia’s proprietary CUDA as the only option available to developers.

Zotac Nvidia Jetson TK1 Is the Jetson TK1 the SBC of the future?

REVIEW

Technical specs Price £199.99 / $192 Operating System Linux 4 Tegra (Ubuntu 14.04) Processor Nvidia Tegra K1, quad-core 2.3GHz ARM Cortex-A15 plus ‘Shadow Core’ Graphics 192 Kepler CUDA cores, 852MHz Memory 2GB DDR3L 933MHz RAM, 4MB ROM Dimensions 133mm x 133mm x 30mm Weight 120g (excluding PSU) Storage 16GB NAND Flash (expandable via SD Card) Connectivity Realtek RTL8111GS 10/100/1000 Ethernet Ports 1x RS232, 1x HDMI, 1x USB 3.0, 1x micro-USB 2.0, 1x Ethernet, 1x analogue audio out, 1x analogue audio in, 1x SATA with four-pin power, 1x JTAG, 125x GPIO, 1x single-lane mini-PCI Express slot

Also consider

Top The Tegra K1 processor powering the Jetson requires active cooling, unlike most rival boards Left In addition to its on-board NAND flash, the Jetson features SATA and SD card expansion Middle A mini-PCI Express slot provides expansion capabilities, if you can source ARM drivers for your hardware Right Headers allows the Jetson to be integrated into a PC-style case with power and reset buttons

Another odd restriction comes in the choice of operating systems available. The Jetson comes with Linux 4 Tegra, a modified version of Canonical’s Ubuntu 14.04, loaded into NAND flash. This is the only operating system supported, with Google’s Android – the most common software used on the Tegra K1 processor – nowhere to be seen. If being restricted running CUDA on Ubuntu is no barrier, developers will find the Jetson a powerful device. During testing, the board completed the SysBench single-threaded benchmark with a 95th percentile time of 7.31ms - far faster than any other single-board computer we’ve ever tested, including the Intel Atom-powered Minnowboard and AMD APU-based Gizmo, and a far cry from the 51.45ms of the Raspberry Pi. For tasks that can be ported to CUDA, there’s a total of 300 gigaflops of single-precision floating-point performance on offer from the GPU – and all accessible in an average power draw of 7W and peak of 14W, with the board sitting at around 3W idle during testing. As well as CUDA offload, the GPU can also be used as a standard graphics processor. Running the Nexuiz firstperson shooter at a 1280x720 resolution with all graphical settings turned to max saw the Jetson barely break a sweat, with an impressive 6W peak power draw.

It’s unlikely anyone will be gaming on the Jetson, though. For hobbyists, its 125 general-purpose input-output (GPIO) pins will be the real draw, but there’s a catch: only seven pins are available for true GPIO use as standard, with a few more available when the second camera channel is not in use. The remainder are reserved for uses like flat-panel displays, touch sensors and cameras. Coupled with uncommon 2mm pin spacing, and the use of 1.8V logic rather than the more popular 3.3V or 5V, it makes using the Jetson’s GPIO in hobbyist projects awkward at best. Gareth Halfacree

Summary There’s no denying that the Jetson TK1 is one of the most powerful single-board computers on the market, and having a familiar Ubuntu-based operating system preloaded in NAND is welcome. Its high price and hobbyist-unfriendly GPIO, coupled with a perplexing lack of OpenCL support, sadly, keep it from being a device for everyone.

Adapteva Parallella Desktop Computer £117.67 While only a dual-core board, the Parallella hides Adapteva’s 16-core Epiphany co-processor. Programmable directly or via an uncertified OpenCL-like compatibility layer, the Parallella is good for those interested in manycore embedded projects. A higher-end version, the Embedded System, adds a more powerful FPGA. uk.rs-online.com

Arndale Octa Board $199 Based around the Samsung Exynos 5420 system-onchip processor, the Arndale Octa packs four Cortex-A15 CPU cores alongside four lower-power Cortex-A7 cores. Its graphics hardware also supports OpenCL, but the system performance will lag behind Nvidia’s Tegra K1 processor. Built-in Wi-Fi and Bluetooth is an added bonus. pyrustek.com

More information www.nvidia.com

81 www.linuxuser.co.uk

Review

The basic Android interface is used for Android-x86, including hooking into Google Now

Unless you have specific hardware, you won’t need to worry about not having a mobile or Wi-Fi signal

The soft buttons still exist and work as normal, albeit with a mouse instead of touch

DISTRO

Best for: Development machines

Android-x86 4.4

Minimum Specs: CPU x86 RAM 512MB STORAGE 4GB

Android KitKat is now on your PC. Is it worth installing or should you just stick to your phone for Android? Pros

Great for developing on Android or if you don’t have an Android device in the first place

Cons

Still a bit buggy – the mouse pointer won’t always show up and the screen size is limited without hacks

We’ve been keeping an eye on the development of Android-x86 for a little while now, with the release of 4.4 seemingly imminent for some months now. In the past we’ve managed to use dodgy hacks of Android on proper computers or an emulated version via the ADK, but this promises to be one of the first complete ports of the mobile operating system to x86. Android-x86 is straight-up Android. There are no extra Linux repositories or a custom desktop to accommodate a mouse and keyboard on a standard computer or laptop. What you get is the standard Android 4.4 interface that can be used by touchscreens along with a mouse and keyboard. Android actually has some level of mouse support already included in its code anyway, so the main changes revolve around the actual porting of the kernel and components, along with support for the kind of hardware you only get on PC, such as wired networks.

82 www.linuxuser.co.uk

The live disc is handled quite differently from a usual Linux distro. Starting it live will get you into an instance of Android that you can easily play around with: it acts exactly like any Android device would if you’d turned it on for the first time, asking for settings and login details. All of this will not be saved so it serves well as a test of the system more than anything else.

Install Android The installation is handled by a custom installer with limited options – it only really helps you get the hard drive set up, as a lot of the user info is done on Android itself. It doesn’t give many recommendations and lets the user decide for themself on what kind of file system should be used – it’s not a big deal as all the available file systems will work, but something like ext3 works a bit better for Android than FAT32. Either way, not everyone will

Android-x86 4.4

Is KitKat worth installing?

REVIEW

New features: Android 4.4 KitKat • Hardware acceleration for AMD and Intel chips • Multi-touch support • SD card simulation

Q There are a few extra apps installed such as Lime HD to help further tweak the distro

Q The installation is very basic but good enough to get your

system properly sorted out

What you get is the standard Android 4.4 interface know what to pick and there’s very little reason to use any of the other file systems. Otherwise it’s quite quick and gives you the option to go straight into the Android installation without restarting – quite a novel concept. GRUB can be edited to allow easy dualbooting as well, so there’s no need to forgo Linux or any other operating system just to install Android-x86. The account and settings process on first boot is the same as any Android device, although in some cases you’ll have to ignore wireless settings and just hope a wired internet connection is working, as there’s no indication on the UI for this.

User experience With something so heavily Android-based, you’re going to run into some issues quite early on. In a virtual machine you may have trouble getting a mouse cursor to show up, and across all installations you’ll need to wrestle with the Android display options. There are some third-party apps installed to the OS that allow you to get around some of these issues with an extra download or two, though, so it’s something the devs have definitely thought about. Otherwise it basically runs like any Android device. You can install apps from the Play Store for the moment, although whether or not this will be removed from images in the future (like on CyanogenMod) is another matter. You may get issues with scaling for some apps depending on your resolution, but Android has a pretty decent method for compensating for

that anyway with pixel-doubling and such. Games with fixed resolutions may not be so lucky though. If you’re used to modern Android you’ll be able to quickly get around the workflow, especially as the basic operation of the interface has not changed. You’ll need to drag down the notification bar with a mouse and do the same with swiping away items or between photos on an app.

Measure of stability Foraport,itissurprisinglystable.Wehaven’treallyencountered any huge problems and have been able to use it for extended periods without much issue. It has crashed on us, though, and usually for no discernible reason, so we definitely wouldn’t recommend it for a primary distro. As it’s designed for low-powered smartphones it can run quite light. It only requires a couple of gigabytes to install properly and a recommended minimum of 512 MB of RAM. It willrunbetterwithmorebutisstillhighlyfunctionalatthatlevel. It’s definitely an interesting use for Android, especially if you’re a fan of the way some of the apps work, or if you like the second-screen apps but don’t want a tablet to make the most out of them. For development, it doesn’t beat a native device, but it’s a good way to test for more extreme hardware types. Rob Zwetsloot

Summary Android-x86 delivers what it promises but it’s not quite free from the kind of bugs you’d expect from such a port. The extra features for a desktop work well and it has a number of improvements over the many development versions

Download now www.android-x86.org

83 www.linuxuser.co.uk

Review

While it’s sturdy enough for you to not have to worry about, the tough but lightweight plastic white case does just slide on and off

They’re pretty simple, but these LED indicators will show you the status of your DS115j, LAN connection and hard drive

As with other Synology DiskStations, the trademark logo-shaped air vents help give the device a little extra cooling

NAS BOX

Synology DS115j Is this new single-bay DiskStation the best NAS option for home users on a budget? Pros

Cheap, easy to set up and makes a great backup or media streaming solution for the home

Cons

800MHzprocessor and256MBRAM limitthisdeviceto basicsetupsfor personaluse

With its expansive product range, Synology is a mainstay of the file storage and private cloud market, and almost certainly a name familiar to even those picking up their first NAS box. The DS115j is pitched as the replacement for the DS112j, which was the budget-friendly single-bay option for the home user not needing a RAID setup or masses of storage space, and in those terms it’s a very compelling product. Costingjust£78–about30percentcheaperthantheDS112j – the changes here are few but noticeable. The 1.0GHz Marvell Kirkwood has been swapped out for a Marvell Armada 370 800MHz, which is a much more efficient CPU, and the system memory has more than doubled with a shift from 128MB DDR2 to 256MB DDR3, bringing an all-around improvement to the speed and operation of the DiskStation. The fan itself hasn’t changed – it’s still a single 60mm unit – though the noise it

84 www.linuxuser.co.uk

makes has risen from 17.1dBA to 18.1dBA, for some reason. Old fans of Synology devices will be pleased to hear that this had no practical impact on the audibility of the fan at all, with it still running as quiet as a whisper. Otherwise, this is very much the same device as its predecessor, with the tried-and-tested Synology form factor remaining exactly the same in terms of weight, dimensions and buildquality,aswellasthesliding-lock design of the white plastic casing. Getting a 2.5- or 3.5-inch hard drive loaded into the NAS box is as simple as sliding that case off and then sliding the hard drive(orenclosureforthe2.5-inchdrive) into place along the sleds on the inside –it’s a brilliant way to repurpose any old drives you have at home. For those not familiar with the DS112j, it’s also worth pointing out that there’s the same flat-type Kensington slot on the back panel of the device, just left of the USB ports,

Synology DS115j Is this the best entry-level NAS box?

REVIEW

Technical specs Price £78 Operating System DiskStation Manager 5.0 (Proprietary Linuxbased) Processor Marvell Armada 370 800MHz Memory 256MB DDR3 Dimensions 224 x 166 x 71 mm Weight 710 g Drive Bays 1x 3.5” or 2.5” SATA (II), 5TB maximum capacity Networking 1x Wired Gigabit Ethernet Expansion 2x USB 2.0 Cooling 1x 60mm fan, 18.1dBA

This model comes with a flat Kensington security slot, so you can secure your Synology to your workstation with both single- and multiple-piece Kensington locks

Also consider

LaCie CloudBox $149.99

Just a single Ethernet port, but this isn’t a problem given the price point and target market here. Synology claim speeds just shy of 103 MB/s read and 61 MB/s write which means that you can securely tether this device to your desk using either a single- or multiple-piece Kensington lock. The main draw for the entry-level home buyer though is, of course, the brilliant DiskStation Manager OS, and the DS115j ships with version 5.0 on board (which is feeling much brighter and more colourful these days). This browser-based operating system can be easily accessed via a URL when it comes to the first switch-on, and the familiar desktop GUI means that users new to DiskStation Manager will be able to intuitively work out what to do next. File Station, Control Panel, Package Center and DSM Help greet you to the left of the interface, there’s a main menu bar up top that also allows for multitasking within this single tab of your internet browser, while a system health panel and resource monitor pop up along the right-hand side. Drill deeper into the main app menu or Control Panel and you may find yourself a little intimidated by the sheer amount of stuff going on – especially as a home user new to NAS devices – but again, it’s easy enough to spot the relevant options; Network, Wireless, Shared Folder and the like. DSM 5.0 comes with an EZ-Internet app too, to help with connections over the internet, and even a Support Center through which you can get remote assistance if you really are having a nightmare setting up. As you become more familiar with the apps on offer, you’ll find yourself growing steadily more and more impressed by the provision of options for everything

you could want – DNS and VPN servers, cloud syncing and CMS, tools for various types of backups, media servers for you to stream your content (companion mobile apps are available). If anything, there’s almost too much choice here for an entrylevel device, and perhaps this should be reduced a little – especially since there’s no real out of-the-box orientation (though a PDF manual is available to download). But in any case, when you take into account things like QuickConnect, which simplifies the process of connecting to the unit from other devices, and the fact that DSM can help you through the setup even if you’re not really sure what ports are to begin with, you really do have a brilliant NAS box for the beginner. Gavin Thomas

Summary Incredibly easy to get a basic setup working, even with zero knowledge of what’s going on under the hood. For seasoned users, advanced options are available for almost every type of file transfer or access you’d want to handle. Given how cheap it is, we’d recommend this to anyone looking for a budget device for their home.

Similarly pitched as an entry-level device for the home user, LaCie’s CloudBox comes in 2, 3 and 4 TB models with Gigabit Ethernet, offering a range of flexible backup tools and compatibility with consoles and network-connected TVs, as well as modern Windows and Mac computers.

QNAPTS-112P £108 Featuring a customisable DSM-like desktop, QNAP’s device packs in a comprehensive range of features covering photo, video, music, file, TV, DJ and surveillance stations, plus FTP, VPN, MySQL, Syslog and Radius servers all supported by 512MB of DDR3 RAM. www.qnap.com

More information www.synology.com

85 www.linuxuser.co.uk

Classified Advertising

DOMAINS

A DOMAIN FOR

THE CAPITAL

Claim your piece of London! Show what the capital means to you and your business with the new .london domain extension 

Highlight your connection to o of the world’s most visited citie and a global financial centre



Be first in line to claim your ide .london domain!

19

£

.

1

CLICK

UPGRADE OR DOWNGRADE

1

CALL

SPEAK TO AN EXPERT

.99

first year* excl. 20% VAT

1

CERTAINTY GEOREDUNDANCY

0330 123 0274 *.london domain for 1 year at £19.99 excl. VAT (£23.99 incl. VAT) instead of £39.99 excl. VAT (£47.99 incl. VAT). After 1 year regular price applies. Visit www.1and1.co.uk for full offer details, terms and conditions.

1and1.co.uk

01202 586442

Read anything good lately? Shop for quality magazines, books and DVDs from Imagine Publishing

I spy with my little eye domains ending in...

.actor .buzz .club .ink .pub .reviews .social .trade .uno .wiki Think

Different Think Follow @imagineshopuk

on Twitter for exclusive discount codes

Context Think

Available MAGAZINES

BOOKS

DVDS

DOWNLOADS

GIFTS

Get started with one of our Makeblock complete kits to build your first robot and then expand it with our huge selection of add-ons, components and modules. Telephone 01933 663903

Follow us on Twitter @TLBRC

www.thelittlebritishrobotcompany.co.uk

www.blacknight.host [email protected] @blacknight

Contact us...

Web: www.linuxuser.co.uk Email: [email protected]

Questions & answers

Facebook:

Twitter:

Linux User & Developer

@linuxusermag

Your questions

answered Send us your questions and we’ll do our best to answer them!

Miming

I want to create a MIME type file that can be opened in nano, the terminal text editor. I am running CentOS 6.5, and I have used my strongest Google-fu, however, despite my efforts I have not been able to find a usable answer. I have some text files for which I have edited the extension to .work to designate that I want them to be opened in nano by default. I have tried the “open as” option in gnome (command:

FAQ:

Editing GRU Q: How can I change the boot GRUB menu? A: In GRUB 2, the boot me determined by the order of the /etc/grub.d directory. Th installation, the one you’re u listed as 10_linux, whereas an discovers will be listed in orde prober file. Simply change the change the order. Q: Can I add Windows or o entries to this list? A: Yes, you just need to in the same style as those that in the grub.d directory. Aga ordered by number. Q: Can I change the default en A: Yes, the default selection /boot/grub/grub.cfg – below first if loop at the top, look ou set default=“0”.

88 www.linuxuser.co.uk

gnome-terminal -e nano) but that only opens nano with a new buffer. Sites I have found say to make a new MIME type or edit exsting MIME types with mimeopen, but it seems that command is not available and attempts to install it (yum install mimeopen) reward me with “no package available” message. Can you guys point me in the right direction? Keith Before you start creating new MIME types, maybe look into making nano the default

editor for the terminal? Look for the EDITOR or VISUAL environment variable and set it to nano with its full path, something like /bin/nano. You could also try adding the MIME type to /etc/mime.types. Otherwise, you could create a nano. desktop file, create the MIME type as text/work and associate it with nano via the defaults.list. Hopefully one of these methods would work, but try to do without making the new MIME type first.

Below CentOS is perfectly capable of handling such requests

Questions & answers

All your technical problems solved

Q/A

KD-Issues My computer just starting experiencing an issue within the past week where the prompt to unlock the screen doesn’t appear after it’s been idle for a while (sleep or just idle). I’m running Kubuntu 12.04, the LTS. I end up having to restart KDM to get back in, which is obviously not exactly convenient for me. Has anyone ever experienced this? Any ideas on how I can troubleshoot? Christian Homer Okay, this is actually a bit of a bug in KDE right now. They do know of it, though, so it will be fixed in future versions; for now though, you’ll need to change a setting to make sure it works as you wish it to. The main problem lies in the Energy Saving options in Power Management. Check the setting that requires a password after waking up the screen, and it should reappear for you to use. Keep KDE up-to-date, and when it gets fixed you shouldn’t have this problem again in the future.

Networking USB storage

configuration issues, but I worked through them. One issue that is still unresolved is getting Mint to talk to my WD 3TB “My Book Live” NASD drives. The WD support CD configures Windows automatically and assigns a drive letter to each drive. Alas, there is no similar support for Linux. I can’t seem to attach to the drive with a browser address like “\Files1\Public\” as I can in Windows. Nor can I attach to it with a browser address like “\169.254.10.130\Public\” as I can in Windows. Nor can I successfully ping the prior IP address from Linux. I have Windows and Mint on separate pluggable drives, so switching the OS is no big deal. Windows works, Linux doesn’t, so it can’t be the hardware or connections. It has to be a configuration issue. Okay, so networks are not exactly my strongest suit, but I can follow instructions, and I can chase down resources on the net, and best of all, I can play without fear of bringing down a company network – I own all the pieces and they reside in my basement. I understand TCP/IP at the physical level, but building entire networks is beyond me for now. However, I am educable. So, if you could suggest what I need to do, in as much detail as your time permits, I will try it. If you could suggest good references for something beyond the basics of the wiring and packets of networking, I would appreciate

I have been using Mint 13 for a while now, and am very pleased with it. There were some initial

Monogrammed I’m currently using Debian Squeeze to work on Mono stuff. I’m running Mono 2.6.7, but I’d like to upgrade to Mono 2.10 because I believe it would remove a few of the problems I’ve been having. It seems there isn’t a back port available, though. Will I have to compile from source? I don’t usually do that, and I don’t want to do something wrong and break what I’ve done so far. I’d prefer binaries or something. Peter Chan Don’t worry, if you’d rather not compile from source then there is actually a backport you can you use for Debian Squeeze. You’ll need to add a source for the backports first, so add this mirror to /etc/apt/sources.list:

deb-src http://ftp.de.debian.org/ debian wheezy main Run sudo apt-get update, then install:

$ apt-get install fakeroot dpkg-dev If you got dpkg-dev version 1.15.X in the previous step make sure to do this:

$ dpkg -i libdpkgperl_1.16.1.2~bpo60+1_all.deb $ dpkg -i dpkg-dev_1.16.1.2~bpo60+1_ all.deb Now build the necessary dependencies:

$ apt-get build-dep mono && exit Once that’s done, create a new directory, cd to it and grab the packages you’d want:

$ apt-get -b source mono=2.10.8.1-5 There will be something like 160 packages downloaded. You’ll need to filter through them and install the ones you need, and remove the ones you already have if you think it will make the installation easier for yourself. The way to install them is to use:

$ dpkg -i {package1} {package2} This may take a while, but it is a little less involved than compiling from source.

Above KDE is usually much more stable and bug-free

89 www.linuxuser.co.uk

Questions & answers

Facebook:

Twitter:

Linux User & Developer

@linuxusermag

Above The fstab may look daunting to beginners, but it’s very straightforward

it. Even better if they were on the internet. I am sure others would appreciate this as well. WD seems to have no interest in helping its non-Windows customers. I have seen others pose this question. Some guesses about file systems and Samba, but no definitive reply. I know this can be done, I just don’t know how. Scott Mann We can definitely help you out. The first thing we’ll say is that accessing external or networked hard drives is handled quite differently in Linux than it is in Windows. While you may have noticed USB sticks or other types of flash storage popping up in Linux Mint, this is due to the distribution automatically mounting the drive. Mounting is the process of assigning a place in the overall filesystem for the storage, and in the case of Linux, letting it know what type of filesystem it is as well. On one hand, this makes it easier to access without having to remember the different network names to type into a file browser. On the other, it can be confusing to folks such as

90 www.linuxuser.co.uk

yourself who are having trouble finding out how to connect a networked storage for the first time. First of all, we’ve noticed that you’re trying to access it with an IP address that is for internet-based connections. You’ll need to find the IP address of the hard drive on your local network, which on home hardware will usually start with 192.168, eg 192.168.0.25. Once you know that, we can tell you that apparently these hard drives use an ext4 file system, the same used by modern Linux distros. To mount it, assuming Public is the folder you want to mount, it would be something like this in the terminal:

$ mount //192.168.0.25/Public /home/user/ Share You can place it anywhere, but make sure to create the folder first. If that doesn’t work, you’ll need to install Samba. You can find it in the software centre, or by installing smbfs in the terminal. The mount would then be:

$ mount -t smbfs //192.168.0.25/Public / home/user/Share

That should get you started actually seeing the share. To get it to automatically mount at boot, you will need to add an entry to the /etc/fstab file, which you can access in the terminal with something like:

$ sudo nano /etc/fstab Where nano is just a text editor. The line should look something like this:

//192.168.0.25/Public /home/user/Share cifs defaults 0 0 There are plenty of tutorials online for fstab if you get stuck as well. Hope this helps.

GNOME life GNOME 3 is confusing me, which I suppose is nothing new in the Linux world. My style of workflow has me constantly moving between work spaces, and while I like that this is a bit more visually-orientated while using a mouse in GNOME 3, I just can’t get used to having to use Ctrl+Alt+Up or Down to move up and down work spaces. I’d probably get used to it

Questions & answers

All your technical problems solved

Q/A

Above The visual view may be useful, but the new keyboard shortcuts can trip you up if I didn’t use separate systems in my life that are stuck on other desktops which use left and right, but my brain just doesn’t seem to be clicking with it yet. Can I modify the way the extra desktops work to be horizontal? Or can I just remap the keys to use left and right instead? Tim Lunn Unfortunately, standard GNOME 3 is stuck with using vertically-orientated work spaces, and the key bindings for them cannot be changed. There is, however, an extension to add this into GNOME 3 as part of GNOME Shell Frippery. One of the extensions adds a bottom panel to GNOME 3 that has the workspaces arranged horizontally like in GNOME 2. This also changes the keybinding to be left and right for moving between the spaces. You could also check out Cinnamon, Linux Mint’s fork of GNOME, which also has horizontal work spaces.

concurrently or is there a better way of going about it? Tab You don’t need to install the 32-bit drivers to get this working, the best solution would be to install the xorg-x11-drv-nvidia-libs.i686 library from the extra RPM Fusion repo. If you haven’t got RPM Fusion, it’s pretty easy to add; open the terminal and type:

$ su -c ‘yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/ rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/ fedora/rpmfusion-nonfree-release-stable. noarch.rpm’ After you’ve added these repos, all you need to do is update yum, and install the extra package so you can get the compatibility working fine. Good luck.

Bit war

Quite unexpected

I’m having a problem with my 64-bit Fedora install that I wonder if you can help me with. I don’t know why I haven’t run into this before, but lately I’ve come across a handful of packages and games that seem to require 32bit video drivers. As I mentioned, I have a 64bit system which of course has 64-bit drivers installed; these I added via KMOD-Nvidia. Is it okay to install the 32-bit KMOD drivers

I had written a script to read a list of servers and was running Expect against that a long time ago, but I have no idea how I got it working. I have searched Google for the answer, but I have had no luck. All I want to do is have Expect run a ‘wget’ command inside fifty servers which are all listed in one file, line by line. This shouldn’t be difficult, but for some reason I can’t get it working.

Above RPM Fusion can also be easily added via its website Is it possible to have the script request the password as input, as a one time only thing, ie:

echo “Type the password:” read -s password Then call it later. In short, ssh into each machine listed in the ‘servers’ file, run a wget on each machine to pull a file down, and move it to a new location, then exit. Like a “for i in `cat servers` ; do ssh user@$i && wget /tmp/ http://google.com; done Except, obviously, that doesn’t work. Many thanks, Alexander Just for those that might like to know, Expect is a tool that allows you to control text terminal interfaces. For what you’re trying to do, we’d suggest using autoexpect to create the expect script that calls ssh and enters a password. We’d also use shell to run the expect script against all the servers, providing stdin of the commands wanted on each server:

for i in `cat servers` do e < w done Hopefully this should get you on the right track.

91 www.linuxuser.co.uk

Sponsorship opportunity

Hosting listings

Bring attention to your brand by sponsoring this section. Contact Daniel Gunton on +44(0)1202 586421

Dedicated server listings PERMANENT KVM

UPTIME GUARANTEE

NETWORK BACKUP STORAGE

Dual Core 2.2GHz

160GB

N/A

Raid 1













3000DC

0800 8085450

£40

1 month

Dual Core 3GHz

2 x 250GB

N/A

Raid 1













2660QC

0800 8085450

£65

1 month

Intel 2.66GHz Quad Core Xeon Processor

2 x 500GB

N/A

Raid 1













Developer

0800 8085450

£2.99

1 month

N/A

1GB

N/A















One

0800 8085450

£9.99

1 month

N/A

5GB

N/A















www.netcetera.co.uk/linux

Reseller

0800 8085450

£24.99

1 month

N/A

Unlimited

N/A















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















Netcetera

PACKAGE

24/7 PHONE SUPPORT

REMOTE POWER REBOOT

1 month

PRIVATE SUBNET

HARDWARE RAID

£25

NAME AND URL

1GBPS INTERNET CONNECTION

MINIMUM CONTRACT TERM

0800 8085450

[email protected]

DISK SPACE

COST PER MONTH

2200DC

Whetheryou’reahostingfirmor ahappycustomerwhowantsa favouriteproviderlisted,dropus alinewiththedetails!

CPU CORES / SPEED

PHONE NUMBER

Got a deal you think we should list?

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)

UltimateWindows

N/A

£60

N/A

N/A

Unlimited

N/A















catalyst2 (www.catalyst2.com)

Bronze Managed Dedicated Server

0800 107 79 79

£199

1 month

1x 2.4GHz vCPU

50GB









99.90%

catalyst2 (www.catalyst2.com)

Silver Managed Dedicated Server

0800 107 79 79

£299

1 month

1x 2.4GHz vCPU

80GB









99.90%







catalyst2 (www.catalyst2.com)

Gold Managed Dedicated Server

0800 107 79 79

£399

1 month

2x 2.4GHz vCPU

150GB









99.90%













123-Reg (www.123-reg.co.uk)

Dell PowerEdge R200 (Ubuntu Linux)

0871 230 9525

£69.99

12 months

4x 2.13GHz

2x 160GB

10Mbit







99.99%

O





123-Reg(www.123-reg.co.uk)

DellPowerEdgeR200 (WindowsWebEdition)

08712309525

£79.99

12months

4x2.13GHz

2x160GB

10Mbit







99.99%

O





Daily (www.daily.co.uk)

Linux VPS Pro

0845 466 2100

£29.99

1 month

2.27 Intel Quad Core

60GB

100Mbps







*

 - full backup



**



**



**

Daily (www.daily.co.uk)

Linux VPS Max

0845 466 2100

£59.99

1 month

2.27 Intel Quad Core

100GB

100Mbps







*

 - full backup

Daily (www.daily.co.uk)

Windows VPS Pro

0845 466 2100

£34.99

1 month

2.27 Intel Quad Core

60GB

100Mbps







*

 - full backup

Daily (www.daily.co.uk)

Windows VPS Max

0845 466 2100

£64.99

1 month

2.27 Intel Quad Core

100GB

100Mbps







*

 - full backup



**

Daily (www.daily.co.uk)

VPS Pro Hyper-V

0845 466 2100

£44.99

1 month

2.27 Intel Quad Core

60GB

100Mbps







*

 - 1GB



**

Daily (www.daily.co.uk)

VPS Max Hyper-V

0845 466 2100

£74.99

1 month

2.27 Intel Quad Core

100GB

100Mbps







*

 - 1GB



**

Daily (www.daily.co.uk)

VPS Ultra Hyper-V

0845 466 2100

£139.99

1 month

2.27 Intel Quad Core

200GB

100Mbps







*

 - 1GB



**

HeartInternet(www.heartinternet. co.uk/dedicated-servers)

Linux Dual Core

0845 644 7750

£79.99

12 months

DualCoreXeon 2.33GHz

160GB









99.99%





24/7Ticket support

Heart Internet (www.heartinternet. co.uk/dedicated-servers)

Windows Dual Core

0845 644 7750

£89.99

12 months

Dual Core Xeon 2.33GHz

160GB









99.99%





24/7 Ticket support

Heart Internet (www.heartinternet. co.uk/dedicated-servers)

LinuxQuadCore

08456447750

£129.99

12months

Quad Core Xeon 2.5GHz

250GB









99.99%





24/7 Ticket support

Webfusion (www.webfusion.co.uk)

Dell PowerEdge R210

0845 130 1602

£79.99

12 months

2x 3.06GHz

250GB

Webfusion (www.webfusion.co.uk)

Dell PowerEdge R210

0845 130 1602

£119.99

12 months

4x 2.66GHz

2x 250GB

Webfusion (www.webfusion.co.uk)

Dell PowerEdge R210

0845 130 1602

£149.99

12 months

4x 2.66GHz

2x 500GB

Up to 100Mbit Up to 100Mbit Up to 100Mbit







99.99%

Free

O









99.99%

Free

O









99.99%

Free

O



O = Option

92 www.linuxuser.co.uk

GET YOUR LISTING HIGHLIGHTED! CONTACT DANIEL

[email protected] +44(0)1202 586430

Hosting listings LISTINGS

SHOPPING CART

VIRUS FILTER

FIREWALL

PHONE SUPPORT

EMAIL SUPPORT

WEB CONTROL PANEL

SERVICE LEVEL AGREEMENT

From £0.99 10GB

Unlimited 10

















1&1 Basic (Linux)

0844 335 1211

From £0.99 100GB

Unlimited 100

















1&1 Basic (Win.)

0844 335 1211

From £2.99 100GB

Unlimited 100

















1&1 Starter (Linux)

1&1 Internet Ltd www.1and1.co.uk

POP3 ACCOUNTS

WEB SPACE

COST

PHONE NUMBER

MONTHLY BANDWIDTH

0844 335 1211

PACKAGE

DATABASE SUPPORT

Dedicated and Shared server listings

1&1 Unlimited (Linux) 0844 335 1211

From £4.99 Unlimited Unlimited Unlimited

















1&1 Unlimited (Win.)

0844 335 1211

From £4.99 Unlimited Unlimited Unlimited

















1&1 Unlimited Plus (Linux)

0844 335 1211

From £6.99 Unlimited Unlimited Unlimited

















1&1 Unlimited Plus (Win.)

0844 335 1211

From £6.99 Unlimited Unlimited Unlimited

















eHosting (www.ehosting.com)

Starter

0844 999 4100

£23.88

1GB

25GB

10

















eHosting (www.ehosting.com)

Personal

0844 999 4100

£59.88

2.5GB

Unlimited

50

















eHosting (www.ehosting.com)

Expert

0844 999 4100

£95.88

5GB

Unlimited

250

















eHosting (www.ehosting.com)

Virtual

0844 999 4100

£227.88

50GB

Unlimited

Unlimited

















Equiphase (www.equiphase.net)

Bronze

0121 314 4865

£30

200MB

2GB

10

















Equiphase (www.equiphase.net)

Silver

0121 314 4865

£42

400MB

5GB

20

















Equiphase (www.equiphase.net)

Gold

0121 314 4865

£72

800MB

10GB

100

















Equiphase (www.equiphase.net)

Platinum

0121 314 4865

£114

1,200MB

40GB

200

















Eurofasthost.com (www.eurofasthost.com)

Email Only

02380 249 823

£40

1GB

2GB

10

















Eurofasthost.com (www.eurofasthost.com)

Essential

02380 249 823

£75

2GB

5GB

10

















Eurofasthost.com (www.eurofasthost.com)

Superior

02380 249 823

£140

5GB

10GB

25

















Eurofasthost.com (www.eurofasthost.com)

Premium

02380 249 823

£250

10GB

25GB

100

















Evohosting (www.evohosting.co.uk)

Starter

N/A

£29.99

500MB

1GB

3

















Evohosting (www.evohosting.co.uk)

Home

N/A

£54.99

2.5GB

30GB

50

















Evohosting (www.evohosting.co.uk)

Business

N/A

£79.99

6.5GB

Unlimited

Unlimited

















Evohosting (www.evohosting.co.uk)

eCommerce

N/A

£159.99

30GB

Unlimited

Unlimited

















WebFusion (www.webfusion.co.uk)

Fusion Professional

0845 130 1602

£107.40

5GB

50GB

1,000

















WebFusion (www.webfusion.co.uk)

Fusion Business

0845 130 1602

£179.40

10GB

150GB

1,500

















WebFusion (www.webfusion.co.uk)

Fusion Developer

0845 130 1602

£227.40

20GB

300GB

5,000

















WebFusion (www.webfusion.co.uk)

Fusion Reseller

0845 130 1602

£329.99

Unlimited

Unlimited

Unlimited

















Giacom (www.giacom.com)

Business Pro

0800 542 7500

£199

100MB

2GB

100

















Heart Internet (www.heartinternet.co.uk)

Starter Professional

0845 644 7750

£29.80

2.5GB

10GB

1,000

















Heart Internet (www.heartinternet.co.uk)

Home Professional

0845 644 7750

£89.99

10GB

50GB

10,000

















Heart Internet (www.heartinternet.co.uk)

Business Professional

0845 644 7750

£129.99

Unlimited

Unlimited

Unlimited















 

Heart Internet (www.heartinternet.co.uk)

Reseller Professional

0845 644 7750

£299.99

Unlimited

Unlimited

Unlimited















Hostway (www.hostway.co.uk)

Silver

0808 180 1880

£79.50

150MB

3GB

5



O













NameHog (www.namehog.net)

Email Only

0845 612 0330

£11.75

25MB

1GB

5

















NameHog (www.namehog.net)

Standard Package

0845 612 0330

£35.25

100MB

4.5GB

10

















NameHog (www.namehog.net)

Professional Package

0845 612 0330

£58.75

250MB

8GB

25

















NameHog (www.namehog.net)

Expert Package

0845 612 0330

£105.75

500MB

15GB

75

















Skymarket (www.skymarket.co.uk)

Standard 1

0800 321 7788

£49

10MB

2GB

1

















Skymarket (www.skymarket.co.uk)

Standard 2

0800 321 7788

£69

20MB

2GB

1

















Skymarket (www.skymarket.co.uk)

Premium 1

0800 321 7788

£99

25MB

2GB

1

















Blacknight (www.blacknight.com)

Minimus Linux / Windows

+44 (0)845 5280242 €49.95

10GB

150GB

1,500

















Blacknight (www.blacknight.com)

Medius Linux / Windows

+44 (0)845 5280242 €89.95

20GB

300GB

5,000

















Blacknight (www.blacknight.com)

Maximus Linux / Windows

+44 (0)845 5280242 €149.95

30GB

600GB

Unlimited

















O = Option

93 www.linuxuser.co.uk

Your view

Your source of Linux news and views Contact us…

Register and post your comments… www.linuxuser.co.uk/forum/

Email us directly… [email protected]

YOUR VIEW

Linux User Letters Your opinions about the magazine, Linux and open source

Model B+ is not A++

The B+ is no more powerful than the B? Sorry but they also needed to up the power and memory. Some of us need a little power too and ARM-based dual-cores are dirt-cheap on tablets. I tried to use an original Model B and it was barely usable as a media player. Not because it couldn’t play video with scamp, but that it was choking loading up websites. Waiting three minutes for a page to finish opening was horrific. In the end I had to give in and buy an old AMD LE1640 base unit for £49.99 and install Linux. This is far better. I can see the other uses this can be put towards, but to my needs it was near useless. Mi Pen It’s worth remembering that the Raspberry Pi was never meant as a consumer hobby device but as an educational tool. That said, with the way chips go obsolete it may soon be cheaper to upgrade all the Raspberry Pis

around this time next year to a Raspberry Pi 2. The Foundation has said this will be the last iteration of the Model B so perhaps it’s hinting towards a Model C or full upgrade in the future.

Open source, open door?

While I’m a supporter of open source, I’ve always had concerns over malicious code making its way into the programs I use via clever folk with nefarious intent hiding it behind other pieces of code. The more I’ve used open source code the more I know that is in fact complete bull. It’s not the movies, that’s not quite how code works. So I’m quite happy to hear that although some person is trying to damage the Linux kernel, whether intentionally or not, the mods are able to make sure their code doesn’t get in. It’s also nice to hear they’re giving them the benefit of the doubt and some tips on best practice in case they’re genuinely trying to contribute. It’s waylaid my fears somewhat about the contribution process. Lisa

We had a bit of a laugh over the situation over at Linux User’s Flying Fortress but it could be a serious issue if the maintainers weren’t so vigilant about the problem. Luckily, they’ve all been warned and it probably won’t be long until the user is banned if they keep it up. We’re surprised they’ve been this patient really, especially with the stories of how short-tempered Linus himself can apparently be – especially since the one time a suspect commit did slip through, it was on a branch Linus maintained himself.

Up-to-date kernel

Every now and then when I update my distro I get a new version of the Linux kernel; however, it’s never the very latest version. At the time of writing they’re up to 3.16 yet I’m still on 3.12-pointsomething. Is there something I’m doing wrong? I’d like to use whatever new functions are available for the newer kernels, including security updates as well. If the distro can’t automatically upgrade to the very latest kernel, can I install it myself? Why don’t these distros update themselves to the very latest kernel? Laura B.

Left The Model B+ while a lot better, is not everything people wanted

Above Linus and his team keep an eye on the kernel, to keep track of updates and stop malicious code

94 www.linuxuser.co.uk

Your view

Model B+, Linux kernel, Banana Pi

LETTERS

Twitter:

THREAD BARE

@linuxusermag

Fresh Banana cream Pi

Facebook: Linux User & Developer It’s not just the kernel that is slightly held back with upgrades: a lot of distros with set release schedules also keep other software at earlier versions and don’t always backport the latest one. This is done on a case-bycase basis and is different per distro, but mainly it’s down to human resources and bug fixes/prioritising getting things into the next version. The kernel is slightly different as it’s the core of the system and each release has a different major kernel version. You can definitely install the latest kernel with a bit of patience, although you may need to reinstall some software and start compiling it from scratch. The easiest method we’ve found by far is to get a rolling distro which continuously updates and always uses the latest software.

AndroidMagazine With more and more Android feature merge the L it’s be easier for on popula operating systems around. billion app downloads, and ov Android devices worldwide, audience of folks ready a consume apps. For a more A editorial, you can look to o Android Magazine, the on dedicated to the platform news and reviews to keep y on everything Android, th tutorials and advice on de hacking your hardware. Fin www.littlegreenrobot.co.uk

We reviewed the Banana Pi last issue, and then put that review online to quite a mixed response; a heady blend of curiosity, distrust and satisfaction. Join in the conversation and have your say about the Banana Pi online: http://bit.ly/1tluCZK

Glen Duncan said: “an upgrade for users who have found the berry-flavoured variant lacking” Botanically speaking, bananas are berries.

PyPlate said: I’m really happy with the increase in performance. I just built a cluster with four Banana Pis.

Hulhong Luo said: I’ve been using Banana Pi for a month to port our iOS AirPlay mirroring software, rPlay, from Raspberry Pi. I have to say that Banana Pi is much better than Raspberry, five times faster and most importantly it supports Android and can run Chrome browser. It seems impossible for Raspberry Pi to support Android or to run Chrome browser. When I build rPlay on Raspberry, I can go to lunch for over an hour, whereas on Banana Pi, I can only do a coffee, as it takes only ten minutes. According to the Banana Pi site, Android 4.4 is planned. Right now, the only thing missing for Banana Pi is community support.

Michael Horne said: You’re right, it is easy to pour scorn on the blatant riding of coat-tails, and much scorn should be poured. By using the name of ‘Pi’, they are trying to insinuate themselves in a very cynical way into the Pi community, even though their board is fundamentally different in terms of architecture. I applaud them for their pricepoint, but not for their marketing strategy. The other thing that benefits the Raspberry Pi is the enormous community it now has, something which Lemaker has been unable to foster so far. I would say 4/5 is being a bit generous.

Keith McNeill said: “While it’s easy to pour scorn on Lemaker for its blatant attempt to ride on the coattails of the Raspberry Pi”

Right This clone-cum-upgrade has garnered some fair criticism

PePas said: Very interested in getting this as my home server with the SATA port Need a

iPad iPhone Android phone Android tablet Apple Mac Windows PC

/P %JTD /P 1SPCMFN Many of the files you’re looking for can be found on the magazine’s website

*NBHJOF EJHJUBM FEJUJPOT BSFBOFXBOEFYDJUJOH XBZUPFYQFSJFODFPVS XPSMEMFBEJOHNBHB[JOFT BOECPPLB[JOFT

5PCVZNPSF*NBHJOFEJHJUBMFEJUJPOTBOEGPSUIF MBUFTUJTTVFTBOECFTUPGGFST QMFBTFHPUP

To get the most out of your digital editions, be sure to enjoy all of our fantastic features, including:

r;PPNBCMFUFYUBOEQJDUVSFT r*OBQQCSPXTJOH r4FBSDIBCMFUFYU r5BLFZPVSDPMMFDUJPOXJUIZPV r3FBEPGáJOF

XXX(SFBU%JHJUBM.BHTDPN

Next issue

What’s coming up…

Look fo issue 145 ron 23 October

Want it soon er?

COMING IN THE NEXT ISSUE

Subscribe today!

Ubuntu’s th

THE MAGAZINE FOR THE GNU GENERATION

Imagine Publishing Ltd Richmond House, 33 Richmond Hill Bournemouth, Dorset, BH2 6EZ  +44 (0) 1202 586200 Web: www.imagine-publishing.co.uk www.linuxuser.co.uk www.greatdigitalmags.com

Magazine team

Deputy Editor Gavin Thomas

[email protected]  01202 586257 Production Editor Carrie Mok Designer Sam Ribbits Senior Staff Writer Rob Zwetsloot Photographer James Sheppard Senior Art Editor Will Shum Editor in Chief Nick Roberts Publishing Director Aaron Asadi Head of Design Ross Andrews

Contributors Liam Fraser, Gareth Halfacree, Richard Hillesley, Phil King, Jon Masters, Rebecca Richards, Richard Smedley, Nitish Tiwari, Sean Tracey, Mihalis Tsoukalos.

Advertising Digital or printed media packs are available on request. Head of Sales Hang Deretz  01202 586442 [email protected] Advertising Manager Alex Carnegie  01202 586430 [email protected] Account Manager Daniel Gunton  01202 586421 [email protected]

Cover disc Junior Web Designer Steve Dacombe [email protected]

International Linux User & Developer is available for licensing. Head of International Licensing Cathy Blackman  +44 (0) 1202 586401 [email protected]

Subscriptions 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

Circulation Head of Circulation Darren Pearce  01202 586200

Production Production Director Jane Hawkins  01202 586200

Founders Group Managing Director Damian Butt Group Finance & Commercial Director Steven Boyd

Printing & Distribution Printed by William Gibbons, 26 Planetary Road, Willenhall, West Midlands, WV13 3XT Distributed in the UK, Eire & the Rest of the World by: Marketforce, Blue Fin Building, 110 Southwark Street London, SE1 0SU  0203 148 3300 www.marketforce.co.uk Distributed in Australia by: Network Services (a division of Bauer Media Group) Level 21 Civic Tower, 66-68 Goulburn Street Sydney, New South Wales 2000, Australia  +61 2 8667 5288

Disclaimer

Control a Bigtrak rocket launcher

Automate continuous code quality analysis

Leo White returns to show us how to upgrade a Bigtrak tank with a rocket launcher

Nitish Tiwari explains how to combine Jenkins automation with SonarQube code cleaning

Virtual boxes with Puppet + Vagrant

ALSO INSIDE:

Richard Smedley reveals the trick to simple virtualisation 98

>> Get started with FUZE BASIC >> Monitor a Cisco router with MRTG >> Set up a BitScope Micro oscilloscope >> HummingBoard-i2ex reviewed

The 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 specifically 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 affiliated 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.

© Imagine Publishing Ltd 2014 ISSN 2041-3270

)BWFZPVHPU VOXBOUFENPOJUPST

 NPOJUPSTOFFEFEGPS TDIPPMTJO"GSJDBBOE-BUJO"NFSJDB t 8&&& DPNQMJBODF HVBSBOUFFE t  UP MBOEöMM QPMJDZ t "MM MFHBM MJBCJMJUJFT DPWFSFE t %BUB XJQFE UP 6, NJMJUBSZ TUBOEBSET PO BMM 1$T

www.computeraid.org/donate 020 8361 5540 [email protected] Or find us on...

Registered Charity No. 1069256 Registered Company No. 3442679

Linux User & Developer Issue 144 - 2014 UK.pdf

And if you'd like to see a Linux desktop on a much smaller,. more portable screen then turn to page 26. This issue we. show you how to install Linux on your Android phone or tablet. – regardless of your rooting situation –and take advantage of. your favourite tools right from your go-to mobile device. Once your screen's all ...

17MB Sizes 3 Downloads 93 Views

Recommend Documents

Linux User & Developer Issue 144 - 2014 UK.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Linux User ...

man-144\mitac-user-manual.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

man-144\saitek-user-manual.pdf
Download. Connect more apps... Try one of the apps below to open or edit this item. man-144\saitek-user-manual.pdf. man-144\saitek-user-manual.pdf. Open.

man-144\megatech-user-manual.pdf
Download. Connect more apps... Try one of the apps below to open or edit this item. man-144\megatech-user-manual.pdf. man-144\megatech-user-manual.pdf.

man-144\mitel-user-manual.pdf
Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. man-144\mitel-user-manual.pdf. man-144\mitel-user-manual.pdf.

man-144\rollei-user-manual.pdf
Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. man-144\rollei-user-manual.pdf. man-144\rollei-user-manual.pdf.

man-144\meritor-user-manual.pdf
Download. Connect more apps... Try one of the apps below to open or edit this item. man-144\meritor-user-manual.pdf. man-144\meritor-user-manual.pdf. Open.

man-144\medion-user-manual.pdf
Connect more apps... Try one of the apps below to open or edit this item. man-144\medion-user-manual.pdf. man-144\medion-user-manual.pdf. Open. Extract.

August 2014 – Issue 57
Aug 12, 2014 - Judyannet Muchiri. Paul Shaw ... internet in Africa thus the need to take advantage of social media to engage with people who are involved in various projects ..... outcome of a complacent business as usual approach to 2015.

pdf-144\prespacetime-journal-volume-4-issue-11-fundamental ...
... the apps below to open or edit this item. pdf-144\prespacetime-journal-volume-4-issue-11-funda ... hat-is-quantum-gravity-what-is-graviton-by-quant.pdf.

man-144\free-linux-operating-system-downloads.pdf
Whoops! There was a problem previewing this document. Retrying... Download ... to open or edit this item. man-144\free-linux-operating-system-downloads.pdf.

man-144\night-guard-home-surveillance-system-user-manual.pdf ...
man-144\night-guard-home-surveillance-system-user-manual.pdf. man-144\night-guard-home-surveillance-system-user-manual.pdf. Open. Extract. Open with.

man-144\network-computing-devices-user-manual.pdf
man-144\network-computing-devices-user-manual.pdf. man-144\network-computing-devices-user-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

man-144\sprint-mifi-user-guide.pdf
Connect more apps... Try one of the apps below to open or edit this item. man-144\sprint-mifi-user-guide.pdf. man-144\sprint-mifi-user-guide.pdf. Open. Extract.

man-144\national-instruments-user-manual.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

man-144\liz-claiborne-user-manual.pdf
man-144\liz-claiborne-user-manual.pdf. man-144\liz-claiborne-user-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

man-144\verizon-wireless-droid-user-guide.pdf
man-144\verizon-wireless-droid-user-guide.pdf. man-144\verizon-wireless-droid-user-guide.pdf. Open. Extract. Open with. Sign In. Main menu.

man-144\nortel-networks-user-manual.pdf
man-144\nortel-networks-user-manual.pdf. man-144\nortel-networks-user-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

man-144\metra-electronics-user-manual.pdf
man-144\metra-electronics-user-manual.pdf. man-144\metra-electronics-user-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

man-144\nilfisk-advance-america-user-manual.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item.

man-144\rds-industries-user-manual.pdf
man-144\rds-industries-user-manual.pdf. man-144\rds-industries-user-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

August 2014 – Issue 57 - NAYD
2. NEW EDITION www.nayd.org. Dear change makers,. We are delighted to present to you this month's edition of ... environment to support sustainable energy.

man-144\nilfisk-advance-america-user-manual.pdf
man-144\nilfisk-advance-america-user-manual.pdf. man-144\nilfisk-advance-america-user-manual.pdf. Open. Extract. Open with. Sign In. Main menu.

man-144\psion-teklogix-user-manual.pdf
man-144\psion-teklogix-user-manual.pdf. man-144\psion-teklogix-user-manual.pdf. Open. Extract. Open with. Sign In. Main menu.