Eric Schmidt working with Pentagon

I prefer Apple to Google. My preferences side with Apple because their hardware is superb, their OS is a lovely shiny UI and ecosystem atop a solid UNIX foundation, and their interests align with mine: they make hardware, I buy hardware, we both win.

There’s no denying the centrality of Google to digital life, however. If you want to find more information something, see a video of something, or communicate with colleagues, chances are you’ll use a Google service. And for some weird reason to do with our perceived value of non-tangible objects, we refuse to pay for this central fact-of-life, and so Google has found ways to monetize that aren’t directly inline with my interests.

For instance, Andrea Shalal reporting for Reuters via John Gruber:

Eric Schmidt, the former chief executive officer of Google, will head a new Pentagon advisory board aimed at bringing Silicon Valley innovation and best practices to the U.S. military, Defense Secretary Ash Carter said on Wednesday. Carter unveiled the new Defense Innovation Advisory Board with Schmidt during the annual RSA cyber security conference in San Francisco, saying it would give the Pentagon access to “the brightest technical minds focused on innovation.”

Makes perfect sense: software is a munition, after all, so why shouldn’t Google be a defense contractor? I hope this relationship truly is about innovation within the military which ultimately brings good to world instead of increased spying on citizens, or worse, more effective destruction.

Slack planning voice and video

I strongly dislike Slack: it’s an overhyped and proprietary web wrapper around IRC with history. It works just fine, but it bills itself as a replacement for email, which it isn’t, and so it’s become just another thing I have to check. Having said that, TechCrunch report and iMore paraphrase:

Slack plans to roll out voice and video chat this year, making the popular messaging company even more competitive with incumbents like Microsoft’s Skype and Google’s Hangouts. That’s according to their 2016 product roadmap, presented to customers at a conference today in San Fransisco.

I’m glad, because then I can stop saying that Slack is just an web wrapper around IRC with history, and people can stop telling me that “No! It’s also got zany error messages and GIFs.” I hope that Slack can do a better job than Skype, Hangouts, FaceTime, and all those awful corporate conferencing applications, because it’s a market which could really use improvement.

However everyone should stop using Slack for open source projects. Because it’s proprietary and costs money and is just a web wrapper around IRC. So stop it.

John McAfee on Apple vs. FBI

In an interview given to RT, software legend John McAfee claims that unlocking the iPhone is a “half-hour job.” This part of the interview is just wrong: it may have been the case that passwords were stored in memory in the past, but I don’t believe that’s the case any more. For instance, if I were Apple and I was implementing the iPhone unlock system, I’d encrypt the disk without storing the password, and when the user enters the password I’d attempt to decrypt the disk with that key. I’d then check to see if some known (and non-sensitive) value in memory was correctly decrypted or gibberish.

He does raise an interesting dilemma, however, and that’s that either:

  1. The FBI does not know how to access the iPhone’s information, and they should because there a well-funded federal agency;
  2. The FBI does know how to access the iPhone’s information, and so they’re deceiving the American people.

I find (1) much more likely in this scenario, or rather, that they do not know how to access the iPhone’s information easily, and would prefer that they have a precedent to get Apple to do it in the future. I find this more likely because iPhone’s have zero day exploits: I don’t have one, I wouldn’t know one if I saw one, but it’s a massive user base with a large attack surface area, they undoubtedly exist and the FBI undoubtedly have access to people that can get them. But it’s hard, costly, and the best hackers smoke weed and don’t wear suits.

The first self-driving car accident

As artificial intelligence and machine learning is increasingly commercialized, it’s going to begin challenging our legal and moral notions of agency, blame, and responsibility.

Google’s self-driving car had a very minor accident with a bus, and Reuters had this to report about it:

Alphabet Inc’s (GOOGL.O) Google said on Monday it bears “some responsibility” after one of its self-driving cars struck a municipal bus in a minor crash earlier this month.

The crash may be the first case of one of its autonomous cars hitting another vehicle and the fault of the self-driving car. The Mountain View, California-based Internet search leader said it made changes to its software after the crash to avoid future incidents.

