Ladditude
CoreData Transformables not saving?

I’ve been having the damnedest time with a Core Data object that has, as one of its properties, a custom class that’s transformable. Behind the scenes, this saves any object as NSData — all you have to do is implement NSCoding. The glitch? 

I kept saving, and saving, and saving, and while the initial creation of the objects was persisted just perfectly, any changes I made vanished with a restart of the app. Why could this be? After tearing my hair out, I found this on CocoaBuilder:

Core data attributes are expected to be immutable and will be treated as such.  To property track changes to the value of an attribute you’ll need to replace the attribute object on the owning managed object with a different instance.

link

Translated? That means your ManagedObjectContext and PersistentStoreCoordinator are just looking at your transformable object, seeing that it object A is object A, regardless of whether A.someInterestingProperty used to be set to @”pinkGloves” and now is set to @”beigeGloves”. CoreData is like a bad boyfriend. What haircut? You look fine, sweetie pie. You look great in everything.

So, what do you need to do to make your lazy, good for nothing (just kidding!) Core Data get up off the couch and persist your transformable changes? Just give it what every bad boyfriend wants: give it a clone. Implement NSCopying, and, if you’ve got a somewhat mutable transformable property, implement a method in your NSManagedObject subclass like this:

 -(void)refreshTransformable {     
     id tempTransformable = [self.someTransformableProperty copy];
     self.someTransformableCopy = tempTransformable;
     [tempTransformable release];
 } 

A few things to note here:

1. You’ll need to implement NSCopying’s -(id)copyWIthZone in your transformable subclass.

2. Notice I released my tempTransformable. Copy means you own the memory.

3. Remember how I said you own the memory with Copy? That means you shouldn’t autorelease your copy of the object when you implement copyWithZone. Right? Right.

Now kick back, relax like Core Data, and have a brew ski on the couch. You’ve earned it.

I don’t want a little scribble thing. Or, Why Steve Jobs killed the Newton

More on this 1997 closing WWDC keynote from Steve Jobs, an hour and one minute in, someone asks “what do you think Apple should do with Newton,” and gets a surprise preview of the iPhone:

I tried a Newton, I bought one of the early ones, I thought it was a piece of junk, I threw it away. I bought one of the Motorola envoys, I thought it was a piece of junk after three months and threw it away. I hear the new ones are a lot better. I haven’t tried one … here’s my problem: My problem is, to me, the high order bit is connectivity. The high order bit is being in touch, connected to a network. That’s why I bought the Envoy: it had a cellular modem in it. And I don’t think the world’s about keeping my life on this little thing and IR-ing it into my computer when I get back to my base station, I think that, to me, what I want is this little thing that I carry around with me that’s got a keyboard on it, because to do email, you need a keyboard. Until you perfect speech recognition, you need a keyboard. You don’t sit there and write stuff, you need a keyboard. And you need to be connected to the net. So if somebody would just make a little thing where you’re connected to the net at all times, and you’ve got a little keyboard, like an eMate with a modem in it. God, I’d love to buy one. But I don’t see one of those out there. And I don’t care what OS it has in it. So, you know, I don’t want a little scribble thing. But that’s just me.”

As to why he didn’t think Apple should run at making that a reality in 1997? That goes back to what Gruber posted this video for in the first place: focus.

I’m in the minority, and what I think doesn’t really matter about this. I think that most companies can’t be successful with one stack of system software. Rarely can they manage two, and we I believe are going to succeed at managing two in the next several years, with MacOS and Rhapsody, which is a superset of that. I cannot imagine being successful trying to manage three. So I have sort of a law of physics disconnect with trying to do that, I just don’t see how it can be done. And I don’t think that has anything to do with how good or bad Newton is, or whether we should be making $800 products, or $500 products, which I think we should. It has to do with, I don’t see how you manage three software stacks. So that’s what I think.”

Remember, at the time, Jobs is not CEO. Apple has just bought NeXT, and Rhapsody is the codename for repurposing the NeXTStep operating system as Apple’s own next generation OS, which would emerge as Mac OS X some four years later. At the same time, Apple would need to focus on supporting what would come to be called ‘Classic OS’ and, if Newton were continued, spending massive resources supporting NewtonOS. Apple was in trouble in 1997. By killing the Newton, Jobs was able to consolidate programmers, designers, and, importantly, money and general focus to give Apple’s mainstay, the Mac, a fighting chance.

