Tag Archives: apple

Send in the clones!

So here’s the thing that drives me crazy.

Having had a hard disk die on me a few years ago, I’m a little paranoid about backups. I have three:

  1. Time Machine, over WiFi to a Synology NAS
  2. Backblaze, “cloud” backup over the internet
  3. SuperDuper clone to an infrequently connected USB hard disk

Time Machine and Backblaze run all the time, nice, seamless and hopefully pretty complete. I do the SuperDuper clone occasionally and every few months I try to reboot and check that the clone actually works.

And that’s where the problems start.

If I forget to turn off WiFi — which I almost always do — then when the clone starts up, it immediately connects to WiFi and starts to back up to Time Machine. I panic and stop it as soon as I realise.

But then I boot back to my main disk and… Time Machine decides it needs to do a full backup. Which. Takes. Forever. (Backblaze is also doing a huge backup, presumably for the same reason.)

What’s the answer to this? Is there a way to switch off WiFi on the clone automatically? Only start when the boot disk has a specific name? I don’t know! It’s hard to search for because I can’t think what the answer might be.

iOS 11

As I’ve done for the last few years, here are a few quick thoughts about today’s new iOS release, version 11.

I’ve been using the iPad version since the beginning of August and the iPhone version for only a couple of week but I think I have reasonable picture of what you’re going to see. 

Good

  • Multi-app support on the iPad. Wow! It’s quite different. You might need to give it a while before you get used to it. I also found that I needed to rearrange my dock so that apps I use to multitask are quickly available
  • “Swipe up on the iPad keyboard to get symbol characters.” Such a time saver
  • The voice synthesis of Siri is way better. But I agree with Gruber, if I could have dedicated engineering resources to Siri that wouldn’t have been where I would put them
  • iCloud sync for Photos. No more training each device to receognise each person!
  • Lots of nice, minor changes. The “Now playing” lock screen widget, the “play” button at the top of playlists/albums in the music app
  • Control Center is improved (but see first item in the “ugly” section below)

Bad

  • I’m guessing this has something to do with the iPhone X, but the one 3D Touch gesture I used all the time was the hard-press on the left side of the screen to trigger the app switcher. That’s gone in iOS 11. This is going to take a lot of getting used to
  • It won’t work on older devices. I get the “why” but it always sucks when they get left behind

Ugly

  • Why did the WiFi button is Control Center change to be “disconnect” rather than “switch off”?!
  • Not sure about some of the animations, especially on iPhone. 

iPhone 6s

I wasn’t sure that I wanted a “big” iPhone as I was perfectly happy with the 4” form-factor. But if I was going to get a new phone and the new ones are bigger, I reasoned, I may as well go really big and go for a 6s Plus. On paper it made perfect sense.

Then I played with one in an Apple Store and I laughed. In practice it was comically big. I really didn’t want a phone I could only realistically use with two hands.

In many ways, my main complaint with the iPhone 6S is the same. It’s a lot bigger and I can only just use it one handed. Even a couple of months in, I think I still want a 4” phone.

Which is not to say that it’s not good. The camera is excellent. It’s much faster than my old 5. It’s my first device with Touch ID, and it’s great. Going back to punching in my PIN code every time would get annoying very quickly.

At launch I thought that 3D Touch would be a game changer and that Live Photos were a gimmick. I may have had that the wrong way around. The problem with 3D touch is that it’s not available everywhere, so you quickly forget to use it. This is not entirely Apples fault. Even my own apps don’t fully support 3D Touch yet. Live Photos, on the other hand, “just work” and they do capture a moment in a way that a simple photo doesn’t. They’re good for those serendipitous moments that you wouldn’t try to record a video of.

Overall I like it, but with more reservations than I’ve had with any of my previous iPhones after a couple of months with it.

Taking Stock

Share price movements are kind-of-sort-of-rational but not always intuitive. For example, when Apple has a big keynote and announces some significant product, everyone expresses surprise that the share price goes down straight afterwards. Even many smart people get this wrong (“It isn’t based on logic and reason” – The Talk Show episode 53). I hope to explain why the price dropping actually does make sense in this post.

In doing so I’ll likely make some errors. Some of those will be deliberate simplifications. In other cases I’ll probably just be wrong. But either way, I think the gist, if not the details, should give you a good idea of what’s going on.

I’m going to keep things simple by only talking about the share price. There are other factors (such as dividends) that might reasonably be considered but I think we can get a decent enough explanation without complicating things.

If we only worry about the share price, the obvious way that you make money is by selling the share at a higher price than you bought it for. So, even when you first buy a share you’re making a punt on the future of the company.

For a keynote, where no actual financial information is shared, it’s a pretty simple case of “buy on the rumour, sell on the fact.” Traders heard some of the same rumours about the shiny new iUnicorn that you did. They speculated that people would like and buy this new product and bought some shares. By the time the product is announced, the theory is that the share price already factors in all the up side (profit) of it, so they sell.

It doesn’t matter whether the product is good or bad, better or worse than was predicted, the share price will likely still go down. The next bit of good news that will likely pump up the stock will be an earnings announcement, good launch weekend sales figures, etc., but no more good can come out of this announcement. So sell.

The process for an earnings call are similar though possibly are a little more technical. In addition to any sales figures, traders are also looking at things like the “earnings per share” (EPS). However, in common with a product announcement, at the point of the call, traders would generally consider all the good news to already be factored into the price. Even if the company beats expectations, there’s no more good news to be had so they may as well sell.

