Joho the BlogJoho the Blog - Let's just see what happens

November 25, 2018

Using the Perma.cc API to check links

My new book (Everyday Chaos, HBR Press, May 2019) has a few hundred footnotes with links to online sources. Because Web sites change and links rot, I decided to link to Perma.cc‘s pages instead . Perma.cc is a product of the Harvard Library Innovation Lab, which I used to co-direct with Kim Dulin, but Perma is a Jonathan Zittrain project from after I left.

When you give Perma.cc a link to a page on the Web, it comes back with a link to a page on the Perma.cc site. That page has an archive copy of the original page exactly as it was when you supplied the link. It also makes a screen capture of that original page. And of course it includes a link to the original. It also promises to maintain the Perma.cc copy and screen capture in perpetuity — a promise backed by the Harvard Law Library and dozens of other libraries. So, when you give a reader a Perma link, they are taken to the Perma.cc page where they’ll always find the archived copy and the screen capture, no matter what happens to the original site. Also, the service is free for everyone, for real. Plus, the site doesn’t require users to supply any information about themselves. Also, there are no ads.

So that’s why my book’s references are to Perma.cc.

But, over the course of the six years I spent writing this book, my references suffered some link rot on my side. Before I got around to creating the Perma links, I managed to make all the obvious errors and some not so obvious. As a result, now that I’m at the copyediting stage, I wanted to check all the Perma links.

I had already compiled a bibliography as a spreadsheet. (The book will point to the Perma.cc page for that spreadsheet.) So, I selected the Title and Perma Link columns, copied the content, and stuck it into a text document. Each line contains the page’s headline and then the Perma link.

Perma.cc has an API that made it simple to write a script that looks up each Perma link and prints out the title it’s recorded next to the title of the page that I intend to be linked. If there’s a problem with Perma link, such as a double “https://https://” (a mistake I managed to introduce about a dozen times), or if the Perma link is private and not accessible to the public, it notes the problem. The human brain is good at scanning this sort of info, looking for inconsistencies.

Here’s the script. I used PHP because I happen to know it better than a less embarrassing choice such as Python and because I have no shame.

1

<?php

 

2

// This is a basic program for checking a list of page titles and perma.cc links

3

// It’s done badly because I am a terrible hobbyist programmer.

4

// I offer it under whatever open source license is most permissive. I’m really not

5

// going to care about anything you do with it. Except please note I’m a

6

// terrible hobbyist programmer who makes no claims about how well this works.

7

//

8

// David Weinberger

9

// [email protected]

10

// Nov. 23, 2018

 

11

// Perma.cc API documentation is here: https://perma.cc/docs/developer

 

12

// This program assumes there’s a file with the page title and one perma link per line.

13

// E.g. The Rand Corporation: The Think Tank That Controls America https://perma.cc/B5LR-88CF

 

14

// Read that text file into an array

15

$lines = file(‘links-and-titles.txt’);

 

 

16

for ($i = 0; $i < count($lines); $i++){

17

$line = $lines[$i];

18

// divide into title and permalink

19

$p1 = strpos($line, “https”); // find the beginning of the perma link

20

$fullperma = substr($line, $p1); // get the full perma link

21

$origtitle = substr($line, 0,$p1); // get the title

22

$origtitle = rtrim($origtitle); // trim the spaces from the end of the title

 

23

// get the distinctive part of the perma link: the stuff after https://perma.cc/

24

$permacode = strrchr($fullperma,”/”); // find the last forward slash

25

$permacode = substr($permacode,1,strlen($permacode)); // get what’s after that slash

26

$permacode = rtrim($permacode); // trim any spaces from the end

 

27

// create the url that will fetch this perma link

28

$apiurl = “https://api.perma.cc/v1/public/archives/” . $permacode . “/”;

 

29

// fetch the data about this perma link

30

$onelink = file_get_contents($apiurl);

31

// echo $onelink; // this would print the full json

32

// decode the json

33

$j = json_decode($onelink, true);

34

// Did you get any json, or just null?

35

if ($j == null){

36

// hmm. This might be a private perma link. Or some other error

37

echo “<p>– $permacode failed. Private? $permaccode</p>”;

38

}

39

// otherwise, you got something, so write some of the data into the page

40

else {

41

echo “<b>” . $j[“guid”] . ‘</b><blockquote>’ . $j[“title”] . ‘<br>’ . $origtitle . “<br>” . $j[“url”] . “</blockquote>”;

42

}

43

}

 

 

