Working with Code in e-Books

This is an update of a post that originally appeared on March 16, 2016.

Most of my technical readers now use e-books instead of paper books. Of course, there is a convenience factor to storing your entire library on a Kindle, even if it’s a software version of the Kindle. Of course, there are all sorts of e-book formats for your desktop system as well. The point is that electronic format makes a lot of sense when dealing with technical books.

However, e-books can cause some interesting problems and I’ve encountered a few with a number of readers now. The most important consideration is that you can’t cut and paste code from an e-book directly into your IDE and expect it to work. There are all sorts of reasons for this exclusion. For example, cutting and pasting may insert special characters into the output stream or the resulting paste may not have white space in the right places. A common problem is that publishers often convert regular single and double quotes into curly quote equivalents. The two kinds of quotes (both single and double) are completely different and the second type definitely won’t compile.

The best option when working with an e-book is to view the code in the e-book, but still get the downloadable source code for the book from my website or the publisher’s website as described in the book’s introduction. If you can’t find the downloadable source, always feel free to contact me at [email protected]. I want to be sure you have a great reading experience, which means having source code that actually runs in your development environment.

Another potential problem with e-books is that you may see unfortunate code breaks (despite the efforts of the publisher and myself). When you need to understand how white space works with a programming language, always review the downloadable source. The fact that the downloadable source compiles and runs tells you that all the of white space is in the right place and of the correct type. Typing the source code directly out of your e-book could result in added carriage returns or other white space errors that will cause the code to fail, even though the commands, variables, and other parts of the code are all correct.

As always, I’m open to your questions about my books. If you don’t understand how things work, please contact me—that’s why I’m here.

Discovering the Right e-Book Format

As I start to get more involved in planning my first self-published e-book, I’ve been looking into the requirements for putting such a document together. When you write for a living, you get used to having a whole plethora of skilled individuals to help you put a nicely rendered document together. There are a number of editors to help, along with the production staff that takes the document from ethereal bits to actual paper. So, the thought of doing everything myself is a bit daunting because I really want the final product to look great.

There are several considerations and reading about self-publishing online usually fails to break these elements into manageable pieces. The first piece is the document itself. I’ve read a number of sources that suggest using HTML or a direct output format, such as EPUB. However, I’m starting to believe that while they leads will work, they aren’t necessarily optimal if you want to publish your work through a number of online vendors. The advice offered in Clearing Up Confusion About Self-Publishing seems to ring true-using the .doc format will work best. Actually, the article mentions both .doc and .docx formats, but I have good reasons to use .doc:

  • The format is used more often by third party products.
  • It’s easy to scan a file in .doc format using a utility such as FindStr.
  • There seem to be fewer glitches with the .doc format.
  • I have more templates that work well with the .doc format.

Of course, you can just as easily use the .docx format if that format appeals to you. The choice is one of personal taste in this case, but choosing one of the two seems to be best because it’s accepted by three major online vendors.

Another consideration is the actual content and formatting of the document. I have years of experience with the content part of the question and have a good idea about formatting. However, self-publishing and going exclusively after the e-book market puts a few twists into the picture. After reading a lot of documentation online about the issue of formatting, I found a lot of good material in Creating an e-book: Tips on formatting and converting your document. Although all five pages of this article are good, the best formatting information begins on page 4. However, what a lot of these articles fail to mention are the obvious sorts of things that some people fail to do:

  • Create a comprehensive outline for your book.
  • Actually stick to the outline as you write.
  • Format the outline when you put it together so that you can use the same formatting in the book.
  • Ensure you collect the resources needed to make your outline work and note them in the outline.

If you’re seeing a pattern here, it’s that outlines are important. The better you define the outline, the better the book will come out. Part of formatting your e-book is creating a good outline and then sticking with it.

After you decide on a document format, the formatting of the book content, and the content itself, you need to consider one other element-presenting your book to others. Of course, the presentation starts with a great cover. Most of the material I find online for creating covers is negative. For example, avoiding the use of book services. I’m used to thinking about how to market my books because it’s part of what the publisher asks me to provide, but I’m also having to start to think about the cover in more ways than simply the content the cover provides. Actually, it’s a creative process that I plan to enjoy.

