Joho the Blogmisc Archives - Page 2 of 95 - Joho the Blog

February 29, 2016

Republicans for Hillary

In 1964, Barry Goldwater was the Republican nominee, running against Lyndon Johnson. Goldwater was from what was then the furthest acceptable edge of the right wing. He was so effectively presented as an extremist that famously in his nomination acceptance speech he responded, “I would remind you that extremism in the defense of liberty is no vice! And let me remind you also that moderation in the pursuit of justice is no virtue!”

In one of the most famous political ads of all time, LBJ successfully painted him as too irresponsible to trust with nuclear weapons:

Nate Silver now has dug up another ad from that campaign: “Confessions of a Republican” voting for LBJ. Silver calls it “strange and kind of amazing.” I’d add “mesmerizing.”

Silver wonders if Hillary Clinton is studying it. She should.

1 Comment »

February 14, 2016

How a dot invaded dweinberger’s privacy

Yesterday I started getting a stream of receipts from Amazon for goods I had not purchased. Mainly they were free games and apps so I only freaked out to 70% of maximum.

I changed my Amazon password and checked my credit cards just in case one of the purchases — there were dozens — was not free. All seemed in order.

The receipts cheerily exposed the person’s name to me, thanking “Dixxon Weinberger” for the $0.00 purchase. (I have changed Dixxon’s name because judging from the receipts and from the Facebook page I found under that name, he’s probably a minor.)

Because Dixxon’s name is spelled in an unusual way, I think I found the right Facebook page for him. It looks like an account he doesn’t check. But just in case, I left him a carefully written, friendly note suggesting that he clear up his email address at Amazon. The first thing I said in the message is that he should probably show this note to his parents. I did my best not to sound like an Internet creep, but it turns out that the harder you try, the creepier you sound. So I kept it to a minimum.

Then my son figured out what happened.

I own the email address dweinbergergmail.com. I use it as my backup email in case my primary one (davidweinberger.org) breaks. It turns out that Gmail ignores dots in your name. So, dwe.inbergergmail.com will reach me, as will dweinb.ergergmail.com. I’m sure there’s a good reason for this but I don’t really get why Gmail would so restrict its namespace. Anyway.

Dixxon apparently signed up at Amazon under d.weinbergergmail.com, so all his mail from Amazon (and now from other places he’s signed up at) are coming to me. I am filing them without reading them because I don’t want to know what this kid is downloading, but it seems like a pretty big flaw that Amazon let someone sign up without sending an email requiring confirmation.

Let me now put this in the past tense: I just spent 20 mins on the phone with Amazon support. The support person was very patient. They have closed the d.weinberger account. The poor kid isn’t going to know why because the explanation will go to an address that ends up in my inbox.

Sorry, Dixxon! It’s better this way. And, Amazon, maybe do better at sending confirmation emails.

Of course it’s likely that I mistakenly/absently clicked some confirmation email, although I have no record or recollection of doing so. Nevertheless, I’ve learned that 97% of the mysteries in my life can be resolved by assuming I did something wrong.

3 Comments »

February 3, 2016

Trump’s "linguistic killshot"

Scott Adams, the Dilbert guy, writes perceptively about Trump’s skill verbally assassinating his opponents with what Scott kills a “linguistic killshot.” His example is Trump labeling Jeb! as “low-energy.” It’s the type of description that cannot be countered and cannot be unheard. Adams notes that Trump is both very calculating and very smart about this.

But he predicts that Trump’s shot against Hillary Clinton will be that she is not “credible.” I think I disagree. For one thing, that’s been the explicit beef against her for twenty years. For another, I don’t think it will have much traction with the people Trump needs to reach, because independents are just as likely to think that Trump negotiating with allies is more of a Dukakis-in-the-tank moment than a vision of credibility.

Assuming that Hillary is the nominee, I think maybe Trump will go after her as “always flapping her jaws,” as “chatty but no one can understand what she’s saying,” as “blah blah NATO blah blah Excuses blah blah Policy Report #45278 Part A.” But that’s not what America needs, he’ll tell us. We need someone who will stand up to our allies and kill our enemies. “It’s not that hard, folks. And we don’t need a Chatty Cathy for that.”

This has the effect of neutralizing her deep expertise, especially in foreign affairs, thus turning her strength against her. It makes her look weak-willed. There is no effective counter to it. And it’s deeply misogynistic. In short, it’s got Trump in big gold letters all over it.

2 Comments »

January 28, 2016

Keep the Web unbroken, with Amber

When sites go down, they don’t take the links to them with them. So, your posts now point to 404s. That’s not just an inconvenience. It’s Web entropy and over time it will render the Web less and less useful and even less intelligible.

