Blogdown/Xaringan does not work after using chakra option - r-markdown

I followed the installation process for Xaringan explained by Tim Mastny. Everything worked smoothly and I could produce my first slideshow.
To make the slides work offline, I followed the tips by Yihui Xie. The download with xaringan::summon_remark() went fine and generated the libs folder in my project directory with the file remark-latest.min.js in it. But when I added the chakra option chakra: libs/remark-latest.min.js to the YAML header as describe in the Xaringan slideshow documenation, and called serve_site(), the slideshow did not work anymore.
Instead of the previous working slideshow I got a small window on the left top of my screen which contains the source text of my slideshow. I have seen this window in other occassions as well. For instance in some links from the remark.js website to demo slideshows, e.g. here.
I installed a complete new blogdown website with the Xmin theme and did the installation procedure from scratch. I used the R Markdown "Nina Presentation" template and added just the one chakra line. I received the same result. Just the small window.
I used Google Chrome but tested also with Safari and Firefox with the same result. Has anyone any idea what could be the problem or what I could try next?
My sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.1 backports_1.1.2 bookdown_0.7 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6
[7] tools_3.5.1 yaml_2.1.19 Rcpp_0.12.17 stringi_1.2.4 rmarkdown_1.10 blogdown_0.8
[13] knitr_1.20 xfun_0.3 stringr_1.3.1 digest_0.6.15 evaluate_0.11

Found the problem: you summoned remark.js to libs/ in your blogdown project's root directory. Instead, you should summon remark.js to static/slide/libs/ using:
xaringan::summon_remark(to = "static/slide/libs")
Explaination: Hugo copies all files under "static/" to the root of the compiled website.
Make sure libs/ sits together with your xaringan source Rmd somewhere under static/ subdirectory, like yours: static/slide/libs, so that the xaringan can find files they need.
And that remark-latest-min.js should be in static/slide/libs/ too.

Related

cannot seem to get boost and quantlib directories to align

I have tried a number of different methods to try and get QuantLib to work on my windows machine. I would prefer to have QuantLib running in eclipse (so if anybody has any help in this direction I would be much appreciated!).
However, most online tutorials give their instructions using Visual Studio so I decided to try and get it working using this. I have followed this tutorial to a T and I still cannot get it working.
I have a folder looking like the following:
(My computer >> Documents >> cplusplus)
Next I enter the "QuantLib" folder and open the file "QuantLib.sln" where I enter visual studio.
I highlight the two projects in the solutions folder and select the wrench / properties tab
Which brings me to this tab:
Note that Todas las config = all config and Todas las plataformas = all platforms from minute 5.55 of the Youtube video.
I then go to "Directorios de VC++" - "VC Directories" and apply the following settings:
I then click "build /Compilar" -> build solution
I get the following error:
So how can I match Boostup with Quantlib and C++ - I like eclipe but at this stage I just want to understand the quantlib package
EDIT:
In the video the screen shot is the following:
Where I have in the intermediate directory the following: .\build\$(qlCompilerTag)/\$(Platform)\$(Configuration)\ which is different to the video. Additionally they have the following which includes an (includePath) addition to the include directoies tab:
Just some additional observations I noticed...
EDIT 2: I have also modified the directorios intermedio line to match the Youtube videos results. It was set at some default value beforehand. (i.e. qlCompilerTag)/ was something differnet.
EDIT 3:
I changed the directories:
and get this ouput:
EDIT 4:
(removed the underscore)
With the following output:
##### EDIT (Following the official documentation)
I think I managed to solve the main issue I was having but now I am getting a new issue.
When I build the solution I get the following error:
When I go to the folder C:\Users\Matt\Documents\cplusplus\boost_1_73_0\lib64-msvc-14.1 I locate the following files.
So Visual Studio is looking for the wrong files. What have I done wrong here? I downloaded the 64 bit version of boost? Is there a 32 bit version?

Using custom fonts on shinyapps.io

