Archive for May 2003

Thursday, May 29, 2003

Stone Cold

Go Eric. The fact of the matter is that companies like Unsanity and St. Clair Software go the extra mile to make their patches work with both Carbon and Cocoa. If Stone doesn’t want to do that, it’s his choice, but he should stop spreading FUD.

Wednesday, May 28, 2003

Memory Models

Chris Brumme:

The trade-off between developer productivity and computer performance is really an economic one.  If there’s sufficient incentive to write code to a weak memory model so it can execute efficiently on future computers, then developers will do so.  At that point, we will allow them to mark their assemblies (or individual methods) to indicate that they are “weak model clean”.  This will permit the native code generator to emit normal stores rather than store.release instructions.  You’ll be able to achieve high performance on weak machines, but this will always be “opt in”.  And we won’t build this capability until there’s a real demand for it.

Lisp Machine

John Wiseman has posted a video of a Lisp machine. I also found these pictures of the keyboard.

FrameMaker Capitalization

I always forget FrameMaker’s keyboard commands for changing capitalization. They’re not in the menus or in the online help index. You have to remember which help page to look on. So here they are, for my reference:

Automatic Switching

Pierre Igot:

Right now, I’m seeing a pattern in Mac OS X and in Apple’s applications that I really don’t like: something akin to systematic UI intrusiveness when background processes fail.…Apple wants us to adopt Mac OS X because it’s an advanced, multithreading, multitasking system. Fine. But then please design Mac OS X so that it handles multiple tasks more gracefully! I am definitely a multitasker and I hate having to wait for a process to finish before I can switch to something else. Mac OS X lets me switch. It shouldn’t force me to switch back whenever there is an error or failure!

Journalism

Tim Bray:

I had an intense dialogue with Jon Udell about how journalism in general and tech journalism in particular feel increasingly broken, and whether something else comes next, and if so what. Herewith a look at the problem and where it comes from.

Blacklists

Hiawatha Bray:

Blocklists are a powerful alternative to more costly and unreliable “content filtering” software, which scans each incoming message and tries to determine whether it’s spam.

Of course I’m biased, but I think blacklists are less reliable than content filters and fail less gracefully. Most content filters I’ve seen are free or cheap, so I don’t know why he says they’re costly.

iTunes 4.0.1

Boing Boing:

Apple has “enhanced” iTunes so that it can’t be used to play music from one computer on another if they’re on different subnets (i.e., if you have a computer at home that you stream to from work).

This is an unfortunate consequence of the integration between the music store and the music player. Looks like an opportunity for a third-party developer without Apple’s conflicting interests.

Tuesday, May 27, 2003

Spam

My sister got her first ever spam message today. Despite having an account at the same ISP as me, she’s never gotten any before. Amazing.

On the Origin of Creoles

Although I love linguistics, I’ve never conducted research in it beyond class projects. A few weeks ago I posted my term paper on periphrasis just for kicks. It was a fun project, and I had found the research challenging. There were a lot of papers with relevant information, but few that focused on the precise areas I was investigating. Googling for “periphrasis tsai” revealed that my paper hadn’t been indexed yet, but I came across an article (PDF) by Michel DeGraff (one of my favorite professors). It’s definitely worth reading if you’re interested in this sort of thing. DeGraff is a master at debunking.

Related books:

Verdana

Verdana is my favorite Microsoft product. It’s not as nice as Geneva (except for headlines, where it’s better), but Mac OS X can draw it well. I’m now using it in Cocoa programs like Safari, NetNewsWire, and Path Finder that can’t draw Geneva right.

Mac Faithful

Waferbaby interviews John Gruber:

there are only two reasonable explanations for the mac’s continuing success in the face of microsoft’s dominating monopoly: (a) it offers advantages over windows; or (b) mac users are blindly loyal to apple for completely illogical reasons.

so what i’m saying is that the truth is (a), but that most so-called “industry experts” have decided the answer is (b)—they don’t perceive the mac’s advantages, and so they refuse to believe there are any.