44

// finish by noting how many files have been read

45

echo “<h2>Read ” . count($lines) . “</h2>”;

 

46

?>

Run this script in a browser and it will create a page with the results. (The script is available at GitHub.)

Thanks, Perma.cc!



By the way, and mainly because I keep losing track of this info, the table of code was created by a little service cleverly called Convert JS to Table.

2 Comments »

October 12, 2018

How browsers learned to support your system's favorite font

Operating systems play favorites when it comes to fonts: they pick one as their default. And the OS’s don’t agree with one another:

But now when you’re designing a page you can tell CSS to use the system font of whatever operating system the browser is running on. This is thanks to Craig Hockenberry who proposed the idea in an article three years ago. Apple picked up on it, and now it’s worked it’s way into the standard CSS font module and is supported by Chrome and Safari; Windows and Mozilla are lagging. Here’s Craig’s write-up of the process.

Here’s a quick test of whether it’s working in the browser you’re reading this post with:

This sentence should be in this blog’s designated font: Georgia. Or maybe one of its serif-y fall-backs.

This one should be in your operating system’s standard font, at least if you’re using Chrome or Safari at the moment.

We now return you to this blog’s regular font, already in progress.

Be the first to comment »

September 20, 2018

Coming to belief

I’ve written before about the need to teach The Kids (also: all of us) not only how to think critically so we can see what we should not believe, but also how to come to belief. That piece, which I now cannot locate, was prompted by danah boyd’s excellent post on the problem with media literacy. Robert Berkman, Outreach, Business Librarian at the University of Rochester and Editor of The Information Advisor’s Guide to Internet Research, asked me how one can go about teaching people how to come to belief. Here’s an edited version of my reply:

I’m afraid I don’t have a good answer. I actually haven’t thought much about how to teach people how to come to belief, beyond arguing for doing this as a social process (the ol’ “knowledge is a network” argument :) I have a pretty good sense of how *not* to do it: the way philosophy teachers relentlessly show how every proposed position can be torn down.

I wonder what we’d learn by taking a literature course as a model — not one that is concerned primarily with critical method, but one that is trying to teach students how to appreciate literature. Or art. The teacher tries to get the students to engage with one another to find what’s worthwhile in a work. Formally, you implicitly teach the value of consistency, elegance of explanation, internal coherence, how well a work clarifies one’s own experience, etc. Those are useful touchstones for coming to belief.

I wouldn’t want to leave students feeling that it’s up to them to come up with an understanding on their own. I’d want them to value the history of interpretation, bringing their critical skills to it. The last thing we need is to make people feel yet more unmoored.

I’m also fond of the orthodox Jewish way of coming to belief, as I, as a non-observant Jew, understand it. You have an unchanging and inerrant text that means nothing until humans interpret it. To interpret it means to be conversant with the scholarly opinions of the great Rabbis, who disagree with one another, often diametrically. Formulating a belief in this context means bringing contemporary intelligence to a question while finding support in the old Rabbis…and always always talking respectfully about those other old Rabbis who disagree with your interpretation. No interpretations are final. Learned contradiction is embraced.

That process has the elements I personally like (being moored to a tradition, respecting those with whom one disagrees, acceptance of the finitude of beliefs, acceptance that they result from a social process), but it’s not going to be very practical outside of Jewish communities if only because it rests on the acceptance of a sacred document, even though it’s one that literally cannot be taken literally; it always requires interpretation.

My point: We do have traditions that aim at enabling us to come to belief. Science is one of them. But there are others. We should learn from them.

TL;DR: I dunno.

2 Comments »

September 14, 2018

Five types of AI fairness

