FBI jealous of China

The FBI have made the point that Apple should comply with the order because they’ve apparently done something similar in China:

If Apple can provide data from thousands of iPhones and Apple users to China and other countries, it can comply with the AWA in America.

I read this as:

Hey! No fair! Other governments get to trample their citizens rights and so should we!

The argument should be instead that maybe if an authoritarian government insists on Apple’s subjugating users that this behavior has no place in the land of the free and the home of the brave.

"Why didn’t you just write a blog post?"

Sudophilosophical is an experiment: I’ve heard claims that blogging is dead, I’ve been encouraged to go with the flow and publish where the readers are (Medium supposedly), I’ve been called a paranoid narcissist for insisting on owning my “content” (whatever that is), and many of these claims are compelling and reasonable (but still wrong). However, when and if the tech bubble bursts and the chosen unicorn publishing platforms of Silicon Valley are forced to monetize or die (see LinkedIn, Twitter, soon Medium), I hope this drives more people to own their own content and publish it themselves with a copy left license, reviving a bygone era of blogging bliss and Internet citizenry.

Or perhaps I’m delusional, but anyway, I was pleased to read Craig Grannel writing on his Revert Saved blog that:

So I’m trying something new, getting back to writing more regularly here again, but with shorter, sharper articles. I’m not sure what themes (if any) will emerge, nor even what kind of voice. But I hope any of you who are still checking in now and again will enjoy at least some of what is posted over the coming weeks and months.

Yes! Yes please do! Because RSS is an open web version of Twitter and we don’t need them to have a public discourse!

The smaller iPhone as a big deal

There’s a lot of buzz regarding Apple’s upcoming March 21st event, in particular about an expected smaller iPhone. Dan Moren writes for Macworld:

To me, the iPhone SE is an important move for Apple because, like the larger-sized Plus models before it, it indicates that Apple has passed the idea that the iPhone is a monolithic, one-size-fits-all device. And while I don’t think that the addition of the SE to the lineup will send iPhones sales back into the stratosphere any more than the iPad Pro did for sales of the tablet line, I do think that it adds another leg to hold up the stool that is the iPhone platform.

This is another hallmark characteristic of Tim Cook (along with being a stalwart on privacy, of course), that all of Apple’s core products have versions that are bigger and smaller: iPhone SE, iPhone 6s, iPhone 6s Plus; iPad Mini, iPad Air, iPad Pro; MacBook, MacBook Air, MacBook Pro Retina 13 & 15 … I rather appreciate the degree of choice, but there is a mystique with the “any color as long as it’s black” strategy. I think, uncontroversially, that the supposed iPhone SE will be great, it won’t transform Apple and the way we think about computers, and it won’t be a flop, but it’s no iPhone, if you know what I mean.

Apple vs. FBI is getting heated

Chris Welch of The Verge reports:

As Apple and the FBI head to another hearing on the San Bernardino iPhone case, both sides are growing more aggressive — and the exchange is quickly turning negative. Hours ago, federal prosecutors filed a motion that said “Apple’s rhetoric is not only false, but also corrosive of the very institutions that are best able to safeguard our liberty and our rights.” The government also pushed back against Apple’s concerns over the “backdoor” to iPhone making its way to the wrong hands. “Far from being a master key, the software simply disarms a booby trap affixed to one door.” Well, Apple isn’t very pleased with the government’s latest filing.

The company just held a conference call with members of the press, describing the prosecution’s motion as a “cheap shot” brief that takes away from the debate over consumer privacy and encryption’s role in preserving it. But Bruce Sewell, Apple’s general counsel and SVP of legal, had harsher words still. He accused the government of trying to “vilify Apple” on unsubstantiated theories.

Earlier today, Russel Brandom of The Verge reported:

Apple just pulled off a major scheduling coup. After months of rumors, the company announced today that its next product keynote will come on March 21st, just one day before the company defends itself against government efforts to break security on a phone linked to the San Bernardino attacks.

We’re absolutely going to see this issue mentioned at the keynote. It’s one of Apple’s most public and influential means of communicating with their customers. I hope they’re a specific call to action, i.e., “go to apple.com/privacy to find a list of congressman and senators to contact.”