Some stray observations:

  • I’m surprised Google owned up to even “some responsibility”, as I would have thought they were eager to shed all responsibility early in the product’s existence, because while in the long run they’ll be less accidents with robot drivers, I’m uncertain that the first batch will always be so fortunate.
  • I imagine this is 100% the fault of the bus driver, and for purely an unfair reason: as an bike rider, I see how bus drivers in New York City act on the road, and it isn’t always friendly.

Playgrounds get video support

Playgrounds are such a wonderful feature of Xcode and the growing Swift ecosystem: they drastically lower the barrier for entry for learning the language and for experimenting. I have countless “experimental projects” that are just empty view controllers which have some interesting code snippet, and Playgrounds are a much better way of supporting this use case.

Erica Sadun has discovered an exciting new feature in Xcode Beta 5:

What you do is this, you add movie files to the playground’s resources. You can then add specialized playground rich text:

//: ![Alternate text](video width="width" height="height" poster="poster")

You won’t see the video until you render the rich text.

The markdown rendering and rich content embedded in Playgrounds is going to make them great for education. There’s nothing like running code to prove a point, and having educational content sit side-by-side with running code is a brilliant way to learn. I hope the project format for Playgrounds sees adoption on Linux and Windows so that more people can learn from them.

Proofreading software

When a company markets a product as perfect and constantly re-invents it, there will be growing pain. There are some issues that should almost never exist with even a modest QA process however, which includes proofreading, and here’s Stephen Hackett describing a grammar problem in Disk Utility:

  1. The first sentence should read “….destroy all of the data.” It currently transposes “all” and “of.”
  2. “Enter a name, choose a format” is a comma splice. Break it into two sentences or use a semicolon.

Even given Apple’s software woes, this is an unfortunate misstep for a core system utility.

App Store review and rule-of-law

The App Store review time is a contentious issue for iOS developers. As a user of iOS, I like it, because it means that I never fear downloading an app, knowing it has at least been vetted for the worst offenses. As a developer, the biggest obstruction to making iOS development as responsive to change as Web development is undoubtedly App Store review times. Here’s Dave Verwer from iOS Dev Weekly:

So, is App Store review still providing a useful service? Did it ever? My opinion is that at the very start it definitely set a tone and stopped the immediate flooding of the store with crap. However at this point, I’m not sure it’s really providing many benefits. Half finished and completely useless apps still get through all the time so it’s definitely not providing the quality control that was promised. More importantly, it continues to stifle innovation through fear of (and the reality of) rejection as we’ve seen time and time again.

I don’t think his points make the case to remove App Store review, but rather that there should be rule of law with regards to App Store review. Inconsistent enforcement is what’s stifling innovation through fear of rejection: multiple times in my career, an app has been rejected for something that had not changed since the last version, pointlessly slowing down development. These should have been cases of “approved, but make these changes for next submission.” Furthermore, I think that organizations in good standing should get approved-by-default status with periodic audits.

GovtOS and resignation as civil disobedience

In the debate between Apple and the FBI, the software giant has filed an appeal to dismiss the the court order. On page 13, there’s a very interesting section discussing what it would take to develop the custom version of iOS that would allow the government to brute force passwords on someone’s phone (which has come to be known as “GovtOS”):

The compromised operating system that the government demands would require significant resources and effort to develop. Although it is difficult to estimate, because it has never been done before, the design, creation, validation, and deployment of the software likely would necessitate six to ten Apple engineers and employees dedicating a very substantial portion of their time for a minimum of two weeks, and likely as many as four weeks.

Up to ten engineers for up to four weeks, Apple believe GovtOS will take. I have to wonder what I would do if I were given this assignment. I consider it similar in some respects to what must have gone through the heads of Volkswagen engineers that were asked to create a way to fake emission reports: it’s immoral and it’s my job. Unique to the Apple case, however, is the addendum that it might be illegal to not do it. I do not envy the engineers that get this assignment should Apple be compelled to create GovtOS, and I imagine that it would be given to their most trusted and senior members.

I’d like to say that I’d resign in that position, but the fact is, with a court order, if someone chooses not to do it, they will be replaced with someone that will. And a project of this fragility deserves to be in the most trustworthy and capable hands. Having said that, resignation as civil disobedience would weigh heavily on my conscience.

When a word or phrase regularly finds its way into how we talk, I encourage finding another purely because it becomes cliche. E.g. "lessons learned" (or worse, learnings), "deep dive", and "considered harmful."

