Review of C# 5.0 Programmer’s Reference

A number of readers have asked me about the next book to get after reading one of my C# books, such as Start Here! Learn Microsoft Visual C# 2010 or C# Design and Development. Of course, it’s hard to recommend a next book unless you know where the reader is headed. After all, many of my books offer a starting point or deal with a specific area of interest. Based on the feedback I’ve received, in most cases, what the reader really wants is a compendium such as C# 5.0 Programmer’s Reference by Rod Stephens. This 918 page book is truly huge and contains a great deal of information within the pages between the covers.

The beginning of the book offers a different (and updated) perspective of what my books offer. It’s a starting point for your adventure in programming. Rod and I have complimentary writing styles, so if you didn’t quite pick up a concept in my book, Rod’s explanation will almost certainly make the difference for you. Most importantly, Rod’s book offers that latest updates for C# developers that my books can’t offer because they’ve been out for a while.

By the time you get to Part IV of the book, you’re moving away from the material that I offer into some more advanced programming topics. For example, I don’t really talk much about printing in my books. All of these topics are treated in greater depth than the material in my books—generally because I’m covering the topic at a level and in a manner that the less experienced developer will understand. So it’s essential not to skip these topics even if you’ve read about them before.

Part V is where this book really excels. I was especially taken with the chapter on parallel programming. Just about every machine on the planet provides multiple processors today, yet applications don’t use them nearly as often as they should, which results in wasted processing cycles and poor performance. Rod also provides an outstanding discussion of cryptography. If you’ve read the trade press recently, you know that securing data is becoming harder and harder, yet more important all the time.

Every chapter ends with a set of exercises. This makes the book invaluable in the classroom. An instructor can assign the book a bit at a time and have exercises ready to check the student’s comprehension of the material. Appendix A contains the answers for the exercises, so the answers are easy to check. It could be possible to create a student version of the book that lacks Appendix A so the instructor can check the student’s answers without worry about peeking.

What makes this book a compendium, a reference book, is the appendices in the back of the book. There is an appendix for nearly everything you can imagine. Do you need a quick refresher on data types? Well, you can find it in Appendix B. Appendix J will give you the quick scoop about Language INtegrated Query (LINQ). Look in Appendix T when you need to know more about regular expressions. The point is that the appendices make it easy to perform quick lookups when you’re in a hurry.

The bottom line is that if you need a book that will do more than just sit on your shelf, this is the one to get. You could easily use this book to get a great refresher on C# usage, an update on the new features provided by C# 5.0, a great classroom experience, and that reference book that you need later when you need to rediscover something under pressure.

 

Cross Platform Functionality for .NET

Microsoft has recently announced that it will port the .NET Framework to the Mac and Linux platforms. This is welcome news because more and more of my readers have expressed an interest in developing applications that run on multiple platforms. It’s the reason that I cover Windows, Linux, and Mac requirements in books such as Beginning Programming with Python For Dummies. Until now, I usually had to include some mention of alternative solutions, such Mono, to help my readers achieve cross-platform functionality. (For readers with older versions of my books, Mono is actually delivered by Xamarin now, see my announcement in the An Update About Mono post.) Even though Mono makes a valiant effort to make cross-platform a reality, it does have limits, so the Microsoft announcement is welcome. Now we have to see whether Microsoft actually delivers on its promises.

There has been a lot of analysis about the announcement. You can find some general information about the product on eWeek. The information is pretty much a reworded version of the Microsoft announcement, but I found it clear and succinct. The InfoWorld writeup provides additional information and takes Microsoft to task for not completely opening the .NET Framework. There are still some licensing issues to consider. For my part, I wonder when Microsoft will make it possible to fully use C# on any platform. At some point, Microsoft must make it possible to develop applications on a platform other than Windows or developers will continue to lose interest.

One of the biggest questions I’ll need to answer for you is whether any of my book examples will run on other platforms. Given how Microsoft has done things in the past, it seems unlikely that you’ll be able to use any of my existing book examples on other platforms. The code might possibly work, but the downloadable source would have to be redone to make it possible to compile the examples with the new tools. So, for now, I’m saying outright that you need to continue to use my books with the version of Visual Studio for which they are written and not assume that the examples will work on other platforms.

I do find the news exciting because there is finally a chance that I’ll be able to address your needs better when it comes to working with languages such as C#. Yes, working with solutions such as Mono did allow you to perform certain tasks across platforms, but there is not a potential for writing complete applications of nearly any type and having them work anywhere, which is where the world as a whole has been headed for a long time. I applaud Microsoft’s efforts to move forward.

