mkj musings

[ Home | RSS 2.0 | ATOM 1.0 ]

Fri, 22 Apr 2011

Why Layout Matters

I have found myself reading Adobe's AMF3 specification, and trying to read their ABNF grammar for AMF3. Unfortunately, Adobe have seen fit to format their nesting in arbitrary ways that make it hard to read. Here are two examples from the specification (which has not been touched since 2008, to the best of my knowledge):

array-type        =   array-marker (U29O-ref | (U29A-value
                      (UTF-8-empty | *(assoc-value) UTF-8-empty)
                      *(value-type)))
...
object-type       =   object-marker (U29O-ref | (U29O-traits-ext
                      class-name *(U8)) | U29O-traits-ref | (U29O-
                      traits class-name *(UTF-8-vr))) *(value-type)
                      *(dynamic-member)))

Line breaks in arbitrary places do not make the ABNF any easier to read. (Line breaks in the middle of a terminal are also in poor taste.) If you count the parentheses in the object-type definition, you will find that there are two extra closing parentheses. This is not optimal for a grammar for a binary language that is supposed to enable interoperation.

If the specification authors had used logical layout, this would have been completely obvious:

array-type        =   array-marker (U29O-ref |
                                    (U29A-value
                                     (UTF-8-empty | *(assoc-value) UTF-8-empty)
                                     *(value-type)))
...
object-type       =   object-marker (U29O-ref |
                                     (U29O-traits-ext class-name *(U8)) |
                                     U29O-traits-ref |
                                     (U29O-traits class-name *(UTF-8-vr))
                                    ) *(value-type) *(dynamic-member)
))

I guess it should surprise no one that a long-time Python programmer would suggest that literal layout influences both readability and comprehensibility.

I guess I should also rant that the specification says that the grammar is specified in Augmented Backus-Naur Form, and explicitly references RFC2234 (since obsoleted by RFC4234, then by RFC5234), but then uses the vertical bar character | when RFC2234 clearly states that alternatives will be presented with a solidus (forward slash) /. However, we're all used to | from BNF and EBNF, so I can forgive that more easily...

posted at: 14:01 | path: /rants | permanent link to this entry

Sat, 21 Aug 2010

Math, Amtrak Style

I had a page open to check the progress of an Amtrak train, so that I could know when to pick up a passenger. Not a lot of info was available. As of 8:30PM, it just said "on time" for 9:00PM (though the timetable said 9:13PM instead of 9:00PM, just to keep things interesting).

I arrived at the station at 9:00PM to find out that the train had arrived at 8:30PM. When I returned home, I refreshed the page from the Amtrak site, curious what it would say. There were two surprises. The first was that it said that the train had actually arrived at 8:40PM. The second was how late the site said this 20-minutes-early train was.

posted at: 23:00 | path: /rants | permanent link to this entry

Sat, 07 Aug 2010

Archos 7 Home Tablet: First Impressions

In part because my children are perhaps not quite so careful with CDs as I am, I ripped all my CDs (at least, all that will still read!) to flac, ogg, and mp3 files. The second half of the project was to get a media player that could play all those files -- preferably over the network from my main server so that I don't have to copy files onto an SD card every time I get a new CD and rip it.

When the Archos 7 Home Tablet was announced, it seemed like the obvious thing to use. WiFi to access the server. Should play oggs just fine. I don't really care very much about whether it can access the Android market, though the restrictions on the market seem rather silly to me.

After I downloaded Subsonic and installed the server portion on my home server and the client on my tablet, I had a working solution for audio. While the default RPM packaging for Subsonic is sub-optimal (making important directories world readable/writable, for example) and this makes me convinced that I would not want to expose a Subsonic server implementation to the world, on my internal network I'm fine with it, and it gives me all the functionality I need to play my music collection on my home stereo. (The only problem is that for reasons I haven't researched, I have to use mp3s instead of oggs, even though I can play ogg files directly on the tablet.)

However, I'm not all that impressed with the Archos 7 Home Tablet. As reported by others, the native browser crashes almost instantly when you try to actually use it. It rarely survives a google search from the google search widget. I'm not impressed that Archos shipped something this broken, and less impressed that Archos has not yet released an updated firmware to resolve this issue, nor do they have updates available in their proprietary "applib" for the malfunctioning browser. Using Dolphin Browser or Opera seems to be the only way to use this tablet to browse the web.

