CoffeeScript | Git | Facebook | LSB | Beowulf | Unison

™ Writing Facebook Applications

Understanding and Using Git

Since 1994: The Original Magazine of the Community Use AUGUST 2011 | ISSUE 208 | www.linuxjournal.com Podcasts to Share BUILD A Your Linux BEOWULF Knowledge HPC SYSTEM with the Add Nagios FedoraLiveCD Notifications Project to Your Screen Window LINUX STANDARD Make BASE JavaScript and Its Role Programming in the Easy with Community HOW TO PLAN CoffeScript YOUR OWN LINUX EVENT WITH GARETH GREENAWAY OF SCALE

$5.99US $5.99CAN HOW-TO: 08 UNISON THE FILE

SYNCHRONIZATION PROGRAM 0 09281 03102 4 10 Gig On Board

Blazing Fast, Embedded 10Gb Ethernet

10G Rackmount Servers in the iX-Neutron server line feature the Intel® Xeon® Processor 5600/5500 Series, and come with 10GbE networking integrated onto the motherboard. This eliminates the need to purchase an additional expansion card, and leaves the existing PCI-E slots available for other expansion devices, such as RAID controllers, video cards, and SAS controllers.

For more information on the iX-1204-10G, or to request a quote, visit: http://www.iXsystems.com/neutron

30% cost savings/port over equivalent Dual- Port 10 GB PCI Express add-on card solution KEY FEATURES:

IPMI NIC . Supports Dual 64-Bit Six-Core, Quad- Core or Dual-Core, Intel® Xeon® Processor 5600/5500 Series GigE NICS . 1U Form Factor with 4 Hot-Swap SAS/ 10GbE NICS SATA 3.5” Drive Bays . Intel® 5520 chipset with QuickPath Interconnect (QPI) . Up to 192GB DDR3 1333/1066/800 SDRAM ECC Registered Memory (18 DIMM Slots) . 2 (x8) PCI-E 2.0 slots + 1 (x4) PCI-E 2.0 (in x8 slot -Low-Profile - 5.5” depth) . Dual Port Intel® 82599EB 10 Gigabit SFP+ - Dual Port Intel® 82576 Gigabit Ethernet Controller . Matrox G200eW Graphics . Remote Management - IPMI 2.0 + IP-KVM with Dedicated LAN . Slim DVD 10Gb Ethernet . 700W/750W Redundant AC-DC 93%+ Adapters High-Efficiency Power Supply

Call iXsystems toll free or visit our website today! 1-855-GREP-4-IX | www.iXsystems.com

Intel, the Intel logo, Xeon, and Xeon Inside are trademarks or registered trademarks of Intel Corporation in the U.S. and/or other countries. 1&1 DUAL HOSTING

No other web host offers more expertise, know- how and quality service than 1&1.  Double Security: Your website is simultaneously hosted in 2 locations in our high tech data center!  High-speed Global Network: 210 GBit/s Connectivity  Environmentally Responsible: 100% Renewable Energy  Solid Technical Foundation: 1,000 In-house Developers

SUMMER SPECIAL: 1&1 DUAL ADVANCED PACKAGE & * 1 YEAR FREE! Q2 FREE Domains QUNLIMITED Traffi c QASP, .NET, AJAX, LINQ, PHP5, Perl, SSI QFREE Private Domain Registration QDNS Management Q5 Microsoft® SQL Databases Q500 E-mail Accounts Q1&1 SiteAnalytics Q24/7 Toll-free Customer Support Q50 FTP Accounts Q1&1 WebsiteBuilder

Need more domains? ® .com with FREE Private Registration just $4.99/fi rst year.*

1-877-GO-1AND1 www.1and1.com 1-855-CA-1AND1 www.1and1.ca

* 24 month minimum contract term required for Dual Advanced offer. Set-up fee and other terms and conditions may apply. .com offer valid fi rst year only. After fi rst year, standard pricing applies. Visit www.1and1.com for full promotional offer details. Program and pricing specifi cations and availability subject to change without notice. 1&1 and the 1&1 logo are trademarks of 1&1 Internet AG, all other trademarks are the property of their respective owners. © 2011 1&1 Internet, Inc. All rights reserved. AUGUST 2011 CONTENTS Issue 208

FEATURES 34 A CONFERENCE PRIMER WITH GARETH GREENAWAY Geek Wrangling 101, with an expert. Shawn Powers 42 FACEBOOK APPLICATION DEVELOPMENT Port your Web app to Facebook. Mike Diehl 48 LINUX STANDARD BASE: STATE OF AFFAIRS LSB and what it means for the Linux community. Jeff Licquia, Stew Benedict and Vladimir Rubanov 54 GIT A guide to what many consider the best version control tool ever created. Henry Van Styn

ON THE COVER • How to Plan Your Own Linux Event with Gareth Greenaway of SCALE, p. 34 • Writing Facebook Applications, p. 42 • Understanding and Using Git, p. 54 • Build a Beowulf HPC System with the FedoraLiveCD Project, p. 64 • Linux Standard Base and Its Role in the Community, p. 48 • Use Podcasts to Share Your Linux Knowledge, p. 60 • Add Nagios Notifications to Your Screen Window, p. 24 • Make JavaScript Programming Easy with CoffeeScript, p. 16 • How-To: Unison the File Synchronization Program, p. 73

2 | august 2011 www.linuxjournal.com They say work smarter, not harder. They must be using our processor.

The next generation of intelligent server processors The Intel® Xeon® processor 5600 series automatically regulates power consumption to combine industry-leading HQHUJ\HIÀFLHQF\ZLWKLQWHOOLJHQWSHUIRUPDQFHWKDWDGDSWV to your workload. Check out the new intelligent features of the Xeon® 5600 at intel.com/itcenter.

Servers from iXsystems feature the Intel® Xeon® processor 5600 series.

iX2216-10G

5IFiX2216-10GGFBUVSFTEVBMPOCPBSE t%VBM*OUFM® Xeon® 5600 Series Processors *OUFM®&#(JHBCJU4'1 1PSUT  t6'PSN'BDUPSXJUITJYUFFO4"44"5")PU4XBQ ® EVBMPOCPBSE*OUFM (JHBCJU1PSUT  %SJWF#BZT Enterprise Servers BOE%*..TMPUTTVQQPSUJOHVQUP(# t0O#PBSE%VBM1PSU*OUFM®&#(JHBCJU4'1 for Open Source PG%%3&$$3FHJTUFSFENFNPSZ*EFBMGPS www.iXsystems.com )1$ %BUB$FOUFS 7JSUVBMJ[BUJPO $MVTUFSJOH  1-855-GREP-4-IX BOE$MPVE$PNQVUJOHBQQMJDBUJPOT iX1204-10G 5IFiX1204-10GGFBUVSFTUIFMBUFTU*OUFM® ® Xeon® 5600 Series Processors Intel is not responsible for and $16TCBTFEPOUIFONBOEON t%VBM*OUFM has not verifi ed any statements OFYUHFOFSBUJPONJDSPBSDIJUFDUVSF5IFOFYU t6'PSN'BDUPSXJUI)PU4XBQ4"44"5"%SJWF#BZT or computer system product- TUFQJOJOUFMMJHFOUQFSGPSNBODF BVUPNBUFE t0O#PBSE%VBM1PSU*OUFM®&#(JHBCJU4'1 specifi c claims contained herein. FOFSHZFGýDJFODZ BOEþFYJCMFWJSUVBMJ[BUJPO

© 2010, Intel Corporation. All rights reserved. Intel, the Intel logo, Intel Sponsors of Tomorrow, Intel Xeon, and Xeon Inside are trademarks of Intel Corporation in the U.S. and other countries. *Other names and brands may be claimed as the property of others. AUGUST 2011 CONTENTS Issue 208 COLUMNS 16 Reuven M. Lerner’s At the Forge Introducing CoffeeScript

22 Dave Taylor’s Work the Shell Calculating Day of the Week

24 Kyle Rankin’s Hack and / Nagging Notifications

77 Kyle Rankin and Bill Childers’ Tales from the Server Room It’s Always DNS’s Fault! 30 BLU-RAY

80 Doc Searls’ EOF First Brazil, Then the World INDEPTH 60 Podcasting Do you know something about Linux? A podcast is an excellent way to share your knowledge with others. Charles Olsen 64 How to Build a Beowulf HPC System Using the FedoraLiveCD Project Build a -based Beowulf Cluster using a 73 UNISON kickstart file and tools from the FedoraLiveCD project. Howard Powell 69 Radio Dramas in Linux Tips and tricks for creating radio dramas with open-source software. Dan Sawyer 73 Unison, Having It Both Ways The file synchronization tool that supports bidirectional updates of files and directories. Adrian Klaver

IN EVERY ISSUE 8 Current_Issue.tar.gz 10 Letters 12 UPFRONT 28 New Products 30 New Projects 69 RADIO DRAMAS 65 Advertisers Index 79 Marketplace

USPS LINUX JOURNAL (ISSN 1075-3583) (USPS 12854) is published monthly by Belltown Media, Inc., 2121 Sage Road, Ste. 310, Houston, TX 77056 USA. Periodicals postage paid at Houston, Texas and at additional mailing offices. Cover price is $5.99 US. Sub scription rate is $29.50/year in the United States, $39.50 in Canada and Mexico, $69.50 elsewhere. POSTMASTER: Please send address changes to Linux Journal, PO Box 16476, North Hollywood, CA 91615. Subscriptions start with the next issue. Canada Post: Publications Mail Agreement #41549519. Canada Returns to be sent to Pitney Bowes, P.O. Box 25542, London, ON N6C 6B2

4 | august 2011 www.linuxjournal.com More TFLOPS, Fewer WATTS Microway delivers the fastest and greenest floating point throughput in history 2.5 TFLOPS

Enhanced GPU Computing with Tesla Fermi 480 Core NVIDIA® Tesla™ Fermi GPUs deliver 1.2 TFLOP single precision & 600 GFLOP double precision performance! New Tesla C2050 adds 3GB ECC protected memory New Tesla C2070 adds 6GB ECC protected memory Tesla Pre-Configured Clusters with S2070 4 GPU servers WhisperStation - PSC with up to 4 Fermi GPUs OctoPuter™ with up to 8 Fermi GPUs and 144GB memory

New Processors  12 Core AMD Opterons with quad channel DDR3 memory 8 Core Intel Xeons with quad channel DDR3 memory Superior bandwidth with faster, wider CPU memory busses Increased efficiency for memory-bound floating point algorithms

Configure your next Cluster today! 10 TFLOPS 5 TFLOPS www.microway.com/quickquote 508-746-7341

FasTree™ QDR InfiniBand Switches and HCAs

45 TFLOPS 36 Port, 40 Gb/s, Low Cost Fabrics Compact, Scalable, Modular Architecture Ideal for Building Expandable Clusters and Fabrics MPI Link-Checker™ and InfiniScope™ Network Diagnostics

FasTree 864 GB/sec Achieve the Optimal Fabric Design for your Specific Bi-sectional Bandwidth MPI Application with ProSim™ Fabric Simulator Now you can observe the real time communication coherency of your algorithms. Use this information to evaluate whether your codes have the potential to suffer from congestion. Feeding observed data into our IB fabric queuing-theory simulator lets you examine latency and bi-sectional bandwidth tradeoffs in fabric topologies.

GSA Schedule Contract Number: GS-35F-0431N

pC2_Microway.indd 1 7/15/10 9:20:43 AM 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

Proofreader Geri Gale

Publisher Carlie Fairchild [email protected]

General Manager Rebecca Cassity [email protected]

