Learning to curse

I forgot how much I hate the fickleness of writing software!

I finally gave up on Swift (for now). It’s a easy to pick up language because it resembles more a modern scripting language than a compiled one, and frees you up from historical artifacts like Smalltalk, C pointers, and reference counting. Plus you get awesome things like playgrounds:

Sure, it takes a little bit of chucking random “?”’s and “!”’s in your code before you get the hang of optionals, and I’d fear the performance of a basic structure like a b-tree written in Swift, but it interoperates with C and Objective-C so I don’t have to worry.

Or so I thought. Because of strong typing and the lack of built-in overloads, poorly documented character-based1 functions, here is how I inject a a random letter into a string:

let randomletter = "\(String(UnicodeScalar(65 + Int(arc4random_uniform(26)))))"

And then you find it doesn’t always release variables when you use optionals. create some optional simple objects, add them to an array reset everything and see what your NSLog() (e.g. println())) prints in your deinit:

e.g. BNRItem.swift:

import Cocoa
import Foundation

class BNRItem: NSObject, Printable {
    var itemName:String
    init(itemName name:String)
    {
        self.itemName = name
        super.init()
    }
    deinit {
        println("Destroyed \(self)")
    }
    class func randomItem() -> BNRItem
    {
        let randomAdjectiveList = ["Fluffy", "Rusty", "Shiny"]
        let randomNounList = ["Bear", "Spork", "Mac"]

        let adjectiveIndex = Int(arc4random_uniform(UInt32(randomAdjectiveList.count))) //arc4random() overflows Swift int
        let nounIndex = Int(arc4random_uniform(UInt32(randomNounList.count)))

        let randomName = "\(randomAdjectiveList[adjectiveIndex]) \(randomNounList[nounIndex])"
        return BNRItem(itemName: randomName);
    }
   override var description:String {
        return "\(itemName)"
    }

and main.swift:

import Foundation

var items = BNRItem[]()

var backpack:BNRItem? = BNRItem(itemName: "Backpack")
items.append(backpack!)
var calculator:BNRItem? = BNRItem(itemName: "Calculator")
items.append(calculator!)
backpack = nil
calculator = nil
items.append(BNRItem.randomItem())
items.append(BNRItem.randomItem())

for item in items {
    println(item)
}

// Destroy the mutable array object
println("Setting items to nil…")
items = []

creates 4 items, deletes three. Hello, memory leaks!

Then there are issues when you call C functions like CoreGraphics from Swift. My personal favorite is depending on if I restart Xcode before compiling, one of my apps compiles file or throws an error:

SetAppThreadPriority: setpriority failed with error 45

Great!

That’s not to say I won’t use it for the future. It’s just too frustrating for me to programming model (Cocoa Touch) in a language that I’m rusty at (Objective-C) in a new IDE (Xcode), translate to a language I don’t know (Swift), and not know if my errors are my own stupidity, or just the compiler is buggy.

Yes, someday Swift, and Swift playgrounds for learning the language, and perhaps even a mix of Swift and Objective-C in a iOS project, but I’m putting the language down for now until I learn Cocoa Touch.


  1. as opposed to string based functions ↩

Learning to smile

Learning to smile

I’ve been a manager for 2.5 years and I’ve been too long away from programming. There is something just so wonderful about being able to work again in a world where there is a right and a wrong.1

I decided to start to finally2 teach myself iOS development today for: first, because I’ve never done it before and second, because it’s an opportunity to learn a new language and re-learn an old one3 I haven’t done for over a decade.

We’ll see how it goes. I’m not optimistic.


  1. …and getting the feedback to know which is which! ↩
  2. This does not count. ↩
  3. If you call writing a median-based BPM counter for Mac OS X, “learning.” I think the jury is still out since Xcode, memory management, and the user-interface are so different now. ↩

TechCrunch dreams

In 2008, I had a friend who was the co-founder and CTO of a startup. He was getting a lot of pressure from the other co-founder to get into TechCrunch. I said, “Why the fuck does anyone want to be in Techcrunch?1 The only people who read it are your competitors.”2

This morning just before I woke up, I dreamt that I found out that TechCrunch had made it into the top ten most popular websites.

In my dream, Michael Arrington still owned them and through a systematic analytically-driven approach of A-B testing subject lines, content, and marketing, they had applied it to an entire network of blogs to make it very popular. Michael had picked up ballroom dancing as a hobby and even his ballroom dance blog, through this approach, had become far more popular than it deserved to be.

I started thinking, “Wow, that’s crazy. I remember back in 2005 when TechCrunch was so unknown Michael had to comment on Scoble’s blog to get traffic.3 Who would have thought it could become so popular?”

Then I woke up and remembered that nobody reads TechCrunch.4


  1. Usually it’s because they have a tiny ego and need to be a big fish in a very tiny, tiny pond. BTW, I remember at the time Tagged was really obsessed with TechCrunch. ↩
  2. I suppose given the big Valley circle jerk, another valid reason is if you are seeking funding from investors. ↩
  3. This part is true↩
  4. Not even your competitors. Because even if TechCrunch does write about you, they won’t catch it before it scrolls off the front page an hour later. ↩

The Uber-truth about the slavery economy

When I first heard someone use the term “the sharing economy” last year:

Me: What the fuck is “the sharing economy”?

Someone: It’s a catchall for businesses like AirBnB, Uber, Lyft, TaskRabbit and the like.

Me: Sounds more like they should call it “the slavery economy.”1 Give it a few years for that bubble to go the way of GroupOn.

What did I mean?

Well to take one example, this was sent to me recently by a friend because it appeared on her feed and she was curious how they got the numbers:

UberX truth in advertsing

Should say “Apply now and start making serious cash… for Uber’s investors.”

Let’s do the math, shall we?2

Continue reading some Uber math after the jump

LinkedIn and the dangers of A-B Testing

LinkedIn brags about their use of A-B testing.1

Here is a fucking clue, guys. When you vary where a mail header (from:2, to:, subject: line, etc.), you bypass peoples’ mail filters and of course e-mail open rates will test higher.

Fuck you, LinkedIn

So many companies don’t know the limits of analytics. To those idiot business analysts that are data-driven instead of data-informed: please DIAF. ktnxbai!


  1. Never mind the fact that LinkedIn took years to go viral and only after Reid Hoffman became on Tagged’s Board of Directors. ↩
  2. invitations@linkedin.com, member@linkedin.com, invitations-noreply@linkedin.com, communication@linkedin.com, messages-noreply@linkedin.com, updates@linkedin.com, communication@linkedin.com, connections@linkedin.com, … ↩