2006-03-31

Report-an-Apple-bug Friday! 16

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: ,

2006-03-28

How to evict __MyCompanyName__ from their office building

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.

Technorati tags: .

Free stuff on iTunes: 2006-03-28

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

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.

2006-03-27

Within epsilon of perfect

(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: , .

2006-03-25

Poking the RSS

The test apps have been uploaded for ABF 11 and ABF 15.

2006-03-24

Report-an-Apple-bug Friday! 15

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.


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!

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

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

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

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

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: , , .

2006-03-23

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

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:

<GMT23-Mar-2006 22:01:55GMT> 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: ,

2006-03-21

New Cocoa docs!

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

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.

2006-03-19

Hosting

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.

Technorati tags: .

2006-03-17

Report-an-Apple-bug Friday! 11

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

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

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

I posted this to IOMUG's mailing list on 2004-04-05. I've HTMLized it, upgraded the English to sentence-caps, 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.)
  • 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.


Technorati tags: .

Troy Stephens is cool

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: .

Report-an-Apple-bug Friday! 8

This bug is kevent does not return EV_EOF when an open regular file reaches EOF. It was filed on 2006-03-17 at 02:27.


Summary:

EVFILT_READ on a regular file never returns an event with the EV_EOF flag set.

Steps to Reproduce:

  1. Create a kqueue.
  2. Open a file for reading.
  3. Add a kevent description to the queue from step 1 with EVFILT_READ and the fd from step 2.
  4. Read until the end of file.
  5. Call kevent.

Expected Results:

The data member of the returned kevent structure has the EV_EOF bit set.

Actual Results:

The data member of the returned kevent structure never has the EV_EOF bit set, so if your app is expecting it, it keeps on polling forever and never closes the file.

Regression:

None known.

Notes:

I also tried calling read and kevent one more time (testing for feof behavior), but still did not get EV_EOF.

A test case is included.


(Note: GeoCities is being cranky today. The test case will be up eventually.)

Technorati tags: ,

Report-an-Apple-bug Friday! 7

So much for filing these earlier in the week. I spent the whole week pounding on the test cases.

This bug is kevent read events' .data is random when st_size > ULONG_MAX. It was filed on 2006-03-17 at 01:55.


Summary:

When the size of a regular file exceeds ULONG_MAX, the value of the event's data member can be truncated.

Steps to Reproduce:

  1. Create a kqueue.
  2. Open a file for reading.
  3. Add a kevent description to the queue from step 1 with EVFILT_READ and the fd from step 2.
  4. Poll the queue for events.

Expected Results:

The data member of the returned kevent structure, indicating the amount of data between the file's current position and the end of file, is capped to ULONG_MAX to work around truncation issues.

Actual Results:

The data member of the returned kevent structure, indicating the naked size of the file, may be truncated or appear negative.

Regression:

None known.

Notes:

The st_size member of struct stat is an off_t (a long long), which is 8 bytes. The data member of struct kevent is an intptr_t (a long), which is 4 bytes.

kevent appears to simply assign the .st_size value directly to event.data in all read events. This produces the exhibited effect: only the low 4 bytes are copied; the high 4 bytes are thrown away. If the .st_size value exceeds ULONG_MAX, then the resulting 4-byte value would appear random if you didn't know what was going on.

The other problem is that, unless I'm wrong about what a 'vnode' is, this behavior does not match the manpage's description:

EVFILT_READ

Takes a file descriptor as the identifier, and returns whenever there is data available to read. The behavior of the filter is slightly different depending on the descriptor type.

Vnodes
Returns when the file pointer is not at the end of file. data contains the offset from current position to end of file, and may be negative.

.data only contains the offset to the end of file when the open file's position is at the start of the file, since at that time, that value is equal to the length of the file.

.data should always contain the offset, unless that value exceeds ULONG_MAX, in which case it should be ULONG_MAX (that is to say, .data should be capped to ULONG_MAX).

Workarounds:

  • Don't use kevent.
  • Ignore event.data and only use results from fstat/read/fread.
  • Use mmap.

