The personal blog of Stuart Breckenridge

Visual Studio for Mac  

Update: I think someone posted news a little too early as the linked article has been pulled.

Mikayla Hutchinson via the MSDN blog:

At Connect(); in November, Microsoft is launching a preview of Visual Studio for Mac. This is an exciting development, evolving the mobile-centric Xamarin Studio IDE into a true mobile-first, cloud-first development tool for .NET and C#, and bringing the Visual Studio development experience to the Mac.

After the release Visual Studio Code, I expected a version of Visual Studio for Mac, but not this quickly. This is big news!


The Influence of Facebook  

Rory Cellan-Jones, for the BBC:

In the United States, newspapers take their responsibilities to the democratic process very seriously.

So seriously, in fact, that they can come across as rather pompous to a British reader. When it comes to a presidential election they seem to believe that their endorsements are of huge significance and that their words will be weighed with utmost seriousness by their readers.

Now both the newspapers and the rest of the mainstream media are waking up to the fact that their influence may be as nothing compared with that of Facebook.

The News Feed algorithm serves you up whatever it thinks you and your friends want to believe and it certainly does not do any fact-checking.

Stories that accused the Clintons of murder or maintained that Barack Obama was a Muslim will have cropped up in the feeds of millions of people inclined to support Mr Trump.

Firing human editors really worked out well.


Fascism: I Sometimes Fear...  

Michael Rosen on Fascism (link):

I sometimes fear that
people think that fascism arrives in fancy dress
worn by grotesques and monsters
as played out in endless re-runs of the Nazis.

Fascism arrives as your friend.
It will restore your honour,
make you feel proud,
protect your house,
give you a job,
clean up the neighbourhood,
remind you of how great you once were,
clear out the venal and the corrupt,
remove anything you feel is unlike you…

It doesn’t walk in saying,
“Our programme means militias, mass imprisonments, transportations, war and persecution.”


Reversing Progress  

Peter Baker, for the New York Times:

For the first time since before World War II, Americans chose a president who promised to reverse the internationalism practiced by predecessors of both parties and to build walls both physical and metaphorical. Mr. Trump’s win foreshadowed an America more focused on its own affairs while leaving the world to take care of itself.


Completion Handlers vs. Delegation with URLSession

I am currently working on a URL shortener side project that uses URLSession and it just so happens that over on Use Your Loaf Keith Harrison was examining the same problem as me: completion handlers or delegation.

My initial API for shortening URLs used a completion handler:

public func shortenURL(url:String, completionHandler:@escaping (Bool, String?) -> ()) throws {
	// Setup Code  //
	let session = URLSession(configuration: .default, delegate: nil, delegateQueue: nil)
	let task = session.dataTask(with: urlComponents.url!, completionHandler: {(data, response, error) in
            if data != nil && error == nil {
                do {
                    let json = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.allowFragments) as! NSDictionary
                    
                    guard let shortenedURL = json["shorturl"] as? String else {
                        completionHandler(false, nil)
                        return
                    }
                    
                    completionHandler(true, shortenedURL)
                } catch {
                    completionHandler(false, error.localizedDescription)
                }
            }
        })
    task.resume()
}

This worked fine, but I still prefer to use delegation when using URLSession:

public func shortenURL(url:String) throws {
	// Request did begin
	self.delegate?.didBeginRequest()
	
	// Setup Code //
	
	let session = URLSession(configuration: .default, delegate: nil, delegateQueue: nil)
        let task = session.dataTask(with: urlComponents.url!, completionHandler: {(data, response, error) in
            if data != nil && error == nil {
                do {
                    let json = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.allowFragments) as! NSDictionary
                    
                    guard let shortenedURL = json["shorturl"] as? String else {
                        DispatchQueue.main.async {
                            self.delegate?.didFailWith(error: nil)
                        }
                        return
                    }
                    
                    DispatchQueue.main.async {
                        self.delegate?.didShortenTo(url: shortenedURL)
                    }
                } catch {
                    DispatchQueue.main.async {
                        self.delegate?.didFailWith(error: error)
                    }
                }
            }
        })
    task.resume()
}

Why delegation? URLSession doesn’t have a didBeginRequest() equivalent and I like having that granular level of control.



U.S. Election Coverage: NYT & The Guardian

