An Interesting Breakfast Toast

We’re always trying to find new ways to have flavorful meals that are also healthy. To make this happen, we use a wide range of herbs, oils, and other flavor enhancers, plus interesting combinations of food items. One of our goals is to reduce both added salt and sugar intake to nearly nothing (in fact, nothing would be best). Most people get more than enough salt and sugar to meet their dietary requirements directly with their food—no additional salt or sugar is required.

I’ve been experimenting with a recipe for a French toast-like breakfast that actually tastes better than the standard product, but contains significantly less sugar and salt. After playing with this recipe for a while, I think I’ve come up with a solution that works. Just in case you’d like to try it yourself, here’s the recipe:


Orange Spice Breakfast Toast

 

¼ tsp Cloves
1 tsp Cinnamon
½ tsp Orange Extract
3 Eggs
2 tbs Sugar or Splenda
¾ cup Milk
  Spray Shortening or Canola Oil

Put eggs and sugar/Splenda in bowl and whisk until frothy. Add milk slowly using whisk. Add spices and orange extract. Pour about ½ cup of mixture onto a plate (or whatever will fit comfortably). Dip bread into mixture and ensure both sides are thoroughly soaked. Spray frying pan with shortening or add canola oil and heat until a drop of water bounces on surface. Place soaked bread into pan and fry until brown on both sides. Most frying pans will actually accommodate two pieces of bread at once.

We used a tiny bit of margarine and just a sprinkle of powdered sugar (less than ¼ tsp) to dress up the toast when finished. Recipe serves 4 people with some leftover or 5 people if you want to be a tad stingy.

The toast ends up tasting quite nice, but without the sugar that comes with standard French toast. A cup of syrup normally costs you 67g of sugar and 257g of salt (and most people use more than a cup). Using this recipe, with real sugar instead of Splenda, will cost you only 6g of sugar and no additional salt (the bread you use still contains salt, but the salt is there in both recipes). Interestingly enough, both cloves and cinnamon have nutritional benefits; although the amount of nutrition you get with this recipe is somewhat limited.

I’m still playing with this recipe a bit. How much spice do you like with your toast? Is the amount of orange extract enough to produce a pleasing, but not overwhelming taste? Let me know your thoughts on alternative breakfast offerings at John@JohnMuellerBooks.com.

Using the Trigonometric Functions in VBA

It’s gratifying to know that people are still buying and using VBA for Dummies to perform useful work. I still get a fair number of reader queries about the book and I’ve tried to provide updates to keep the book useful as part of my blog. So, I was appalled recently to find that there is an error in one of the examples. The error appears in both the 4th edition of the book (on page 83) and in the 5th edition book (on page 99). It affects the use of trigonometric functions to perform various kinds of calculations involving angles.

Most of us are used to thinking about angles in degrees. However, most mathematicians use radians, not degrees, when working with angular measurements. The main reason for using radians is that degrees measure direction, rather than the angular part of a circle (there is actually some discussion about this whole issue and it’s off topic, so I’ll leave any thoughts on the matter to you). If you’re really interested in the detailed math, check out the articles Why Use Radians instead of Degrees? and Radians and Degrees. The bottom line is that Microsoft uses radians, not degrees, when providing trigonometric functions to make them mathematically correct, but completely confusing to the rest of us.

The example uses a measurement of 45 degrees as input to the trigonometric functions: Atn(), Sin(), Cos(), and Tan(). However, to make the input work correctly with the functions, you must first convert the degrees to radians. The corrected example looks like this:

Public Sub ScientificCalcs()
    ' Define an input value
    Dim MyInt As Integer
    MyInt = 45
     
    ' Convert input to radians.
    Dim Converted As Double
    Converted = WorksheetFunction.Radians(MyInt)
     
    ' Create an output string.
    Dim Output As String
     
    ' Display the trigonometric values for a 45 degree
    ' angle.
    MsgBox "The original angle is: " + CStr(MyInt) + _
           vbCrLf + "The value in radians is: " + CStr(Converted) + _
           vbCrLf + "Arctangent is: " + CStr(Atn(Converted)) + _
           vbCrLf + "Cosine is: " + CStr(Cos(Converted)) + _
           vbCrLf + "Sine is: " + CStr(Sin(Converted)) + _
           vbCrLf + "Tangent is: " + CStr(Tan(Converted)), _
           vbOKOnly, _
           "Trigonometric Values"
            
    ' Change the sign of the number using Sgn and Int.
    ' Add the value to Output each time.
    Output = "The sign of 0 is: " + CStr(Sgn(0))
    MyInt = -45
    Output = Output + vbCrLf + _
             "The sign of " + CStr(MyInt) + " is: " + _
             CStr(Sgn(MyInt))
    MyInt = Abs(MyInt)
    Output = Output + vbCrLf + _
             "The sign of " + CStr(MyInt) + " is: " + _
             CStr(Sgn(MyInt))
    MsgBox Output, vbOKOnly, "Using Sgn and Abs"
End Sub

Actually, the updated example also demonstrates the use of the WorksheetFunction object, which is something that isn’t covered well in the book now. Notice how the code converts the number of degrees into radians using the WorksheetFunction.Radians() function. The WorksheetFunction object provides access to a host of useful functions and you really need to check it out if you work with Excel on a regular basis. The new version of this example outputs the correct values for sine, cosine, tangent, and arctangent as shown here.

ScientificExample

Please let me know if you have any questions about this updated example. Let me know about any other concerns you have about this book at John@JohnMuellerBooks.com.

 

Using the Set Command to Your Advantage

Last week I created a post about the Windows path. A number of people wrote me about that post with questions. Yes, you can use the technique for setting the Path environment variable to set any other environment variable. The Windows Environment Variables dialog box works for any environment variable—including those used by language environments such as Java, JavaScript, and Python. Windows doesn’t actually care what sort of environment variable you create using the method that I discuss in that post. The environment variable will appear in every new command prompt window you create for either a single user or all users of a particular system, depending on how you create the environment variable.

A few of you took me to task for not mentioning the Set command. This particular command appears in both Administering Windows Server 2008 Server Core and Windows Command-Line Administration Instant Reference. It’s a useful command because you can temporarily configure a command prompt session to support a new set of settings. When the session is ended, the settings are gone. Only those settings you create as part of Environment Variables window have any permanence. There are other tricks you can use, but using Set for temporary environment variables and the Environment Variables window for permanent environment variables are the two most common approaches.

In order to see the current environment variables you simply type Set and press Enter at the command line. If you add a space and one or more letters, you see just the matching environment variables. For example, type Set U and press Enter to see all of the environment variables that begin with the letter U.

To set an environment variable, you add the name of the variable, an equals sign (=), and the variable value. For example, to set the value of MyVariable to Hello, you type Set MyVariable=Hello and press Enter. To verify that MyVariable does indeed equal Hello, you type Set MyVariable and press Enter. The command prompt will display the value of MyVariable. When you’re done using MyVariable, you can type Set MyVariable= and press Enter. Notice the addition of the equals sign. If you ask for the value of MyVariable again, the command prompt will tell you it doesn’t exist.

Newer versions of the command prompt provide some additional functionality. For example, you might set MyVariable within a batch file and not know what value it should contain when you create the batch file. In this case, you can prompt the user to provide a value using the /P command line switch. For example, if you type Set /P MyVariable=Type a value for my variable: and press Enter, you’ll see a prompt to enter the variable value.

It’s also possible to perform math with Set using the /A command line switch. There is a whole list of standard math notations you can use. Type Set /? and press Enter to see them all. If you write application code at all, you’ll recognize the standard symbols. For example, if you want to increment the value of a variable each time something happens, you can use the += operator. Type Set /A MyVariable+=1 and press Enter to see how this works. The first time you make the call, MyVariable will equal 1. However, on each succeeding call, the value will increment by 1 (for values of 2, 3, and so on).

Environment variables support expansion and you can see this work using the Echo command. For example, if you type Echo %MyVariable%, you see the value of MyVariable.

However, you might not want the entire value of MyVariable. Newer versions of the command prompt support substrings. The variable name is followed by a :~, the beginning position, a comma, and the ending position. For example, if you place Hello World in MyVariable, and then type Echo %MyVariable:~0,5% and press Enter, you see Hello as the output, not Hello World. Adding a negative sign causes the expansion to occur from the end of the string. For example, if you type Echo %MyVariable:~-5% and press Enter, you see World as the output.