Please do contact me with your questions regarding cross-platform functionality in .NET and how it affects by books at John@JohnMuellerBooks.com. No, I can’t answer your question about how Microsoft will implement cross-platform functionality in the new versions of .NET, but yes, I do want to hear about your ideas for book updates based on this technology. What I want to do is help you use this new functionality as soon as is possible.

 

C++ All-in-One for Dummies 3rd Edition Extras

A number of you have pointed out that the extras for C++ All-In-One for Dummies, 3rd Edition on the Dummies site are a bit confused at the moment. Thank you, as always, for your input. I always appreciate getting your e-mails on any topic that affects the usability of my books. The publisher has assured me that the links will be cleaned up. Of course, eventually getting the links fixed won’t help you today. With this in mind, here is a list of the actual extras for this book—the elements that I’ll support and that provide support for the book:

To access a particular extra, just click its link in the list. Of the items you can download, the items that I most strongly suggest you download are the code examples. Downloading the code examples will save you considerable time, reduce potential errors, and make your experience with the book a lot better. If you want to type the examples in by hand, try them first using the downloaded code and then type them in. Using this two-step process makes it possible for you to easily see typos that you make as you work with the code on your own.

Remember that this edition of the book uses a newer IDE, Code::Blocks 13.12. Even though some examples will work with the older versions of Code::Blocks used in the second edition, other examples won’t. Upgrading your copy of Code::Blocks to version 13.12 ensures that you see the examples as they are meant to work. A few readers have asked about the requirements for using the extras and you really do need Code::Blocks 13.12 to use them correctly. You can also get by with a compiler that provides C++ 14 support, but you’ll need to modify the procedures to use that compiler, rather than Code::Blocks. I don’t provide support for other compilers because I don’t have them installed on my system.

Please let me know if you have any other questions about the extras for this book. It’s important to me that you get the maximum value from your purchase. Report any problems to me at John@JohnMuellerBooks.com. Of course, I always want to hear your book-related queries as well.

 

Fixed C++ Book Link

Last week I announced the release of C++ All-In-One for Dummies, 3rd Edition and told you about a link for the book extras at http://www.dummies.com/extras/cplusplusaio/. Unfortunately, the link didn’t work for a while. Clicking the link produced an error message, rather than a page full of useful content. The publisher has fixed the link and you can now gain access to a lot of really cool book extras:

All these extras will make your reading experience even better. Make sure you check them all out. Of course, I always want to hear your book concerns, especially when it’s something major like not being able to find needed content. Please feel free to contact me at John@JohnMuellerBooks.com with your book-specific question.

 

Choosing a C++ Editor

A lot of people have asked why I chose Code::Blocks as the editor for C++ All-In-One for Dummies, 3rd Edition. There are a number of reason that I chose this particular editor including:

  • Ease of use
  • Free download
  • Runs on all the platforms the book supports

However, the fact that Code::Blocks works well for the book and for most beginning projects doesn’t mean it’s the best solution for your particular needs. There are many different C++ Integrated Development Environments (IDEs) out there and I’m constantly trying new products. When the new version of Visual Studio comes out, you can be sure I’ll obtain a copy and check it out because some of my readers use Visual Studio. The problem with Visual Studio is that it tends to use Microsoft additions to the C++ language and it also doesn’t run on all the platforms that the book must support. However, if you’re working with Microsoft systems and need to create a relatively large project, Visual Studio might be a good choice for you—only you can make that determination.

The Eclipse IDE is another good selection. In fact, I used Eclipse when writing Java eLearning Kit for Dummies because it runs on every platform I needed to test. When I wrote this book, I chose to focus on the language though and not really mention the IDE at all. I didn’t want readers to have preconceived ideas of how Java should look inside an editor. I had thought about using Eclipse for C++ All-in-One for Dummies, 3rd Edition, but after reviewing the IDE and comparing it to Code::Blocks, I felt Code::Blocks was a lot simpler. Even so, if you need great multiplatform support for your C++ projects, Eclipse is a great choice.

I recently tried another IDE, Intel Composer. This is most definitely not a IDE for the faint of heart or the light of pocketbook (the asking price is $1,199.00). Of course, many of you are going to question my sanity for even downloading such a product when there are so many less expensive solutions out there. The main reason to obtain a product like this one is that it provides phenomenal parallelism support for multiprocessor applications. In other words, you use this sort of IDE for high end projects. You can read all the other features this product offers on the vendor site. One of the other items that grabbed my attention is that it provides both multiplatform (Windows, Mac, Linux, and Android) and multiformat (Phone, Tablet, PC, Ultrabook, and Server) support. Whether this particular IDE makes sense for your needs depends on the kind of applications you create.

