The Quality Without A Name

2006/11/22

Cocoa Programming Notes

Filed under: Uncategorized — mayoff @ 7:14 pm

It appears to be perfectly acceptable to set an NSArrayController’s content object to an NSSet. For example:

NSSet* symbolSet = [stockMarket symbolSet];
[symbolListController setContent:symbolSet];

On a related note, suppose your NSArrayController’s content is a set (or array) of NSStrings, and you want it to sort those strings by their values. You have to give the controller an NSSortDescriptor, and an NSSortDescriptor requires a key path specifying a property of the controlled objects. But in this case you don’t want to sort by a property, you want to sort by the objects (NSStrings) themselves. It turns out that NSObject has a method, -(id)self, which returns self. So you can specify @"self" as the key path, like this:

NSSortDescriptor* sd = [[[NSSortDescriptor alloc]
    initWithKey:@"self" ascending:YES] autorelease];
[symbolListController setSortDescriptors:
    [NSArray arrayWithObject:sd]];

Note that specifying nil or @"" as the key path will not work.

2006/11/11

Impressive speed from the V640

Filed under: Uncategorized — mayoff @ 11:04 pm

According to Speakeasy’s speed test, I’m getting over 1200 kbps download speed (and over 120 kbps upload) using the Verizon V640 ExpressCard. I love technology!

2006/11/08

Parallels + Windows XP from Virtual PC

Filed under: Uncategorized — mayoff @ 11:38 pm

I have a copy of “Microsoft Virtual PC for Mac Version 7 with Windows XP Professional” that I used on my PowerBook. Now I’ve got a MacBook Pro, which Virtual PC doesn’t support and I’d rather use Parallels anyway.

This page describes how to make a bootable Windows XP installation CD from the Virtual PC installation CDs. I did that under Virtual PC on the old PowerBook. Virtual PC couldn’t burn the CD, so I copied the ISO to a shared folder and burned it using Disk Utility.

Then I tried to use it in Parallels. Parallels said, “No boot device available, press Enter to continue”. I modified the Parallels virtual machine configuration so that the CD-ROM was on IDE 0:0 and the hard disk was on IDE 1:0. That allowed the Parallels VM to find and boot the CD.

Booting from the install CD gets a bootable second-stage installer copied to the hard drive. Then the VM reboots. This happens quickly and silently in Parallels, so I ended up back in the first-stage installer again without noticing (I’d put the CD first in the boot order). I changed the CD to last in the boot order and got the “No boot device available” message again. So I changed the hard disk back to IDE 0:0 and the VM booted the second-stage installer.

I encountered no other problems after that. I was able to activate Windows XP inside the Parallels VM with no trouble (even though I’ve activated it under Virtual PC in the past).

MacBook Pro + V640 ExpressCard

Filed under: Uncategorized — mayoff @ 7:51 pm

I bought a V620 EVDO card from Verizon months ago to use with my PowerBook. Now that I’m on a MacBook Pro that card is useless because the MBP has an ExpressCard/34 slot instead of a PC Card slot.

Verizon sells the V640 ExpressCard, so I decided to buy one. Of course I wanted to transfer my existing service to the new card rather than get a new contract. I ended up having to go to the Verizon Wireless kiosk at the mall; I couldn’t manage to order one online or by phone without getting a new contract. Total cost: nigh $350. $299.99 for the card, plus tax, plus a $20 fee to “change handsets”. Pretty steep, but the ~18 months left on my contract would go to waste without the new card.

So the card arrived this morning by Fedex. I put it in the MBP, which recognized it, gave me a nice menu bar extra for it, and asked if I wanted to activate it, which I did. Unfortunately the activation didn’t work, presumably because my old card was still activated. I tried to activate the new card at verizonwireless.com but it didn’t work and told me to call an 800 number. So I called the 800 number and was able to activate the new card that way. Actually I had to give them the card’s ESN over the phone, and then the MBP activated the card.

Other than that, it works great – better than the V620 did. The V620 wasn’t supported by Apple and required a small hack to get working, and didn’t give me the nice menu bar extra showing the single strength. The V640 requires no hacks and just works.

Blog at WordPress.com.