The e-Book in Your Future

Back in February I wrote a post entitled, “Paper or e-Book?” where I stated a personal preference of using paper for fiction books and e-books for anything technical. I expanded on that post by writing about the advantages and disadvantages of online media when compared to technical books in my “Is the Technical Book Dead?” post. I even considered the effects of electronic media on libraries in my “Future of Libraries?” post. Let’s just say I’ve given this topic a lot of thought, but up until now, facts have been a little hard to come by. Most people speculate about e-books, but they can’t truly back up their speculation with hard facts of the sort that just about anyone can accept. However, I’ve been seeing articles such as, “Ebook Sales Both Rise and Fall in Wiley’s Divisions” (by Mercy Pilkington) as of late.

It seems as if I’m not the only one who finds the convenience of e-books addicting when it comes to technical topics. However, according to this article (probably the best of the batch I found online), the sales of e-books are stratified. Someone is less likely to buy a cookbook in e-book form, than a tome on writing your first application in C#.

My take on everything I’m seeing is one of practicality. A technical book in e-book form is convenient. You can pack entire bookshelves in an incredibly small form factor. Even the least expensive Kindle can pack 1,400 books in a tiny form factor. You can read all of your books anywhere you go and modern screens have become better at presenting information under a range of conditions, as long as you can focus on the e-book, rather than the surrounding environment.

I also see e-books becoming status-quo in the classroom. In addition to being able to store a hoard of books in an incredibly small space, schools will find book updates far easier to provide and less expensive as well. The media options provided by e-books will enhance the learning experience. From what I’ve seen, e-books are already becoming well established in the school system and I see a day coming soon where a student won’t touch a paper book as part of the educational process.

However, e-books are less useful in some situations. If you spill a sauce on your paper cookbook, you wipe it off and continue on as if nothing happened. Spilling the same sauce on your Kindle will have disastrous results as the sauce oozes into the device and damages it. Even a cheap Kindle costs $79.00 (at last look), which makes for a mighty expensive sauce.

I can also see problems using a Kindle for woodworking. For one thing, the print is small enough that it would be really hard to read construction instructions while using a Kindle. Not only that, but imagine trying to use a drawing in the Kindle—good luck. In addition, dust specs from the woodworking environment would eventually end up inside the device. I haven’t met an environment yet that wood dust can’t penetrate.

It’s hardly surprising then that e-books have become quite popular in some areas, but not in others. The debate is over though. Sometime in your future you’ll likely find yourself using an e-book for a practical need. The more time I spend researching the topic though, the less likely I find it that paper books will go away anytime soon. Paper is still quite practical for many needs and people will use something that’s both inexpensive and practical. Not many people are into gizmos for the sake of having them.

That brings me to my latest project. For the first time I’m writing a book that’s designed from the ground up for the electronic environment. The book is entitled, “Java eLearning Kit for Dummies” and the more I work on it, the more fascinated I become with the possibilities that this book provides. You’ll receive a CD with this book that contains a fully interactive environment. In fact, for the first time ever, you’ll be able to engage in one of my books without bothering with the paper content. You’ll gain access to the book’s information by interacting with the content on the CD. The entire concept is amazing and I’m having a great time working on it.  I’ll let you know more details when the book gets closer to release, but for now, it’s something to think about as you look over the book offerings online. Expect to see more books of this sort.

What is your take on e-books? What niche do you see e-books filling? Do you see yourself using e-books in the future (why or why not)? Talk to me about your expectations for e-books at [email protected].

 

25 Years and Still Going Strong

It was 25 years ago today that my first article, “The Forgotten Chips,” was published in Byte Buyer magazine in San Diego. A good friend, Wally Wang, encouraged me to write it and even helped me put it together. It seems that IBM managed to leave quite a few important chips out of the original PCs design in order to offer a hobbled system at a price they thought everyone would pay and I was upset about it. Never, in my wildest dreams, did I imagine that I’d still be writing articles 25 years later. I can honestly say that I’ve never tired of writing articles—not that every article is easy or even well written. The best articles have been difficult to research and write, and sometimes the editor has to work mighty hard to turn my prose into something worthy of the reader’s attention. Still, this first article is special and only someone who has had something published can understand how I felt when I saw it.

ForgottenChips

It never occurred to me that I would eventually write books. In fact, this first article was slated to be my last. Wally encouraged me to write other articles after the first article turned into a success and I’m happy he did. In fact, we wrote our first five books together. However, the first book, “Illustrated VP Expert,” wouldn’t be finished until mid-July 1988 or accepted by the publisher until August 1988. So, this first article was followed by quite a few more before that first book happened.

IllustratedVP_Expert

I’m currently working on my 89th book and have lost count of the number of articles I’ve written in 25 years (in excess of 300, probably closer to 400). I’ve also accomplished technical editing on at least 63 books and achieved all kinds of other tasks associated with technical writing over the years. It has all been interesting. Nothing worth doing is easy though and there have been times where I’ve pulled my hair out trying to discern why something wouldn’t work. Schedules and deadlines have caused me more woe than I care to remember, but I wouldn’t have selected any other career for myself.