Although the information in Wikipedia is often suspect, you can find a comparison of various IDEs at http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments. The best way to choose a C++ IDE is to look for a product that meets your needs and then try it out on a subset of the problem you’re trying to solve. Researching the IDE you use is essential because a mistake can cost you a lot of time later. Not every IDE support every C++ feature, every platform, or every team need. Tell me why you think I should move to something other than Code::Blocks for the next edition of the book at John@JohnMuellerBooks.com.

 

Examining the Calculator in Windows 7 (Part 2)

A while back, over two years ago in fact, I uploaded a post entitled, “Examining the Calculator in Windows 7.” Since that time, a number of people have asked about the other features that the new calculator includes. Yes, there are these rather significant problems that Microsoft has introduced, but there are some good things about the new calculator as well.

The good thing appears on the View menu. When you click this menu, you see options at the bottom of the list that provide access to the special features as shown here.

The View menu includes options for unit conversion, date conversion, and worksheets.
The Windows 7 Calculator View Menu

The Unit Conversion and Date Conversion options are the most useful. However, the worksheets can prove helpful when you need them. Of the new features, I personally use Unit Conversion the most and many people likely will. After all, it’s not often you need to figure out a new mortgage, vehicle lease amount, or the fuel economy of your vehicle (and if you do such work for a living, you’ll have something better than the Windows Calculator to use). To see what this option provides, click Unit Conversion. You see a new interface like the one shown here:

The Unit Conversion display makes it possible to convert from one unit of measure to another.
Calculator Unit Conversion Display

You start using this feature by selecting the type of unit you want to convert. As you can see from this list, the kinds of conversions you can perform are extensive:

Select a conversion type to determine what options are offered in the From and To fields.
The Calculator Supports a Healthy List of Conversion Types

The option you select determines the content of the From and To fields. For example, if you want to convert from kilometers to miles, you select the Length option. After you select the type of unit, type a value in the From field and select the From field unit of measure. Select the To field unit of measure last. Here is what happens when you convert 15 kilometers to miles:

The output shows that converting 15 kilometers to miles equals 9.32056788356001 miles.
Converting Kilometers to Miles

I’ve found use for most of the entries in the types list at one time or another. Every one of them works quite well and you’ll be happy they’re available when you need them. The Data Calculation option can be similarly useful if you work with dates relatively often, as I do. However, I can’t see many people needing to figure out the number of days between two dates on a regular basic. Even so, this feature is probably used more often than any of the worksheets.

The ability to perform conversions of various kinds and to access the worksheets that Windows 7 Calculator provides isn’t enough to change my opinion. The implementation of the Calculator is extremely flawed and I stick by my review in the first posting. However, you do have the right to know there are some positives, which is the point of this post. Let me know your thoughts about Calculator now that you have a better view of it at John@JohnMuellerBooks.com.

 

Announcing C++ All-In-One for Dummies 3rd Edition

I’m really excited to announce the release of C++ All-In-One for Dummies, 3rd Edition. This is the book that:

  • Provides all the updates you’ve been wanting
  • Relies on the latest version of Code::Blocks
  • Includes better support for Windows, Linux, and Mac installations
  • Contains all the latest techniques, including lambda expressions

