Archive for March, 2006

Report-an-Apple-bug Friday! 16

Friday, March 31st, 2006

This feature request is iTunes should offer menu items to sort the selection. It was filed on 2006-03-31 at 23:35 PST.


Summary:

iTunes should allow [the user to specify — oops! —the Bored Zo] the order in which playlist items are stored in the playlist.

Steps to Reproduce:

  1. Right-click on a selection, or click in the Edit menu.
  2. In the ‘Sort by’ submenu, choose one of the criteria listed.

Expected Results:

The selected items are repositioned within the playlist (that is, the order in which they are stored changes).

Actual Results:

No results, because no such submenu exists.

Regression:

None known.

Notes:

iTunes does currently allow the user to change the order in which items are displayed by clicking a column header. But it offers no quick and easy way to sort items within the playlist itself (that is, to change the order in which the items are stored).

When a display sort (one of the column headers besides the far-left one) is selected, iTunes could run a dialog box: “The order in which the selected items are stored in the playlist was changed. The order in which they are displayed and will be played has not changed, because you have a different sort (^0) selected for display (in the column headers).” (^0 = name of selected column).


At 23:45, I added the following information:

Summary should read: iTunes should allow +the user to specify+ the order in which playlist items are stored in the playlist.

I had edited it and didn’t notice that I removed that part. Sorry.


Technorati tags: , .

How to evict __MyCompanyName__ from their office building

Tuesday, March 28th, 2006

UPDATE 2008-07-15: You no longer need to do this as of Xcode 3.1. Make sure you fill out your Address Book. (If you don’t want to use the company name on your Address Book “Me” card, then you do need to follow these instructions.) Thanks to BJ Homer for pointing this out in his comment.

Xcode comes with a number of document templates. You see the list of them when you choose File→New Document in Xcode. The templates are actually stored at /Library/Application Support/Apple/Developer Tools/File Templates. Most files contain a header comment that looks like this:

/*
 *  «FILENAME»
 *  «PROJECTNAME»
 *
 *  Created by «FULLUSERNAME» on «DATE».
 *  Copyright «YEAR» «ORGANIZATIONNAME». All rights reserved.
 *
 */

The problem is ORGANIZATIONNAME. This gets replaced with “__MyCompanyName__”, and there is no obvious way to change this other than by changing it every time (or by editing the templates, a solution that gets clobbered when you upgrade Xcode).

I was reading Step into Xcode, and found that on page 53, it gives instructions for defeating __MyCompanyName__. Here’s the important part, from the book:

defaults write com.apple.xcode PBXCustomTemplateMacroDefinitions '{ ORGANIZATIONNAME = "Joan Smith"; }'

This information is also available on this Xcode release notes page. It’s slightly inaccurate (__CompanyName__ rather than __MyCompanyName__) and well-buried, but it documents the same thing as the book.

Presumably, you could override any macro name or add your own using that default. But ORGANIZATIONNAME is the important one.

I debated about posting this here (publicly, rather than only privately to the Adium and Growl developer lists), because I got the info from the book. But I decided that it’s OK because (1) it is also documented by Apple and (2) it’s an example of the good info in this book. So here it is.

UPDATE 2007-04-07: Markus Magnuson sagely points out that you must relaunch Xcode after making this change. This really applies to any application whose prefs you plan on hand-modifying; Xcode is no exception. Thanks for the reminder. ☺

Free stuff on iTunes: 2006-03-28

Tuesday, March 28th, 2006

As usual, it’s video:

The Conviction pilot costs money now, BTW. But the feelies are still free.

Technorati tags: iTunes, iTunes Music Store, iTMS, iTunes Video Store, iTVS, Battlestar Galactica, Ghost Hunters.

A programming koan

Tuesday, March 28th, 2006

I considered how to rotate a raster image earlier today. Without doing any research into the subject, I wrote down my thoughts on it on a webpage, complete with images drawn in Photoshop. Feel free to answer the open-hanging question in the comments here.

Within epsilon of perfect

Monday, March 27th, 2006

(Title taken from my own assessment of my spelling.)