But what about this business of software stacks. Isn’t that the same road they ended up going down with the iPod and iPhone?

With the iPod, yes, but that’s a fairly simple operating system, and, with few exceptions, it’s one that didn’t need to deal with users putting their own data into the system. It didn’t need to run people’s lives. Just their iTunes playlists. iPod’s OS does one thing and does it well.

With the iPhone, Apple chose to share a phenomenal amount of code with the Mac — building on a solid foundation, and then innovating only those elements that were too slow to run on a phone, or user interface elements that don’t make sense for your fingers. But, at its heart, Mac OS X and iPhone/iOS are brothers. This means not only that designers and engineers at Apple need to do less work to maintain it. But it also means that, once you convince a developer they should invest in acquiring the skills to program for iOS, it’s a short hop to convince them to program for the Mac.

It all comes down to two simple tenets: successful products are born from people who want to use them. And, especially in software, time, and, by extension, focus, is the most valuable commodity there is. Allocate it wisely.

Apple WWDC ‘97 Closing keynote, via df. Gruber posted this to point out that ‘focus is saying no,’ but I think the most interesting part is about 13 minutes in. Steve Jobs spells out iCloud 14 years early:

 ”Never have I seen something more powerful than this computation combined with this network … if Apple could make that as plug and play for mere mortals as it made the user experience over a decade ago, that’s one of the things where there’s a giant hole. And I can’t communicate to you how awesome this is unless you use it. And what you would decide within a day or two is that carrying around these non-connected computers, or computers with tons of state in them … is byzantine by comparison. ”

He’s talking in this case more about the traditional file system, simply remote, but the crux of the idea is to separate your data from where you use it, to make the device you happen to be on irrelevant. Which, in a nutshell, is iCloud.

Anyone who invents things, who has projects of their own, can relate to how long it sometimes takes to translate a sketch into reality, how certain projects mutate and evolve, and reemerge years later. I’m still working on software I sketched out years ago. It’s refreshing to see Jobs follow the same pattern. If an idea sticks around for 14 years, it’s probably still worth doing. My guess is that iCloud is more than a decade in the making.

On Viceland today:

As I only just got a smartphone like, three months ago, I’ve spent a significant amount of my life in the Apple Store checking my emails on their free internet. While I’m in there, I usually see if anyone has left any photos in the Photo Booth program and email the best ones to myself. 

Fun. [link]

How the MealSnap app works: Magic!

I was recently talking with someone about a web project of mine that has, at its core, users tagging meals they ate with the foods contained in those meals. I was mentioning that I spend a great deal of time bringing the friction point of tagging those foods down — making it as easy as possible. They brought up MealSnap, an iOS app that has users take pictures of food, and then magically identifies not only what foods are contained in that picture (magic!) but also the caloric content of that food (doppel-magic!).

I couldn’t stop thinking about how they do it. Do they start with the color of a food, and then do some sort of edge detection? Do they have a massive database of images, and it somehow searches for similar ones? Turns out it’s simpler: they upload the pictures to the web, and then pay actual, real humans to type in what’s inside:

Looks like they’re using Mechanical Turk to identify the foods at anywhere from $0.02-$0.05 per picture and then using the data returned from Mechanical Turk to search for calorie information in their already well established database of food.

With a $2.99 price point for the app, DailyBurn would start losing money at around meal 60. By that point, however, Daily Burn has a loyal user that can easily be converted to the sale of another app in their family of products.

(Thanks, justinxreese). Kind of an ingenious shortcut to the simplest solution to a problem: a human can easily tell what’s chicken and what’s fish. A computer program to do the same might take gazillions of dollars to implement well. It’s easier to pay a modest fee to a well qualified human, e.g. one with eyes and a brain and a reasonable command of English.

This Mechanical Turk business? It’s an Amazon Web Service. Why turk?

The name Mechanical Turk comes from “The Turk,” a chess-playing automaton of the 18th century, which was made by Wolfgang von Kempelen. It toured Europe beating the likes of Napoleon Bonaparte and Benjamin Franklin. It was later revealed that this “machine” was not an automaton at all, but was in fact a chess master hidden in a special compartment controlling its operations. Likewise, the Mechanical Turk web service allows humans to help the machines of today perform tasks they aren’t suited for.