When a word or phrase regularly finds its way into how we talk, I encourage finding another purely because it becomes cliche. E.g. “lessons learned” (or worse, learnings), “deep dive”, and “considered harmful.”

Android and iOS development side-by-side

Mobile platforms are polarizing, and it doesn’t help that’s there’s effectively only two. To that effect, I thought it’d be instructional to complete the same simple tutorial on both platforms to get an appreciation of what each does well and what each does differently. This tutorial will read something like “beginning Android for iOS developers.” The Android portion of this tutorial is inspired by “Android Programming: The Big Nerd Ranch Guide” by Bill Phillips, Christ Stewart, Brian Hardy, and Kristin Marsicano (if you want a more rigorous look at how to do this on Android rather than a compare and contrast, it’s a good book). The goal is to make an app which presents the user with a single question and informs them if it’s correct or incorrect.

Let’s start with Android. Some preliminaries: install Android Studio and the SDK installed on your computer and start a project. Now, navigate to your custom activity XML file (app/src/main/res/layout/activity_my.xml) and create a RelativeLayoutTextView, and two Button objects.

Note that the visual editor gives you the option to either input the text into the text views and buttons directly or create a new “value” for it, and either is fine. The new value option is quite interesting, however, as it works by placing the string in an XML file of your choosing and referencing it with a key-value pair. I imagine this is hugely useful when reviewing copy or localizing, but it does add a level of indirection for smaller projects where it’s not needed. String management is a pain-point I experience on iOS, so I definitely appreciate this feature.

You should also be sure to look at the properties of your button objects and give them IDs. The IDs are used to generate a file called R.java that maps this IDs to constants so you can access them at runtime. This is the same file that the strings get entered in to. I find this cumbersome compared to IBActions and IBOutlets on iOS, which allow you to drag and drop actions and references to files as you see fit, without needed to go through a generated file.

Now you should have something that looks roughly like this:

ih

The experience of setting this up in Android Studio is much better than it was in Eclipse. The IDE has a feature to hide a lot of the configuration files that you don’t need to worry about all the time and the visual preview works pretty well. Admittedly, the drag-and-drop visual editor functionality does not work so well, as it’s difficult to get your UI element into the view collection you want it to go in. Just like in Xcode with XML for UI, you have to open up the source file and modify it manually, however I get the impression that as I learn more Android there will be a lot more time spent manually writing XML than I ever spend on iOS, which is almost exclusively to resolve conflicts.

To perform the same path on iOS, download Xcode and start a new project. Go to the storyboard file and drop your UI elements into the square view. I recommend trying out stack views to do this, as they are a new feature with iOS 9 and they’re supposed to solve some of the pains with Auto Layout. Here’s what it ends up looking like:

Screen Shot 2016-02-26 at 6.42.46 AM

Android and iOS’s visual UI editors are in many respects equals. They both are XML editors and they both have quirks. I find the layout engine in iOS, Auto Layout, to be very powerful, but many people complain that it is difficult to use so I may just be experiencing Stockholm Syndrome.

Now that we have our UI finished, let’s write some code. The next step is to hook up our buttons to fire off a UI element which indicates to the user whether or not the answer they chose is correct. On Android, you get a reference to a view object from XML by asking your activity to find the view with an ID you set in the XML file. Like so:

this.mTrueButton = (Button) this.findViewById(R.id.true_button);
this.mFalseButton = (Button) this.findViewById(R.id.false_button);

While I like that generated resource file for the images and strings, I must say, I find this a very convoluted way of getting an association between a serialized view and an activity. If this were iOS and you wanted to get a view in your view controller, you could just directly map over a reference. But this isn’t so bad. Now that we have the buttons, it’s time to give them behaviors by setting their on click listeners:

this.mTrueButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Toast.makeText(QuizActivity.this,
                R.string.correct_toast_text,
                Toast.LENGTH_SHORT).show();
    }
});

this.mFalseButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Toast.makeText(QuizActivity.this,
                R.string.incorrect_toast_text,
                Toast.LENGTH_SHORT).show();
    }
});

Note that the on click listeners are a property on the button which you define the behavior of by creating an anonymous inner class. This is a cool way of getting block-like behavior and syntax out of Java. Also, a “toast” is an Android UI element which shows up briefly towards the bottom of the screen and contains some text.

