Solipsism Gradient

Rainer Brockerhoff’s blog

Browsing Posts published in February, 2007

Cocoa quickie

No comments

Borkware Quickies is a highly recommended collection of small, useful code snippets. Mark Dalrymple has been so kind to post one of my own there: “Making naked memory autoreleased”. Here’s a shorter and even more useful, though sometimes slower, version:

static void* tempCopyOf(void* data,UInt32 size) {
   void* buffer = calloc(1,size);
   if (buffer) {
      if (data) bcopy(data,buffer,size);
      [NSData dataWithBytesNoCopy:buffer length:size freeWhenDone:YES];
   }
   return buffer;
}

So, you can call this as:

void* thing = tempCopyOf(&myStructure,sizeof(myStructure));

which will give you a temporary copy of myStructure, or as

void* thing = tempCopyOf(NULL,someSize);

which will return a zero-filled buffer of someSize for you to fill in as you want.

Re: Sony Reader

No comments

Taking up my old thread of e-book readers and electronic paper, I just found an interesting write-up of such technologies and of the latest variation: reusable paper. Worth a read.

Too hot

No comments

Since the beginning of the year (or, perhaps, more germanely, the beginning of the hot season) the hard drive in my iMac G5 would have a little clicking fit. This is usually the first sign of impending drive failure, but as it usually would stop and get back to work in a few seconds I did nothing except resolve to backup more often than I usually do. Just FYI, it’s a 20″ iMac G5, the last series before the iSight model, with a 250GB Maxtor SATA drive.

The last few days it’s been hotter than usual – often around 33C during the day – and around the middle of last week the clicking started to happen more often, and it would sometimes take minutes to recover… this only happened when I was booted from a certain partition, and never when booted from the other partition, so I tended to spend more time in the latter situation. I also installed Marcel Bresink’s excellent freeware Temperature Monitor, which told me that the iMac’s built-in hard drive temperature sensor showed 54C, while the drive’s own SMART sensor said it was at 70C. Which of course is somewhat beyond the usual rated operating temperature of 60C…

I finally got some free time to actually do something about it and proceeded to do a full backup of my home folder and of selected other folders to an external hard drive. I then tried to do an erase-and-zero-data operation on the internal drive, which (after 10 hours!) failed with an I/O error. And the drive temperature went up to 72C while the external sensor still said 54C! Something was very wrong.

Well, clearly this meant the drive was no longer reliable and I proceeded to find a replacement. Only a few months earlier I’d phoned around to find a larger backup drive, finding out that nobody had anything larger than a 160GB IDE in stock, and that an exorbitant price. SATA drives were “about to come in”. This time, too, the first stores I tried had no large drives available, until the nice people at TecMania pointed me at WAZ, where I promptly found a 320GB SATA drive for about US$210.00, not too bad for someone in a hurry. So on Saturday I was the proud owner of a new Western Digital WD3200KS, and gained several dozen GBs space, not too bad.

The new drive’s power consumption specs were about 20% lower than the old Maxtor’s, so I was reasonably confident that it wouldn’t overheat as badly. Still, after installing it, I looked closely at the way the temperature sensor was mounted on the drive bracket. It turns out that the bracket on that side is a thin metal strip fixed to the drive with two mounting screws, and the sensor is glued on near the middle. However, even with the screws properly tightened, the metal strip arches out a little in the middle, so that there was a small air gap between the sensor place and the drive itself – clearly not a thermically optimal solution, and this might explain the huge 18C difference between the internal and external temperature readings.

I googled around and some people had indeed run into the same problem. A few had mounted external fans onto the air inlet and/or outlets, and some had even cut into the iMac cover to do so! This seemed a little radical to me, especially as it would drastically cut resale value. Another user recommended cutting off the sensor and re-gluing it onto the drive body itself, something which I actually considered doing, but I found the sensor cable would be too strained if I did so.

The actual solution I implemented is shown here:

I added the round-headed Philips screw in the middle of the mounting bracket, which goes into the center (previously unused) hole on that side of the drive. I also spread a thin layer of thermal heatsink paste onto the mounting bracket, in the space between the two holes on each side of the sensor. The air gap was completely eliminated, and indeed after I fired the system up and restored my backups, the temperature gap between internal and external sensors was reduced to a much more reasonable 4C.

This means that the drive peaks at about 58C; still within the nominal operating range of 60C max, but uncomfortably close to the upper limit. By coincidence while I was doing this, I became aware of a Google paper (pdf) about disk failures. Very interesting; they investigated an awful lot of drives, and concluded that elevated temperature wasn’t necessarily a factor; then again, their operating temperatures were below 50C.

Meanwhile, I’m monitoring the drive closely and think of alternate methods to make the sensor’s temperature track the drive’s temperature more closely (which would make the cooling fan kick in a little earlier). My first attempt, putting a piece of tape over the sensor to take it out of the fan’s airstream, didn’t make any appreciable difference.

Update: Another paper on disk failures just came out. Also very interesting.

Re-cognition

No comments

I’ve always been extremely skeptical about speech recognition. Like machine translation, it’s always been one of those technologies that for some reason is the “coming great thing” for a certain group of tech pundits, while not getting any closer (or even steadily receding) when you look at actual implementations. Here’s a particularly hilarious example. More here.

Understanding spoken language is a problem even for people. I listened carefully and, frankly, didn’t quite catch several sentences spoken by the operator in that first video. Even though he tries to avoid running words together as he would probably do when speaking to another person, he’s prone to leaving vowels out (“c’rrect”, “d’let'”, “cap’t’l”). Personally I’m able to misunderstand people in several languages, which actually adds to the problem – before decoding the words, I have to identify the language. Great fun on trips.

I’ve been getting some positive feedback lately about my “Interesting Times” articles, so I thought I’d repost some pointers to them. The column itself is, sadly, now defunct, but new material crops up now and then; I’ve decided to post it here instead. In retrospect, the way this blog/forum is organized could use a few revisions, but that’s not likely to happen very soon.

So, “Highly Advanced But Obsolete” talks about the QI900, which was an 8-bit CP/M-based computer I helped design in the middle-80s:

…the Z80 was too slow for a fully graphical interface, and we hadn’t the mechanical know-how to build a mouse.

…here’s the final result: the QI-900 had menus…

…and moveable windows…

…and, even better than the original Macintosh, it had preemptive multitasking – or rather, multithreading inside the same application.

I promised a follow-up article with more details, but never had the time to do the necessary research. Maybe later in the year.

Everybody’s favorite seems to be, however, “This Internet isn’t worth anything…“, where I tell some stories about setting up a commercial ISP in the early 90s:

(At Embratel – that was the government’s telecomm monopoly)

Me: “I want an Internet connection.”

Embratel Salesman: “OK. I suggest a 2400 or 9600 link, the price will be X cents per packet. That’s 20% of what it costs to send a TELEX. Isn’t that revolutionary?”

Me: “A packet means how many Kbytes?”

Embratel Salesman: “What? It’s 64 bytes per packet!”

Me: “And if a user decides to download a larger file, say, 500 Kbytes? It’ll cost hundreds of dollars!”

Embratel Salesman: “Don’t worry, that will never happen!”

Re: WWDC?

No comments

I just heard the news; it seems the rumors were right. This year’s WWDC is now officially set for June 11 to 15, 2007. As I said below, this further reinforces my belief that the availability of Leopard and of the iPhone will be announced simultaneously by Steve Jobs at the keynote – June 11 – and, very probably, that the Leopard DVD will be distributed to every developer after the keynote. Let’s hope an iPhone developer’s kit will be thrown in… and that I will be able to attend.

Photos licensed by Creative Commons license. Unless otherwise noted, content © 2002-2017 by Rainer Brockerhoff. Iravan child theme by Rainer Brockerhoff, based on Arjuna-X, a WordPress Theme by SRS Solutions. jQuery UI based on Aristo.