(Thanks for the plug.)

Adobe Reader

Sven-S. Porst:

Today brought us the advent of Acrobat Reader 6. And at a first glimpse this is a piece of software that wants to make you puke. I really like using PDF files because they’re an easy way to distribute documents efficiently without relying on other people to have a working TeX (or whatever other program you like to use) installation. But step by step Adobe has managed to turn Acrobat Reader into a crappy behemoth without any actual improvements.

Quote of the Day

A successful [software] tool is one that was used to do something undreamed of by its author. —S. C. Johnson

Fowler Bliki

Martin Fowler, author of Refactoring and Analysis Patterns has started a blog-wiki hybrid.

Wednesday, May 21, 2003

Cortland

Two new cartoons from Matt Johnson continue the Mac Wars.

Destructors, Finalizers, and Synchronization

A new paper from Boehm.

Mojo Mail

There’s a new version of Mojo Mail out, but my copies are so thoroughly modified that it will be a while before I get around to upgrading.

Depressing

Buzz Andersen, John Gruber, Chris Nandor, Ryan Wilcox, and others are saying that Apple should fix bugs in OS X before adding features. I find the fact that these people agree with me on this strangely depressing. Since I tend to be hyper-sensitive about these issues, I’ve had a lingering hope that the problems weren’t really that bad. It’s fading.

Matt Deatherage’s column in the June Macworld posits that the OS X migration is going slowly because of NeXT hubris. On the face of it, this seems impossible. Are the Apple menu, pop-up windows, and all the rest really that big a deal? I’ve written type and creator good, file extensions bad more times than I care to remember, yet I’m sitting here using OS X. Others have yet to switch (it’s more of a switch than an upgrade), and yet most of them probably have no idea what HFS metadata is.

Maybe all the changes and bugs add up to a death of a thousand strings, altering the gestalt of the system. Or maybe late adopters aren’t switching because they don’t want to upgrade all their software and buy not-so-speedy new hardware just to make OS X’s speed tolerable. Whatever the reason, the transition is going slowly. Accelerating it is probably the best thing Apple can do for itself, its developers, and ultimately its users.

Quote of the Day

I don’t think any of us can really predict exactly how [new intellectual property systems] will work, but I do think that any model which fundamentally prevents people getting something they want is going to fail. We shouldn’t be trying to prevent copying, just trying to make sure that the creator of the copyright gets something for his or her work when it happens. —Douglas Adams

Monday, May 19, 2003

Google and Blogs

Dave Winer:

Somehow, in a perfect world, Orlowski reasoned, Google would remember not only that the Times had used the term first, but that somehow the Times is more important than weblogs. Pfui. The Times can’t possibly be a factor in Google searches for the simple reason that the Times archive is not accessible to Google. It’s behind a for-pay firewall.

Quote of the Day

For every problem there is one solution which is simple, neat, and wrong. —H. L. Mencken

Sunday, May 18, 2003

Shell

There’s some discussion on Erik Barzeski’s blog about shell aliases and tricks.

Top 10 Things I Hate About Star Trek

Lee Bennett pointed me to this hi-larious article. I love the Firefly reference, but although the sentiment is correct the quotation is not. The example scene did not actually involve the captain; rather it was about who would be in charge in his absence. Better examples would have been shooting Dobson in Serenity, the engine scene in The Train Job, and the airlock scene in Ariel.

Cortland

Matt Johnson has a new Cortland cartoon out.

Heaps

Apple:

CFBinaryHeap implements a container that stores values sorted using a binary search algorithm.

Really?

Macros

Donovan Kolbly:

This work presents several new approaches to the construction of extensible languages, and is the first system to combine local, dynamically extensible context-free syntax with the expressive power of meta-level procedures. The unifying theme of our system is that meaning should be computed relative to local context.

The Lessons of Zelda