The Set command is a valuable addition to both the administrator’s and programmer’s toolkit because it lets you set environment variables temporarily. The Set command figures prominently in batch file processing and also provides configuration options for specific needs. Let me know about your environment variable questions as they pertain to my books at John@JohnMuellerBooks.com.

 

Taking Inventory of the Larder

There is fresh fallen snow outside my window as I write this and more on the way. In fact, it doesn’t look like gardening season out there at all. It’s a bit past the middle of winter, but spring is a long way off. However, this is the time of the year that Rebecca and I start thinking about the garden—mainly because our mailbox is bristling with seed catalogs. Of course, the seed catalogs end up in the house and we now have stacks of them in the living room, dining room, family room, bathroom, and even in our bedroom. We could possibly start our own catalog company by simply redistributing all the catalogs that are coming from various seed companies in the mail.

Inside each catalog we see beautiful presentations of various vegetables and fruits. Given the time of year and the fact that our root cellar is becoming a bit empty, the idea of having fresh vegetables is quite appealing. Yes, canned and frozen foods will keep us quite happy and well fed, but there is nothing like picking that first asparagus spear (the first vegetable of the season) and preparing it for dinner. So, gazing fondly at the vegetables in the catalogs becomes the stuff of dreams for the upcoming season.

However, before we can order anything, we need to know what the larder lacks. This means doing an inventory. Doing an inventory is no small undertaking. If we simply needed to create a list of items to grow, the inventory would be simple enough, but that’s not the end (nor even the beginning) of the task.

As part of the inventory, we take down every jar, examine it for potential problems (such as a broken seal or rust on the lid that will eventually result in a broken seal). After that, we wash and dry the jar (remarking it if necessary). The jars are then repacked to ensure that the oldest stock is in the front. What all this work accomplishes is to ensure that what is on the shelf is actually edible and usable. The shelves can become disorganized during the winter months, so it’s essential to reorganize them so that any count we perform is accurate.

During the process of working with the jars, we’ll begin to notice that some items are lacking. For example, this year we noted that there aren’t any beets left—not even the pickled variety (a favorite of mine). The pickled okra is also gone. However, we have a surprisingly strong supply of corn in various sized jars (for specific needs), so we probably won’t grow corn this year. I also found several jars of a wonderful blueberry compote Rebecca made for me. I had thought them gone when they were simply hiding behind some dill pickles.

A well-stocked larder is a wonderful thing. You can go to bed at night knowing that you won’t go hungry—something far too many people in the world can’t say. It also provides you with high quality food of precisely the type you want. However, in order to maintain the larder, you must inventory it at least once a year (twice is better) and make sure that what you think you have is actually what you do have. Let me know if you have any questions about the inventory process at John@JohnMuellerBooks.com.

 

Differentiating Between CSS Boilerplate, Template, and Frameworks

You often see the terms boilerplate, template, and framework uses almost interchangeably online when people discuss CSS. In fact, some readers are confused about these terms and have written me about them. There are distinct differences between the three terms and you really do need to know what they are.

Boilerplate is code that you can simply cut and paste to use in an application. As an alternative, you can simply import the file that contains the boilerplate code. However, boilerplate code is designed to perform a specific task without modification in your application. Someone else has written code that performs a common task and you simply borrow it for your application (assuming they make it publicly available). It would be nearly impossible to create a complete application using just boilerplate code because it’s inflexible. Developers often stitch multiple sources of boilerplate code together to perform specific tasks, but then add custom code to the mix to customize the output.

Templates, like boilerplate, provide a means to reuse code, but the implication is that the code is modified in some way and that it’s also incomplete as presented. Yes, the template may provide a default presentation, but the default is usually bland and simplistic. Using templates makes it possible to create a customized appearance without writing a lot of code. Of all the readily available code categories, templates are the most common. Template makers also commonly create wizards to reduce the time a developer needs to employ a template even further. The downside to templates is that they do require some level of skill and more time to use than boilerplate.

Frameworks can be viewed as a container for holding other sorts of code and presenting it in an organized manner. However, a framework still consists of modifiable code. The difference is that a framework will commonly control the layout of a page, rather than the appearance of content it contains. Developers commonly combine frameworks with both templates and boilerplate to create a finished site. In general, frameworks always rely on a wizard to make creating the site easier.