There is a secret to my writing and it’s you. My writing has always been about the readerhow to convey the importance of a topic or make the mundane more interesting. Delving deeply into technology is addicting, but I could have done that in other ways and earned a far better living (technical writers are notoriously underpaid, but you knew that already ). Getting an e-mail from someone who has benefited from something I’ve written makes my day special. It fills me with glee to know that you’re better off because I’ve written something that helps. As long as there is an audience who needs my help, I’ll continue writing.

The question I’m asked most often is where I get my ideas from. That’s a hard question because there isn’t a single source of ideas. Some ideas are easythe publisher or a client requests that I write about something. A number of ideas came to me as I was doing something else or even in my sleep. What can I say? I dream about technology. A few ideas were wrought from the forge of deep confusion and consternation as I struggled to achieve seemingly unreachable goals. My wife has inspired me more than once by asking simple questions that would never have occurred to me. Readers provide more than a few ideas and sometimes a book happens because readers have complained about a book that came before. More than a few of my ideas come from experimentsI set something up on my computer, try it out, and see what happens. In this last respect, I get paid to play.

Where do I plan to go from here? Well, I’ll definitely continue to write technical books. Most of my books are about Microsoft products, but I’ve also written about other applications and languages. A few of my books are hardware related and I even wrote a home security book. I’ve written certification guides in the distant past. All of these sorts of books still interest me and I’ll continue to write them. However, an author needs challenges. I’m currently working on ideas for self-sufficiency books. I may eventually write a book of poetry or two. Perhaps I’ll even get into some fiction. Precisely where I end up depends on what sorts of ideas I get and what opportunities present themselves.

This year saw me starting a blog unlike any other blog on the Interneta diverse blog that encompasses everything I do so that you can get to know me as a person. As a reader myself, it’s hard sometimes to imagine what an author is really like simply by reading books that author has written. This blog is meant to bridge that gap for you. I hope that you’ve enjoyed my writings here and in other places over the years. I’m always there when you need me. Here’s to another 25 years. Thank you for your support!

 

Understanding the Relative Insecurity of SCADA Systems

It wasn’t long ago that I wrote about how Supervisory Control and Data Acquisition (SCADA) systems affect those with special needs in Security and the Special Needs Person. I then posted an update on that original message in An Update On Special Needs Device Hacking. In both cases, I decried the lack of security for SCADA systems that affect those with special needs. I realize that only a truly nasty person would turn off someone’s insulin pump in order to kill them, but our world is unfortunately filled with some pretty nasty people.

One person (who shall remain nameless) wrote to tell me that it was fine that I was worried about special needs people, but that he wasn’t worried about it because these problems don’t affect him. Well, let’s say that you truly are superhuman and will never once need to use any sort of special needs device in your entire life (statistically, you’d really need to be superhuman or die early). Let’s put the whole SCADA issue in another light. Let’s look at your car.

Your car contains SCADA systems. Those ads you see for turning your car on, opening the windows, flashing the lights, and so on using a cell phone are really telling you about the SCADA systems in your car. If you can access your car using a cell phone, someone else can do the same thing. All they need to do is break the security, which someone has already conveniently done for them. CNET News recently ran an article about how an expert hacker had broken into a car.

Imagine now that you’re on an off-ramp. There are cars crowding you on both sides. A crook uses his cell phone to turn off your car engine and unlock the doors. Bam, you’re suddenly in a world of hurt because the car manufacturer thought it would be a neat idea to let you control your car using a cell phone. I have to wonder why such control is even necessary. Does it even serve a useful purpose? If so, why can’t it be secured better?

Of course, not every drives. So, let’s look at another SCADA issue. A recent InfoWorld article states bluntly that our water system is already under attack by hackers. Sure, the hackers are only kicking the tires of their new toy for now, but how long do you think they’ll wait to do something truly terrifying to your water supply? The experts have been warning about this sort of attack for quite some time, but everyone ignored them as being sensationalists. The sad thing is that the experts probably didn’t scream loud enough this time.

Someone out there is probably thinking that the bad guys can overcome physical security too. You’re right, of course. Someone can remove a padlock, jimmy a car, and overcome physical security in all sorts of other ways. The point is that the bad guy has to be in physical contact with the object to overcome it when you’re using physical security. In addition, if you’re nearby, a physical security system often buys you enough time to call the police or obtain help in some other way. The remote control nature of SCADA systems makes it possible for someone to break into the system and do something nasty with it long before you’re even aware of the intruder.

SCADA systems make a modern world possible by allowing remote control of many of the devices that we need to live. I can fully understand how a utility would need to monitor and control a system from a remote location, and how such control actually makes the system safer. However, it’s time that we realize that these systems are dangerous in the wrong hands and that we need to do something about them before a major accident occurs. Here are some ways to make SCADA systems better:

  • The SCADA systems we do need should be secured better.
  • All SCADA systems should be restricted to wired connections only and those wired connections should be on a private, secure, network.
  • Researchers should be advised not to research break-ins for hackers to use (and then publish them for the whole world to see).
  • Our society also needs to seriously consider where SCADA systems can be removed.