I would like to use a custom font in my shiny app (on plots) on shinyapps.io. I have my Roboto-Regular.ttf in the ./www/ directory. And this is the upper portion of my app.R file:
dir.create('~/.fonts')
system("chmod +x ./www/Roboto-Regular.ttf")
system("cp ./www/Roboto-Regular.ttf ~/.fonts/")
system('fc-cache -f -v ~/.fonts/')
system('fc-match Roboto')
library(ggplot2)
library(shiny)
library(shinythemes)
library(extrafont)
font_import(pattern="Roboto",prompt=FALSE)
loadfonts()
print(fonts())
Upon deploying the app, I end up with an error that looks like this:
Registering fonts with R
Scanning ttf files in /usr/share/fonts/, ~/.fonts/ ...
Extracting .afm files from .ttf files...
/home/shiny/.fonts/Roboto-Regular.ttfWarning in gzfile(dest, "w") :
cannot open compressed file '/opt/R/3.5.1/lib/R/library/extrafontdb/metrics/Roboto-Regular.afm.gz', probable reason 'Permission denied'
Error in value[[3L]](cond) : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
Does anyone see what might be wrong?
After a bit of struggle I found an even simpler solution that works on shinyapps.io:
Here we go:
Place custom font in www directory: e.g. IndieFlower.ttf from here
Follow the steps from here
This leads to the following upper part of the app.R file:
dir.create('~/.fonts')
file.copy("www/IndieFlower.ttf", "~/.fonts")
system('fc-cache -f ~/.fonts')
Since Linux looks into the .fonts directory to search fonts, you don't need the extrafont package, but you can directly use those fonts like:
ggplot(mapping=aes(x=seq(1,10,.1), y=seq(1,10,.1))) +
geom_line(position="jitter", color="red", size=2) + theme_bw() +
theme(text=element_text(size = 16, family = "IndieFlower"))
This is the answer I received from RStudio regarding this. I haven't tested this out myself.
Hi,
Our developer was able to advise this is due to a possibly unfortunate design choice made when they created extrafont and the associated extrafontdb package. The extrafont font database is stored in the extrafontdb package directory -- that's essentially all that the extrafontdb package is used for.
This means that the extrafontdb directory needs to be user-writable. If the user installs the package, this will work fine, but if root installs the package (as is the case on shinyapps.io), then it won't work.
One potential workaround is to install the extrafontdb package to library that is in subdirectory of the app.
To do it: create an r-lib/ subdir, and download the extrafontdb source package there:
dir.create('r-lib')
download.file('https://cran.r-project.org/src/contrib/extrafontdb_1.0.tar.gz','r-lib/extrafontdb_1.0.tar.gz')
When deployed, the app will include this r-lib/ subdirectory and the extrafontdb source package.
Then, at the top of the app, install the extrafontdb package from the source package, into the r-lib directory.
.libPaths(c('r-lib', .libPaths()))
install.packages('r-lib/extrafontdb_1.0.tar.gz',type = 'source',repos = NULL)
They deployed an app on shinyapps.io that does the extrafontdb installation, and it works fine. The libpath is set so so that install.packages() will install from the provided source package to the r-lib/ subdirectory of the app.
Please let us know if you're able to implement the above or have any additional questions.
Thanks,
Adding an alternative answer to symbolrush's answer which I found did not work. Here was the code I used initially:
# Add fonts to shiny linux server
if (Sys.info()[['sysname']] == 'Linux') {
dir.create('~/.fonts')
fonts = c(
"www/IBMPlexSans-Regular.ttf",
"www/IBMPlexSans-Bold.ttf",
"www/IBMPlexSans-Medium.ttf"
)
file.copy(fonts, "~/.fonts")
system('fc-cache -f ~/.fonts')
}
# Load fonts and set theme
font_paths("fonts")
font_add("IBMPlexSans", regular = "IBMPlexSans-Regular.ttf")
font_add("IBMPlexSans-Bold", regular = "IBMPlexSans-Bold.ttf")
font_add("IBMPlexSans-Medium", regular = "IBMPlexSans-Medium.ttf")
showtext_auto()
The bizarre thing is that the first instance of the app on shinyapps.io worked, including the custom fonts. However when the app went to sleep and was opened a second time, I get this error in the log:
Error in value[[3L]](cond) : font file not found for 'regular' type
I was never able to debug why this was the case, but I tried a simpler solution that has worked perfectly so far. I moved my fonts to a /font folder in the app folder (I don't think using the /www folder is necessary) and added the /font folder using path_folder():
library(showtext)
# Load fonts and set theme
font_paths("fonts")
font_add("IBMPlexSans", regular = "IBMPlexSans-Regular.ttf")
font_add("IBMPlexSans-Bold", regular = "IBMPlexSans-Bold.ttf")
font_add("IBMPlexSans-Medium", regular = "IBMPlexSans-Medium.ttf")
showtext_auto()
I hope this helps anyone who is having problems with their app not running after the first instance, as I could not find the same situation anywhere on stackoverflow.

Trouble getting a Qt Reference Document program to work(Minehunt)... its just blank when run... no errors though?

http://docs.huihoo.com/qt/4.7/demos-declarative-minehunt.html
When I build and run... I just get a blank white rectangle... game is MineHunt.
The source code is in the URL. I created files and copied and pasted into Qt Creator 4.7.
Running in Linux.
No need to downvote. Deploying qml apps does not seem to be easy for beginners. jdl, I don't know if I can help you. Currently I am only on Linux. But what I did:
I copied the whole folder minehunt in my destination folder (/tmp/mine). When I ran qmake I got:
WARNING: Include file
/tmp/mine/helper/qmlapplicationviewer/qmlapplicationviewer.pri not
found
So I also copied the examples/declarative/helper folder into /tmp/mine.
Looked like this:
/tmp
/mine
/minehunt
/helper
Then I changed into minhunt, did 'qmake' and 'make'. A few seconds later I had a working minehunt binary in /tmp/mine/minehunt/.
I'll try tomorrow the Windows build.
Edit: Ok, tried now under Windows 7. Qt4.
QtCreator opened.
Project ...qt\demos\declarative\minehunt\minehunt.pro
loaded. Normally in release mode compiled. No problem. A file minehunt.exe was created in ....qt\demos\declarative\minehunt\release. Started: White screen. Exactly as you described it. In ...qt\demos\declarative\minehunt I found a folder 'qml'. I moved this folder and the minehunt.exe into another folder (myMineFolder). Simulating a simple deployment this way. Clicked on minehunt.exe -> worked like a charm.
So my folder layout:
myMineFolder
qml
minehunt.exe
But of course, I have set my PATH variable correctly to my Qt installation.

TFS Build/MSBuild 2010 bin folder auto redirection to binaries folder not redirecting all projects

I have TFS2010 build workflow that compiles our solution which contains ~100 projects. Compilation is successful, tests run as expected etc. The issue I have relates to the redirection of the bin output folders.
As I understand it, the TFS2010 build activity for MSBuild redriects your bin folder output to a binaries folder at the the same level as the Sources and TestResults folders as shown below.
C:\Builds\1\MyPlatform\MyPlatform Main - CI\Binaries
C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources
C:\Builds\1\MyPlatform\MyPlatform Main - CI\TestResults
This redirection of the bin folder works as expected for 80% of my projects. The remaining projects bin folders appear unredirected in their standard location as if I was compiling using VS on a local machine.
To illustrate, when working as expected...
Source path:-
C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources\Source\MyPlatform.Modules.Interaction.Specs
Bin output succesfully redirected to the binaries folder :-
C:\Builds\1\MyPlatform\MyPlatform Main - CI\Binaries\Mixed Platforms\Debug\MyPlatform.Modules.Interaction.Specs
and now a non redirected example...
Source path :-
C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources\Source\MyPlatform.AddIns.Framework.Services
Bin output not redirected and remains in the source folder:-
C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources\Source\MyPlatform.AddIns.Framework.Services\bin\Debug
To clarify, this is not an issue with the drop location but the redirection of bin output to the intermediate Binaries folder. The copy to my final drop location works as expected, all be it minus the projects whos bin output wasn't initially redirected to the binaries folder.
I've had a good look around and all information I've seen points towards customising the output to the binaries folder or relates to the drop location. Having read this, I can't see anything that should cause some projects to ignore the default redirection.
Most of my projects are standard .NET 4 class libraries although there are a couple of c++ projects and a WIX installer. I initially though it would be related to this difference but this problem is occuring on several .NET 4 class libraries that have identical settings to all the other projects that redirect successfully.
One more point about the example paths above. I've substituted "My" for actual project prefixes but otherwise paths are as used.
Does anyone know why some projects bin output might not be redirected?
Any help you can offer would be appreciated.
Thanks
H
Continued investigations and a shove in the right direction from Dharmesh Shah on MSDN revealed this was all related to the "TeamBuildOutDir" setting. More details can be found here http://blogs.msdn.com/b/jimlamb/archive/2010/04/13/customizableoutdir-in-tfs-2010.aspx

How to statically link Qt image formats plugins for WebKit?

I need a QWebView to display images, instead of the question marks it currently displays.
I have found that i need to link some image plugins to my application to do so. I have researched this problem for a while now, and I haven't found a satisfying solution.
I followed these steps:
1) I have added in my project folder and the folder in which the application is compiled a folder named: imageformats/ in which i have put these folowing plugins: libqgif.so and libqjpeg.so
2) I have added to my project configuration file (.pro) this:
QTPLUGIN += qjpeg \
qgif
3) And I have added to the .cpp containg the main function of my project this:
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qgif)
And i get the following errors:
main.cpp:(.text.startup+0xce): undefined reference to `qt_plugin_instance_qjpeg()'
main.cpp:(.text.startup+0xda): undefined reference to `qt_plugin_instance_qgif()'
I also tried changing the directory to plugins/imageformats/, but it made no difference whatsoever.
For me (on Ubuntu 12.04), I didn't have libjpeg and dev headers installed.
$ sudo apt-get install libjpeg62-dev
(which will also install libjpeg62 if you don't have it).
After this, my QTWebView showed jpeg images without any extra modifications.