I know that e-books aren’t for everyone and as a result you may be limiting your target audience, as many people either don’t have access to a computer/laptop/tablet or wouldn’t enjoy reading a book on one of those devices. However, you could always go online and have your ebook printed out as a physical book which you could then sell/give to those who want it but couldn’t access it as an e-book.

I’ll keep you updated as I work through these first several self-published book projects. However, for now, I’ve been putting some content together and thinking a lot about what I need to do to get the book out there and make it sell. Let me know your thoughts on self-publishing at [email protected].


The Ongoing Evolution of Libraries

I read a news story this weekend that confirms some of the things I’ve been saying about the future of libraries. The story, Texas library offers glimpse of bookless future, describes a new library in Texas, Bexar County’s BiblioTech, that doesn’t actually contain any books. This library contains computers and e-book readers that people use to work with content electronically. The article states that a lot of people are looking at this library to see how successful it becomes because the cost of maintaining such a library is significantly less than a traditional library. In fact, advances in technology will continue to make it possible to further reduce the cost of maintaining this particular kind of library.

However, I’ve been exploring a question for a while now about the future viability of libraries as physical entities. I first described this particular issue in my A New Emphasis On Libraries post. For 3 ½ years now I’ve tried to expand on the theme discussed in the Future of Libraries? post. The problem with a library that serves up only electronic media is that it’s overkill. Eventually, such libraries will disappear because people will be able to find the content online. A national library that’s based on the Internet will eventually take hold and that will be the death knell for the local library.

Something that the article brings up is that this library serves a neighborhood where few people have the hardware required to read electronic books and there is no Wireless Fidelity (WiFi) connection in the area for them to use. At one time rural areas didn’t have telephones because it was too expensive to service them. Now rural areas have good satellite or Digital Subscriber Line (DSL) connections. It won’t be long before rural and less serviced areas in cities have WiFi connectivity. So, the first problem this library solves won’t be a long term condition. We’re in a transitional phase.

The devices used to read books electronically will continue to evolve and become less expensive. At some point, the government will figure out that it’s less expensive to simply issue a device to those in need, rather than build physical libraries. At that point, a virtual national library will become feasible and probably appear on the scene. Paper books will eventually be relegated to the niche market—sold to those who have the money required to buy such products.

I’m one of the few, I’m sure, who will miss the paper book when this change happens. Using e-books for technical reading really is quite nice, but the feel of paper when I read fiction just can’t be overcome by the convenience of using an e-book reader. At one time I predicted that paper would continue to be available and preferred to meet my fiction needs, but things have changed faster than I could have ever predicted. It may very well be that the transition to e-book as the only viable media will happen within the next few years—only time will tell.

What do you feel about the transition to e-books and virtual libraries? If you like the idea of being able to find any book and check it out using a virtual library, let me know how you envision this system working. More importantly, how will such a system compensate authors for the time and effort spent putting the books together? Send me your ideas to [email protected].


Learning About Online Publishing

Eventually, you’ll likely read absolutely everything in electronic format. As e-book readers like the Kindle and Nook (too many to list) become more popular and the cost of producing paper-based products continues to increase, people will naturally gravitate toward the less expensive medium. Yes, many older people, like me, will continue to enjoy at least their fictional reading in paper format, but even the most steadfast amongst us has gravitated toward e-book format for professional and technical reading.

Besides saving trees and reducing costs, e-books make it possible to bring many marginal topics to the market. An aspiring author can self publish books that a publisher might not be willing to touch because the perceived profit margins are too low. Once books are published, looking into how to get book reviews could be a step with considering, especially if an author is looking to make a name for themselves in this industry.