Google PAIR (People + AI Research) has just posted my attempt to explain what fairness looks like when it’s operationalized for a machine learning system. It’s pegged around five “fairness buttons” on the new Google What-If tool, a resource for developers who want to try to figure out what factors (“features” in machine learning talk) are affecting an outcome.

Note that there are far more than five ways to operationalize fairness. The point of the article is that once we are forced to decide exactly what we’re going to count as fair — exactly enough that a machine learning system can implement it — we realize just how freaking complex fairness is. OMG. I broke my brain trying to figure out how to explain some of those ideas, and it took several Google developers (especially James Wexler) and a fine mist of vegetarian broth to restore it even incompletely. Even so, my explanations are less clear than I (or you, I’m sure) would like. But at least there’s no math in them :)

I’ll write more about this at some point, but for me the big take-away is that fairness has had value as a moral concept so far because it is vague enough to allow our intuition to guide us. Machine learning is going to force us to get very specific about it. But we are not yet adept enough at it — e.g., we don’t have a vocabulary for talking about the various varieties — plus we don’t agree about them enough to be able to navigate the shoals. It’s going to be a big mess, but something we have to work through. When we do, we’ll be better at being fair.

Now, about the fact that I am a writer-in-residence at Google. Well, yes I am, and have been for about 6 weeks. It’s a 6 month part-time experiment. My role is to try to explain some of machine learning to people who, like me, lack the technical competence to actually understand it. I’m also supposed to be reflecting in public on what the implications of machine learning might be on our ideas. I am expected to be an independent voice, an outsider on the inside.

So far, it’s been an amazing experience. I’m attached to PAIR, which has developers working on very interesting projects. They are, of course, super-smart, but they have not yet tired of me asking dumb questions that do not seem to be getting smarter over time. So, selfishly, it’s been great for me. And isn’t that all that really matters, hmmm?

Comments Off on Five types of AI fairness

August 4, 2018

Unlocking picture frames in Keynote 8

In 2015, I posted about a way to unlock the picture frames that for some reason ship with Keynote but are not accessible within Keynote. They’re there but they don’t show up on the pull down, so you can’t use them.

In 2018, with Keynote at version 8 + change, the same technique works. With the same warnings. So, if you want to give yourself considerably more than the 14 frames that the menu shows you, go here, follow the instructions carefully, and most important: do not blame me. (The replacement file I link to still seems to work.)

1 Comment »

July 31, 2018

[2b2k] Errata: Wrong about Wycliffe

I received this about Too Big to Know from Isaiah Hoogendyk, Biblical Data Engineer at Faithlife Corporation:

In chapter 9, “Building the New Infrastructure of Knowledge,” (sorry, don’t have a page number: read this in the Kindle app) you state:

“There was a time when we thought we were doing the common folk a favor by keeping the important knowledge out of their reach. That’s why the Pope called John Wycliffe a heretic in the fourteenth century for creating the first English-language translation of the Christian Bible.”

This is quite false, actually. There was in fact nothing heretical about translating the Scriptures into the vernacular; instead, Wycliffe was condemned for a multitude of heresies regarding rejection of Catholic belief on the Sacraments and the priesthood, among other things. Some of these beliefs were interpolated into the translation of the Scriptures attributed to him (which weren’t even entirely translated by him), but it was mostly his other writings that were censured by the Pope. You can read more about that here: https://plato.stanford.edu/archives/win2011/entries/wyclif/.

Thanks, Isaiah.

Comments Off on [2b2k] Errata: Wrong about Wycliffe

July 20, 2018

Thomas Edison’s endorsement of MIT

Someone alert MIT’s recruitment office: Thomas Alva Edison was a fan.

Here’s a 1916 letter from a father asking Edison’s advice about where to send his son who is “not a very studious boy” but is “mechanically inclined”:

Letter to Edison with his recommendation of MIT

Edison’s handwritten response says, as best I can make out:

My advice is to send him to the Mass Institute of Technology – Boston of all the young men out of college which I have employed those from the Mass Tech were far superior to all others.”

Source: “Letter from Harry C Shaaber to Thomas Alva Edison, October 30th, 1916,” Edison Papers Digital Edition, accessed July 20, 2018, http://edison.rutgers.edu/digital/document/E1632AD./a>. The ever-vigilant Lewis Brett Smiler sent it to me.