Remote control is a two-edged sword and you can bet the bad guys have no compulsion about playing dirty—count on them not following the rules. If there is a way for you to access something, the bad guys will find a way to access it too. Let me know what you think about the threat of SCADA system break-ins at [email protected].

Considering the Inefficiency of a Global Economy

A lot of people have said a lot about the global economy—how it exists and is pretty much unstoppable. However, a recent article in ComputerWorld, amongst others, have highlighted problems with the global economy. In this case, flooding in Thailand has impacted the availability of hard drivesdriving up the price that everyone pays. If manufacturing were decentralized, flooding in a single country wouldn’t have much of an effect. In short, the emphasis on cost of individual products instead of emphasizing the reliability of multiple sources of hard drives at an increased cost has proven a shortsighted strategy that inevitably hurt the world supply.

Some countries are using the global economy as a source of blackmail. According to the New York Times, China has consolidated its grip on rare earth metals used for everything from compact fluorescent lights to displays used in smartphones. The blackmail started after a disagreement with Japan. As a consequence, the price of any item that requires rare earths has gone up and will continue to increase. It’s another instance where price advantages offered by a global economy have come back to haunt us. In fact, this problem is so significant that the United States government is doing everything it can to create alternative sources, no matter the cost. Unfortunately, it will require nearly 15 years to fully develop those alternatives.

These two stories, and many more, only hint at the potential problems of a global economy. The problems are actually far more severe than you might initially think. When someone ships a hard drive all the way from Thailand to your home, the carbon footprint of that drive is quite large. It takes a lot of gas to move that hard drive. What the global economy does is it trades fossil fuel for price. The cost of the oil, plus the cost of the object (whatever it might be), is less than the cost of producing the object locally. The short term monetary gain takes priority over the cost to the environment and its eventual cleanup. In the long term, that hard drive will cost everyone a great deal more than if it had been purchased locally.

This blog has contained more than a few self-sufficiency posts (60 as of this post). You’ve seen discussions of how to grow your own food and reasonably recycle products instead of dumping them in a landfill. I even told you how to obtain CFLs for free (see CFLs for Free). All of these posts are practicalI’ve worked hard to write posts that demonstrate techniques that improve the condition of your wallet, decrease your health problems, and still help everyone around you by producing a greener environment. Even with these measures, I’m well aware that my carbon footprint is huge because a global economy forces me to buy articles from overseas. These items aren’t available locally and I can’t make them myself.

In the long run, it’s unlikely that we’ll be able to sustain a global economy unless the equation changes dramatically. Fossil fuels aren’t unlimitedwe’ll eventually run out, so from a practical perspective, transportation of items from overseas must change or we won’t be able to transport them. However, long before that happens, the damage to our environment will take a dramatic toll on everyone. The question is why anyone would wait around to see it all happen? Is the world determined to wait until everyone is so sick and so without resources that we have no choice but to toe the line? Does no one think about the effect they’re having until it’s too late?

I ask these questions because the global economy is simply a bad idea. Producing goods locally is far more efficient, even when the initial price for the good is higher. Eating and using what you can produce locally is far better for everyone. You do have a choice. Even with the global economy in full swing, you can buy local goodsin fact, insist on them. Tell local stores that you’re willing to pay more for local goods that are good for the environment. Your money matters. When stores find that they can’t sell those overseas items at any price, they’ll buy locally. “Give the customer what they want” is a cliche, but it’s also a fact. Vote with your cash to bring down a global economy that is ill conceived and killing us all. Let me know your thoughts about the global economy at [email protected].

 

Windows 7 and the PowerCfg Utility

On page 327 of Administering Windows Server 2008 Server Core, you find the PowerCfg utility and may not even find it all that interesting. Yes, this utility makes it possible to configure the power settings for a system from a remote location. An administrator can use it to ensure that everyone has a power saving setup by adding the command to the user’s login script. However, as utilities go, it isn’t all that interesting. For that reason, the command doesn’t even appear in Windows Command-Line Administration Instant Reference. A number of beta readers said they didn’t even use it.

Microsoft is showing an increasing interest in power management with each version of Windows. In fact, from what I’ve been reading about Windows 8, power management is going to take a relatively large leap forward (read about the changes in, “Building a power-smart general-purpose Windows“). With this in mind, the Windows 7 version of the PowerCfg utility has added four new command line switches:

 

  • /Requests: Enumerates the application and driver power requests. Applications and drivers make power requests to ensure that resources are available when needed. However, sometimes these requests can also become a problem when they’re abused. Power requests can also prevent the computer from automatically turning the display off or going into hibernate mode, which wastes power.
  • /RequestOverride: Forces the system to disregard an application or driver power request. The positive aspect of this command line switch is that you can enforce a power management strategy when you have applications and drivers that abuse power requests. However, by denying applications and drivers access to resources, you could also cause system instability or data loss when the application or driver crashes.
  • /Energy: Performs an energy survey of the system. This is probably the most important addition that Microsoft has made. Using this particular feature, you can detect system elements that are consuming a lot of power and reduce its energy footprint. Generally, you use this feature with just the system running to determine what the system uses. However, you can also use it with single applications open to detect the energy cost of using that application, which I think is actually the more revealing way to use this command line switch. Most people don’t associate an energy cost with using an application. This feature makes the energy cost significantly more apparent. Yes, every application you use has a cost, so keeping needless applications open is costing you money.
  • /WakeTimers: Displays a list of timers that are set to wake the system from sleep or hibernate states. Waking a system too often also costs you money. For example, it costs more to perform individual maintenance tasks at separate times than to perform them during a single time. An organization could use this command line switch to ensure that every system wakes at the same time, performs required maintenance, and then goes back into either the sleep or hibernate states.