Thx, wikipedia. It turns out when MealSnap says their app is “Magic. Pure magic,” they’re not joking. What is magic but taking something that can’t possibly work, is against the laws of the universe as we know it, and faking it in a believable way for an eager audience?

Well played, MealSnap. I await your next illusion.

How the Newton Saved Apple

I was just reading this interview with John Sculley when I came across this: according to Sculley, Apple pretty much gave birth to the ARM processor, which you’re familiar with if you’ve ever used a modern cell phone. The ARM, in turn, saved Apple from an early death:

Most people don’t realize in order to build Newton, we had to build a new generation microprocessor. We joined together with Olivetti and a man named Herman Hauser, who had started Acorn computer over in the U.K. out of Cambridge university. And Herman designed the ARM processor, and Apple and Olivetti funded it. Apple and Olivetti owned 47 percent of the company and Herman owned the rest. It was designed around Newton, around a world where small miniaturized devices with lots of graphics, intensive subroutines and all of that sort of stuff… when Apple got into desperate financial situation, it sold its interest in ARM for $800 million. If it had kept it, the company went on to become an $8 or $10 billion company. It’s worth a lot more today. That’s what gave Apple the cash to stay alive.

So while Newton failed as a product, and probably burnt through $100 million, it more than made it up with the ARM processor… It’s in all the products today, including Apple’s products like the iPod and iPhone. It’s the Intel of its day.

The whole interview, from October 2010, is worth reading. Sculley is smart, and a bit repentant. I’d always seen him as a kind of ‘Apple nemesis,’ but this piece has turned me around. Seems more like a good guy put into the wrong situation.

- link

WWDC Tips From Chris Ladd. Yes, The Chris Ladd.

I’m just back from WWDC, Apple’s World Wide Developer Conference for you non-nerd readers out there. In fact, non-nerds, you might just want to move along. This is not the post you’re looking for.

They gone? Good. If you’re reading this, you either a) just got back from WWDC or b) really, really want to go next year. Either way, I really enjoyed reading other people’s wwdc tips as I prepared for this one, and so I thought I’d share some tips I picked up along the way, most of which I don’t remember reading elsewhere. Most importantly:

Don’t Be Shy

WWDC is like the first week of college: everybody is excited to be there, most people don’t have established friend groups, and there is free beer just about everyplace you’ll go. You do not need an excuse to join a group of people standing around talking. My general MO is to walk up to any random group of fun looking strangers and say ‘You guys look fun. Do you mind if I join your group?’. If they say “YES WE MIND” they’re probably not as cool as you thought they were or they think they are. I’ve never encountered this. Everybody likes meeting people. You can be that people.

 Say I Love You

Not literally. But if you find yourself hanging out with a group of people you like, be sure to establish some tether — business cards, twitter, phone. It’s a big conference, and a bigger city. It’s very possible to see someone once and never see them again. Also, remember that most of you are all strangers in this town, so if you find a cool bar / party / happening, tell your new BFFs about it. Share the fun. 

Use the Twitter

I wasn’t a big Twitter user before WWDC — I didn’t even have a Twitter client installed — but WWDC has made me a believer. Get handles from people you like, tweet your location, plans, etc… it totally pays off. While we’re at it, make sure you put your Twitter handle on your business cards. I didn’t do this, but should have.

Operate in ‘YES’ Mode

Especially when meeting new people, positive attracts. Say YES to almost everything. It’s more fun. Be interested in other people’s work, especially if it’s interesting. Make friends with seat-mates. Line-mates. Bar-mates. Don’t spend too much time shitting on popular web/iPhone software / Apple APIs. The guy behind you in line may have written it. In general, if you have a positive impulse, go with it. If you have a negative one, suppress it. The West Coast seems to bring this out in people naturally.

Don’t Sweat The Keynote

