Thursday, August 18, 2005

Exotic OS X knowledge: unifying data and resource forks

Mac OS X 10.4.2 (Part 29)

I once spent a few days looking for a way to unify data and resource forks. I didn't come up with anything. So this Macintouch discussion really caught my attention:
I haven't tried this as I don't have any files on a FAT32 volume, but I believe that this technique should work. Obviously, don't throw out the component files until you've tested this solution.

1) Identify the files which are the actual resource and data forks. In Scott's case he seems to understand which is which.

2) Copy the data fork file onto an HFS volume. Let's assume that the copy will be called /Users/me/test.

3) Open the terminal app.

4) Here's the slightly tricky part. You can use the 'cp' command to copy into the resource fork directly. Assuming the resource fork's file name is

/Volumes/Fat32/file/resource.frk, use this command:
cp /Volumes/Fat32/file/resource.frk /Users/me/test/rsrc

Even though /Users/me/test is a file, not a directory, the syntax above is valid (on OS X, not other Unixes). Actually, I think as of Tiger, it's being deprecated in favor of a more extensible fork naming scheme (/Users/me/test/..namedfork/rsrc), but this still works and it's easier.

5) If you (or your applications) care, use a utility to set the new file's Creator and Type. If you're not sure what they are, just open the finder info file in a text editor- they ought to jump out at you. Alternatively, make a new data file with the relevant application, and copy the info from there. I'd probably do this step just to be sure, but most OS X apps don't care about this. The Finder won't care if the file extension is correct and unique. /Developer/Tools/SetFile is a command-line tool that will work, but there are zillions available, some for free.

File Buddy for OS X has some interesting features - creating packages

The most popular file utility for the Macintosh