I don’t think I’ve played Zelda since the 80s, but this list from Matt Gemmell is still amusing.

Registers vs. Stacks for Interpreter Design

Dan Sugalski:

Still, it ought to be fairly obvious that register machines aren’t the vile and horrible things people make them out to be.

The Cognitive Style of PowerPoint

Edward Tufte (via Phil Greenspun):

Alas, slideware often reduces the analytical quality of presentations. In particular, the popular PowerPoint templates (ready-made designs) usually weaken verbal and spatial reasoning, and almost always corrupt statistical analysis.

Narrative

Narrative is “a Mac OS X native plotting framework written with the Cocoa API.”

Networking Frameworks Comparison

Stepwise:

With network capabilities required by so many applications, Cocoa developers often wonder why Apple doesn’t provide a complete Objective-C solution for network programming. While it’s possible, and often practical, to the C sockets interface in Objective-C code, it doesn’t provide the ease of use Cocoa developers expect. Fortunately, there are many third-party open-source solutions available.

Click-through Again

John Gruber:

The details do matter, at least on the Mac OS, the entire success of which is based on getting small details right. Pervasive click-through leads to usability paper cuts. That it’s possible never to get such a paper cut—by taking care always to click carefully in background windows—does not mean this isn’t a usability problem.

XRA

Michael McCracken has released some code for a “ubiquitous text watcher that integrates with the Cocoa text system and does interesting things with what it sees.” He also notes that the new version of OmniAppKit includes the code for the flashy OmniGraffle 3 palettes.

Mac OS X Advanced Development Techniques

Steven Frank and Buzz Andersen like this new book by Joe Zobkiw. I’m not really a fan of it, though.

The book begins by repeating the annoying assertion that “The Cocoa application environment is the native Mac OS X development environment” (page 14).

Page 17 exhorts you to “read Apple’s Human Interface Guidelines and practice them,” but on page 40 the book directs you to create a metal application that has no business being metal, and page 61 includes a hideous example of excessive group boxes.

Page 22 demonstrates scalar accessor methods by…creating an infinite loop.

Page 56 characterizes Cocoa’s reference counting system as a “big gotcha.” It doesn’t explain retaining and releasing particularly well, nor does it link to more comprehensive coverage.

Page 63 uses the application controller’s +initialize method to set the application’s defaults if they have not already been set. It uses an integer where a boolean would be a better fit, and it creates NSNumber objects instead of just using -setInteger:forKey:. More seriously, the example probably should have used -registerDefaults: instead of actually setting the defaults.

Page 73 says “pop-up menu” when it means “contextual menu.”

In a great example of the book’s cursory coverage, page 126 recommends embedding frameworks in your application’s bundle without mentioning that the key to doing this is to use the magic @executable_path/../Frameworks string for the installation path. It merely tells you to use Project Builder’s stationery, which is pre-configured for the framework being in the Library folder.

Pages 143 and 158–160 use CFPreferences (and other Core Foundation stuff) rather than NSUserDefaults (and other Cocoa stuff) in a Cocoa example without explaining why.

Page 155 says to give your .prefPane package a custom icon by copying from the .icns file’s Get Info window and pasting into the Get Info window of the .prefPane. First, this won’t work. You want to copy the contents of the .icns file, not its icon. Second, you’d have to re-do this process after each clean build. It would be better to use Project Builder to set the icon using the Info.plist file. Now, maybe there’s some reason this doesn’t work with .prefPanes, but if this is the case the book should say so.

Page 163 says that status items “are intended to display hardware or network status/settings only. This is why you will see iChat and Airport[sic] but not Mail.app.” Now there’s a clear distinction.

Page 169 creates a menu using [[[NSMenu alloc] init] retain] and only releases it once, thus leaking it.

The Threads chapter is basically an introduction to what threads are. It doesn’t really talk about Cocoa thread-safety, and in fact the examples are thread-unsafe. Nor does it mention how to communicate between different threads.

