On Steve Jobs, illness, and the future of Apple

Steve Jobs (vintage)The tech world is abuzz this week over the news that, despite his open letter from last week stating that he was going to stay on the job, Steve Jobs has announced that he will be taking a six-month leave of absence from Apple.

For those of you who don’t know, Steve Jobs has been battling pancreatic cancer since 2004. He underwent a surgery called the Whipple procedure in which large portions of various intestinal organs are removed, and has appeared mostly healthy since then. However, throughout 2008 he was observed to be losing an alarming amount of weight, which as he described in last week’s letter, is not (directly) related to the cancer.

I’ve been reluctant to delve into this topic here, because I have a personal connection with pancreatic cancer. Someone close to me has been battling the disease since 2005, and in fact underwent the same surgical procedure as Jobs. It led to a remarkable recovery, allowing her to travel internationally in 2006 and 2007. She’s still with us, but it’s been a hard-fought battle against both the disease and the effects of chemotherapy. So, in short, I probably have a better idea than most observers of just what Jobs is up against.

His cancer may or may not have returned, and he may or may not return to Apple in June as he has promised. But regardless of his health, it’s true and obvious that eventually he’ll be leaving Apple, regardless of the reason. And despite his role as the company’s founder, prodigal son, and visionary leader for the past dozen years, Apple will go on without him. But a lot of people seem not to be able to imagine how.

Apple went on without him from 1985 to 1997. It struggled, yes, and was the butt of many jokes. But I became a loyal Apple user in the darkest of those dark days: 1993. I witnessed the foibles of Gil Amelio, and yet Apple managed to soldier on.

Then of course came the return of Jobs. The past decade since his return as CEO has seen the company vault from laughable also-ran in the computer business to an innovative leader, not just in computers but in portable music players and now smartphones (though that name does a disservice to the fact that the iPhone/iPod touch is really a brand new, pocket-sized computing platform that defies the currently available categories). Their computers are more popular than ever for home users, and they’re even making inroads into the business world.

And yet, Apple fans are still viewed as something of a cult. It’s a cult of personality, largely, focused squarely on Steven P. Jobs. So, what happens to the cult of Apple without His Eminence?

It’s true that Steve Jobs is a uniquely skilled CEO. He’s a visionary without peer, he’s a ruthless businessman, a shrewd leader, and a great showman. So who can fill that void?

Well, as it happens, Apple has some pretty impressive leadership in its other corner offices as well. I think the situation at Apple, and whether or not to be worried about Jobs leaving, is best expressed in pseudocode:

if (Cook + Schiller + Ive < Jobs) { panic; } else { do_not_panic; }

There are three people at Apple who really stand out from the crowd, besides Jobs himself. They are Tim Cook, the Chief Operating Officer, who was largely responsible for the outstanding success of the iTunes Store; Phil Schiller, the showman who more than adequately filled Jobs’ shoes at this year’s Macworld Expo keynote; and Jonathan Ive, the visionary designer who has been at the heart of just about every new product offering Apple has introduced since Jobs’ return and the world-changing original “gumdrop” iMac design.

In short… these are some brilliant, talented guys. What’s more, together the three of them are at least as responsible for the current state of Apple as is Jobs.

Apple is in good hands.

Why oh why won’t CakePHP store my tinyint(1) data?

CakePHPOK, I actually know the answer to the question posed in the subject line. Despite the palpable suspense, I am sure 99.9% of my audience can tune out now. That leaves the remaining 0.001 readers to dive into this problem with me.

I’m doing a lot of CakePHP development these days, and I’m loving it. (What? The McDonald’s legal team is on its way over here? Damn. Fine, McDonalds. Have it your way. What, Burger King too? I guess I better make a run for the border. OK, joke’s over.)

Of course, plunging into a sea of someone else’s code is always fraught with a little peril, and today I found some. Here’s the scenario:

MySQL is a pretty cool database. I’m very loyal to it. But there are some things it should do, but it just doesn’t. One of those things is support a boolean data type. So, we make do. A common way to make do, and the way preferred by CakePHP, is to use a tinyint(1) field and just store 0 or 1 in it. In fact, CakePHP loves this approach so much that whenever it sees a data field that’s a tinyint(1), it “automagically” refuses to accept any values for that field other than 0 or 1.

That’s super-dee-duper. If that’s what you want. But I have a data table, my users table, as it happens, and in that table I used to have a field called admin, a boolean value. Either the user’s an admin or not. Great. But I decided to upgrade this to allow more access levels than just 0 or 1 (and while I was at it, changing the field name, shockingly, to access_level). I wanted to be able to support up to ten levels. Well, great! A tinyint(1) will nicely store values from 0 through 9, so I’m set!

Except… it didn’t work. Every time I tried to save a value greater than 1, I’d find that it had saved 1 as the value. I could change it to 0 just fine, but anything else became 1.

I checked the documentation and found ample evidence for the “automagic” behavior, so I figured there were a couple of possible changes I could make that would fix the problem: I could change it to a tinyint(2), or I could change it to a char(1). Since I decided I’d rather (in theory) allow letters in the field than double-digit numbers, I went with char(1).

Only it still didn’t work.

I did some more research, found that I seemed to be on the right track, but I was still confounded.

Then it occurred to me. I knew I had seen a cache directory somewhere in the labyrinth of directories and subdirectories and sub-sub-sub-sub-subdirectories in the CakePHP package. And I also knew that a framework as developed as CakePHP probably wouldn’t hit up the database for schema information constantly, so maybe… just maybe… it was cached.

I burrowed down in my application to the app/tmp/cache/models directory, and sure enough… there’s a cache file for each data table, with the schema in a serialized form. Well, it’s a cache, right? Nothin’ to lose. Trash can, here we come! I refreshed my page, and voilà! Success!

So… word to the wise (or, not so wise, like me… otherwise you’d probably already know):

  1. CakePHP will only store 0 or 1 in a tinyint(1) field. Period.
  2. If you change the schema for any of your data tables, and CakePHP acts like you didn’t… dump that cache!

We now return you to our regular, slightly less geeky programming.