To perform this same operation on iOS, open up your storyboard and view controller side-by-side by Alt-clicking in Xcode. Then, control-click-and-drag from the UI element you want a reference to from the storyboard into the view controller file, and select that you want an IBAction, which is like an on-click listener. You can make one for each button, or if you want to get clever you can make multiple buttons to the same IBAction and determine what to do at runtime. While iOS has no native notion of toast, I’ve hacked together one using UIAlertController and Grand Central Dispatch for sake of parity.

class ViewController: UIViewController {
    @IBAction func buttonTouchUpInside(sender: AnyObject) {
        guard let sender = sender as? UIButton else { return }
        let title = sender.titleLabel?.text == "True" ? "Correct!" : "Incorrect!"
        let alert = UIAlertController(title: title, message: "", preferredStyle: .Alert)
        self.presentViewController(alert, animated: true) { () -> Void in
            let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(1 * Double(NSEC_PER_SEC)))
            dispatch_after(delayTime, dispatch_get_main_queue()) {
                alert.dismissViewControllerAnimated(true, completion: nil)
            }
        }
    }
}

This code conditionally unwraps the sender into a button, and if it is a button, checks to see if it’s title is “True” to build the “Correct!” or “Incorrect!” text to display to the user. To do this, it uses a UIAlertController with that title, presents it, and when presentation is complete it waits 1 send to subsequently dismiss this alert controller.

Swift is truly magnificent. That code block above is not a snippet, that’s the whole view controller. In Android and Java and an Activity, the whole thing becomes quite long and nested fairly quickly. It does seems that if you’re going to use anonymous inner classes and getting views by IDs, however, you have to place it in a non-top-level function somewhere.

This is just a very thin top-to-bottom slice of the development for both Android and iOS. Admittedly, I prefer iOS development on account of its new language Swift and less cumbersome SDK, but this comes at the cost of not supporting older platforms and less ubiquitous third party libraries and community discussion (which Java has plenty of). Although perhaps soon they’ll be the best of both worlds, as it was recently proposed that Swift should get Android support!

Swift ported to Android

There has been a great disturbance in the Swift community: Brian Gesiak has done the work necessary to get Swift up-and-running on Android and opened a pull request on GitHub.

This adds an Android target for the stdlib. It is also the first example of cross-compiling outside of Darwin: a Linux host machine builds for an Android target.

If this draws the ire of higher-ups at Apple, this could get … interesting. Apple have clearly acknowledged Android more than they have historically with 2 native Android apps. Further, they stand to benefit from Swift’s wider adoption. But there is a sense in which Apple loses by improving the development environment of Android with the clearly delightful Swift. On my view, Java has yet to catch up to Objective-C considering the lack of blocks, never mind Swift and its tuples.

Google have a neural network that takes a photo and returns a location

Google have trained a neural network that can determine with better accuracy than humans the geographical location given an arbitrary image; from the MIT Technology Review:

That’s impressive work that shows deep neural nets flexing their muscles once again. Perhaps more impressive still is that the model uses a relatively small amount of memory unlike other approaches that use gigabytes of the stuff. “Our model uses only 377 MB, which even fits into the memory of a smartphone,” say Weyand and co.

That’s a tantalizing idea—the power of a superhuman neural network on a smartphone. It surely won’t be long now!

That is indeed tantalizing, and while this trick is in some ways a gimmick, it’s a great part of an intelligent system. The hard part about this is to compose these skills into a system than can use the right skill at the right time, analyzing an image for location when needed, finding the shortest path when needed, seeing the trend in data structures when needed, etc.

Microsoft support Apple in the right to privacy

After the Microsoft CEO and founder expressed at best lukewarm support for Apple’ defense of the right to privacy, Bloomberg report that they’re going to stand with Apple on encryption in a big way:

Microsoft Corp. will file an amicus brief next week to support Apple Inc. in its fight with the U.S. government over unlocking a terrorist’s iPhone, President and Chief Legal Officer Brad Smith said at a congressional hearing Thursday to discuss the need for new legislation to govern privacy.

Good for them. This puts them on the right side of history, in my opinion, and I hope it’s enough to sway our government. The US government should be a leader here, because other nations will consider what happens here when making their policy.