As mentioned in the list, I consider the /Energy command line switch the most important PowerCfg addition to date. If you’re interested in self-sufficiency, as I am, then you begin to count even the pennies of energy usage. For example, in my CFLs for Free I discuss how I bought just one CFL and turned it into a complete setup for my entire home. This particular feature has allowed me to perform an energy survey of the applications I use. I found out, for example, that streaming audio using Firefox does indeed cost less than using a separate device for the purpose (such as a radio) and also delivers clearer audio. However, streaming impacts system performance and tacks a network bandwidth penalty onto other applications that rely on Internet connectivity, so there are times where using the separate device is actually better.

Let’s look at the /Energy command line switch in a little more detail. The easiest way to use this command is to open an Administrator command prompt, change directories to a directory you can write in (I’m using C:\Temp), and then type PowerCfg /Energy and press Enter. I purposely ran the command with a number of applications running and some misconfiguration in place to generate some errors, warnings, and informational messages as shown here.

PowerCfg01

The report required a little over a minute to generate. You can see the results in the Energy-Report.HTML file. Here are the results I generated from this run.

PowerCfg02

The PowerCfg utility makes it possible to diagnose energy problems with a system and significantly reduce the cost of running it. The language of the report does require a little interpretation at times, but normally the language is plain enough for an administrator to figure out with little effort. By correcting every error and 12 out of the 13 warnings, I was able to reduce the power requirements of this system by about 15 percent (as measured by a watt meter). So, how does that equate in dollars? You use the equation: Cost = ((Watts / 1000) * Hours Used) * kWh rate, where kWh is the kilowatt hour rate provided by your power company on your electrical bill. This system was averaging a little over 520 watts before tuning it. For the sake of argument, let’s say you’re using it 60 hours per week and the electrical rate is $0.12. The weekly cost of running this system is:

 


((520 / 1000) * 60) * 0.12 or $3.74

After tuning this one system the power usage was only 442 watts on average. That means the weekly cost went down to:

 


((442 / 1000) * 60) * 0.12 or $3.18

a savings of $0.56 for this one system each week or a total of $29.12 for the year.  I have three systems that I tuned this way, so I’m hoping for a $87.36 savings from performing this tuning. Each system required about 30 minutes to tune, so I’ve made $58.24/hour from this activity. If you’ve read other posts, I do like to put a dollar figure on my time—you should too. Not many people can afford to throw away money like this and the PowerCfg utility, along with a watt meter, can help you better understand how your system uses (and abuses) power.

There are two additional command line switches you should know about when using the /Energy command line switch. The /Duration:Time command line switch changes the duration from 60 seconds to some other value. For example, if you want to change the duration to 120 minutes, you’d type /Duration:120. Longer testing times are often required when you’re trying to determine how an application is using energy. Take my advice and don’t set the duration lower than the default 60 secondsyou’ll be disappointed with the results.

The /XML command line switch outputs the data in XML format so that you can incorporate the information into a database. If you have a large setup, the XML format is absolutely essential. No one has time to look at individual HTML pages. Using XML output and a centralized database also makes it possible for you to look for organization-wide trends, which could produce even bigger savings.

The /Energy command line switch can also be used with the /Trace command line switch to trace energy usage without performing any analysis. This output isn’t as helpful or as accessible as using the /Energy command line switch alone. The output is an Event Trace Log (.ETL) file. To view this file, open the Event Viewer console found in the Administrative Tools folder of the Control Panel. Right click the Event Viewer folder and choose Open Saved Log from the context menu. You’ll see a dialog box asking whether you want to convert the .ETL file into the new format used by Windows 7. Click Yes. You’ll see a list of energy events like the ones shown here.

PowerCfg03

By carefully reviewing the events, you can discern energy usage patterns, filter data about specific events, and perform other analysis. However, this raw data is a little hard to use and the administrator would be better off generating the report, unless your organization has an application designed to analyze the raw data in some way.

So, how do you save energy in your organization? Do you rely on specialized tools such as a watt meter and PowerCfg? If not, how do you tune your equipment to deliver optimum service and minimum cost? Let me know at [email protected]

 

Is the Technical Book Dead?

Some time ago I wrote a post asking the question of whether paper books would go the way of the dinosaur (see Paper or e-Book? for details). I recently came across another question, one of whether books will exist at all in the future (at least, technical books). It seems that at least some people now think that online articles (referenced through Google and other search engines) will answer all of their questions and that books are passe. We’ve heard the same death knell sounded before and this one is just as false as those that came before.

