2020-04-27

War and Peace Programming in C# Errata

War and Peace Programming in C# 2019, 2022 Errata



Keyliner has produced a 2,100 page series of books on how to program in Visual Studio C#. 

This is a six volume set, with 1,300 illustrations.  And, it is inexpensive! 

Search Amazon for "War and Peace Programming"

Keyliner article and Description: 
https://keyliner.blogspot.com/2020/04/war-and-peace-programming-in-c.html

Amazon Link:
https://www.amazon.com/War-Peace-Programming-Introduction-Visual/dp/B09QP1YB24/ref=pd_lpo_1?pd_rd_i=B09QP1YB24&psc=1


Source Code Downloads
(especially for Chapter 6 and 7 Utility Functions)
https://drive.google.com/drive/folders/1nubCFPLM4c4xUEGdQOimKxqDn8dsQXU1?usp=sharing

 
Errata
(Kindle does not allow changes to publishing dates)
The most current dates are in the cover pages.

Edition 3.0 2022.05 - all changes below are incorporated, plus other enhancements.  The errata is too hard to maintain for all changes.  I'll only add glaring bugs in code in the future.  

Your comments on sections you like, or struggle with, are welcome.
Thank you.
 
Edition 3.0 2022.05 and older

Chapter 11 (multiple forms)
Passing Values using get-set Properties, Recommended
Error on Overview (page ~277);

private Form string private_strCompanyName = null;

public Form string Public_strCompanyName
{
    get => private_StrCompanyName;
    set => private_strCompanyName = value;
}


Chapter 26 SQL, apx pg 45:  Required SQL Parameters - Active Directory Credentials

Should be static String strDatabase = "Address";


Edition 3.0 2022.01 - published on Kindle:

Upgraded all illustrations and text for Visual Studio 2022.
Expanded SQL chapter to include more details
No known program bugs (with exception of a few tiny, minor ones, not documented here)
New snazzy book-cover.

Kindle does not allow 3.x version numbers and although most illustrations changed for Visual Studio 2022, I did not think the text changed enough to warrant a major edition change.

Edition 3.0 - published on Kindle :

Substantial or pertinent changes to the print edition are recorded here. 
Minor cosmetic, punctuation, or word-choice mistakes are not recorded.  The electronic edition is always up-to-date and can be re-downloaded at will.  I should mention the paper edition is glorious.


Page-numbers approximate and may shift with new content.


Published Vol 6 2021.03: Student and Instructor Project Workbook
(which formerly was the SQL chapters, which were moved to Vol5 in 2020.10). 
Three stand-alone, fun projects.  Does not require other volumes to complete.

Project 1:  Star Trek TOS Bridge Computer Simulation
Project 2:  Luhn Check Digit for Visa Cards
Project 3:  DirectoryPulse - Disk Directory Inventory Program


Version 2020.12:  Vol 3 and 4 only.
- Volume 3:  Formatting chapter:  Reference tables easier to read
- Volume 4:  Improved parts of the array chapter; especially 2-D array over-allocation.
If you have the electronic version of these, re-download them
 

 
Version 2020.10:

3rd Edition, published 2020-04; consolidated and republished 2020-10 

In version 3 (2020-10), volumes were consolidated, making a better value for students:
- less to buy
- less to download
- better value

Chapter's 6 and 7 were moved from Volume 2 into Volume 1.
Volumes 2 and 3 were combined into one larger book, now as Volume 2. 
Volume 4 was shifted to Volume 3
Volume 5 was shifted to Volume 4
Volume 6 was shifted to Volume 5 (SQL)
All with the same basic content, but with minor editing improvements, etc.   If you purchased the electronic version, delete and re-download for updated content.
If paper version, don't fret; same basic content, just in different books.

Volume 6 became a Student and Teacher Project Workbook. 
This is a stand-alone book that does not require the other volumes to be useful.
If you previously purchased electronic Volumes 5 and 6 (SQL), re-download (5) to get that book shifted, then download Volume 6 for a free upgrade.

