Archive for March, 2006

Report-an-Apple-bug Friday! 8

Friday, March 17th, 2006

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

Friday, March 17th, 2006

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

UPDATE 2007-08-02: I’ve updated the test case to fix a bug. Here’s kevent-read-bug r2.


Technorati tags: ,

About my grammar

Friday, March 17th, 2006

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?

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

Tuesday, March 14th, 2006

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

Tuesday, March 14th, 2006

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

Tuesday, March 14th, 2006

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)

Tuesday, March 14th, 2006

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.

Minor update to “Hello Worlds”

Monday, March 13th, 2006

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

I hate spammers

Sunday, March 12th, 2006

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.

Even more Hello Worlds

Saturday, March 11th, 2006

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

Saturday, March 11th, 2006

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.

Report-an-Apple-bug Friday! 6

Friday, March 10th, 2006

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

Friday, March 10th, 2006

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

Multi-pass implementation sucks

Thursday, March 9th, 2006

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

GNU bloat

Wednesday, March 8th, 2006

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 
or (if this fails) to .

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? (UPDATE 2006-12-06: Thomas Ptacek says that it is to compute sunrise times.)
  3. WHY does it have such an awful email signature in there?

Technorati tags: .

New Apple documentation

Wednesday, March 8th, 2006

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

Wednesday, March 8th, 2006

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

Free stuff on iTunes: 2006-03-07

Tuesday, March 7th, 2006

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