Articles such as Bestseller Success Stories that Started Out as Self-Published Books point out the times when publishers simply got it wrong. The book idea really produced a great book, but the publishing staff didn’t know it. Of course, self-publishing can also produce atrocities that can hardly be called literature. The book publisher has acted as a kind of testing ground for book material in the past, but that era has passed and now the consumer must filter out the good from the relatively large flow of bad material. There are so many publishers and printers out there, that it can be hard for one to even choose a book publisher – pushing people to get their work self-published instead. By simply searching for london print services, or printing services wherever you might be located, an array of choices are given to you. As a writer or business owner, it can be hard to know where to begin.

There are many sites online that tell you about online publishing and getting your work self-published. I personally started with Creating an e-book: Tips on formatting and converting your document. It’s a comprehensive article with a lot of great tips that just about anyone will find useful. A problem with many of the resources you find online is that they’re oriented toward a particular genre, device type, publication method, or content type so that the advice is less useful than it could be.

However, my favorite new source of information for everything to do with e-book publishing is The Electronic Author. The material on this blog is published by someone who actually does output a number of e-books each year and has a copious number of books to his credit, Wallace Wang. In fact, I recently reviewed on such offering, Math for the Zombie Apocalypse. So, unlike many other places you could go for information, this blog really is run by someone with a considerable amount of experience.

The point I’m trying to make is that if you do plan to self-publish the next great American novel, you need to research the required techniques before you make the attempt. Otherwise, you could find that your book doesn’t sell well (or possibly at all). There are a lot of resources out there for improving your product. Everyone who wants to read your book also wants to see it in a usable format. Let me know your thoughts about self-publishing at [email protected].

Contemplating the Future of the Written Word

Last week I wrote a post entitled, “An End to the Written Word” that generated more e-mail than most of my posts have in the past. The e-mail content covered a broad range of thoughts and emotions about the written word. Of course, it’s hard to imagine that anything we have used so successfully for so long will eventually go away, but that’s how technology works. A technology is kept only as long as it’s useful. However, I need to provide some more input on my thoughts about the written word based on some of the e-mails I received.

Let me put one thought to rest immediately—I’m not just talking about paper print. Yes, everyone has been predicting the end of writing on paper for many years now and if anything, some businesses actually use more paper than before the computer revolution. However, paper will eventually go away in its entirety. There are a number of indicators of its demise in my own life and I’ll share them with you.


  • Manuscripts: At one time I sent my manuscripts to the publisher in printed form. I boxed up my books and sent them for editing in double spaced form. The manuscript would come back with editors marks in place at some point, I’d make any required changes and send it back (the postage really got out of hand at times). In fact, paper would pass back and forth several times before a printed book came out. The process was incredibly slow. Today I’m using electronic media for all my book needs and my printer is collecting dust.
  • Royalty Statements: All of my royalty statements used to come in paper form. Some of them still do, but many of them come electronically now. I eventually look for the huge folders used to store my tax information to become quite svelte indeed.
  • Contracts: A lot of my contracts are now issued in electronic format. I use an electronic signature to sign them. Not only is this approach faster, but I don’t have to provide storage for bulky contracts any longer—the contract goes right into the same folder as all of the other electronic files for my book.
  • Book Purchases: Most of my books are now sold as e-books, not as printed books. It will eventually become uncommon for me to sell a printed book. In fact, I have to wonder how long I’ll continue to obtain printed author copies.
  • Banking: More and more of my banking is done electronically. Even when I do send a check to someone, they often don’t send it back to the bank. The transaction is performed electronically.

I’m sure you can come up with examples from your own life, but the fact is that printed matter is going to go away. However, that’s not what I’m talking about. Eventually, writing itself will become something that professionals use to express abstract ideas that can’t be presented in some other way. People will commonly not use any form of writing because there will be other ways to convey thoughts and ideas to other people. In fact, those other ways already exist. I don’t look for writing to go away in my lifetime, or even in the lifetime of my grandnephew or grandniece, but I do look for it to go away.

Many of the uses that writing once fulfilled are being filled by other technologies. For example, it’s quite possible that contracts in the future will be written using a video record, not writing. A mortgage might show an actual recording of the property in question and include pictures of the participants in the deal. An iris scan of the parties will encrypt the video so it can be played, but not changed. Of course, this technology is quite futuristic indeed, but the concept isn’t all that hard to grasp.

