Archive for November 6, 2016

Sunday, November 6, 2016

Underscore Uses in Swift

Dmitri Pavlutin (via Natasha Murashev):

You can use _ to suppress the argument label every time its indication seems redundant.

[…]

let (_, sub, _, div) contains _ at first and third positions. This indicates that addition and multiplication results are insignificant.

[…]

The flight speed case .flight(let speed, _) omits the information about the altitude using an underscore _. Extracting the altitude in this case is simply not necessary.

[…]

Otherwise you can discard the result using an underscore […] Such way you let know the compiler that you ignore the returned value. And no warning is triggered in this case.

[…]

If you need to skip naming some closure parameters, just mark those with underscores.

[…]

Another common usage of the underscore is to iterate a code block a particular number of times, and ignore the iteration value.

In-app Purchases Are in Need of Reform

Pierre Lebeaupin:

The common wisdom with Apple, especially when it comes to explaining the unusual and apparently limiting ways they introduce features, is that to better serve the user they introduce features that solve the user need in a specific way for each task, instead of providing a generic, unrestricted feature that may not provide an optimal user experience.

[…]

So I have to wonder why Apple is not applying this principle to in-app purchases. Currently, it is a generic feature that does not provide an optimal user experience for a variety of user needs[…]

[…]

This results in warped incentives for app developers, which you probably know about already since Apple has gotten in hot water in the press for those, especially the matter with children buying smurfberries amounting hundreds of dollars or more (which they’ve been able to do while under the timer, initiated by the initial purchase, where the Apple ID password is not prompted for).

Scriptarian

Matt Rajca (tweet):

Scriptarian allows you to easily automate macOS using the Swift programming language, providing a modern alternative to AppleScript.

[…]

Scriptarian uses a multitude of heuristics and transformation passes to ensure AppleScript naming conventions map nicely to Swift. For example, the property name uses ssl gets imported as usesSSL, url string gets imported as urlString, and the class name PXCanvasDocument gets imported as CanvasDocument.

[…]

In addition to full support for the Swift Standard Library, Scriptarian includes ScriptingKit, a scripting framework we built from the ground up with Swift in mind. It lets you communicate with any AppleScript-enabled app and even provides various utility functions for speech synthesis, sound playback, file management, process management, and more.

There’s no trial version, but it’s only $10.

Ed Cormany:

There’s a 100% chance Apple either Sherlocks this or buys it, strips it down, and ships it as Script Editor 3.0.

Hamish Sanderson sees potential:

I love the idea of Scriptarian: a clean, simple out-of-the-box alternative to Script Editor + AppleScript that “Just Works”. The minimal featureset is quite acceptable considering it’s only $10; by comparison, Script Debugger 6 is $100, down from $200, which is still not unreasonable for a “pro” tool.

But has some concerns:

And this one’s the deal-killer: For any software that claims to provide a modern alternative to AppleScript, everything hinges upon how well its application scripting support, a.k.a. Apple event bridge, works compared to AppleScript. And Swiftarian’s AE bridge is rubbish.

[…]

Whether an Apple event bridge has any chance of working right depends 100% on whether or not its authors realize that application scripting is far more closely related to relational databases and SQL than it ever will be to Cocoa and Swift.

Again, I have some sympathy for Swiftarian, since even Apple's own AppleScript alternatives, ScriptingBridge and JavaScript for Automation, are crippled, incompetent garbage, while Apple documentation at best leaves you with no clue about how this stuff works and at worst gives you an understanding of it that is 100% wrong. OTOH, even a cursory study of history would've found that this is hardly a new problem and there are numerous previous attempts, both good and bad, from which to learn: Frontier, AppleScript, Mac::Glue, aetools+gensuitemodule, JavaScriptOSA, aeve, appscript, ScriptingBridge, RubyOSA, and so on.

RupturedHeartTheory:

If the first thing I notice about this app is that it’s more than twice the size than the developer claims that it is, I’m bound to get confused. I can’t see any reason for a developer to claim a thing like this if it’s not the truth.

Then I notice that it’s kinda slow, but hey, it’s a work in progress, so I really don’t mind that. And it’s probably faster if I compile it first… Oh, the second claim about the app “Scriptarian can compile your scripts into native executables” is also not true.

I seriously can’t understand why you would advertise features that isn’t working in the state you are selling it. And apparently it will work in the next update, then please write that it will work, not that it actually works.

I still think that this is a great idea, and worth my $10, but it really needs some tweaks on how the developer is trying to sell it.

Instapaper Premium Is Now Free

Instapaper (via Hacker News):

Before, some of our greatest features were limited to Instapaper Premium subscribers. Now that we’re better resourced, we’re able to offer everyone the best version of Instapaper.

[…]

All users will continue to have an ad-free Instapaper app experience, and we’re eliminating ads on the web entirely.

Brian Donohue:

I understand and appreciate the skepticism, however, the reason we’re making this change is because we want to provide the best experience for our users.

Pinterest receives value from the ongoing operation of Instapaper in the form of continued parsing improvements and aggregate information about links on the web, and that value is enough to justify our relatively small operating costs.

Fakespot for Amazon and Yelp Reviews

Fakespot:

We are a data analytics company specializing in providing an online service for smarter shopping which analyzes product reviews and provides potential buyers with a grade based on the reviews authenticity.

With so many online shopping options, product reviews can be a valuable indication of which companies to trust with your money. User reviews should be an informative tool for providing honest feedback from other buyers - but what about when the reviews themselves cannot be trusted? Recent reports of companies tampering with reviews have led to consumer doubt about their validity, and for good reason. In the last year Amazon filed lawsuits against a number of companies that offered to pay for positive reviews, while stories continually come to light of schemes which offer free or discounted products in return for reviews.

Via Gabe Weatherhead:

Now Fakespot has an iOS app that adds a new sharing extension for URLs.

The extension does little more than open a web view with Fakespot results, but that’s enough. I use it directly from the Amazon app.

Update (2016-11-27): Sarah Perez (via Hacker News):

Amazon is making good on its promise to ban “incentivized” reviews from its website, according to a new analysis of over 32,000 products and around 65 million reviews. The ban was meant to address the growing problem of less trustworthy reviews that had been plaguing the retailer’s site, leading to products with higher ratings than they would otherwise deserve.

[…]

It found that Amazon had deleted over 500,000 reviews, 71 percent of which were incentivized. The average rating for these deleted reviews was 4.75 stars – clearly much higher than the typical average.

[…]

What’s also interesting, Noonan notes, is that Amazon’s product ratings were largely unaffected, despite the mass deletions. The product ratings – that is, when Amazon tells you that a product is “4.5 out of 5 stars” – appear to have already been adjusted to discount the incentivized reviews when calculating the overall rating.