Amber fights Web entropy. It’s a plugin for WordPress or Drupal that automatically takes a snapshot of whatever you’re linking to. If the linked site goes down — or is taken down by a government that doesn’t like what it’s saying — your readers will still be able to read what was there when you linked to it.

For example, this is a page that I posted and then took down. It was here: http://toobigtoknow.com/amberSample.html. It’s not there now. But if you hover over the link, Amber shows you what you’d otherwise be missing.

Amber’s pedigree literally could not be better. It’s a project from the Berkman Center, from an idea cooked up by Jonathan Zittrain and Tim Berners-Lee. It is a fully distributed system, thus helping to re-decentralize the Web, although you can opt to store the page images at sites like the Internet Archive, Perma.cc, and Amazon AWS.

What are you waiting for?

 


 

If you install Amber and it’s not working, make sure that you’ve created a folder called “amber” in your WordPress “uploads” directory: /wp-content/uploads/amber.

7 Comments »

January 22, 2016

Open Syllabus Project goes live—Yay for open platforms!

The Open Syllabus Project has just gone live with a terrific beta Web site and a front page article about it by two of the main people on the project. (I’m proud to be an advisor to the group.)

The OSP is an open platform that so far has aggregated over a million syllabi. At the beta version of their search site you can do plain old searches, or filter by a number of factors. Want to see what is the most taught work at Harvard? In the state of Texas? In the field of Biology? Lucky you.

The project is computing what it calls a “Teaching Score” for each work, a number from 1-100. This is along the same lines of the StackScore I’ve been pushing for, a metric we use in Harvard’s LibraryCloud Project and that will be used in the Linked Data for Libraries project. (The OSP used Harvard’s open catalog metadata as a main source for book metadata and disambiguation; that metadata is available through LibraryCloud’s API. It’s an intertwingly world.)

The OSP plans on making its data available through open APIs, which will multiply the good effect it has. Sites will be able to integrate data from the OSP through the API, developers will be able to create apps that use that data, and researchers will find ways to investigate it that we literally cannot imagine.

Now, you’d think someone would have done something like the OSP years ago. In fact, there have certainly been efforts. For example, Dan Cohen (currently head of the DPLA) scoured the Web and aggregated about a million publicly available syllabi. But the sad truth is that most academic institutions don’t make their syllabi openly available. In fact, many institutions and many professors copyright their syllabi. That makes sense to me if they have written little essays in them. But as a listing of topics and works, I can’t imagine why anyone would insist on asserting copyright. What’s the worst that would happen? Some other teacher copies your syllabus perfectly? That teacher has learned from you, and you’re going to teach your course differently anyway. Meanwhile, the potential good from sharing syllabi is enormous: We can learn from one another. We can see unintended patterns that may express wisdom or bias.

The OSP is here. It’s going to make a real difference.

2 Comments »

Good luck with the snow, my southern friends

I just got off the phone with a friend in DC where a couple of days ago one inch of snow caused 6-hour tie-ups, causing some people to abandon their cars. Now the city is expecting a record thirty inches (or what we in Boston call, “Oh, it looks like it may have snowed overnight”). Residents are being told to expect power outages.

Best of luck to you all. You have New England’s sympathies. (And you also have an offer of help from Boston’s mayor.)

At least we can look forward to the Republican snowball fight in Congress to prove that global warming is a myth.

1 Comment »

January 16, 2016

Getting the path from the Dropbox API

Suppose you’re using the Dropbox API to let a user choose a file from her Dropbox folder and open it in your application. Dropbox provides a convenient widget — the Chooser — you can more or less just drop into your Web page. But…suppose you want to find out the path of an item that a user opens. For example, you want to know not only that the user has opened “testfile.txt” but that it’s “Dropbox/testfolder/TestA/testfile.txt”. The chooser only tells you the link is something like:

https://www.dropbox.com/s/lry43krhdskl0bxeiv/testfile.txt?dl=1

Figuring out how to get that path information took me /for/ev/er. I know it shouldn’t have, but it did. So, here’s how I’m doing it. (As always, please try not to laugh at my efforts at coding. I am an amateur. I suck. Ok?) (I owe thanks to Andrew Twyman at Dropbox who went out of his way to help me. Thanks, Andrew! And none of this is his fault.)

The way to get the path is explained in Dropbox’s API documentation, but that documentation assumes I know more than I do. Dropbox also provides an API Explorer that lets you try out queries and shows you the code behind them. Very helpful, but not quite helpful enough for the likes of me, because I need to know what the actual PHP or JavaScript code is. (It’d be easier if I knew Python. Someday.)