Books and other forms of general communication are already starting to become more visual and less written—it isn’t much of a leap to think other communication will follow. Sites such as YouTube have become popular because it’s easier to show a video of an event than to write about the event in words. In addition, the recording is actually easier for other people to understand. Sites such as Facebook also rely heavily on graphics, not on the written word. The point is that anything that is concrete and easily conveyed using a combination of audio and graphics is already being presented in precisely that form, without written words.

I’ll be discussing this topic more as time goes on, but for now, this gives you an idea of some of the questions I’ve received. This whole idea of writing going away has taken some people by surprise (and others simply expect it to happen). What are your ideas about writing? Let me know at [email protected].


An End to the Written Word

A reader asked the other day whether I thought that books (even e-books) would become outdated-that we would no longer need writing. A quick answer to that question would be no. However, the fact is that writing does serve a particular need. It allows for long term storage of thoughts and ideas so that they can be transmitted long distances, shared by those who don’t interact with the writer, and preserved for posterity. Writing is an old and established form of data storage. It actually replaced an even older data storage technique-the story teller.

Today there are many forms of data storage and writing is only one of them. In the digital age, unsurprisingly, the resources offered by Timescale and other providers is far more practical. From a convenience perspective, listening to someone tell you about something is easier than having to learn special symbols and then translate those symbols into spoken words in your head. The use of interactive graphics and demonstrations are far more revealing than translating a written procedure into movement by reading the words and then thinking about what you need to do in order to accomplish the tasks described by the words. For many people, hearing someone speak the words of Shakespeare will present not only the content, but the intonation required to actually understand the words at a deeper level. So, I do look for the written word to disappear from common use at some point (fortunately, not today).

However, even the best speaking, graphical presentation, and animation in the world aren’t up to the task of presenting most abstract ideas. An equation requires the use of symbols to represent the various concepts declared, defined, and solved by the equation. The symbols need not represent anything in the real world. Scientists will continue to require some level of writing to discuss, store, and implement abstract ideas. The presentation of these symbols need not be on paper (in fact, it probably won’t be on paper), but it will be writing nonetheless.

The tone of the conversation was such that I knew the reader was actually wondering whether I thought I might someday be out of a job. Writing is simply a tool that authors use to store ideas. Whether the author uses words or some other means of presenting ideas is immaterial, the ideas remain. It may very well be that I’ll eventually resort to other methods to present the ideas that form in my thoughts and that the creative expression of those ideas will take a different form. I don’t see myself as losing an occupation, but of having methods that my predecessors could only dream about to interact with my readers.

In short, it appears to me that eventually not everyone will know how to write because other forms of information exchange will become easier and more flexible. Some people already do all of their banking without writing anything-many other tasks will follow suit. Tomorrow, writing may not even be a part of the curriculum in grade schools. Students will learn some form of symbolic presentation in college as part of their professional courses and only professionals will use writing at all. However, I don’t see writing ever going away completely. Let me know your thoughts about the written word at [email protected].


Handling Printed Output in a Colorful World

There is an issue that most writers encounter when creating art for a book, but which readers seldom think about. Everything you use on a computer includes color, yet most books (especially technical books) are printed in black and white due to the prohibitive costs of printing them in color. Even many e-books use black and white images because the publisher typesets the document that way. Fortunately, e-book output is changing and you can get color images in them now, but the problem for the author is still there and will be there for quite some time to come.

Translating a colorful world into something that prints well is hard. Most publishers have strict guidelines on configuring a system to produce optimal printed output. Even though the output is optimal, the resulting system display seldom looks like anything you’d use on a regular basis. Even font smoothing is discouraged because it causes problems in the printed output. So, as a starting point, you need to understand that the plain image you see in the book is plain in order to make it easier to print.