There was a time when people said that radio was dead because of television. Fortunately for everyone, the doomsayers were wrong. Radio is still with us—albeit in a different form from those days gone by. In fact, when something proves useful enough, it remains viable and in use despite the appearance of newer technologies. Because of the comments I received from the Paper or eBook? post, I strongly believe that for this reason alone, books will remain one method of choice for obtaining technical information.

Online media does have many good attributes. I have no doubt that it provides a useful and welcome adjunct to books. I use online media myself for some of my research and for general information. From my perspective, online media has the following advantages over books:

 

  • Timely: There isn’t any way a book will ever beat online media to market. Books can’t even beat magazines to market.
  • Succinct: One misconception about online media is that there is no word limit. However, I haven’t ever seen a truly viable book-length online resource. Online resources are broken into small pieces that someone can digest in just a few minutes.
  • Updateable: Both magazines and books have strict limits on updates. If the author makes a mistake, the publisher must provide a separate errata that the reader may not ever find.
  • Inexpensive: There are paid online resources, but they’re in the minority. Most online resources, including this blog, are free. Some online resources do rely on subscriptions and a few are purchased as individual content items (much like a book), but I doubt that paid online media will ever take off as a major industry because it suffers from a severe problempeople tend to post the purchased online media on other sites so that others can download it free (often without any knowledge that the content is pirated).
  • Searchable: Online media has all other forms of communication beat when it comes to searches. You can find what you need quickly, provided that the search engine isn’t overwhelmed with junk listings.


There are probably other reasons for using online media, but these reasons best serve the technical reader. It would seem that these reasons alone would compel a potential reader to use online sources. However, books continue to offer value in other ways. Readers will continue to flock to books (either in paper or e-Book form) for these reasons:

 

  • Accurate: Because books are somewhat permanent, the vast majority are edited by someone other than the author. In fact, most books have several editorseach with a different specialized skill set. Multiple sets of eyes tend to reduce the probability of errors; although, some errors are bound to creep into any form of writing (see my Errors in Writing post for details).
  • Fewer Fads: Books tend to focus on technology that has proven its worth, rather than following every fad on the market. Business runs on proven technology. Someone who is looking for time-tested technology will look in a book, not at an online resource.
  • Author Availability: Having worked through the vagaries of community support myself, I know that it sometimes works, but often doesn’t. A good book author will provide a certain level of support and will answer reasonable questions about book content. You simply don’t get this sort of support using online media.
  • Cohesive: A book offers something that online media can’t in the form of a cohesive work. Whatever the topic is, a book will offer a progression of some type and lets you see a technology from a long view, rather than as snippets.
  • Less Junk: Online media can be clogged with all sorts of junkmaterial that has nothing to do with the topic at hand or that you simply don’t require. Books are more focused, stick to the subject, and are easier to visually filter. As a consequence, you can spend a lot less time getting what you need from a book.


There are some personal issues I have with online media. Many of the books and paper magazines I read are professionally written by authors with the experience to write well. Yes, some online media is also professionally written, but you’re just as likely to run into information written by an unknown entity. Because of the anonymity of the Internet, I find myself checking and rechecking information I obtain from it. Normally, I require at least three different sources, written by different authors, to confirm a fact from the Internet. I’m more likely to accept material from the books of authors that I know well simply because I have read the works of these authors for years and I’ve built up trust in what they have to say. Yes, it’s true that you should verify anything you read, but I find the Internet resources I read are far less reliable.

Much of the confusion about online media has nothing to do with the material itself, but with the authors. When you work mainly with books you hear the voices of a few well-known authors who have helped you over rough spots for many years. The Internet provides a cacophony of many voices that I don’t know. I don’t know how to read between the lines with these authors or understand when I need to consider the author’s personal biases. Again, this is a personal issue, rather than something you’ll need to consider, but if you’re like me, you do need to think about it at least.

I also find that the purpose of online media and books differ. Online media focuses on informing someone of a fact. When you read an online source, it’s to find a bit of information you need now in the fastest manner possible. On the other hand, books tend to focus on teaching. A book presents a topic in a way that helps the reader learn about the technology so that there is a better chance the reader will be able to answer questions about the technology later. This difference in focus is the reason I feel both technologies will remain useful.

As with the radio versus television discussion, I don’t think either online media or books are going to go away. They each have something valuable to offerthey both have their place in your technology toolbox. The ability to choose the right tool, at the right time, has always been the mark of a professional. If you rely exclusively on online media to obtain your technological information, you’re at a distinct disadvantage when compared to the person who uses both online media and books. How do you get your information? Let me know at [email protected].

 

Passing By Value Versus By Reference

A number of readers have written me about the examples that use pointers in the book. One of the most common questions comes from the example on page 149 of C++ All-In-One Desk Reference For Dummies. In this example, the application contains a function that accepts an argument by reference. The use of a reference seems to have many people confused and this post will hopefully clear the issue up.

The first thing you need to understand is that there isn’t any magic going on here. The process for working with functions remains constant in C++. When you call any function with an argument, the application creates memory to hold the argument. The memory is local to that function. When the function ends, the memory is released. What the memory holds, now that changes.

