did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780974078519

Advanced Mac OS X Programming

by
  • ISBN13:

    9780974078519

  • ISBN10:

    0974078514

  • Edition: 2nd
  • Format: Paperback
  • Copyright: 2005-10-01
  • Publisher: Big Nerd Pub
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $69.99

Summary

There are several other books on programming for Mac OS X, but none of them contain explanations of how to leverage the powerful underlying technologies. This book goes down to the real nitty-gritty of multi-threading, interprocess communication, networking, performance tuning, distributed objects, queues, Bonjour, authentication, the keychain, and directory services. The tools are also covered: gcc, gdb, subversion, Shark, and Saturn.

Author Biography

Mark Dalrymple has been a Macintosh programmer since 1985 and a Unix programmer since 1990. Over the years he has worked on projects ranging from cross-platform development toolkits, parts of the Mac AOL client, and high-performance web server software servicing hundreds of millions of requests per day. Currently he heads Borkware, a custom application development and consultation company. Aaron Hillegrass who worked at NeXT and Apple, is the author of “Cocoa Programming for Mac OS X.” He is also the founder of the Big Nerd Ranch. Big Nerd Ranch provides world-class training for Mac OS X and Unix developers.

Table of Contents

Acknowledgements xv
Introduction
1(4)
Unix: Built to Evolve
1(1)
This Book
2(1)
Typographical Conventions
3(1)
Online Materials
3(2)
The Compiler
5(32)
Handy Flags
5(2)
Debugging
6(1)
Warnings
6(1)
Defining Preprocessor Symbols
7(2)
Seeing Preprocessor Output
9(1)
Seeing the Generated Assembly Code
10(1)
Preprocessor Hints and Tricks
11(5)
Predefined macros
11(2)
Macro hygiene
13(1)
Multiline macros
14(2)
Variable Arguments
16(5)
Varargs Gotchas
20(1)
Compiler Optimization
21(1)
GCC Extensions
22(1)
gcc 4.0
23(3)
long double
23(1)
Testing the Compiler Version
24(1)
New Optimizer
25(1)
Vectorization
25(1)
Even More Compiler Flags
26(2)
64-Bit Computing
28(2)
The 64-bit Programming Model
28(1)
64-bit Cleanliness
29(1)
Should You Go 64-bit?
30(1)
Universally Fat Binaries
30(7)
Fat Binaries from the Command Line
30(4)
Fat Binaries in Xcode
34(3)
Libraries
37(36)
Static Libraries
37(4)
Shared Libraries
41(2)
Frameworks
43(5)
Framework Versioning
46(2)
Writing Plug-ins
48(9)
Bundles in Cocoa
48(5)
Bundles With Dylib
53(4)
Shared Libraries and dlopen
57(3)
dlopen()
57(1)
dlsym()
58(1)
BundleLoader Revisited
59(1)
Embedding Frameworks in Applications
60(10)
Creating the Framework
61(4)
Creating the Application
65(3)
Cross-Project Dependencies
68(2)
ranlib and Source Code Management
70(2)
For The More Curious: Optimizing the system
72(1)
Challenge
72(1)
Command Line Programs
73(12)
The Basic Program
73(2)
Inside the Central Loop
75(1)
Changing by Name
76(1)
Looking at the Environment
77(2)
Parsing the Command Line
79(4)
For the More Curious: getopt()
83(2)
Memory
85(38)
Introduction
85(1)
Virtual Memory
85(1)
Differences From Classic Mac OS Memory Management
86(1)
Program Memory Model
87(3)
Memory Lifetime
90(1)
Dynamic Memory Allocation
90(6)
malloc()
91(3)
free()
94(1)
realloc()
94(1)
calloc()
95(1)
alloca()
96(1)
Memory Ownership Issues
96(5)
Debugging Memory Problems
101(8)
Common API issues
101(1)
Memory corruption
102(1)
MallocGuardEdges
103(1)
MallocScribble
104(1)
MallocStackLogging and MallocStackLoggingNoCompact
105(1)
MallocCheckHeapStart
105(2)
Guard Malloc
107(1)
Memory Leaks
107(1)
Memory Leaks in Cocoa
108(1)
For the More Curious
109(11)
ps and top
109(2)
Resource limits
111(5)
Some other tools
116(3)
vm_stat
119(1)
vmmap
119(1)
Challenge
120(3)
Debugging With GDB
123(30)
What is a Debugger?
123(1)
Using GDB From The Command Line
123(13)
A Sample GDB Session
123(13)
GDB Specifics
136(1)
Help
136(1)
Stack Traces
137(1)
Program Listings
138(1)
Breakpoints
139(1)
Displaying Data
140(2)
Changing Data
142(1)
Changing Execution Flow
142(1)
Handy Tricks
142(2)
Debugging Techniques
144(2)
Tracking Down Problems
145(1)
Debugger Techniques
146(1)
For The More Curious
146(5)
Core files
147(3)
Stripping
150(1)
More Advanced GDB Commands
151(2)
Threads
151(2)
Exceptions, Error Handling, and Signals
153(34)
errno
153(3)
setjmp, longjmp
156(2)
Signals
158(1)
Handling A Signal
158(2)
Blocking Signals
160(5)
Handling signals with sigaction ()
164(1)
Signal Issues
165(4)
Reentrancy
165(3)
Race conditions
168(1)
Exception-Handling in Cocoa
169(7)
Classic Exception-Handling
169(3)
Native Exception-Handling
172(3)
Subclassing NSApplication to catch exceptions
175(1)
Logging
176(9)
syslog()
176(2)
ASL
178(1)
ASL Messages
178(2)
ASL Queries
180(5)
For The More Curious
185(2)
Assertions
185(1)
Challenges
186(1)
Files, Part 1: I/O and Permissions
187(46)
Unbuffered I/O
187(14)
Opening a file
187(3)
Writing to a file
190(2)
Reading From a File
192(2)
Closing files
194(1)
Changing the Read/Write Offset
194(1)
Atomic operations
195(2)
Scatter / gather I/O
197(4)
creat()
201(1)
Blocking I/O
201(1)
Buffered I/O
201(8)
Opening files
202(1)
Closing Files
203(1)
Text I/O
203(2)
Binary I/O
205(3)
Positioning
208(1)
Formatted I/O
209(1)
Misc Functions
209(1)
Buffered I/O vs. Unbuffered I/O
210(1)
Removing Files
210(2)
Temporary Files
212(2)
File Permissions
214(9)
Users and groups
214(2)
File permissions
216(7)
Directory Permissions
223(1)
Permission-Check Algorithms
224(2)
For the More Curious: Memory-Mapped files
226(7)
Files, Part 2: Directories, File Systems, and Links
233(40)
Directories
233(6)
Creation and destruction
233(1)
Directory iteration
233(1)
The opendir() Family
233(2)
getdirentries()
235(4)
Current working directory
239(1)
Inside The File System
239(2)
Links
241(4)
Hard links
242(1)
Symbolic links
242(3)
Mac OS aliases
245(1)
API for links
245(1)
File Metadata
245(19)
stat()
245(6)
getattrlist()
251(1)
Describing the Attributes
252(2)
Parsing the Buffer
254(4)
Metadata in Batches
258(6)
Mac OS X Specific Weirdness
264(1)
Resource forks
264(1)
.DS_Store
264(1)
Disk I/O and sleep
265(1)
For The More Curious
265(6)
Differences between HFS+ and UFS
265(1)
Other random calls
266(2)
Other random programs
268(1)
Cocoa APIs of interest
269(1)
Access Control Lists
269(1)
Extended Attributes
270(1)
Challenge
271(2)
NSFileManager
273(16)
NSFileManager
273(1)
Make a File Browser
274(12)
Create the DirEntry Class
275(3)
Create a nib file using NSTreeController
278(5)
Using NSBrowser and DirEntry
283(1)
Adding deletion
284(2)
NSWorkspace
286(1)
Challenge
287(2)
Network Programming With Sockets
289(36)
Addresses
289(1)
The Address Data Structures
290(1)
IPv4 Address Structures
290(1)
IPv6 Address Structures
291(1)
Network Byte Order
291(1)
Address Conversions
292(3)
IPv4 and IPv6 Compatible Functions
292(3)
IPv4-specific functions
295(1)
Domain Name Lookup
295(3)
Simple Network Programming
298(5)
Server coding
298(1)
Constructing an address
299(1)
bind
299(1)
listen
299(1)
accept
300(3)
Client Coding
303(3)
connect
303(3)
More Advanced Issues
306(16)
Multiplexing connections
306(3)
Message boundaries
309(13)
For the More Curious:
322(1)
Datagrams
322(1)
Challenge
323(2)
CFRunLoop
325(26)
CFSocket
325(3)
GUI Chatter Client
328(9)
The System Configuration Framework
337(4)
Architecture
337(1)
Basic API
338(3)
Seeing all values
341(2)
SCFMonitor
343(5)
For the More Curious
348(2)
Challenge
350(1)
Multiprocessing
351(28)
Process Scheduling
351(1)
Convenience Functions
352(1)
fork
353(3)
Parent And Child Lifetimes
356(4)
exec
360(2)
Pipes
362(4)
Gotchas with Cocoa and fork()
366(1)
For the More Curious
367(10)
The HTTP protocol
367(10)
Summary
377(1)
Challenge
377(2)
Using NSTask
379(12)
NSProcessInfo
379(1)
NSTask
379(1)
NSFileHandle
380(1)
NSPipe
381(1)
Creating an App that Creates a New Process
381(4)
Non-blocking reads
385(6)
Edit the nib file
386(1)
Edit the code
387(4)
kqueues
391(18)
kqueue()
391(1)
Events
392(1)
Registering and Handling Events
393(2)
kqueues for Signal Handling
395(3)
kqueues for Socket Monitoring
398(1)
kqueues for File System Monitoring
399(3)
kqueues and Runloops
402(5)
fsevents
407(2)
Accessing the Keychain
409(16)
Items and Attribute Lists
410(2)
Searching for Items
412(2)
Reading Data From an Item
414(2)
Editing the Keychain
416(1)
Getting Specific Keychains
416(1)
Keychain Access
417(2)
Making a New Keychain Item
419(2)
Convenience Functions
421(2)
Challenge
423(2)
Authorization
425(22)
The Security Framework API
426(1)
Passing authorization to a SUID tool
427(2)
Add Authentication to Remover
429(14)
Wrapping NSFileManager
429(2)
Preauthorizing
431(3)
Creating the SUID tools
434(9)
For the More Curious: AuthorizationExecuteWithPrivileges()
443(2)
For the More Curious: Computing a Checksum
445(1)
Real and effective UID
445(2)
Distributed Objects
447(16)
Distributed Objects Concepts
447(2)
NSPort
448(1)
Create a DO Server
449(5)
Create a Client Using DO
454(7)
For the more curious: NSPortCoder
461(1)
Bindings and Distributed Objects
461(2)
Bonjour
463(8)
Publishing an NSNetService
463(2)
Make chatterd Zeroconf-compliant
464(1)
Browsing Net Services
465(4)
Make ChatterClient browse for servers
466(3)
For the More Curious: TXT Records
469(1)
Challenge
470(1)
Daemons and launchd
471(18)
launchd Configuration
472(5)
Starting Daemons
477(1)
Well-known Directories
477(1)
launchctl
477(1)
Making Your Own Daemons
478(3)
A Minimal Daemon
479(1)
A Minimal Service
480(1)
Talking to launchd
481(8)
Accessing Configuration Information
482(2)
A ``Proper'' Daemon
484(5)
Directory Services
489(20)
Directory Server Concepts
490(1)
Open Directory Data Structures
491(4)
tDirReference
491(1)
tDataBuffer
491(1)
tDataList
492(1)
tDirNodeReference
492(1)
tRecordEntry and tAttributeList
492(2)
tAttributeValueList, tAttributeEntry, and tAttributeValueEntry
494(1)
UserPictureBrowser
495(5)
Authenticating
500(5)
Editing Records
505(2)
Challenge
507(2)
Multithreading
509(30)
Posix Threads
509(19)
Creating threads
509(4)
Synchronization
513(1)
Mutexes
514(2)
Deadlocks
516(1)
Condition Variables
517(11)
Cocoa and Threading
528(7)
NSThread
528(3)
Cocoa and thread safety
531(1)
Objective-C @synchronized Blocks
531(4)
For the More Curious: Thread Local Storage
535(1)
For the More Curious: Read/Write Locks
536(1)
Challenge
537(2)
Using Distributed Objects Between Threads
539(14)
``Each Server In Its Own Thread'' Design
539(11)
Generate the Mandelbrot set
539(9)
Add Zooming
548(2)
performSelectorOnMainThread:
550(1)
Challenge 1
551(1)
Challenge 2
551(2)
Subversion
553(28)
Subversion Commands
554(1)
Getting Started
555(4)
Creating the Repository
555(1)
Importing a Project
556(1)
Multi-Project Repositories
556(1)
Project Directory Layout
557(1)
Performing the Import
558(1)
Daily Workflow
559(9)
svn commit
559(1)
svn diff
560(1)
svn add
561(1)
svn rm
562(1)
svn status
562(1)
svn update
562(1)
Updates and conflicts
563(1)
svn annotate
564(1)
svn log
565(1)
Specifying Revisions
565(3)
Tagging and Branching
568(2)
Tagging
568(1)
Repository URLS
569(1)
Branching
569(1)
Branching vs. Tagging
570(1)
Properties
570(3)
System Administration Issues
573(2)
.svn Directories
573(1)
Making Backups
573(1)
Remote Repositories
573(1)
Apache
574(1)
svnserv
574(1)
svn+ssh
574(1)
Mac OS X Weirdness
575(4)
Bundled Files
575(1)
Xcode
575(3)
Conflicts with Projects and Nib Files
578(1)
Subversion Locking
578(1)
.svn Directory in Built Applications with Xcode 1.5 and Earlier
579(1)
Summary
579(2)
Performance Tuning
581(40)
End to Free Performance is Nigh!
581(1)
Approaches To Performance
582(1)
Major Causes of Performance Problems
582(7)
Memory
583(1)
Locality of Reference
583(2)
Caches
585(1)
Memory is the New I/O
586(1)
CPU
587(1)
Disk
587(1)
Graphics
588(1)
Before using any of the profiling tools
589(1)
Command-Line Tools
589(5)
time
590(1)
ktrace
590(1)
fs_usage and sc_usage
591(2)
top
593(1)
Stochastic profiling
593(1)
sample
593(1)
Precise Timing with mach_absolute_time()
594(2)
GUI Tools
596(3)
ObjectAlloc
596(2)
Sampler
598(1)
CHUD
599(19)
Shark
599(1)
Starting With Shark
599(1)
Interpreting Results
600(2)
Getting Heavy
602(2)
Branching Out
604(2)
Looking At Source Code
606(2)
Charts
608(3)
Data Mining
611(3)
Saturn
614(4)
Using the CHUD Frameworks
618(1)
Summary
618(3)
Index 621

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program