Still, even with all of the settings that publishers require and authors invoke, the computer display is still ablaze with colors—some of which won’t print well and some of which will blend into each other. These two problems aren’t apparent at times until the book comes out in print. Putting sky blue next to buttercup yellow works just fine when viewing them in your browser, but they don’t print well. Assuming that the two colors print at all, they’ll be exceptionally light and will tend to blend in a way that makes it impossible to tell one from the other in the book. So, color choice becomes problematic for the author trying to seek a balance between what looks good in the real world and what looks good in a book.

It’s important to remember that books are printed in only two colors: black and white. Gradients of color, grayscale, are simulated by varying the dot density in a particular area of the book so that it appears the colors are either lighter or darker. The best an author can hope to achieve in simulating this environment is to employ a screen capture program that can also create grayscale output. In fact, that’s one of the tasks I perform as part of writing a book. Here’s a color version of one image I added to a recent book.


As part of the writing process, I converted the image to grayscale to see how it would appear in the book. Here is the grayscale version:


The grayscale version isn’t nearly as pretty, but it does work. You can see all of the details on the page. Of course, it won’t look precisely like this in the book, but the grayscale version does help me visualize an approximation of the image appearance.

As more publishers begin to use color in their e-books and you begin to employ it to dress up your examples in book, you also need to consider special needs requirements. With this in mind, I also check all of the images in my book with VisCheck, a color blindness simulator, to ensure that readers who have special visual needs can work with the book without problem. Colorblindness (or more precisely, color shifting) causes some people to see colors incorrectly (often blended) even though they appear quite different to someone with normal color vision, so ensuring the colors work for someone with colorblindness is also important to the author.

Every graphic you include in a book is important and readers need to see them well. It may seem like a lot of bother to perform checks like those that I employ, but from the reader’s perspective, the time is well spent. Let me know your thoughts about working with color in books at [email protected].


E-book Integration in Schools

I use every opportunity I can to track the change in how people read information. Some of this material is in articles, some comes from readers and friends, and some comes from just observing. For example, at one time people would grab a magazine from the rack at our doctor’s office. Now it’s quite likely that they’ll take out a Kindle or other reading device to view their favorite novel. Even at our library, I see people sitting in front of computers reading, rather than holding a book. Increasingly, I get questions from readers who use the e-book version of my books, instead of paper copies. Let’s just say that in the year and two months since I wrote The e-Book in Your Future, things have changed considerably. E-books are reducing the cost of reading material of every sort, especially technical books.

That’s the reason I’m a bit concerned about some of the things I read about our school system, especially when conversations with students tend to bear out the information I read. One ComputerWorld article in particular, “The e-book revolution is bypassing U.S. elementary schools” really grabbed my attention. The author, Joe Mohen, makes some astute comments about the benefits of using e-books in schools. As an author, I see significant benefits in using e-books, such as the ability to update the information as needed. Schools often struggle with outdated texts now due to a lack of funds, using e-books greatly reduces the cost of updates making it possible for schools to keep their texts updated.

More worrisome is the fact that most of our colleges still use paper texts. In talking with any number of students, I have yet to find any of them using more than one or two e-books for their classes. Given the high cost of education, it makes sense to reduce costs by providing students with materials in electronic format. A recent Forbes article, “Should College Students Be Forced To Buy E-Books?” makes a strong case for using e-books in colleges. The same article points out that only three percent of students currently use e-books for their education.

My interest in e-book technology isn’t just a passing fancy. Part of the reason I spend so much time delving into this issue is to discover how to serve you best. A large percentage of my readers are college students. What if my books were offered only in e-book format? Would you still buy them? For now, my books will continue to appear in both print and e-book format for the most part, but the time could come when I’m asked about how my readers would be affected if the publisher produced only e-books. To answer that question, I need your input. Let me know your thoughts about e-books, especially in the school environment, at [email protected].


Self-Sufficiency and Technology

One of the things I’ve been curious about lately is how much of a role technology plays in current self-sufficiency efforts. For example, there has been a strong emphasis on heirloom (heritage) plants and animals, rather than using plants and animals that science has helped to produce, because these older varieties offer things that modern science can’t. For many people, the main reason to rely on heirloom varieties is that they always produce the same thing. If you plant an heirloom seed, you get the expected plant, rather than something mysterious that results from hybridization. Of course, there are people of the opposite persuasion who feel that that older varieties lack the benefits that science can provide, such as increased yield or better taste.