I was torn before I came of whether to camp out early for the keynote — I saw some guys starting to form the line at 4pm the afternoon before. Ultimately, I decided to sleep in, show up around 9am, and commit myself to watching it in the overflow room. The room where they do the keynote holds something like 4,000 people, a significant portion of which are VIPs and journalists. My thinking was that I have a big week in front of me, and I don’t want to start that week exhausted, miss things in the sessions, and possibly get myself sick. I stand by that reasoning. Some people can operate on zero sleep. I am not those people. Regardless of your choice, you will not get to have breakfast with Steve Jobs.

Fill in The Seats

Even in the super-full sessions, if you’re by yourself you can usually grab a killer seat by just walking to the front and finding singles. In several super-crowded sessions, I was able to get a great spot right up front just by asking for it. The downside to this is that if the session isn’t as awesome as you were hoping, you’re pretty much stuck, vs. sitting in the back near the door. Usually a risk worth taking — very few sessions fell short of my expectations.

Location Matters

Especially early on in the week, don’t just look at the session you’re about to go to. Look to see what the rest of the morning/afternoon looks like. If you’re torn between sessions, pick the one that’s in a room where you’re hoping to catch another session right afterwards. The big sessions have lines around the building, but if you’re in already for the previous session, you almost always get to stay, and you can get an even better seat by stealing it from the people who are just leaving, or who foolishly decided to use the bathroom. Which brings us to…

On Peeing

Expect to wait in line to pee. WWDC is the only place I’ve ever been with nonexistent women’s lines, and men’s lines out the door. So, girls win. If you’re a boy and if you only kind of have to go, and if you’re interested in getting a good seat/getting into the next session, you should hold it. You might not get back in otherwise. Speaking of which, you will often be holding something (coffee, lunch, laptop) in your spare hand, so make sure you have one-hand-able flies and underpants. I’ll leave it at that.

Hold Your Place

I didn’t realize this right away, but if you’re in a session that just ended and you want to stay for the next one in that same room, you can leave your stuff on your seat and go out a side door. Make eye contact with the Apple guard and they’ll let you back in without waiting in line. I’m not sure if this applies to the super big sessions, but I had good luck with this method in popular sessions in the small rooms.

Take Two Lunches

But not for the reason you think. The lunch speakers are super popular, and for good reason. All the talks were great. But if you’re in a session right before, you basically have a choice of whether to skip lunch entirely and get a good seat, or go grab a lunch and stand in the back / not get in. If you do happen to have a chance to grab a sandwich, grab as many as you can carry and bring them up to the line to hand out to your fellow nerds. You will be loved. Speaking of food, I’m not a big coffee snob, but Marco was right: eat the lunch, don’t drink the coffee. It’s terrible.

Get Coffee Near Your Hotel

This is a little thing, but the coffee at Moscone is undrinkable, and the Starbucks right next door, understandably, fills up in the morning, and right before big sessions. If you have a choice, grab your coffee near your hotel, and walk with it into Moscone. I ate my breakfast most days in my seat waiting for sessions to begin.

Brightness Down, People

Turn your monitor brightness down, and use a black background text editor. It’s really distracting to have your neighbor’s flashlight in your face while you try to absorb code way over your head. Speaking of which, if your neighbor has a bright monitor, don’t sit there and silently fume. Just ask if they would turn it down. They will, and they won’t be mad.

Take Two Showers

It’s a long day. If you’re like me, and you tried to catch almost every single session, you’re up at 8, then bouncing around from nerdfest to nerdfest until evening, and then partying like a nerdstar until the early morning. I got in the habit of going back to the room after the last session of the day, taking a quick nap (20 minutes or so) and then taking another shower before getting dressed to go. I really think this helped me to keep energy up night after night, possibly by tricking my body into thinking ‘Hey, it’s morning!’. Have a cup of coffee on the way to wherever your evening plan is, also.

Get the Party List app

I’ve heard people complaining about this thread blocking thing, or that design choice, but come on: this guy made an app that is basically public service for all of us WWDC peeps. He’ll never see a dime on it, and he probably did it while he should have been doing something else, which is to say that any shortcomings are likely the product of building it quick because he’s a nice guy.

I never met him, but everyone should give him a dollar and a new pair of disco pants. Especially early on in the week, it’s great to always have somewhere to go, even if you have no friends. So, thanks. At the very least, you should go leave a sweet review for the guy on iTunes. 

Bring Your Gym Clothes

