Thursday, January 08, 2015

Apple you might catch more OS X bugs with honey than vinegar

I just installed the 10.10.2 beta and was excited to see Feedback Assistant added to my Dock. I quickly attempted to be login with my Apple ID only to see this:

Screen Shot 2015 01 08 at 9 37 30 AM

 

I’m not sure what politics are likely involved in Apple Developers not being able to use this seemingly handy tool, but I’m sure the number of bugs reported from outside Apple would increase if an easy to use app was available to all.

Wednesday, December 31, 2014

Keep Calm and Email On: Using OS X Mail to Send Through iCloud Uses TLS Even Though UI Says No

I was looking through the Account Info screen of OS X 10.10 Yosemite’s Mail.app and the red alert �� sounded in my head because sending mail using the iCloud SMTP server my account is configured for didn’t appear to be using SSL:

Screen Shot 2014 12 31 at 12 27 05 PM

I immediately asked AppleCare to call me. I didn’t want to waste any time figuring this out, I wanted to know how to fix it. As soon as I put my number in the web form, I got a call. Then I got connected immediately to a person. Apple has this part of the customer service experience nailed.

The guys I talked to at AppleCare were great. The first guy I talked didn’t waste my time with scripts. As soon as I described my issue he knew what I was talking about & had me try resetting my account in System Preferences Internet Accounts. When that didn’t work, he escalated to a guy named “Chris”. 

While on hold, I did some digging of my own. I found the iCloud SMTP server config in ~/Library/Preferences/MobileMeAccounts.plist. Here’s the section on the iCloud SMTP server:

 <key>smtpHostname</key>
 <string>p03-smtp.mail.me.com</string>
 <key>smtpPort</key>
 <integer>587</integer>
 <key>smtpRequiresSSL</key>
 <true/>

Looks like SSL is required, but the UI isn’t showing it. What’s going on? I turned on logging in Mail’s Connection Doctor and captured this log while sending a test mail out (bolds mine):

INITIATING CONNECTION Dec 31 11:39:39.264 host:p03-smtp.mail.me.com -- port:587 -- socket:0x0 -- thread:0x618000a69b40
CONNECTED Dec 31 11:39:39.375 [kCFStreamSocketSecurityLevelNone] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
READ Dec 31 11:39:39.553 [kCFStreamSocketSecurityLevelNone] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
220 nk11p03mm-asmtp002.mac.com -- Server ESMTP (Oracle Communications Messaging Server 7.0.5.33.0 64bit (built Aug 27 2014))
WROTE Dec 31 11:39:39.562 [kCFStreamSocketSecurityLevelNone] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
EHLO [10.0.1.6]
READ Dec 31 11:39:39.653 [kCFStreamSocketSecurityLevelNone] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
250-nk11p03mm-asmtp002.mac.com
250-8BITMIME
250-PIPELINING
250-CHUNKING
250-DSN
250-ENHANCEDSTATUSCODES
250-EXPN
250-HELP
250-XADR
250-XSTA
250-XCIR
250-XGEN
250-XLOOP 1EAF97A4D9D382EFF77592D25EA741DA
250-STARTTLS
250-NO-SOLICITING
250 SIZE 28311552
WROTE Dec 31 11:39:39.653 [kCFStreamSocketSecurityLevelNone] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
STARTTLS
READ Dec 31 11:39:39.749 [kCFStreamSocketSecurityLevelNone] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
220 2.5.0 Go ahead with TLS negotiation.
WROTE Dec 31 11:39:40.088 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
EHLO [10.0.1.6]
READ Dec 31 11:39:40.187 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
250-nk11p03mm-asmtp002.mac.com
250-8BITMIME
250-PIPELINING
250-CHUNKING
250-DSN
250-ENHANCEDSTATUSCODES
250-EXPN
250-HELP
250-XADR
250-XSTA
250-XCIR
250-XGEN
250-XLOOP 1EAF97A4D9D382EFF77592D25EA741DA
250-AUTH PLAIN LOGIN ATOKEN
250-AUTH=LOGIN PLAIN
250-NO-SOLICITING
250 SIZE 28311552
WROTE Dec 31 11:39:40.188 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
AUTH ATOKEN (*** 80 bytes hidden ***)
READ Dec 31 11:39:40.291 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
235 2.7.0 ATOKEN authentication successful.
WROTE Dec 31 11:39:40.292 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
MAIL FROM:<redacted>
READ Dec 31 11:39:40.399 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
250 2.5.0 Address Ok.
WROTE Dec 31 11:39:40.399 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
RCPT TO:<redacted>
READ Dec 31 11:39:40.744 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
250 2.1.5 redacted OK.
WROTE Dec 31 11:39:40.744 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
DATA
READ Dec 31 11:39:40.833 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
354 Enter mail, end with a single ".".
WROTE Dec 31 11:39:40.833 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
From: Dave Murdock <redacted>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Subject: Test Mail
Message-Id: <19F12A22-0D05-4B13-B96F-3F3036C368ED@icloud.com>
Date: Wed, 31 Dec 2014 11:39:39 -0500
To: Dave Murdock <redacted>
Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\))
X-Mailer: Apple Mail (2.1993)
.
READ Dec 31 11:39:41.042 [kCFStreamSocketSecurityLevelTLSv1_0] -- host:p03-smtp.mail.me.com -- port:587 -- socket:0x6100004a5460 -- thread:0x618000a69b40
250 2.5.0 Ok, envelope id 0NHG002NOGY4N150@nk11p03mm-asmtp002.mac.com