Unless you’ve been living under a rock you’ll be aware that the U.S. presedential election comes to an end on 8th November1. The NYT and The Guardian (I’m a subscriber of both) have some neat offers over the next few days.

The New York Times will be free from November 7th to November 9th:

The New York Times is inviting readers to take advantage of its reporting, analysis and commentary from the lead-up through the aftermath of the 2016 election. Readers will have unlimited access to NYTimes.com for 72 hours from 12:01 a.m. ET on Monday, November 7 until 11:59 p.m. ET on Wednesday, November 9.

The Guardian’s Mobile Innovation Lab will be making full use of iOS 10 notifications with their rich format:

If you sign up, you’ll receive a single continuously updating notification that will sit on your phone’s lock screen as results come in on election night. The notification will show the most up-to-date numbers of electoral votes won and states called, as well as an indication of which swing states have been called, and the breakdown of the popular vote between the two top candidates.

The Guardian's notifications on Android and iOS.
  1. Barring any ridiculous lawsuits. ↩︎


My Static Website Workflow on iOS

I sold my old MacBook Pro in September in anticipation of purchasing a new one in early October, and because it actually took until November to buy one, I was iOS only for the month of October. This post describes how I migrated my static website workflow from macOS to iOS.

This blog is a static website built with Jekyll. This means that after writing a post, the entire site is rebuilt at which point the new content is visible. This differs from a dynamic website, such as Wordpress, which makes a call to a database to retrieve the desired content each time a page is loaded. With Jekyll, your content is already there.

My macOS workflow until September was pretty simple:

  • write content (in BBEdit or Coda 2)
  • build website locally
  • commit to GitHub
  • upload the generated _site directory to Surge

I had to migrate this workflow to iOS.

1. Writing Content

There are many capable Markdown editors for iOS, almost too many to mention. When writing posts on iOS, I’ve settled on the excellent Drafts app from Agile Tortoise.

As an added advantage, Drafts supports the TextExpander keyboard. I consider this essential as I have many blog post expansions in TextExpander, such a Jekyll’s YAML front matter. For example, the front matter for this post is as follows:

---
layout: post
title: My Static Website Workflow on iOS
excerpt: “How I migrated my static website workflow from macOS to iOS."
categories: [iPad Pro, Working Copy, Drafts, Netlify]
date: 2016-11-02T08:00:00+08:00
#modified:
identifier: CC6E9F6D-2A90-4434-A9CF-CBE9F0602C47
#image:
#link: 

---

2. Building the Website

On macOS it’s possible to build the website locally, via Terminal, as Jekyll can be installed. On iOS this isn’t possible. My approach to this problem: remove this step from the workflow.

When I tried to solve this problem initially, the question I was trying to answer was how do I continue to do this? Over time, that changed to do I need to do this? The answer is no.

3. Committing to GitHub

My solution for committing to GitHub was to start using Working Copy which allows me to manage the website’s GitHub repository.

So now, after a post is written in Drafts, I copy the content to a new file in the _posts directory in the website’s GitHub repository using Working Copy, commit and push the changes.

4. Uploading _site

Instead of using Surge to host my site, I now use Netlify. Netlify monitors changes to the website’s GitHub repository and when a change is made they do the rest, in their own words. In short, Netlify:

  • checks out the repository
  • builds the site using the command I’ve provided: bundle exec jekyll build1
  • uploads the generated _site/ directory

With my new iOSified workflow I no longer have to worry about building my website locally or uploading it. This doesn’t preclude me from continuing to build my site locally on macOS — indeed, if I am making design changes I will work on a Mac — but the move to iOS forced me to fundementally re-think and simplify my workflow.

I now write, commit, and wait for changes to be visible.

  1. This would be different if you were using Hugo or Middleman, for example. ↩︎


Apple Planning on Reducing Apple Music Price?  

Apple are apparently planning on a price reduction for Apple Music.

Chance Miller (via 9to5Mac):

With a 20 percent discount, the single-person Apple Music plan would come in at $7.99 per month, which is $2 less than the current $9.99 price point. The family package, which allows for up to six people, currently comes in at $14.99, but with the price cut would come in at $12.99. The $4.99 student tier would remain the same.

