Thursday, January 24, 2008

Microsoft Office Supports PDF on the Clipboard, And Why That is a Big Deal

For months, I've wanted to know whether Microsoft Office 2008 supported copying and pasting PDF data from the OS X clipboard. I couldn't find out, and it's not like I didn't ask. Two days ago, Office 2008 appeared on my chair, and the answer is yes.

Backing up a moment. When you copy content in one application and paste it in another, you are using a system service to transfer the data be it via the old style Carbon Clipboard manager, the Cocoa NSPasteboard class, or the newish Pasteboard framework available to the non-Objective C crowd. The two applications must agree on the format of the data exchanged, so typically only widespread standards are used. For text, as I've outlined before the RTF format is preferred. For bitmap images, a good choice is lossless TIFF. Vectored images, however, were a quandary.

Vectored images are pictures composed of individual drawing operations such as MoveTo, LineTo, AddToPath, FillPath, etc.. Because they are not limited in resolution like a bitmap, they look good on screen and tend to print out with lovely crisp lines. They also tend to be smaller than bitmap files. Every application on Classic Mac OS used a convenient format called PICT which is basically a recording of the QuickDraw operations needed to generate the onscreen display. PICT is a primitive format, something more in tune with the computers of 1984 than 2008. Off the top of my head, it lacks fractional coordinates, paths, Bezier curves, gradient fills, pagination, is limited to QuickDraw fonts, has limited (to rotating text) coordinate matrix manipulations, poor support in Cocoa applications and its ugly. The only two good things I can say about it is it does allow for high quality printing via embedded PostScript, and you can squirrel away your own data in it in case the same PICT gets copied and pasted back into your application.

When OS X arrived, legacy Carbon applications kept on generating their PICT clipboards for both bitmap and vectored material even though the superior PDF format was available and universally used by newer Cocoa applications. QuickDraw became obsolete and onscreen drawing is most often done with Quartz calls, and yet applications still maintain ways to generate PICT clipboards at great expense of maintenance and design. Why?

Because Microsoft Office didn't support PDF, and if you want to sell business applications on the Mac, you have to share data with Office, and that content had better print nicely from within Office. I know from personal experience the aggravation of maintaining the portion of an application which renders content into QuickDraw PICTs; ugly, cludgy QuickDraw PICTs when I could be easily generating PDF clipboards; beautiful lightweight, lithe, PDF files.

To illustrate what I mean I created this pdf in an application which supports creating EPS files but not putting PDF on the clipboard. I opened it in the OS X Preview application (a Cocoa App):

Copied the image into TextEdit (another Cocoa App) from Preview:

TextEdit has a bug where it doesn't re-render embedded PDFs when it zooms.
Copied the image from TextEdit and pasted it back into Preview and zoomed in on a detail:

Now compare with a zoomed detail when using the PICT version from the clipboard of the original application (a Carbon app) (ignore the checkerboard) pasted into Preview:


Presumably, OS X could provide a service where it would extract embedded PostScript from PICTs (if available), and generate a pleasing PDF pasteboard, but it doesn't and I doubt that Apple wants to encourage developers to keep on using PICT.


Getting back to the big news, there was Office 2008 on my chair. Install. Draw a moon:

Copy. Launch Pasteboard Peeker and see this output (... means omitted content):
PasteboardRef: 1116096 ItemCount: 1
Index: 1 item ID: 1112493904
...
"com.adobe.pdf"
"Apple PDF pasteboard type"
'PDF ' P_____ 21056 PDF-1.3 4 0 obj << /Length 5 0 R /Filter /FlateDecode >> stream x

"com.apple.pict"
"Apple PICT pasteboard type"
'PICT' P_____ 409198 >n C 0 H
...


Yay.

And notice how svelte the PDF (21,056 bytes) is compared to the PICT (409,198 bytes). Rendering a gradient fill in QuickDraw is not pretty.

Go back to Word and add a star:

Copy and paste into Pasteboard Peeker and:
PasteboardRef: 1116096 ItemCount: 1
Index: 1 item ID: 1112493904
...
"com.adobe.pdf"
"Apple PDF pasteboard type"
'PDF ' P_____ 24935 PDF-1.3 4 0 obj << /Length 5 0 R /Filter /FlateDecode >> stream x

"com.apple.pict"
"Apple PICT pasteboard type"
'PICT' P_____ 498658 H
...
The PICT version bloats by 97K while the PDF gets a mere 4K. Not that size matters any more with RAM and hard prices the way they are.


Word in Office 2004 had a clipboard which looked like this:
PasteboardRef: 3323920 ItemCount: 1
Index: 1 item ID: 1112493904
...
"com.apple.pict"
"Apple PICT pasteboard type"
'PICT' P_____ 2222 U , , f
...


Open up the pasted PDF in Preview and Zoom:

Look at that beautiful shadow detail! Try to do that in a PICT!

Draw something in Sketch copy paste, yep, there it is, a PDF pasted into Word. Yay again.

But what does this all mean? It means that once Office 2008 sees widespread adoption, the rest of the Mac content creation software industry can rip out every last QuickDraw call in their application. It means we can build 64-bit versions of our applications. It means we had best start putting PDF on our own clipboards. It means Cocoa apps can generate content and with no extra effort have it look great inside Office apps. It means there will be a new, higher minimum quality for interchanged content. It means we can forget everything we ever knew about Classic Mac programming.

The future is finally here.
[Update: One fly in the ointment is that Word has a bug wherein if you paste a PDF graphic into a Word document, and subsequently copy and paste it from Word and into another application (such as Preview), it loses its vectored quality:


But while the graphic is still within Word, it scales, prints, and zooms beautifully, so presumably this is just a bug in the copy code and not a design flaw. The vectored PDF is being maintained internally in some vectored form.]