Using the correct term for the kind of code that you’ve created makes it easier for others to know whether your solution will help them. In many cases, developers don’t want to be bothered with details, so boilerplate is precisely the solution needed. At other times, management has decided that a site with a perfectly usable framework needs a new look, so the developer may want a template to create a customized appearance within the existing framework. There are still other times where a new layout will better address the needs of site users, so a new framework is required.

Precise terminology makes it possible for people to communicate with each other. The creation and use of jargon is essential to any craft because precision takes on new importance when describing a process or technique. Developers need to use precise terms to ensure they can communicate effectively. Do you find that there is any ambiguous use of terminology in my books? If so, I always want to know about it and will take time to define the terms better in my blog. Let me know about your terminology concerns at John@JohnMuellerBooks.com.

 

Adding a Location to the Windows Path

A number of my books tell the reader to perform tasks at the command line. What this means is that the reader must have access to applications stored on the hard drive. Windows doesn’t track the location of every application. Instead, it relies on the Path environment variable to provide the potential locations of applications. If the application the reader needs doesn’t appear on the path, Windows won’t be able to find it. Windows will simply display an error message. So, it’s important that any applications you need to access for my books appear on the path if you need to access them from the command line.

You can always see the current path by typing Path at the command line and pressing Enter. What you’ll see is a listing of locations, each of which is separated by a semicolon as shown here (your path will differ from mine).

Path01

In this case, Windows will begin looking for an application in the current folder. If it doesn’t find the application there, then it will look in C:\Python33\, then in C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, and so on down the list. Each potential location is separated from other locations using a semicolon as shown in the figure.

There are a number of ways to add a location to the Windows path. If you only need to add a path temporarily, you can simply extend the path by setting it to the new value, plus the old value. For example, if you want to add C:\MyApp to the path, you’d type Path=C:\MyApp;%Path% and press Enter. Notice that you must add a semicolon after C:\MyApp. Using %Path% appends the existing path after C:\MyApp. Here is how the result looks on screen.

Path02

Of course, there are times when you want to make the addition to the path permanent because you plan to access the associated application regularly. In this case, you must perform the task within Windows itself. The following steps tell you how.

 

  1. Right click Computer and choose Properties from the context menu or select System in the Control Panel. You see the System window shown here open.
    Path03
  2. Click Advanced System Settings. You see the Advanced tab of the System Properties dialog box shown here.
    Path04
  3. Click Environment Variables. You see the Environment Variables dialog box shown here. Notice that there are actually two sets of variables. The top set affects only the current user. So, if you plan to use the application, but don’t plan for others to use it, you’d make the Path environment variable change in the top field. The bottom set affects everyone who uses the computer. This is where you’d change the path if you want everyone to be able to use the application.
    Path05
  4. Locate the existing Path environment variable in the list of variables for either the personal or system environment variables and click Edit. If there is no existing Path environment variable, click New instead. You see a dialog box similar to the one shown here.
    Path06
  5. When adding a new variable, type Path in the Variable Name field.
  6. Add the path you want to use in the Variable Value field. Click OK three times to close all the dialog boxes.


When you open a new command prompt, you’ll see the new path in play. Changing the environment variable won’t change the path for any existing command prompt windows. Having the right path available when you want to perform the exercises in my books is important. Let me know if you have any questions about them at John@JohnMuellerBooks.com.

 

Perfect Love (Reposted)

I had a number of requests to post this poem again for Valentine’s Day. It’s my hope that you find perfect love during this Valentine’s Day celebration.

Perfect love casts out my fear.
Keep your perfect love so near
that I never fear again.
Perfect love for you attain,
‘til my heart with love is filled
and my spirit never chilled.

All around the world I see,
how a perfect love could be,
an answer for mankind’s woes,
when hatred and evil flows,
fueled by fires of doubt and fear,
no one lets the other near.

Open eyes to perfect love,
gift of wonder from above.
A love that gives, never takes,
love that grants others mistakes,
that counts no loss and no gain,
that makes our hearts young again.

Copyright 2012, John Paul Mueller

 

Keeping Warm in the Cold Winter Months