If this comes to fruition it will be interesting to see what the price changes would be in the UK, where the weak pound is causing significant price increases.


MacBook Pro (13-inch, Late 2016, Two Thunderbolt 3 Ports) Review

I watched Apple’s recent hello again event and, on reflection, found it to be disappointing: after a four year wait for a redesign, I was expecting a powerhouse update. That didn’t happen. Apple’s determination to have ~10 hour battery life along with reduced weight and size, restricted them from including more powerful features (DDR4 RAM, GPU). MacDaddy has a detailed article outlining the technical limitations Apple has to contend with.

The event ended with me ordering a 15-inch model which I subsequently cancelled. I am typing this article on the MacBook Pro (13-inch, Late 2016, Two Thunderbolt 3 Ports) Space Grey model.

Keyboard: Butterfly, 2nd Generation

Apple claim that this 2nd generation keyboard provides up-to 4x more stability over the previous generation. My point of reference to verify this claim is the 2016 MacBook and the difference is imperceptible. There is very little travel in each keypress and while I am fan of this design, it’s not to everyone’s taste. Your mileage here will vary. Like previous generations of MacBook Pro, the keyboard is backlit.

Butterfly Keyboard, 2nd Generation

This keyboard does not come with the new Touch Bar or Touch ID and I don’t feel as though I am missing out. Useful these features may become, but I don’t see either as being critical to my workflow.

Audio

Sitting either side of the keyboard are some much appreciated speakers. They are markedly improved over the speakers included in the previous 13-inch MacBook Pros: louder, and with more bass, they produce much better sound to my non-audiophile ears.

Force Touch Trackpad

The Force Touch Trackpad is huge! You can get more done in a single swipe than you’ve ever been able to get done in a single swipe before! Other than the size difference there are no other technical changes to the trackpad. However, I did find that the noise emitted when clicking the trackpad is strange — it sounds like you’re lightly tapping an empty tin. It’s not a bad thing, but it’s definitely noticeable.

Ports

Moving on to the sides of the chassis, we have two Thunderbolt 3/USB-C ports on the left and one headphone jack on the right. That’s it.

I am a big fan of Thunderbolt 3/USB-C — it’s such a capable connector. While there will be a migration period where everyone will need a dongle, I firmly believe that USB-C is the future and the quicker we all move to it the better. That said, these MacBooks are aimed at creatives and the ports that have been removed will be hugely inconvenient to them. For example, photographers relying on the SD card slot are out of luck.1

Display

Retina Display

This Retina display is, by far, the best display I’ve ever used on a MacBook. It’s got the same resolution as before (2560 x 1600) but now comes with wide-colour support and a brighter backlight. Indeed, when turned to full brightness I actually found the display too bright.2

On the subject of wide-colour support, there is a discernible difference between this screen and that of my iMac3. Colours are definitely more vivid.

Software Performance

The main apps I use are Xcode, Coda 2, and BBEdit. Of those, Xcode is obviously the most demanding and given that none of the apps I have developed are that taxing, I don’t see degraded performance over my iMac.

I would still recommend a 15-inch MacBook Pro for development of larger applications and media creation.

Other Notes

Like the 2015/2016 MacBook, the MacBook Pro no longer has an Apple logo that lights up. Do I miss it? Not really. I don’t spend time looking at the back of my MacBook’s screen (or, for that matter, anyone else’s screen).

Performance wise, results are beginning to appear on Geekbench. Based on commentary from MacRumors, this MacBook Pro is roughly 7% faster than the 2015 base MacBook Pro. I can’t say I’ve noticed a huge difference.

Final Thoughts

I am happy with this MacBook Pro, not delighted. It provides a spec bump that is in-line with the limitations Apple is working within. The main reason I downsized is that I expect this MacBook Pro, with its reduced cost compared to the 15-inch models, will last me around two years. Within that timeframe, I expect Apple will launch MacBook Pros with their own CPUs, more RAM, and perhaps an nVidia GPU.

  1. The current migration period is best summarised as follows: out of the box you cannot connect your iPhone to your MacBook Pro without a converter. I expect that will change and that Apple will drop Lightning for Thunderbolt 3/USB-C in the next iPhone. ↩︎

  2. The background used in this image is available via Interfacelift ↩︎

  3. Late 2013, non-Retina. ↩︎