For the sake of completeness, let’s also consider a couple of other circumstances that can trigger significant variation in the price. These are typically financial in nature and if they happen at the same time as an earnings call or keynote can exacerbate any already significance price changes.

The most common are options, a derivative financial product that gives the owner the option to purchase a share at a price set in advance, pushing the real share price towards the option price. (A large number of people are going to have to buy the same stock at a set price, so that becomes the price.)

Something else that happens fairly frequently is a share price dropping by a certain amount causing algo trading systems to kick in a sell too. Combine this with the sell off after an earnings call or product announcement and the effects can be way out of proportion with what was announced.

The last one I’m going to mention is when a company is added to a well traded index, such as the S&P 500. This happens because many investors looking for relatively low risk (such as pensions) buy index funds, so as soon as you’re added to the index your shares suddenly become a lot more popular. (Sadly I worked for a company and had shares in it when the opposite happened.)

The short story here is that, unless you’re a professional investor, you probably shouldn’t buy shares to make a quick buck. Buy Apple stock because you like the company and expect to hold onto it for at least a few months. Don’t let the day-to-day peaks and troughs worry you.

Java and Yosemite

"To view this web content, you need to install the Java Runtime Environment."
“To view this web content, you need to install the Java Runtime Environment.”

Ever since upgrading from OS X 10.9 to Yosemite (10.10) I’ve been getting the above error message periodically. As far as I know I have no software that needs Java to run.

When I asked on Twitter, the most common suggestion was that it was the Adobe updater. But I don’t have PhotoShop or anything else likely installed.

I checked the system logs, but, again, nothing.

The final obvious — for a fairly broad definition of “obvious” — was in System Preferences. If you look in the “Users” pane, you can find a list of “Login items,” programs that are started when the computer boots. (I figured this wasn’t likely since the alert pops up at all time but it was worth checking.)

think I found the solution but I found some interesting (if you’re geeky) new commands that I thought I’d talk about before I document the actual solution.

So the underlying system that the Mac uses to start programs periodically is called ‘launchd’ (or “launch daemon”). It’s kind of an amalgam of init and cron and a bunch of other standard Unix processes, a concept that is controversial in some circles. The interface, I found, isn’t terribly intuitive.

In addition to the long-running process, there’s a configuration program called ‘launchctl.’ The man page runs to several pages. ‘launchctl help’ is only slightly shorter.

I find the ‘list’ subcommand in the “legacy” section and give it a try:

$ launchctl list | grep -i java
- 0 com.apple.java.updateSharing
98767 0 com.apple.java.InstallOnDemandAgent
$

The columns are Process, Status and Label. So we can see that Apple’s Install On Demand Agent is running but not what triggered it.

There’s also a sub-command called ‘procinfo’. It’s not even “legacy” so it must be good… I certainly can’t complain about the volume of information, though I couldn’t claim to understand a good chunk of it.

Ah, but then I see ‘blame’ which the help tells me ‘Prints the reason a service is running.’ Ooh, yes please!

$ launchctl blame 98767
Usage: launchctl blame <service-target>
$

Er, so what’s a service-target?

Anyway, long story short, I find that the text in the man page isn’t entirely clear and that I need to do this:

$ launchctl blame pid/98767/com.apple.java.InstallOnDemandAgent
Not privileged to signal service.
$

So, I don’t know. (If anyone could give me a sample command I’d be grateful!)

But, after all this messing around I did find something. The configuration for ‘launchd’ is scattered around the filesystem in directories like ‘~/Library/LaunchAgents’. I grep’d in that directory for “java” and found a single reference to it in an application that I installed ages ago and never used. The file is called “com.facebook.videochat.stephend.plist”. I deleted it and the other binaries related to it and then restarted.

Clean so far…

Swift Types

If you look at the Swift Language guide, you get the distinct impression that the type system is sleek and modern. However the more you dig into it the more eccentricities you find.

The one I’m going to look at today makes sense only if you look at the problem domain from a slightly skewed perspective. I’ve been trying to think whether this is a sensible, pragmatic way of designing a language or a mistake. Judge for yourself.

So, the feature. Let’s define a dictionary:

var test1 = [ "Foo" : "Bar" ]

Check the type and we find that it’s of type Dictionary<String,String>. The generics and type inference are doing exactly what you’d image.

test1["Test"] = "Works"

So basically it’s all good.

So, what type is this expression?

var test2 = [:]

And why does this not work?

test2["Test"] = "Doesn't work"

Let’s take a step back. What’s the problem? Well, [:] is an empty dictionary but give us no clue what the type is. Remember, Swift dictionaries and arrays use generics, so the compiler only allows objects of a particular type to be added.

A good guess for the type would be Dictionary<AnyObject,AnyObject>. But a little fishing around tells you that’s not the case because AnyObject is neither “Hashable” or “Equatable” and keys need to be both.

The answer? test2 is an NSDictionary. That is, in this one circumstance, Swift extends outside its native dictionary type and decides to use a class found in Foundation.

Once you know that, it is clear that the second line should be:

test2.setValue("Does work now", forKey:"Test")

Maybe if you’re familiar with the guts of both Objective C and Swift this behaviour makes sense, but a language built-in returning a completely different type just because it can’t figure out the type feels broken to me.

In the end I think I’ve convinced myself that, while it might be convenient to allow this syntax, it’s a bad idea to saddle the language with these semantics so early on. In a few years when no one uses Objective C or when Swift is no longer fully tied to Cocoa, will this make sense?

I would prefer to see it being a compiler error with the correct approach being explicit with the type:

var test2:Dictionary<String,String> = [:]

Thoughts?