Most people know that this has been one of the colder winters in recent memory. In fact, I’ve been taking enough heat about my views on global warming that I wrote a post entitled, Where is the Global Warming?. The effects of the cold have been serious enough to drastically raise the price of propane and to create local shortages. In fact, a few of my neighbors have been paying upwards of $6.00 a gallon for propane that normally costs around $2.50 a gallon. What this means is that a house that normally requires $300.00 per month to heat now costs $720.00. Most people can’t afford the price increase. More than a few people feel that the propane industry is engaged in price gouging. At issue is the need for propane to keep warm.

We heat our home for the most part using our wood stove. Wood heat is a lot better than propane because a wood stove will heat not only the air, but also the floor, walls, and ceiling. You get a mix of both direct and radiant heat. In addition, wood is a renewable resource. Carefully managed woods produce an abundant supply of wood that won’t ever run out as fossil fuels will. However, due to some unexpected circumstances, we’ve been using the furnace a bit this winter as well and feeling the pinch just a little.

There are some long term fixes for some of the problems with heating in the works. For example, there is a movement now to improve the standards for furnaces. The technology exists to improve the efficiency of furnaces from the current 80 percent to nearly 98 percent. In addition, newer furnace fans can save substantially on the electric bills. Unfortunately, even though the technology exists, you’d be hard pressed to find any furnaces like this for sale—they simply aren’t available today. So what do you do to improve fuel usage in your home today?

We’ve been experimenting with various strategies over the years. For one thing, we turn the thermostat way down at night—we’re talking 47 degrees. Blankets are a lot less expensive than fuel and we’ve actually found we sleep more soundly. I’m not sure anyone has ever done a study on the proposed benefits of sleeping cool (if you find such a study, please let me know). A programmable thermostat can get the furnace started up just a few minutes before you begin your day. I do know that we both sleep better and feel more refreshed when the house is kept quite cool during the winter months. We use both a blanket and a comforter on our bed and it seems to work just fine.

One of the more interesting aspects of most homes is that the bathroom actually warms quickly and is usually high on the priority list for getting heat. Even though the rest of your house is now at 47, you can run into the bathroom, close the door, and enjoy a nice warm early morning experience quite quickly. Just take your clothes with you (I certainly do) and dress inside. If you set up a schedule, other family members can just remain cozy in bed until it’s their turn to keep warm while dressing in the bathroom. Actually, it’s a technique that people have used for hundreds of years. I still remember my father telling me about running from the bedroom down to the kitchen where he’d dress in front of the wood stove in the morning.

We’ve found that running the furnace for one long period is far more efficient than running it over several short periods. An engineer who specializes in such things could probably produce the math required to tell you precisely why this is the case, but simply observing the monthly costs has shown us that long burns are more efficient. A long burn also provides some of the same radiant heat benefits that our wood stove provides. So, we get the house up to temperature in the morning and then turn the thermostat down while we work. When it’s time to sit and relax, we heat the house back up again and then turn it down about 2 hours before we go to bed (the house will most definitely maintain temperature long enough for you to get cozy beneath the blankets). Using this cycled method of maintaining house temperature can reduce the heating bill by as much as 30 percent when used correctly. Given that we work in our house, the cycled method does mean making comfort choices, but the savings are just too great to pass up. If you’re working outside the house, using the cycled approach is a given.

I doubt that there is a perfect solution to any heating problem during the winter months. Even using wood has problems. Of course, you need to go out and cut the wood. I find the task pleasurable, but most people wouldn’t. There is also the problem of the ashes. We use them around the animal cages so that we can maintain our footing on the ice (the ash adds grit), but most people aren’t in a farm environment like we are and would have a hard time finding a place to put all the ashes. The ash dust also gets everywhere, which means we’re constantly dusting the house. (Still, when given a choice, we much prefer wood, even with the downsides it presents.)

Have you come up with any interesting solutions to the heating problems for your home? Have you ever tried a cycled approach? Let me know your thoughts at John@JohnMuellerBooks.com.

 

Entering Data in a Code::Blocks Window