The Terminal (NSTask) chapter doesn’t really add anything beyond Apple’s documentation and sample code. It doesn’t discuss buffering issues, which are probably the biggest gotcha here. It’s also not a good example to emulate: it uses polling, it doesn’t protect a shared variable with locks, and it calls the AppKit from a child thread. For some unknown reason, all of the threads end with calls to [NSThread exit], even though the book ascribes no benefit to this practice.

The XML-RPC chapter has some information that’s not in other Mac books to my knowledge. However, it contains this confusing bit of code:


// Add the users choices to the dictionary to be passed as parameters

params = [NSMutableDictionary dictionaryWithCapacity:2];

[params setObject:selectedProduct forKey:selectedProduct];

[params setObject:selectedColor forKey:selectedColor];



// Create the array to specify the order of the parameter values

paramsOrder = [NSArray arrayWithObjects:selectedProduct, selectedColor, nil];

I would have made the keys and array elements string constants like @"ProductColor" and @"ProductProduct". Not only does that make the intent clearer, but it won’t fail if a color and a product have the same name.

And the next page goes on to release params and paramsOrder both of which were already autoreleased. The subsequent SOAP chapter does use readable string keys, but it has the same over-releasing bug.

Page 298 promises to help find “Application Support Directories,” but apparently the “Application Support” folder isn’t one of them. It would have been better to provide some alias-savvy code for locating and creating the application’s folder in ~/Library/Application Support.

Page 300 uses NSOKButton instead of NSAlertDefaultReturn. Luckily, the constants have the same value so the code does work.

Page 301 again over-retains an NSMenu.

Although there are a lot of errors (and more typos) in this book, I sympathize. It’s tough to get all the details right, and many technical books do no better. However, my larger concerns are the choice of topics and the depth of coverage.

Don’t let the title fool you. This is not an advanced book, nor is it about techniques. Instead, it’s a guided tour through some example projects that are off the beaten path. Many of them are covered in other books and articles, but some are not. Thus, it’s great that this book exists, but it will not be of interest to everyone. The advanced book I was hoping to find, would cover things like AppleScript, inter-thread communication and threaded application architectures, application code structure, databases and persistence, AppKit gotchas, third-party libraries and wrappers, medium- and lower-level networking, Quartz tricks, and optimization.

The book’s coverage is wide and shallow. It’s based around a series of examples, and it’s wont to show a simple code example and then paraphrase the code in prose. As a result, in many cases I felt it didn’t add much value over Apple’s documentation and sample code. I would have liked to see less focus on what and more on why. Also, if a book is based around examples, I would expect them to exhibit best practice techniques. In contrast, Bill Cheeseman’s Cocoa Recipes manages to use an example-driven style without ignoring the rationales, subtleties, and gotchas.

Cocoa Programming by Anguish, Buck, and Yacktman is both wider and deeper than this book. Not only does it have great introductory material (for those who know how to program but don’t know Cocoa), but it also contains a lot more advanced information. Every Cocoa programmer should own this book. Its only significant flaw is ignoring AppleScript—as do all the other Cocoa books I’ve seen.

Mac OS X Advanced Development Techniques does contain chapters on Carbon and Cocoa plug-ins and on XML-RPC and SOAP. I don’t know of other books that cover these, but Apple (see preceding links) and O’Reilly have already done a decent job.

I hope someone will step in and write a truly advanced book about Mac OS X programming. Until then, I recommend Apple and Omni’s mailing lists, Mulle kybernetiK, O’Reilly, Stepwise, and developer blogs.

Saturday was Beautiful

2003-05-18-red-tree-1.jpg 2003-05-18-red-tree-2.jpg
2003-05-18-field.jpg 2003-05-18-pond.jpg

FairPlay

Buzz Andersen has done some more reverse engineering of Apple’s DRM. He found the QuickTime atom where the DRM information is stored, but wasn’t able to play the file after removing it. Code is included.

SQLite 2.8.1

