Skip to main content

Posts

Showing posts from October, 2016

Turn and face the strange: Using a C function to merge (or stable) sort in Swift (Swift 3, Xcode 8)

It was suggested that Swift include a stable (or merge) sort function and I hope this becomes the case.  At present, however, we must turn to pure Swift implementations presented by others or turn to the C functions accessible through Swift. (According to the man pagesmergesort: is a stable sort function.)

It should be noted that the mergesort: function has some restrictions that make generic use difficult if not impossible. Not least connected to closures, but at the moment I just want to look at the basics of mergesort:
public func mergesort(_ __base: UnsafeMutableRawPointer!, _ __nel: Int, _ __width: Int, _ __compar: @escaping @convention(c) (UnsafeRawPointer?, UnsafeRawPointer?) -> Int32) -> Int32 This is quite an unwieldy looking function but let's break it down.
base: this is a pointer to a mutable array, which can be implemented using the in-out notation of & so &arrayName is what you'll see herenel: is the array length, so arrayName.count goes herewidth…

Solving OneDrive Syncing Problems on Mac

In terms of value for money I give OneDrive 10/10 but it can face a few syncing issues in day-to-day use. Syncing problems can be caused by path length:
"The entire path, including the file name, must contain fewer than 255 characters. Shorten the name of your file or the name of subfolders in OneDrive, or select a subfolder that's closer to the top-level folder." They can also be caused by use of certain symbols in file names, and by individual files over 1 GB in size. If any of these issues occur you should see a warning symbol appear on the OneDrive icon in your menu bar and there should be an option appear when you click on the icon to inspect and correct these errors.

Aside from these esoteric errors, it sometimes occurs that OneDrive, most often at the least convenient time, simply cannot progress with syncing. This problem I often find arising if I've had a desktop Mac syncing with the service for a number of days and then I attempt to sync a MacBook. Here…