Mail.app is negotiating for TLS using STARTTLS. Technically, the UI is correct, SSL/TLS is not guaranteed but negotiated. Mail data wasn’t exchanged until TLS had been negotiated, so everything is fine, except the UI is misleading.

I thought SMTPS(ecure) required a dedicated port, but TLS is expected to be negotiated over port 587 (or another if in use). Wikipedia has a good summary.

“Chris” at AppleCare confirmed what was going on and called the account summary screen a “display” bug, which he would file with engineering.

Just for fun, we tried adding the iCloud SMTP server defaulting to, not negotiated, TLS, but it didn’t work. Turns out with 2 factor authentication, you can’t add the iCloud SMTP server directly, it constantly reports that it can’t authenticate.

Tuesday, December 30, 2014

Productivity Booster: Drag Files from OS X Finder to Attachment Buttons in Safari

I have no idea how long this has existed, but I just discovered you can drag a file* from Finder on OS X onto a file attachment button in Safari and It Just Works™!

This is going to save me serious time on  Bug Reporter:

Screen Shot 2014 12 30 at 11 34 17 AM

* Does not work with multiple files

Saturday, July 12, 2014

Amazon iOS App Showing Android App in Search Results

Totally feels like a passive aggressive dick move and from a UX standpoint, obviously not what's wanted.

Friday, July 11, 2014

How To Have Xcode Automatically Delete an iOS Simulator Content Folder When Building Your App

Inspired by Matt ConeyBeare's post Programmatically Opening the iOS Simulator Data Directory for Your App, I've written a shell script, with Matt's script as a template, to delete an app's content folder in the iOS simulator with every build. I needed this while testing the content download startup code for an app I'm working on.

To use the script create an Xcode Run Script Build Phase for the target(s) where you want it to run and paste in the following:

Note: Yes
#!/bin/sh
is redundant, but did not want to introduce confusion about what shell.



Thursday, June 26, 2014

Why Does Apple's Swift Use Pascal's Variable Declaration Syntax?

I'm extremely excited about Swift. I’ve read The Swift Programming Language and Using Swift with Cocoa and Objective-C. Both were very well written and explained with clear examples what you can do with Swift, but left out information I'm dying to know: why?

Not why does Swift exist, I think it's pretty obvious that Apple's Objective-C, which along with AppKit dates to 1988, was showing its age. C itself is from the late 60s, early 70s. A language purportedly as fast as C with non-garbage collected but automatic memory management (mostly) and protection against common programmer mistakes has been needed for a while now. No we need the why of Swift's design.


