Open adamding opened 10 years ago
The 50 character limit is hardcoded currently. A quick fix would be to navigate to libraries/widgets/quiz/js/quiz-app.js
and modify this line.
Thanks. However, when I changed this line, the behaviour did not change. It seems like still the old quiz-app.js applies. I restarted R, and then load library(slidify) again. Nothing changes. Do I need to do something else to force compilation using the updated quiz-app.js?
Did you modify the quiz-app.js
in the libraries/widgets/quiz/js
folder in your slide directory? I presume you are running using mode: selfcontained
.
Yes. On my machine, there is only one quiz-app.js in the directory R\win-library\3.0\slidifyLibraries\libraries\widgets\quiz\js
The mode is selfcontained. My index.Rmd file is as following
title : Self-Check Questions (ungraded) subtitle : Random sampling from distributions author : Aidong Adam Ding job : Made using Slidify in R. (Click mouse then right arrow key for next slide.) framework : io2012 # {io2012, html5slides, shower, dzslides, ...} highlighter : highlight.js # {highlight.js, prettify, highlight} hitheme : solarized_dark # widgets : [mathjax, quiz, bootstrap] # {mathjax, quiz, bootstrap} mode : selfcontained # {standalone, draft} knit : slidify::knit2slides --- &submitcompare1
Write the R command that sample 500 values randomly form the Chi-square distribution with 7 degrees of freedom, and store in variable y.
*\ .hint To generate data from the distribution, using the routines start with "r".
*\ .explanation y<-rchisq(500,df=7)
I did not mean for you to change the quiz-app.js
file inside slidifyLibraries
. If you used the selfcontained mode, you will find a libraries
folder in your slide directory and you can navigate to quiz-app.js
within that directory.
Let me know if you can find it. This modification should work.
Thanks, that works now on my machine. However, when I published to Rpubs, the published one still requires 50 characters (my local testing only need 5 characters now).
I used the command publish('SelfCheck4.1.1',host="rpubs") to get its published to http://rpubs.com/adamding/SelfCheck4-1-1
Is there some need to specify more dependence when publishing?
That makes sense, since when you publish to RPubs, you are linking to js/css assets on the CDN, which have not been modified. To make this work, I would recommend that you publish to github
instead of rpubs
.
Push your entire slide folder to a gh-pages branch of github and serve it from github. Slidify has an option to publish to github
, but requires you have SSH access to github set up properly. You could also do it manually using the github app.
Another option is to do the following.
slidifyLibraries3
.quiz-app.js
in the cloned repo.lib_cdn: "http://slidifylibraries3.googlecode.com/git/inst/libraries"
in YAML front matter.This essentially serves the js/css assets from the cloned version of slidifyLibraries
, and hence allows you to work with custom changes.
The next time I am working on slidifyLibraries
, I will make this option configurable.
Another option is to copy your slide folder to https://www.bitballoon.com/, which allows you to host static web pages easily. Note that the same should work if you copy your slide folder to a public dropbox folder.
Well, actually I am having trouble publishing to github, and thus was using Rpubs.
I followed your instruction on publishing to github. Every files seem to get to the repo on github correctly. However, they do not appear when using link: http://adamding.github.io/SelfCheck4.1.1 Just get the 404 page saying there is no such page. I can see every file under https://github.com/adamding/SelfCheck4.1.1/tree/gh-pages
(It is not just this project, I was not able to setup any project correctly to gitHub and used Rpubs instead. I did not mean to bother you with troubleshooting with my gitHub, but is there some simple stuff I am missing? )
I am wondering if it has something to do with the periods in the repository name. Can you change that and check. Given that you are able to get the files on to a gh-pages branch, I am sure there is just some trivial detail to be fixed.
To troubleshoot, I want you to do the following.
temp-test
. DO NOT initialize it with a README.library(slidify)
author('temp-test')
publish(".", repo = "temp-test", username = "adamding")
If this works, you should be able to view your deck at
http://adamding.github.io/temp-test
Let me know how this works.
Actually, I was not able to get any project set up correctly, so it is not the periods in the repository name. (I used something simple like interactive before and never got published correctly.)
Anyhow, I tried your commands:
library(slidify) author('temp-test') Creating slide directory at temp-test... Finished creating slide directory... Switching to slide directory... Opening slide deck... publish(".", repo = "temp-test", username = "adamding") Error in publish_deck(...) : unused argument (".")
So I used
publish(repo = "temp-test", username = "adamding") Initializing Git Repo Checking out gh-pages branch... Adding .nojekyll to repo Publishing deck to adamding/temp-test You can now view your slide deck at http://adamding.github.com/temp-test Warning messages: 1: running command 'git init' had status 127 2: running command 'git commit --allow-empty -m 'Initial Commit'' had status 127 3: running command 'git checkout -b gh-pages' had status 127 4: running command 'git add .' had status 127 5: running command 'git commit -a -m "publishing deck"' had status 127 6: running command 'git push git@github.com:adamding/temp-test gh-pages' had status 127
This actually did not publish correctly, and just lead me to the 404 page at http://adamding.github.io/temp-test
And I can see that the repo on github.com is in fact empty. (In fact the "publish" procedure in R never worked for me on github. I used the GitHub interface to put the repo into github.com instead.) My problem is more low level than Slidify. Just could not seem to get the publish to github working at all.
Okay. I believe for some reason your RStudio is unable to detect git
. Here is a workaround I want you to try.
Step 1: Create a fresh slide deck
library(slidify)
author("temp-test")
slidify("index.Rmd")
Step 2: Initialize Git Repo with Github-Pages Branch
Execute the following from the command line.
git init
git commit --allow-empty -m 'Initial Commit'
git checkout -b gh-pages
Step 3
Now use your github client to push to github. Step 2 is important, since by default the github client would only set it up as master which is not deployable as html pages.
Let me know if you find some success with this.
I will figure out an alternate workflow that uses RStudio all the way. Maybe that might be easier.
Can you try system('which git')
from your R console and tell me what it returns?
Thanks a lot. The instructions with "step 2" above do make this work. (I also need to manually create the "gh-pages" branch on the github client.) So this solves the issue. However, I would appreciate if you have any idea why the publish function does not work properly on my machine: The
system('which git')
command just results in some warning messages
Warning message: running command 'which git' had status 127
Well, the publish
functions calls git
using the system
command. RStudio
is unable to find the path to your git
executable. I am not sure how exactly to solve this.
If you ran Step 2, then when you commit using your github client, it should automatically be in the gh-pages branch. I am not sure why you are having to create the gh-pages branch manually.
And just to make sure, you are using the Github Desktop Client right? Mac or Windows?
Yes. I am using the Github for Windows.
It seems that git is indeed found in Rstudio with the system command. However, something was wrong so that there is always the "status 127" warning message.
publish('SelfCheck3.4.1','adamding') Adding .nojekyll to your repo... Publishing deck to adamding/SelfCheck3.4.1 You can now view your slide deck at http://adamding.github.com/SelfCheck3.4.1 Warning messages: 1: running command 'git add .' had status 127 2: running command 'git commit -a -m "publishing deck"' had status 127 3: running command 'git push git@github.com:adamding/SelfCheck3.4.1 gh-pages' had status 127
How are you confirming that git
is found by RStudio? If running system('which git')
is resulting in an error, then it surely means that it is not recognizing the path to the git executable.
I thought that the warning message "status 127" meant that it found git, but had some issues. So actually that meant it not finding git. So that is the issue: Rstudio can not find git. Then that would explain why we need the workaround above.
Is there a way to allow the student to see the correct answer in "submit and compare" question by submitting an answer shorter than 50 characters?
I am asking students for some simple short R commands. But they can not see the correct answer, has to first put a lot garbage characters to get to the 50 characters limit?
(I am not using multitext type, since that one seems can only judge numerical answer? If multitext accepts non-numerical ASCII, that would also solve my problem.)