tag:blogger.com,1999:blog-70662192024-03-07T18:13:25.030-05:00 Inner Exceptionby Dave MurdockDave Murdockhttp://www.blogger.com/profile/05890407802752665754noreply@blogger.comBlogger570125tag:blogger.com,1999:blog-7066219.post-32919261654091526212020-02-01T15:56:00.001-05:002020-02-01T15:56:05.361-05:00Quit and Close Tab Confirmation for Safari on macOSA few weeks ago, John Gruber posted <a href="https://daringfireball.net/2020/01/quit_confirmation_for_safari_on_macos" target="_blank">Quit Confirmation for Safari on MacOS</a>. I was inspired to make a few changes to Mr. Gruber's script and add a couple more.<br />
<br />
Check out my <a href="https://github.com/murdocdv/applescripts" target="_blank">AppleScripts GitHub repo</a> for quit confirmation on Safari and Chrome as well as a tab close confirmation on Safari.Dave Murdockhttp://www.blogger.com/profile/05890407802752665754noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-48075662662074715752018-05-07T10:03:00.002-04:002018-05-07T10:03:38.135-04:00Android Development: Day 0 - You're Probably Wondering How I Ended Up in This Situation<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0V3k15jORsYzifGEgAe5iUhGF4PfY8T7Ws-G180IJ_IN9nFwWs3-0dvB2YKZrZjVyvDLJ97ImPeC4QN3-8ZslHv6FoSjGKUBlFbN5nvevK8uHUIXXg1ewkIl2UfR-2947sCzepA/s1600/y5cw6GK9RKGUX%252BKies%25254Cw.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0V3k15jORsYzifGEgAe5iUhGF4PfY8T7Ws-G180IJ_IN9nFwWs3-0dvB2YKZrZjVyvDLJ97ImPeC4QN3-8ZslHv6FoSjGKUBlFbN5nvevK8uHUIXXg1ewkIl2UfR-2947sCzepA/s320/y5cw6GK9RKGUX%252BKies%25254Cw.jpg" width="240" /></a>*Record Scratch*<br />
<br />
*Freeze Frame*<br />
<br />
Yup, that’s me holding a Google Pixel 2. If you know me at all, you’re probably wondering how I ended up in this situation.<br />
<br />
I’ve been developing iOS apps and the occasional macOS app now for 10 years. I’ve immersed myself in the ecosystem, love it, and I’m not stopping. However, when an opportunity arose recently at the day job to work on an Android app, I was intrigued.<br />
<br />
I’d looked at Android development from time to time, but it’s only recently that I thought it would be something I wanted to spend the time to learn.<br />
<br />
<br />
For May 2018, I’m diving deep into Android. The reasons I said yes now are:<br />
<br />
<ul>
<li>Android Studio</li>
<ul>
<li>It’s Not Eclipse™</li>
<li>Still not a good native macOS app by any stretch of the imagination</li>
</ul>
<li><a href="https://kotlinlang.org/">Kotlin</a></li>
<ul>
<li>It’s very Swift-like</li>
<li><a href="https://kotlinlang.org/docs/reference/native-overview.html">Kotlin Native</a> - iOS, macOS, and WebAssembly are all target platforms</li>
</ul>
<li>Needed something developer wise to learn this year</li>
<ul>
<li>Learned Ruby on Rails last year</li>
</ul>
<li>Theory that Google and Apple had cross pollinated enough ideas that learning Android development would be incremental over iOS</li>
<ul>
<li>It’s early days, but this theory is looking decent.</li>
<li>e.g. ViewController on iOS is an Activity on Android</li>
<li>Also, leveled up Git, Bash shell scripting, and Unix in 2017, all those skills would help with Android</li>
</ul>
</ul>
<ul><ul>
</ul>
</ul>
<ul><ul>
</ul>
</ul>
<ul><ul>
</ul>
</ul>
Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-36674245048909014042018-04-18T17:19:00.000-04:002018-04-18T17:30:08.979-04:00Android Development: Day 1 - I Don't Complain About Xcode Much, but Now I'll Never Complain About Xcode AgainI’ve been doing a bit of Android development here and there for the last couple years but today is the day I started digging in to really lay down some code.<br />
Since I’d experimented, I opened an Android Studio 2.2 era project to use on Android Studio 3.0.1, the latest and greatest as of this writing.<br />
Here are my notes on the experience:<br />
<h2>
<strong>The Good</strong></h2>
<ul>
<li>I got everything updated and using the minSdkVersion</li>
<li>Realized I was using sdkVersion 26 (Android 8) RC1 libraries in the project, which is not what you want</li>
</ul>
<h2>
<strong>The Bad</strong></h2>
<ul>
<li>You have to update so many, to many, things</li>
<ul>
<li>Android Studio</li>
<li>SDK Platforms</li>
<li>SDK Tools</li>
<li>Gradle</li>
<li>Kotlin</li>
</ul>
<li>Any update can fail on my corporate network because they come from a variety of Internet repositories:</li>
<ul>
<li>Google</li>
<li>Maven</li>
<li>JCenter</li>
</ul>
<li>Android Studio and/or the behind the scenes command line tools have a hard time remembering or using corporate proxy server settings</li>
<li>Gradle does not gracefully recover from stalled or blocked downloads, it will happily spin seemingly forever</li>
<li>Changing the minSdkVersion (resetting from Android 4.4 to 23, aka Android 6) restarts most of the above</li>
<li>Android Plugin for Gradle 3.0.0 deprecated a whole bunch of stuff that I was getting warnied on with every build:</li>
<ul>
<li><a href="https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#new_configurations">https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#new_configurations</a></li>
<li>An easy fix, but why not a migrator?</li>
</ul>
<li>Gradle warnings</li>
<ul>
<li> I had a “+” in a library import (build.gradle) path to mean version 26 or higher.</li>
<ul>
<li>Again an easy fix, but why not a migrator? This was in the old template.</li>
</ul>
<li>Was importing an 1.0.0 of the <em>constraint-layout</em> library when 1.1.0 was available</li>
<ul>
<li>Again an easy fix, but because of the network issues, this blocked forever</li>
</ul>
</ul>
<li>Android Studio keyboard shortcuts are garbage</li>
<ul>
<li>Building & Running Should be ⌘B and ⌘R respectively, not ⌘F9 and ⌃R</li>
<li>No Keymap for Xcode when there are one for Emacs, Visual Studio, Eclipse, NetBeans and JBuilder just feels passive aggressive</li>
<ul>
</ul>
</ul>
</ul>
<h2>
The Ugly</h2>
<ul>
<li>Gradle just stopped building and I had to go delete some directories manually</li>
<ul>
<li><a href="https://github.com/gradle/gradle/issues/3176">https://github.com/gradle/gradle/issues/3176</a></li>
<li>Issue listed as closed in gradle 4.2, but still happened on gradle 4.4</li>
</ul>
<li>Because of the aforementioned network issues, all this took around 1/2 day 😭</li>
</ul>
Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-57402321914470867692018-04-03T10:44:00.001-04:002018-04-03T10:44:50.596-04:00Apple's 64-bit Unification is Prep for ARM Macs and Mac/iOS Shared Apps<ul>
<li><a href="https://developer.apple.com/news/?id=06282017b">iOS 11 and apps are 64-bit only</a></li>
<li><a href="https://developer.apple.com/news/?id=01242018d">macOS 10.13 is the last release to support 32-bit apps without compromise</a></li>
<li><a href="https://developer.apple.com/news/?id=01242018c">Mac App Store as of 1/18 mandates new apps support 64-bit and updates to existing apps must support 64-bit by June 2018</a></li>
<li><a href="https://developer.apple.com/news/?id=01242018d">Xcode 9.3 includes diagnostic tools to make sure your apps are 64-bit compatible</a></li>
<ul>
<li><a href="https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-DontLinkElementID_1">Xcode 9.3 makes it a warning to build to for 32-bit architecture</a> (Apple Developer Account Required)</li>
</ul>
<li>…</li>
<li><a href="https://daringfireball.net/2017/12/marzipan?se=body&so=cu">Project Marzipan, combined iPhone, iPad, and Mac apps, is in the works</a></li>
<li><a href="https://daringfireball.net/linked/2018/04/02/arm-based-macs-2020">Apple will replace Intel with ARM CPUs in Macs by 2020</a></li>
</ul>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-13852985608747321832018-02-15T17:04:00.002-05:002018-02-15T17:19:45.058-05:00Apple Glass Will Replace Dumb GlassesI’d never heard of <a href="https://www.idropnews.com/">iDropNews</a> before today, but they have some beautiful <a href="https://www.idropnews.com/rumors/apple-glass-ar/63353/">renders of a potential Apple Augmented Reality (AR) product called Apple Glass</a>:<br />
<a href="https://cdn.idropnews.com/wp-content/uploads/2018/02/14142428/Apple-Glass-AR-Glasses-iDrop-News-x-Martin-Hajek-5.jpg"><img alt="" src="https://cdn.idropnews.com/wp-content/uploads/2018/02/14142428/Apple-Glass-AR-Glasses-iDrop-News-x-Martin-Hajek-5.jpg" width="600px" /></a><br />
They got me thinking. Let’s just say Apple is working on AR glasses for a launch in Fall 2020.<br />
<br />
The biggest feature isn’t Augmented Reality…<br />
<h1>
It’s the Dumb Glasses market, stupid!</h1>
Any facial augmented reality solution is going to fail if they aren’t fashionable and are user hostile to spectacles, contacts, and sunglasses. Apple has more than likely come to the same conclusion after seeing the Google Glass debacle. A high level of fashion has to be baked into the product.<br />
<br />
To maximize their market opportunity, Apple must be working on <strong>vision correction as a core feature</strong>. The market looks enormous. An estimate from Grand View Research says the worldwide eyewear market <a href="https://www.grandviewresearch.com/industry-analysis/eyewear-industry">was $102.66B USD in 2015</a>.<br />
<br />
In North America, the majority of the eyewear market is spectacles:<br />
<img alt="" src="https://www.grandviewresearch.com/static/img/research/north-america-eyewear-market.png" /><br />
If Apple is going to sell a lot of Glass (or whatever they’re called), they need to replace dumb spectacles. Is Apple going to make lenses custom lenses for this product? I don’t think so.<br />
<br />
What I’d be betting on is that Apple will ship a product that has<strong> dynamically configured vision correction</strong>. This doesn’t mean optometrists go out of business, but instead of walking out of the office waiting for new glasses, they just send your new prescription to Apple Glass (and you get a copy in the Health app on iOS) and boom, you see at 20/20 or better again. Apple could also take a huge chunk out of Luxottica. This Snopes article has the best breakdown on <a href="https://www.snopes.com/does-luxottica-own-80-of-the-eyeglass-industry/">truth and rumor about their market share I can find</a>.<br />
<br />
If you wear contacts, no problem, Apple Glass just turns off all corrections.<br />
<br />
Wait, you also switch between indoor spectacles and sunglasses? No problem, Apple Glass darken like transitions (or better?).<br />
<br />
That’s right, Apple Glass would also darken like transitions (but better?).<br />
<br />
Apple Glass would also be compatible with contact wearers by turning off vision correction.<br />
Need bifocals? No problem, Apple Glass can handle it.<br />
<br />
The keynote practically writes itself…<br />
<h1>
WWDC 2020 - June 8</h1>
<blockquote>
Tim: Today were announcing three products.<br />
<br />
Tim: An Augmented Reality headset<br />
<br />
Tim: Vision correcting glasses<br />
<br />
Tim: Polarized sunglasses<br />
<br />
Tim: …<br />
<br />
Tim: Are you getting it yet? This isn’t three products, it’s one.<br />
<br />
Tim: I’d like to show you Apple Glass</blockquote>
This would be the culmination of Tim Cook’s Apple. He’d be 60 years old, just shipped Apple’s most revolutionary product since the iPhone, and with plenty of time to pursue any other projects he wished.<br />
<br />
Does Apple Glass cannibalize any other Apple products? Apple Watch shrinks a bit as some users that want Glass decide they don’t need Watch too. But if Apple Watch enhances the AR experience through arm motion tracking, Apple Glass could be purely additive.<br />
<br />
Apple Glass complements iPhone for the foreseeable future due to processing power/battery life issues.<br />
<h1>
<strong>Update</strong></h1>
I didn’t realize when I opened Seeking Alpha this morning it was about <a href="https://seekingalpha.com/article/4147014-apple-moves-toward-greatest-victory">Apple’s AR opportunity</a>.Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-55064948783046404812017-11-22T09:10:00.002-05:002017-11-22T09:10:18.706-05:00Plan on using Face ID on iPhone X in your iOS app? You must include NSFaceIDUsageDescription in your Info.plist<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUmJkDhudn4AKpoV5bzATEh4u2tsBlProuuhDUymGh5R961j_jqpBcedciUtGH5QqdgJL5A93LEgMx02-DbtmPXvRBJwq0e8bFV28hX7zhYTgdNMH_EUd0eTllrTTZ8zZAK2DoQg/s1600/IMG_0057.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="596" data-original-width="804" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUmJkDhudn4AKpoV5bzATEh4u2tsBlProuuhDUymGh5R961j_jqpBcedciUtGH5QqdgJL5A93LEgMx02-DbtmPXvRBJwq0e8bFV28hX7zhYTgdNMH_EUd0eTllrTTZ8zZAK2DoQg/s320/IMG_0057.png" width="320" /></a>I’ve already shipped an app that is accessing Face ID on iPhone X, but while testing an unrelated feature the other day, I saw the alert on the left. I thought I had read everything that I needed to about Face ID implementation, but this had slipped past me.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWxFVvPUmts_8Sb8MsTMu5RnS0p3ljQuGMPIus_59RlfbnRtdHSvLxULu9K57fMaRQ9wjEjqseJ0_AC4PTgO4b8bh2KYU5voAqcQVeuBrOCULBoW1V3JsBuuKArHB-pfhyphenhyphentk3OaA/s1600/LAContext.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="302" data-original-width="1476" height="65" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWxFVvPUmts_8Sb8MsTMu5RnS0p3ljQuGMPIus_59RlfbnRtdHSvLxULu9K57fMaRQ9wjEjqseJ0_AC4PTgO4b8bh2KYU5voAqcQVeuBrOCULBoW1V3JsBuuKArHB-pfhyphenhyphentk3OaA/s320/LAContext.png" width="320" /></a>I parked it for a while, but I happened to open the <a href="https://developer.apple.com/documentation/localauthentication/lacontext">docs on LAContext</a> on an unrelated issue when I saw the <b>Important</b> information on the right.<br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvYJBzzwZ7JFASoKUPWN4p88HdQQjoAfhIcLLcutml-T3_5PvOUdBkiHobkCURM0d_SmR2CtUNbpUAu7dGTsMy4pgLw8197iXMgIs3UMTCPUlv6GOb-h7TjqEVQoaT_facCHFVwQ/s1600/NSFaceIDUsageDescription.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="412" data-original-width="1600" height="82" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvYJBzzwZ7JFASoKUPWN4p88HdQQjoAfhIcLLcutml-T3_5PvOUdBkiHobkCURM0d_SmR2CtUNbpUAu7dGTsMy4pgLw8197iXMgIs3UMTCPUlv6GOb-h7TjqEVQoaT_facCHFVwQ/s320/NSFaceIDUsageDescription.png" width="320" /></a><br />
When you click on <a href="https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW75">NSFaceIDUsageDescription</a> you see the description on the left. I didn't experience any forced app quitting behavior on device or simulator, but your experience may vary.<div>
<br /><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQDAKenPn9VGHc9HIl0vTI69BEstUzRAk8FuYOyanaK4v9CD2Dowu3VCPABHKs_D6NnOJS36a0S7kfK57Hze2mAPFo_RT7RdWCOoUjAiOhPPwCpEyilRsOASpanZBznSn0wa-MUQ/s1600/IMG_0058.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQDAKenPn9VGHc9HIl0vTI69BEstUzRAk8FuYOyanaK4v9CD2Dowu3VCPABHKs_D6NnOJS36a0S7kfK57Hze2mAPFo_RT7RdWCOoUjAiOhPPwCpEyilRsOASpanZBznSn0wa-MUQ/s1600/IMG_0058.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="506" data-original-width="810" height="199" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQDAKenPn9VGHc9HIl0vTI69BEstUzRAk8FuYOyanaK4v9CD2Dowu3VCPABHKs_D6NnOJS36a0S7kfK57Hze2mAPFo_RT7RdWCOoUjAiOhPPwCpEyilRsOASpanZBznSn0wa-MUQ/s320/IMG_0058.png" width="320" /></a><br />
<div>
<br /></div>
With <a href="https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW75">NSFaceIDUsageDescription</a> added to Info.plist, and a key of “Secure Account Access” like in the right screenshot, users will see a prompt like the one on the right when the app tries to access Face ID the first time.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /><br />
<br />
Glad I caught this in the “one to fix all the iPhone X issues” release of the app I’m working on.<br />
</div>
Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-24090240055762622192017-10-01T09:46:00.001-04:002017-10-01T09:48:16.626-04:00How I was Accidentally Credited by Apple on a macOS Security Update<blockquote>
<p style="margin: 13px 0px 0px; padding: 0px; font-size: 17px; line-height: 1.52947; letter-spacing: -0.3569999933242798px; font-family: 'SF Pro Text', 'SF Pro Icons', 'Helvetica Neue', Helvetica, Arial, sans-serif; word-wrap: break-word; color: #333333;"><strong>curl</strong></p>
<p style="margin: 13px 0px 0px 40px; padding: 0px; font-size: 17px; line-height: 1.52947; letter-spacing: -0.3569999933242798px; font-family: 'SF Pro Text', 'SF Pro Icons', 'Helvetica Neue', Helvetica, Arial, sans-serif; word-wrap: break-word; color: #333333;">We would like to acknowledge Dave Murdock of Tangerine Element for their assistance.</p>
</blockquote>
<p>That’s from the end of <a href="https://support.apple.com/en-us/HT207922">About the security content of macOS Sierra 10.12.6, Security Update 2017-003 El Capitan, and Security Update 2017-003 Yosemite</a>.</p>
<p>I wasn’t aiming to obtain such credit, all I did was <a href="http://filearadar.com">File a Radar</a> on <a href="https://github.com/curl/curl">curl</a>.</p>
<h2>Why?</h2>
<p>I have no end of trouble downloading Cocoapods, Ruby Gems, Node modules, using Terminal at my day job.</p>
<p>They have a proxy server connected to my Active Directory credentials. For GUI based apps, macOS combined with a little Apple utility called Enterprise Connect configures everything as soon as I make a connection to the network.</p>
<p>However, anything that is strictly command-line is not guaranteed to work.</p>
<p>A bunch of co-workers and I have taken matters into our own hands and written a script that runs in our .bash_profiles. It sets these environment variables when started a shell automagically based on the current username and password:</p>
<pre>http_proxy</pre>
<pre>https_proxy</pre>
<pre>no_proxy</pre>
<p>Both <span style="font-family: Courier; font-size: 14px;">http_proxy</span> and <span style="font-family: Courier; font-size: 14px;">https_proxy</span> have traditionally been set to the same thing, a proxy server like http://proxy.company.com which is only available inside your company. Even the https_proxy variable is configured to hit an unsecured HTTP server.</p>
<p>During an earlier version of the script, I had accidentally set <span style="font-family: Courier; font-size: 14px;">https_proxy</span> to https://proxy.company.com and things were breaking.</p>
<p>Turns out, curl couldn’t support HTTPS proxies until late 2016, and macOS 10.12.5 hadn’t been updated to curl 7.52.0 or later to add support.</p>
<p>So I filed a radar…</p>
<h2>But Wait There’s More!</h2>
<p>Turns out, <a href="https://curl.haxx.se/changes.html#7_54_0">curl 7.54.0 or later closed a number of CVEs</a> and I mentioned that in my radar.</p>
<p>Fast forward 2 months after I filed the radar, and Apple Product Security emails me to ask if I’d like credit.</p>
<p>I hesitated at first, not knowing what, if any, ramifications being publicly listed on an Apple Security listed might have.</p>
<p>Ultimately, being credited was just to cool not to do, so I did.</p>
<h2>Still More to Do</h2>
<p>While curl has been updated, unfortunately my problems persist. Appears the <a href="https://en.wikipedia.org/wiki/Generic_Security_Services_Application_Program_Interface">Generic Security Services Application Program Interface (GSSAPI)</a> somehow occasionally selects the wrong way to present my credentials to the proxy server and I get connection errors.</p>
<p>I’m updating to macOS High Sierra right now hoping that something has changed to resolve this issue, but if not, I’ll be filling another radar.</p>
<p>Though the public <a href="https://bugreport.apple.com">Bug Reporter</a> interface recently got a much needed overhaul, the system is still far from perfect. </p>
<p>I’m truly baffled why Apple doesn’t build macOS and iOS apps that developers can use to collect the required information and file with far less work. I bet they’d get a lot more high quality bug reports. I’ve filed a radar on a radar app.</p>
<p>However, I’ve seen enough bugs fixed that I was the original reporter to feel my time is worth spending on filing radars.</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-85150130918303784862016-05-29T14:02:00.001-04:002016-05-29T14:03:59.612-04:00All Hope was Not Lost...Apple Released AirPort Base Station Firmware 7.6.7 for 3+ Year Old Devices!<p>While at a Memorial Day gathering yesterday, the host mentioned that an update just became available for his Airport devices, the Express, Extreme, and Time Capsule. I thought he had to have been mistaken and maybe I’d missed updating his hardware on a previous visit. No update had been mentioned in the Apple press, but I knew my AirPort Utility automatic update checking was off, I’d lost hope Apple would ever send out any updates for my aging Time Capsule. Maybe Apple did send out an update…</p>
<p>Sure enough Apple released <a href="https://support.apple.com/kb/DL1880?locale=en_US">AirPort Base Station Firmware 7.6.7</a>! The prior version was <a href="https://support.apple.com/kb/DL1673?locale=en_US">7.6.4</a> released in August 2013. That immediately got my mind racing. Were internal 7.6.5 and 7.6.6 releases created that didn’t make it public? Could more bug fixes be bundled up into this update than just those mentioned in the support article? We’re fixes made during a development cycle for new <a href="http://www.macrumors.com/2016/05/27/airport-out-of-stock-us-apple-stores/">AirPort Base Stations or to comply with the FCC</a> and back ported to 2 generation old hardware?</p>
<p>I guess we’ll never know, but WWDC is right around the corner, I’m not immune to rampant speculation 😬</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-50977426117573966692016-05-27T09:27:00.001-04:002016-05-27T11:06:43.978-04:00TL;DR Wil Shipley: Keep Calm and Swift On<p><img style="float: left; padding-right: 5px;" title="Keep Calm and Swift On-300x337.png" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFNcJifTu_AxgIvoOVyzgOfXk-39N9NMfrQMc-ejVEoaAXkpltp520ozxMSthKmQ54rIjIb_xSBRUdOWOhZ8sMv1hVxnoqxzbMxuaxuhIhzhW3XfeV9SD5lEdK9rXGt2aS7m98iA/?imgmax=1600" alt="Keep Calm and Swift On 300x337" width="149" height="168" border="0" />I couldn’t agree more with Wil Shipley’s post on <a href="http://blog.wilshipley.com/2016/05/pimp-my-code-book-2-swift-and-dynamism.html?m=1">Swift and Dynamism</a>. All the likes, stars, favs, or hearts wouldn’t be enough. </p>
<p>You should read it for the entertainment value alone.</p>
<p>In Chris Lattner I Trust!</p>
<p>Is ABI compatibility missing Swift 3.0 annoying? Absolutely.</p>
<p>Is Swift 3.0 source compatibility going to be a time sink with chicken and egg library problems? Yep.</p>
<p>I’m sure dynamism is coming to Swift 3.x or 4 and I’m confident the teams and the community will improve on what Cocoa's had since 1988. Swift is the next 30+ years of Apple developer tooling and platforms. It’s almost insulting to the teams to suggest they aren’t being thoughtful.</p>
<p>Hapuna Matata, because in the coming on 2 years I’ve been using Swift it's saved me so much time with fewer bugs and easier to read code.</p>
<p><iframe src="https://www.youtube.com/embed/xB5ceAruYrI" width="560" height="315" frameborder="0"></iframe></p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-27509376371331415062016-05-14T20:25:00.001-04:002017-11-22T09:11:04.747-05:00Let's Talk About What Chewie Does in Star Wars The Force Awaken<div style="background-color: red; color: white; padding: 5px;">
<table>
<tbody>
<tr><th><strong>SPOILERS</strong></th>
<td>Ahead for Star Wars The Force Awakens</td>
</tr>
</tbody>
</table>
</div>
I’ve read a lot of <a href="http://www.popsugar.com/entertainment/Star-Wars-Force-Awakens-Theory-About-Kylo-Ren-39515387">theories</a> about what every character does in Star Wars The Force Awakens…except Chewbacca.<br />
The first thing you have to admit about Chewy in The Force Awakens is that he’s awesome. The Force Awakens is the best Chewbacca movie yet. He’s physical, played in large part not by original actor Peter Mayhew, but by newcomer <a href="http://www.businessinsider.com/joonas-suotamo-chewbaccas-double-in-the-force-awakens-2016-1?op=1">Joonas Suotamo</a> and the result is a more action oriented Wookie. He’s also funny and expressive. With just a head move or grunt, Mayhew and Suotamo communicate as much information as any actor playing humans do in the movie.<br />
That’s not what I want to talk about though. I want to know what Chewie knows. Given what we see in The Force Awakens, Chewie knows:<br />
<ul>
<li>Kylo Ren is Ben Solo</li>
<li>Rey's lineage</li>
<li>Who Supreme Leader Snoke is (<a href="http://www.slashfilm.com/snoke-darth-plagueis-theory-debunked/#more-353280">not Darth Plagueis</a>)</li>
</ul>
If you believe that Kylo Ren has completed his fall to the Dark Side by killing Han Solo...<br />
<ul>
<li>Why doesn’t Chewy go for the kill shot?</li>
<li>Why doesn’t Chewy’s bowcaster knock Kylo off the platform?</li>
<li>Why does Chewy go with Rey without comment?</li>
</ul>
However, there is another possibility. Watch this video by Movies with Mikey:<br /><iframe frameborder="0" height="315" src="https://www.youtube.com/embed/nVZGUV77aRg" width="560"></iframe><br />
Mikey’s theory is that while Kylo and Rey fight, Kylo is not using the Dark Side, but Rey does. The theory is that Ren and Rey will flip Force sides by the end of the trilogy and Kylo Ren is in deep cover.<br />
If you think this theory has any credence, then I’d propose that Chewy shoots Kylo Ren with a lower power, non-fatal bowcaster shot on purpose. Through The Force Awakens, we see Han and Chewy blow foes away with impunity using the bowcaster, catapulting them several feet upon impact. Yet Kylo Ren doesn’t move.<br />
Of course Kylo’s force abilities could explain him being able to absorb the energy of the blaster bolt without moving. However, we see Kylo able to stop blaster fire in mid-air after being fired. If he was using his powers, he wouldn’t simply diminish the energy, he’d stop it.<br />
On the other hand, if Chewie doesn’t miss a Kylo Ren kill shot on purpose, he’s responsible for allowing one of the galaxies greatest evils to escape justice just after his best friend of all time was killed.<br />
Or Chewbacca is relieved his life debt is over, but feels he must take some kind of shot to keep up appearances that he actually liked Han Solo 😉Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-70714847391826419432015-10-02T15:19:00.001-04:002015-10-02T15:19:54.853-04:00Changing UITextView's textContainer.layoutManager.delegate to your UIViewController Swaps Line Break from Word to Character Wrap<div style="background-color: lightblue; padding: 5px;">
<table>
<tbody>
<tr><th>TL;DR</th>
<td>Don’t assign UITextView.textContainer.layoutManager.delegate to your UIViewController, bad things happen. </td>
</tr>
</tbody>
</table>
</div>
<div style="background-color: lightyellow; padding: 5px; margin-top: 5px;">
<table cellspacing="2px">
<tbody>
<tr><th>Versions:</th>
<td>OS X 10.10, 10.11</td>
<td>Xcode 7.0.x</td>
<td>iOS SDK 8, 9 </td>
</tr>
</tbody>
</table>
</div>
<p>Some of the highlight <a href="https://developer.apple.com/videos/wwdc/2013/">WWDC 2013 sessions</a> for me where those about Text Kit. That was largely because I was working at Dow Jones on The Wall Street Journal and Barron’s iOS apps which had native text layout code. It worked extremely well, but it was largely Core Text, and it wasn’t the easiest to maintain. I thought we might be able to replace a lot with Text Kit. Unfortunately I never got the chance, but I was always curious to try Text Kit’s capabilities.</p>
<p>Fast forward a few years and I got my change this past week. Designers handed me a screen that looks like this:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Text Kit Design.png" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYzZgUH5gNHoyXajfh3iD1AiC6apT0SjXWgwUiQIv4NbAjnkgttyVnRpI7PQrS6WvcOrbdfHgNek3jmKy6hWMoF6gCmIHh4yyALNCdQ_I9kWyf8NFkQ4R-4IZgI-uPaqybGgBibg/?imgmax=800" alt="Text Kit Design" width="516" height="393" border="0" /></p>
<p>What I always remembered about Text Kit was the easy way to exclude paths from the layout for things like images and the text could flow around it.</p>
<p>To refresh my memory on how to do that, I did some searching and came across <a href="http://www.raywenderlich.com/77092/text-kit-tutorial-swift">Ray Wenderlich’s Text Kit Tutorial, Updated with Swift</a>. Great, read the article, downloaded the sample, and started using the UIBezierPath calculation stuff in my real project.</p>
<p>That’s where things went off the rails but I didn’t realize it until today. You see the tutorial had this:</p>
<p><span style="font-family: Courier;">let exclusionPath = timeView.curvePathWithOrigin(timeView.center)<br />textView.textContainer.exclusionPaths = [exclusionPath]</span></p>
<p>The method <span style="font-family: Courier;">curvePathWithOrigin</span> was calculating a round <span style="font-family: Courier;">UIBezierPath</span> because the tutorial was inserting a round graphic into the UITextView. I needed to create a rectangular UIBezierPath (see orange box in above image), but didn’t know you could do. Maybe it was the pain from a hand injury, maybe just ignorance or I forgot, but I didn’t get it.</p>
<p>Of course the round bezier path from the tutorial was not flowing text around the rectangle image correctly. It all seems to obvious in hindsight.</p>
<p>I tried many things to fix this issue. One of those was crawling down <span style="font-family: Courier;">UITextView’s</span> internal object tree and setting <span style="font-family: Courier;">textContainer.layoutManager.delegate</span> to my <span style="font-family: Courier;">UIViewController</span> instance. I usually never do things like this but again I probably wasn’t thinking very clearly.</p>
<p>Setting the delegate appeared to make the text flow better because character wrapping became the default, so I left the delegate assignment in. What a mistake!</p>
<p>When I realized how stupid I was being with <span style="font-family: Courier;">UIBezierPath </span>and used a rectangular exclusionPath, <span style="font-family: Courier;">UITextView</span> was defaulting to character wrapping instead of word wrapping.</p>
<p>Of course I was going through the Six Stages of Debugging:</p>
<blockquote class="twitter-tweet" lang="en">
<p lang="en" dir="ltr">The Debugging Six Stages <a href="https://twitter.com/hashtag/debugging?src=hash">#debugging</a> <a href="https://twitter.com/hashtag/programming?src=hash">#programming</a> <a href="https://twitter.com/hashtag/epic?src=hash">#epic</a> <a href="http://t.co/kM6JOG3s5E">pic.twitter.com/kM6JOG3s5E</a></p>
<p>— Silviu Ardelean (@silviuardelean)</p>
<p><a href="https://twitter.com/silviuardelean/status/441199377189588992">March 5, 2014</a></p>
</blockquote>
<p>
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
I finally got to Stage 5 when I built up a sample line by line until I figured out setting the <span style="font-family: Courier;">textContainer.layoutManager.delegate</span> to my <span style="font-family: Courier;">UIViewController</span> instance was a really dumb idea.</p>
<p><img src="http://bukk.it/fullpalm.jpg" /></p>
<p>Sometimes when writing code, you make bad choices and it takes a while to figure that out...</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-56938290020111801082015-10-02T14:09:00.001-04:002015-10-02T14:09:04.262-04:00How To: Switch an Apple Watch to a new iPhone<p>I just got an iPhone 6s 128 GB and I remember reading an iMore article on the <a href="http://www.imore.com/doing-clean-install-your-iphone-6s-heres-what-youll-bring-over-and-what-youll-lose">merits of doing a clean phone setup or restoring from a backup</a> mentioning how to switch the Apple Watch to a new iPhone. Here’s a direct link to the<a href="https://support.apple.com/en-us/HT205189"> Apple Support</a> article.</p>
<p>This procedure is way to complicated. The iPhone setup experience doesn’t know anything about Apple Watch, which is ridiculous.</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-37616501382921729542015-09-16T15:06:00.001-04:002015-09-16T15:06:29.322-04:00Inner Exception is on Apple News! Just search for "Inner Exception"<p>iOS 9 is out now and one of the big new features is <a href="http://www.apple.com/news/">News</a> and Inner Exception is there!</p>
<p>I didn’t really expect that Apple would take a blog like this into the News pantheon, but they did and it’s live.</p>
<p>Turns out the old logo was so poorly designed by me, it really looked terrible in Apple News, so I made a new one.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="InEx - Orange.png" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfj_lYNFTOm4Gi7ubkFW9SJ8mgWeowrRQKUquGd2MuCTx1QC2NpFA1q_dApcqkxQzK8Y7HUz5sYsCFxsOvyaXbY0rzvPu7ToGd0yFFDaQRQI0YEtRf7jYVoYZudOLZWP_xbQSidA/?imgmax=800" alt="InEx Orange" width="600" height="75" border="0" /></p>
<p>Since I look at Menlo all day long in Xcode and this is mostly a coding blog, it seemed like the right choice.</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-38822120267462472372015-08-21T10:11:00.001-04:002015-08-21T10:11:37.033-04:00Just discovered iTunes Connect - Manage iCloud Download Settings<p>When you have an app for sale and you haven’t logged into iTunes Connect for a while, you don’t often see new features added. The <strong>Manage iCloud download settings for this app</strong> in the <strong>Pricing</strong> tab is one such feature that escaped my attention…until now!</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Mange iCloud Download Settings.png" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOsMmAVmgaFpqqNzUZ7VZ6F4i_w5TGUpJ-kuUrEpXSNN4vNacZ8EgweL4rojbIxPojvQk4ZywE29Txm1NhDeXTsWO9ruhWjzUQ9ti-mD45a9D-CNsT1zygiYffkE3lAcRiTwRDVA/?imgmax=800" alt="Mange iCloud Download Settings" width="429" height="193" border="0" /></p>
<p>Super handy if you need to control this more tightly.</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-87656361578520906312015-07-31T10:14:00.001-04:002015-07-31T10:14:28.399-04:00How To Write a Swift Generic Function Based Only On Return Type<div style="background-color: lightblue; padding: 5px;">
<table>
<tbody>
<tr><th>TL;DR</th>
<td>Annotate the return variable with a type, e.x. <span style="font-family: Courier;">let foo:String? = Utility.nullableValueFromKey(“identifier", dictionary: jsonDictionary)</span></td>
</tr>
</tbody>
</table>
</div>
<div style="background-color: lightyellow; padding: 5px; margin-top: 5px;">
<table cellspacing="2px">
<tbody>
<tr><th>Versions:</th>
<td>OS X 10.10.4 </td>
<td>Xcode 6.4</td>
<td>iOS SDK 8.4 </td>
</tr>
</tbody>
</table>
</div>
<p>When I started working with Objective-C coming from .NET, one of language features that I missed the most was Generics. They solve a whole class of problems that are tedious and/or require way more code than without generics. When Swift was announced with Generics...</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Finally...It's Done" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihkMixoSlswW5D6wfGyQzO2NSRPdE4PbsOkSdhHAeaiDvFHr2TDQVuV3JC5v6UglJgQ2QjAzhbHdq5UHxqz3lp202ymUDPOZ0ZDQI2VYim4FdMzX4ejwjIo61MlZUxcC8rUwXsNQ/?imgmax=800" alt="Finally...It's Done" width="200" height="200" border="0" /></p>
<p>But Generics can be hard, thinking in T for any giving problem can make you a little crazy, especially when the compiler keeps yelling at you.</p>
<p>In Swift 1.0, I used generic functions to help parsing JSON server responses, the functions worked, but they were less than ideal.</p>
<p>The typical problem I wanted to solve was getting a primitive type out of the response dictionary that could be null.</p>
<p>I ended up with this function to do the trick:</p>
<blockquote>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">class</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">func</span> originalNullableValue<T>(valueType: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">T</span>, key: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">String</span>, dictionary: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">NSDictionary</span>) -> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">T</span>? {</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"><span> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">var</span> value:<span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">T</span>? = <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">nil</span></pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">var</span> valueTemp = dictionary[key] <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">as</span> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">AnyObject</span>! <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">as</span>? <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">T</span></pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">if</span> valueTemp != <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">nil</span> {</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> value = valueTemp!</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> }</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">return</span> value</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;">}</pre>
</blockquote>
<p>Ugly! Why did I end up with this? Either I wasn’t smart enough to figure this out or the 1.0 compiler wasn’t.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Smart, but not Smart Enough" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw1H4BbphPb5zr8Y_uYhdzOmX6mH6g7wLMzPMdNbXpWFh_fVc2V4PJyScQxXrlTpl_YWwyaYA5LBc5Dp4ukQAvKTiPdEaLjyav3wtW88TX36Lxe-ksnMZy8axvYK1wG0-ec0MX0Q/?imgmax=800" alt="Smart, but not Smart Enough" width="250" height="172" border="0" /></p>
<p>Getting either me or the compiler to figure out what type T was without passing an argument of that type into the method, was, well let’s just say it was the solution I found.</p>
<p>What I wanted was this:</p>
<blockquote>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">class</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">func</span> nullableValueFromKey<T>(key: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">String</span>, dictionary: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">NSDictionary</span>) -> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">T</span>? {</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">var</span> value:<span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">T</span>? = <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">nil</span></pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">var</span> valueTemp = dictionary[key] <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">as</span> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">AnyObject</span>! <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">as</span>? <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">T</span></pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">if</span> valueTemp != <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">nil</span> {</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> value = valueTemp!</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> }</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo; min-height: 14px;"> </pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">return</span> value</pre>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;">}</pre>
</blockquote>
<p>So I dusted off the original method and tried making it what I wanted with Xcode 6.4 & Swift 1.2.</p>
<p>Defining it works fine, but If you attempt to call it:</p>
<blockquote>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">let</span> foo = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187;">JSONUtility</span>.nullableArrayFromKey(<span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b;">"fooBar"</span>, json: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">Dictionary</span><<span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">String</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">AnyObject</span>>())</pre>
</blockquote>
<p>The compiler returns this error:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Argument for generic parameter 'T' could not be inferred" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidpJeuMGyKsgWOrCK2FTRUEvxUBMjnoBmy8llpaTBVB7OvIDpqn7G5jU5GHi3pAbQOfGKGcSc7hQh4ZHkw1FNIP3mnsTow5JbYzX6-NVuHHOA0O5ayRNVpnhXy9UWQh93jqJrgJg/?imgmax=800" alt="Argument for generic parameter 'T' could not be inferred" width="276" height="18" border="0" /></p>
<p>I have no way to know/test if this is the same error that caused me trouble in Swift 1.0, but this time, either I or the compiler were smart enough to figure it out!</p>
<p>All you have to do is add the type to the variable declaration:</p>
<blockquote>
<pre style="margin: 0px; font-size: 12px; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">let</span> bar:<span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">String</span>? = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187;">JSONUtility</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d;">nullableValueFromKey</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b;">"name"</span>, dictionary: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">Dictionary</span><<span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">String</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">AnyObject</span>>())</pre>
</blockquote>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Flawless Victory" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhms1v9A_KV8ihKGweagtjjQ-p7dVTVhbzepqLIMubZdyZldruxoE-mlsTup0RGoyoxhQCbsVb49mBeT1HuZXgfIyXAGMvg3XEMUE0-o7KtyrqrlBFyiNSgi7S9GSlJP6PSw2NSSQ/?imgmax=800" alt="Flawless Victory" width="250" height="187" border="0" /></p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-77827276411042751992015-07-30T17:15:00.001-04:002015-07-30T17:15:58.953-04:00No Dan Gillmor, Government Should Do Nothing About Android Security<p>I nearly burst from laughter after reading this tweet and then article by Dan Gillmor:</p>
<blockquote class="twitter-tweet" lang="en">
<p lang="en" dir="ltr">New Android vulnerability + industry fecklessness = need for new laws/regs. My latest at <a href="https://twitter.com/Slate">@slate</a><a href="https://twitter.com/FutureTenseNow">@FutureTenseNow</a>: <a href="http://t.co/uzPgEJZYgD">http://t.co/uzPgEJZYgD</a></p>
<p>— Dan Gillmor (@dangillmor)</p>
<p><a href="https://twitter.com/dangillmor/status/626849803511726080">July 30, 2015</a></p>
</blockquote>
<p>What’s so funny? The free market is working in this case exactly as intended. A company in the market, e.x Apple, provides mobile devices that are usually secure and updated. Some consumers have voted with their dollars that isn’t as important to them as other criteria, so they bought an Android phone. There is no surprise here that if you buy an Android device, you highly likely will not get updates of any kind, security or otherwise. </p>
<p>What criteria stops people from buying an Apple device? Let’s return to Mr. Gillmor:</p>
<blockquote>
<p><span style="color: #281b21; font-family: sl-Apres; font-size: 15px; line-height: 27px;">Apple's iOS devices, of course, are part of a tightly controlled ecosystem, and while Apple is far from perfect on security, it does update iPhones. But we shouldn't be required to turn over our computing and communications to control-freak companies in order to get necessary security updates.</span></p>
</blockquote>
<p>So let me get this straight? Mr. Gillmor doesn’t want Apple devices because Apple is a “control-freak” company, so he invites the control-freak government to use laws & regulations & force Android implementors to be more control freaks about updates…like Apple. LOL. Sure, the government is always the lightest touch!</p>
<p>If Android users thought updates and security where higher priorities than cheap phones or “open source” software, then they wouldn’t have bought an Android device.</p>
<p>Returning this as not a bug, working as intended!</p>
<p><strong>Epilogue</strong></p>
<p>Google made this mess, they can still fix it. They already offer an <a href="https://www.google.com/about/appsecurity/android-rewards/index.html">Android Bug Bounty</a>. They have a generic <a href="https://www.google.com/about/appsecurity/patch-rewards/index.html">Patch Reward Program</a>.</p>
<p>Instead of the heavy hand of laws and regulations, Google should start an Update Rewards program.</p>
<p>Every carrier or vendor that releases Android updates in a timely fashion (say within 1 month) gets a payment from Google.</p>
<p>Security Updates pay more than Feature Updates. To really sweeten the pot, Google can pay per user upgraded, get some vendor/carrier incentive to update as many users as possible.</p>
<p>Vendors/carriers have such thin margins, seems like they don’t have the money to cover testing and deploying Android updates without taking a loss.</p>
<p>Use some of that ad revenue to cover the costs. I mean, advertisers should be clamoring for this. After all, how can they trust the ad profiles Google vends with compromised devices?</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-35980833429407629082015-07-13T14:44:00.001-04:002015-07-13T14:44:46.343-04:00How to Completely Eliminate UITableView Content and Separator Indent on UITableVIewCell<div style="background-color: lightblue; padding: 5px;">
<table>
<tbody>
<tr><th>TL;DR</th>
<td>
<p><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">override</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">func</span><span style="font-family: Menlo; font-size: 12px;"> viewDidLoad() {</span></p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;"><span> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">super</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81;">viewDidLoad</span>()</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo; color: #008400;"><span style="font-size: 12px; color: #000000;"> </span><span style="font-size: 12px;"> </span></p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo; color: #703daa;"><span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">self</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000;">.</span>tableView<span style="font-variant-ligatures: no-common-ligatures; color: #000000;">.</span>separatorInset<span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> = </span>UIEdgeInsetsZero</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo; color: #703daa;"><span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">self</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000;">.</span>tableView<span style="font-variant-ligatures: no-common-ligatures; color: #000000;">.</span>layoutMargins<span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> = </span>UIEdgeInsetsZero</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;">}</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo; color: #703daa;"> </p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;"><span style="color: #bb2ca2;">override</span> <span style="color: #bb2ca2;">func</span> tableView(tableView: <span style="color: #703daa;">UITableView</span>, willDisplayCell cell: <span style="color: #703daa;">UITableViewCell</span>, forRowAtIndexPath indexPath: <span style="color: #703daa;">NSIndexPath</span>) {</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo; color: #703daa;"><span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> cell.</span>layoutMargins<span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> = </span>UIEdgeInsetsZero</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;">}</p>
</td>
</tr>
</tbody>
</table>
</div>
<div style="background-color: lightyellow; padding: 5px; margin-top: 5px;">
<table cellspacing="2px">
<tbody>
<tr><th>Versions:</th>
<td>OS X 10.10.4</td>
<td>Xcode 6.4</td>
<td>iOS SDK 8.4</td>
</tr>
</tbody>
</table>
</div>
<p>Almost every iOS app has at least one and usually more UITableViews and associated UIViewController or UITableViewControllers to manage them.</p>
<p>The view’s ubiquity has to make implementing it very tough and I don’t envy the team that has to account for all the use cases.</p>
<p>Over time, UITableView, UITableViewDelegate, UITableViewDataSource, and UITableViewCell have become very large. Throw in their subclasses, UIScrollView & UIView, and developers have to remember a lot of stuff to get all the behavior they want.</p>
<p>Or in this case, don’t want. UITableView enforces default layout margins and separator margins that are not obvious…once you use AutoLayout.</p>
<p>This is what you see in your storyboard:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="UITableView_Storyboard.png" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf0LE8wFR-sRid4yBGCec5HhM5e3-iNYMMYvxJW1zvoF8k7qkQ5KB3tpnjv4g4AoRuRkNLY5EkHU5xFw680zgiNDVXOAVX8yyrv_Vw3RlgFv9J2bb7iI7008OoRZp_gAxrwJt6Dg/?imgmax=800" alt="UITableView Storyboard" width="553" height="589" border="0" /></p>
<p> </p>
<p>This is what you see in the app:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="UITableView_Insets.png" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj93R1Id9BCeO1oFJyleJsoZ4bN2txACbQ5sDzucpkQEADOHlJJQPXDmeVrEDPdm09g7gMI46p4iRErtogsq41-7ka8EO2ZeOrcG-b4weAXwWNqqovTCZvQ3vENKBJg4ZILhBa8qw/?imgmax=800" alt="UITableView Insets" width="380" height="127" border="0" /></p>
<p>Notice the left hand margin? There is no option you can change in the Storyboard to fix it, you just get an indent/margin/inset you didn’t ask for. The storyboard doesn’t show this, so I’m not sure if this is a bug in the Storyboard editor, or in runtime in UITableView.</p>
<p>What’s happened is that I added a few AutoLayout constraints to the left red bar (margins t: -8, l: -8, b: -9).</p>
<p>When I do this, the tableView.layoutMargins appear to be their default value of 8. It looks like without AutoLayout, UITableView resets layoutMargins to UIEdgeInsetsZero, but with AutoLayout, it either wants the default margins or there’s a bug.</p>
<p>You have to add the following code to fix the pre-cell tableView display:</p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo;"><span style="color: #bb2ca2;">override</span> <span style="color: #bb2ca2;">func</span> viewDidLoad() {</p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo;"> <span style="color: #bb2ca2;">super</span>.<span style="color: #3d1d81;">viewDidLoad</span>()</p>
<p style="margin: 0px; font-size: 11px; font-family: Menlo; color: #008400;"><span style="font-size: 12px; color: #000000;"> </span><span style="font-size: 12px;"> </span></p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo; color: #703daa;"><span style="color: #000000;"> </span><span style="color: #bb2ca2;">self</span><span style="color: #000000;">.</span>tableView<span style="color: #000000;">.</span>separatorInset<span style="color: #000000;"> = </span>UIEdgeInsetsZero</p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo; color: #703daa;"><span style="color: #000000;"> </span><span style="color: #bb2ca2;">self</span><span style="color: #000000;">.</span>tableView<span style="color: #000000;">.</span>layoutMargins<span style="color: #000000;"> = </span>UIEdgeInsetsZero</p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo;">} </p>
<p>But that’s not enough to get the cells looking right. Based in part on <a href="http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-working">this StackOverflow post</a>, but with my own testing, you have to implement the delegate callback <span style="font-family: Courier;">willDisplayCell</span> like this:</p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo;"><span style="color: #bb2ca2;">override</span> <span style="color: #bb2ca2;">func</span> tableView(tableView: <span style="color: #703daa;">UITableView</span>, willDisplayCell cell: <span style="color: #703daa;">UITableViewCell</span>, forRowAtIndexPath indexPath: <span style="color: #703daa;">NSIndexPath</span>) {</p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo; color: #703daa;"><span style="color: #000000;"> cell.</span>layoutMargins<span style="color: #000000;"> = </span>UIEdgeInsetsZero</p>
<p style="font-size: 12px; margin: 0px; font-family: Menlo;">}</p>
<p>Why do we have to set <span style="font-family: Courier;">layoutMargins</span> again in <span style="font-family: Courier;">willDisplayCell</span>? Apparently the cell’s layoutMargins get reset again right UITableView decides where to draw the separator line, so you have to make them whatever you want. Curiously, <span style="font-family: Courier;">willDisplayCell</span> has existed since iOS 2, but I don’t remember needing to use it before iOS 8.</p>
<p>Now we get what we want.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="UITableView_Insets_fixed.png" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihdfaIKQbyz0r1PNymF611Y2XliwzN4DTkrBR7g26dsKIuu8AlybURX3CLpYRMKAe501kacr5fI6HBD01xBCGWZIh-oYN80rpnJ4NG92N9EF_2zUpTnTcvUCkYfUWLXD7_pOxd9g/?imgmax=800" alt="UITableView Insets fixed" width="378" height="121" border="0" /></p>
<p><strong>Another Workaround That’s Incomplete...</strong></p>
<p>This <a href="http://stackoverflow.com/questions/29572043/ios-8-3-uitableview-cell-not-aligned-indentation-to-the-left">other StackOverflow post</a> mentions the <span style="font-family: Courier;">UIView</span> property <span style="font-family: Courier;">preservesSuperviewLayoutMargins.</span> It defaults to NO/false, but for a <span style="font-family: Courier;">UITableViewCell</span> is set to YES/true.</p>
<p>You could have mostly solved the problem by explicitly setting that property to NO/false, but it would not have fixed the separator issue.</p>
<p><strong>iOS 9 Beta</strong> </p>
<p>I haven’t run through this on iOS 9 beta, so I don’t know what the the default indent situation is there.</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-62061797949581710282015-07-10T15:30:00.001-04:002015-07-10T15:30:44.334-04:00Change the Global Tint in an Xcode Storyboard<div style="background-color: lightblue; padding: 5px;">
<table>
<tbody>
<tr><th>TL;DR</th>
<td>Look at the File Inspector tab (the one with the blank document) of your storyboard</td>
</tr>
</tbody>
</table>
</div>
<p>Whenever I go looking for the Global Tint defined in the main storyboard in Xcode, there’s always a moment of cognitive dissonance.</p>
<p>My problem is that I go looking for some kind of Window object, which of course is how you’d do it programmatically (in Swift):</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo; color: #703daa;"><span style="font-family: Courier;">UIApplication<span style="font-variant-ligatures: no-common-ligatures; color: #000000;">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81;">sharedApplication</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000;">().</span>delegate<span style="font-variant-ligatures: no-common-ligatures; color: #000000;">?.window!!.</span>tintColor<span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> = </span>UIColor<span style="font-variant-ligatures: no-common-ligatures; color: #000000;">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81;">redColor</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000;">()</span></span></p>
<p>The double !! after window is not a typo according to Xcode, though it sure looks weird.</p>
<p>Anyway, I guess nobody wants to make UIWindows things in Storyboards, so this property is stashed under the File Inspector tab!</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-35832377377669937472015-06-12T08:28:00.000-04:002015-06-12T08:39:45.044-04:00GitHub is Not Your ResumeYour resume is your resume. <div><br></div><div>Your released apps are your resume. </div><div><br></div><div>Your released sites are your resume. </div><div><br></div><div>Your published blog posts are your resume.</div><div><br></div><div>Your contributions to widely used open source software, some of which might be hosted on GitHub, are your resume. </div><div><br></div><div>Your public repo that you're the sole contributor to and isn't a shipping product is <b>not your resume</b>. </div><div><br></div><div>Hiring managers <span style="background-color: rgba(255, 255, 255, 0);">screening applicants </span>don't have time to pull 3+ repos, attempt to compile them, and then read the source to see what a 10x dev/rockstar/ninja/special snowflake you are.</div><div> </div>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-22231676305694849922015-05-14T11:22:00.001-04:002015-05-14T11:22:16.667-04:00Google Mandating Chrome Extensions Hosted on Google Servers, Installed from Chrome Web Store<p><a href="http://arstechnica.com/information-technology/2015/05/google-extends-chrome-malware-crackdown-to-windows-dev-channel-os-x/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+arstechnica%2Findex+%28Ars+Technica+-+All+content%29">All about fighting malware extensions</a>. Not just on Windows stable, but Windows dev and all OS X soon.</p>
<p>Open Always Wins!</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-17763722023496965812015-05-07T11:56:00.001-04:002015-07-07T07:22:57.694-04:00Cocoapods use_frameworks! Means A Bridging Header Not Required for Objective-C Pods in Swift<div style="background-color: lightblue; padding: 5px;">
<table>
<tbody>
<tr><th>TL;DR</th>
<td>Use standard "Import Framework" in Swift instead of the Obj-C bridging header for Obj-C Cocoapods with use_frameworks! in your Pods file</td>
</tr>
</tbody>
</table>
</div>
<div style="background-color: lightyellow; padding: 5px; margin-top: 5px;">
<table cellspacing="2px">
<tbody>
<tr><th>Versions:</th>
<td>OS X 10.10.3</td>
<td>Xcode 6.3.1</td>
<td>iOS SDK 8.3 </td>
<td>Cocoapods 0.36.1</td>
</tr>
</tbody>
</table>
</div>
<p>This just wasn't obvious at all. I've been using Swift & Cocoapods < 0.36 since Xcode 6 shipped. While versions < 0.36 did not work with a Swift framework like <a href="https://github.com/Alamofire/Alamofire">Alamofire</a>, you could use Objective-C pods and let them get compiled as a static library as long as you used the Objective-C bridging header to import the header(s).</p>
<p>With Cocoapods 0.36 and above, you can have Swift frameworks as Pods. To make that work, you have to put the <a href="https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang">use_frameworks!</a> keyword in your Pods file. My brain misunderstood <strong>Use frameworks instead of static libraries for Pods</strong> because it automatically inserted <em>for Swift</em> before the <strong>Pods</strong> in that sentence. </p>
<p>Took me a couple hours this morning to work out all my Pods might be framworks. I'm not the first person to figure it out, just a few days ago, <a href="http://johannesluderschmidt.de/cocoapods-swift-does-not-work-with-use_frameworks-fix/3281/">Johannes Luderschmidt published a blog post</a> with the solution which put on the right path. All Pods using <strong>use_frameworks!</strong> are frameworks, not just the Swift pods. A problem like this is where experience with Xcode can really work against you. You start tweaking <span style="font-family: Courier;">Header Search Paths,</span> <span style="font-family: Courier;">Framework Search Paths</span>, <span style="font-family: Courier;">User Header Search Paths</span>, and the <span style="font-family: Courier;">Always Search User Paths</span> (docs: disabling it is strongly recommended) settings in desperation because that's <em>usually</em> where these problems lie. Especially when the first compiler error in your project after putting <strong>use_frameworks!</strong> in your Pod file is that the header for come Objective-C pod can’t be found.</p>
<p>But that’s totally down the wrong rabbit hole. I’m using the Obj-C <a href="https://github.com/jdg/MBProgressHUD">MBProgressHUD</a> Pod. What you need to do is:</p>
<ol>
<li>Remove the <span style="font-family: Courier;">#imports</span> from your bridging header</li>
<li>Add <span style="font-family: Courier;">Import MBProgressHUD</span> into every Swift file that needs the class.</li>
<li>Fix the enums</li>
</ol>
<p>You're now using bona fide frameworks, so your enums have moved in flight! You might have a line of Swift that was fine with the bridging header like this:</p>
<pre>progressHUD.mode = MBProgressHUDModeIndeterminate</pre>
<p>That now has to become this:</p>
<pre>progressHUD.mode = MBProgressHUDMode.Indeterminate</pre>
<p>Not to big a deal, but the pile of errors might lead you astray that you have a bigger problem than you do if you’re using a lot of Obj-C enums.</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-13358840497387216162015-04-22T17:43:00.001-04:002015-04-22T17:43:14.213-04:00Deleted my Instapaper Account, Here are Some Stats, and Why the Service Didn't Work For Me<div style="background-color: lightblue; padding: 5px;">
<table>
<tbody>
<tr><th>TL;DR</th>
<td>645 Unread</td>
<td>25 Archived</td>
<td>1 Starred</td>
</tr>
</tbody>
</table>
</div>
<p>I've had an <a href="https://www.instapaper.com">Instapaper</a> account since 2008 when <a href="http://www.marco.org">Marco Arment</a> launched the service until now. I haven’t been using the account for most of the last 2 years, with my last save in June 2014, the only one the whole year.</p>
<p>So I deleted my account. Finally!</p>
<p>The idea never really worked for me, even though I was very excited about it. I’ve always been a news junkie. My routine is daily RSS reader, hourly Twitter timeline, Facebook News Feed mostly on weekends, and daily manual reading of a number of sites. The idea of a service that could generate a newspaper like thing for me to read later seemed great. But I realized that after I went through my usual news reading routine, my attention was exhausted. </p>
<p>Instead, I used Instapaper as a bookmarking service for “important stuff”, longer form deeper think pieces I thought I absolutely had to know and would get to later. That also turned out to be untrue. Out of the 671 links I added to Instapaper, how many did I actually read? 26! 3.8%. That’s way lower than even I expected.</p>
<p>I’ve been using the Reading List feature built-in to Safari on iOS and OS X, but it’s where links kind of go to die for the same reasons as Instapaper, I just don’t go there, does’t fit into my routine. Bookmarks are a similar story, only the Bookmarks on my favorites bar see any action.</p>
<p>What I think I might need is something to save links grouped by research topic, not just one big list. Bookmark Folders kind of serve that purpose, but it’s not really an elegant or searchable tool.</p>
<p>I’ve also kind of become one of those people on a desktop browser that just leaves a browser window open per topic with tabs for each site until I’m ready to deal with it. Safari does an excellent job of keeping this state at the ready in my Dock on OS X.</p>
<p> </p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-88340260177407309622015-04-08T15:33:00.001-04:002015-04-08T15:41:02.764-04:00How To Use the Spock Live Long and Prosper Emoji on iOS 8.3 & OS X 10.10.3<div style="background-color: lightyellow; margin-top: 5px; padding: 5px;">
<table style="background-color: lightyellow;" cellspacing="2px">
<tbody>
<tr><th>Versions:</th>
<td>OS X 10.10.3</td>
<td> </td>
<td>iOS 8.3</td>
</tr>
</tbody>
</table>
</div>
<div> </div>
<div>Despite the date, this article by <a href="http://sixcolors.com/post/2015/04/apples-emoji-lives-long-and-prospers/">Jason Snell at Six Colors</a> about the Spock Live Long and Prosper hand gesture, referred to as <a href="http://emojipedia.org/raised-hand-with-part-between-middle-and-ring-fingers/">Raised Hand with Part Between Middle and Ring Finger</a>, is not an April Fool’s Joke.</div>
<div> </div>
<div>iOS 8.3 and OS X 10.10.3 can display the emoji, but it isn’t in the standard Emoji keyboard on either OS yet.</div>
<div> </div>
<div>To be able to use the emoji on OS X, you can create a text replacement macro to use it now:</div>
<div><ol>
<li>Copy the emoji from here: <a href="http://emojipedia.org/raised-hand-with-part-between-middle-and-ring-fingers/">Raised Hand with Part Between Middle and Ring Finger</a> (Blogger keeps double-encoding the emoji and makes it unreadable).</li>
<li>Go to <strong>System Preferences -> Keyboard -> Text </strong>tab.</li>
<li>Click <strong>+.</strong></li>
<li>I used <strong>LLAP</strong> in the <strong>Replace</strong> column and the emoji in the <strong>With</strong> column.</li>
<li>That’s it!</li>
</ol>
<div>Now when you type LLAP on OS X, you’ll get prompted to use the emoji.</div>
<div> </div>
<div>Now on iOS:</div>
<div><ol>
<li>Copy the emoji from here: <a href="http://emojipedia.org/raised-hand-with-part-between-middle-and-ring-fingers/">Raised Hand with Part Between Middle and Ring Finger</a></li>
<li>Go to <strong>Settings -> General -> Keyboard -> Shortcuts.</strong></li>
<li>Tap <strong>+.</strong></li>
<li>Paste the emoji into <strong>Phrase.</strong></li>
<li>Type <strong>LLAP</strong> into <strong>Shortcut.</strong></li>
<li>Tap <strong>Save.</strong></li>
</ol></div>
</div>
<div>Now when you type LLAP on iOS, you’ll get prompted to use the emoji.</div>
<div> </div>
<div>Live Long and Prosper!</div>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-16279436435153669132015-04-03T12:58:00.001-04:002015-04-03T12:58:37.777-04:00With Autocompleted Methods & Functions, I Wish Returned Values Came After the Call In Swift<p>We’ve been calling functions or methods on objects the same since at least C appeared in 1972. You declare & call a function like this:</p>
<blockquote>
<pre>int main(void) {<br /> printf("hello, world\n");</pre>
<pre> return 0;<br />}</pre>
<pre>int value = main();</pre>
</blockquote>
<p>To define, the return type is declared before the name of the function. On call, a variable is declared to hold the return value of the function call.</p>
<p>In Swift, you declare a function with a return type like this:</p>
<blockquote>
<ul class="code-lines" style="border: 0px; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; counter-reset: li 0; line-height: 1.6em; list-style: none; font-family: Helvetica, Arial, sans-serif;">
<li style="background-color: transparent; border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: #f9f9f9; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap;">
<p style="margin: 0px; font-size: 12px; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">func</span> printAndCount(stringToPrint: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">String</span>) -> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">Int</span> {</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81;">println</span>(stringToPrint)</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;"> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81;">countElements</span>(stringToPrint)</p>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;">}</p>
</li>
</ul>
</blockquote>
<p>I loved this change to the C convention. IMHO, the information importance follows the order you declare the function: name, parameter type(s), and return type(s). However, you still call that function like this:</p>
<blockquote>
<ul class="code-lines" style="border: 0px; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; counter-reset: li 0; line-height: 1.6em; list-style: none; font-family: Helvetica, Arial, sans-serif;">
<li style="background-color: transparent; border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: #f9f9f9; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap;">
<p style="margin: 0px; font-size: 12px; font-family: Menlo; color: #d12f1b;"><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000;"> count = </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d;">printAndCount</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000;">(</span>"Hello, playground"<span style="font-variant-ligatures: no-common-ligatures; color: #000000;">)</span></p>
</li>
</ul>
</blockquote>
<p>This feels like a job half done, a little bit like the tail wagging the dog</p>
<p>I nearly always know the name of a function or method I want to call before I know its return types.</p>
<p>Wouldn’t it be great if the language was fully adapted to the pervasiveness of autocomplete?</p>
<p>Imagine the amount of time you’d save if you could start typing the name of the function or method first and let autocomplete show & then fill in the return types?</p>
<h2>Proposing Post Call Return Value Assignment</h2>
<p>I’m proposing that variables that are assigned the return value of a function should come after the function call using a return arrow. It would look something like this:</p>
<blockquote>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;">printAndCount(<span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b;">"Hello, playground"</span>) -> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">let</span> count</p>
</blockquote>
<p>With methods, it would look like this:</p>
<blockquote>
<p style="margin: 0px; font-size: 12px; font-family: Menlo;">someObject.printAndCount(<span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b;">"Hello, playground"</span>) -> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">let</span> count</p>
</blockquote>
<p>The actual syntax is up for debate, but I’m excited by the idea. I don’t know of another language that does this.</p>
<h3>Pros</h3>
<ul>
<li>Far fewer trips to documentation to lookup the return types of a function you know the beginning of.</li>
<li>Far less typing of return types of any kind</li>
<li>Far less (no?) typing the object, autocompleting the method, then fixing up the return types to variables you want.</li>
</ul>
<h3>Cons</h3>
<ul>
<li>Return variables harder to “find” when reading code</li>
<ul>
<li>Listing for completeness, I don’t see it being materially wrong, just different from the norm</li>
</ul>
<li>Imagine the style debates because the existing way stays in the language.</li>
</ul>
<p>I’m betting the pros would outweigh any cons, and this feature would greatly increase the usability of the language and editor together.</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.comtag:blogger.com,1999:blog-7066219.post-81949113684024450072015-04-02T11:01:00.001-04:002015-04-02T14:49:52.500-04:00 iOS MPMoviePlayerController Crashes when prepareToPlay is Called Without Adding to a View<div style="background-color: lightblue; padding: 5px;">
<table>
<tbody>
<tr><th>TL;DR</th>
<td>Call something like <span style="font-family: Courier;">[self.view addSubView:moviePlayer.view]</span> before <span style="font-family: Courier;">[moviePlayer prepareToPlay]</span></td>
</tr>
</tbody>
</table>
</div>
<div style="background-color: lightyellow; padding: 5px; margin-top: 5px;">
<table cellspacing="2px">
<tbody>
<tr><th>Versions:</th>
<td>OS X 10.10.2</td>
<td>Xcode 6.2</td>
<td>iOS SDK 8.2 </td>
</tr>
</tbody>
</table>
</div>
<p>I just inherited some code previously compiled against iOS SDK 6.0, ran fine through iOS 7, but crashes on iOS 8.x. Here’s the crasher:</p>
<blockquote>
<p><span style="font-family: Courier;">NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"impact_of_needs_goal_planning@1x" ofType:@"mp4"]];<br /> self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];<br /> self.moviePlayer.shouldAutoplay = NO;<br /> [self.moviePlayer setControlStyle:MPMovieControlStyleNone];<br /> [self.moviePlayer.view setFrame:CGRectMake(0.0, 0.0, 1024.0, 748.0)];<br /> [self.moviePlayer.view setTag:7]; <br /><br /> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieDidLoad:) name:MPMoviePlayerLoadStateDidChangeNotification object:self.moviePlayer];<br /> [self.moviePlayer prepareToPlay];</span></p>
</blockquote>
<p>App was crashing on the last line, <span style="font-family: Courier;">[self.moviePlayer prepareToPlay];</span> every time it was called.</p>
<p>This is a guess (because installing an iOS 7 simulator is taking forever), but it looks like iOS 7 and below didn't care because the app was working fine. iOS 8 crashes.</p>
<p>The solution is adding the <span style="font-family: Courier;">moviePlayerController</span> to a parent view before calling <span style="font-family: Courier;">[self.moviePlayer prepareToPlay];</span>, like this:<br /> <span style="font-family: Courier;">[self addSubview:self.moviePlayer.view];</span></p>
<p>Given this is The Right Thing To Do™, I'm actually surprised it ever worked!</p>
<h2>Update</h2>
<p>Turns out this was not the cause of the crash, which I have yet to nail down. This change did seem to temporarily solve the crash, but alas it is something to do with NSNotifications :’(</p>Anonymoushttp://www.blogger.com/profile/16150203206863414230noreply@blogger.com