Why was Swift Designed the Way It Is?

That's the missing link for me in both Swift books. Some might argue that explaining why Swift is designed the way it is requires a third book. I would have found it much easier to digest some syntax design if those decisions had been explained inline. Especially when that syntax is largely used from another non-C like language.

For example, Swift uses Pascal's variable declaration syntax, but not its constants declaration syntax.

Why?

Pascal Variables
var one = 1;
var two: Integer = 2;
Swift Variables
var three = 3
var four: Int = 4
Pascal Constants
const five = 5;
const six: Integer = 6;
Swift Constants
let seven = 7
let eight: Integer = 8


Why Happened To Objective-C Without the C?

If the goal was Objective-C without the C, then the up to Xcode 6 Beta 2 Swift syntax seems kind of far way from that. Chris Pietschmann has a good Basic Comparison of C# and Apple Swift Programming Language Syntax. I haven't used C# in a few years, so this was a nice refresher:

C# Variables
var legalAge = 18;
string firstName;

C# Constants
const int legalAge = 18;

Looks a lot more like Objective-C without the C. There is a rough edge there. C# didn't have a var keyword in early versions. So explicitly typed variables start with the type name, not var. Var is only for method local scope implicitly typed variables.

An important idea here is that C# looks an awful lot like C++ without the second +. C++ Intrinsic type variables and constant declaration looks identical to C# (ignoring C++ 2011 additions since it post dates core C#, and C#'s var keyword). The main difference is C# class variables have no pointers.

Here are a few possible versions of an alternative universe variable declaration syntax in Swift following C# and C++, but would sand away the C# var rough edge:

Swift Alt 1
var:String lastName = "Kirk"

//Traditional C constant keyword
const:Int rulesBroken = 4

//A new C like constant keyword whose length matches var
con:Int rulesBroken = 4
Swift Alt 2
var String lastName = "Spock"

//Traditional C constant keyword
const Int rulesBroken = 4 


//A new C like constant keyword whose length matches var
con Int rulesBroken = 4


What I like about these examples is the connection of type with the kind of variable. It makes the code more readable as a sentence to me:

//With type
variable of type String named Kirk

//Without type
variable named Kirk
Instead of Swift's current syntax: 

//With type
variable named Kirk of type String

//Without type
variable named Kirk
I introduced a new constant declaration keyword con anticipating that the use of let was due in part to wanting length matched keywords for variables and constants. I dislike let which reads weird to me in non-declaration cases (more on that in another post) and it's meaning compatible with JavaScript. Perhaps there's a compiler land reason why name:type is better, I don't know because it's not explained.

Maybe there is an across Swift consistency reason for the use of keyword(s) name:type = default


Unified Theory for Swift's Variable Declaration Syntax

Swift & LLVM lead designer Chris Lattner is obviously a C++ wizard since LLVM is written in it. He must also have seen and likely used a lot of C# since he was a Research Intern at Microsoft's Research lab. He didn't adopt C# or slightly modified C++ variable declaration syntax. Why not?
In the absence of an official explanation, I have a theory. Look at function and closure declarations in Swift:

Swift Functions and Closures
//function
func backwards(s1: String, s2: String) -> Bool {
    return s1 > s2
}

//closures
reversed = sort(names, { (s1: String, s2: String) -> Bool in
    return s1 > s2
})
By default all parameters are constants, so let is ommitted. What remains? In the majority case, name: type.

My theory is that Swift uses the Pascal variable declaration syntax to make reading functions and closures with constant parameters easier for people.

At worst, the the function & closure parameter declaration syntax can expand to this keyword(s) name: type. Examples:

//keyword(s) name: type

func fullName(var middleName: String) -> String

func lastName(inout lastName: String) -> String

{ (firstName: String) -> String in return firstName.description }
Contrast with a couple functions in C#