A test case is included.


(Note: GeoCities is being cranky today. The test case will be up eventually.)

Technorati tags: ,

About my grammar

Most of you are used to me not capitalizing the first letter of sentences. I'll still be this way on IRC, at least for a little while longer, but you should get used to seeing me capitalize. I've been doing this in the past couple days with my replies to emails sent to the Adium feedback list, and starting today I'll be doing it with other emails and blog posts too. I'll be doing it with everything eventually.

You know, I actually used to capitalize when I started on the internet. Guess I got lazy. Funny how things come full circle, huh?

2006-03-14

Free stuff on iTunes: 2006-03-14 (part 2)

I don't remember this being up before, and it's enough extra stuff that I think it merits an extra post. iTVS now has SportsCenter ads. they are 15 and 30 seconds, they are free, and they are not on the front page of iTMS.

there are apparently other commercials at the ESPN website. if you want more, you'll have to go there.

Technorati tags: , , , , , , .

Multi-pass implementation no longer sucks

multi-pass notification emails are clearer now about how you would go about getting the new episodes that are waiting for you. this is what they used to say:

The latest episode of The Daily Show is now available for you to download. Simply sign in to iTunes and it will begin downloading immediately.

… which, as I said before, is not the whole story. if you stay signed in all the time, like I do, you must sign out first.

then patr1ck suggested (in the comments on that post) that I try the “Check for Purchases” menu item in iTunes. that worked, and now Apple backs the same suggestion:

The latest episode of The Daily Show is now available for you to download. Click here and it will begin downloading immediately. You can also select 'Get Purchases' from the Advanced menu of iTunes.

the link, interestingly enough, appears to be equivalent to the “Check for Purchases” menu item. I get the idea that every feature of iTMS, even those features that don't appear in the iTunes window, can be expressed as some kind of URL.

and yes, the email gives the name of the menu item inaccurately, but it's a huge step up from where they were.

UPDATE 2006-03-16: they fixed it. it says “Check for Purchases...”, which is close enough. the actual title is “Check for Purchases…”, with the Unicode HORIZONTAL ELLIPSIS character instead of three FULL STOPs. (that's the correct way to write a menu item title, BTW, and it has been since the HIG were first written in 1984.)

Technorati tags: , , , , .

Free stuff on iTunes: 2006-03-14

nothing was up initially, but there's now one free item on iTMS that's not listed on the front page. as usual, it's a video: NASCAR Daytona 500 Preview.

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

Season pass (or not)

iTunes added “season passes”. it's mentioned on the iTVS page, as well as on the front page of the TV Shows section.

Screenshot of the top-right corner of the iTVS front page, showing a poster link to the NASCAR section, with the caption “Season Pass Just Added”.

ah, but it doesn't work. there are two three episodes there, and they total $4. the price of a season is $25. not much of a discount, hm?

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

2006-03-13

Minor update to “Hello Worlds”

Augie “durin42” Fackler and Colin Barrett contributed some info worth adding to “Hello Worlds, cut four ways.

durin42 complained that he doesn't like multiple return statements in a function. the version shown in the page under his name is what I showed him as an alternative, and he approved. I then came up with a third implementation based on the second.

Colin pointed out a couple of reasons why the Shortest Possible Hello World was not, in fact, the Shortest Possible Hello World. I fixed 'em both, and there should be no further ways to make it shorter.

with this update, the version on the page becomes 0.2. thanks to both of you for the pointers. ☺

2006-03-12

I hate spammers

you may remember that I have comment moderation turned on, to fight spam. when a comment comes in (as usually happens after a new post, because new posts appear on the front page and the spammers watch it), it gets sent to me by email, and if it's spam, I reject it.

today, I got two moderation requests (for spam comments) in my email, followed by two email notices that those comments had been PUBLISHED!

take a look at Even More Hello Worlds. there they are. I deleted them, of course.

can anybody suggest a blog host other than Blogger or WordPress.com?

Technorati tags: Blogger, spam.

2006-03-11

Even more Hello Worlds

I posted something similar before: The worst possible Hello World. in that post, I presented a completely awful implementation of Hello World, which I wrote to disprove the notion that more lines of code == more productive coder.

I got to thinking about it yesterday, and decided that a new post was in order because a 50-line Hello World probably won't look like much to a non-coder (e.g. boss) without some point of reference. so I wrote a webpage on the topic: Hello World, cut four ways. I present four different Hello Worlds (including the original Worst Possible Hello World), and explain why the first three are bad and the last one is the Best Possible Hello World.

Technorati tags: , .

Regarding Apple Bug Friday

I've developed quite a backlog of bugs and feature requests to file. so I'm going to do ABF differently, at least for awhile.

you're used to seeing my ABF posts titled “Report-an-Apple-bug Friday! N” (for N = 1–∞). henceforth, a post so titled means that the bug was filed with Apple that day (which is consistent with all my ABFs so far). but, starting today, I'll also file bugs on days other than Friday, so as to whittle down my backlog and give Apple that much extra lead time to fix these. blog posts for such bug reports will be titled “Apple bug Friday! N”. this tells you that the bug was filed previously, and is only now being blogged because today is a Friday.

the “Apple bug Friday!” posts will come at a rate of one per week, except when two or more bugs are similar (for example, I have a couple of kevent bugs to report that will be doubled up on next Friday). and if I find a new bug, and it happens to be on a Friday, I'll do another “Report-an-Apple-bug Friday!” post.

2006-03-10

Report-an-Apple-bug Friday! 6

part two of a two-fer. I did this one with proper capitals because the last paragraph was pretty long and I couldn't think of a good way to break it up. the capitals were my second-choice clean-up method.

this bug is iTunes provides no UI for downloading a new episode on a multi-pass.

UPDATE 2006-03-11: Simone Manganelli mentioned in the comments that I failed to mention that you can Check for Purchases to get new updates (see Multi-pass implementation sucks). everything he said there is correct. mea culpa. :)

