Mastering NGINX

Nginx is an http server intended for high traffic websites with a mind toward network scalability. I used NGINX as my primary web server for about 3 years. At the time, I hosted my sites on under-powered hardware that had little memory and had trouble keeping up with demand when I used Apache, but was able to keep this web site up and running the day one of my posts hit the front page of Digg (back when dinosaurs roamed the Earth and Digg was a really cool website). Back then, NGINX was still pretty new and most of the documentation was either in Russian, sporadic, or consisted of random posts on people’s blogs. It has been a couple of years since I upgraded my server to something beefier. At that time, I switched back to Apache, since I have used it for years and know it very well. That could change again, especially now that the official documentation for NGINX is much better, and because of today’s review book.

Mastering NGINX is by Dimitri Aivaliotis, a systems architect for a hosting provider and someone who uses NGINX daily. His experience shows in the quality and depth of the material. Unlike a different book on NGINX from the same publisher that I reviewed in 2010, Nginx HTTP Server, this book is well written and does not suffer from what I have come to call “The Packt Problem.” I hope this is a sign that Packt’s copy editing process has improved and that there is now a stronger commitment to offer titles that are worthy of being read because of the quality of the writing as well as the quality and uniqueness of the technical content.

Mastering NGINX is intended for experienced systems administrators and systems engineers, people who are familiar with using and administering *nix machines and configuring servers. This is not a beginner book. For me, that is a plus. It allows the author to get right down to business with NGINX.

We start with a short and typical installation chapter, complete with a discussion of modules that includes third-party modules and their benefits and risks. Installing using the package managers of several types of Linux distributions is covered along with compiling from source and the various flags and configure options available.

The next chapter jumps right in to the good stuff. Most of the NGINX materials I once used tell you what to change, but not why to change it. For a long time I was left wondering how to tell when to use specific configuration options, which files to find them in, and what the parameters are that I can use. The goal of this book is not to tell you what to do, but to describe these very things, so that in the end, you should be able to find and open an NGINX configuration file and edit it to fit your situation. Well done.

I was a little concerned when I realized that I was nearing the end of the chapter and still had some questions in my mind about some of the parameters and settings. Then I read this on page 40 in the chapter summary:

What we did not cover in this chapter are the configuration options provided by the various modules that may be compiled into your nginx binary. These additional directives will be touched upon through the book, as that particular module is used to solve a problem. Also absent was an explanation of the variables that NGINX makes available for its configuration. These too will be discussed later in this book. This chapter’s focus was on the basics of configuring NGINX.

Bravo! The author was thinking ahead, anticipated my concerns, and addressed them immediately at the point I had them.