Google doesn’t prioritize iOS apps

There’s a lot of animosity about Google’s applications on iOS. Michael Tsai posted a roundup:

Federico Viticci:

No matter the technical reason behind the scenes, a company the size of Google shouldn’t need four months (nine if you count WWDC 2015) to ship a partial [Google Docs] compatibility update for iOS 9 and the iPad Pro. Google have only themselves to blame for their lack of attention and failure to deliver modern iOS apps.

Other Google apps also lag behind on iOS. Kirsty Styles:

After launching on Android in October last year, a pitstop feature has finally dropped on Google Maps for iOS today.

One of the major competitive edges that iOS has on Android, as I see it, is the quality of apps on the App Store. I recently experimented with using an Android handset, and my experience is that all the “big names” have pretty good apps: Uber, Facebook, Twitter, Instagram … even Apple Music. But as your needs get more obscure, a Reddit client, an RSS reader, a podcast client say, so the apps get worse. This of course isn’t uniform, but I did find it striking. I bring this up because if Google doesn’t “prioritize” iOS because they don’t want to “help” their competitor, they’re only harming their own credibility. People will use alternatives (for instance, MS Office is really quite exemplary on iOS).

If I were Google and I didn’t want to “help” Apple, I’d make world-class web apps for mobile instead of half-assed native apps for mobile. As a comparison, Apple, Apple of all companies, do not have “iOS-like” apps on Android, they’re good Android citizens.

The Walking Dead S06E12: "No Tomorrow Yet" Review

Spoilers ahead. This episode was one of the darkest ever. In a way, the undead are to The Walking Dead what stormtroopers are to Star Wars: they’re dangerous, but also cannon-fodder. I found the last few episodes at times deeply unsettling because of how scary they were and the violence, but it was obvious who the bad guys were: the zombies and the Wolves. Even when Rick and the gang murdered the Termites, I felt they kind of deserved it because they ate people. But this episode turns that upside down, and gives Rick, his plan, and the Alexandrians an anti-hero edge: where first Daryl kills “Negan’s” people with a rocket launcher (though admittedly they were threatning his friends) and next Rick kills more of “Negan’s” people for food.

The argument over striking first

One of the best parts of The Walking Dead is the moral conflict: Shane and Herschel and Dale, all with their own morality, all in conflict with Rick. This plot device re-surfaces this season, where the perfectly pacifist Morgan is the only detractor at striking first at the Saviors. While the storytelling has set Morgan up to be on the opposite side of the viewer’s feelings, it remains to be seen whether he’s right. In fact, a point that was not addressed in Rick’s town hall was: how do we know Negan and his Saviors are bad? In fact, quite to the contrary, it’s Jesus and the Hilltop that’s supplied all information regarding Negan and the Saviors, and how do we know they’re not framing the situation in their own favor?

Sure, there are some fairly damning signs: Negan seems to have evidently killed a teenager to prove a point, the Saviors seem to pit Hilltop against itself and kidnap people, and finally his name is Negan, as if it couldn’t be any more Dickensianly evil. But I hope that The Walking Dead plays on (to bring back the Star Wars analogy) the notion of  “the Empire did nothing wrong”, where sure, Negan’s henchman threatened Daryl, and extorted Hilltop, but perhaps they never intended to harm Daryl and co. And in the end, it was Daryl that struck first, and with a rocket launcher.  Even given this, Morgan’s plea for non-violence was ineffective, and at least in part because it was so weak. Morgan should have appealed to practical reasons that the gang shouldn’t murder an entire compound of people. Here’s Nick Statt from the Verge on this point:

There should be a counter-argument to Rick’s belligerent and hawkish approach to diplomacy, but Morgan is more often than not making nonsensical appeals to non-violence. He doesn’t articulate why characters shouldn’t kill, so viewers are tempted to show him the same disdain as Carol does. At least he’s building a jail — Warden Morgan would at least have a purpose.

In any case, there are plenty of reasons that Rick and the gang might be in the wrong here. If I were Rick, I’d have wanted more information before needing to commit to his plan, but I’d probably also have been eaten in season 1. I look forward to seeing this moral debate continue, I imagine Negan will be sure to bring it up when we meet him.