It’s been known for awhile that rather than directly comparing two floating-point numbers, you should instead subtract the larger from the smaller and compare the difference to some epsilon value. The reason for this is that two numbers might be very very similar, but not exactly equal. “Epsilon” in a mathematical sense means “minimum precision that you care about”. The epsilon value for money, for example, is usually 0.01 — differences lower than this are thrown away.

So of course I went scrounging in the headers, found macros named FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON, and recommended to all my programmer friends that they use these constants for comparisons of floating-point values rather than == and !=.

From time to time, facts just float up to the top of my head for no obvious reason. I have a sheet taped to my wall called “Word of the Day”; when a word pops into my head like this, completely unrelated to any previous thoughts, I write it down on that sheet to look up later. I consider this a more advanced (if slow) form of self-education. They might be long-forgotten memories, or something else; I don’t know, I just write them down and look them up.

About half an hour ago, this happened to me again. Except this time, the thought was definitely a memory, of something I’d read in float.h:

/* The difference between 1 and the least value greater than 1 that is
   representable in the given floating point type, b**1-p.  */

Another thought had bubbled up with this, and it was an epiphany: Technically, this means that the expression x != (x + FOO_EPSILON) should evaluate to 1. In other words, subtracting from FOO_EPSILON isn’t necessary.

So, as is my wont, I wrote a test app. Sure enough, that expression does evaluate to 1.

So forget what I said. x != y is directly equivalent to comparison against FOO_EPSILON, and it’s easier to read, too. So just use that.

Technorati tags: , .

Report-an-Apple-bug Friday! 15

Friday, March 24th, 2006

This bug is Terminal leaves files open when invoking shell directly. It was filed on 2006-03-24 at 23:45 PST.

UPDATE 2006-03-25: Uploaded the test app to GeoCities. Linked below.

UPDATE 2006-08-27: By GeoCities, I now mean boredzo.org. Link updated.


Summary:

When Terminal invokes a specific shell directly, rather than by invoking /usr/bin/login, several files are left open.

Steps to Reproduce:

  1. Launch Terminal.
  2. Terminal menu→Preferences….
  3. Select “Execute this command (specify complete path):”
  4. Specify the complete path.
  5. File menu→New Shell.
  6. Run the attached test app, or run ps and then run lsof with the pid of the shell.

Expected Results:

The test app prints “3”. lsof reports only three file descriptors: 0, 1, and 2, the respective FDs of stdin, stdout, and stderr.

Actual Results:

The test app prints “10”, “11”, “14”, or some other number. lsof reports a lot of open files having to do with Carbon (suggesting that the shell probably did not open them itself).

Regression:

None known.

Notes:

The test program creates and opens a file, and reports the FD it gets back from open. open returns the first FD that was available. In the absence of any other open files, this should be 3 (because that’s the FD after stdin, stdout, and stderr).

When I tested using test-app-free version of the above steps, I did observe that zsh 4.3.1 leaves open one file of its own (the terminal device). Perhaps it opens /dev/tty. This open file is not passed onto subprocesses, however, as is demonstrated by the test app.

Terminal (or Carbon) is responsible for all the other files that Terminal leaves open; this is obvious from the paths of the open files. Maybe login is closing them; in this case, Terminal should do this itself when the user chooses to bypass login.


Technorati tags: , .

Ah-HA!

Friday, March 24th, 2006

I found the problem that was preventing me from uploading things to my site at GeoCities. Turns out it was SurfRabbit, probably deleting some hidden input from the form.

Apologies to them for all the hate I’ve been putting on them lately. Soon I will be uploading the files that have been waiting for the problem to be resolved. This includes the attachments to several Radar reports.

Technorati tags: .

Report-an-Apple-bug Friday! 14

Friday, March 24th, 2006

This bug is Symbols listed in File Manager Reference, not defined in header. It was filed on 2006-03-24 at 23:00 PST.


Summary:

The File Manager Reference contains 394 symbols that are not actually defined in any current header.

Steps to Reproduce:

  1. Open the File Manager Reference.
  2. Scroll.
  3. Scroll.
  4. Scroll.
  5. Scroll.

Expected Results:

No signature and file-type constants are ever encountered, because no such constants are defined in the headers.

Actual Results:

You eventually arrive at 394 file type and signature constants, listed in eight sections in the Constants section.

