Errata

Programming Windows® Services with Microsoft® Visual Basic® 2008

Errata for Programming Windows® Services with Microsoft® Visual Basic® 2008

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date Submitted
Printed Page 125
Updating the <Tutorials.threadfunc> Method

a) Capitalise the Method <Tutorials.ThreadFunc>


b) ".. add the bolded code shown in Listing 7-11?"

There is no bolded code in Listing 7-11

Oliver Slay  Nov 03, 2010 
Printed Page 124
Updating Our Configuration.xml File

<ProcessedError> - in next paragraph it reads: "I have added the <ProcessError> element."

Change XML to <ProcessError> or text to <ProcessedError>

Oliver Slay  Nov 03, 2010 
Printed Page 122
Install and Verify -

Compile Errors:

a) the pszVars is out of bounds ? at:
UserID = New Guid(pszVars(8)) - GUID not in the text file. So changed to New Guid()

b) Then error inserting because there is no primary key.

c) Now an error because Guid is all zeroes ? ?New Guid()? and ?New Guid(str)? ? both appear to be incorrect. Using Guid.NewGuid.

Maybe it would be better to make the UserID passed into InsertRecord ByRef ? set UserID to NewGuid() and then pass UserID into newUser.UserID

Oliver Slay  Nov 03, 2010 
Printed Page 119
Creating a SQL Class - Code Sample

Code Sample ? should there be a line:

?Private m_UDC as New UserDataContext?

m_UDC.Users.Add ? Add is not a member of Users ? use ?InsertOnSubmit?
instead?

Oliver Slay  Nov 03, 2010 
Printed Page 119
Creating a SQL Class - First Paragraph

a) '... call it SQL.VB.'

- change to 'LINQSQL.vb'

Oliver Slay  Nov 03, 2010 
Printed Page 114
Creating a User Stored Procedure - Second Paragraph

?Right-click the Programmability option? ? change to ?Left-click?/?click?

Oliver Slay  Nov 03, 2010 
Printed Page 98
Updating the <Tutorials.ThreadFunc> Method ? Listing 5-23

Loop through each childe node (FileWorkerOptions) and? ?

extra ?e? in ?childe?

Oliver Slay  Nov 03, 2010 
Printed Page 89
Updating the <Tutorials.OnStop> Method

a) Last ?*Catch ex As Exception?* has reverted to using a String and not My.Resources as the author recommends.

b) m_WorkerThread - Should this be m_WorkerThreads?

Oliver Slay  Nov 03, 2010 
Printed Page 87
Creating a New <FileWorker.ProcessFiles> Method

m_FileWorkerOptions.EmailProperties.Message = Message

? should be "...Message + TextFile" (or ProcessFile)?

m_SmtpClient.QueueMail(m_FileWorkerOptions.EmailProperties)

---
.EmailProperties is NOT a property of m_FileWorkerOptions.

Oliver Slay  Nov 03, 2010 
Printed Page 87
Creating a New <FileWorker.ProcessFiles> Method

m_FileWorkerOptions.EmailProperties.Message = Message

? should be "...Message + TextFile" (or ProcessFile)?

m_SmtpClient.QueueMail(m_FileWorkerOptions.EmailProperties)

---
.EmailProperties is NOT a property of m_FileWorkerOptions.

Oliver Slay  Nov 03, 2010 
Printed Page 87
Creating a New <FileWorker.ProcessFiles> Method

Line 6 ? ?*File is moved so lets read it out of the Output folder*?
When was the file moved?



Oliver Slay  Nov 03, 2010 
Printed Page 84
Scenario 3: Combing Synchronized Queues and Eventing - Title

'Combing' - should be 'Combining'

Oliver Slay  Nov 03, 2010 
Printed Page 81
Updating the <Tutorials.ThreadFunc> Method ? Last Paragraph

'FileWorkerProperties'? Should perhaps be 'FileWorkOptions'?

Oliver Slay  Nov 03, 2010 
Printed Page 81
Updating the <Tutorials.ThreadFunc> Method ? Code Sample

a) Line 8 .. extra ?e? in ?childe?

b) ??.SelectSingleNode(?MailEnabled ?) ? extra space after *Enabled*

Oliver Slay  Nov 03, 2010 
Printed Page 81
Updating the <Tutorials.ThreadFunc> Method ? Code Sample

Throughout this code, no need to use ?System.Xml?? as it's already imported by the ?Imports? statement.

