KDE 4ON reimagined YOURwww.linuxformat.com/downloads*Get the by ISOFREE ofRosa the DVD LinuxDVD from

3 top Raspberry Pi add-ons + Hotpicks, code

and more!

#1 for BUILD YOUR OWN DISTRO Create the perfect for you and show Mint,Fedora and

Ubuntu how it should be done 8 pages of programming excellence

Concepts Compress images p84 OpenEuphoria Code happy p86 HTML 5 Scrolling effects p90 Firefox vs Chrome Also inside… The browser wars blitz through IS YOUR the Maginot line p20 FREE DVD for phones MISSING? Why you will want one – as soon Speak to your as they’re in the shops p50 newsagent A cyborg speaks now! OS/4 OpenLinux Relive the glory days of the Amiga, When I use it on aeroplanes then relax with Steam games p18 people go ‘What is that? That looks so cool!’ Collection managers Karen Sandler on showing off with Gnome 3 p42 Keep tabs on your hoard of shiny things p26

Cloud computing Package management Web applications Amazon cloud stuff FPM Juju Charms Harness the power of Forget RPMs and Deb – Enable mere mortals someone else’s servers this is the one to rule them all to install your web apps TuxRadar.com

Welcome

#1 for Free Software What we do We support the open source community by providing a resource of information, and a forum for debate. We help all readers get more from Linux with our tutorials section – we’ve something for everyone! We license all the source code we print in our tutorials section under the GNU GPLv3. We give you the most accurate, unbiased and up-to-date information on all things Linux. Who we are In this issue, Ben looks at some great add-ons for the Raspberry Pi. So we asked our contributors, what Raspberry Pi add-ons would they like to see? 22 years of brilliance

It’s been 22 years since Linus Torvalds made his now famous announcement proclaiming the availability of Linux. Linus recently mentioned this on his Google+ account, so he must still think this was a significant moment. But this is also the month when Steve Ballmer announced his Chris Thornett Andrew Gregory Efrain Hernandez- departure from Microsoft. Its easy. Id like a A waterproof laser Mendoza The public image of Ballmer and Torvalds couldn’t be further device that found attachment for my My add-on would removed, and neither could the ‘products’ these two leaders incorrect and sharks. I’d then open a worm hole inappropriate use an SSH tunnel to a beach bar in manage. We used to liken this difference to the battle between apostrophes. to fire them from Acapulco. Goliath and David, but as Linux and Free Software have gone my bunker. from strength to strength, it has become more of a fight between generational shifts in development. It seems to me that for the majority of its life, Microsoft has been run democratically; pools of the smartest brains on the planet push their ideas through various levels of management, each with their own departments, agendas and backing. The Ben Everard Mayank Sharma Jonathan winning ideas aren’t necessarily the best, just those championed A missile proof I’d make an Roberts fl thermal exhaust interconnected A retina scanning by in uential leaders like Steve Ballmer. Linux, on the other port – this Death tower of Pis then device I could use hand, is meritocratic. If a large enough contingent thought Linus Star will last! truly discover the on the folks at wasn’t doing a great job, they’d do it themselves. Just as anyone value of Pi! Linux Format. can create their own distribution (see our feature, p34). Good ideas flourish because they’ve got great support, not because they’re championed through one management tier after another. Microsoft is losing its footing in the rapidly developing and fluid field that technology has become, whereas Free Software evolves to fit new trends and demands Mike Saunders David Cartwright Nick Veitch dynamically, because it’s partly the reason for those trends in A GPIO to MikeOS I’d turn my Pi into I’d use mine to the first place. Microsoft needs to become more open, it needs connector so I can an annoy-a-tron, create a trusted to become more flexible, give its great teams more autonomy continue to play dress as a janitor, network without with x86 asm on and hide it beneath ever connecting to and reduce its management burden. It needs to become more my Pi! Theresa May’s the internet again. like open source or risk the consequences. desk.

Graham Morrison Editor [email protected] Juliet Kemp Shashank Sharma Neil Bothwick A device to interface I’d like a device to Has anyone the Pi to Babbage’s make the perfect mentioned sharks Difference Engine cup of coffee, from with lasers yet? for the ultimate bean to cup! They have?! Damn Subscribe today esoteric API! you, Gregory! See p32 for awesome deals

www.tuxradar.com November 2013 LXF176 3 Contents “Whatever good things we build, end up building us.” Reviews

OS/4 OpenLinux ...... 18 Has this app-packed, user-friendly Ubuntu derivative bitten off more than it can chew?

OS/4 OpenLinux – the distro that’s trying to please everyone. Create your perfect PC-BSD 9.2 ...... 19 operating system and BSD made easy? Is that even possible? Here’s the place to find out. show Mint,Fedora and Ubuntu how it should be done p34

Roundup: Collection managers p26

Getting into the swing of deciding which browser is best.

Firefox vs Chromium ...... 20 The browser behemoths go head-to-head. Find out which packs the biggest punch. Devolo LiveCam...... 22 A wireless IP webcam that claims to work with Linux.

Talking heads I’m with Gnome because I

Well it looks pretty slick, but how think it’s awesome, but if does it work? another free software Books ...... 24 Keep fit while coding and every recipe you solution wins, I don’t mind might need for your Raspberry Pi. Karen Sandler on why she backs open source p42

4 LXF176 November 2013 www.linuxformat.com On your free DVD Rosa Freshen up your KDE Peppermint Four Lightweight cloud-friendly OS Treat yourself or a loved one to an LXF PLUS: HotPicks and tutorial code p96 subscription! p32

Don’t miss... Raspberry Pi add-ons ...... 46 Three of our favourite extras. Ubuntu Phone ...... 50 The story so far… Open vSwitch ...... 54 The open source server software.

Coding Academy Tutorials

Coding Concepts ...... 84 Dual booting Ben Everard compresses his JPEGs – and it’s VirtualBox/Fedora ...... 68 not as painful as it sounds. Run two separate distros off the same external hard drive. OpenEuphoria ...... 86 Juliet Kemp makes us all happy with a language Package management that’s fast to read and quick to compile. FPM ...... 70 Mike Saunders discovers an easy way to Skrollr ...... 90 build Debs and RPMs. Ben Everard whips up some JavaScript to add some tasty scrolling effects to your HTML. Regulars at a glance

News ...... 6 Subscriptions ...... 32 Answers ...... 92 Groklaw closes, Ubuntu Edge Never miss an issue – and save YOUR PROBLEMS SOLVED funding shortfall and two new useful pennies too. Amazon angst? Data Crow The only Torrent tracker you can gun-based games. dilemmas? We soothe your really trust is your own. Sysadmin ...... 56 Linux-based headaches. User groups ...... 11 Dr Chris uses open software to File sharing Sun, sea and a Raspberry Jam at build a closed firewall and discovers Next month ...... 98 BitTorrent ...... 74 Barcamp Blackpool and all the LUGs the power of Sed. The Linux handsets heading to a Share files and folders using Transmission meeting in a town near you. phone shop near you. and set up a Torrent tracker. HotPicks ...... 60 Mailserver ...... 12 Picks even hotter than the Cloud services Forgotten forks, ancient on sale dates, Hungarian Grand Prix: a AWS ...... 76 and some useful tips on how to con customisable text editor, a handy Try out Amazon’s cloud services without parting with any cash. the fraudsters. wiki engine and your very own Linux-based burglar alarm. More cloud services Roundup ...... 26 Juju ...... 80 Five collection managers reviewed Back issues ...... 66 Cloud-enable your services. Witch doctor and rated – you’ll never lose track of Missing an issue? Get in touch to Our subscriptions team is Nick Veitch shows you how. your stuff again. collect the set. waiting for your call.

www.tuxradar.com November 2013 LXF176 5 9000 THIS ISSUE: Ubuntu Edge War games GPL violation Android arguments BIG BROTHER Groklaw shuts down Award-winning, software freedom-defending legal site to close over privacy fears.

roklaw, the legal site set up to US out or to the US in, but really fight the protracted SCO vs anywhere. You don’t expect a stranger GIBM case (see boxout, below) to read your private communications to has folded after 10 years of award- a friend. And once you know they can, winning campaigning journalism. The what is there to say? Constricted and site’s founder, Pamela Jones, cited fears distracted … That’s how I feel.” that she would not be able to protect the identity of sources in the light of Thanks for all the fishes recent revelations over email security. Jones, a paralegal by training, set up Writing in the site’s last post, Jones Groklaw to bridge the gap in said: “The owner of Lavabit tells us that understanding between the worlds of he’s stopped using email and if we knew the programmer and the courtroom. what he knew, we’d stop too. There is no Although it was originally intended to way to do Groklaw without email. provide clarity over the SCO vs IBM legal Therein lies the conundrum. fight, Groklaw also helped other legal “I hope that makes it clear why I cases with implications for free software, can’t continue. There is now no shield including Oracle vs Google, Microsoft vs Groklaw spoke rather than comply with a demand that from forced exposure. Nothing in that Motorola and Apple vs just about truth to power, it be given access to its users’ email parenthetical thought list is terrorism- everyone in the world. and power accounts. He posted at the time: “I have related, but no one can feel protected The owner of Lavabit (the email doesn’t like that been forced to make a difficult decision: very much. enough from forced exposure any more provider used by, among others, US to become complicit in crimes against to say anything the least bit like that to whistleblower Edward Snowden), Ladar the American people or walk away from anyone in an email, particularly from the Levison, closed the service in August nearly 10 years of hard work.” Lavabit had complied with an earlier investigation into a suspected Groklaw vs SCO paedophile, so the issue here isn’t one of legitimate cooperation with the In March 2003 the SCO group sued authorities; rather, it looks as though IBM over alleged copyright Levison and Jones didn’t want to infringement for $1bn (later rising to subject their users to fishing $5bn). SCO alleged that IBM stole code expeditions. Whatever the cause, the that SCO owned, and illegally contributed it to the Linux kernel. Many years and many millions of dollars later, “There is now no shield the case eventually petered out, with the ruling that SCO didn’t even own the from forced exposure.” allegedly infringed code in the first place. In the meantime the case Pamela Jones, Groklaw spawned suit and counter suit. Former SCO CEO Darl McBride. SCO failed to identify the code in internet will be a poorer place without question, attempted to collect a licence Linux that may have slowed Linux Groklaw. Big companies will find it fee from Linux users, and tried to warn adoption in business, and definitely easier to bully smaller companies, off companies that were using Linux. added fuel to the fire of Microsoft’s governments will find it easier to bully In hindsight SCO’s claims were anti-free software marketing. We have subjects, and we’ve all lost a valuable risible, but at the time they created an Groklaw to thank for exposing SCO’s resource for understanding the atmosphere of uncertainty around claims for the nonsense they were. increasingly complicated world of software rights.

6 LXF176 November 2013 www.linuxformat.com Newsdesk

QUIXOTRY Newsbytes

According to a proposal put forward at the Flock Ubuntu Edge falls conference for Fedora contributors, the distro could be moving back to the days of Fedora Core, when a base distro was released along with short of $32m goal several meta packages to enable users to tailor the distro to their Only $12.6m pledged to bring super-smartphone into requirements. Or, as is the way with production, but the future looks bright for Ubuntu phones. suggestions made at conferences, perhaps things will stay as they are. he Ubuntu Edge, the smartphone-cum- the Edge, a fact acknowledged by Shuttleworth in On 16 August 2013 it was the desktop PC replacement, has failed to a statement from Canonical: “The big winner from 20th birthday of , the Treach its ambitious $32m funding goal this campaign is Ubuntu. While we passionately foundation distro for Ubuntu and on the crowdfunding platform IndieGogo. wanted to build the Edge to showcase Ubuntu on Mint and, lest we forget, a damn fine However, there are some positives to be drawn phones, the support and attention it received will distro in its own right. The first from the experience, according to Canonical still be a huge boost as other Ubuntu phones start Debian release came just two years founder Mark Shuttleworth. to arrive in 2014.” after the announcement of the “It’s definitely set a record for the most money Linux kernel, so hats off to the raised,” Shuttleworth told the Guardian shortly Debian folks for spotting the before the campaign ended, “but also for the potential of Linus’ creation. most missed in a campaign.” Steve Ballmer, the man who The previous record for the most amount of famously described Linux as a money pledged in a crowdfunding campaign was “cancer that attaches itself in an the $10.2m raised by the Pebble smartwatch. The intellectual property sense to Edge beat that with $12.6m pledged, but everything that it touches”, has according to the conditions of the IndieGogo announced that he will down funding platform, this money must now be as Microsoft CEO within the next 12 returned to the backers, so Canonical hasn’t months. Hyperbole aside, under his actually raised a single penny. stewardship the company has What it has raised, however, is a ton of media continued to make loads of money. coverage. The Sun, the Guardian, the BBC, the Well done Steve! Independent, Wired and several other outlets No $32m for the Ubuntu Edge, but loads of have been falling over themselves to write about publicity for the fight against Android and Apple.

GAMES

More guns on Linux Sweden Microsoft ©

Two top titles are coming our way. credit Photo All together now: “Developers! e’re very soon to get two more Developers! Developers! excellent games, both featuring guns Developers! Developers!” and shooting things. Wargame: Airland W Our Bulgarian correspondent Battle, a real-time strategy game set in the Cold tells us that LG’s head of War years of 1975-85, is at the time of writing in mobile for that country has beta for Linux and OS X at a tasty 50% discount. revealed that the company intends The multiplayer mode is cross platform, so early to enter the Firefox OS market, and adopters will be able to team up with gamers could do so as early as the first playing on the PC version. What’s more, the beta quarter of 2014. will automatically upgrade to the full version when Google has released the it gets its official release. binary code and OS disk Also available is the remake of The Chaos images for its latest Nexus 7 Engine, the classic top-down shoot-’em-up that Android operating system. If the earned much praise when it was released for the company follows its usual pattern, Amiga in 1993. The original will be preserved the source code and SDK will follow – just in a form ported to Linux, OS X and in a few weeks. Windows – and there will also be an enhanced The Chaos Engine is set in a Victorian England version, for extra steampunk gun-based fun. controlled by a rogue Babbage-like scientist.

www.tuxradar.com November 2013 LXF176 7 Newsdesk

Comment MOBILE Gregor Samsung violates GPL, then fixes it Mendel Company quick to comply with licensing conditions.