The pre-emptive strike

The invasion on Negan’s compound was all-around well-executed: on a meta-level, the direction and acting were exciting and believable, with regards to the story, the plan was ambitious and ruthless. Here’s Brian Bishop of the Verge on this point:

… [I]t’s all brilliantly executed both in front of and behind the camera, and as the second guard is taken out and the team pours into the compound it’s clear that director Greg Nicotero has been doing his action movie homework.

But this comes at a terrible cost, because as entertaining and wild as this scene was, Rick, Glenn, and the gang that are so known to have a moral compass in an evil world, murder people in their sleep. It was unsettling to watch Glenn slide a knife through (even a henchman’s) eye. Here’s Zack Handlen of A.V. Club on this point:

Some sort of line is being crossed here, albeit one that will inevitably become less important once we get first hand proof of just how vile Negan actually is. (I’m guessing.) But it’s chilling to watch Rick and Glenn murder dudes in their sleep, even as we’re offered ample proof that those dudes weren’t very nice at all.

Clearly the emotion we were meant to feel when we saw those Polaroids was that what Rick was doing was right, but for me, it did little to help. Again, it’s a very bad sign, but it’s no evidence that can’t be reasonably doubted. Clearly, at least Glenn feels this. Matt Fowler of IGN:

The fight, though, was really intense. First a walker head (complete with busted nose) to stand in for Gregory’s melon. Then some stealth kills. Then the rescue. Then…the sweep inside to collect guns and kill everyone on site. And sure, you’re not going to mourn much a guy who keeps polaroids of bashed in faces taped above his bed, but offing a stranger in their slumber is stilla heavy deal. So much so that Heath couldn’t do it. Glenn had to take over. And even he had severe qualms.

I think we’re going to see this plan horribly backfire: I don’t yet fully trust Hilltop to be telling the truth, it’s clear that this wasn’t Negan’s only lair (nice try, “I wonder which one was Negan?”), and Rick and co. are so clearly in the wrong.

And now they have Maggie

Matters have already taken a turn for the worse, where the unarguably unneeded Maggie was captured becaused Carol didn’t want the future mother to get her hands dirty. The gang already seem outgunned, and I look forward to finding out how they get out of this one.

Custom fonts with Dynamic Type in Interface Builder

Managing custom font text styles in Interface Builder and in code has always been a pain point for me when developing for iOS. For instance, what’s the best place to define text styles? Is it in the Interface Builder document? This grants you a great WYSIWYG experience, allows you to quickly change and iterate, and maybe even lets non-developers modify appearance. Or should it be in code? This makes changes to the appearance more explicit and easier to merge, as well as being an easier target for large-scale refactoring when an app-wide design change inevitably happens. I thought there must be a better way, and here’s my proposal. If you aren’t one for rhetoric, here’s some working code.

In both of the above scenarios, the text style is static: it’s defined either in the nib file or in the source file, and barring some runtime changes, it is constant. On the contrary, if your app uses the default iOS font, which is the beautifully utilitarian San Fransisco font since iOS 9, your app can take advantage of a system-level feature known as Dynamic Type. Dynamic Type allows the user to set the base font size used by the operating system on a scale from extra small to extra large. Apps that use system text styles can scale their fonts’ sizes up or down to account for the user’s preferences. But not all of us live in an all-white room where beauty can meet form and function: sometimes an app needs a custom font to express its own personality. It would be a shame if this requirement came at the cost of adjusting type size to a user’s preference, and fortunately, I have some code which lets you have the best of all these worlds:

  1. Define text styles in Interface Builder to take advantage of the WYSIWYG editor and great user experience;
  2. Change custom fonts quickly and easily by modifying source code;
  3. Adjust your custom font to user text style preferences using Dynamic Type.

The way that I accomplished this is two-fold: first you need to define your custom font’s various text styles, and secondly you need to override your Label’s and Text View’s font with your own with a custom subclass which overrides the font descriptor for text style method, as we’ll see.

I found out how to define custom sizes and font styles from this Stack Overflow post. The Stack Overflow answer isn’t quite right for me, because I wanted an all-Swift solution with all text styles, but it lays out the methodology for an implementation which I’ve used. Here’s the definition for UIFontTextStyleBody:

extension UIFontDescriptor {
    class func preferredAvenirNextFontDescriptorWithTextStyle(style: String) -> UIFontDescriptor {
        var onceToken: dispatch_once_t = 0
        var fontSizeTable: [String: Dictionary] = Dictionary()
        dispatch_once(&onceToken, { fontSizeTable = [
            UIFontTextStyleBody: [
                UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: 21,
                UIContentSizeCategoryAccessibilityExtraExtraLarge: 20,
                UIContentSizeCategoryAccessibilityExtraLarge: 19,
                UIContentSizeCategoryAccessibilityLarge: 19,
                UIContentSizeCategoryAccessibilityMedium: 18,
                UIContentSizeCategoryExtraExtraExtraLarge: 18,
                UIContentSizeCategoryExtraExtraLarge: 17,
                UIContentSizeCategoryExtraLarge: 16,
                UIContentSizeCategoryLarge: 15,
                UIContentSizeCategoryMedium: 14,
                UIContentSizeCategorySmall: 13,
                UIContentSizeCategoryExtraSmall: 12
            ], ...
        ]})
        let contentSize = UIApplication.sharedApplication().preferredContentSizeCategory
        let sizes = fontSizeTable[style]!
        let size = sizes[contentSize]!
        return UIFontDescriptor(name:self.preferredFontName(), size: CGFloat(size))
    }
}

This code will first key on your text style name, then key on your users content size, which will yield a font size that you or your designers define. Next, we’ll get an example nib going with some labels with all of the text styles we want to support. I added a label for each text style and placed them in a Stack View:

Screen Shot 2016-03-07 at 10.14.43 PM

Interface Builder is going to show the system font with Apple’s font sizes. While we cannot change this about Interface Builder, we can change how our labels will interpret their text styles at runtime, and we can do that with a short and sweet label subclass, which we’ll set all our labels to. This way of getting a Label’s font description comes from this Stack Overflow post. Check it out:

class CFDTLabel: UILabel {
    override func awakeFromNib() {
        super.awakeFromNib()
        if let textStyle = self.font.fontDescriptor().objectForKey(UIFontDescriptorTextStyleAttribute) as? String {
            let font = UIFont(descriptor: UIFontDescriptor.preferredAvenirNextFontDescriptorWithTextStyle(textStyle), size: 0)
            self.font = font
        }
    }
}

Now, each time we have a label and set its text style, it’ll ask out custom method for the text style we defined in our UIFont extension. And that’s it, when we run our app we see our beautiful custom font which adjusts wit Dynamic Type.

Simulator Screen Shot Mar 7, 2016, 10.30.42 PMThis approach will be well-suited to you if you need a solution which lets define text styles in Interface Builder, adjust text styles quickly across your whole application, and scales up or down to meet your user’s font preferences. This last point is an important feature for people with different eyesight than the average: I’ve seen people use smaller text to fit more on the screen and larger text to make it easier to see.

LinkedIn and the network effect

Finding new professional contacts and keeping existing ones used to be a lot more difficult before the Internet, and now it’s becoming more difficult because of the Internet, or well, they way the Internet is monetized.

LinkedIn doesn’t cost anything to sign up and put your information on, and it would have a hard time convincing job-seekers or the employed if it wasn’t gratis. It’s kind of like free beer at other professional events, where the gratis stuff attracts people that might not otherwise bother. But unlike the free beer at that glorified sales info sessions, LinkedIn sticks to you, it becomes your online business card and professional directory. Furthermore, and like the free beer, LinkedIn has got to recoup the cost of the beer and more, as it must feed Wall Street’s insatiable thirst for growth. The conflict between being good at being your online professional network and being good at making money is the core of what’s wrong with LinkedIn: their interests aren’t the same as their users’ interests.

You may reasonably decide to do a quick query for “Paul Jones” on LinkedIn to see if I’m a hypocrite, and you would likely be slowed down by how many entries there are, so I’ll save you the trouble: I’m still on LinkedIn. Why? Evert Pot has a great way of putting it:

My only issue is that I feel, as an independent contractor, I’m obligated to maximize my potential in acquiring new customers. I don’t yet have the luxury to shut down an entire channel for new leads, despite the fact that LinkedIn has actually done very little for me in that regard. On top of that LinkedIn has become so ubiquitous that it’s actually become a standard question during some interview processes to ask for my profile. I feel that “I don’t have one” because of “principles” is never a great opener when you just made a new connection with someone.

Richard Stallman is often mocked on these grounds, of being unreasonable because of principles. A business person might deem this the “network effect” while a 5 year old might identify it more cogently as “peer pressure.” But it’s true. Everyone (in the professional scene) seems to be on LinkedIn, which means I have many reasons to be on there too. Then, because I’m now on it, LinkedIn as a service is more (even if only ever so slightly) valuable to a potential user. This compounds across millions of users until it’s inescapable. Facebook and Twitter have this same property as networks, and at least Facebook has found a pretty good way of monetizing without harming users too much: displaying engaging content from advertisers for a price. It isn’t perfect because advertising is annoying and has privacy concerns, but these are by no means insurmountable for users or for Facebook.

The biggest place that I see LinkedIn getting paid is for the “InMail” they sell to recruiters for the privilege of contacting people on platform. Unfortunately, just like every member of my trade which joins LinkedIn adds value, every sham recruiter and message they send me removes value from the network. Here’s Henrick Warne on the problem with recruiters:

Plenty of times, I have received messages from recruiters asking if I am interested in an “amazing opportunity”. Even if I am happy at my current job, I am always a little bit curious. You never know whether it is a great job or not. But before I can say if I am even remotely interested, I need to know some details. “OK, please send us your CV”. What? LinkedIn is my CV, you have already seen it. Next, they want to schedule a phone call. Why? Just mail me the details. If I agree to talk to them, they will act as if I contacted them, and they are now “helping me with my career” by jumping into interview mode. No, I don’t need your help. Just tell me about the “amazing opportunity”, and I will say if I am interested or not. If I am, we can take the next step.

The positive network effect that LinkedIn gets is increasingly stifled by the negative network effect of recruiters. Which is a problem, because the recruiters are the ones that are, in part, keeping the lights on. These misaligned interests are more than just some fuzzy notion I’m using to criticize LinkedIn, this conflict actually manifests itself in the product. As many people have embarrassingly realized, LinkedIn is terrible for contacting people and taking information that it tricks the user into. Here’s Dan Schlosser describing “dark patterns”:

In UX design, a dark pattern is design that works against users. It might trick them into doing the wrong thing, or just confuse them to the point where they can’t figure out how to do something that the designers don’t want them to do. This could be making it hard to delete a user account, or in LinkedIn’s case, making it really hard to use the service without importing your entire address book.

Unfortunately for LinkedIn, I’m of the opinion that the way forward is to decentralize the web from Silicon Valley unicorns, and I envision a utopia where everyone cares enough to host their own website. Perhaps it’s a pipe dream, but as technical skills are disseminated and the barrier to entry becomes lower thanks to improved tools, I have hope that people will come to desire control of their own Internet presence. Until then, I’ve un-connected with all the people I don’t know on LinkedIn and removed much of the information from my profile, and I advise everyone do the same.

Mitt Romney on Donald Trump

In a surprisingly honest speech delivered to the University of Utah, Mitt Romney muses on the present presidential candidate race. The whole thing warrants reading, here’s a particularly prescient snippet:

For the last three decades, the Clintons have lived at the intersection of money and politics, trading their political influence to enrich their personal finances. They embody the term “crony capitalism.” It disgusts the American people and causes them to lose faith in our political process.

A person so untrustworthy and dishonest as Hillary Clinton must not become president. But a Trump nomination enables her victory. The audio and video of the infamous Tapper-Trump exchange on the Ku Klux Klan will play a hundred thousand times on cable and who knows how many million times on social media.

I’m glad the Republican establishment knows that Trump stands no real chance in the general election against a vetted careerist like Clinton. When Romney ran, I supported and voted for Obama, but given the present political circus, a Romney candidacy would be a welcome sanity.