Think of the memory as a box. This box has an address that points to it. When you work with a pointer, you’re working with the address. On the other hand, when you work with the value, you’re working with the content pointed to by the pointer, or the contents of the box. Whether the box the function receives contains a pointer or the value depends on how you write the function and what you pass to it from the caller.

Now, let’s look at an example so that you can better understand what’s going on.  This example will do the same thing to the number each time, but using different techniques: by value, using a pointer, and by reference.

#include <iostream>
 
using namespace std;
 
void MessMeUpA(int myparam)
{
    myparam = myparam * 2 + 10;
}
 
void MessMeUpB(int* myparam)
{
    // Obtain the current value.
    int currentValue = *myparam;
 
    // Perform the required math.
    currentValue = currentValue * 2 + 10;
 
    // Save the result.
    *myparam = currentValue;
}
 
void MessMeUpC(int &myparam)
{
    myparam = myparam * 2 + 10;
}
 
int main()
{
    // Call by value.
    int mynumber = 30;
    MessMeUpA(mynumber);
    cout << "By Value: " << mynumber << endl;
 
    // Call using a pointer.
    mynumber = 30;
    MessMeUpB(&mynumber);
    cout << "By Pointer: " << mynumber << endl;
 
    // Call using a reference.
    mynumber = 30;
    MessMeUpC(mynumber);
    cout << "By Reference: " << mynumber << endl;
 
    return 0;
}

You may notice that part of this example comes directly from page 149. If you run this example, you’ll see this output:

PassingData01

When you pass the data by value, you’re passing the information, not a pointer to the information. As a result, MessMeUpA() receives a value of 30. It doesn’t receive a pointer to the initial variable, nor does it obtain a reference to the initial variable. As a result, when the application performs the calculation, the result is thrown away.

When the application calls MessMeUpB(), it provides a pointer to the variable. However, the pointer isn’t a value. As a result, you move the value pointed to by the pointer into a local variable, perform the required math, and then move the value back into the original pointer. As a consequence, the original value is altered to 70.

Finally, when the application calls MessMeUpC(), the function obtains a reference to the original memory location. When the function performs the math, it’s actually using the original value as pointed to by the reference, which means that this is a kind of pointer, just not passed from the caller. The changes made in MessMeUpC() are reflected in the original value because you’re using a pointer to that value and not a copy of the value in local memory.

I highly recommend that anyone trying to understand how code works use the debugger to trace through that code. It’s instructive to look at each of the functions to see how they look. Place a breakpoint in each of the functions and then start the debugger. Open the Watches window, if necessary, by choosing Debug | Debugging Windows | Watches. Here is the view of the Watches window when calling MessMeUpA().

PassingData02

What you see here is a function argument—an integer that contains the value of 30. Now, let’s look at MessMeUpB().

PassingData03

In this case, you see a local variable, currentValue, that contains the updated value and a pointer to the variable used by the caller in myparam. The pointer gives you access to the value held by the caller and allows you to change it. Finally, let’s look at MessMeUpC().

PassingData04

Look at the function argument, myparam. The debugger is giving you a valuable insight here. See the address provided with the variable? Match that address to the pointer provided to MessMeUpB() and you’ll see that they’re the same. The reference is simply another sort of pointer, but one that gives you direct access to the memory without having to go through the extra steps required by pointers. The debugger even shows you that the current value of that memory is 30 (the math hasn’t been performed as of yet).

A function argument is simply a box that holds either a value or a pointer. Whether that pointer is an actual pointer or a reference depends on how you write you code. That’s the point of the example. Pointers don’t have to be mysterious or hardthey’re simply an address for an area of memory (a box if you will) that holds a specific value. Please let me know if you have any questions about this issue at [email protected].

 

Profession Versus Job

I often find inspiration for posts in places that you wouldn’t think to look. Today’s post comes courtesy of Bill Bridges from his Green Market Press blog. The post in question is the Taipei Journal entry for today—there are many of these journal entries, all entertaining and educational about the human condition. Bill is a professional journalist and a good friend who has often inspired me to excel with his seemingly simple posts. The reason that today’s post struck a chord with me is that it answers part of the question of how to become a programmer. My initial post discussed the mechanics, the precursors that someone might pursue to become a programmer, but that post didn’t answer the question of how to make programming a profession.

Today’s journal entry answers the question of profession versus job rather succinctly. Susan writes an article that constantly mentions “the French system of government” without ever explaining what the term means. Bill asks her about it and her response is, “I did sort of wonder about that.” Susan has a job, Bill has a profession. Education, no matter how complete, is only a precursor to a profession. In order to turn a job into a profession, one must also become involved, learn to think for oneself, and have a desire to excel. An aspiring programmer must have integrity as well and be willing to devote long hours toward the goal of delivering the best possible code. Mind you, the code a particular individual delivers is unlikely to be perfect and it’s always possibly that someone else will write better codeI’m talking here about excellence within the individual’s ability to deliver it.

