Errata

MacRuby: The Definitive Guide

Errata for MacRuby: The Definitive Guide

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
PDF Page 8
Code

I ran the code per instruction.
I got the display & function as described.
However I also go the following error:


macruby(12760,0x107edd000) malloc: *** auto malloc[12760]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug.

Frederick C. Lee  Dec 19, 2011 
PDF Page 18
2nd last example ("Convert an object into a property list:")

Code listing for the example "Convert an object into a property list:" doesn't work on macruby 0.10 (OSX 10.6.7).

the following code works instead:
[1, "two", {'3' => 'three'}, true, false].to_plist

Marc Tan  Mar 28, 2011 
PDF Page 20
last paragraph

"some APIs use an asynchronous mechanisms"

should be

"some APIs use an asynchronous mechanism" (singular: 'mechanism').

Marc Tan  Mar 28, 2011 
PDF Page 58
First code block

Just wanted to point out that I get very different results with Thread inspection than what is printed. E.g.

framework "Foundation"
NSThread.multiThreaded?

Yields true from the start.

This, running HEAD Macruby on an i5 MacBook Pro.

Dylan  Jun 17, 2011 
PDF Page 128
First code block: def add_image(sender)

When I use this code, either the provided code included with the book or self-type, I get an EXC_BAD_ACCESS error in xCode 4. The issue seems to be related to the way this code is made or with MacRuby itself. I'm submitting as this issue is a complete roadblock to completing the chapter. Hope this helps :)

Keith Posehn  Jun 30, 2011 
PDF Page 181
3rd paragraph

Edit our xib file, right click on the Window instance, and --- set the drag the --- window delegate outlet to the "App Delegate" object.

"set the drag the" should just be "drag the"

Alex Heaton  Sep 13, 2011 
Mobi Page 1243
Code Listing (3rd Paragraph)

Chapter 4: Foundation -> Strings and Attributed Strings -> NSAttributedString code listing

The code example is uses framework 'Foundation'. On MacOSX 10.8.2 the NSFont class is in AppKit and should read foundation 'AppKit'.

> > framework 'Foundation'
= > true
font = NSFont.fontWithName(" Helvetica", size: 14.0)

Aimonetti, Matt (2011-10-13). MacRuby: The Definitive Guide: Ruby and Cocoa on OS X (Kindle Locations 1243-1245). O'Reilly Media. Kindle Edition.

The error displayed when using framework 'Foundation' is:
NameError: uninitialized constant NSFont

Roger Kohler  Jan 01, 2013 
Mobi Page 1330
Code listing (2nd paragraph)

writeToFile:automically does not return true. It returns 1.

From the book:
> > order = [' double double', [' pickles', 'onions'], {: animal_style = > true}] = > [" double double", [" pickles", "onions"], {: animal_style = > true}] > > order.writeToFile("/ tmp/ in-n-out", atomically: true) = > true

Aimonetti, Matt (2011-10-13). MacRuby: The Definitive Guide: Ruby and Cocoa on OS X (Kindle Locations 1330-1341). O'Reilly Media. Kindle Edition.

My results:
>> order = ['double double', ['pickles','onions'],{:animal_style => true}]
=> ["double double", ["pickles", "onions"], {:animal_style=>true}]
>> order.writeToFile("in-n-out",atomically: true)
=> 1

Roger Kohler  Jan 01, 2013 
Mobi Page 1400
5th paragraph

The big difference between NSHashTable and the other Set implementations is that NSHashTable supports weak references in a garbage-collected environment. Unless you have a very specific need for weak references, stick to Ruby or Cocoa?s Set implementations.

Can you give an example of a weak reference? What does that mean? Is the behavior of an NSHashTable such that a "weak reference" will allow the item within the table to be spared from GC? What makes a weak reference as opposed to ...?

Roger Kohler  Jan 01, 2013