void addReferenceType(SomeRefType refType) {
    // do something
}

void SwapStrings(ref string s1, ref string s2) {
    // The string parameter is passed by reference. 
    // Any changes on parameters will affect the original variables.

    string temp = s1;
    s1 = s2;
    s2 = temp;
    System.Console.WriteLine("Inside the method: {0} {1}", s1, s2);
}
C# can make the position of the parameter name position 2 or 3 after each comma, but can result in some method signatures that are possibly more jagged than Swift.


Why Else Would Swift Use Pascal Variable Declaration Syntax?

If the Pascal variable declaration syntax isn't for the compiler or it really doesn't make functions & closures more readable, I don't know why it was chosen. Personal taste? Just to be different than C#?

Obviously the LLVM and Swift team at Apple are brilliant people. I have immense respect for the amazing work they've been doing to modernize the platform. But it seems like there was a more familiar path from Objective-C to Swift for variable declaration and it wasn't taken. I'd love to know why.

Tuesday, April 15, 2014

Are You Hangry?

Hunger + Angry = Hangry

Nothing brings out Hangry like a vacation. Everyone's eating schedules thrown out, sleep deprived, sunburned and hungover.

Watch out!

Carnival Cruise Ship Can't Handle The Windows XPiration

I don't know why the ship map channel running Windows XP surprises me, but it did this morning:

Friday, April 04, 2014

Xcode 5.1 Expired Provisioning Profile Hidden Feature

In Xcode 5.0.x, you could not delete multiple expired provisioning profiles by multiple selecting the expired profiles. Highly annoying if a development device acquired a ton of these things over years of testing.

In Xcode 5.1, you finally can select multiple expired profiles and delete! Sometimes it really is the little things...

Friday, July 19, 2013

My Friend Jeffrey McManus Suddenly Died on July 5th

On July 5th Jeffrey McManus unexpectedly died. I learned of this devastating news on July 10th through his wife Carole's tear-jerking FAQ about this death posted to her Facebook timeline. I'll never joke again about quitting Facebook, I don't know when I would have found out about Jeff's death living in NJ.

PandoDaily has a fine public write up if you want the immediate details, though I wish they ran with a better picture.

It is literally the least I can do to honor his memory by recounting how he touched my life. I still can't believe I never get to see him again.

Vertigo Software
I met Jeffrey, whom I called Jeff, when we both worked at Vertigo Software. Jeff worked at Vertigo for 5 months in 2003 and he made a lasting impression. We didn't keep in touch much for a long time after he left the company because I wasn't ready for Jeff. He had such an outgoing personality, and at the time I was very much an introvert, that I didn't know how to handle Jeff's joviality. I mistook his playful spirit for a lack of technical seriousness, a blunder of colossal proportions that I've never admitted to anyone. I never stopped keeping tabs on what he was doing since he was always doing interesting stuff.

New York and Potential Opportunities
Jeff came to New York City in August 2006 just when he was starting Platform Associates. We had drinks at the W hotel in Times Square. I hadn't seen Jeff in a few years at that point and wasn't really sure what to expect, but we had a wonderful few hours together filled with Jeff's trademark off color humor and alcohol. Jeff tried to talk me into joining him at Platform Associates, but since I'm more cautious with my career, I had to tell him I couldn't do it. I always admired his ability to come up with new ideas and just go for it.

Twitter
Jeff was one of the people I interacted with the most on Twitter. My wife and I would specifically take a discussion to Twitter just to see what kind of response we would get out of Jeff. I don't think I missed too many opportunities to get in a snarky or slightly subversive comment on whatever Jeff was saying on Twitter. I'll greatly miss Jeff's witticisms.

Tangerine Element
Jeff was the first person I turned to when I wanted advice on launching Tangerine Element. I asked him for help on consulting engagements, search engine optimization, incorporation strategies, you name it. I'm pretty sure during some of the early consulting he gave me template contracts and invoices to look at from Platform Associates to help smooth that process out. Jeff was always giving like that, always quick to help out however he could.

