Julia DataFrame output in Jupyter error in nbconvert - julia

The output of the DataFrame package for Julia looks good in a Jupyter notebook, but converting to a pdf with nbconvert causes the following error.
! Package ucs Error: Unknown Unicode character 9474 = U+2502,
(ucs) possibly declared in uni-37.def.
(ucs) Type H to see if it is available with options.
See the ucs package documentation for explanation.
Type H <return> for immediate help.
...
l.410 │ Row │ A │ B │ C │
?
! Emergency stop.
...
l.410 │ Row │ A │ B │ C │
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on notebook.log.
The unicode character U+2502 is the "BOX DRAWINGS LIGHT VERTICAL", which is the vertical pipes the DataFrames package uses to separate the table columns.
Any suggestions on how to stop this?

Thanks to Thomas K and minrk on github the following fixed the problem.
Setting up a config file, for example nbConvertConfig.py, in the same directory as the notebook that contains the following:
c = get_config()
c.PDFExporter.latex_command = ['xelatex', '{filename}']
then from the console run jupyter nbconvert --to pdf --config nbConvertConfig.py Example.ipynb.

Related

R CMD check with R-devel: note occurs about 'https://doi.org/...' address inside \href{} in Rd files

Summary
With R-devel, an R CMD check note appears about \href{https://doi.org/...}{label} in Rd files. Can this be resolved - i.e. using \doi{} ?? - or should an issue be posted about this?
Problem
From the R CMD check results in https://github.com/florisvdh/n2khab-fork/runs/1821504203?check_suite_focus=true#step:9:40 :
Found the following URLs which should use \doi (with the DOI name only):
File ‘read_GRTSmh.Rd’:
https://doi.org/10.5281/zenodo.2611233
https://doi.org/10.5281/zenodo.3354403
File ‘read_GRTSmh_base4frac.Rd’:
https://doi.org/10.5281/zenodo.3354401
File ‘read_GRTSmh_diffres.Rd’:
https://doi.org/10.5281/zenodo.3354405
File ‘read_habitatmap_stdized.Rd’:
https://doi.org/10.5281/zenodo.3355192
File ‘read_habitatmap_terr.Rd’:
https://doi.org/10.5281/zenodo.3468948
File ‘read_habitatquarries.Rd’:
https://doi.org/10.5281/zenodo.4072967
File ‘read_habitatsprings.Rd’:
https://doi.org/10.5281/zenodo.3550994
File ‘read_soilmap.Rd’:
https://doi.org/10.5281/zenodo.3732903
File ‘read_watersurfaces_hab.Rd’:
https://doi.org/10.5281/zenodo.3374645
I had already shortened this list before, by replacing \url{https://doi.org/...} occurrences by \doi{...}.
The above remaining cases however concern a DOI address inside \href{}:
$ find . -type f -name "*.R" -exec grep -nH "{https://doi.org/" {} --colour \;
./R/GRTSmh.R:232:#' \href{https://doi.org/10.5281/zenodo.2611233}{Zenodo}, is a monolayered GeoTIFF
./R/GRTSmh.R:263:#' \href{https://doi.org/10.5281/zenodo.3354403}{Zenodo}, and can only be
./R/GRTSmh.R:374:#' \href{https://doi.org/10.5281/zenodo.3354401}{Zenodo}.
./R/GRTSmh.R:485:#' at \href{https://doi.org/10.5281/zenodo.3354405}{Zenodo}), composed of
./R/read_habitatdata.R:24:#' \href{https://doi.org/10.5281/zenodo.3355192}{Zenodo}, that
./R/read_habitatdata.R:196:#' \href{https://doi.org/10.5281/zenodo.3374645}{Zenodo}, that contains:
./R/read_habitatdata.R:748:#' \href{https://doi.org/10.5281/zenodo.3468948}{Zenodo}, that contains:
./R/read_habitatdata.R:1079:#' \href{https://doi.org/10.5281/zenodo.3550994}{Zenodo}.
./R/read_habitatdata.R:1276:#' \href{https://doi.org/10.5281/zenodo.4072967}{Zenodo}, that contains:
./R/read_soilmap.R:25:#' \href{https://doi.org/10.5281/zenodo.3732903}{Zenodo}.
Can this be solved as well (while retaining the \href{}{} behaviour), or is this to be seen as buggy behaviour from the '\doi note'?

Applying .patch file in Yocto does not work

I am trying to patch a custom qt virtual keyboard from Yocto.
First of all I cloned the git repo of that keyboard, changed one file (just replace an old version of .otf by new one), committed the changes and created the patch file executing:
git format-patch -1 <COMMIT_ID> -o patches
In result I have an commit file inside /patches/ folder.
I have checked it by reverting the changes and git apply <File.patch> again. Everything looks fine.
The next step.
I have necessary qtvirtualkeyboard_%.bbappend file in /sources/meta-yogurt/recipes-qt/qt5/.
I created new folder qtvirtualkeyboard and copied the file.patch there.
Than I modified qtvirtualkeyboard_%.bbappend and not it looks like:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += \
"file://0001-Update-font-file.patch;striplevel=0"
PATCHTOOL = "git"
PACKAGECONFIG = " lang-de_DE lang-en_GB lang-ru_RU lang-zh_CN \
lang-it_IT lang-ja_JP"
I tried to modify it with and without PATCHTOOL var and striplevel - it did not make any result.
And in the end when I build the image I receive the next error:
ERROR: qtvirtualkeyboard-5.9.8+gitAUTOINC+dc18b608b5-r0 do_patch: Applying '0001-Update-font-file.patch' failed:
can't find file to patch at input line 12
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 5defffb3a8afaa8e254cd2cf551d6126ead74014 Mon Sep 17 00:00:00 2001
|From: Savchenko Serhii <s.savchenko#smissltd.com>
|Date: Mon, 21 Sep 2020 11:41:37 +0300
|Subject: [PATCH] Update font file
|
|---
| FontAwesome.otf | Bin 85908 -> 465076 bytes
| 1 file changed, 0 insertions(+), 0 deletions(-)
|
|diff --git a/FontAwesome.otf b/FontAwesome.otf
|index 81c9ad949b47f64afeca5642ee2494b6e3147f44..7720e3739b64143d0a1dcb28fda78ac209afbcb8 100644
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
Does anyone have any idea how to fix it?

Remove spaces from directory and file names (recursively) in R on any platform

I'm trying to create an R function that will remove spaces from all directories and files within a path, and I want this to work on any platform. To be clear, I'm not just trying to change the names of the path in a string in R, I want to change the actual names of the directories and files. I want the function to be able to work through R because it's part of an R package that I'm building.
Here is some reproducible code to create folders within your working directory in R. I want to make a function that removes spaces from all of these folders and files, and I want this to work on Mac/Linux and Windows.
#- set up a recursive file structure with spaces in folder names and file names
# create a folder called "folder 1" within your directory
dir.create("folder\ 1")
# enter folder 1
setwd(paste0(getwd(), "/folder 1"))
# create a couple of files with spaces in names
file.create("file 1.txt")
file.create("file 2.txt")
# create "folder 2" within "folder 1"
dir.create("folder\ 2")
# enter folder 2
setwd(paste0(getwd(), "/folder 2"))
# make some files with spaces
file.create("file 1.txt")
file.create("file 2.txt")
# I am **NOT** trying to do this. This replaces spaces with "_", but only in the string in R, not the actual directories or file names
string1 <- "./folder 1/folder 2/file 1.txt"
gsub(" ", "_", string1, fixed = TRUE) # This just removes the spaces from the string; this is not what I want to do. I want to actually change the names of the directories.
# but this is how I'd like my path to be after running the function.
If the computer is a Mac, in the terminal I can run the following code from my original working directory, which requires rename, which can be installed with brew install rename if you have homebrew. It replaces all spaces in directories and file names with _.
find . -depth -name '* *' -execdir rename 's/ /_/g' '{}' \;
The problems with trying to run this from R are that 1) it only works on a Mac or Linux machine, and 2) I can't run a system command with this because it ends in \;, which throws an error if I run this in R:
# running this same command in R
sys_cmd <- ("find . -depth -name '* *' -execdir rename 's/ /_/g' '{}' \;")
system(sys_cmd)
# produces in an error
Does anyone have suggestions for this problem? I appreciate your help.