Michael Meeks amsung, the world-leading question under the GPL]. We take our mobile device manufacturer responsibility to abide by open source This month’s Sresponsible for putting Linux licences seriously and recognise the highlight was a into the hands of millions in the shape value that open source software brings.” of the Android mobile OS, has violated As well it might: having overtaken trip to the the GPL by incorporating sections of Apple, Samsung is the world’s largest Gnome Users GPL code into some of its software manufacturer of mobile phones, thanks And Developers European Conference aimed at working with Microsoft’s largely to Android, Linux – and the GPL. (GUADEC) in the Czech Republic. Amusingly ExFAT filesystem. this was preceded by some advanced negative Soon after the infringement was speculation about this being “the last pointed out, by a hacker calling herself GUADEC”. What I saw in Brno convinced me rxrz, Samsung put itself in contact with the Software Freedom Conservancy that this is not so, indeed I was thrilled to see Group, which worked together with the community unfazed by such chatter. Samsung to ensure that it was One of the big moves in Gnome this year is complying with the GPL. the drive to use the Wayland display server in Ibrahim Haddad, head of open place of X11. The hope is that this will provide a source innovation at Samsung, told step change in quality of rendering: every frame Wired that “After discussing with will be perfect. It should also significantly multiple open source organisations and improve graphics extensibility and drop a lot of getting their thoughts on this matter, The GPL obliges those who use it to we proceeded [to release the code in share the improvements they make. baggage from the long and twisted past of X11. The developers committed to shipping Gnome on Wayland in distributions early next year. SOFTWARE FREEDOM Along those lines, it was also great to see the recent work that Collabora did to make Wayland’s Weston compositor work nicely on Microsoft, Nokia cry the Raspberry Pi. That work, exploiting the built-in compositing hardware of the device, foul over Android gives an extremely smooth and slick window management experience even on that low- Companies complain to EU over unfair pricing. power device. I was particularly pleased to catch up with the airSearch.org, an organisation team behind the Evolution personal information devoted to protecting tech manager and see the great work they’ve done Fminnows from being dominated by Google, has issued a complaint to fixing performance and scalability issues, and the European Commission over what it also to compare notes on cleaning the internals sees as ‘predatory pricing’ of the free of another large codebase. Android mobile OS. The wording of the Finally there was a lot of excitement around complaint makes it clear that it’s the systemd, and the plans for generic Linux fact that Android is free that is the really application containment. This has the potential objectionable thing about it. “Google’s predatory distribution of Anyone can use Android for free – for bundling self-contained desktop apps and including Nokia, which rejected it. managing them cross-distribution in a much Android at below-cost makes it difficult for other providers of operating more intuitive way. systems to recoup investments in FairSearch is plainly unsuitable to It is a year of great change and improvement competing with Google’s dominant describe a market where there is no in the Linux desktop space. The board is set, mobile platform,” the complaint says. price, and a product that, being free the pieces are moving and I’m excited about There’s nothing wrong with free software, can literally be taken by where things are heading. though, as the Free Software anybody and ‘forked’.” Foundation Europe pointed out in an FairSearch represents 17 companies

Michael is a pseudo-engineer, semi-colon lover, open letter to the commission: “The with a closed-source business model, SUSE LibreOffice hacker and amateur pundit. predatory pricing theory proposed by including Oracle, Microsoft and Nokia.

8 LXF176 November 2013 www.linuxformat.com

Newsdesk

Comment Hitting the mirrors In search What’s behind the free software sofa? of identity MEDIA PLAYER If you pine for the lost days of Tony Chapman getting an album home on the bus, then sitting reading the sleeve One thing notes as you obsessively listen to that gets my your new purchase for the first goat is the time, is for you. This music player, which has just reached constant version 2.8, comes with more bells need for an organisation, particularly within and whistles than any other music Amarok 2.8 includes work by four technology, to have a ‘brand image’. While I player on the Linux platform, Google Summer of Code students. agree that it’s important to have an identity, including lyrics, biographies and the issue here is that everyone is trying to even a music quiz. better support for themes other than create what they interpret as the new Google New for 2.8 is a smooth fade- KDE’s standard grey, and a better or Facebook. Everyone has a football table, out feature when pausing music, MusicBrainz tagger. everyone has table tennis and everyone waxes lyrical about how casual, creative, SOLUS OS 2 social and ‘cool’ they are – it turns into a SolusOS, the Debian-based distro parody of itself where everyone is trying to be that aims to provide a pure version of so different they are actually all the same! Linux, with applications as close as The main gripe I have about this is the possible to their upstream packages, number of companies I see that are getting it is getting close to its version 2 so wrong and rather than fulfilling their release. Only this time, it’s all being built from scratch rather than based objective of attracting top talent, it is actually on Debian, which makes the jump being detrimental to the process and they are from version 1.0 to 2.0 rather more SolusOS: “a genuine attempt to actually turning people away. Interviews and significant than usual. bring back the true Gnome”… candidate attraction within the technology SolusOS 2 is still in alpha testing sector is now a two-way street and if you’re at the time of writing, but when it’s 4.10 desktop at the heart of a getting the fundamental culture of your ready you can expect to find an Xfce lightweight, easy-to-use desktop OS. company wrong, you’re going to struggle. People get paid thousands to create brand OFFICE SUITE image, but the fundamentals are simple: follow the basics, be true to yourselves and 2.7 has burst forth on to the over your meticulously assembled your traditional core values. You don’t need to internet, with a release that provides desktop. New for version 2.7 comes a come up with buzzwords to describe how KDE users with an integrated office new toolbox, which is used in Words suite that should fit with all your and Sheets (the word processor and vibrant you are in some naff promotional careful customisation – unlike spreadsheet respectively), better material, you’re better off spending your time AbiWord, LibreOffice and the other export options and improved CSV and resources creating a vibrant atmosphere. GTK applications that ride roughshod data import, among other goodies. Don’t get me wrong: I think it’s great building an interesting and fun working environment, however, we can achieve this LINUX DISTRO in so many other ways, mainly by creating Like Debian? Like Gnome 3? Then great challenges and cutting-edge technology you’ll like Parsix 5.0, which aims to to work with. People aren’t stupid: if the job graft the latest stable version of the isn’t very interesting or challenging, they will Gnome desktop on to the Debian testing branch to create a distro not join just because there is a fridge full of that looks great and benefits from food and employees dress up as the huge package repositories of superheroes for a foosball competition the rigorously free software- every second Thursday. compliant Debian. Gnome 3.8.13, LibreOffice 3.5.4 and more, but Because it’s based on Debian, Tony is a leading Linux and open source recruiter Parsix uses Iceweasel, not Firefox. at specialist agency LinuxRecruit. really it’s all about the polish. www.linuxrecruit.co.uk

10 LXF176 November 2013 www.linuxformat.com Linux user groups United Linux! The intrepid Les Pounder brings you the latest community and LUG news. Find and join an LUG Barcamp Blackpool 2013

Bristol & Bath LUG 12.30pm at the Knights A big open source celebration by the sea. Templar on the fourth Saturday every month, details on the website. he fifth Barcamp Blackpool ‘Minecraft is Programming’, which www.bristol.lug.org.uk took place on 27 July at the showed great promise from someone Greater London LUG Details on the website. T Norbreck Castle Hotel, only 12 years old. Martin Cunningham www.gllug.org.uk Blackpool. This year’s event was talked about Flickr’s redesign, and there extremely well attended, with a record was a panel discussion on the recent Hull LUG 8pm at Hartleys Bar, Newland Ave, first turnout of 180 attendees (of whom news stories about UK internet filtering. Tuesday every month, details on the website. http://hulllug.org 20% were female). Video from the event is being edited This year saw the well established and released via the official website Lincoln LUG Third Wednesday of the month at Barcamp take on a very ‘Makerfaire’ http://barcampblackpool.com. 7pm, Lincoln Bowl, Lincoln, LN4 1EF. feel, offering much more than its usual The team behind the event would http://lincoln.lug.org.uk three tracks of unconference talks. like to thank AltBlackpool, Aunty Social, Manchester Hackspace Open night is every This time there were stalls run by local Cefn Hoile, Manchester Girl Geeks, Wednesday each week, details on the website. not-for-profit groups, hackspaces, Linux WomenTech, Blackpool Roller Derby, http://hacman.org.uk user groups, lightning talks (where and all of its sponsors. LXF Manchester Raspberry Jam Runs monthly delegates get to pitch at Madlab, details on the website. themselves to potential http://madlab.org.uk/content/ employers) and an in-house manchester-raspberry-jam-3 Raspberry Jam, run by teams from Preston and Manchester. Nottingham LUG 7.30pm, every first and third All this activity didn’t week, details on the website. http://nottingham.lug.org.uk detract from the quality of the speakers. We were very lucky Preston Hackspace Every two weeks on a to have the excellent Tuesday at The Continental, Preston. Freakyclown speak on the day, http://prestonhackspace.org.uk in an interesting talk that Les Pounder Les Tyneside LUG From 12pm, first Saturday of the focused on how much month at the Discovery Museum, Newcastle. information we disclose on the Surrey & Hampshire Hackspace Third internet, and what the Tuesday of the month, details on the website. authorities do to track our credit: Photo http://sh-hackspace.org.uk movements. Other great talks Barcamp Blackpool saw a record turnout and were Marcus Ayrton on took on a more Makerfaire vibe this year. Community news

techniques; and where Pycon UK Battle Hack practitioners of creative and Returning for another year, Now this is rather stimulating: technical disciplines can come Pycon UK aims to continue its hacking apps together for good together to learn some pretty skilful blend of learning with causes over 24 hours. Initially, amazing stuff from each other. networking and socialising. this will take place at a national Over the Air is also about Whether you are new to level, then if your team is Over the Air recognising software Python or an established expert, successful in your own country, This is an event that defies easy development as a creative there will be lots for you to learn you move on to challenge other description, but we’re going to discipline and, finally, it’s a space at this great event running from teams from around the globe. attempt one right now: it’s a where you can build cool stuff 20–23 September. The event will Only one team can be the winner sleep-over; a two-day party; a and show it off to an appreciative be hosted in Coventry and has an and bag $100,000! If this sounds celebration of creativity; a festival crowd. You can find out more extensive list of speakers, about like your thing, head over to the of all things mobile; a place about this unusual gathering whom you can find more details website and assemble your where attendees can learn about from the official website. at the official website. team, ready for 12 October 2013. technologies, trends and http://overtheair.org/blog www.pyconuk.org http://battlehack.org

www.tuxradar.com November 2013 LXF176 11 Mailserver

Write to us at Linux Format, Future Publishing, 30 Monmouth Street, Bath BA1 2BW or [email protected]

Nice guy, Guy Hi guys, Letter of the month First, I can confirm for you that CCL Online still sells PCs without an OS. Its customer support is The forgotten fork excellent and they are my first port of call for all PC hardware. found your article on the different Graham says: Trinity is indeed a great example of Second, I noticed you were desktops to be excellent and showed me one of the defining principles of free software: if you talking about the new Linux two that I had not come across before: don’t like the way that your favourite project is filesystems in the latest issue I Xmonad and Razor-. However, there going, you can always fork it yourself and make it [LXF175, Tutorials, p78]. I do not was a glaring omission in your coverage of head the direction that you want it to go. Trinity is a need any of the advanced unusual choices of desktop environments. much lighter desktop environment than KDE 4 or features at the moment and the You missed out on Trinity, the fork of KDE Gnome 3, is easy to use and customise, and has only thing in which I am 3.5. Personally, I cannot get to grips with KDE great applications – just like KDE 3. interested is performance. 4 and have always found Gnome a little sparse I presently use ext4 on all my and inflexible for my own tastes. Even more so (>10) Linux installs, but would now with Gnome 3. drop it in a flash if another were With Trinity I have a desktop that suits me much faster. Please try not to and allows me to get on without getting in the leave performance out of things way of my work. The website for Trinity is if at all possible. www.trinitydesktop.org where all the steps Guy needed to install are carefully set out, at least Andrew says: Thanks Guy. And for mainstream distros. The site is regularly CCL is in the UK too, which makes updated and work continues on Trinity. a nice change from the usual US Trinity works and has saved me much tearing or Eurozone-only nonsense. of hair in trying to get to grips with the modern touch-oriented desktops currently The price of Pi being offered. Dear Linux Format team, Andrew Street Most articles on the Raspberry Pi always seem to mention it’s £30 [see LXF174’s, NOOBS, The Pi is only £30, but as part of my learning how to presto, I have a working system, Reviews, p21]. While this might peripherals may increase your write programs using Python. total cost £170. While I might not seem like a cheap way of total cost of ownership. So my RPi came with an SD have needed it, I also splashed learning about computers I have card, power supply, Wi-Fi dongle out on a VESA mount and heat to disagree. and HDMI–VGA cable (this cable sink. This is a hobby for me after I bought an RPi recently as I cost more than the RPi). I had an all and what else would I spend thought I’d play with this device old wireless keyboard and my money on, but I don’t see it mouse kicking around so I didn’t as a cheap way to learn about have to buy those, but I had just computers, unless you plan to spent £82. So what to do about work on a computer-controlled a monitor? Yes, I could use my device, perhaps. TV, but I didn’t want to keep Galen plugging it in and out again as I’d Andrew says: Yes, but if you’re in switched to using my DVD player the market for an RPi it’s a fair and a MK802 Android PC for assumption that you’ll have a viewing Netflix. So for another bunch of cables, a monitor and a £65 I bought a monitor. keyboard hanging about anyway. When plugging the system And if you don’t, the £30 price together, the Wi-Fi didn’t seem point is still accurate, because to work and the mouse was that’s the cost of replacing the Pi if sometimes a bit erratic. I figured you manage to fry it. The idea is to out that it might be a power convince parents and schools that supply problem, so I bought a they can afford to let kids mess powered USB hub (£23). Hey about with these things and get as

12 LXF176 November 2013 www.linuxformat.com Mailserver

Reference Wallchart and, among effects of inflation, it makes no other useful information, it gives sense to keep those extra pennies the Linux Format on-sale dates in cash – far better to invest it in for 2005. Maybe an update other asset classes, such as would be a good idea but I shall laptops, food, books and a not need on-sale dates as I now subscription to Linux Format. have a subscription. I started with Cobol and C Con blocking but although I have looked at I am not sure I beat the Good other languages, I have never Doctor’s record of keeping a con mastered C++ and welcome the artist on the phone for 24 tutorials you’re running. minutes but it was a long time. Lionel Goodwin He kept telling me that a file Graham says: If we were to do essential for XP to work properly something similar nowadays we’d was in fact a virus, and that I include the print deadline, which is needed to take urgent corrective when the subscribers get access action. I kept replying that there to the PDFs of the latest issue. was no such file present (it was). That’s right: subscribers can read After he had me reboot several the latest issue of Linux Format on times (I only pretended to do their shiny tablet devices before this) his frustration levels were the ink has even dried on the pleasingly high… paper copy. He eventually told me that my machine was so badly Flickin’ annoying infected that it was hiding files Canonical’s phone that’s also a PC, the Ubuntu Edge, may have Can we call them ‘films’ and not from me. I replied by saying broken the record for the most money pledged for a crowdfunded ‘movies’ please? something like “I don’t project at $12,809,906, but failed to hit its target of $32m. Tnx, Guy (English pedant). understand how XP can work hands on-as possible, unlike when them since their start. Ubuntu Andrew says: Sure thing buddy, without that file because it’s a I were a lad and we got half an has changed direction, and it is a that’s A-OK by us guys. system file”. It went quiet. I then hour each of Granny’s Garden on direction that most of the ‘old said I was happy to have kept a BBC rationed across eight guys’ don’t care to follow, but Mr Budget tech him busy for so long because it weeks (this was in 1992). Shuttleworth has decided that As I have been a long-time user at least prevented him from the future is them, not us, and of Linux I occasionally forget one trying to rip somebody else off. Has Ubuntu lost it? he is probably right. of the reasons why I am such a The other end went dead. A very As a user of Ubuntu since Allen Bradley big fan: that ‘old’ but very satisfying interaction. version 5.10 (Breezy Badger), Andrew says: By definition, the useable computers can be kept Simon Shaw, Brunel University, I have watched as Ubuntu and future is not old guys, and it never in service long after Windows Uxbridge Linux in general have moved has been. There are many more (and hardware manufactures) Graham says: Excellent work, from being a curiosity to people who have not tried Linux would have you believe they are Simon. It’s sickening to think of becoming a very useful, than there are people who have, obsolete. When I dropped my these people fleecing the tech- standalone operating system. so it’s sensible of Ubuntu to try nine-year-old Dell Inspiron averse public. It’s even more I have a backup copy of Windows something new in order to attract laptop I looked around for a sickening to think that the licence XP on one of my computers, but new users. If Ubuntu loses us and sensible replacement and under which XP is distributed I almost never use it. Linux is gains market share, it wins, and if spotted on eBay a 2005 IBM hampers those who want to learn that good! we switch to Debian or Mint, we Lenovo R60e at £38 including about how their operating system It was with a great deal of win, so everybody wins. postage. The listing stated that it works. By keeping its users dismay that I watched Ubuntu The one thing that’s maybe “would suit a competent ignorant Microsoft is making life change with the introduction of sub-winning is that we, the old technician as there is no much easier for con artists to Unity. I tried to use it and like it, users, have some genuinely useful operating system installed”! bamboozle the public. Well done but I just couldn’t see the point. criticisms for Ubuntu (Unity’s Of course, we all know how easy for wasting these criminals’ time Navigating and finding what I initial clunkiness; and integrated it is to install Linux these days and saving someone else from wanted with Gnome 2 was Amazon search is not the best and now I have it working being ripped off. intuitive and straightforward, way to make users feel that their perfectly using Minino LXDE as whereas with Unity it was more a privacy is valued). In the clamour an operating system. Any cash I Where’s my LXF? case of guessing, hoping and to denounce Ubuntu as evil/ saved can be used on the things I have considered a subscription needlessly clicking. I hung onto arrogant/whatever, these useful I really enjoy… other laptops; to Linux Format but my Ubuntu and Gnome 2 as long as criticisms are being lost. eating out; books; Linux Format. experience ordering single I could, and finally left for Mint Kevin Garner issues has kept me from it. and Debian, which have all of Writing on the wall Andrew says: Saving money is The latest instance (and yes Ubuntu’s good points with a Three days ago, while looking for excellent. But with the Fed, ECB there are more) is that I ordered usable GUI. But has Ubuntu lost another lost treasure, I came and Bank of England’s liquidity the August 2013 issue roughly it? No, I don’t think so. It has lost across a poster you gave away programmes keeping interest 35 days ago and have yet to see us, the folks that have followed some time ago. It is Linux Quick rates so low, and the pernicious the issue. Since then you have

www.tuxradar.com November 2013 LXF176 13 Mailserver LXF173 Debian 7 Mageia 3 Sabayon Google mail servers, so Google using Ardour 2 on AVLinux in my lacklustre, even though it’s LXF

August 2013 would still have a copy of the home studio for years but am Linux, but it doesn’t feel like

I don’t have a great emails and be able to read them now on Ardour 3 on Ubuntu Linux, if you know what I mean. ideological commitment

Issue 173 to giving away my IP #1 for Free Software Eben Upton is pragmatic – using Roundcube would not do Studio. Here comes a blatant What I’m trying to say is, I like Debian 7

SIGN OUT Break free from Google Escape any more for your privacy than a plug for my blog. In the article the idea of a Linux desktop in

Inside the EFF standard IMAP or POP client. where I interview Paul Davies he my phone scaled down, to fit the Mir

Raspbian Have I missed something here? mentions that it would be good screen, and features to suit… And Facebook Twitter Flickr and more! Lisp

Coming soon in KDE Liberate your personal data from the companies that want to steal your Thanks for your help. to have some basic video I for one am looking forward emails, photos and friends and take over your life.

Ruby on Rails Google Search I’m getting out of here Matthew Cobley tutorials and, although I’m not a to something new, fresh and

User management Debian 7.0 LibreOffice tips Added style for your docs Neil says: You are right, passing great expert, I’ve decided to step free. How awesome would it be Find out why 8 out of 10 sysadmins* use IS YOUR this distro FREE DVD

Hamstercam MISSING? Speak to your Also inside… newsagent mail through Google to your up. I’m publishing them on to see Ubuntu, Fedora or CentOS now! KDE 5.0

Eben Upton Mir What’s coming in the latest Display servers go in to paradigm-smashing desktop p50 orbit with Ubuntu’s Wayland replacement *This is a made-up statistic Inside the EFF webmail client doesn’t affect the http://osmtutorial.blogspot. pop up on your phone or Linux Discover the data superheroes of programming excellence Optimise your protecting us from Big Data p46 site’s performance Practise practically System administration privacy of that mail, but if you co.uk. Currently, I’ve posted TV display? Also to have one perfect parentheses End the swap space argument forever p56

Printed in the UK Raspberry Pi Admin Data handling Raspbian Manage data MariaDB Install a custom Debian Control puny users like Scale out a database have a Gmail address people will three with three more waiting for distro work across all platforms LXF173 AUGUST 2013 flavour designed for the Pi wanton boys play with flies for speed and safety TuxRadar.com PRINTED IN THE UK £6.49 use it so you still need to check publication. I’d love to get some would make developers very Escaping Google will involve your Gmail account. Pulling the feedback or other people (like happy. If Ubuntu succeeds, it telling friends you’ve left Gmail. mail into Roundcube means you Paul Collins who wrote the letter would make for an interesting can do all of this in one place, in LXF174, p14) to contribute. future that I hope will make already come out with the next it also means you can send replies Matt Burton, Nottingham others re-think their phone issue. Tell me why I would want a using your de-Googled address, Graham says: I’d love to turn the platform and focus on making subscription that could deliver gradually weaning others off whole magazine in to an audio better products. issues one month late? I would sending mail to that address. fest, but I fear that the rest of the Mark Carloni like to know why it takes so long Remember, Google will read the world would lose interest quickly. Graham says: “Making a better to get an issue to the US? emails sent to your account when product, rather than beating the Steve Cox they arrive, whether you read On Ubuntu’s side competition”. That’s the key Andrew says: I’ve no idea why this them or not, so to maintain After reading Has Ubuntu Lost phrase. An open development should be the case, but I’ve asked privacy you need people to use It? [LXF172, p42], I’m on platform would kickstart our subscriptions person whether your other address. Ubuntu’s side. The first time I competition on phones, meaning he has any ideas. Until we get any heard about what it was doing I that there would no longer be any answers though, can I ask: do any Apps for newbies liked the idea. I for one think incentive to drip-feed product of our other readers in America Windows 8 gave me the push to there’s room for Ubuntu. improvements out slowly: the race and overseas have this problem? try Linux and so far I have stuck I have always wanted Linux would really be on. That’s why with Ubuntu. I wish there was a on my phone, and have done for we’re crossing our fingers and Not escaped? list somewhere that would tell years. Android to me is kind of wishing that Ubuntu succeeds. LXF I’m a relative newcomer to Linux me what programs Linux has Format and love the magazine, that are replacements for but couldn’t get my head around Windows programs. I have spent something in your Escape lots of time so far researching Google piece [LXF173, p34]. and looking for programs. With the webmail section you Steve Cox mentioned that Google store Andrew says: That’s a good idea. emails in plain text and read We’ll make it happen soon, and them to provide advertising, and put it up on www.tuxradar.com you suggested Roundcube as a so that the whole world can webmail client, which you could benefit. Thanks Steve! then use in conjunction with your existing Google account. Adoring Ardour Surely in this situation all email I too enjoyed the overview of received to your Gmail account Ardour 3 and would love more There are free software alternatives for most proprietary applications, will still be received by the Linux pro-audio stuff. I’ve been including LibreOffice, which is a replacement for Microsoft Office.

[email protected]

14 LXF176 November 2013 www.linuxformat.com Mailserver

If you must recite prose and poems the words you use should be your own. Poets’ corner Don’t plagiarise or take on loan…

What a load of rap I’ve written a rap all about Linux and free software for yo at LXF. You will a load need to imagine a funky syncopated beat while reading it out aloud to get the full effect. of rap!

I’m an angry PC user and I’m kicking up a FOSS, so forget proprietary software, forget Apple, forget DOS,

It’s time to see the light and to throw off all your OS chains, If you want to keep your freedom then you’d better make a change.

I’m a Linux geek, it’s the baddest in the game, you’ll be runnin’ to your mamma

when I apt-get install pain.

I’m a Linux geek, and everybody knows, in a universe that has no walls then who needs Gates and Windows?

Ridin’ in the back seat with my homie Richard Stallman, seein’ closed source projects which we think is quite appallin’, We have it on good authority that Richard Stallman Really when you look at it and all is quite likes the Public Enemy track that Channel 4 used said and done, restricted boot’s a fallacy in its Paralympics coverage. and DRM’s no fun. how we do it, Wine is not an emulator and I’m a Linux geek, Apple and MS Windows are all evil, GNU’s not Unix! and my statement don’t you see? They don’t want to help you is affirmative, Wake up, people, out, they’re just taking your money, Your biggest problem is that you don’t and use an OS that’s alternative! get a voice, my biggest problem is that I have Thanks, and I love the magazine! :-) I’m in a world of my own and I’m getting too much choice! Gary Lewis Cheetham it for free, and it’s ethical, hackable, and respects my privacy. Apple fans, really, how could you be so naive? Andrew says: Bravo, hip hip and, dare I say You’ve all been led astray by that fat cat it, hooray! While I’m more of a Shakespeare/ I’m Linux geek, you don’t know the Steve (May he rest in peace). Morrissey man myself I can appreciate the mess you’re in, while we’re beatin’ all your talent that has gone into this, especially the trademarks with recursive acronyms. I’m a Linux geek, time to open up your eyes, attempt to find a rhyme for ‘recursive Download yourself Ubuntu or get a acronym’. Nice work. Now, can any I’m a Linux geek, and if you don’t know Raspberry Pi. troubadours out there top Gary’s effort? LXF

Write to us

Do you have a burning Linux- related issue you want to discuss? Do you simply want to hail Ben’s awesomeness or bemoan the distinct lack of The Lord of the Rings references in the magazine these days? Write to us at Linux Format, Future Publishing, 30 Monmouth Street, Bath BA1 2BW, or [email protected].

www.tuxradar.com November 2013 LXF176 15

All the latest software and hardware reviewed and rated by our experts

BEN EVERARD has been developing Raspberry Pies. That’s not a typo. Our pick of this month’s releases:

OS 4 ...... 18 Firefox vs Chrome .. 20 Packed full of apps, this distro aims They’re the two most popular web DRM to be the “most user-friendly OS on browsers on Linux. One is open the planet”. That’s quite an source, the other is based on open ambitious goal, so we put it to the source. Which one is better? ike many Britons of my test to see how it stacks up. Spoiler generation, I did much of my Alert: Amiga fans will be impressed. Live Cam ...... 22 Learly computing on a BBC Seduced by the promise of a Micro and later on an Acorn PC-BSD 9.2 ...... 19 plug-and-play wireless webcam Archimedes. For their time, they were It promises to make BSD easy to with Linux support, we installed the great machines: user-friendly, at least use but can it really be so? Can an new offering from Devolo. The OS from the other family of free results, though, weren’t quite what up to a point, and they exposed my We may be called Linux Unix-alikes come even close to our we were expecting… young mind to the command line in Format, but we do like to beloved Linux in this respect? A the form of BBC BASIC. few years ago such a claim would Books ...... 23 stray to BSDs. seem laughable, but a lot has Programming could be killing you! changed. We ditched our Tux Find out how to stay alive in The Eating Pi costumes, donned Beastie Healthy Programmer. Also, discover Fast-forward two decades and we’re disguises and snuck over to the a Raspberry Pi Cookbook with a now trying to push Raspberry Pis – other side to investigate. little useful culinary advice. the spiritual and architectural descendants of BBC computers – into Firefox Chrome schools. The differences, though, are phenomenal. Yesterday morning, I knocked up a clone of the classic game Tron in a couple of hours, yet the complexity of the software is probably on a par with my A-level computing coursework (the last program I wrote on an Acorn before switching to Linux), which took me months to write. Of course, I’m a better programmer now, but it’s also due to the mind-boggling ease of Python and its associated modules. By the people, for the people... funded Is Chrome’s popularity justified? We put Code that took days to write before by Google. Google’s other browser to the test. can now be done in a single line, if you import the right things. And it’s not just programming. There’s an ever-increasing array of peripherals for the Pi that allow you to Roundup: Collection managers p26 convert it into a physical computing device, something that’s been a bit tricky on a regular PC. Take a look at Data Crow GCStar the feature on page 46 for a few examples – they’re rapidly making hardware creation as simple as software programming. Raspberry Pis aren’t the future. They’re just neat computing devices. It’s the kids that are now learning to LibreOffice Base Music use them that will shape the Stuff is great. It helps you do technology of tomorrow. With this things. However, it can be hard much power at their fingertips, I can’t to keep track of. We round up wait to see what they come up with. five applications that help you [email protected] manage your stuff – whatever that stuff may be.

www.tuxradar.com November 2013 LXF176 17 Reviews Linux distribution OS/4 OpenLinux This Ubuntu derivative is packed with apps and aimed at ease-of-use, but as Les Pounder discovers, it might be trying to do a bit too much.

buntu, itself a derivative of the In brief... upstream Debian operating U system, has long enjoyed a Ubuntu-based reputation of providing a base for other distribution with a derivative distributions. This has been vast choice of installed software. more prevalent recently as Canonical’s Also consider: switch to Unity hasn’t been widely PCLinuxOS and accepted by stalwart FOSS advocates. Linux Mint. Enter OS/4 OpenLinux 13.6, an Ubuntu-based distro that aims to be “the most user-friendly operating system on the planet”. For instance, it comes with all the necessary codecs to play proprietary audio and video files, which is a real bonus for new and inexperienced users. We tested it on a Lenovo x61, and it detected the Wi-Fi with no issues, even if it did generate a crash report when it couldn’t find a This version of OS/4 OpenLinux can run on 512MB of RAM – though we’re not Bluetooth dongle. sure what sort of Steam performance a spec like that would give you. OS/4 comes with plenty of software pre-installed including classics such as is reflected in the size of the ISO file but you need a little knowhow to make Firefox, Gimp and AbiWord, and some (1.7GB). One notable omission, however, the emulator work properly. Again, it really exceptional choices, such as VLC, is LibreOffice. OS/4 has chosen to use made us wonder what it’s doing here. Blender and Steam. Yes, you read AbiWord and Gnumeric for word The question then is: who is OS/4 correctly, the Steam client is installed as processing and spreadsheets. Both really aimed at? On one hand, it standard, so you can get up and gaming applications are light and provide provides a lot of software out of the box, quickly (as long as you have the enough functionality for the end user, but on the other its choice of package required hardware, of course). but if you really need LibreOffice, then manager isn’t a gentle introduction to This is where OS/4 is different to you can use the package manager to software management, and to top it off other Ubuntu-based distros: it provides install it, which is where OS/4 becomes it plops down Amiga emulation into the everything you need to game, surf and less user-friendly. middle, basically because it can. work out of the box. Normally with We can’t really recommend this Ubuntu-based distros, there’s just a Packed with apps distro to new users, because of its change of window manager and a few Ubuntu has long since dropped choice of package manager. But OS/4 changes to the file manager and a Synaptic as its default package OpenLinux will appeal to established choice of audio/video player. With OS/4 manager in favour of Software Centre, users who want a quick setup and there’s a great choice of software, which as it is designed to make it as easy as access to the vast amount of software possible to find, add and remove in the Ubuntu repositories. LXF software. Although OS/4’s use of the old package manager reflects its intention to move back to Debian, Verdict Synaptic is an odd choice for a distro that aims to be the “most user-friendly”. OS/4 OpenLinux 13.6 This isn’t quite as quirky a decision Developer PC OpenSystems LLC Web www.os4online.com as another app choice: OS/4 comes Licence Various free software licences with the FS-UAE Amiga emulator pre- Features 7/10 installed. In isolation this might seem Performance 8/10 like a strange decision, but distros are Ease of use 7/10 made by mere mortals and many of Documentation 8/10 OS/4 team have strong ties to the Not as easy as it claims, but good Amiga community. While OS/4 isn’t an for mid-level Linux users, who want operating system for Amiga computers, a working machine quickly. it does provide the resources for OS/4 ships with FS-UAE, an Amiga emulator, and the enthusiasts to emulate their favourite Rating 7/10 AROS subsystem, which aims to mimic AmigaOS 3.1. machine. FS-UAE is great for doing that,

18 LXF174 November 2013 www.linuxformat.com BSD operating system Reviews PC-BSD 9.2 Can BSD – the operating system that strikes fear into the hearts of many Linux users – ever be easy to use? Ben Everard investigates…

SD is often seen as Linux’s In brief... scarier cousin. Its name is Bmentioned in hushed tones and A user-friendly its users are thought of as elite desktop-oriented programmers and über sysadmins. BSD OS. Also consider: However, when we went to the PC-BSD FreeBSD, NetBSD, website to download the latest ISO, we OpenBSD, saw the main screenshot featured DragonflyBSD. Facebook and a YouTube video of funny cats. Not exactly leet browsing material. Perhaps it is for mere mortals after all. PC-BSD aims to be user-friendly, like a BSD equivalent of Linux Mint. Of course, BSDs aren’t like Linux distros because they don’t all share kernel – though their features are broadly similar, the main projects all maintain their own. You could perhaps think of PC-BSD, though, as a distro of FreeBSD. Installation couldn’t have been easier: just select Desktop or Server It may carry the cute exterior of KDE (pun intended), but underneath beats and set it to work. Once it’s done, the the heart of a BSD. system walks you through creating a user and you’re done. Frankly, a few but GUI-loving users needn’t be afraid. technical gap between the two systems popular Linux distros could learn a thing There’s also AppCafe which is a fully is closing. At the same time, though, or two about user-friendly installation graphical software installation that’s some of the BSDs (especially PC-BSD) one of the best we’ve come across. have become easier to use, closing the “PC-BSD aims to be There’s only about 1,100 apps here – game on Linux in that respect. we say only because there’s almost Unless you have an ideological user-friendly, like a BSD 70,000 on the Ubuntu Software Centre preference for the BSD licence over the – but you should find software for most GPL, it’s hard to give you a specific version of Linux Mint.” common tasks. There were a few reason to give BSD a try – but we highly surprises, like Apache OpenOffice recommend that you take it for a spin from PC-BSD. The install gives you a instead of the more popular LibreOffice anyway. Not because of any great KDE desktop, though other (or even Calligra Suite given the OS’s technical difference, but because it environments are available. The only predilection for KDE). As we said, gives you another view of a free slight blip was a warning message there’s software to suit most tasks, but Unix-like OS – and it’s easy enough to telling us that we had less than 50GB of you don’t have as much choice as you whip up in a virtual machine or on a hard drive space. This seemed a little may be used to. You still have the option spare computer. LXF excessive, given that the install only of installing open source software the took up 7.2GB, and a message like this old fashioned way, and most Linux might cause people to worry that the software should compile on BSD. Verdict install will fail. We ignored the warning and it worked fine on our 20GB disk. On files PC-BSD 9.2 If it weren’t for the logo on the For years, the biggest difference Developer: PC-BSD Software Web: www.pcbsd.org desktop, many Linux users wouldn’t between BSD and Linux has been the Licence: Various, but the core is BSD realise they weren’t using a penguin- way they deal with filesystems. BSD’s Features 9/10 flavoured OS. The range of apps ZFS has long been the envy of Linux Performance 9/10 installed by default seems a little light, sysadmins. This version of PC-BSD Ease of use 10/10 though, considering the 3.4GB comes with lpresnap which simplifies Documentation 8/10 download. There’s no office suite, the process of taking ZFS snapshots, Without a doubt it’s the most is the only web browser, and though at the moment it’s only available simple introduction to the often there’s little else of interest – you have on the command line. A graphical confusing world of BSD. to install everything you need. version is promised for the next version. PC-BSD comes with the famous ZFS now works on Linux, and BTRFS Rating 9/10 ports package management system, is also starting to be used, so the

www.tuxradar.com November 2013 LXF176 19 Reviews Web browser Firefox vs Chromium As Ubuntu looks all set to dump Firefox, Mayank Sharma wonders whether it’s time we all made the switch to Chromium?

lthough it still isn’t set in stone, In brief... it’s very likely that Google’s A open source Chromium The two most browser will take over Mozilla’s Firefox popular and as the default web browser in Ubuntu feature-rich web browsers. See starting with the 13.10 release. also: Opera and Canonical has explained that the Konqueror. foremost reason for selecting a default browser is the end user experience for a general user. The company doesn’t zero in on a browser based on the number of features that it has compared to the competition but rather the quality and stability of its releases. This makes sense, as both Firefox and Chromium have almost identical support for open internet standards such as HTML 5, CSS 3, ECMAScript 5 and DOM 3 etc. Starting with Chromium 28, the browser now uses the Blink engine instead One difference between the two is of the popular WebKit engine, while Firefox continues to use the Gecko engine. that while both browsers support the NPAPI plugin, only Chromium supports Could it be because of Chromium’s Then there’s Chromium’s address the PPAPI plugin. The plugin is superior performance? Historically, it’s bar, which is called ‘omnibox’ because it developed by Google, and Adobe has been the faster of the two, but of late also doubles up as a search box that announced that it will distribute Linux Firefox has been cutting the flab and can trawl through the web, as well as versions of the Flash player in the future feels as fast as Chromium. your bookmarks and history. The Firefox using this plugin only. Mozilla has said navigation bar, known as the ‘awesome that it has no plans to implement the You say potato, I say… bar’, can also do the same. In fact, the plugin in Firefox. The best way to install the browsers is added advantage of Firefox’s separate If you look at the numbers, Firefox is to rely on your distro’s package search box is that you can change to a still leading in terms of usage. But that manager. All major desktop distros different search engine in one click. can be attributed to the fact that it’s include both browsers either in their The New Tab page of both browsers pre-installed on most Linux distros. official repos or ancillary ones. Firefox is also very similar with subtle The more important trend, however, is has the added advantage of being the differences. Both show thumbnails of that more and more people are going default on the majority of Linux distros. the most visited websites. In Firefox you It’s easy to out of their way to replace their default If you rely on your distro’s package can rearrange the order in which they find settings in browser with something else, most manager you might not be running the appear and also pin a website. In Chromium. notably Chromium. latest stable browser version. In that Chromium, in addition to the new tab case you can download the latest stable page, you can switch to Apps, which release (or bleeding-edge dev builds) lists web apps installed from the web from the browser’s project page itself. store. However, if you take this approach, Talking of app stores, both browsers Firefox, with the convenience of its have their own, although Firefox’s self-contained archives, wins hands Marketplace is young and doesn’t have down over Chromium’s cumbersome as many web apps compared with build process. Chromium’s. Also Firefox houses Chromium thinks of itself as a plugins, themes and extension in a ‘tabbed window manager for the web’ separate add-ons website, while and uses a minimal user interface. Chromium has a unified store. You’ll find That’s fancy talk for removing the menu the popular extensions and plugins in toolbar and clubbing the search box both stores. and the address toolbar. If you hide the Once installed, Firefox web apps are menu toolbar in Firefox, it rolls up all its available from within the Applications functionality inside the Firefox menu menu in the OS as well. However, to and frees up as much screen real-estate launch Chromium apps from your host as Chromium. distro you’ll have to right-click on the

20 LXF176 November 2013 www.linuxformat.com Web browser Reviews

installed web app in the browser and Web apps select the Create Shortcuts options to installed place them on the desktop and the via Firefox’s applications menu of the distro. Marketplace Both browsers have well laid-out and open in chromeless organised Settings sections. Chromium windows just like has a Search Settings box that helps in Chromium. you hunt down embedded settings. For example, if you type ‘password’, it will bring up options to manage passwords as well as the option to clear browsing data and clear saved passwords. Security & privacy One of the most important things you can control from the Settings menu is your privacy. Probably in a bid to impress users paranoid of everything Google, Chromium has more controls for managing privacy than Firefox. multiple devices, but it’s quite a In terms of performance, Chromium With Firefox you can control how the complicated process to set up. By hasn’t slowed down as much as Firefox browser handles the files you download, contrast, setting up sync in Chromium has sped up. A couple of years ago, the the data you enter in forms, your involves simply signing into your Google difference in performance forced the browsing history, how the location bar account. The browser will then Lubuntu distro, which targets older PCs, uses this history to suggest matches, synchronise your bookmarks, to switch to Chromium. Lubuntu has and lets you clear individual cookies. preferences, extensions and other now switched back to Firefox and, You can also select one of the preset browser data with your Google account. generally, Chromium, with its multi- tracking options to either prevent To get these on any other Chromium or process feature, performs better on websites from tracking you or not. Chrome browser simply sign into the newer multi-core PCs with oodles of In addition to these, Chromium can same Google account. Changes on any system resources. block images, JavaScript and pop-ups browser will be replicated on the other One of the reasons for Firefox’s from all or particular websites. You can as well. popularity is that it isn’t tied to a for- also deny websites access to your Both Firefox sync and Chromium will profit corporation like Google. Also webcam and microphone and control encrypt your data before transmission. Firefox runs on more devices and how they use plugins. Both browsers By default, Chromium will encrypt the platforms than Chromium and the also let you adjust cookie and data with your Google account browser has been constantly adding permission settings for a particular credentials but you can optionally new features, albeit, in some cases, specify your own sync passphrase. following Chromium’s lead. It has also “Firefox runs on more Both Firefox and Chromium will keep restarted work on project Electrolysis the encryption keys on your computer. that’s designed to separate processes devices and platforms One notable advantage with Firefox for the browser UI and the web content. Sync is that you can setup your own Even if Canonical switches to than Chromium.” sync server. Chromium, our recommendation is that If you share your computer with you don’t. If Firefox works for you, then website that you are visiting by clicking others, you’ll appreciate Chromium’s there’s no reason to look elsewhere. But on the padlock icon in the address bar. ability to create multiple profiles. Firefox if you’re looking for a change, Both browsers have malware and also has a profile manager but it’s not Chromium has come of age and is a phishing protection. Furthermore, you as usable as Chromium’s. wonderful option. LXF can also prevent Chromium from using other web services to improve your browsing experience, such as by Verdict Verdict resolving navigation errors and using a prediction service to help complete Firefox 23 Chromium 28 searches. When it comes to managing Developer: Mozilla Foundation Developer: The Chromium Project Web: www.firefox.com Web: www.chromium.org passwords, the one major difference Licence: Mozilla Public Licence Licence: Various free software licences between Firefox and Chromium is that Features 9/10 Features 9/10 the former lets you lock all your Performance 8/10 Performance 9/10 passwords by encrypting them with a Ease of use 8/10 Ease of use 9/10 master password. Documentation 9/10 Documentation 9/10 Another feature that both browsers Firefox is the more customisable Chromium feels faster, is better have is brower data synchronisation, browser of the two and has much suited to contemporary systems, and but both go about it differently. You can improved performance. is a good option for everyday users. use Firefox’s sync option to access open tabs, bookmarks, history, Rating8.5/10 Rating 9/10 passwords and preferences across

www.tuxradar.com November 2013 LXF176 21 Reviews Devolo LiveCam Devolo LiveCam Graham Morrison knows that the NSA are terribly busy with all that snooping, so he helps them out by putting an IP webcam in his office.

e have one simple rule; In brief... whatever we’re reviewing W needs to support Linux. A webcam that There was one time when we reviewed connects to the a piece of Windows software that internet through powerline enabled you to restore files from a Linux Ethernet. Also partition, and there have been a few consider: any pieces of cross-platform software that number of use Java. But otherwise: no Tux, no wireless IP review*. The Devolo LiveCam might be webcams. our first exception. Tux is featured in all its publicity material and on the side of the box, but to run the software that comes with it, you run the Windows version through Wine. Devolo is honest about this, but it’s a little surprising. It’s likely you’ve already heard of Devolo and its excellent powerline Ethernet adaptors, which carry the The LiveCam is well designed, and it’s plug ’n’ play, but it’s lacking internet through the power lines in your some geeky features that we think are a requirement. house. It doesn’t take a huge leap of imagination to guess what the LiveCam your adaptors and then on the side of 640x480, and all you can do is connect, package includes; a webcam module the LiveCam. A small LED turns green watch for a while, take a screenshot and that’s designed to work with your to show that your new device has been disconnect. There’s no motion sensing, existing powerline network. accepted. Despite this being all it takes no way of alerting you to an intruder, no There are two ways to buy this to connect the device to the network, time-lapse photography and no movie product: one package that comes with and unlike nearly every other internet- mode. None of the cool stuff you can do a 200 AVduo adaptor bundled with the connected webcam, you can’t do with ZoneMinder, or even a decent NAS webcam (which is the one we were anything further until you install from Synology or Qnap. It is great for sent), and another that includes only another piece of software. watching a sleeping baby, especially the webcam. The first is useful if you with its very effective ring of infrared don’t have an existing powerline Red, red wine LEDs to light up a dark room, and it’s This is where Linux compatibility comes great for making no-fuss connections in, because the file on the end of across the internet, but it’s nowhere “Devolo’s download link Devolo’s download link is the near as useful as a generic Wi-Fi aforementioned Windows executable. webcam, especially when you add the is the aforementioned We’ve mixed feelings about this: on the potential insecurity of relying on Windows executable.” one hand, there are excellent Android Devolo’s protocols for internet access. and iOS apps that do the same job, It’s perfect then as a hamster cam. LXF network, as all you need to do is plug in they’re easy to install, and put the the adaptor close to your router and application in the place you’re most connect that with the included Ethernet likely to use it. On the other, Devolo is Verdict cable. But the price isn’t so attractive barely providing Linux support despite when you look at wireless internet the Tux on the packaging. In the Devolo LiveCam cameras, which can be cheaper. Option company’s defence, installation through Developer: Devolo Web: www.devolo.co.uk two is the best value, as it enables you Wine went painlessly, albeit with broken Price: £89.99/£119.99 (with adaptor) to slot the LiveCam into your network fonts, and despite the webcam being Features 4/10 in places that a wireless network might located at home while we installed the Performance 6/10 not cover, such as your garage or shed. client application in the office. We Ease of use 7/10 This is helped by the sturdy design, two simply connected through the internet Value 5/10 sets of screw positions, and the with the device name and password – If only it operated as a regular IP promise that it will work outdoors – all very easy. enabled webcam, rather than through *We have broken this although it’s not waterproof. What’s worse than a Windows Devolo’s limited software program. golden rule on page Connecting the LiveCam is as executable, however, is that Devolo’s 19 by looking at simple as plugging it in and pressing the own application is severely limited. Rating 5/10 PC-BSD. D’oh! encryption button on the side of one of The maximum resolution provided is

22 LXF176 November 2013 www.linuxformat.com Books Reviews

The Healthy Programmer Ben Everard discovers coders don’t have to be out of condition.

f you ask someone to name a tiny – but in today’s increasingly with spending too much time sat in an dangerous job, the chances are sedentary world, obesity, diabetes, RSI office: problems with posture, eye Ithey’ll answer with something like and other less glamorous dangers stalk strain and diet are covered in as much lion tamer, fireman or astronaut. The us while we program. Unfortunately, detail as those caused by lack of sad truth, though, is that desk-bound unlike the aforementioned lion tamer, a physical activity. jobs are also incredibly dangerous. Not chair and a whip aren’t sufficient to It’s time to cast off the stereotype of in spectacular ways – the chances of protect us from these stealthier risks. the pasty, sickly-looking geek and getting attacked by a large carnivore In The Healthy Programmer, Joe reinvent our community as fine while debugging PHP code are Kutner takes us through a complete specimens of human health. Your life tour of what it takes to keep our bodies expectancy and the quality of your code and minds running at their full potential will improve as a result. while coding. It’s not about quick fixes, but the small changes you can make to your working habits that build to make Verdict a big difference, so there’s nothing in The Healthy Programmer The phrase this book that is hard to achieve. It ‘healthy doesn’t suggest running 10 miles a Author: Joe Kutner Publisher: The Pragmatic Bookshelf programmer’ may week until you’ve shed any excess ISBN: 978-1-93778-531-4 be considered pounds. Instead it focuses on an oxymoron Price: £25.50 awareness of what you’re doing, making Pages: 199 by some, but improvements, and iterating until with a little A complete guide to staying fit and knowledge and you’ve built up a lifestyle that will enable healthy in an office-centric world. understanding, you to continue your imperilled career. it needn’t be an This book also covers the full gamut Rating 9/10 impossible aim. of physical health problems associated Raspberry Pi Cookbook Pi problems? Les Pounder has found the recipe for success.

he O’Reilly Cookbooks are and there’s lots of information for every this is due to change over the next few always a great source of level of Pi enthusiast. months, as Simon is working on the Tinformation, and provide quick The book starts with an overview of final version. Needless to say, if you are solutions to your problems. The the Pi, then swiftly moves on to the interested in hardware hacking, you’ll Raspberry Pi Cookbook, written by Raspbian OS, including how to write an find lots of information about using Simon Monk, continues in the same image to your SD card, which at time of Python and I2C with the Pi. vein: it’s a great quick reference guide, review does not cover NOOBS. The If you have a Raspberry Pi, this is an that covers a lot of content very quickly Cookbook then moves on to configuring excellent book for quick reference, and Raspbian, including wired and wireless should offer something for everyone, networking and serial communication. from noob to sysadmin. LXF Where this box excels, though, is in its coverage of the various aspects of the Pi, for example, the command line Verdict and Python will probably be unfamiliar to Pi owners, but this book provides Raspberry Pi Cookbook ample clear instructions on what to do, Author: Dr Simon Monk including some excellent illustrative Publisher: O’Reilly examples. I particularly enjoyed the ISBN: 978-1-4493-6522-6 Price: eBook $31.99 (via Early Python and GPIO sections, which Release) Print Version $39.99 provided me with lots of useful December 2013 information – the Python section Pages: 500 (Chapter 5) especially summarised my All the A great book, with lots of ingredients you commonly-used Python queries, and information for your Pi-based projects. need for getting provided clear answers. the most out of The GPIO section (Chapter 6) is still Rating 9/10 your Pi. a work in progress at time of review, but

www.tuxradar.com November 2013 LXF176 23 Monster® DNA On-Ear Headphones Thin King Anodized aluminium wallet Sky TV free for a year Monster Game® MVP Carbon – Cobalt Blue and a Sky+HD Box On-Ear Headphones by EA Sports™ – Black

Clicloc watch Coleman Da Gama4 tent and Biker sleeping bag Win £10,000 worth of prizes! There will be one lucky winner of all these great prizes from well-known brands. Enter by text today to be in with a chance of grabbing this amazing gadget wishlist JVC GCXA1 action camera Outride by Mophie iPhone mount

Sky Broadband Unlimited free for a year Phoenix laptop security carry case David Bowie inspired Momentum Phoenix laptop security travel case Olloclip Quick-flip case Kaspersky Pure 3.0 Special Edition headphones from Sennheiser

CyberLink PowerDVD 13 Ultra Sony BDV-N590W home theatre Marin Palisades Trail 29er x rocker rockster gaming chair Phoenix iPad security case Monster® iSport Victory In-Ear system Mountain Bike Headphones

Sigma SD1 D-SLR camera and lens The Sigma SD1 Merrill digital SLR benefits from a 46 megapixel Foveon X3® direct image sensor to capture all three primary colours at every pixel location, ensuring astonishing detail and clarity. A redesigned interface provides faster and more convenient operation and the magnesium-alloy body construction adds rugged durability and resistance to water and dust. The result is a precision instrument that responds intuitively to your every intention. This camera comes complete with Sigma’s 17-50mm f/2.8 EX DC HSM lens featuring top spec FLD glass, Optical Stabilisation and high-speed HSM autofocusing.

24 LXF176 November 2013 Hauppauge HD PVR 2 GE Plus Airhogs Helix 4 Airhogs atmosphere Bladeztoys bubble blaster and PURE Jongo S3 wireless Mutewatch touchscreen watch water blaster RC helicopters music system

Monster Mobile® ClarityHD Monster High Definition HDP 850G Asics Gel Kayano trainers Kingston Technology MobileLite Black MS-2 Marshall Micro-Amp Zoom G5 Guitar Effects and Micro Bluetooth Speaker - Black PowerCenter™ v2 w/ GreenPower™ – UK Wireless Amp Simulator

Garmin Edge® 810 – the Monster® iCarPlay™ Wireless Magicscreen screen protector pack, a Mophie Juice Pack Unit Portables Laptop Bag Humax Youview box DTR-T1000 complete touchscreen GPS 800 FM Transmitter for iPhone Magicwand touch screen stylus, a bike computer and iPod Magicpotion screen cleaning kit, a pair of Artisanphonics luxury wood earphones, and a case from the MediaDevil range

Monitor Audio Wireless D6200 netgear Wi-Fi router Netgear PTV3000 Wireless multimedia system display adaptor HOW TO ENTER TEXT: LIN

TO 87474 Kymera wand remote control Sonic Screwdriver remote control Unique Track days Radical experience at Silverstone Texts cost £1 plus 1 message at your standard network rate, Terms and Conditions usually 10–12p You must use the keycode in your text. The prize draw is only open to UK residents. You must be 16 or over to enter. The prize draw is not open to Or post your name & contact number to The Future employees of Future Publishing and its affiliates or agents, the families of such Great Gadget Giveaway, c\o Puma Source Solutions employees and any other person connected with this promotion. One winner will Ltd, The Lodge, Portobello Docks, 551 Harrow Road, be chosen from all eligible entrants at the close of the prize draw by way of an London. W10 4RH independently supervised random draw. The winner will be notified after the prize draw has closed. The winner will be notified by telephone on the mobile telephone Increase your chances of number used to enter the prize draw. If the winner cannot be contacted, the prize is forfeited and we reserve the right to draw another winner. In the event of a winning by texting again. dispute, the winner is deemed to be the owner of the winning mobile phone number. In the event of an entrant’s mobile and/or contact telephone number Plus, get 3 entries for the price changing and/or the mobile phone being lost, stolen or damaged, the Promoter is of 2 – so every third text is free! not able to retrieve and amend any existing entries to a new mobile and/or contact number. Prizes may arrive on different dates. The winner may be required to fulfil all reasonable requests to take part in publicity relating to this Promotion. Deadline for entries is 30 November 2013. Text entry costs £1 plus your standard network rate. You’ll find the full prize draw terms and conditions here: To decline marketing texts end your message with NOINFO www.futureplc.com/survey-prizedraw-terms-and-conditions

November 2013 LXF176 25 Roundup CollectionOffice suites managers Every month we compare tons of stuff so you don’t have to! Collection managers Got so many DVDs that you forget what they are? Marco Fioretti suggests five programs that will help you keep all your collections in order.

How we tested...

For the reasons explained in the introduction, we chose only three collection managers for Linux and added two generic database front- ends, all with FOSS licences. With one exception, all these applications are available as binary packages for Fedora 17, which we used for our testing process, and most other desktop distributions. After installation we created several collections with each program, both of the predefined types and also completely custom ones. Next, we tested data entry, both from online sources and by hand. We also checked each program’s search support, ease of use, customisation, and, finally, their ability to exchange collection data with the other applications.

ollecting stuff is really fun. The trouble is: how do your “Should you really make the keep you collection effort to learn a different program C manageable and under control when it begins to grow and take for each collection?” on a life of its own? How do you, for instance, remember things? Should you really make the stuck at versions so old – some at least who borrowed that precious first edition effort to learn a different program for four years old – that making certain book, when you were crazy enough to each collection? features work on modern distros Our offer it? How do you keep handy These and similar questions started requires patching the source code. selection everything you just need to know about a new edition of a Roundup that LXF Eventually, it dawned on us that this each single item – such as its current ran last in 2009 [LXF125, p30] on revelation could turn out in our favour, Data Crow GCstar value on the resale market – if someone Linux-compatible, multi-purpose because it forced us to propose some Kexi asks out of the blue? Could you collection managers. This time though, alternative solutions that should both LibreOffice calculate easily how much your entire we got a big surprise when we started work well in some situations, and also Base collection is worth if you happen to get looking: there aren’t enough FOSS apps help you consider what you really need Tellico offered a slot on Four Rooms? What if to fill a Roundup anymore. Griffith, Moll or use in a collection manager. Let’s get you like to collect a lot of different and Stuffkeeper are all still online, but started then!

26 LXF176 November 2013 www.linuxformat.com Collection managers Roundup

Flexibility and customisation Are they ready to do your bidding?

o matter how complete a Collections present in all the software program is there’s Dedicated Three are Books, Movies/ Nalways something we’d like it to Videos and Music. Data Crow adds do differently, so what’s customisation Images and Software (also in GCstar). like for the pick of the programs? Both GCstar and Tellico provide Comic It may seem a paradox, but Base Books, Coins, Stamps, Wines and and Kexi probably are the best choices Videogames. Tellico has Bibliographies from this point of view, exactly because and Trading Cards, while GCstar also they are ‘only’ generic database manages Board Games, TV Shows interfaces. Since it’s up to you to set Series and Episodes, Periodicals, Mini TheTellico UI for creating new collection fields is simple, them up to manage collections, the Vehicles, and Smart Cards. but very powerful, thanks to grouped (derived) variables. result can be just what you need. Unlike Data Crow, GCstar and Tellico Customisation can insert and group fields of several (from here on called the ‘Dedicated Our Dedicated Three all let users create types, such as radio buttons, text Verdict Three’), Base and Kexi can also use their own collection layouts. Data Crow strings (with or without history of Data Crow many different back-ends, from in-file, has a Media Items module that creates previously entered values) and lists. single-user , such as HSQL or a single meta-collection for your Each numeric field can have its own GCstar SQLite to enterprise level, such as software and multimedia, which can be predefined range, increment step and PostgreSQL or MySQL. This makes sorted by category or release date. be displayed as a star rating. Kexi them great for collections In GCstar, custom collections Tellico has several collection LibreOffice co-maintained by several users. Next, without a corresponding, explicitly templates available for download. If you Base there’s the integration with Calligra and defined type name store all their want your own custom version of LibreOffice. If you need to insert definitions and settings in one file. collections that it natively supports (eg Tellico Music collection data frequently, or use them Assigning a type name, instead, will Stamps or Wine), you can modify an as data sources for spreadsheets, then create a new, reusable ‘Personal empty one with the default template Kexi and Base why keep them out of environments collection model’, with a template instead. This is the only way to let get the top score, but you have to born to do that? Kexi and Base also stored in ${XDG_DATA_HOME}/ Tellico know what type of collection it is, do more work! support a few scripting languages. /GCModels/. In both cases you and keep using the standard icons. Data entry & online searches Data access is king when it comes to keeping collections current.

he more a program can get data Base and Kexi can link to external can alternate between data sources, by itself, either from accessing data in theory. In practice, however, at changing it at every query. Tlocal files or via the internet, least for managing collections, they are Tellico also knows how to download the better. This fact alone may be the worst solution for this particular data from PubMed and bibliographic enough of a reason to use a dedicated area of interest. servers compatible with the z39.50 application instead of paper or generic Even when tools, such as the standard for online search and retrieval database software. unsupported ones available for movies of information (www.loc.gov/z3950/ Verdict at www.imdb.com/interfaces, offer to agency). Be warned though: Tellico’s download data automatically into Base website says that “Tellico is not a full- Data Crow and Kexi, you will find it’s much safer to blown bibliographic reference manager”, GCstar load the results into your database so it may not be the best choice separately, either by hand or by using available for research-related Kexi custom scripts. collections. Your mileage my vary. All of our Dedicated Three programs, Of course, not all collectibles give LibreOffice in comparison, can download data the same choices. There’s no online Base straight from reputable websites: data source for stamps in Tellico, for Tellico Music Amazon, IMDB, Sourceforge, example. In other cases, data entry may MusicBrainz and many other data even happen without any typing at all. Kexi and Base sources. GCstar can either query all the Data Crow can read metadata directly have no built-in websites in a predefined (but obviously from the most popular multimedia functions of this modifiable list), or just head off to one formats, and our Dedicated Three are kind. But Data Crow has a host GCstar has the simplest, least website – you can change the sources all, more or less, compatible with of them to try. intimidating online search interface. whenever you want. Alternatively, you barcode scanners or webcams.

www.tuxradar.com November 2013 LXF176 27 Roundup Collection managers

User interface Which program offers the most choice, in the simplest way?

he visible part of any collection how much data you’re having to download Some collection manager programs (the manager should be simple to use, from the internet, to help you cope with slow good ones, at least) will also offer the option to T flexible when it comes to displaying connection issues. temporarily lock a collection in read-only items effectively, and offer as many options as Another important feature, especially if you mode. This can be very helpful for people who possible to find information both online and plan to use the same collection manager on find that they need to let other less from inside your actual collections. many computers, may be how much choice experienced (and possibly younger) users A collection manager’s user interface you have in the way that collections are placed browse shared collections with the same should also give you an easy way to control and the Settings files are handled. account and copy of the software. Data Crow Data Crow runs on any system where Java 1.6 (or higher) is installed (and even as a web server). In fact, this is also the only program in the Roundup that needs a manual, even if it’s just a simple installation guide: download the code, unpack it somewhere, adjust the path to the datacrow.jar file in the datacrow.sh script and make it executable. Data Crow has a skinnable graphic interface, available in English and six other languages, and a clear configuration wizard. You can switch back and forth in any moment between a Beginner and an Expert mode. We suggest staying with the former for a while, with the ‘Tip of the Day’ pop-up box active, before trying the latter. Data Crow is good, but even its Beginner mode is overwhelming. That said, the tagging, web services, backup and restore functions are great. Data Crow has a special tab for items that still need to be filed. LibreOffice Base The only Base interface we can really speak about here is the one you will need to create yourself by using the actual collection manager windows. Base has wizards to create Tables, Queries, Forms and Reports. The Form Wizard and the Form Design view both offer ways to create entry forms, in a drag-and-drop interface. We found the Form Design is more complex, but much more flexible. Whatever tool you use, don’t forget to plan out what you want it to do before starting. You will have to consider what your database and forms should look like, and take advantage of the Base support for grouped elements, which should make your forms much quicker to use. Also remember to associate each field of your forms with a column of the Collection management in Base starts with the creation of each corresponding database column, otherwise bad and very frustrating table and form of the database. things will happen.

Documentation Verdict Data Crow

What was the name of that function, again? GCstar

ven if it’s not specifically about as for complex searches using regular Kexi collections, Base and Kexi both expressions, or for running an LibreOffice E have a lot of documentation, not optimising online searches. Base to mention very large communities. From a documentation standpoint, If you have a clear idea of how your however, GCstar is a little behind Data Tellico Music collection manager interface should Crow and Tellico. We say this partly look, any question you may have will because the manuals of the two other Base and Kexi score less as find a quick answer online. programs are more detailed, but also each has a lot of As far as the Dedicated Three are because they are installed locally. documentation, concerned, they all come with adequate GCstar’s Help button opens its online but most of it’s or very good manuals and other wiki in your default browser. Therefore, not specifically resources. You probably won’t need it should you need it when there is no for making Data Crow’s extensive user collection apps. though, except for special cases such connectivity, you’d be out of luck. documentation is included with the app.

28 LXF176 November 2013 www.linuxformat.com Collection managers Roundup

GCstar GCstar opens with a big warning: “information downloaded from websites is for personal use only and any redistribution is forbidden without explicit authorisation”, leaving you wondering why the developers found it necessary to push that (albeit correct) reminder. Warnings aside, the interface is simple and intuitive, without losing anything important. The Toy Car collection, for example, has 12 predefined fields for photographs from any possible angle, plus a field for notes. You can also lock a collection to prevent involuntary edits and get suggestions of movies to watch or books to read. There are plenty of filters and configurable search functions that can be combined together. We also like how easy it is to find out why a filter or plugin isn’t working: just open the Dependencies list in the Help menu. GCstar packs a lot of data in a really clean and simple interface. Kexi Much of what we said for Base also applies to Kexi. This multi platform (needs Fink on Mac OS X) visual designer for databases lets you create Tables, Queries, Forms, Reports and Scripts without ever leaving the program. Kexi has also been defined as “the only multi platform graphical tool for importing data from Microsoft Access databases.” Being a part of Calligra, Kexi enjoys the same theming capabilities, print support and many other features available to all KDE applications. The Property Editor and, above all, the Project Navigator – which can both be undocked from the main window and docked again whenever you want – make it easier to handle simultaneously many different databases (or in our case, collections). As with GCstar, a locked-down User mode is available, to disable all the editing commands and prevent Kexi can manage collections just like you want… if you build it. involuntary data corruption. Tellico Tellico is the official collection manager for KDE. Its main graphic elements are the Group and Column views. The former shows the current collection in a tree-like structure, the latter shows a plain list of the same items. You can group multiple independent fields into a single one, to get more compact views, or sort your items as you want, even if you find the result can be a little confusing initially. Tellico’s Search filters support regular expressions, and it’s also possible to edit more entries simultaneously. All you do is select the entries you want to edit, and when you click on any entry that has fields that are the same value in all the entries selected it will editable. Remember, if your collection is going to have many images you will need to tell Tellico that they must not go into the main database file, but The look and feel of Tellico is minimalistic, if not bare, but it shows in a separate folder, otherwise the software would run much slower. and does everything you really need to see and do. Loan features Verdict Data Crow

Who borrowed my Pink Floyd albums? GCstar

Kexi ery frequently, especially when though, all have a panel dedicated to dealing with many books or loan management and reminders. LibreOffice VDVDs, there’s a need to have a The one in GCstar is the most Base clear idea of who borrowed what and intuitive. It can import contacts lists when. Friends, generally we’ve found, in LDIF or VCARD format, or from a Tellico Music have a habit of forgetting to give back Claws Mail address books. You can GCstar will help your friends bring All the apps your rare editions and often need a also configure the email that will be back borrowed items in a few clicks. can help a user gentle, but implacable reminder to automatically sent to all forgetful to manage return them. borrowers. Tellico can do the same and is the most complete and complex loans in different ways, but Base and Kexi can support you more, through KOrganizer: This can add of the group. It catalogues borrowers GCstar makes in this – if you add the right columns loan reminders automatically to your with tags and categories, stores their the process and form fields to your collection default KDE calendar as To-Do items. photographs and exports pending loans very easy. databases. The Dedicated Three, The Data Crow’s Loan Administration with their due dates as iCalendar files.

www.tuxradar.com November 2013 LXF176 29 Roundup Collection managers

Reporting features Summarising what’s in my collection and bragging about it.

ood reports make sense of a reports with charts dynamically to creating queries and grouping results, collection, or simply make it generated by Calc. albeit with less formatting. The program, Geasy to print a list of things you You can create reports with the however, supports many widgets, want to sell. From this point of view, the dialogs of the Report Wizard or by including one for charts and another Dedicated Three are more limited than dragging and dropping fields in the that inserts barcodes, corresponding to Kexi or Base, but also easier to use. Base Report Builder. To view a report or the content of whatever fields you want In LibreOffice Base, reports are refresh its content, click on the Execute to display also in that format. preconfigured text documents, Report icon in the toolbar. Writer will Data Crow has various HTML and dynamically filled with content from open the file, showing all the data from PDF basic reports, which may be your database. Therefore, you have the report queries you put in, and enough for most users, even if you have much more formatting options, if you you can reorder the results as you want to open them in another program to have the need and patience to use with the Sorting And Grouping dialog. print them. If you want to change the them. More advanced LibreOffice users The Kexi Report Designer has the layout or formatting style, however, you may even decorate their collection same flexibility as Base when it comes need to know XLST (EXtensible Stylesheet Language Transformations, www.w3.org/Style/XSL). This issue is Verdict also present, to an extent, in GCstar and Data Crow Tellico, even if the KDE manager can download extra templates. GCstar The Tellico dialogue for report generation, checks for XSLT templates Kexi in the installation path and in LibreOffice $KDEHOME/share/apps/tellico/ Base report-templates. Besides the actual HTML report, Tellico Music GCstar also creates a folder with copies of the corresponding pictures. The The Dedicated Three all produce HTML code points to that folder, so you basic reports, but have to distribute it together with the Data Crow can file or the resulting reports will look also generate quite ugly. You can also insert several charts As Kexi shows here, general database interfaces are better equipped to build JavaScript in the HTML source, to add and include bar code insertions. complex reports than specialized collection managers. some basic interactivity to it if you want. Interoperability Will my manager play nice with others?

an your manager exchange share data or whole collections Verdict data with other programs? Can between different Data Crow C it handle some tasks by itself? installations. Note that the official Data Crow Again, thanks to their multi-database preferred format for this job is XML. GCstar support. and the many utilities available GCstar can perform import, export on any platform for converting or and download from the command line Tellico can read and save collection Kexi editing databases, Base and Kexi are without launching the whole graphical data in more many, many formats. the best choices in this area, but only for interface and that’s even from within LibreOffice expert users. Cron jobs or other shell script. Beside In general, anything that is a valid Base The Data Crow Import Wizard can native GCstar files, which are used by Tellico XML file – or can be converted to Tellico Music import items from CSV or XML files, default, the GCstar export plugin that format via XSL stylesheets – can which is done by simply selecting the supports CSV, HTML, SQL, TAR.GZ, XML be imported into Tellico. You may never Tellico and module (which, depending on the (Note: but not necessarily for all need something like that, however, GCstar can read context, is the Data Crow term for a collection types, or in both directions) because Tellico recognises many and write each collection or collection type) before and both the native formats of Tellico, formats: CSV, Bibtex, Bibtexml, RIS, other’s data, at least for some starting the Import Wizard. which are plain or compressed XML. MODS, CDDB, audio file metadata and collection types, Unsurprisingly, the Export Wizard does GCstar also provides some import and exports, CSV, HTML, Bibtex, Bibtexml, and many more. exactly the same job. You can use it to export templates. ONIX, and PilotDB. Phew!

30 LXF176 November 2013 www.linuxformat.com Collection managers Roundup

Collection managers The verdict efore even getting started with of extra features that aren’t entirely the actual verdict, let us make covered in the Roundup. Bone thing clear, lest we start Overall, both Tellico and GCstar are some flame war. Yes, strictly speaking, great programs that can be integrated we should have considered OpenOffice with other parts of any Linux desktop Base and LibreOffice Base as two environment (especially Tellico) more separate applications. However, they’re than a Java application like Data Crow. still similar enough, at least for the They both can also import and export Want to access your collections from any computer? purpose of this Roundup, that we may your collections in many formats, Just install Data Crow on (almost) any web space. consider them to be interchangeable. including, rather generously, the native Base and Kexi produce the best formats of each other! – if you’ll forgive us for using a highly reports. Using either of them to build Data Crow does have a steep abused buzzword – Data Crow is the your own multi-purpose collection learning curve, and no matter how only program in this Roundup that is manager is a good project that will many collections you might have, cloud-ready. Put Data Crow, properly give you just what you need and leave it may be impossible (or completely configured, on some web space and (as you with skills you may reuse in many unnecessary) to use all its numerous shown in the picture, above), you can other situations. If this weren’t too features. However, it has tagging, good manage your collections remotely, with time consuming for many users, and documentation, and did practically any browser. For this and everything else they both offered ready support for everything we attempted to do with it. it offers, Data Crow is the winner. LXF downloading data from the internet, Even if you only we’d be tempted to declare one of these need half of its “Data Crow: even if you only generic managers the winner. features, they’re all Before giving our verdict on the very customisable need half of its features, they’re Dedicated Three, we do need to clarify (with the exception that each of the three has a number of reports). Finally all very customisable.”

1st 4th Data Crow LibreOffice Base Web: www.datacrow.net Licence: GPL Version: 3.11.0 Web: www.libreoffice.org Licence: LGPL Version: 3.5.7 Very, very complete. A great program that’s also usable from a browser. A great foundation for a program, but only if you are willing to build it.

2nd 5th Tellico Kexi Web: http://tellico-project.org Licence: GPL Version: 2.3.6 Web: www.kexi-project.org Licence: GPL Version: 2.6.4 Highly flexible and well integrated with KDE and Linux desktops. Same verdict as Base, for the same reasons.

3rd GCstar Over to you... Web: www.gcstar.org Licence: GPL Version: 1.6.2 Found a gem of a collection management app? Or maybe made A little less flexible than Tellico, but with lots of predefined collections. one yourself? Email your opinions to [email protected]. Also consider... We’ve said that one of the main reasons to use at talking with the websites that you see as the Finally, if you only have one type of a collection management program is to get most complete and reliable as data sources. collection, it’s very likely that there are already them downloading and adding data found on Another thing to consider, at least for FOSS managers specifically designed for that the internet. This fact has an obvious, but multimedia objects, is that none of the type, or that need some development help. sometimes overlooked corollary: the best programs mentioned here are, or aim to For instance, there’s the Palatina project for collection manager may not be the one with become, a real multimedia player. Therefore, book collectors (http://palatin.as), which has the look, feel and functions that you like the be prepared to research how to tell your been written from scratch to replace the most. It may be, instead, the one that’s better manager how it should launch your player. Gnome app Alexandria. LXF

www.tuxradar.com November 2013 LXF176 31 Subscriptions Subscribe today Subscribe today and get Linux Format for just £3.90 an issue Want ake advantage of our fantastic the digital subscription offer and subscribe to edition? T Linux Format for just £12.69 every Turn to three months and save up to 40%. page 66!

Our subscribers are our most loyal readers, and as a thank you we like to make sure you not only get a great price, but also tons of other benefits. Get all this: Exclusive access to the LXF subs-only area, featuring magazine PDFs, complete issues and coverdisc downloads. A digital edition of every issue from our subs-only area on your PC, iPhone or iPad. Save money on the shop price. Get each issue delivered to your door – a week before it hits the shops (UK only). Discount on Linux Format merchandise.

What You’ll Pay: UK – pay £12.69 by quarterly Direct Debit, or £54.99 for a year’s subscription (13 issues) Europe – pay £99.99 a year Rest of the world – pay £107.99 a year – equivalent to £8.31 an issue

32 LXF176 November 2013 www.linuxformat.com Save up to Fig. 1 The benefits of subscribing 40% per year Get thousands Hello Linux Format reader! of DRM-free tutorials, features and reviews Is this the first time YES Read, enjoy, come back next issue. you’ve read LXF?

NO

Do you buy Well done! You’ve saved Are you a LXF more than YES YES yourself the hassle of subscriber? a couple of getting down to the shops – times a year? town centre parking is a nightmare these days. NO NO

Don’t bother subscribing; it’s not Do you Buy it on the worth it. Instead, write to us and let Are financial live in Foreign YES YES newsstand in us know what you want to see more incentives and visit the UK more often than the UK and of and what you want to see less of. important once a save our costly We want your cash! to you? month? export fees. NO NO

Congratulations on transcending materialism. You should subscribe. Perhaps you’d like more than 2,700 DRM-free At just £59.99 a year for PDFs covering everything from Asterisk to UK readers, it’s far cheaper Zshell, available exclusively to LXF subscribers.* than buying each issue individually. NO

You should subscribe. You’ll get your copy up to a week before it hits NODo you own YES You are the Doctor, and I claim my the shops, and be able to download a TARDIS? prize. Also, please take me back to a digital version. 1968 so I can see the Elvis comeback special! *That’s all of our back issues, starting with issue 67 and going right up to the magazine you’re holding in your hands.

Visit www.myfavouritemagazines.co.uk/LINP34 or call our hotline on 0844 848 2852 and quote LINP34 For international subscription offers go to: www.myfavouritemagazines.co.uk/LINP34 In the USA or Canada? Subscribe for $139 a year, or $35 every three months Go to www.imsnews.com/lxf-a049 or call TOLL-FREE on 1-800-428-3003 and quote ‘a049’

All savings are based on current newsstand prices. Payment is in GBP unless otherwise stated. You will receive 13 issues of Linux Format a year. If you are dissatisfied in any way you can write to us or call us to cancel your subscription at any time and we will refund you for all unmailed issues. International subscribers please allow up to eight weeks to receive your first issue. Access to the subscriptions-only archive area is strictly for personal use and not available to digital subscribers. Offer ends 10 October, 2013.

www.tuxradar.com November 2013 LXF176 33 BUILD YOUR OWN DISTRO Tired of the run-of-the-mill stuff on Distrowatch? Why not heed Mayank Sharma and create the perfect operating system for you?

few issues ago, [LXF171, 50 making it your own – by removing apps and Now traditional wisdom says that creating Distros Tested], we looked at drivers that you don’t need and adding the your own Linux system is a rather difficult the best Linux distributions for ones you do. You’ll also probably change the thing to do and shouldn’t be attempted by A all kinds of users. There were factory-fitted artwork that says more about anyone other than Linux veterans. distros that were designed with ease of use the distro vendor than you. We begin the feature with graphical point- in mind, some focused on productivity, Sure that’s one way to go about it. and-click tools. Yes, you read that right. All it while others catered to specialised use You tweak and customise the distro to suit takes is a couple of clicks to craft your very cases, such as security and privacy your requirements. But wouldn’t it be really own flavour of Linux that you can pass to conscious users. But we can guarantee great if you just create your very own, custom friends and family. We’ve got tools that’ll help that there wasn’t a distro designed Linux distribution? you create and distribute customised spins specifically and entirely for you! based on Ubuntu, Fedora and While most Linux users make do OpenSUSE – the three mainstream with one of the mainstream distros out “We’ve got tools that’ll Linux distributions that house there, there’s always something or the help you create and thousands of open source software in other that’s missing. That’s because their online repositories. the major distros have to take into distribute custom spins.” Later on, we’ll look at tools for the account the whims and fancies of the intrepid users familiar with the thousands of users in their community. In this feature we’ll show you tools that command line, as well as system admins who There’s a lot of brainstorming behind every you can use to create a custom flavour of want to save time rolling out identical change; and every application addition or your favourite Linux distro. Want a cool distro machines. You can keep your customised removal is hotly debated. to hang out with? Maybe you might want to distros for your own use or hand it out to your At the end of it you get a distribution that strip out all the excess power tools and plug friends or even host it on the web and watch meets about 80% of your requirements. in your favourite games, or have a distro full of as word spreads and your distro rises up the After you’ve installed the distro, you set about programming tools, IDEs and documentation. charts on DistroWatch.

34 LXF176 November 2013 www.linuxformat.com Spin a localised Ubuntu distro The tools to make custom distros in your preferred language.

o habla inglés? Don’t sweat! With the Ubuntu If you Customization Kit app, tastefully abbreviated to know your NUCK, you can create Ubuntu editions in your own way around language. All you need is an ISO image of the Ubuntu Ubuntu’s filesystem, you edition you want to localise, about 5GB of hard disk space can customise under your /home partition, and an internet connection to your distro to download the language packs, besides UCK itself. the hilt. Begin by grabbing the UCK Deb installer from its website (http://sourceforge.net/projects/uck) and installing it with the Ubuntu Software Centre. If you prefer the command line, you can install it with: dpkg --install uck_2.4.7-0ubuntu1_all.deb However, the tool has some additional dependencies, and if Dpkg can’t find them on your machine, you can download them with After prompting you for a name for your new localised sudo apt-get -f install distro, UCK gives you the option to manually customise your Besides the dependencies it installs, you’ll also need the new distro. If you choose to do so, at some point in the future, libfribidi-bin package otherwise you’ll get the ‘failed to UCK will let you run a package manager to alter the list of build gfxboot theme’ error. apps inside the distro, and can launch a terminal to tweak UCK is designed as a wizard, so as soon as you start the files. Since Ubuntu doesn’t include a chroot-aware graphical app, it’ll display a welcome message and take you to the package manager, the package manager option will fail. wizard. In the first step you select the language packs that You can still however install and remove packages from the will be available in your distro. The next step involves console by using apt-get. picking languages that will be available at boot. As the tool warns, the choice of languages available at boot varies More customisations from one Ubuntu release to another. In the final couple of steps in the UCK wizard, you get the In the third step, the tool lists all the languages you have option to delete all Windows-related files from your distro, selected in the previous two screens and asks you to select and generate a hybrid ISO image that you can burn on a CD one of them as the default language of your distro. Next, or copy to a USB. UCK will then unpack the ISO under the you’re asked to select the desktop environment for your ~/tmp directory, and then download the language packs. distro. UCK needs this info to download the localised When it’s done, you’ll get the options to manually customise strings for the desktop in your distro. the distro if you’ve selected the option earlier. At this point, Next, you need to point it to the ISO image of the you can also copy files into your new distro. All you need to do Ubuntu distro you want to customise. Unlike some other is copy them (with the cp command) to the appropriate tools, UCK doesn’t offer to download the image itself, so directory under the root of the customised distro, which is make sure you have downloaded it already. Remember that ~/tmp/remaster-root. Underneath, it has the same you’ll need an image that’s compatible with your machine’s directory structure as a regular Ubuntu distro. architecture. So if you’re on a 32-bit machine, you’ll need Once you’re done, UCK will build your new localised the i386 image and not the x86-64 one. However, users of Ubuntu distro and point you to its ISO. Eso es todo amigo! 64-bit OSes can also customise a 32-bit image. UCK works best for creating localised spins of Ubuntu. But if

Simple web-based tools

Creating a custom distro is such a trivial task that are, in turn, used for producing official When your customised Debian Live system these days that you can actually create one Debian live images. is ready, a download link will be emailed to you. from your browser! While they save you the Using the online tool you can build hybrid Then there’s Porteus online builder effort of installing any software, these online ISO images that you can transfer to USB disks, (http://build.porteus.org). Porteus is a tools don’t offer the same flexibility that you get as well as basic netboot images without the X portable distro based on Slackware. The web with offline tools like Ubuntu Builder. server. The Standard options also let you interface enables you to select the desktop for One such tool is the Debian Live Builder specify the desktop environment. Additionally, your customised distro and some common (http://live-build-cgi.debian.net). This is a you get lots of advanced options. For more software, such as web browsers, word free web service that’s maintained on a ‘best details about these options refer to the processors, VoIP clients, and proprietary video effort basis’. The web builder is hosted by the documentation for the Debian Live project card drivers from Nvidia and AMD. Optionally, Live Systems project, which produces the tools (http://bit.ly/17pdmrj). you can influence advanced boot parameters.

www.tuxradar.com November 2013 LXF176 35 Build your own distro

you want to further customise the distro by adding (or other languages to save space. If you select the options to removing) apps or replace Unity with another desktop make a bootable USB live system or burn the ISO image to environment, you need to use Ubuntu-Builder. To install it an optical drive, Ubuntu Builder will automatically launch you’ll first need to add its PPA. Fire up a terminal and enter: the applications to perform these tasks after creating your $ sudo add-apt-repository ppa:f-muriana/ubuntu-builder custom distro. $ sudo apt-get update In the main Ubuntu Builder menu, you can select the $ sudo apt-get install ubuntu-builder graphical desktop you want in your custom distro. After it’s installed, at least on newer versions of Ubuntu, Remember that selecting a desktop environment from this you will need to launch the tool from the command line with menu will not remove the default Unity desktop, but rather root privileges, because Ubuntu-Builder creates a working install your selection beside it. Also, in our experience, it’s directory under /home: best to use the package manager to install a new desktop $ sudo /usr/bin/ubuntu-builder.gambas meta package rather than these presets. Using Ubuntu Builder is fairly straightforward. You can use Use the Synaptic option to launch the graphical the Get Ubuntu pulldown to download an ISO image of the package manager. The console option will launch a Ubuntu version you want to download. If you have an ISO terminal into your distro where you can add packages via image already you apt-get. See the box below (CLI Tricks to Customise can point to it using Ubuntu), for a list of useful packages that are worth “The secret sauce the Select ISO pull- installing to make Ubuntu more usable). behind Fedora distros down option. The Ubuntu Builder also has buttons that will enable After it’s you to add custom repositories. You can also add custom are kickstart files.” mounted your ISO, Deb packages from your disk into your distribution and the click on the builder will auto-resolve dependencies that are required Settings icon. In the window that opens, you can add basic from the configured repositories. information about your custom distro, such as its name, One interesting feature of the tool is that it lets you version number and a link to its online release notes. customise the Ubuntu installer as well. The Ubiquity option If you switch to the Advanced tab in this window, you get launches the Ubiquity editor which enables you to edit the options to set a default language for your distro and remove text of every slideshow screen that’s shown while Ubuntu is being installed. When you’re done customising your distro, click the Build button to create the ISO image of your distro. Once it’s done, you can use the Try option to test your custom distro with the Qemu virtual machine emulator. Create Fedora-based live CDs Ubuntu isn’t the only distro that gives you the tools to create a customised version. If you prefer RPM packages We don’t instead of Debs, you can assemble a customised distro actually speak based on Fedora, using command-line tools bundled in the Russian, but livecd-creator package. thanks to UCK we can create Unlike UCK and Ubuntu Builder, the Fedora tools don’t a localised require an ISO image of a stock Fedora release. Instead the spin for our tool fetches all packages you need in your custom Fedora comrades. distro from the internet.

CLI tricks to customise Ubuntu

Here are some ideas to make your customised setup command, which launches a wizard to ubuntu-settings.gschema.override file and Ubuntu distro more usable. set up a new user. The lightdm screen will list change the picture-uri parameter to point to You can install plugins to handle multimedia this user instead of the live user. the image you wish to use as the background, in various formats with: If you want to put application shortcuts on such as: sudo apt-get install ubuntu-restricted-extras the desktop first create the Desktop/ directory picture-uri=’file:///usr/share/backgrounds/ and remove the controversial Amazon shopping under your custom distro with: Brother_typewriter_by_awdean1.jpg’ lens with: mkdir -p /etc/skel/Desktop Similarly, you can change the theme and sudo apt-get remove unity-lens-shopping You can now move application shortcuts from icons by editing the -theme and Don’t like Unity? Give users a choice by the host distro: icon-theme parameters under the [org.gnome. installing another desktop like Gnome 3 with: cp /usr/share/applications/firefox.desktop /etc/ desktop.interface] section, such as: sudo apt-get install gnome-shell skel/Desktop gtk-theme=”Radiance” After it’s downloaded and installed, make sure cp /usr/share/applications/libreoffice-writer. icon-theme=”HighContrast” your custom Ubuntu boots Gnome 3 instead of desktop /etc/skel/Desktop For these changes to be reflected in your Unity with: chmod +x firefox.desktop custom distro, make sure you compile the /usr/lib/lightdm/lightdm-set-defaults -s chmod +x libreoffice-writer.desktop modified schemas with: gnome-shell If you want to change the default wallpaper, glib-compile-schemas /usr/share/glib-2.0/ You can also add a new user using the user- open the /usr/share/glib-2.0/schemas/10_ schemas

36 LXF176 November 2013 www.linuxformat.com Build your own distro

The secret sauce behind custom Fedora distros are kickstart files. A kickstart file is a simple text file, which contains a list of items, such as package names. The livecd-creator tools reads a kickstart file and builds your distro as per the instructions in it. In fact, when you install Fedora, the Anaconda installer also creates a kickstart file (/root/anaconda-ks.cfg) based on the options that you select during installation. To help you get started, you can download the kickstart files for several official Fedora spins by downloading the spin-kickstart package, along with the livecd-tools: $ su -c “yum install livecd-tools spin-kickstarts” This will install the livecd-creator tool that will build your If you prefer you can launch a wizard that will guide you through the custom distro and place several kickstart files under the process of creating your custom distro. /usr/share/spin-kickstarts directory. You can open and edit any kickstart file in a text editor. To get a hang of what goes in a kickstarter file, open one and refer to the resolv.conf Fedora documentation (http://bit.ly/14c1XJ7) to %end understand the various options. To autostart the Gedit text editor, you will need to place a Or, if you’re lazy sort, you can just install the Kickstart shortcut to the app in the ~/.config/autostart folder in your Configurator tool, which lets you create a kickstart file customised distro: using a graphical user interface. Install the app with: %post su -c “yum install system-config-kickstart” # autolaunch gedit mkdir -p /etc/skel/.config/autostart Using kickstart files cp /usr/share/applications/synapse.desktop /etc/skel/.config/ The two parts of the kickstart file that you should pay autostart/ close attention to are the software section, which begins %end with %packages and the post-installation section, You can also use the --nochroot switch with %post if you which begins with %post. The software section lists the wish to run commands outside the chroot environment of apps that will be installed in your distro. This is best your custom distro. The most common use for this is to copy configured with the graphical Kickstart Configurator tool. files from the host distro to your new distro, such as: The %post section is where you specify commands %post --nochroot that will run in the build environment before the ISO # copy the configuration file for SSH image is created. It’s useful for carrying out cp $INSTALL_ROOT/etc/sshd_config $LIVE_ROOT/etc/ customisations like adding a user, configuring the sshd_config network or specifying applications that will launch %end automatically. For example, the following will add the Also make sure you define a Fedora repository in the kickstart nameserver 10.10.10.10 to /etc/resolv.conf: file. To use the same repository as the host system, add the %post following line to the kickstart file: # add nameserver repo --name=fedora --mirrorlist=http://mirrors.fedoraproject. echo “nameserver 10.10.10.10” >> /etc/resolv.conf org/mirrorlist?repo=fedora-$releasever&arch=$basearch echo “10.10.10.10 server.local server” >> /etc/ You can also grab packages from another repository for another architecture besides the host one. For example, to grab packages from Fedora 18 repository for the i386 architecture, use: repo --name=fedora --mirrorlist=http://mirrors.fedoraproject. org/mirrorlist?repo=fedora-18&arch=i386 When you’re finished, save the custom kickstart file, say under ~/custom-kickstarts/My-Remix.ks. Now fire up a terminal, switch to the root user (su -) and ask the livecd-creator tool to build your custom distro: # livecd-creator --config=/home/bodhi/custom-kickstarts/ My-Remix.ks --fslabel=My-Remix --cache=/var/cache/live --verbose When the machine has stopped whirrring and the messages have all scrolled by, your custom Fedora distro will be available under your home directory. Turn the page to learn how to get a custom distribution based on OpenSUSE, using the SUSE Studio web app. For more customisation options through the command line You can modify the Syslinux splash image and install a and how to install Arch Linux jump to page 40 (Remaster a graphical desktop from the Extras menu. Working Install).

www.tuxradar.com November 2013 LXF176 37 Build your own distro

Build distros online Make a custom distro using web tool, SUSE Studio.

f we were to rank Linux customisation tools by the power they give the normal user, OpenSUSE would win hands Idown. Its SUSE Studio tool is the most comprehensive solution for creating a customised distro: with it you can create desktops, servers, and even virtual appliances, and in addition to adding software and files, you can even customise the artwork to brand your distro. Best of all, SUSE Studio doesn’t require you to be running OpenSUSE or install any software. It’s a Ruby on Rails web application that runs in a web browser! After you’re done building your custom distro, you can even test it from the web browser without downloading anything. To get started, head on over to www.susestudio.com. SUSE Studio will enable you to, optionally, upload You can sign in with any OpenID provider or register an single files or zipped archives to your custom distro. account with the service. Before you start, remember that SUSE Studio refers to type of system you want to create. The choices here custom distros you create with the system as an ‘appliance’ include a Just enough OS (JeOS) template for a irrespective of whether it’s designed for real physical minimalistic system, a text-only template for building hardware or virtual machine. Once you’re signed in, click the servers, and templates for a Gnome 3, or KDE 4 desktop. Create New Appliance under Actions in the upper-left corner. This step is rounded off by selecting the processor architecture for the distro and giving it a name. Set up the distro You’re now at the main screen of your appliance, which You can base your distro on various Novell-supported ones, has two panes. The right-hand side of the screen has a set including the current version (OpenSUSE 12.3), as well as of tabs that you can switch through to configure your various editions of their commercial SUSE Linux Enterprise appliance. On the left you are shown a summary of the server. To use the latter you’ll need to buy a licence. software included in your appliance. For most purposes you’ll opt for the OpenSUSE base. You’ll then have to select a template that will determine what Pick your software Switch to the Software tab to add software to your appliance. You can choose software from three sources. The primary source is the group of official distro repositories that provide software based on the base template. You can also add external repositories either SUSE Studio from the OpenSUSE Build Service or a third-party. Finally, is designed you can upload an RPM or bunch multiple RPMs in a to be easy compressed archive. to use and offers enough After you’ve configured the sources, you can scroll flexibility down the page and search for software and add them to to cater to your distro. So, for example, if you wanted to add both new and LibreOffice to your system, search for it using the search advanced users. bar. You can get details about the software by clicking on its

Deploy prefabricated custom servers

Suppose you are a sysadmin who has to roll out Common Operating Environment project Debian-based distributions or a kickstart file for a bunch of identical machines with similar (http://linuxcoe.sourceforge.net). Although it Red Hat-based distros and puts it on a small configurations and the same software. The isn’t actively maintained, you can still create (about 30MB) CD. www.instalinux.com service is an online working systems based on server distros, such However, because it isn’t actively maintained, service like SUSE Studio, but instead of full- as CentOS and Scientific Linux. the installation disks that are made for CentOS fledged OpenSUSE-based distros, it churns out The system takes you through the steps and Scientific Linux need to have their final small ISOs that are designed to prepare ready- involved in installing a distro, such as selecting a configuration files tweaked to point to the to-use Linux machines by automatically keyboard layout, timezone, password for the correct URL for downloading packages. But fetching packages and installing them root user, package selection and the disk once you have the disc, pop it in the CD and The web service is powered by the partitioning scheme. Once you’ve answered the depending on your package selection your SystemDesigner CGI scripts from the Linux questions, it creates a preseed installer for machine will be up and running soon.

38 LXF176 November 2013 www.linuxformat.com Build your own distro

name in the search results. To add a piece of software, Sessions via click on the +Add button, which will auto-resolve the Testdrive dependencies and update the software information in link are restricted to the left pane. one hour to When you are done adding software, switch to the save resources. Configuration tab. The tab has several buttons to configure different aspects of your distro. From the General section you can configure the network, enable the firewall and open ports for the SSH and HTTP ports, and add users and groups. To add your logo and a custom wallpaper switch to the Personalise section. SUSE Studio will use these and show a preview of how your appliance will look at the Grub boot loader screen, while booting and at the login screen. If you are setting up a server and will be using a MySQL or PostgreSQL database, head to the Server section from where you can add data from an existing update your custom distro regularly by adding new software, database by uploading its SQL dump and adding users or changing configuration in any other way. The website will and defining their permissions. Similarly, if you are keep track of all your builds and every subsequent build will setting up a desktop distro, switch to the Desktop automatically generate a changelog that’ll list all the changes section, where you can automatically log in any user since the last version. that you have added and define programs that you want Initially the service will only build the distro in the default to auto-start when they log into their desktop. format you’ve selected. If you’ve selected additional formats The Appliance and Scripts sections are designed for as well, click on the Build additional button to get images in advanced users. The Appliance section comes in handy the other formats. if you want your custom distro to serve as a virtual After the image has been built, you can test it before appliance. The Scripts section will run custom scripts to downloading, using the Testdrive link. This will launch a flash- execute actions like removing temporary files, or based VNC session and boot your distro inside the web loading custom kernel modules, either immediately browser itself. The service also has instructions for after creating your distro, or when the distro boots. connecting to the test drive via a regular desktop VNC client or through an SSH connection. When you’re satisfied, you can Build and share download your custom distro or share it with other SUSE Once you’ve completed configuring your custom distro, Studio users by publishing it in the SUSE gallery. head to the Build tab to turn it into a usable distribution. SUSE Studio is a wonderful tool for creating customised SUSE Studio can make your distro available in several distros. Users new to Linux can use it and so can experienced formats. Besides the Live ISO image for the optical system administrators. The web-based tool has very low media, there are Live images for USB and images for bandwidth requirements. Packages are downloaded at the virtually every virtualisation software available, including SUSE Studio servers and you only really need an internet KVM, VirtualBox, VMware, Xen, and OVF etc. connection to download the image of your final distro. Two options are the Preload ISO and Preload USB Interruptions don’t hamper the distro creation process and images. These come in handy if you are planning to do you can stop and resume the process at any stage. SUSE installations of your distro on physical machines and Studio also gives you get lots of customisation options to don’t need the live environment. These disk images are influence the software in your distro, add users, and wrapped in a simple bootable installer and you only personalise it with your own logo and wallpaper. need to point them to a target hard disk for installation. SUSE Studio definitely gives you more customisation These formats are ideal for deploying servers. options than UCK and Ubuntu Builder and is far easier to use SUSE Studio also gives each custom distro a version than Fedora’s livecd-tools. However it might be an overkill for number in the format. This is useful if you plan to creating simple distros.

You can use appliances in SUSE Studio’s gallery as a www.jopux.org hosts a wide range of appliances from good starting point for your custom OS. basic workstations to analytics servers.

www.tuxradar.com November 2013 LXF176 39 Build your own distro

Remaster a working install Whip your favourite distro into shape – or give Arch a whirl.

n this feature, we’ve shown you tools that will customise called USER that points to your username, by adding the Ubuntu, Fedora, and OpenSUSE to different degrees. following line to the configuration file: IThe point-and-click tools are convenient to use but don’t USER=$(whoami) offer the same amount of customisation that you get with Now point to the files that shouldn’t be included with command-line tools, and no matter how proficient you are the EXCLUDE parameter, such as: with Linux, it’ll take some doing to make your custom distro EXCLUDE = “/etc/fstab /home/$USER/Music / look and behave like the one you’re using. Wouldn’t it be nice, home/$USER/Download” then, if you could just turn the distro you’re currently running Also, unless you replace the bootlogo.png file under the into a live one that you can pass on to family and friends? bootfiles/ directory, you’ll get a very ugly splash image on Many distros, such as Linux Mint, PCLinuxOS, Damn the boot screen. Small Linux and Mepis include a remaster script, specifically Then head to the tools/ directory and run the for this purpose. The remaster scripts included in these ./isolinux.bin.update script, which will patch and update distros will go through your installed distro and spit out a live the other components to match the name of your custom image with the exact same contents. live kit. Before executing this script make sure that you are These scripts save you the trouble of fetching software connected to the Internet because the script will fetch the from the internet or working in a chroot environment to edit syslinux package from www.kernel.org. configuration files. Just set up the distro you want, remove When it’s done updating the components, simply run any unnecessary the ./build script and go prepare a cup of tea. The script files and then create will take some time depending on the size of your file “If you want a truly a remaster that you system and the crunching power of your computer. customised distro, you can then After it’s finished, you’ll have an ISO file and a TAR redistribute. archive under the /tmp directory. The ISO file is meant for should setup Arch.” If you want a optical media. To make a bootable USB, extract the truly distro agnostic contents of the TAR archive to a USB device, change to the way to create a live CD, then grab the Linux Live Kit boot/ directory and run the ./bootinst.sh script. (www.linux-live.org). This project produces a set of scripts that will go through your installed distribution and produce a Set up Arch Linux live version. Download the script’s tarball from the web and If you want a truly customised distro, you should set up extract it into /tmp. You might also want to rename the Arch Linux. While most distros provide a pre-packaged set extracted directory to something like linux-live-kit. of tools, apps, and configuration, Arch lets you design your The extracted directory has a hidden file named .config. installation from the grounds up. This means that you get Open the file in your text editor and change the value of the to decide everything that goes into your system. Heck, it LIVEKITNAME variable to the name of your distro, such as doesn’t even add any user by default except the root user! maggie-20072013. This DIY approach is an integral part of the Arch If you scroll down the file, you’ll notice the vmlinuz philosophy. It also makes Arch a wonderful distro for the variable points to /boot/vmlinuz. Various scripts in the kit truly obsessed customisers. Arch is a rolling release that expect the kernel at this location. In case your distro doesn’t can be bought up to date with a single command, keep the kernel in this location, create a symbolic link to the and Pacman, its package manager, is one of the best tools real kernel such as: for the job. ln -s /boot/vmlinuz-3.8.0-25-generic /boot/vmlinuz. To install Arch download the Arch install ISO from its If there are certain files in your home directory that you website (www.archlinux.org). The single ISO image will don’t want to include in the live version, first create a variable work on both 32-bit and 64-bit machines. Unlike most other distros, the Arch install CD only contains a bare minimum environment and you’ll have to fetch all packages from the internet, including the bootloader. Arch Linux’s live install CD will drop you to a root shell, which means the first order of business is to partition your hard disk and make space for Arch. The install CD includes the Gdisk tools for partitioning disks using the new GUID Remember Partition table standard as well as Fdisk if you want to use to remove the older MBR table. unnecessary files with a tool After partitioning your disk, you’ll have to format them. like Sweeper First mark the swap partition, sda5: before making # mkswap /dev/sda5 install into a # swapon /dev/sda5 custom distro. Then you will need to format the root partition, which is

40 LXF176 November 2013 www.linuxformat.com Build your own distro

You’ll now have to create an initial ramdisk environment, which will load kernel modules and set up the environment before handing over the control of init. Arch uses the mkinitcpio script for this purpose. Experienced users would want to edit the /etc/mkinitcpio.conf file before creating the ram disk with: # mkinitcpio -p linux The last step in setting up our basic Arch system is installing and configuring a bootloader. Arch supports the Grub and Syslinux bootloaders. In this tutorial we’ll set up the lightweight Syslinux bootloader, but you can setup Grub by following instructions that can be found on the Arch wiki (https://wiki.archlinux.org). Slax is an example of a lightweight distribution First, grab the Syslinux bootloader as well as the gptfdisk created using the Linux Live set of scripts. package to modify our GUID Partiton Table with: # pacman -S syslinux gptfdisk sda7, using the ext4 filesystem: Then install the bootloader and mark the Arch partition as # mkfs -t ext4 /dev/sda7 bootable with: Unless you are well versed with the command-line # syslinux-install_update -i -a -m disk partitioning and formatting tools, it’s best if you Finally, edit the /boot/syslinux/syslinux.cfg file to point to prepare your disk using external tools like Gparted. the Arch Linux partition. Oh, and before you log out of the Once you have prepared a root partition for Arch chroot environment don’t forget to set a password for the Linux, mount it on /mnt: root user with passwd. # mount /dev/sda7 /mnt Press Ctrl+D to exit the chroot environment and unmount If you have separate partitions for /home and /boot, the Arch partition with umount /mnt. That’s the end of the mount them as well in appropriate directories such as install process. You can now restart your computer and boot to /mnt/home, and /mnt/boot. into your shiny new Arch installation. Configuring the network shouldn’t be an issue if your network has a router that hands out IP address via Post install customisations DHCP, as the Arch install CD has a DHCP service Arch uses the Systemd system and service manager. So it’s a already enabled. If you don’t use DHCP, you’ll have to good idea to spend some time learning the basics of the manually setup an IP address. Arch can assist you with systemctl command, which interacts with Systemd. various tools, such as netctl and wifi-menu to setup the The installed base system only has a CLI. Before you can Wi-Fi network. install a desktop environment you’ll need to install drivers for Now edit the file that lists Arch mirrors to select a your video hardware. Use Pacman to search for a list of open preferred mirror for downloading packages: source video drivers in Arch’s repos with: # nano /etc/pacman.d/mirrorlist # pacman -Ss xf86-video | less When you’re done, use Arch’s pacstrap script to And install the one that matches your hardware. You can also download and install the core packages: download and install proprietary Nvidia driver with: # pacstrap /mnt base # pacman -S nvidia Once the core packages have been downloaded You can then use Pacman and begin to install components generate an fstab file to define how the storage devices such as your preferred desktop environment, an office suite will be mounted: and a web browser etc. You can also set up a user with the # genfstab -p /mnt >> /mnt/etc/fstab useradd command. You’ll now have to chroot into the installed base to When you’ve set up your custom system, you can use the configure the other components of the Arch installation. Archiso set of Bash scripts to generate live CD/USB images Arch Linux wraps the standard chroot command inside of your installed system. Using the scripts you can carry a a custom script called arch-chroot. bootable version of your custom Arch install with all your # arch-chroot /mnt apps on a flash drive. The package is well documented on the Congratulations, you’re now inside your new Arch Arch wiki with step-by-step instructions. installation. You’ll now have to set your hostname by Now you’re all set to cook your very own flavour mentioning it in the /etc/hostname file. Also symlink of Linux. Using your preferred tools (on and offline) /etc/localtime to your timezone listed under covered in this feature you can roll a simple distro /usr/share/zoneinfo, such as: for your personal use, or pique the interest of family # ln -s /usr/share/zoneinfo/GB /etc/localtime and friends with a localised version, or even Then open the /etc/locale.gen file and uncomment host it on the internet and nurture the locale you wish to use, such as en_GB.UTF8 UTF8. a community around it. Who knows A locale defines a user’s language, country and other – if you produce something related parameters. Now you’ll need to set the keyboard absolutely brilliant your custom mapping with: distribution might find its way into # localectl set-keymap uk the LXFDVD! LXF

www.tuxradar.com November 2013 LXF176 41 GNOMIC CYBORG

For more of Karen’s wisdom go to TuxRadar.com

Andrew Gregory talks to Karen Sandler, Executive Director of the Gnome Foundation, and hears some compelling arguments for software freedom.

A cyborg gnome Software Freedom Law Center; finding out that whether I needed one, getting doctors’ opinions conjures up images of I needed this device, then finding out that it and then getting second opinions, and I kept a garden ornament was based on proprietary software. Over the putting it off. I took a whole year, and I finally Interview wielding a phased course of evaluating whether to get this device decided I would get the device. plasma rifle in the 40 and having the magnitude of all of that sink in, And then it took me a whole other year to do watt range, so we’re I realised that it’s not just my medical device; the research, because every time I read about looking forward to it’s not just our lives that are relying on this the failures of these medical devices it affected meeting Karen software: it’s our cars, and our voting me so personally. Reading about the failed Sandler, executive director of the Gnome machines, and our stock markets and now our insulin pumps other software failures on Foundation and self-professed cyborg phones in the way that we communicate with medical devices, people who got lethal doses of lawyer. What followed was a journey through one another. We’re building this infrastructure, insulin… I would start working on it and then Gnome 3, security flaws in medical implants and it’s putting so much trust in the hands of have to put the research away, and come back and why people shouldn’t be jerks online. individual corporations, in software that we and start again. It took a long time because it can’t review and we can’t control. Terrifying. was a very emotional issue for me. Linux Format: I saw your presentation on closed source medical software from two LXF: Had you only just got the heart device LXF: Was that because of a bug? years ago, in which you were talking about when you found out that it contained this KS: There were multiple reasons why the insulin proprietary software used in medical mystery software? pumps failed, one of which was that it was implants. The intellectual case for free KS: I found out when I was 31 that I had the unclear which field was minutes and which was software there is unanswerable. heart condition, and then it took me a whole hours for the dosage time, and so people were Karen Sandler: It was really weird to year of struggling with the idea of whether I setting minutes when they thought they were experience personally, being a lawyer at the should get this device. First of all figuring out setting hours for the dosages. I don’t know

42 LXF176 November 2013 www.linuxformat.com Karen Sandler

whether you’ve read about this, but there‘s a KS: Only in raising awareness of the issue, glad that Barnaby Jack and Kevin Fu do their guy called Barnaby Jack, who has done some which has I think been very helpful. I don’t work and demonstrate that these devices, really cool research in showing how know if it’s really because of me, but some of where they’re not publishing the code, are vulnerable these devices are, and he has the jokes I have made have made it into other totally maliciously hackable. Security through demonstrated that with an iPhone in a public areas. Like, a joke that I had made in my early obscurity doesn’t work. place you can identify people with insulin talks about this was also made on The Big pumps and pacemaker/defibrillators and in Bang Theory. It probably wasn’t me exactly, LXF: It seems silly to continue with this both cases can deliver a lethal result. but I think just me talking about it in tech interview. Everything else is going to seem I actually have an older device, because I was circles, you know, it captures the imagination. banal in comparison with having potentially so freaked out about this. It’s been a plot point in CSI and it’s been a buggy software implanted in your vital organs. [Note: Barnaby recently died unexpectedly. plot point in Homeland, the TV show. KS: OK, so we’ll bridge to desktop environments You can read Karen’s Gnome blog comment I’m not so full of myself that I would take from this: I was at a Usenix conference right about it here: http://bit.ly/173I0IQ]. credit for these things, but describing the after I gave that talk, a Usenix healthcare situation and talking about it I think makes conference where I was asked to be on a panel LXF: It’s pretty crazy that you can interfere people think about it in that way. There’s with a gentleman who is in cyber security at the with someone’s heart by Wi-Fi. been progress in popular culture and FDA. That was amazing because one of the KS: I was so freaked out about this. I kept understanding that these devices can be talks I heard at the conference was a woman trying to talk to doctors about it and they problematic. There’s been progress with the who was showing an app that she’d made for wouldn’t listen to me, or they just didn’t know FDA in that it’s announced now that there her iPhone where the phone could talk to her how to handle the conversation with me. could be problems, but there’s been very insulin pump. She had a fitness program on the I had one electrophysiologist who I talked to little discussion about the software iPhone where she could keep track of who just hung up the phone on me. transparency component to this, and very everything she ate and all of her exercise. The I said that I can imagine that there are few efforts to curb the medical device iPhone could talk to her insulin pump and classes of people who might be attacked in companies. The most believable reason I’ve monitor her blood sugar levels, and basically tell this way. Think of the people who have these heard for not requiring the device companies her how she was doing with the exercise and devices: people who have access to really fine to publish their source code is that it will her eating with respect to her blood sugar levels, medical care. What percentage of our probably expose them to patent liability. And first I was like “that’s kind of cool” but then I politicians, or our judges, or other people in realised: “Oh wow. Her iPhone is talking to her positions of power have these devices? Dick LXF: They wouldn’t lose out on licensing insulin pump!” Cheney had one of these devices. It’s not that fees; I can’t imagine that one manufacturer We’re relying on Apple for our health! To talk hard to think about targeting, sending out a would develop software to be used in to our medical devices? When did that happen? signal… so he hung up on me. another’s pacemakers, for example. We’re building crazy amounts of infrastructure, I finally found another doctor who KSL: It’s a perfect example of where a and we’re doing it by entrusting all this stuff to understood the issue, and I got one of the proprietary business case makes no sense. these companies. older devices. You can talk to it with magnetic coupling. It doesn’t have the wireless LXF: But I think it also sounds like a LXF: There’s the Microsoft guy over there [we component. It’s starting to run out of battery perfect example of fear, uncertainty and all turn and wave at the Microsoft guy who is though, so I’m going to have to get it doubt about open source software, that replaced. I’m going to have to confront it people allow to flourish in business ON MEDICAL IMPLANTS again, because there aren’t any of the older software, for example. Releasing their devices left, so I’m going to have to get a new software and realising that there are these “If software isn’t one, and they still haven’t fixed this problem. critical problems in the source code that could be taken advantage of. reviewable then LXF: Have you made any progress on the KS: But these vulnerabilities exist in medical devices? proprietary software too. This is why I’m so we’re in trouble.”

Question: How comfortable would you feel about having propriety software regulating your heart beat?

www.linuxformat.com November 2013 LXF176 43 Karen Sandler

“I only care that free and try to fix problems from the bottom-up. and open software It’s one of the things that Gnome is really well wins at the end of the known for and one thing that I’m really proud day,” says Sandler. of about our community. That’s why there’s a great Wayland track at this year’s GUADEC (the Gnome Users and Developers European Conference). Systemd, PulseAudio, all sorts of great stuff that has come out of our community because of that philosophy, and this philosophy in particular is something that we should try to highlight and work together so that we have less duplication across the stack. We as a whole are such a tiny, tiny percentage of the market, and when we can’t give a clear answer to someone about what they should use or where they should start, you have 10 different projects going off in different directions, it’s tough. I only care that free and open source software wins at the end of the day. I’m with ON GNOME 3 Gnome because I think it’s awesome. I think it’s The One, but if another free software “This is the answer… it’s sleek, it’s solution wins at the end of the day I don’t mind so much; I just think we need to figure pretty, it’s easy to use and it’s different.” out what that is and all work together. having a chat with someone on the other bringing in more voices; we can care about all LXF: On the subject of all working together, side of the room. He waves back] the privacy issues; we can care about things can you tell us a bit about the Gnome KS: In a previous world we would have had a lot that may not be in the bottom-line interests outreach programme for women? My first of government oversight and we would have of particular companies, because we’re free question was going to be: “Why does the had real infrastructure that was publicly software and non-profit. sex of the person who wrote my distro motivated. We’re making choices now that are matter?” But then when I looked again at going to be hard to go back on. We’re building LXF: Does it bother you that a lot of people the numbers, it’s kind of obvious that standards and we’re building reliance on are not too impressed by Gnome 3? there’s something wrong. different kinds of software, and people don’t KS: You know, I think people have strong KS: It’s amazing. Only 25% of all software even think about it. Software is just a tool right? opinions about it, and people have been developers are women. That includes all Like a hammer? No one would think about the slowly coming to it. Gnome 3 was already proprietary software. It used to be 30%. ethics or morality of a hammer. But it’s just not well underway by the time I became So you start out with that, which seems the case with software. If software isn’t executive director. And by the time I took the like a low number already, but OK, that’s kind reviewable then we’re in trouble. job Linus Torvalds had already said his of understandable, women are less into We need to build on free and open negative comments about Gnome 3, and software, I don’t know what the reasons are, platforms, and that’s why I moved to Gnome. there was a storm of negative press. but OK. Then you look at students, and only Because now we use our computers for There’s something – I think it’s press in 18% of computer science graduates are everything, and therefore they have to be general, but I think it’s even more so in the women. That also used to be a little bit higher, usable, by everyone. If we keep making tech press – negative press gets picked up so but whatever, It’s sort of like OK, that’s even solutions that are not easy for everyone to use, hard, and there was sort of this feeding less good; and then you look at free and open we’ll never get adoption. And if they’re not built frenzy (no one really covered when Linus source software and all of the stats on the by an independent, non-profit driven structure, started using Gnome 3 again, for example). involvement of women are dramatically lower. we’re just making bad choices as a society. And so it was really slow going at the The most I’ve even seen is 5% quoted but When I first saw Gnome 3, I thought: this is the beginning, but I think more and more people usually 3% or even 1% are the numbers used. answer we are looking for. It’s sleek, it’s pretty , have come back, given it a chance and found It’s an order of magnitude off. it is easy to use and it is different from anything it to be this great environment. It’s just so that free software has done before. pretty looking to start with, and it’s so easy to LXF: Why do you think there’s such a Two years later it still feels the same way. use, so people who want to give it a try wind massive gulf there? I would have expected it I love showing off Gnome. When I use it on up being quite enthusiastic about it … I’m not to be the other way round; free software is aeroplanes people go “What is that? That looks pointing any fingers, but because there’s supposed to be inclusive and happy. so cool!” I think it uses the best of the PC and been a lot of fragmentation in the area it’s KS: I don’t want to get too much in detail the Mac paradigms, so people can come in actually made things a lot worse, because it’s about wondering why, because everything from both sides, and it’s very easy for me to made, I think, people who maybe would have that I talk about is anecdotal. There aren’t transition from society-critical software to the been formerly partners fan the flames a little great surveys and research that show it. desktop, because Gnome is an ideological bit. And I think that’s sad, and I think that we approach to computing and making sure that should find all opportunities to work together LXF: That’s a problem in itself. everyone has access to it. In a free software to advance the GNU/Linux desktop together. KS: Yes, that is a problem, but I don’t have that non-profit world we can care about Gnome is very well known and differentiated information. Actually the Ada Initiative is accessibility; we can care about things like by the fact that we actively dive into the stack working towards getting more concrete data.

44 LXF176 November 2013 www.linuxformat.com Karen Sandler

all before it took part in our outreach programme for women, which is amazing. And the Linux kernel has a terrible track record in attracting women to participate. Now this summer there are seven women who are contributing to the Linux kernel actively through the programme. So it’s a programme that works, but one of the things is that we’ve been learning all these lessons at Gnome and we’re trying to do the best that we can to give all our newcomers a shot. Not all of those things are going to be as incorporated into the other projects. We encourage other free software projects to make efforts to incorporate and newcomers at their conferences, but I’m sure they don’t do the exact same thing as we do, and they’re finding out what works for them. We do now require that a $500 stipend is added into the internship, so the internship amount is now $5,500: $5,000 for the internship and $500 for travel. And that’s because if you bring these Sandler advocates the need for more women to events where they can meet the “friendly communities.” people they’re working with, they’re much more likely to stick around and form the relationships that we need in order to improve LXF: Doesn’t GitHub collect information on our communities. So we can have the program, the sex of its contributors? ON BEING INCLUSIVE but if we don’t actually keep some of these KS: Do you want it to? I think there are studies “People shouldn’t women and integrate them into our that show that when you ask people to provide communities there’s no point in doing any of it. their gender, you’re first of all asking them a be jerks on We’re trying to do the best we can at Gnome to binary question, which is not necessarily the make things better, but I think the different right way to go because many people feel like mailing lists.” participants in the outreach programme for they don’t fit into one gender or another. women will find their own way. KS: We have one big session at GUADEC – LXF: In the UK you can’t go to the dentist, it’s like a keynote basically, a keynote lightning LXF: We’re sold. How can we help? for example, without filling in a form that talk session – where all the Google Summer of KS: If you know smart women, just tell them asks for your sex. It’s annoying, but I can Code and Outreach Programme for Women about the programme. They can either understand why they’re doing it. participants just present their work. And it’s potentially get involved in some way or KS: You’ll also find that of the people who don’t great. For a lot of people English is their second another. We actually got a number a of great respond, a much higher percentage of them language, so giving that talk is a major applicants from friends of mine posting on tend to be women. So that skews the results as challenge. But then they have the confidence social networking, who were not even in free well. It’s really tough to get a handle on those that they have presented in that way and the software. Just getting the word out means that numbers. I’d rather just think about all the whole community has seem their work, and women who are qualified… There are reasons that could possibly be the case and try knows what they’re doing and knows why exceptionally talented women who will go to to find acceptable solutions to them. That’s they’re there. That’s great, and it has helped a proprietary software jobs without even giving what we’ve been doing. You know, if people are lot with having people feel like they’re more free and open source software another jerks on mailing lists, women in particular get integrated into our community. thought. It’ll get them thinking… If you’re in a turned off. Anecdotally, that seems to be the Actually it’s not just have them feel that free software project, consider joining us, and if case. You now what? People shouldn’t be jerks way, but really be more integrated, because you’re working in a company, please, please, on mailing lists. We should have friendly when somebody else is working on please, ask about sponsorship. LXF communities where people don’t feel like something related to it they know that they they’re going to be harassed. should talk to that newcomer as well. We have an outreach programme for Karen Sandler got excited when we LXF: But everyone benefits when people women and we’ve extended it to other free mentioned MikeOS. aren’t jerks on the internet. software projects and so we have 18 KS: Everyone benefits. And that’s what we’ve different projects that are participating found with the outreach programme for through different distros. So we’ve got women. Each of the things that we’ve tried to Debian and Fedora, and we’ve got the Linux overcome, we’ve found, makes our community kernel, and Wikimedia. better for everyone. So why not just do that? LXF: Subversion? LXF: What else do you do to make the KS: Yes, as I understand it, Subversion community better for everyone? didn’t have any women contributing to it at

www.linuxformat.com Raspberry Pi add-ons Ben Everard investigates the extras on offer for the device that has turned us all into tinkerers.

he Raspberry Pi is probably the most understand how to use it, though. This was a these haven’t been developed by large successful British computing product particular problem when the Raspberry Pi first companies, but by hobbyists who saw a need Tin a decade, but it’s also one of the came out: there were few tutorials explaining and filled it. It’s been great to see just how most misunderstood. Too many people think of how to use it, and if you wanted to use the quickly new and innovative devices have come the Pi as just a cheap desktop, but by the time GPIO you had to build any add-ons for yourself. on to the market. you’ve bought a monitor, keyboard, mouse and Fortunately, times have changed quite rapidly, Here, we’re going to look at three of our SD card, you’ll have spent almost as much as and a whole ecosystem of components for the favourite add-ons, so if you’ve got a Raspberry you would buying a cheap laptop – and it’s a Pi has sprung up. Pi acting as a paperweight, blow off the dust whole lot less powerful. Every day, it seems, we hear news of some and put it to a more productive use; if your Pi The real innovation of the Pi, then, isn’t its new device that connects to the Pi to enable project is already complete, well, you know it cost, but its form factor. It’s small, it can be run some function or add some feature. Many of needs just one more feature don’t you? off a few batteries (or solar cells), and has GPIOs (General Purpose Input and Output pins) exposed. This trio of features is almost “Times have changed quite rapidly unprecedented in computing, and before the and a whole ecosystem of components Pi, it had never been done at this price point. Because it’s not just a new device, but a new for the Raspberry Pi has sprung up.” type of device, a lot of people struggle to

46 LXF176 November 2013 www.linuxformat.com Raspberry Pi add-ons

Pi Lite A multi-purpose LED display.

hen the folks at Ciseco mulled over the problem Since the Pi Lite is driven from a serial port, it’s actually of underused Raspberry Pis, they came up with a quite portable, and can be run from any device with such W simple solution: stick a shedload of LEDs on a capabilities, whether that’s Raspberry Pi, Linux PC or almost board and create a simple way for people to turn them on and any other computer (such as via a USB FTDI connection). off. Why? That’s up to the user’s imagination, but it made the Getting this set up will require a little soldering, but shouldn’t Pi stand out from a regular PC and forced people to think be too complex. about its particular niche. From this simple idea, the Pi Lite was born. It contains 126 Pi Lite emulator red LEDs (and there’s a white LED version coming soon) on a If you’re interested in seeing how the Pi Lite works, but aren’t board that plugs into the GPIO pins on the Pi, and then sits quite ready to part with any money, Ciseco has made an neatly over the top of the main board so the unit doesn’t take emulator so you can try out the hardware before you up any more space than a naked Pi. purchase it. This is available from (yes, you guessed it) It’s not quite a plug and play add-on, and there’s a little Ciseco’s Open Micros website at http://bit.ly/14Li3d4 configuration needed to enable the board to use the serial The Pi Lite has one more trick up its sleeve: it uses an port, but it’s not too complex as long as you’re using the ATMEGA chip to drive the LEDs. This just happens to be the Raspbian OS, and it’s well documented on Ciseco’s same family of chips that are used in the popular Arduino openmicros.org website at http://bit.ly/1c0GOY1. It should boards, and the Pi Lite comes with the Arduino bootloader take no more than 10 minutes, though you will need a installed. In other words, you can program the microcontroller network connection to install some software which could on the board to do whatever you want. make it a little tricky on a model A. In fact, you could even run the Pi Lite board as a Scrolling With all that done, you can control your Pi Lite over the standalone unit without any other computer attached. The text, 80s-style serial port. From the command line type: board also exposes the five analogue inputs from the interface, the minicom -b9600 -o -D /dev/ttyAMA0 ATMEGA, which means that with a bit of programming, you world’s lowest and you will have an interface to the LEDs. Anything you type can make those accessible for your project. This is a bit more resolution digital will scroll across in glorious red light. This is pretty cool by complex than the standard use of the Pi Lite, but it is an camera – what itself, but it’s only the beginnings of what the Pi Lite can do. As excellent example of how a single piece of hardware can help will you do with well as text, you can also send commands to the unit. These you develop a wide range of technical skills. your Pi Lite? are anything preceded by three dollar signs. For example: $$$ALL,ON will turn all the pixels on the Pi Lite. There are additional modes to display vertical and horizontal graphs, and to manipulate individual pixels. This final mode takes a string of 126 1s and 0s, each of which represents a pixel, such as: $$$F00000000000000000000011100001111111001111111011 111111111110111111110111101100011001100011000000000 0000000000000000000000000000 This final mode allows you to draw any images that you like, though it’s probably most useful when used with scripts rather than through typing. Since all communication to the Pi Lite goes through the serial port, you can access it using any language that supports serial communication. Python (using the serial module) is probably the easiest to try, and there are plenty of examples to get you started, again on Ciseco’s Open Micros website at http://bit.ly/19C3Sve.

www.tuxradar.com November 2013 LXF176 47 Raspberry Pi add-ons

Camera module Take pictures on your Pi.

efore we get on to what the camera module is, let’s first clear up what it isn’t. If you’re looking for a cheap Bwebcam to Skype with your family, the Raspberry Pi camera module isn’t for you. Not least because Skype doesn’t run on the device. The Raspberry Pi camera is easy to use, but not in a plug-in-and-use-graphical-tools kind of way. Instead, it’s designed to be scriptable. Now, with that cleared up, let’s get started. The camera module comes as a ribbon interface that slots into the vertical connector between the Ethernet port (or the Ethernet port- shaped gap on the model A) and the HDMI connector. Lift the top of the connector up, slot the ribbon in with the silver side raspistill -ifx cartoon -ISO 800 -tl 100 -t 10000 -w 300 -h 300 facing the HDMI port, then push the top back down. -o test_%04d.jpg With this done, you’ll need to make sure you’ve got the Here we’re using quite a few of the command line options. latest version of Raspbian with: -ifx is image effects, and it allows you to do all sorts of cool sudo apt-get update stuff. In this case, we’re using it to render the pictures in a sudo apt-get upgrade cartoon style. -ISO sets the ISO sensitivity. We’ve used a high sudo rpi-update one since image quality doesn’t matter too much in this case. Then run raspi-config and make sure that the camera is -t1 sets the timeout between the photos in milliseconds, while enabled. Finally, restart and you should be ready to go. -t sets the total time for the timelapse capture, again in All the magic is done with two commands: raspistill and milliseconds. -w and -h are width and height in pixels. Finally, raspivid. It should be pretty obvious which one takes still -o is the image filename (the _%04d is a number that’s images and which takes videos. You can, of course, just run it incremented with every picture). like this, and type the command each time you want to use These, of course, are just a few examples to get you the camera. To capture a still image, it just takes: started. For a full list of options for the camera, just run raspistill -o image.jpg raspistill from the command line (with no options). Some of However, that’s not where the fun lies. Because you can them won’t make any sense unless you’ve got some run these from the command line, you have full power to photography experience, but with a bit of fiddling, you should include it in your programs. For example, if you never know get the hang of things. what white balance to use, why not use all of them with the As we mentioned before, raspivid can be used in a similar following Python script: way to capture videos. To capture a simple video, run: from subprocess import call raspivid -t 5000 -o video.h264 for awb in [‘off’,’auto’,’sun’,’cloud’,’shade’,’tungsten’,’fluoresce and the more advanced options are similar to raspistill. nt’,’incandescent’,’flash’,’horizon’]: Once you’ve mastered the basics, you can try out some call([“raspistill -n -awb “ + awb + “ -o image” + awb + “. more advanced projects. How about facial recognition using jpg”], shell=True) OpenCV? There’s a tutorial from the Think RPI blog to get you As you can see from the above, you can control the started at http://bit.ly/13WDdoy/. camera from Python, even though there aren’t any Python bindings, by using a system call. You can do this in most languages, so hack away in your language of choice. Since all Other cameras Raspberry Pi the options are available as command-line switches, you camera module should easily be able to build the options you want into the Connect your webcam or DSLR sketch mode == system call. Next, how about trying to make a stop-motion awesome! cartoon of your life? So far, the official Raspberry Pi camera module is the only camera that can link up to the vertical connector, but the Pi can still talk to a wide range of cameras via USB. Not all webcams will work, but there’s an incomplete list available of the ones that currently do at http://elinux.org/RPi_USB_Webcams. It’s well worth checking before you buy one. Regular digital cameras can also be accessed through Gphoto2. Most modern digital cameras are supported to some extent, but not all features are available on all cameras. For example, you can get photos off almost any camera, but it’s unlikely you’ll be able to control a point-and-click unless you’ve specially picked it. Find out what this software can do at the project’s website, http://www.gphoto.org/, and you can find a list of cameras known to work with remote capture at http://www.gphoto.org/doc/remote/.

48 LXF176 November 2013 www.linuxformat.com Raspberry Pi add-ons

The natty ribbon cables add a splash of colour to Pi projects, but Quick2Wire GPIO expansions won’t work with some cases. Extra ports to improve your Pi’s connectivity.

ne of the best features of the Raspberry Pi is the There’s quite a bit of setup to get a Quick2Wire board up and exposed GPIO pins. These allow you to add whatever running. Not least the need to configure kernel modules. You Ocircuitry that you want to your Raspberry Pi. They’re will find an online guide on the Quick2Wire website, at http:// both easy to use and easy to understand; with a single line of quick2wire.com/articles/beta-kit, though it did miss a few Python or Bash, you can turn them on or off, or read their things, such as the location of the Python library (which can input. While they’re good, though, they’re not perfect. be found at https://github.com/quick2wire/quick2wire- You can see a lot of pins, but not all of them are available python-api. We also found that we needed to install the to use, and there’s no analogue input or output. They also python3-setuptools package. have very little protection, and if you apply the wrong voltage Once up and running, though, it was straightforward to (or even if you accidentally link the wrong two pins together) program the board with Python. Right now, it’s not a you can fry your Raspberry Pi a little too easily. question of which Raspberry Pi GPIO board is best, but which Several companies have developed products to help is most suitable for your project: Ciseco’s Slice of Pi is a great, simplify the process and each works better in different low-cost device to make Pi GPIO use a bit safer; the Pi Face is situations. For example, Ciseco’s Slice of Pi gives access to 16 a really good board for experimenting with physical GPIOs that are protected to work at both 3V and 5V; the Pi computing, especially if you don’t have a specific use in Face adds some useful features, such as buttons, LEDs and mind; while the Quick2Wire boards are incredibly useful if relays (to control motors etc); and the Gertboard adds a wide you need the power of SPI or I2C to daisy-chain peripherals range of input and output features that are useful for learning and port expanders. LXF about the various applications. You can even hook up an Arduino and use this to control input and output, although this will require programming in C. However, we’re going to look at Quick2Wire’s I2C and SPI board. Other extras

GPIO expanders Accessories and expansion kits SPI and I2C are both Serial Peripheral Interface and Inter- Intergrated Circuits (often written I2C and pronounced ‘eye- Right now, there’s an embarrassment of riches for squared-C’). In its basic usage, the Quick2Wire setup comes anyone looking to expand their Pi’s features. Adafruit in two parts: the main board breaks out the I2C and SPI ports (www.adafruit.com) supplies a range of Pi products as well as adding protection for the Pi and voltage selectors. that’s been specially designed for tinkerers in the US. UK Pi players can get their hands on Adafruit gear through The company also makes I2C boards that add GPIO ports Pimoroni (http://shop.pimoroni.com), which also and analogue input and output to your device. These boards stocks a few of its own products, including the popular can also be daisy-chained to add even more ports to the Pi. Pibow case. You will have to do plenty of work yourself and solder the As well as the more general purpose peripherals, boards on your own but, once done, connecting them is there’s also a host of more specialised add-ons. The simply a case of plugging in the ribbon cables. BrewPi (http://brewpi.com/) has been designed to help thirsty geeks make beer – look out for it in future issues of Linux Format. Hardware hackers keen to ply their trade are also turning to Kickstarter. In fact, the first “It was simple to UK kickstarted project was a Raspberry Pi arcade machine by Pimoroni. Keep an eye on crowdfunding sites program the board for upcoming projects. with Python.”

www.tuxradar.com November 2013 LXF176 49 Birth of the Ubuntu phone

Our expert Jono Bacon is the Ubuntu Community Manager.

BIRTHOF THE UBUNTU Jono Bacon walks us down Canonical’s long road to the PHONE Ubuntu Phone. ack in 2004, Linux was a and 19 releases later, Ubuntu is overseeing a Ubuntu has always been a traditional considerably more technical world far more ambitious mission: to create a single Linux distro that pulled together a collection than it is today. Even the more converged operating system that runs across of open source projects and integrated them Bnovice desktop flavours involved the desktop, phone, tablet and TV, as well as to make them work well together. Although installation procedures, choosing tools, the cloud and the server. Ubuntu’s core code was sourced in other limited documentation and, at times, Of all of these platforms, right now the projects – the Linux kernel, Gnome, X complex configuration. Though many of us focus is very much on building the first Window System and Libre Office – the dreamed of the power of Linux simplified for version of the Ubuntu Phone. Fortunately, due integration work was complex. It involved all, it was, by definition, a geeky domain. to the convergent nature of this business, the bringing together all those disparate Back in 2004 Canonical’s distro came in majority of this work benefits each of the components, user interfaces, dependencies one form: Ubuntu for the desktop. Nine years other devices too. and more into a single consistent system.

50 LXF175 November 2013 www.linuxformat.com Birth of the Ubuntu phone

Ubuntu quickly became the most popular desktop Linux distro and it attracted attention not just from the Ubuntu community, but from the mainstream media as well. The decisions Ubuntu made impacted on the wider Linux world almost as much as they did on the distro. The growth in Ubuntu also generated commercial interest. Before long, the four largest OEMs in the world were shipping Ubuntu pre-installed on their systems, and the introduction of Ubuntu Server was generating interest from server hardware manufacturers and service providers too. Remember, this was back, largely, in the days when most hardware came in the form of desktops, laptops and servers. But then the market changed. With the arrival of increasingly powerful smartphones – largely driven by companies wanting a piece of Apple’s pie – the hardware world started to evolve. Before long, we had a new generation of netbooks, mobile internet devices and tablets. The mobile industry was hotting up and the hardware industry was exploring new avenues; it became obvious to Canonical that in order for Ubuntu to stay competitive, it needed to harness Ubuntu available side-by-side for comparison on a desktop, this new revolution, not merely dig its heels into the desktop phone, tablet and TV, the convergence was visible and and refuse to acknowledge change. intriguing for onlookers, particularly at the Mobile World Canonical is Congress (MWC), where the entire vision was exhibited. putting a lot of Promoting Unity faith in its dream The start of Ubuntu’s evolution into a new converged world Phones 4 Ubuntu of convergence was the introduction of the Unity desktop environment in late One of the unique features of the Ubuntu phone is that it – that is, one OS 2009. Shortly before it introduced Unity, Canonical had been doesn’t require any buttons on the front. Instead, you to control every exploring refinements and improvements to Ubuntu in the swipe the edge of the screen to access different features. device you own. form of the messaging menu and new notifications. These After pressing the Power button, a swipe of the left edge of changes were not merely engineering ideas promoted to the screen brings up the familiar Unity launcher with a shippable state, they were design-driven, user-tested features stacked collection of icons to load different applications. As that solved many of the problems the developers had with the desktop, these icons collapse as you slide up and witnessed users experiencing. down to provide space for as many of your favourite These early refinements transitioned into a wider plan in applications as you like. the form of Unity, so named to deliver a unifying experience. At the bottom of the launcher is an Ubuntu button, which Unity was intended to simplify the desktop, maximise screen unlocks the phone and takes you to the Home view. In much real estate, and challenge many of the presumptions people the same way as the Dash works on the desktop, there are had about the traditional different views (called Master Linux desktop world. Scopes) for Home, Apps, Canonical continued to “The Ubuntu phone Music and Video. Each of share work that contributed doesn’t require any these scopes provides access to the vision of one familiar to content either on your interface that would work on buttons on the front.” devices, in the cloud, or multiple platforms. Ubuntu for available to purchase. Sliding Android enabled a docked Android phone to boot a full left and right jumps between these different content types Ubuntu desktop. Much of this work was possible due to and you can then slide up and down to browse, tap an item to Canonical’s close relationship with Linaro, an organisation view more information or view/buy/download. This that consolidates and optimises open source Linux software, functionality is subtle but important: it integrates content ensuring that the Ubuntu archive could run on ARM devices. right into the phone. You no longer need to load an application Ubuntu TV demonstrated the design principles of Unity to access your music, videos or apps – they’re all right there applied to television, but the convergence story really kicked at the core of the phone. off in January, when Canonical announced Ubuntu If you load an application, such as Gallery which shows for phones, quickly followed by Ubuntu for tablets. With your photos and videos, you can swipe up from the bottom of the screen to access that app’s functionality. For example, if you’re viewing a photo, an upwards swipe will show options Global network such as Edit or Share. The HUD works in much the same way as it does on the desktop, except instead of pressing Alt, a long upwards slide Canonical recently announced the formation of the Ubuntu brings up a small search icon that you can use to see the Carrier Advisory Group to help shape Ubuntu for mobile phone’s equivalent HUD functionality. phones. With representatives from all over the world the current CAG membership list includes Deutsche Telekom, If you now open a variety of applications, such as the Everything Everywhere, Telecom Italia, China Unicom, browser, gallery and camera app, the right edge comes into Korea Telecom, LG UPlus, Portugal Telecom, MTN Group, play. Swiping from the right switches between the different SK Telecom, Verizon Wireless and Smartfren. open applications. This makes multitasking as simple as a swiping from the right to the left of the screen. On the

www.tuxradar.com November 2013 LXF175 51 Birth of the Ubuntu phone

Compiz and the Nux toolkit (the latter designed and built specifically for Unity). The new converged Unity is being rewritten using the popular Qt QML framework. This codebase is known as Unity 8. Importantly though, there is not a different Unity for each device form-factor. Instead there’s a single Unity codebase that displays the appropriate user interface depending on the screen size and configuration of the device. As an example, if you take Unity 8 and run it on a device with the dimensions of a phone, you will see the phone experience. If you then widen the same instance of Unity 8 to the dimensions of a tablet, you will see the tablet experience. Likewise, the same will happen for desktop dimensions. Ubuntu for tablet, sliding out from the right edge shows the side stage, This has a few notable benefits. Firstly, when a bug is fixed phones looks which enables you to run phone applications within a smaller or performance is further improved in Unity 8 it instantly slick and elegant. window and be able to easily interact with tablet applications applies to all form-factors. Secondly, it means that Unity can (such as dragging content from the tablet web browser and easily and effectively switch between these user interfaces saving it in the note-taking app in the side stage). when required. As an example, you might want to take your The top and final edge of the screen is where you Ubuntu phone and plug it into a monitor with an HDMI cable configure the phone’s most common parts. In much the and then see the Ubuntu desktop experience. This means same way as you have the indicators in the top bar on the that although much of the work going on right now is getting Ubuntu desktop, you have the same indicators on the phone; Unity ready for the phone, all of that work ultimately benefits sliding down from the top screen lets you navigate between all of the different form-factors. them and view controls for Another important piece in configuring those items. As the stack is the Mir display an example, you can select a “A single Unity server. Mir provides a next- wireless network, change the codebase displays generation replacement for volume, adjust power the ageing X Window System settings, and more. the appropriate UI.” that has been in commission As with the Ubuntu for the past 25 years or so. desktop the messaging menu is also present. This little Although some were disappointed that Unity didn’t move to envelope icon lights up when you receive a text message, Wayland, the choice of building Mir was born out of creating Facebook/Twitter direct message, missed call, or other something lighter than Wayland in terms of breadth of content. All of your messages are in one place and when you features and more orientated towards these multiple devices. select a message you can respond from within the messaging menu. This means that you can reply to messages without Taking it for a test drive having to load a separate app or even exit an existing one. If you have a Galaxy Nexus or Nexus 4 phone and want to give Ubuntu for phones a whirl, you first need to understand Another dimension that it is unfinished software. You should back up any data The development of Ubuntu across these devices has not and applications you need as Ubuntu is going to replace it only involved producing a single and consistent design with a new operating system. Fortunately, you can revert to experience in Unity but also a great deal of convergence and Android if you need to later (albeit, without your original data, unification at the software level too. hence the back-up!). Traditionally the Unity that has shipped on Ubuntu First install the software from the PPA: Desktop has been the Unity 7 codebase, written using sudo add-apt-repository ppa:phablet-team/tools Writing Ubuntu phone apps

Ubuntu for phones won’t be able to take advantage of the huge number of Android applications out there, so it’ll need developer buy-in if it’s going to be a success. With this in mind, Canonical has tried to make it as easy as possible for developers to get involved. If you want to write an application for Ubuntu running on any of these different devices – not just for phones – you can use the Ubuntu Software Development Kit (SDK) that has recently seen its beta release. Applications can be written for Ubuntu using QML, HTML5 and OpenGL, and the SDK provides a complete integrated development for creating these applications, complete with comprehensive documentation. Best of all, the SDK includes detailed tutorials as well as a small selection of example applications. To get started, visit http://developer.ubuntu.com, download the Ubuntu SDK Ubuntu’s SDK make a lot more sense (and is a hell of and get started with the tutorials. a lot easier to install) than its Android equivalent.

52 LXF175 November 2013 www.linuxformat.com Birth of the Ubuntu phone

Ubuntu core apps

When Ubuntu for phones was announced there More than 1,500 developers volunteered to the line-up. Members of the team at Canonical was also a request for community participation contribute to the project and since then the have been working with each of these to help write the core set of applications that will core apps have been making steady and community members to help coordinate the ship with the phone. The goal of this campaign significant progress, with many reaching core projects to get them ready in time, and the was to write the main calendar, clock, weather, feature completion. community has done a fantastic job. You can calculator, email client, RSS reader, music In addition to core apps we added Sudoku, track the progress of the project at https:// player, file manager, document viewer and Dropping Letters and StockTicker apps that wiki.ubuntu.com/Touch/CoreApps – be sure terminal applications that most users will need. other community members were working on to to come and participate.

Now do the following: Now save the version of the current image on the device as a sudo apt-get update reference to revert back to. The version can be found by going sudo apt-get install phablet-tools android-tools-adb android- to Settings > About Phone > Build Number. Fortunately you tools-fastboot only need to run through that unlocking process once. Now You now need to unlock the device (if your device is you can install the Ubuntu phone image to the device easily unlocked you can skip this). With the device powered off, by just running phablet-flash. power on the device by holding The latest version of the Power button + volume up Ubuntu phone will now be + volume down. The device will “When a bug is fixed, downloaded and boot into the bootloader. it instantly applies to automatically installed to the Now plug the device into device. When it is complete your computer via the USB all form-factors.” the phone will automatically cable. On your computer, press boot into Ubuntu phone. If Ctrl+Alt+T to start a terminal and type: you have your SIM card in the phone you should be able to sudo fastboot oem unlock make calls, receive text messages, and use the other features Now on the device screen, accept the terms of unlocking. of the phone. Your device is now unlocked! Now boot the device by pressing As the engineering team works hard to have a first cut of the Power button (pointed by an arrow with Start on the Ubuntu for phones ready by October, this is a story you are screen). Next, you need to enable USB debugging. This varies sure to want to keep an eye on – you might even want to grab depending on which version of Android you are running: a spare phone so you can have a play about with it. Although Ice Cream Sandwich (version 4.0) Go to Settings and there is a long road ahead, the journey has already been turn on USB Debugging (Settings > System > Developer rewarding... who knows what the future holds? LXF options > USB debugging). Jelly Bean (versions 4.1 and 4.2) Enter Settings, About [Phone|Tablet] and tap the Build number 7 times to see the Join the community Developer Options. On either Android version you must then enable USB If you would like to find out more Google+ Ubuntu App Developers about Ubuntu for phones, keep https://plus.google. debugging via Settings > Developer options > USB up-to-date with current progress or com/u/0/111697084657487423167/ debugging. You should now accept a host key on the device. get involved with the project, have a posts On the computer type: look at the following resources: Facebook Ubuntu App adb kill-server Ubuntu For Phones Homepage Developers Page adb start-server www.ubuntu.com/phone www.facebook.com/ubuntuappdev Depending on the installed Android version, a pop-up will Ubuntu Developer Portal IRC Channel appear on the device with the host key that needs to be http://developer.ubuntu.com #ubuntu-app-dev on Freenode accepted for the device to communicate with the computer.

www.tuxradar.com November 2013 LXF175 53 What on Earth Open vSwitch

What on Earth is Open vSwitch? Marco Fioretti explains the whys and wherefores of the mechanism that enables Linux to support swarms of restless virtual servers.

Let’s dive in then – what on Earth is it are concerned, as if each operating system You mean the companies that are Q Open vSwitch? had one whole, real computer all by itself. Q pushing all those on demand and cloud Open vSwitch (http://openvswitch.org) The actual software that is playing the trick is computing services? A is open source software that works as a called the hypervisor. Among other things, Exactly. In order for those services to virtual Ethernet switch (or bridge, since in hypervisors need internal switches to route A remain affordable, while providing a decent networking the two terms are synonyms). packets to and from those virtual machines as level of services to an ever-larger market, the Virtual switches forward traffic between if each of them had its own, independent servers and networks used by those different virtual computers on the same or on Ethernet connection(s). businesses need virtualised environments with different hosts and networks. much higher performances and flexibility. VirtualBox and similar programs could They need to be better than somebody I assume that this because virtual Q already do that. What was wrong with running two or three operating systems in Q computers can’t use real Ethernet their previous ways to handle packet parallel on their own office or home computer. switches directly? switching, whatever they were? That’s correct. Virtualisation makes one The fact is that they couldn’t really handle Why? Of course, they will have much A physical computer behave, as far as the A the huge, multi-server virtualisation Q higher traffic and processor loads, but operating systems simultaneously running on deployments that are required today. what is the qualitative difference?

54 LXF176 November 2013 www.linuxformat.com Open vSwitch What on Earth

These days, it looks like everybody and his VLANs are used in tandem with Generic First, by appending tags, which also A cousin needs a virtual server in the cloud. Routing Encapsulation (GRE, http://bit. A contain unique names for virtual Sometimes it is for new projects big enough to ly/13FtVRd), a tunnelling protocol developed machines, to all the network packets under its need much more processing power, but too by Cisco Systems. OvS uses GRE to create control. Second, by providing methods to short to justify the purchase of new hardware. point to point links between virtual machines in perform mass renaming, updates and Much more often, it’s just for a few days or different data centres. migration of those tags remotely. hours, to test some concept or just for the fun of it. Besides, many traditional activities that In practice, what would you say are the Wait a second! So far, you’ve been are ‘moving to the cloud’ have natural seasonal Q main features of OvS? Q talking only of virtual servers migrating peaks (think to tax accounting or Christmas Well, the first one is automated, from one fixed computer to another fixed online sales). On a large scale, this situation A centralised management. After that I one. What if the virtual servers themselves literally creates swarms of virtual servers that would mention Quality of Service (QoS), are running on mobile devices? change all the time, jumping like kangaroos monitoring, and hardware integration. Ouch! That’s a separate, more from one server farm to another, in order to A complicated issue. At the end of the day, stay closer to their end users, or just to Quality of Service? What does that what OvS does is ‘simply’ managing Ethernet distribute the load. Q actually cover? frames. As such, it can’t handle, all by itself, QoS consists of guarantees that certain many cases of physical hosts moving from one Sounds awfully complicated. So, Open A parameter and performances of each access point to another of their own will, so to Q vSwitch (let’s call it OvS) was developed traffic flow will remain within desired, speak. That, however, is a general problem: to cope with the chaos of virtualisation? predefined limits. A business that is an end many wireless hotspots block all packets with a Yes, that’s its goal. The code is specifically user of OvS may, for example, be willing to pay source MAC address different from the one A written both to handle highly dynamic, to be sure that the average bandwidth of its used to establish the connection, regardless of unpredictable loads, and to automate as much virtual servers will never go below X megabits which virtual switch was used. as possible their reconfiguration and per second, and that they will be allowed to use management, including automatic start, twice that bandwidth at least Y times a day, The only main feature you haven’t restart and migration of many virtual for no less than Z minutes each time. Q explained yet is hardware integration. computers without compromising their This means two symmetrical things. security, or unnecessarily exposing their traffic. Cool. What about the automated, A To begin with, OvS can offload parts of the Q centralised management? packet flow processing to hardware chipsets, Before looking inside OvS, let me ask That is the core of OvS. Through the to increase overall performances. The opposite Q one thing: is it based on reusable, A protocols that I’ve just explained, OvS is also true, and is a further, even greater open standards? advantage of Yes, it is. The two main ones are called hardware A OpenFlow (www.openflow.org) and “The code is specifically integration: usage OVSDB. OpenFlow provides methods to of switches and interconnect switches and other networking written to handle highly network cards devices, with streams of packets, that understand unsurprisingly called ‘flows’. Each flow can have dynamic, unpredictable loads.” OvS flows and multiple priorities, routing and filtering criteria commands expressed in tables. allows the administrators of virtual machines, means that you can manage both virtual and scattered across many different data centres, physical switches from one interface. That’s all I need or want to know about to model in great detail the topology and Q OpenFlow, I think. What about OvSDB? current status of their networks. Building on What are the main components of the The Open vSwitch DataBase management that, OvS also provides support for accounting Q OvS distribution? A protocol specifies how to create a and the automatic – or, at least, semi- The most important is the daemon that database of the switch ports of a network, and automatic – management of both slow and A performs the actual switching job. Then how to control them remotely. It is the fast network states. there is a database server storing the OvS combination of OvS and OvSDB that allows configuration and a Linux kernel module that management software to know what happens Slow and fast network states? What are supports flow-based switching. In addition to in a network of moving virtual machines, and Q they now? all this, there are utilities for monitoring and reconfigure them more or less in real time. Slow state is, more or less, a fancy way to debug, plus libraries to write extensions. A call the configuration of a virtual machine, You said OpenFlow and OvSDB are just and how it may change over time, if you move Last question: what’s the status of OvS Q the main standards supported by OvS. it to a less loaded host. The fast state of the Q support in Linux? True. There are at least two other features same machine would be – simplifying a lot! – OvS is included in the Linux kernel from A without which OvS couldn’t do much: what that machine is actually doing in any A version 3.3, with binary packages available Virtual Local Area Networks (VLANs) partition given moment. That is the processes it is for the most popular distributions. In general, one physical (or virtual) packet switch into running, and its current connections with the OvS can work on any Linux-based virtualisation multiple virtual ones. This is necessary, for rest of the internet. platform running at least version 2.6.18 of the example, when you have different groups of kernel. Extra support is present in Citrix virtual machines on the same host, but all the How does OvS distinguish the virtual XenServer and Red Hat Enterprise Linux. Linux traffic of each group must remain completely Q computers it is managing and their aside, OvS has also been ported to FreeBSD, invisible to machines of the other groups. traffic flows? Windows and some embedded systems. LXF

www.tuxradar.com November 2013 LXF176 55 Dr Brown’s Administeria Dr Brown’s Administeria Dr Chris Brown The Doctor provides Linux training, authoring Esoteric system administration goodness from and consultancy. He finds his PhD in particle physics to be of no help in this work at all. the impenetrable bowels of the server room. Bit recycling

recent visit to the Eden Project has strongly reinforced my need to A recycle more and reduce my carbon footprint. I do a patchy job right now. It’s true that I recycle the jokes I use when I’m running training courses, but that’s because I only know four. I’ve turned down the speed on my treadmill. I’ve started shaving on alternate days and Smoothwall brushing the razor out into the compost. Firewalls Use open software to build closed But I could do so much more. I’m especially worried about running out systems – put that satin finish on your network. of bits – that is to say, binary digits – that form the very basis of our digital world. irewalls are an essential component of hardware and to provide an easy-to-use Think about it – when we’re done with most corporate networks and you can administration interface to those using it”, and them, we just throw them all away. Nobody Fspend good money (anywhere between a new version (3.1) has just been released. recycles them. At some point, when the £300 and £10,000) on dedicated hardware If you’d like to give it a try, for a modest very last one is used (or it could be the very solutions. Alternatively, you might consider (220MB) download you get an ISO image that last zero, it’s hard to predict) every rescuing that ageing PC from the dumpster installs in a couple of minutes. Hardware computer will come to a screaming halt. and installing Smoothwall on it. To quote the requirements are minimal. You don’t need to So I have decided to set up a bit recycling official website (http://smoothwall.org): know anything about Linux to install it, but you service. You’ll be able to send all your scrap “Smoothwall is a best-of-breed internet do need to understand the network topology data to my servers which will sort it out into firewall/router, designed to run on commodity surrounding your firewall or you’ll come to a zeros and ones and store them on two very, screaming halt, as I did, at the ‘Network very large disks. (If you’re concerned about configuration type’ screen. security I’ll supply a little app that randomises the order of the bits before you Coloured zones send them). Then when you need some Smoothwall divides your network up into more, you just ask for however many zeros colour-coded zones and asks you to allocate and however many ones you need, and I’ll each network interface to a zone. For example, send them to you. At first it will be a free a typical scenario might use the green zone for service, but the point is to create a the private internal network, the orange zone dependency. Then when I’ve established a for the ‘DMZ’ network where your public monopoly, and the bits really start to run servers sit, and the red zone for an internet- out, and the chips are down (so to speak) facing connections. I’ll start charging. Eat your heart out, Once initial setup is complete, you configure Mark Zuckerberg. One of Smoothwall’s many web-based Smoothwall via a web-based interface. There [email protected] screens. Here, we see real-time network are screens to set up filter rules for incoming, traffic on the green and orange networks. outgoing, internal and external traffic. This approach means that you don’t have to get down and dirty with Iptables rule sets but it Little and large doesn’t entirely absolve you from the need to understand what’s going on. In addition, If you’re really impatient to try VMware workstation or player. arm at www.smoothwall.net Smoothwall provides proxies for web, instant out Smoothwall, there’s a Be aware, though, that this is offers a variety of products for messaging, SIP and POP3. You also get screens compressed VMware image version 3.0 not 3.1. At the network security, web content with pretty graphs and bar charts of network available – just download, opposite end of the spectrum, filtering, spam and malware uncompress, and fire it up in the company’s commercial filtering, and more. traffic and bandwidth, and screens for examining the log files.

56 LXF176 November 2013 www.linuxformat.com Dr Brown’s Administeria

Sed ain’t dead, baby Small languages The Good Doctor bats aside any suggestion that Sed is just too obscure to be useful and lays bare its genius for sysadmin scripts.

his month and next I want to take a look at a couple of ‘small languages’ that are popular in Linux – Sed and Is Sed a language? TAwk. Both find widespread use in system administration scripts and it certainly helps if you are able to You might argue that Sed’s command programming language. Julia at least read and understand the code, even if you have little set does not qualify as a programming Jomantaite has even written a Tetris call to actually write any. This month I’ll look at Sed. language. In fact, a remarkable Sed game in Sed (see the links on Peteris script by Christophe Blaess shows that Krumin’s blog post http://bit. Some would argue that the command set of Sed doesn’t Sed is ‘Turing Complete’ which means ly/17DVI3o). But I don’t see anyone really qualify as a language; I will let you draw your own that it can (in theory) approximately re-writing, say, the Linux kernel in Sed conclusion on that particular nugget (But first read the box Is simulate any other general-purpose anytime soon. Sed a Language?). To begin at the beginning, Sed is a stream editor. It behaves as a classic filter – if you give it a file to operate on, systems, but it includes a heading line that can mess things it will stream input from that file. If you don’t it will read its up in downstream processing. We can delete that initial line: standard input, allowing it to sit on the downstream end of a df | sed 1d pipeline to post-process output from some other command. Here, Sed is reading from standard input (the output Whether reading from a file or from standard input (stdin), piped from df). The d command means ‘delete the line’ and Sed reads the input stream a line at a time, performs a the 1 means ‘just do it on line 1’. So the first line gets the chop, specified set of editing operations on the line, and writes the but all the others make it through unchanged. This is resulting line to standard out (stdout). Then it reads the next equivalent to doing a tail -n +2. line and starts over. Unlike most interactive editors, which Let’s go back to the s (substitute) command. Suppose you read the entire file into a buffer, sed works a line at a time, want to just get the user names from /etc/passwd – that is, allowing it to operate efficiently on extremely large files. the field up to the first colon. This is easy once you discover that the ‘old pattern’ part of the substitution can be a regular Substituting with Sed expression. To get us started, here’s a simple example of using Sed to sed s/:.*// /etc/passwd perform a substitution – probably the commonest use for The example is a little deceptive. The ‘old pattern’ is the Sed. Suppose we have moved our users’ home directories regex ‘:.*’ which matches from the first colon through to the from /home to /users and need to modify all the home end of the line. (We’re relying here on the ‘greediness’ of regex directory names in /etc/passwd. That is, we need to change – it starts matching as soon as possible, and carries on lines of the form matching for as long as possible). The ‘new pattern’ is empty, chris:x:501:501::/home/chris:/bin/bash so whatever the regex matches is removed. Magic! to Let’s take one more example of substitution. Suppose you chris:x:501:501::/users/chris:/bin/bash wanted to change strings like “£25” to “25 GBP”. This is This will do the job: trickier because the replacement text “GBP” needs to appear sed s/home/users/ /etc/passwd after the number. This command will do the job: Let’s be clear what’s happening here. Sed reads the sed -r ‘s/£([0-9]*)/\1 GBP/g’ prices password file line by line, performs the substitution on each which will change a line like: line, and writes the result to stdout. It does not modify the fees range from £20 to £40 typically original file. If you really do want to change the original file, it is to: tempting to try this: fees range from 20 GBP to 40 GBP typically sed s/home/users/ /etc/passwd > /etc/passwd I’ve drawn a diagram to explain how this works (below). But that way lies doom and disaster. When the shell sees the output redirection it will truncate the output file down to zero length before Sed even gets to see it. Bye bye password file! Sed’s syntax can get tricky That is generally true of filters – you cannot redirect their really fast. Here, we dissect the Perform the substitution for back substitution example. output back to the original file. Instead you would have to do all matches on the line something like this: sed s/home/users/ /etc/passwd > /tmp/passwd The ‘old pattern’ The ‘new pattern’ mv /tmp/passwd /etc/passwd In fact, the GNU version of Sed also has an ‘in place’ sed -r ‘s/£( [09]* )/\ 1 GBP/g’ prices option, -i, that does the job, so sed -i s/home/users/ /etc/passwd Literal ‘£’ This ‘back substitution’ would also work, although in this particular case I would inserts whatever the caution you not to mess with the password file unless you are Tells Sed to recognise The ‘tagged’ part of the tagged part of the regular extended regular regular expression sure your Sed command does what you think it does. expression matched expressions matches any sequence Our next example is even simpler. The df command of digits generates a nice table of disk usage for each of your file

www.tuxradar.com November 2013 LXF176 57 Dr Brown’s Administeria

function foo() { Lines read one by one p stdout from file or stdin echo this is foo The pattern space } w # call the first function copy append foo file The hold space h H x g G function bar() { lets you park text copy append exchange echo this is bar in what is really } Sed’s one-and- The hold space # call the second function only ‘variable’. bar First, we’ll create a script with the function definitions stripped out: Think that’s tricksy? Well, maybe, but many of the Sed sed ‘/^function/,/^}/d’ demo.sh > demo2.sh commands you find in administration scripts use far more Here, we specify a range of line numbers based on a regex spectacular regexes. Here’s an example, taken from the file match. Text between a line beginning with function and a line /etc/init/rc-sysinit.conf on Ubuntu: beginning with } is deleted. If there are several such blocks of sed -nre ‘s/^[^#][^:]*:([0-6sS]):initdefault:.*/DEFAULT_ text in the file, they are all deleted. Turning the logic round, we RUNLEVEL=”\1”;/p’ /etc/inittab can extract just the function definitions: what this command does is extract the default run level from sed -n ‘/^function/,/^}/p’ demo.sh > funcs.sh the inittab file. Now you can’t do that with grep! Although it’s conventional to use a forward slash to separate the pieces of a substitution command, it gets ugly The pattern and hold space if the old or new patterns themselves contain forward slashes. Even with just the few commands we’ve seen so far, together Suppose we want to change ‘/home/chris/bin:’ to with a canny use of regular expressions, there’s a lot you can ‘/opt/bin’. We’d have to escape all those forward slashes do with Sed. But in all our examples, the output lines will so it would look like this: appear in the same order as the input lines. We can’t re-order sed ‘s/\/home\/chris\/bin/\/opt\/bin/’ foo.txt the material in the file. To do that we need to learn about the Using a different separator (‘:’ in this case) makes it a little ‘pattern space’ and the ‘hold space’. The pattern space is the easier: text buffer that’s used for the normal line-by-line editing. sed ‘s:/home/chris/bin:/opt/bin:’ foo.txt The substitute command, for example, operates on the pattern space, and the p command outputs the contents of Line selection the pattern space. You can select single lines, or ranges of lines, that you want an The hold space is basically a buffer where we can park editing command to operate on. The 1d command we saw text, allowing us to re-order the content of the input stream. earlier is an example of this, selecting just line 1. Or we could Three key commands (h, H and x) transfer text in and out select a range like this: 1,10d to delete the first 10 lines, or of the hold space (these and the other commands are 5,$d to delete from line 5 to the end ($ is a shorthand for the described in the summary table, bottom p59). last line of the file). We can also select lines based on a regular Now, using the hold space typically requires us to use two expression match, so or more Sed commands in a single invocation, so before we sed ‘/^#/d’ /etc/fstab go further, let’s see how we can do that. The first way is to use will delete lines that begin with ‘#’ (typically comment lines). the -e option on the command line. For example, the This is like an inverse grep (print lines that don’t match). To command: get an ordinary grep behaviour we need to make two sed -e ‘s/linux/windows/’ -e ‘s/good/bad/’ somefile.txt changes. First we add the -n option which turns off the will perform both substitutions on each line. Another way is to automatic printing of lines. That means we need to explicitly separate the commands with semi-colons, like this: ask Sed to print the lines we want, like this: sed ‘s/linux/windows/;s/good/bad/’ somefile.txt sed -n ‘/^#/p’ /etc/fstab These approaches work fine but get tedious if we have Notice that I’ve enclosed the command in single quotes to more than two or three commands. A better strategy is to put prevent the metacharacter wars that can so easily result in the commands into a file and then reference the file on the casualties on the Linux command line. command line. Re-casting our example to use this approach, Here’s a more interesting example. Suppose I have a shell we could create a file called (for example) script.sed with script that has lots of function definitions scattered around, content like so: and I’d like to extract the functions into a separate file. s/linux/windows/ For demonstration, let’s imagine a toy script like this: s/good/bad/ #!/bin/bash and then tell Sed to take commands from this file like this: echo hello sed -f script.sed somefile.txt How old is Sed?

Sed is really, really old. It was originally line editor ed, and its command syntax, bottom line commands in Vi). Even the written by Lee E McMahon around 1974, which looks strange to modern eyes, GNU version is 15 years old, dating from it appeared in the Unix Programmer’s would have felt much more comfortable 1998. Sed has in its turn influenced Manual for Seventh Edition Unix in 1979. to a seasoned ed user (or even to those other languages that excel at processing Sed was an evolution of the interactive of you who are comfortable with the text; notably .

58 LXF176 November 2013 www.linuxformat.com Dr Brown’s Administeria

Would you like to know more?

The official Sed manual is at brain-curdling examples of scripts that that you really can do arithmetic in Sed www.gnu.org/software/sed/manual. emulate standard commands like wc, (but probably don’t want to.) And there’s Here, you’ll find not only the full cat, head, tail and uniq. There’s even a a great chapter on Sed in Unix Power command reference, but some truly script that increments a number, proving Tools [See LXF125, p55).

There are a couple of benefits to putting your Sed echo hello commands in a separate script. First, we don’t need to quote # call the first function the commands any more because they are no longer subject foo to interpretation by the shell. Another benefit is that the script # call the second function is a component that you can re-use. bar With all these things in mind, let’s return to our shell script It’s nearly right – the only problem is that the #! line example and give ourselves a slightly different task. Suppose should still be up at the top. That’s not too hard to fix – I’ll we want to simply move all the function definitions up to the leave it as an exercise to the reader! start of the file, with the rest of the script following. Here’s the script; it’s just three lines: Sed in the real world # sed script to separate out functions in a shell script In case you’re thinking that Sed is too obscure to be worth /^function/,/^}/!H noticing, here’s a statistic for you: I counted the number of /^function/,/^}/p uses of Sed in the system administration scripts on Ubuntu. $ { x; p; } Well actually I let the command: $ find /etc -type f -exec grep -w sed {} \; 2> /dev/null | wc –l Function shift example count them for me. It turned up 259 examples. Some explanation is probably in order. The first line uses the The majority of these examples use Sed within a same pair of regular expressions that we used before to command substitution to set the value of a variable from the identify the body of a function, except that we’ve added a ! to contents of a config file, something like this: reverse the sense of the test. The H command adds the pid=$(sed ‘s/ //g’ /var/spool/postfix/pid/master.pid) pattern space to the hold space. So, this line builds up in the All this example simply does is remove spaces from the hold buffer all those lines that are outside of a function input. The g switch on the end of the substitution tells Sed to definition. The second line prints out those lines that are make the change globally – that is, everywhere within that within a function definition (so these will come out first, as particular line. required). Finally, the last line uses the line number shorthand Another common usage is to take the value of some $ meaning ‘the last line of the input’; it swaps the hold space existing variable and use Sed to munge it in some way. into the pattern space, and prints it out. This example is taken from /etc/network/if-pre-up.d/vlan Let’s run this and see what happens: on Ubuntu: $ sed -n -f splitout.sed demoscript.sh VLANID=`echo $IFACE|sed “s/vlan0*//”` function foo() { Notice this uses the alternative back-quote notation for echo this is foo command substitution. } Here’s another example, using both Awk and Sed in function bar() { combination: echo this is bar arch=`echo “$line” | awk ‘{print $4}’ | sed ‘s/:$//’` } Here, Awk is selecting the fourth field of $line, and Sed is #!/bin/bash removing a trailing colon. Finally, this masterpiece is from /etc/bash_completion.d/sysv-rc: valid_options=( $( \ Arguments in Sed tr “ “ “\n” <<<”${COMP_WORDS[@]} ${options[@]}” \ | sed -ne “/$( sed “s/ /\\|/g” <<<”${options[@]}” )/p” \ Command Description | sort | uniq -u \ s Substitute text within pattern space ) ) What this impressive piece of scripting does is use Sed d Delete contents of pattern space within a command substitution to generate a command for p Write pattern space to stdout an outer Sed command. It makes my teeth curl up just q Quit thinking about it. h Copy the pattern space to the hold space I am being a little unfair in presenting this example out of context. We don’t know what the structure of the input data H Append the pattern space to the hold space looks like, so it’s hard to figure out what’s happening. In my g Copy the hold space to the pattern space experience, the key to understanding all of these fancy text- G Append the hold space to the pattern space processing pipelines is to have a very clear idea of the structure of the data that you’re processing at each stage in r Read from a file into pattern space the pipeline. w Write pattern space to a file Next month we will take a good look at another of my Sed has more commands but this is a great start. favourite small languages – Awk. See you then. But for now, enough Sed! LXF

www.tuxradar.com November 2013 LXF176 59 The best new open source software on the planet

Mike Saunders Having visited every single nook and cranny of the internet, Mike Griffon Puddletag Mobik PyHIDS Potamus Ioping knows where the best open source Dateutils Berusky UBee512 Vinterm S2png gems are hidden.

Text editor and IDE Griffon Version 1.6 Web http://griffon.lasotel.fr/en

e Brits don’t have a great horribly cluttered on low-resolution reputation for learning displays, but if you have plenty of W foreign languages, so it screen real estate, you’ll appreciate always impresses us to see so much having lots of useful panels and widgets multilingualism in the open source surrounding the main editing area. world. We mention this because Griffon is written in C with GTK, and Griffon’s lead coder, Philippe Muller, is a along with the source tarball a Deb Frenchman and although there are a package is available for Debian and few problems with the English Ubuntu-based distros. translation of his program, they’re The core component of Griffon is the Don’t like the colour scheme? Go to Themes in the menu minor and we applaud his effort. syntax highlighting, auto-completing for an alternative selection of eye-pleasing photons. Griffon is a hugely ambitious text editor with elements of an IDE editor; the latter’s implementation is a (Integrated Development Environment). “A very customisable bit strange at first, making heavy use of It attempts to cram everything you editor with a few the right-hand Shift key, but it becomes could need into a single window, second nature after a while. Syntax producing an interface that looks interface rough spots.” highlighting is available for 13 languages, and Griffon has a special focus on HTML, with a dedicated menu for Exploring the Griffon interface creating HTML templates, inserting Doctypes, and adding tags to your code. However, the editor can be used for virtually everything, thanks to a Projects Second toolbar feature which lets you associate build Use the blank space to enter a commands and working directories to line number and click the blue arrow to jump to it. source code files. Get things done File browser Griffon lets you mount SFTP servers in the right-hand panel, while the bottom A standard filesystem navigator – double-click on a section is home to a bunch of useful source code file and it will tools, such as a WebKit-based viewer open in the tabbed editor in (for previewing web page edits), a the middle. terminal and a to-do list. Ad-hoc user commands can be created by going to File > Manager configuration file > Extra tools Configuring the user menu: this opens This area contains an a new editor tab where you can add embedded terminal, web page custom commands accessible via viewer, note-taker and to-do Editing panel Yet more tools! Function > User Menu. list, switchable via tabs. The heart of Griffon. Hit the right- Another switchable area, this time containing In all, Griffon is a very customisable hand Shift key to bring up auto- auto-complete keywords, language help and editor with a few interface rough spots, complete options when typing. a place to mount SFTP shares. but plenty of neat features to pad it out.

60 LXF176 November 2013 www.linuxformat.com LXFHotPicks

Audio tag editor Puddletag Version 1.0.2 Web http://puddletag.sourceforge.net

ost music players include a If your music collection is lacking way to edit tags, the decent tags, you can create new tags Mmetadata associated with based on filenames via the Convert music files, but the implementation is menu. You can also do this the other often lacking. In many cases you have way round, creating more descriptive to open a new editing dialog box for file names based on the content of your each song, which is horribly tedious. tags. Puddletag’s Actions system is Puddletag takes a different approach by immensely versatile: you can define Scratching an itch: the author wrote Puddletag to escape presenting songs and their tags in a custom actions to modify tags based Mp3tag on Windows and free up a partition. spreadsheet-like layout – so you can on regular expressions, merge tags work on multiple files at the same time. together, remove whitespace and much Undo button if you mess up. You can It’s written in Python, and you’ll need more. These actions can be applied to even play songs from inside the various modules, such as Mutagen and batches of songs, providing an program, by default in Amarok (go to PyParsing (the full list is in the Readme automated editing system. Edit > Preferences to change to a file). Once you have these, you can run With the python-musicbrainz2 different player). the program from its own directory with module, Puddletag can retrieve song Puddletag is one of the most ./puddletag. You’ll be presented with a data from the net and tag files versatile tag editors we’ve come across, mostly blank display, so use the accordingly, and there’s a life-saving and its spreadsheet-based approach is Filesystem panel in the bottom-left to way better than the tiresome dialog-box navigate to a directory containing your system normally employed by. If you’ve songs. This will populate the main panel “One of the most used Mp3tag on Windows then you’ll with tag data, and you can scroll around versatile tag editors feel right at home here; the interfaces inside it like a typical spreadsheet – are very similar, although there are double-click on a cell to change its data. we’ve come across.” some feature differences.

Wiki engine Mobiki Version 2013-07-23 Web http://bit.ly/1488jIw

or quick document collaboration initial edits, you’ll need to input a jobs, nothing beats a wiki. password. This can be modified in the FThey’re easy to use, anyone with configuration section of index.php. a web browser can contribute, and Mobiki’s markup isn’t quite the same as admins can monitor changes to the MediaWiki’s, but it shares many content. The only problem is the setup: similarities and a pre-built Wiki-Markup many wiki engines require the admin to page is provided for experimentation. create databases, fiddle around with The template.html and template. permissions and other laborious tasks. css files are used for customising the Mobiki is designed to be ultra simple wiki’s appearance; in the former you Mobiki’s default theme is targeted at mobile devices. to install – it’s a single PHP file, and it can modify the structure of pages, while writes wiki pages to individual text files, the latter lets you fine-tune fonts and comparison to the larger engines: it’s so no database is required. It’s colours. Mobiki provides a simple News not possible to do comparisons with “optimised for usage with mobile page which shows recent edits sorted earlier page versions or revert changes. devices”, hence the minimal interface by date, along with an RSS feed With a quick five-line hack (saving when compared with the likes of containing the same information. extra copies of pages with a timestamp MediaWiki, and the code is easy to hack Here’s where Mobiki feels weak in affixed) it’s possible to add a basic thanks to an abundance of comments. versioning system, and manually copy To get the wiki running, place its files older versions of pages over current in the document root of a web server “Mobiki is designed to ones if necessary. But Mobiki isn’t with PHP 5.4 (or later) support (we be ultra simple to install designed to be a high-end engine, and used Nginx in our testing) and open for a simple, low-maintenance wiki for a index.php in your browser. To perform – it’s a single PHP file.” small group of users, it does a solid job.

www.tuxradar.com November 2013 LXF176 61 LXFHotPicks

Intrusion detection system PyHIDS 0.4 Version 0.4 Web http://bit.ly/14o4vr1

f you suspect that someone has compact and easy to use example of an broken into your home, what do IDS, as its name suggests it’s written in Iyou do? Before calling the old bill, Python. To run it you’ll need Python 3.3 you’ll want to find some evidence that a and the RSA module, which are no-gooder has been inside your available in Debian/Ubuntu-based property (and they are not still there systems like so: Here we’re looking at the config file, and then running too). For instance, a window that has sudo apt-get install python3-pip PyHIDS – in this case the Iptables have changed. been forcibly opened, or a broken door sudo pip-3.3 install rsa lock. You have a similar situation when Copy conf.cfg-sample to conf.cfg of the files and commands that are your computer is compromised, and open it in a text editor. You’ll see described in conf.cfg. Then run pyHIDS. whereby system and configuration files various configuration sections marked py to see if any of them has changed – that have been changed without your in square brackets; first look at the try manually editing one of the files involvement can indicate the work of [files] section. Here’s where you specify listed in conf.cfg and run pyHIDS.py an intruder. the files that PyHIDS will keep track of, again to see what the warning output The problem is, a typical Linux so if something changes in them, looks like. PyHIDS can be run in a Cron installation contains tens of thousands PyHIDS will let you know. Along with job each day, and you’ll be alerted by of files, and you can’t manually check all individual files you can specify mail if any of the files have changed the important ones every day. This is directories in the [rules] section, and without your knowledge. where an IDS comes in immensely under [commands] you can tell PyHIDS useful: it’s an Intrusion Detection to alert you when the output of certain “PyHIDS is a compact System that monitors the content of commands changes. your system-critical files and the output Once you have PyHIDS configured and easy to use of certain commands, and lets you to your liking, run genKeys.py and know if something changes. PyHIDS is a genBase.py. This will create a database example of an IDS.”

Audio player Potamus Version 14 Web http://offog.org/code/potamus

ome of the best open source Potamus’s interface is built with GTK projects were born out of so you’ll need the development headers S frustration. It’s a similar to compile from source, along with the situation with Potamus, which is “a development packages for libao and reaction to music players like libsamplerate. On first start, the Rhythmbox that use complex program shows a blank playlist – drag- databases to keep track of music”. and-drop songs into it or start the Now, you could argue that these program with a directory containing databases are essential to give high- songs as a parameter. From here, it’s end players like Rhythmbox all the simple to operate: there are Play, Pause features we’ve come to expect. But and Skip buttons along the top, and a Potamus won’t every Linux system has a decent dropdown list for switching between win any beauty won’t find visualisers or album artwork database for organising songs: the various mono and stereo modes. contests – it’s downloaders here. If your music filesystem. So Potamus doesn’t try to The player supports MP3, Ogg all about the collection is lumped together in a single do anything fancy for sorting and Vorbis and FLAC files, along with 24-bit functionality. directory and you rely on ID3 tags and managing your tunes – it doesn’t audio output and gapless playback. And pre-built playlists to manage it, then extract ID3 tags or move things into that’s pretty much it, feature-wise; you Potamus won’t rock your world. But if categories etc. It just shows you your you’ve carefully organised your songs songs based on their filenames, but it into directories for artists and albums, lets you rearrange them with drag-and- “Drag-and-drop, or drop and given songs descriptive filenames, drop, or drop in new songs from your in new songs from your it’s a great little player – integrate it with file manager. There’s also a Shuffle your file manager, and you can right- button to create a random playlist. file manager.” click on a directory to play an album.

62 LXF176 November 2013 www.linuxformat.com LXFHotPicks

Disk I/O latency measuring tool Ioping Version 0.7 Web http://code.google.com/p/ioping

ou’ve almost certainly heard of the disk speeds. Try this: ping before, but if not: it’s a ./ioping . Ysmall command line utility that Here, Ioping reads 4k of data from sends short messages to other the current directory every second, and machines on a network, waits for the shows how long the reading process response, and then shows the total time takes. With such a small amount of taken. For example, if you run it like this: data, the results will probably be Here we can see the effect of du / in the background ping google.com displayed in ‘µs’ on your machine – terminal – the latency jumps up from 5ms to over 30ms. Ping will send a request to that is, microseconds, or millionths of a www.google.com every second, and second. You can bump up the amount time will jump right up. And this is show how long it takes for the response of data that Ioping reads like so: where Ioping is most useful: you can to come back. Slow responses could ./ioping . -s 1M run it on different storage devices at indicate a problem with Google’s This time it reads 1MB every second. different times, and see exactly what is servers, or some congestion on the While you’re running Ioping, try happening with your disk throughput. network between your machine and opening another terminal and doing Using top, it’s easy to see how a Google’s mammoth data centres. In any something disk-intensive, like du /. particular Cron job affects CPU usage case, it’s a valuable tool for system You’ll immediately see the effect this for example, and with Ioping you can administrators, and now we have a disk has on disk-read latency – the response now see if it’s slowing down disk drive I/O equivalent in the form of Ioping. accesses for other processes as well. To compile it, extract ioping-0.7.tar. “It’s easy to see how a Ioping has other options (enter man gz, jump into the resulting directory and ./ioping.1) providing more detailed enter make. You can now run the Cron job affects CPU analysis of disk latency, and it can even program in place, but you need to generate raw data for feeding into provide a filesystem location for testing usage, for example.” another program for further processing.

Date calculating toolkit Dateutils Version 0.2.5 Web www.fresse.org/dateutils

alk about inconsistency: there system-wide, run make install as root; are 60 minutes in an hour, 24 otherwise just jump into the src Thours in a day, seven days in a directory and run them from there. week, 52 weeks in a year… and then The best way to learn how Dateutils there are the 12 months, which have works is with some examples, so here’s varying numbers of days. We’re all used how to solve the question posed earlier: to this system, but it all gets very messy dadd 2016-02-24T17:00 +6000h when you try to calculate durations As you can guess from the name, Use dgrep to between dates, or add periods of time dadd performs additions on dates and (-2m), months (+6mo) and so forth. search log files to them. For instance, off the top of your times, and in this case we’re specifying for events that Then there’s ddiff, which shows the head, what time and date is it if you add the year, month and date. It’s possible happened before duration between two dates. If you 6,000 hours to 17:00 on the 24th of to work solely with dates, but by adding or after a specific enter ddiff 2016-02-24 2016-08-15, February 2016? T we can use times as well, in 24-hour date/time. for example, you’ll get 173 (the number If you can answer that, well, you clock format. So after specifying the of days between the dates). If you add don’t need Dateutils. But this toolkit is exact moment in time, we add the exact times (eg ddiff 2016-02- a godsend for the rest of us, and it 6,000 hours – it’s also possible to add 24T12:00 2016-08-15T13:00) then features a small collection of programs or subtract days (eg +3d), minutes you’ll see the result in seconds, but you with familiar Unixy names such as ddiff can format this to something more and dgrep. It has no dependencies useful with the -f flag. Using -f ‘%m beyond the standard C library, so it will “Work solely with dates %d’ shows the result split into months compile virtually everywhere, and you or by adding T you can and days. Dateutils has other handy can build it with ./configure and make. tools for searching and converting If you want to install the programs use times as well.” times. see Readme.md for the list.

www.tuxradar.com November 2013 LXF176 63 LXFHotPicks

HotGames Entertainment apps

Bug-based puzzle game Berusky Version 1.7 Web http://anakreon.cz/?q=node/1

e thought our internet- basics. In summary: you control one or sifting capabilities made more bugs on a 2D playing field, and W the NSA look like your job is to collect five keys scattered amateurs, but somehow Berusky around before making your way to the never came under our radar. It’s a exit. On levels where you can control block-pushing puzzle game along the more than one bug, hit the Tab key to lines of Sokoban, but with heaps of switch between them. extra features and fiendishly Berusky’s challenge comes from the This is one designed levels – oh, and its only various objects that stand between you of the easier plan your progress. The level design major dependency is SDL, so it’s easy and the keys. Stones block your path levels, but it still is excellent, and you often find gave our brain a to install. Extract berusky-1.7.tar.gz (collect a pick-axe to destroy them) and yourself staring at a new level for a good workout. and build it with the usual barrels hinder progress (push dynamite while to get your bearings, before ./configure, make and make install into them). Doors close behind you and even daring to make the first move. (as root) procedure; then extract the trap you. Completing levels is rarely a Our only minor gripe is that the data tarball and run ./install inside. straightforward affair – you need to carefully crafted pixel art is tiny, so Start the game by entering the game is almost impossible to berusky, and click Play to be “A block-pushing puzzle play on hi-res screens. A quick fix for presented with a list of level this is to enable High Resolution categories. Berusky includes 120 game… with heaps of mode in the Settings – this doubles levels, and helpfully there’s a Training up each pixel, making the game look series which takes you through the extra features.” a bit blockier, but far easier to see.

MicroBee emulator uBee512 Version 5.5.0 Web www.microbee-mspp.org.au

f you’re one of our Australian code, and to get it running you’ll readers, or you have a soft spot need MicroBee ROM images. These are I for the home computers of the provided by the MSPP at www. 1980s (or best of all, both of these microbee-mspp.org.au/technology_ apply), then this is for you. The public/ – grab the BASIC, charrom MicroBee was released down under and rom1 files, and place them in in 1982, originally in kit format but ~/.ubee512/roms/. Last, you’ll need a later as a pre-built system, and boot.disk to start up the machine, The MicroBee made a minor comeback in 2011 with a sported a Z80 processor running at examples of which are available at www. limited edition (105 units) Premium Plus kit version. 2MHz along with 16k of RAM. microbee-mspp.org.au/repository. The MicroBee series was largely We tried games_demo_ds80.dsk, unknown outside of Australia and which includes various puzzlers such as copyright (download at your own discontinued in 1990, but it still has Mah Jong, dominoes and Tetris. Other risk). UBee512 includes its own mini fans. There’s even the MicroBee games can be found on the internet, toolkit and windowing system for Software Preservation Project, which such as the classic Hunt the Wumpus, configuration – right-click inside the aims to “preserve the old technology with the usual complications about emulator window to switch to full- for future generations”. Core to this screen mode, change the sound effort is UBee512, a MicroBee volume and power-cycle the system. emulator that runs on Linux, “Available in Deb and Given the MicroBee’s obscurity Windows and Amiga OS. RPM formats, along when compared to the ZX Spectrum UBee512 is available in Deb and and C64, it’s great to see an emulator RPM formats, along with the source with the source code.” for it being actively developed.

64 LXF176 November 2013 www.linuxformat.com LXFHotPicks

Vintage-style terminal emulator Also released

New and updated software that Vinterm also deserves a look... downtimed 0.6 Version 0.4.0 Web http://bit.ly/11Rm0Pn Monitor operating system downtime, uptime, shutdowns and crashes. http://dist.epipe.com/downtimed emember Terminology [LXF174, distros), Vinterm won’t source your p48], the super-snazzy terminal ~/.bashrc when you start it, leaving you storeBackup 3.4 R from the Enlightenment team? with a very bare environment – you Backup utility with compression that Well, here’s pretty much the exact won’t have your aliases for instance. stores files on other disks. opposite. Whereas Terminology spruces Just enter bash (or your normal shell) www.storebackup.org up the command line with all sorts of to fix this. Vinterm doesn’t support Giada 0.7.2 forward-looking features like image colours, but it can show bold and A minimal, hardcore loop machine for previews and video playing, Vinterm inverted text as used in man for DJs and live performers. takes you back to the 1980s, with fuzzy instance. There’s also a full-screen www.giadamusic.com monitors and green-on-black displays. mode, accessible via Shift+Ctrl+F11. It’s totally retro and we like it. And that’s it for now, but the Vinterm’s only major dependency is developer plans to introduce emulation SDL, and to compile it you just issue a of other monitor and TV types, and single make command. Then run it in more configuration options to toy with. place with ./vinterm. Straight away you’ll see how the program attempts to recreate the displays of yore, with a blurry effect added to the fading green text. To see the effect in more detail, Vinterm’s use the -s flag to increase the scaling Giaga has lots of shiny knobs retrotastic visual and buttons to play with. (zoom) level, eg: style is based on ./vinterm -s 2 the IBM 5151, as Converseen 0.6.4 Note that if your default shell is shipped with the Qt-based image converter and resizer, Bash (as is the case in most Linux original PC. supporting over 100 formats. http://converseen.sourceforge.net

Convert binary files to PNGs DOMjudge 3.4.0 An automated judgement system to run programming contests. S2png http://domjudge.sourceforge.net Aletheia 0.1.4 Version 0.05 Web http://bit.ly/16zScGW Debug web applications by sending raw HTTP requests. http://aletheia.k42b3.com teganography, the technique of To use S2png, simply run its binary embedding hidden messages followed by a file. For instance: Data Crow 3.11.0 S inside images or other media, is ./s2png myfile.txt Manage all your various collections a fascinating subject. It has been used This will generate myfile.txt.png from movie, video, book, image, throughout history for clandestine which you can now upload to an image software, and music. communication, and with modern gallery. (To decode the file use the -d www.datacrow.net digital images it’s possible to hide large switch). It’s a useful way to share data GeomSpace 0.12 amounts of data inside a seemingly on a message board which only allows Interactive geometry software for innocent file. image uploads, and by default each different geometric spaces. S2png (something to PNG) has a lot image contains a text message http://sourceforge.net/projects/ in common with steganography tools, explaining how to get the software. For geomspace but with one major difference: it doesn’t a thin layer of security, it’s possible to try to hide anything. Instead, the password protect images as well. LXF resulting images that it generates scream ‘Look at me! I contain a file.’ You can store any kind of file inside a PNG image with S2png, but the picture states that it’s a carrier for other data. The resulting To compile it, just enter make – and images look if you receive a nasty warning about like random If Euclidian space isn’t rocking missing libraries, try adding -lm to the noise, but they your boat switch to Minkowski. LIBS line of the Makefile: can be viewed LIBS = `libpng-config --libs` -lgd -lm everywhere.

www.tuxradar.com November 2013 LXF176 65 #1 for Free Software Back issues Missed one?

Issue 175 Issue 174 Issue 173 October 2013 September 2013 August 2013 Product code: Product code: Product code: LXFDB0175 LXFDB0174 LXFDB0173 In the magazine In the magazine In the magazine Level up your skills with Save time and work Learn how to liberate our guide to the tools smarter with the right your data from Google. of tomorrow. Peek into desktop for you. Explore Discover Mir, the the world of Arch Linux, the Raspberry Jam, controversial display and get the inside track marvel at the insight of graphics project and on how open source is Mozilla’s top security delve inside the EFF, being put to good use at LXFDVD highlights guy, and feed your brain LXFDVD highlights Ruby on Rails, Raspbian, LXFDVD highlights Jolla, the successor to Fedora 19, Arch Linux, Knoppix, with tutorials on Puppet, Gnome Tweak Tool for Gnome 3, MariaDB, bracket-loving Debian 7, Mageia, Sabayon and a Meego, the mobile OS. Tails Linux and Overclockix. Kotlin, Grub 2 and more. Mint 15, Linux Bodhi, Siduction. Lisp and more. blast from the past: issue LXF64.

Issue 172 Issue 171 Issue 170 July 2013 June 2013 May 2013 Product code: Product code: Product code: LXFDB0172 LXFDB0171 LXFDB0170 In the magazine In the magazine In the magazine We ask ‘Dude, what’s It’s the ultimate Protect yourself from happened to Ubuntu?’ roundup: the 50 top the password stealing, Plus the ethos behind distros tested. Plus WordPress cracking distinctly Gaulish distro, mastering the ruffians of the web. Plus Trisquel, Firefox OS Raspberry Pi’s CLI, how how to put a media phones, Scratch, Kerbal to digitise your music centre onto a Raspberry Space Program and LXFDVD highlights collection, cloud LXFDVD highlights Pi, sharing photos with LXFDVD highlights finding dead people with Our Privacy Enhanced remix of computing, Ruby on Two DVDs! More than 100 games Digikam and lots more PCLinuxOS, Zorin, SMS, IPFire, Gramps genealogy app. Ubuntu, , Manjaro. Rails, C++ and more. plus OpenSUSE 12.3 and Trisquel. great Steam game info. SalentOS and Porteus.

Quote the issue code shown above and have your credit or debit card details ready

NOW ON LINUX FORMAT NOW ! AVAILABLE DIGITALLY We’re pleased to announce that you can now purchase Apple your favourite Linux Newsstand magazine digitally! With Linux Format digital subscriptions are lower subscription prices also available to buy through Apple and the latest issue Newsstand from £14.99 for 90 days. available to download the For more information, or to buy, go to day it goes on sale in the http://goo.gl/Zjj2T UK, there has never been a better time to go digital!* Instant access: WHAT YOU’LL PAY: Download your copy the day it Single issues from £4.99 goes on sale in 1-year subscription £44.99 the UK!

For more information or to buy, go to http://goo.gl/sLxZs

All prices are correct at the time of going to press. Digital subscriptions are managed separately by Google Play, Apple Newsstand or Zinio.com. *Please be aware that digital subscriptions do not include coverdiscs, although content is available online. Access to the subs-only area and cover-mounted gifts are not included with digital subscriptions. You will be charged in your local currency.

66 LXF176 November 2013 www.linuxformat.com Xxx Reviews

Turn on, log in and let our experts help make you a smarter Linux user

ANDREW GREGORY would be more likely to read the manual if it had pretty pictures in it. This month learn how to... Verbiage

uring the course of writing a tutorial for this Dissue, I discovered that the VirtualBox manual is over 150,000 words long. First of all, let me congratulate the technical writers who took the time to document the features and foibles of this wonderful piece of Dual boot ...... 68 Package apps ...... 70 Share large files ...... 74 software. Documentation, as we Andrew Gregory sets up a dual Heal the rift between RPM and Deb – Seed your own Torrent files and say time and time again, is vital. booting external hard drive with Mint, package software with FPM and the share the burden of large downloads, Second, let me Fedora and the power of VirtualBox. guiding hand of Mike Saunders. like Neil Bothwick. uncongratulate the person who told a questioner (who was having the same problem as me) to “read the manual”. If you know Code in tutorials what you’re looking for, great – you’ve probably found it already, Source code is presented in beige boxes. When lines of code are too long and aren’t wasting your time for our columns, the remaining text reading unhelpful forum posts. If appears on the next line in a solid box: you don’t know what you’re procedure TfrmTextEditor. looking for, being told to read a mniWordWrapClick 150,000-word document is Outsource to Amazon76 Deploy Juju Charms .80 Otherwise, there is a gap, like this: unhelpful, to say the least. Rent cloud space without spending If you’ve created a thing of beauty begin any money. Rob Dobozy shows how it’s your responsibility to share it, mniWordWrap.Checked := false Part of the problem to use Amazon’s cloud services. says Nick Veitch. In fact, it’s worse than useless, because the useless reply hangs around the internet, clogging up the Google rankings and Whether you’re a beginner or annoying people who just want a guru, learn new skills in our to get stuff done. programming section If you’re looking for a solution on the internet and you come across someone who’s just there to make himself feel better, don’t In this issue... worry. The world is a beautiful place, full of generous people who really do want to help. We’ve Concepts Open Skrollr mentioned Mint’s forums in the JPEG Euphoria Code eye- past, but there are many, many more (LinuxFormat.com/ compression Compile to pleasing scrolling forums, for example, is truly explained with C the happy effects in CSS excellent). Just have faith. zombies p84 way p86 and HTML 5 p90 [email protected]

www.tuxradar.com November 2013 LXF176 67 TutorialDual Xxxx booting Set up an external hard drive to boot Linux wherever you are Dual boot from a Andrew Gregory performs quite a simple task, and manages to hit every possible snag along the way – so you don’t have to!

There is another aspect to VirtualBox that makes it attractive for this tutorial, and that’s that you can use it to install from ISO files – downloaded disc images rather than physical discs – which is handy when your DVD drive is broken. The first thing that we need to do is get VirtualBox talking to our USB external hard drive. If you’ve installed the stock VirtualBox installation from your distro’s repositories, you Our most likely installed the virtualbox-ose package (OSE as in expert open source edition). While this is fine for most uses, it Andrew doesn’t include the USB functionality that the proprietary Gregory version has. To prevent clashes, go into your package Perennial newbie manager, search for ‘Virtualbox’ and opt for Complete Andrew has been making words Removal, then go to www.virtualbox.org and download the look nice since latest version for your distro from the VirtualBox 4.2.16 for 2003, and breaking things in Linux hosts link. Linux since 2005. Once you have VirtualBox installed, go back to www. virtualbox.org/wiki/Downloads and click on the link near the top of the page to install the extension pack, which provides support for USB 2.0 devices. Now, go back to VirtualBox and set up a virtual machine. Once you’ve created the VM, click on the USB tab. What’s this? It’s an error message, telling us: “VirtualBox is not currently allowed to access USB devices. You can change this by adding your user to the ‘vboxusers’ group. Please see the user manual for a more detailed explanation.” his issue, we’re answering a question set by Alan Vamplew, who wanted to know how to get rid of Error message TFedora 18, which he’d set up to boot from an external This is a classic example of the unhelpful error message. hard disk, and replace it with a dual-boot system running There’s no link to the user manual under the Help tab, so you Fedora 19 and Mint 15. Thanks for writing Alan! have to go to Documentation in virtualbox.org to find the One of the advantages of booting from an external device User Manual, which is a PDF with 335 pages running to a is that you get your own setup, wherever you are. A USB flash length of 156,609 words. drive is often too small to move lots of files, around so an It turns out that to add yourself as a user to the vboxusers external hard drive is the next logical solution. group, we have to open a terminal and enter: VirtualBox enables us to mess about without putting our sudo usermod -aG vboxusers base system at risk, so that’s what we’re going to use here. This will give you permission to use VirtualBox to access the hardware plugged into your physical machine. Log out, then back in to effect the change. If you start up a virtual machine now, and plug in a USB device, you should be able to see it as a volume in the file manager of the virtualised Linux distro. Except that it’s not quite as simple as that; it turns out that we have to explicitly enable the USB connector. Back in VirtualBox, go into the USB tab, tick the boxes next to Enable USB Controller and Enable USB EHCI Controlling. Underneath that, on the right-hand side, there’s an icon that looks like a USB stick with a green plus sign on it. Clicking on Proto-success: this will give you a list of all USB devices plugged into the Fedora’s installer machine – in our case, a webcam and a USB to SATA adaptor. recognises the external drive, so The USB to SATA adaptor is the one we want, so with that we can use it as selected we should, at last, be able to connect to a USB a target to install device with our virtual machine. Now that’s working, we can Fedora 19. turn our attention to Alan’s question.

68 LXF176 November 2013 www.linuxformat.com VirtualBox/Fedora/Mint Tutorial m an external HDD Dual boot

Alert! Choose The good news is that you don’t have to do anything special Standard, to get rid of Fedora 18; as long as you tell it to, the Fedora 19 rather then LVM and Mint installers will overwrite anything on the disk, so partition, if you you’ll have the full space on the hard drive to play with. want Mint to be To begin, boot Fedora 19 and click the icon to start the able to share a installation process. You’ll be asked where you want to install /home partition Fedora: either on your local drive, or on the external hard with Fedora. drive, so select the external drive and click Done at the top of the screen. In the Reclaim Disk Space screen, highlight the hard disk and click Delete at the bottom of the window, then click on Reclaim Space. This will clear space for Fedora 19, so you can proceed with the installation. You’ll be asked whether you want to accept the automatic storage configuration, or create only possible to make changes to an unmounted system. your own. It’s OK to accept the default here,because Fedora After asking you for language and keyboard preferences, the automatically creates a separate /boot, root (/) and /home installer will notify you that there’s a Fedora installation on the partition. At this stage, make sure you select Standard disk, and ask what you want to do. Create partition for the Partition, rather than LVM, because otherwise you’ll have Mint installation, using the tools in the Mint installer. problems getting the Linux Mint system (which we’re going One reason for doing it this way round (Fedora first, then to install next) to work with Fedora. We wasted loads of Mint) is that Mint’s partitioning tool is a lot more user-friendly; time at this stage, and it’s all because Fedora is just too just make sure that the device for the bootloader installation clever – Logical Volume Management (LVM) may be more is set to the external hard disk rather than the laptop or efficient if you only have one distro set up, but getting it to virtual machine. Another good reason is that Fedora, as with work with other systems is tricky. the LVM issue noted earlier, isn’t the greatest at playing nicely with other systems. If you were to install Mint first, then Virtual machine Fedora, the latter tends to delete the other distro from the After you’ve created a root password and a normal user menu of distros to choose from at boot time (the files are still account, make a cup of tea and wait for the installer to copy all there, but the entry needed to get into the other system is the files across to the hard drive. Because all the data is going mysteriously hidden). Mint is much more co-operative. There across the USB connection, and Fedora 19’s DVD edition is a are ways to fix this problem with Fedora, but as we’re aware of pretty large 2.9GB, this may take a while. it from the start we can avoid it completely. When you’re done, create a virtual machine for Linux Mint, We found that the resulting hard drive, with Mint and remembering to add a USB filter for the external hard drive. Fedora dual-booting, wasn’t recognised in VirtualBox, but it You’ll be asked whether you want to unmount the sdb was picked up by our laptop’s BIOS, which enabled us to boot partition (this is the external drive), which you do, because it’s into either system. LXF

You can’t resize a live filesystem, so you have to click Yes In the Mint partitioner, shrink Fedora’s to unmount the Fedora disk before you can install Mint. /home partition and create a / (root) partition for Mint.

www.tuxradar.com November 2013 LXF176 69 TutorialPackage Xxxx building: Discover the easy way to make Debs and RPMs FPM: Building Building packages has never been an easy job. Until now that is, thanks to FPM. Mike Saunders explains the change.

Now, we all appreciate the work that distro developers do to package up software. If you’ve ever tried to make a Deb or RPM file by yourself, you might have run away screaming after a couple of hours of graft. It’s not an especially simple Our process, and even when you’ve grokked it fully, it can be very expert time-consuming. FPM (http://github.com/jordansissel/ fpm) aims to solve this, and its fundamental principle is: Mike Saunders “If FPM is not helping you to make packages easily, then there spends ages compiling things is a bug in FPM.” Great, but why would you want to make your for the HotPicks own packages in the first place? section, so he You’re writing your own program, you want to distribute it hopes this program will online and you want to give users something easier to install encourage app than the source code. developers to You’re an admin, you’ve built a custom version of some package up their work properly. software, and you want to roll it out easily across other boxes. You just want to learn more about how packages work, boost your geek credentials and have something to natter about at your next LUG meeting. Whatever the case, read on and we’ll discover how FPM makes the job of creating and modifying packages much easier than you might expect. First steps with FPM FPM is written in Ruby, so first of all you’ll need to get the hen it works, Linux package management is a latest version of the programming language, along with its marvellous thing to behold. Dependencies are development files. On a X/K/Ubuntu 13.04 box it’s as simple W resolved automatically, everything can be installed as this: and easily removed with a few commands, and you can sudo apt-get install ruby1.9.1 ruby1.9.1-dev quickly find out which files belong to which packages. Almost every major distro has Ruby in its repositories Sometimes it’s not so pretty, when developers split up though, so if you’re running a different distro just search for it programs into 50 packages or you try to install an older in your package manager. FPM is available as a Gem – that is, package on a newer distribution release, but compared to the a Ruby package – so install it like this: Windows world, where there are umpteen different installers sudo gem install fpm in use and programs leave all sorts of crud in your Registry – You’ll see lots of output whizz by as RubyGems grabs and well, it’s world’s apart. builds various dependencies. Once the process has finished, you’re ready to use FPM. Now, for FPM to do its job properly, it needs a bunch of files that it can wrap up into a package. These can be any kinds of files – after all, packages can contain executables, configuration files or images – so FPM doesn’t ask for specifics. What it does need is a location containing the files, with the appropriate directory structure. Let’s look at the second scenario mentioned in the introduction: customising a program and making a package from it. In this case, we’re going to use a simple program that’s easy to build, Dateutils (www.fresse.org/dateutils) as covered in this month’s HotPicks (See p63). Download Here, Dateutils dateutils-0.2.5.tar.xz and extract it like so: hasn’t been installed system- tar xfv dateutils-0.2.5.tar.xz wide, but in At this stage you could make any customisations that you a temporary need, but for now we’ll simply jump into the resulting directory instead. directory and compile the program. Note that binary

70 LXF176 November 2013 www.linuxformat.com FPM Tutorial packages packages typically install into the /usr directory, as opposed Ta-da: our to /usr/local/. This is just a convention, and it’s not newly built massively important. So we use the --prefix= option for the package in all its configure script: glory. Some of cd dateutils-0.2.5/ the information ./configure --prefix=/usr fields need some make more details, but we can easily From here, the usual command to install the program fix that. would be something like sudo make install. However, we don’t want to scatter the files around the filesystem now; instead, we want to place them in a separate and distinct directory so that FPM can find them easily and bundle them into a package. This is possible with: mkdir /tmp/packagedir make install DESTDIR=/tmp/packagedir If you look inside /tmp/packagedir, you’ll see all of the files for a successful Dateutils installation, as per the first screenshot. The DESTDIR part should always work with programs that follow the usual ./configure, make and make Enter one of the commands included in the package, install procedure, but with other build systems you should such as ddiff, and you’ll see that everything is in order. check the documentation to find out how to install files into a Great success! If you’ve ever tried to make a Deb package the temporary directory. traditional way, you’re probably be jumping for joy at the simplicity of all this (or crying at the difficult memories it Creating a Deb package conjures up). And we’re only just getting started… So now we come to the big moment: using FPM to convert During the package building phase, you can add extra this directory into a package. The command you need is: information to the resulting file. This isn’t a step which is fpm -s dir -t deb -n dateutils -v 0.2.5 -C /tmp/packagedir/ . necessary to produce a functional package, but if you’re Let’s go through this carefully bit-by-bit. The first option, -s, creating packages for others to use it makes your work look tells FPM what we want to use as the source for the package; more professional. First of all, add a textual description via the in this case it’s a directory. FPM can use other sources as well, --description flag: use single quotes to specify the text, which as we’ll explore later. also lets you enter newline characters. A good description Next is the -t option which describes the type of package shouldn’t be too long or meandering, and simply explain the that we want to create (a Deb in our case, but you can use -t core purpose of the program. rpm to build RPMs providing you have the relevant software installed (see the Building RPMs box on page 72). The -n Customising the results switch provides the name for the package, while -v specifies Next, use --url to add a website address for the program, the version. Finally, the -C part tells FPM to change into the which is typically its home page. It’s also a good idea to use specified directory before searching for files, and the ‘.’ says --license (put multiple words in single quotes if necessary) that it should search from the base of the directory that its so that end users know whether they can redistribute the been switched-to. package, along with --vendor and --maintainer to provide a Once this command has completed, you’ll see something contact address if a user needs to get in touch. like this displayed: The --before-install, --after-install, --before-remove and Created deb package {:path=>”dateutils_0.2.5_i386.deb”} --after-remove options are especially useful. With these, you Take a look at the package details: can provide scripts that should be run at the corresponding dpkg --info dateutils_0.2.5_i386.deb times during the (de)installation process. You’ll see that FPM has populated many of the package Many packages make use of these scripts to perform description fields automatically, eg using your login name and initial setup operations before putting the files in place, or system hostname for the vendor and maintainer fields. cleaning up old temporary files after the package is Others are given generic text, like the description and completely removed. homepage. You can add options to the FPM command to To see how this works, create a text file called afterinstall customise these, as we’ll see in a moment, but for now you’ll in /tmp with the following contents: want to install the package to check that it’s working: #!/bin/sh sudo dpkg -i dateutils_0.2.5_i386.deb ls --color

If you missed last issue Call 0844 848 2852 or +44 1604 251045

www.tuxradar.com November 2013 LXF176 71 Tutorial FPM

Tips for distro independence

Building a package that works across shouldn’t run into major problems with multiple distros is no mean feat. A few this approach. projects emerged over the years that In your post-installation scripts, try to aimed to create a distro-neutral use vanilla tools that are available on packaging format, most notably the now every distro, and not distro-specific defunct Autopackage, but none of them programs. If you’re building a package on really took off. Still, there are a few things OpenSUSE and need to do some you can do to ensure that your packages configuration work after the installation work on as many distros as possible. phase with a post-install script, it might First, try to build the package on a be tempting to call a Yast module, slightly older version of your distro. but then the package definitely won’t Whether this is possible or not depends work on Fedora. on the program’s dependencies, but if Also, take a look at the Linux Standards you can get by with older versions of Base and Filesystem Hierarchy Standard libraries, that helps a lot. For instance, (www.linuxfoundation.org/ if your distro has libfoo 3.4, but you can collaborate/workgroups/lsb). These build the package on an earlier distro are projects that attempt to unify the release that has libfoo 3.1, then your common toolset, libraries and directory package (should!) work on a wider range layouts across distros, and many distros of distros with varying libfoo versions (eg include an lsb_release script for getting a spin-off of your distro that has libfoo version information. You could use lsb_ 3.3). Generally, open source libraries take release -a in a script to find out which Many distro-neutral packaging formats have come and backward compatibility seriously, so you distro and version are being used. gone. Do you remember this one?

You will need to make it executable (chmod +x /tmp/ the standard C library, most programs will need other afterinstall) and build the package again, using the --after- libraries and packages installed to run. Yes, we’re talking install option like this: about dependencies here, but don’t run away screaming as fpm -s dir -t deb -n dateutils -v 0.2.5 --after-install /tmp/ FPM handles them elegantly. afterinstall -C /tmp/packagedir/ . First off, you’ll need to find out which libraries (and When you install the new package, you’ll see the output of ls versions) are required by the program you’re packaging up. If --color after the Setting up dateutils (0.2.5) line. This is a the software is well documented, you should be able to find highly versatile system, in that you can print out messages this out from the Readme and Install files, but if not, there during the installation phase or even ask the user questions are some other tricks you can employ. Running ldd on the with a bit of shell scripting. program’s main binary after compilation will show you a detailed list of every library file that it uses, and with your Conflicts and dependencies usual packaging tools you can find out which library file Some packages can’t be installed if a certain other package is belongs to which package. already present on the system. This isn’t a common Let’s say that Dateutils needs at least version 2.17 of the C occurrence, but it helps to avoid clashes between packages library. We can specify this as a dependency during the build that provide the same functionality in the same filesystem phase like so: locations. Try building the package with --conflicts xterm, for fpm -s dir -t deb -n dateutils -v 0.2.5 -d ‘libc6 (>= 2.17)’ -C / instance, and then installing it again – you’ll see an error tmp/packagedir/ . saying that the package can’t be installed because Xterm is The most important thing to note here is the >= part, already on the system. (Well, providing you have Xterm which means ‘greater than or equal to’. So, our Dateutils already installed, of course.) package won’t be installed unless the current C library While our Dateutils example has no requirements beyond version is 2.17 or newer. You will need to change that to Building RPMs

As mentioned earlier, to make RPMs you just need to pass the Note that there are some FPM options which only apply to -t rpm option to FPM. This should work without a hitch on RPMs. You can get a list of these by running fpm --help and RPM-based systems, but if you’re running another distro you’ll looking for the lines which contain ‘rpm only’. You should also need extra tools. On Ubuntu-based distros you can use sudo take care with RPMs that are produced on Deb-based systems: apt-get install rpm which provides the rpmbuild program that in most cases they shouldn’t pose any problems, but if you’re FPM needs. Then, by running the previously listed commands distributing software online then it’s worth trying them out on a with -t rpm, you will end up with a package that’s called genuine RPM-based distribution before open the doors and dateutils-0.2.5-1.i686.rpm. handing them out

Never miss another issue Subscribe to the #1 source for Linux on page 32.

72 LXF176 November 2013 www.linuxformat.com FPM Tutorial

something excessively large version number like 9.99, rebuild the package and try to install it again, and you’ll see a message along the lines of: dpkg: dependency problems prevent configuration of dateutils: dateutils depends on libc6 (>= 9.99); however: Version of libc6:i386 on system is 2.17-0ubuntu5. It’s possible to specify multiple dependencies with a series of -d flags followed by the package names and versions as illustrated in the code above. If the program you’re packaging up has a vast range of dependencies, check in your distro’s package manager to see if there’s a meta-package to cover them all. For instance, if you’re creating a package for a Gnome app, instead of typing in endless lines of dependencies for the various parts of Gnome, you could simply make your package dependent on ‘gnome’ which itself pulls in all the major Gnome dependencies. Advanced options So far through this tutorial, we have looked at using directories as sources for FPM; the -s dir part. But FPM can generate packages from other files as well, such as tarballs. If you have foo-1.0.tar.gz which contains files and a directory structure that can be copied into the filesystem (eg /usr/ See http://goo.gl/sWs3Z for a light-hearted presentation from FPM’s bin/foo, /usr/share/doc/foo/ and so forth), then you can author, explaining his motivation for writing the program. convert it into a .deb or RPM using -s tar like this: fpm -s tar -t deb -n foo -v 1.0 foo-1.0.tar.gz Well, this feature is primarily useful for creating meta- Another source that FPM can use is Python modules. packages. For instance, you might be setting up a bunch of Thanks to easy_install, FPM can download modules and desktop machines with a specific combination of programs (a package them up automatically, rather than having to hunt certain window manager, web browser, editor etc.) Instead of around on websites. For instance, to build a package of PyX, installing the programs by hand on each machine, or fiddling a module for creating PostScript and PDF files: around with a script, you could create a meta-package with fpm -s python -t deb pyx the required programs as dependencies. Then you just need Last of all, with -s empty you can create completely to install the package on each machine and the package empty packages. But why would you want to do that? manager will handle the rest. LXF Building static binaries

One way to make your packages work library versions a distro is using; all the across many distros is to statically link code your program needs is included in the executable files. Normally, programs the executable. Building static binaries is make use of external code libraries via a complicated, but a proprietary program system called dynamic linking, that is, called Ermine exists that makes it much they access the libraries when needed. simpler (www.magicermine.com). Libraries typically live in /lib and /usr/ Download the ErmineLightTrial.i386 (or lib, are provided in their own packages, .x86_64) file and make it executable. and can be updated independently of the Now find the binary that you want to programs that use them. make static. For example, let’s look at the This is a very sensible system: why gedit binary here: if we run ldd /usr/bin/ should every GTK-based program include gedit we see that it uses over 60 shared its own version of the GTK library, when libraries on the system. But after doing they could all share the same version? this: And it’s good from a security viewpoint ./ErmineLightTrial.i386 /usr/bin/gedit as well, because when a vulnerability is --output static-gedit found in GTK, you can update the shared We now have a complete binary called version and all programs using it are static-gedit which doesn’t depend on automatically fixed. any other libraries. It’s much larger at - Now, if you’re willing to lose these 42MB, compared to 671K. In general, it’s benefits, you can statically link the better to stick with dynamic libraries in executable file(s) inside your package. most scenarios, but if you’re using FPM This rolls all of the shared library code to distribute your self-written software on into the executable, producing a much the net, you could make an optional Ermine massively simplifies the job of making larger file but one that will work virtually statically linked package for users who statically-linked binaries, but it’s not open source. everywhere. It doesn’t matter which can’t get the normal package to work.

www.tuxradar.com November 2013 LXF176 73 BitTorrent Share les and folders using Transmission and set up a tracker BitTorrent: Set Neil Bothwick explains how BitTorrent works and how you can set up your own file and directory sharing, and even your own torrent tracker.

ost Linux users have used BitTorrent at some time, are not involved in the transfer of the files themselves, they at least those of us with a reasonable internet simply let you know where the pieces are. Mconnection. In contrast with many groups, we see it Do not confuse a tracker with an indexer. An indexer is a as a way of sharing files that should be shared, not as a website that lists details of torrents and lets you download means of downloading content that we shouldn’t. But how them, like The Pirate Bay (which hosts a lot of legal content, Our many of us have given it more than a passing thought? How despite its name). Some indexers also run trackers, but this is expert does it work? How can we use it to share our own files? Can it a convenience, not a necessity. be done privately, without making our files available to every There are plenty of clients available; my personal favourite Neil Bothwick user of The Pirate Bay? is Transmission, which also happens to be the default in has a computer in every room, but Rather than downloading a file from a single-source server Ubuntu. If you want something to be used without a GUI, won’t disclose the the BitTorrent protocol enables several users to join a ‘swarm’ Transmission has a terminal client and a headless daemon, or location of his of hosts to download and upload from each other at the same you could try rtorrent which is also very popular. central server for security reasons. time, sharing the bandwidth burden between them. With BitTorrent there is no concept of a server containing the file Sharing your own files and clients downloading it; every computer running a torrent So that’s how BitTorrent works in a nutshell, and you’ve most is doing both. You don’t even need the whole of the file to be likely used it at some time to get hold of a distro’s ISO image, in one piece in any place, although that helps. BitTorrent splits for example. But you can use it to share your own files too. a file into pieces, and the torrent describes the details of this There are a number of reasons why you may want to do this. for a particular file or collection of files. When you start The most obvious is bandwidth. Unless you have a server with downloading from a torrent, your BitTorrent program will a fast internet connection, serving your new distro respin over begin downloading pieces from those who are sharing them. your DSL or cable internet connection is going to be painfully These are not necessarily from the same place, nor in any slow, especially if it becomes popular. The more people that particular order. Once you have downloaded complete pieces, want it, the slower it gets. By contrast, torrents become faster they are made available for sharing, so you are sharing the file with popularity, because more are sharing them. almost as soon as you have started downloading it. Another reason is speed. You could upload your files to a BitTorrent refers to seeders and leechers. Seeders are fast server, a VPS or download site, but they would have to be computers that have downloaded the complete file but completely uploaded before anyone could start downloading. continue to share it. It’s good manners to leave the torrent With BitTorrent, the files are available immediately and, as running after the download has completed to allow others to soon as people start downloading them, at a speed greater share it. Leechers are those who’ve not yet completed the than your own upload rate. download, but this is a rather unfortunate term as leechers “But isn’t BitTorrent public?” I can hear. No, not really. The are seeding as well, as everyone is an uploader with BitTorrent. trackers simply track who has which pieces of which torrent, So how does your BitTorrent program know where to get but knows nothing about the torrents themselves except for the pieces of the file you need? This is handled by trackers. the hash key used to identify the torrent. The files cannot be These are computers that keep details of torrents, they act as downloaded or shared without the torrent file, and it’s up to a sort of clearing house, knowing who has which parts. The you how you share that – whether that’s with the whole world address of one or more trackers is embedded in the torrent or just your circle of friends, BitTorrent is suitable. file, so your client knows where to start looking. The trackers The key to all of this is the torrent file: how do you create one? There are several tools for this, and most of the desktop BitTorrent clients have an option to do so. For example, in Transmission, select File > New, pick the source (which can be either a directory or a single file) and type in the URLs of the tracker(s) to use. How do you know which trackers to use? There are plenty to choose from, such as PublicBitTorrent (http://publicbt.com) or alternatively OpenBitTorrent Most BitTorrent (http://openbittorrent.com), the websites give the tracker clients have an address to use. It’s worth adding more than one tracker, so if option to create one is down or overloaded, your torrent will still work. a torrent file with a couple of There are also command line programs that can be used mouse clicks, to create torrents when a GUI is not available, or from a script. provided that Mktorrent and createtorrent are two choices, but I always end you have a up back with Transmission: tracker address. transmission-create -t udp://tracker.publicbt.com:80 -t udp:/

74 LXF176 November 2013 www.linuxformat.com BitTorrent Tutorial up a torrent

tracker.openbittorrent.com:80/announce somefile will create somefile.torrent – where ‘somefile’ can be a file or directory, which you can share with whoever you want. But where do they download the content from? At least one person, usually you, has to seed the torrent. Copy the file to share (not the torrent) to the directory in which your BitTorrent client saves completed downloads, then load the torrent into your client. Your client will see that the file is already there and, after verifying it against the checksum included in the torrent, will start seeding it. You need to keep seeding the file until at least one copy of each piece has been downloaded by others. At this point you could stop seeding and the file would still be downloadable even if no single user had the whole file, but you generally want to keep seeding your own files if you want to be sure they are always available. Track yourself There’s something about the word ‘tracker’ that sets off the privacy alarms, so even though a torrent tracker does not look at the contents of the files you are torrenting, you only have the word of the tracker operator for that. If you are really concerned about privacy, the answer is to only use a tracker make Public operator you really trust, and who do you trust more than This builds two executable files, opentracker and BitTorrent is yourself? That’s right, you can run your own torrent tracker. opentracker-debug, which you can copy to somewhere in one of several You could even run a tracker that is only visible on a private your path, normally either /usr/local/bin or ~/bin. There services that provide pure network for local(ish) sharing of files only. The most popular are no other dependencies to build or install but it does help tracking services, option is Opentracker. to have a config file, to avoid specifying all options on the without trying Unusually, for such a well used piece of software, there are command line, there is a sample included. Then start the to index all the no packages available for it and not even a source code tarball tracker with: torrents on the – you’ll need to get it from the CVS server. Provided you have opentracker -f /path/to/configfile internet. Or you a compiler environment, usually provided by the build- This must be on a static IP address that’s accessible for could run your essential package, and the cvs package installed, you can the clients wanting to use it, which includes forwarding the own with the build Opentracker by creating an empty work directory, cd’ing correct port from your router if you want access over the same software. into it and running these commands, as your normal user: internet. Then you’ll need to add this tracker to your torrent cvs -d :pserver:[email protected]:/cvs -z9 co libowfat files when you create them. With the default Opentracker cd libowfat configuration, this would be: make udp://IP-ADDRESS:6969/announce cd .. using the appropriate IP address or host name for the cvs -d:pserver:[email protected]:/home/cvsroot opentracker server. co opentrackercd opentracker There is a also a Python script called bttrack.py included with the bittornado package. While this can usually be installed from your distro’s package manager without the need for CVS or compiling, it is a little more fiddly to use, but you may prefer to try it this way. LXF BitTorrent Sync

There is another option for sharing files, easy to use, although appears rather or even directories, using the BitTorrent slow for large files, and can be used to protocol without torrents. The new share multiple directories, with different BitTorrent Sync program (http://labs. users if you want. It’s not open source bittorrent.com/experiments/sync. and it does communicate with their html) syncs directories on different servers, so it’s not entirely private. Your computers, rather like Dropbox but choice on whether to use it depends on BitTorrent Sync is another way of sharing files, although without storing the files on a server. It is how paranoid you are. more suited to folder synchronisation.

www.tuxradar.com November 2013 LXF176 75 TutorialCloud DrupalXxxx services Manage, monitor and back up instances using AWS

AWS: Managing What you need to know about cloud computing, Rob Dobozy shows you how to try it yourself using Amazon Web Services without spending a penny.

how to deploy your own Platform as a Service (PaaS) environment in under ten minutes. First, let’s recap the key information from the first part. Your EC2 instance is running in Eu-west region (Ireland) and Our its type should be t1.micro as this is free for 12 months under expert Amazon’s tier pricing system. The type designation defines how many CPUs and how much memory is available to your Rob Dobozy is a SAP Technical instance. In this case, the instance has one 8GB volume Architect. For the which contains the root filesystem. last 12 months The EC2 console allows you to control all the aspects of and he’s been walking about the instance including volumes and snapshots (more about with his head in snapshots later). It also allows you to do some basic the clouds. monitoring. If your instance isn’t running, start it now. The instance details section contains four tabs. The first one, Description, shows more detailed information about the instance. The Status Checks tab shows the status of AWS infrastructure and your instance. If you click on tab called Monitoring you should be able to see how the instance is performing. You’ll notice that there are also graphs for CPU, Quick disk and network throughput. tip Taking a snapshot The instance name Before you start using the cloud for anything serious it’s a and IP address will change when you n the first part of this tutorial series [LXF171, Get on the good idea to make at least one backup, and more restart it. Make Cloud, Tutorials, p86] I ran through all the basic building importantly, be sure that you can restore it. The Amazon EBS sure you use the Iblocks that make up the Amazon Web Service. In this volume snapshot feature makes this a fairly easy process. new name when second instalment you will find out how to manage and In AWS console (https://console.aws.amazon.com/) connecting to it. monitor the cloud infrastructure we created last time and select EC2 dashboard and click on the Instances link to see the list of all instances. If your instance is running stop it now. It’s possible to create snapshots of EBS volumes while the instance is running, but this doesn’t guarantee consistency of your data (especially if you are running databases). Making a snapshot of a running system and then trying to use it is like pulling a power cable from a server and then hoping it will start without any issues. It’s, therefore, important to make sure the instance is stopped before creating a snapshot of a root disk. The step-by-step instructions on page 78 explain how to take a snapshot of an EBS volume, how to create a useable volume from it and how to replace the current volume with the new one, effectively bringing your instance to the state it was at the time the snapshot was created. If everything went well and your instance is running happily you can remove the old unused EBS volume and the snapshot. This is to ensure you won’t go over the free tier limit and won’t get charged needlessly. You can use the snapshots to do regular backups and to make backups before major changes (eg patching). A good practice is to use multiple volumes. For example you can use one for the root filesystem and one for all your data. This makes it easier to take snapshots of your precious data more frequently and with less overhead as all you need to do is I’m not able to overload even this micro instance with my web requests. stop your application (eg database) before taking a snapshot.

76 LXF175 November 2013 www.linuxformat.com Amazon Web Services Tutorial the cloud

Checking Managing multiple snapshots and doing them manually will AWS Mobile: quickly become a chore. Fortunately, Amazon is providing Everything up, command line tools for Linux as well as SDKs for Android, green and no iOS, Java, .NET, Node.js, PHP and Ruby. These tools and charges. Just the libraries not only let you manage snapshots, but also any way I like it. aspect of your instance. Monitoring EC2 instances If you are not keen on doing any programming with AWS, you can use an existing application. AWS Console by AWS Mobile LLC for Android and iOS is quite simple and easy to use. It enables you to check AWS status and current charges, manage your instances and create snapshots. I’m sure it will come in handy while on holidays when you realize that you’ve forgot to stop your 20 EC2 instances. Now that your cloud infrastructure is ready, you can start making and deploying your snazzy web applications. To do that, however, you need to have the three remaining components of the LAMP stack: a web server (Apache), database (MySql/MariaDB) and execution environment (Perl/PHP/Python). Although they aren’t too complicated to install and configure, there may be a more efficient way. This brings us to the Platform as a Service (PaaS) concept, which you can use to have all the components ready within a few minutes. But what’s probably even more important is the ability to quickly and automatically scale your application if there is an increased demand. PaaSing to the next layer

Amazon’s implementation of the PaaS concept is called component which tries to distribute load between all EC2 Elastic Beanstalk. A Beanstalk application consists of instances belonging to the application. components, resources and versions. When you generate an You may be wondering where the additional EC2 instances application it will create a new EC2 instance with appropriate are coming from. This is an advantage of Elastic Beanstalk as security settings. It will also create a load balancer you don’t have to do everything yourself.You can define auto scaling rules which automatically start additional instances to This is what accommodate increasing load. If the load on your application elastic beans decreases, the additional instances are stopped. on a stalk look This seems like a good time to create your first Elastic like inside. Beanstalk application. Before you do anything, it may be better to stop the EC2 instance you’ve used earlier. You can, obviously, have as many instances as you want, but the resources Elastic Beanstalk generates are taken from your free tier allowance, which allows one instance to run continuously for one month. If you are still in EC2 console, click on Services in the top left corner of the browser and then select Elastic Beanstalk from the menu. Follow the step- by-step instructions on page 79 (Set up an Elastic Beanstalk demo) to create an demonstration application. With the basic settings configured and the second version of your application running (have you noticed what’s different between the versions?) you can now take your PaaS platform

If you missed last issue Call 0844 848 2852 or +44 1604 251045

www.tuxradar.com November 2013 LXF175 77 Tutorial Amazon Web Services

Backing up and replacing instances

1 Create snapshots 2 Break it Click on Volumes in the Elastic Block Store section. There will be one Now you can start the instance. Note that the instance will be given a volume attached to your EC2 instance. Right-click on it and select different name, so you have to modify the ssh command and the URL Create Snapshot. Give it a meaningful name and confirm the accordingly. Let’s pretend that you’ve made a mistake while editing dialogue. You can verify that the snapshot was created in the the index.html file in /var/www and rename the file as user root Snapshots section (refresh may be required). (don’t forget sudo).

3 Create volume from snapshot 4 Detach current volume Snapshots can’t be used by instances directly. You need to create a As the root disk will be changed you will have to stop the instance volume from the snapshot first. In the snapshot section, right-click on volume first by right-clicking on it and selecting the Stop option. With the snapshot and select ‘Create Volume from Snapshot’. Select the instance stopped, make a note of the volume attachment Standard as Volume Type and make sure the availability zone is the information (normally /dev/sda1) before you detach the volume from same as the instance. the instance.

5 Attach a new volume 6 Is it working again? In the volumes section, attach the new volume. Select the correct As the instance has to be restarted it will now get a new IP address instance and change the device to be the same as the old volume was and name. You will need to use the new name in a browser and SSH to (/dev/sda1). Now start the instance. If everything went correctly, the it to check that the ‘deleted’ file is back and that your instance is in the instance should start in a few minutes. original state.

78 LXF175 November 2013 www.linuxformat.com Amazon Web Services Tutorial

further. Hopefully, you will have noticed that the major You can now start deploying proper cloud based missing LAMP component is a database. This is because the applications. We will start by downloading Wordpress from default application wizard doesn’t provision any databases. http://wordpress.org/download. All you need to do to To add a relational database, go to the configuration area install the CMS is save the ZIP file to your computer, upload it and scroll to the bottom. Click on the link and fill-in the as a new version of your application in your application’s required fields. Once confirmed, a new database will be Dashboard. You will need to wait for the application to go created. As with all provisioning, it will take a few minutes for green, indicating that it’s available, and then access it from a the database to become available. browser. You should get the Wordpress configuration wizard. Follow the wizard and provide the details of the database that you’ve just created. Your new Wordpress website will be up and running in no time! All the resources that Elastic Beanstalk provisions as a part of your application will be visible from the AWS console. You can then check the load balancer, EC2 instance or RDS database with all their relevant settings and security groups. However, if you want to modify or remove your application Doesn’t you should do it from the separate Elastic Beanstalk console look much, as it will modify all the resources accordingly. but it’s your You are now prepared to deploy and scale your first Elastic applications in the cloud. Use this knowledge to create a cool Beanstalk app. project. Remember, the cloud’s the limit! LXF

Set up an Elastic Beanstalk demo

1 Select a platform 2 How is it performing? Creating Elastic Beanstalk applications is easy. You have a choice of Back in the Elastic Beanstalk console, head over and click on the the following six platforms: Java, .NET, Node.js, PHP, Python and ‘Monitoring’ link. This is how AWS knows that it needs to start Ruby. The choice is yours, but in this tutorial we’ve used PHP. Press additional instances. You can also add more metrics to your default the ‘Get Started’ button and a sample PHP application will be created. environment via the Edit button.

3 Uploading a new version 4 The configuration Download a second sample application from https:// In the configuration area, add your Key Pair to the instance. This will elasticbeanstalk-samples-us-east-1.s3.amazonaws.com/ allow you to SSH to it. You can also enable notifications by defining php-secondsample.zip and in the Dashboard section click on the your email address. Note that some changes will result in instance ‘Upload and Deploy’ button. being recreated with the new settings.

www.tuxradar.com November 2013 LXF176 79 TutorialJuju Xxxx Create a charm for deploying your preferred services to the cloud quickly Juju: Making Cloud-enable your services using some West African magic and this charming man you may have met before, Nick Veitch.

Penguin is good (12.04 is a long term release) or Raring Ringtail (13.04). You will also need to install the juju-core package, or the older Juju package (for installation details for your distro/platform, see https://juju.ubuntu.com/docs/ getting-started.html). It is also a really good idea to install the charm-tools Our package, which has a few functions to help you along. expert Whatever the case, you should also have an environment Nick Veitch where you can create instances with Juju, such as an AWS remembers he account, HP Cloud or OpenStack. If you have any difficulty launched LXF with setting up Juju on your cloud provider, check the link above. only a set of Bash scripts keeping Assuming that’s all in place, we can get started! the magazine OK, so the first thing to do is create the directory structure going. They were replaced with for your charm, and fill it with the placeholder files we will ‘people’, a need. Since you installed charm-tools, this is easy. retrograde step mkdir -p ~/localcharms/precise in his opinion. cd ~/localcharms/precise charm create vanilla You will see an error which says ‘failed to locate vanilla in apt-cache’. This is fine. If you were creating a charm for a package that was already locally installed, the charm tools would have done a bit more work and filled out some of the metadata for you, but not to worry.

uju is great. If you haven’t heard of Juju, then you aren’t Creating charms being the best you can be at clouds (see Juju GUI, p81 The first port of call is the metadata.yaml file. This contains Jfor details on the demo). The underpinning thing about all the important information that Juju will need to know Juju is charms. A charm is a little bundle of distilled expertise about the charm, but it actually looks quite simple. The first that knows how to deploy a particular service – say part is straightforward: something like MySQL or WordPress. But it is more than just name: vanilla a glorified install script: it can also make sense of other summary: Vanilla is an open-source forum. services and connect them together (eg joining MySQL to maintainer: my name WordPress so the latter can use the former as a back-end). description: | Charms are, quite simply, magic and in this tutorial, we are Vanilla is an extendable, multi-lingual forum system. This going to make some magic happen! charm will deploy Vanilla according to the official instructions. There are a few things you will need in order to create a As you can see the YAML format is quite readable, and charm. Although it is possible to do on other distros, it is contains simple key:value pairs, which so far have been much easier if you have a recent version of Ubuntu. Precise mostly simple descriptions. The next part is a little more important. categories: applications provides: website: interface: http requires: database: interface: mysql Categories is a list, as your charm can be in more than The structure one (put each on a new line). The valid options here are of your charm databases, file-servers, applications, cache-proxy, app- directory should servers, miscellaneous. Don’t worry about this too much, it is look like this! really only for making them searchable online. There are two

80 LXF176 November 2013 www.linuxformat.com Juju Tutorial charms

important sections below though – provides and requires. The provides section includes services our charm will Juju GUI provide. In this case it is a website, so we put that down and, as an indented value, include the interface it will use to deliver Tired of typing? You should check out the the available charms from the demo this service. The names here don’t matter too much – we Juju GUI, a drag and drop interface for store, and you can drag them onto the could have called the service ‘web’ or ‘forum’ or something, deploying charms in your cloud. The GUI main panel to deploy them. but it is important to remember the name because we will runs as an instance and makes all those Try out the live demo site to see what need to use it for naming our scripts later. tedious relationships so much easier to you are missing! Requires is a little more specific, because in this case we manage. A browser on the left shows all https://jujucharms.com/sidebar. will be consuming another service (MySQL). If we check the metadata of the MySQL charm, we see that in the provides section it states it provides a database with an interface of MySQL. That’s exactly what we want. This information allows Juju to work out ways in which services can connect, so it knows what scripts to look for. Hooking up charms Okay, now for the clever bit. The hooks directory contains executable scripts with specific names which are called upon when certain things happen. Think of it as event handling, but for services. These events can be broken down into two types – lifecycle and environmental. The lifecycle ones deal specifically with events that only happen to our service, and are always named the same – start, stop and install. Let’s The Juju GUI makes deploying cloud services look a bit too easy. Shhhh. write one now. We will start with ‘start’, as it is pretty easy: #!/bin/bash set -e an error code if any of the subsequent commands fail – if service apache2 restart something goes wrong, we want Juju to know about it. The As this is an executable file, it should start with the usual vanilla forum runs from an Apache web server (in our case – hash bang. An important note here – we are using Bash you could use something else if you wanted). To start this because it is simple and easily understood by most people, service then, all we need to do is start Apache. But what if but you can write your scripts in any language you want, as Apache is already running? Then we should just restart it – long as it is executable on a standard Ubuntu server. We the restart option will start Apache if it is stopped, or restart it wouldn’t recommend Fortran 77, but it is up to you. The if it is running. This means our script is ‘idempotent’ (see the set -e line is important, as it tells the script to exit and return Idempotency! box top of p82), which means we can run it several times without changing the desired result. The stop script is similar and simply uses a slightly different command to stop Apache. The real tricky one is the install script – this has to download and install everything we need to run Vanilla, and copy the files into the correct directory. We’ll break this down to explain it as we go along… #!/bin/bash set -e apt-get install -y apache2 php5-cgi php5-mysql curl php5-gd wget libapache2-mod-php5 Yes! we can use apt-get to install any dependencies (remember to use the -y switch to disable any interaction). In this case we want Apache, wget (for fetching our Vanilla source) and various PHP bits we need to make Vanilla work properly. Your requirements may be different of course – base it on the dependencies required by your software on a If you need help setting up Juju, check out the online plain Ubuntu server install. docs at https://juju.ubuntu.com/docs. dl=”https://github.com/vanillaforums/Garden/archive/

If you missed last issue Call 0844 848 2852 or +44 1604 251045

www.tuxradar.com November 2013 LXF175 81 Tutorial Juju

cat < ServerAdmin webmaster@localhost Idempotency is a word you will hear a lot matter what state it was in to begin with. DocumentRoot /var/www/vanilla with regard to charm hooks (and maybe It can be tricky to think of all the other places depending on the company scenarios where relationship hooks Options Indexes FollowSymLinks MultiViews you keep). It means that re-running the apply, but just bear in mind that you AllowOverride All operation shouldn’t change the intended shouldn’t make assumptions about the Order allow,deny end result. So if the operation is to start a state of services when triggering a script. allow from all service, it should end up started, no This helps charms be more robust. ErrorLog \${APACHE_LOG_DIR}/vanilla.log LogLevel warn Vanilla_2.0.18.8.tar.gz” CustomLog \${APACHE_LOG_DIR}/access.log combined # Grab Vanilla from upstream. juju-log “Fetching $dl” EOF wget “$dl” -O /tmp/vanilla.tar.gz a2dissite 000-default This part fetches the tarball from the website – it is a good a2ensite vanilla idea to fetch a specific file – one you know will work! service apache2 reload # check if installed juju-log “Files extracted, waiting for other events before we if [ -f /var/www/vanilla/conf/config.php ]; then do anything else!” cp /var/www/vanilla/conf/config.php /tmp/ The last bits at the end there make Apache aware of the rm -rf /var/www/vanilla website and reload it so it gets the configuration changes. fi You may notice some juju-log commands. These are used to What if Vanilla is already installed? In that case we should send log messages to the /var/juju/ logfiles, and can help a preserve the configuration, which is what the above does. lot with debugging your scripts. Now we can extract the files: # Extract to a known location Relationships juju-log “Extracting Vanilla” Relationships can be tough, but the hooks relating to them tar -xvzf /tmp/vanilla.tar.gz -C /var/www/ are quite straightforward. The first thing to know about this mv /var/www/Garden-Vanilla* /var/www/vanilla type of hook is that they take their name from the if [ -f /tmp/config.php ]; then relationships mentioned in the metadata. So, for example, we mv /tmp/config.php /var/www/vanilla/conf/ will need some event hooks to deal with fi -relation-joined We should also change the permissions on relevant files: -relation-changed Browse the chmod -R 777 /var/www/vanilla/conf /var/www/vanilla/ -relation-departed hook code of uploads /var/www/vanilla/cache -relation-broken other charms The next step is to configure Apache to know about Vanilla Some of these events are self-evident. The relation-joined online and check and edit its configuration to include an entry for it. This can is called when a relation is established. As this also means the out their Readme easily be done by redirecting the output from cat to the relationship has changed, the relation-changed hook runs files for tips on how to connect relevant file: right afterwards. A departed state happens when a service to them. juju-log “Creating apache2 configuration” disconnects, and a broken state when a relationship that was established is no longer available, to enable any cleanup. So, we need a set of scripts for our database service to deal with these events. However, each time an event happens, if Juju doesn’t find a script to run by the appropriate name, it just assumes everything is fine. This saves us from writing dummy scripts. For example, there is no need to write a database- relation-joined script if we are going to write a relation- changed script which can handle the initial connection too. #!/bin/bash

set -e # If any command fails, stop execution of the hook with that error db_user=`relation-get user` db_db=`relation-get database` db_pass=`relation-get password` db_host=`relation-get private-address` if [ -z “$db_db” ]; then juju-log “No database information sent yet. Silently exiting” exit 0 fi

Never miss another issue Subscribe to the #1 source for Linux on page 32.

82 LXF176 November 2013 www.linuxformat.com Juju Tutorial

Local provider with LXC

You don’t need to have a cloud account with HP or Amazon to mess around with charms. There is currently experimental support for LXC (Linux containers), which means you can run a cloud virtually on local instances – it saves time and money and is great for when you are developing charms. You can find the latest instructions on configuring Linux Containers at http://juju.ubuntu.com/docs/config-LXC.html.

vanilla_config=”/var/www/vanilla/conf/config.php” cat < $vanilla_config juju bootstrap charm is being deployed on, by using the And then you can browse the logs or juju deploy mysql machine name given from juju status do whatever else you need to. juju deploy --repository=~/localcharms local:precise/vanilla

www.tuxradar.com November 2013 LXF175 83 Coding Concepts Back to basics: JPEG compression Ben Everard uses the undead to illustrate how JPEG compression maximises image quality while minimising image size.

ast month we looked at the DEFLATE algorithm, revert this to RGB by calculating G=Y’-(Cb+Cr), and also [LXF175, p86] which compresses files so they take up factoring the brightness channel into the red and blue Lless space when stored, but can still be decompressed channels. This process (known as 4:2:0 subsampling) Our to the original file. It works well, but for some types of file we reduces the amount of information in the image by half, yet is expert want to squeeze even more space out of them. For example, a barely perceptible to the eye. Ben Everard 10-megapixel image with a single byte per colour per pixel Now we get to the maths bit. We split each channel up into left his job as an would take up about 240MB. Using the DEFLATE algorithm, 8x8 pixel blocks and for each block, apply a Discrete Cosine IT consultant to we might get this down to tens of megabytes (this, Transformation (DCT). For those of you who like numbers and spend two years in Tanzania incidentally, is what the PNG file format does). However, we Greek letters, take a look at the formula on p85 (Fig 1), for installing Ubuntu- might want to get it even smaller. those of you who don’t, fear not, we’re going to focus on what based systems in schools. Now he’s There’s no way to create a significantly smaller file and it does, not how it does it. putting his skills retain the image quality perfectly. Instead, we have to look for to use in the the best ways to strip out information so that the impact on Tricking the eye roiling cauldron of discovery that the quality is minimised. This is the sort of compression used In simple terms, a DCT changes an image from a spatial is LXF Towers. in MP3s and almost all video formats. Here we’re going to representation to a frequency representation. Imagine for a look at the process of compressing an image in JPEG format. moment that we take a single strip of pixels along the image. When we talk about maximising the quality of the The data for this strip of pixels would be a series of numbers compressed image, it’s important to realise that this is quality that we could plot on a graph. Assuming the image wasn’t as it appears to humans, not the actual bit-by-bit difference plain that graph would have peaks and troughs. The values of between the original and compressed files that a computer the pixels is our spatial representation of the data, while might see. The trick in creating good lossy compression storing the frequency of the peaks and troughs is the algorithms is in removing data that humans can’t perceive. frequency representation of the data. We often think about images having a red, green and blue The reason we go to this trouble is, again, to try to find component, but that’s actually not quite how our eyes work. ways to remove as many bits as possible while minimising the We perceive colours in red, green and blue, but we see detail effect on how we see the image. It turns out that the eye is just in intensity, regardless of colour. This, for example, is why quite sensitive to low-frequency changes in an image (that is, we can’t see colours in the dark, and why some photographs gradual variation in colour or brightness), but finds it hard to look better in black and white. JPEG compression takes detect the specifics of high-frequency changes (sudden advantage of this by transforming the image from the RGB changes in intensity, such as lines). In other words, we can Using Gimp, colour encoding to the Y’CbCr encoding. This is brightness detect subtle changes in brightness, but as far as the eye is you can fine-tune (Y’), blue (Cb) and red (Cr). Since our eyes only see detail in concerned a line is pretty much just a line. the variables the Y’ channel, we reduce the resolution of the Cb and Cr Because of this property of the eye, we can lose a lot of in the JPEG channels by half. When the image is decompressed, we can information from the high-frequency portion of the image compression. while minimising what’s noticeable. We do this by ‘quantisation’. The means that we assign fewer bits to the higher frequency parts of the image than to the low frequency portions. There’s no fixed way of doing this, and the amount you assign to each section of the frequency determines the amount of compression (and image quality) you’ll finish with. Once the DCT, and quantisation have been performed, a Huffman code [see LXF175, Tutorials, p87] is created to squeeze out any redundant information without affecting the image quality any further. The result is the JPEG version. All lossy compression methods use similar techniques to remove as much information as possible while minimising the effect on the user. The science of compressing data in this way is all about understanding the limitations of humans, and exploiting these to hide the errors you inevitably introduce as you cast data aside. LXF

84 LXF176 November 2013 www.linuxformat.com Coding Concepts

JPEG artifacts on the undead

Errors introduced during the compression, known as artifacts, JPEG images, with increasing levels of compression. Note how increase as you increase the level of compression. However, the high-frequency parts of the image are the first to degrade, they don’t increase uniformly across the image. Here are four while the low-frequency parts hold their quality longer.

1 First we start will minimum compression. This is still 2 Looking carefully, you’ll notice how the high 4:2:0 subsampled, but due to the nature of how our eyes frequency parts of the images are beginning to lose work, we just can’t see this. definition as fewer bits are assigned to them.

3 The quantisation has now become so harsh that it’s 4 At this level of compression, the high-frequency starting to affect the low-frequency portions, such as portions are almost entirely lost, yet at less than a single the edges of the zombie’s arms. bit per pixel, the image is still identifiable.

(Fig 1) This overly complex formula just splits an image up into its frequency components.

www.tuxradar.com November 2013 LXF176 85 OpenEuphoria Joyous coding with OpenEuphoria Juliet Kemp dives into Euphoria and discovers it’s fast to read, fast to pick up and fast to run. Tutorial code

Our uphoria was first released back in 1993, when it was myfile = open(“myfile.txt”, “w”) expert shareware. These days, it’s still under active if myfile = -1 then Edevelopment, but it’s now an open source project, puts(STDERR, “couldn’t open myfile\n”) Juliet Kemp always likes a bit available for a variety of platforms including Linux. It’s fast, else of euphoria in can be interpreted or compiled into C, and does a bunch of puts(STDOUT, “file opened\n”) the morning. run-time checking to help you find bugs quickly. It’s also fairly puts(myfile, “Hello, World\n”) easy to read and understand from the get-go, with a close(myfile) minimum of coding punctuation marks and boilerplate. end if Euphoria’s definitely a bit old-school in style; procedural, One of the four available types in Euphoria is integer with very minimal type checking and minimalist function (See the bottom of this page for the other three). Here, we set declarations. If you’re an OO fanatic, perhaps best stay away. up an integer to use as a filehandle, then try to open the file. At times the English-language keyword approach even leaves If it works, we’ll get a positive integer (3, in this case, unless it feeling close to pseudocode – but it’s pseudocode that we’ve opened another file earlier in the code); if it fails, we’ll works. Give it a try; you might find yourself surprisingly taken get the result of -1. We test for success (if/then syntax, as by the language. here, is straightforward; note the end if closing the block) You can download either a Deb package, or a generic and act accordingly. Note that puts takes a filehandle tar.gz binary package, from the OpenEuphoria website argument; here one statement is output to standard out, (http://openeuphoria.org). At time of writing, the most and the other to the file, and it’s important to remember to recent release was 4.0.5. You can also download and compile close the file afterwards! your own C source code release from the downloads page. Nightly builds are available if you like being bleeding-edge. Ring the alarm program If you decide to install the tar.gz package, you’ll need to Time to get a bit more complicated. We’re going to create a unpack it wherever you prefer (probably /usr/local). You can program that rings an alarm after a certain number of then either edit /etc/profile as necessary, or create your own minutes. In our initial very basic iteration, we’ll set it to run for eu.cfg that looks like this: just a few seconds: /path/to/euphoria/include include std/os.e This will tell Euphoria where the various standard libraries global integer Seconds = 5 are. (You can also set an environment variable $EUINC to do global object Message = “Time’s up!\n” the same thing.) At this point, you’re ready to go. procedure ring_alarm(object alarm_text) puts(1, alarm_text) Hello World end procedure As is customary, let’s start with Hello World. Create a file procedure run_alarm() helloworld.ex (by convention, console Euphoria programs sleep(seconds) end .ex, GUI apps end .exw, and include files/libraries end .e): ring_alarm(message) puts(1, “Hello, World\n”) end procedure You run it with eui helloworld.ex, and you will see the run_alarm() expected output. The first line includes a standard library which allows us to puts() (“put string”) may be familiar from other use (among other things) the system sleep() function. languages. Here, it takes two arguments. The first one tells We then declare two global variables. There are only four Euphoria where the output is going to (1 is, as ever, the variable types in Euphoria: filehandle associated with standard output); the second one object (can take on any value at all). is the string to output. printf() is also supported for more sequence (a sequence of any type of object). complex or formatted output. atom (numbers of any sort). To output the same thing to a file, you’d need to open a file integers (integer numbers between -1073741824 and first and assign it to an integer filehandle: +1073741823; larger integers can be used but must be integer myfile declared as atoms). constant STDERR = 2 Numeric calculations are slightly faster on integers than constant STDOUT = 1 on atoms. You can also define your own variable types if you

86 LXF176 November 2013 www.linuxformat.com OpenEuphoria

need to; check the documentation for more details. Here, global object Break_message = “Break time is up!\n” integer is fine for our number of seconds variable. global atom Work_minutes = 25 The two building-blocks of an Euphoria program are global atom Break_minutes = 5 procedures and functions. A procedure performs some procedure run_alarm() computation, and can take parameters. Functions are like sequence pomodoro = {Work_minutes, Break_minutes} procedures, but return a value; we’ll use functions in a later sequence pomodoro_message = {Work_message, Break_ iteration of this program. Both functions and procedures are message} closed with end [procedure|function]. Simply defining a for i=1 to length(pomodoro) by 1 do procedure or a function doesn’t run it; you have to explicitly sleep(set_alarm(pomodoro[i])) call it. As you’ll notice, we could do everything here in a single ring_alarm(pomodoro_message[i]) procedure, but it’s good practice to break different functions end for out and makes it easier to extend the program later. Both of end procedure these procedures are straightforward. Run the program with This is all fairly self-explanatory. We set up two sequences, Quick eui pomodoroalarm.ex, and after five seconds you should one to handle the time, and one to handle the message see a message displayed on the console. displayed. Then we use the built-in length() function to tip iterate over the time sequence, sleep, and display the To trace the Coding standards appropriate message. (I recommend, again, changing the progress of a Of course, five seconds isn’t very long. The ‘pomodoro’ minute values for testing while you’re developing.) Note that Euphoria program (ie, to step through productivity technique uses sections of 25 minutes, so let’s Euphoria indexes from 1. it instruction by change our program to reflect that (only the changes are This is a bit error-prone, though; what if pomodoro and instruction), add shown here, the rest of the program stays as-is): pomodoroMessage are different lengths? You’ll get an error. these lines at the global atom Seconds For a more neat, and more maintainable, process you could top of any program: function set_alarm(atom minutes) use a sequence of sequences to associate your *Minutes with trace trace(1) return minutes * 60 and *Message variables: end function procedure run_alarm() procedure run_alarm() sequence pomodoro = {{Work_minutes, Work_message}, Seconds = set_alarm(25) {Break_minutes, Break_message}} -- rest of procedure as before for i=1 to length(pomodoro) by 1 do end procedure sleep(set_alarm(pomodoro[i][1])) Run this, and you should get an alarm after 25 minutes. ring_alarm(pomodoro[i][2]) However, this is a long time to wait for testing, so you might end for want to swap in a smaller value (try 0.1) for 25 while you’re end procedure experimenting. Note that if the type of minutes in set_ Or you could achieve a similar result by changing the global alarm() were integer rather than atom, you would be limited variables: to whole minutes. We’ve also changed Seconds to atom, for global sequence Work_settings = {Work_minutes, Work_ the same reason – you want it to be able to handle random message} fractions of a minute. Try keeping it as integer, then putting global sequence Break_settings = {Break_minutes, Break_ 0.01 in to replace 25; you’ll get a type check failure, as the message} result is 0.06 and seconds cannot be set to 0.06. procedure run_alarm() A quick note on Euphoria coding standards: the standard sequence pomodoro = {Work_settings, Break_settings} for the standard libraries is to use lower case for local -- for loop as above variables, uppercase for constants, Sentence case for global end procedure variables, and underscores within names. I’ve broadly stuck This is probably the clearest and most maintainable with this, though you can choose your own coding standards version, but as you can see, Euphoria is quite flexible in how if you prefer. Euphoria is case-sensitive. you use its variables! Another aspect of the Pomodoro technique is following The next thing we can try is to ask the user how long they your 25 minutes of work with a five-minute break. It would be want the timer to run for. We’ll keep our existing default great if we could set our alarm up to manage that settings, but add a procedure that asks the user for input: automatically for us. For that, we could use a sequence, and include std/io.e loop over it: include std/get.e global object Work_message = “Work time is up!\n” procedure get_alarm_times() Editors and Euphoria

There is a Euphoria-specific editor, ed.ex that big advantage: if you run it with no argument support. To access this, install the files provided ships with Euphoria, although to use it you may immediately after encountering an error, it will by the eu-editor project to the appropriate have to add the Euphoria bin directory to your read the ex.err file and launch itself with the system Vim directories, and add this line to path in .bashrc: cursor on the line the error came from. your global filetype.vim file: PATH=$PATH:/usr/share/euphoria/bin However, I found that it simply wasn’t a good au BufNewFile,BufRead *.ex setf euphoria To use it, type enough editor to make it worth using, even for Turn syntax on in your Euphoria file and you eui ed.ex file.ex this. Check out the OE wiki for a list of should see lovely colours. Compared with an editor like Vim or Emacs, alternative editors with Euphoria support, some Similar support is available through the ed is pretty basic, but it does do syntax of which also have this error location support. eu-editor project for MicroEmacs and Nano, highlighting and editing correctly. It also has one Unfortunately, Vim only has syntax and indent among others.

www.tuxradar.com November 2013 LXF176 87 OpenEuphoria

puts(STDOUT, “Please enter work minutes: “) Work_settings[1] = Work_minutes sequence result = get(STDIN) Break_settings[1] = Break_minutes Work_minutes = result[2] end procedure puts(STDOUT, “Please enter break minutes: “) -- Option 2 sequence result = get(STDIN) procedure run_alarm() Break_minutes = result[2] get_alarm_times() end procedure sequence pomodoro = {{Work_minutes, workMessage}, procedure run_alarm() {Break_minutes, breakMessage}} get_alarm_times() -- as before -- rest is as before end procedure end procedure (Comments in Euphoria use either -- as here for a single The std/io.e library enables us to use the library line, or /* ... constants STDOUT, STDIN, and STDERR rather than */ for multi-line.) declaring them ourselves. get() (from the std/get.e library) Arguably the first option is slightly neater, but either will do enables us to read a string of characters from a file and the job. Run it again and it should work fine. convert them into a numeric value. The other input options (gets(), for example) will not automatically turn characters Calling out into a numeric value, and we want a numeric value. get() can If you’re deep in the throes of work, though, you might not take several parameters: notice a little message on a console somewhere. It would be get(integer file, integer offset = 0, integer answer = GET_ better if we could make it play something. Unfortunately, SHORT_ANSWER) while there’s built-in support for Windows system sounds in file gives the file handle from which to read; offset the offset Euphoria, there isn’t anything similar for Linux. So the most to apply to file position before reading; and answer allows you straightforward option is to use a system call to fire up an to choose between two forms of answer: external program and play an MP3: GET_SHORT_ANSWER : {integer return_status, object global object Play_alarm_command = “mpg123 -q alarm. value_read} mp3” GET_LONG_ANSWER : {integer return_status, object procedure ring_alarm(object alarm_text) value_read, puts(1, alarm_text) integer num_characters_read, integer initial_whitespace} system(Play_alarm_command, 2) The return status can be GET_SUCCESS, GET_EOF, end procedure GET_FAIL, or GET_NOTHING. Here we’re not bothering to I chose mpg123 just because it’s a very simple command- check return status, but best practice would be to include an line program that can be run with no output (the -q switch); error check. Since we’re reading from standard input, and we you can use whatever program you like; system() just calls only want the value read in, we don’t need to include offset or out to the system to run a particular command. The mode answer when calling get. This means we’ll just get the short here, 2, means that the graphics mode will not be restored answer. We then pull out the answer’s second index to get our afterwards; it’s not necessary to worry about the graphics or atom to put into Work_minutes (and then Break_minutes). clearing the screen because mpg123 won’t do anything to However, if you run this, you’ll discover that it doesn’t the screen. seem to be doing the right thing. It seems like the values of If you run this, you’ll find that hitting Ctrl+C cancels the Work_minutes and Break_minutes aren’t being changed. alarm and goes back to our program; until you’ve cancelled What’s going on? the alarm, the next timer won’t start. In this case this is In fact, if you put in a few logging statements, you’ll find probably what you want. If in another situation you wanted to that the problem isn’t with Work_minutes and Break_ keep the program running, you’d need to look into using minutes; they are indeed being changed. The problem is that fork(), or multitasking. (There’s a multitasking guide available our global variables Work_settings and Break_settings do in the Euphoria docs). not reflect those changes, because they were assigned before Let’s make one final improvement, which will let us have a we got the user input. There are a couple of options for fixing quick look at if/then structure. We’ll set the program up to this problem: have a default of running a user-defined number of -- Option 1 ‘pomodoros’ (25 minute + 5 minute sequences), with the procedure get_alarm_times() option of changing the times. The whole program as it now -- as above stands is on the LXFDVD. Other neat language features

There is a big stack of common routines If you want to go the graphical route, .dll and .so files), defining the function, and available in the OpenEuphoria API, all well Euphoria has a few GUI options available. using c_func() or c_proc() to call it. Check the documented in the manual. These include The cross-platform graphics available in the Euphoria docs for more; but this gives your extensive maths support; internet functions like std/graphics.e library are console based, and Euphoria program even more scope for rapid HTTP, DNS, and URL handling; locale support; std/image.e can handle bitmaps. Alternatively, development. Finally, while Euphoria can be and a bunch of others. Euphoria also supports there is a GTK graphics library at http://eugtk. hooked in to all the standard databases, if you multitasking, which is particularly handy if wikispaces.com, which also has some support want something a little more lightweight, the you’re interested in writing games or other fast- for Glade. It’s possible to interface Euphoria and Euphoria Database System is available to enable moving programs, or carrying on behind the C code fairly easily; Euphoria can call C routines you to develop database-lite apps easily and in a scenes while waiting for user input. and use C variables, using open_dll() (for both Euphoria-oriented way.

88 LXF176 November 2013 www.linuxformat.com OpenEuphoria

You can edit the The addition we’ve made is the function get_number_ code with syntax pomodoros(), and the if/then section in set_timing(). highlighting, and As shown here, the if/then syntax is pretty straightforward, have it running in and again uses the end * syntax familiar from functions and the background. procedures. If you wanted an else, you would add it in the following way: if a = b then -- do something here elseif a = c then -- do something else here else -- more code end if If the user has specified 0 pomodoros, we let them set their own time preference (and we set the number of pomodoros to 1, which is a slight hack to simplify run_ alarm()). Having set the timings as the user prefers, we use a Alarm_sequence = repeat(Work_settings & Break_settings, double for loop in run_alarm() to iterate over the ‘pomodoro’ Number_pomodoros) sequence as often as the user requested. /* Alarm_sequence now looks like {{W_min, W_mess, B_ min, B_mess}, Operations & sequences {W_min...}, ... } */ The double for loop here seems a little untidy. If you look at end procedure the Euphoria manual, there are a lot of operations you can do procedure run_alarm() with sequences to concatenate them in various ways – using set_timing() the & operator, append() or repeat(). So can we generate an for i=1 to Number_pomodoros by 1 do alarm sequence that looks like this? sleep(set_alarm(Alarm_sequence[i][1])) {{Work_minutes, Work_message}, {Break_minutes, Break_ ring_alarm(Alarm_sequence[i][2]) message}, sleep(set_alarm(Alarm_sequence[i][3])) {Work_minutes, Work_message}, {Break_minutes, Break_ ring_alarm(Alarm_sequence[i][4]) message}} end for In fact, this is a bit complicated, because the end procedure concatenation operators all squash the sequences into one As per the comment, this generates a four-part sequence another in various ways. to repeat. The alternative looks like this: append({a, b}, {c, d}) = {a, b, {c, d}} procedure set_timing() append({Work_minutes, Work_message}, {Break_minutes, -- as above Break_message}) Alarm_sequence = repeat({Work_settings, Break_settings}, = {Work_minutes, Work_message, {Break_minutes, Break_ Number_pomodoros) message}} /* Alarm_sequence now looks like {{{W_min, W_mess}, {B_ {a, b} & {c, d} = {a, b, c, d} min, B_mess}}, {Work_minutes, Work_message} & {Break_minutes, Break_ {{W_min...}, {B_min..}}, ... }*/ message} end procedure = {Work_minutes, Work_message, Break_minutes, Break_ message} procedure run_alarm() repeat({a, b, c, d}, 2) = {{a, b, c, d}, {a, b, c, d}} set_timing() repeat({Work_minutes, Work_message, Break_minutes, for i=1 to Number_pomodoros by 1 do Break_message}, 2) sleep(set_alarm(Alarm_sequence[i][1][1])) = {{Work_minutes, Work_message, Break_minutes, Break_ ring_alarm(Alarm_sequence[i][1][2]) message} -- could also use another for loop here {Work_minutes, Work_message, Break_minutes, Break_ sleep(set_alarm(Alarm_sequence[i][2][1])) message}} ring_alarm(Alarm_sequence[i][2][2]) repeat({a, b, {c, d}}, 2) = {{a, b, {c, d}}, {a, b, {c, d}} end for repeat({Work_minutes, Work_message, {Break_minutes, end procedure Break_message}}, 2) It’s up to you which of these you think is clearest and most = {{Work_minutes, Work_message, {Break_minutes, Break_ maintainable method. message}} {Work_minutes, Work_message, {Break_minutes, Break_ And there’s more! message}}} As ever, there are plenty of improvements to be made to this This leaves us with two possible ways of generating our sample code. For example, you could write code to count alarm sequence through sequence operations: down minute by minute, or even second by second, how procedure set_timing() much time there is remaining before your alarm goes off. Number_pomodoros = get_number_pomodoros() Or you could set up something graphical to represent your if Number_pomodoros = 0 then alarm program with nice buttons to push. Overall, we’ve get_alarm_times() found Euphoria is quick to develop in and gives relatively clear Number_pomodoros = 1 error messages, so it’s easy to dive in and see where your end if inclination takes you. LXF

www.tuxradar.com November 2013 LXF176 89 HTML scrolling effects HTML: Create scrolling effects Put a bit of movement into HTML pages – Ben Everard demonstrates the power of Skrollr using an omelette recipe.

TML is possibly the greatest innovation in text since the printing press. It’s simple to write, doesn’t care Our Habout language and can be displayed on almost any These two lines load and initialise the Skrollr script. You can expert computer made in the past two decades. However, it does add all of these to a HTML file manually, or you’ll find a Ben Everard lack a little pizazz. Fortunately, though, it does enable us to template in the Skrollr file called shim.html. left his job as an build our own pizazz using CSS and JavaScript. In this The one final thing to do before we start is add our IT consultant to tutorial, we’re going to look at using the Skrollr JavaScript stylesheet. This CSS file just contains a few styles that we’ll spend two years in Tanzania library to create various scrolling effects. This is where things use in this example. The fixed-positioning style sheet adds installing Ubuntu- animate themselves in some way as you scroll down a page. some pieces that Skrollr needs. based systems in To start with, you’ll need a copy of the Skrollr library, which to use in the or you’ll find it on the LXFDVD. The first job on the list is roiling cauldron of discovery that unzipping the file, and taking a look at the index.html file to Data properties is LXF Towers. see a whole host of effects that are possible (this file’s also With all this done, we can start adding content. Our page online at http://prinzhorn.github.io/skrollr). won’t really be like a page of text at all, but more like an To add these effects to a website, you just need to add a animation that the viewers can control the speed of. Each few lines to the HTML: element in the animation needs to be inside

Skrollr how to animate them. We’re going to create a simple This goes inside the tags. HTML page that teaches the reader how to make an
omelette. The first div we’ll add is just an introduction.
that sits inside the tags.

Lets make an Omelette