Adding Swift to an Obj-C Project

You have an Objective-C Xcode project, and you want to add Swift code to it for the first time.

  • What do you need to do so it doesn't segfault when you launch?
  • What do you need to do so your Objective-C code can call your Swift code, and vice versa?

These notes apply to Xcode 8, and they assume an Xcode project named Project Foo. Names of build settings, etc., may change from one Xcode release to the next.

Read more…

Not Just Clogged Pipes

Coronary Artery Disease as Clogged Pipes


Although the image of coronary arteries as kitchen pipes clogged with fat is simple, familiar, and evocative, it is also wrong.

most cardiac events occur at lesions that appeared mild on previous angiography

These plaques contain a lipid-rich core covered by a thin fibromatous cap. Inflammatory cells (eg, macrophages and mast cells) within the plaque may become activated by microbes, autoantigens, or inflammatory molecules (activated plaque model). The activated cells secrete cytokines and proteases that weaken the fibrous cap, causing it to erode or rupture.

Before rupture, these plaques often do not limit flow and may be invisible to angiography and stress tests.

Anecdote: My dad had ​a stress test and angiography in early 2003. It showed him to have low risk for heart attack. Less than 8 months later Dad had a heart attack, with a subsequent quintuple bypass and a stent.

in the setting of myocardial infarction, the model of an obstructed pipe is accurate, and interventions aimed at eliminating the thrombus, either thrombolytics or angioplasty, can be lifesaving. But for patients with stable disease, local interventions can only relieve symptoms; they cannot prevent future myocardial infarctions.

Although atheromatous plaques contain lipids, they are not composed of fat directly from the diet. Low-density lipoprotein is produced primarily in the liver...

growth within the vessel walls is accommodated by outward enlargement of the vessel. In that case, large plaques may not encroach on the lumen and are therefore hidden from angiography.

High-density lipoprotein removes low-density lipoprotein from peripheral tissues through reverse cholesterol transport to the liver and may have antiinflammatory properties

Although saturated fat increases low-density lipoprotein cholesterol, it also increases high-density lipoprotein, so the net effect on cardiac risk is neutral.

More recent observational studies do not support the use of low-fat diets. ​ low-fat diets had adverse effects on high-density lipoprotein cholesterol. But for patients with elevated low-density lipoprotein, they have tightened restrictions on saturated fats and now recommend that consumption not exceed 7% of total calories.

in many products, fat is simply replaced by sugar. More recently, the AHA recommended that people limit their intake of sugar, which now appears to contribute to obesity, hypertension, and subsequently coronary heart disease.

Useful Python Modules

My top 5 ‘new’ Python modules of 2015 « Robin's Blog


This module is so simple but so useful – it makes it stupidly easy to display progress bars for loops in your code.


[...] to use it within the Jupyter Notebook just make sure that the map object (map_1 in the example above) is by itself on the final line in a cell, and the notebook will work its magic and display it inline…perfect!

​ Many thanks to Robin Wilson for the summaries. It will be fun to try folium, especially.

iosnoop no longer works on OS X 10.11 El Capitan

[Note: This all started because some process – I'm still not sure which – is chewing on my hard drive for minutes at a time. This behavior started when I updated to OS X 10.11.1. Given the duration, it seems unlikely to be a simple re-indexing by mdsworkers.]

I recently tried using iosnoop to find out which processes were chewing on my Fusion drive with enough vigor to make the hard drive audible. Instead of a running log of events, I got this:

That's not right.

I filed a radar with Apple. (TODO: Create a corresponding Open Radar entry.) The response was unsatisfying, as it effectively means iosnoop is no longer usable:

This issue behaves as intended based on the following: Some significant portions of dtrace are not compatible with System Integrity Protection. Unfortunately, the iosnoop script contains probes that are not compatible, and thus cannot run.

The iosnoop(1m) man page says nothing about this. At the least this is a documentation failure on Apple's part.


Twitter turned up a workaround/solution:

@sevanjaniyan To reenable dtrace reboot to recovery, open terminal. csrutil disable; csrutil enable --without dtrace

Unfortunately this isn't working on my late 2009 iMac. As I understand it the problem is that, when I installed an SSD and configured a Fusion Drive last year, I didn't put the recovery HD outside the fusion drive. So I have some storage reconfiguration to do.


From 2 March 2015:

Exclusive: Obama sharply criticizes China's plans for new technology rules | Reuters:

In an interview with Reuters, Obama said he was concerned about Beijing's plans for a far-reaching counterterrorism law that would require technology firms to hand over encryption keys, the passcodes that help protect data, and install security "backdoors" in their systems to give Chinese authorities surveillance access.

Obama said the rules could also backfire on China.

"Those kinds of restrictive practices I think would ironically hurt the Chinese economy over the long term because I don’t think there is any U.S. or European firm, any international firm, that could credibly get away with that wholesale turning over of data, personal data, over to a government," he said.

From 24 February 2015, an exchange between Yahoo's Chief Information Security Officer and NSA Director Mike Rogers:

Yahoo's security boss faces down NSA director over crypto ban - Boing Boing:

AS: [...] So, if we’re going to build defects/backdoors or golden master keys for the US government, do you believe we should do so — we have about 1.3 billion users around the world — should we do for the Chinese government, the Russian government, the Saudi Arabian government, the Israeli government, the French government? Which of those countries should we give backdoors to?


MR: I think we can work our way through this.

AS: I’m sure the Chinese and Russians are going to have the same opinion.

MR: I said I think we can work through this.

AS: Okay, nice to meet you. Thanks.

Connecting to a headless Raspberry Pi w. VNC

Rather than dedicate a keyboard, mouse and display to my Raspberry Pi I'd prefer to access it over the network. ssh access is usually good enough, but sometimes I'd also like to use its graphical desktop, via VNC.

This post at My Raspberry Pi Experience provides all the required info in one place. Many thanks!

To recap the article: with the Pi connected to my network, and with its IP address reserved on the router, log in via ssh. Then install tightvncserver:

$ sudo apt-get install tightvncserver

Create a script, somewhere on the path, to start the VNC server manually:

# start_vnc_server
# Starts a VNC server listening on port 1, with a 16-bit pixel depth.
vncserver :1 -geometry 1024x768 -depth 16

Run the script (natch).

When you're done, either unplug the Pi or shut down the server. If you're as forgetful as I am, you'll need a script for that, too:

# stop_vnc_server
vncserver -kill :1

I use Jolly's Fast VNC as my vnc client. The Pi's server doesn't seem to advertise its presence via ZeroConf/Bonjour, but it's pretty easy to configure:

Pasted Image 3 8 14 12 23 PM 5

And there it is:

Pasted Image 3 8 14 12 42 PM 2

Coincidentally, it's curious that all of my iOS devices show up in the server list. Someday when time is free I should investigate how to view them via VNC...