Errata

Mono: A Developer's Notebook

Errata for Mono: A Developer's Notebook

Submit your own errata for this product.

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 6
mint heading

For the 3 trivial programs I tried, using "mint aprogram.exe" is faster than using
"mono aprogram.exe". I wonder if this can be clarified. I would think that mint would
always be slower.

Anonymous   
Printed Page 36
The code of WatchDirectory.cs

Something must have changed since the book was published, as WatchDirectory produces the error "Delegate can only have one target".

In the original code, "watcher.EnableRaisingEvents = true" should be lower than the next Console.WriteLine command.

Here are my alterations, which seem to work:

public class WatchDirectory {

private static void OnChanged (object sender,
FileSystemEventArgs e) {
Console.WriteLine (e.FullPath + " " + e.ChangeType);
}

private static void OnRenamed (object sender,
RenamedEventArgs e) {
Console.WriteLine(e.FullPath + " Renamed to {1}", e.OldName, e.Name);
}

public static void Main (string[] args)
{
if (args.Length < 1) {
Console.Out.WriteLine ("Usage: <directory path>");
Environment.Exit (1);
}

if(Directory.Exists (args[0]) == false) {
Console.Out.WriteLine (args[0] + " does not exist");
Environment.Exit (2);
}

string path = (string)args[0];

FileSystemWatcher watcher = new FileSystemWatcher(path);

watcher.Filter = "*";

watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.Deleted += new FileSystemEventHandler(OnChanged);
watcher.Renamed += new RenamedEventHandler(OnRenamed);

Console.WriteLine("Enabled watcher on {0}; " +
"hit return to terminate.", path);

watcher.EnableRaisingEvents = true;

Console.ReadLine();

watcher.EnableRaisingEvents = false;

watcher.Changed -= new FileSystemEventHandler(OnChanged);
watcher.Created -= new FileSystemEventHandler(OnChanged);
watcher.Deleted -= new FileSystemEventHandler(OnChanged);
watcher.Renamed -= new RenamedEventHandler(OnRenamed);

Console.WriteLine("done");
}
}

Bitflogger  May 21, 2013 
Printed Page 108
top of page

CellRenderer colr = new CellRendererText();

should be changed to:

CellRendererText colr = new CellRendererText();

Anonymous  Apr 19, 2013