This is the book update that I discussed in Beta Readers Needed for a C++ Book Update. Here’s the new book layout:

  • Book I: Introduction C++
    • Chapter 1: Configuring Your System (18 Pages)
    • Chapter 2: Creating a First C++ Program (20 Pages)
    • Chapter 3: Storing Data in C++ (30 Pages)
    • Chapter 4: Directing Your C++ Program Flow (26 Pages)
    • Chapter 5: Dividing Your Work with Functions (26 Pages)
    • Chapter 6: Dividing Between Source-Code Files (16 Pages)
    • Chapter 7: Referring to Your Data through Pointers (30 Pages)
    • Chapter 8: Working with Classes (38 Pages)
    • Chapter 9: Using Advanced C++ Features (36 Pages)
  • Book II: Understanding Objects and Classes
    • Chapter 1: Planning and Building Objects (30 Pages)
    • Chapter 2: Describing Your Program with UML (20 Pages)
    • Chapter 3: Structuring Your Classes with UML (12 Pages)
    • Chapter 4: Demonstrating Behavior with UML (18 Pages)
    • Chapter 5: Modeling Your Programs with UML (12 Pages)
    • Chapter 6: Building with Design Patterns (30 Pages)
  • Book III: Fixing Problems
    • Chapter 1: Dealing with Bugs (12 Pages)
    • Chapter 2: Debugging a Program (14 Pages)
    • Chapter 3: Stopping and Inspecting Your Code (12 Pages)
    • Chapter 4: Traveling About the Stack (10 Pages)
  • Book IV: Advanced Programming
    • Chapter 1: Working with rays, Pointers, and References (30 Pages)
    • Chapter 2: Creating Data Structures (22 Pages)
    • Chapter 3: Constructors, Destructors, and Exceptions (28 Pages)
    • Chapter 4: Advanced Class Usage (26 Pages)
    • Chapter 5: Creating Classes and Templates (32 Pages)
    • Chapter 6: Programming with the Standd Libry (38 Pages)
    • Chapter 7: Working with Lambda Expressions (16 Pages)
  • Book V: Reading and Writing Files
    • Chapter 1: Filing Information with the Streams Libry (14 Pages)
    • Chapter 2: Writing with Output Streams (16 Pages)
    • Chapter 3: Reading with Input Streams (12 Pages)
    • Chapter 4: Building Directories and Contents (10 Pages)
    • Chapter 5: Streaming Your Own Classes (12 Pages)
  • Book VI: Advanced C++
    • Chapter 1: Exploring the Standd Libry Further (20 Pages)
    • Chapter 2: Working with User Defined Literals (UDLs) (16 Pages)
    • Chapter 3: Building Original Templates (20 Pages)
    • Chapter 4: Investigating Boost (26 Pages)
    • Chapter 5: Boosting Up a Step (16 Pages)
  • Appendix A: Automating Your Programs with Makefiles (12 Pages)

As you can see, this new book focuses a lot more strongly on standardized C++ so that you can get more out of it. There isn’t any mention of Microsoft special features any longer. You can use this book in all sorts of environments now and expect the examples to work (with some modification depending on how well your compiler adheres to the standard). Most importantly, there is now a chapter specifically designed to help you get your system configured so you can begin enjoying the book in a shorter time.

As always, I highly recommend you download the book’s source code from http://www.dummies.com/extras/cplusplusaio/ (the source code appears at the bottom of the page, so you must scroll down). In addition to the source code, the site also contains a wealth of extras that you really want to check out as part of your book purchase. Of course, there is always room for additional information, so let me know about the topics you’d like to see covered on the blog as well. You can check out the current posts at: http://blog.johnmuellerbooks.com/category/technical/c-all-in-one-for-dummies/.

I’m really excited about this new book and want to hear from you about it. Please feel free to contact me about any questions you have at John@JohnMuellerBooks.com.

 

Using Code::Blocks 13.12 with C++ All-in-One for Dummies

As stated in my Beta Readers Needed for a C Book Update post, I’m currently working on an updated version of C++ All-In-One Desk Reference For Dummies. The 2nd Edition book that is currently available relies on Code::Blocks 8.02 (the version I still recommend you use with this particular edition), which is really long in the tooth at this point. I’ve provided a number of update posts since the book was released to help you use Code::Blocks versions 10.05 and 12.11. However, as the example code has gotten older, more and more problems have surfaced with the example code because C++ itself has changed. The new book will use Code::Blocks 13.12, so the example code problems will disappear.

Most of the book examples for the 2nd edition will still compile with Code::Blocks 13.12, but not all of them will (the series of Code::Blocks 10.05 update messages should give you some idea of the problems you’ll encounter using a newer version). However, there are issues with one of the Code::Blocks 13.12 releases that will cause you serious problems in using the book. If you insist on using the latest version of Code::Blocks, make sure you download the codeblocks-13.12mingw-setup.exe file and not the codeblocks-13.12mingw-setup-TDM-GCC-481.exe file. According to the site, this second file has some issues with Code::Blocks. A note on the site page at http://www.codeblocks.org/downloads/26 explains the problem. Essentially, the GCC 4.8.1 release has problems with Code::Blocks, so you’ll see behavior that has nothing to do with the example code if you use it.

One of the beta readers for the new edition actually pointed out this problem. He inadvertently installed the buggy version of GCC 4.8.1 and I was able to see first hand that it really does cause some serious issues. (Actually, we couldn’t figure out what was going on at first.) This is one of many reasons I love to use beta readers when working on my books. In finding just this one problem (and he has found others), this beta reader prevented a whole lot of other readers from having issues with my new book .

I always want to hear about issues you have with my books. If you find that you have problems with the examples after reading through the posts on my blog, please contact me at John@JohnMuellerBooks.com and tell me about them. In many cases, the only way that I know a problem exists is when you make me aware of it. Thanks again for all your helpful support over the years!

 

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.