2 Comments »

July 5, 2018

Empathy at three

Yesterday afternoon, our three year old grandson, who I’ll call Eliza because I’ve heard people have noticed a creep on the Internet recently, played with “Amos,” a 2.5yo child he had never met before. Amos is a sweet, fun child who was eager to join in. Eliza turned three a few days ago, so there was a noticeable age difference but not a huge gap. They played for hours out on the lawn, along with Amos’ wonderfully sociable and kind 6yo sister. It gave me full-body memories of watching our children play with their cousins on the very same lawn. There aren’t a lot of stretches when I’d say I was happy without adding some type of qualifier. Yesterday earned no qualifiers

Then, after maybe four hours of play, Amos swung a bubble wand and accidentally hit Eliza in the head with it. It’s a foot-long light plastic tube with a long slit in it, and Amos is only 2.5, so there was no damage, no mark, no blame. But, still, no one likes being beaned, especially by surprise.

Eliza started to make the quivering face of a child about to cry, but quickly realized what had happened. You could see him struggle not to cry. His mom — who was born empathetic — took him into the hammock where she was lying down and snuggled him. He spooned so she wouldn’t see that he was still stifling tears. But I could see. And his mom of course could tell. And so could Amos, who started getting upset because Eliza was.

Now, I’m Eliza’s grandparent and he and I are very close in both senses of the word. So I am undoubtedly one of the two most biased people in the world when it comes to him. On the other hand, I have the joy of knowing him well. And I am certain that Eliza was holding back the display of his emotions because he did not want to upset Amos.

I think we often overrate empathy. But not always. And what Eliza exhibited was not just empathy. It was empathy for the person who accidentally hurt him. It was empathy rising above his own contrary feelings. It was empathy in the moment, without pause, that helped the object of that empathy, Amos. It was empathy that could not be expressed as empathy .

So why did I wake up at 2:30 this morning and weep?

1 Comment »

July 4, 2018

Moral rights kill culture

<rant>

Moral rights of creators are inventions grounded in a bad analogy with property rights.

If you want to maintain your “moral right” to what you’ve written, then don’t publish it.

If you publish it, you are making it public. Thank you for doing so.

You will make money from it for some fixed period — a period designed to provide you (but not necessarily Stephen King) with sufficient incentive to continue to create and publish works, but a short enough period that creative works can be assimilated by the culture.

Why put limits on the author’s exclusive right to publish? To keep culture lively. Which is the same as keeping that culture alive.

Cultural assimilation requires the freedom to talk about your work, to reuse it, misuse it, abuse it, to get it terribly wrong, to make it our own as individuals, to make it ours as a culture.

Imagine a Renaissance in which “moral rights” were enforced. Can’t.

Moral rights kill culture.

(Note that this applies to works that are published as copies. Please don’t take a hammer to any irreplaceable statues. Thanks.)

</rant>

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.0 Generic License.

Comments Off on Moral rights kill culture

June 19, 2018

Game addiction

From Jane Wakefield at the BBC:

Its 11th International Classification of Diseases (ICD) will include the condition “gaming disorder”.

The draft document describes it as a pattern of persistent or recurrent gaming behaviour so severe that it takes “precedence over other life interests”.

Oy. IMO, this will go down in history as a ludicrous example of the hysteria we’re living through, which I take as strong evidence of the depth of the changes the Internet is bringing. It’ll be the example of cultural hysteria mentioned after the anti-comic-book hysteria of the 1950s.

That’s not to deny that some people suffer from the symptoms listed. But we don’t have a disease called “fingernail addiction” because some people chew their nails compulsively. Or TV addiction. These obsessive behaviors are (in my non-expert opinion) expressions of other issues, not caused by the object of the obsession. Or else games are a peculiarly finicky addictive substance. If only heroin were so selective!

Pardon me, but I left my character in Tom Clancy’s Wildlands
sitting on the edge of an airfield, awaiting her 37th attempt to steal that frigging airplane.

Comments Off on Game addiction

Next Page »