Speaking of partying, you’re going to be asking a lot of your body over the course of a week. You should try to do something nice for it and slip in a quick workout at some point. So bring a pair of sneakers and some shorts. I didn’t think to do this, so I bought a pair of shorts and sneakers at NikeTown. Really glad I did. Speaking of clothes:

San Francisco is Not LA

It’s cold here, especially at night. Dress accordingly. The weather in June feels a lot like a New England October. If you find yourself underdressed at the beer bash on Thursday, and you were smart enough to get a close hotel, go back for a sweater. You’ll be happier, and it’s not getting any warmer.

Get a Close Hotel

Everyone says this, but they say it for a reason. I stayed at the Grand Hyatt, which is, I think, roughly the limit of far-ness. You want to be able to walk home from Moscone in 5 minutes. Pay significantly more for this if you have to. It’s worth. it. Also, the Hyatt has a killer gym. Just saying.

Maintain Two Sets of Business Cards

I have one stash with phone numbers written on the back, one without. You’ll meet two main categories of people out on the town: people who are down to hang out and chat about, you know, like whatever. And people trying to sell you something, or, in the case of recruiters, sell you. 

Annotate Business Cards Immediately.

You will forget who these people are. Write a quick note on the back of any business cards you get that are connected to people you’d genuinely like to get to know / correspond with. Something like ‘Has beard, glasses, met at X bar, talked about South American handball.’ It seems like a scummy, business school kind of trick, but you’re going to be meeting dozens of people, maybe even hundreds, every day. Give yourself at least a decent chance of remembering the ones you clicked with.

Schedule Late Flights

This is an easy way to prevent yourself from tiring unnecessarily: schedule late flights, on both ends, even if they cost more. It’s worth it to not have to call it an early night on your last day. Allocate a full day on each end for travel / winding down. Definitely nothing earlier than mid-morning. Shoot for mid-day.

Wear Your WWDC Jacket On The Plane

I’m not going to weigh in on the merits of joining or not joining the black-jacket-brigade for the week in San Francisco, but you should definitely wear the jacket on your flight home as a nerd beacon. In fact, I’m planning on wearing it around for the next week, so if you see me around Boston, come say hi. I’m the guy in the black jacket with the 11 on the back

Go.

My last tip is simple: Go. This week has been up there with the best in my life, and certainly the best in my NSNerdLife. If you’re at all serious about nerding it up on iOS, I’ll see you in 360-ish days at Moscone.

DevColor: free, simple, color representing strings for developers

Dear world: In a shameless bid to make friends before WWDC, I’m releasing a new, open source color editor today: DevColor.

DevColor is a simple, graphical tool I built to make my life as an iOS, Mac and web developer better. For the past several months I’ve been using DevColor every day as a lightweight tool to generate color-representing strings in a variety of formats. Now you can too.

DevColor lets you choose colors graphically, and generates the UIColor, NSColor, Hex, RGB, and RGBA code to represent them. You can also paste in any color representing string in those formats, and DevColor will let you tweak it in a variety of ways, automatically generate complementary colors, and spit it back out in any format you wish.

You can get the full source of DevColor, under MIT license, for free on GitHub (here), or download a fully compiled version of the DevColor app that will run on your Mac, here.

Either way, check out the documentation for a quick overview of what DevColor can do for you.

[ link ]

NYTimes reports Seinfeld is going to be doling out his standup career online, three clips at a time partly, he says, as a way to re-familliarize himself with himself

Reviewing some of his performances from the early 1980s, Mr. Seinfeld said he saw in them “a newborn fawn — the knees were very wobbly.”

But when he reached the end of that decade, just before he was offered the television series that changed his life, Mr. Seinfeld said: “I’m watching it and thinking: ‘Boy, he’s really got it together now. He knows how to write and how to perform. Something should happen to this guy at this point. I hope something breaks for him.’ ”

Looking forward to it - can’t wait until they do the same for the TV show - that’s a gap-tooth in the Netflix streaming lineup at present…

David Simon, who wrote The Wire, talks about using real life to ‘shut doors’ on creativity. I feel the same way, and it’s why in my writing, I’ve always preferred non-fiction, lousy reporter as I might be. Working with truth does a lot to fill the blank page.