Technology also affects technique. Some people eschew modern machines and do all of the work required to meet their self-sufficiency requirements by hand. The benefits are that the carbon footprint of such efforts is incredibly small, costs are low, and the results often better. Using technology makes things faster and easier. Just how much technology you use depends on the size of your work area and the results you expect. Many people use a combination of hand and machine techniques.

Most people recognize that the use or lack of technology has a significant impact on the outcome of self-sufficiency efforts. In addition, the choices we make affect our neighbors and the planet to some degree. Choosing the best options for one scenario often lead to problems in another. That’s why there is growing debate over just how much technology is good for those who engage in self-sufficiency as I do. I’m constantly looking for a better answer—one that produces good results with a minimum of effort, but is also good for the planet.

The question that I have pondered most as of late is how technology affects the presentation of information.  The problem for anyone writing about self-sufficiency is that no one really knows for sure just how people get self-sufficiency information. For example, do you rely heavily on questions you ask online to obtain information? Would you purchase e-books instead of the paper variety in order to reduce the cost of the information, while also reducing the effects of producing paper on the planet? In order to do a good job of providing information to you, I need to know how you communicate. Let me know your ideas on the topic at [email protected].


Considering the Fracus Over E-book Pricing

There is currently a debate raging over e-book pricing. The charge is one of price fixing and the debate affects all book publishers. Even though the press has focused on Apple as the target of the DOJ investigation, the lawsuit also affects five other publishers:
Hachette, HarperCollins, Macmillan, Penguin and Simon & Schuster. Of these six defendants, three have settled with the DOJ: Harper Collins, Simon & Schuster and Hachette. Any time vendors collude to set prices at a specific level in order to improve profits its price fixing. The law is blind as to the reasons behind the price fixing, engaging in this practice is simply against the law for any reason.

The supposed point of the lawsuit is to restore competition to the market, but more than a few people see the opposite happening if the DOJ is successful. There is a fly in the ointment—Amazon. It seems that Amazon has actually been pricing e-book content at a loss in order to promote the Kindle, which has placed the publishers in an unenviable position of losing money in order to remain competitive. Healthy debate on the topic is probably the best course of action until all of the facts come to light, but debate of this sort seldom occurs. Some industry pundits are wondering whether Amazon should be part of the lawsuit as well. A few have come outright as said that Amazon is more of a problem than the publishers for these reasons:


  • The lawsuit will hurt professional authors financially.
  • A decrease in compensation will end up closing smaller bookstores.
  • After Amazon buries the competition, buyers will be hurt by the resulting monopoly.
  • Lower book prices will adversely affect the quality of content available to readers.
  • Amazon already uses the same model as the publisher do, but hasn’t been named in the lawsuit.

At issue here is one of fairness and eventual results. It’s not fair for the DOJ to pursue price fixing for some actors in this situation and not others. If the DOJ is serious about fixing the current problems with competition in the e-book market, then it really does need to do something about Amazon. Otherwise, the result will be a monopoly that will hurt everyone and prove incredibly expensive to fix. More importantly, professional authors already make little money for their efforts—squeezing them further will definitely result in a loss of the incredible wealth of professional authors available today. Fixing the problems in the market will prove considerably more easy than trying to reestablish the author base used to write books when they become completely unprofitable.

Perhaps this will eventually work out in an unexpected way. This may be yet one more nail in the coffin that is currently killing books as a means for exchanging information. The interactive tools that are being developed for use with books may eventually take over and everyone will use them for all sorts of training. However, these tools are currently in their infancy and authors like me are only now beginning the build the expertise required to use them. In the meantime, it’s important that the DOJ take appropriate actions to ensure true competition in the marketplace.

What is your take on this issue? Do you even read books anymore to obtain information or do you rely on some other source? Let me know at [email protected].