Microsoft Acquires Xamarin

Xamarin is a cross-platform development tool that’s built on Microsoft-sponsored technologies, here’s the announcement:

As part of this commitment I am pleased to announce today that Microsoft has signed an agreement to acquire Xamarin, a leading platform provider for mobile app development.

In conjunction with Visual Studio, Xamarin provides a rich mobile development offering that enables developers to build mobile apps using C# and deliver fully native mobile app experiences to all major devices – including iOS, Android, and Windows.

This is a massive power grab from Microsoft, and could be leveraged to put them back on top. Consider that Microsoft have a way for developers to take iOS and Android codebases and ship it on Windows 10 using a compatibility-layer approach. If you look at their offerings on competitor’s platforms, you might think they’ve taken a “if you can’t beat them join them” approach, but it’s becoming more and more “if you can’t beat them become them.”

Apple introduces Podcasts Connect

A couple days ago, I received an email from Apple regarding podcasts, which announced a number of new features that the iTunes service has for podcasters, including:

Introducing Podcasts Connect
Podcasts Connect is the primary place to manage your podcasts on the iTunes Store. Here you will be able to validate and submit podcasts to iTunes. You will also be able to manage availablity once your podcast has been approved.

Get started using Podcasts Connect.

Right now it just lets you manage your shows, and it is much better than the older webforms I had to use to set up my podcast. An exciting development for anyone that wants to get into podcasting, because it’s now easier than ever. I hope this includes analytics one day, it could be a huge boon for podcasters that want to attract advertisers.

The March 2016 issue of Hacker Bits published with yours truly

A couple weeks ago, Ray Li of Hacker Bits reached out to me asking to reprint some of my writing in the periodical. I clicked around the site and found that it’s a beautifully typeset publication, check it out. Here’s a synopsis:

Wow! What a month! We just put the finishing touches on the March 2016 issue of Hacker Bits.

The issue line-up is a great mix of startups, programming bits, opinion pieces topped off with a DIY camera article!

The Walking Dead S06E10: "The Next World" Review

Spoilers ahead. After the madness and gore of the mid-season premier, The Walking Dead picks it up a couple weeks later when things have quieted down a little bit: it’s safe to rebuild walls, take care of the baby, and begin thinking of getting some more food. I have a hard time watching The Walking Dead, admittedly, because when things are going badly for our ragtag team of zombie killers, I feel sad about it. And when things are going well for our protagonists, I don’t get comfortable because I know it’s coming.

Such was the case with the first major plot point: Rick and Daryl leave together to go scavenging. It was an entertaining vignette, full of snappy dialogue and interesting developments, but before we get to that why the hell did they leave as a pair. Seems to me with the impending threat of “Negan”, which Daryl knows about and has presumably told Rick about, deserve a little more precaution. Certainly a level of precaution above and beyond blasting music while revving the engine, as Daryl rightly objected to. Further, when your hauling what is perhaps the single greatest find left around due to the “law of averages”, you do not use it to tow a soda machine, especially when you’re being hunted.

This brings us to the next plot point: Jesus. Rick and Daryl have seen some terrible things, they’ve done some terrible things, and well, it’s gotten to them. I’d have to imagine that if The Walking Dead were real, which I seem intent on treating it like it is, that they’d have killed Jesus on the spot, no questions asked. Perhaps it shocked them, perhaps they’re still hesitant to kill strangers, and perhaps either of these possibilities will turn out for the best, but the fact remains that Rick and Daryl colossally messed up in letting Jesus do what he did. Having said that, he’s a terrifically interesting character and I look forward to the content of his talk with Rick in the nude.

Much of the other vignettes of the show were built around the theme of family: where Maggie tried to convince Enid to be a part of the gang, where Carl and Enid try have fun in the wilderness like the good old days, Spencer having to confront his undead family to join a new living one, and Michonne becomes closer to the Grimes than she’s ever been. While I found the pacing of these parts a little prolonged, I enjoyed just hanging out with the bunch without too much fear that all was going to go awry.

“The Next World” was a balanced episode which leaves me excited for the future: Jesus the scoundrel fascinates me in much the same way the lead of “Negan’s people” in last episode did, #Richonne feels totally right and I caution them against getting too happy because I want neither of them to die, and the worry of Negan hangs over all of this.