PrintNumber ErrorLocation Error Correction DateAdded
2 p 20 center “n’s” above sigma character in figure on bottom of page done 9/11/2008
2 p 91 HFS type and creator are useful in doing searches for files of a specific type using the low-level HFS API (application programming interface). In the Finder, they help in matching generic documents (such as text files) to the specific applications that created them. However, non-HFS file systems don’t support the codes, and Apple has not expanded their role in Mac OS X. Use your own judgment as to whether you specify them; I prefer to do so.
HFS type and creator are useful in doing searches for files of a specific type using the low-level HFS API (application programming interface). In the Finder, they help in matching generic documents (such as text files) to the specific applications that created them. Apple has taken pains to ensure file metadata is preserved on non-HFS volumes, but type and creator codes are clearly not their preferred method. Use your own judgment as to whether you specify them; I prefer to do so.
9/11/2008
2 p 97 build * .nib *.so *.pbxuser *.mode* *.perspective*
build *~.nib *.so *.pbxuser *.mode* *.perspective* 9/11/2008
2 p 135 Apple’s release notes recommend examining the existing macro-specification files and developing your own from a copy of one that most nearly matches your needs. The nearest thing to an XML plist file is HTML, so let’s start from that.
Apple’s release notes recommend examining the existing macro-specification files and developing your own from a copy of one that most nearly matches your needs. The nearest thing to an XML plist file is HTML, inside the Xcode application package at Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources/HTML.xctxtmacro, so let’s start from that.
9/11/2008
2 p 138 {
Identifier = plist.container;
BasedOn = plist;
TextString =
“<$(Tag)>\\n\\t$(PreSel)<#!text!#>$(PostSel)\\n</$(Tag)>“;
PreSel = ““;
PostSel = ““;
},
{
Identifier = plist.container.array;
BasedOn = plist.container;
Name = “Array”;
Tag = “array”;
IsMenuItem = YES;
},
{
Identifier = plist.container.dictionary;
BasedOn = plist.container;
Name = “Dictionary”;
Tag = “dict”;
IsMenuItem = YES;
PreSel = “<key>“;
PostSel = “</key>\\n\\t”;
}
)
{
Identifier = plist.container;
BasedOn = plist;
TextString =
“<$(Tag)>\n\t$(PreSel)<#!text!#>$(PostSel)\n</$(Tag)>“;
PreSel = ““;
PostSel = ““;
},
{
Identifier = plist.container.array;
BasedOn = plist.container;
Name = “Array”;
Tag = “array”;
IsMenuItem = YES;
},
{
Identifier = plist.container.dictionary;
BasedOn = plist.container;
Name = “Dictionary”;
Tag = “dict”;
IsMenuItem = YES;
PreSel = “<key>“;
PostSel = “</key>\n\\t”;
}
)
9/11/2008
2 p 199 #define FLUSH GRAPHICS 1
#if FLUSH GRAPHICS
#define DEBUG FLUSH [[NSGraphicsContext currentContext] \
flushGraphics];
#else
#define DEBUG FLUSH
#endif
And after every drawing operation, we add debugflush:
.
.
.
[NSBezierPath strokeLineFromPoint:
NSMakePoint(NSMinX(dataBounds), y0)
toPoint:
NSMakePoint(NSMaxX(dataBounds), yN)];
DEBUG_FLUSH
}
// Draw points:
[sPointColor set]; // Use the point color
unsigned index, limit = [delegate countDataPoints];
for (index = 0; index < limit; index++) {
double x, y;
[delegate dataPointAtIndex: index x: &x y: &y];
// Make a small rectangle around the point.
NSRect pointRect = NSMakeRect(x - 2.0,
y - 2.0,
4.0, 4.0);
// Fill the small rectangle with the point color.
NSRectFill(pointRect);
DEBUG_FLUSH
}
Running this version, with FLUSHGRAPHICS set to 1, we find that we still can’t watch the first pass through the drawing code—it’s to a window that isn’t on screen yet. But allowing the window to display, and then a slight move of the resize box, forces a redraw, and stepping through drawRect:—past the drawing of the axes and the line to the drawing of the first point—leaves us with a partially drawn view that looks like Figure 13.6.
#define FLUSH_GRAPHICS 1
#if FLUSH_GRAPHICS
#define DEBUG_FLUSH [[NSGraphicsContext currentContext] \
flushGraphics];
#else
#define DEBUG_FLUSH
#endif
And after every drawing operation, we add DEBUG_FLUSH:
.
.
.
[NSBezierPath strokeLineFromPoint:
NSMakePoint(NSMinX(dataBounds), y0)
toPoint:
NSMakePoint(NSMaxX(dataBounds), yN)];
DEBUG_FLUSH
}
// Draw points:
[sPointColor set]; // Use the point color
unsigned index, limit = [delegate countDataPoints];
for (index = 0; index < limit; index++) {
double x, y;
[delegate dataPointAtIndex: index x: &x y: &y];
// Make a small rectangle around the point.
NSRect pointRect = NSMakeRect(x - 2.0,
y - 2.0,
4.0, 4.0);
// Fill the small rectangle with the point color.
NSRectFill(pointRect);
DEBUG_FLUSH
}
9/11/2008
2 p 201 Make this change and Stop Linear, if you haven’t already quit it. Re-#define FLUSHGRAPHICS to be 0, and build and debug Linear one more time. It feels like turning the crank: Load the data set, make sure the regression has been computed, and click Graph (see Figure 13.7).
Make this change and Stop Linear, if you haven’t already quit it. Re-#define FLUSH_GRAPHICS to be 0, and build and debug Linear one more time. It feels like turning the crank: Load the data set, make sure the regression has been computed, and click Graph (see Figure 13.7).
9/11/2008
2 p 119 DataPoints * curr;
// For each data point, add its property-list version
// to the pointArray.
while (curr = [iter nextObject]) {
[pointArray addObject: [curr asPropertyList]];
DataPoint * curr;
// For each data point, add its property-list version
// to the pointArray.
while (curr = [iter nextObject]) {
[pointArray addObject: [curr asPropertyList]];
9/11/2008
2 p 145 aRegression->slope =
(aRegression->count * aRegression->sumXY
- aRegression->sumX * aRegression->sumY)
/
(aRegression->count * aRegression->sumXSquared
aRegression->sumX * aRegression->sumX);
aRegression->intercept =
(aRegression->sumY
aRegression->slope * aRegression->sumX)
/
aRegression->count;
aRegression->correlation =
aRegression->slope * sqrt(
(aRegression->count * aRegression->sumXSquared
- aRegression->sumX * aRegression->sumX)
/
(aRegression->count * aRegression->sumYSquared
- aRegression->sumY * aRegression->sumY)
);
aRegression->dirty = 0;
aRegression->slope =
(aRegression->count * aRegression->sumXY
- aRegression->sumX * aRegression->sumY)
/
(aRegression->count * aRegression->sumXSquared
- aRegression->sumX * aRegression->sumX);
aRegression->intercept =
(aRegression->sumY
- aRegression->slope * aRegression->sumX)
/
aRegression->count;
aRegression->correlation =
aRegression->slope * sqrt(
(aRegression->count * aRegression->sumXSquared
- aRegression->sumX * aRegression->sumX)
/
(aRegression->count * aRegression->sumYSquared
- aRegression->sumY * aRegression->sumY)
);
aRegression->dirty = 0;
9/11/2008
2 p 160 CFBundleExecutable, the name of the executable file, which may be an application binary, a library, or plug-in code. It corresponds to the EXEXUTABLE_NAME build setting; use $(EXEXUTABLE_NAME) in the target’s Properties tab to ensure this key is always properly set. A bundle that mismatches this entry with the actual name of the executable file will not run. Applications must specify this key.
CFBundleExecutable, the name of the executable file, which may be an application binary, a library, or plug-in code. It corresponds to the EXECUTABLE_NAME build setting; use $(EXECUTABLE_NAME) in the target’s Properties tab to ensure this key is always properly set. A bundle that mismatches this entry with the actual name of the executable file will not run. Applications must specify this key.
9/16/2008