Fallen

Fallen

A friend messaged me yesterday: do you know an app that can log ‘times fallen’ in Health? His lovely girlfriend needs a wheelshare to get around, and has to log these kind of medical events. 

I didn’t find one with a search in the App Store (then again, no surprise there), I didn’t want to tell him she can just log it manually in Health and being lazy as I am, writing one myself wasn’t really an option. 

Or could I? Thanks to Workflow’s Health integration, writing an app that logs a fall with a touch of a button is easy. 

Five minutes later his girlfriend now has a Workflow complication on her Apple Watch. Pressing it runs the ‘Fallen’ workflow and logs a fall with the time and date in Health. You can find the workflow here

If you wonder why Apple bought Workflow? In the words of Gusteau:

Anyone can code. 

iPhone 6s

iPhone 6s

I finally got my hands on the new iPhone 6s plus today. Since Belgium wasn’t in the first release wave, I had two options: wait until the next wave hits (next friday), or go to France and buy an iPhone via in-store reservations.

I’ve been checking Apple’s preorder page and iStockNow every morning at 6 AM —I’m not very patient when it comes to buying new toys (hello Lego WALL-E on my desk), so— hoping to see the iPhone 6s Plus in stock. And I finally managed to get a reservation today.

A two hour train ride, 15 minutes in the Apple Store and a three hour trainride later, my new iPhone sits next to my Mac, and it will probably remain there for the rest of the night.

Why? Because after you unwrap a new iPhone you have two options: start from scratch and say goodbye to your Health Data, or go through the restore-process and retain that data.

banner

If you check Apple’s support page they describe the process in these short steps:

Transfer your iCloud backup to your new device

  1. Turn on your new device. (..)
  2. Swipe left to right on the “Hello” screen. (..)
  3. Tap a Wi-Fi network to join.
  4. Tap Restore from iCloud Backup > Next.
  5. Enter your Apple ID and password.
  6. Choose a backup. (..)
  7. Stay connected and wait for the process to complete. (..)

It just works right? That is.. until you use it in real live in combination with an Apple Watch and don’t get your device on day one.

Transfer your iCloud backup to your new device (Extended Version)

  1. Within a week after Apple released iOS 9 and the new iPhone they already pushed two small bug fixes. Which means your old iPhone probably runs a newer iOS than your new iPhone will.
  2. Optionally: Update all apps on the old device to make sure they work on the new hardware.
  3. Verify that everything has uploaded and synced. Especially Photos and iCloud Drive documents.
  4. Unpair your Apple Watch and wait for the syncing process to finish. Takes about 10-15 minutes.
  5. Make an iCloud Backup, which now contains a recent backup for your Apple Watch. Hope nothing errors out, or goes wrong. Takes about 15 minutes.
  6. Unwrap your new iPhone. Enjoy that new Apple product smell. If you try restoring your backup now, it will fail because the backup you just made is made on a more recent iOS version.
  7. Configure your new iPhone as a new device.
  8. Upgrade to the latest iOS. (Takes, yet again 10-15 minutes)
  9. Wipe your new iPhone. (Feels so wrong).
  10. Finally you can follow Apple’s steps and restore your iCloud backup. Naturally, only confirming that your Apple ID belongs to you via two-factor authentication on another device.
  11. Wait until restore finishes. Takes ages.. unless your running a Caching Server on El Capitan with your iCloud backup locally seeded.
  12. Wait until apps are downloaded, Photos and iCloud are cached.
  13. Enter dozens of passwords and reauthenticate most services. Move from 1Password to Dropbox and back again and hope nothing goes wrong.
  14. Re-pair the Apple Watch again and select its latest backup.
  15. Wait until your Watch restore finishes, which takes… a long long time.
  16. Finally enjoy your new iPhone.
  17. Enter some more passwords in password prompts that didn’t occur upon first boot
  18. Repeat in a year, or earlier if you break your device.

Steps 8 and 9 should be part of the initial wizard. If the iPhone detects its not running the latest OS, just update it. It may frustrate some users, but it makes the process so much easier for less-technical-inclined people.

And the Apple Watch really needs either independent iCloud backups, or an easier way to re-pair it to your new iPhone. How about:

  1. You don’t need to unpair your Apple Watch
  2. After restoring your backup to your new iPhone, show an alert that asks you if you want to move your Watch to the new iPhone.
  3. If yes: show that awesome QR code thingie again and voila, re-paired.

But even though the process is frustrating at times, in the end the process does work, and takes way less time than manually redownloading all your apps and configuring all the little settings.

The man who broke the music business

One Saturday in 1994, Bennie Lydell Glover, a temporary employee at the PolyGram compact-disk manufacturing plant in Kings Mountain, North Carolina, went to a party at the house of a co-worker. He was angling for a permanent position, and the party was a chance to network with his managers. Late in the evening, the host put on music to get people dancing. Glover, a fixture at clubs in Charlotte, an hour away, had never heard any of the songs before, even though many of them were by artists whose work he enjoyed. – Stephen Witt, The New Yorker

The author of this article wrote a book about the download-culture of the nineties, which, if I can judge it based on this article, should be an interesting read.

I grew during that short period where P2P MP3s were the de facto way we discovered music. And although I do appreciate the modern legal convenience of a one-click purchase in iTunes or unlimited streaming a whole lot more, there’s a touch of nostalgia to that time where it would take an entire afternoon to download a song.

How it’s made: Beats

 

