Cleaning up Zotero’s “The attached file could not be found at the following path”

After an upgrade to one of the machines linked to my Zotero account, I got errors that some of the attached filed could not be found. Now, I attach most of my files, so I was pretty sure that the files were there. I also double-checked that the base directory was set correctly, and that it was set to relative paths (moreover, only some of the attached PDF were affected, so I knew that the basic setup was OK).

Using Zutilo (a plugin for Zotero), I could figure out that the problem of those attached files was that an absolute path was set. In fact, on the Windows machine (i.e. the machine that was upgraded and where Zotero was set up afresh), I could simply choose to select the file again to resolve the issue, but there were more than a handful of attachments involved.

So I used the Zotero Storage Scanner (another plugin for Zotero). I was useful to read the instructions, as the scanner plugin has no GUI and works in the background to tag broken attachments. On my machine, I got around 1 entry tagged per second, so adjust your expectations accordingly.

Because the scanner plugin tags the attachments/PDF and not the articles, I then created a new collection in Zotero. Selecting the #broken_attachments tag, pressing minus (to collapse all items), I then added all the items to that collection. This way, I was sure to select the entries for the next step.

Selecting all articles with broken attachments, enter Zutilo for the second time. This time, I needed to “Modify attachment paths”. There are two boxes, one after the other. So in the first one, I entered that part of the absolute path, that wasn’t needed (I copied this from Zutilo’s “show attachment paths”), like “D:\ZoteroPDF\” (without quotes). In the second one, I added “attachments:” (without quotes, but including the colon). On my machine, this took around 3 seconds for 2k items.

Because I did the fixes on the GNU/Linux machine (this will also apply to Mac), I used Zutilo once again to modify attachment paths: In the first box, I entered the backslash (“\” without quotes), and made sure to tick “change all instances”, and then in the second box I entered the forward slash (“/” without quotes).

Getting everything synced on the Zotero servers took a while, but all my attachments work again as they should.

Fixing Jupyter access denied on Ubuntu 22.04

After the upgrade to Ubuntu 22.04 Jupyter Notebook (on Firefox 99.0.1) would greet me with an Access Denied error. Not exactly conducive to work.

I tried setting access right of the directories (I also thought about access issues given that .local is a hidden directory), but it turns out that creating an explicit configuration helps:

jupyter notebook --generate-config

This creates a file at: ~/.jupyter/jupyter_notebook_config.py

and in this (text) file we’re looking for c.NotebookApp.use_redirect_file, uncomment it, and set it to

c.NotebookApp.use_redirect_file = False

(as explained in the comments; this seems completely fine on a single-user machine).

Optimism

Sometimes I really admire the optimism demonstrated by engineers… or the pleasures of working from home.

How long would that even be, 833 re-connection attempts?!

Getting started with Bayesian in R

Stan logo

There really is no excuse any more: getting started with Bayesian regression analysis in R is really simple.

Step 1: install rstanarm from CRAN

Step 2: replace lm() with stan_glm() in your code

Sure, you’ll probably want to learn about priors, and invest a little in understanding diagnostics such as those provided by ShinyStan. But rstanarm is really designed to work well out of the box (i.e. with your existing code).

What I really appreciate is that it has useful warnings and error messages, and extensive documentation. Sometimes the documentation shows that quantitative analysis has something to do with mathematics, but even those who skip the Greek letters and formulae will get enough guidance. You’ll get nudges to use your own priors rather than rely on the default priors, but in my experience for most simple applications the default priors work reasonably well. You’ll also get suggestions right on your screen what you can do when there are say divergent transitions.

Once you can handle rstanarm, you’ll find it easy to upgrade to brms, where you can still use your trusted syntax for regression models in base R.

Plagiarism‽

I had fun this morning when checking the results of the routing plagiarism check. There was one paper flagged as suspicious because it used quotes from published articles without quotation marks. It turns out, the student was guilty of using French-style quotation marks for English quotes — clearly inappropriate… not!