Tuesday, January 22, 2008

Space Heaters: Honeywell HZ-519 versus DeLonghi HHP 1500

I have an online account with Consumer Reports, which I've been quite pleased with; it's the first place I look for home appliance recommendations. The manufacturers of my washer, dryer, wet vac, space heaters, and lawn mower can all thank Consumer Reports for my purchase. However, sometimes, by sticking to objective measures, they get things wrong when problems crop up outside those objective measures. In my case, I feel their high recommendation of the Honeywell HZ-519 electric convection space heater was misguided, as compared to another heater they gave a not quite as high rating, the DeLonghi HHP 1500.



Problem 1: Physical Dimensions

You might notice that the HZ-519 is long and thin. Long and thin objects are delicate and require odd shipping boxes. As I, and at least one other Amazon reviewer found out, these things are easily bent in the middle during shipping as it is hard to protect, leaving me with some ugly and noisy bends in the metal. (The Amazon merchant did give me $24 back instead of taking the return). Also, while it has ample cord length, it is mounted at the right side, if your plugin happens to be to the left, the cord suddenly is no longer so long. Compare this with the squarish, solid HHP 1500 which fits in a box of normal dimensions, and whose cord can be used at a fair distance to the left and right.

Problem 2: Temperature Control

Consumer reports gives the HZ-519 high marks for its digital temperature control and timer, which are nice for a single use: set the temperature to maintain by pushing a few buttons, set the time to heat through a few more button presses. The HHP 1500 on the other hand has no way to set a temperature, you turn some knobs and it will try maintain a temperature: what temperature that is it doesn't say. You will have to futz with it over the course of a couple nights until you find a setting which is comfortable for you. But, and here is the big but, once you find a setting you like you are done. When you want to use the DeLonghi you come in flip the top knob on; with the Honeywell, you press the power button, press the "Temp/Timer" button to select temperature, hit a couple arrow keys; if you want automatically turn off the unit, that's more button presses. Every single session. There is no memory of the last setting. Yes, you do get a timer, which is nice, but you try setting the temperature on this thing in a darkened room, when all you want to do is crawl in bed. (There are versions of this heater with a display backlight, and with a remote control which would mitigate this annoyance.)





Problem 3: Being Nice to Your Fuses

The HHP 1500 has two main power settings. One draws about 7Amps when powering its element, the other around 13 Amps, which spikes at over 15 when turning on causing my Kill-a-Watt to make a warning beep. The HZ-519 has one mode which draws around 11 Amps. A typical household circuit is rated at 15Amps. Now imagine having two bedrooms which share an electrical circuit, each with their own space heater. If you installed two HHP 1500s, that's fine, just keep both of them at their 7 Amp setting, and it will just take longer to heat the rooms. If you have two HZ-519s, pop goes the circuit breaker. This assumes the rooms in question are small enough to be heated adequately at the lower setting.


Problem 4: Noise

OK, I shouldn't criticize the HZ-519 because mine has a lot of twisted metal from the shipping incident, but it is quite noisy as it expands and contracts. The HHP 1500 is dead quiet.

Problem 5: Flexibility of Placement

The HZ-519 is designed to be placed along a wall, while the HHP 1500 can be mounted on a wall or rolled into the middle of a room.

Energy Usage

Not a big problem here, and impossible for me to compare. The HZ-519 in one bedroom has been using about 6kWH (about a dollar) a night keeping the room at a comfy temp over the chilly temp I keep the rest of the house, while the HHP 1500 has been draining about the same. I would be happy with nice thick blankets, but my wife wants the children warm when they kick off their covers.

Safety

The HZ-519 does have such additional safety features as automatic switch-off when knocked over. You will have to judge how important this is for you.

In Conclusion

If you are in the market for an electric convection space heater, get the DeLonghi. Buy them in the summer when they are cheap, because they have really gone up in price since the cold weather set in. I paid $80 for a DeLonghi in late November, it's now mid-January and the same heater is $160.
[Updated with additional commentary after first posting]

Tuesday, January 01, 2008

Memories of RAM past

Pretending 1GB equals 1000 MB.


This is in the category of things that happen to everyone, but which should me remarked upon. Modern RAM capacities are amazing.


My first computer, a Mac Plus, purchased new from the University of North Dakota's bookstore, had .001 GB of RAM installed, which I upgraded first to .0025 GB, and then to its maximum .004 GB, at a cost, as I recall of about $150,000/GB.


I just purchased, at $15/GB (shipping included) a 2GB module for my MacBook, bringing it up to 3GB—and requiring me to dispose of an inconvenient 1GB module. So this means that my computer of today has 3000× the RAM of my 1988 computer, while the price per unit has dropped by 9,999/10,000ths of what it once was. Imagine if cars were improving at the same rate.


Here's a chart of the final RAM capacities for all my previous computers. I've long meant to make up this chart, so bear with the irrelevance to your life:


Drive capacities have gone through a similar transition, from the .0008 GB floppy in my Plus to the 200 GB drive in my MacBook.


The scary thing is the idea that over the next 20 years from now, RAM might increase in typical capacity by another 3000 times, and what will we be doing with it?

[Update: For whatever reason, my MacBook does not like the Transcend TS256MSQ64V6U module in combination with any other module I have. It works by itself, but put in either of the pre-existing 1GB modules (or even a 256MB module from a Mac Mini, and it would not boot. So, I'm stuck at a mere 2GB.]
 
Google+