Wednesday, January 20, 2010

The Nerd in the High Castle


I like to read history books, and that includes the history of the computer industry. Steven Levy's stuff is pretty good, even if sometimes he gets a little breathless in the telling. Dealers of Lightning, West of Eden, Soul of a New Machine, stuff like that.

From reading enough of these, and from the tech press as well, I know there's this notion floating around that during the early 80s Apple was fighting the wrong enemy. (Pirates of Silicon Valley also plays this note.) During that era, Apple focused on IBM instead of on Microsoft. But Microsoft and MS-DOS really won their independence from IBM during the Clone Wars. Everyone wanted to clone the IBM PC, and run MS-DOS on it, because IBM had been so successful. If Apple had somehow won market dominance over IBM in the early 80s, they would have also defeated Microsoft by proxy.

That got me thinking though, that Microsoft probably would not have stayed out of the OS market. They were still a successful applications company at the time and, if PC-DOS had failed, they surely would have made another attempt at an OS product. Now it starts to sound like the plot of a alternate history novel, doesn't it? On the back cover: "What if Apple had defeated IBM in 1984? What if Microsoft had partnered with Commodore to sell MS-Windows in 1986?"

Wow I just realized... if someone wrote that book, I would totally read it.

Wednesday, October 14, 2009

Can I make a UIView transition to itself?


Sure, why not?

Let's say you have a UIViewController and you want the base view to do a CATransition from itself to itself:

- (void)doTransToSelf {
    CATransition *anime = [CATransition animation];
    anime.type = kCATransitionPush;
    anime.subtype = kCATransitionFromRight;
    anime.duration = 0.5;

    UIView *mySuper = self.view.superview;
    [self.view removeFromSuperview];
    [mySuper addSubview:self.view];
    [mySuper.layer addAnimation:anime forKey:nil];
}


Or, changing this to work on a subview of self.view is trivial.

So, why would you want to do this? In my case, I have a collection of data objects and a UIView that is the user interface for editing one object. When the user is ready to move on and edit the next object in the collection, the user interface doesn't substantially change, I'm really just changing the data object that is the target of the user's edits. So I want to re-use the same view with the same set of IBOutlets, and just do the transition as a visual cue to the user - "okay, you're working on a different object now."

Sunday, June 28, 2009

Why won't my backBarButtonItem use its action?


Or, How to make a backBarButtonItem send its action to its target.

Answer: you don't.

Because a backBarButtonItem is a UIBarButtonItem, it has "target" and "action" properties, leading you to believe that if you assign values to those properties, shit will happen. Alas, shit will not happen. Or rather, the usual shit will happen, but not the extra shit you hoped would happen. The backBarButtonItem is special - no matter what you do with those properties, «target» will never receive a message for «action».

What you can do instead is assign a delegate to either your UINavigationController or UINavigationBar. Both of these classes have delegate protocols that give you opportunities to act when the stack of view controllers changes. I've been using my root view controller as the delegate object, since that one never gets popped off the stack.

Friday, May 22, 2009

Sun. Oracle. Ponytails.


So... Sun. Oracle. And of course Schwartz. Schwartz, Schwartz. Blogging his way through the graveyard, chanting his open source mantra. As if clinging to all the right buzzwords would make up for not having an actual strategy. "I'm a CEO with a blog! How can my company fail??"

There are lots of companies that get by without a strategy, at least for a while. Hell, I used to work for one. But if you're going to get into the business of being a VAR for a product (free software) whose starting cost is zero and whose cost of duplication is zero, you better have a Goddammed plan of how you're going to add enough value to be attractive.

That's why, even as I care less about free software, I do continue to admire Redhat. They started their business with a plan. And when the market changed and the plan faltered, they got to work on a new plan. This happened to them at least twice, until now Redhat is basically a large consulting firm - which is where most free software VARs seem to end up. But hey, as long as they're making money at it, there's nothing wrong with that.

Sun, on the other hand, seemed to get sucked into the open source zeitgeist of the last decade, rather than deliberately enter it. By 2006 when Schwartz became CEO, the vicious round of consolidations and closures among open source companies was ancient history and he should have been able to learn from it. Instead he seemed to think it was still 1996 and he threw more money at open source products without any clear strategy that I could see. That's why Redhat grew from a dorm room operation to a successful corporation, while Sun dwindled from being a key player to being an easy acquisition.

Friday, May 01, 2009

A Thread Across the Ocean


A Thread Across the Ocean was (to my surprise) the only book I could find that tells the story of laying the first transatlantic communications cable. Luckily, it's a good book. It's a classic story of 19th-century ambition to conquer nature (and get rich doing it) and this book tells it well. Recommendation: acquire.

See also: Cryptonomicon.