Anyone can perform a job. Only a few people have a profession. However, I’m not talking about a particular sort of profession. When Rebecca and I lived in San Diego, we’d go to a particular restaurant (the name escapes me at the moment, but the restaurant is no longer there anyway). There was a man named Kevin there who waited tablesit was his profession. You could see it in the way he performed the tasks of his tradewith enthusiasm, vigor, and more than a little subtle humor. You felt honored to be served by him and the lines were often long with people who specifically asked for him. Application development is a trade that requires no small amount of education, but I’ve seen more than a few people obtain the required skills by simply reading a book. The difference between a job and a profession remains the samethe professional takes responsibility for successful completion of the task and delights in seeing the task well-done.

While my previous post described a job, this one describes a profession. Many people have questioned why America has been losing it’s place in many different technology areas. First of all, I submit that statistics lie and often tell the story that they’re designed to tell. Don’t believe the lies that you readthink for yourself. Americans still have what it takes to create some of the most amazing technologies ever and I’ve discussed more than a few of these technologies in previous posts. If America has truly lost its edge, then where do these technologies come from? Second, far too many Americans are focused on getting a job, rather than a profession. When you view America of the past, you discover that we have had an array of professionals that delivered new technology is all sorts of waysmany never thought about before.

The bottom line is that you need to consider what sort of programmer you’re going to be as part of your journey. Education isn’t enough. If you really want to become a good programmer, then you must be willing to do what it takes to become a professional. As a professional, you’ll have a higher quality of life, discover the benefits of job satisfaction, and contribute to society in ways that you can scarcely imagine. So what do you havea job or a profession? Let me know your thoughts at [email protected].

 

More on CFL Usage

Readers came back with a few questions about CFLs after reading my CFLs for Free post. The one thing I want to get across clearly is that the article is emphasizing that you can buy new CFLs using the savings from previous purchases. You need to make the investment in the first CFL to get started and then use the savings from that investment to buy future CFLs. No one is going to mysteriously pay you to buy CFLs, but if you buy smart, you can indeed get future CFLs for free after making the initial purchase. Eventually, you’ll pay off the initial purchase using the savings as well.


A number of people asked about the startup surge (also known as inrush current). The startup surge is something that occurs when you first apply power to the light. This surge is extra electricity that’s required to get the bulb started. The amount of power the bulb requires decreases as it gets to operating temperature, which isn’t very long in most cases. Of course, some people are worried about this electricity surge as some people often think they are experiencing a power surge. Luckily, these two things are quite different. If a homeowner did experience a power surge, it would be worth them contacting a company like Safe and Sound Electric to install some surge protection to prevent this happening again. However, this bulb requires that extra surge, so don’t be concerned if you notice a quick surge. I’ve read a number of conflicting opinions about the startup surge of CFLs. My take on everything I’ve read is that the startup surge will vary by bulb vendor and type of light. A tube light has a smaller startup surge for a significantly smaller time than the twisted bulbs. Vendors who meet Energy Star requirements tend to produce bulbs that have a smaller startup surge than the less expensive bulbs.

A few readers also asked about long term efficiency of CFLs. From personal experience Rebecca and I have found that CFLs do provide an efficiency advantage if you use them for one long interval, rather than several short intervals. In other words, if you burn the light for four hours solid instead of two, two hour intervals, you’ll gain an efficiency advantage. In addition, turning the light on and off reduces its life expectancy.

Efficient energy use is why Rebecca and I tune our work schedule to follow the sun. We get up at 5:30 am (sometimes a bit earlier) during the summer months to make maximum use of the daylight hours, but we get up at 7:00 am during the winter months to ensure we won’t have to turn the lights on in the morning. The actual difference between summer and winter work times is 2½ hours due to the effect of daylight saving time. We do work later into the evening during the winter months to make up for the later start time, so everything evens out. Using this approach has had both health and monetary benefits, but we also understand that it’s not a solution that most people can use.

