Archive for April 7, 2015

Tuesday, April 7, 2015

Swift, Accelerate, and Generics

Chris Liscio:

After spending a while in a Playground, I managed to get a generic vDSP multiply routine written that could work on both Slice<Float> and [Float].

For no good reason at all, I decided that I should brain-dump this approach into my SMUGMath-Swift project before I lose the playground to the sands of time.

The “magic” is in the way that I was able to lean on the withUnsafeBufferPointer method that exists for both collection types, and then also specify some additional type clauses to ensure we’re working with Float vs Double floating point types.

1Password 5.3 for Mac

Chris De Jabet:

We recently introduced our TOTP feature — Time-Based One-Time Passwords — in iOS and Windows, and now we’re bringing it to the Mac. TOTPs are increasingly used as an extra layer of security by companies from Dropbox to Tumblr, so now you’re ready for them with 1Password for Mac.

[…]

We also implanted a plethora of custom field options, some great 1Password mini nips and tucks, and Secure Notes can now have custom fields and sections.

Infinite NSScrollView

Milen Dzhumerov:

When we refer to infinity, what we mean is that in practical terms the user will never hit an edge. One way to achieve that would be to make the scrollable area as large as possible (max values of CGFloat). Unfortunately, such very large values end up producing jerky scrolling movements.

Another approach is to never let the user hit the edge of the scroll view. We can observe the position of the scroll area and if it gets too close to a particular edge, we can move it back to the center while also making any changes to ensure the onscreen contents do not change. This will create the illusion of an infinite scroll view – in practice, the user can just never hit the edge.

Car UI

Dr. Drang:

When the wiper is in intermittent mode, it moves at the same speed as it does in low-speed mode. The difference is that it pauses between wipes. How long it pauses is what’s controlled by the collar position. To me, twisting the collar to move the marker down should make the pause between wipes shorter. This would be consistent with the way the stalk itself is moved: down to handle heavier rain. This is also consistent with the quasi-bar chart graphic, which I interpret as a graph of the pause, or interval, between wipes.

You will not be surprised to learn that the collar works exactly the opposite of how I think it should work. The interval between wipes increases as you turn the collar to move the marker down; the bottom position is for the lightest sprinkle. For the stalk, down equals heavier rain; but for the collar, down equals lighter rain.

The chart is apparently meant to represent the frequency of wiping, not the interval between wipes, despite the INT label on the marker. Yes, I know they mean INT to be interpreted as intermittent, not interval, but intermittent is not a quantity that can be graphed. Interval is. Which is why every time I look at that control, my mind says interval and I want to twist it the wrong way.

This has always bothered me with my Toyota.