WWDC 2011
Apple's WWDC 2011 was my first time attending the conference. When I mentioned to Jeff I was going, he immediately said we should hang out. I didn't hesitate to say yes.
We ate dinner at a very nice place not to far from Moscone West that I can't remember the name of, but I think that's mostly because Jeff dazzled me with Marriot's The View lounge. Jeff and I were both Star Wars fans and he knew that The View's resemblance to the Emperor's throne room from Return of the Jedi would blow me away. It did. If I'm around Moscone West and someone hasn't been to The View and I know there a Star Wars fan, I make it a point to take them to the Marriot. The views are simply stunning as well.
As usual, Jeff and I talked about his startups and if there was some way I could help out…

CodeLesson
At the end of 2011, I taught Introduction to iOS Programming through CodeLesson.com. This was my first time teaching an actual course on anything. It meant a tremendous amount to me. I taught another session of the class starting in April 2012. Unfortunately the demands of my day job and the amount of work it takes to do an instructor lead course to my standards meant I couldn't schedule a third session.

WWDC 2012
WWDC 2012 was a truncated affair for me. I had to leave on Tuesday night of that week, but Jeff adjusted his schedule so we could still grab dinner. We went to this great place 54 Mint in a night I'll never forget. I was surprised to find us sitting next to a large table of people from Apple, including Michael Jurewitz. I'd just seen a large number of these people up on stage, and @Jury in particular I'd interacted with on Twitter a few times. I thought if I ever wanted to work at Apple, perhaps I'd say hi later.
Jeff and I got deeply into a discussion about the future of CodeLesson.com. Since I had just wrapped up the second session of my course, I was overflowing with ideas on what to do with the site and take it to mobile. Jeff had just proposed bringing me onto CodeLesson in a product advisor role in my spare time when all of a sudden he gets up, steps towards Apple's table, and makes a fake big smile and waves his hands.
Flabbergasted by what I'd just saw, Jeff sits back down and chuckles as I ask him what he'd done. This was my introduction to the photobombing. Jeff said he did it all the time and all involved got a great laugh out of it. I'd never heard let alone done that so I emailed @jury at the airport to apologize. Don't know if that email was ever read, but this was the only time Jeff and I truly disagreed on anything.
This incident epitomized Jeff. With him you never knew what you were going to get, and that's one of the reasons these outings where so exciting!

WWDC 2013
I had the pleasure of hanging out with Jeff and his wife Carole before the conference at the Pi Bar for pizza and beer. I met a few of Jeff and Carole's friends and we chatted about potential iOS work, schools in San Francisco, and places to live. I was given a mission by @missionbride,  gather intel for "Operation: Could We Possibly Move the Family Back to CA". Jeff and Carole helpfully answered all the questions I had. Mission Bride and I aren't planning for an imminent move, just feeling it out a bit.
Jeff came out the next night with my co-workers and former co-workers. We stopped at the Xamarin party held at the Press Club, then dinner at Annabelle's Bar & Bistro before heading to Marriot's The View. Jeff staged a boisterous game of "Who's Your Top 5". If you've never played, this is a game of "who would you cheat on your spouse for just one night with". Again, this was classic Jeff, taking an off color concept and truly relishing it! When Jeff and I were saying our goodbyes, I gave him a bear hug and told him how proud I was of all the weight he'd lost in the last year.
Mission Bride was coming to San Francisco a couple days later. Jeff magnanimously offered to share his Father's Day the coming Sunday and show us around neighborhoods Carole and he thought might be good for us. I had every intention of taking him up on the offer when traffic intervened and prevented us from getting back from a jaunt down to Salinas in time for our flight home. In hindsight I'm glad we missed it. Carole and the kids got Jeff to themselves as far as I know on his last Father's Day.

Conclusion
Jeff was a talented entrepreneur, great dad, great husband, and a good friend to me. It feels so cliché, but I wish I had more time with him. I'm sure we would have been great friends.