Regression:

This wasn’t a problem back when these constants were actually defined.

Notes:

I constructed a header file from the header excerpts shown in the docs. It is attached.


Technorati tags: , .

A musing

Friday, March 24th, 2006
Bad dream:
You have fallen out of a plane and are hurtling toward the ground.
Good dream:
You are skydiving.
Middle-of-the-road dream:
You are still on the plane.

Report-an-Apple-bug Friday! 13

Friday, March 24th, 2006

This bug is IPA support in Speech Synthesis Manager. It was filed on 2006-03-24 at 00:36 PST.


Summary:

Speech Synthesis Manager does not support IPA (International Phonetic Alphabet).

Steps to Reproduce:

  1. Call a function such as CreateIPAStringFromString, which converts natural-language text into IPA.
  2. Call a function such as SpeakIPAString, which speaks the text represented in IPA aloud.

Expected Results:

CreateIPAStringFromString returns a CFString containing the IPA version of the text.

SpeakIPAString parses the IPA text in the CFString passed in, and speaks it.

Actual Results:

The program fails to compile because Speech Synthesis Manager has no such functions.

Regression:

None known.

Notes:

IPA is a standard alphabet for representing pronunciation. It has its own block in Unicode, making CFString a natural fit. Thus, this report extends #4489914, “Speech Managers do not support Unicode” [see Apple bug Friday! 12 —the Bored Zo].

IPA used in this context would be a substitute for the phoneme syntax currently used in Speech Synthesis Manager (specifically, TextToPhonemes and SpeakBuffer).


At 04:11, I added the following:

I should clarify that I simply made up the names CreateIPAStringFromString and SpeakIPAString. I am not under a belief that those functions are supposed to already exist. I’m requesting functions that do those things, whatever they end up named.


Technorati tags: , .

Apple bug Friday! 12

Friday, March 24th, 2006

This bug is Speech Managers do not support Unicode. It was filed on 2006-03-23 at 23:07 PST.


Summary:

Neither the Speech Synthesis Manager nor the Speech Recognition Manager has support for Unicode text (CFStrings).

Steps to Reproduce:

  1. Attempt to speak Unicode text using Speech Synthesis Manager.
  2. Attempt to receive Unicode text from the Speech Recognition Manager.

Expected Results:

The Unicode text is successfully spoken, and speech from the user is successfully received as Unicode text.

Actual Results:

No results, because it is impossible to write such an application. Neither Manager supports Unicode.

Regression:

None known.

Notes:

Since Mac OS X now has CFStrings, the Speech Managers should at the very least support using these for input and output, even if actual parsing and recognition are limited to ASCII or MacRoman.

This could be extended in a future version of Mac OS X, with better support for other languages and accents using a broader range of the Unicode character set. Hard, I know — it would be a major feature, not a relatively-minor API enhancement like simply supporting CFStrings. CFString support is simply a first step in that direction.


Technorati tags: , , .

Report-an-Apple-bug Friday! 8 (follow-up)

Thursday, March 23rd, 2006

I got a follow-up to Report-an-Apple-Bug-Friday! 8. I’ve HTMLized it, but otherwise it is unchanged.

This is a follow-up to Bug ID# 4481916. We have received the following update regarding your report:

Ray SAMPSON:

Engineering has determined this issue behaves as intended based on the following information:

Please know, EV_EOF is not to be set for just reaching the current end of a regular file. Otherwise, you could never wait for more data to arrive.

The flag indicates that no more data will ever be present to read – as when the sending end of a socket is closed. The closest thing for a regular file is when the containing filesystem is force-unmounted (which is when EV_EOF will be set for a regular file).

I’m satisfied. I put the following comment on the bug:

I suggest that this information be added to the manpage for kqueue, that EV_EOF does not get returned for a regular file unless the device containing the file disappears (along with any other circumstances that would cause that).

Thanks for the information.

Technorati tags: , .

New Cocoa docs!

Tuesday, March 21st, 2006

The Cocoa documentation was completely redesigned this month. Class docs are now whole sections, rather than a single page each, and each such section now has the same look and feel as a Carbon Manager’s docs. Check it out:

My favorite feature of the new design is that the class names are no longer in two columns. The two-column design was theoretically a good idea, because it meant that the page was shorter (which would ordinarily mean less scrolling), but bad in practice because it means you have to look in both columns to find a class (especially if its name is near the middle of the alphabet, like the NSMutableFoo classes are — there were some of those in each column in the old design).

You can copy these docs to your own machine by going to Xcode’s Preferences, Documentation pane, and clicking “Check Now”.

Technorati tags: ,

Free stuff on iTunes: 2006-03-21

Tuesday, March 21st, 2006

Two videos, no songs (aside from the SOTW — there isn’t even a Discovery Download this week, though):

Technorati tags: iTunes, iTunes Music Store, iTMS, iTunes Video Store, iTVS, NCAA, Basketball.

Hosting

Sunday, March 19th, 2006

So most of you probably know that I’m in the market for real hosting. I’ve identified two companies (a host and a domain registrar) that look suitable for my patronage.

If anybody has a better suggestion for either (or both) roles, please post in the comments. I need at least 100+ MiB of space (with room to grow, so call it at least 200) with Python and PHP support (I want to give self-hosted WordPress a try, and run some of my own things which will be written in Python).

Definitely do not recommend DreamHost. I’ve given up trying to get them to change their TOS.

UPDATE 2006-08-26 21:10 PDT: And it’s done. The blog is now on TextDrive+Active-Domain. ☺

Technorati tags: .

Report-an-Apple-bug Friday! 11

Friday, March 17th, 2006

This bug is -[NSMenu menuBarHeight] always returns 0.0f. It was filed on 2006-03-17 at 23:55.

UPDATE 2006-03-25: Uploaded test app to GeoCities.


Summary:

NSMenu‘s -menuBarHeight method always returns 0.0f. Even the main menu’s.

Steps to Reproduce:

  1. Call [[NSApp mainMenu] menuBarHeight].

Expected Results:

The method returns 22.0f.

Actual Results:

The method returns 0.0f.

Regression:

None known.

Notes:

Appearance Manager (in the form of the GetThemeMenuBarHeight function) and NSMenuView (in its +menuBarHeight method) both return 22.0f, the correct height of the menu bar under Tiger.

The documentation for +[NSMenuView menuBarHeight] recommends using -[NSMenu menuBarHeight] instead.

This method is superseded in Mac OS X v10.4 by the NSMenu menuBarHeight instance method.

Following this advice would break one’s app on 10.4.3 through 10.4.5 (the bug exists on 10.4.5 as well).

The bug works with any menu — the main menu isn’t the only one. It’s just the most obvious menu to call that method on.

Workarounds:

Use GetThemeMenuBarHeight or +[NSMenuView menuBarHeight].


Technorati tags: , .

Report-an-Apple-bug Friday! 10

Friday, March 17th, 2006

This bug is iTunes should have a “Free Downloads” section on other front pages. It was filed on 2006-03-17 at 21:19.


Summary:

iTunes Video Store front pages don’t have a “Free Downloads” section like the Music Store’s does.

Steps to Reproduce:

  1. Launch iTunes.
  2. If the Music Store source is not already selected, select it.
  3. Click on Movie Trailers, Music Videos, or TV Shows.
  4. Click on the background inside the Music Store view (to the right of the source list).
  5. Hit End.

Expected Results:

You see a “Free Downloads” section in the bottom-left corner.

Actual Results:

You don’t see a “Free Downloads” section in the bottom-left corner.

Regression:

None known.

Notes:

The Video Store (especially the TV Shows section) has had a number of free downloads lately, such as the free pilot and feelies for Conviction and the free “This is SportsCenter” commercials. There is no centralized place on any Video Store front pages where people can easily find these free downloads. One must look at all the values for the rotating poster views at the top of the page, and the non-rotating poster views in the middle of the page (below the first middle row).


And yes, this feature request does go toward making it easier for me to compile the “Free Stuff on iTunes” posts. ;)

Technorati tags: , , , , , , .

Report-an-Apple-bug Friday! 9

Friday, March 17th, 2006

This bug is Terminal should support xterm‘s 256-color mode. It was filed on 2006-03-17 at 20:44.


Summary:

xterm has a 256-color mode. Terminal should support it.

