Using Online IDEs

Many readers today want to code anywhere, using any device, and at any time. Obviously, hauling around a desktop system or even a high end laptop is not on the list of things they want to do. I thought it unique when a reader wrote me to say that coding on a smartphone should be included in my books. I have since had several more readers make the same request. So, I’m no longer surprised to hear about the various methods used to produce source code.

Personally, I think squinting while I code would be uncomfortable, but I definitely don’t want to hinder anyone’s learning process, so many (not all) of my introductory books now include a chapter on coding with mobile or online IDEs. For C++ All-In-One for Dummies, 4th Edition the mobile device tool of choice is CppDroid (a mobile IDE for C++). Python books, such as Beginning Programming with Python For Dummies, 3rd EditionPython for Data Science for Dummies, and Machine Learning for Dummies, 2nd Edition, rely on Google Colab (an online IDE). Just out of curiosity, I tried Google Colab using my smart TV and it did work—not that I plan to code using my TV anytime soon. Even though my latest book, Machine Learning Security Principles, doesn’t include any sort of IDE setup chapter, I did test the source code using Google Colab for that book as well.

Any time you change IDEs, you need to test your code to actually ensure that it will work with that IDE. Consequently, during the writing process I carefully tested every example on both my desktop system and the alternative IDE that the book supports. This dual testing process helps ensure you have a great learning experience. Unfortunately, I don’t have the time or resources to test every possible IDE out there. To obtain a good learning experience from my books, you need to choose one of the IDEs that I mention. In addition, it’s essential that you choose the correct version of the IDE, the one that matches the book, because vendors tend to introduce breaking changes into IDEs and compilers during the upgrade process.

When you contact me about an IDE issue, the first thing I need to know is which book (and edition of that book) you have, followed by the operating system and IDE version you’re using. Otherwise, it’s very tough for me to try to help you and I do want to help you within reason. No, I’m not going to try to support the alternative IDE that you like that was created for you by your long lost relative. I’ll only support the IDEs specifically mentioned in the book. That said, I do want to hear your input about IDEs at [email protected]. If you’re encountering a problem with the IDE that’s used in the book, I definitely need to know about it and I’ll post some helpful information about it on this blog.

Source Code Placement

This is an update of a post that originally appeared on October 12, 2015.

I always recommend that you download the source code for my books. The Verifying Your Hand Typed Code post discusses some of the issues that readers encounter when typing code by hand. However, I also understand that many people learn best when they type the code by hand and that’s the point of getting my books—to learn something really interesting (see my principles for creating book source code in the Handling Source Code in Books post). Even if you do need to type the source code in order to learn, having the downloadable source code handy will help you locate errors in your code with greater ease. I won’t usually have time to debug your hand typed code for you.

Depending on your platform, you might encounter a situation the IDE chooses an unfortunate place to put the source code you want to save. For example, a Windows System might choose the Program Files folder, which contains a space and doesn’t allow saving of files unless you specifically override the default rights. Fortunately, modern IDEs do manage to avoid many of these problems, but you still need to be aware that they could exist, especially when using an older IDE.

My recommendation for fixing these, and other source code placement problems, is to create a folder that you can access and have full rights to work with to store your source code. My books usually make a recommendation for the source code file path, but you can use any path you want. The point is to create a path that’s:

  • Easy to access
  • Allows full rights
  • Lacks spaces in any of the pathname elements
  • On a local drive, rather than a cloud drive in many cases

As long as you follow these rules, you likely won’t experience problems with your choice of source code location. If you do experience source code placement problems when working with my books, please be sure to let me know at [email protected].

Verifying Your Hand Typed Code

This is an update of a post that originally appeared on January 10, 2014.

I maintain statistics for each of my books that are based on reviews and reader e-mails (so those e-mails you send really are important). These statistics help me write better books in the future and also help me determine the sorts of topics I need to address in my blog. It turns out that one of the most commonly asked questions is why a reader’s hand typed code doesn’t work. Some readers simply ask the question without giving me any details at all, which makes the question impossible to answer. In some cases, the reader sends the hand typed code, expecting that I’ll take time to troubleshoot it. However, this isn’t a realistic request because it defeats the very purpose behind typing the code by hand. If I take the time to diagnose the problems in the code you typed, I’ll be the one to learn an interesting lesson, not you. If you learn better by doing—that is, by typing the code by hand and then running it, then you need to be the one to troubleshoot any problems with the resulting code.

My advice to readers is to use the downloadable source code when working through the book text. If you want to type the code by hand after that as part of your learning experience, at least you’ll know that the example works on your system and you’ll also understand how the example works well enough to troubleshoot any errors in your own code. However, you need to be the one to diagnose the errors. If nothing else, perform a character-by-character comparison of your code to the example code that you downloaded from the publisher’s site. Often, a reader will write back after I suggest this approach and mention that they had no idea that a particular special symbol or method of formatting content was important. These are the sorts of lessons that this kind of exercise provide.

Now, it has happened that the downloadable source code doesn’t always work on a particular user’s system. When the error is in the code or something I can determine about the coding environment, you can be certain that I’ll post information about it on my blog. This should be the first place you look for such information. Simply click on the book title in question under the Technical category. You’ll find a list of posts for that book. Always feel free to contact me about a book-specific question. I want to be sure you have a good learning experience.

There are some situations where a reader tries to run application code that won’t work on a particular system. My books provide information on the kind of system you should use, but I can’t always determine exceptions to the rule in advance. When I post system requirements, your system must meet those requirements because the examples are guaranteed to fail on lesser systems. If you encounter a situation where the downloadable code won’t run on your system, but none of the fixes I post for that code work and your system does meet the requirements, then please feel free to contact me. There are times where an example simply won’t run because you can’t use the required software or the system won’t support it for whatever reason.