SQLite now supports in-memory databases, attaching other databases as tables in the current database, and compacting.

Quote of the Day

An adventure is a sign of incompetence; everything you add to an explorer’s heroism you have to subtract from his competence. —Vilhjalmur Stefanson

Friday, May 9, 2003

Switch

Tim Bray:

It was about a year ago that, after a decade or so of Windows on my client and Unix/Linux on my servers, I bought a TiBook and got into OS X. I am only rarely tempted to go back. It’s worth it, I think, to look back over the past year and see what the take-aways are.

Celtics

I’m listening to the Celtics getting spanked tonight, but today will be a good day even if they lose. Danny Ainge has been named head of basketball operations. Ainge was a great player, has management experience, and, most importantly, seems to have a clue about the current team’s problems. I’m glad he seems to hold no grudge after being traded to Sacramento and having his number given to Rick Fox.

Ralston

Wow.

Quote of the Day

Joe [Klein]’s getting plastic surgery right now. It’s all right. He needed a little plastic surgery.Danny Ainge

Wednesday, May 7, 2003

ITMS XML

Tristan Louis has done some more reverse-engineering of the Apple Music Store.

Back Dating

Jon Gales alleges that MacNN back dates some of its stories.

AAC Again

Gunnar Van Vliet compares the quality of MP3 and AAC at different bit rates (via Gary Robinson).

CPS

Dan Sugalski:

The cool thing about using a CPS for function calls is that it makes taking a continuation much, much easier. When taking a continuation, you only have to take a snapshot of the current function/sub’s lexicals and control stack—you don’t have to care at all about the function’s caller, or the whole stack or anything.

Click-through

John Gruber:

In short, with Windows-style pervasive click-through, you need to click very carefully if your intention is merely bring a window from the back to the front.…Better is a default policy where click-through is off by default, and enabled only for exceptions where there is little or no downside when click-through isn’t intended.

Quote of the Day

I got theories with this woman, this Joumana Kidd who wants to be a star, wants to be a TV star. She wants face time on camera. The great way to get face time is to bring the cute, precocious kid. Oh, great. I’d like to smack her. —Bob Ryan

More or less he needs to apologize to Joumana. To take somebody’s livelihood away for comments…. You know, everybody makes mistakes. —Jason Kidd

Tuesday, May 6, 2003

Plurality and Conjunction

Kai von Fintel links to a new paper:

The main claims are that plural/mass denotations are built in stages within the DP, by the combined effect of number features and semantic operators associated with functional heads; that languages differ in whether the denotation of nouns is filtered for singular or plural number, and that the word and crosslinguistically denotes SET PRODUCT, an operation which, in different contexts, can mimic the behavior of intersection and union.

Hackers and Painters

Paul Graham has a new essay about hacking and painting. He likens agile methodologies to sketching, static and dynamic typing to pens and pencils, and says that he likes debugging. I think debugging is probably more scientific than anything in computer science.

iTunes Man

Slashdot has a great parody of “Piano Man” (via Daniel Sandler). If you’re familiar with the original lyrics, you’ll notice some cute details: “worried about MP3s” (cf. “someplace that he’d rather be) and “downloading Dixie Chicks” (cf. “practicing politics”).

Quote of the Day

I am, as I’ve said, merely competent. But in an age of incompetence, that makes me extraordinary. -Billy Joel

Sunday, May 4, 2003

PyObjC 0.9

PyObjC, the Python–Objective-C bridge, has been updated to 0.9. The most interesting change in this version seems to be:

Support for libFFI—gcc’s Foreign Function Interface—has been added. This reduces the size of the PyObjC module’s binaries from 1MB to 300K while also providing the ability to message any Objective-C method, regardless of whether its signature happens to have been declared in the Foundation or AppKit headers.

Quote of the Day

Python is executable pseudocode. —Bruce Eckel

Saturday, May 3, 2003

Coroutines