Sometimes it isn’t very obvious how to enter data into a Code::Blocks window. One of the windows that seems to be causing problems for a number of readers is the Watches window. You open this window by choosing Debug | Debugging Windows | Watches. The purpose of this window is to let you view the content of variables in your application, which is an essential part of the debugging process. In order to view the variable (or other expression) content, you must enter it in the Watches window. Book III of C++ All-In-One Desk Reference For Dummies tells you all about debugging.

One technique for entering the variable is to select it in the editing window and the drag it to the Watches window. The variable will appear in the Watches window along with its value. However, this approach only works for variables and expressions that actually appear in your code. You might want to enter some other expression (or manually enter the variable, rather than drag and drop it). The Watches window consists of rows and columns as shown here.

WatchEntry01

The name of the variable or the expression you want to view appears in the first column. To enter a new value into the Watches window, click directly in the first empty left column cell. The row will turn blue and you’ll see a red insertion point appear in the cell as shown in the screenshot. Now you can type the variable name or expression you want to work with and press Enter. Let’s say your variable is named i. It might look like this:

WatchEntry02

Notice that the row is now white because it isn’t selected. However, you can see the name of the variable, i, it’s value 1983844706, and it’s type int. The row is in red because the value of i has just changed (unchanged values appear in black so you can see them easier). As you debug your application, you can now watch the value of i for changes.

Sometimes it isn’t obvious how to enter information into Code::Blocks (or any other application for that matter). When that happens, the focus turns to the application, rather than the work you need to do, and the experience becomes frustrating. Let me know about your book-related Code::Blocks questions at John@JohnMuellerBooks.com and I’ll do my best to answer them. Because I don’t have a direct connection to the vendor, my ability to answer other sorts of questions is limited.

 

Finding Code::Blocks Tutorials

Sometimes it’s hard to know precisely how to cover information in a book because each reader’s needs are different. One reader may be somewhat knowledgeable and not need tutorials, another reader might me a complete novice and require more assistance. Over the years, I’ve come to appreciate the landslide of comments I receive about my language books when they deviate to discuss topics other than the language. Most readers don’t want to read about anything other than the language. In fact, in a few of my language books I’ve stopped mentioning any sort of IDE except in passing (and sometimes not at all).

C++ All-In-One Desk Reference For Dummies is a little different from most of my language books in that it must make mention of an IDE in order for the reader to follow all of the examples. Because I want the book to work well on all platforms, I’ve chosen Code::Blocks as the IDE for this book. This particular IDE works on all of the platforms that the book supports (Mac, Linux, and Windows) in a similar fashion, so one set of instructions works for everyone. In addition, Code::Blocks enjoys great community support and has a large enough user base that it’ll be around for a long time.

This book does contain a few bits of information about Code::Blocks because it must in order for the reader to follow the examples. However, I’ve purposely kept the amount of information about Code::Blocks to a minimum because this really is a language book and you could use any IDE with it, not just Code::Blocks. It’s difficult to walk the line between providing enough information about the IDE and not enough. Whether I’m successful depends on the skill level of the reader for the most part. The beta readers of the current edition are definitely letting me know where I need to add more information to ensure the material is understandable, but there will always be some room for readers to feel there is either too much or too little coverage.

With this in mind, I’ve provided posts such as Pausing the C Example Output in the C++ All-in-One for Dummies category. If you have a question about how to perform a task in the book, this is the first place to look. Make sure you contact me at John@JohnMuellerBooks.com if you have questions, because then I’ll know to discuss the topic as part of a blog post. What it all comes down to is my wanting to provide you with the information you need, but not knowing what that requirement is until you contact me. As more readers contact me and the list of posts grows (59 including this one) the chances of finding what you need in one place becomes greater.

Code::Blocks also comes with a nice help file, but you might not know it. Choose the Help | Codeblocks option and you’ll see a new window pop up with the help information. I must admit that it would have been better had the vendor provided a different command for accessing the help file, but at least the help file is there.

Even with these two resources, you’ll likely find situations where you need more information. As I said, Code::Blocks enjoys good support in the development community. The following list contains some tutorials you can try when none of the other sources I’ve mentioned help.

There are other tutorials available. What I need to know is whether these tutorials answer your questions or not. If not, what topics do you need covered that my blog doesn’t already discuss? It’s important to me that you have a good learning experience with my books so always feel free to contact me about topics you’d like to see covered in the blog.