Read/write access for Samba/cfis drive remotely using GNU/Linux

I’ve had some issues with accessing a remote network drive: I didn’t have the permission to write on the network drive, even though I should. Changing the permissions manually would have worked, but that seemed like the wrong approach. I didn’t log into this particular drive for a while, so I figured my mount options were probably incorrect. Turns out (as usual) that the solution was to set the uid option:

mkdir -p ~/mnt/remote_username

sudo mount -t cifs -o user=remote_username,domain=domain.com,uid=local_username //home/remote_username$ ~/mnt/remote_username

rtweet with Premium to search the archive

The R package rtweet does a great job to connect R to Twitter. Unless you’re looking at the past 7 days, Twitter offers two additional API (with different syntax).

If you access Twitter archives with rtweet and have a Premium subscrption on Twitter, the current version of rtweet sends requests in batches of n=100, but Premium (currently) allows batches up n=500. This means, you use 5 requests where 1 would suffice. Kevin Taylor has provided a fix for this, which he also mentioned in the issues of rtweet. Using the fix is easy (much easier than the description in issues thread suggests):

library(devtools)
install_github("kevintaylor/rtweet")

This will replace any installed version fo rtweet. You probably want this version if you’re on Twitter Premium; for the free Sandbox, n=100 is correct. Perhaps this is why rtweet has not implemented the fix yet?

Image credit: CC-by-nc by diarnst

Mac *.txt.rtfd to *.txt

In a recent project, an assistant used TextEdit to supposedly save documents as pure (UTF-8) text files. We managed to fix the workflow, but I was left with a bunch of Zip files full of *.rtf from TextEdit. On a Windows or GNU/Linux machine, these files show up as what they are: folders that contain a rich text document (and potentially other stuff). I needed text documents.

After a bit of searching and tweaking, I got the following shell script to convert all the rich text documents in these folders/containers into text documents:

find . -name '*.rtf' -exec unoconv -f txt {} \;

There was a problem, though. The files all had a name containing important meta data. So I had the folder with the name of the file, and inside this folder the file but it was called TXT.txt (converted from TXT.rtf). I’m sure there’s a quick way in a shell script (if you know one, please share it in the comments), but I got stuck with the shell.

Enter LiveCode. Here’s a script that does just that. I guess I could have called the above shell script, but I already had this.

on mouseup
-- INPUT: select a folder with the *.txt.rtfd folders
answer folder "Input: Choose folder:"
put it into infoldername
set the defaultFolder to infoldername
put the folders into listoffolders
-- filter . and .. can cause problems
filter listoffolders without "."
filter listoffolders without ".."
-- OUTPUT: select a destination folder
answer folder "Output: Choose folder:"
put it into outfoldername
repeat with i = 1 to the number of lines of listoffolders
put line i of listoffolders into currentfolder
revCopyFile infoldername & slash & currentfolder &
slash & "TXT.txt", outfoldername & slash & textname
end repeat
end mouseup

Full LiveCode stack here on OSF (it’s nothing more than a button and a text field with a basic log).

More Support and Templates in SciFlow

SciFlow is an online editor for academics. They have recently updated and expanded the documentation, so should you ever get stuck, here’s how to. That said, the interface is pretty intuitive, so I’m not sure you’ll ever need to navigate to the support pages for basic editing.

There are some useful hints, though, like using zbib (Zotero) with Sciflow (instructions here). This gets pretty close to Authorea’s citation feature, and is also useful for collaborative texts (and doesn’t suffer from the slowness of direct Zotero/Mendeley connections if you have a large database of references).

The SciFlow team have also recently updated the Templates feature:

There are many journal styles to choose from. It’s not quite (yet) like typeset.io, but the social sciences are not well covered by typeset anyway. SciFlow offers some useful templates, but in most cases, it’s necessary to do some finishing before submitting to a journal. On the other hand, there’s a template for minutes — that’s useful for anyone working in a team, and who isn’t?

In most cases the generic templates will do, including the SciFlow templates which support many common citation styles.

R-Forge: File ‘/pkg/DESCRIPTION’ is out of date

I came across a puzzling “File ‘/pkg/DESCRIPTION’ is out of date” error when updating an R-package of mine on R-Forge today. I was pretty sure the version number and date were correct. I couldn’t figure out any other issue, so I made a copy of my documents, checked out the code again, and copied the modified files back. All worked. I’m still a bit puzzled as I only use one machine for this, but who cares if the code is working…