The reason that the current crop of candidates besides Trump are so weak is that they’re playing his game, on his terms. No one can “out Donald the Donald”, because he’s been slinging insults and schmoozing audiences his whole life. Even with Romney’s speech, all it takes for The Donald to deflect it is to say something to the effect of, “Who? Romney? What that loser is telling me how to win?”

The Republican establishment has fallen prey to Rule 19 of the Internet:

The more you hate it, the stronger it gets.

The Walking Dead S06E11: "Knots Untie" Review

Spoilers ahead. I wholeheartedly enjoyed “Knots Untie” because, despite the show’s modus operandi, everyone was mostly okay this episode. I’ve come to terms with the fact that I don’t actually like watching it, as it’s the story of the end of the world where people get eaten or worse, but I do find it fascinating. The reason I liked this episode so much was it focused less on getting “eaten or worse” and more on the fascination of relationships, and more importantly, politics. Let’s go over a few plot points:

Abraham and Sasha and Rosita

Admittedly, I totally forgot that Abraham and Rosita were still an item, I assumed that it fizzled out when he started patrolling with Sasha (or something). I thought Abraham was going to die when he was getting all philosophical with Sasha before discovering the rocket launcher, yet he remains and continues to find out more about himself. I haven’t figured out the meaning of his necklace, in part because I don’t care too much. I worry that TWD is going to suffer in the later season for the same reason FRIENDS did: babies.

Jesus and Hilltop

On the whole ride to Hilltop, I couldn’t help but not trust Jesus. He seems too idealistic and care-free for what the world has become. This trepidation reached a climax when they encountered the wrecked car on the way there, and when he was handcuffed and left with Maggie, I was sure he was going to pull some stunt. But eventually trusting him paid off, at least in the sense that the gang made it to Hilltop. Here’s Nick Statt from the Verge describing this sequence:

“Your world is about to get a whole lot bigger,” says Jesus before this episode’s opening credits roll. I have to admit, the scene gave me goosebumps. This was a moment when the show finally acknowledged its own potential — there are more communities of survivors, and there may be a huge conflict threatening the rebuilding of a real and lasting society.

This is absolutely right: where TWD needs to go is beyond man-vs-himself (Rick in the first seasons), beyond man-vs-nature (the zombie after the first seasons), and beyond man-vs-man (the various villains we’ve encountered since the prison): it’s time for group-vs-group and the inevitable politics that ensues. I love the idea that trade and cooperation (or not) could occur between multiple groups, and I look forward to an expanded universe in TWD.

Maggie’s negotiation

The group from Alexandra and the Saviors aren’t so different: they’re both ruthless murderers and take whatever they want from Hilltop. In fact, Maggie used the promise of future violence from Negan to negotiate half of their stuff from them. Matt Fowler makes this point at IGN:

And let’s hear it for Maggie this week too. Her mostly offscreen job as leader/planner/stay-behinder wound up paying off this week during her back-and-forths with Gregory. He batted her around like a ball of yarn for most of the episode, but then she came back strong after he realized just how powerless he was against Negan’s ever-increasing greed. So good on her. And good on the show for giving her a powerful scene outside of worrying about Glenn.

The hunger of those 50 or so hungry people at Alexandria and the knowledge of Hilltop is going to make for some tense negotiation.

Negan and the future

I thought that the leader of Hilltop may actually have been Negan because I know nothing about the comics, but it looks like the truth is far more interesting. Here’s Zack Holden from A.V. Club:

This is going to be a disaster, if not now than by the end of the season at least. This a story, and stories where characters say, “Yeah, we totally have this under control,” and then they do, don’t tend to be all that interesting. But at least no one’s behaving stupidly so far—or if they’re being stupid, their stupidity makes sense.

Certainly, a bloodbath is on the horizon. The hungry and desperate group from Alexandria is set to face off with well-equipped and savage Saviors, and it seems that they think it’s totally going to be easy. Whoever Negan is, he’s going to be livid that six-or-so of his men were taken out by Daryl, and if Negan is willing to take out a 16 year-old to “prove a point”, there’s no doubt that what he does to exact revenge will be far worse. The food from Hilltop is going to come at a great cost. (Which could have been avoided if Jesus and Daryl and Rick hadn’t been so childish with the truck, but never mind.)

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.

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.