Professional Documents
Culture Documents
1 FOR RASPBERRY PI
www.linuxuser.co.uk
RASPBERRY PI
MET ITS MATCH?
MinnowBoard: Review, Intel interview & spec face-off
VS
HAS THE
ALSO INSIDE LaTeX docs with LyX Master the Vim editor 14+ pages of reviews
ISSUE 131
Raspberry Pi
Model B - 512MB with 8GB NOOBS SD Card
32.99
Inc VAT
code SC 1
27.49 E x Vat
313058
NOW IN STOCK!
5MP Raspberry Pi Camera 19.24
16.03 Ex Vat code SC1302358
cpc.co.uk
Full range of project accessories Kits and Cases Expansion, Breakout and Prototyping Boards Vast Range of Components WiFi Dongles & HDMI to VGA Adaptors Video and Audio Leads Keyboards, Mice and Monitors GPIO Ribbon Cables Programming and User Guides
Welcome
Your team of Linux experts
Mihalis Tsoukalos has over 15 years of
UNIX system administration and programming experience and has been using Linux since 1993. He is also proficient in Oracle database administration, Cisco IOS and Cocoa. In this issue Mihalis shows us how to sync files with Unison, a useful open source CLI tool (42-45).
This issue
open source enthusiast and Linux researcher. His articles have been featured on IBM developerWorks and Computerworld among others. He also blogs at mylinuxbook.com. This month he shows us how to make the most of Vim with his expert guide starting on page 62. been hacking away at Linux for over 15 years. He specialises in desktop Linux solutions among other things. In issue 131 Michael shows us how to get started with databases using LibreOfce its easier than you might think. See his work on pages 34-37.
Build add-ons for XBMC Page 32 Sync your les with Unison Get started with Android Studio
been working on Linux for some 18 years, since he rst attended university at the age of 13. Jon lives in Cambridge, Massachusetts, and works for a large enterprise Linux vendor. You can nd his indispensable Kernel Column on pages 22-23 this month.
reporter and brings us the latest from all over the open source ecosystem, starting on page 14. Also this issue, Gareth speaks to Intel about its new dev platform MinnowBoard on page 6. You can also find his review of this potential RasPi-beater on pages 12-13. at university, using Python to model complex simulations in class. Along with tutorials, reviews and more this issue, Rob tells us which IDE we should be using (pages 72-77) and walks us through the build process of an Onion Pi (pages 46-49).
Welcome to the latest edition of Linux User & Developer, the UK and Americas favourite open source and Linux magazine. When youre trying to make the best Linux and open source read in the world, theres nothing more useful than feedback from readers. Theres little point us being here if we dont aim to give you a healthy dose of what you want, so we pay close attention to what you have to say. But what have you been saying? After collecting, formatting, graphing and a lot of stubble scratching, its clear many of you want more tutorials, bigger reviews and more introductory and intermediate developer content. As youll see this issue, weve dedicated more pages to tutorials and guides than ever before and weve even reformatted our distro reviews to make them more useful. We still need your help, though. If youre keen to learn more about development in the open source eld, we want to know what languages and frameworks you care about. Weve been focusing very heavily on Python in recent months and intend to continue with this, but would you like to see Qt, Vala and C++ here too, or something else entirely? Let us know on Facebook and Twitter or simply drop me an email directly at russell.barnes@imagine-publishing.co.uk.
Twitter:
Buy online
@linuxusermag
www.linuxuser.co.uk
3 Issue 131
DOMAINS
Choose from over 700 new top-level domains! Create a short, memorable web address that perfectly ts your business or website theme, like fashion.blog, kitchens.online or john-smith.london. You can also make your website easier to nd by getting new extensions for your current domain. With almost 20 million registered domains, 1&1 is Europes market leader for domain registration. Thanks to integrated forwarding features, domains registered with us can be quickly and easily connected with any website, no matter which web hosting provider you use. Find out more at 1and1.co.uk
FREE
NEW! PRE-ORDER
WITH NO OBLIGATION!*
1and1.co.uk
* Pre-ordering a domain name is not a guarantee that the domain will be registered. If your requested domain has already been pre-ordered, you will be added to a waiting list for that domain.
Exclusive
n Scott Garman is a Yocto Project engineer at Intel, and the companys evangelist for the MinnowBoard
We chat to Scott Garman about Intels first foray into the world of Linux-powered open hardware development systems
at its heart a low-power 32-bit Atom processor, the board is designed as a development platform to bring the exibility and familiarity of the x86 instruction set architecture to embedded systems and to do so at a low cost. Most surprisingly of all, the device is open hardware: all specications, schematics, board layouts and rmware packages are available for download and reuse under a permissive licence a rst for an Intel hardware product. Clearly, this is a departure from the norm, and one of which Garman is understandably proud.
6 www.linuxuser.co.uk
n Open hardware an offshoot of open source, where the schematics, component lists, and even the individual Gerber les for having printed circuit boards made are released under a permissive licence is growing increasingly popular. Although the Raspberry Pi, one of the most popular low-cost embedded development platforms, is proprietary, many of its competitors are more open: as well as the MinnowBoard, the Gizmo, the BeagleBoard and its smaller BeagleBone offshoot, the Olimex OLinuXino family, and the microcontroller-based Arduino range are all open hardware. Open hardware can lead to rapid advances in features and technologies for the projects that adopt it, but as with open source software there are risks: the Arduinos open nature has led to it being one of the most copied projects around, with Far Eastern factories churning out illegitimate clones by the dozen and misappropriating the projects trademark in direct contravention of its otherwise extremely permissive licence.
up this rst board. Its turned out to be a great collaboration and were really pleased with the results. In one sense, the Intel team working on this is extremely small. At the same time, I wouldnt want to discount the contributions that many people have done to help make this happen, even if they werent involved with the project fulltime on a daily basis. What led to the decision to choose the Queens Bay platform, with its Tunnel Creek Atom processor, in the MinnowBoard? Two main issues led us to use Tunnel Creek CPU for MinnowBoard. One, we were looking for longevity of the platform. Going with an open hardware model means that this is going to be an attractive board for embedded product companies to use and adapt for commercial products. I can tell you from experience, there is nothing more frustrating
To my knowledge, MinnowBoard is the rst hardware platform designed with the Yocto Project in mind
n Along with the power and reset buttons on the right, the MinnowBoard boasts four programmable buttons
n The MinnowBoard sits on four stilts to help aid the passive cooling of its 1GHz Intel Atom processor
7 www.linuxuser.co.uk
Exclusive
Larger and pricier than the Pi, the MinnowBoard offers full x86 compatibility
than developing a successful embedded product and then nding out that your components are about to enter end-of-life. Queens Bay is a platform used in IVI [In-VehicleInfotainment] devices, and was designed with a long lifespan since people tend to own cars for a long time. It still has four to ve years left in the products life cycle. Two, the time to execute was now, so we werent about to wait for upcoming Intel platforms to roll out. Tunnel Creek met our main requirements and was available immediately, so we ran with it. What advantages does the x86 architecture used in the Atom processor offer in the embedded space, compared to ARM or other RISC platforms? Compatibility is likely the biggest advantage. Linux originated on the Intel 386, and whether youre working on embedded or desktop applications, the toolchain, libraries etc were designed on and are pretty much guaranteed to work on x86. Performance is another signicant one. Countless person-years have been put into optimising compilers such as GCC to take full advantage of x86 platforms, so you can leverage that to its greatest benet.
The MinnowBoard includes eight GPIO pins and a dedicated expansion port for Lures
Do you agree that the success of the ARMbased Raspberry Pi has demonstrated a clear demand for low-cost development boards from hobbyists? Yes, absolutely. One of the things I appreciate and respect about the Raspberry Pi project is that its introducing so many new people to embedded Linux development. It used to be that embedded was a niche thing that software engineers specialised in, and now the embedded Linux community is becoming much more diverse, especially with younger people. I love that. What does the MinnowBoard offer that other, more established development boards lack? MinnowBoard stands out in its combination of performance, exibility, openness and
standards. The Intel Atom CPU provides plenty of performance for high computational workloads. It also has strong I/O performance due to PCI Express powering its Gigabit Ethernet and SATA disk features. We also make PCI Express available through MinnowBoards expansion connector to enable high-speed I/O to custom hardware projects, for example interfacing with FPGAs or other hardware. The MinnowBoard can be used for fun hobby projects, yet scales up to higher workloads. Its expandable via several PC and embedded bus standards, and offers an environment for custom rmware development.
With Gigabit Ethernet and a real-time clock, it pulls ahead of the Raspberry Pi
8 www.linuxuser.co.uk
Queens Bay
The code name for the combination of an Intel Atom E6xx-series processor with the EG20T controller hub (code-named Tunnel Creek and Topcliff respectively), Intel launched the Queens Bay platform in 2010 with the embedded market rmly in mind. Initially, the company targeted in-car computer systems for navigation and entertainment so-called infotainment devices but claimed the platform would be equally at home in gaming, communications, point-of-sale, industrial and digital signage applications. The Tunnel Creek family of processors are not true system-on-chip designs, ofoading much of the circuitry to the EG20T chip, but do include the CPU, a graphics processor supporting up to two simultaneous displays, an audio controller and a hardware video codec on a die some 46 per cent smaller than its predecessors. Until the launch of the MinnowBoard, however, using Queens Bay in hobbyist applications was almost impossible: Intels ofcial development board was provided only to registered hardware partners, and came with the expectation that you would be placing an order for a few thousand processors once you had nished your design.
the embedded input/output capabilities and community of Arduino will open up a lot of interesting possibilities. How critical is Linux and the Yocto Project to the MinnowBoards success? We designed the board to be a Yocto Project development platform, and Yocto produces embedded Linux distros. So its pretty core to our purpose. It was the primary motivation behind the project itself to my knowledge, MinnowBoard is the rst hardware platform designed with the Yocto Project in mind. But most people using the MinnowBoard may have no knowledge of or interest in the Yocto Project thats okay, too. Is the MinnowBoard likely to be the rst in a family of open development boards from Intel, or is it merely an experiment for the company? There are a lot of people within Intel who are excited about open hardware. I cant speak [about] any specic future product plans, but I think the future is very, very bright.
9 www.linuxuser.co.uk
Specifications
MinnowBoard vs Raspberry Pi
MinnowBoard
Intels Atom-powered development board is the first to be Yocto Projectcompatible and runs Angstrm Linux. While considerably more expensive than the Raspberry Pi, it utilises the x86 architecture so offers computational power more akin to desktop and mobile computers. Its also a very complete package, offering both Angstrm Linux on a microSD card and a properly rated power supply in the box. However, without decent driver support for the Intel GMA 600 GPU and a DVI-over-HDMI video interface (no HD audio or HDCP encryption), it lacks the same multimedia appeal as the Raspberry Pi.
The MinnowBoard supports tinkerers with two on-board LEDs and six buttons The stilts increase airow to help keep the 1GHz Intel processor (under heat sink) cool SATA support brings mass storage within easy reach of MinnowBoard Analogue audio input is a denite step up from the Raspberry Pi Four stilts and bigger dimensions mean it towers over the RasPi
MinnowBoard Specs
Price Dimensions Weight Operating system Processor Video Max resolution Memory 162 106 x 115mm 119g Angstrm Linux (Yocto certied) supplied on microSD 32-bit Intel Atom E640T single-core at 1GHz Embedded Intel GMA 600 1366 x 768 (no HDCP encryption) 1GB DDR2 (shared), 4MB SPI ash (rmware storage) DVI-over-HDMI (no audio), analogue audio out Analog audio in, 2x USB, 1x SATA-2, 1x micro-USB, 1x mini-USB, 1x serial console, SD card slot, 1x micro-SDIO, 8xGPIO pins 10/100/1000 Ethernet Yes (no battery installed) Lure connector with CAN bus, HD audio, LVDS, IC, 3x PCI Express, SATA-2, SDIO, SPI bus, UART, 2x USB 5V at 2.5A (adaptor included)
Output Input
It has fewer GPIO pins, Gigabit Ethernet means but includes two LEDs and faster networking great four buttons to control if youre planning a server
Power
10 www.linuxuser.co.uk
MinnowBoard vs Raspberry Pi
VS
COMPARED
Raspberry Pi
The Raspberry Pi has inspired thousands to try Linux for the first time and reinvigorated interest in bare-metal computing. It opens the door to the creation of fascinating Internet Of Things projects and drastically lowers the barrier of entry for both programming and physical computing. Its not all plain sailing, though. Its low-price means the out of the box experience isnt stellar. One still needs to acquire a microSD card, an HDMI cable and power supply, meaning starter packs can retail upwards of 60. While its raw processing power is left in the shade by Intels x86 CPU, the Raspberry Pi continues to amaze users with its remarkable multimedia prowess.
Standard SD card support is good, but highspeed SD cards are worth the extra expense
(Model B, Rev. 2)
The Pis small size makes it ideal for hiding behind a monitor or stashing in a project box
Raspberry Pi Specs
Price Dimensions Weight Operating system Processor Video Max resolution Memory Output Input Networking Real-time clock Extras 28 86 x 54mm 40g None included (Raspbian & others supported) ARM1176JZF-S (armv6k) single-core at 700 MHz VideoCore IV Full HD with HDCP encryption 512MB DDR2 (shared) DMI (with HDCP encryption), composite RCA, analogue audio out 2x USB, 1x micro-USB, SD card slot, 26x GPIO pins 10/100 Ethernet No (can be added via GPIO) DSI display connector, JTAG headers, CSI (camera module) connector, SPI bus, I2C, UART 5V at 700mA (not included)
The RasPi could really do with a Lure port - even just two more USB ports would be great
26 GPIO pins means theres massive scope for tinkering. No analogue support, though, sadly
Power
The audio on the RasPi is probably its weakest aspect. No mic support either
11 www.linuxuser.co.uk
Review
Intel MinnowBoard
The Lure connector, for addon boards, carries everything from CAN bus signals to three PCI Express lanes
An HDMI port offers DVI video connectivity, but does not carry digital audio
Two USB ports provide connectivity for external peripherals Gigabit Ethernet gives the MinnowBoard powerful networking capabilities
Intel MinnowBoard
Pros
Powerful, exible, open; a familiar x86 environment for newcomers to embedded development
DEV PLATFORM
162.83 ($200)
Intels answer to the Raspberry Pi is here but at nearly six times the price, can it tempt buyers back to x86?
Clearly, the MinnowBoard is no Raspberry Pi. Measuring 102mm on its shortest side, its signicantly larger, requires a whopping 2.5A from a 5V power supply to run and costs almost six times as much as the credit-card-sized Pi. The MinnowBoard does offer something the Pi lacks, however: full x86 compatibility. At the heart of the MinnowBoard is one of Intels less powerful processors: the Atom E640T. Running at 1GHz, the single-core chip offers a 32-bit x86 implementation already putting it on the back foot compared to the dual-core 64-bit APU found on rival AMDs Gizmo, the closest device for comparison while generating a surprisingly small amount of heat, allowing for passive cooling through a compact heat sink. With 1GB of RAM, the MinnowBoard offers a surprisingly powerful yet lightweight platform for embedded computing. Peaking, during testing, at 7W from the socket, it scored a respectable 95th percentile time of 11.49ms almost ve times faster than the Raspberry Pi at 51.45ms, but still some way behind the Gizmos impressive 9.87ms score. Add in the fact that the Gizmo can run two threads simultaneously and its clear Intel isnt going to win on outright performance although it has included Hyper-Threading support in the MinnowBoard for pseudo dual-core operation.
Cons
Compared to ARM equivalents its expensive, and its performance lags behind AMDs rival Gizmo device
12 www.linuxuser.co.uk
Intel MinnowBoard
REVIEW
A micro-SDIO slot plays host to a bundled SD card containing the Angstrm operating system A small heat sink passively cools the Intel Atom E650T processor
Bundled risers lift the board up in order to allow the processor room to cool
Technical specs
Angstrm Linux (Yocto Certied) 32-bit Intel Atom E640T single-core at 1GHz Embedded Intel GMA 600 1GB DDR2, 4MB SPI Flash (Firmware Storage) 106 x 115mm 119g (excluding PSU) DVI-over-HDMI, Analogue audio in & out, 2x USB, 1x SATA-2, 1x USB device, 1x Serial console, Gigabit Ethernet, 1x micro-SDIO Extras Lure connector with CAN bus, HD audio, LVDS, IC, 3x PCI Express, SATA-2, SDIO, SPI bus, 2x UART, 2x USB Power 5V at 2.5A
Four switches combine with two usercontrollable LEDs to get users started with the boards capabilities
Also consider
Treating the MinnowBoard as a standard computer, however, misses the point entirely. The device is designed for embedded development, and to help Intel regain a foothold in a market that has become almost completely dominated by ARM-based systems. Accordingly, it includes eight buffered general-purpose input-output pins, along with two user-controllable LEDs and a set of four switches. Together, these turn the MinnowBoard into a ready-to-run system for developing embedded applications and unlike with ARM-based devices, those used to an x86 toolchain dont have to learn anything new. The board also includes an expansion connector for addin daughterboards dubbed Lures. Designed to be analogous to the shields of the Arduino microcontroller, the port gives each Lure access to considerable potential: as well as three PCI Express lanes, an SDIO channel, two USB channels and more, the port carries everything from CAN to IC buses. Although there are no Lures available on the open market at the time of writing, several are in development including one which will offer compatibility with Arduino shields. That doesnt mean the main board is bereft of connectivity: a micro-SDIO slot for the boot device, two USB ports, analogue audio connections, Gigabit Ethernet, and mini- and micro-USB ports for acting as a USB device or as a debug serial console are included. The board also features a SATA-2 port, offering up to 3Gbps of throughput to a mass storage device with a second port available through the Lure expansion port if required.
At present, the MinnowBoard ships with a bare-bones installation of Angstrom Linux no friendly out-of-box experience here. With full Yocto Project certication, however, rolling your own OS isnt a challenge and Intel is in talks with distributions including Ubuntu to add support for the boards somewhat unique 32-bit UEFI rmware. Using documentation still in progress from the projects founders, the MinnowBoard is quick to offer up its GPIO capabilities. The only real disappointment comes from the HDMI socket, which only carries a DVI signal and not the audio required of a full HDMI implementation. Theres also no support for HDCP encryption, although anyone considering using the MinnowBoard as a media playback system has probably missed the point of its design and features. Gareth Halfacree
Sage Gizmo
$199 (154.29)
Based on an embedded AMD APU, its far more powerful than the MinnowBoard. Embedded graphics aid computer performance and a bundled expansion board makes getting started easy. It does, however, require more power under load. gizmosphere.org
Summary
The MinnowBoard is a welcome foray from Intel into the world of open hardware and offers considerable potential. While its performance may lag behind the rival Gizmo board, the Lure connector holds promise for some impressive add-ons to come but its high price means the Raspberry Pi has little to fear from this upstart.
Raspberry Pi
28.07
The Pis ARMv6 processor is considerably less capable than the MinnowBoards Atom but at almost a sixth the price, its easy to overlook this in favour of having spare cash for add-on hardware and tinkering components. raspberrypi.org
More information
minnowboard.org
13 www.linuxuser.co.uk
OpenSource
OPEN SCIENCE
nOpenBELs Ted Slater extols the virtues of Linux and collaborative development
advance science, and were happy to impart our knowledge of collaborative software development to leaders in the life sciences industry. Successful open source projects dont just host code; they make use of a full suite of open source best practices to quickly gain adoption and collaboration. We aim to help OpenBEL achieve even more success. The Linux Foundation hosts the largest collaborative project in the history of computing: Linux, stated Ted Slater, project
nOpenBEL provides a platform for the capture and collaborative analysis of life sciences data
All of us are smarter collectively than any one of us is by ourselves Ted Slater
14 www.linuxuser.co.uk
News
OPEN SOURCE
OPEN SOURCE
Linux calendar
Le Beffroi, Paris France openworldforum.org The rst European summit designed to bring together technical experts and political representatives, Open World Forum includes speakers ranging from Microsofts Frederic Aatz to the CIO of the French Culture and Communication Ministry.
OggCamp
LJMU Art & Design Academy, Liverpool England oggcamp.org The largest open source and free culture event in the UK enters its fth year. Based around the unconference format, there will be three uid tracks along with a series of scheduled speakers throughout the weekend.
nThe DevShare programme introduced by SourceForge owner Dice Holdings has drawn strong criticism
LinuxCon Europe
OPEN SOURCE
Edinburgh International Conference Centre Scotland events.linuxfoundation.org The largest event covering Linux in general rather than specic distributions comes to Scotland, with over a hundred planned sessions. Followed by the Linux Kernel Summit, Automotive Linux Summit and Embedded Linux Conference Europe, all in Edinburgh.
nThe X.Org Foundation is considering letting others take care of its paperwork in future
CloudOpen Europe
The Foundation is now considering joining an umbrella organisation in order to reduce the paperwork required of its members and prevent this sort of embarrassing situation from recurring.
Edinburgh International Conference Centre Scotland events.linuxfoundation.org The second annual CloudOpen conference looks to build on the success of the rst, helping push forward the use of open source technologies in cloud computing.
15 www.linuxuser.co.uk
OpenSource
GOVERNMENT
Valencia has long been at the forefront of open source adoption, having pushed a programme of Linux adoption in schools back in 2005. Covering 110,000 PCs installed across all regional schools, the move to Lliurex Linux is claimed to have saved over 30 million so far. Installation of the free ofce suite is part of the regional governments strategic commitment to its use of free software. It will not only help save costs for licences, Bells
added, but also boosts the development of the local ICT sector, promotes the use of Valencian in the digital world and improves interoperability and security of the administrations IT systems. The move has been lauded by the European Commissions JoinUp programme, which looks to improve interoperability between public administrations through standardisation, suggesting other governments may follow suit.
HARDWARE
ARM is pushing its technologies, including the mbed prototyping platform, as the future of IoT
frequently, these days, the low-cost and highperformance Raspberry Pi or its more exible alternative the BeagleBone Black while others use lower-cost microcontroller devices from Atmel, Texas Instruments and others.
16 www.linuxuser.co.uk
News
OPEN SOURCE
LINUX
VIDEOGAMES
n4A Games has ported Metro: Last Light to Linux, for launch later this year
We are very happy with the results, said 4As CTO Oles Shishkovstov. We hope that Mac and Linux gamers will appreciate our efforts to create the best possible version for their machines.
MALWARE
We do.
2ndQuadrants Platinum Production Support for PostgreSQL provides a guaranteed 15 minute (human) response, 4 hour workaround and guaranteed bug fix within 24 hours. 24 hours a day, 365 days a year. PostgreSQL is used worldwide for mission critical applications. Now you can choose this open source database, safe in the knowledge that if you ever need help, its less than 15 minutes away. With guaranteed fix times and access to leading Postgres experts. 2ndquadrant.com/support
PostgreSQL Development 24x7 Support Training Services 2ndQuadrant Ltd. 7200 The Quorum, North Side, Oxford Business Park, Oxford, OX4 2JZ, UNITED KINGDOM www.2ndquadrant.com TEL +44-870-766-7756
Opinion
OPEN SOURCE
Linux is increasingly being used for cutting-edge robotics opening up the eld to anyone interested in learning more
of commonly used robotics hardware such as cameras, accelerometers and communication devices are now both much cheaper and much smaller than they were ten years ago. Actually making use of electronic sensors, and motors, is also a lot easier now, as platforms like the Arduino make connecting electronic components to your computer, and controlling them, both quick and simple. On top of all this, small, powerful computers such as the Raspberry Pi and the BeagleBoard, to name but two, mean that you can now cram much more processing power into your robots at an affordable price. In order to put this hardware to good use, however, you need software, and as luck would have it, Linux is the platform where the most exciting developments in robotic software are taking place. Writing the software for modern robots can be one of the most involved and complicated parts of the process. Software is needed for controlling motors, reading values from sensors and, possibly most importantly, to provide high-level control and AI. A number of distributed software environments have been produced to try to ease the development of robotic software. But the Robot Operating System (ROS) produced by a company called Willow Garage in Silicon Valley is arguably one of the most successful. ROS is not actually an operating system, but rather a BSD-licensed open source software framework which runs on Linux. It allows interfaces to be dened for common bits of robotic software, such as the drivers for cameras and motors, and it allows this software to be run as a large number of separate processes called nodes either all on one machine, or transparently distributed over a network of machines. Over the last ve years, ROS has dramatically eased the process of writing robotic software. Now you can download a large number of precompiled packages to quickly allow you to hook up common sensors such as cameras or Microsofts Kinect. High-level services such as inverse kinematics, map building and speech recognition are easy to plug in, and ROS also provides a great selection of visualisation tools so that you can see whats going on from your robots point of view. When you need to write your own software, you can do it in the language you choose. Low-level motor drivers can be written in C and then communicate over ROSs network layer with high-level control processes, written in a language such as Python or Java. Not having access to robotic hardware is no bar to entry, as ROS also provides support for simulators such as Gazebo. ROS has been embraced by the robotics research community and so lots of simulations of cuttingedge robots are now provided by the teams who built them. So, for absolutely no cost at all, you can get access to Willow Garages PR2 robot, NASAs Robonaut and Boston Dynamics Atlas robot. This last robot is currently being used in the DARPA Robotics Challenge, which seeks to get a humanoid robot to drive a car and move around a disaster area, so its ambitious stuff. Now is an exciting time in robotics, and Linux is the platform on which some of the coolest stuff is happening. If you havent tried it yet, then I would urge you to download and have a play with ROS, start building yourself a robot and join in all the fun!
for a PhD at the Bristol Robotics Laboratory. He is also the managing director of Dawn Robotics Ltd www.dawnrobotics.co.uk
Robotics is a fascinating subject. It links computers to the physical world, allowing them to move around, sense their environment, and to interact with it. Building your own robot, however, has traditionally required that you spend a huge amount of time and energy to get even the most basic of robotic systems up and running. You need mechanical engineering skills to build the chassis or body, electronic engineering skills to wire up the motors and the sensors, and programming skills to animate the robot, to control its body to get it to do what you want. These barriers to entry mean that people entering into the eld of robotics either in search of a stimulating pastime, or perhaps as part of more formal research can quickly be overwhelmed by the sheer amount of work required. The initial dreams of building a robot to fetch your beer or to walk your dog get pushed further and further back, as more and more time is sucked up just getting the basics working. Things are changing, however, and the barriers to entry are falling. The relentless march of progress in consumer goods means that a lot
18 www.linuxuser.co.uk
OpenSource
Fair game
I play games. Ive always liked playing games, and suspect Ill continually sneak one or two in for the rest of my days. If you talk to my editor, hell obviously tell you that Im the most reliable hitter of a deadline that hes ever met and that my words arrive perfectly formed, requiring the barest of edits before theyre laid before your
20 www.linuxuser.co.uk
Opinion
OPEN SOURCE
A GPL breakthrough
Samsung is releasing the code for its exFAT le system driver for Linux under the terms of the GPL. This is an important breakthrough because of the participation of both Samsung and the GPL Compliance Project for Linux Developers
As we all know, the GPL makes a simple pact between the coder and the user. Anyone can take, modify, copy, share and redistribute the software and the code, but must pass on the same rights to subsequent users of the software, including any modications to the code. The coder, who is usually (but not always) the copyright holder, gains because enhancements to the code are fed back through the development process. The manufacturer gains because thirdparty developers become involved who may bring new dimensions to the code. The user gains because the code remains free and the obligation is mutual, meaning that every other user has the same obligation to feed their changes back. The only requirement of the GPL is that the source code be made accessible to end users, but this requirement is often ignored, especially when the code is reused in rmware and embedded devices. GPL code is used in thousands of devices, but many dont comply with the terms of the licence. The role of Software Freedom Conservancy is to alert manufacturers to failures in compliance and to help them to reach an amicable resolution. Most violations are resolved without court proceedings. In very rare cases this may involve litigation but as Jeremy Allison, a board member of Conservancy, observes: The point is not to punish people for making mistakes, but to bring them into compliance. When people get into trouble its usually down to laziness and inconvenience. Its usually a case of I cant be arsed, and its too much effort to do it right, so Ill just use it. The great majority of infringements are not deliberate, and can be attributed to misunderstandings and lack of attention to detail. Manufacturers of mobile devices operate in a rapidly changing environment with short product cycles and shorter time-to-market. The market for rmware and mobile devices is highly competitive, and every new product comes to market with a new range of features. Failure to comply with the GPL is usually inadvertent, but releasing the source code is a small price to pay when set aside the considerable advantages of cost-effectiveness, speed to market, and the accessibility of pre-written and tested code that free software offers, especially when it is remembered that it is only the GPLd code that has to be made available to others. Sharing the code is useful to everyone, but the terms of the GPL havent always been enforced because the coders have other things to do, or the copyright has been assigned to corporate entities who dont care about the licence beyond their immediate needs. For this reason it is an important development that signicant contributors to the Linux kernel, in the shape of Conservancys GPL Compliance Project for Linux Developers, have become involved in helping to ensure compliance with the terms of the licence, and that Samsung, a major manufacturer, was not only a willing and amicable partner in releasing the code, but was happy to talk publicly about the matter, which may make it easier to achieve compliance from other manufacturers in the future. The drawback, in this instance, is that exFAT is owned by Microsoft, is a proprietary le format and has patent issues. The exFAT driver code can only be deployed by manufacturers or distributions that have obtained a licence from Microsoft.
art, music, digital rights, Linux and free software for a variety of publications
Non-profit FOSS organisation The Software Freedom Conservancy has reached an amicable agreement with Samsung to release the code for Samsungs exFAT file system driver for Linux under the terms of the GPL. The exFAT driver code came to light through its inadvertent release via GitHub (lwn.net/Articles/560424/) and the use of a binary version in a Samsung Linux-based tablet. The Software Freedom Conservancy, led by Bradley Kuhn, works with developers and manufacturers to ensure compliance with the GPL. The greater part of the job is to point out the legal obligation to manufacturers and to help them achieve compliance, and most will happily comply.
Sharing the code is useful to everyone, but the terms of the GPL havent always been enforced
21 www.linuxuser.co.uk
OpenSource
JON MASTERS
Linus Torvalds announced the latest release candidate of the 3.11 Linux for Workgroups kernel on the 22nd anniversary of his original Hello everybody email first introducing Linux back in 1991. The last few weeks have been largely quiet in terms of changes merged into the mainline kernel, typical both of late summer and of the late stages in a kernel release cycle. It would seem that temporary xes for the ongoing Windows 8 ACPI compatibility issues which cause display backlights (now managed directly by certain Windows graphics drivers, rather than in the ACPI rmware) to misbehave on some laptops will sufce for this release, but will be
NUMA development
Linux Weekly News recently noted that there can often seem to be themes to given periods of kernel development, and that this past month has had somewhat of a memory management theme. This certainly seems to be the case. But even more specically, this months theme would seem to actually be that of NUMA (NonUniform Memory Access) development. NUMA is all about dealing with the reality that as SMP (symmetric multiprocessing, the kind used in
your computer to provide many CPU cores for the operating system) scales, it does not necessarily do so in a linear fashion. The truth is that certain memory DIMM banks are closer to certain CPU cores. In an SMP system, every CPU can access every memory location in the system, which is typically coherent, meaning that the underlying hardware takes care of ensuring that memory locations cached internally by other CPUs are updated when a different CPU updates that same memory. But accessing a given memory location can be more expensive in terms of latency if it is not local to a given processor ie if the underlying hardware must take more steps to reach a given location by routing access to that location through an inter-processor local bus. To an application (and a user) this manifests in terms of slower performance than could be achieved if the memory for an application were strictly local to a given processor. Linux handles NUMA in various ways. To a certain extent it can provide a level of transparent support, by migrating memory for applications to be closer to the processors that are using it (copying the underlying memory locations to other locations more local to a given processor and updating the virtual memory translation tables accordingly), but special tools have been written to allow administrators to be more specic about how a given application should manage its memory. Mel Gorman, famous for writing the denitive book on Linux memory management, has been working on NUMA scalability problems recently, and both he and
22 www.linuxuser.co.uk
Opinion
OPEN SOURCE
Ongoing development
Beyond memory management, Srinvas Pandruvada (Intel) posted an initial RFC (Request for Comments) patch the rst stage in developing a new idea into code series that implemented an in-kernel power capping framework. The basic idea is to allow a given system (platform) to specify how much power is available and for a precise cap to be enforced across a variety of CPU and non-CPU devices installed within the system. Using this mechanism, it is hoped to provide certain limits (such as the amount of power that can be delivered by a battery, or power utility, or the amount of power available if a battery is intended to last for a certain time period, and so on) and for devices to provide various performance tradeoffs within those constraints. But by providing an overall framework, it is possible for the kernel to make whole-system decisions that are not isolated to a given subsystem or to a given device in isolation. Initial comments on the power capping framework were favourable, although Greg Kroah-Hartman (now of the Linux Foundation) suggested that he wanted to see actual users of the framework before it is merged by which he meant that he really wanted to see Intel post code for its own CPUs and platforms to make use of this framework. This seems to be in progress, since comments on the mailing list implied that such patches exist and have been reviewed by at least a subset of developers to this point. It will be interesting to see where this development leads, especially in the mobile space, and also when applied to other architectures.
Beyond NUMA and virtual memory, development has included an initial implementation of UEFI boot stub support for 32-bit ARM systems (which previously used a less standard embedded bootloader called U-Boot), a patch to allow perprocess control of transparent huge pages, a x for PCIe reinitialisation when performing a kernel crash dump (and kexec into a kernel that must not have outstanding DMA operations pending on boot), and optimisations from Andi Kleen for the kernel build system known as kbuild. Andis patches convert the kallsyms stage of kernel compilation into a single-pass, rather than being the multi-stage process that has been the case. This is the point during kernel compilation at which all of the symbols (function names provided by the kernel for internal and modular use) are resolved during the nal linking of the kernel image. Andi has a series of cute hacks proposed for dramatically speeding up the process. In this months kernel announcements, Ted Tso reminded everyone that the 2013 Linux Kernel Summit is coming up in Edinburgh next month, and that there will be places reserved for those who are strictly hobbyist developers. This seems to have been a late decision since the deadline for submissions came and went quickly, but it will be worth keeping an eye on this next year, in case such an invitation is repeated. Beyond the Kernel Summit, there will be a number of kernel and nonkernel developers present at the Linux Plumbers Conference in New Orleans, at which several other mini-conferences will run concurrently. These include an ACPI/Power Management gathering, a PCI mini-conference and this years Linux Security Summit, among many others.
23 www.linuxuser.co.uk
Feature
Android Studio
Android Studio
Get your head around the early access preview of the next stage in Android development
nnounced earlier this year at Google I/O, Android Studio will be the replacement for the current Android development solution in Eclipse. This Eclipse setup is part of the Android Developer Tools, and takes advantage of the IDEs Java-based development environment and plug-in support to currently create the development portion of Android apps. With the rest of the SDK, virtual devices can be created and used to test code before deployment onto real devices. The Android Studio aims to be an all-in-one solution for development and testing. Coming with the entire SDK, and not even requiring traditional compiling or installation on Linux, Android Studio is an incredible easy and quick way to get straight into coding your apps whether youre an experienced Android/Java dev working directly in code, or a novice looking to use the graphical, drag-and-drop approach to app creation. Android Studio is still currently in beta as a free early preview well cover some of the current quirks with the software. However, its a denitely a great way to get used to using the software before the nal switchover occurs. Well also cover how you can export from Eclipse if youve already been using that, and how to then distribute your app once its nally complete.
24 www.linuxuser.co.uk
Android Studio
FEATURE
25 www.linuxuser.co.uk
Feature
Android Studio
New Project Start a new project by going through the handy Android new project wizard, selecting API levels and setting the icon Recent Projects The recent projects view allows you to go straight into any project you wish to work on without having to look in the Open Project prompt
Android Studio has its own update manager, allowing you to keep it up to date. It will notify you when a newer version is available
Docs and How-Tos Some tips and how-tos for IntelliJ, the base of Android Studio, are available straight from the welcome screen
Installation
01
Download
Head over to the Android Developers website and grab yourself a copy of the early access preview to Android Studio from here: bit.ly/1bWrFXz Youll need to then extract the contents put it in a folder you have easy access to, as you need to run the Studio from the folder.
02
the folder you just created, specically the First run android-studio/bin/ directory. To launch If this is your rst time using Android Android Studio, enter into the terminal: Studio, you can safely ignore the prompt to import any settings. Otherwise, nd the $ ./studio.sh If it asks about your Java settings, for le you created from before, or your old now press Enter, as we can x that later if it installation folder, to get previous settings. We can import from Eclipse later on. becomes a problem.
03
26 www.linuxuser.co.uk
Android Studio
FEATURE
Key features
Development views
As the Java for the Android apps is split into visual and function elements, you can use a visual WYSIWIG editor for the XML code, allowing you to place buttons and text and other UI elements wherever you want on the screen. The text part is a full IDE, with code navigation, debugging, syntax highlighting and a smart code analyser that warns you of any obvious issues with what youve written.
Helpful shortcuts
Android Studio has handy, configurable keyboard shortcuts. Heres a list of the most common to get you started
Command look-up (autocomplete command name)
Ctrl
+
Alt
Shift
Project quick x
Enter
Reformat code
Ctrl
+
Ctrl
Alt
+
Q P
Virtual devices
Test your apps on a virtual device that you dene, either by using settings for the main Nexus devices, or by using generic settings for differentsized Android phones or tablets. You can edit the system settings to limit or increase RAM, and even allow it to use the system GPU if you need it to. Its not perfect, but its a great way to quickly test functionality.
+ + +
Generate method
Insert
+ +
F4
Jump to source
Delete line
Ctrl Ctrl
+ +
Y Alt
+
Eclipse migration
For existing Android developers, its easy to migrate from Eclipse and the ADT to Android Studio. The tools are already in place to export the necessary les from Eclipse, and Android Studio includes a handy feature that allows you to then import them, and any other Studio le. This is helpful now and will be essential when it replaces Eclipse.
Shift
Build
Debugging
A specic debugger can analyse the code as it runs and give you a full rundown of whats happening when, allowing you to go through the logs and gure out any possible issues, or work out where problems are already occurring. You can pause the program at any point to isolate issues, instead of having to search through code as it continues to run.
+ + +
F9 F10 1
27 www.linuxuser.co.uk
Feature
Android Studio
FAQ
Since Android Studio is still under some development, there are some bugs that still need to be ironed out. Here are a couple of known issues with Android Studio that you can work around. 1) Error: Gradle project refresh failed Android Studio has a newer version of Gradle that has some backward compatibility issues. These can be xed by rst clicking the link to search build.gradle from the error dialog. From there, doubleclick the line under the build.gradle usage, opening the project build.gradle le. Edit the classpath to change the gradle version to 0.5.+. Finally, save the le and rebuild your project. 2) Error: Failed to import Gradle project This can be a problem after upgrading Android Studio, as the project les may point towards an SDK element that no longer exists. To x this, youll need to quickly install the Android Support Repository. First, open Android SDK Manager, nd and expand Extras, and install Android Support Repository.
01
From the Welcome screen, click on Create New Project to open up the dialog window. Name the project HelloWorld well be creating the code for that shortly. Leave all the other default settings they relate to what versions of Android will be able to use the app.
02
Set image
Here you can set your image, giving you a nice preview of how it will look on different types of devices. You can set padding, background colour and more to your app icon. For now, click Next, as we dont need an icon for the sample project.
03
Activity selector
For now, well just use the blank activity. When making other apps, this activity selector can help you choose how the app with behave such as being full-screen or having a multi-column ow to view several items.
04
Activity name
Here you can name the activity and customise the way it works, with tabs, dropdown menus and other actions. For now, well leave this as is. Hit Finish and the project will be built. It may take a little while to do this.
Migration
Its quite easy to export existing projects from Eclipse and then import them into Android Studio. First of all, make sure your ADT plug-in is up to date, then select File and Export. Open Android from there and select Generate Gradle les, then your projects to export before clicking Finish. In the basic Android Studio window, click on Import project, nd the build.gradle le and then press OK at the pop-up. You should then be able to start development on the project within Android Studio.
05
Project structure
Android Studio will create a lot of les for what will be a simple app luckily we just need to pay attention to MainActivity.java and Main_Activity.xml for the moment. The interface is also initially set up to allow for WYSIWYG visual development.
06
Views
The default view is the visual development interface it includes elements down the side that allow you to drag and drop functionality. You can also click the Text tab at the bottom to get straight into the Java code, with a live preview updating as you type.
28 www.linuxuser.co.uk
Android Studio
FEATURE
A view to develop
The two views for Android Studio serve different purposes and people. The default visual view allows you to drag and drop functions onto the interface, with guidelines to make sure you keep them aligned with other UI elements. This then adds the elements to the code, so you can edit them further in there. The text view works like any good IDE, with a hierarchical view of code, code navigation tools, autocomplete and, of course, proper syntax highlighting. Whichever view you use is up to you however, you will ultimately have more control with the text view.
Layouts & widgets Drag and drop different layouts and functions to create your app visually a great way for novices to get started
Live preview See a live preview of the way your app will look, even while using the text mode
Toolbar Quick access to preview and debugging tools, along with the ability to change the theme, activity type and the device preview
Component tree Even in the visual view, you can break down the code in the individual components to see how they work
Useful resources
There are plenty of online resources you can use to help you with your development whether you need to gure out a more elegant method to create a specic function, or need to wrestle with some bugs. Heres a list of some of the places you should visit. Android Developer Site developer.android.com As well as the place to get Android Studio, the Developer site has regular posts on interesting projects, updates to the SDK, and some troubleshooting tips. Stack Overow stackoverow.com One of the best places on the internet to get advice on an issue either by searching for a related question or submitting your own. IntelliJ IDEA Support intellij-support.jetbrains.com/home Support for IntelliJ IDEA, the base for Android Studio. Some of the support questions may be more suited to the IntelliJ side of things. XDA Developers www.xda-developers.com/ A community built around smartphone development, the XDA forum is a good way to nd out about Android-specic tips and tools, and even to promote your application.
29 www.linuxuser.co.uk
Feature
Android Studio
01
Visually
To do it visually, simply select Plain TextView, and place it on the display. Doubleclick it and type in Hello World!. All static text can be placed this way onto the interface, and it will create the necessary code in the text view as well.
02
Relative text
04 05
Quit button
The relative layout should be included in the code by default. Create a text parameter by opening up triangle brackets with:
<TextView
which we will use to display Hello World.
The le were editing now is just the display. To do something, we need to start editing the .java le. While were still in the .xml, place a button and give it the caption Quit. Open up MainActivity.java from the Projects column before we continue.
06
Coded actions
Button button = (Button) findViewById(R.id.button) button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); System.exit(0); } });
03
Hello code
Imported
android:layout_width=wrap_content
Code listing
Package name The name of your package according to the Android system
import functions Import the various functions we need to get the code to work on an Android device MainActivity class The MainActivity class includes all the functions in our main activity that we created Main layout This sets what the main layout, and displays it Quit button The section containing the code to make sure our button (with id button) properly quits the app with System.exit Settings menu This creates the Android settings menu that appears at the top of the app
package com.linuxuser .helloworld; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); System.exit(0); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
30 www.linuxuser.co.uk
Android Studio
FEATURE
Create a virtual Android device to test and debug your Android apps, choosing from a selection of generic phones and tablets
Physical buttons Theres a range of physical buttons you can use that work on certain devices, with power and volume working on all
Android buttons Software buttons are included on the virtual device, as they are part of modern Android
Hardware specs Edit specic hardware variables to better emulate certain aspects of a device, or give it more power via your host system
01
From the Project View, nd the Android Virtual Device (AVD) manager icon along the top and click it. From here you can create and edit a range of devices for testing your apps on. Click on New so that we can get started.
02
New device
In the pop-up dialog, name the virtual device, select the device you wish to emulate and then the target API level. Some devices will have a minimum Android version target. Your can edit this later, but for our app we wont need to change any other settings.
03
Virtual reality
Click OK and Android Studio will conrm the options youre using. Press Start while the device is selected and choose whether you want to get a pixel-accurate screen, or a scaled version. It will then boot up a virtual phone or tablet you can test on.
Debugging
Android Studio includes tools to debug the apps you create. To use them, rst make sure a device is running to emulate the app. Then, click the Debug button in the shape of a green bug and the le will rebuild and launch on the device. This time, though, it will bring up a full logging window, a console and a debugger with full tools to gure out where problems may be occurring in your apps.
31 www.linuxuser.co.uk
YES I would like to subscribe to Linux User & Developer YOUR DETAILS
First name
SUBSCRIPTION VOUCHER
Country
Please complete your email address to receive news and special offers from us
Instructions to your Bank or Building Society Please pay Imagine Publishing Limited Direct Debits from the account detailed in this instruction subject to the safeguards assured by the Direct Debit guarantee. I understand that this instruction may remain with Imagine Publishing Limited and, if so, details will be passed on electronically to my Bank/Building Society Signature(s)
Bank/Building Society account number Date Banks and Building Societies may not accept Direct Debit instructions for some types of account A6 instruction form
PAYMENT DETAILS
MasterCard
Amex
Expiry date
Maestro
Please tick if you do not wish to receive any promotional material from Imagine Publishing Ltd by post by telephone via email Please tick if you do not wish to receive any promotional material from other companies by post by telephone Please tick if you DO wish to receive such information via email Terms & Conditions apply. We publish 13 issues a year, your subscription will start from the next available issue unless otherwise indicated. Direct Debit guarantee details available on request. This offer expires without notice. I would like my subscription to start from issue:
OR H DEUR R RY N OW
Subscribe today and get your first three issues for 5 (and save 13.00)
Pay only 4.19 for every future issue a 30% saving on the store price Free UK delivery to your door Never miss an issue Money-back guarantee
Terms & Conditions
This offer entitles new UK direct debit subscribers to receive their rst three issues for 5. After these issues, subscribers will then pay 25.15 every six issues. Subscribers can cancel this subscription at any time. New subscriptions will start from the next available issue. Offer code PGG134Q must be quoted to receive this special subscription price. Details of the Direct Debit guarantee are available on request. Offer expires 31 March 2014. Imagine Publishing reserves the right to limit this type of offer to one per household. Source Code PGG134Q Web address: www.imaginesubs.co.uk/lud. Tel: 0844 249 0282
5
Readers in the US see page 84 for exclusive offer
Get your first 3 issues for just 5, then save 30% on the shop price
THREE EASY WAYS TO SUBSCRIBE 3.Post or email 1.Online
www.imaginesubs.co.uk/lud And enter PGG134Q
Please complete and post the form to Linux User & Developer Subscriptions Department 800 Guillat Avenue Kent Science Park Sittingbourne ME9 8GU
Or alternatively, you can scan and email the form to
2.Telephone
And quote PGG134Q
lud@servicehelpline.co.uk
Tutorial
phpMyAdmin offers a web-based front-end for the creation and maintenance of MySQL databases
Data entry is carried out via an easy-to-use form in Base, the front end to our database
All of the actual database design (elds, form layout etc) is carried out from within Base
You import and export data to and from LibreOfce Base by using Calc, the spreadsheet module. This enables access to most common data formats
Create a database that combines an easy-to-use, form-based front-end using LibreOfce with a portable, networked MySQL back-end
Advisor
writer, and hes been hacking away at Linux for over 15 years. He specialises in desktop Linux solutions
Resources
Were going to show you how to put together a typical database for small business use: a database of customer details. It will be possible to both export and import contact data from in standard formats by making use of Calc, LibreOfces spreadsheet module. Well use Gmail contacts as our source, but you can use any software that can export CSV les and pretty much everything can. Weve added a few twists to keep things interesting. This project uses the Base module of LibreOfce as the front-end, and this provides a GUI for setting up the database, creating the
forms for data entry and the actual business of entering data. For the back-end, we will be using the industry-standard MySQL. This allows us to locate the back-end on a central server. This, in turn, allows multiple users to access the database. For initial creation of the MySQL database, well use phpMyAdmin thanks to its friendly web interface, although the actual database design will be carried out from within Base. By the end of the project, you will have a GUI system for browsing and editing the database with a portable, networked back-end.
34 www.linuxuser.co.uk
01
Install LibreOfce
At time of writing, the major Linux distributions havent moved over to LibreOfce 4 and are still offering 3.x. This means that you may have to install LibreOfce 4 manually. Visit the LibreOfce website (www.libreofce.org) and follow the instructions. On Ubuntu, this consists of unpacking the archive and running sudo dpkg -i *.deb on the contents.
04 05
Install the MySQL Server Type sudo apt-get install mysql-server to begin installation. Before long, you
should be prompted to set a root MySQL password. Note that this isnt the same as the administrator account of your system, which is also called root. Choose a password and make a note of it.
Install and test phpMyAdmin Type sudo apt-get install phpmyadmin to begin installation. When
06
Create database
prompted to choose a web server, choose Apache2, select it with the space bar and press Return. When requested, give it the MySQL root password and then choose a password for phpMyAdmin and make a note of it. Navigating to http://localhost/phpmyadmin/ should take you to a functioning login page. Log in using the MySQL root username and password. Well use MySQL to set up and maintain the actual database, although well create the elds from within LibreOfce later on.
Within the phpMyAdmin web interface, select the Databases tab. Now create a new database by entering the name customer into the text box and clicking on Create. This database will contain our customer data.
02
Well install Apache early on and with its own command because some of the other packages need to be able to congure a working Apache installation. Carry out the installation with sudo apt-get install apache2. Test it by navigating a web browser to http://localhost.
07
We now need to tell LibreOfce where to nd the JDBC class le. Start LibreOfce and go to LibreOfce>Options>Advanced. In the Java Options section, select Class Path and then Add Archive. The le you need is located at: /usr/share/java/mysql-connector-java.jar. Select it and restart LibreOfce.
03
Connectivity between Base and MySQL makes use of a Java class. Type sudo apt-get install default-jdk to install the Java runtime. Type sudo apt-get install libmysql-java to install the needed additional Java classes.
35 www.linuxuser.co.uk
Tutorial
08
We now need to connect our frontend (LibreOfce) to the back-end (MySQL) of our database. Start LibreOfce and launch the Base module. In the dialog that pops up, select Connect to an existing database. From the dropdown menu below this, select MySQL as the database type.
12 10
Save the database
You can accept the defaults on the next page, so click on Finish. When prompted, give the database a name and save it. Remember that this le contains the connection information for access to our MySQL database it doesnt contain the actual records.
Select Forms from the sidebar. Click on Use Wizard to Create Form in the Tasks window. In the table wizard, click on the >> symbol to copy across all of the elds in the database.
13 09
Congure Base
On the next page, select Connect using JDBC. On the next page, click on Test class to ensure that the Java RT is working. Now enter the name of the database that we created, customer, and enter localhost into the Server eld. On the next page, add Root as the username and tick Password required. Now click on the Test connection button and enter the root MySQL password, when asked for it, to test the connection between LibreOfce and the local MySQL server. Presuming that this completes without errors, click on Next.
Finalise form
11
You may want to create a custom set of elds for your customer records, but to save time were going to use the one of the templates that is built into Base. Select Tables from the side menu and then Use Wizard to Create Table. Using the Sample tables pull-down menu, select Customers. Use the >> button to copy all of them across. On the next page, you can tweak the elds that you have included and add new ones. Select the defaults on the next two pages and then click on Finish.
Accept the defaults in sections 2, 3 and 4, but select the rst arrangement icon in section 5, Arrange controls. You should now see a preview of our entry form in the main window. Select defaults on the other sections and then click on Finish.
Remember that this file contains 14 Test data entry the connection information for access to our MySQL database it doesnt contain the actual records
36 www.linuxuser.co.uk
To enter data into the database, use the form that we created. Select Forms in the sidebar and then double-click on the name of the form in the main window. This brings up the GUI recordediting interface. The form can still be tweaked and edited by right-clicking on its name in the main window.
18
The eld names from our imported data dont quite match those of the database and so we need to use the second page of the wizard to line them up. To do so, click on a eld name and use the up and down icons in the other list to create the correct attachments. Then click on Create.
19 15
Export your contacts from Gmail
Switch from the Gmail contacts view using the pull-down menu in the top-left corner, underneath the Gmail logo. From here, click on the More icon pull-down menu and select Export Click on Export.
17
To access the database from more than one machine, you must create additional users. Log back into phpMyAdmin, click on the Users tab and select Add user. From here, create a new user with the name and password of your choosing and make a note of it. Click on Check all in the Global privileges section.
16
Start a new spreadsheet and open the CSV le that you exported from Gmail. Use Ctrl-mousewheel zooming to get an overview. Typically, a lot of the elds will be completely blank, so select these columns (click on the column letter at the top of the window) and remove them (Edit>Delete cells). We have to create a key for each record. Label a column ID. Select the rst cell in the column and then select the nal cell by Shift-clicking on it. Use the ll feature (Edit>Fill>Series).
When youve cleaned up the spreadsheet, select the data (including the column headers) by clicking on the top-left cell and then Shiftclicking on the bottom-right cell. Right-click and select Copy. Select Tables from the side menu of the Base module. From here, right-click on the customers table and click on Paste. This should bring up the import wizard. Select Append data and Use rst line as column names options, and click on Next.
20
In the Base module, re-save the database under a new name. In this new version of the le, we have to alter a few details. Select Edit>Database>Properties and enter the name of the new database user. Click on the Additional Settings tab and enter the IP address of the machine with the MySQL database.
37 www.linuxuser.co.uk
Tutorial
The toolbar gives you shortcuts for items like lists, images, tables and maths formulae
You can always see what the actual LaTeX source code looks like for your document. Nothing is hidden from you in LyX
The main window is where you type your text. This is also where your text gets rendered
You can view what your document will look like by rendering it to a PDF le. Dont forget to refresh it after making edits
LyX lets you to get your document written without having to deal with LaTeXs steep learning curve. Heres how
Advisor
man, he splits his time between building furniture, helping researchers with scientic computing problems and writing Android apps. When the kids let him have some time, that is
Resources
LaTeX is a typesetting system that gives you full control over how everything in your document is rendered. The problem is its really steep learning curve. One option is to use a basic text editor and learn all the markup you need for your document. The other option is to use an application that wraps the markup to some degree. LyX does this very nicely. While a fully WYSIWYG editor for LaTeX doesnt make sense (since your doc isnt fully rendered until sent to an output device), LyX does provide a pseudo-WYSIWYG interface where you can see how different regions will be rendered.
In this tutorial, youll learn how to create a new document and create various content sections, like images, tables and lists. You will also learn how to use various document settings, like the document class, to control the overall options used during document rendering. Since LaTeX is a typesetting system, LyX will let you output to several formats, like PDF, Postscript, HTML, plain text and OpenDocument les. Regardless of whether you are writing a book, a journal article or a set of presentation slides, LyX will help you get your work done with minimal fuss.
38 www.linuxuser.co.uk
01
Installation
The rst step is to get LyX installed on your system. Most distributions should have a package available. For your non-Linux friends, there are binaries available for Windows, Mac OS X, and even OS/2 and Haiku. As always, you can download the source code and build from scratch in the worst-case scenario.
04 02
Text layout
While the document class sets the defaults for your document, you still have full control to change anything in the document. The Text Layout option lets you change the indentation size to a custom increment. The vertical spacing and line spacing can also be customised. You also have the option to make your document two-column here.
06 07
Documents are broken down into several nested subregions. How these regions are handled in the layout is decided by the document class. You can also set whether these regions are numbered or not, and whether they show up in the generated table of contents.
View source
When you rst start up LyX, the main window opens up with a splash screen image displayed. You actually have to tell LyX that you want to start a new document before you can start writing. You can start a new document by clicking the menu item File>New.
05
Page layout
LaTeX gures out the actual rendering of your document based on a page layout. You can select one of a number of standard page formats, or set a custom page size. You can set whether the page is oriented as either portrait or landscape mode.
Now that your document is set up, you can start typing. LyX gives you a pseudoWYSISYG display of the text. But LaTeX is a purely text-based markup language, so you can always see the actual source code to verify what LyX is putting into your document. To see the source, just click on the menu item View>View Source.
03
Many of the layout properties for your document are set to defaults based on the class of your document. You can set this by clicking the menu item Document>Settings. This will pop up a dialog window that well use for the next few steps. The drop-down list will give you a very full list of possible document classes.
39 www.linuxuser.co.uk
Tutorial
Many of the layout properties for your document are set to defaults based on the class of your document
12 08
Title
The rst item your document will need is a title. In LaTeX, you need to worry about what a particular piece of text is supposed to be, not what it will look like. So at this stage, you can type in your title text. To identify it as a title, you can click the drop-down at the top right of the toolbar and select Title.
Sections
10
Dates
You should have noticed that there is a date option in the drop-down. You dont need to use this if you dont wish to. LyX will automatically add the current date when you actually render the document into an output format.
In most documents, you will probably want to break the text down into sections, and possibly subsections. Sections are dened by giving them a title. For instance, if your rst section is going to be an introduction, then you would type the section title as Introduction and set the type in the drop-down to Section. The actual text for this section would be set to the type Standard.
11
Abstracts
If you are writing an article, or a report, you may need to include an abstract of the subject matter being covered. If you have already written your abstract, you can highlight the region with your mouse and select Abstract from the dropdown. This adds the title Abstract and changes the format of the text.
13
Mathematical formulae
09
Author
Hitting Enter will give you a new line, with the type back to Standard. You can here enter your name and set the type to Author, again with the drop-down at the top right of the toolbar. Where and how this will get rendered depends on the document class and the output format.
Mathematical formulae are always a problem area in document typesetting. Many people in the sciences rst move to LaTeX because of the ability to fully control equations by explicitly laying out all of the elements. However, for more complex equations, this can still be confusing. Therefore LyX provides an equation writer tools that helps you create the LaTeX required to lay out your formula in your document. You can set the type of maths to be either inline with your text, or to be centred and displayed on its own.
40 www.linuxuser.co.uk
14
Lists
There are several different types of lists available for your use. Both numbered and unnumbered lists are available as buttons on the main toolbar. To start a list, click on one of the buttons and start typing the rst item. Hitting the Enter key will give you a new item to enter. Hitting Enter on an empty item will drop you out of the list section.
15
Tables
You can add a table by clicking on the menu item Insert>Table. A dialog will appear where you can set the number of rows and columns. The rst row is set aside as a header for the columns, but you can change this in the LaTeX source.
(pdatex)]. There are also other viewing options, in case you want to render your document using other methods.
provided by your LaTeX installation. This is dened in the Document Settings dialog, where you can set the family, encoding and fonts to use for Roman, Sans Serif and Typewriter.
16
Images
Clicking on the menu item Insert>Graphics opens a dialog window where you can select an image le to insert into your document. You can either set a scaling factor, or an explicit width and height for its display. You can also rotate your image through X degrees. You also have the option to control if and how the image gets clipped to a bounding box.
20 18
Spellchecking
Most people need help when it comes to making sure everything is spelled correctly. If you want to use the system default spellchecking engine, you can simply click on the menu item Tools>Spellchecker. You can change the engine being used by selecting it in the options window.
Output formats
Now that you have your document nished, you will want to render it to some nal output format. A common choice is either PostScript or PDF. This way, you know that it will look the same, regardless of who you give it to. But you have several other options available, too. You can output to HTML, rich text, plain text or even OpenDocument.
17
Previewing
Now that you have a bunch of content in your document, you probably want to get an idea of what it will look like once it is fully rendered. You can get LyX to generate a PDF for viewing by clicking the menu item View>View [PDF
19
Fonts
Linux users have had problems, traditionally, when dealing with fonts. This extends to applications like LaTeX. LyX includes options that help you correctly set up TrueType fonts, allowing you to use fonts other than those
41 www.linuxuser.co.uk
Tutorial
Unison synchronises les between computers here were using the commandline version of the tool
This line indicates that Unison has nothing to sync at the moment, since no les have changed
This error message shows that there is a lock le that needs to be manually removed
Learn how to use the Unison command-line tool to synchronise les between computers quickly and reliably
Advisor
system administration and programming experience and has been using Linux since 1993. He is also procient in Oracle database administration, Cisco IOS, Cocoa and iOS programming. He always learns new things
Resources
Unison is an open source file synchronisation tool for both text and binary files. It also has a GUI, but here were focusing on the only the command-line version because its quicker and gets the job done cleanly. Unison really shows its capabilities when you are working with more than one computer and you need synchronisation across all of them. Benjamin C Pierce led the creation of Unison at the University of Pennsylvania and it started life as a research project. It can be used through the
SSH service and works equally well on both UNIX (Linux, Mac OS X etc) and Windows machines. It should be apparent that Unison was inspired by the rsync utility. Unison differs from rsync in that the latter is a mirroring tool that needs to know in advance where the willing-to-keep versions of the les are, whereas Unison is a synchronisation tool that identies the les that have been changed since the last sync process and decides the way that the changes are going to be propagated. In short, its smart.
42 www.linuxuser.co.uk
01
Installing Unison
Most Linux distributions have Unison as a package ready for installation so that you do not have to compile it. At the time of writing, the current stable version of Unison is 2.40.102. Note that every machine that is part of the synchronisation process must have a copy of the command-line version of Unison installed. Additionally, this copy of Unison should be located inside one of the directories of the default PATH shell variable. Assuming youre on a Debianbased system, simply type:
having a prole le does not prevent you from adding extra command-line options (although this article will not deal much with such options). In the rare event that you have troubles working with Unison, you may run it using the -debug all command-line option so that you can better trace and resolve errors.
and is located inside the ~/.unison directory. The following two lines to work on the same machine, as they do not include a remote machine:
04
Given a prole name called articles.prf that is located inside the ~/.unison directory, you can tell Unison to use it by executing the following command:
$ unison articles
The remote machine declaration starts with root = ssh://. There are rare occasions usually when the user changed a le on both computers before synchronising where Unison will not be able to determine whether a le or directory has changed on the local or the remote server. In such situations, Unison kindly asks for your help so that it will not mistakenly proceed using the wrong version.
unison -version
03
02
Unison can run from the command line without using any conguration les (proles), but using a prole greatly simplies its use
Although Unison was initially developed with synchronising les located on different machines in mind, you can synchronise les located on the same computer using one of the following two methods: Using localhost as the remote machine name. Using only local directory paths for both root = lines. Your advisor prefers the second way as it does not require the SSH server be up and running. The Unison prole le is called localFiles.prf
43 www.linuxuser.co.uk
Tutorial
07
Most of the Unison housekeeping happens inside the .unison directory which resides in the users home directory. Unison keeps the following data there: Its prole les including the default prole called default.prf. Its backup les, if you decided to have central backups. The status le for each used prole. The Unison log le, should you tell it to keep one. You can put it anywhere you want but it is very convenient for it to reside there. Unison creates lock les there, during synchronisations, which it deletes when nished. Note: It is not recommended to synchronise the whole .unison directory. Synchronising just the proles is okay.
08 05
Running Unison using a simple prole le
Some basic things you need to know about Unison proles are: The default backup level is 2, which controls how many previous versions of each le are kept not including the current version of the le. So the default backup level keeps two backup copies of a le. The parameter for setting the backup level is called maxbackups. You can tell Unison not to keep le backups by not adding any backup options inside a Unison prole le. Unison prole les support Unicode characters. The logle option tells Unison to keep a log le called unison.log inside the .unison directory. Sometimes, network problems prohibit le synchronisation, but Unisons error messages are denoting the problem: computer) that are going to participate in the syncing process as well as the directories that are considered the root directories for each machine. After those important declarations, the actual directories that are going to be synced are listed. In this example we have just one directory (one path = line). Its full path is /Users/mtsouk/docs/ article/working for the local machine and /home/ mtsouk/docs/article/working for the machine called linode (an IP alias inside /etc/hosts). You can have as many path entries as you want. All les are synced except the ones that match the ignore option. You can also have as many ignore = lines as you want and can use regular expressions in them. The backup option tells Unison to keep backups of all les.
root = /Users/mtsouk root = ssh://linode//home/mtsouk times = true batch = true # Log file logfile = /Users/mtsouk/.unison/ unison.log # Paths to synchronize path = code/C # Backup files backup = Name * backuplocation = central maxbackups = 3 ignore = Name {Thumbs.db} ignore = Name {.DS_Store} ignore = Path {Samples.lnk}
$ unison articles Contacting server... Connection closed by 109.xxx.yyy.zzz Fatal error: Lost connection with the server
06
Lines starting with a # denote comments and are not processed any further. Exactly two lines must start with root =. They declare the machines (one is always the local
44 www.linuxuser.co.uk
3. Copy the contents of the ~/.ssh/id_rsa.pub le from your local server into the le ~/.ssh/authorized_keys found on the remote server. One way of doing it is by executing the following command:
12
09
Explaining the advanced prole le The times = true line tells Unison to
10
synchronise modication times. The maxbackups = 3 line tells Unison to keep the current le version plus three backups of it. The backup = Name * line tells Unison to back up every le. The backuplocation = central, which is the default option, tells Unison to keep all backups in a central location. If neither the backupdir preference nor the environment variable UNISONBACKUPDIR are set, the .unison/backup directory is used as the backup location. If set to local, then all backups will be kept in the same directory as the original les. The batch = true option is a little tricky and you should be careful with it as Unison will ask no questions at all and non-conicting changes will be propagated whereas conicts will be skipped. Nevertheless, it is an essential option if you want to use Unison as a cron job. The ignore = Name {.DS_Store} line tells Unison to not synchronise les that end with .DS_Store.
$ ssh linode Linux (none) 3.9.3-x86_64-linode33 #1 SMP Mon May 20 10:22:57 EDT 2013 x86_64 . . . Last login: Wed Jul 31 18:46:23 2013 from ppp-94-64-21-97.home.otenet.gr mtsouk@li140-253:~$
The rst time you log into the remote server without typing your password, the following informative message will be on the screen:
The rst two or three times you use a new prole, double-check if everything works as expected. You do not need to use every parameter that Unison supports, just the ones that will do your job! You can troubleshoot Unison using the -debug all command-line option. It will generate lots of output useful for debugging. The more you use Unison, the more you will understand its practicality. You should be very careful with your backup options, especially maxbackups, as it can take up too much space on your computer. You can use Unison to securely exchange les between computers. If a Windows machine is involved in the synchronisation process, be careful with le and directory permissions. For non-critical data les you may run Unison once a day, but for critical data you should run it more often. Unison cannot replace regular backups! When you are making a new prole, either start simple or use an existing one as a starting template. Add the extra functionality and features while making sure that you always have a working prole.
11
The single most time-saving thing you can do is to set up SSH so that you will not need to enter your password each time you want to synchronise your les and directories. The procedure is easy and involves the following three steps: 1. Run ssh-keygen -t rsa You will have to enter a passphrase twice, so please do remember the passphrase! Two new les are going to be created: ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. 2. You may need to create a directory called .ssh on the remote server if it does not already exist.
There are times when things do not work as expected. Unison offers you many options that can help you both nd and solve problems. The rst option to try is the -testserver option that just connects to the remote server and then exits without synchronising any les. The second thing to do is run the following command:
$ ssh $PATH'
remote.machine.domain
'echo
The aforementioned command let you see whether the PATH is the same as when you log in using ssh remote.machine.domain. If the problem is with the PATH, check if the option PermitUserEnvironment in /etc/ssh/ sshd_cong is set to no and change it to yes.
45 www.linuxuser.co.uk
Tutorial
This isnt a hardware hack a spare SD card can be used for the Tor router, and other SD cards can be used for different functions without any problems
Using not much more than a Raspberry Pi, you can route one or more systems through a Tor-enabled access point, guaranteeing anonymity
Hook into the internet just about anywhere theres an internet connection a relatives house, hotel rooms and more
Turn your Raspberry Pi into a highly secure and very portable router to keep your system safe and your browsing anonymous, wherever you are
Advisor
complex systems and is a web developer proficient in Python, Django and PHP. He loves to experiment with computing
Connect everything over a wireless network no need to directly connect to the Pi with a cable
Resources
We showed you in issue 129 how to turn your Raspberry Pi into the ultimate portable wireless router, requiring very little power and giving you a wireless network wherever theres the most basic of internet connections. What if its not enough to know you can search the web, though? What if you want to be wholly secure as you do it? Then its time to upgrade the router with Tor to protect your privacy on the internet. This Onion Pi, as dubbed by Adafruit, combines Raspbian and
Tor to create and secure a wireless access point using just a Raspberry Pi. This project is fairly straightforward: after setting up the wireless access point, we install Tor and do some basic setup tasks so that it routes trafc properly, and securely. This will keep you anonymous online a handy feature in a time of privacy concerns all around the web. When the Pi is not connected to the internet, it should still function as a wireless router, allowing at the very least a wireless LAN in your location.
46 www.linuxuser.co.uk
06
Set up DHCP
Now we need to congure the DHCP server. Edit the conguration le with:
07
Server address
01
Install Raspbian
Raspbian is the Raspberry Pi distro well be using for the Onion Pi. Download the zip le, extract the image and then apply it to an SD card using:
04
SSH connection
Plug your USB wireless adapter into the Pi and turn it back on. On another computer connected to the same network, open a terminal or type into the command line:
subnet 192.168.42.0 netmask 255.255.255.0 { range 192.168.42.10 192.168.42.50; option broadcast-address 192.168.42.255; option routers 192.168.42.1; default-lease-time 600; max-lease-time 7200; option domain-name "local"; option domain-name-servers 8.8.8.8, 8.8.4.4; }
Save and exit.
02
Set up Raspbian
Go through the initial Raspbian setup and make sure to turn on the SSH server, and to disable autoboot to desktop this is unnecessary and will only use extra power. You can also tell it to ll up the rest of the card if theres room for it.
05
Install DHCP
03
Pi IP
To make life easier for any system connecting to the Pi access point, we need to install a DHCP server to it. We do this with:
Well be accessing your Raspberry Pi via SSH to set it up. To do this we need to know its IP address you can nd it by typing ifconfig into the command line. Make a note of it and turn off your Pi.
08
DHCP server
Edit the server conguration les so that its set to work in conjunction with the wireless adaptor:
INTERFACES="wlan0"
47 www.linuxuser.co.uk
Tutorial
09
Incoming Wi-Fi
We need to set up the Wi-Fi adaptor to be both static and accept incoming signals. First:
14
Network addressing
net.ipv4.ip_forward=1
Save this, and then nish by running:
10
Static IP
Now give the wireless interface a static IP after the line allow-hotplug wlan0, enter the following:
12
WLAN conguration interface=wlan0 driver=rtl871xdrv ssid=[access point name] hw_mode=g channel=1 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=[password] wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP Hostapd
15
IP tables
Run the following three commands to make sure the internet connection is forwarded correctly:
13
After saving and exiting, we need to edit hostapd to point it to this new le. Open it with:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
16
Apply conguration
So that this still works after a reboot, type:
11
WLAN creation
We need to create a new le that holds all the information for our wireless network. We are going to make it password protected so that only the people we want to can access it. To create the le, start with:
DAEMON_CONF="/etc/hostapd/hostapd. conf"
$ sudo conf
nano
/etc/hostapd/hostapd.
48 www.linuxuser.co.uk
17
Wi-Fi nal
sudo service hostapd start sudo service isc-dhcp-server start sudo update-rc.d hostapd enable sudo update-rc.d isc-dhcp-server enable
And the wireless access point part will be nished.
18
Install Tor
19
Tor congure
Put this below the FAQ comment:
Log notice file /var/log/tor/ notices.log VirtualAddrNetwork 10.192.0.0/10 AutomapHostsSuffixes .onion,.exit AutomapHostsOnResolve 1 TransPort 9040 TransListenAddress 192.168.42.1 DNSPort 53 DNSListenAddress 192.168.42.1
23
Logging
We should create a log le in case you need to debug later. To do this, use these three commands:
21
Reroute
Route all DNS trafc rst, using:
$ sudo touch /var/log/tor/notices. log $ sudo chown debian-tor /var/log/ tor/notices.log $ sudo chmod 644 /var/log/tor/ notices.log
You can also check it with:
$ sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040
$ ls -l /var/log/tor
24
Finally, we can activate the Tor service so that we can start using the access point securely with:
20
Table ush
We now need to ush the current IP tables so that we can get the routing to go through Tor. First of all, do:
22
49 www.linuxuser.co.uk
If it wasnt open source, if it wasnt GPL, there wouldnt be the 20,000 plug-ins that have been written for it
51
With ten years under its belt, WordPress has firmly cemented its place in the hearts of bloggers. But what next for its co-founder Mike Little? David Crookes finds out
being made where you get someone just lming what they are doing and there are lots of ums and ahs and backtracking. My screencasts wont be like that and people will certainly get value for money. Little, who also teaches WordPress to classes face-to-face, continues to work with WordPress for professional clients too. After all, if he cannot produce a killer website for companies and organisations using the software, then nobody can. It is tting, then, that he has worked with Downing Street on government sites. He appears most proud of a science-engagement site for children called Im A Scientist, Get Me Out Of Here, which has spun off into Im An Engineer. I really enjoy doing these, he says, explaining that his entire freelance
52 www.linuxuser.co.uk
career has been based around WordPress since he left full-time employment in 2008. WordPress has, therefore, shaped his life. In between mouthfuls, he tells us all about the WordPress project, barely pausing for breath, and there is little doubt that he is proud of the part he played in the initial years of WordPresss inception. If there was any doubt, then the snazzy WordPress T-shirt hes wearing at our meeting certainly puts paid to that.
66%
Little has been programming professionally since 1990. His rst six years were spent at an industrial software house called Pantek in Stockport, where he became responsible for a team of six and developed Visual Basic apps, learned C++ and gained experience in DOS, Windows SDK, assembler, Novell, TCP/IP and Microsoft networks. After leaving Pantek, he went on to work at various other software companies in the Greater Manchester area, but he was also an early blogger. He used software called b2/cafelog which had been written by Michel Valdrighi, the rst Corsican blogger. A small community had built up around the software with around 2,000 active users on the forum, but development of b2/ cafelog suddenly ground to a halt when Valdrighi disappeared, leaving behind an app that had a few bugs, a couple of security issues and a
Before WordPress
domain that was up for renewal. Another programmer, Matt Mullenweg, also used b2/ cafelog, or, as it was more commonly known, b2, and he was concerned not only about Valdrighis disappearance but also about the lack of development of b2. He posted an article on his blog called The Blogging Software Dilemma which discussed how he had come to be using b2, primarily because it was the best of the bunch and something he was able to develop. Mike Little spotted this blog post and responded, asking Mullenweg if he would be interested in forking b2. Mullenweg said he would. The pair then got together, albeit remotely over the internet. Id communicated with Matt a couple of times before because he had a website with a really good gallery on it and Id emailed him to ask him about the software, recalls Little. Id actually communicated with him on the b2 forums as well, but I didnt know he was the same person as the one who ran the gallery site. So when I saw his blog post about b2, I was interested. As it turned out, I was the only person who responded to his posting at the time.
Version one
That first release of WordPress had a couple of extra features Id already created for b2
Mullenweg and Little took the b2 software and began to work on it, xing bugs and adding extra features. Then Valdrighi reappeared. He
53 www.linuxuser.co.uk
declared Mullenweg and Littles software as the ofcial successor to b2. It turns out hed been made redundant or something like that, had to give up his at, gone back to his parents who didnt even have internet and so on, smiles Little. So it was just the real world was much more important than a bit of software. WordPress was thus born. It was January 2003. Little had been learning PHP and he felt he would work his way around b2 and make alterations. No software is perfect, so it was just a case of thinking of things that we wanted to add to it, says Little. That rst release of WordPress had a couple of extra features that Id already created for b2 and the same for Matt: hed had a couple of extra features that hed added to b2. Wed shared these things on the forums and we kind of incorporated those into the core project. And yeah, we just took it from there. One of the biggest changes was the introduction of Pages, which made a massive difference to WordPress and set it apart from its rivals at the time. It enabled WordPress to become more than blogging software. But the
TAKING INSPIRATION
WordPress was not created in isolation. Although Little and Mullenweg worked on their own, with the expanse of the Atlantic ocean separating them, they did look at other blogging software being created at the time and they took inspiration from it. There was denitely a lot of studying of rivals and playing catch-up, seeing what other people were doing, Little says. For a very long time there was a lot of blogging software and certainly you would see Blogger or Moveable Type with features that were cool and that we thought we might add to WordPress. Eventually it started going the other way round as well and these other apps were copying features that had been added to WordPress.
killer feature, Little says, came in the guise of hooks. It meant you could write additions to the product without having to modify the code, and that was something that only really big grown-up software did, like some of the Java Stacks, says Little. This ability to actually change the way it behaves and add things to it without having to touch any of the core les was crucial. Its still the hardest thing, I think, for new developers to get their heads round how it works, but I think thats what made it so much easier. He said it made the process of updating the software so much easier. Prior to that, with anything like Drupal or any of those tools, whenever there was an update you were in danger of losing your changes because youd modied original les to call your stuff or to add somebody elses stuff in. Youd stick these function calls in there. It meant that as soon as you got the new version, if you just literally FTPed the new one over the top of the old one, you were going to lose your stuff and lose your modications. So I think that was probably one of the key features and I dont think its necessarily something that people appreciate because these days they just never see the problem. They update WordPress or they update the plug-ins and oh, its the new version, and nothings gone wrong. And yet before then you had to save those les you modied before you updated to the new software. Mullenweg and Little continued to work on WordPress and the rst release came in May of that year.
User-friendliness
18.9%
The percentage of the 10 million websites in the world that run WordPress
Little and Mullenweg saw WordPress as an evolving product. Little worked on doing what he could to eliminate the ability to make mistakes, which he believes was a crucial step forward. With the original b2, you could lose your settings, he says. But with WordPress, I added the cong sample PHP and it just took that ability to make a mistake away. I took what was the original b2 settings le and created an Options interface for it. It was another le, you didnt have to ddle with it - you didnt have to know how to edit these les and FTP them back up to your server and stuff like that. I think all those bits helped make it easier, made it harder to cock up and I think that all helped. The need to be userfriendly was at the forefront of the minds of both developers. It was also important for them that WordPress, like b2, was an open source project. They loved that b2 operated under a General Public License, which meant they had the freedom to take the code, change it and distribute it to other people. They loved that it was free too. Ive always been a huge open source advocate, says Little. Matt was kind of new to the open source idea, but that was one of the reasons behind him choosing to use b2. Little attributes the popularity of WordPress to its open source nature (if it wasnt open source, if it wasnt GPL, there wouldnt be the 20,000 plug-ins that have been written for it or the 10,000 themes, he says) and it matters not to him that he has not made any direct money from WordPress. Nobody does, he says. Its
If it wasnt open source, if it wasnt GPL, there wouldnt be the 20,000 plug-ins that have been written for it
54 www.linuxuser.co.uk
n The original posting, The Blogging Software Dilemma, on Mat Mullenwegs website and Mike Littles response
not sold and yes, I continued in my day job. Matt went [to work] for CNET, which had just started using WordPress for just a couple of things, and they actually had him doing a standard software development job. But they paid for him to work one day a week on WordPress itself and I think it was through working there that he met a guy called Tony Schneider, who had just sold some software to Yahoo! for 25m or something like. Matt had started Automattic at this point. Schneider later managed to help raise funding for him and joined the service that eventually became WordPress.com. But me, I continued in my day job up until 2008.
Carrying on
The number of page views of WordPress websites from April 2012 to April 2013
4 billion
Little considered becoming part of WordPress.com, which is a blog web hosting service provider owned by Automattic, but this was prior to the funding and the company couldnt afford to pay him a wage. Today it is nancially supported via paid upgrades, VIP services and advertising and can pay wages, but in the early days there wasnt much cash for this and the bulk of the fundraising efforts went on infrastructure.
Up until the rst release, the development team consisted of just Mullenweg and Little, but ve people were working on the project by the end of 2003 and it continued to grow after that. By the end of 2005, Little wasnt able to stay involved. I had issues at home, real-life issues which meant that I couldnt spend the time working on this thing voluntarily, he says. It was still a very techy thing, a very geek thing, it wasnt as good and as user-friendly as it has become today and it certainly wasnt as prominent. Cash, he insists, is something that does not motivate him, however. I need to pay the bills and we need to eat, he says. I am the breadwinner of the house and I always have been, but I just wish I could put that side of things in place and do what interests me from that point on. Theres no doubting my passion for open source computing. Indeed, he has read up on the philosophy behind the General Public License and he has devoured Richard Stallmans story of how he created the free software movement. I not only found it very inspiring, he says, it just seemed
the morally right thing to do, for me. The fact is that, at the time, in the 1970s and 1980s, software companies were effectively creating articial scarcity, based on intellectual ideas that were almost free to reproduce. Back then rms were making oppy disks and putting them in boxes and getting manuals printed and they were charging 500 or 600 for a product that had just 30 or 40 worth of materials. As things moved on, it got easier and easier to distribute software online where the distribution costs and the reproduction costs approach zero, so to then charge articial amounts on top of that just seemed like the wrong thing to do. He hopes that future generations go down the same path and release open source software. But rst, he says, I think it is crucial that we just get kids learning how to code. There are some good moves in that direction and I love what is being done with the Raspberry Pi. Suddenly, a school cant say it cannot afford to buy lots of computers to experiment with. These are costing 25 each. Its a great time to be in computing and I feel its good to be putting back in and helping people learn. Mike Littles new website is at mikelittle.org but he also runs his company site, zed1.com.
55 www.linuxuser.co.uk
Tutorial
Congure launcher
Python is the worlds most popular easy-to-use open source language. Learn how to use it to build your own features for XBMC, the worlds favourite FOSS media centre
Advisor
a solid community behind it. It supports almost all major platforms, including different hardware architectures. It is available for Linux, Windows, Mac OS X, Android, iOS and Raspberry Pi. In these pages we will learn to build extensions for XBMC. Extensions are a way of adding features to XBMC without having to learn the core of XBMC or alter that core in any way. One additional advantage is that XBMC uses Python as its scripting language, and this can be also used to build the extensions. This really helps new developers get involved in the project since Python is easy to learn compared to languages like C/C++ (from which the core of XBMC is made). XBMC supports various types of extensions (or Add-ons): Plugins, Programs and Skins. Plugins add features to XBMC. Depending on the type of feature, a plug-in will appear in the relevant media section of XBMC. For example, a YouTube plug-in would appear in the Videos section. Scripts/Programs are like mini-applications for XBMC. They appear in the Programs section. Skins are important since XBMC is a completely customisable application you can change the look and feel of just about every facet of the package. Depending upon which category your extension ts, you will have to create the extension directory accordingly. For example Plug-ins: plugin.audio.ludaudi: An audio plug-in plugin.video.ludvidi: A video plug-in script.xxx.xxx: A program In this tutorial we will build an XBMC plug-in called LUD Entertainer. This plug-in will provide a nice way to watch videos from Reddit from within XBMC. Our plug-in will show various content such as trailers and documentaries from Reddit. Well also allow our users to add their own Subreddit. Each video can then be categorised as Hot, New, Top, Controversial etc. With this plug-in we will demonstrate how easy it is hook into XBMCs built-in method to achieve a very high-quality user experience. Due to space limitations, we arent able to print the full code here. You are highly recommended to explore the cover disc to access the complete code, which has many other amazing functions.
Resources
56 www.linuxuser.co.uk
01
As we have mentioned previously, each XBMC extension type follows a certain directory naming convention. In this case we are building a video plug-in, so the plug-in directory name would be plugin.video.ludlent. But thats just the root directory name we will need several other folders and les as well. The following describes the directory structure of LUD Linux Entertainer: plugin.video.ludent Root Plugin directory |-- addon.xml |-- changelog.txt |-- default.py |-- icon.png |-- LICENSE.txt |-- README `-- resources |-- lib `-- settings.xml
version="2.1.0"/> <import addon="plugin.video. youtube" version="3.0.0"/> <import addon="plugin.video.vimeo" version="2.3.0"/> <import addon="plugin.video. dailymotion_com" version="1.0.0"/> </requires>
In the above code we have added a dependency to a library called xbmc.python version 2.1. Currently it is added as a mandatory dependency. To make the dependency optional you will need to add optional="true"; eg <import addon="kunal.special"
05
Metadata about the plug-in is provided in <extension point="xbmc.addon.metadata">. The following are the important elements <platform>: Most of the time, XBMC extensions are cross-platform compatible. However, if you depend on the native platform library that is only available on certain platforms then you will need to set the supported platforms here. Accepted values for the platform are: all, linux, osx, osx32, osx64, ios (Apple iOS) , windx (Windows DirectX), wingl (Windows OpenGL) and android. <summary lang="en">: This gives a brief description of the plug-in. Our example sets the language attribute as English, but you can use other languages too. <description>: A detailed description of the plug-in. <website>: Webpage where the plug-in is hosted. <source>: Source code repository URL. If you are hosting your plug-in on GitHub, you can mention the repository URL here. <forum>: Discussion forum URL for your plug-in. <email>: Author email. You can directly type email or use a bot-friendly email address like max at domain dot com.
02
Creating addon.xml
An addon.xml le needs to be created in the root of the extension directory. The addon.xml le contains the primary metadata from a XBMC extension. It contains overview, credits, version information and dependencies information about the extension. The root element of addon.xml is the <addon> element. It is dened as:
06
<addon id="plugin.video. ludent" name="LUD HSW Viewer" version="0.0.1" providername="LUDK"> rest of the content is placed here </addon>
Here, id is the identier for the plug-in, so it should be unique among all the XBMC extensions, and id is also used for the directory name; version tells XBMC the extension version number, which helps in its ability to deliver automatic updates XBMC follows the Major.Minor.Patch versioning convention; name is the English title of the plug-in. Note: Steps 3 to 5 cover entries that need to be added within the addon.xml le.
We need a few additional les in the plug-in directory changelog.txt: You should list the changes made to your plug-in between releases. The changelog is visible from the XBMC UI. An example changelog: 0.0.1 - Initial Release 0.0.2 - Fixed Video Buffering Issue icon.png: This will represent the plug-in in the XBMC UI. It needs to be a non-transparent PNG le of size 256x256. fanart.jpg (optional): The fanart.jpg is rendered in the background if a user selects the plug-in in XBMC. The art needs to be rendered in HDTV formats, so its size can range from 1280x720 (720p) up to the maximum 1920x1080 (1080p).
04
Our extension is supposed to provide the video content for XBMC. In order to convey that, we have to set up the following element:
03
57 www.linuxuser.co.uk
Tutorial
License.txt: This le contains the licence of the distributed plug-in. The XBMC project recommends the use of the Creative Commons Attribution-ShareAlike 3.0 licence for skins, and GPL 2.0 for add-ons. However, most of the copyleft licences can be used. Note: For the purpose of packaging, extensions/ add-ons/themes/plug-ins are the same.
The following are a few important settings types that you can use text: Used for basic string inputs. ipaddress: Used to collect internet addresses. number: Allows you enter a number. XBMC will also provide an on-screen numeric keyboard for the input. slider: This provides an elegant way to collect integer, oat and percentage values. You can get the slider setting in the following format:
resource/language/english/string.xml example:
07
Settings can be provided by the le resources/settings.xml. These are great for usercongurable options. Partial: resources/settings.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <strings> <string id="30001">Add subreddit</ string> <string id="30002">Hot</string> <string id="30003">New</string> <string id="30004">Top</string> <string id="30005">Controversial</ string> <string id="30006">Hour</string> <string id="30007">Day</string> <string id="30008">Week</string> <string id="30009">Month</string> <string id="30010">Year</string> </strings>
As you may have seen in the settings.xml example, all the labels are referring to string ids. You can have many other languages as well. Depending upon the language XBMC is running in, the correct language le will be loaded automatically. Post XBMC Frodo (12.1), strings.xml will be deprecated. Post Frodo, XBMC will be moved to a GNU gettext-based translation system; gettext uses PO les. You can use a tool called xbmc-xml2po to convert strings.xml into equivalent PO les.
<settings> <category label="30109"> <setting id="filter" type="bool" label="30101" default="false"/> <setting type="sep" /> <setting id="showAll" type="bool" label="30106" default="false"/> <setting id="showUnwatched" type="bool" label="30107" default="true"/> <setting id="showUnfinished" type="bool" label="30108" default="false"/> <setting type="sep" /> <setting id="forceViewMode" type="bool" label="30102" default="true"/> <setting id="viewMode" type="number" label="30103" default="504"/> </category> <category label="30110"> <setting id="cat_hot" type="bool" label="30002" default="true"/> <setting id="cat_new" type="bool" label="30003" default="true"/> </category> </settings>
Here, label denes the language id string which will then be used to display the label. id denes the name which will be used for programmatic access. type denes the data type you want to collect; it also affects the UI which will be displayed for the element. default denes the default value for the setting. You should always use a default value wherever possible to provide a better user experience.
09
Building default.py
08
Language support
Language support is provided in the form of the strings.xml le located in resources/languages/[language name]. This approach is very similar to many large software projects, including Android, where static strings are never used.
Since our plug-in is small, it will all be contained inside default.py. If you are developing a more complex add-on then you can create supporting les in the same directory. If your library depends upon third-party libraries, you have two ways to go about it. You can either place the third-party libraries into the resources/lib folder; or bundle the library itself into a plug-in, then add that plug-in as the dependency in the addon.xml le. Our plug-in works with reddit.tv. This is the website from Reddit which contains trending videos shared by its readers. Videos posted on Reddit are actually sourced from YouTube, Vimeo and Dailymotion. We will be starting default.py with the following imports:
58 www.linuxuser.co.uk
idFile 1 2 3 4 5
idPath 1 2 2 2 2
playCount 1 1 1 1
lastPlayed 2013-08-06 23:47 2013-08-07 22:42 2013-08-08 00:09 2013-08-08 00:55 2013-08-08 00:58
dateAdded
12
The above table is an example of a les table. addSubreddit(): Our plug-in allows users to add their own Subreddit. This function takes the Subreddit input from the user, then saves it in the subreddits le inside the addon data folder. The following sets the subreddits le location:
In this step we will look at some of the important helper functions. getDbPath(): This returns the location of the SQLite database le for videos. XBMC stores library and playback information in SQLite DB les. There are separate databases for videos and music, located inside the .xbmc/userdata/ Database folder. We are concerned with the videos DB. It is prexed with MyVideos
10
Initialising
During the initialisation process, we will be reading various settings from settings.xml. Settings can be read in the following way:
def getDbPath(): path = xbmc. translatePath("special://userdata/ Database") files = os.listdir(path) latest = "" for file in files: if file[:8] == MyVideos and file[-3:] == .db: if file > latest: latest = file return os.path.join(path, latest)
getPlayCount(url): Once we have the database location, we can get the play count using a simple SQL query. The MyVideo database contains a table called les, which keeps a record of all the video les played in XBMC by lename. In this case it will be URL.
subredditsFile = xbmc. translatePath("special://profile/ addon_data/"+addonID+"/subreddits") this translates into .xbmc/userdata/ addon_data/plugin.video.ludent/ subreddits def addSubreddit(): keyboard = xbmc.Keyboard(, translation(30001)) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): subreddit = keyboard. getText() fh = open(subredditsFile, a) fh.write(subreddit+\n) fh.close()
This function also demonstrates how to take a text input from the user. Here we are calling the Keyboard function with a text title. Once it detects the keyboard, it writes the input in the subreddits le with a newline character. getYoutubeUrl(id): When we locate a YouTube URL to play, we pass it on to the YouTube plug-in (plugin.video.youtube) to handle the playback. To do so, we need to call it in a certain format
pluginhandle = int(sys.argv[1]) urlMain = "http://www.reddit.com" userAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0" opener = urllib2.build_opener() opener.addheaders = [(User-Agent, userAgent)]
11
dbPath = getDbPath() conn = sqlite3.connect(dbPath) c = conn.cursor() def getPlayCount(url): c.execute(SELECT playCount FROM files WHERE strFilename=?, [url]) result = c.fetchone() if result: result = result[0] if result: return int(result) return 0 return -1
As mentioned, XBMC uses strings.xml to serve up the text. In order to read those strings, you will need to use getLocalizedString.
59 www.linuxuser.co.uk
Tutorial
On the same lines, we can build a function to place links as well Similarly for Vimeo:
def addLink(name, url, mode, iconimage, description, date): u = sys.argv[0]+"?url="+urllib. quote_plus(url)+"&mode="+str(mode) ok = True liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage) liz.setInfo(type="Video", infoLabels={"Title": name, "Plot": description, "Aired": date}) liz.setProperty(IsPlayable, true) ok = xbmcplugin. addDirectoryItem(handle=int(sys. argv[1]), url=u, listitem=liz) return ok
Based on the abstractions we have just created, we can create the base functions which will populate the content. But before we do that, lets rst understand how Reddit works. Most of the Reddit content lters are provided through something called Subreddits. This allows you to view discussions related to a particular topic. In our plug-in we are interested in showing videos; we also want to show trailers, documentaries etc. We access these using Subreddits. For example, for trailers it would be reddit.com/r/ trailers. For domains we can use /domain; for example, to get all the YouTube videos posted on Reddit, we will call reddit.com/domain/ youtube.com. Now you may ask what is the guarantee that this Subreddit will only list videos? The answer is that it may not. For that reason we scrape the site ourselves to nd videos. More on this in the next step. The rst base function well dene is index(). This is called when the user starts the plug-in.
if spl[i]: subreddit = spl[i] entries. append(subreddit) entries.sort() for entry in entries: if entry in defaultEntries: addDir(entry.title(), "r/"+entry, listSorting, "") else: addDirR(entry.title(), "r/"+entry, listSorting, "") addDir("[ Vimeo.com ]", "domain/vimeo.com", listSorting, "") addDir("[ Youtu.be ]", "domain/ youtu.be", listSorting, "") addDir("[ Youtube.com ]", "domain/youtube.com", listSorting, "") addDir("[ Dailymotion.com ]", "domain/dailymotion.com", listSorting, "") addDir("[B]"+translation(30001)+" -[/B]", "", addSubreddit, "") xbmcplugin. endOfDirectory(pluginhandle)
Here, the penultimate entry makes a call to addSubreddit. listSorting takes care of sorting out the data based on criteria such as Hot, New etc. It also calls in Reddits JSON function, which returns nice easy-to-parse JSON data. We have created a settings entry for all the sorting criteria. Based on what is set, we go ahead and build out the sorted list.
13
xbmcplugin contains various routines for handling the content listing inside the plug-ins UI. The rst step is to create directory entries which can be selected from the XBMC UI. For this we will use a function called xbmcplugin.addDirectoryItem. For our convenience we will be abstracting addDirectoryItem to suit it to our purpose, so that we can set name, URL, mode, icon image and type easily.
def addDir(name, url, mode, iconimage, type=""): u = sys.argv[0]+"?url="+urllib. quote_plus(url)+"&mode="+str(mode)+" &type="+str(type) ok = True liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage) liz.setInfo(type="Video", infoLabels={"Title": name}) ok = xbmcplugin. addDirectoryItem(handle=int(sys. argv[1]), url=u, listitem=liz, isFolder=True) return ok
def index(): defaultEntries = ["videos", "trailers", "documentaries", "music"] entries = defaultEntries[:] if os.path. exists(subredditsFile): fh = open(subredditsFile, r) content = fh.read() fh.close() spl = content.split(\n) for i in range(0, len(spl), 1):
def listSorting(subreddit): if cat_hot: addDir(translation(30002), urlMain+"/"+subreddit+"/hot/. json?limit=100", listVideos, "") if cat_new: addDir(translation(30003), urlMain+"/"+subreddit+"/new/. json?limit=100", listVideos, "") if cat_top_d: addDir(translation(30004)+": "+translation(30007), urlMain+"/"+subreddit+"/ top/.json?limit=100&t=day", listVideos, "") xbmcplugin. endOfDirectory(pluginhandle)
60 www.linuxuser.co.uk
def listVideos(url): currentUrl = url xbmcplugin.setContent(pluginhandle, "episodes") content = opener .open(url).read() spl = content.split("content") for i in range(1, len(spl), 1): entry = spl[i] try: .+?)" , re.DOTALL).findall(entry) match = re.compile("title": "( title = match[0].replace("&" , "&") , re.DOTALL). .+?)" match = re.compile("description": "( findall(entry) description = match[0] match = re.compile("created_utc": ( .+?), , re.DOTALL).findall(entry) downs = int(match[0].replace("}" , "")) rating = int(ups*100/(ups+downs)) if filter and (ups+downs) > filterVoteThreshold and rating < filterRating: continue title = title+" ("+str(rating)+"%)" match = re.compile("num_comments": ( .+?), , re.DOTALL). findall(entry) comments = match[0] description = dateTime+" | "+str(ups+downs)+" votes: "+str(rating)+"% Up | "+comments+" comments\n"+description match = re.compile("thumbnail_url": "( .+?)" , re.DOTALL). findall(entry) thumb = match[0] matchYoutube = re.compile("url": "http://www.youtube.com/ watch\\?v=( .+?)" , re.DOTALL).findall(entry) matchVimeo = re.compile("url": "http://vimeo.com/( .+?)" , re.DOTALL).findall(entry) url = "" if matchYoutube: url = getYoutubeUrl(matchYoutube[0]) elif matchVimeo: url = getVimeoUrl(matchVimeo[0].replace("#" , "")) if url: addLink(title, url, playVideo , thumb, description, date) except: pass match = re.compile("after": "( .+?)" , re.DOTALL).findall(entry) xbmcplugin.endOfDirectory(pluginhandle) if forceViewMode: xbmc.executebuiltin(Container .SetViewMode(+viewMode+))
In the code listed to the left here, we are opening the URL, then based on regular expression matches we are discovering the location title, description, date, ups, downs and rating. We are also locating video thumbnails and then passing them on to XBMC. Later in the code, we also try to match the URL to a video provider. With our plug-in we are supporting YouTube, Vimeo and Dailymotion. If this is detected successfully, we call the helper functions to locate the XBMC plugin based playback URL. During this whole parsing process, if any exception is raised, the whole loop is ignored and the next JSON item is parsed.
15
You can install the add-on using one of the following two methods: You can copy the plug-in directory to .xbmc/addons. You can install the plug-in from the zip le. To do so, compress the add-on folder into a zip le using the command:
14
At this point we have the URL in hand, which returns JSON data; now we need to extract the data out of it which will make sense to us. By looking at the JSON data, you can see theres a lot of interesting information present here. For example, url is set to youtube.com/watch?v=n4rTztvVx8E; title is set to The Counselor Ofcial Trailer. There also many other bits of data that we will use, such as ups, downs, num_comments, thumbnail_url and so on. In order to lter out the data that we need, we will use regular expressions. There is one more thing to note: since we are not presenting directories any more but are ready to place content, we have to set the xbmcplugin.setContent to episodes mode.
61 www.linuxuser.co.uk
Tutorial
All the examples presented in this article are tested for Vim version 7.3.547 on Ubuntu 13.04
Just type :help and Vim displays some valuable info for newbies, such as navigation keys and keyboard shortcuts to enable the mouse in xterm or GUI etc
Type :help iccf and Vim displays information (including weblinks) related to donations for the needy in Uganda as well as for the development of the Vim editor
Himanshu Arora is a
Vim: www.vim.org/download.php
Resources
Thanks to a steep learning curve, many people either avoid using Vim or use it on a very basic level. If youre guilty of either of these then youre really missing out. Vim, rst released in November 1991, is a command-line-based text editor that was developed by Bram Moolenaar as an improved Vi clone for Amiga platform. Besides including all the features of the popular Vi editor, it also contains a lot of new features and so derives its name from Vi improved. As well as being a text editor, Vim can be used as an integrated development environment by software programmers. Vim provides a wide range of features, but as it is a command-line utility it has a steep learning curve. Please note that Vim is not a word processor, which means that you cannot do layout-related changes with it. While you will get to know about the real strengths of the Vim editor once you master it,
on the whole some of the prominent pros include fast text editing (because of little to almost no use of the mouse) and easy execution from anywhere on the command line. There are also many GUI front-ends (like gVim) available for Vim. Although it is command-line based, Vim has a loyal following and is extensively used by system administrators and software programmers. Though it is hard to learn and understand all the features that Vim provides, in order to reap its real benets it is essential to master Vim for your dayto-day work. Through this article you will learn how to work with multiple les, how to indent and fold code, how to search and replace keywords, how to split the Vim window horizontally/vertically, and many other related features provided by Vim. Note: This article assumes that you have some basic knowledge (opening, editing, saving and closing a le) of the Vim editor.
62 www.linuxuser.co.uk
01
03
Work with multiple les
05
While most regular users use Vim to edit one le at a time, it can also be used to edit multiple les in parallel. To open multiple les with the Vim editor, just provide names of all these les as arguments to the vim command. The rst le is displayed by default. Type :n to switch to the next le, :prev (or :N) to switch to previous le, :bf to switch to rst le, :bl to switch to last le and :bw to close the le.
To get the list of les currently opened in the Vim editor, just type :ls. This will display list of opened les along with other information like the current line number of the cursor in a le, le in current active window (represented by %a), le in previous active window (represented by #) etc. Switch between current and previous active windows by typing :b#.
02
04
Sometimes it is required to open a new or an existing le while editing an already opened set of les. Well, this can be done by typing :e followed by the lename (along with a complete path if its not located in the current working directory).
Vim also supports wildcard characters (like *, ? etc) while opening multiple les at a time. This is especially useful in cases where multiple log les begin with a common set of characters like the current date (2013-08-05---.log), or where multiple programming source les have same language extension such as .c or .cpp.
Another frequent requirement is to copy from one le and paste into another. For this, you need to split the Vim window to open both les. This can be done either by using the -o option with the vim command (vim -o <file1-name> <file2-name>); or by opening a le with vim <file1-name>, then opening the second le in split window mode from within the active Vim window with :split <le2name>. To switch cursor control between the two windows, press Ctrl+w (a couple of times). Copy-paste operation across the les can be done as follows: open les in split mode (as explained above); copy the required text from one le; press Ctrl+w to switch the control to the other le; then paste the copied text. You can also split a Vim window vertically. All you need to type is :vsp <le-name> from within an active window.
63 www.linuxuser.co.uk
Tutorial
06 07
To close all the opened les in one go, add a to regular close options like :q, :wq or :q!. So, to close all the les in a single shot, do something like :qa or :wqa or :qa!.
Normally, when the last open le is closed, the Vim application also exits. But, if it is required to close the last open le without closing the application, then just type :bd. This closes the current le and opens an empty buffer.
While most regular users use Vim to edit one le at a time, it can also be used to edit multiple les in parallel
braces of the function denition. For example, bring the cursor to the rst line of the function body. Once there, just type va}zf. As you type this, you will observe that va is used to activate visual mode in Vim, while } selects the complete block including curly braces and zf enables the fold. To open the fold, press zo; to close it, press zc. Make sure that the cursor is within the block while performing fold open and close. Typing va}zf creates a fold (that is invisible). zo and zc work only when a fold is created. An existing fold can be deleted by typing zd.
09
Manual indenting
08
Another frequent requirement which software programmers usually have is to fold some blocks of code in order to save window space. This helps them to focus on the required code blocks. Vim does support block folds. For this, the rst step is to bring cursor inside the
Another important feature that Vim provides is code indentation. Software programmers are required to indent their code and Vim provides easy steps for code indentation. To indent a single line of code, you can use >> or << to indent the line to the right or left respectively. Multiple lines can also be indented using [number-of-lines]>> or
64 www.linuxuser.co.uk
For those programmers who want everything automated, Vim also provides an auto-indenting feature
:set shiftwidth=<number-of-spaces>. For example, use :set shiftwidth=4 to indent lines by four spaces.
11
Search words
To search for a word in the active window, simply type /[search keyword]. This will enable Vims search mode and nd the rst occurrence of the searched keyword. Use n (just press n) in order to search more occurrences of the keyword. Note that you cannot do a backward search here. If you need to do a backward search then just type :?[search keyword]. This will enable Vims backward search mode. Again, use n to continue the search, but backwards this time. Sometimes the keyword is present in the text/source le and it is desired to nd other occurrences of that word in the current text/ source le. In this case, just put the cursor below that word and press * (ie Shift+8). This way, you can search for a word without even typing it.
[number-of-lines]<<; for example, 10>> or 10<<. This is a better technique than indenting each line, but you still need to count the number of lines to indent. This could prove frustrating, especially if the number of lines is very large. Fortunately, there is another trick: to select the lines by working with Vim in visual mode. In order to do this, you rst need to bring Vim into visual mode. This (as mentioned previously) can be done using va. Once in visual mode, use the arrow keys to select all the lines that you want to indent in one go. After this, all you need to do is press > or < and the whole selected area will be indented accordingly.
10
Automatic indentation
For those programmers who want everything automated, Vim also provides an auto-indenting feature. For example, to enable auto-indenting for C code, use :set autoindent and :set cindent. Now, try writing some C code and you will see that Vim automatically produces indentation as you write it. Sometimes, depending upon the existing settings of your Vim editor, lines might get indented to a number of spaces other than four spaces or any other default value that you desire. As a solution to this, you can set the number of spaces to indent using
12
Replace words
Vim also supports search and replace operations. To execute a basic replace operation, just type :%s/[keywordto-search]/[keyword-to-replace-with] to replace keyword-to-search with keyword-toreplace-with. This trick is good if you want to replace all the occurrences of a searched keyword, but what if it is desired to replace only selected occurrences? Well, there is a way through which you can run a search and replace operation in interactive mode. This means that Vim will conrm before replacing the keyword each time. This can be done through :%s/[keyword-to-search]/[keyword-toreplace-with]/c. The rst occurrence is always highlighted and Vim displays a prompt (in green, at the bottom) where you can input your choice of whether you want to replace this occurrence or not. Here, y = Yes, replace this occurrence; n = No, skip this occurrence; a = Replace this and all other occurrences; q = Quit the command; l = Replace this match and then quit the command. Use Ctrl+e (^E) and Ctrl+y (^Y) to scroll the window up and down in this mode. Also, use i and I (along with /c, for example /ci or /cI) for case-insensitive and case-sensitive search.
65 www.linuxuser.co.uk
Tutorial
Create your own app details by using the Twitter Developer account tools, either for personal use or for an app you intend to release
Access the entire dataset of Twitter via the Python wrapper, allowing you to grab timelines, lists and user proles among others
Create your authentication keys for your user and OAuth, letting you tap into the Twitter API
Write your own tweets in Python using the Twython module to access components from the Twitter API
Learn the basics of the Twitter API using Python libraries and create a simple Twitter client to make and monitor tweets
Python has many strengths, and one of them is the way you can use it to create lightweight desktop software and packages for the Internet of Things. One of the services used for this is Twitter, which has a few Python APIs you can make use of in a Python script to check and post the tweets from a specied user. With this you can create a standard Twitter client in the command line, or make a UI for it with Tkinter (from previous issues of LUD). You can also specify the login details youd normally ask for from a client and then use it to check for specic words on Twitter, retweets, messages received, or if a specic person is sending tweets. For this tutorial well be using Twython, which provides a pure Twitter interface for Python, and show you how to get your own unique API key to use it with Twitter itself.
66 www.linuxuser.co.uk
01
Accountability
To create a Twitter app, you need a Twitter account. Sign into your account, or create a separate one if you want to split up personal and development accounts on the service. Once thats done, go to dev.twitter.com and log in using your desired account.
We need to create a Python le to hold all our authentication details. Start by importing Twython
04 02
New beginnings
Go to My applications and click Create a new application. Here youll need to enter the apps name, a short description and a website where more details about yourself and/or the app can be found. Names of apps are not allowed to use the word Twitter in them.
Access token
05
We can now create an access token for the application to work with your Twitter account. Go back to the details once the read and write permissions have been changed, and scroll down to the bottom. Click Create my access token to retrieve it.
07
Authentication le
We need to create a Python le to hold all our authentication details. Start up IDLE, or a text editor of your choice, and start by importing Twython with:
Install Pip
Well install the latest version of pythontwitter from its website. To do this, rst install pip on your system, available in repos as python-pip. As were using Debian, this looks like:
03
Privileges
After this has been created, youll be brought to the details page of the app. Before we go any further, click on Settings and select Read, Write and Access Direct Messages under Application Type so that we can use it properly as a Twitter client.
06
08
Install Twython
App keys
Add the following to your code:
Now that we have Pip installed, we can go ahead and install Twython. To do this, continue in your terminal and put:
67 www.linuxuser.co.uk
Tutorial
09
Access keys
Now we add the access tokens that we created to the script with:
10
Verication
Nows a good time to verify if what youve done so far actually works. Enter the following at the bottom of the script:
twitter.get_user_timeline(screen_name = 'username')
15
Full timeline
We can access the accounts full timeline by using the get_home_timeline variable like so:
twitter.get_home_timeline()
11
Test post
As it all seems to be working, you could try making a test post straight to Twitter. At the bottom of our code, enter:
twitter.update_status(status='Test')
And then run it again. If its successful, there will be no errors and it will show up on your timeline.
13
If you printed this out, it would display all the unltered data from the last 20 tweets on your timeline. You can modify the amount of tweets by adding the count parameter to the get_home_timeline. Well set it to ve for now:
Update
twitter.get_home_timeline(count = 5)
Well need to parse the data to make sure we get something coherent and recognisable as a timeline.
To post this, we use the update_status bit from before, only it now uses the string from post to update our timeline. Add:
twitter.update_status(status=post)
And then save the le. Run it, and test the code again.
12
Write a post
Lets create a simple way to post tweets to your timeline via our script. Well use human input like so:
14
Timeline
twitter.get_user_timeline()
This accesses the past 20 posts our account has made. You can specify which timeline to check as well by adding the screen_name option:
68 www.linuxuser.co.uk
16
19
Search tweets
Favouriting
This works very similar to retweets, using the unique ID for the tweet used in the URL to determine which tweet to favourite. The function for this is create_favorite, and is written as:
twitter.search(q='linux')
This will return a mixed result of tweets relating to the word Linux. You can lter them with the result_type parameter, by setting it as mixed, recent or popular.
twitter.create_favorite(id = '12345')
Make sure to use the American spelling (favorite) when doing this.
22
Trending topics
Everyone knows what everyone else is talking about thanks to Twitters trending topics, whether its a young Canadian musician or important world events. You access the trends with:
twitter.get_place_trends(id = '1')
An ID of 1 returns global trends. You can specify different IDs for different locales.
20 17
Follow
To follow someone on Twitter, we use the create_friendships function. We need either the screen name or numerical ID of the Twitter user you want to follow youll most likely be using the screen name, so well write it like so:
Retrieve favourites
All of a users favourites are stored by Twitter so that you can recover them at any time. You can either get your own, or specify a user to get the favourites from. The basic code is:
twitter.get_favorites()
which will get your own favourites. As before, you can specify the user ID number or screen name with user_id and screen_name respectively to get a specic list.
23
Retrieve list
If you prefer to use Twitter by curating lists of people, you can get the contents of any list using the get_list_statuses function:
twitter.create_friendship(screen_name = 'LinuxUserMag')
twitter.get_list_statuses(id '12345')
Each list has a unique ID, or a slug, that you can use. You can also call members of any list, or anyone that subscribes to it.
18
Retweeting
21
Mentions
24
The end
As retweets are an integral part of Twitter, the function for this is simply retweet. We require the tweet ID for this, the numerical string used for each tweet and displayed in the URL for a tweet. We use it with:
You can also access the list of mentions for your authenticated account. To do this, use the get_mentions_timeline function. This works like the other timelines, allowing you limit the amount of posts you get from the selection. Limit it to ve like before with:
With all these functions, you can start picking and choosing data and making our code do a lot more than just post tweets. Getting specic attributes from the timeline functions will allow you to display a coherent timeline, and it also includes the details needed to follow the links to the users and their links.
twitter.retweet(id = '12345')
twitter.get_mentions_ timeline(count='5')
69 www.linuxuser.co.uk
Essential kit, software and resources for the open source scene
Review index
REVIEWS
Group Test
72 IDE super-test
Enhance your workow with the best dev environments
Hardware
12 MinnowBoard 79 Nook HD+
Has the Raspberry Pi really met its match? The perfect mix of low cost and high performance?
Our experts thoroughly test the kit and grade it using the following criteria Avoid at all costs
How we review
Software
Code::Blocks Geany
A designer/developers bad day Good but could do better Get this. It wont disappoint
Books
85
Eclipse Netbeans
71 www.linuxuser.co.uk
Review
GROUP TEST
We pit four of the best IDEs against each other to nd out which is the best way to streamline and enhance your workow
Weve chosen Eclipse, Code::Blocks, Geany and Netbeans for this review. While theyre not included, KDevelop and Anjuta are other, desktop-environment-specic IDEs that are also great. Weve chosen platform-independent IDEs for this test, although those two will generally work ne on other desktops.
72 www.linuxuser.co.uk
A relatively new IDE, Code::Blocks was rst released in early 2008 after three years of release candidates. Although a C++ IDE by default, it has plug-in support to extend its functionality to allow for building and testing of other languages. However, for pure coding, Code::Blocks can be used to write scripts in various languages thanks to support for syntax of a variety of different languages. However, you cannot test these without add-ons. Unfortunately, the plug-in scene for Code::Blocks is fairly immature and there isnt even proper support for Python and other interpreted programming languages. Plug-ins are found via the Code::Blocks wiki and are not particularly well laid out at the moment. Plug-ins are installed manually, which would be ne normally, but the other IDEs in the test have some interesting ways of managing plug-ins that make this method seem somewhat archaic. While you wont be able to properly debug test code, the interface for Code::Blocks is still very nice for actually writing your code. Projects are handled via proprietary projects les which link to specic folders. Projects dont need to be created with a specic language in mind and, like some text editors, it will smartly know to highlight the syntax for different languages. Browsing
Code::Blocks
A more open IDE originally for C++, but now able to do a bit more
There are a few rst-party plug-ins available, but not many third-party
doesnt always work for all functions and classes; however, it will allow you to perform simple code editing to test elsewhere if you specically like the interface. Code::Blocks is also quite customisable, allowing you to change the look and behaviour of the editor, the way the compiler works and even editing the startup script for the application itself.
Code::Blocks is a nice piece of software, although due its immaturity it doesnt quite have the best plug-in support of the other IDEs in this test especially if you want to use it for multilanguage programming. Its a bit lighter than Eclipse at least, and the interface is well laid out, but it may still be a few years before it becomes preferable to the others.
SCORES
Available in repos, but binaries and source code is easily accessible elsewhere Code::Blocks interface is generally good for workow, although it doesnt support all languages properly A great selection of features that can all be heavily customised Very limited right now, meaning that not all languages are properly supported Code::Blocks has a great interface, and some great ideas on how to code and manage projects, but the plug-in selection needs to be improved
Installation
8 7 7 4
Workflow
Features
Plug-in support
Overall
73 www.linuxuser.co.uk
Review
Geany
n Geanys interface is smart and easily breaks down code for workow purposes
SCORES
Installation Readily available in most repos and requires minimal dependencies Workow is superb for the variety of different languages included No proper debugger, but a great selection of build and project management functions Although it doesnt quite need it like the others, there are very few plug-ins available Geany is a great, lightweight IDE with good native support for a variety of languages, but theres not much room for expansion
Workflow
9 9 7 4
Features
Plug-in support
n The native languages are supported quite well with compilers and such
Overall
74 www.linuxuser.co.uk
Eclipse
The ubiquitous Eclipse is an industry standard how does it fare against more community-run efforts?
Eclipse is one of the most popular development suites around, and at first glance its easy to see why. While created mainly for Java development, Eclipse is highly customisable through plug-ins. Thanks to its popularity and community, this has resulted in a great selection of add-ons that enables Eclipse to work with just about any language. These plug-ins allow for more than that, with a marketplace full of interface and behavioural modications alongside the language elements. Eclipse has great project management tools as well, with a smart tabbed interface, and plug-in-specic menu entries for starting projects in different IDEs if needed. Projects are located in plain folders in the location of your choice, allowing for easy access of source code if you need it, instead of being inside a proprietary le. The function search ability works well and the interface has plenty of tips and warnings for
anything that might be inefcient in terms of the code. There are plenty of editing tools too, such as simple indent or dedent options. The debug suite in Eclipse is fully featured, with various ways to run, check and unit-test code, although this depends on the plug-ins to some degree. The tools are there, though, and most of the major plug-ins seem to use them. The plug-ins are handled by a repository system, which lets you keep any add-ons up to date. While there arent a huge amount available by default, its easy enough to add more to the plug-in manager and you can even
A great selection of add-ons enables it to work with just about any language
select which extensions to install from each of the repositories. Eclipse is customisable in other regards, with an expansive properties and settings menu that lets you edit a huge amount of the native behaviour of the IDE, from the way patches are viewed to little things like key bindings and other shortcuts. Eclipse is a fairly big suite of packages, though, and easily the biggest resource hog out of all of the IDEs were testing. It does have probably the best extensibility of all these IDEs, however, meaning it also probably has the most to offer those who work on a lot of differing projects.
SCORES
Eclipse requires a lot of dependencies; however, its available in most major repos Smart interface design that lets you easily navigate projects and code A great set of features by default, although mainly for handling Java The best support around, with a great repo system offering a wealth of add-ons Eclipse is popular for a reason its got a great selection of features that are easily extensible to suit almost any need
Installation
7 9 8 10
Workflow
Features
Plug-in support
Overall
75 www.linuxuser.co.uk
Review
Netbeans
Netbeans started life as a humble student project to make a Java IDE in Prague. Within a few years, a company had been set up around the IDE, and then had been bought by Sun Microsystems. The rest is history and after over 15 years of development, Netbeans is on version 7.3. Netbeans has a very similar feature-set to Eclipse, with debuggers, compilers, unit testers and the like, although by default Netbeans has support for PHP and HTML as well as its Java-specic features. Netbeans also has a huge database of plug-ins to call from, allowing you to extend its features to just about any programming language. These plug-ins are nicely arranged in a database format on the Netbeans website, with simple search functions and a fairly easy way to install the plug-ins to the system. Theres no repository function for the plug-ins like Eclipse, but the database displays enough information to know if youre getting the latest version of the plug-in. The interface is a little confusing not very well streamlined and aesthetically a little dated. While the splash screen is nice for starting new projects, the rest of the interface is cluttered
There just isnt quite the same level of customisation as Eclipse or the others
and some functions are hidden away in weird menu options. The code view is not particularly well handled, with syntax highlighting a little sparse. The function navigator is fairly nice, though, with the sidebar allowing you to track the hierarchy a little better than some. Customisation in Netbeans is handled with a nice-looking options menu, but there just isnt quite the same level of customisation as Eclipse or the others. However, for similar customisation tasks, its a little better laid out than Eclipse. Overall, Netbeans seems like its a little behind the times, with an interface that needs a small overhaul and a better selection of customisation options. Its by no means a bad IDE, with a great suite of debugging and testing options to use on code. On the other hand, Eclipse is equal or better in almost every regard.
SCORES
Packages are readily available for Netbeans and it requires a Java install The interface is a little cluttered and convoluted, but there are some decent options to be found A similar feature-set to Eclipse, but not as much customisation A fairly large selection of plug-ins are available for it within an easy-tosearch database Netbeans just misses the mark with a slightly dated interface, but its made up for somewhat with a good selection of plug-ins
Installation
8 7 7 8
Workflow
Features
Plug-in support
Overall
76 www.linuxuser.co.uk
Geany
Eclipse
Netbeans
Installation
8 7 7 4
Requires few dependencies and easy to come by Great workow ideas, with easy code navigation Theres not a proper debugger for Geany
9 9 7 4
A big suite of packages, but readily available Project management is excellent and code navigation is good Eclipse is a featurefull IDE and is highly customisable Eclipse has the best selection of plug-ins in this test by a long way Ubiquitous for a reason, Eclipse has a lot of things going for it
7 9 8 10
In most major repos and doesnt have many dependencies A nice workow view, but the interface is a little dated A decent debugger and reasonable customisation A huge database of plug-ins, although some are a bit old Netbeans just falls short of the other IDEs with some missing features
8 7 7 8
Workow
Plug-in support
Geany does not have many available plug-ins A great lightweight IDE that may not be the best, but its still recommended
Overall
Eclipse
Offers excellent project management features and a GROUP TEST hugely expansive plug-in list WINNER to work any way you want
www.linuxuser.co.uk
77 www.linuxuser.co.uk
Nook HD+
REVIEW
The display has a high pixel density and is great for reading eBooks and watching videos. We would have preferred a bit more brightness to it
TABLET
The Nook has a fully customised skin, but does have access to the full range of Google apps, plus the Play Store, so you can Android-it-up a bit more
Technical specs
Operating system Processor Memory Dimensions Weight Display size Display resolution Expansion slot
Android 4.0 1.5GHz dual-core 1GB RAM, 16-32GB storage 240.3 x 162.8 x 11.4mm 515g 9-inch 1920 x 1280 pixels microSD
Is this low-cost, hi-res tablet alternative to the Kindle Fire an Android hackers dream device?
The software is also built for eBooks. Like Amazons Kindle Fire series the bulk of the UI is built around encouraging you to buy content, but unlike with the Kindle you do get the full set of Google apps, and Play Store access as well. There are a number of apps pre-installed, ranging from Spotify to Pinterest to a crosswords app, and none of these can be removed. You will need a Nook account before you can start using the tablet, and will also need your Google account details to access the Play Store. With a bit of work you can get the Nook looking pretty much like a normal skinned Android 4.0 tablet. We wouldnt count on getting OS updates, but it is rootable and there are Jelly Bean ROMs available. Theres a good chance there will be KitKat (Android 4.4) ROMs in future too. Sandra Vogel
Great screen and exemplary battery life; quite hackable too
Pros
Cons
Summary
The Nook HD+ is a pretty good device. With nice hardware and a good display, its surprisingly exible: you can use it as a casual eBook optimised tablet, for the full set of Android apps, or open it up to hacks and tweaks.
More information
www.nook.co.uk
79 www.linuxuser.co.uk
Review
RasWIK
n The small ceramic antenna can be replaced with a wire whip to boost range
n While small, the Slice of Radio does block the little-used Display Serial Interface (DSI) connector
PERIPHERAL
EDITORS
www.linuxuser.co.uk
CHOICE
Designed to mate a wireless Arduino microcontroller with the Raspberry Pi, is the RasWIK what budding developers have been waiting for all this time?
While its easy to see the Arduino and the Raspberry Pi as competitors theyre both low-cost electronic devices aimed at the hobbyist market, after all in truth theyre extremely complementary: the Arduino excels at real-time control and sensing, while the Pi provides cheap network connectivity and powerful data processing capabilities. Thats clearly been the thinking of Ciseco in designing the Raspberry Pi Wireless Inventors Kit, or RasWIK: a bundle of components and accessories, its designed to make working with the Arduino on the Raspberry Pi as simple as possible and showing users just what potential is opened up when the two are connected over a radio link. Getting started couldnt be easier: the kit includes a 4GB SD card with a customised version of the Raspbian operating system. Simply slide this into the Pi, pop the bundled Slice of Radio board onto the GPIO header and apply power. The SD card includes an open source example utility for controlling the included Arduino clone, a radio-equipped microcontroller dubbed the XinoRF. Using this tool, a visual representation of the board appears on screen and allows the user to turn outputs on and off, or read values from digital or analogue input pins. With nothing connected to the Arduino, that would soon get pretty boring, but the kit also includes numerous
Cons
The LLAP wireless protocol offers no encryption; Slice of Radio blocks unused pins on the Pis GPIO header
80 www.linuxuser.co.uk
RasWIK
REVIEW
n Most
Operating system Raspian Linux Dimensions (XinoRF) 70.9 x 53.3mm Weight (XinoRF) 25g Dimensions (Slice of Radio) 30.3 x 34.3mm Weight (Slice of Radio) 7g Extras 4GB SD card, USB cable, small breadboard, 5x red, yellow and green LEDs, 30x resistors, light sensor, thermistor, piezoelectric buzzer, 3x push-button switches, 25x jumper wires
Technical specs
Also consider
n The same compact radio board is found on the XinoRF as on the Slice of Radio
of Radio in particular is a very clever bit of design and sits happily on top of the Pis GPIO port without increasing its dimensions meaning it can be used in conjunction with the vast majority of non-metal cases on the market. The only real downside for those who enjoy experimenting with the Pis GPIO hardware is that the Slice of Radio does not include pass-through connections for the other pins on the header, despite only using power and the UART connection itself. Careful work with a soldering iron will allow you to x that, but if youre not happy with such modications and have only one Pi, youll soon grow tired of removing the radio board in favour of other GPIO-connected devices you may have. Gareth Halfacree
An open source kit, Oomlouts ARDX is the best way to get started with Arduino development. While it includes more components than the RasWIK including a mounting plate, servo and motor it does not include any wireless capabilities as standard. These can, however, be added at a later date. www.oomlout.co.uk
Gertboard
31.12
One of the rst add-on boards developed for the Pi, the Gertboard is a wired GPIO expansion module. Not entirely suitable for beginners due to inaccessible code examples and awkward hardware, its still an affordable way of increasing the Pis GPIO capabilities but, again, has no integrated wireless hardware. uk.farnell.com
Summary
Although it would be easy to mark the RasWIK down for its insecure protocol, to do so misses the point: its an easy way to get started with wireless microcontroller development, and provides a great platform for adding sensors or actuators to a Raspberry Pi. If security is a worry, users can always roll their own protocol.
More information
ciseco.co.uk
81 www.linuxuser.co.uk
Review
SparkyLinux 3.0
New features: Debian 7.0 Linux kernel 3.9.8 GNOME 3.8 compatible
n Customised desktop environments such as LXDE, Openbox and MATE are available
n The preset Conky display gives a lot of information about your system, all of it relevant
DISTRO
n The SparkyCenter is a nice little app for controlling your system, although it could do with better navigation
Minimum Specs: CPU 1GHz i486 RAM 256MB (128MB for CLI Edition) STORAGE 5GB (2GB for CLI Edition) Best for: Home Ofce
SparkyLinux 3.0
Pros
Lightweight distro based on new testing branch of Debian; nice aesthetic; great selection of images
One of the first distros using Debian 7.0 Jessie, SparkyLinux is positioning itself as a lightweight system for any user
SparkyLinux is a relatively new distro, with its rst version only coming out in May of last year. Since then, its gone through a few major upgrades and number changes and is now on its third iteration. The idea is to create a lightweight distro that computers both old and new can use with modern aesthetics and graphical features available for those with high system specs. In case you dont need graphics at all, though, there is a handy CLI image that reduces the specs down further another rst for a Debian 7.0-based distro. Graphical images come in several avours: the standard lightweight LXDE image, a purely Openbox-based image, a MATE image and a Razor-Qt running edition. These are all customised to t the needs of Sparky, with a dock added in most cases, along with a nice custom theme. All of the live images include both a graphical and a command-line installer as used in the CLI version. Both work exactly the same way with the exact same options; however, the command-line version uses cfdisk for partitioning, and the graphical installer used GParted. Its a minor difference that can actually cause a unique issue SparkyLinux cant detect partitions on a hard drive that uses GPT. This means that systems with UEFI may need to be wiped before installing. As GParted can work with GPT, you may never know that this is an issue, as no warning messages or errors are thrown up. This also means that partitioning for SparkyLinux is completely manual. It does explain what it needs to run, and
Cons
Doesnt play nice with all desktops; some issues with Flash and JS on non-Iceweasel browsers
82 www.linuxuser.co.uk
SparkyLinux 3.0
REVIEW
n Unlike a lot of modern distros, the installer has you manually partition the hard drive although there are decent instructions on how to do it
n Synaptic grants you access to the entire Debian repos although we had some issues with using apps and other packages we installed to it
n Its a rolling release based on testing Debian, so all the latest software is available to use in Sparky
Screenshot Gallery
Unique aesthetic
The default login manager is very simple: a drop-down list for users, and a few options in the corner hidden away that let you change the locale and desktop session. Nothing fancy. However, the default desktops each have an aesthetic quality unique to SparkyLinux. A nice use of monochrome icons and colours class up the desktop, and the dock included with LXDE increases its usability. Theres also a precongured Conky display that gives a great selection of system information. This is also present in the live image, just in case you need to keep an eye on your system. SparkyLinux has a great graphical system manager, similar to the likes of Mageia, albeit not as well laid out or as deep. The SparkyCenter gives you access to change the theme and overall look of the distro, software sources, Flash and Java settings, default applications, hard drive management etc. The interface is presented in icons that move into different layers and while theres no back button, exiting the window will take you back a step. The default app selection was nice, although with no commitment to truly free software. VLC, GIMP and Iceweasel
It shouldnt happen
That also wasnt the only extra package we had issues with trying to install Cinnamon went terribly, with only a patchy black screen showing up when trying to boot into it. This really shouldnt happen, even if its not available as a default desktop. At the very least, the default desktops all work well, especially the Razor-Qt offering which is fast becoming one of our favourite lightweight desktops. Being Debian based, the repos are of course full of all the latest and greatest software. The reason SparkyLinux has iterated so much is because its considered a rolling release basically updated with snapshots from Debian testing at specic intervals. This should mean that Sparky is always up to date if you like to be on the cutting edge. However, we dont think its worth it. Being severely limited to basically the default applications and desktops, however good they are, is not the Linux way. Its worth a look, but dont get your hopes up. Rob Zwetsloot
bit.ly/LUDSL3
Summary
There are some great ideas in SparkyLinux, and it works very well unless you decide to step a bit outside the predened barriers of apps and desktops. Well worth a look, but its not for everyone.
Dowload now
sparkylinux.org
83 www.linuxuser.co.uk
Subscribe
USA
www.imaginesubs.co.uk/lud
Or call +44 (0) 1795 418661
Imagine Publishing publishes more than 20 monthly magazines, some of which have been running for over 10 years, reaching over 4 million readers every year
84 www.linuxuser.co.uk
*Terms and conditions: This is a US subscription offer, please dont forget to quote USA when ordering. You will actually be charged 80 sterling for an annual subscription. This is equivalent to $122 at the time of writing, although the exchange rate may vary. Five free issues refers to the newsstand price of $15.99 for 13 issues being $207.87, compared with $122 for a subscription. Your subscription will start from the next available issue. This offer expires 31st December 2013.
Book Reviews
REVIEWS
Scala in Action
Sage advice for all creatives programmers and web designers, not just artists and illustrators that should be common sense, but comes (if at all) from decades of experience. Its never too late to learn improve your work and your workplace with Jandas blogpost-sized bites of wisdom.
Arduino Adventures:
Fun and imaginitive Arduino inroduction
James Floyd Kelly & Harold Timmis Publisher APress ISBN 978-1430246053 Price 23.50 Score Authors
Virtual development environments the easy way, with two commands to get a virtual machine up, then easy sync of complex development environments. Automated provisioning includes Chef, Puppet and shell script options. Vagrant creator Hashimoto expounds, explains, and expands including a section on writing plug-ins.
Emergent Design:
Improve old code & professionalise programming
Author Publisher ISBN Price Score
Functional JavaScript:
Author Publisher ISBN Price Score
The near-ubiquity of JavaScript in the web age makes it a good platform for teaching functional programming techniques, while applying functional concepts to JavaScript will improve your apps in many ways though functional programming people looking to learn JS may need an additional guide.
Framing an Arduino tutorial in a science-fiction story is a big risk. Fortunately, Timmis and Kelly have made both story and tutorial work, as their engaging characters get caught in an adventure that can only be survived with the help of some creative, breadboard-based, hardware hacking something they must learn from scratch, along with the reader. An imaginative way of justifying the various beginner projects which can build knowledge both of electronics, and of Arduino programming, this book should carry young minds easily past some new concepts, and through the acquisition of a number of skills. Fiction, theory, hardware and software through eight challenges, from simple potentiometer and LED projects, through temperature and motion detection, to building your own robot. Rounded off by a comprehensive parts list for each project, and the advice: Never stop learning. Recommended for any beginner, of any age, wanting to start learning Arduino.
A profession an agreed-upon set of minimal standards, and a clear path of entry is not a way of describing software development, but Scott Bain would like it to be and, with Emergent Design, sets out his view of the standards to improve our lot as creators of software. To make (inevitable) change an opportunity, Emergent Design leans heavily on Gang-ofFour patterns and refactoring (with attention to coupling, cohesion, redundancy, readability, testability) so Bain concentrates exclusively on object-oriented languages and techniques. Missing is the functional programming view (most G-o-F patterns are unnecessary in FP languages), but this book is valuable for the questions it asks, and its (practical) optimism: An old concept that I used to accept code must inevitably decay over time fades away in favour of something more hopeful: code can evolve over time, getting better and better every time I touch it.
85 www.linuxuser.co.uk
Classied Advertising
01202 586421
Machined Aircraft Aluminium Integrated Camera Option Anodized Colour Options Security Features Passive Cooling
TM
Proto Armour
www.protoarmour.com
Raspberry Pi is a trademark of the Raspberry Pi Foundation
To Advertise In
rhian.carter@imagine-publishing.co.uk
Twitter:
@linuxusermag
answered
Russell Barnes has been a computer and technology journalist for nearly 15 years
aerospace engineering, using Python to model simulations
Your questions
$ make
.to compile it.
Compiling software from source code isnt that difcult all it requires are simple build tools available in all repos. To make sure you have the correct build tools installed, do the following in a Debian-based system:
Ghost editing
Richard Smedley spends 90% of his screen time shelled into servers in the UK and USA
Hi there. Ive been playing around with my system recently, and decided to do a small overhaul of my disc setup. I created a ghost of my main hard drive, which was not full, and am now attempting to apply it to a smaller space than it was originally on. I gure because the image wasnt full up anyway (and there was no important data Ill lose if I start messing about with it) that I can make some changes to the le and be able to apply it to the new disc I want it to be on? Hope you have some answers. Joe OReilly
$ ./configure
88 www.linuxuser.co.uk
Its certainly possible to do this, and it doesnt require a huge amount of messing around to accomplish either. First of all, boot into a live Linux environment from a disc or USB storage. Use fdisk -l and make a note of the cylinders, heads and sectors, and then edit the image le sda-chs.sf with these new details. Next, use:
$ ffmpeg -i input.mkv -vcodec libxvid -qscale 5 -s 640x272 -aspect 40:17 -r 23.976 -g 240 -bf 2 -acodec libmp3lame -ab 160k -ar 48000 -async 48000 -ac 2 -pass 1 -an -f rawvideo -y /dev/null $ ffmpeg -i input.mkv -vcodec libxvid -qscale 5 -s 640x272 -aspect 40:17 -r 23.976 -g 240 -bf 2 -acodec libmp3lame -ab 160k -ar 48000 -async 48000 -ac 2 -pass 2 -f avi outlander-q5.avi
This should give you a little more control over what youre outputting, and hopefully work a bit better with your DVD player.
Minty Apple
My parents have nally decided to join this century and get a proper computer rather than relying on me or library computers to get their information. As family tech support, Ive told them Ill get them set up with a new system they can use for emails and such. Because theyve never really used computers much at all, I wanted to set up a Linux Mint system for them. However, the only issue I have is nding spare hardware to get that going. I did nd that I have a Mac Mini lying around, though so I thought about putting Linux on that. However, I seem to recall its not as easy as just putting the live disc in and installing as I found out. Im not too bothered about losing OS X, and would much prefer my parents use Mint anyway. How do I get it installed on there? Jeff Vincent While Mint and its Ubuntu base have tools to install on Secure Boot systems that use UEFI, it requires the use of legacy modes to get it work normally. But we dont have that luxury with a Mac, so you need to do a little more. The main issue is that it uses a different partition table that wont work with Mint, so the easiest thing to do if you dont mind losing OS X is convert it to something more Linux friendly. Make sure any les you want to keep are backed up, as this method will format the hard drive. Burn a live CD or DVD of Mint and put it in your optical drive. Restart the Mac and hold down the Option key to bring up the boot selection screen, and of course select CD. Boot into the live environment by choosing Try Linux Mint. When Mint loads up, youll next need to open GParted. By default it should select the Macs hard drive, so click Device on the menu bar and then go to Create Partition Table. A warning will pop up, and then youll want to click the Advanced triangle. From here youll be able to create a new partition table format, this time as MS-DOS. After that is done, you can install Linux Mint however you wish. Wed suggest using Cinnamon if your parents are more used to Windows systems, and show them how to install apps from the Software Centre.
Converted
Batch download
Ive been trying to follow a guide on converting an MKV to an AVI using MEncoder. It seems to work just ne, but I keep getting problems where it just plays the audio on some devices. Heres what Im doing to convert the video, by the way:
$ mencoder abc.mkv -oac pcm -ovc xvid -xvidencopts bitrate=886 -sub ITC0101.srt -subfont-text-scale 3 -o zzz.avi
It works ne on my PC, but on my DVD player, which has no problem with these codecs usually as far as Im aware, it just doesnt work. Am I missing something with my command, or is there another way I should be going about doing this? Tim Daley No, your command seems to be ne, its most likely an issue with MEncoder and the limited codecs on the DVD player. You might be better off trying FFmpeg, though,
Every now and then I come across a website directory that has a load of individual les I need to download residing within it. I used to use a Firefox add-on to select and download them all in one. However, I wanted to know if theres a more universal way of me doing it without having to get extra add-ons for my browser? Colin Still
Its most likely an issue with MEncoder and the limited codecs on the DVD player
89 www.linuxuser.co.uk
Facebook:
Twitter:
@linuxusermag
One method wed recommend using on Linux would be wget, the standard downloading tool for the command line. You can download the contents of a web directory with something like:
Assault on battery
I want to have a notication show up in the event that my laptop battery charge falls below 10%, as I regularly move around when working on it. I guess that most desktop environments provide a notication of this sort, but I use xmonad with a few other programs, so I just need something like a notication daemon and front-end. Ive had a few close calls while working so far, and Id really rather not go back to a desktop environment if I dont have to. Can you suggest any notication tools? I would prefer a lightweight package that I can extend with other notications, but any suggestions are welcome. If there are any DE notication tools that work well outside of their environments, that would also do. Chris Dodd
Theres actually a couple of great tools you can use on xmonad to get this type of functionality. You can use i3, which is a tiling window manager, which can be used on its own or in conjunction with twmn. Both offer tiling notication windows, and i3 is specically designed to work with the xmobar as well. i3 is also very extendable, and it can be used for a lot more than just battery notications. Hope this helps.
how do I go about setting up my system to use the Oracle JDK? Im currently running Ubuntu. Thanks. Peter Chan Okay, so the process for doing this is a two-step one. Firstly, you need to download the JDK les from the Oracle website, which come in a tarball. Extract these and this will create a ./jdk.1.7.0_0x directory in the location of your choosing. Now create a new directory for it and move into it with:
Now you need to run some specic commands to update the system Java info, allowing you to then switch to it. First of all do:
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/ jvm/jdk1.7.0/bin/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/ jvm/jdk1.7.0/bin/javac" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/ lib/jvm/jdk1.7.0/bin/javaws" 1
Now, correct the le ownership and the permissions of the executables with:
Oracle of Java
So I have the OpenJDK installed on my system, and it turns out I need to use the ofcial Oracle JDK for a project Im working on. Only, it seems like I cant just install it and expect it to work
90 www.linuxuser.co.uk
n When connecting remotely, some settings n The right drivers dont always produce the right response
$ sudo chmod a+x /usr/bin/javac $ sudo chmod a+x /usr/bin/javaws $ sudo chown -R root:root /usr/lib/ jvm/jdk1.7.0
Now we need to select the new JDK by running:
Open the terminal while logged in as root, and then change to another user
As root works, heres a little thing you can try open the terminal while logged in as root, and then change to another user with:
$ java -version
You can now also switch back to OpenJDK, if you need to, with the config java command.
Terminal trouble
Graphical Java
Ive just upgraded my box to the Radeon drivers, and its so far proved to be a good idea. The box runs smoothly now. There are some issues with Java OpenJDK, though. How do I get it to use OpenGL? There may well be the option to use Suns Java, but it needs AOSS so, either I tweak the OpenJDK to not crash and use OpenGL/acceleration; or I use Suns JRE, but it would involve installing OSS. Chris Kimpton Youre going to have to use a little hack so that Java knows where its located. Create it with:
Im experiencing a very weird problem every now and then I need to do some work in the terminal on my system. However, whenever I try and open the terminal emulator, it opens for a brief instant and then automatically closes. The system in question is CentOS, which I have to access remotely via VNC. Its using Xfce as a desktop environment as well. The weird thing is, it works just ne if Im logged in as root, so I can only assume its a problem with the user type. Obviously, I dont want to make some of the normal users have full root privileges, and Id much rather not log in as root every time I work on this system. Have you heard of anything like this before? Is there something fairly obvious that Im missing? Thanks for any help. Thomas Reid
$ su -l <user>
This will allow you to open another shell to log in with and then try to open the terminal. Any errors will show up in the root terminal. What may likely happen is that you cannot even load into the shell. This is because the user will not have access to connect to the X server because youre using it via VNC. To solve this, you just need to add the relevant users to the list that are allowed to make this connection. You can do this with xhost by typing:
# xhost local:<user>
as root. Give the system a reboot and it should now be working ne.
91 www.linuxuser.co.uk
Hosting listings
Sponsorship opportunity
Bring attention to your brand by sponsoring this section. Contact Rhian Carter on +44(0)1202586421
linuxuser@imagine-publishing.co.uk
PHONE NUMBER
0800 061 2801 0800 061 2801 0800 061 2801 0800 061 2801 0800 061 2801 0800 061 2801
N/A N/A N/A N/A N/A N/A
Dual Core 2.2GHz Dual Core 3GHz Intel Quad Core 2.66GHz N/A N/A N/A
N/A N/A N/A N/A N/A N/A
160GB
2 x 250GB 2 x 500GB
DISK SPACE
PACKAGE
Whether youre a hosting firm or a happy customer who wants a favourite provider listed, drop us a line with the details!
N/A
HARDWARE RAID
N/A
Netcetera
www.netcetera.co.uk/linux
Bravo14 (http://bravo14.co.uk) Bravo14 (http://bravo14.co.uk) Bravo14 (http://bravo14.co.uk) Bravo14 (http://bravo14.co.uk) Bravo14 (http://bravo14.co.uk) Bravo14 (http://bravo14.co.uk)
Reseller
Starter Linux Starter Windows Business Linux Business Windows Ultimate Linux Ultimate Windows
N/A
01628 777730 01628 777730 01628 777730 01628 777730 01628 777730
Dual/Quad Core Intel Xeon 3065 Quad Core Intel Xeon X3430 2 x Intel Xeon Quad Core 2 x Intel Xeon Hex Core 2 vCPU (4GB)
160GB to 2TB 1 x 250GB 120GB Intel 520 SSD 2 x 500GB SATA II 4 x 1TB SATA III 40GB
10Mbps 100 Mbps 100 Mbps 100 Mbps 100 Mbps Gbit shared / node Gbit shared / node
10 GB 10 GB 10 GB 10 GB 10 GB
Cloud Server
01628 777730
52
1 month
n/a
99.90%
PoundHost
Cloud Server
01628 777730
98
1 month
4 vCPU (8GB)
40GB
n/a
99.90%
www.poundhost.com
Heart Internet (www.heartinternet. co.uk/dedicated-servers) Heart Internet (www.heartinternet. co.uk/dedicated-servers) Heart Internet (www.heartinternet. co.uk/dedicated-servers) Linux Dual Core 0845 644 7750 79.99 12 months Dual Core Xeon 2.33GHz Dual Core Xeon 2.33GHz Quad Core Xeon 2.5GHz 160GB
99.99%
89.99
12 months
160GB
99.99%
129.99
12 months
250GB
99.99%
Unlimited
1.79 7.95
12 months 3 months
Unlimited Unlimited
N/A
N/A
99.9% 99.9%
N/A
N/A
Zyma
www.zyma.com
Unlimited
O = Option
92 www.linuxuser.co.uk
UPTIME GUARANTEE
PERMANENT KVM
PRIVATE SUBNET
rhian.carter@imagine-publishing.co.uk +44(0)1202586421
Hosting listings
LISTINGS
+44 (0)845 5280242 49.95 +44 (0)845 5280242 89.95 +44 (0)845 5280242 149.95
0844 999 4100 0844 999 4100 0844 999 4100 0844 999 4100 0121 314 4865 0121 314 4865 0121 314 4865 0121 314 4865 02380 249 823 02380 249 823 02380 249 823 02380 249 823 N/A N/A N/A N/A 23.88 59.88 95.88 227.88 30 42 72 114 40 75 140 250 29.99 54.99 79.99 159.99
Unlimited
Unlimited Unlimited
10 50 250 Unlimited 10 20 100 200 10 10 25 100 3 50 Unlimited Unlimited
Blacknight
www.blacknight.com
eHosting (www.ehosting.com) eHosting (www.ehosting.com) eHosting (www.ehosting.com) eHosting (www.ehosting.com) Equiphase (www.equiphase.net) Equiphase (www.equiphase.net) Equiphase (www.equiphase.net) Equiphase (www.equiphase.net) Eurofasthost.com (www.eurofasthost.com) Eurofasthost.com (www.eurofasthost.com) Eurofasthost.com (www.eurofasthost.com) Eurofasthost.com (www.eurofasthost.com) Evohosting (www.evohosting.co.uk) Evohosting (www.evohosting.co.uk) Evohosting (www.evohosting.co.uk) Evohosting (www.evohosting.co.uk)
0808 168 6777 0808 168 6777 0808 168 6777 0808 168 6777 0808 168 6777 0808 168 6777
0800 542 7500 0845 644 7750 0845 644 7750 0845 644 7750 0845 644 7750 0808 180 1880 0845 130 1602 0845 130 1602 0845 130 1602 0845 130 1602 N/A N/A N/A N/A 0845 612 0330 0845 612 0330 0845 612 0330
5GB 50GB
O O O O
O
O O
VIRUS FILTER
FIREWALL
Fasthosts
WD Starter WD Advanced
Business Pro Starter Professional Home Professional Business Professional Reseller Professional Silver Fusion Professional Fusion Business Fusion Developer Fusion Reseller Starter Standard Advanced Reseller Unlimited Email Only Standard Package Professional Package
www.fasthosts.co.uk
Giacom (www.giacom.com) Heart Internet (www.heartinternet.co.uk) Heart Internet (www.heartinternet.co.uk) Heart Internet (www.heartinternet.co.uk) Heart Internet (www.heartinternet.co.uk) Hostway (www.hostway.co.uk) WebFusion (www.webfusion.co.uk) WebFusion (www.webfusion.co.uk) WebFusion (www.webfusion.co.uk) WebFusion (www.webfusion.co.uk) Eco Web Hosting (www.ecowebhosting.co.uk) Eco Web Hosting (www.ecowebhosting.co.uk) Eco Web Hosting (www.ecowebhosting.co.uk) Eco Web Hosting (www.ecowebhosting.co.uk) NameHog (www.namehog.net) NameHog (www.namehog.net) NameHog (www.namehog.net)
O = Option
93 www.linuxuser.co.uk
Your view
Contact us
YOUR VIEW
Piece of Pisi
I remember a while ago you talked about Pisi Linux, an alternative to Pardus that was a bit more like the original. I was sad to see that DistroWatch refuses to even list Pisi Linux because someone trolled them, telling them it was not active, setting up fake Pisi Linux sites etc. DistroWatch apparently decided they would remove it from their lists. Very sad and disappointing on the part of DistroWatch. I hope that when it nally
reaches stable release theyll add Pisi back to the database, as the older Parduses were some of my favourite distros! Mark Doyle Its a shame that DistroWatch took the stance. Going by the Pisi teams side of the
story, it seems like DistroWatch were duped; however, the folks over at DistroWatch havent responded to the Pisi team since their explanation. The beta for it is out now, but Pisi is not back on DistroWatch just yet. Look out for a review of the full version when its nally released.
THREAD BARE
things shouldnt be that bad either, because Mir/Wayland support is at the toolkit level. The biggest burden will probably be on the toolkits, though: having to have and support two back-ends in addition to X (because X will not be totally going away any time soon).
bwat47 said
I dont think the situation is quite as bad as it seems. Both Mir and Wayland have several major similarities in their architecture, such as using EGL. For drivers, theoretically it should not be difcult to support both as long as they provide EGL support. For applications
94 www.linuxuser.co.uk
Your view
LETTERS
Android Magazine
With more and more Android features being merged back into the Linux kernel, its becoming easier to develop for one of the most popular mobile operating systems around. With over 25 billion app downloads, and over 500 million Android devices worldwide, theres a huge audience ready to consume apps. For a more Android-driven editorial, look to our sister mag Android Magazine, the only publication dedicated to the platform. Along with news and reviews to keep you up to date on everything Android, there are also tutorials and advice on developing and hacking your hardware. Find out more at www.littlegreenrobot.co.uk.
Specialist distros
Okay, I am a little confused with the whole distro designed for specic job trend. If I want to run audio applications in Windows, Mac or any other OS, I install the programs I want. Why oh why with Linux do we see this approach of just install the audio distro for the best audio environment. What a waste! Instead of customising an existing distro and having a nice aptitude/yum install audio-env we get all the overhead of maintaining a distro just for the applications? Isnt it time we separated the application from the OS and ignored any attempts by people to integrate the two? Colin McDermott Theres no specic reason why you cant do this anyway a lot of people will probably be ne with a standard Fedora or Ubuntu install for any of their specialised needs. However, some distros do more than just come with a selection of themed default packages distros like AV Linux go the extra mile and customise the kernel specically for AV software. Not everyone has the skills to do that in Linux, so these kind of distros do serve a purpose. The same with some lightweight distros. Its about choice, and this offers a lot more choice for people.
Raspberry Pi projects you had. I tried out a couple of them and was pleased with the results; there are really so many things you can do with the Raspberry Pi! I now use my Raspberry Pi for all my media centre needs and havent looked back I even have a spare SD card for using it as a portable access point for when I go travelling. Will you be doing another feature like this in the future? If so, will I be able to suggest some projects? I have a few in mind which I feel will properly make use of the Raspberry Pi. Thanks again, Phillip Cordaro
Raspberry Pi projects
Were glad you enjoyed the projects, Phillip. We always love to hear about Raspberry Pi projects ideas from all of our readers, even just to feature on their own in the magazine. We usually try to get at least one Raspberry Pi related tutorial or feature in the magazine every month for example, in this issue you can nd out how to turn that portable access point into a secure router with our Onion Pi tutorial starting on page 46. You can send any ideas to the email address at the top of this page.
Ive just nished reading issue 129 of your magazine and was very inspired by the ten
More Pi
Facebook:
Twitter:
@linuxusermag
Next issue
Whats coming up
Subscribe today!
Imagine Publishing Ltd Richmond House, 33 Richmond Hill Bournemouth, Dorset, BH2 6EZ +44 (0) 1202 586200 Web: www.imagine-publishing.co.uk www.linuxuser.co.uk www.greatdigitalmags.com
Magazine team
russell.barnes@imagine-publishing.co.uk 01202 586272 Staff Writer Rob Zwetsloot Photographer James Sheppard Senior Art Editor Will Shum Editor in Chief Nick Jones Head of Publishing Aaron Asadi Head of Design Ross Andrews
Contributors
Phil King, Richard Smedley, Jon Masters, Himanshu Arora, Richard Hillesley, Michael Reed, Gareth Halfacree, Joey Bernard, Simon Brew, Sandra Vogel, Steve Mumby, Mihalis Tsoukalos, Eden Frankham, Kunal Deo, Abbi Denney & David Crookes
Digital or printed media packs are available on request. Advertising Director Matthew Balch 01202 586437 matthew.balch@imagine-publishing.co.uk Head of Sales Hang Deretz 01202 586442 hang.deretz@imagine-publishing.co.uk Advertising Manager Jennifer Farrell 01202 586430 jennifer.farrell@imagine-publishing.co.uk Account Manager Rhian Carter 01202 586421 rhian.carter@imagine-publishing.co.uk
Advertising
Cover disc
Junior Web Designer Steve Dacombe ludxtrahelp@imagine-publishing.co.uk Linux User & Developer is available for licensing. Contact the International department to learn more. Head of International Licensing Cathy Blackman +44 (0) 1202 586401 licensing@imagine-publishing.co.uk Head of Subscriptions Gill Lambert For all subscriptions enquiries 0844 249 0282 (UK) +44 (0) 1795 418661 (Overseas) Email: LUD@servicehelpline.co.uk 6 issue subscription (UK) 25.15 13 issue subscription (Europe) 70 (ROW) - 80
International
Subscriptions
Circulation
Production Founders
Production Director Jane Hawkins 01202 586200 Group Managing Director Damian Butt Group Finance & Commercial Director Steven Boyd Group Creative Director Mark Kendrick
Printed by William Gibbons, 26 Planetary Road, Willenhall, West Midlands, WV13 3XT Distributed in the UK & Eire by Seymour Distribution, 2 East Poultry Avenue, London, EC1A 9PT. 0207 429 4000 Distributed in Australia by Gordon & Gotch, Gordon & Gotch Corporate Centre, 26 Rodborough Road, Frenchs Forest, NSW 2086. + 61 2 9972 8800
Distributed in the Rest of the World by Marketforce, Blue Fin Building, 110 Southwark Street, London, SE1 0SU. 0203 148 8105
Disclaimer
>> Master the RasPi camera >> LTE Open Phone reviewed The worlds favourite version control >> Visualise data with Graphviz >> Protect your network with FOSS system isnt as easy as it could be
ALSO INSIDE:
The publisher cannot accept responsibility for any unsolicited material lost or damaged in the post. All text and layout is the copyright of Imagine Publishing Ltd. Nothing in this magazine may be reproduced in whole or part without the written permission of the publisher. All copyrights are recognised and used specifically for the purpose of criticism and review. Although the magazine has endeavoured to ensure all information is correct at time of print, prices and availability may change. This magazine is fully independent and not affiliated in any way with the companies mentioned herein. If you submit material to Imagine Publishing via post, email, social network or any other means, you automatically grant Imagine Publishing an irrevocable, perpetual, royalty-free license to use the images across its entire portfolio, in print, online and digital, and to deliver the images to existing and future clients, including but not limited to international licensees for reproduction in international, licensed editions of Imagine products. Any material you submit is sent at your risk and, although every care is taken, neither Imagine Publishing nor its employees, agents or subcontractors shall be liable for the loss or damage. Imagine Publishing Ltd 2013 ISSN 2041-3270m
98 www.linuxuser.co.uk
many MORE
SCAN FOR
20% SAVINGS