humancode.us

The Amazing iPhone Home Button

October 2, 2014
Updated October 16, 2016

How many things can the iPhone Home Button do? Let’s see…

  1. Go to home screen (press while unlocked)
  2. Wake the phone from sleep (press while locked)
  3. Launch/cancel fast app switching (double press while unlocked)
  4. Launch Siri (press and hold)
  5. Unlock the phone with Touch ID (touch)
  6. Make a purchase on iTunes Store (touch)
  7. Authorize an app to access a Keychain item (touch)
  8. Enable/disable accessibility options (triple press)
  9. Reachability (double touch)
  10. Apple Pay (double press or touch and hold)
  11. Take a screenshot (press and hold, press sleep/wake button)
  12. Take a stackshot sysdiagnose (press and hold, press a volume button)
  13. Enter DFU mode (no longer works with iPhone 7)
  14. Dismiss Notification Center or Control Center (press while NC or CC is displayed)
  15. Dismiss lock screen camera (press)
  16. Go to the home screen from lock screen (press) (iOS 10)
  17. Dismiss a pulled-down notification (press) (iOS 10)
  18. Make a purchase in Safari (touch) (iOS 10)

Removed functionality:

  1. ✗ Show/hide media playback controls over lock screen (press while locked) (removed in iOS 10)

Credit goes to Guy English for inspiring this.

Update: Found a 15th use.

Update: Updated for iOS 10.

Secure your iPhone with a Long Numeric Passcode

September 28, 2014

A great way to secure your iPhone is to use a long passcode. But setting a typical long passcode that has letters and numbers in it results in an unlock screen that looks like this:

Lock screen with alphanumeric keyboard

I find the alphanumeric keys too small to hit accurately, especially if I’m one-handing the phone.

But did you know you can set a long numeric passcode, and your lock screen will look like this?

Lock screen with long numeric keyboard

So much better! You get the benefits of a long passcode, but you retain the convenience of a large number pad for one-handed use. As a bonus, people can’t tell how long your passcode is, which makes it even harder to guess.

Read more…

You know what’s best?

September 20, 2014

You know what’s best?

Copyright ©2014 Dave Rahardja

Writing Thread-Safe Classes with GCD

September 13, 2014

GCD Logo

This is the fifth post in a series about Grand Central Dispatch.

So far, we’ve learned that a multi-threaded program means that access to our data structures must be protected by some kind of synchronization mechanism. We used GCD’s serial queues to gate access to our data structures.

We also discussed using concurrent queues to implement a Readers-Writer lock. To keep this post simple, we’ll stick to using serial queues.

One serious issue remains: whoever uses your data structures have to remember to use dispatch_sync(), otherwise you get errors. This is obviously a problem, especially when your code is used by someone not familiar with your arrangement (for instance, when your code is part of a framework).

Wouldn’t it be great if we could encapsulate the synchronization behavior into our data structure, so that its users don’t have to worry about asynchronous behavior?

Encapsulation, of course, is what classes are really good for. Instead of requiring synchronization code in our user’s codebase, we should make thread-safe classes.

Read more…

RIAA Music Revenue Share Over Time

August 24, 2014

I updated my old chart to include 2012-2013 data:

Figure: RIAA revenue share over time 1980-2013