Dan Sugalski has posted another good introductory article, this time on coroutines. He’s got a great series going here. I only wish he would list some references at the end.

AAC

My brother did some listening tests with AAC at different bit rates. He found that AAC at 192 kbps was indistinguishable from AIFF with his setup, but that 128 kbps (which ITMS uses) was noticeably worse, though better than MP3. As a result, I don’t think I’m going to bother re-ripping my 224 kbps MP3s in AAC.

A Course in Universal Algebra

One of Springer-Verlag’s old graduate texts is now online (via Kai Von Fintel). They’ve re-paginated it for US Letter and get bonus points for using a good LaTeX-to-PDF converter, so that the PDF is searchable and looks good on screen.

Unifying Tables, Objects and Documents

Erik Meijer and Wolfram Schulte:

This paper proposes a number of type-system and language extensions to natively support relational and hierarchical data within a statically typed object-oriented setting. In our approach SQL tables and XML documents become first class citizens that benefit from the full range of features available in a modern programming language like C# or Java. This allows objects, tables and documents to be constructed, loaded, passed, transformed, updated, and queried in a unified and type-safe manner.

CD Labels

Is there a program like Discus—but better? A lot of people say it’s better than the others, which would be truly sad. I tried to use the demo a few days ago and it seemed unbelievably clumsy. I couldn’t control the formatting of the track names, and there wasn’t even a command for centering text boxes. The interface uses weird cross-platform controls that remind me of the Squeak demo I saw a few years ago.

I ended up making my labels in FrameMaker instead. I don’t really recommend doing layout-type stuff in FrameMaker, but it has good table support and I’m very comfortable with its stylesheet interface.

rsync

Mike Bombich has written a tutorial on using rsync over ssh (via Mark Pilgrim). This is an amazing combination. I can change a few files locally and synchronize (or, as purists would say, reconcile) the entire ATPM Web site (10K files) with the server in a few seconds. This is my favorite example of something that Mac OS X can do right out of the box, but that was hard even with third-party software on OS 9.

SM2DGraphView 1.0

SM2DGraphView is a framework drawing graphs. I haven’t figured out why it uses arrays of NSStrings instead of NSValues.

httpflow

Bill Bumgarner and Ben Holt wrote some code for looking at HTTP sessions.

Even More Apple Music

ATPM 9.05

Early Friday morning we released the May issue of ATPM.

Quote of the Day

Listen. Strange women lying in ponds distributing swords is no basis for a system of government.Monty Python and the Holy Grail

Interface Criticisms

John Gruber rightly blasts Safari’s use of click-through. And Erik Barzeski voices some of my criticisms about drawers. There are only two drawers that I recall liking: the pages/thumbnails drawer in Preview and the Preview drawer in Path Finder. Apple’s guidelines for using drawers are vague.

Use drawers only for controls that need to be accessed fairly frequently but that don’t need to be visible all the time. (Contrast this criterion with a utility window, which should be visible and available whenever its main window is in the top layer.)

Huh? Utility windows aren’t visible all the time, either, because you can hide them. So where is the guideline that tells me when to use a drawer rather than a utility window? Presumably we should learn by example:

Some examples of uses of drawers include access to favorites lists, the Mailbox drawer (in the Mail application), or browser bookmarks.

In my experience, favorites and bookmarks work much better in separate windows, because of width issues. I’ve used programs that put the mailbox list in panes, and others that put it in a separate window. Both worked better than Mail’s drawer, which isn’t even in the keyboard loop.

A drawer’s contents should be included in the window components that the user can select by pressing Tab.

I think the key difference between a utility window and a drawer is that you never have more than one copy of a given utility window on screen at a time. So you would use a drawer when you want to be able to see two drawers at a time. For instance, Transmit uses drawers to show FTP transcripts. That’s potentially useful. But I’d still prefer separate windows because I probably don’t want the width of the transcript to be the same as the width of the connection window. And I might want to view a full screenful of the transcript next to a screen-high connection window.