Senior Sales Manager Joseph Krack [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 PHONE: +1 818-487-2089 FAX: +1 818-487-4550 TOLL-FREE: 1-888-66-LINUX MAIL: PO Box 16476, North Hollywood, CA 91615-9911 USA Please allow 4–6 weeks for processing address changes and orders PRINTED IN USA

LINUX is a registered trademark of Linus Torvalds. Learn Drupal & jQuery FROM THE COMFORT OF YOUR LIVING ROOM

The Lullabot Learning Series includes everything you need to become a Drupal & jQuery expert from the comfort of your living room! The videos are available in both DVD format and high-defi nition video download. Purchase the videos at http://store.lullabot.com Current_Issue.tar.gz

I’ll Be in My Hole

ech folks tend to get a bad rap as basement- are standards and collaboration. The Linux Standards dwelling creatures unable to function in Base attempts to keep the various flavors of Linux T polite society. And really, that’s true for only compatible with each other. Sometimes that works 80% of us. Of course, I’m teasing, but it’s hard to better than others, but we have the current “State deny Linux users and open-source enthusiasts tend of Affairs” regarding the LSB for you this month. to belong to unique communities. We thought it Jeff Licquia, Stew Benedict and Vladimir Rubanov SHAWN POWERS might be nice to focus on our Linux community this provide an overview of the LSB and talk about how month, and so the articles you’re about to read to be compliant. Henry Van Styn follows them up should feel as cozy as a Hobbit hole. with an article on Git. Once a group of people start Reuven M. Lerner knows his audience and to collaborate on software, revision control is vital. introduces a new programming language called Henry discusses Git and how its distributed model CoffeeScript. The coffee-/java-/bean-naming makes it so powerful. convention is nothing new, but CoffeeScript makes As magazine publishers, we surely understand JavaScripting fun and easy. If you’ve ever been the importance of communication when it comes frustrated with JavaScript, you’ll want to read Reuven’s to community. With the Linux world, however, we article. Following that, Dave Taylor continues his communicate in multiple ways. One of those methods, series on determining the day of the week. If you which is near and dear to my heart, is podcasting. truly do live in a basement or Hobbit hole, you Kyle Rankin and I do the Linux Journal Insider podcast might need your computer to determine what day every month, and if we can do it, you can do it. it is, as sunlight might be a rare sight. Charles Olsen walks through the process of creating Kyle Rankin doesn’t help the geek stereotype a podcast from the planning stages all the way to when everything he does is within a single, dark the publishing stages. Content, of course, is up to console window. Kyle uses a screen session to connect you. Dan Sawyer takes a slightly different angle, to his favorite programs (all command-line) from and instead of podcasting, he shows how to edit anywhere. This month, he shows how to get Nagios radio dramas. If you tend to make stuff up in your to send notifications to a screen session instead of podcast, you already may be walking the line e-mail or SMS messages. Bill Childers is back with us between fact and fiction, so we wanted to make this month as well, and he and Kyle continue their sure you were prepared either way. new column, Tales from the Server Room. If you’re What group of geeks would be worth their a sysadmin, you’ll probably relate to their misery and salt without allowing their computers to form a maybe learn something along the way. community as well? Whether you want multiple No community is a community without gatherings. computers to share a filesystem with Unison (Adrian Granted, in our world, those gatherings often are Klaver shows how), or if you want your systems in IRC rooms or in on-line forums. We do have our to form a cohesive community of their own in a meatspace meetups, however, and if you’ve never Beowulf cluster (Howard Powell describes how to do been to a LinuxFest, I highly recommend attending it with Fedora Live CDs), this issue has you covered. one. This month, I interview Gareth Greenaway We’ve also got the full lineup you expect every month. from the Southern California Linux Expo (SCALE) UpFront articles, new product announcements—lots and ask him what it takes to host a Linux confer- of goodies to soothe your geek itch. And, of course, ence. Gareth is easy to talk to, and he has some if the thought of being a part of the Linux community practical advice for anyone interested in attending a offends you, well, feel free to read this magazine by LinuxFest or even hosting their own. To contrast the yourself. We won’t tell.I idea of getting together in person, Mike Diehl talks about Facebook application development. Whether Shawn Powers is the Associate Editor for Linux Journal. He’s also the Gadget you’re interested in integrating services or creating Guy for LinuxJournal.com, and he has an interesting collection of vintage a new zombie-pony-themed Farmville, you’ll want Garfield coffee mugs. Don’t let his silly hairdo fool you, he’s a pretty ordinary to read Mike’s article. guy and can be reached via e-mail at [email protected]. Or, swing Some of the core values of our Linux community by the #linuxjournal IRC channel on Freenode.net.

8 | august 2011 www.linuxjournal.com

letters

production logs on hosts behind a load low-power television stations. His under- balancer. You don’t have to set up standing of the situation is that the FCC handlers like swatch, and you also can dictates to broadcasters the power just use chip to see of all of your logs at which they can transmit based on like a pimped version of tail. several technical factors. Those factors include things like terrain, desired broadcast I’ve used it here at Yahoo pretty frequently coverage, distance from other broadcasts during the past month for deployments running on close frequencies and so on. and bug investigations. In fact, the FCC sometimes will dictate that the signal can’t be broadcasted Here’s a blog post, if you’re omnidirectional. I’m close to the Canadian interested: codefury.net/2011/04/ border, and some stations are not allowed video-chip-a-log-file-monitor-multiplexer. to broadcast toward Canada. -- Kenny Katzgrau Before researching, my guess was that broadcast power was based on fees paid Thanks Kenny. Sharing tools is one of to the FCC. As it turns out, that’s not the the things that makes the Open Source case. The fees do vary widely based on community so great. I appreciate you location, however, and usually frequencies sharing with us!—Ed. are auctioned off to the highest bidder.

May 2011 Cover Receiving Digital TV Signals, Finally, you might want to check out My manga reading/drawing daughter saw No Longer Analog Signals www.antennaweb.org. It offers some the cover of the May 2011 issue of LJ and Regarding the new digital TV world: I am great tools to help you get the best asked me why there was manga on it. I told receiving three stations via digital signal on possible reception.—Ed. her, “Linux is just cool like that!” Then, she my digital-to-analog-converter TV, with my asked if there was an article about manga outdoor antenna. Two other stations, in 777 Permissions in the magazine. I told her about past issues the same area, hardly come in at all. The While reading the article titled “Numeric covering Blender, GIMP and so on, which first group transmits at 1MW power; the Relativity” by Joey Bernard on page 14 prompted a discussion about the great other group transmits at only 0.25MW of the May 2011 issue, I was a little open-source software she uses every day. power. My signal strength meter seems disappointed to notice that the instruc- consistent with these numbers (above). tions for installing the Einstein Toolkit Thanks for the great cover! My question is, why is hardly anything contain a chmod 777. Being a systems -- written on the transmit power of the administrator, this made my eye twitch Eric Miller sending stations? Why do some “stations” a bit. The world write bit should be get to transmit at 1MW, while others can used only under rare circumstances. In That’s awesome! It’s great when things like transmit only at one-fourth of this? All fact, I would argue that it should be cover art can make Linux relevant for people the complaints about digital TV signals used only for common storage locations, who otherwise might not care.—Ed. abound, but nobody ever seems to such as /tmp, and even then, it should mention the power used by the sending be accompanied by the sticky bit (that Utility I Wrote (Open Source, stations to send their signals. I believe this is, 1777). In most cases, 700 or 755 of Course) has to be the main reason for fair-to-bad permissions are most appropriate. I’m a longtime reader and fan of LJ, TV receptions of digital signals, not all -- and I thought you might be interested the malarkey you read—for example, Elliott Forney in a tool I wrote for system admins and airplanes, leaves, slight temperature developers named chip. It’s basically changes and so on. I get better reception Sky Survey Using Linux a logfile multiplexer and monitor: in cold, cloudy, rainy weather than on There’s an incredible survey of the entire https://github.com/katzgrau/chip. “nice days”! And, I live more than 60 night sky, using a laptop powered by miles from the transmitters of these five Fedora Linux, and I thought Linux Journal I remember you wrote about swatch stations. Who decides who gets what MWs? readers may be interested: skysurvey.org. (www.linuxjournal.com/article/4776), -- -- and chip basically does what swatch does, R. E. Mackey Jim Gagnon but additionally, it can do it on multiple remote files. That becomes super handy I didn’t know the answer to this, so I How cool! Thanks for the link.—Shawn, when you want to monitor multiple called a friend of mine who manages local the space nut.

10 | august 2011 www.linuxjournal.com Linux to the Rescue! started with the home-schooling community Situation: 1998-vintage Compaq small-form- in Ontario, Canada. What “Baby Penguins” factor desktop (Pentium-II 400MHz) running are you going to target? Fedora Core 5 as a home firewall/DHCP/DNS -- server. After a power failure, it refuses even Dean Anderson to POST. The lights come on, but nobody’s home. I’d buy a used Dell SFF system to You’re totally preaching to the choir here, At Your Service replace it, but I’m looking at several hours of as I’ve been pushing Linux in education for work to install and configure with Fedora more than a decade. (I am the Technology 14. There goes my evening plans, sigh. Director for a school district in Michigan.) MAGAZINE I didn’t know about Japan and coffee, PRINT SUBSCRIPTIONS: Renewing your Brilliant idea: move the old hard disk to the but it’s a great story and encouraging for subscription, changing your address, paying your new system and see what happens, but I’m those of us in the trenches. I do hope the invoice, viewing your account details or other quite skeptical based on my experiences next generation “gets it” when it comes subscription inquiries can instantly be done on-line, with Windows and changing out hardware. to the advantages Linux and open source www.linuxjournal.com/subs. Alternatively, can provide. Great job!—Ed. within the U.S. and Canada, you may call us toll-free 1-888-66-LINUX (54689), or Result: it boots! It works! Nary a hiccup. internationally +1-818-487-2089. E-mail us at I’m back in business in 15 minutes. I got Dropbox [email protected] or reach us via postal mail, my evening back, thanks to Linux. I received the June 2011 issue of LJ today, Linux Journal, PO Box 16476, North Hollywood, CA and as usual, I proceeded to read it cover 91615-9911 USA. Please remember to include your -- complete name and address when contacting us. Jim Garrison to cover on the day it arrived. I immediately noticed your article on Dropbox, as it is an DIGITAL SUBSCRIPTIONS: Digital subscriptions I feel obliged to recommend a system integral part of my daily toolkit. of Linux Journal are now available and delivered as PDFs anywhere in the world for one low cost. upgrade, as FC5 reached end of life back in Visit www.linuxjournal.com/digital for more 2007. I also feel obliged to note how awe- For my part, I find one of the key uses of information or use the contact information above some it is that a system running FC5 still is Dropbox is to turn regular desktop applica- for any digital magazine customer service inquiries. running well! And, you gotta love Linux. It tions into Web-synchronized applications. As LETTERS TO THE EDITOR: We welcome makes most hardware, “just work”.—Ed. many LJ readers do, I work across different your letters and encourage you to submit laptops and desktops, but I would like to them at www.linuxjournal.com/contact or It Starts with the Kids keep some key apps immediately available, mail them to Linux Journal, PO Box 980985, A few years ago, I read a book called The with the same data, no matter where I am Houston, TX 77098 USA. Letters may be edited Culture Code by Clotaire Rapaille. One working, such as time-tracking and my to-do for space and clarity. concept that he explained intrigued me. list. There are many Web-based solutions for WRITING FOR US: We always are looking He described how in the 1970s, Japan’s this, but I found a couple client applications for contributed articles, tutorials and real- consumption of coffee was 0%. If you I prefer to use for their feature sets. world stories for the magazine. An author’s guide, a list of topics and due dates can be were to go to a restaurant and ask for found on-line, www.linuxjournal.com/author. coffee, it was not on the menu. How do For time-tracking, I use Klok 2 you impose a new beverage into a nation (www.getklok.com), and for task lists, ADVERTISING: Linux Journal is a great that does not have coffee in its vocabulary? I use Task Coach (www.taskcoach.org). resource for readers and advertisers alike. Request a media kit, view our current You start by making candies infused with By moving the data files for these applica- editorial calendar and advertising due coffee flavor. Who eats these candies? tions into Dropbox, I immediately have my dates, or learn more about other advertising Children. This is exactly what was done. time-tracking and to-do lists synchronized and marketing opportunities by visiting us They whet a generation’s appetite with caf- across all my working environments. on-line, www.linuxjournal.com/advertising. Contact us directly for further information, feine, and in around the year 2000, coffee Thanks Dropbox for the synchronizing [email protected] or +1 713-344-1956 ext. 2. accounted for billions and billions of Japan’s feature, and thanks to the Linux Journal GDP. What is my point? Next paragraph. team for a great publication. -- Last month, I was honored with the oppor- Randy Earl ON-LINE tunity to expose home-schooling parents WEB SITE: Read exclusive on-line-only content on to a presentation on “Free Software to I use Dropbox in a similar way as well! Linux Journal’s Web site, www.linuxjournal.com. Augment your Child’s Learning”. In this I find it works great to sync Pidgin prefer- Also, select articles from the print magazine presentation, I attempted to cover various ences, so I don’t need to enter all my are available on-line. Magazine subscribers, digital or print, receive full access to issue open-source projects as well as operating account information on each computer I archives; please contact Customer Service for systems that are freely available to everyone. use. I also keep my desktop background further information, [email protected]. If we start to infuse the idea of Linux and photos (all space photos from NASA) FREE e-NEWSLETTERS: Each week, Linux open source in the conscience of the in sync, so they are available on every Journal editors will tell you what's hot in the world generation coming after us, maybe, just computer. Syncing is awesome technology, of Linux. Receive late-breaking news, technical tips maybe, Linux would be synonymously in and I really look forward to open-source and tricks, and links to in-depth stories featured the minds of people when they say “PC”, tools maturing to the point that they on www.linuxjournal.com. Subscribe for free instead of the other OSes available. I’ve rival Dropbox’s abilities.—Ed. today, www.linuxjournal.com/enewsletters.

www.linuxjournal.com august 2011 | 11 UPFRONT NEWS + FUN diff -u WHAT’S NEW IN KERNEL DEVELOPMENT

This edition of diff -u is dedicated to David Brownell, a kernel hacker who XBMC, Now gave a lot his time and creativity to Linux, and a lot of help and encouragement with Less XB! to many open-source developers. Rest in peace, David. May your name linger long in the source tree. Xbox Media Center (XBMC) is Pekka Enberg has been working on a helpful virtualization tool to make one of those projects whose it relatively straightforward to boot a virtual system on a running Linux box. There name makes less and less sense are various virtualization tools available, but Pekka says this one is intended to as time goes on. Sure, people still be a clean, lightweight alternative that anyone could use. Tony Ibbs has released KBUS, available at kbus-messaging.org. It’s a mes- are using XBMC on an actual sage-passing framework, intended to support software running on embedded Microsoft Xbox, but for the most systems. The main idea is that it will be very reliable: a process that dies before part, XBMC now is run on com- it can send a needed message still will have a message sent by KBUS on its puters. In fact, recent versions of behalf; messages flying through the system will all arrive in a predictable order, XBMC installed on an ION-based making their significance easier to interpret; and messages that are sent by one process are as nearly as possible guaranteed to arrive at their destination. nettop makes just about the Dan Rosenberg kicked off a new drive to increase Linux security, when he perfect media center. Version posted some patches to hide the /proc/slabinfo file from regular users. It 10 (Dharma) introduced a fancy turned out that his approach was too much of a blunt instrument, with too plugin system that allows XBMC little gain, for certain folks’ taste. But in the process of debating its various to be extended beyond its built-in merits, a bunch of folks, including Linus Torvalds, dove into the memory allocation code, trying to figure out ways of preventing various security exploits media-playing abilities. The next that had been seen in the recent past. version, currently in development, David Johnston alerted the kernel folks to the idea that some of his code will focus partially on recording as had been included in the kernel, without attributing him as the author and well as playback. without having been licensed by him to be included in the source tree. It When it comes to performance, appeared to be a clear copyright violation. David actually said he’d be pleased and honored to have his code in the kernel; he just wanted to make it’s hard to beat XBMC. It’s faster sure the attribution was correct, and the license issues sorted out. So a few and more responsive than a Boxee folks worked on finding out how the code had gotten into the kernel in the Box, has local media playback first place and how to fix the attribution. These kinds of debates always are unlike the Roku, and is open fascinating, because they put everyone in the awkward position of already source, unlike Microsoft’s media having done something wrong and trying to figure out the best legal and ethical way to back out of it again. center options. It does currently A bit of political wrangling: David Brown tried to remove Daniel Walker lack in premium on-line stream- and Bryan Huntsman from the MAINTAINERS file, as the official maintainers ing, but that’s largely because of ARM/Qualcomm MSM machine support. Bryan was fine with this, but the live version is based on Linux. Daniel had not given his approval. It turned out that Bryan and David were It’s a trade-off I’m willing to both industry folks, and Daniel wanted to remain a maintainer, partly in order to make sure they “did right by the community”. As Linus Torvalds pointed out make. (I actually keep a Roku during the discussion, there was no real reason for any good maintainers to be for that purpose and use XBMC supplanted if they didn’t want to step down. Their contribution could be only for everything else.) positive, and so the argument by the industry folks amounted to an exclusivity Check out the latest features that Linus said he found distasteful. And as Pavel Machek pointed out, the and download a copy for your fact that David had thought it would be okay to do this in the first place was a good enough argument that he wasn’t yet ready to be a sole maintainer. operating system at xbmc.org. —ZACK BROWN —SHAWN POWERS

12 | august 2011 www.linuxjournal.com [ UPFRONT ]

NON-LINUX FOSS

Most people are familiar with Thunderbird. In fact, I used its predecessor back when it was just a part of the Netscape Communicator suite. Thunderbird has come a long way in recent months, however, and it’s still being developed very actively. If you haven’t checked out some of its new features, now might be the time to do so. Thunderbird sup- ports Gmail-style archiving, tabs and better searching, and it’s completely extensible with add-ons. Oh, and if you’re stuck with Windows or OS X, no problem! Thunderbird always has been a cross-platform e-mail solution, and it still is. It makes the transition from one platform to another easier for users, and if you don’t like your e-mail to be kept on some Web company’s servers, it might be the ideal e-mail solution for you. Check it out at getthunderbird.com. —SHAWN POWERS

BOOKS LENS

This screenshot, from the project page, shows the search results for “Dora”.

If you are an Ubuntu user and a fan of the new Unity interface, you might be interested in a new lens in development by David Callé. The Books Lens provides a real-time search interface for e-books. It currently interfaces with Google Books, Project Gutenberg and Forgotten Books. By the time you read this, that list probably will have grown. The Books Lens instantly finds metadata on your search, including book covers, and gives you direct links to the books themselves. For us book nerds, it’s quite a handy little tool. Check it out yourself at https://launchpad.net/unity-books-lens, or install the PPA with: sudo apt-add-repository ppa:davicd3/books-lens

Then, install the package unity-books-lens. —SHAWN POWERS [ UPFRONT ]

velocity. So, you would have two files in the To CFD, or Not to CFD? 0 subdirectory describing these two fields. You also need to set any important physical One area that chews up a lot of cycles on OpenFOAM is library-based, you can properties in files stored in the Dictionaries machines around the world is CFD. What build your own utilities or solvers by using subdirectory. These files end with Properties. is CFD? CFD is short for Computational OpenFOAM as a base. This is very useful This is where you would define items like Fluid Dynamics. The general idea is to in a research environment where you may viscosity. The last step in pre-processing is model the flow of gases and liquids (or be trying something no one else ever has. to set up the control file. This file is named fluids) as they interact with solid surfaces. A model in OpenFOAM is called a controlDict and is located in the system This type of modeling is used in designing case. Cases are stored as a set of files subdirectory. As an example, let’s say you aircraft, automobiles, submarines and fan within a case directory. Many other CFD wanted to start at t=0, run for 10 seconds blades—basically, anything that travels packages use a single file instead. A direc- with a timestep of 0.1 seconds. This section through water or air. As you increase the tory allows you to separate the data from of the control file would look like this: complexity of the surfaces, or increase the the control parameters from the properties. complexity of the flow (such as going Case files can be edited using any text startFrom startTime; from subsonic to supersonic), the amount editor, such as emacs or vi. Pre-processing startTime 0; of computer time needed to model it involves creating all of the files required stopAt stopTime; goes up. One of the big packages avail- for the case you are investigating. stopTime 10; able to do CFD is the suite of programs The first step is mesh generation. deltaT 0.1; made by Ansys. Several groups here at Your fluid (be it a liquid or a gas) is broken my university use it. But, there is an down into a collection of discrete cells, You also set output parameters in open-source option available, OpenFOAM called a mesh. OpenFOAM includes a this control file. You can set how often (www.openfoam.com). This month, I number of utilities that will generate a OpenFOAM writes output with the describe what you can accomplish with mesh based on a description of the writeControl keyword. So, let’s say you OpenFOAM. The OpenFOAM Project geometry of your fluid. For example, the want to write out the results every 10 includes binary packages as deb files blockMesh utility generates simple meshes timesteps. That section of the control file or RPM files. You also can download of blocks, and the snappyHexMesh utility would look like this: a source code package of files or even generates complex meshes of hexahedral download directly from the Git repository. or split-hexahedral cells. If you want to writeControl timeStep; OpenFOAM (Open Source Field generate a basic block mesh, you would writeInterval 10 Operation and Manipulation) basically is lay out the details in a dictionary file, a set of C++ libraries that are used in the called blockMeshDict, in the subdirectory This tells OpenFOAM to write out various processing steps. OpenFOAM, constant/polyMesh within your case results every 10 timesteps into separate just like most other CFD packages, breaks subdirectory. The file starts with: subdirectories for each write. These subdirec- down the work to be done into three tories would be labeled with the timestep. separate steps. The first step is called pre- FoamFile You also can set the file format, the processing. In pre-processing, you define { precision of results and file compression, the problem you are trying to model. This version 2.0; among many other options. involves defining the boundary conditions format ascii; Before you actually start the solver given by the solid objects in your model. class dictionary; step, it probably is a good idea to check You also describe the characteristics of the object blockMeshDict; the mesh to be sure that it looks right. fluid you are trying to model, including } There is a post-processing tool called viscosity, density and any other properties paraFoam that you can use. If you are in that are important for your model. The Case files, in general, start with a your case directory, calling paraFoam will next step is called the solver step. This is header of this format, describing what load it up. Or, you can specify another where you actually solve the equations each case file consists of. In this particular directory location with the command-line that describe your model. The third step file, you can define sections containing argument -case xxx, where xxx is the is called post-processing. This is where vertices, blocks, edges or patches. Once case directory you are interested in. you take a look at the results and visualize you have created this file, you can run the The next step is to run a solver on your them so that you can see what happens in blockMesh utility to process this dictionary model and see what you get. Solvers tend your model. An obvious consequence of file and generate the actual mesh data to be specialized, in order to solve one this breakdown is that most of the com- that will be used in the computation. particular class of problem efficiently. So putational work takes place during the The next step is to set your initial condi- OpenFOAM comes with a rather large set solver phase. The pre- and post-processing tions. This is done by creating a subdirectory of standard solvers out of the box. If you steps usually can be done on a desktop, called 0 and placing the relevant case files are interested in solving a laminar flow while the solver step easily can use up 50 here. These case files would contain the ini- problem for an incompressible fluid, you or 100 processors. OpenFOAM includes tial values and boundary conditions for the likely would use icoFoam. Or, if you are several pre- and post-processing utilities, fields of interest. For example, if you were interested in looking at cavitation, you could along with several solvers. But the real looking at a fluid flowing through a cavity, use cavitatingFoam. Or, you may want power comes from the fact that, because you may be interested in the pressure and a solver for internal combustion engines

14 | august 2011 www.linuxjournal.com [ UPFRONT ]

(engineFoam). Take a look at the documentation to see what is available. They Said It Once you know which solver you are going to use, you can run it by simply If at first you don’t succeed, call executing the relevant binary from it version 1.0. within your case directory, or you can —Unknown use the -case command-line argument to point to another case directory. WE APOLOGIZE FOR THE The last step is the post-processing INCONVENIENCE—God step, where you actually look at the —Douglas Adams, So Long results and see what happened inside and Thanks for All the Fish your model. Here, you can use the supplied utility paraFoam. It can accept All Your Base Are Belong To Us a -case command-line argument, just —Zero Wing (Nintendo Game) like all of the other utilities I’ve discussed. DesktopNova has many options to set, and You then can manipulate the data and Now I am become Death, the a convenient method to set them. look at various time slices. You can destroyer of worlds. generate isosurface and contour plots, —J. Robert Oppenheimer vector plots or streamline plots. You DesktopNova even can create animations, although Klaatu barada nikto. One of the things that frustrates not directly. You can make paraFoam From 1951’s The Day the Earth me about GNOME is the lack of output image files representing movie Stood Still wallpaper rotation integration. frames. So they would be saved with Thankfully, several tools are avail- filenames of the form: able to remedy that shortcoming. My current favorite solution is fileroot_imagenum.fileext READERS’ CHOICE AWARDS 2011 DesktopNova by Stefan Haller. DesktopNova not only lets you Then, you can take this sequence Vote for your Linux and open- of images and run them through source favorites in this year’s add multiple folders to your something like the convert utility Readers’ Choice Awards at wallpaper rotation group, it also from ImageMagick to bundle them www.linuxjournal.com/rc11. optionally allows you to show a Polls will be open August 2–22, together into a single movie file. tray icon to interact with it. 2011, and we’ll announce the As a final comment, in both the DesktopNova comes precom- winners in the December 2011 pre- and post-processing steps, there issue of Linux Journal. piled for several distributions, and are utilities that allow you to convert it already may be in your repository. to and from file formats used by other When combined with the hundreds CFD packages, including fluent, CFX of space photos I’ve downloaded and gambit, just to name a few. This LinuxJournal.com from NASA, DesktopNova makes comes in handy if you are collaborating my computing experience out with other people who happen to This month’s issue is all about com- of this world! (Yes, I think that be using one of these other packages. munity. The Linux and Open Source counts as the cheesiest thing I’ve If you are working with someone community is what keeps all of us written all year.) who is using fluent, you would motivated and having fun with use fluentMeshToFoam in your pre- what we do. These communities Check it out at sites.google.com/ processing step and foamMeshToFluent range in size and scope from a site/haliner/desktopnova. in your post-processing step. small LUG in your hometown, to —SHAWN POWERS This short article provides only a the distributed development teams small taste of OpenFOAM. If you are on the largest Linux distributions, interested in fluid dynamics, you defi- to other Open Source communities nitely should take a look at OpenFOAM. that exist to support projects like Drupal. They are all part of the larger ecosystem The home page includes links to great that is open-source software. We also like to think of LinuxJournal.com as its documentation and several tutorials. own community, and we hope you’ll join us. The installation package also includes Visit www.linuxjournal.com/participate to connect with Linux Journal several example cases, so you can see staff and others, check out our forums and learn about community events. how standard problem sets are handled. We encourage you to chime in with your comments, and let your opinions be You usually can use one of these known. It’s a great way to give and get feedback from our writers and readers. examples as a jumping-off point for We also invite you to visit us on Freenode on our IRC channel, #linuxjournal. your own problem. Check it out and There, you’ll find Linux Journal staff and readers who always are eager to share see if it can help you in your work. stories and sometimes lend a hand. See you there!—KATHERINE DRUCKMAN —JOEY BERNARD

www.linuxjournal.com august 2011 | 15 COLUMNS AT THE FORGE

Introducing CoffeeScript

REUVEN M. LERNER An attractive, new language that makes JavaScript programming fun and easy.

For many years, JavaScript had a bad reputation which then is executed. among developers. Sure, we would use it when we Why would you want to compile a program into needed to do something dynamic in the browser, but JavaScript? First, because modern JavaScript engines we also would avoid it as much as possible. As I (and are quite speedy. Compiling to JavaScript ensures that others) have written numerous times in the past year, the execution will be fast, and that it will work on a however, JavaScript is going through a multidimensional wide variety of platforms and in many contexts—similar renaissance. It executes quickly, and it increasingly is in many ways to the growing number of languages standardized and stable across browsers and imple- (for example, Clojure and Scala) that compile to JVM mentations. You can use it in the traditional role of bytecodes. Second, if you can compile into JavaScript, browser-side applications, either by itself or using a you can take advantage of the libraries and frameworks framework, such as jQuery. You even can build entire that already work with JavaScript. MVC applications in the browser using systems like The other reason to use a language other than Backbone.js, as I described in this space the past two JavaScript, but that compiles into JavaScript, is that you months. And on the server, you can use node.js to can use a syntax that’s more accessible and less prone create high-performance applications. to errors. I’m a longtime user of both Ruby and Python, It’s great that JavaScript has improved in many ways. and I found that CoffeeScript incorporated many of At the same time, the language contains many legacy my favorite features from both languages to create a issues—not in terms of capabilities, but in terms of language with easy-to-understand syntax and powerful the syntax and grammar. You can do great things with features. If you know Ruby, Python and JavaScript, you’ll JavaScript, but it’s easy to write code that has unexpected likely be able to learn this language in a relatively side effects, whose variables don’t have the scope you short time period. expect, or whose functions operate just differently Now, it’s true that CoffeeScript has been around enough from your intention to cause problems. for about 18 months at the time of this writing, and (Another thing that hasn’t improved is its name that it already has attracted a number of fans. But, and the fact that although everyone calls it “JavaScript”, several events have made it even more interesting during it’s officially known as “ECMAScript”, named for the the past few months. First, Brendan Eich, Mozilla’s standards body that approved it.) CTO and the inventor of JavaScript, said earlier this One of the more interesting solutions to this problem year that CoffeeScript may well provide some useful has been the introduction of languages that are supersets syntax ideas for the next version of JavaScript, known of JavaScript. One of the best-known examples is as “Harmony”. Douglas Crockford, well known for his Objective-J, which bolts an Objective-C-like syntax, object ideas, writing and lectures about JavaScript, apparently structure and class library onto JavaScript. The Cappuccino has lent his support to CoffeeScript as well. framework for in-browser MVC applications is written Even more significant, from my perspective, is in Objective-J and provides a programming experience that the Ruby on Rails core team has announced similar to that of the Cocoa platform for the Macintosh. that CoffeeScript will be a standard part of Rails, Another solution has been to run a preprocessor on starting with version 3.1. (Version 3.1 also will feature JavaScript code, as in the case of Google Closure. Closure jQuery as the standard framework, replacing compiles JavaScript into JavaScript, but in so doing, Prototype, and the incorporation of SASS, a CSS optimizes and minimizes your JavaScript code. macros language.) I’m not going to explore the Another approach, taken by Jeremy Ashkenas details of CoffeeScript and Rails here, but the fact (who, incidentally, also created the Backbone.js that a large, growing, active and influential Web framework) was to create an entirely new language framework is adopting CoffeeScript will give that compiles into JavaScript. This language, which he JavaScript language architects like Eich a chance to called CoffeeScript, is not designed to be run directly see how it works “in the wild” and gather feedback (although you can do so, with the right tools). Rather, from developers before deciding what will (and won’t) CoffeeScript code is compiled into JavaScript code, go into the next version of JavaScript.

16 | august 2011 www.linuxjournal.com So, this month, I want to introduce some of the from standard JavaScript. JavaScript, after all, is all basics of CoffeeScript. I must admit I was skeptical of about functions—those that you can pass as parameters, learning yet another new language, especially one that and those that you can execute with parentheses, compiles into JavaScript. But after a bit of playing and much like in Python. You can start to see the differences experimentation, I see why people are so excited about as soon as you define a function though: it. Just where CoffeeScript will be in another few years remains to be seen, but it’s certainly a useful tool to coffee> hello_world = (name) -> console.log "Hello there, #{name}!" have right now, particularly if you’re working on Web applications whose code has become increasingly twisted First and foremost, you can see that defining a and complex with JavaScript functions. function in CoffeeScript is really a variable assignment. The function-definition syntax is still a bit weird by my Installing and Running standards, using -> to separate the parameters and body You can download and install CoffeeScript in a number of an anonymous function. Parameters are named in of ways. One method is to download and compile the parentheses, with commas separating them if necessary. source from the GitHub account on which it is stored In this particular function body, I’m also using and developed. Just say: Ruby-style string interpolation to print the user’s name. If you’re tired of using + or a third-party library git clone http://jashkenas.github.com/coffee-script/ just to interpolate string values, this is likely to be a useful feature for you. and you will have the source on your machine. The CoffeeScript compiler depends on node.js, so it’s not Basic Syntax surprising that you also can download and install it To execute the function, just give the CoffeeScript REPL using the node.js package manager, npm: (read-eval-print loop) the name of the function, followed by parentheses (that is, execution): npm install coffee-script coffee> hello_world() Finally, some Linux packages (of various flavors) exist for CoffeeScript, for those who would prefer to CoffeeScript functions return their final value, install it alongside other packages, with dependencies much as Ruby methods do. In the case of this hello_world taken care of. function, that means the function is returning Once you’ve installed it, you can involve the “undefined”. You can make that a bit better by having interactive command-line prompt, and start coding the function return the string, rather than print it: at the coffee> prompt. You can print something immediately, using the coffee> hello_world = (name) -> "Hello there, #{name}!" built-in console.log function: Then, you can say: coffee> console.log "Hello, world" coffee> console.log hello_world('Reuven') What’s console.log? It’s a built-in function on the Hello there, Reuven! “console” object—for example: or: coffee> console.log.toString() console.log.toString() coffee> hello_world('Reuven') function () { 'Hello there, Reuven!' process.stdout.write(format.apply(this, arguments) + '\n'); } depending on whether you want to get the string back or just print it to the console. As you can see, this lets you take a look at the CoffeeScript provides the basic JavaScript data JavaScript behind the scenes. If you do the same thing types, but it adds a great deal of syntactic sugar, as with the “console” object, you see something that looks well as additional methods, that make those data even more like the JavaScript you know and love (or not): types easier to deal with. For example, CoffeeScript uses Python-style triple-quoted strings. coffee> console.toString() The “existential” operator, a question mark (?), console.toString() allows you to determine whether a variable contains [object Object] something other than null or undefined values. This is better than just checking for the truth of a value, which In some ways, I haven’t yet done anything different will lead to (literal!) false negatives if a value contains

www.linuxjournal.com august 2011 | 17 COLUMNS AT THE FORGE

0 or the empty string. For example: languages. Unlike Python, however, colons aren’t necessary after the “if” and “else” statements. v = 0 CoffeeScript arrays are like JavaScript arrays, but with all sorts of nice syntax added. Want a ten-element if v array? Just use this: console.log "yes" else a = [0..9] console.log "no" and you’ll get it, using the built-in “range” operator. if v? (This doesn’t work for letters though.) You can retrieve console.log "yes" ranges as well: else console.log "no" a[5..7]

The above code example shows how CoffeeScript You can assign to a range, without worrying about implements if/else control blocks. There also is an the precise length of what you’re splicing in: “unless” operator, which (as you might expect) inverts the output from if. CoffeeScript also provides postfix a[5..7] = ['a', 'b'] “if” and “unless” statements—something you might recognize from Perl and Ruby. You also can retrieve substrings using this syntax: You also can see another element of CoffeeScript above, this one taken from Python. Whitespace and coffee> alphabet[5..10] indentation are significant, and allow you to remove alphabet[5..10] much of the curly braces and begin/end of many other 'fghijk'

Silicon Mechanics is proud to announce their sponsorship of Wave Vidmar and the Ocean Row Solo North Atlantic Challenge 2011, a solo row from west-to-east across the North Atlantic.

Expedition Goals Departure: July 2011, Cape Cod Education and research: Wave’s Science Education Adventure Destination: England Program reaches hundreds of thousands of students around Duration: 140 days (estimated) the world. Philosophy Boat “It’s not just one man rowing across an ocean, it’s hundreds Liberty is 24 feet long, with a 6.5 foot beam, and weighs or thousands of people rowing across an ocean. It’s a 1400 pounds fully laden. It is the most advanced, technologi- cooperative effort, that helps push the boundaries and limits, cally equipped ocean row boat in the world. Shaped and giving real-life examples to others in what they too can designed using 3D modeling programs, the boat was tested possibly achieve.” under simulated extreme conditions long before it was ever constructed. Equipment Mission Control “We only work with the best of the best. When you trust Silicon Mechanics and Intel have partnered to donate the your life to equipment and/or services, you can’t afford to Rackform iServ workstation that will run mission control have second-best. We only accept sponsors that have superior functions for the expedition. The Intel® Xeon® Processor product, value, and policies.” E3-1200 Series is at the heart of his customized high-performance system.

For more information about our For more information about Wave Vidmar and Ocean Row Solo, Intel Xeon Processor-based servers visit www.oceanrowsolo.com. visit www.siliconmechanics.com/xeon To track the expedition, visit www.siliconmechanics.com/ors. CoffeeScript strings, like JavaScript strings, are first_name: 'Reuven' immutable. Thus, you cannot assign to a substring: last_name: 'Lerner' coffee> alphabet[5..10] = [5] Once again, using Python-style indentation instead of alphabet[5..10] = [5] curly braces makes it more compact but no less readable. [ 5 ] Loops and Comprehensions coffee> alphabet You can loop through arrays with for..in: alphabet 'abcdefghijklmnopqrstuvwxyz' for number in a console.log number JavaScript objects, which can be used like hashes (aka “dictionaries” or “associative arrays”) work just I should point out that this will print each number as they do in JavaScript, but with some easier syntax. on a line by itself and will return an array of undefined For example, in JavaScript, you would write: values (because console.log doesn’t return a value, and “for” returns an array). person = { Objects can be accessed using the similar for..of loop: first_name: 'Reuven', last_name: 'Lerner' for key, value of person } console.log "key = '#{value}'"

In CoffeeScript, you can say: Note that for..of loops work on any JavaScript object. Because every object can contain properties, person = and because arrays are objects, you even can assign

When you partner with Silicon Mechanics, you get more than affordable, high-quality HPC — you get a team of Experts pulling right along with you. COLUMNS AT THE FORGE

properties to arrays: doing this only when you want, not by mistakenly forgetting to add a “var” somewhere. a.foo = 'bar' Second, properties can be accessed and assigned to as if they were variables, using Ruby-style @varname Using a for..in loop, you’ll continue to see the values syntax. So, when you say x=5 in a CoffeeScript program, in the “a” array. But using a for..of loop, you’ll get not you’re assigning the value 5 to the lexical value x. When only the array elements (whose keys are the indexes), you say @x=5 though, you’re assigning the value 5 to but also “foo”. Additionally, note that if you’re interested the property x on the current object. only in the properties defined on an object, rather than Finally, “this” is scoped dynamically in JavaScript, on its prototype, you can add the “own” keyword: changing value to reflect the object to which the current function is attached. This means that if you aren’t for own key, value of person careful, you can write callback functions that reference console.log "key = '#{value}'" “this”, but accidentally end up referring to the wrong object. CoffeeScript lets you define functions not only In this particular case, there will be no difference. with -> (the “thin arrow”), but also with => (the “fat But if “person” were to have a prototype, and if the arrow”). The difference is that when you define functions prototype were to have keys of its own, you would see with =>, they are bound to the value of “this” when it the prototype’s keys and values, and not just those for was defined, allowing access to the defining context’s the “person” object. properties using @propname syntax. But the need for these for..in and for..of loops All of these things come together in CoffeeScript’s is reduced dramatically in CoffeeScript because of object model, which extends JavaScript’s such that comprehensions, an idea that comes from Python that you can work with something resembling a traditional takes some getting used to, but that offers a great class-instance model, rather than the built-in, deal of power and simplicity once you do so, allowing JavaScript-style prototype-based model. Prototypes still you to combine map, reduce and filter in a single state- exist and work—and indeed, CoffeeScript’s classes ment. For example, you can take a list of numbers: compile into JavaScript prototypes. But, you can get beyond prototype-style inheritance by declaring classes coffee> a = [100..110] with a constructor. Here is a simple example of the [ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110 ] sort of thing you can do:

And you then can multiply each number by 5, much class Person as you would do with “map” in Ruby or Python, but constructor: (firstName='NoFirst', lastName='NoLast') -> using “comprehension” syntax: @firstName = firstName @lastName = lastName coffee> i*5 for i in a Person.count++ [ 500, 505, 510, 515, 520, 525, 530, 535, 540, 545, 550 ] @count: 0 You also can select out some values. Suppose, for example, you want to operate only on those elements p1 = new Person() that are odd. You can say: console.log p1 console.log Person.count coffee> i*5 for i in a when i%2 [ 505, 515, 525, 535, 545 ] p2 = new Person('Reuven') console.log p2 Objects console.log Person.count As I wrote above, everything in JavaScript (and, thus, in CoffeeScript) is an object, and every object has properties. p3 = new Person('Reuven', 'Lerner') (Another way to think about this is to say that everything console.log p3 in JavaScript is a hash, with key-value pairs.) Understanding console.log Person.count and working with this can be a bit confusing at first, particularly because of the way the “this” keyword When you run the above file, you get the operates. CoffeeScript offers several solutions to this following output: problem, as well as the scoping and variable issues that drive JavaScript programmers crazy. { firstName: 'NoFirst', lastName: 'NoLast' } First, scoping of all variables is lexical and is obvious 1 from the indentation. You can attach variables to the { firstName: 'Reuven', lastName: 'NoLast' } global object, or other objects, but you will end up 2

20 | august 2011 www.linuxjournal.com { firstName: 'Reuven', lastName: 'Lerner' } 3

This not only shows how you can use CoffeeScript classes in a way similar to traditional classes, but also that you can have default values for function parameters by declaring their values before the -> sign. You also can see how naturally the use of the @propname syntax fits into this object model. The above constructor looks almost like a Ruby method, rather than a JavaScript one, with a clear distinction between local variables and instance variables.

Conclusion CoffeeScript is an attractive, new language that makes JavaScript programming fun and easy. You can think of it as JavaScript with a new syntax or as an easy-to-learn language that integrates into JavaScript applications, with many ideas taken from Python and Ruby. It removes many of the syntactic bloat and issues associated with traditional JavaScript, simultaneously providing a language that’s easier to write and maintain, but also faster to execute, than raw, unoptimized JavaScript. CoffeeScript is a language we all should watch in the coming months and years. It probably won’t replace JavaScript altogether, but it definitely will make it easier to accomplish certain tasks. Next month, I’ll look at how CoffeeScript can be integrated into your browser-side Web applications, especially those using jQuery. That’s the direction the Ruby on Rails community seems to be moving toward with its 3.1 release, and even if your favorite framework doesn’t adopt CoffeeScript, understanding how they work together probably will be useful.I

Reuven M. Lerner is a longtime Web developer, architect and trainer. He is a PhD candidate in learning sciences at Northwestern University, researching the design and analysis of collaborative on-line communities. Reuven lives with his wife and three children in Modi’in, Israel.

Resources

The home page for CoffeeScript, including documentation, quick references, FAQs and annotated source code, is at jashkenas.github.com/coffee-script. There is an active and growing community of CoffeeScript users, with an IRC channel (#coffeescript) and Wiki at GitHub.

For a good introduction to CoffeeScript, see the presentation written by Jacques Crocker, available at coffeescript-seattlejs.heroku.com.

Finally, the Pragmatic Programmers have released (at the time of this writing) an excellent pre-release “beta book”, written by active CoffeeScript user Trevor Burnham. If you’re interested in learning more about this interesting little language, I highly recommend this book. It’s mostly aimed at beginners, but given the limited number of advanced CoffeeScript programmers out there, this should not bother you. COLUMNS WORK THE SHELL

Calculating Day of the Week

DAVE TAYLOR Working on the nuances of this day-of-the-week shell script.

For those of you playing along at home, you’ll 8 9 10 11 12 13 14 recall that our intrepid hero is working on a shell 15 16 17 18 19 20 21 script that can tell you the most recent year that a 22 23 24 25 26 27 28 specific date occurred on a specified day of the 29 30 31 week—for example, the most recent year when Christmas occurred on a Thursday. Look! A perfectly formed month, so it’s easy to There are, as usual, nuances and edge cases that figure out the DOW for once. But, that’s not really make this calculation a bit tricky, including the need fair for our testing, so let’s move forward a month to recognize when the specified date has already to June and look at June 3 instead. That’s DOM=3, passed during the current year, because if it’s July DOW=6 (Friday): and we’re searching for the most recent May 1st that was on a Sunday, we’d miss 2011 if we just June 2011 started in the previous year. Su Mo Tu We Th Fr Sa In fact, as any software developer knows, the core 1 2 3 4 logic of your program is often quite easy to assemble. 5 6 7 8 9 10 11 It’s all those darn corner cases, those odd, improbable 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 The solution I’m going to work with is The solution I’m going to work with is likely likely more complicated than necessary, more complicated than necessary, but it’s mine and I’m sticking with it. but it’s mine and I’m sticking with it. Here’s the idea. As awk goes through the lines, it easily can ascertain NF (number of fields). If NF < 7, we have a month where the first day starts on situations where the program needs to recognize and a DOW other than Sunday. Any matching date for respond properly that makes programming a detail- the first week of June 2011, for example, would oriented challenge. It can be fun, but then again, it can have NF = 4. be exhausting and take weeks of debugging to ensure Look back at June though, because it’s important excellent coverage. to recognize that the last week of the month has a That’s where we are with this script too. On problem too. It has NF=5. Because any match in that months where the first day of the month is a line must have DOM > 7, however, we can address Sunday, we’re already set. Give me a numeric date, this nuance later. Stay tuned, as they say. and I can tell you very quickly what day of the week The formula we can use to calculate day of it is. Unfortunately, that’s only 1/7th of the possible week for the first week of a month, however, month configurations. given all this information and with i the day of the month is DOW=i+(7-NF). A few test cases verify What DOW Is That DOM? that it works: For purposes of this discussion, let’s introduce two acronyms: DOM is Day Of Month, and DOW is Day June 3 = i=3, NF=4 DOW=(7-4)+3 = 6 Of Week. May 3, 2011, has DOM=3 and DOW=3, July 1 = i=1, NF=2 DOW=(7-2)+1 = 6 as it’s a Tuesday. May 2 = i=2, NF=7 DOW=(7-7+2 = 2 The cal utility shows this month like this: For any date that doesn’t occur on that first May 2011 week, however, we can ignore all these complicated Su Mo Tu We Th Fr Sa calculations and simply get the day of the week. 1 2 3 4 5 6 7 How do you tell if it’s in the first week? Another

22 | august 2011 www.linuxjournal.com test. Search for the matching DOM and then look at the matching How do you tell if it’s in the first line number. If it’s not line 1, we have to calculate the day of week from the matching cal output line: week? Another test. Search for awk "/$expr/ { for (i=1;i<=NF;i++) the matching DOM and then look { if (\$i~/${day}/) { print i }}}" at the matching line number.

In my previous columns, I was creating this overly complicated regular expression to match all the edge cases (literally, the cases DOW of 2 may 2011 = 2 when the match was the first or last day of a week). Instead, DOW of 16 may 2011 = 2 here’s a new plan that’s faster and less complicated. We’ll use sed to pad each calendar with leading and trailing spaces: Looks good! Next month, we’ll tie this all together. We have a function cal june 2011 | sed 's/^/ /;s/$/ /' that calculates day of week for a given date, we already have figured out how to parse user input to get a desired day of Now our regular expression to match just the specified date week for a specified month/day pair, and we know how to and no others is easy: figure out if the starting point for our backward date search is the current year (for example, whether we’re past that point [^0-9]DATEINQUESTION[^0-9] in the year already).I

Further, awk easily can give us that NF value too, so here’s Dave Taylor has been hacking shell scripts for a really long time, 30 years. He’s the author a rough skeleton of the DOW function for a given day of the of the popular Wicked Cool Shell Scripts and can be found on Twitter as @DaveTaylor and month, month and year: more generally at www.DaveTaylorOnline.com. figureDOM() { day=$1; caldate="$2 $3" expr="[^0-9]${day}[^0-9]" Open Frame Panel PC NFval=$(cal $caldate | sed 's/^/ /;s/$/ /' | \ awk "/$expr/ { print NF }") DOW="$(( $day + ( 7 - $NFval ) ))" Ÿ Fanless ARM9 400MHz CPU } Ÿ 4 Serial Ports & SPI Ÿ Open Frame Design That works if we search only for matches that are in the first Ÿ 10/100 BaseT Ethernet week of the month, but that, of course, is unrealistic, so here’s a Ÿ SSC-I2S Audio Interface better, more robust script: Ÿ 2 High Speed USB 2.0 Ports Ÿ SD/MMC Flash Card Interface Ÿ figureDOW() Battery Backed Real Time Clock Ÿ Up to 1 GB Flash & 256 MB RAM { Ÿ Linux with Eclipse IDE or WinCE 6.0 day=$1; caldate="$2 $3" Ÿ JTAG for Debuging with Real-Time Trace expr="[^0-9]${day}[^0-9]" Ÿ WVGA (800 x 480) Resolution with 2D Accelerated Video 2.6 KERNEL cal $caldate | sed 's/^/ /;s/$/ /' > $temp Ÿ Wide Input Voltage from +12 Vdc to +26 Vdc NRval=$(cat $temp | awk "/$expr/ { print NR }") Setting up a Panel PC can be a puzzling experience. However, the NFval=$(cat $temp | awk "/$expr/ { print NF }") PPC-E7+ Compact Panel PC comes ready to run with the Operating if [ $NRval -eq 3 ] ; then System installed on Flash Disk. Apply power and watch either the DOW="$(( $day + ( 7 - $NFval ) ))" Linux X Windows or the Windows CE User Interface appear on the vivid color LCD. Interact with the PPC-E7+ using the responsive else integrated touch-screen. Everything works out of the box, allowing DOW=$(cat $temp | awk "/$expr/ you to concentrate on your application, rather than building and { for (i=1;i<=NF;i++) { if (\$i~/${day}/) { print i }}}") configuring device drivers. Just Write-It and Run-It. fi For more info visit: www.emacinc.com/panel_pc/ppc_e7.htm /bin/rm -f $temp

} Since 1985 OVER A few quick tests: 25 YEARS OF SINGLE BOARD SOLUTIONS EQUIPMENT MONITOR AND CONTROL DOW of 3 june 2011 = 6 DOW of 1 july 2011 = 6 Phone: (618) 529-4525 · Fax: (618) 457-0110 · www.emacinc.com

www.linuxjournal.com august 2011 | 23 COLUMNS HACK AND /

Nagging Notifications Why let your e-mail do all the nagging? Let screen alert you to Nagios issues.

KYLE RANKIN In the February 2011 issue, I wrote about screen, for the information I needed. Honestly, this same the console window manager, and how I configure its method should work pretty well for just about any hardstatus line to show notifications along the bottom monitoring program you might use, as long as it has a of my terminal window. Although some people like Web interface and you have enough regex-fu to parse their desktop environment to fire up notifications when the HTML for the data you need. they have a new e-mail or IM, because I spend a good I originally wrote the script so that if the Nagios deal of my time within screen, it has my focus, and it status was okay, it would print that, and if there were makes sense to put important notifications there. In any critical or warning alerts, it would output those that February 2011 article (see Resources), I introduced statistics instead. I realized that I wanted screen to print how to set up the hardstatus line and demonstrated a okay in green, warnings in yellow and critical alerts in custom script I use to show when I have new e-mail. red. That way, I might notice problems even if I wasn’t For this article, I expand on the topic of screen looking directly at my terminal at the time. To accomplish notifications with a new notification script I’ve found this, I actually needed to run the script three different incredibly useful. Ever since I’ve had more than a handful times within screen. of servers, I’ve relied on monitoring programs like Nagios The script below takes just two arguments: the to keep track of server health. Although monitoring Nagios host to poll (with an optional user name and software has its own method of notifications via e-mail password if you use one) and the type of status to or SMS, I’ve found it valuable to have my current report. I chose the color codes green, yellow and red to represent okay, warning and critical statuses, respectively. I found the http://nagioshostname/cgi-bin/ Although monitoring software has its own nagios3/tac.cgi page was the simplest to scrape and method of notifications via e-mail or SMS, I’ve had all of the information I needed for the script:

found it valuable to have my current Nagios #!/usr/bin/perl

health right there in my screen session. # usage: nagios_scraper.pl [user:password@]nagios_host STATUS # where STATUS is green, red, yellow, or all Nagios health right there in my screen session. It not only provides a backup to my mail notifications, it also $nagios_host=shift; saves me from having a Nagios window open in my $show=shift; browser all the time. If you are new to screen and haven’t set up a open TAC, "wget --timeout=2 -q -O - custom hardstatus line, check out my February 2011 ¯http://$nagios_host/cgi-bin/nagios3/tac.cgi |"; @tac = ; article first to get up to speed. Instead of revisiting how close TAC; to configure a .screenrc file from scratch, I’m assuming you already have a basic .screenrc set up, and instead, foreach $line (@tac){ I’m skipping ahead to how to add this Nagios script to if ($line =~ /(\d+) Down/){ $hosts_down = $1; } your existing screen session. elsif($line =~ /(\d+) Unreachable/){ $hosts_unreachable = $1; } elsif($line =~ /(\d+) Up/){ $hosts_up = $1; } Screen Scraping for Screen elsif($line =~ /(\d+) Pending/){ $hosts_pending = $1; } When I set about writing this script, I realized there elsif($line =~ /(\d+) Critical/){ $services_critical = $1; } are a number of different ways to capture the current elsif($line =~ /(\d+) Warning/){ $services_warning = $1; } health of Nagios. Although I didn’t spend a lot of time elsif($line =~ /(\d+) Unknown/){ $services_unknown = $1; } looking into it, I imagine there are lower-level APIs I elsif($line =~ /(\d+) Ok/){ $services_ok = $1; } could query, but honestly, all I really wanted was to elsif($line =~ /(\d+) Pending/){ $services_pending = $1; } know if Nagios was all green (okay) or had any } warnings or critical alerts (yellow or red), and if so, how many. To accomplish that, I decided the simplest # remove the username and password from the output method was to scrape one of the Nagios status pages $nagios_host =~ s/.*\@//;

24 | august 2011 www.linuxjournal.com only if it truly needs my attention. if($show eq "green" && ($hosts_down == 0 && $services_critical == 0 Name this script nagios_scraper.pl, put it either in ¯&& $services_warning == 0)){ /usr/local/bin for everyone to use or your user’s ~/bin/ print "$nagios_host: OK"; directory, make sure it is executable, and then test it } against your Nagios server to make sure you have the elsif($show eq "red" && ($hosts_down > 0 || $services_critical > 0)){ syntax right. For instance, if you had no user name or print "$nagios_host: ${hosts_down}D ${services_critical}C "; password set up for Nagios, and your Nagios server } was named naggyhost, you would type the following elsif($show eq "yellow" && $services_warning > 0){ command to test if everything was okay: print "$nagios_host: ${services_warning}W "; } $ /usr/local/bin/nagios_scraper.pl naggyhost green elsif($show eq "all"){ print "${hosts_down}D ${hosts_up}U ${services_critical}C Type the following to test for critical alerts: ¯${services_warning}W ${services_ok}OK"; } $ /usr/local/bin/nagios_scraper.pl naggyhost red

As you can see, I actually collect a lot more statistics Or, type the following to test see all statuses: than I ultimately use, just in case I want to refer to them later. The important thing to note in this script is $ /usr/local/bin/nagios_scraper.pl naggyhost all that in each of the green, red and yellow statuses, I print something only if there’s something of that status I do recommend that you set up a user name and to print. This is crucial, because I don’t want to clutter password for your Nagios Web access if you haven’t my hardstatus line, and I want to see yellow or red text already. Because the user name and password you use COLUMNS HACK AND /

for this script ultimately will end up in plain text, I recommend setting up an account for the Nagios Web interface that can log in but can see only the Nagios status and can’t submit any changes (like maintenance modes and acknowledgements). Let’s assume I set up an account called readonly with a password of n0wr1t3 on naggyhost. I would call the script like this:

$ /usr/local/bin/nagios_scraper.pl readonly:n0wr1t3@naggyhost red

Again, if the script doesn’t provide any output in one of the modes, it could just mean that the status doesn’t currently apply. If you want to test that for sure, run the script with the all argument instead of Figure 1. Everything is okay. green, yellow or red to see the full status.

We Will, We Will, Nag You Once you have tested the script and have it working, the next step is to add it to your ~/.screenrc. The first step is to add three new backtick configuration lines to ~/.screenrc that will call nagios_scraper.pl each with green, red and yellow statuses. In my case, I assume you might have a few backtick commands defined, so I start with command 110:

backtick 110 27 27 /usr/local/bin/nagios_scraper.pl ¯readonly:n0wr1te@naggyhost red backtick 111 61 61 /usr/local/bin/nagios_scraper.pl ¯readonly:n0wr1te@naggyhost yellow Figure 2. One host is down alert with five critical services. backtick 112 73 73 /usr/local/bin/nagios_scraper.pl ¯readonly:n0wr1te@naggyhost green into your existing screen session. Figures 1 and 2 show I’ve set each of these commands to run at different what the hardstatus line will look like either when the intervals. I want to check for critical alerts more frequently status is okay or when there are critical alerts. than warnings or when everything is okay, so I run What amazes me the most the more I dig in to the command with the red argument every 27 seconds. screen notifications is just how simple it is to add new I then run it with yellow and green every 61 and 73 scripts to the list once you get the hang of it. Even if you seconds. Note that I set these intervals to be at odd times. don’t use screen, it wouldn’t be too difficult to modify I’ve realized the value in staggering my screen notification the script so that it outputs to a desktop notification scripts so they don’t risk all running at the same time, so instead (see my December 2009 column for details).I to help with that I try to choose odd intervals. Once you have defined the backtick lines, the Kyle Rankin is a Sr. Systems Administrator in the San Francisco Bay Area next step is to add them to your hardstatus string and the author of a number of books, including The Official Ubuntu Server so they show up in green, yellow and red. In my Book, Knoppix Hacks and Ubuntu Hacks. He is currently the president of the case I pasted in: North Bay Linux Users’ Group.

%{+b r}%110`%{+b y}%111`%{= g}%112` Resources so that my hardstatus string modified from my previous article would be: “Status Messages in Screen” by Kyle Rankin, LJ, February 2011: www.linuxjournal.com/ hardstatus string '%{= w}%Y-%m-%d %c | %l | %101`| article/10950 ¯%{+b r}%110`%{+b y}%111`%{= g}%112`' “Message for You Sir” by Kyle Rankin, LJ, Now save your changes to your ~/.screenrc, and December 2009: www.linuxjournal.com/ either start up a new screen session or type Ctrl-A : article/10612 and type source ~/.screenrc to load these changes

26 | august 2011 www.linuxjournal.com

NEW PRODUCTS

Compuware’s Gomez Platform

Compuware’s integrated application performance management (APM) solution not only has been upgraded but also rechristened the Compuware Gomez Platform. Gomez, says Compuware, “optimizes mobile and Web application performance across the entire application delivery chain, from data centers, through the cloud, to the edge of the Internet”. This update includes new functionality in both Compuware’s on-premise APM products (formerly called Vantage) and its software as a service (SaaS) APM products, now all operating under the Gomez product brand name. New features and capabilities in the new Gomez release include real-user monitoring, mobile-readiness assessment, real-user transaction analytics, integration with Google Page Speed and Internet health map with last-mile data. www.compuware.com

Noble Harmony

Noble Systems has released the next generation (that is, version 2) of Noble Harmony, a browser access tool for remote and mobile contact center management. Version 2 builds on the earlier edition’s flexible, browser-agnostic design, adding improved user-interface layout and customization. The net effect is that managers and supervisors can operate effectively without being tethered to an individual station by allowing them to monitor real-time activities with mobile devices and tablets. More specifically, they now can arrange how KPI information is displayed on the dashboard, speed access to frequently used screens, query a vastly expanded array of variables, set alerts to be triggered on specific activities and parameters, find and analyze individual campaigns and agents, and manage list assignments. www.noblesys.com

Protecode’s Developer Assistant

The folks at Protecode have expanded the reach of Developer Assistant, a tool that the company calls “the industry’s first solution for real-time management of open-source licensing and copyrights”. Previously available only for the Eclipse IDE, the tool now supports all operating systems and all software development tools worldwide. Developer Assistant, says Protecode, operates unobtrusively in the background and requires no training for developers, allowing them to concentrate on development rather than open-source license management. Operating directly at the developer workstation, it uses the code analysis services of Protecode’s Enterprise Server and compares the code structure of a file to signatures of millions of files stored in Protecode Global IP Signatures. There, it identifies the licensing and copyright obligations of the file and provides instant feedback to the developer as the code is put together or brought in from the Internet, an external storage device or a corporate repository. www.protecode.com

Lucid Imagination’s Lucid Certified Developer Exam If your daily grind involves development with Apache Lucene/Solr technology, surf on over to Lucid Imagination to find out more about its new Lucid Certified Developer Exam. The company calls the exam “the industry’s only standardized benchmark of open-source search knowledge, skills and experience”. Created by some of the most esteemed experts and contributors for the Lucene/Solr Project, the Lucid Certified Developer Exam provides developers with a way to validate their expertise and differentiate themselves in the competitive job market, as well as helps employers select new hires with more confidence and more accurately assess knowledge gaps in the current employee base. www.lucidimagination.com/certification

28 | august 2011 www.linuxjournal.com NEW PRODUCTS

Sencha Animator

Sencha is encouraging interactive designers to switch to its new Sencha Animator v.1, “the industry’s first purpose-built tool for creating CSS3-based animations that deliver plug-in-free rich-media experiences”. Designed for interactive designers and advertising creatives who want to create cross-platform animations for playback on WebKit browsers and touchscreen mobile devices, Sencha Animator brings static Web pages to life and ensures high-fidelity playback on all leading mobile devices and desktop browsers. Key product features include full CSS3 support, interactive timeline and intuitive object property controls, an intuitive timeline interface and exporting of animations to readable HTML. www.sencha.com InMage Scout

From the backup and recovery news desk comes breaking news from InMage on version 6 of InMage Scout—a single, easy-to-use solution for local backup and replication of physical and virtual environments that is based on continuous data protection (CDP) technology. InMage claims that the upgraded InMage Scout becomes the only unified product on the market featuring CDP- based backup and remote disaster recovery support for most major enterprise platforms, including Linux, AIX, Windows, VMware, Solaris, XenServer and Hyper-V. The new Scout also features both asynchronous IP and synchronous FC-based data protection without imposing software-based storage virtualization on customers. With this launch, InMage Scout 6.0 also introduces the PureSplit architecture, which allows customers to use their existing storage without having to virtualize it though server appliances. www.inmage.com

Queplix QueCloud

Integrate your disparate cloud-based, SaaS and on-premise applications with Queplix’s new QueCloud, easily and without coding. This can be done using QueCloud, says Queplix, at low cost and with a great deal of automation while avoiding common drawbacks, such as long service engagements, manual processes and the constant wholesale movement of entire datasets. QueCloud cites its Application Software Blades technology that provides automatic connection to data sources, complemented by data virtualization that brings all of the structure of the data sources into the system instantly. From there, the entire data integration process merely involves checking off boxes to align the data and the business rules desired. Once applications are integrated, QueCloud keeps critical customer, product and financial data consistent between applications. Absent from the process are typical elements of ETL technology, such as coding, SQL, complex widgets and wire diagrams. www.queplix.com

Thomas Lah, Steve O’Connor and Mitchel Peterson’s Building Professional Services (Prentice Hall)

Ready to take your world-class skills out of the cubicle and into the big, brutal world? Before you take that jump, sit down long enough to digest the new book Building Professional Services: The Sirens’ Song from Thomas Lah, Steve O’Connor and Mitchel Peterson. There certainly is money to be made, but the pitfalls are also deep and treacherous, say the authors. These leading experts present a comprehensive guide to creating professional services organizations, managing them to maturity and delivering quality services while earning superior margins. Readers will learn how to adopt a complete, practical framework for delivering a full spec- trum of professional services—from support and education services to managed, consulting and productized services. Besides emphasizing the key factors that drive success—revenue, references and repeatability—the book covers frameworks for organization, project delivery, solutions development and operational infrastructure. www.informit.com/store

Please send information about releases of Linux-related products to [email protected] or New Products c/o Linux Journal, PO Box 980985, Houston, TX 77098. Submissions are edited for length and content.

www.linuxjournal.com august 2011 | 29 NEW PROJECTS Fresh from the Labs Blu-ray Special This month’s article is in a different format from usual; normal service will resume next month. I recently scraped together some cash to buy a Blu-ray drive, and like every other user, I found there was no immediate way to play the disc other than reboot into an OS I won’t mention. Therefore, this month, I cover Blu-ray-specific projects, highlighting individual parts of what later will become a whole in basic playback of Blu-ray discs—I hope. libbluray—Blu-ray Playback Library www.videolan.org/developers/ libbluray.html According to the libbluray Web site: “libbluray is an open-source library designed for Blu-ray discs playback for media players, like VLC or MPlayer. This research project is developed by an inter- national team of developers from Doom9.” The Web site lists the project’s features as follows:

I Portability: currently supported platforms are GNU/Linux, Windows and Mac OS X. Dependencies are very limited.

I Freedom: libbluray is released under a Free Software license, ensuring it will I’m watching a Blu-ray movie under Linux. How? Read through to the end, but I guarantee stay free. you won’t like it.

I Features: the library integrates naviga- tion, playlist parsing, menus and BD-J. If your distro uses sudo: research project provides, through an open-source library, a way to I Legal: libbluray is DRM-circumvention- $ sudo make install understand how the AACS works. free, and thus, safe to integrate in This research project is mainly your software. If your distro uses root: developed by an international team of developers from Doom9. I Fun: libbluray is a fun-to-hack-on $ su NB: this project doesn’t offer project in its starting phase. # make install any key or certificate that could be used to decode encrypted Installation To install libbluray, you The main note here is that “Most copyrighted material. need to grab a binary from somewhere commercial Blu-ray are protected by (like the Ubuntu Personal Package Archive, AACS or BD+ technologies, and this According to the project page, libaacs for instance), or you need to grab the library is not enough to play back those features the following: source. To get the source, you need to discs”. This is simply a library, and you’ll have git installed. Once you have git, need a player like MPlayer or VLC com- I Portability: currently supported plat- enter the following command: piled against it. This is the first of several forms are GNU/Linux, Windows, Mac libraries I’m going to cover, so let’s move OS X. The main dependency is libgcrypt $ git clone on to the next. for all cryptographic functions. git://git.videolan.org/libbluray.git libaacs—AACS Reading I Freedom: libaacs is released under a Once that downloads, change into the Library Free Software license, ensuring it will new directory and compile like so: www.videolan.org/developers/libaacs.html stay free. To quote the libaacs Web site: $ cd libbluray I Legal: libaacs does not include any key $ ./bootstrap libaacs is a research project to or certificate and respects copyright. $ ./configure implement the Advanced Access $ make Content System specification. This I Fun: libaacs is a fun-to-hack-on project

30 | august 2011 www.linuxjournal.com in its starting phase. traces of AACS.” Also according to the docu- Installation The installation follows mentation, here are its key fea- the same procedure as that for libbluray. If tures so far: you’re grabbing the source, enter: I Dual-Core supported $ git clone decryption of EVO/M2TS files git://git.videolan.org/libaacs.git (for hard-disk-to-hard-disk speed records). Change into the new directory with the following command: I Support for every pack type of an EVO (including in-place $ cd libaacs decryption of ADV_PCKs, excluding Sequence Key Then, repeat the next few lines from Sections). This snazzy-looking program is DumpHD. It decrypts HD my libbluray installation instructions. DVD and Blu-ray discs onto your hard drive. I Decryption of every ARF libbdplus—Purpose protection type. Unconfirmed path (/media/INCEPTION, in my case), (URL Unknown) I Multiple files (currently CLI only) as well as to browse for a destination. Perhaps the missing link in basic Blu-ray or complete disc mode. From here, you need to check only playback, I translated this from a French whether you want audio, video or both, Web site: “libbdplus is a library for I Usage of a key database to get the and then click Dump. decrypting protected BD + Blu-ray discs. decryption keys or direct retrieval of Part of my problem appeared to be Currently in development, the project will the keys off the source disc. something to do with external libraries certainly be hosted by the VideoLAN team and helper applications, and their installation if legal clarification is achieved.” I Supports HD-DVDs for and pathing. So far, the documentation However, finding this library seems to Standard/Advanced Content (but available is strewn haphazardly across be a mystery in itself, which I’m guessing not both on the same disc), Blu-ray README files, forums, man pages and so may be kept under wraps for legal ROM BDMV. on, all as separate elements that are hard reasons. On the first page of Googling, I to track down. The same applies for the came across this e-mail from the MPlayer I Experimental Blu-ray recordable support actual program files themselves, which is archives: “Can you send me a link to (with multiple CPS Units, BDMV, BDAV not fun. If anyone wants to help these guys the hidden libbdplus git? Or the source with Aux Directories and Thumbnails). with packaging, hosting, documentation snapshot? Thanks.” (anything to make this a cohesive package), Indeed, I’ve seen references on other I Automatic BD+ removal using the I swear I will cover this program again mailing lists referring to this trio of BDVM Debugger or manually by but in proper detail. libraries being the key to basic playback. supplying a correct Conversion Table Although I couldn’t confirm it with my (currently CLI only). MakeMKV one-and-only Blu-ray disc (and meager www.makemkv.com download limit), it seems that unencrypt- I Streaming output of EVO/M2TS files If you’ve reached this point of the article ed discs can be played back with the first to stdout. filled with despair and just want to watch library, and these last two are needed a film with your new drive, there is one for encrypted discs. I Very much console output for free. last resort: MakeMKV. Before I continue, this is shareware— DumpHD—HD Decrypter I GUI. that horrid software model from the forum.doom9.org/ 1980s and 1990s. Nevertheless, installa- showthread.php?t=123111 Although I don’t have space to cover tion is quite easy, and its GUI integration While I must stress from the outset that the installation properly, I did find this is simply excellent (it managed to include I couldn’t get this to rip my only disc, it program in the Ubuntu repository, and clever program choices when I right-clicked looks to be invaluable nonetheless. Also as this is a trickier program, I hope it’ll be on the titlebar). developed by the Doom9 folks, like libbluray in your distro archive too. Using DumpHD Still, you get only a trial period for Blu-ray and libaacs, DumpHD is a sleek GUI program at least is easy. The only real input required functionality, at which point you have to for decrypting HD-DVD and Blu-ray discs from the user is to browse for the disc’s pay for the program. Okay, you’re thinking, and dumping the files onto your hard disk. According to the documentation: “DumpHD is a HD-DVD/Blu-ray decrypter While I must stress from the outset that based on the idea of BackupHDDVD I couldn’t get this to rip my only disc, it by muslix64. The goal of this program is to make a perfect backup without any looks to be invaluable nonetheless.

www.linuxjournal.com august 2011 | 31 NEW PROJECTS

Hopefully, we as a community can focus our efforts in whatever form we can— hosting, coding, documentation and so on—and reach the same point of maturity as projects like libdvdcss.

massive files. Ripping some- is available at themediaviking.com/ thing that’s 30Gb makes software/bluray-linux. something that’s almost 30Gb And, that’s about as much coverage as as well. I guess this is to make I’m willing to give a shareware program. the quality as 1:1 as possible, MakeMKV: this expensive bit of shareware always gets but I couldn’t find anything to Conclusion the job done in ripping Blu-ray discs to hard drive, but lower the bitrate for storage Linux and Blu-ray may be in a bit of a sorry at quite a price. (half the point of ripping). state for now, but (encrypted) DVD also had Maybe I missed something in many of the same problems in its first few that doesn’t sound too bad. How much is the GUI, but I don’t think so. years. When I first tried DVDs under Linux it? It costs 50 euros. Last time I looked, When you get to the ripping stage, (longer ago than I care to remember), that’s about eleventy-billion in US dollars. you need to choose which title(s) to rip, projects like xine were in their infancies. Only I might pay 50 euros for a commercial and be sure you choose the right ones unencrypted DVDs (of which there weren’t software player, maybe, but for a ripper, on the first go. After a big wait, your many around) could be played, and play- no, sorry. Anyway, I have 30 days of trial MKV should be ready to watch. I hope back methods were primitive. No menus or usage, and I’m desperate just to watch a you chose the right title! navigation, no chapters and individual .vob film with my new drive, so let’s push on. Still, this isn’t watching Blu-ray. It’s files were played one at a time. The Next Head to the Web site’s Download page, ripping it. And, it takes some time too. Chapter button in xine would skip to the where at the top, it has a link to a forum “Can we watch the film at your place, next .vob file (if memory serves correctly). for Linux users. There you’ll find all the honey?” “Certainly. I’ll just rip it first and Now we take Linux DVD playback for information with excellent instructions for guess at which titles are the film and the granted—at least for those of us in countries installation, with links to two tarballs you’ll special features, and hope I get it right where libdvdcss isn’t a problem. And, unless need. The installation went perfectly for on the first go.” Less than cool. I’m using something OSS like VideoLAN, me, and all I had to do was download and Note: just after writing that section, playing DVDs under Windows nowadays is extract the tarballs, open a terminal in each I found a guide on how to stream from actually more of a hassle than when I’m in folder, and copy and paste some commands. MakeMKV to VideoLAN. This saves on my native Linux. So what about Blu-ray? The GUI is intuitive and largely self- ripping time, but it also has jittery perfor- Currently, the projects for decrypting explanatory, but I urge you to make sure mance, and when I tried it with MPlayer, it and playing Blu-ray discs are spread around the output folder is on a partition with was very glitchy. For those wanting to try the Net, disparate and unconnected. The enough free space to accommodate these their luck with this alternative, the guide streaming method mentioned at the end of the last section of this article shows it is at least possible to play encrypted discs, albeit in a bastardized form. Hopefully, we as a community can focus our efforts in whatever form we can—hosting, coding, documenta- tion and so on—and reach the same point of maturity as projects like libdvdcss. If I’ve made any mistakes along the way, I implore you to write in and correct me! I’d rather provide some kind of help with this issue than contribute misinformation.I

John Knight is a 27-year-old, drumming- and bass-obsessed maniac, studying Psychology at Edith Cowan University in Western Australia. He usually can be found playing a kick-drum far too much.

Brewing something fresh, innovative or mind-bending? Send e-mail to [email protected]. The final product: a 27-gig mkv rip that I can finally watch. Worth it? Not sure.

32 | august 2011 www.linuxjournal.com The newly updated LINUX JOURNAL ARCHIVE is here!

ALL 200 ISSUES!

The archive includes all 200 issues of Linux Journal, from the premiere issue in March 1994 through December 2010. In easy-to-use HTML format, the fully searchable, space-saving archive offers immediate access to an essential resource for the Linux enthusiast: Linux Journal.

www.LinuxJournalStore.com A CONFERENCE PRIMER WITH GARETH GREENAWAY Can’t make it to a LinuxFest this year? Host your own! SHAWN POWERS

34 | august 2011 www.linuxjournal.com www.linuxjournal.com august 2011 | 35 FEATURE A Conference Primer with Gareth Greenaway

Every time I attend a Linux conference, I’m reminded of one thing: that we need to host the show comes from I’m so glad I’m not in charge. I have a difficult time getting my family our generous sponsors. Several of them return each year and have a regular presence out the door to go to school on time every morning. The thought of on our show floor, and we greatly appreciate arranging dozens of sessions, hundreds of volunteers and thousands their support. We end up providing various discounts for our attendees to attend the of attendees is just overwhelming. I’ve always been quite certain every show—these range from student discounts conference has a “nervous-breakdown room” where the people in to discounts for various user groups and open-source projects. charge go to rock back and forth in a fetal position a few times a day. Although that might be true for many people, as it would certainly SP: What is the most expensive part of putting on a Linux conference? be for me, my opinion changed when I attended my first Southern GG: There are a few aspects that could California Linux Expo (SCALE) a couple years ago. There certainly was easily qualify for the most expensive part. The first is the show network, which is plenty of chaos to be had, but in the hallway outside the vendor area, utilized by our exhibit floor, our show I met Gareth Greenaway. Gareth was casually talking to the group registration system, our show wireless of us from Linux Journal, sipping on a cup of coffee and wearing networks and audio/video equipment used for monitoring talks. Each of these areas, flip-flops. When I learned that he was one of the people in charge including each booth on the show floor, of SCALE, I figured he already had cracked and had just come from ends up being a separate managed network. The downside is that providing this kind a fetal-ball-rocking session in the nervous-breakdown room. As it of network infrastructure can be very turns out, he’s just really good at what he does. When we decided expensive, while the upside is that SCALE ends up with a rock-solid network. to do an issue on Community, I thought he would be the perfect The other aspect is our audio and person to interview about running a Linux conference. Thankfully, visual equipment. We made the decision a few years back to handle the audio and in his typically calm and casual way, he agreed. visual equipment ourselves, realizing how expensive renting it directly from the SP: What is your job, specifically, when it attendee registration for the show should venue can be. Luckily, we had some very comes to SCALE every year? open, and when the “early-bird” registration talented individuals step forward and fill GG: Currently, I fill two roles within should end and the ticket price should the need. Although we’re handling this the SCALE organization. The first role is increase. We also have several milestones element ourselves, it still can end up being Conference Operations. This role is the for behind-the-scenes tasks, such as the quite an expense, especially with the primary contact between the venue and the various committees submitting their number of speaker sessions that we need SCALE “team”. In this capacity, I also deal budgets for the show, determining the to accommodate now. At the SCALE 9x with several of the vendors that make the placement of booths on the show floor, Friday sessions, we had nine concurrent show happen, such as the booth decorators. signing various contracts and so on. sessions running, each room with its own The second role is that of Community Planning for the show usually begins full A/V setup. Relations. This role is responsible for work- around May or June. Around September ing with the community to get the word is when we typically open up the Call for SP: What is the most difficult aspect out about the show, working directly Presentations. In December, we open up of planning SCALE? And, what’s the with the speakers’ chairs to draw speaker the registration system, with the early-bird most rewarding? submissions from community groups and ticket prices going until around early GG: For me, the most difficult aspect is projects, and directing the Community January. The Call for Presentations closes that the show lasts only a few days. We Relations committee’s efforts to recruit near the end of December or early plan things out for almost a full year, and dotORG exhibitors from the Free and January. Around this time, things really it often feels like it’s over too quickly. Open Source community. get busy for most of the committees. A few years ago, I jokingly said that it [Note: the conference is usually sched- reminded me of a scene from one of my SP: Given a one-year calendar, could you uled to take place toward the end of favorite movies, Brewster’s Millions. The describe the milestones and activities that February each year.] main character inherits millions of dollars take place to prepare for SCALE? If some and has to spend it all to get his full things are planned more than a year in SP: Most conferences charge an entry inheritance. Shortly after he gets his first advance, mention those as well. fee, accept sponsorships and get money inheritance, he has an interior designer GG: The big milestones for the show from vendors for having booths on-site. design him an office, but it’s never quite include things like the dates for the Call Without divulging specific dollar amounts, right. He explains to her that he wants to for Presentations, when the Call for what percentage of funding comes from walk in and say “I want to die in this Presentations should open and when it what sources? office!” Finally in one of the final scenes, should close. Other milestones are when GG: Generally, a good portion of the funds after he’s spent all his money and has

36 | august 2011 www.linuxjournal.com “WE’VE PUT TOGETHER A LIST LINUX PRESENTER TIPS OF THOSE SPEAKERS I People like to look at pictures and listen to speakers. I try to keep my PowerPoint presentations simple and with few words. Not everyone presents that way, but WHO ARE TYPICALLY it works for me.

LATE, AND AS THE I Be excited about your topic, even if you’re not. I just gave a very lively and exciting DEADLINE GETS CLOSER talk at Penguicon about backups, pretty much the most boring topic on the planet. WE SEND OUR GOON I Give 110% to your audience, whether it’s 2,000 people or two people. They came SQUADS TO THEIR to see you, likely at great expense; give them the respect they deserve. HOMES, FORCING THEM I Leave some time for questions if possible. TO GO THROUGH THE I Leave the room when your time slot is over. If there is a crowd, lead them into the SUBMISSION PROCESS!” hallway to be respectful of the next speaker. I Make bullet points short, and elaborate on them when you talk. If you just read nothing, Brewster walks into the office your bullet points to the crowd, the crowd can (and will) do it without you. This and exclaims “I want to die in this office.” needs to be bold, highlighted and repeated. Your talk elaborates your bullet Immediately after that, all the rented points. If you simply read the presentation, it makes for a horribly boring session. furniture is taken back and the office is torn down. This is always how I feel I Don’t be arrogant. Your audience is full of your peers, not your students. Always when SCALE is being packed up. assume there are people in the audience who know more about the topic than There are a few aspects about organizing you do (there usually are). SCALE that I consider especially rewarding. The first being the opportunity to help I It’s important to take questions from the audience, but don’t let the questions spread the word about many of the free (or one audience member) dominate the talk. If questions start to get out of and open-source projects that aren’t able hand, tell the audience you’ll take further questions at the end or after the talk. to be as vocal as some of the others. A few years ago, we invited the creators of the I Fact-check your presentation. Geeks love to correct a presenter, so be careful QIMO Project to attend SCALE as a dotORG with generalizations and look for places in your talk where you might be exhibitor, and they ended up being one of inaccurate. Make sure any sources you use are authoritative and up to date. the more-popular exhibitor booths during the show and gained quite a bit of exposure I Avoid demos unless absolutely necessary. Screenshots, screen-scrape because of being at SCALE. videos and example commands usually can make your point and are less We’ve also given quite a few people likely to break in the middle of your talk. Nothing’s worse for a presenter’s who have never spoken at a conference reputation or an audience’s patience than a broken demo. If you must use a the opportunity to speak. One of my demo, test it thoroughly and have a backup plan in case it fails. Preparing for favorite sessions that we’ve had at SCALE things to go completely wrong is something that you have to do. I gave a talk was a session that took place during our on virtualization at Penguicon a couple years ago. I prepared for the talk and Friday sessions a few years back. The ran through the demo at least four times. But on the day of the presentation, daughter of one of our volunteers, Larry the virtual networking I needed for the talk failed to run. I played it off, spent Cafiero, and two daughters of Fedora/Red a couple minutes getting comments and tips from the peanut gallery in the Hat contributor Karsten Wade, gave a talk crowd on how to troubleshoot it, but then abandoned it, and just went off to on what they liked and disliked about free talk about what was left in the slide. The talk wasn’t as good as I’d hoped, and open-source software. It was a great and it wasn’t what people came to see, but I think it wasn’t a total wreck moment as these three young girls were either, simply because I had enough material and was prepared in the event explaining to a room full of adults, many that it went sideways. of whom were developers, what the software should and shouldn’t do. I Practice your talk at a LUG. Linux Users Groups usually are quite grateful to have speakers and are a great place to practice your talk in front of a similar audience SP: As someone who speaks at confer- before the “main event”. ences, I know I’m horrible at getting talks submitted in time. I can’t imagine I’m the I Try not to take yourself too seriously. There will be mistakes, flubs and people only speaker with that tendency. Do you doing silly stuff during your talk. Be ready to blow off mistakes or joke about find it difficult to arrange quality sessions them. You can turn a bad moment into something that will make the crowd laugh. in a timely manner? They won’t remember the flub, and you come off as very entertaining.

www.linuxjournal.com august 2011 | 37 FEATURE A Conference Primer with Gareth Greenaway

GG: We’ve put together a list of those speakers TIPS FOR ATTENDING who are typically late, and as the deadline gets closer we send our goon squads to their homes, A LINUX EVENT forcing them to go through the submission process! In all seriousness, it can be difficult, I Always plan a backup talk to attend. Sometimes a talk’s summary and we’ve had to resort to extending the call for is written months before the presentation, and often presenters papers a few times. Usually this works to our will completely rework a talk. Other times, the talk just isn’t what benefit though, as we see a flood of submissions you were expecting. Usually you can tell in the first five minutes for really great talks. Unfortunately, the flood whether a talk is worth the time, and if you already have a backup of talks also leaves us with more talks than talk planned, you’ll be able to get there before you miss too we can accommodate in the main conference. much of it. Fortunately, many of those talks end up being great candidates for the SCALE Friday sessions I Attend the “hallway track”. Some of the most rewarding time you’ll or the UpSCALE, our version of Ignite. spend at a conference is the hallway track or the conversations you have with geeks in the hallway outside formal talks. It’s definitely SP: Who is your dream speaker, and why? worth it to get over any social anxiety and strike up a conversation GG: I really have two answers to this one. An with fellow geeks to find out what cool things other people are obvious choice would be Linus Torvalds. I believe up to. there is an unwritten rule somewhere that your event really can’t be considered a true open- I All things being equal, choose an expert. Sometimes you’ll have a source event until you’ve had Linus speak. I’d few different talks you want to attend at the same time. If it’s difficult imagine he’s got a whole blessing he does to decide, add extra points if one of the talks is being given by either too, a big ceremony and probably a closing a known good presenter or the absolute expert on the topic. dance number as well. My other dream speaker isn’t anyone in I Don’t be “that guy”. There’s always the person in the audience particular but all the people who don’t think they who wants to prove he or she is smarter than the presenter and have what it takes to speak at a conference. tries to dominate the talk. You’ll get better answers and a better One of the things I love seeing at events is an presentation from presenters if you actually let them present. If you overflowing room for an unknown speaker. have detailed questions, most presenters are more than happy to field questions after the talk is over. SP: What is the most stressful part of the planning process? I Always throw in at least one “wild card”. It’s easy if you are a GG: The most stressful part is the last few programmer to stay in the developer track, or if you are a weeks leading up to the show—wondering sysadmin to stay in the sysadmin track—after all, that’s why if everything is going to come together and tracks were invented. Be open to mixing it up though, and wondering if anyone will show up. This is choose at least one wild-card talk in a subject you may have also when I start dreaming about all the only indirect interest in. things that could possibly go wrong. Usually the scenarios end up being pretty ridiculous I Silence your phone. This goes for your computer too. It’s really though. One of those scenarios had the show distracting for everyone to hear that Ubuntu startup sound, a taking place on a farm, with speakers giving ringtone or the Angry Birds noises in the middle of a talk. talks in a chicken coop.

I Get your schedule figured out, and plan which talks you want to go to. SP: How many people are involved in putting If you have a smartphone or PDA, put them in your calendar, along on SCALE (not including guest speakers)? with what room they’re in. That way, you’re not scrambling trying GG: There are roughly ten core members that to figure out where you need to be and when. work on the show each year, but that number is growing as more and more people get involved, I If you’re on social media, find the event’s hashtag and which is really great to see, because new Tweet/Facebook-post with the hashtag. Also, search for that members bring new ideas and make sure that hashtag. You’ll wind up finding lots of sidebar events and the show stays fresh and fun. It works very meeting a whole bunch more folks that way. It’s the “hallway much like an open-source project—someone track”, but virtualized. will see a missing or existing element that needs to be added or needs attention, then I If it’s a multi-day event, bring half the clothes and twice the money. he or she jumps in. We’ve had several people Hotel food is expensive, and drink is doubly so. start off simply as volunteers during the show, who are not core members of the team. I Pack a power strip. SP: How did SCALE start? I Be ready to have a lot of fun. GG: Several years ago, I proposed to some

38 | august 2011 www.linuxjournal.com members of the local Linux Users Group Since then, we’ve hosted the show crouching under my desk, reaching up to that we host a one-day event, with the at various locations, expanded the the keyboard to hit the Enter key, because idea of it being a gathering of the local speaker track to five concurrent sessions, I had read horror stories of people blowing LUGs in the area. We had speakers from added specialty Friday sessions and up their monitors. I wouldn’t say I neces- the local LUGs giving presentations on a expanded the exhibitor floor to more sarily miss those days, but I do think it’s variety of topics, and exhibitors included than 100 exhibitor booths. important to realize and appreciate how LUG members showcasing their favorite far things have come. open-source projects and a handful of SP: You must be passionate about Free and open-source software definitely local commercial companies with Linux- Linux to take on something like this. has come a long way. It’s given so many based products. We called the event What’s your story? people so many opportunities to use and LUGFest and ended up hosting the event GG: I actually got involved with free and work with a variety of software that they four times, every six months. open-source software while looking for a otherwise wouldn’t have had access to. While planning the fifth event, a job. I was hunting for a job as a computer member of one of the other local LUGs programmer and came across one that SP: How has the economy dip in recent told me that some students at University sounded interesting. I ended up asking years affected the turnout of both guests of Southern California and University of about their environment and was told that and vendors? California Los Angeles and members of they used UNIX. I had never heard of GG: When the economy dipped a few the USCLUG and UCLALUG, respectively, UNIX, so I started doing some research years ago, we definitely saw that reflected were looking into the possibility of hosting and came across two free UNIXes, Linux in many aspects of the show. For obvious a conference on the USC campus. I made and FreeBSD. I don’t remember exactly reasons, many sponsors and commercial contact with that team, and we ended up why, but I ended up going the Linux exhibitors were more reluctant to fund the meeting, then planning out the first route, and I ended up doing a Slackware show and have their employees host a SCALE event. The first show was held at install. After writing 40+ floppy disks, I booth. We saw fewer companies out at the the Davidson conference center on the had a Linux machine. That definitely was a show recruiting versus other years as well. USC campus, and there were roughly 20 different time. I can vividly remember the One aspect that remains a constant, how- exhibitors and two speaker tracks. first time I set up an X graphical session— ever, is our attendance. Many of us feared FEATURE A Conference Primer with Gareth Greenaway

get everything in writing. And, if you’re LINUX COMMUNITY EVENTS holding an event at a hotel, be sure to account for the 20% service charge that CHECK TO SEE IF THERE’S A COMMUNITY-ORGANIZED EVENT IN YOUR REGION: gets charged to everything! One of the most interesting experiences I Flourish—Chicago, Illinois: www.flourishconf.com that I’ve had planning SCALE was the year the show ended up being the same week- I LinuxFest Northwest—Bellingham, Washington: linuxfestnorthwest.org end that a certain awards show takes place in Southern California. Before the show I Northeast GNU/Linux Fest—Worcester, Massachusetts: began, while hunting around the venue www.northeastlinuxfest.org for a missing package for one of sponsors, I ended up in the room where the awards I Ohio Linux Fest—Columbus, Ohio: ohiolinux.org show tickets were being stored. Following the show, buildings surrounding the venue I Penguicon—Troy, Michigan: penguicon.org were topped with snipers as a form of security for the awards show. I SCALE—Los Angeles, California: www.socallinuxexpo.org SP: What advice can you give to someone I SouthEast LinuxFest—Spartanburg, South Carolina: southeastlinuxfest.org who is (or readers who are?) considering starting a regional event themselves? I Florida Linux Show: www.floridalinuxshow.com GG: Start small, don’t try to do too much the first year. For a more complete list of Linux-related events, including popular corporate-organized events as Make sure roles and responsibilities well as international events, visit www.linuxjournal.com/events. are well defined and well communicated. Nothing is worse than having too many cooks in the kitchen all trying to do the same thing. that with the economy in the position it software or events, but it shouldn’t just Take chances, and allow others to make was that we would see a downturn in the be about the paycheck. mistakes. The event doesn’t need to be number of people who attended. While it absolutely perfect, and it won’t be. didn’t shoot up at all, it certainly didn’t SP: How do you arrange the session Don’t take things personally. People plummet, which was a pleasant surprise. schedule? Is it your fault when two sessions are going to complain; it’s just a fact of In recent years, as a hopeful sign that I want to go to occur at the same time? life. Be polite, and listen to what they the economy is heading back to a more That said, is there a certain methodology have to say. There likely will be some healthier place, we’ve seen an uptick in or software that helps arrange tracks to useful information in the complaints. both sponsorship and attendance. This minimize topic overlap? Open communication is key. It definitely past SCALE (SCALE 9x), we saw quite a GG: We do our best to arrange the talks should be a team effort. jump in the number of attendees that in a way that two talks we think will be came out for the show as well as the popular don’t overlap. Unfortunately, SP: As always, Gareth, speaking with you number of exhibitors. we’re not always right. We’ve definitely was great. Thanks for taking the time to had some talks that were wildly popular, talk to us. And, to LJ readers, if you’ve SP: Many are wondering if there’s a place with attendees spilling out into the hallways ever considered starting a community for a major national show again—a and sitting in the aisles. That being said, event, I’d highly recommend attending LinuxWorld circa 1998—or if the trend is it’s absolutely my fault when there are two one of the regional events in your area. toward regional community-driven events sessions that you want to go to occur at Talk to the people who make conferences like SCALE. What are your thoughts? the same time. happen; they even might be willing to give GG: I think the time for commercially you some advice. And, if you’re ever in driven events has passed, and now it’s SP: Share some experiences or details Southern California in late February, be sure the time for community events. That that would be surprising for those not to come to SCALE! Tell Gareth we sent you. being said, I think having a governing familiar with planning and running a If you’re planning to speak at or attend a organization for national or international Linux conference. Linux event in the future, see the sidebars events could be an interesting and impor- GG: One thing that always surprises to this article for some tips from myself and tant addition. The community events are everyone about SCALE is that everyone editors Kyle Rankin and Bill Childers.I so successful because of the passion for involved is a volunteer; no one is paid the subject that the organizers bring to to work on the show. Shawn Powers is the Associate Editor for Linux Journal. the table. There definitely is a different Advice I would give to others wanting He’s also the Gadget Guy for LinuxJournal.com, and he has an dynamic when people work on some- to plan a similar event would be to start interesting collection of vintage Garfield coffee mugs. Don’t let thing for a paycheck vs. for the love of it. small and definitely not try to do every- his silly hairdo fool you, he’s a pretty ordinary guy and can be I’m not against people being paid for thing yourself. When dealing with reached via e-mail at [email protected]. Or, swing by their work on free and open-source vendors and any venues, make sure to the #linuxjournal IRC channel on Freenode.net.

40 | august 2011 www.linuxjournal.com

Facebook Application Development

Facebook development, for friends and profit. / Mike Diehl

o you have a Facebook page? If you do, you are among previous jobs and some of my son’s activities. I’ve managed to the 600 million users who actively use the social-networking reconnect with my best friend from high school after 20 years. service. I’ll admit I initially resisted the temptation to join I’ve even managed to reconnect with my best friend from the DFacebook. After all, I’ve got e-mail, instant messaging third grade! Since I’m 43 years old, I think that’s quite an and VoIP. What do I need with yet another form of communication? accomplishment. Like I said, it’s very powerful technology. Eventually, temptation got the better of me, and I gave it a try. For But for me, there’s more. I also get links to blogs and news the record, I also experimented with MySpace and Twitter, but those articles from like-minded friends as well as pointers to breaking sites just didn’t seem to do anything for me. These days, every time I news that’s of interest to me. Many times, I’ve heard about events go to my computer, I check my servers, my e-mail and my Facebook. on Facebook before I saw them on TV or read about them in the I never thought it would get to this point, but it turns out that newspaper. Lately, I’ve been investigating ways to use Facebook Facebook is a surprisingly powerful piece of technology. So far, to promote my new business, and I’m sharing some of what I’ve I’ve connected with friends from church, college, high school, found in this article.

42 | august 2011 www.linuxjournal.com First, let’s take care of some of the easy stuff. Everyone’s probably been to a Web site and seen a Facebook “Like” button. When users click on this button, they are asked to log in to Facebook, if they’re not Figure 1. Like Button already. Then, the button click causes a brief message to be added to users’ Facebook pages, indicating that they like the particular Web site. All of the users’ Facebook friends then can see this message. Assuming the user’s full name, you would use something like this: that many of one’s friends share the same interests, this is a very simple way to get a message out to potentially interested people. select name from user where uid=1690577964 Adding a Like button to a Web site is as easy as embedding a little HTML code into your page. Facebook even has a wizard to The resulting URL would like like this: help customize the button: https://developers.facebook.com/ docs/reference/plugins/like. https://api.facebook.com/method/fql.query?query=select When I played with this wizard, I was given code that looked ¯name from user where uid=1690577964 like the code shown in Listing 1. This code results in a Web browser displaying something that resembles Figure 1. Amazingly, your results look like this: Facebook also provides methods that allow a Web site to post to users’ Facebook pages as well as add a person or page to their friends list. These methods are documented at https://developers.facebook.com/docs/reference/dialogs. Mike Diehl Before I go any further, let me pass on a little tidbit of infor- mation I came across while researching this article. Facebook supports a primitive chat function that allows users to exchange interactive messages with their friends. This chat function is FQL requires that you specifically list each of the fields in based on the XMMP protocol, which is the same protocol that which you are interested. That means you can’t simply use Google Talk and Jabber use. The details are documented at select * from... as you would be tempted to do in a https://developers.facebook.com/docs/chat. Essentially, you language like SQL. So, it’s important to know what tables Adding a Like button to a Web site is as easy as embedding a little HTML code into your page. need to know your Facebook user name and password. Then, you and columns are available to you. This is well documented prepend your user name to @chat.facebook.com to form a Jabber at: https://developers.facebook.com/docs/reference/fql. ID. When I plugged this information in to Kopete, I was able to At the risk of duplicating what’s already on the Web site, chat with my Facebook friends using Kopete. I also was able to get here’s a list of a few of the more interesting tables that you can real-time updates when my friends logged in and out of Facebook. query (from the Web site): Facebook also provides a powerful method of querying its database for various types of information. Using a language I comment: query this table to obtain comments associated with called Facebook Query Language (FQL), you can ask for all one or more feed comment XIDs. kinds of information about a Facebook user, subject to access restrictions. The easiest way to do this is to use the HTTP GET I connectioncomment: query this table to return a user’s friends access method. This method allows you to execute a query and the Facebook pages to which the user is connected. using a standard HTTP GET. The results are returned in XML format. All you have to do is append your query to the end of I friend: query this table to determine whether two users are this URL: https://api.facebook.com/method/fql.query?query=. linked together as friends. For example, if you had a user ID number and wanted to find I like: query this table to return the user IDs of users who like a given Facebook object (video, note, link, photo or photo album). Listing 1. Like Button Code I notification: query this table to get the notifications for the I status: query this table to return one or more of a user’s statuses.

www.linuxjournal.com august 2011 | 43 FEATURE Facebook Application Development

I stream: query this table to return posts from a user’s stream You can query against quite a few other tables, and I’ve not or the user’s profile. fully explored what information is available. I can tell you that e-mail addresses and phone numbers aren’t readily available using I user: query this table to return detailed information from a this query method. Also, users are able to set permissions that user’s profile. determine what can be retrieved.

Listing 2. Facebook JavaScript Demonstration

1 #!/usr/bin/perl 50 function(rows) { 2 51 document.getElementById("who").innerHTML = 3 ¯rows[0].name + "\'s Minions!"; 4 print < ¯friend where uid1={0} order by uid2', r.session.uid); 9 56 query2.wait( 10 test page 57 function(rows) { 11 58 var i = 0; 12 59 var friends = ""; 13 60 14 61 while (rows[i]) { 15 62 var friend = " ¯src=http://graph.facebook.com/" + rows[i].uid2 17