(Unfortunately:  Kindle does not allow SubTitle changes for the volumes -- they remain fixed with their original topics.  Read the description for an accurate view of the contents.)

- Consolidated chapters and Volumes, making for less to purchase; better price.
   Seeing a book in print changed my perception on how it should be organized. 
   I think you will like these improvements.
- No new content in these volume changes.
- Numerous grammatical fixes, improvements to sentence structure and flow, etc. 
- (Volume 3: Formatting has better reference tables, but I forgot to update the version number)
   Apparently a book is never "done-done."

Chapters 6 and 7 (Utilities, Advanced Utilities)
- Moved to Volume 1.  Volume 1 was 376 pages; now 550 pages.

Chapters 10, 11, 12 (Class Libraries, ScopeForms, ASCII, Parsing)
- Merged to Volume 2  (Volumes 2 and 3 combined into one book.  Now 435 pages)

Volume 4 moved to Volume 3
Volume 5 moved to Volume 4
Volume 6 moved to Volume 5  (Volume 6 now retired; see Volume 5)

Future plans:  Volume 6 become a Student Workbook.


Minor corrections to version 3, dated 2020-04 and Older:
----------------------------------------------------------------------------------------------------------
Chapter 5 - Numbers and Dates

Pages 285...
Fixed several INT "casting" and "Convert.ToInt32" problems where casting and Converting were confused and crossed. 

Chapter 7 - Advanced Utility Functions
Page 145:
StripDuplicateCharactes
Found the routine improperly converted "\\\\" unc paths to a single "\".  Routine modified.
\\\\server\\sharename now properly converts to : \\server\sharename

Page 149 (new):
Added new advanced routine:  ValidiateEmail.
Enhanced ValidateEmail to allow user-bypass (allow audits that would normally fail to proceed.  This was a rare need found when "short domains" were not allowed, but a particular domain needed to be allowed to pass.).

Chapter 10 - Forms
Page 91: 
In "Setting a CheckBox Value Programmatically"
"In Button1's event code, query and report on the status of the checkBox with this logic:"
Should have said: "In Button2's event code, ......

Page 97: 
Radio button best practices.  This section needs an example showing how to remove a check-changed event.  Update pending.  I feel this is a weakness in the text.

Chapter 11 - Multiple Forms

Page 163: 
"Non-form class libraries do *** have an automatically built constructor..."  
should be: "Non-form class libraries do not have an automatically-built constructor..."

Page 206:
The Property illustration mistakenly mixed "private_strProgramVersion" and "private_strServerName" into one paragraph.  This is a minor descriptive text issue and does not effect code examples.

Corrected block of code, with a new section for the ServerName:

    private string private_str

Chapter 12 - ASCII files - Transaction Logging, Log Files

Pages 255, 255+
The description for building a logging routine, and how to cleanup old log files was convoluted.  Changed the text across many pages.  The new version, Revision 3  2020-07 is much improved.


Chapter 13 - Parsing Strings, Tab-delimited, CSV files

Page 282:
Minor typo and a poorly-worded paragraph that substantially effected the text.  Original text: 
'The empty string is an artifact of the first character, first delimiter.  The first character happens to be... finding a *** "(_" ...'    This second parenthesis is facing the wrong direction and substantially effects the meaning of the paragraph.

Paragraph re-written as:
"The empty string is an artifact of the first character, first delimiter. 

"This first character is a "(" delimiter and the split generates an empty cell because there is nothing before the first delimiter.  Similarly, when it finds two delimiters in a row at the end of the area-code, finding a parenthesis and a space ")_", the .split takes everything between (e.g. – nothing), adding another blank cell in the array.

Page 288, 294, 296:
Typo on the input line.  Change field value 1130.00  to 1130.50
string strInputLine = "Fuel Expenses:,1000.00,1130.50,1200.00";


Chapter 14 - INI files

Page 31 "Using CL860 INI File Read"
In the Summary Steps, move step 2 ("in top menu... Change command-line arguments") to a new Step 7.  

Chapter 19 - Waits, Delays, and Pauses