How to move files based on a list (which contains the filename and destination path) in terminal?

I have a folder that contains a lot of files. In this case images.
I need to organise these images into a directory structure.
I have a spreadsheet that contains the filenames and the corresponding path where the file should be copied to. I've saved this file as a text document named files.txt
+--------------+-----------------------+
| image01.jpg | path/to/destination |
+--------------+-----------------------+
| image02.jpg | path/to/destination |
+--------------+-----------------------+
I'm trying to use rsync with the --files-from flag but can't get it to work.
According to man rsync:
--include-from=FILE
This option is related to the --include option, but it specifies a FILE that contains include patterns (one per line). Blank lines in the file and lines starting with ';' or '#' are ignored. If FILE is -, the list will be read from standard input
Here's the command i'm using: rsync -a --files-from=/path/to/files.txt path/to/destinationFolder
And here's the rsync error: syntax or usage error (code 1) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/options.c(1436) [client=2.6.9]
It's still pretty unclear to me how the files.txt document should be formatted/structured and why my command is failing.
Any help is appreciated.

getting file names in R

I am trying to get all the file names that are placed in Hadoop HDFS. all i find is bash command for listing files
hadoop fs -ls
is there any way to get them in R. Please guide me
Thanks!
setpw("/directory/of/choice")
list.files()
The result is a character vector of file names in the Present Working directory
But it occurs to me that hadoop is special. So maybe this works in your situation
system("hadoop fs -ls", intern=T)
The result is again a character vector of file names, assuming "hadoop fs -ls" actually returns something similar to "ls" in a system console.
Check out the RHadoop project. In particular the package you need to list files is rhdfs.
Thought people might find this answer useful, here is the code to get files names from a specific hdfs folder into R using rhdfs.
R Code:
# Load required library and set hadoop environment
library(rhdfs)
Sys.setenv("HADOOP_CMD"="/opt/cloudera/parcels/CDH/bin/hadoop")
# Initialise
hdfs.init()
# Extract files names from a given hdfs folder to a data frame
files <- as.data.frame(hdfs.ls('/'))
Output:
> files #Print data frame
permission owner group size modtime file
1 -rw-r--r-- manohar supergroup 204632 2015-01-13 22:45 /LICENSES.txt
2 drwxr-xr-x manohar supergroup 0 2014-12-20 19:51 /SA
3 drwxr-xr-x manohar supergroup 0 2015-01-10 18:16 /in
i used Rhipe's command rhlist("/") and it returned data frame.

Resources