Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Book Reviews

Submission + - Sams Teach Yourself Node.js in 24 Hours

Michael Ross writes: "Since its introduction in 1994, JavaScript has largely been utilized within web browsers, which limited JavaScript programmers to client-side development. Yet with the recent introduction of Node.js, those programmers can leverage their skills and experience for server-side efforts. Node.js is an event-based framework for creating network applications — particularly those for the Web. Anyone interested in learning this relatively new technology, can begin with one of numerous resources, including Sams Teach Yourself Node.js in 24 Hours.

This book, authored by George Ornbo, was released by Sams Publishing on 15 September 2012, under the ISBN 978-0672335952. The recent publication date is promising, because Node.js is evolving rapidly, thus gradually obsoleting books written not that long ago. On the publisher's page, visitors will find a brief description of Ornbo's book, a few customer reviews, the table of contents, a sample chapter (the 14th, "A Streaming Twitter Client"), and links to purchase the print and electronic versions of the book. There is also a link to the companion site, which offers some of the same content as Pearson's page, but also has a link to download an archive file containing all the example code, nicely organized.

The book's material spans 464 pages, and is organized (shoehorned) into 24 "hours" (chapters), grouped into six parts. The first two chapters in "Getting Started" explain how the reader can download Node.js, create a "hello world" web server program, install new modules using npm (Node Packaged Modules), search for modules, locate documentation on them, and indicate module dependencies for an application. Unfortunately, the blocks of source code presented in the first examples (Listing 1.1 and Figure 2.2) are not explained in the narrative (until the fifth chapter) or even commented. Readers would likely appreciate some clues as to the nature of http.createServer, req, res, the "underscore" module, etc. — especially at the beginning of their journey. If readers are not expected to understand these details at this point, then they should be told so, to avoid any concerns that such an understanding is assumed in the subsequent chapters. The author does not explain where Node.js is installed or what changes it makes to the terminal's default path variable. On page 18, the term "project folder" is unclear: should the "underscore" module end up in hour02/example01/node_modules, or nodejs/node_modules, or nodejs/node_modules/npm/node_modules? Only later is this (partially) answered.

Chapter 3 demonstrates the complexity that arises from concurrent input/output in networked applications. This material should arguably have been presented at the beginning of the book, to better establish the purpose of Node.js, and the value to the reader of studying it. The next chapter summarizes jQuery and JavaScript callbacks, and then provides a helpful discussion of how Node.js uses the latter. The author contends that the asynchronous paradigm of Node.js is unsuitable for long-running processes, but does not explain why this is true, which would have provided some substantiation for the claim.

The second part of the book, "Basic Websites With Node.js," encompasses four more chapters. The first one discusses how to: create a simple server (using the core HTTP module), examine the response headers (generated for web pages, in different browsers and on the Linux command line), execute 301 redirects, respond to different types of requests (using the URL module), and create a simple client. Oddly, the author does not explain or even mention the sizable JSON output — the first line of which is "{ domain: null," — displayed in the reader's server terminal when the web page pointing to that server is refreshed or when the "curl -I" command is run. The next two chapters cover how to build websites using the Express framework, and are likely the first point where the reader will see some of the real-world complexity of Node.js. The eighth chapter explains how to persist data between calls to the application, including files, environment variables, and MongoDB.

Debugging, testing, and deploying are all critical topics for any application development, and are covered in the third part of the book. The author illustrates three methods of debugging: STDIO, a core module, is a lightweight method for debugging Node.js code; it allows one to output messages to the console, check the value of any variable or literal, and track function calls and responses from third-party services. Node.js provides access to the more powerful debugger of V8 (the Google Chrome JavaScript engine), which supports breakpoints and code stepping. Node Inspector, compatible with WebKit-based browsers, provides all of the above functionality, and more. The next two chapters present several modules that ease the important process of creating full-coverage tests, and demonstrate how to deploy applications to any one of three Node.js-capable cloud hosting providers (Heroku, Cloud Foundry, and Nodester).

Having covered the basics of Node.js, the author begins the fourth part of his book with two chapters that show how to use Socket.IO, WebSockets, and Express to build real-time web applications. These techniques are illustrated in the development of a chat server as well as a nickname management and messaging system. The aforementioned sample chapter extends these techniques further in working with the Twitter API to consume its real-time data, push it to the browser, and show results in a dynamic graph. This section is wrapped up with coverage primarily of JSON — specifically, how to create, consume, and send JSON-structured data.

APIs were addressed briefly in the previous section, but are explored much more deeply in the subsequent five chapters. Readers may initially conclude that the discussion of processes is elementary, but the author then shows how one could utilize that knowledge to interact with Node.js scripts, including detecting script exits and errors, sending signals and arguments to a script, generating child processes if needed, and sending messages among them. In the 18th chapter, the author goes into greater detail about Node.js's Events module, best practices, and how to generate event listeners dynamically. The buffer API may be low-level, but it is essential for storing raw binary data, as opposed to the Unicode-encoded strings that JavaScript uses within a browser. The Buffer and Stream modules are presented with plenty of helpful examples.

The last part of the book addresses miscellaneous topics, starting with CoffeeScript (a JavaScript precompiler). While CoffeeScript affords numerous benefits, it is not clear why it would deserve an entire chapter in a book dedicated to Node.js. In the next chapter, readers learn how to verify their Node.js code, add command-line executables, and then package it all up into portable modules that can be contributed to the npm registry or GitHub. The last two chapters explain how to create and configure middleware using the Connect module, and how to use Backbone.js (a front-end JavaScript framework) in conjunction with Node.js to build browser-based web applications.

Each chapter concludes with a summary (invariably a waste of space), a Q&A section, a workshop comprising quiz questions (with the answers presented immediately below it, for almost instant spoiling), and several exercises for the reader.The index at the end is missing several of the important topics discussed in the text.