There are a lot of myths, misconceptions, and outright controversies about CFLs online. In addition, I’m finding that people have individual experiences based on how they use lighting in their home. However, after researching this topic intensively, I’m finding that the following tips about CFLs seem to be true for just about everyone:

  • Buying CFLs with the Energy Star label tends to pay dividends in reduced operating costs and longer life, but you must weigh these benefits against the increased initial cost. In general, buying Energy Star products save you money.
  • If you must use a CFL in a socket controlled by a dimmer, buy a CFL designed for that purpose. Using a standard CFL in a dimmer-controlled socket greatly reduces bulb life and could damage the dimmer.
  • CFLs require more air to work properly. They’re more heat sensitive, so putting one in a can or recessed fixture will result in a reduced life expectancy. The exception is that there are CFLs specially designed to work in recessed fixtures, but you’ll also pay a premium price for them.
  • CFLs also don’t like
    damp or wet conditions. If you need to use a CFL in a damp or wet
    condition, make sure you get one rated for that purpose.

  • Standard CFLs don’t work well in fixtures that vibrate, such as the lighting kits for fans. If you want to use a CFL with a fan or other fixture that will vibrate, you need to get a CFL designed for the purpose. (I finally gave up using a CFL in my garage door opener light socket because even the CFLs designed for use in vibration don’t last long in that particular application.)
  • Excessive on and off cycles in a given day will most definitely reduce the life expectancy of your CFL. I researched this one a lot and didn’t get a definitive answer for you. The most common guidelines say that you should strive to keep on/off cycles below 20 for any given CFL during one day. It’s commonly said that CFLs have a life expectancy of 7,000 on/off cycles if you observe the 20 on/off cycle per day limit. The source of problems in this case is the electronic ballast that CFLs use, which aren’t designed for heavy on/off cycles.
  • Faulty wiring affects CFLs considerably more than incandescent bulbs. If your wiring is such that it causes flickers or flashing with an incandescent bulb, it might be a cause for concern and you should probably look to get more info from an emergency electrician. Your CFL also won’t last very long in this instance. Even if you can’t see the flickering, small dips in power can cause early CFL failure. If you find that your bulbs aren’t lasting very long, have the power checked and bring in an electrical repair company similar to https://electricalsynergies.com/ to fix it. Faulty wiring also affects the cost savings from a CFL in a big way because the bulb never quite gets to its operating range.
  • Line noise will also affect CFLs. For example, if you have a heavy duty motor (such as a refrigerator) on the same line as a CFL, the drop in line current when the motor starts can affect the life expectancy of the CFL. Line noise will also affect the cost savings you see from a CFL because the bulb isn’t operating properly.

Some readers have pointed out that CFLs are overrated. I’m not quite sure how to respond to this question other than to say that there isn’t any free lunch. Just about every solution we now have for fixing the planet’s carbon problem is flawed. Even if we were to all go back to burning candles, there would be problems. However, I did spend some time online looking for something a bit less hysterical and a little more scientific than something that says CFLs and other modern technologies are bad. You should embrace CFLs and other good for the planet technologies with open eyes. The best post I found on these issues is one entitled, “Directory:Compact Fluorescent Lighting (CFL) Downsides.” If someone else has a non-hysterical source of additional information, I’d be happy to address it in another post.

I’d welcome verifiable tips from other people. I verified each of these tips against three sources (including government sites when available). That doesn’t mean that every tip will work for you personally, but most people find that these tips work for them. Let me know about any additional thoughts you have about CFLs at [email protected]

Security Implications of the AT Command

I read the security post provided by Roger Grimes with interest this morning because I’ve always felt that the Task Scheduler is just another entry point for viruses and the like on any system. As he mentions, it’s an avenue that many administrators fail to check because they don’t really think about it. As Roger points out, there are three ways to add new entries, but this post focuses on the oldest of the three, the AT command.

Before you can interact with the Task Scheduler, you must have its service started. This is a given on Vista and Windows 7, where Windows relies heavily on the Task Scheduler. However, you’ll want to read my Interacting with the Task Scheduler Service for details about this service. It’s important to have the service setup correctly in order to work with it error free.

The AT command is the oldest way of working with the Task Scheduler. At one time you could access it from the command prompt even if you weren’t an administrator. This meant that any virus or other piece of nasty software could cause woe without notice on your part. However, if you try to use the AT command at a normal command prompt in Windows 7, you’ll receive an Access Denied error message, which is at least a start in the right direction.

To use the AT command to create a new entry, you must provide a time and command as a minimum. For example, if you type AT 15:00 “Dir C:\” and press Enter, you’ll create a new task that starts at 3:00 pm on the current day. You’ll receive a numeric identifier for the task. The entry also shows up in the Task Scheduler console (found in the Administrative Tools folder of the Control Panel) as At plus the identifier, such as At1 as shown here.

TaskSchedulerEntries01

If you want to list the jobs created by the AT command, you type AT and press Enter. The AT command only lists those jobs that it creates—you won’t see any jobs created using other Task Scheduler techniques.

Likewise, to delete jobs using the AT command, you provide the identifier you received when you created the job along with the /Delete command line switch. For example, if the identifier for the task you created earlier in this post is 1, then you’d type AT 1 /Delete and press Enter. In this case, the AT command doesn’t provide any output. In order to verify that the job is actually gone, you must type AT and press Enter. Here’s what the command output from this session looks like.

TaskSchedulerEntries02

The true power of AT lies in remote access. For example, if you have an Administrator command line open, have a server named WinServer on your network, and possess administrator privileges on that server, you can type AT \\WinServer 15:00 “Dir C:\” and press Enter to create a command that starts at 3:00 p.m. (local time) on WinServer. It’s important to realize that the command will execute when it’s 3:00 p.m. on the server, not 3:00 p.m. on your system. You can likewise list and delete remote entries using the same commands you’d use for local entries. Again, the Task Scheduler console will display these entries, but only on the host machine (so you’d need to access that system remotely to see it from your local computer).

Windows 7 does make it harder to use the AT command, but not impossible. If an outsider should gain access to an account with administrator privileges, it wouldn’t take long for a virus to add all sorts of nasty commands to every machine on the network. As Roger comments in his post, administrators need to exercise vigilance in order to catch potential security issues such as this one. Let me know if you have any questions at [email protected].