Archive for April 6, 2015

Monday, April 6, 2015

Xcode Searching

Daniel Jalkut:

A search scope that includes system frameworks will not actually search or match against any of the frameworks that are linked to by the targets in a workspace. It appears that it will only search frameworks that are explicitly included as file references in the project navigator.

[…]

A related problem is that even if a framework is explicitly linked to, such as Cocoa.framework, only the header files of that specific framework will be searched, not the header files of subsidiary frameworks (e.g. Foundation and AppKit).

I find that searching in Xcode is only worthwhile for my own code. If I’m trying to find an API, Xcode’s documentation search is clunky and doesn’t seem to actually search all the documentation. Its header searching, as Jalkut explains, is very limited. Dash is great for searching the documentation, but there is a lot that is not documented. If Dash can’t find what I want, I have a BBEdit saved search set that looks in all the header files in the current SDK.

Google, Our Patron Saint of the Closed Web

Drew Crawford:

Of course ICANN cannot actually afford to manage the day-to-day operations of thousands of new TLDs. So they’ve opened the process up to anyone who wants to apply. So you fill out an application, you pay $185,000, there’s a convoluted evaluation process where they ask you questions like whether or not you’re a drug dealer and whether you’re technically qualified to run a TLD, and after a lengthy and bureaucratic review process you basically get your own TLD.

It came as no surprise that thousands of applicants came forward in some kind of crazed internet landrush. Many internet companies are placing bets. Amazon made some 76 applications, and Google made even more, with 101.

What people did not seem to expect (whether due to incompetence or malice is up for debate) is what they would be used for.

[…]

Google opens with a “how-is-this-not-a-parody” argument that owning a TLD and not allowing anyone else to use it “lead[s] to diversified consumer choice”[…]

Update (2019-02-18): Drew Crawford:

So google straight up LIED to icann. They said when applying that .dev was internal-use-only, now that they have it they’re selling access

.htaccess Snippets

Phan An (via Hacker News):

What we are doing here is mostly collecting useful snippets from all over the interwebs (for example, a good chunk is from Apache Server Configs) into one place.

The Birth of Microsoft’s New Web Rendering Engine

Charles Morris comments:

As we announced last month, Project Spartan will be the new browser across all Windows 10 devices, from phones to tablets, PCs and beyond.

[…]

First, the Web is built on the principle of multiple independent, yet interoperable implementations of Web standards and we felt it was important to counter movement towards a monoculture on the Web. Second, given the engineering effort required, we found that we could deliver an interoperability focused engine to customers significantly faster if we started from our own engine (especially if unshackled from legacy compatibility concerns), rather than building up a new browser around an open-source engine.

[…]

As detailed in Jacob Rossi’s article for Smashing Magazine, the new engine began as a fork of MSHTML.dll but has since diverged very quickly. By making this split, we were able to keep the major subsystem investments made over the last several years, while allowing us to remove document modes and other legacy IE behaviors from the new engine. On the other hand, our legacy engine (MSHTML.dll) can remain largely unchanged (outside of security and other high priority fixes) to help guarantee legacy compatibility for our enterprise customers. We also built up capabilities to switch between the legacy and new rendering engines seamlessly.

A clean break also necessitates a new user-agent string to ensure that no IE-specific code was being sent. This built upon a long browser history of using whatever tokens are necessary to get the desired content from servers. Although this meant a lower compatibility rate initially, it was also useful to reveal interoperability issues that needed to be fixed!

[…]

However, a new engine was not enough – we also needed to significantly revamp how we find, track and fix issues on the long tail of the Web. To do so, we do daily analysis on trillions of URLs crawled in conjunction with Bing to detect patterns that exist in the head of the Web and the tail of the Web. By fixing these patterns, sites just end up working. This data is augmented by thousands of daily feedback reports from users via the “smiley face” icon.

MustOverride

Nick Lockwood:

MustOverride provides a macro that you can use to ensure that a method of an abstract base class must be overriden by its subclasses.

Apple does not currently provide a way to flag this at compile time, and the standard approach of raising an exception in the base class’s implementation has two disadvantages: 1) it means that the method will only crash when it is called, which might only happen under difficult-to-reproduce conditions, and 2) you cannot provide a base implementation and require that the subclass calls super.

MustOverride uses some runtime magic to scan the class list at load time, and will crash immediately when the app is launched if the method is not implemented, even if it is never called.

Motion Sensing Using the Doppler Effect

Daniel Rapp (via Avi Bryant):

Recently I stumbled upon an interesting paper for implementing motion sensing requiring no special hardware, only a speaker and mic! Unfortunately the paper didn’t include code to test it, so I decided to reproduce it here on the web!

[…]

In order to measure the doppler effect for motion detection on a conventional computer, what you can do is send out a sinusoid at some known (inaudible) frequency, say, 20 kHz. If something is moving in the room, then, after the sinusoid has bounced around on the walls and into the microphone, the sound will shift in frequency. This can be measured by looking at the frequency spectrum in the nearby region of the 20 kHz tone.

Speedy Transfers With IP Over Thunderbolt

Dan Moren:

Right now Thunderbolt remains the fastest port on both my 2011-era iMac and my MacBook Air from 2014—even if it can’t reach its full speed of 10Gbps (or 20Gbps in the case of Thunderbolt 2), it can still transfer a multi-gigabyte file from one machine to the other in a matter of seconds. But using it to transfer files does take a few steps.

While you could use Thunderbolt Target Disk Mode, which essentially lets you boot one of your Macs as an external drive, I generally don’t feel like shutting down my computer just to transfer a file. Fortunately, there’s another option: Thunderbolt can converse via the same Internet Protocol (IP) used by Ethernet. It just takes a little quick configuration.