Jupyter download as pdf - jupyter-notebook

How can I solve this problem when I want to download as pdf through Jupyter?
nbconvert failed: PDF creating failed, captured latex output:
Failed to run "['xelatex', './notebook.tex', '-quiet']" command:
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./notebook.tex
LaTeX2e <2018-12-01>
'''(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2019/texmf-dist/tex/latex/tcolorbox/tcolorbox.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2019/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-def/xetex.def)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.de
f
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx
.def
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-p
df.def))))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.
code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.
code.tex)) (/usr/local/texlive/2019/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.co
de.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconst
ruct.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage
.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.co
de.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicst
ate.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransform
ations.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.cod
e.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.c
ode.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathproce
ssing.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.co
de.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.cod
e.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.cod
e.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.
code.tex))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.co
de.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretranspare
ncy.code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.
code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.
tex)))
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.cod
e.tex)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.
tex)
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-0-65.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-1-18.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/environ/environ.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/trimspaces/trimspaces.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/tcolorbox/tcbbreakable.code.tex
Library (tcolorbox): 'tcbbreakable.code.tex' version '4.20'
)) (/usr/local/texlive/2019/texmf-dist/tex/latex/parskip/parskip.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))))
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/iftex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/tuenc.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/caption/caption.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/caption/caption3.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/adjustbox/adjustbox.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/adjustbox/adjcalc.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/adjustbox/trimclip.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/collectbox/collectbox.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/adjustbox/tc-xetex.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/varwidth/varwidth.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/float/float.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/tools/enumerate.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/ifxetex/ifxetex.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/upquote/upquote.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/eurosym/eurosym.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/ucs/data/uni-global.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v3.2a <2019/01/15> (tvz))
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/grffile.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/hxetex.def
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/stringenc.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/titling/titling.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/booktabs/booktabs.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/enumitem/enumitem.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/ulem/ulem.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/jknapltx/mathrsfs.sty)
No file notebook.aux.
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1cmr.fd)
ABD: EveryShipout initializing macros
(/usr/local/texlive/2019/texmf-dist/tex/latex/caption/ltcaption.sty)
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
*geometry* verbose mode - [ preamble ] result:
* driver: xetex
* paper: <default>
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes:
* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt)
* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=469.75502pt
* \textheight=650.43001pt
* \oddsidemargin=0.0pt
* \evensidemargin=0.0pt
* \topmargin=-37.0pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=11.0pt
* \footskip=30.0pt
* \marginparwidth=59.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \#twocolumnfalse
* \#twosidefalse
* \#mparswitchfalse
* \#reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)
(/usr/local/texlive/2019/texmf-dist/tex/latex/ucs/ucsencs.def)
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
Package hyperref Warning: Rerun to get /PageLabels entry.
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/umsb.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/jknapltx/ursfs.fd)
LaTeX Warning: No \author given.
! LaTeX Error: Command \b already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.384 \newcommand{\b}{\mathbf{b}}
?
! Emergency stop.
...
l.384 \newcommand{\b}{\mathbf{b}}
No pages of output.
Transcript written on notebook.log.

Related

How to build a package with RcppArmadillo?

I wish to build a package, but I write part of it using RcppArmadillo and now I am suffering the consequences. I am using roxygen2 and devtools to help me with DESCRIPTION and NAMESPACE. I am coding in R / Ubuntu. In the DESCRIPTION I include two lines to load the packages:
Depends: R (>= 3.4.4), MASS (>= 7.3-49), Rcpp (>= 1.0.5), RcppArmadillo (>= 0.9.900.2.0)
LinkingTo: Rcpp, RcppArmadillo
and in the folder /src I write a script name loss_function.cpp, inside it there is:
> // [[Rcpp::depends(RcppArmadillo)]]
>
> #include <RcppArmadillo.h>
>
> using namespace Rcpp;
>
> //' Check function.
> //'
> //' #param x vector
> //' #param tau percentile
> //' #return y new vector
> // [[Rcpp::export(rho_koenker)]]
> arma::vec rho_koenker(arma::vec x, double tau){
> int n = x.n_elem;
> arma::vec y(n);
> for(int i = 0; i < n; ++i){
> if(x(i)<0){
> y(i) = x(i)*(tau-1);
> } else {
> y(i) = x(i)*tau;
> }
> }
> return(y);
> }
>
> //' Quantile regression loss function
> //'
> //' #param beta parameter
> //' #param x matrix
> //' #param y vector
> //' #param tau percentile
> //' #param N total number of observations
> //' #param d beta's length
> //' #return eta numeric
> // [[Rcpp::export(loss_qr)]]
> double loss_qr(arma::vec beta, arma::mat x, arma::vec y, double tau, int N, int d){
> double eta = 0;
> arma::vec res(N);
> arma::vec rho(N);
> res = y - (x * beta);
> rho = rho_koenker(res,tau);
> eta = accu(rho);
> return(eta);
> }
When I check the package (build -> check package) there comes an error msg:
Error in .Call("_pqfe_loss_qr", PACKAGE = "pqfe", beta, x, y, tau, N, :
"_pqfe_loss_qr" not available for .Call() for package "pqfe"
Calls: qr ... optim_qr -> <Anonymous> -> <Anonymous> -> fn -> .Call
Execution halted
Warning message:
Can't find generic `sew` in package knitr to register S3 method.
This message is only shown to developers using devtools.
Do you need to update knitr to the latest version?
As alluded in the comment above, it is not clear where you error would lie here with RcppArmadillo. So I
invoked RcppArmadillo.package.skeleton() (via the helper command kitten.r from littler relying on pkgKitten but those are details)
added in src/loss_function.cpp based on what you had
added one missing #export tag to you doxygen/roxygen to also have the R documentation created
called Rcpp::compileAttributes() (via helper compAttr.r from `littler) to have the interal glue code generated / updated
called roxygenize() (via helper roxy.r from littler) to have help files created
called R CMD build (directly, or via helper build.r from littler)
ran R CMD check (directly, or via helper rcc.r from littler)
and it all works:
edd#rob:~/git/stackoverflow/73405262(master)$ R CMD build soDemo
* checking for file ‘soDemo/DESCRIPTION’ ... OK
* preparing ‘soDemo’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to process help pages
* saving partial Rd database
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘soDemo_1.0.tar.gz’
edd#rob:~/git/stackoverflow/73405262(master)$
and checks nicely too
edd#rob:~/git/stackoverflow/73405262(master)$ R CMD check soDemo_1.0.tar.gz
* using log directory ‘/home/edd/git/stackoverflow/73405262/soDemo.Rcheck’
* using R version 4.2.1 (2022-06-23)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘soDemo/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘soDemo’ version ‘1.0’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘soDemo’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking use of PKG_*FLAGS in Makefiles ... OK
* checking compilation flags used ... OK
* checking compiled code ... OK
* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
Running ‘tinytest.R’
OK
* checking PDF version of manual ... OK
* DONE
Status: OK
edd#rob:~/git/stackoverflow/73405262(master)$
I put the tarball here if you want to take it from there.

The class Mock_* was not found in the chain configured namespaces App\Entity [Symfony 5.3][PHPUnit 8.5]

I am trying to write PHPUnit tests for my Symfony 5.3 project with some Repositories mocked with others real.
$ bin/console -v
Symfony 5.3.10 (env: dev, debug: true)
$ bin/phpunit -V
PHPUnit 8.5.19 by Sebastian Bergmann and contributors.
Doctrine\Persistence\Mapping\MappingException: The class 'Mock_SType_b1b7aee4' was not found in the chain configured namespaces App\Entity
/var/www/cir/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/MappingException.php:23
/var/www/cir/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/Driver/MappingDriverChain.php:91
/var/www/cir/vendor/doctrine/doctrine-bundle/Mapping/MappingDriver.php:45
/var/www/cir/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:156
/var/www/cir/vendor/doctrine/doctrine-bundle/Mapping/ClassMetadataFactory.php:19
/var/www/cir/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:382
/var/www/cir/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:85
/var/www/cir/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:251
/var/www/cir/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:293
/var/www/cir/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1789
/var/www/cir/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1764
/var/www/cir/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:629
/var/www/cir/src/Component/User/UserManager.php:1059
/var/www/cir/src/Component/User/UserManager.php:383
/var/www/cir/tests/Component/User/Manager/Creation/ATCPTest.php:146
I have created a KernelTestCase where:
$sTypeRepository = $this->createStub(STypeRepository::class);
So I tried to use the actual Repository:
$sTypeRepository = static::getContainer()->get('doctrine')->getRepository(SType::class);
and I get error:
TypeError: Argument 2 passed to App\Component\User\UserManager::__construct() must be an instance of App\Repository\STypeRepository, instance of Doctrine\ORM\EntityRepository given, called in /var/www/cir/tests/Component/User/Manager/Creation/ATCPTest.php on line 122
/var/www/cir/src/Component/User/UserManager.php:214
/var/www/cir/tests/Component/User/Manager/Creation/ATCPTest.php:122
Other tests run fine for other mocked classes, like here:
$this->SUserRoleRepository = $this->createStub(SUserRoleRepository::class);
So, why do I get a MappingException or TypeError, respectively, for some repositories but not others? Perhaps help me to understand the errors better? Thanks!
The issue was that my SType entity did not have an accurate #ORM\Entity(...) annotation. I had:
/**
* SType.
*
* #ORM\Table(name="s_type", indexes={#ORM\Index(name="idx_s_type_1", columns={"type_group"}), #ORM\Index(name="idx_s_type_2", columns={"code"})})
* #ORM\Entity
*/
class SType {}
Needed the repositoryClass relation:
/**
* SType.
*
* #ORM\Table(name="s_type", indexes={#ORM\Index(name="idx_s_type_1", columns={"type_group"}), #ORM\Index(name="idx_s_type_2", columns={"code"})})
* #ORM\Entity(repositoryClass="App\Repository\STypeRepository")
*/
class SType {}

Generate Moodle exercises with images using the exams package

I am using the exams package, I want to generate some Moodle exercises with it which incorporate some images. Although using this code in a *rmd file:
```{r, echo = FALSE, results = "hide"}
exams::include_supplement("ae1_2_1e2.png")
```
Question
========
Question text:
\centering
$\includegraphics[width=0.55 \textwidth] {ae1_2_1e2.png}$
Answerlist
----------
* answer a
* answer b
* answer c
* answer d
Solution
========
Answerlist
----------
* True
* False
* False
* False
Meta-information
================
exname: ae1_2_1
extype: schoice
exsolution: 1000
exshuffle: 4
Which produces this results in Moodle:
Another question is, does the package allows to use images as options in the Moddle exercises (i.e. schoice)? Example:
```{r, echo = FALSE, results = "hide", out.width = "20%"}
exams::include_supplement(c("ae4_3_2_1e2.png","ae4_3_2_3e4.png"))
```
Question
========
For a right-tailed test (using the Neyman-Pearson criteria), which would be the rejection region for a t-test (independent samples)?
Answerlist
----------
* \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$.
* \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$.
SOLVED
You cannot have the same image file in different options. If you want to use the same image, you have to produce a copy of it and use a different name.
So the new code:
```{r, echo = FALSE, results = "hide", out.width = "20%"}
exams::include_supplement(c("ae4_3_2_1.png","ae4_3_2_3.png","ae4_3_2_2.png","ae4_3_2_4.png"))
```
Question
========
For a right-tailed test (using the Neyman-Pearson criteria), which would be the rejection region for a t-test (independent samples)?
Answerlist
----------
* \ ![](ae4_3_2_1.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$.
* \ ![](ae4_3_2_2.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_3.png){width=20%} $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_4.png){width=20%} $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$.
Meta-information
================
exname: RTT
extype: schoice
exsolution: 0001
exshuffle: TRUE
And the result (thanks to #Achim):
When you are using R/Markdown (.Rmd) exercises, then Markdown should be used for including static graphic files:
Question text:
\
![](ae1_2_1e2.png)
Inclusion of LaTeX is possible but only for mathematical equations - putting the \includegraphics{} into math mode is not appropriate here.
An example template that includes a static PNG file is available at: http://www.R-exams.org/templates/Rlogo/. Note that the backslash embeds the image in such a way that no caption is added here. See the pandoc documentation for more details: https://pandoc.org/MANUAL.html#images
Below is also a worked example (mice.Rmd) for images as answers in Moodle, restricting the width to the same value for all images:
```{r, include=FALSE}
download.file("https://i.pinimg.com/originals/f7/7b/17/f77b173fb104d07130697c9d3a024e75.png", "a.png")
download.file("https://upload.wikimedia.org/wikipedia/en/thumb/f/fe/Speedy_Gonzales.svg/1200px-Speedy_Gonzales.svg.png", "b.png")
download.file("https://www.disneyclips.com/images3/images/basil-great-mouse-detective.png", "c.png")
```
Question
========
Which of these cartoon mice belongs to the Disney franchise?
Answerlist
----------
* ![](a.png){width=20%}
* ![](b.png){width=20%}
* ![](c.png){width=20%}
Meta-information
================
exname: Mice
extype: schoice
exsolution: 001
exshuffle: TRUE
In Moodle this is rendered in the following way:

How do you set MAILTO in crontab programmatically?

I am currently creating my crontab programmatically as follows:
echo "* * * * * run_some_job" | crontab -
Additionally, I want to programmatically set the MAILTO address, is that possible? That is, without the interactive editor crontab -e
crontab can take multi line input.
So, give two lines, for example this way:
> (echo "MAILTO=xxx#yyy.org"; echo "* * * * * run_some_job") | crontab -
> crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (- installed on Fri Jan 24 16:26:20 2020)
# (Cronie version 4.2)
MAILTO=xxx#yyy.org
* * * * * run_some_job
And programmatically (because of unix-tag, C example):
#include <stdio.h>
void main()
{
FILE* file = popen("/usr/bin/crontab -", "w");
if (file)
{
fprintf(file, "MAILTO=xxx#yyy.org\n");
fprintf(file, "10 11 * * * run_some_job\n");
pclose(file);
}
}
result:
> gcc main.c
> ./a.out
> crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (- installed on Fri Jan 24 16:35:03 2020)
# (Cronie version 4.2)
MAILTO=xxx#yyy.org
10 11 * * * run_some_job

Warning: include(1) [function.include]: failed to open stream

I have this massage at the top of the wordpress site and can`t enter in admin area!
Warning: include(1) [function.include]: failed to open stream: No such
file or directory in /home/pharmme/public_html/bphsa.bg/wp-config.php
on line 21
Warning: include() [function.include]: Failed opening '1' for
inclusion (include_path='.:/usr/local/php52/pear') in
/home/pharmme/public_html/bphsa.bg/wp-config.php on line 21
What is the problem?
?php
/**
* The*/include /* base configuration for WordPress
*
*
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* #link https://codex.wordpress.org/Editing_wp-config.php
*
* #package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'pharmme_wp573'); <--- line 21
The second line is the problem.
* The*/include /* base configuration for WordPress
should be:
* The include base configuration for WordPress
Now PHP thinks it the include function. Which is causing the error.

Resources