I'm also not impressed that this late, they are still shipping an Android 1.5 OS.

Kindly, a user has stepped up to the plate and delivered a firmware update (shame on Archos for their lack of attention to this device!) that resolves at least some issues. So far, the browser hasn't crashed for me after applying the update. As a bonus, the user-supplied firmware enables the Android Market on the device, which made it a bit easier to get my apps back after wiping the system as part of applying the update.

It looks like there will soon be a whole crop of better tablet devices coming out with similar hardware but newer versions of Android. In retrospect, if I could make my decision again, I would wait and purchase a different tablet. Maybe at Kmart, of all places...

posted at: 11:47 | path: /rants | permanent link to this entry

Mon, 15 Jun 2009

Nice "work" if you can get it...

At the post office, I found myself writing a bit of a pastiche of an old classic:

Passport Hours: 10:30-4:30

Nice work hours if you can get 'em

NOTICE: TO SERVE YOU BETTER, PASSPORT SERVICE IS NOW BY APPOINTMENT ONLY

And you can work less, if you try!

1:40 PM:

Applicant has been waiting since around 1:30 PM, occasionally ringing doorbell.

Postal Service Employee (annoyed, poking head around door she is holding mostly closed): When's your appointment?

Applicant: My appointment was at 1:30, Ma'am

Postal Service Employee (even more annoyed): Can't be at this post office. You must be at the wrong post office. I have lunch from 1 to 2.

...

Suddenly, I find myself thinking that privatizing postal service might be a good idea after all. Also, putting the phrase "to serve you better" on a sign or form should be a federal offense, publishable by standing in line at a post office for 10 years.

posted at: 14:20 | path: /rants | permanent link to this entry

Mon, 14 Apr 2008

The Blue Screen Of Zombie

I have a dual-boot system that, on rare occasions, finds itself running windows. It used to be limited to taxes and GPS database programming, but now it is limited to taxes, GPS database programming, and logitech harmony programming.

Since I so rarely run windows, I keep forgetting or repressing how hard it is to use, and how easily it breaks, catastrophically. I rant loudly whenever things break under Linux about how unacceptable it is.

I just went through the exercise of doing my taxes in turbotax. It occasionally went unresponsive or would simply quit displaying some of its user interface elements, but a restart would bring it back. Once turbotax disappeared entirely right in the middle of using it. (Oh, that's why it auto-saves so often. I guess they expect that.)

Then I wanted to print some forms. Of course, I don't have a printer connected, so I figured I'd just print a PDF (or postscript, that would be OK too) and print it later.

Half an hour later, muttering, I went downstairs to plug my computer into the laserjet. It's an HP LaserJet 1320 -- supports PCL6 and Postscript, has USB, and has been trivially supported under Linux for years. I figured I'd just move the USB cable temporarily to the machine running windows.

Or maybe not.

I tried letting windows try to install the driver automatically. Several times. Then I went to the HP web site, and downloaded three different drivers to try (no help from HP on which drivers to use). None of them worked. I finally, in desperation, found the CD that shipped with the printer. No luck. An hour and twenty minutes later, you'd think that at least I'd still have a working system, even if I couldn't print the tax forms.

I remember jokes about suspend/resume from years ago: "My laptop suspends fine, it's just resume that doesn't work so well." Unfortunately, after these attempts to get printing working, the system no longer shuts down. It just hangs indefinitely with nothing displayed on a blue background. The only way to get it to shut down is to hold the power button down until the hardware timeout passes and the system is forcibly shut down. It's not the "blue screen of death" -- it's the normal (for me) blue background shown during shutdown, it just never goes away. Call it the "blue screen of zombie", I guess.

Of course, setting this printer up under Linux took all of about one minute some years ago, and it has worked flawlessly ever since.

And no, I'm not crazy enough to be running vista with all its performance and driver problems. This is a recent XP install as shipped on a thinkpad.

Afer all that trouble, I find (back on my trusty Linux system) that the IRS site has the form in PDF, that it is a fillable PDF, and that evince can fill it in. This will take all of a couple minutes; I don't even have to use a pen except to sign the form.

posted at: 09:18 | path: /rants | permanent link to this entry

Made with PyBlosxom