Steps to Reproduce:

  1. Launch Terminal.
  2. Run 256colors2.pl from the above website.

Expected Results:

Lots of pretty colors.

Actual Results:

Lots of backslashes and 16 pretty colors.

Regression:

None known.

Notes:

Some applications, including vim, look for TERM to be set to xterm-256color. Therefore, Terminal’s default should be changed to this if 256-color support is added.


Technorati tags: , .

How to eject a CD

Friday, March 17th, 2006

I posted this to IOMUG‘s mailing list on 2004-04-05. I’ve HTMLized it, added Unicode, and added Tiger info.


Here are all the ways to do it using Apple software (the OS and the programs that come with it). Note that all the same methods work for DVDs as well, so, if you have a DVD drive, you can read “CD/DVD” wherever you see “CD”. Unless otherwise noted, these all take place in Finder.

These require a CD in the drive.

  • Hold down the mouse button at startup.
  • Select the volume and press ⌘E, or choose Eject from the File or Special menu.
  • Drag the volume to the Trash (on Mac OS X, the Trash icon will change to an ⏏ icon).
  • Mac OS only: Select the volume and press ⌘Y, or choose Put Away from the File menu. This is the only way to unmount a server in Mac OS.
  • Mac OS 7.5 and later only: In the Control Strip, choose Eject from the Audio CD module (the one with a CD icon).
  • Mac OS 8 and later only: Right-click on the volume and click Eject.
  • Mac OS X only: Select the volume and click the ⏏/Eject button on the toolbar.
  • Panther only: Select the volume and click the ⏏ button in the sidebar. (Works in Navigation Services dialogs, too.)
  • Mac OS X only: From Disk Utility, select the volume and click the ⏏/Eject button on the toolbar.
  • Mac OS X only: From Disk Utility, select the volume and choose “Eject” from the File menu.
  • Mac OS X only: Press the Eject key on the keyboard. (Thanks, Andrew Wellington! Added 2006-03-18.)
  • Old Mac OS X only: From Terminal, type “disktool -e device”. (Thanks to Sören Nils “chucker” Kuklau for telling me about this one.)
  • Mac OS X only: From Terminal, type “diskutil eject device”. device is one of /dev/diskN”, “diskN”, or “/Volumes/Name”. Use diskutil list to determine an appropriate value of N. (Thanks to Graham Booker for reminding me of diskutil.)

These do not require a CD in the drive if you have a tray-loading drive. In this case, the tray will open so you can put in a CD.

  • From Open Firmware, type “eject cd”. (Note: you can’t substitute “dvd” here. It must be “eject cd”, even if you have a DVD drive.)
  • Burners only: from Terminal, type “drutil tray eject -drive N”, where N is the number of your drive. You can use “drutil list” to determine the value of N.
  • Burners only: from Terminal, type “drutil eject -drive N”.
  • Press F12, or on *Books, press fn-F12. On Mac OS 9, you may need to add the ⌥ key, depending on your keyboard settings.
  • Mac OS X only: with the Eject MenuExtra enabled, choose “Eject ‘Volume Name’” or “Open/Close CD-ROM Drive” from the ⏏ menu.
  • In iTunes, click ⏏ on the iTunes window.
  • In iTunes, choose “Eject Disc” from the Controls menu.
  • In DVD Player, click ⏏ on the controller.
  • In DVD Player, choose “Eject” from the Controls menu. (May vary by version. What I said is true of 4.0, i.e. Panther’s DVD Player, and 4.6, i.e. Tiger’s DVD Player.)

* Mac OS is the OS before Mac OS X. The latest version of Mac OS is 9.2.2.

** You can enable this MenuExtra by opening /System/Library/CoreServices/Menu Extras/Eject.menu.

Troy Stephens is cool

Friday, March 17th, 2006

I emailed him early this morning about the fact that I wasn’t credited on the 0.9 release, which incorporates my patch. He has fixed the IconFamily webpage and will add me to the ReadMe for 0.9.2.

And when 0.9.2 comes out, I’ll check it into Adium, killing three of its deprecation warnings. Sweet! (I never applied my patch in Adium because my preference was for it to be applied in the master IconFamily source, and now it has been.)

Technorati tags: .