The rest of the book gives deeper, more detailed information about specific uses for NGINX. Topics covered include using NGINX for serving mail, reverse proxying, setting up security, HTTP serving, including setting up your server for use with PHP (which is much easier now than when I wrote this outdated post), caching, tracking, and various sorts of troubleshooting. I was thrilled to see the appendices, especially the rewrite rule guide, as when I tried to do rewrites, I couldn’t find any good information (see my now-long-outdated post on the topic.

I was pleased to see how complete and clear the book is. Kudos to the author, the reviewers and editors, and the publisher. I recommend this book to anyone who uses NGINX or wants to do so.

Disclosure: I was given my copy of this book by the publisher as a review copy.

Learn You Some Erlang for Great Good!

Functional programming is not new, but it is becoming popular once again. For this reason, in my last book review, I talked about a Lisp book and this review will cover a book on Erlang. Functional programming treats computation differently from other programming languages. Here, computation is done by evaluating mathematical functions. State and mutable data are avoided. Most of this is rooted in lambda calculus, in which everything is a function (yes, I’m simplifying, but this is a short review). Even if you prefer to use a different programming style, learning a functional language is beneficial to expand your skills and your ability to think of a problem in multiple ways, which often leads to more elegant and human-readable solutions. This is vital for long-term maintainability of code.

Learn You Some Erlang for Great Good! is by Fred Hébert. One of the things I really admire and appreciate about the author is that he provides a great example to others. So often, budding programmers and computer scientists feel intimidated by functional programming, somehow believing that they need to study for years and earn a higher level computer science degree before they even make the attempt. Hébert is a self-taught programmer and also the author of one of (perhaps the) most respected and used Erlang tutorials out there, on which this book is based and shares a title. He was named Erlang user of the year for 2012. Hébert proves that really bright people can learn and use and teach complicated things, and you can do so without learning it in a university. So, put aside the intimidation and press on!

This book covers all the basics of language and syntax, as well as the needed functional programming concepts and techniques. It covers the hot Erlang topics of today, too, stuff like concurrency and distributed computing. One thing I love is that as the book discusses these things, it does so without the typical hype and over-zealousness that often accompanies Erlang presentations and discussions. In fact, there is an amusing series of information box notes throughout the book, each titled “Don’t Drink Too Much Kool-Aid,” that give a welcome, balanced view of various features, praises, and criticisms of Erlang. Each of these shows a grounding in reality that comes from real-world use.

This is a serious book filled with quality discussions, clear writing, interesting and useful examples, and an occasional bit of whimsy. The book isn’t playful like Land of Lisp, but it isn’t dry and boring or overly academic, either. It is an accessible, practical book that the real-world programmer who is considering Erlang will find useful.

Disclosure: I was given my copy of this book by the publisher as a review copy.

Land of Lisp

Programming books are not fun. No one uses Lisp anymore, and almost no one ever did. There is no practical reason to read a book about Lisp. These are a few misconceptions that this review aims to correct.

Land of Lisp is by Conrad Barski, M.D. It is a book filled with enjoyable art, clear prose, and an easy to follow structure. The examples used in the book are easy to comprehend and do a very good job of illustrating the concepts being taught while also being interesting.

Let’s step back for a minute. What is Lisp? Lisp is a functional and expressive programming language. It was born out of an attempt to make a programming language that is easily read and understood by humans while also being able to do a lot in a short number of lines. Lisp code is compact and involves a manner of expressing instructions that is different from any other programming language I have experienced. It is with good reason that people describe Lisp as poetry, as elegance, or as “casting spells”. When you really get it, Lisp will affect how you program in any language because it changes how you think. I may be biased, I first encountered Lisp way back in 1987.

Land of Lisp includes within it the same sense of quirky brilliance that you remember in your favorite computer science or physics gurus. All share a different, not-completely-serious way of looking at the world that also allows them to come up with ideas that shatter stereotypes and enable new inventions. The book resides somewhere between the classic The Far Side comics and Richard Feynmann, perhaps with some of the better qualities of Richard Stallman thrown in, without Stallman’s sometimes off-putting traits. The book is a throwback to an era when playful brilliance was the norm in science, including computer science, and I mean that in a good way. This is one of the most fun computer books I have ever read.

So what about the quality of the information, from a technical standpoint? Rest easy, this also receives kudos. Land of Lisp starts with a short history section to give the reader context and then jumps right in to programming. Throughout the book, games are used to illustrate concepts. The first game is identical to the “guess the number” game I programmed on my Casio fx-7200G programmable graphing calculator back in 1986. The game is a simple one, but it provides a launching pad to greater things. The program is used to discuss global and local variables, functions, and basic Lisp etiquette.

From here, we move into syntax, code and data, and lists. Then, in the section titled “Lisp is Symmetry,” we begin the deeper topics like conditionals, paths, objects, reading and printing text, lists, and lambda. The last one, lambda, even gets its own chapter, which is a good thing since so many find it difficult and confusing at first. Before the section ends, Land of Lisp helps you learn important concepts using the classic Hunt the Wumpus and we get into arrays, hash tables, structures, and sequences. Now we are almost halfway through the book.

Land of Lisp includes some atypical examples for Lisp, and I like this. While it teaches the remaining vital programming concepts and Lisp style, we learn not only silly games, but even how to create a web server, really grok functional programming, macros, and more. The book is focused on Common Lisp, but modern variants like Clojure are also discussed.

If you have ever wanted to learn Lisp, but find typical tutorials and resources a bit dry, this is the book for you. Even if you aren’t as excited about the playful bits of the book, the quality of the prose and technical descriptions are such that you should give Land of Lisp a chance.

Disclosure: I was given my copy of this book by the publisher as a review copy.

A Chance Encounter with Mr. Darcy’s Progenitor

(In honor of the 200th anniversary of Pride & Prejudice, a review written in a style which attempts similarity to that of Miss Austin.)

I found myself, through no fault of my own, suffering terribly for several days under a fever. During the course of that time, I exhausted the contents of my reading list and asked my beloved wife if I might read her favorite book, one Pride and Prejudice by a Miss Jane Austin. Here is my opinion.

Miss Austin is a talented writer. She is witty, charming, gifted in her phrasing and descriptive ability, and has a sharp, perhaps wicked, sense of humor. I don’t like her at all. Next to hers, my own prose arrives at the ear uninteresting and plain. Hateful woman. Her ability to make the mundane and silly prattle of Elizabethean women both interesting and delightful gives me cause to doubt my own abilities.

I had the privilege of attending a ball at which Miss Austin was also an attendee. A Mr. Darcy, my longtime friend at whose estate I have often passed enjoyable hours fishing for trout in his stream or listening to his delightful sister play on the piano forte, did the pleasure of introducing us. In person, I found Miss Austin engaging, insightful, and possessed of a savage ability to expose to the world the innermost parts of other attendees with a mere sentence. May I always find myself in her good favor.

During that encounter, Miss Austin enquired as to my opinion of her book, as Mr. Darcy had informed her previously of my reading it. I told her all that I have already described to you. She then asked me to be forthright and direct with her as to my personal opinion. I hesitatingly told her that, while I found her writing gifted and her skills great, I was not enamoured with her subject matter as it falls outside of my personal interests. She gave a frown and replied, “Of course, you are not among my target audience.”

We both stood silently for a moment, regarding one another. Our stern gazes met, softened, and smiles appeared. Soon we found ourselves laughing giddily and causing no small scene. In the end, we embraced and parted as friends.

Python for Kids

I previously reviewed a book intended to teach programming to kids, Super Scratch Programming Adventure. That book used a self-contained editor and language that was easy to understand, easy to use, but confined its usefulness to a very limited set of roles. This is because of how Scratch is run and written.

It is no secret that I like Python. Even though I really don’t write code anymore, at least not very often, for most purposes I am still a big fan of Python over any other programming language I have learned. I’ve reviewed two Python books in the past, Learning Python and Python for Unix and Linux System Administration. While I know people who use Python as a beginner’s language for kids, I had not done any reading nor read any curriculum used for teaching programming to kids using Python that I felt I could recommend freely. Until now.

Python for Kids: A Playful Introduction to Programming is by Jason R. Briggs. It is the book that fills the hole in my Python library. It starts with a nice introduction and installation instructions for Windows 7, Mac OS X, and most importantly to me, Ubuntu (on which you are really only checking to make sure you have Python 3 installed, since Python is installed by default, although Ubuntu releases older than 12.04 may still have Python 2.x installed as default). Perhaps it is because we started in a similar era, but I found Briggs very easy to read and follow; like me, he started out by learning BASIC on a TRS-80. More likely, the clarity and tone are the result of an intentional focus so that kids can comprehend the complexities of the material. In either case, he did a wonderful job.

The book is broken down into logical chapters, each building upon the previous ones. It starts with foundational concepts like variables and calculations, adds types like strings and lists and tuples, then begins with an introduction to graphic interaction using the turtle module. This is much sooner than typical, and I think it is beneficial because it gives kids a quicker jump to that fun moment of power, “Hey! I just made that thing move on the screen.”

Then the book builds understanding with explanations of if and else statements and loops. On top of that are added the concepts of functions, modules, classes, and objects. We are now a mere third of the way through the book.

From here on, the simple explanations given will be expanded upon in easily-absorbed chunks. Built-in Python functions and useful modules each get a chapter. Then, we revisit turtle graphics to play some more. Once the basic graphic concepts are taught with turtle, tkinter is presented.

The last third of the book is focused on games. Specifically, using some fun game examples to flesh out the concepts more completely, developing greater fluency with the concepts, grammar, and vocabulary already presented.

One weakness of many beginning programming books is that once you finish the book you have to do further research on your own to figure out what to do next. I love that Python for Kids does not end this way, but instead includes a useful Appendix titled Where to Go from Here. This Appendix is short, but gives enough information to help the reader learn just a little bit about some Python resources and other programming languages to make those next steps just a little bit easier.

This book is suitable for kids in upper elementary school and older. The only real prerequisites are the ability to read and understand the concepts and a computer that will run Python. While the book is clearly written using suitably simple vocabulary, it is not watered down and never talks down to the reader. For this reason, despite the title, this book could be just as useful for the adult programming novice, too.

Disclosure: I was given my copy of this book by the publisher as a review copy.

LEGO books for all

This time around I have a real treat: three books about LEGO. These bricks were a staple of my childhood. They are well made and foster creativity in ways no other toy does. My LEGO collection has been handed down to my kids (who allow me to play with them sometimes) and added to many times.

These books give interesting insights and ideas that LEGO aficionados may enjoy. Each book is focused on a different segment of this audience. All are from No Starch Press. All the books are nicely printed on quality paper and include amazing color illustrations throughout. I’ll say right up front that, while I really liked all three of these books, I am reviewing them in order of preference. This preference reflects my personal tastes more than my feelings about the quality or content of any of the books, though. I think each deserves a high rating.

The first book is The Unofficial LEGO Builder’s Guide, 2nd Edition by Allan Bedford. This book has a lot of words, but they are not wasted words. It communicates the philosophy behind the engineering of LEGO and then builds on that knowledge the skills necessary to design and create anything you can conceive of using LEGO. That’s an amazing feat! There are some step by step directions to build a few things, but these are used more to illustrate good and useful techniques rather than give examples of what to build. The information given is deep, interesting, and would give a great foundation to anyone wanting to learn to build using other materials later in life. I recommend this book to anyone from older elementary school all the way through adulthood.

The second book is The LEGO Adventure Book, Vol. 1 by Megan Rothrock. This hardcover book includes a series of about 25 step-by-step building guides that are similar to what is provided when you buy a LEGO kit and pictures of about 200 built models for further inspiration. The illustrations in this book are stellar and the models are outstanding. Anyone looking to be inspired to build more interesting and more beautiful things will find this book thrilling. The book follows a loose story line focused on an adventure, a quest to learn how to build interesting and complicated things with LEGO. The story line is neither vital nor distracting, it just gives an fun excuse to move from idea to idea. This is the book that I expect my kids to enjoy most (ages 7, 9, and 10), with the older kids graduating to the book above very soon. This book includes “Vol. 1” in the title. I haven’t seen any other volumes, but will be watching for their appearance.

The third book is The Unofficial LEGO Technic Builder’s Guide by Paweł “Sariel” Kmieć. This is the most technical of the books in this review. Not everyone moves from standard LEGO bricks and kits to the Technic series. Those with a bent toward engineering, toward learning the mechanics of systems, love Technic kits and what can be done with them. I remember building my first car with a working steering wheel that actually turned the front wheels using Technic pieces back when I was in middle school (say 12 or 13 years old). I loved learning how this stuff works and the flexibility that comes from building with the even-more-precise-and-flexible gears, beams, and technical pieces available. I remember building a model of an internal combustion engine and tons of other stuff of this sort. Not everyone finds this interesting, and this smaller audience is the only reason this book is listed last. If you like this sort of thing, this book will expand your palette in ways you never imagined. You will learn about all the types of pieces available, how to use them to even greater effect, and learn some great mechanical science at the same time.

Disclosure: I was given my copy of these books by the publisher as review copies.

Ubuntu on a Mac

With every copy of Ubuntu Unleashed 2013 Edition we include a DVD of Ubuntu 12.10. This is similar to what we have done with past editions. The contents of the DVD are identical to and taken from the main Ubuntu download page. In the past, this disc has been sufficient to boot live or install on either a Windows machine or a Mac. However, this time around, anyone putting the disc in a Mac will find that the machine will not boot from the disc.

Bummer. We didn’t discover this until after the book was printed, the DVDs were created and attached, and the book shipped. When I read through the install documentation for Ubuntu while doing the editing for the new edition of the book, I failed to see any note of there being a problem. In fact, as I looked today (20 December 2012), there is still no note of any special needs when using Apple Mac hardware on or in the install instructions at

I have found that there is a different install DVD image available for 64 bit Mac that anyone can download from, but this is not mentioned anywhere else that I can find and is not available from the main download page. I found it by searching Google and discovering the problem is common and that a new iso was created to circumvent a Mac-specific issue (details below on the actual issue).

If you bought my book and own Mac hardware, I apologize for the inconvenience. The DVD attached to the book will not boot on your machine, but you can download the Mac image mentioned just above and it should work.

For those interested in the technical details of the problem, here is a high-level description.

In past years, computers used a BIOS, or Basic Input/Output System, to load some software necessary for the hardware to then read and load an operating system. The industry has been moving to the UEFI, or Unified Extensible Firmware Interface, which serves a similar purpose to a BIOS but communicates differently and with greater flexibility. Most UEFI software includes legacy support for BIOS services to ensure compatibility across a wide range of hardware. Linux supports UEFI, and as a result, so does Ubuntu.

Because the version of UEFI that is included with Mac hardware only has to support a very limited range of hardware, it does not include that BIOS legacy support (and perhaps other support). This means that Mac hardware using UEFI can not read the files from the disc that are needed to boot Ubuntu. This is a direct result of Apple making a decision to use only the parts of the UEFI standard that support their Apple hardware. While it is not my preference as a geek and tinkerer, it is a reasonable business decision as Apple seems to prefer to control the entire user experience so that everything will “just work” for their users. The downside is that it becomes difficult to use any hardware or software they do not produce or directly sanction. Booting any operating system that is not OS X on Mac hardware is a use case that Apple does not support, so it doesn’t work easily. The workaround is to download the Ubuntu-community-provided modified DVD image linked above and use it as it has received some modifications that enable the version of UEFI on this Mac hardware to recognize the DVD and allow Ubuntu to boot.

Advent 2012, justice, and God stuff

Advent really starts in a couple of days, but I’m already thinking about it. Here’s my thought for the season. Feel free to ignore this if it isn’t your thing. If my religious post makes you feel a little grumpy, please read it in the light of my post from 2007 about Holiday Greetings and hyper sensitivity.

The season of Advent is about waiting and anticipation. We believe these things, but are waiting for their full arrival…just as we believe in faith that Christ’s actions brought about our justification, but we are still waiting for the completion.

Christianity too often seems to teach the Gospel in terms of punitive justice, as if to say that because God is being kind, he chose through Christ to die in your place and take the punishment you deserve.

What if the real message is one of restorative justice, one that turns the entire idea of “an eye for an eye” upside down? What if the real message is that God saw the problems that result from sin and chose to come through Christ and take all those problems upon himself, along with the sin that causes them, and have them die with him?

The upshot then is that we can be justified, not merely in the sense of “the jury decided to call you innocent,” but in the sense that we who were unclean were loved and accepted and cleaned from the inside out so that there is no longer anything within us that keeps us from being with God?

That is a much more beautiful reading of the Gospels, of Romans, of the entire message of the Bible.

I think it is also the message Christ taught and which earned him the moniker “friend of sinners,” originally intended as an insult, and that message is a large part of why he was perceived as a threat by the religious powers of his day.

I think it is the real message intended by Saint Paul for the readers of his letter to the Romans and why he felt he had to so strongly and completely renounce his former belief in religiously motivated violence.

In my opinion, this is the beauty of Advent and this time of year–God sees each of us as we are, loves and accepts each of us, and as we let him, gently changes us to become more and more pure, as we allow ourselves to die with Christ so that Christ may live in and through us.

I once heard an Eastern Orthodox priest say that God has sanctified us (made us holy), God is sanctifying us (is making us holy), and that God will sanctify us (will make us holy). For one outside of time, these can happen “concurrently.” For those of us bound by time, that is nearly inconceivable. I think the phrase in the first sentence sums it up as well as it is possible to sum it up. Advent is a beautiful celebration of that mystery, of waiting for what will come even though it has already happened (and is happening). It celebrates anticipation and hope, expectation and wonder, a looking past the flawed things that are and toward an ideal hoped for future, both personally and for those around us.

Whether you believe the same as me or not, I hope that I can display to you the same love, acceptance, and gentle desire for ever-improving good things for you. This is my wish for this time of year.