™ Control Your Own Data with the Personal Cloud
Since 1994: The Original Magazine of the Linux Community OCTOBER 2013 | ISSUE 234 | www.linuxjournal.com EMBEDDED DIAGNOSE YOUR CAR WITH ANDROID TEST NEW BUILDS QUICKLY WITH A U-BOOT TRICK BUILD A PERSONAL COMPUTER OR SERVER WITH AN EMBEDDED SYSTEM + Shell Scripts and ImageMagick
HOW-TO: rss2email ZURB FOUNDATION Set Up Your A Simple Approach Design a Responsive Own BirdCam for Viewing RSS Feeds Web Site
LJ234-Oct2013.indd 1 9/20/13 11:50 AM Linux Journal_Layout 1 8/6/13 10:19 AM Page 1
Attend the Largest Dedicated Android Conference in the Universe!
SAN FRANCISCO November 12-15, 2013
Get the best real-world Android developer training anywhere! • Choose from more than 75 classes and tutorials • Network with speakers and other Android developers • Check out more than 40 exhibiting companies
“AnDevCon is a great opportunity to take your Android skills to the next level, get exposed to technologies you haven’t touched yet, and network with some of the best Android developers in the world.” —Joe Mitchell, Software Engineer, Quicken Loans
“It’s a blast learning and exchanging ideas with phenomenal speakers and cutting-edge experts who have the exp erience.” —Brad Holmes, Software Developer, uShip
Register Early and Save at www.AnDevCon.com
AnDevCon™ is a trademark of BZ Media LLC. Android™ is a trademark of Google Inc. Google’s Android Robot is used under terms of the Creative Commons 3.0 Attribution License.
A BZ Media Event Follow us: twitter.com/AnDevCon
LJ234-Oct2013.indd 2 9/18/13 4:08 PM LJ234-Oct2013.indd 3 9/18/13 4:08 PM OCTOBER 2013 CONTENTS ISSUE 234 EMBEDDED FEATURES 64 Be a Mechanic...with Android and Linux! Decode Your “Check Engine” light. Bill Childers
74 Create a Mini PC or Server with Olimex’s Olinuxino A13/A13Micro Build a capable Linux personal computer or server with a cheap embedded system. Ronald Kurniawan
91 A Handy U-Boot Trick U-Boot over LAN. Bharath Bhushan Lohray
ON THE COVER • Control Your Own Data with the Personal Cloud, p. 104 • Diagnose Your Car with Android, p. 64 • Test New Builds Quickly with a U-Boot Trick, p. 91 • Build a Personal Computer or Server with an Embedded System, p. 74 • Shell Scripts and ImageMagick, p. 36 • How-To: Set Up Your Own BirdCam, p. 48 • rss2email: a Simple Approach for Viewing RSS Feeds, p. 42 • Zurb Foundation—Design a Responsive Web Site, p. 26 Cover Image © Can Stock Photo Inc. / pzAxe
4 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 4 9/18/13 4:08 PM INDEPTH 104 The Personal Cloud What happens when you take all the functionality of enterprise commercial software and make it available to individuals? We’re about to find out. T.Rob COLUMNS 26 Reuven M. Lerner’s At the Forge Zurb Foundation
36 Dave Taylor’s Work the Shell Image Manipulation with ImageMagick
42 Kyle Rankin’s Hack and / Command-Line Cloud: rss2email
48 Shawn Powers’ The Open-Source Classroom It’s a Bird. It’s Another Bird! 64 114 Doc Searls’ EOF The First Personal Platform— for Everything IN EVERY ISSUE 8 Current_Issue.tar.gz 10 Letters 14 UPFRONT 24 Editors’ Choice 60 New Products 117 Advertisers Index 74
LINUX JOURNAL (ISSN 1075-3583) is published monthly by Belltown Media, Inc., 2121 Sage Road, Ste. 395, Houston, TX 77056 USA. Subscription rate is $29.50/year. Subscriptions start with the next issue.
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 5
LJ234-Oct2013.indd 5 9/18/13 4:08 PM Executive Editor Jill Franklin [email protected] Senior Editor Doc Searls [email protected] Associate Editor Shawn Powers [email protected] Art Director Garrick Antikajian [email protected] Products Editor James Gray [email protected] Editor Emeritus Don Marti [email protected] Technical Editor Michael Baxter [email protected] Senior Columnist Reuven Lerner [email protected] Security Editor Mick Bauer [email protected] Hack Editor Kyle Rankin [email protected] Virtual Editor Bill Childers [email protected]
Contributing Editors Ibrahim Haddad • Robert Love • Zack Brown • Dave Phillips • Marco Fioretti • Ludovic Marcotte Paul Barry • Paul McKenney • Dave Taylor • Dirk Elmendorf • Justin Ryan • Adam Monsen
Publisher Carlie Fairchild [email protected]
Director of Sales John Grogan [email protected]
Associate Publisher Mark Irgang [email protected]
Webmistress Katherine Druckman [email protected]
Accountant Candy Beauchamp [email protected]
Linux Journal is published by, and is a registered trade name of, Belltown Media, Inc. PO Box 980985, Houston, TX 77098 USA
Editorial Advisory Panel Brad Abram Baillio • Nick Baronian • Hari Boukis • Steve Case Kalyana Krishna Chadalavada • Brian Conner • Caleb S. Cullen • Keir Davis Michael Eager • Nick Faltys • Dennis Franklin Frey • Alicia Gibb Victor Gregorio • Philip Jacob • Jay Kruizenga • David A. Lane Steve Marquez • Dave McAllister • Carson McDonald • Craig Oda Jeffrey D. Parent • Charnell Pugsley • Thomas Quinlan • Mike Roberts Kristin Shoemaker • Chris D. Stark • Patrick Swartz • James Walker
Advertising E-MAIL: [email protected] URL: www.linuxjournal.com/advertising PHONE: +1 713-344-1956 ext. 2
Subscriptions E-MAIL: [email protected] URL: www.linuxjournal.com/subscribe MAIL: PO Box 980985, Houston, TX 77098 USA
LINUX is a registered trademark of Linus Torvalds.
LJ234-Oct2013.indd 6 9/18/13 4:08 PM ® has the tools to keep you afloat. Key Features:
• Dual Intel® Xeon® Processors 5600 Series TrueNAS® Unified Storage features the Intel® Xeon® Processor • Support for CIFS, NFS, iSCSI, and more 5600 series and supports high availability, remote replication, • Active Directory, LDAP, and NIS integration deduplication, encryption, compression, and snapshots. It has • Multi-Petabyte Scalability the tools to deal with any storage challenge you may face.
Intel, the Intel logo, and Xeon Inside are trademarks or registered trademarks of Intel Corporation in the U.S. and other countries.
Call iXsystems toll free or visit our website today! 1-855-GREP-4-IX | www.iXsystems.com
LJ234-Oct2013.indd 7 9/18/13 4:08 PM Current_Issue.tar.gz
Stealth Linux SHAWN POWERS
y favorite scene from The the Google Reader shutdown. One of Karate Kid (the original the things I love about Linux is that M from 1984, sorry, I’m old) there’s no single way to do anything. is when Mr Miyagi stops the Cobra While I want a bookmark to take me Kai sensei, John Kreese, from beating from RSS site to RSS site, Kyle shows up his defeated student. Miyagi is a us to have articles delivered via e-mail. small, feeble-looking old man, and If that sounds interesting to you, he has no need to prove to anyone check out his column this month for that he’s an awesome warrior. Linux instructions on how he does it. is much the same: awesome and Dave Taylor and I have a little unassuming. Linux is slowly but surely crossover with our columns this taking over the world, embedded into month, which is completely cell phones, televisions, wristwatches coincidental, but very aptly timed. and server rooms. Because Linux itself Dave explores the power of the isn’t a commercial entity, it doesn’t ImageMagick suite of tools used need to be flashy, and it doesn’t need in scripting. I follow later in the to brag. When it comes to embedded magazine with my column describing systems, Linux is “honking the nose” my homemade streaming Webcam of proprietary alternatives, just like Mr of “BirdTopia”, or “Backyard” Miyagi does to the bully. as others refer to it. I use some We start out our Embedded issue ImageMagick tools to manipulate the with Reuven M. Lerner’s column. This images pulled from my cell phones, month, Reuven explores an alternative all from scripts on my Linux server. to the extremely popular Twitter I’ve enjoyed creating my BirdCam Bootstrap. Zurb Foundation may setup more than most of my Linux sound like a character from Starcraft, projects, and I hope it inspires you but in fact, it’s a competitor to Twitter to try something similar! Bootstrap that is worth a look. Kyle The truly embedded portion of this Rankin takes the path less traveled as issue starts with Bill Childers and well this month with his solution to his article on interfacing with your
8 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 8 9/18/13 4:08 PM CURRENT_ISSUE.TAR.GZ
vehicle’s OBD system. Using Android with managing our personal, private and a fancy dongle, Bill explains how data in a world focusing on selling to get diagnostic information directly services? T.Rob explores that and from your car! If your “Check Engine” gives us a lot to consider. light suddenly pops on, but gives no Much like “cloud” computing, reason as to why, Bill’s article will be “embedded” computing has a fairly extremely helpful. Ronald Kurniawan flexible definition. One thing is goes one step deeper and shows how certain, however, and that is that to use an $80 embedded system from Linux is perfect for the embedded Olimex to create a desktop system, or world, however you define it. With even a complete server. Proving there’s its breathtaking variety of hardware more to the tiny embedded world support and unassuming happiness than just Raspberry Pi devices, Ronald living behind the scenes, the walks through the entire process for embedded market may be the vehicle getting a system running. Linux finally uses to take over the Most new embedded systems take world. Year of the desktop? Pshaw, advantage of the U-Boot system more like year of “the everything for starting up. Bharath Bhushan else”, with a little desktop on Lohray covers U-Boot and some the side! Although Linux may not of its features, along with a few have the marketing campaign, or tricks. Whether you need to boot ad campaigns of the proprietary your embedded device from an SD alternatives, much like Mr Miyagi, it card, a USB stick or even over TFTP, doesn’t need it. Just do the job, do it U-Boot can make modifications as well, and the rest will fall into place. simple as a device reboot. Bharath We hope you enjoy this issue (very walks through the process and likely reading it on your embedded gives configuration examples. And device); we certainly enjoyed putting finally, T.Rob talks about the future it together!■ of the Cloud—specifically, the Personal Cloud. While the fluid size Shawn Powers is the Associate Editor for Linux Journal. and burstable expansion of cloud He’s also the Gadget Guy for LinuxJournal.com, and he has computing has revolutionized the an interesting collection of vintage Garfield coffee mugs. way we think about server rooms, it Don’t let his silly hairdo fool you, he’s a pretty ordinary guy also has moved sensitive data out of and can be reached via e-mail at [email protected]. our personal control. How do we deal Or, swing by the #linuxjournal IRC channel on Freenode.net.
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 9
LJ234-Oct2013.indd 9 9/18/13 4:08 PM letters
Doc Searls replies: Coincidentally, I am a youth of 66 as well. So let’s toast staying young for the duration (clink!).
As I said, mostly I stay in private homes (all with free Internet connections) when I’m paying my own way. And, I like AirBnB. But the youth hostel idea is also a good one, and even cheaper. Thanks!
Cerberus, I In the August 2013 issue, Shawn Powers recommended the Cerberusapp application to track the Net Connectivity in Hotels location of your Android phone (see In Doc Searls’ article “Dear Hotels: his UpFront piece titled “Android Quit Being A-holes” in the August Candy: Hire a Cerberus to Find Your 2013 issue, he writes: “In the US Phone”). This is indeed a great app; and Europe, the expensive hotels thanks for sharing. are the ones with inconvenient connectivity deals....It’s the cheap However, you should be hotels that offer free Internet, just aware of the privacy policy like they offer free electricity, heat, (https://www.cerberusapp.com/ air conditioning and running water.” privacy.php): “LSDroid uses your personally identifiable, location... I’ve recently stayed in youth hostels in information...to create new features, northern Italy and in Alberta, Canada. promotions, functionality and They all had free Wi-Fi. Why would services....LSDroid uses cookies and anyone stay in an expensive hotel? log file information to...b) provide custom and personalized content, And, I’m a “youth” of 66—most youth advertisements and information; hostels seem to have no age limit. c) monitor the effectiveness of our —David Brown marketing campaigns....LSDroid
10 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 10 9/18/13 4:08 PM [ LETTERS ]
discloses aggregate, anonymous log access to the back issues—maybe that file and usage information in reports helps?—Shawn Powers to interested third parties....” Google Reader I just thought you and LJ readers I saw Shawn Powers’ article on should be aware of the privacy Google Reader via the Linux Journal implications when using the app. RSS feed (“The Google Giveth” in —Aviv the May 2013 issue).
Ugh! Thanks for pointing that out. Go to http://keepamericaatwork.com. Creepy indeed.—Shawn Powers I decided to do this when Google
Archive CD? I already own the 1994–2009 Linux Journal Archive CD. Is there a way to just download/purchase the issues from 7” Panel PC Ÿ ARM9 400Mhz Fanless Processor 2010 onward, or do I have to purchase Ÿ Up to 1 GB Flash & 256 MB RAM PPC-E7+ Ÿ 7" 800 x 480 TFT LED Backlit LCD another archive disk? Also, do you plan Ÿ Analog Resistive Touchscreen Ÿ 10/100 Base-T Ethernet to have another Linux and Amateur Ÿ 3 RS232 & 1 RS232/422/485 Port Ÿ 1 USB 2.0 (High Speed) Host port Radio issue? I enjoyed the January Ÿ 1 USB 2.0 (High Speed) OTG port Ÿ 2 Micro SD Flash Card Sockets 2010 issue. P.S. I enjoy the articles in Ÿ SPI & I2C ports Ÿ I2S Audio Interface w/ Line-in/out Linux Journal; keep up the good work. Ÿ Operating Voltage of 12 to 26 Vdc Ÿ Optional 2D Accelerated Video & Decoder —Micheal Trombley Ÿ Pricing start at $550 for Qty 1 2.6 KERNEL Designed and Manufactured in the USA the PPC-E7+ Compact The archive CDs are an all-or-nothing Panel PC comes ready to run with the Operating System installed on Flash. Apply power and watch the Linux X Windows User sort of thing. The intention isn’t to resell Interface appear on the vivid 7” color LCD. Interact with the PPC- E7+ using the responsive integrated touch-screen. Everything the same thing every year, but rather works out of the box, allowing you to concentrate on your application, rather than building and configuring device drivers. to provide a full archive for those folks Just Write-It and Run-It. hoping to catch up. They’re also nice www.emacinc.com/panel_pc/ppc_e7+.htm
for people like me who like to “collect Since 1985 OVER the whole set”, but I don’t think there 28 YEARS OF SINGLE BOARD are any plans to release incremental SOLUTIONS EQUIPMENT MONITOR AND CONTROL · · updates. That said, subscribers have Phone: ( 618) 529-4525 Fax: (618) 457-0110 Web: www.emacinc.com
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 11
LJ234-Oct2013.indd 11 9/18/13 4:08 PM [ LETTERS ]
Reader disappeared, so that I wouldn’t And, because I also have subscribed to be dependent on any system. Keep America At work via the e-mail subscription plugin, I automatically Basically, I host my own site, and I use get a copy of everything that gets a plugin called wp-o-matic that goes added via e-mail in case I become too out and grabs the RSS feeds that I busy to check the site itself. So far, it program it with. works like a champ.
Because I’m using WordPress, I can The downside is that if you’re categorize those feeds (look on the subscribed via the e-mail plugin, right-hand sidebar for the categories), and you add a bunch of new feeds, and now I can view articles by category you will get a bunch of e-mails or by searching. Most important, I can until it processes the new feeds, click on a day in the calendar and read but then because most places all feeds for that particular day. release only one or two articles
LINUX JOURNAL on your Android device Download app now in the Android Marketplace
www.linuxjournal.com/android
For more information about advertising opportunities within Linux Journal iPhone, iPad and Android apps, contact John Grogan at +1-713-344-1956 x2 or [email protected].
LJ234-Oct2013.indd 12 9/18/13 4:08 PM per day, it is very manageable. —Virgil At Your Service
Interesting concept. Over the past few months, I’ve SUBSCRIPTIONS: Linux Journal is available in a variety of digital formats, including PDF, written about a few ways to replace Google Reader, .epub, .mobi and an on-line digital edition, but creating a personalized blog that “writes itself” as well as apps for iOS and Android devices. Renewing your subscription, changing your based on subscribed feeds...that’s interesting. Of e-mail address for issue delivery, paying your invoice, viewing your account details or other course, it makes me want to have you add your subscription inquiries can be done instantly on-line: http://www.linuxjournal.com/subs. own RSS feed to your feed aggregation setup, E-mail us at [email protected] or reach to see if it blows itself up, but that’s just the us via postal mail at Linux Journal, PO Box 980985, Houston, TX 77098 USA. Please prankster in me coming out!—Shawn Powers remember to include your complete name and address when contacting us.
ACCESSING THE DIGITAL ARCHIVE: Cerberus, II Your monthly download notifications will have links to the various formats I often pass on Shawn Powers’ “Android Candy” tips and to the digital archive. To access the digital archive at any time, log in at to my wife. I did so this month for the Cerberus app, http://www.linuxjournal.com/digital. but then almost immediately saw this story: “Google LETTERS TO THE EDITOR: We welcome your Unveils Android Version of ’Find My iPhone’” letters and encourage you to submit them at http://www.linuxjournal.com/contact or (http://officialandroid.blogspot.com/2013/08/ mail them to Linux Journal, PO Box 980985, Houston, TX 77098 USA. Letters may be find-your-lost-phone-with-android.html). edited for space and clarity.
WRITING FOR US: We always are looking for contributed articles, tutorials and You might want to alert your users to this real-world stories for the magazine. development in next month’s LJ. An author’s guide, a list of topics and due dates can be found on-line: —Bob L. http://www.linuxjournal.com/author.
FREE e-NEWSLETTERS: Linux Journal editors publish newsletters on both Thanks Bob! This is especially interesting based on a weekly and monthly basis. Receive late-breaking news, technical tips and Aviv’s letter regarding Cerberus. It does mean I’ll be tricks, an inside look at upcoming issues reading the fine print on the Google solution before and links to in-depth stories featured on http://www.linuxjournal.com. Subscribe installing though, that’s for sure.—Shawn Powers for free today: http://www.linuxjournal.com/ enewsletters.
WRITE LJ A LETTER We love hearing from our readers. Please send us ADVERTISING: Linux Journal is a great resource for readers and advertisers alike. your comments and feedback via http://www.linuxjournal.com/contact. Request a media kit, view our current editorial calendar and advertising due dates, or learn more about other advertising PHOTO OF THE MONTH and marketing opportunities by visiting us on-line: http://ww.linuxjournal.com/ Remember, send your Linux-related photos to advertising. Contact us directly for further information: [email protected] or [email protected]! +1 713-344-1956 ext. 2.
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 13
LJ234-Oct2013.indd 13 9/18/13 4:08 PM UPFRONT NEWS + FUN diff -u WHAT’S NEW IN KERNEL DEVELOPMENT
There recently was a flame war on “People are different. I’m not polite, the linux-kernel mailing list that and I get upset easily but generally got some attention outside the kernel don’t hold a grudge—I have these community. It started when Greg explosive emails. And that works well Kroah-Hartman complained that for some people. And it probably people were sending patches for the doesn’t work well with you. And you stable series that didn’t belong there, know what? That’s fine. Not everybody and Linus Torvalds suggested he has to get along or work well with each learn how to yell at people more; then other. But the fact that it doesn’t work Sarah Sharp said that Linus shouldn’t with you doesn’t make it ’wrong’.” And be advocating abuse. he said that the issue was really about It turned out to be an interesting “how to work together DESPITE people culture clash. Sarah posed her argument being different. Not about trying to as, “Violence, whether it be physical make everybody please each other.” He intimidation, verbal threats or verbal gave the example of Sarah’s work with abuse is not acceptable. Keep it Greg, saying that they worked a lot professional on the mailing lists.” And, with each other, probably because they “In karate, or any other sport, if your did work well together, and that that opponent is motionless on the floor, was as it should be. you stop. You can’t see the person The debate went on for a bit, and you’re emailing. You can’t see if the ultimately the two of them, and others, first conversation-disabling blow has decided to continue the discussion at completely knocked them out. You can’t the upcoming Kernel Summit, over see if you’ve misjudged their mental cookies and pot brownies. strength for the day and completely The debate interests me personally wiped out their ability to use their brain because, on the one hand, no one to correct the technical mistake you’re should ever be abused. That’s what trying to get them to fix.” abuse is—something that shouldn’t Linus posed his response as being, happen. Otherwise, it’s just an activity.
14 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 14 9/18/13 4:08 PM [ UPFRONT ]
And on the other hand (in my opinion), Linus Torvalds is the one doing the not all of his “yelling” is really abuse. flaming. So I’m interested to see what For one thing, it’s an e-mail list, and kind of public pressure ultimately will there is a long and glorious history of come to bear on Linus to stop doing flame wars on e-mail lists. People aren’t something that’s really an ordinary required to participate, even when on-line activity.—ZACK BROWN
Non-Linux FOSS: Launchy!
that runs on Windows, OS X or Linux. It listens for a predefined keystroke and then pops up a search window. You start typing the application, (Image from http://www.launchy.net) document or media file you want to With Unity’s method for launching and start, and Launchy autocompletes based finding programs and applications, and on its index of your system. The main OS X’s spotlight tool becoming the new advantage is the ability to launch a way to launch programs, the entire way program without moving your fingers we think about launching programs is from the keyboard. changing. Although I still like to have a Launchy is fast, accurate and doesn’t few icon shortcuts on my task bar, many steal lots of resources on your system. folks prefer a quick keystroke to bring up I can’t find a way to make Windows Gnome-Do, or Unity’s launcher, or even behave this way on its own, so although OS X’s spotlight. If you’re one of those Launchy is cross-platform, it probably people, but can’t seem to find a smooth will be the most useful for Windows way to accomplish your launching on users. You can download your copy Windows, check out Launchy. today at http://www.launchy.net. Launchy is an open-source dæmon —SHAWN POWERS
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 15
LJ234-Oct2013.indd 15 9/18/13 4:08 PM [ UPFRONT ]
Own Your Data with OwnCloud
faint of heart, as it requires some PHP tweaking and really should be SSL-encrypted, but for anyone comfortable with configuring LAMP applications, it’s not insurmountable. Once your server I love Dropbox. I really do. With is installed, there are native syncing a Google AdWords campaign, applications for Windows, OS X, and $50 or so, I was able to Linux, Android and iOS. Because max out my free storage. That OwnCloud is hosted on your own means I have around 24GB of server, your space limitation is based free Dropbox storage to fiddle on your actual hard drive space! with. Granted, that’s a lot, but If you’ve ever wished your Dropbox in the grand scheme of things, data was hosted on your own 24GB isn’t very much space. servers, or if you just don’t have During the past few years, I’ve enough space, check out OwnCloud. mentioned several alternatives It not only supplies file syncing, but (like SparkleShare), but the new with its extendible infrastructure, kid on the block, OwnCloud, is it also can do calendaring, sharing a Web-based application that and pretty much anything else provides a plethora of cloud-based you’d want to do with cloud services. The most popular is its computing. Check it out today file syncing. at http://www.owncloud.org. Setting up OwnCloud isn’t for the —SHAWN POWERS
16 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 16 9/18/13 4:08 PM [ UPFRONT ]
Surf Safely with sshuttle
your system firewall to tunnel all (yes all) traffic through a remote SSH connection. The remote connection doesn’t even need administrator privileges, so your shell account at your Web host might suffice for securing your traffic in a hotel or coffee shop. sshuttle will even tunnel your DNS lookups, which In past issues, I’ve explained how to means your entire network interaction set up a SOCKS proxy with SSH. I’ve should be secure and encrypted. demonstrated how to tunnel traffic sshuttle is in many OS repositories, with SSH. I’ve even shown how to or you can downloaded it from circumvent a company firewall with https://github.com/apenwarr/sshuttle. SSH. I’ve never been able to use SSH With a simple sudo sshuttle completely as a VPN, however, and --dns -vvr username@server that’s always bummed me out—until 0/0, all your traffic will be encrypted I discovered sshuttle. and funneled through the remote Mind you, sshuttle isn’t a new server. Because DNS also is tunneled, program. It isn’t even a new concept. it means you won’t be vulnerable What it is, however, is pure awesome. to DNS poisoning either! Check out Basically, launching the sshuttle sshuttle today. You won’t be sorry. binary with root privileges will modify —SHAWN POWERS
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 17
LJ234-Oct2013.indd 17 9/18/13 4:08 PM [ UPFRONT ]
Mapping Your GIS Data
I’ve already looked at some GIS package management systems. If applications available on Linux. not, you always can download the Programs like GRASS and qgis sources and build it from scratch. provide a full set of tools to do It does depend on Python, among GIS. Sometimes, that’s really several other libraries, so you overkill though. You may just want need to do a bit of a dependency to display some data geographically dance. Binary downloads even are and create a map. For those cases, available for Windows and Mac there is Thuban, an interactive OS X, so you can point your geographic data viewer non-Linux friends to them. (http://thuban.intevation.org). If you don’t already have data Most distributions should have of your own, sources of public- a package available within their domain GIS data are available
Figure 1. Starting Thuban gives you a blank slate.
18 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 18 9/18/13 4:08 PM [ UPFRONT ]
on-line. Here are a couple: simply grabbed several of the data http://www.naturalearthdata. files available on-line. com/features and http://wiki. When you start Thuban, you end openstreetmap.org/wiki/Shapefiles. up with a completely blank slate The files available on these sites (Figure 1). The first step is to start will get you started with SHP files a new session, which you can do by that contain at least basic features selecting the menu item File→New for most of the world. Session (not much will change on the Thuban is not as flexible as full- screen). In order to start building your fledged GIS software and cannot map, you need to add layers that can handle very many data file formats. be manipulated. I started by selecting You can use SHP files, DBF database the menu item Map→Add Layer and files and various image file formats. adding in an SHP file to give me the In the screenshots for this article, I basic geographic attributes for my
Figure 2. Adding a new layer opens a file selection dialog where you can choose an SHP file.
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 19
LJ234-Oct2013.indd 19 9/18/13 4:08 PM [ UPFRONT ]
Figure 3. By default, Thuban just displays all of the data with a single symbol color.
home province of New Brunswick the Generate Class button. The (Figure 2). This includes several Generate Classification window different geographical items, such will pop up, where you can click as water, river banks and parks. The on the Retrieve From Table button default display is not very interesting to get a list of the possible values. yet (Figure 3). I accepted the default gray-scale You can edit the way a layer is mapping for the colors, giving four displayed either by double-clicking new entries in the layer properties. the layer within the list in the But this is not very interesting legend pane or by right-clicking either, yet. Selecting each of the the layer of interest and selecting new properties, you can edit the Properties. This will pop up a new symbol and change the colors for window (Figure 4). In this case, I each of the types (Figure 5). If you selected the “type” field within want to have a preview of what the classification pane. The easiest this will look like, you can click choice at this point is to click the Try button. If it doesn’t quite
20 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 20 9/18/13 4:08 PM [ UPFRONT ]
Figure 4. Each layer has a properties window where you can control how the data gets displayed.
look right, you always can click the has several different attributes to Revert button to undo the changes play with. For now, I selected four and try something else. different road types and highlighted Although every map begins with them with four different colors. a single layer, it is very rare that There is still a default color for any a single layer is enough to show road types other than the four I all the details you may want to selected. To make them go away have displayed. In this example, I on the map, you can select the don’t have any roads on my map. default property and simply make A separate SHP file is available that it transparent. Then, only the four has this information, however. So, I selected road types will show up. clicked on the menu item Map→Add Now the map is starting to look a Layer and added the file roads.shp. bit more interesting, and I need to Opening up the properties dialog start worrying about what order the shows that this particular SHP file layers are in.
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 21
LJ234-Oct2013.indd 21 9/18/13 4:08 PM [ UPFRONT ]
Figure 5. Using the Generate Class button is a shortcut to get you started.
Thuban will draw layers in the To manipulate the map itself, order they appear in the legend list, Thuban uses a sort of mode system. starting at the bottom and working To zoom in, you need to select the its way up. You can move a particular zoom button. Then, you either can layer up our down by selecting it and use click and drag to select a region then using the buttons at the top of to zoom in on or simply click a spot the legend pane. on the map to re-center and zoom Another type of layer you can use in. Once you have zoomed in, you is an image layer. Obviously, the can use the pan tool to move the image needs to be geo-referenced view window around the map to in some way. Thuban supports the highlight different regions. There geoTIFF file format. If you place are buttons to zoom you to specific your image at the bottom of the scales such that the entire map is layer list, you then can draw on top visible. This always takes you back of it with the data in the SHP files. to the default map view.
22 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 22 9/18/13 4:08 PM [ UPFRONT ]
Two tools allow you to work with individual They Said It elements from an SHP file. The first is an information tool that pops up a detail window for any element you select. The My home is not a second is a label tool. When you select an place, it is people. element, a dialog window pops up allowing —Lois McMaster you to select one of the properties to be Bujold displayed as a label. Once you have a map you’re happy with, The middle of you probably will want to save it for later the road is where use. Because Thuban works with sessions, all the white line of your work in generating the map will be is—and that’s saved as a session within Thuban, as long as the worst place you remember to save it by clicking the menu to drive. item File→Save Session. —Robert Frost But, this doesn’t help much if you want to use your map outside Thuban. There is The future will be an option to export a map as an SVG file by better tomorrow. using the menu item Extensions→Write SVG —Dan Quayle Map. This is not the most efficient output available, however. My simple example here Some have been blew up to more than 50MB for a single map thought brave with two layers. because they The other option is to print your map. were afraid to Although you can print to actual paper, run away. for a hard copy, you also can print to a file —Thomas Fuller using the generic PostScript printer. This generates a PostScript file that will be a Reading is bit more manageable. You also can convert no substitute this PostScript file to other formats with for action. relative ease. So, to get a PDF of your map, —Colleen you can print to a PostScript file and then Wainwright convert it to PDF with the ps2pdf utility. Now you have a map that you can share with friends and family.—JOEY BERNARD
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 23
LJ234-Oct2013.indd 23 9/18/13 4:08 PM [ EDITORS' CHOICE ]
™
Dude, Where’s EDITORS’ CHOICE My Car? ★ When my family moved to Grand Rapids, Michigan, last year, one of the biggest adjustments was dealing with city parking. While we usually remember what side of the mall we parked on, there was a time downtown that I couldn’t remember what parking garage we used, much less what level or spot. Thankfully, I had the parking ticket in my pocket, which included the address for the particular parking lot we used. Although we had to walk up 15 levels one by one to find the car, at least we knew it was there somewhere! If you’ve ever walked around a parking lot wondering if you were the victim of theft, or possibly going senile, Valet is the perfect app for you. It not only
24 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 24 9/18/13 4:08 PM remembers the GPS location of (Maybe that’s just me.) your parked car, but it also has In fact, Valet fills such a simple a timer to remind you of parking yet helpful purpose, it’s earned meter timing. Plus, if your car has this month’s Editors’ Choice award. Bluetooth connectivity, Valet will Its automatic tracking based on record where you left your car vehicle Bluetooth is really the without any interaction on your feature that puts it over the top for part. It just marks the location me. It’s the best $0.99 I’ve spent where Bluetooth disconnected, and in a while. You can find it at the it happily guides you back when Google Play store, or check out the you’ve finished spending your Web site: http://valetapp.co. paycheck at Teavana in the mall. —SHAWN POWERS
Linux JournaL on your e-Reader
Customized e-Reader editions Kindle and Nook editions FREE for Subscribers now available
LEARN MORE
LJ234-Oct2013.indd 25 9/18/13 4:08 PM COLUMNS AT THE FORGE
Zurb REUVEN M. LERNER Foundation Designing a responsive Web site? Zurb Foundation is a worthy competitor to Twitter Bootstrap.
I was recently speaking with a new in many ways. But it really hadn’t client about a consulting project, and registered much on my radar, and we were discussing the technologies I hadn’t paid much attention to it. we were going to use. I said, “So, I It turns out that I should have been assume that we’ll be using Twitter paying attention. Zurb is a worthy Bootstrap as a CSS framework, competitor to Bootstrap, and it has right?” Bootstrap, of course, is the some advantages that make it more open-source CSS framework written appropriate in some cases. in the LESS language that recently So in this article, I take a look at released its third version, which has Zurb Foundation, considering it both become wildly popular among Web as a standalone CSS framework and as developers. I’ve used Bootstrap on something you can use from within an a number of projects in the past application framework, such as Ruby few years, and I’ve been pleasantly on Rails. Zurb recently released version surprised to discover just how easily 4 of the Foundation framework, I could implement layouts, menus and although it is not as popular as and sidebars, as well as produce Bootstrap, the people who are using nice-looking tables and buttons. it seem to be quite passionate about I was surprised when the client its advantages. said, “No, we’re actually using Zurb Foundation.” Now, I had heard of Foundation Basics Foundation before. Zurb is a Web If you aren’t yet familiar with CSS design company based in California, frameworks, the idea is pretty whose Foundation framework straightforward. When you want to preceded and inspired Bootstrap lay out a Web application, you likely
26 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 26 9/18/13 4:08 PM COLUMNS AT THE FORGE
will want some headlines, some text, use Foundation. some sidebars, a menu and all sorts How can you use Zurb Foundation? of other design elements. You could Download the package. You have design the entirety of the layout, several options, but the easiest one classes and CSS from scratch each is to use the precompiled CSS files. time. Or, you could use predefined Go to the Zurb Foundation download styles, designed to work with all sites, site at http://foundation.zurb.com/ with a great deal of flexibility. download.php, and from there, Each modern CSS framework click on the button for “download functions in this same way. You put Foundation CSS”. text into divs and give each div a class If you want to change the defaults, indicating how many columns across you could download the SCSS version it should be, up to the maximum and do it that way. Alternatively, the number of columns defined by the good people at Zurb have provided framework. Foundation offers 12 a Web-based selection system, such columns, meaning that you can lay that you can indicate what parts of out your design in one very wide Foundation you want, as well as which column, two equally sized columns colors and styles. The CSS that you (6+6) or even something wilder, download then will be precompiled, such as 3+4+5. customized according to your needs. Foundation, like other modern If you download the simple CSS frameworks, goes way beyond version and open the resulting zipfile, just providing you with a nice a sample HTML page (index.html) grid. It also gives you control over will be at the top level of the navigation elements and forms, and folders. There also will be several even gives you some JavaScript- subfolders, whose names are fairly based elements for displaying self-explanatory: js (JavaScript), css images and dialog boxes. (stylesheets) and img (images). The bulk of Foundation is Looking at the HTML page, you implemented using SCSS, a modern can see that Foundation is loaded in implementation of SASS. SCSS five steps: is a superset of CSS that can be 1) First, you load the core Foundation compiled (using an open-source tool) CSS file: into regular CSS files. However, you don’t need to know SCSS in order to
WWW.LINUXJOURNAL.COM / OCTOBER 2013 / 27
LJ234-Oct2013.indd 27 9/18/13 4:08 PM COLUMNS AT THE FORGE
Now, this is definitely a long and I’ve covered Modernizr in this column complex CSS file. However, remember before; it allows you to test for certain that this defines all of the styles, HTML5 features and use alternatives for all of the aspects of Foundation. if the feature doesn’t exist. You can Moreover, this is the result of use Modernizr in your application translating the SCSS source into CSS; if you wish, but it’s loaded here so expressed as SCSS, the file is much that Foundation can handle different shorter and easier to understand. browser versions. 2) After loading the Foundation 3) Next, you load the JavaScript CSS file, you then load Modernizr. for Foundation. But here, things
Listing 1. Hello, world
Hello, world headline
Hello, world paragraph
28 / OCTOBER 2013 / WWW.LINUXJOURNAL.COM
LJ234-Oct2013.indd 28 9/18/13 4:08 PM COLUMNS AT THE FORGE
get a bit more interesting. Rather the page before loading and executing than a
This should constantly refresh