I also noticed when I went to edit this that I did not link to the bug report. oops. fixed.

UPDATE 2006-03-14: somebody has put “ITMS: ” in front of the bug's title.


Summary:

iTunes needs to provide explicit UI for downloading new episodes of The Daily Show or The Colbert Report.

Steps to Reproduce:

  1. Receive the email notification that a new episode is available.
  2. Launch iTunes.

Expected Results:

one or more of:

  1. iTunes presents a dialog box that you have episodes waiting to be downloaded, offering to add them to your shopping cart if that is enabled, offering to download them immediately otherwise.
  2. iTunes presents a Growl notification that you have episodes waiting to be downloaded. (OK, so I wasn't expecting it, but it would be nice. :)
  3. The iTunes Music Store offers a section listing episodes you haven't downloaded yet. Perhaps on the Account Information page, being that the notification email tells you to "sign in". If you try to do this while already signed in, you go to the Account Information page.

Actual Results:

You must sign out and then sign in again to receive the new episode(s).

Regression:

None known.

Notes:

At the very least, the email should point out that you must sign out before signing in if you are already signed in (because signing in does work when you are already signed in, and it has a different result that doesn't include checking for new multi-pass episodes).

Even better would be a clearer, more explicit UI for checking for and downloading multi-pass episodes. Such UI should include the shopping cart if it is turned on. Though a multi-pass is similar in operation to a podcast, it is not present in the Podcasts source at all; it is, instead, in the Music Store, so multi-pass downloads should behave as any other Music Store download, i.e. go through the shopping cart.


Technorati tags: ,

Report-an-Apple-bug Friday! 5

part one of a two-fer.

this bug is The Daily Show and The Colbert Report not listed among iTunes TV Shows.

UPDATE 2006-03-11: forgot to link to the bug report. oops. fixed.


Summary:

in iTunes' Browse view, The Daily Show and The Colbert Report are not listed.

Steps to Reproduce:

  1. click on Music Store. you do not need to load the front page; if you don't want to, click (x).
  2. click Browse.
  3. click TV Shows.

Expected Results:

The Daily Show is listed between Conviction and Desperate Housewives. The Colbert Report is listed between The Biggest Loser and Comedy Central Stand-Up.

Actual Results:

neither The Daily Show nor The Colbert Report is anywhere in the list.

Regression:

none known.

Notes:

rdar://4407769 is a previous instance of missing TV shows.


Technorati tags: ,

2006-03-09

Multi-pass implementation sucks

so I bought a multi-pass for The Daily Show last night. I was waiting all last night for iTunes to give me a dialog box or something (a Growl notification would have been nice, but that's just wishing on my part), but it didn't do anything.

finally, when I checked my email, I got this:

The latest episode of The Daily Show is now available for you to download. Simply sign in to iTunes and it will begin downloading immediately.

  1. The Daily Show with Jon Stewart 3/08/06

sign in? but I'm already signed in! I'm always signed in!

I tried quitting iTunes, accessing the front page, accessing the TV Shows page, accessing the Daily Show page — nothing worked. there was no notification in iTunes that a new episode was available, and not even a place I could poll to see if a new episode was available, much less get it.

finally I signed out, then signed in again. and then, finally, it downloads. but it didn't get added to my shopping cart (I still use one — holdover from my dial-up days); it simply downloaded immediately. this would be fine if it were listed among the podcasts, but it's a component of the Music Store, and Music Store downloads should use the shopping cart if it's enabled.

so if you buy the multi-pass, you have to sign out and back in to make it download any new episodes. lame, Apple, lame.

I think I'll file a bug on this tomorrow.

UPDATE 2006-03-10: patr1ck suggested in the comments that I should try “Check for Purchases”. this works, but it isn't documented anywhere. I'll still file a bug today.

Technorati tags: , , , , .

2006-03-08

GNU bloat

gcal: The Gregorian calendar program (GNU cal) 3.01

I installed gcal to test my ISO 8601 parser. I have some differences with it.

first, if you type gcal --help, you get this:

gcal: The Gregorian calendar program (GNU cal) 3.01

Copyright (c) 1994, 95, 96, 1997, 2000 Thomas Esken

Usage:  gcal [[OPTION...] [%DATE] [@FILE...]] [COMMAND]

Usage:  gcal [-|/{[?|h|??|hh|L|V]|{CDFIPHKNORSXbcfijnpqrsuv}}] [[MM] [YYYY]]

  -h,  --help          Display this help text and quit program
  -hh, --usage[=ARG]   Display extended help text and quit program
  -L,  --license       Display software license and quit program
  -V,  --version       Display version information and quit program
  -p,  --pager         Direct output through external `less' pager

Use `gcal --usage[=ARG]|[=?] --pager' for more information.

Email bug reports to <deleted>
or (if this fails) to <deleted>.

so the --help option returns no actual help. seeing this, I tried -hh. here are SOME of the options it prints out.

--exit-status-help-non-zero
Set EXIT status of program to 127 on `--help' etc.
-R ARG
--response-file=ARG
Create response file for the `@FILE' option
ARG = Store arguments of command line in file ARG
-S ARG
--shell-script=ARG
Create shell script which contains the arguments of command line
ARG = File name of the shell script
--export-date-variables
Export local date variables from file to file
--export-text-variables
Export local text variables from file to file
-u
--suppress-calendar
Suppress output of calendar sheet explicitly
-p
--pager
Direct output through simple internal pager
--mail[=ARG]
Send output via `mail' program to user
[ARG] = Email address, otherwise eMail is send to user `boredzo'
--adjust-value=ARG
Set reference value for rise/set time respectively shadow length
ARG = Angular value respectively factor in range: -90.0...+90.0
--atmosphere=ARG
Set base data of Earth's atmosphere
ARG = Air pressure and temperature separated by `,' character
Air pressure in Millibar (actual: 1013.250)
Air temperature in degrees Celsius (actual: +15.000)
--limit
Limit rise/set times of Sun to the day
--precise
Represent astronomical times and data with utmost precision
--execute-command
Execute `%![ARG]' shell commands and "TVAR[?|\:]COMMAND" assigments

finally, at the very end:

------------------------oOO      \\\_''/      OOo---------------------------
Thomas Esken               O     (/o-o\)     O  eMail: deleted
Im Hagenfeld 84                 ((  ^  ))       Phone: +49 deleted
D-48147 Muenster; Germany    \____) ~ (____/    MotD : 2old2live, 2young2die

so:

  1. why does this program reproduce functions (e.g. pipe to mail) already provided by the shell?
  2. why does it need to know about the atmosphere?
  3. WHY does it have such an awful email signature in there?

Technorati tags: .

New Apple documentation

I don't ordinarily write about changes to Apple's documentation, since you can get that info straight from ADC RSS, but today's round of changes is unusually significant.

Apple replaced several of the documents relating to Cocoa with new ones, and added some things to the new ones as well. the full run-down:

Was Now
  • Basic Drawing
  • Drawing and Images
  • The Drawing Environment
  • OpenGL
Cocoa Drawing Guide
  • What Is Cocoa?
  • Cocoa Objects
  • Adding Behavior to a Cocoa Program
  • Cocoa Design Patterns
  • Communicating With Objects
Cocoa Fundamentals Guide

Two new chapters have been added: "The Core Application Architecture" and "Other Cocoa Architectures". In addition, the discussion of the Model-View-Controller design pattern in "Cocoa Design Patterns" has been greatly expanded.
revision history
  • Sdef Scriptability Guide for Cocoa
  • Scriptable Application Programming Guide for Cocoa
Cocoa Scripting Guide
Document-Based Applications Document-Based Applications Overview

New articles added are "Message Flow in the Document Architecture", "Creating Multiple-Document-Type Applications", "Autosaving in the Document Architecture", and "Error Handling in the Document Architecture".
revision history
Drawing and Views Scroll View Programming Guide for Cocoa
Drawing and Views View Programming Guide for Cocoa

I think the new set of documents may be much more suitable for passing to people who are learning for the first time. I'll show The_Tick, who's learning Cocoa, and see what he thinks.

while I'm at it, I'll point out that they clarified the docs on CGImageSourceUpdateData:

Each time you call the function CGImageSourceUpdateData, the data parameter must contain all of the image file data accumulated so far.

so you should probably use a CFMutableData (or its NS equivalent) when using this function.

Daily Show on iTunes, in subscription-ish form

The Unofficial Apple Weblog announces that the Daily Show and the Colbert Report are now in iTunes:

The sale of these shows is being handled a bit differently. You can buy a "multi-pass" for both The Colbert Report and The Daily Show for $9.99US. This gets you the current episode, and sets up iTunes to automatically download future episodes as they become available (up to 16 episodes).

this is equal to paying 62.4375¢ per episode. that's cheaper than music. especially when you consider that 20 minutes of music will usually cost you at least $10 (because songs over 8 minutes are usually album-only).

TUAW says that there weren't any episodes. there is one now (of each), and it is $1.99, the same as all other TV show episodes on iTVS. there is no reason to buy single episodes of The Daily Show — get the multi-pass and save yourself $21.85.

UPDATE 14:29: I should clarify that you can buy these shows an episode at a time if you want to. there is just no reason to, because the multi-pass costs so much less.

Technorati tags: , , , , , .

2006-03-07

Free stuff on iTunes: 2006-03-07

there's only one download this week that doesn't appear in the free section of the front page. it's Access Hollywood Year 10: Oscar Preview. a little late, but what do you want for free?

UPDATE 2006-03-09: well, I don't know if this wasn't up Tuesday or if I just missed it, but there are two other free videos, under Project Runway:

  • Project Runway Trailer: ‘Overview of Emmy-nominated series "Project Runway".’
  • Project Runway Trailer: ‘A 22-minute overview of Project Runway Season 2 leading up to the finale.’