Oliver Slay  Nov 03, 2010 
Printed Page 80
Updating the <Tutorials.ThreadFunc> Method ? Code Sample

a) "... = New dXmlDocument" - extra 'd'

b) Options = Doc.SelectSingleNode(?//*[local-
name()=?FileWorkerProperties?]?)


what is FileWorkerProperties? This has not been introduced yet. Perhaps 'FileWorkerOptions'?

Oliver Slay  Nov 03, 2010 
Printed Page 77
Updating the FileWorkerOptions Class - end of Listing

"Private mProcessed"

should read m_Processed

Oliver Slay  Nov 03, 2010 
Printed Page 72
Installation and Verification - First Paragraph - End

?? is configured properly per Listing 4-5?

Should read ?4-25?

Oliver Slay  Nov 03, 2010 
Printed Page 71
Updating <Tutorials.ThreadFunc> - listing 4-27

a) First ?Catch ex as Exception? ? should be updated to use
My.Resources.ConfigurationFileReadError and new Const value for
CONF_READ_ERROR to distinguish it from other errors in the <ThreadFunc>
method? Should it really be using the ONSTART_ERROR? It also goes against what was said earlier about passing Strings.

b) Last ?Catch ex as Exception? also uses ONSTART_ERROR ? it is not explained when this change occurred?

Oliver Slay  Nov 03, 2010 
Printed Page 71
Updating <Tutorials.ThreadFunc> - listing 4-27

a) Line 12 ? ?Looop? ? extra ?o?.

b) Line 12 ? ?childe? ? extra ?e?.

Oliver Slay  Nov 03, 2010 
Printed Page 69
Application-Specific Configuration File - after listing 4-23

"... an item call Configuration with a value of Tutorials.Xml ??

It's not called Tutorials.xml - it is Configuration.xml

Oliver Slay  Nov 03, 2010 
Printed Page 68
Application-Specific Configuration File

a) It does not say to change ?User? to ?Application? when entering
?Configuration? and ?Configuration.xml? as settings.

b) Third paragraph ? last sentence ? ?You *can, , updated* the runtime
config file manually after you release your code.? - Something missing?

Oliver Slay  Nov 03, 2010 
Printed Page 66
Updating <Tutorials.ThreadFunc> - Code Sample

m_WorkerThreads is a collection and with Option Strict On it shows
up as an Implicit Conversion Error. Lazy.

Oliver Slay  Nov 03, 2010 
Printed Page 66
Updating <Tutorials.ThreadFunc> - Code Sample

?I never recommend that you hard-code options into your
application.?

This not exactly true ? if I had stopped reading up till now I would assume that I had been recommended to hard-code options in the
Resource file.

It would read better as ?Up until now we have been using
My.Resources for the FileType and IncomingPath/OutputPath locations ? this has been out of convenience. It is recommended that??

Oliver Slay  Nov 03, 2010 
Printed Page 66
Updating <Tutorials.ThreadFunc> - Code Sample

Delete the 'End If' at the end of the code sample - between End Try and End Sub.

Oliver Slay  Nov 03, 2010 
Printed Page 65
Updating Our <FileWorker.ThreadFunc>

?Notice that now we are using the passed-in options for Output, FileType and Input locations.?

The code sample does not use the Output as a passed-in option.

Oliver Slay  Nov 03, 2010 
Printed Page 64
Updating Our <FileWorker.ThreadFunc>

It is not clear whether the whole function should be replaced with this code ? or only the For? Next loop. I have presumed that since we want to maintain the looping of the ThreadFunc that I only update the For? Next loop ? but at first I replaced the whole function with this, thinking that the loop would be handled elsewhere.

Oliver Slay  Nov 03, 2010 
Printed Page 62
Implementing the Worker Class ? Adding a FileWorker Collection

"As shown in Listing 4-16, we will create five worker threads."

This is Listing 4-16:

Private m_WorkerThreads As New Collection

---
Needs some extra lines of code to create five worker threads, I think.

Oliver Slay  Nov 03, 2010 
Printed Page 57
Listing 4-9 - Last Line

Superfluous 'End Try' AFTER the 'End Sub'

Oliver Slay  Nov 03, 2010 
Printed Page 56
Creating the Code - Step 3

Step 3 is covered by Steps 4 and 5.

Oliver Slay  Nov 03, 2010