The book contains many errata: "EBay" (page 1; should read "eBay"), "OSX" (page 9; presumably Mac OS X), "yaml" (page 15; should read "YAML"), "irc" (19), "led to [a] great deal" (27), "to solve Concurrency" (37), "process" (54; should read "processes"), "try and" (55; should read "try to"), "This goal" (56; should read "The goal"), "how [a] class" (56), "You will [see] the" (62), "status of [a] web server" (70), "javascripts" (77), and "then [the] name" (87). At this point, less than 20 percent into the book, it was clear that the copyeditors had done a sloppy job, so I stopped recording these flaws that should have been caught. Those first four errata suggest that "textese" is even pervading the world of technical publishing. (Strangely, there does not appear to be a place on the publisher's website for reporting errata.)

The production team should have been looking for places to cut down on the heft of the print edition. The "Try It Yourself " sections sometimes duplicate what is found in the regular text nearby — especially in the third and fourth chapters. For instance, three sets of HTML markup are repeated, as well as the surrounding discussion (pages 42 through 47).

In general, the text does not appear to have been carefully scrutinized by technical reviewers and copyeditors. Occasionally the reader is given critical information later than would be optimal, e.g., the "Watch Out" warning on page 18, provided after the reader installs a module. The writing style is noticeably awkward in countless places in the book, including several run-on sentences. (Technical authors should not be bashful in using commas when doing so would help readability.) Also, the text is littered with too many exclamation marks — as if that is going to make any narrative more exciting.

In terms of the production quality of the book, a lay-flat binding would have made it much easier to read when using both hands on the keyboard. Also, in my review copy (kindly provided by the publisher), a disappointingly large number of the pages had small black splotches of ink; fortunately, none made the text unreadable.

On the other hand, Node.js is certainly not a simple subject area, and this book is able to convey a lot of information about it. This book's forte is the extensive use of example code to illustrate the concepts being presented. Incidentally, kudos to the author for inviting the reader to contribute to the Node.js community, such as adding new modules to GitHub or updating the documentation of existing modules. Overall, readers new to Node.js would certainly benefit from working their way through this volume.

Michael J. Ross is a freelance web developer and writer."
Books

Submission + - Drush User's Guide

Michael Ross writes: "With the advent of graphical user interfaces (GUIs) decades ago, most of the commercially-available software transitioned from command-line usage to point-and-click interfaces, with the majority of these applications completely phasing out all command-line capabilities, or never implementing them in the first place. But for programmers — most of whom are comfortable working on the command line — performing administrative actions within a GUI can become tedious and time-consuming, and there is a growing movement toward adding command-line support back to software development applications. An example of this is Drush, which is a command-line interface for the Drupal content management system.

Drush, whose name is derived from "Drupal shell," was originally developed six years ago, and is seeing a resurgence within the Drupal community. However, what appears to be the primary information resource for Drush, the community documentation, currently has a status of "incomplete." Fortunately, there is now a book available that provides more extensive coverage, Drush User's Guide, authored by Requena Juan Pablo Novillo ("juampy"). The book was released by Packt Publishing on 10 April 2012, under the ISBN 978-1849517980. The publisher's page offers descriptions of the book, its table of contents, a brief author biography, the known errata, the example code used in the book, and a free sample chapter (the third one, "Customizing Drush"). This review is based upon a print copy kindly furnished by the publisher; an e-book version is also available.

The book comprises 125 pages, mostly grouped into four chapters, which cover how to install, use, customize, and extend Drush. The preface briefly summarizes those chapters, the software needed to use Drush, the target audience of the book, the styling conventions used in the text, and various publisher information. The author states that "Apache 2.0 or higher" is required to use Drush (page 2), but the project's README.txt does not mention this, and Drupal 7 itself runs fine on Apache 1.3; so this requirement is unclear. He also states that "Drush 4 does not support Windows" (page 13); Windows users are instructed to use Drush 5. This seems questionable, since a quick test revealed that Drush 4.5 runs on a Windows XP machine. Admittedly, it always elicits a warning: "Drush 4.x has significant limitations on Windows; it is not advisable to use on that platform. Substantial progress has been made towards supporing [sic] Windows on the 5.x branch; please upgrade."

The first chapter of the Drush User's Guide naturally begins with instructions on how to install Drush on Linux, Mac, and Windows systems. The book's examples use Drush 4.5, even though 5.1 was available at the time of the book's publication, and 5.0 was available a month earlier. Version 4.5 was the last 4.x release, and was probably the latest stable release when the book was being finalized. Throughout the book, all Windows instructions are specific to Windows 7, so any XP straggler will need to modify them as needed. In the "Manual installation" section, the subheads are almost identical in font size to the higher-level subheads, forcing the reader to check the table of contents hierarchy just to see where the manual installation instructions end. But the main problem is that the reader is not given recommendations as to which optional features should or should not be chosen. For instance, if you already have PHP installed on your system, should you decline to have the Drush installer try to add the "Php [sic] Required Runtime," even though it is enabled by default?

The author then shows how to set up a Drush-specific PHP configuration file, in order to bypass potential problems, such as memory limitations in the default configuration file. In the rest of the chapter, he demonstrates how to perform Drush commands (in general), define arguments and options for those commands, create command aliases, and specify which Drupal website any Drush command is supposed to operate upon.

In the second chapter, "Executing Drush Commands," the author shows the reader how to perform a fresh installation of Drupal 7 — including creation of the database and its tables — with just two commands. He introduces the music festival website that will be used throughout the rest of the book for demonstration purposes. At this point, some readers may hit a stumbling block: The "--drupal-project-rename" option used in the text fails on Windows machines (this is a known issue). Presumably the author did not test his suggested commands in a Windows environment. The bulk of the chapter is devoted to introducing numerous Drush commands, including those used to get and set variables, install modules, administer users, back up the database, and many more.

The author notes that "Drush is highly configurable," and in the third chapter he shows the reader how to create custom commands, include their help information in the output of the command "drush help," extend existing commands, run custom PHP scripts, and define site aliases. Readers new to Drupal may find these topics fairly advanced, as they necessitate familiarity with command namespaces, as well as Drupal's hook system, callbacks, and database API. Defining remote site aliases involves SSH and public keys. However, given the flexibility and power of custom Drush functionality, it is arguably worthwhile to make the effort to learn how to do it properly. At the end of the chapter, the reader learns how to use and configure the Drush command-line interface.

The fourth and final chapter, "Extending Drush," discusses how to utilize some of the modules that are integrated with Drush — specifically, Backup and Migrate, Devel, Features, Views, and Module Builder. The chapter concludes with a section on Drush Make, which packages the module information of a Drupal website so it can be re-created using Drush easily.

As with all of the Packt Publishing titles that I have reviewed, this one has a high number of errata relative to the total page count, aside from the seven already reported online (as of this writing): "command line interface" (page 1; "command line" should be hyphenated when used as an adjective), "book title through the subject" (same page; should be "book title in the subject"), "Clear cache" (page 7; should be "Clear all caches"), "follow [the] instructions" (page 13), "close [it] and open [it] again" (page 18), "try and" (page 21; should be "try to"), "change version by something" ("by" should be "to"), "parenthesis" (page 23, twice; should be "parentheses"), "within [the] sites subdirectory" (page 25), "execute commands towards" (page 26; "towards" should be "on"), "MySql's" (page 28; should be "MySQL database's"), "provided with it" (should be "provided it with"), "that resolves" (page 29; should be "resolves"), "First, of all" (page 33), "anoying" (page 48), "Imagine, that" (page 52), "lists [the] latest messages" (page 55), and "altering existing" (page 57; should be "alter existing"). At this point, not yet halfway through the book, I stopped recording errata. The Packt Publishing copyeditors should have spotted and fixed these obvious errors.

Although the author's meaning is invariably clear enough, the writing style is awkward in many places. For instance, "replace by" (page 4) should instead be "replace with," "take the chance to review" (page 41) should be "take the opportunity to review," and "of the flow" (page 55) should be "in the flow." The term "at" is used to indicate "in" a file — e.g., "at the Drush README.txt" (page 9); the same is true for MySQL tables — e.g., "stored at the variable table" (page 30). In addition, countless passages in the text would have benefited from a comma. Conversely, there are some extraneous commas (e.g., on page 43).

Yet the main flaw of the book is the neglect for readers who are using the Windows operating system for building and administering Drupal websites. The aforesaid "--drupal-project-rename" bug likely would have been caught had the Drush pm-download command been tested on a Windows computer. Another example is on page 48, where it is assumed that the command "firefox" will work as a link to the browser's executable on the reader's computer. Also, the ".drush" folder is critical for creating site aliases and other configuration settings; but where will the Windows user find this folder? This Linux partiality could result in Windows readers encountering — and possibly being frustrated by — confusing technical problems.

Nonetheless, the author does a fine job of explaining how to utilize the many Drush commands presented, as well as many of their arguments and options — oftentimes pointing out differences in their usage for Drupal 6 versus Drupal 7. Any Drupal developer interested in learning how to harness the power of a command-line interface for building and administering websites, should find Drush User's Guide a worthwhile tutorial.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Drupal for Designers

Michael Ross writes: "Of all the open source content management systems used for building websites, Drupal has a reputation for being one of the most flexible and powerful available, but not the easiest for web designers to use. Drupal version 7 has made some strides in alleviating those flaws, but there is still much progress to be made. During the past few years, a number of books have been published that explain how Drupal designers can do custom theming, but they tend to focus on the technical details of the theme layer, and not the practice of web design when using Drupal as a foundation. That rich yet neglected subject area is the focus of a new book, Drupal for Designers: The Context You Need Without the Jargon You Don't.

The book's author, Dani Nordin, is a Massachusetts-based web designer and the founder of The Zen Kitchen, a UX design business. The book was published by O'Reilly Media, on 1 August 2012, under the ISBN 978-1449325046. The publisher's page offers a description of the book, the table of contents, an author bio, and some free sample content (the first chapter). This publication is a compilation of three previously-released short guides — Planning and Managing Drupal Projects, Design and Prototyping for Drupal, and Drupal Development Tricks for Designers — with additional material. All of these books were written by Dani Nordin, and comprise the "Drupal for Designers" series by O'Reilly Media. (My thanks to the publisher for a review copy of this particular title.)

The book's material spans 328 pages, and is organized into seven parts, which do not include the introduction or the first chapter. The seven parts — each comprising at least two chapters — are largely presented in the same order that a typical reader would want to learn and implement the recommendations: Discovery and User Experience; Sketching, Visual Design, and Layout; Setting Up a Local Development Environment; Prototyping in Drupal; Making It Easier to Start Projects; Working with Clients; and Sample Documents.

Unlike most introductory Drupal books, this one wisely begins with a helpful dictionary of Drupal terminology. The first chapter also discusses the phases that compose a typical Drupal project lifecycle. Sandwiched in between is some guidance on where to place custom code in a Drupal directory system. The author advises that "Any module, theme, or other customization that you create for your site should always reside in sites/all" (page 2, and also reflected on pages 1 and 5). That may be true of contrib modules and themes, but certainly not custom ones, which are better located in sites/default or sites/[domain name]. She states that a child theme should be "stored separately in sites/all/<client_name>" (page 4). Actually, they should be placed in "sites/default/themes" or the themes subdirectory of a domain name directory. Finally, she recommends that for a multisite installation, one should keep "everything in sites/all" (page 5). Lumping everything into the "all" subdirectory would defeat the fundamental mechanism of multisite, which allows one to host multiple sites on a single Drupal installation, with their custom files and settings separated by domain name.

The first part of the book is loaded with valuable counsel on how to conduct the discovery phase of a website project, including coverage of project goals, user experience (UX), mockup tools, user personas, wireframes, prototypes, and the key components of a short-form project brief. It is evident from the narrative that the author is drawing upon a great deal of real-world experience, as well as lessons learned from other veteran web designers. The only blemish is where the author refers to "the project brief in Section 8" (page 45, repeated on page 254), and yet there appears to be no such section in the book. Perhaps she means Appendix A, which has an example project brief.

Once a design team has completed and received sign-off on a project brief — as well as any wireframes and other helpful preliminaries — a logical next step is to build the initial visual design. In the second part of the book, the author demonstrates how she uses sketches, style tiles, layout elements, greyboxing, grid systems, and Fireworks templates for crafting a visual design for a website. Throughout these chapters, she uses a redesign of her own personal website to illustrate the material. Both this part and the previous part of the book contain little information that is specific only to Drupal; thus, it could be useful to designers building websites using other CMSs.

Some readers of the book may already have up-to-date Drupal environments installed and configured on their development web servers. For those who do not, Part III will likely be appreciated, especially if the reader is using a Mac machine, because that is the environment to which the text and screenshots are geared. The author contends that "Windows seems to add an annoying layer of complexity to most of the command-line stuff" (page 102). Yet from my own experience, installing and using Git and Drush on a Windows PC is largely the same as in a Linux environment. Most developers complain that the main hurdle is Git's unintuitive workflow, which is independent of the operating system. The author touches upon some other tools, such as LESS and phpMyAdmin. Chapters 9 and 10 focus on Drush and Git, respectively. The last chapter in this section steps the reader through installing MAMP and Drupal. The discussion is generally comprehensible, except for the first paragraph on page 132, which is arguably the most confusing in the entire book. For instance, echoing a misstep seen earlier, it advises that all changes to your Drupal site should be stored in the sites/localhost directory, which contradicts the advice on the previous page, that all customizations to the site should be located in the sites/all directory.

The fourth part of the book covers prototyping in Drupal: gleaning from the client the information needed to define the content types for the website; choosing the appropriate modules for implementing the desired functionality; using views for displaying data; improving the HTML generated by views; creating custom Drupal themes; and using LESS to better manage the CSS within a theme. The advice is on target, except for the recommendation to use the Submit Again module, which does not have a Drupal 7 release, and has been replaced by the Add another module. Readers who are having difficulty locating the User Reference module mentioned by the author (page 187), can find it as a submodule in the References project. Lastly, the author instructs the reader to enable any base theme used (page 217), but actually it does not need to be enabled; installation alone is sufficient.

Part V, the briefest of them all, explains how to utilize the Features module, as well as Drush Make and installation profiles. Part VI comprises three chapters which offer guidance on how to propose an estimate for new projects, how to push back on unreasonable client requests, and how to learn from and document a finished project. This material is so closely related to that presented in the first part of the book — project discovery, planning, project briefs, etc. — that these final three chapters should have been incorporated into that earlier part. In fact, the first paragraph of this part states that it describes a phase of the discovery process that should be conducted prior to the phase described in Part I. Nonetheless, the author provides smart tips on some of the more difficult aspects of project management. The last part of the book comprises three appendices with sample documents — specifically, a project brief, a work agreement, and a project proposal.

On the publisher's page for the book, no errata have been reported, at this time. That is likely because the book appears to contain remarkably few errata: "What if there was" (pages 81 and 245; "was" should be "were"); "get familiar [with] the command line" (page 108); "a couple of" (page 172; should be "a few," as it is referencing three bullet points); ".less" (page 208, twice; should be "LESS"); "carpal tunnel[s]" (page 231); "original code [for] a feature" (page 242); and ".tpl" (page 266; should be ".tpl.php"). This is certainly a low number of errata for a technical book of this size. Kudos to the author and the O'Reilly editing team.

Overall, the book's style is clear and conversational, with only a few rough patches. Incidentally, the terms "directory" and "folder" are synonymous, but newbie readers who do not understand this could be confused when the two terms are used interchangeably, especially within the same sentence (e.g., page 109). Interspersed at various points in the text are interviews with people involved in web design, entitled "From the Trenches," which add perspective from designers other than the author. The reader will also find some natural humor and humility, which is always welcome in a technical work.

The author and publisher have made good use of the many screenshots, showing sample designs, Drupal user interface pages, etc. Unfortunately, for the Drupal pages, the admin theme used is the default, Seven, which results in black text on a gray background — a poor choice for such wide screenshots being compressed into small images on the page. Consequently, much of the text is barely legible, especially for anyone with imperfect eyesight.

From a technical point of view, the information provided is accurate and worthwhile. The only serious problem is the misleading advice, noted above, concerning the placement of custom modules and themes within the directory structure of a Drupal project — which was undoubtedly unintentional. The reader will encounter some HTML markup, a lot more CSS, and a minimal amount of PHP code. All of it is neatly formatted, and the only apparent problem is where a snippet of example code includes invalid nested "<?php" tags (page 188).

Despite these minor blemishes, this is one of the better-written Drupal books on the market. Web designers who will be working on Drupal projects, should be well rewarded in choosing this book as a solid starting point for their studies.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Drupal 7 Multi Sites Configuration

Michael Ross writes: "All the leading content management systems (CMSs), including Drupal, use a combination of source code, in files, and user/configuration data, in a database. There may be some mixing of the two types of components — such as configuration settings stored in small files, or JavaScript code stored in the database — but most CMS-based websites generally employ this separation. One significant benefit is that updates to the non-custom code (the CMS's "core") can be easily made without overwriting user data or custom configuration settings. However, each website has its own copy of the core code, even if the websites reside on the same server — which wastes disk space and wastes developer time when all of those instances of core need to be updated. Thus there is growing interest in running multiple websites on a single core instance, despite the dearth of documentation for how to do so. For those in the Drupal world, one resource is a new book by Matt Butcher, Drupal 7 Multi Sites Configuration.

Released on 26 March 2012 by Packt Publishing under the ISBN 978-1849518000, the book spans 100 pages, organized into five chapters. For developers familiar with the subject — particularly those who have read the (few) articles that cover Drupal multisite — it may seem inconceivable that such a subject could fill an entire book. Yet for the countless Drupal developers and administrators who have encountered critical problems in implementing the advice proffered in the aforesaid articles, a definitive book could be invaluable. Even a brief perusal of the book's table of contents will show that there are more topics to be covered than one might have imagined. This review is based upon a print copy of the book kindly provided by the publisher. An electronic edition is available as well. More details can be found on the publisher's page, where visitors will find an overview, a table of contents, a brief author biography, and links for purchasing the print and electronic versions of the book.

In the first chapter, the author presents the fundamental ideas and many benefits of basing multiple Drupal websites on a single code base, known as "multi-site hosting." He discusses the most common configuration options, and then focuses on the one used throughout the book, namely, Drupal's built-in multi-site capability. One thinks of Drupal (and any other PHP applications) as running on top of the web server layer (typically Apache); so readers will likely be confused by the statement that virtual hosting "is a layer higher than Drupal's multi-site feature" (page 8). Aside from that, the discussion is straightforward.

The second half of the chapter provides detailed instructions on two methods for setting up a server for multi-site usage. The first method utilizes virtualization, specifically VirtualBox and Vagrant, which supposedly are ideal for spinning up disposable websites. However, the instructions for "Installing our tailored Vagrant project" quickly become problematic: The MultiSite Drupal Vagrant Profile directs the user to perform a git clone command, and then "cd multisite_drupal_vagrant_profile," which works fine, as that directory exists. But the next step, on page 15 of the book, calls for the reader to cd into "multisite_vagrant," which does not exist. Was the aforesaid directory intended? Apparently so, as otherwise the third command, "vagrant up," fails. Windows users, at the very least, may find these steps and those that follow to be quite perplexing. In my case, both VirtualBox and Vagrant initially appeared to fail installation; yet upon trying them again, they were apparently running. But certain operations discussed in the book, were never executed. I slogged my way through numerous cryptic error messages, and eventually gave up. Any other reader who experiences anything similar may also chuckle at the author's claim that "This made it easy to get an entire server environment configured and running without dealing with the nuances of configuration" (page 17). The second method presented for setting up a multi-site environment is to manually configure Apache and MySQL. Even though this approach is probably what most readers will settle upon, it is sadly given a backseat to Vagrant.

In the second chapter, "Installing Drupal for Multi-site," the author explains how to perform the standard Drupal 7 installation, but for three example instances. For those readers unable to get the Vagrant method working fully, or who for some other reason choose not to use it, the author's frequent references to Vagrant will likely be increasingly annoying. Fortunately, it tapers off about halfway through the chapter, as the author explicates the details of multi-site configuration, concluding with some tips on where the reader can find assistance if she encounters any difficulties during an install. The only flaw is, on page 41, where the author states that "the lines that typically need changing are highlighted," but none of them are.

The complexities of sharing configuration settings among multiple websites, compose the first topic addressed in the third chapter. All of the technical information appears to be sound, except for the advice on page 46 to add the line "global $conf;" in the shared settings PHP file, which is included in the site-specific settings files. A "global" keyword would only be needed if the line setting the array value $conf['site_slogan'] were inside a function, in which case the variable $conf would have only local scope without the keyword. The PHP documentation on variable scope notes that, for a (non-global) variable, its "scope spans included and required files as well." (I confirmed this with a quick test, in which a shared settings file changed the slogans of two different websites.) The author then explains how to share modules and themes among multiple websites, or keep them separate. The chapter concludes with information on how subthemes in separate Drupal 7 instances can use a single base theme.

The fourth chapter, "Updating Multi-site Drupal," focuses on the administration of multiple websites sharing Drupal code. Readers will learn of the numerous pitfalls that can catch the unwary (or at least the inexact). The fifth and final chapter, "Advanced Multi-sites," continues the discussion of other factors that can complicate and undermine working off a single Drupal code base: favicons in themes, robots.txt files, shared authentication, shared content, and other topics that one may never encounter if only working with simple websites — but could be critical otherwise. The only readily apparent flaw is his referring to the project at http://drupal.org/project/virtual_site as "the Virtual Site module" (page 80), when in fact it is the Virtual Sites module — not be confused with the actual Virtual Site module.

Unlike most Packt Publishing books, this one contains relatively few errata: "served [a] few" (on the first "About the Reviewers" page), "start its" (page 17; should read "start it"), "Drupal looks for, for site configuration" (page 30), "trouble shooting" (42), and a missing ")" in the first sentence on page 67. Scattered throughout the book are several instances of title case used inappropriately when referring to generic concepts that are not proper names, e.g., "Version Control System" (page 10). Fortunately, all of these flaws are quite minor, and should have been caught by the publisher's production team.

Some of the narrative is a bit redundant, such as a question being asked at the end of one section, only to be repeated at the beginning of the next section, sometimes more than once. The (unneeded) chapter summaries add to the repetition, as do the introductory paragraphs of each chapter, many of which merely tell the reader what she just read in the previous chapter. Yet the author's narrative style is generally clear and easy to understand.

The main problem with this book is the VirtualBox and Vagrant pair — specifically, the (unjustified) heavy emphasis upon them, and the spotty instructions for configuring them, which could easily confuse and discourage readers. The information is mostly confined to the first two chapters, yet all of it should have been left out, or consolidated and relegated to an appendix — especially as most readers would not use Vagrant for their development environments, and probably no one would use it for a live production environment.

But for anyone interested in setting up multiple Drupal-based websites that share a single code base, these blemishes are of little consequence. Although modest in size, Drupal 7 Multi Sites Configuration provides the most thorough coverage to date of this worthwhile yet oft-neglected subject.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Head First Python

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

Veteran computer programmers — adept with languages such as PHP, Perl, and JavaScript — typically have no trouble learning an additional language, often just by reading online tutorials and stepping through sample code. But for those new to programming, that approach can prove difficult and frustrating. Yet nowadays there appears to be growing interest among such people for learning how to write programs in Python, especially as it is seeing increasing use by Google and other organizations, and is often chosen as the primary teaching language in schools. For such budding programmers, one possible starting point is the book Head First Python.

Its author is Paul Barry, an experienced programmer and lecturer in computing science. The book was published by O'Reilly Media, on 7 December 2010, under the ISBN 978-1449382674. On the publisher's page, visitors can learn more about the book and its author, see feedback from readers, peruse the discussion forum, and read the errata identified so far (many of which appear to be fixed in the most recent printing). The book's example code is available from Head First Labs. It is packaged into a large Zip archive file, containing directories for all the chapters. Additional resources — such as test data — can be downloaded from a page on the website of the school where the author teaches, The Institute of Technology, Carlow in Ireland. (But don't bother trying to use the site's search functionality to find more information about him, because no search results are returned, as of this writing. Hmm, what is the Goidelic word for "fail?")

The book's material, spanning 494 pages, is organized into 11 chapters, plus a supplementary section for more advanced topics. In the first chapter, "Everyone loves lists," the author briefly explains how to find and install on one's computer Python and its IDLE development environment, if necessary. Oddly, he assumes that if it is already present on a Windows machine, then it will be found in the directory c:\Python31; this is repeated in the second chapter as well. More importantly, he mentions the (command-line) command to start the Python shell, but then immediately begins describing IDLE, without mentioning how to get it running. Most of the chapter explains how Python supports lists and functions, although the coverage of the latter topic is much too brief, considering how critical functions are in any programming language, including Python.

The second chapter shows how to bundle up functions into modules, and make them available to other developers through distribution utilities. This may be an important topic, yet it is inconceivable to me as to why, so early in the book, the author dives into the rather involved details of registering with PyPI and distributing a Python module to the rest of the world, before even introducing such language basics as input/output, files, and objects. (More on that later.)

If the reader perseveres through all the flaws in the first two chapters, then she will likely find that the quality of the narrative gradually improves throughout the rest of the book. An example of this is the third chapter, which addresses basic file access and exception handling. The following chapter, which focuses on data persistence, extends the discussion of how to save in-memory data in files, including the use of the standard library "pickle" for dumping and later loading any type of data. The next few chapters introduce the reader to increasingly complex ways of representing data, in the form of lists (again), dictionaries, and (object-oriented) classes. The discussion is fairly clear, except readers familiar with other object-oriented languages may be confused on page 194, where class attributes are being defined in the constructor only. In fact, the author does not fully explain where attributes can be defined, and what their resultant scope would be.

The seventh chapter roughly marks the halfway point in the book, and also is where the focus shifts from developing Python programs to releasing them to the public. The author begins by incorporating techniques presented earlier in the book, to build a Python-based web app, using the popular Model-View-Controller (MVC) paradigm. The next chapter shows how to port those web apps to mobile devices. Chapter 9 extends these topics, by demonstrating how to query for and accept user data in HTML forms on web pages, and in similar dialogs on Android phones — as well as how to store that data in an SQLite database. The next logical step is to learn how to make Python apps scalable, as well as cloud-based, in this case using the Google App Engine (GAE). Readers are also introduced to Django, for form validation. The final chapter, and the appendix, cover a number of miscellaneous topics, such as how to spreadsheet-type data storage, development IDEs, variable scope, unit testing, and regular expressions.

Most readers should find that the relaxed writing style makes this book approachable, though fairly lengthy. Like most if not all of the other books in the Head First lineup, this one is made more palatable with a sense of humor that is not silly — a welcome improvement to any programming book. The best parts are in the "fireside chats," which are fictional and sometimes pointed conversations, oftentimes between two similar components of Python.

Yet the narrative is far from perfect. Some of the phrasing is ponderous, e.g., "Perform the edits to your code" (page 113); why not just "Edit your code?" A few concepts are used without explanation, e.g., the Python value of "None" (page 80). Some technical slang terms are used quite early in the book, yet with no definitions or explanations for the neophyte — e.g. "app" and "webapp" (both on page xvi). Admittedly, most readers of this book will be programmers or other techies, who feel comfortable with those terms. But the Head First series is intended for people just getting started, and thus all such terms should be explained up front, if only briefly.

There are numerous errata not found in the aforesaid list (on the O'Reilly Media website): "tools to for accepting" (page xviii), "design user-friendly websites" (xxvii; should be "learn Python"), "try and" (14, 84 twice, and 188; should be "try to"), "As your plan to" (37; "you plan" was likely intended), "utiliites" (49), "users that" (50; should be "users who"), "argment" (52), "a iterable" (53 and 54), "the the list on screen" (64), "the your latest version" (65), "a argument" (71), "gives you with a chance" (88), "file's contents" (123; incorrect plural possessive), "the facilities pickle" (134; probably should be "the pickle facilities"), "your were" (170), "it's new mode" (185; no apostrophe in "its"), and at this point I ceased recording errata. These flaws, plus the 119 already reported, suggest that the author and O'Reilly copy editors did not perform enough quality control when working on the manuscript.

One glaring problem with the material is the dramatic unevenness in the depths of coverage, from one topic to the next. For instance, even though the book is aimed at readers who already know another programming language (page xxiv), an entire section is devoted to establishing the (obvious) non-scalability of having to use an individual print() statement for every item in a list, and the superiority of instead iterating through the list (page 15). Yet in the same chapter, only a couple pages (29-30) are provided to explain functions, with no discussion of topics important to any programmer, such as whether one can set parameters to default values, or how to pass arguments by reference, if it's even possible. Some of this unevenness is due to the book's goal of presenting technical information in an easily-digestible form; for instance, in Chapter 7, the reader is told how a web server returns a web page, but later faces the minefield of invoking Python's built-in web server on a CGI server.

A second significant problem is the often-illogical ordering of material — both high level and low. Chapter 2 illustrates both cases: The author recommends that the reader release her code to the public (in the form of modules) after presumably having learned only one chapter's worth of material, when such code would undoubtedly be unready for public consumption. At a much lower level, the first "There Are No Dumb Questions" entry in the chapter briefly discusses various editors that could be used for writing Python code. This information should have been presented at the beginning of the first chapter, or even in the introduction — not after the reader has already chosen whatever editor seemed most convenient at the moment, and probably saved at least one file of code. A third variation of this problem, is when the reader is tested on concepts not previously presented — such as the "Who Does What?" section on page 53, which quizzes the reader on half a dozen functions, none of which the reader has presumably even seen before, and some of which are never mentioned again in the book!

In terms of the typography of the print version of the book, I found the font face and size to be problematic, especially on those pages where the text appears to have been printed a bit too lightly — at least in the review copy of the book kindly provided to me by the publisher. For instance, all of the code on page 227 is practically unreadable. Throughout the book, in the snippets of code, the comments are a light gray making them quite difficult to read — probably because these are screenshots of IDLE sessions, in which comments are by default displayed in green, which apparently does not translate well to grayscale illustrations.

Overall, this book appears to have received less oversight and editing than is typical in the Head First series. If you are a veteran programmer searching for a concise treatment of Python, then this book is not optimal for you. Yet if you seek an engaging and highly visual introduction to an elegant programming language, then Head First Python can be a worthwhile place to start your journey.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Google+: The Missing Manual

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

Prior to Google+, the company's previous attempts at social networking — Orkut, Dodgeball, Jaiku, Wave, and Buzz — were largely failures, and tended to frustrate users who had devoted time and effort to contributing content and establishing connections with other users, only to see the services wither on the vine. In contrast, Google+ appears to be receiving far more nurturing by the Internet behemoth, and as a result has arguably better chances of not just surviving, but expanding to the point of eventually challenging Twitter and Facebook. Like its rivals, Google+ offers online help information to explain to newcomers the basics of how to use the service. But there is little to no advice on how to make the most of its capabilities, and even the basic functionality is not always clearly explained. That is the purpose of a new book, Google+: The Missing Manual.

Authored by Kevin Purdy, the book was published by O'Reilly Media, on 30 December 2011, under the ISBN 978-1449311872. The publisher's page has a brief description of the book, its table of contents, some comments on the book from customers and reviewers, a couple errata (as of this writing), and links for purchasing the print version (such as the one kindly provided to me by the publisher) and/or the e-book versions (in EPUB, MOBI, and PDF formats). The "missing CD" page has links to most if not all of the online resources mentioned in the text.

Like the other entries in the Missing Manual series, this one starts with the basics, and builds upon that foundation. It does not assume any knowledge of Google+, or even possession of a Google account.

The book's material is organized into nine chapters, for a total of 232 pages. The first chapter, "Getting Started," explains exactly how to join Google+, invite friends to your new network, and configure your profile, including your privacy settings and a photo (even tweaking it online). The second chapter, "Managing Contacts with Circles" covers how to create new circles, edit and organize existing ones, share them with other Google+ users, and find people to add to your circles. But, oddly, the information is not presented in that logical order. The author explicates the advantages of using more than the default four circles provided by Google. Some points are repeated, but briefly enough that it is inconsequential.

While the first two chapters lay the foundation for joining Google+ and setting up your account and circles, the next three chapters explore the details of using this service — starting with "Streams, Sharing, and Privacy," which explains the various types of streams (main, circle, Notification, and the now-defunct Incoming stream), as well as the user interface elements for those streams and the individual posts they comprise. The author also demonstrates how to write your own posts, specify who gets to see them, edit your posts, and interact with the posts submitted by other users. The next chapter explores the important topic of notifications, which are sent as e-mail messages, smartphone messages, etc. Helpfully, the author discusses the differences between the user interfaces of the Android and iPhone notification apps. The subsequent chapter fully explains how to share photos and videos with other Google+ users, as well as how to upload and perform basic editing of images. However, it may have been more logical to present the latter information before the former.

For people who want the capabilities previously only provided by commercial web conferencing services, hangouts might be the most welcome feature of Google+. Chapter 6 explains how to set up and participate in these videos/audio meetings online, as well as how to incorporate Google Chat, YouTube videos, and Android devices. The subsequent chapter, "Searching and Sparks," has plenty of advice on how to search for other Google+ users and the content they contribute. The penultimate chapter dives into the differences you may encounter when using Google+ on small screen devices — specifically, Android and Apple smartphones and tablets. The last chapter, which is the briefest of the bunch, is also likely to prove the least useful to most readers, as it covers how to get started playing the games built into Google+.

The book does not cover Google+ Pages, which was likely introduced after the final draft of the book was submitted to the publisher. Readers are directed to an untitled 14-page PDF file that covers the essentials of Google+ Pages. Oddly, the publisher's page links to that file with the text "Download Example Code"; but there is no example code for this book. The supplement contains a few flaws: "box pop-up box" (page 4), "using a promoting your Page" (9), and "his her name" (11).

Speaking of which, given the relatively modest number of pages in this book, and the limited amount of text on each one, this book contains far too many errata: "works different" (page xiii; echoes of Apple's infernal "Think Different" marketing campaign?), "If typing web addresses by hand that isn't" (page 3), "a different a social networking site" (4), "she's added you [to] her" (54), "added to [the] +Add box" (58), "even if [you] just" (79), "and the[n] click the" (79), "settings that lets you can choose" (83), "modicum [of] more fuss" (105), "share its photos [with] specific circles" (117), "where [the] photo" (124), "just like [the] lightbox view" (126), "and or" (147; should read "and/or"), "an job" (148), "how to [use?] Google+ running" (169), "search find" (170), "bring up to the same list" (180), "The form exact" (185; should read "The exact form"), "you can't get start" (191), "in in" (193), and "a box let you know" (194).

Some of the statements in the narrative are odd — for instance, "Halloween right around October 31" (page 7; when else would Halloween occur?). Other phrases are poorly worded — for instance, "whenever you feel irked or like something must be broken" (44), "maybe an extra like a link" (60), and "select an item from the menu that appears to see only circle-related notifications" (80). Lastly, at least one pair of verbs have inconsistent form ("start" and "mentioning" on page 62). All of these blemishes should have been caught by the copyediting crew. But for the most part, the narrative is straightforward. It is occasionally livened up with a bit of humor, which is good, because portions of the text begin to sound the same, as a result not so much of the author's writing, but more the Google+ interface itself.

Only a few technical errors are immediately evident — for instance, on page 61, the author refers to a for-loop in computer code incorrectly: "+1 is a common way of making a program run over and over again." But it is not a program that is being repeated, but rather a code block.

Scattered throughout the text are numerous text boxes — most of which are labeled "Note" or "Tip." Unfortunately, they are set in a font that is a bit too small for comfortable reading. Also, there does not appear to be any difference among these types of information sections, yet there are at least half a dozen different names for them.

All of the key topics are nicely illustrated with sample screenshots, in grayscale, oftentimes with relevant controls circled or otherwise indicated. The only weakness is that the author typically does not mention which figure is being referenced in the text — not that that would help much anyway, since none of them have figure numbers. It's usually clear from the context, but not always.

Yet the very existence of this book may give readers some pause: If a book of this size is required to explain how to use a social networking service aimed at the general public, perhaps the Google+ user interface needs to be overhauled and made more intuitive? Yet that process is probably underway, because Google+ is under constant revision. Thus there will be portions of the text and screenshots that differs somewhat from the current incarnation of the user interface and its features. But for most of these instances, it is easy enough to determine how what you read in the book correlates with what you might see on the screen.

The primary weakness of this book is that it does not attempt to explain how Google+ might be integrated into a business's online marketing strategy, nor how it compares against Facebook or Twitter in terms of its advantages and disadvantages. In fact, as noted above, the book addresses Google+ Pages only in a supplementary document. Such information would have made this entry in the Missing Manual series far more valuable.

However, one forte of this book is that the author has clearly put effort into learning and explaining the privacy implications of the various Google+ features — critical in this era of evaporating privacy and data breaches on an unprecedented scale.

On balance, he largely achieves his objective. Google+: The Missing Manual is an informative and approachable introduction to Google's social network.

Michael J. Ross is a freelance web developer and writer."
Books

Submission + - Teach Yourself HTML5 Mobile Application Developmen

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

The last few years have seen the emergence of several significant advances in web technologies, including HTML5 and CSS3 — all impacting the development of traditional and mobile-centric web sites. In turn, various technical book publishers have released titles addressing one or more of these technologies. While one book may focus on HTML5 and the new JavaScript APIs, another might include extensive coverage of CSS3, with little mention of JavaScript. A recent title, Sams Teach Yourself HTML5 Mobile Application Development in 24 Hours, focuses on some of the more commonly employed elements introduced with HTML5, and how they can be used for creating mobile sites and applications.

This book was authored by Jennifer Kyrnin, who has plenty of experience in using as well as teaching web design techniques, and who curates the Web Design / HTML section of About.com. The book was put out by Sams Publishing (an imprint of Pearson Education) on 25 November 2011, under the ISBN 978-0672334405. On the publisher's page, visitors will find the book's description and table of contents, and some sample content in a PDF document, including the first chapter, "Improving Mobile Web Application Development with HTML5." The page appears to not list any reported errata. This book is available in both print and electronic formats (EPUB and PDF), but prospective buyers should be warned that the e-book is less than seven dollars cheaper than the print version ($25.59 versus $31.99), despite the huge disparity in production and distribution costs. The author's web site offers additional information, primarily in the form of a newsletter devoted to HTML5. The preface claims that this second web site has the example source code from the book, as well as ways to ask questions and report errata; but if so, they are well hidden, as of this writing.

Spanning 496 pages in total, the book's material is organized into two dozen chapters, as is usual with any of the books in the "Sams Teach Yourself X in 24 Hours" series. Readers may well wonder if this artificial constraint causes the various authors to structure their books in a way that does not always make sense. In the case of this title, there does appear to be some forced splitting of material between two chapters, namely, "Building a Mobile Web Application" and "Converting Web Apps to Mobile." Conversely, three topics that may deserve their own chapters are lumped together, in "WebSockets, Web Workers, and Files." Moreover, it is arguably unrealistic to expect that the typical reader will be able — or would even attempt — to read and comprehend a technical book of such length and subject matter in only 24 hours — to say nothing of the time required to type in the sample code (in order to test it and reinforce the information learned). This "teach yourself in 24 hours" format borders on "brain surgery in three easy steps." Lastly, it leads to silly phrasing such as: "a result of reading the hour" (page xvii).

The chapters and appendices are grouped into four parts, the first of which is titled "Building Web Pages and Applications with the Open Web Standard." The structure of the first chapter is replicated in all of the other chapters: The author briefly lists what the reader will learn, and then begins explicating the concepts, illustrated with example code wherever appropriate. Each chapter concludes with a summary (which is of no value), several FAQs (whose material should instead be folded into the main chapter content), and a workshop section comprising quiz questions and exercises for the reader to tackle. Part I's eight chapters introduce HTML5, web applications, the W3C Open Web Standard, the new HTML5 elements and their attributes, CSS3 (with justifiably limited coverage), mobile browser detection, JavaScript, and jQuery. Then the author presents the basics of how to build mobile web apps, both from scratch and from using a non-mobile web site as a starting point.

Part II, "Learning the HTML5 Essentials," goes into greater detail of numerous basic aspects of HTML5: the new HTML5 sectioning, heading, and semantic elements; the semantic repurposing of some HTML 4 elements; the new canvas element (with limited coverage of this extensive topic); new typography support; audio and video elements; new form capabilities; HTML editable content, spell checking, and other user interactivity; microformats, microdata, and RDFa; in-page drag and drop; and new functionality for linking (the <a>, <area>, and <link> elements). Readers should note that the discussion in the ninth chapter on the new sectioning elements starts off rather confusingly, but soon improves, making it well worth reading.

The third part of the book, "HTML5 for Mobile and Web Applications," begins with an introduction to web apps, as well as the HTML5 application programming interfaces (APIs) and data sets upon which they may rely. The author then discusses specific APIs that can be of great use in web apps — specifically, the WebSockets, Web Workers, and File APIs, which allow one to make asynchronous connections between the app and a remote host, perform scripted background processing, and access local files. The remaining chapters show how to: make a web app usable even when it is disconnected from the Internet; save data on the client side (using local storage, session storage, Web SQL, and IndexedDB); control the browser history; geolocate the client; and convert an HTML5 application into a native mobile app, with detailed information on using PhoneGap. Aside from the index, the book concludes with three appendices that cover: answers to the end-of-chapter quizzes; a list of the HTML5 elements and their more commonly-employed attributes; and a list of other books and web sites that address HTML5 and mobile design and development.

The average programming book — particularly one of this size, and in a first edition — will contain some errata, and this one is no exception: "shortcut style" should read "shorthand style" (page 37); "Specific[,] Measurable" (87); "complimentary" should read "complementary" (93); the "By the Way" section on page 131 is missing a close parenthesis; "html5elmeents" (136); "will [be] eventually" (184); "a straight line [] they" (184); "makes build[ing] forms" (223); "method[s] exist" (362); "the page [it] is on" (383); and "()creates" (390).

There are some other parts of the text where either the author or the editorial team may have been careless — for instance, the figcaption and figure tags repeated on pages 16 and 18. Fortunately, such cases are few and far between. The HTML, CSS, and JavaScript code is generally of decent quality, except much of the HTML markup is not indented properly. In the JavaScript code, most if not all of the string concatenation is jammed together, making the elements difficult to distinguish (e.g., page 72). Also, some of the HTML does not utilize the more streamlined attributes of HTML5, such as <script type="text/javascript"> (e.g., page 20), or is not well formed, such as </li> tags missing (e.g., pages 236 and 250).

The author occasionally uses terminology that would be comprehensible only to someone who already has the knowledge that the narrative presents for the first time, without providing at least a quick explanation, e.g.: the !"!" JavaScript operator (page 55); the terms "rollover" and "user agent" (page 69 for both); and "the manifest comes up 404 or 410" (page 342). Some of the advice may be true, but is rather outdated, such as the admonitions in the first chapter to not use frames, nor to use tables or spacer images for layout. Those principles were validated and disseminated many years ago. Some statements could easily be misinterpreted by beginners, e.g., "As long as your HTML file is in the same folder as your style sheet file, it will load your styles when your page is loaded" (page 36). Other statements are not explained in detail or substantiated, and consequently the reader will probably not understand the reasoning behind it, e.g., "using the min- and max- extensions is more effective" (page 61), and "a separate mobile domain [] makes your mobile site easier to find" (page 10). Readers may disagree completely with some of the claims, e.g., "XHTML [is] very difficult to write" (page 2).

There are only two discernible problems with the production of the book: In some of the HTML code, curly quotes are used (e.g., page 303). Secondly and more importantly, the san-serif font used to indicate keywords looks much too similar to the serif font of the regular text, causing the keywords to blend into the surrounding material.

Yet the main problem with the narrative is the somewhat erratic manner in which the author skips from one topic to the next, often providing just a few paragraphs or even sentences for each topic — giving the impression that critical information may have been neglected as a result of the less-than-methodical organization of the material. Most of those topics are discussed again, in varying levels of detail, in later chapters. This is not optimal, because technical readers generally hope to find full coverage of any given topic in one place; hence, it can be frustrating if the information is scattered throughout a book. This is especially true if the reader has already read the book in full, and is now returning to it in order to utilize it as a reference source. For instance, in many cases, attributes are presented, but without detailed explanation or examples. Fortunately, the worst of it seems to be confined to Part I of the book, which contains most of the introductory material. Most if not all of the key concepts appear to be addressed to at least some extent. Lastly, some of the information that should have been presented right up front, is not, e.g., the definitions of HTML5 on pages xiv, 1, and 52.

Unlike most programming books nowadays, this one has few instances of phrasing that would baffle the reader for long, and there are no goofy attempts at humor. For most of the topics, the information provided is the minimum to achieve the bulk of the desired results. The advantage to this is that the narrative is generally concise and quick to read, and the author is able to cover a lot of ground without having to package such a broad topic in a (more expensive) tome. Some of the narrative is quite good, such as the explanations of the various browser exceptions involved in the HTML5 drag-and-drop functionality.

Despite the aforementioned blemishes, this book is definitely worth a look, because it is currently one of the most complete tutorials for learning how to use HTML5 for creating mobile apps and web sites.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Head First HTML5 Programming

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

Web designers and developers alike are increasingly enthused about the capabilities offered by HTML5, which is generally considered the combination of the latest version of the Web's primary markup language and its related technologies. Consequently, publishers have rushed to market a wide variety of books that purport to explore the inner mysteries of HTML5, even as the standards — and how browsers implement them — are still in flux. In characteristic fashion, O'Reilly Media took the time to wait for some of the dust to settle, and attempted to create a resource more approachable and solid than those thrown together quickly. The final result is Head First HTML5 Programming.

The release of this book is quite timely, given the current developments in web technologies. As one of the underpinning components, HyperText Markup Language (HTML) has undergone tremendous change during its two-decade history — with new element names and attributes being added to try to keep up with the latest multimedia formats, design techniques, and other factors in the Internet's evolution. Even though this newest major revision, HTML5, is still not completely supported by most browsers, much of its capabilities are already available, to one extent or another. Also, forward-thinking designers and developers are not waiting for the final blessing by the W3C to begin learning what they can do with it now and in the future.

This book was written by Eric Freeman and Elisabeth Robson, both of whom possess a lot of experience with the subject matter. This title was released on 18 October 2011, under the ISBN 978-1449390549. Its considerable size, 608 pages, is partly due to the extensive use of humorous pictures, actors, scenarios, clever drawings, and a generous use of whitespace — characteristic of other titles in the Head First series. At first glance, these elements might seem like cartoonish gimmicks, meant only to boost the page count or keep graphics employees busy. Actually, these methods are intended to help readers retain the new knowledge, and make the learning process more pleasant. This approach is covered in more detail in the book's introduction.

The material is organized into ten chapters, followed by an appendix. The only technical prerequisite, for prospective readers to get the most out of the book, is a solid understanding of HTML and CSS. Some JavaScript knowledge would be helpful, but is not necessary. On the publisher's page, visitors will find more details about the book, a couple reader reviews, some brief author bios, links to purchase the print and electronic versions (PDF is the only format), and the reported errata (of which there are eight, as of this writing). The example code and other files for the book can be obtained from WickedlySmart.

The first chapter introduces HTML5, at a high level and a fast pace, focusing on the new features that it offers, such as the new JavaScript APIs: embedded video and audio (without the use of plug-ins), client-side data storage, off-line web apps and caching, geolocation, canvases, sockets, Web Workers, and advanced capabilities for forms and drag-and-drop. JavaScript is also introduced, with some simple example code. Much more detail is presented in the subsequent chapter. The only confusing point is, on page 53, when the authors state that there are three different ways to add JavaScript code to a web page, but the figure shows four permutations. The third chapter explains how to work with events and handlers, using a simple music playlist app to illustrate the ideas. In the subsequent chapter, functions and objects are explored in much greater detail, and the presentation is quite methodical and comprehensible.

With Chapter 5, "Geolocation," the authors shift from establishing a foundation of basic JavaScript knowledge, to showing how to apply it for constructing web applications. In the case of geolocation, readers are stepped through the process of building a simple web app that detects the user's current position, displays it on a Google map, and tracks any changes in the position. The next chapter shows how to make one's code work with web services, using the JavaScript communication APIs, and why JSONP bypasses the problems with XMLHttpRequest requests being blocked for security reasons by the JavaScript same-origin policy. The presentation is solid, except for the claim on page 257 that the callback receives an object, when actually it receives an array of objects. Chapter 7 explicates the new canvas element, which offers capabilities encroaching upon the realm of Adobe's Flash. The next chapter, titled "Video," is a logical continuation of the discussion on the canvas element, because the latter allows one to do a lot more with the video API. The authors demonstrate how to do that, after discussing the different video formats and techniques for writing robust HTML to accommodate as many brands and versions of browsers as possible.

HTML5 has taken the venerable browser cookie, and extended its storage capacity tremendously, in the form of the local storage API (a.k.a. "Web Storage"), which is addressed in the penultimate chapter. Sadly, no troubleshooting information is provided in case the reader finds that the example code does not work in Firefox, even when using a web server (i.e., "http://" instead of "file://") — and instead fails quietly with an error message "localStorage is null" in the JavaScript error console. (For those who are interested, one source of the problem is when the Firefox configuration preference "dom.storage.enabled" has somehow been set to "false.") The tenth and final chapter, "Web Workers," shows how to utilize multithreading in JavaScript code to improve its performance, when possible. Readers using Firefox 8.0 (the latest version as of this writing) will likely find that the example code does not work on a localhost, throwing a "Could not get domain" error message, as a result of a known bug. The appendix briefly covers ten additional topics not discussed in the chapters, including Modernizr, the audio element, jQuery, XHTML, SVG, and more.

With a book this size, it is inevitable that it will contain various blemishes. Some of them are a result of the book production process: In the text, JavaScript tokens are not distinguished from English words in any manner (such as a monospace font or bolding), which can trip up the reader. On some of the two-page spreads, the portions of the images and arrows get lost in the book's gutter. In the many illustrations involving one or more persons saying something, their statements are shown in thought bubbles, which is mildly but invariably disconcerting. Other flaws are results of the writing and/or editing: Commas are oftentimes used where semicolons or periods were called for, or just missing altogether — especially in the mock interviews. Sometimes the conversational style — characteristic of the Head First series — becomes a bit too casual, and in some places the authors are trying too hard, such as the repeated use of "skool."

The example code is generally of good quality, but not always consistent; for instance, is employed in some places, but elsewhere — leaving the reader to wonder why. Also, there's at least one case of (incorrect) curly quotes in the code (page 454). It is helpful to have the example code available for download, although it would have been decidedly better had the root directory of the archive file contain an index.html pointing to all of the included apps, so readers could bookmark that single starting point, rather than having to modify their browser's URL each time. In addition, it is oftentimes not obvious as to which chapter subdirectory corresponds to any given location in the book.

However, the main problem with this book is the sloppy editing, evidenced by the notably high number of errata: "pin point" (page xiv), "test editor" (xxii; should read "text editor"), "iPhone" (xxv; should read "HTML5" or something similar), "folks that" (xxxi; should read "folks who"), "get [a] sense" (1), "on the page 2" (3), "can you get a long way" (21), "assign it [the] empty" (26), "you can also thrown in" (40), "its got" (46), "Your job is the act like" (57), "lets concentrate" (58), "get [the] length" (68), "Go ahead an open up" (90), "What you can" (129; should read "What can you"), "a object" (142), "an new object" (147), "to to" (158), "you [are] saying" (158), "users location" (166), "sourth" (167), "three properties" (177; should read "four properties"), "google" (186), "including [the] last two methods" (192), "give it a try it" (218), "will use" (220; should read "we'll use"), "take a 90 milliseconds" (221), "the this code" (249), "with out with" (268), "HTML =" (271; should read "HTML5 ="), and "an drawable region" (285). These are just the errata found in the first half of the book. Fortunately, they are in the narrative, and not the example code, which would have had a much more negative impact upon the reader.

This book is definitely an introductory tutorial, and by no means a reference. Not all of the new HTML5 elements are covered, nor is CSS3 provided full coverage. The repetition of concepts may aggravate experienced or impatient programmers: For people with some experience with these technologies, and for people who readily glean information from technical books upon first exposure to the given concept, the frequent repetition in this book would border on tiresome, if it weren't presented so pleasantly, oftentimes with humor. On the other hand, the Head First books are predicated on the approach of presenting information in different formats, to maximize learning. Any newbie should appreciate this volume's clear explanations, even if they are presented multiple times, but differently. Also, there is plenty of testing of one's knowledge, to reinforce what has been learned.

Head First HTML5 Programming is an entertaining yet instructive and compelling tutorial on how beginners can learn to use many of the advanced new techniques in HTML, CSS, and JavaScript.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Responsive Web Design

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

With more people accessing the Internet using mobile devices than computers, web designers and developers are challenged to make sites that work well on both categories of hardware — or resign themselves to the greater costs and other disadvantages of maintaining two versions of each web site (a mobile-ready version as well as one for much larger screens). Fortunately, recent advances in web technologies are making it easier to build web pages whose contents and their positioning are automatically modified to match the available screen space of the individual user. These techniques are explored in detail in a recent book, Responsive Web Design, written by Ethan Marcotte, a veteran web designer and developer.

This title was published on 7 June 2011, under the ISBN 978-0984442577, by A Book Apart, as the fourth in their series of "brief books for people who make web sites." On the publisher's page, visitors will find brief descriptions of the book and its author, links to purchase the print and e-book versions (or the two combined, at a substantial discount), and three promotional blurbs also used on the back cover of the print version. The e-book package consists of six files: the book in EPUB, MOBI, and PDF formats; an EPUB document on responsive design for video; a letter from Jeffrey Zeldman (the book's publisher), Jason Santa Maria (its designer), and Mandy Brown (its editor); and the previous five files zipped into an archive. This book is also available in French, perhaps reflecting the publisher's greater awareness of internationalization relative to mainstream technical publishing houses.

Readers of the print version will likely be first struck by its diminutive size — just 143 pages. In fact, the book is so slender that only half of the spine title actually fits on the spine. (It's either a bold design statement against conventional publishing practices, or an even bolder typographical error committed inexplicably by a well-regarded design firm.) Flipping through the glossy pages, readers will also notice the judicious use of text color to indicate HTML and CSS code, and highlighted fragments therein. Even more visually impressive are the full-color screen shots and other figures. The book begins with the previously mentioned letter, as well as a short yet delightful foreword by Jeremy Keith; it ends with the author's acknowledgments, suggested resources, references by chapter, and a suspiciously brief index, not much longer than the author bio that follows it.

The bulk of the information is organized into five chapters — the first of which, "Our Responsive Web," presents a high-level rationale for architecting web sites that can be maximally useful on a wide range of devices, with screen sizes ranging from the smallest found on smartphones, up to widescreen TVs attached to web-enabled game consoles. Throughout the book, to illustrate the principles of responsive design, the author utilizes a fictional example web site, "Robot or Not", designed to assist users in identifying robots masquerading as humans (which would have been helpful to the crew of the spaceship Nostromo!). This short chapter is essentially just an introduction.

The author gets down to business in the second chapter, titled "The Flexible Grid," which demonstrates how grid-based layouts can be used to more easily position page elements for greater visual consistency. He goes into detail in showing how such layouts can be made flexible, with font sizes specified in character widths and positioning specified in proportions of containing elements. Experienced designers will probably not encounter any new concepts in this material. These techniques are extended in the subsequent chapter, "Flexible Images," which explains how to use percentages when working with images (both markup and CSS) and other media types — including workarounds for the browser most despised by web designers, Internet Explorer.

Media queries, introduced to the world in CSS2, are now a key technology in responsive design, and are discussed in Chapter 4, which forms the core of the book. The author shows how to use them to cause the browser to apply CSS rules selectively based upon such factors as the width of the browser viewport. All of the narrative is clear, except for the statement on page 66 that the example web site's logo is "scaled down to a nearly microscopic size" in Figure 4.2, when in fact it appears unchanged. Readers may wonder why — after noting that mobile devices do not consistently use "handheld" or "screen" as their media types — the author does not explain why the recommended media queries use "@media screen," and not "@media all" to be more encompassing. Nonetheless, the discussion of media query techniques is instructive. It continues with a look at how to use them in older browsers, using JavaScript libraries, css3-mediaqueries-js and Respond.js. Lastly, the author shows how incorporating some fixed widths into a flexible design may be an optimal approach.

The fifth and final chapter, "Becoming Responsive," discusses real world implications of responsive design. The author counters an interesting contention: web sites on mobile devices should not simply be the desktop content scaled down to a smaller screen, but instead should offer different content, more appropriate for the individual on the go. He then touches on the topic of designing sites first for mobile, rather than the traditional approach of trying to shoehorn a full-size site onto a small screen. The bulk of the chapter is devoted to presenting a workflow employed by the author in creating actual client sites. It concludes with a demonstration of how to add a slideshow using a jQuery plug-in and some custom code, so it abides by the principles of progressive enhancement.

In terms of the physical book, the quality is top-notch, and the full-color images are quite compelling. Sadly, each figure tends to bleed through to the other side of its page, but fortunately not enough to inhibit reading the text on the other side, or appreciating any of the images. The e-books are also quite readable — probably more so compared to the electronic versions of other programming books, given the smaller line lengths.

In terms of the narrative, Ethan Marcotte has a somewhat goofy writing style, replete with nerdy side comments and jokes, which some readers may regard as padding, particularly in those sections where they are quite numerous. The same may be said for the hyperbole in some spots, such as "Marvelous. Wonderful. Stupendous, even." (page 33). On the other hand, many readers may enjoy the lighthearted style, especially those jokes that work well. More importantly, the explanations are generally comprehensible and thorough. I was able to find only one erratum ("or a maybe an animation," on page 119), and the only grammatical error was the frequent use of the term "that" to refer to people, instead of "who." Otherwise, there were no glitches in the writing, and most techies will find this book a fairly quick read.

From a higher-level perspective, one sometimes hears an objection raised against web design/development books such as this one — namely: all of the book's information is freely available in articles, blog posts, forums, IRC channels, and other resources for programmers. So why purchase a static book whose author probably started writing it months if not years in the past? Such technical information is scattered among numerous websites, thereby forcing us to spend time searching around, and in many cases skipping over redundant material. Also, the advice tends to vary in quality, and hence we must distinguish what information is out of date or simply invalid. Likely every experienced developer has been tempted by an article titled such that it sounded as though it would contain the exact solution to the problem at hand — only to discover that the title was quite misleading, or the people contributing to the comments were equally befuddled (and frustrated). Technical books geared toward the working professional can obviate these problems, because they bring together most of the information known by the industry, into a cohesive whole, that is then vetted by technical reviewers and editors. In the case of this monograph, Ethan Marcotte's well-regarded seminal article, in conjunction with the other most popular articles on responsive web design, would still not be a sufficient substitute for this resource.

For web designers and developers alike, Ethan Marcotte's book is a neatly-crafted and authoritative single-source tutorial on how to build responsive web sites that will likely prove robust on a wide range of platforms.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Drupal 7 Themes

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

If you need a theme for a web site based on Drupal 7, then you have a few options for obtaining one. You could go with an existing theme, but the current crop of prebuilt themes is even more limited for Drupal 7 than its predecessor. You could hire a dedicated Drupal themer to create one for you. Or, to avoid the expense, you could try to build your own. In that case, you will need to get up to speed on the changes in the Drupal presentation layer. Unfortunately, most of the Drupal 7 books devote only one or two chapters to the topic. Several Drupal training firms offer video instruction, but the bulk of their material is still geared to version 6, or even 5. The online documentation is of little help. Yet there is a book that is wholly dedicated to the topic: Drupal 7 Themes, authored by Ric Shreves.

This title was released by Packt Publishing on 24 May 2011, under the ISBN 978-1849512763. This review is based on a print version of the book, kindly provided by the publisher. An e-book version — in both the PDF and Mobipocket formats — is available from the publisher's page. Visitors will also find a book description, the table of contents, a sample chapter (the seventh one, "Dynamic Theming"), and, elsewhere on their site, the reported errata (only one at this time). None of the example code presented in the book appears to be downloadable — probably because there is little of it. Like so many Packt Publishing titles, this one is relatively slender compared to other publishers' Drupal books, at 320 pages. The material is organized into ten chapters, as well as an extensive appendix occupying a quarter of the book. The preface notes that the only requisite knowledge is "basic experience of working with Drupal," as well as HTML, CSS, and, optionally, some basic knowledge of PHP. This book is a revised and expanded edition of his previous book, Drupal 6 Themes.

The first chapter provides an overview of the basic concepts of Drupal theming, including its purpose, its customization capabilities, the intercept/override paradigm, sub-themes, some online resources, theme engines, theming output, front-end versus admin themes, the default Drupal 7 themes, and theme files. It is a decent introduction, but would likely be more helpful to theming newbies if the basic concepts — such as what themes are — were discussed prior to more advanced topics — such as intercepting and overriding. All of the material is clear, except for the reference on page 21 to "the Add Shortcut icon," which is not identified or apparently even present in the referenced screenshot. Chapter 2 covers the basics of the configuration settings for themes (global and specific), blocks, and regions, as well as how to install and uninstall themes. It can be safely skipped by anyone familiar with administering a Drupal site.

PHPTemplate has become the de facto templating engine in Drupal, and is introduced in the third chapter. The author focuses on the key files that compose a Drupal theme, and for illustrative purposes uses two themes built into Drupal 7: Seven and Bartik. The author of the latter, Jen Simmons, a female web designer, is oddly referenced in the masculine (page 80). The subsequent chapter gets off to a poor start with nine paragraphs that essentially state the same thing, over and over. But it eventually delves into the critical topics of default templates, themeable functions, individual styles, and whole stylesheets, as well as how they can be overridden using custom CSS and PHP code, including template preprocessing functions. The theory is later illustrated with a focused examination of Bartik. It is with this material that the author begins digging into the technical details of how custom Drupal theming is accomplished.

Chapter 5, "Customizing an Existing Theme," demonstrates how to create a sub-theme, in order to leverage the functionality of a base theme. Readers may be confused as to why the author chose to not present his list of recommended base themes, until the next chapter. After all, readers presumably would want to know the optimal candidates for starter themes while first learning how to select and use them. This confusion could have been avoided had the author explained that those are not just base themes, but starter themes. More importantly, the narrative contains a technical error: On page 115, readers are told that "This is a requirement for a valid sub-theme; you need at least one stylesheet." Testing shows that assertion to be untrue; only a .info file is required. Four pages later, readers are told to refresh Drupal's cached registry to see changes to the template files and theme functions, which contradicts the tip on page 94 that such refreshes are only needed when theme functions or templates are added or removed, but not if they are changed. Aside from these blemishes, the material presented is more than adequate to help get readers started with sub-theming.

Some readers will likely be disappointed that the first half of Chapter 6 discusses how to build a theme using a base theme — the previous chapter's topic — except instead of Bartik as the base theme, a more basic starter theme, Fusion, is used. Aside from that, it's the same process, and large chunks of the text are duplicated — even the erroneous claim of a stylesheet being required (page 130). Finally, the reader arrives at the second half of the chapter, which explains how to create a new theme from scratch. Other sections of the book are referenced heavily, which is possible because the first five chapters have set the stage for this topic.

With Chapter 7, the author takes the earlier introductions to theme templates, and explores them in much greater detail, showing how to separately theme specific groups of pages, including a site's homepage, as well as regions, blocks, and specific elements on a page. The author states (page 158) that all the theming baseline variables are documented inside of the page.tpl.php file, but that only seems to be true for the Bartik and Zen themes. Also, the concept of a block delta is not adequately explained or illustrated. Otherwise, this chapter provides more content and less repetition than most of the others. It concludes with a discussion of CSS classes dynamically generated by Drupal.

Traditionally, one of the most problematic areas of web design is the styling of forms — the focus of Chapter 8. The forms that are built into Drupal by default — user, search, poll, and administration — are presented from a functional standpoint. It is then shown how they can be modified using half a dozen techniques, with varying levels of control over the output and the amount of complexity in achieving that control. The next chapter looks more broadly at other difficult aspects of Drupal theming — including cross-browser compatibility, accessibility, validation, theming the output of various core modules, and many more topics. Some of the tips provided could be quite valuable if and when the reader is stymied by one such problem or another. The final chapter, "Useful Extensions for Themers," introduces a number of helpful tools, most of which are contributed modules. The book concludes with a lengthy and detailed appendix that lists the files, paths, and descriptions for all of the theming system-wide functions and mostly the core module-specific templates.

The author's writing style is conversational, with generally comprehensible explanations. But there are a few baffling phrases, such as "displayed in courtesy of a conditional statement" (page 70); and the common phrase "you likely need to" is twisted into "you are likely needed to" (page 119), which actually has a different meaning. All sorts of phrases are set in title case, without reason, such as "Dev Server" (page 111). Something else that may be difficult to fathom, is that the book's code does not reflect the fact that Drupal.org transitioned from CVS to Git for version control, in February 2011, three months before publication of Drupal 7 Themes.

There is a fair amount of redundant information, even on the same page — such as the theme settings instructions, in duplicate on page 36, and partly repeated again on the next page. Each chapter concludes with a summary, which in most cases is of no benefit to the reader, given how short most of the chapters are. Far too much of the text is presented in bracketed and indented warnings and tips. For instance, page 180 has no fewer than four such blocks of text, and they take up most of the page. In fact, there are several places where a paragraph of the main narrative is inexplicably turned into a warning, indented with large brackets (e.g., pages 71 and 95).

Punctuation is another area where this book could be improved. Most computer programmers use far too few commas in their writing, but this book demonstrates the opposite problem in several places, such as twice on page 71. On the other hand, there are places where a comma could have made the narrative more clear upon first reading. Fortunately, this problem is not nearly as prevalent as seen in the preface, which appears to have been written by someone whose first language is not English. As with most books written by techies, this one contains too many exclamation marks — invariably an indication that the author is trying to make a dull subject seem more exciting. Fortunately, most of this is limited to the early material, and dissipates as the author settles into the important topics. Lastly, there are many spots where the wrong punctuation symbol is used, e.g., a comma trying to perform the duties of a semicolon.

Seemingly every Packt title contains a long list of errata, and this one is no exception: "focuses is on" (page 2), "you Drupal 7 site" (2), "Indentifying" (2), "access to [a] Drupal 7 installation" (3), "Addition[al] tools" (3), "function [of] Drupal themes" (11), "an as" (24; should read "as an"), "Supports [a] four-column area" (24), "all/ themes" (30), "those global setting[s]" (40), "<none>" (49; should read "- None -"), "jump[ ]start" (56), "a temporary CSS files" (87), "in [the] last style sheet" (89), "go ahead [and] make" (100), "Why it is" (113; should read "Why is it"), "functionbartik_menu_tree" and "functionjeanb_menu_tree" (123; similar mistakes are seen on pages 181, 189, and 195), "be name[d]" (124), "cssto" (130), "theadvantages" (147), "is it" (151; should read "it is"), and "different appearance[s]" (153). At this point, roughly halfway through the book, I stopped recording errata. Packt Publishing's copyeditors should have spotted and fixed these problems, as well as those scattered throughout the rest of the manuscript.

Yet the major weakness of this book is the extensive repetition of material — ranging from the paragraph level (one paragraph repeating information from earlier, nearby ones) to the chapter level (e.g., Chapter 6's wholesale copy-and-paste of material from the previous chapter). Also, the book would have been more current if it addressed the critical web design topics of responsive design, media queries, and how they can be employed in Drupal theming. But it is possible that constraints of space and available time for this project, prevented the inclusion of these advanced topics.

Aside from these problems, and those mentioned earlier, this book does a fine job of explaining the key concepts, and demonstrating them in sample code. Drupal 7 Themes is possibly the best available resource for anyone who wants to learn how Drupal themes work, and how to build custom themes.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Definitive Guide to Drupal 7

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

Most computer and web programming books are written entirely by a single author, while the remaining are written by more authors, typically with each one tackling several chapters. The latter approach can suffer from redundant material undetected by editors, and inconsistency in the writing style from one chapter to the next. Yet it offers the significant advantage that the subject matter of each chapter can be presented by an authority on that topic — who can focus on making that explication the best possible, without the burden of completing an entire book. That was one of my first thoughts (and hopes) when hefting the 1112 pages and 4.1 pounds of the Definitive Guide to Drupal 7.

This tome was published on 19 July 2011, under the ISBN 978-1430231356, by Apress (who kindly provided a review copy). As of this writing, it appears to be the longest Drupal book in existence — more than 400 pages longer than the nearest two contenders. Fortunately, no single author ended up in an insane asylum as a consequence of trying to write such an extensive work on his own. Rather, this book is largely due to the efforts of 34 writers in total — more specifically, 30 authors (listed on the front cover, roughly in descending order of how many of the pages they wrote) and four more contributors (added to the list on the title page). This may be a new record in technical book publishing. The entire authorial crew won't be listed here, but it should be mentioned that Benjamin Melançon was the lead author, and contributed to many of the chapters.

The book's material is organized into 38 chapters and nine appendices — all grouped into eight parts: Getting Started, Site Building Foundations, Making Your Life Easier, Front-End Development, Back-End Development, Advanced Site-Building Topics, Drupal Community, and Appendix. The chapter and appendix titles won't be listed here, but can be found on the publisher's book page, which also offers a description of the book, a section for reported errata (none as of this writing), links to purchase the print and electronic versions of the book, and a downloadable archive of the source code. Unfortunately, the code is apparently available only as a Git repository, and thus is inaccessible if you cannot — or do not want to — install Git on your computer. Consequently, it would be more difficult for such a reader to follow along and implement the example code while reading the book.

The authors have created their own website for the book, where visitors can sign up for e-mail notification of updates and free chapters, view a chapter outline (which features some bonus material), see author photos and bios, offer suggested changes for future editions, and learn of reported errata (three, at this time). Throughout the book, readers are told to access that site for additional information related to the chapters' topics; yet there does not appear to be any such information, even after registering a new account and logging in. This will be most disappointing in those cases where the reader is enticed by the promise of valuable information, only to find that it is absent. The authors state (page lv) that there are forums, one per chapter; but those do not yet exist. In general, there seems to be a huge disconnect between that website and the claims made in the book as to what extra material readers will find there.

The book begins with some introductory material, consisting of three mini-chapters: "What's New in Drupal 7" briefly describes some of the terrific improvements over version 6. "How to Use the Book" reassures the prospective reader that the book "does not presume any specific prior curriculum", although this seems inconsistent with the back cover's user level of "Intermediate-Advanced". Also, readers may be perplexed by the claim that the URL path admin/people/permissions/rules will go to admin/help (page lv). The last section, "How Drupal Works", oddly does not explain how Drupal works, but instead discusses some common terms and the typical phases of a website development project.

The first part of the book comprises two chapters, the first of which has the promising title of "Building a Drupal 7 Site", and provides a cursory summary of site planning, wireframing, Drupal installation, the Administration menu, the Shortcut toolbar, color schemes, and modules. The chapter continues with sections on content types, blocks, taxonomy, and other key concepts — all grouped under the chapter head "Allowing People to Register and Log in with OpenID", even though those topics are unrelated to OpenID. All of the chapter's topics are illustrated by stepping the reader through building, from scratch, the beginnings of the Drupal 7 website — namely, one similar to the authors' site mentioned earlier. Unfortunately, some of the instruction in the book does not match the actual website design, e.g., no introductory text (page 20). Readers may be amused by the tip on page 11, which refers to "the remaining 800 pages of the book". Perhaps the remaining 1101 pages can be chalked up to scope creep! The second chapter explains the basics of how to install and use Drush and Git, but not for Windows users. Readers should find the material instructive and consistent, except for the claim that Git is "easy(ish)" even though "getting the hang of Git [is] a lifelong learning process".

The half dozen chapters that compose Part II first introduce some of the most commonly-used Drupal modules, with extensive coverage of Views and later Organic Groups. A couple chapters explain how to keep one's site secure, partly by updating Drupal core and modules. The last chapter continues the development of the example site, using modules presented earlier. All of these chapters' narrative is valuable, although a couple pronouncements are too severe (e.g., "User input is evil", on page 127); but overall the advice is well warranted. Yet the chapter that will most likely aggravate readers is the eighth one. It seems to presume that the reader's test site was not affected by the exercises of the previous chapters, such as the Organic Groups. Secondly, some key information is incorrect, e.g., "Content: Image" (page 159) should be "Content: Headshot". Lastly, the authors refer to items not yet created as though they were, e.g., a "Table of Contents" menu link, an "Outline of Chapters" menu, and a "Twitter" field (pages 162-164). Unfortunately, the effects of all these problems compound, and, combined with the changes in Views since Drupal 7.0, make it increasingly difficult to follow along and implement the instructions.

Part III offers another half dozen chapters, in this case devoted to higher-level, less technical matters — specifically, how to: best participate in the Drupal community, plan and manage a Drupal-based project, craft effective documentation for your sites' end users and support staff, set up a workable Drupal development environment, launch and back up a new website, and stay sane while doing all of this. The information presented is worthwhile, with only a couple peculiarities: Firstly, why is the book organized so that some technical information is presented in the early chapters, as well as later chapters, while a group of "softer" topics are sandwiched in between? Secondly, for Chapter 12, why is the reader told, halfway through the chapter, that she will need "A computer able to connect to the Internet" and "An Internet connection" (page 233)? No one who has worked through the preceding dozen chapters needs to be reminded of this. Perhaps this chapter, on how to set up a development environment, should be made an appendix, as was the other installation and setup topics (Appendices F-I).

The next few chapters, Part IV, explore front-end development — namely, theming and jQuery. The first two chapters were penned by Jacine Luisi, who heads up the HTML5 initiative for Drupal 8. Readers learn about Drupal's core themes, theme engines, theme administration, metadata files, regions, layout, template files, global template variables, theme functions and hooks, preprocess and process functions, render arrays, theming forms, and more. The discussion is competent and thorough, as well as comprehensible, aside from the repeated use of the verb "print" to apparently mean "display". Chapter 17 demonstrates the use of JavaScript and jQuery in Drupal, and finishes by showing how to use jQuery UI to implement animations, such as accordions and progress bars.

Part V, "Back-End Development", comprises seven chapters that explain how to develop custom Drupal modules using the APIs. Because they provide an introduction to Drupal's system of hooks and overrides, they probably should have been located before the earlier chapters on theming, which rely upon those features of Drupal. Regardless, Chapters 18-20, by Benjamin Melançon, attempt to demystify the key topics in module development. Because this subject area is so critical to real-world Drupal development, and because the concepts can be quite intimidating to neophytes, any presentation of it must proceed at a reasonable pace, with clear explanation of how each aspect relates to the next. Like similar discussions in other Drupal books, this one begins quite approachable, but becomes more daunting, with a few places where readers will likely be perplexed — such as the hook_form_alter() discussion (page 411), which doesn't seem to match the resultant HTML. Yet this is such a challenging subject area that entire books have been devoted to it, and this one ventures into areas untouched by other books, such as how to create new database tables. Drupal coding standards are presented, although apparently not always followed in the example code (e.g., preceding internal function names with underscores). Part V is rounded out with chapters on porting modules to Drupal 7, writing "glue" modules, performing functional testing, and writing extendable/API modules.

Part VI, "Advanced Site-Building Topics", consists of ten chapters covering a variety of topics: building an online store using Commerce module (authored by the project's founder and lead, Ryan Szrama); Drush (which overlaps with Chapter 2); caching and storage mechanisms (MySQL and MongoDB); RDFa and the Semantic Web; Drupal's routing system; Drupal's internal operations for presenting a requested page; Solr module; UX enhancements in Drupal 7; completing the book's website; and Drupal distributions. All of the information and guidance appears correct, except for a couple problems: The instructions (page 568) to install Commerce Physical Product module, which does not have a Drupal 7 release, as of this writing, and certainly as of the book's publication date. Drune is a music player used as an example throughout Chapter 34, but its website, drune.org (pages 805 and 817), appears to be dead at this time.

Throughout this book, one will find a strong sense of community, with frequent encouragement for the reader to participate and contribute. This is evidenced by Part VII, which comprises four chapters that present: Drupal's history, how to make a living as a Drupal developer, how to maintain a contributed project, and further thoughts on how to contribute to the overall Drupal community. The book concludes with Part VIII, consisting of nine appendices, most of which focus on how to install Drupal on various platforms. This part is strangely titled "Appendix", yet contains multiple appendices (more scope creep?).

Given the somewhat stunning length of this book, its multitude of authors, and its wide coverage of most aspects of Drupal, it should be expected that the book has both strengths and weaknesses. Consider first that latter category. The authors and publisher should have sought ways to reduce the length of the book. For instance, the overview of PHP in Chapter 18 is not needed for this book's audience, and could be replaced by references to outside, more-detailed resources. The same is true of the section on Drupal coding standards. The book does not need to be made any longer than it already is, without good reason. Speaking of which, most of the longer chapters end with summaries, which are not worth the extra space taken up. Drupal's hook system is explained in at least three different chapters, and Git in two. The many authors should have been aware of this, had they been referencing the book's website, which was presumably built before the text describing it was written. Furthermore, the publisher and its chosen technical reviewers should have also spotted this.

The remarkably large number of authors is probably the primary reason for the book's noticeable unevenness, from one chapter to the next, in the quality of the writing — including the clarity of the explanations, which is arguably the most important factor. In a book written by advanced Drupal developers, it is to be expected that they will use Drupal-specific terminology. That is fine, but such terms should be defined at least once, before encountered by any readers unfamiliar with them. For instance, page xxxv alone mentions "d.o", "D8", and "contrib" — all meaningless to someone learning Drupal. There are places in the text where the descriptions do not match the corresponding screenshots (e.g., the "Required field" on page 18), and where, in the narrative, the lack of quotation marks around field labels makes it jarring and difficult to understand (e.g., throughout Chapter 8). There are some inconsistencies in spelling (e.g., "web site" and "website", even in the same sentence, on page lii), some inconsistencies in italicizing menu links (e.g., page 13), some misused phrases (e.g., "cannot be understated", on pages lix and 225, when "cannot be overstated" was called for), some baffling allusions (e.g., "aiee-the-alligator-is-going-to-get-me", on page 492), curly quotes in the code (e.g., pages 277 and 356-9), a repeated paragraph (page 507), an oxymoron ("libertarian communism"; xlvi), and the obligatory conflation of "depreciated" and "deprecated" (page 495) found in countless programming books.

This book contains numerous errata: "co-maintainer [f]or Drupal 7" (page xxxiv), "and." (xxxv), "bi-lingual" (xxxviii), "able [to] handle" (xlix), "don' think" (lv), "criteria[:] type" (lviii), "able [to] fill" (11), "th[r]ough the" (14), "an a" (19), "ask question questions" (29), "install [the] X-ray" (38), "You [] requests nuggets" (49), "you want to you" (56), "on [the] system" (57), "menu of option[s]" (57), "Rather [than] saving" (57), "menu(" (58), "you[r] Views" (59), "These setting[s]" (61), "that what" (66; should read "than what"), "might for use" (67), "you would chose" (67), "the next sort criteria" (67; should read "the next sort criterion"), "by click[ing]" (74), "you are make" (85), and "have [to] click" (85). At this point, not even 8% of the way in, I stopped recording them — although an amusing one is worth mentioning: "gather shook information" (452). Lastly, how did "Drurpal.org" (854) make it past the spelling check? It turns out that the entire book is peppered with such errors, and that first batch was merely the beginning. It is difficult to believe that so many obvious errata could have made it through any professional copyediting process.

Readers who are following along, and likely using the latest version of Drupal (7.8 as of this writing), will notice some differences between what they see on their screens and what is shown in the book's screenshots — most if not all of which are based upon Drupal 7.0. This is especially noticeable in Chapter 3, which covers Views, a module affected by ongoing enhancement. For instance, Views exporter submodule (page 52) is now gone; "Access all views" (page 53) has been altered; "Display Status" (page 62) is gone; there are no broken link icons to indicate overrides; "views/edit" (in the URL, page 71) is now "views/view"; and the Fields configuration dialog (page 75) is different. Fortunately, none of these cases of obsolescence should have any impact on the value of the information as a whole.

On the positive side of the ledger, this book offers much to be commended. As with any worthwhile programming book, this one makes extensive use of code snippets and screenshots to illustrate concepts discussed. These appear to be correct, except in the flowchart of Figure 30-3, where the conditional symbol's arrows are missing values. The text contains some welcome humor (e.g., a kittens photo request, on page 43) and some apt phrases (e.g., Permission module's "wall of checkboxes", on page 156). Some of the chapters were written by the contrib module developers/maintainers, i.e., those who arguably know those modules best. This is unique among the growing list of Drupal books, in that it devotes entire chapters to topics neglected by its competitors — such as documentation, installation profiles, module porting, Drush, Git, and working profitably as a Drupal professional. Some of this information emphasizes the value of project management (both for your individual projects, and Drupal as a whole).

On balance, the pluses outweigh the minuses. The book has a lot of good information, and many of the problems stem from sloppy writing that should have been caught by the publisher's editing team. It may not be the best source for some key subject areas, such as security or site building options. But if you seek a sole source that offers more information in total, then this is your book. For some topics — such as upgrading Drupal, crafting and testing modules, building installation profiles, and the inner secrets of the menu system — it goes into far more detail than any other. Definitive Guide to Drupal 7 is an impressive attempt to be just that, and no other single book currently matches it.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - CoffeeScript: Accelerated JavaScript Development

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

For decades, programmers have written computer code in one language, and then programmatically translated that code into another, lower-level form (typically machine code that can be run directly by a microprocessor, or some sort of bytecode that can be interpreted by a virtual machine). For instance, source code written in C or C++ is compiled and assembled into machine code. In web programming, there are emerging languages and other tools for translating code into JavaScript. For instance, Google Web Toolkit allows the programmer to create web apps in Java. The latest addition to this category is CoffeeScript, a language that can be compiled into JavaScript, and is intended to reduce source code size and clutter by incorporating some of the best operators from other Web scripting languages, particularly Ruby. It is also the topic of a new tutorial, CoffeeScript: Accelerated JavaScript Development.

This book is authored by Trevor Burnham, who is credited as one of the early contributors to the project by Jeremy Ashkenas (the creator and project lead of CoffeeScript) in his foreword to the book. Published by Pragmatic Bookshelf on 3 August 2011, under the ISBN 978-1934356784, CoffeeScript: Accelerated JavaScript Development fills only 138 pages, which is certainly a change of pace from the majority of programming tomes now being released. This book's material is grouped into six chapters, plus four appendices — aside from a preface, which introduces CoffeeScript as well as a word game, which is used as the example project throughout the book. Oddly enough, the preface mentions jQuery, but not as one of the well-known attempts to streamline JavaScript code.

The first chapter, "Getting Started," begins by briefly explaining how to install Node and npm (Node Package Manager). These instructions assume that you are following along in a Linux environment or some emulation thereof. They also seem to assume that nothing goes wrong in any of the steps, because no troubleshooting guidance or references are provided. Given the number of moving parts required to get CoffeeScript running, as well as the technical pitfalls that could ensnare a Windows or Mac user, the author should have provided more clear and detailed installation instructions. Also, readers unfamiliar with Linux/Unix may be puzzled by some of the instructions. For instance, page 3 appears to state that the way to check that those two aforesaid packages are on your path, is to simply type in "PATH" (whereas what is needed is "echo $PATH"). From that point forward, the narrative gradually becomes more opaque, with cursory coverage of text editor plug-ins, the "coffee" command line compiler, REPL, "the soak" (an existential chain operator), and the limitations of trying to debug CoffeeScript code. It is quite possible that by the end of this chapter, many readers will decide to not bother trying to learn CoffeeScript, and instead to stick with plain JavaScript, possibly supplemented with jQuery (which is not to say that jQuery code is any easier to read).

In the next three chapters, the author presents the basics of CoffeeScript, including how to: define and use functions and their arguments; test conditionals; throw and catch exceptions; understand variable scoping and context; create arrays using splats; accept input from the console; create objects, arrays, and soaks (in more detail than before); iterate over collections; match patterns; define namespaces using modules; and create prototypes and classes. He makes extensive use of examples, which thankfully are concise (unlike some programming books whose example code span far too many lines, and sometimes even multiple pages — forcing the reader to dig through the code, trying to find the important lines). Also, the brevity of CoffeeScript syntax is undoubtedly a factor. However, his concise style extends to the narrative as well, and will likely cause newbies to have to read the material several times — and even then wonder whether they fully grasp the concepts. It seems that the author understands CoffeeScript extremely well, but is not always able to communicate that knowledge to the reader in a patient and comprehensible manner.

Chapter 5 is a primer on jQuery, and is apparently included in the book so that the example application (the word game) can be made to work in a web browser — since none of the code or narrative (aside from the example app) appears to be related to CoffeeScript. It would have been more efficient to simply point the reader to an online jQuery tutorial, and then present only the CoffeeScript-specific differences — or just briefly explain how to load CoffeeScript files in an HTML file, which could have been done in a sidebar. The last chapter demonstrates how to run CoffeeScript on a web server, utilizing Node.js, and also explores how the lack of threads in JavaScript can impact Node programming. The example project is made multiplayer using Node, Connect, and WebSocket.

The appendices provide answers to the end-of-chapter exercises, alternative methods of running CoffeeScript code, a JavaScript cheat sheet, and a list of a half dozen bibliographic references. This book concludes with a suspiciously-short index, at less than three pages long, which appears to provide only the first or earliest occurrences of the major terms. Consequently, anyone who tries to use this book as a reference work for looking up key terms quickly — or for finding their later occurrences — will likely need to obtain an electronic version of the book, since all e-readers have search functionality. Furthermore, the index is missing some key terms used in the text, such as "function callbacks" and "arbitrary expressions" — heck, it's even missing "expressions," a fundamental concept in any programming language.

Prospective readers who wish to learn more about the book, can visit Pragmatic Bookshelf's page, which offers brief descriptions of the book and its author — as does O'Reilly Media's page. But, as of this writing, only the former makes available an e-book version, pre-publication reader comments, a discussion forum, the example source code used in the book, and a link to a page for reporting errata, which already has more than half a dozen items listed. More are present in the text: "add [a] multiplayer capability" (page xx); a lone ")" missing its matching "(" (in Exercise 6, page 34); "in a lot in functions" (page 107; should read "in a lot of functions"); "a[n] overhead" (page 110); "everyone and their dog is" (page 116).

The author's writing style is sometimes quirky, which in most cases adds a bit of levity, but occasionally leads to the misuse of terms, e.g., array ranges usage described as "fantastical" (page 43). "BDFL" (page xiii) will prove puzzling at first to most readers. On page xvi, the reader is told that JavaScript "contains multitudes." — multitudes of what? And nothing can excuse the groan-inducing "automagically" (page 100).

In terms of the ordering of the topics, one of the most exasperating aspects of this book is the way that many language concepts — such as chained comparisons, and variables being true or false (or "truthy" or "falsy") — are not presented up front, on their own, but mixed in with discussions of other topics, including development of the game application, and even in the answers to the chapter questions (Appendix 1). This makes the book generally unsuitable as a reference, especially when combined with a disappointing index.

One might assume that the modest size of this book is a result of the small size of the language itself. But another factor is surely the pithy presentation style for even some of the most important concepts in the language. Perhaps worst of all — especially from the perspective of someone relatively new to programming — some basic concepts are not addressed, or the example code does not address common use cases. For instance, in CoffeeScript, how does one create a block consisting of multiple lines of code? On page 17, indentation is briefly mentioned, but the sample code shows single-line blocks only. Other important ideas are "saved as an exercise" (which may induce flashbacks to exasperating technical college textbooks). Some readers may conclude that the author didn't want to make the effort of fully describing the language, in a more canonical fashion, which would have resulted in a much longer, but more valuable book.

It is unclear as to how much of the likely mystification and frustration of the average reader will be due to the writing choices made by the author, and how much can be blamed on the sometimes cryptic syntax of CoffeeScript, evident in the discussion of topics such as function binding (Chapter 2) and keywords (e.g., from page 106, "what.x and @x are, of course, equivalent if and only if what is this." Of course!). Readers are told in the introduction that they do not need to be experts in JavaScript to understand the book's material, and can be amateurs (page xviii). But there are several places in the book where intermediate-level knowledge, at a minimum, would be needed. That sort of difficult material may be another point in the CoffeeScript journey where some readers will decide to eschew learning the language.

The production quality of the book is fine, except that the chosen font's ratio of height to width is more than what is usually found in books nowadays; when combined with inadequate spacing among the words within many of the sentences, it makes it difficult for the reader to rapidly scan the material. The e-book version reflects the same minor problem. Yet it makes excellent use of color for syntactically highlighting the code — a feature not seen in the print version.

So if you would like to do some JavaScript programming, but without writing any JavaScript, then one possible place to start your journey is CoffeeScript: Accelerated JavaScript Development. As of this writing, it is the only CoffeeScript book on the market. Yet should the language continue growing in popularity, then more substantial and recommendable books will probably become available.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Build Mobile Websites and Apps for Smart Devices

coder4hire writes: "Robert, please set the attribution to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

With the proliferation of handheld devices that allow access to the Web, more business owners and other technology decision-makers are demanding that their organizations' websites be fully accessible on those devices, and even be repackaged as new web-based applications. But designers and developers who may be quite proficient in making non-mobile websites and web apps, can feel uncertain as to how to craft those products, or even where to start the process of learning how to do so. Recently, several books have been published to address this need, including Build Mobile Websites and Apps for Smart Devices, authored by Earle Castledine, Myles Eftos, and Max Wheeler.

This title was published by SitePoint on 29 June 2011, under the ISBN 978-0987090843. The book's contents span 300 pages, and are organized into a preface, eight chapters, an appendix, and an index. The preface contains the usual meta information about a technical book; but what really shines is its intro section, which enthusiastically entices the reader to jump into the burgeoning field of mobile web development. The appendix, comprising little more than two pages, presents only the most basic information on how to utilize whatever native web server might be running on the reader's Linux, OS X, or Windows Vista/7 machine. The more than 49 percent of computer owners still using Windows XP (as of this writing), will need to look elsewhere for information on installing and configuring Apache, IIS, or some other web server, should they want to test their apps locally. In terms of prerequisites for this book, readers are expected to be proficient in HTML, CSS, and JavaScript, but not necessarily HTML5 and CSS3, whose concepts are explained as needed throughout the text.

The publisher maintains a web page for the book, where visitors can find the table of contents, errata (none as of this writing), the book's index, and three free sample chapters (Chapters 1, 2, and 4) in PDF format. Visitors can order the print version of the book, the electronic version (in three different formats: PDF, EPUB, and MOBI), and an online course hosted by Learnable (comprising lessons, video tutorials, Q&A sessions, and the example code).

The first chapter introduces the basic concepts and rationale of mobile apps, as well as some of the key decisions one will face in creating them, such as whether to make a web app versus a native app, and the options for providing a mobile experience. The authors briefly describe the example app — a tool for recording and sharing celebrity sightings — which is designed and created sequentially in the material that follows. But the chapter does not fulfill the promise made for it in the preface, where the reader is told he will "be guided through the process of designing and building a mobile web application"; on the contrary, the chapter does not explain how to design and build one.

That effort begins in the second chapter, where the authors discuss some high-level considerations for designing the user interfaces of mobile devices, as well as the benefits and drawbacks of various navigation and content structuring options. The bulk of the narrative involves wireframing the design for the example app, selecting colors and fonts, and crafting an appropriate icon for it. Readers learn of the advantages of using relative units in their CSS, but not how to get all the elements positioned properly regardless of the target device's resolution, when mixing relative units for text and pixel units for images. The section "Scalable Images," later in the subsequent chapter, is a start, but is not sufficient for non-SVG images.

Chapter 3, "Markup for Mobile," is the longest of them all, primarily because it presents much if not all of the source code written by the authors for the initial version of their example app. The majority of the code is in HTML and CSS, with a focus upon the effects made possible using HTML5 and CSS3. Also discussed are the resource limitations of typical mobile devices, content and menu display options, image techniques and scalability, viewport meta element settings, icons, multimedia, and more. Oddly, on pages 71-72, the resource limitations of iOS are repeated, with only slightly different wording. How could the proofreaders have missed this glaring redundancy?

The fourth chapter, "Mobile Web Apps," addresses the logical next step: enhancing a mobile website so it can function as a web app — for which JavaScript is used extensively. After briefly mentioning a couple of the better-known mobile development frameworks, the authors select jQuery as a library for working with the DOM, to speed development and make the example code more platform neutral. There follows an interesting discussion of touch events on mobile devices, how they compare to mouse events, and techniques for best handling them. But the main goal is to show how to load, swap, and go back to pages so as to most closely simulate the snappy behavior of native apps. The extensive code and narrative in this chapter are the most complex of any in the book, and thus will likely be the most challenging for any reader who is not adept with JavaScript and/or jQuery, or who does not have the patience to work through the example code.

At first glance, it would appear that native apps have a huge advantage over web apps, in that they can access information from their mobile devices' capabilities — such as accelerometers and cameras — historically unavailable to mobile web browsers. Fortunately, an increasing number of standard interfaces are allowing web apps to access that data — and this is the topic of the fifth chapter. The reader is shown how to capture and utilize geolocation data, device rotation and acceleration, as well as shake and touch gestures. The chapter concludes with coverage of how to use HTML5 Offline Web Applications API for enabling an app to work when no network access is available. The subsequent chapter, "Polishing up Our App," shows the reader how to do just that — specifically, preventing the navigation header from scrolling off the screen, handling click processing delays, displaying dialog boxes, storing data on the client device, and other differences. The narrative is clear, except for a perplexing ornithological expression, "Duck-type" (page 182). Experienced developers will appreciate the section on mobile coding best practices, based on controllers and custom events — for minimizing programming headaches as a project's code becomes sizable.

The last two chapters explain how to convert a web app into a native app, using PhoneGap, an HTML5 application platform that allows a Web app to access those resources of the mobile device that would otherwise be unavailable, such as data in the filesystem and images from any built-in camera. Before demonstrating the details of how to implement those capabilities, the authors show how to install the development environments for all of the supported platforms (including Apple iOS and Google Android), and then PhoneGap itself. Lastly, readers learn how to try to monetize their finished web apps by uploading them to the various app stores.

The authors make extensive use of example source code, to illustrate the ideas being discussed, which works well, partly because the code is generally explained clearly and commented as needed. A code archive is available containing the source code used in the book, except that of the first two chapters and the last two, which collectively is minimal. (Look for the "Downloads" button on that GitHub page to avoid having to download all the files separately.) Beware that some of the sample code appears to be incorrect or incomplete, e.g., stars.html in the directories "ch3" and "ch4" appear to be unstyled, and "javascripts/ch3/untitled file" is empty. Readers who elect to type in any code directly from the book, should watch out for "curly quotes" (e.g., page 230), and instead substitute the corresponding straight equivalents.

In terms of the physical presentation of the book, at 9.9 x 8 inches, it is taller and wider than the standard nowadays, allowing for what appears to be a relatively larger font, which makes the text more readable. The attractive color figures are a welcome change from the usual black-and-white screenshots found in most computer books. They enhance the overall appearance of the book's interior and the experience of reading the narrative.

Speaking of which, most of the narrative is quite clear. However, one critical topic for mobile design is screen resolution, including how to best defensively account for that in one's design and coding. This book's coverage of the topic is divided into at least two different places (pages 40 and 55), and should have been consolidated, in the third chapter. Unlike most programming books littered with chapter summaries, this one appears to have only one section with a summary, which oddly does not summarize the information presented in the section, but instead offers some interpretation thereof. Also, American readers might stumble over a few of the words that use the English/Australian spelling, e.g., "licence" (page 239).

Some of the phrasing will likely befuddle the majority of readers, especially in cases where the authors fail to define their terms, e.g., the first bullet point on page 47. There are a few minor inconsistencies in the writing, such as "fill out forms" and "fill in a form" (on the same page, 32), but nothing that would cause confusion on the reader's part. The overall writing style is friendly, although sometimes overdone with an excessive use of exclamation marks (e.g., page 40). The text contains some errata (including several that suggest that the SitePoint copyeditors are unfamiliar with the ability of even a common word processor such as Microsoft Word to detect duplicate words): "to thank to" (page xxi), "the the" (pages 8 and 84), "for for" (13), "look at [in] Chapter 6" (34), "let[']s break" (44), ", (" (54 and 142), "no way to we can used" (55), "[up] to this point" (82), "try and" (82, 93, 131, and 167; should read "try to"), "support [for] standalone mode" (89), "are are" (139), "it's" (162; should read "its"), "if there are" (172; should read "if there were"), "ultimately .depend" (196), "On[c]e you've installed" (203), "we're yet" (212; should read "we've yet"), "an an" (225), "more detail that" (238; should read "more detail than"), and "a a" (240).

Yet none of the aforementioned problems are of great significance, and do not detract from the value of the material presented. All three authors have extensive experience in designing and developing mobile web applications, and this is reflected in the authority with which they not only offer the technical details, but also make recommendations to the reader. This book would serve as an excellent starting point for any web programmer who wishes to learn how to create mobile web sites and applications.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - JavaScript: The Definitive Guide, 6th Edition

coder4hire writes: "Released during the early days of the Web, in 1995, JavaScript has come a long way: Initially a client-side scripting language typically (mis)used for decorative effects, it is now an essential part of countless major websites. Its increasing capabilities and popularity are due to several factors, including the development of libraries that resolve earlier stumbling blocks that held the language back (such as inconsistencies among the implementations in different vendors' browsers). JavaScript: The Definitive Guide, authored by David Flanagan, was first published just one year later, in 1996, with several significant updates made since then.

The book is now in its sixth edition, under the ISBN 978-0596805524, and was published on 10 May 2011 by O'Reilly Media (who kindly provided me with a review copy). At 1100 pages, it certainly feels heavier than its advertised 2.6 pounds — but that may only be a side effect of the thought of wading through over a thousand pages of technical explanations and example code. Yet one could argue that the size is justified, considering the amount of information the book conveys, and its obvious aim to be a comprehensive treatment of the language. The material is organized into four parts, including 22 chapters. On the publisher's Web page, visitors will find a brief description, the complete table of contents, a few consumer reviews, reported errata (seven as of this writing, and none confirmed), the example code used in the book, some free content (the first chapter), and links to purchase the print and e-book versions.

The book commences with a multipart introduction, which begins with the sentence "JavaScript is the programming language of the Web." Even though that statement is not true — since there are many other Web programming languages — it does hint at the importance of the language in the mind of the author, and his willingness to put so much effort into creating such a detailed monograph. The introduction is also the first point in the book where one sees the clear demarcation made by the author between core JavaScript (i.e., the language definition, regardless of its runtime environment) and client-side JavaScript (i.e., usage of the language within Web browsers, including the use of libraries). Both areas are covered in great detail in the first two parts of the book, in quasi-tutorial format, while the last two parts cover the same areas, but in a purely reference format.

Specifically, the first part of the book, "Core JavaScript," offers almost a dozen chapters that explicate the basics of the language: its lexical structure; types, values, and variables; expressions and operators; statements; objects; arrays; functions; classes and modules; regular expressions; JavaScript subsets and extensions; and server-side JavaScript. At almost 300 pages, this part alone could form its own volume. The manner in which the author dives into the technical details, and the amount of example code, immediately make it evident that the book is intended for readers who have experience programming, although not necessarily in JavaScript. In fact, some readers — especially newbie programmers — may become frustrated with those places in the narrative where the explanation is not entirely clear. For instance, on page 7, the "points array from above" refers not to any code on that page, but instead refers to an array defined two pages earlier. Fortunately, such stumbling blocks are infrequent. For experienced JavaScript programmers, these chapters could provide a comprehensive review. For readers new to JavaScript, the material may seem overly dry, but the illustrative code should be quite helpful.

The ten chapters that compose the second part of the book, "Client-Side JavaScript," show how to work with the language within a Web browser. This includes learning how to embed JavaScript code in HTML files; differences among browsers and the versions thereof; the security of JavaScript code; the Window object; how to access and manage the elements within the Document Object Model (DOM); scripting CSS styles; events, and methods of handling them; scripting HTTP, and its use in Ajax (reflected in this edition's subtitle, "Activate Your Web Pages"); the jQuery library; techniques for storing data on the user's computer; how to use JavaScript to dynamically create and manipulate graphics, audio, and video content, as well as charts and drawings; and, lastly, the use of several HTML5 APIs. Speaking of that last topic, probably the most significant changes in this edition, versus the previous one, is the coverage of ECMAScript 5, as well as the new objects and methods introduced with HTML5. Naturally, some of these enhancements do not work in any version of Internet Explorer but the most recent, so the author discusses workarounds, if available.

As noted earlier, the third and fourth parts of the book constitute the purely reference material, with the first part focusing on core JavaScript, and the latter on the client-side aspects of the language. Every chapter is organized into a series of entries, each devoted to a particular class or object, ordered alphabetically. For each entry, the reader is given a brief synopsis, description, and in some cases example code and references to other entries. Each class entry also includes information on its properties and methods, where applicable. Each single method entry includes information on its arguments and any return value. The book concludes with what is arguably the longest and possibly most valuable index I have ever seen in a computer book.

There are only a few immediately-evident weaknesses of this book: Firstly, there are some phrases that may be clear to the author, but likely will prove baffling to the typical reader — e.g., "nonlinear cross-reference problem" (page 8) and "the jQuery gives a synopsis of each method" (page 523). Secondly, some of the example HTML code could have been written better, such as the use of an HTML table for defining the layout of a simple form, with labels and fields (page 13). Finally, despite the claims of the marketing copy that this title is suitable as both "an example-driven programmer's guide or a complete desk reference," it would serve better as the latter, and not as a tutorial for learning the language. Clearly, the more comfortable one feels with computer programming — especially JavaScript itself — the more that one could get out of this book.

On the other hand, there are far more pluses than minuses. One of the real strengths of the book is how the author does not hesitate to use (sometimes lengthy) blocks of code, with explanatory comments for almost every line, to clarify the language — as opposed to paragraphs of text, which could have easily doubled the length of the first two parts (which comprise roughly the first two thirds of the book). Also, in conjunction with the narrative and code fragments, the author makes effective use of figures whenever needed — particularly in Chapter 21, in demonstrating how to work with graphics and multimedia content.

Evolving with the language itself, and again brought up to date, JavaScript: The Definitive Guide still retains its crown as the ultimate reference resource for JavaScript programmers.

Michael J. Ross is a freelance website developer and writer."
Book Reviews

Submission + - Professional Mobile Web Development with WordPress

coder4hire writes: "Years ago, technologists and consumers alike could only dream of surfing the Web using the (increasingly ubiquitous) mobile devices available, such as smartphones. But that is now commonplace, resulting from a convergence of several trends: the standardization of wireless access protocols, greater carrier coverage and bandwidth, the popularity of mobile apps, and more powerful mobile products — featuring embedded keyboards and pointing devices, greater memory, hardware miniaturization, and larger screens with better resolution. For the typical website nowadays, the primary impediment to the site working well on leading mobile devices is that the site was never intended for them in the first place. Web developers and other site builders using content management systems, can now learn how to build for mobile accessibility, with help from resources such as Professional Mobile Web Development with WordPress, Joomla! and Drupal — authored by James Pearce, who is quite active in the mobile development space.

This book was published by Wrox, on 12 April 2011, under the ISBN 978-0470889510. It is a substantial volume, at 552 pages, which are organized into five parts. The bulk of the information is presented in the second and third parts. The former covers mobile development considerations independent of any particular content management system (CMS). It is in the third part that the author shows how to apply these techniques to websites and web apps created using the three leading CMSs — WordPress, Drupal, and Joomla. Most of the example code shown in the book, from a dozen chapters, can be downloaded from the book's web page. Unfortunately, the Zip file contains even more Zip files, which is rather annoying. The book's web page offers the table of contents (both the high-level and detailed ones), a brief author bio, the book's index, and a sample chapter (the first one). The book's introduction states that the web page has a link to errata, but there does not appear to be any such link. (Even if there are no errata reported, the link should have still been added, or at least an explanation as to its absence.)

The first part of this book, "The World of the Mobile Web," begins with an introduction to the mobile Web (which originated just a couple years after the birth of the Web itself), and discusses at a high level the similarities and differences between website development for the desktop versus mobile devices. The author then provides an overview of mobile technologies and networks, their technical limitations, recent developments therein, online information resources, and mobile browsers. Chapter 5, "The Mobile Toolbox," will probably be of more interest to web developers than the earlier chapters, because it surveys the mobile development techniques, server-side technologies, and development tools that are most often used for creating mobile-ready websites. For nondevelopers, the section that describes the key components of a CMS, can be valuable as an introduction to CMSs.

In the second part, "General Mobile Techniques," the author briefly discusses some of the critical options which a web developer must decide upon to structure a website so that it will be suitable for mobile viewers. These include navigation menu depth, breadth, grouping, and placement; typography, pagination, multimedia, and forms; and CSS and JavaScript. He also addresses a decision that likely will have even greater consequences for the long term maintenance costs of a new website, namely, the entry point(s) and structure(s) of the mobile and desktop versions of the site relative to one another. Chapter 7, which explores browser detection and methods of allowing the user to switch between mobile and desktop versions of a website, marks a shift in the book, where the reader is first exposed to any significant amount of code. Most of it is straightforward, but would be better without the use of the clunky heredoc method for outputting HTML from within a PHP script. Earlier, the author makes clear that device detection techniques (specifically, for screen dimensions) are not foolproof. Thus it is perplexing why his CSS code specifies pixel-based widths for images with a class "full" — presumably to fill the entire width of the mobile device's screen — because any pixel-based fixed width could turn out to be improper for the device upon which it is rendered. Wouldn't something like "100%" be a much safer choice?

In Chapters 8 through 10, the author presents user interface patterns seen in the major content management systems — forms, content lists, image galleries, and comments — and discusses how they can be applied to websites intended to support mobile devices. The only information that seems to be missing is the reason, if any, the author recommends using divs for grouping input fields, and not (more semantically correct) fieldsets. He also discusses some key design considerations, as they relate to mobile websites (including CSS media queries), and some HTML/CSS templates and libraries that can be used as starting points (especially valuable if you want to roll your own solution, and not use any CMS plug-in).

The third part of the book, "Major CMS Platforms," demonstrates how to develop mobile websites using the three most commonly-used CMSs — WordPress, Drupal, and Joomla — and how to add more capabilities beyond what is provided by the chosen plug-ins. For WordPress, the solutions examined are dotMobi WordPress Mobile Pack (for which the author appears to be the lead developer), WPtouch, Mobile Edition, MobilePress, and Automattic WordPress. For Drupal, the main weakness in the material is that the author posits the Mobile Plugin module as a solution for Drupal 6 and 7 (even discussing Drupal 7 permissions), but there is no version of it for Drupal 7 — not even an alpha release, and there is no indication there ever will be one. Also, in Chapter 14, the API calls do not work for Drupal 7. Yet the coverage of the topics is generally clear and engaging.

In light of the growing popularity and capabilities of JavaScript frameworks, it is no surprise that in the fourth part of the book, "Enhancing and Launching Your Site," the author explores alternatives to the methods he presented in earlier chapters, by using two such frameworks for mobilizing websites: jQuery Mobile and Sencha Touch. The example code is based upon a WordPress website, and leverages a switcher plug-in and other code discussed earlier in the book. The penultimate chapter covers various techniques for testing and debugging mobile websites: browser plugins, mobile emulators, and online testing services. The last chapter discusses issues with (the network carriers') transcoders, traffic analysis, and mobile search and monetization. The fifth and final part of the book, "References," contains a handy glossary, as well as two appendices that provide recommendations for further reading and developer resources specific to the three CMSs utilized in the book, and various mobile Web organizations and industry players.

Overall, the writing quality is a bit better than average for computer books, with detailed and helpful explanations. However, in several cases, the author uses words he doesn't seem to understand: "RIM's legacy browser remains very populous" (page 68; should read "popular"); "inadmissible flaw" (page 185; one can only guess at the intended use of this judicial word); the delightfully redundant "pre-prepared" (page 208); and "rallied against" (page 209; should read "railed against"). There are numerous simpler errata: "as [a] whole" (page xxvi), "appraised" (page xxvii; should read "apprised"), "been build" (page 3), "switchboard[s]" (4), "connected [to] the Internet" (11), "marking" (11; should read "marketing"), "it's [a] phone" (14), "these are dealt with these" (19), "phone's" (40; should read "phones'"), "try and catch" (45; should read "try to catch"); ". at" (46), "is [a] good start" (75), "most CMS[s]" (116), "some CMS[s]" (125), "a[n] XML" (140), "an pertinent" (166), "you are introduced you" (182), "to [an] extreme" (185), "on [a] par" (187), "part [of] the" (188), "wheedle out" (199; should read "weed out"), "scaling is down" (200; should read "it"), "comprised of" (220), "there comments" (227), "go [to] the" (230), "allow you [to] tweak" (247), "Index.php" (262), "in [a] box" (269), "[non]greedy" (280), "http:// yoursite" (305), "suit[e]s" (340), and at this point I stopped recording errata.

There seems to be no consistency in the formatting of URLs: the inclusion or exclusion of "http://" and root directory slashes was seemingly decided upon randomly (e.g., page 53). One may find the occasional comma where a period was called for (same page, third paragraph). Also, there is an excessive use of exclamation marks, particularly in the earlier chapters. Lastly, the author has an odd habit of phrasing statements of what material will be covered next, in a commanding form, e.g., "you turn your attention to examining" (page 97) instead of, say, "we turn our attention to examining." It's not important, but it's unsettling, and in a couple cases, rather baffling, e.g., "You should briefly discuss how to access HTTP headers in your code" (page 133). With whom should the reader discuss it? Yet the book's style is, for the most part, conversational and easy to digest.

Readers will find plenty of illustrative figures. Although all of them are black and white only, they are without exception top quality and quite attractive, including the many screenshots and product images. The only place a figure is sorely needed, is on page 261, to clarify the discussion about em-based padding. The chapters end with brief summaries, which are of no value and simply make the book a bit longer than it needs to be. Also adding unnecessarily to its heft is the repeated reminder that the example code can be downloaded from the Wrox website.

Aside from the aforementioned blemishes, this book does a fine job of introducing the reader to all aspects of developing CMS-based websites suitable for mobile devices.

Michael J. Ross is a freelance website developer and writer."

Slashdot Top Deals

Always draw your curves, then plot your reading.

Working...