Archive for the 'Documentation' Category

Apple Bug Friday! 74

Friday, February 22nd, 2008

This bug is Typo in syslogd(8) manpage. It was filed on 2008-01-19 at 15:41 PST.

(more...)

Apple Bug Friday! 73

Friday, February 8th, 2008

This bug is ASL_QUERY_OP_REGEX should be a modifier, not an operator. It was filed on 2008-01-18 at 23:27 PST.

(more...)

Report-an-Apple-Bug Friday! 71

Friday, January 18th, 2008

This bug is Description of ASL_OPT_NO_DELAY is unclear. It was filed on 2008-01-18 at 17:34 PST.

(more...)

How to create a RAM disk with the contents of a disk image preloaded

Friday, January 11th, 2008
  1. hdiutil attach -nomount ram://num_sectors

    One sector is 512 bytes. The output of this command is a BSD device path, such as “/dev/disk3”.

    This is the same step 1 as the usual process.

  2. hdiutil attach -nomount path/to/image

    For example, hdiutil attach -nomount Disk\ Images/Adium_1.2.dmg

    The output for a typical disk image is rather longer:

    /dev/disk4              Apple_partition_scheme         
    /dev/disk4s1            Apple_partition_map            
    /dev/disk4s2            Apple_HFS                      

    You want the Apple_HFS one—in this case, /dev/disk4s2.

  3. dd if=disk_image_device_path of=ram_disk_device_path

    Continuing our example: dd if=/dev/disk4s2 of=/dev/disk3

    This copies the bytes from one device to the other. Be very careful which paths you input! You can overwrite your hard disk if you specify the wrong number! The safest way is to assemble the command in a text editor first, then paste it into your terminal.

  4. diskutil mount disk3

    You should see the volume from the disk image mount in Finder—only this time, it will be writable (most disk images, of course, aren't). That's because this volume is not actually the original disk image; it's the RAM disk, with the disk image's contents in it.

  5. diskutil eject disk4

    This is just clean-up. You don't need the original disk image attached anymore, so now you eject it.

    You can use hdiutil detach instead of diskutil eject, with the same device path as its argument.

Report-an-Apple-Bug Friday! 70

Friday, September 14th, 2007

This bug is Borken implementation of -setNilValueForKey: in Model Object Impl Guide. It was filed on 2007-09-14 at 12:24 PDT.

(more...)

Apple Bug Friday! 69

Friday, August 31st, 2007

This bug is Member variable is not an Objective-C term. It was filed on 2007-08-10 at 12:13 PDT.

(more...)

Report-an-Apple-Bug Friday! 68

Friday, August 10th, 2007

This bug is Either you can use a sdef directly, or you cannot. It was filed on 2007-08-10 at 11:51 PDT.

(more...)

WWDC 2007 session videos are out

Monday, July 30th, 2007

If you attended WWDC, you can head over to ADC on iTunes and see what you missed.

Report-an-Apple-Bug Friday! 66

Friday, July 20th, 2007

This bug is File type of GIF files in UTI list is incorrect. It was filed on 2007-07-01 at 18:18 PDT.

(more...)

Apple Bug Friday! 65

Friday, July 6th, 2007

This bug is kIconServicesUpdateIfNeededFlag not documented. It was filed on 2007-05-25 at 02:02 PDT.

(more...)

Apple Bug Friday! 64

Friday, July 6th, 2007

This bug is kIconServicesNoBadgeFlag not documented. It was filed on 2007-05-25 at 02:00 PDT.

(more...)

Code signing: Not as new as you think

Tuesday, July 3rd, 2007

Code signing is new in Leopard, right?

Right?

No, actually; it's much older, as I found out while responding to a question on programming.reddit. In my results for a Google search that I did, I stumbled over a link to TN1176, which mentions the addition of code signing.

TN1176 is the release notes for Mac OS 9.

The technote doesn't actually say much. In fact, I can go ahead and quote it in full:

Apple Code Signing is a new technology in Mac OS 9 that allows applications, plug-ins, and content to be signed by developers. Apple Code Signing Certificates assure your customers of your identity and the integrity of your products. For more information, please see the Mac OS Security and Cryptography Web site.

That site's gone now, of course. Fortunately, the Wayback Machine saved a copy.

Screenshot of the icon for
Apple Verifier

Screenshot of the icon for
Apple Signer

The top link on that page is to the Security 2.0 SDK, which includes a lot of stuff relating to code signing. There's a pair of utilities called Apple Signer and Apple Verifier, some API documentation, some sample code, some resource templates (remember those?), a library, and the debugging root certificate.

UPDATE 06:29: Apple Verifier actually comes with the OS, but Apple Signer is only available in the SDK.

If you've ever seen a 'sign' resource while hacking in ResEdit, now you know what it was.

Meet the new boss
Same as the old boss


Oh, and in case you're wondering what the Signer and Verifier applications look like:

This screenshot shows Apple Signer generating a signature for the SDK archive.
Signer at work.

This screenshot shows Apple Signer verifying the same signature.
Signer can also verify.

This screenshot shows the result of Apple Signer's verification of the signature.
Result of verification.

This is a screenshot of the Apple Signer window that shows the contents of a certificate.Same window, but for a root certificate.
These are the certificates from the verification. The root cert is the “Issuer's Certificate” for the other one.

This screenshot is of a dialog box that says “That application or control panel is not supported by Classic”.
This is why I didn't explain the difference between Apple Signer's Verify command and Apple Verifier: I don't know, because this message comes up when I try to launch Apple Verifier. And no, I don't know why the message comes up.

How to use Plot

Saturday, June 30th, 2007

Plot is a freeware plotting and graphing application for Mac OS X. It's good, but its documentation and UI are not very effective at explaining its most basic usage. I eventually figured out how to use it, but while it could have been much worse, it certainly wasn't obvious. So I'm going to give you the 60-second primer that I needed.

If you're not familiar with the basic concept of a graph: It's zero or more data points with x and y values, lain out in a graphical depiction mapping the x and y values to positions on the graph. Plot is an application that turns your data into a graph.

This is the graph window in Plot. This is a composite screenshot showing both a bar graph and a line chart.

Plot is organized around buffers. Each buffer is a set of data: zero or more points with x and y values, and x and y error-values.

Buffers are listed and managed in the Data Inspector window, wherein Plot indicates the current buffer with a ➽ character. You edit the contents of the current buffer in the Data View window, and you edit its parameters (most of which concern the graphic display of the data) in the Inspector window (not to be confused with the Data Inspector window).

A new document doesn't contain any buffers. You create buffers using the New Empty Buffer command in the File menu, or by importing data from various sources, including text files and MySQL databases. It even has a feature to automatically update the buffer from the database periodically, but I haven't tried it.

You can have as many buffers as you want, and you can change the order in the Data Inspector window, using the ▲ and ▼ buttons.

The Data View is fairly straightforward, but there is one gotcha: Double-clicking the X or Y column header switches the column between number values and date values. I have no idea why this isn't in a more obvious place instead; I actually threw away a document, thinking that it had become corrupted somehow, before I figured out later that double-clicking the column header is what tells the application to switch it.

Another pitfall: There's no “your document is unsaved” warning. You may want to unplug your keyboard so you don't hit ⌘W or ⌘Q by accident. ☺

The text file format is good if you want to store data independently of the Plot document (especially since Plot uses NSKeyedArchiver for its native file format). The text format is very simple: the first column is the x value, and the other column is the y value. Each record is one line. Each file is one buffer. You can import multiple buffers at a time, but you can only export one at a time.

To change the width of a bar in the bar graph, change the “symbolsize” in the Data Style pane of the Inspector. This is also used for the symbol rendering; unfortunately, there's no way to have both a symbol and a bar graph and have them be different sizes (or colors).

To assign text along the sides of the graph indicating what the axes represent, use the Axis Text field in the Axis pane of the Inspector.

To have a legend (most useful for multiple buffers), first assign each buffer a comment in the Data Inspector, then turn on Plot Legend in the Legend pane of the Inspector. To place the legend, either use the two fields there, or use the “move legend” tool in the Inspector (which you can also activate by pressing the L key in the graph window). The move legend tool allows you to set the position of the legend by dragging within the graph window.

Here's a bar graph generated in Plot looks like.

Here's the Plot document for the example graph used herein (compressed with bzip2).