Page 173
[ ] Do not create the directory  (was for Visual Studio 2017), now should read:
[x] (check) Place solution and project in the same directory

Page 173, step 5
Remove phrase "//...pasting both 'wait' and the upper-cased 'Wait' functions." 
In 2019, the lower-cased overload is no longer recommended.  The lower-cased overload was for the convenience of the programmer.

Page 178 (CL805_Wait)
The Wait-routine had several typos:  Here is the completed version:

public void Wait(int ipassedSeconds)
    {
        //Use:  Wait(nn) seconds       

        int iwaitTime;

        if (ipassedSeconds == 0)
            iwaitTime = 220;    //about a quarter second, fixed
        else
            if (ipassedSeconds == -1)
                iwaitTime = 80;            //flash - about a 10th sec
            else
                iwaitTime = ipassedSeconds * 1000;   //Convert to millisecs

        while (iwaitTime > 1)
        {
            System.Threading.Thread.Sleep(110);
            System.Windows.Forms.Application.DoEvents();
            iwaitTime = iwaitTime - 110;
        }


Page 190: Form_Load event
boolcancelLaunchSW   should be cased like this:  boolCancelLaunchSW  (2 places)

Chapter 22 - Arrays

Page 19:   description of 3D array.  Embarrassed to have the wrong addresses in the intro.
Instead of "the cell in the top-sheet's lower-left corner..."
was [7,0,0]   Should be:  [0,7,0]
was [2,2,4]   Should be: [2,4,2]

Page 85: 2D array sorting.  The illustrations were a train-wreck.  This and next two pages re-illustrated.  Sorry not included here.  (Version 2020.12 vastly improved this section.  2-D array sorting, etc., is difficult to explain, but I think I got this right in the 2020.12 version).

Page 71, Sorting Arrays, Step a)

Was:         A021_SortNumbers(astrNames, aiNumbers);
corrected  A012_SortNumbers(astrNames, ref aiNumbers);

Page 87: Step c:  "Create three new intermediate arrays, one for each column:

Chapter 24 Console Apps

Added Index and TOC entries for "CommandLine Parms", Parameters.
Should add this to the INI file chapter, where it was also needed.


Source Code Downloads:
Now published.  See the top of this blog.


2nd Edition:
The second edition was published Chapter-by-Chapter (roughly 70 pages per chapter), but was too difficult for students to download, requiring 28 separate transactions; it was an experiment that failed.  Those single-chapter-books are way out of date and should be discarded for the newer, consolidated volumes.

2020-04-23

Greenshot - ScreenCaptureProgram

Recommended - Greenshot Screen Capture Program

I do dozens of screenshots daily, using them for illustrations or for quick snapshot or reminder of something I need to do.  I typically have a dozen little windows open during the day, using them like a clipboard or an illustrated task-list.  And, of course, I use them to grab illustrations. 

Greenshot is my tool of choice and it is super-easy to use.  
Press PrintScreen, draw a rectangle around the topic. Press enter. 
Save the screenshot as a file, or onto a small editor window.






Greenshot is a community-developed tool; source code available on Github.  For Windows users, is free, where they ask for a light donation.  I like this tool better than Windows "snipping tool."

Download link:  https://getgreenshot.org/downloads/




Installation

Because my Windows user account is a non-administrative account, I had a minor problem when installing.  If your local account is an administrative account, skip these steps and simply install

Non Administrator installation: 

1.  Using File Explorer, create folders before starting the installation:
     C:\ProgramFiles\Util
     C:\ProgramFiles\Util\GreenShot

2.  Download the Installation (to your normal installation directory, typically, "Downloads"
     Download link:  https://getgreenshot.org/downloads/

3.  Using File Explorer, locate the downloaded file. 
     As of 2020-04, "Greenshot-Installer-1.2.10.6-Release.exe"
     Shift-Right-Click the .exe,
     Choose "Install as another user"; use your administrative login.


Related articles:
Quit using an administrative account for day-to-day work.
https://keyliner.blogspot.com/2020/02/windows-10-administrative-accounts.html