So, here’s roughly how I got it working. I’m going to skip some of the preliminaries because I went through them in a prior post: how to register an app with Dropbox so you can embed the Dropbox Chooser that lets users browse their Dropbox folders and download a file.

That prior post included code that initializes the Chooser. I want to add a single line to it so we can get the pathname of the downloaded document:

1

var opts= {

2

success: function(files) {

 

3

var filename = files[0].link;

4

filename = filename.replace(“dl=0″,”dl=1”);

5

$(“#filenamediv”).text(files[0].name);

6

alert(filename);

7

$.ajax({

8

url: “./php/downloadDropboxContents2.php”,

9

data: {src : filename},

10

success: function(cont){

11

$(“#busy”).show();

12

openOpmlFile_File(filename);

13

$(“#busy”).hide();

14

setCookie(“lastfile”,”/php/currentFile/” + filename);

15

getDropboxPath(filename);

 

16

},

17

error: function(e){

18

alert(e.responseText);

19

}

20

});

 

21

},

22

multiselect: false,

23

extensions: [‘.opml’],

24

linkType: “download”

25

};

26

var button = Dropbox.createChooseButton(opts);

27

document.getElementById(“uploadDB”).appendChild(button);

When a user chooses a file from Chooser, the “success” function that starts on line 10 is invoked. That function is passed information about the files that have been opened by the user in an array, but since I’m only allowing users to open one file at a time, the information is always going to be in the first and only element of that array. That information includes something called “link,” which is a link to the file that does not include the path information. So, in line 15 — the only new line — we’re going to pass that link to a function that will get that elusive path.

1

function getDropboxPath(link){

2

$.ajax({

3

type: “POST”,

4

beforeSend: function (request)

5

{

6

request.setRequestHeader(“Content-Type”, “application/json”);

7

},

8

url: “https://api.dropboxapi.com/2/sharing/get_shared_link_metadata?authorization=Bearer [INSERT YOUR AUTHORIZATION CODE]”,

9

data: JSON.stringify({url : link}),

10

success: function(cont){

11

alert(cont.path_lower);

12

},

13

error: function(e){

14

alert(e.responseText);

15

}

16

});

17

}

This is another AJAX call; it too assumes that you’ve included jQuery. (See the prior post.)

Now, how does this work. Well, I’m not entirely sure. But it’s sending a request to the Dropbox API. It’s doing this as a standard http web call, which means (I think) that you have to include metadata that web servers expect when you’re using http. (I could be wrong about this.) So, in line 6 you tell it that you are expecting to get JSON back, not a standard Web page. (JSON is a standard way of encoding human-readable, multipart information.)

In line 8 you’re constructing the URL you’re going to send your request to. Everything up to the question mark is simply the URL of the Dropbox API for getting metadata about a link. After the question mark you’re telling it that you’re authorized to make this request, which requites getting an authorization code from Dropbox. I’m probably cheating by using the one that the API Explorer gives you, but it works for now so I’ll worry about that when it breaks, which will probably be the next time I use it. Anyway, you need to insert your authorization code where it says “insert your authorization code” in all caps.

Line 9: The data is the internal link that the Chooser gave you as the URL of the file the user downloaded. I use JSON.stringify because it didn’t work until I did.

Line 10 is what happens when your query works. You’ll get an object from Dropbox that contains several different pieces of info. You want the one called “path_lower,” presumably because it gives you the path that is lower on the great Tree of Files that is a Dropbox folder. [LATER THAT DAY: Andrew tells me it’s actually called path_lower because it’s the path in all lower case, which is useful because the Dropbox file system is case insensitive. Frankly, I prefer my explanation on poetic grounds, so we’ll have to agree to disagree :)] Line 11 gets that path (cont.path_lower) and pops it into an alert box, which is almost certainly not what you actually want to do with it. But this is a demo.

That’s it. If you have questions, try to find someone who understands this stuff because I got here through many trials and even more errors.

Good luck.

2 Comments »

January 9, 2016

Netflix’s hidden categories

The redditor makeinstallposted to PasteBin an HTMLized version of a list of hidden categories at Netflix that was the subject of a reddit thread. I’ve posted it as a Web page with links.

As you’ll see, Netflix has thousands of categories it uses internally. These are like the ones it lets you browse but more specific. This list will take you to a page at Netflix where you can browse among these micro-categories.

6 Comments »

January 7, 2016

B12 helped my memory?

I’m 65 so I forget where I put my car keys and then remember that they’re in the ignition. And that I’m driving.

Well, no, it’s not that bad. But you know that thing where you click on your browser to look something up, you see what’s already loaded, and then it takes a minute to remember what you went there for? That was getting worse, and it was annoying.

I asked my doctor about it. It turns out that my B12 levels were scraping right along the minimum acceptable level — 181pg/ml is the minimum recommended (at least on the test results document I get) and I was at 190, and occasionally a bit lower. So at my doctor’s suggestion I started taking a supplement every day. That was about a year ago. My B12 levels are now 624 (914 is the highest recommended).

I have no external measurement of my short-term memory to go by, but it seems to me to be much better. Not perfect. I still won’t remember your name. But much better.

I ain’t no stinkin’ medical professional, but you can get B12 without a prescription. Best of all, if you take too much, you will pee a cheerful yellow.

By the way, my B12 levels might have been low because I’ve been a vegetarian for 35 years. There’s B12 in eggs and diary, but I probably wasn’t paying enough attention. (See my post about Soylent.)

2 Comments »

December 27, 2015

Embedded endnote extractor

I’ve updated a 2009 utility that lets you embed your end notes in the text you’re typing. The utility, Footnoter, extracts the endnotes, leaves a footnote number, and compiles a list of the endnotes with numbers and links. It now works with Markdown as well as with HTML; I use Markdown for most of what I write these days.

In other words, let’s say you type this in a document you’re creating with Markdown:

I write using Markdown. ((See John Gruber’s Daring Fireball for more.)) Markdown lets you embed formatting codes into plain text that are then rendered into formatted HTML, Word, etc.((The Marked app adds a viewer with export capabilities. It’s on sale for $9.99 right now.)), enabling me to focus purely on what I’m saying. It also lets me keep my fingers on the keyboard.

If you paste this text into Footnoter and tell it you want Markdown output, it will treat the comments between the double parentheses as endnotes. It will remove those comments from the body of the text, leaving the Markdown code for an endnote number, and will compile a list of endnotes with the proper references back to their endnote numbers. That is, it does what you would expect. At least with my limited testing.

For Markdown, that means the above text gets turned into this:

I write using Markdown.[^fn2] Markdown lets you embed formatting codes into plain text that are then rendered into formatted HTML, Word, etc.[^fn3], enabling me to focus purely on what I’m saying. It also lets me keep my fingers on the keyboard.

[^fn2]:See John Gruber’s Daring Fireball for more.
[^fn3]:The Marked app adds a viewer with export capabilities. It’s on sale for $9.99 right now.

Don’t be freaked out. That’s what endnotes look like in Markdown. When you run them through a parser, they’ll have appropriately numbered superscripts. (Footnoter generates arbitrary unique Markdown labels for endnotes; they start with “fn” and then have numbers appended sequentially. Those numbers have nothing to do with the number the parser will assign to the endnote itself. Also, yes, it’s a little bug that Footnoter starts with fn2 instead of fn1. Non-critical. I’m working on it. [Minutes later]: Fixed it. I think.)

The same thing happens if you are writing HTML except the markup that’s generated is more like this:

I write using Markdown.<span class=’fn_in_text’><a name=’fn2′><a href=#fnend2>2</a><</span> Markdown lets you embed formatting codes into plain text that are then rendered into formatted HTML, Word, etc.<span class=’fn_in_text’><a name=’fn3′><a href=#fnend3>3</a></span>, enabling me to focus purely on what I’m saying. It also lets me keep my fingers on the keyboard.

And that gets rendered in a browser as this:

I write using Markdown.2 Markdown lets you embed formatting codes into plain text that are then rendered into formatted HTML, Word, etc.3, enabling me to focus purely on what I’m saying. It also lets me keep my fingers on the keyboard.

There are a number of options, including setting the delimiters for endnotes and, for HTML, which endnote number to begin with. By default it removes the space before an endnote, so you can put a space between the word where the superscript should be and your delimiters, making your text easier to read when you’re working on it.

Also, if you work on a text, run it through Footnoter, work on it some more and add more endnotes, Footnoter should detect that and begin its arbitrary numbering of Markdown endnotes above where you left off. That means you can run it through more than once and it should still work.

Should.

Note: This code is from 2009. I’ve learned some stuff since then, including that jQuery makes life easier. When I added the Markdown option yesterday, I didn’t bother cleaning up the old code. It is particularly hideous. You can gape at its uglinesss at github.

PS: Yes, I really should have named it “Endnoter.”

Be the first to comment »

« Previous Page | Next Page »


Creative Commons License
Joho the Blog by David Weinberger is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

Creative Commons license: Share it freely, but attribute it to me, and don't use it commercially without my permission.

Joho the Blog gratefully uses WordPress blogging software.
Thank you, WordPress!