This Macintouch reference suggests FB is worth a look:
Use some file-system tool (SkyTag's FileBuddy for instance) to tell the MacOS that a certain folder is actually a Package. If File-Names were not ruined in the copying process, and multi-fork resource-files were not part of the deal (they are quite rare these days), then this trick will work for you.

The following FileBuddy screenshot contains an "info" window for file-system objects. Note the "Package" checkbox. That's the one you'll need to set up for the folders that "forgot" they were packages.

Wednesday, August 17, 2005

Wi-Fi Protected Access: where Windows XP SP2 meets OS X

Setting up an encrypted wireless LAN with both Windows and OS X clients used to be very ugly. There was no implemented standard for WEP passphrases, so one had to work around cryptic hex keys. Well, at least if you're using XP SP2 and OS X 10.3.x or later the bad old days are history. Wi-Fi Protected Access (WPA) just works.

My AirPort Extreme is running WPA (my iBook doesn't seem to support WPA2, not sure if that's a Panther issue or a G3 issue). My XP SP2 laptop connecs using the same passphrase my Mac clients use. No problems at all. Apparently since May 2005 XP SP2 also supports WPA2.

This is so much better than WEP -- although I fear my aged iBook doesn't like the CPU burden ...

MacDevCenter.com: Automated Backups on Tiger Using rsync

MacDevCenter.com: Automated Backups on Tiger Using rsync

OS X Pages - A warm and fuzzy feeling

Apple - Support - Pages

I fired up my free trial vesion of OS X Pages (I'm keeping my Office trial in reserve until I really need Office -- if nothing happens in 6 months I'll remove it). I've no idea if it's any good, but there are some things that give me a warm and fuzzy feeling.

For one, the files are Packages. I opened one and found gzipped document, I opened that and found XML I could open in a text editor. Transparent file formats. Very good.

For another, I really liked the strong styles support and the elegant templates. How refreshing after Word's utterly bodged up style sheets and exceptionately ugly templates (Microsoft is clearly unwilling to hire anyone with taste).

Ok, so the first thing I got was a missing font error message. I know it's got to be as buggy as all get out. I'm still going to give it a try.

PS. It probably helps to know that "Pages are actually sections with section breaks." In other words, pages are document components with associated styles, a template is a set of such components. Once you know Pages are really "sections" (in Word parlance) then this document fills in the rest of the pieces (sections/Pages inherit from the currently selected section/Page):
If you want different parts of a document to have different margins, headers or footers, numbers of columns, master objects, or page-numbering schemes, you can divide the document into sections by inserting a section break. Section breaks are useful when dividing a document into distinct parts, such as title pages, chapters, and indices.

When you add a section break, the new section always starts on a new page.

To insert a section break:

1. Click where you want the new section to begin.

2. Choose Insert > Section Break.

The new section has the same formatting as the previous section until you change it...

To remove a section break, click at the beginning of the line that follows the break and press the Delete key.

Tip: You can see where breaks occur in your document by showing formatting characters (also called "invisibles"). To show formatting characters, choose View > Show Invisibles.

George's Macintosh Tips: a man after my own heart

These are his personal notes, made publicly available. All look interesting. A man after my own heart: George's Macintosh Tips.

His network assessment work is excellent. Note this surprising conclusion (which I think may be true for my home too):

The 802.11g standard supports data rates of up to 54 Mbits/sec. Again, the maximum achieved rates are usually half that. One would suppose that in normal usage, 802.11g would perform 5 times faster than 802.11b. However, my experience says that this isn't necessarily so. When dealing with my cable modem, 802.11g has worked WORSE for me than 802.11b.

Worse?? How can that be?? Both rates are much faster than my cable modem can support so that the wireless rate should not figure into internet related performance at all, however, it indeed does and in an unexpected way. I base my throughput data in this section on internet related speeds, not computer to computer speeds. Since we use relatively little computer to computer networking, getting the most out of the cable modem is the most important rate for us. If we have to move really large amounts of data, then we use firewire target disk mode instead which is 10 times faster than even 802.11g could promise.

Based on accumulated experience and a range of real world tests, I have concluded that, overall, the older standard of 802.11b actually works better than 802.11g in my particular network configuration and environment. Maybe 802.11g would work better with really strong signals, but at 2 and 3 bars on the Apple Airport menu bar icon, 802.11b produces consistently better data rates.

Why is my G3 iBook draining the battery so quickly?

I've a thread going on this at the Apple discussion site. My G3 iBook is sucking down my new battery. Recent changes include:

1. a new hard drive (15GB -> 40GB) with expert disassembly.
2. changed LAN encryption from WEP (pathetic) to WPA 1.
3. restored OS image using Carbon Copy Cloner.

Things I've tried include:

1. Reset PMU.
2. Zap PRAM.
3. Repair permissions (no problems, this never seems to work)
4. Deleted the .plist for power management.

Here's part of the recent thread. Comments welcome!
Apple - Discussions - Power drain after drive upgrade?

I did some research and the drive power demand increases typically measure out at about 2%. Sometimes newer faster drives consume less power than older slower drives!

I could imagine that Panther might have some trouble with optimizing sleep on some of the newer complex drives (which are really full-fledged computers with databases, operating systems, algorithms,etc) -- if I can't figure out anything else I'm going to upgrade the iBook to Tiger. (I hear it works pretty well if you disable Spotlight and maybe the widgets.)

More interestingly now I'm focusing on WPA wireless encryption. I changed my LAN's encrytpion from (so broken) WEP to WPA around the time of the drive switch. I notice the G3 iBook doesn't support WPA 2 (10.3.9, latest version AirPort) -- makes me wonder if there's a CPU math constraint that the G3 can't meet. That in turn makes me wonder how well the vector-less G3 actually does with WPA. If the CPU is churning that would increase heat, turn on fans, etc.

I'm going to install some tool for CPU resource utilization and study what's happening with WPA, the compare to WEP.
Update: this is a very interesting evaluation of encryption and performance, but not particularly looking at power consumption.

Update: Using OS X's monitor tool and the freeware (forget name) dashboard app I can see my iBook CPU is working quite hard to do web page access. I'm suspicious that WPA is a bit much for a 600MHz G3. Too bad -- since it works very well with XP SP2.