One of the great things about the solo headphones is how substantial they feel. A little bit of weight makes the product feel solid, durable, and valuable. One way to do this cheaply is to make some components out of metal in order to add weight. In these headphones, 30% of the weight comes from four tiny metal parts that are there for the sole purpose of adding weight. – Medium

After comparing wireless headphones to replace my Apple EarPods for a while, I ended up buying a pair of red Powerbeats. They’re nice headphones, have good battery life and after using Bluetooth head phones for a while, I can’t image using regular headphones with a cable running from my ears to my jeans. 

Even so, while my PowerBeats work fine, apparently not every product in their line up is that great.

Two Gigabytes

RAM was still a major issue even then. The PS1 had 2MB of RAM, and we had to do crazy things to get the game to fit. We had levels with over 10MB of data in them, and this had to be paged in and out dynamically, without any “hitches”—loading lags where the frame rate would drop below 30 Hz.  – Quora

The original PlayStation was released in 1997. My iPhone in 2015. One has 2GB of RAM, the other a thousand times less. Astonishing. 

Update: apparently the iPhone 6 only has 1GB of RAM. Even so, astonishing. 

Last week Dropbox released a new API endpoint that allows to lazily download files to your Dropbox folder without you needing to wait until the file is uploaded.

We’ve recently introduced a new feature to the Dropbox API: /save_url. This new endpoint lets app developers upload files to Dropbox by just providing a URL, without having to download the file first. – Dropbox Developer Blog

My first thought when I read this was: this is useful on iOS.

An example: I wanted to download Gruber’s Phil Schiller interview to my Dropbox for archiving while browsing on my iPad. Vimeo has a download option on their website, but due to restrictions in iOS this means: download the file in Safari first, wait for it to download completely (5GB!!), and then upload that same file via the Dropbox Extension hoping the thing doesn’t timeout or run out of RAM. In short, doing this is quasi impossible on iOS. and doing this over 3G is just insane, you’ll run out of data before the video has even downloaded completely.

Using the API

To solve this issue and using the new API I came across the following idea: what if I could somehow copy the link of a large file I want to download on iOS and pass it to a service that would trigger a download on Dropbox’s servers without any further user interaction.

This is what I came up with:
I hosted a file on my webserver that uses PHP to CURL a POST string to Dropbox’s servers. I surf to that webpage with a link that contains two parameters: $download_link and $token.

I then created a Workflow action that stores your Dropbox API token as a variable (local on device for security reasons), and captures a link in the clipboard, HTTP encodes it, and stores it as a second variable. The Workflow then generates an url that passes these two strings to my custom webpage, which than submits that data to Dropbox. A few moments later the file appears in your Dropbox folder.

The Webpage

I hosted the following code on my webhost:

  1. Parse http://domain.com?link=(link you want to download)&token=(your Dropbox API token)
  2. Uses the last part of the download link ($end) as a filename.
  3. It tells Dropbox to save the file to /Inbox

<?php
//Parse URL
$download_link = $_GET[‘link’];
$access_token = $_GET[‘token’];

//Set POST variables
$end = end((explode(‘/’, $download_link)));
$url = “https://api.dropbox.com/1/save_url/auto/Inbox/”.$end;
$data = array(‘url’ => $download_link);
$headers = array(‘Authorization: Bearer ‘ . $access_token);

//Open connection
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

//Execute post and close connection.
$result = curl_exec($ch);
curl_close($ch);
?>

Dropbox Token

You can get a temporary Dropbox token by following the steps described on this Dropbox page. It’s a temporary token for personal use only (it maps to your Dropbox), but for this project it serves its purpose.

Testing with a generated access token
If you’d like to test out the Dropbox APIs quickly using your own Dropbox account, you can generate an access token from your newly created app in the App Console by pressing the button that says “Generate” in the OAuth 2 section of your app settings page. Keep in mind that this is only for your own account and you’ll need to use the standard OAuth flow to obtain access tokens for other users.

Screenshot 2015-06-13 14.38.47

Workflow

Since I want to use this script to send very large files from iOS to Dropbox without needing to download the files first, I needed an easy way to generate the correct link and open it in Safari. Which means: Workflow!

The workflow works as follows:

  • First I created a text-field that stores my Dropbox token, and I save it as a variable Token.
  • Then I get the clipboard from my device and HTTP Encode it so I can use it as a parameter value in the link I need to generate.
  • Finally I generate the complete link http://domain.com?link=(link you want to download)&token=(your Dropbox API token).
  • And I open the link in Safari which shows you status message.

IMG_0135 copy

The Result

Combining it all together gives me a workflow like this:

  • Go to a webpage and copy a download link to a large file. (A 950MB WWDC movie in this case)
  • Open Workflow and open the select the script.
  • Safari will immediately open with a {pending} message, this means it’s uploading. You can close Safari and do something else.
  • A few moments later the file shows up in Dropbox. (took around 5 minutes)

Workflow

In conclusion

This workflow will save me a lot of time but there are a few things I would love to improve. Currently this process needs access to a custom webpage to run the Curl command. It would be better if I could just call Curl POST from within Workflow or by triggering another app via an URL- scheme.

Secondly the webpage currently shows the first response you get after doing the POST command, which is a {{pending}} message. It’s a rather ugly result. There are some API calls to ask for the status until you get an {{uploaded}} message, but doing this would make the workflow a lot more complex.

And finally I’d like to expand the workflow so it searches for downloadable links on a webpage, offers them in a list so you can pick one and upload it without needing to manually copy the download link.