The point of this post is that you need to work with the downloadable source code whenever possible. The downloadable source code has been tested by a number of people, usually on a range of systems, to ensure it will work on your system too. I understand that typing the code by hand is an important and viable way to learn, but you should reserve this method as the second learning tier—used after you have tried the downloadable source code. Please let me know if you have any questions or concerns at [email protected].

Working with Code in e-Books

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

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

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

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

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

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

UnZIPping the Downloadable Source

A number of readers have written me to say that they are using the downloadable source and can see the files on their hard drive. However, when they go to access the file using their IDE, the IDE won’t open it. Modern operating systems make things easier for people by displaying the contents of .zip and other archive files as if they’re another directory or folder on the system. However, the IDE doesn’t have the same advantage. You need to remove the files from the .zip archive and place them somewhere on your hard drive that the IDE can locate. You can tell that you’re looking at a .zip file by looking at the path. If you see something like C:\Temp\A4D2E.zip\A4D2E, where A4D2E.zip is the name of the archive, then you know that you’re looking in an archive file. If you still have problems getting the files to open, make sure you remove any spaces from the path that your IDE is using. You can contact me at [email protected] if you have any additional questions about this issue.

Get the Source Code for My Books from Another Source

A lot of readers have asked me to provide a better, centralized, location for the source code for my books. With this in mind, I’ve created a new Source Code web page on my website. All you need to do to use it is locate the name of the book whose source code you need and click the associated link or Download button. Not all of my books appear on the Source Code page yet, but I’m working on it. If you find that you can’t locate a book you desperately need, please let me know at [email protected]. I’ll do my best to help you make great use of my books. Please continue to frequent this blog for updates and news about my books.

Python 2.7.9 Update

Beginning Programming with Python For Dummies is based on Python 3.3. However, I know that some of you are using Python 2.x installations instead. My book does discuss some of the differences between the two releases and makes you aware of examples that won’t work. However, if you do decide to use Python 2.x despite the limitations when it comes to the book, I highly recommend you get the Python 2.7.9 update. The update contains a slew of important bug fixes, many of which affect security, which is always an important issue when it comes to applications.

A reader recently sent me an InfoWorld Tech Watch article that highlights the updates in the 2.7.9 release for you. The most important thing to know from a book perspective is that the update doesn’t offer any new features. This means that if an example didn’t work with 2.x in the past, it won’t work with 2.7.9 either.

A number of readers feel that the Python 2.x releases are better and the bug updates simply mean that it remains popular. Because the 3.x release is the preferred release, I chose to focus on it when I wrote the book. Yes, you can use my book with the 2.x release, but I guarantee some examples simply won’t work with it.

Please let me know if you have any other questions about my book, the level of Python support it provides, or whether the Python 2.7.9 release will provide any book-related advantage other than ensuring your system will remain safe at [email protected]. I want to ensure you have the best reading experience possible. However, there isn’t any chance at all that I’ll rewrite book examples to work with 2.x unless there is a significant number of readers who want this feature. Even then, some examples simply won’t work because there is no workaround to make them work (essentially the reason we needed the 3.x update).

 

Choosing an Example Type

It can be difficult to choose just the right kind of source code examples to include in my books. In fact, readers often write to ask why I didn’t choose a different kind of example for a book. For example, a lot of readers tend to prefer console applications because they’re:

 

  • Straightforward
  • Easy to understand
  • Easy to write
  • Demonstrate the code clearly
  • Don’t rely on any automation


Given these reasons, it would seem as if I’d use console applications for all of my examples in all of my books. In fact, these benefits (and others) are the reason I used console applications in C++ All-In-One Desk Reference For Dummies. In fact, to this list, you can add the benefit of the same example code running on multiple platforms to the list. The same example code runs on Mac, Linux, and Windows platforms with the GCC compiler. Even with this book, however, I’ve had readers write to ask why I didn’t use a different compiler or IDE and why I didn’t include examples that demonstrate the ability to use C++ to create user interfaces in anything but Visual Studio (the new edition of the book won’t include the Visual Studio examples).

Some books don’t lend themselves to console applications. For example, one of the purposes of Microsoft ADO.NET Entity Framework Step by Step is to show how you can use the automation provided by Visual Studio to write your applications with less code and in significantly less time. Not everyone likes the automation and I’ve actually had a few readers ask why I couldn’t write the examples using a console application format. The problem is that few people use the Entity Framework with console applications and the automation is there to simplify things. I understand that other books may provide console application examples, but I chose to provide the examples in a form that the majority of my readers would use in a real world setting.

Trying to come up with a book that pleases everyone is simply impossible because everyone has different needs. It all comes down to people wanting the best deal possible in a book, which means seeing an example that uses their environment on their platform and demonstrating precisely the kind of code they need to write. It’s an unrealistic expectation for any book. My Getting the Most from Your Technical Reading Experience post explains how you can optimize the purchasing experience to obtain the best book for your needs. The caveat is that no matter how good the purchase is, the book will never answer all of your questions and most definitely won’t answer them in precisely the way you need them answered for fulfill an application development requirement.

Of course, I’m always open to your input. It’s the reason I run this blog and ask for your input in nearly every post. My purpose in writing is to answer as many questions as I can for as many readers as I can in the best way possible. Sometimes that means I need to take a step back and rethink a particular process I’m using, technique I’m applying, or perspective I’m pursuing. I encourage you to continue contacting me at [email protected] with your book-related queries. I always use your input to help create better books in the future.