How to include TikZ images in R/exams exercises? - r-markdown

The R/exams package supports including TikZ graphics using its function include_tikz(), e.g., as shown in the automaton and logic exercises shipped with the package.
After getting include_tikz() to work for these exercises (see: Why are TikZ graphics rendered with exams2pdf but not with exams2moodle?) I tried to create my own exercise. However, so far this does not work yet. My code is:
```{r datos1, echo = FALSE, results = "hide"}
options(tinytex.verbose = TRUE)
options(scipen=999)
knitr::opts_chunk$set(echo = TRUE)
##opts_chunk$set(fig.cap="")
library(exams)
library(magick)
questions<-solutions<-explanations<-NULL
questions[1]<-paste("Graph 1.")
solutions[1]<-TRUE
explanations[1]<-"."
questions[2]<-paste("Graph 2.")
solutions[2]<-FALSE
explanations[2]<-"."
questions[3]<-paste("Graph 3.")
solutions[3]<-FALSE
explanations[3]<-"."
questions[4]<-paste("Graph 4.")
solutions[4]<-FALSE
explanations[4]<-"."
orden<-sample(1:4)
questions<-questions[orden]
solutions<-solutions[orden]
explanations<-explanations[orden]
graf01<-'
\\definecolor{uuuuuu}{rgb}{0.26,0.26,0.26};
\\definecolor{zzttqq}{rgb}{0.6,0.2,0};
\\definecolor{ududff}{rgb}{0.30,0.30,1};
\\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\\clip(-0.1,-0.1) rectangle (5,5);
\\fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10] (0,0) -- (4.68,-0.02) --
(4.7,4.66) -- (0.02,4.68) -- cycle;
\\draw (0.99,3.80) node[anchor=north west] {\\textbf{49}};
\\draw (3.44,3.80) node[anchor=north west] {\\textbf{12}};
\\draw (2.22,1.74) node[anchor=north west] {\\textbf{14}};
\\draw (2.22,3.00) node[anchor=north west] {\\textbf{5}};
\\draw (2.22,3.96) node[anchor=north west] {\\textbf{6}};
\\draw (1.40,2.53) node[anchor=north west] {\\textbf{8}};
\\draw (3.00,2.53) node[anchor=north west] {\\textbf{9}};
\\draw (3.85,1.39) node[anchor=north west] {\\textbf{}};
\\draw (0.35,4.57) node[anchor=north west] {\\textbf{DH}};
\\draw (3.97,4.57) node[anchor=north west] {\\textbf{CA}};
\\draw (2.31,0.72) node[anchor=north west] {\\textbf{R}};
\\draw [line width=2pt] (1.76,3.08) circle (1.3cm);
\\draw [line width=2pt] (3.05,3.13) circle (1.3cm);
\\draw [line width=2pt] (2.45,1.98) circle (1.3cm);
\\draw [line width=2pt,color=zzttqq] (0,0)-- (4.68,-0.02);
\\draw [line width=2pt,color=zzttqq] (4.68,-0.02)-- (4.7,4.66);
\\draw [line width=2pt,color=zzttqq] (4.7,4.66)-- (0.02,4.68);
\\draw [line width=2pt,color=zzttqq] (0.02,4.68)-- (0,0);
\\begin{scriptsize}
\\draw [fill=ududff] (0,0) circle (2.5pt);
\\draw [fill=ududff] (4.68,-0.02) circle (2.5pt);
\\draw [fill=uuuuuu] (4.7,4.66) circle (2.5pt);
\\draw [fill=uuuuuu] (0.02,4.68) circle (2.5pt);
\\end{scriptsize}
\\end{tikzpicture}
'
```
Question
========
An auto dealer sold 53 cars in a month; 33 of them had hydraulic steering (DH); 21 were
automatic gearboxes (CA); and 38 had radius (R); 4 had hydraulic steering, automatic gears
and radio; 3 had power steering and automatic shifts, but they had no radio; 13 had
automatic gears and radio, but did not have hydraulics and, 15 had hydraulics and radio, but
did not have automatic gears.
The graph that represents the information of the sale in the agency is
Graph 1:
```{r, echo = FALSE, results = "asis"}
include_tikz(graf01, name = "graf01", markup = "markdown",library = c("arrows"))
```
```{r questionlist, echo = FALSE, results = "asis"}
library(exams)
answerlist(questions, markup = "markdown")
```
In other exercises I have included the source code of this image created in TikZ, but outside the R chunks (from \begin{tikzpicture} to \end{tikzpicture}) so that it works with exams2pdf() (screenshot). But I could not get it to work with exams2moodle().

Essentially your code works and I did not have to make many modifications. What I did:
Omit setting the unnecessary options at the beginning of the initial R code chunk.
Omit the unnecessary semicolons at the end of the regular LaTeX commands in graf01 before the {tikzpicture}.
Add a call to match_exams_device() so that the type of graphic created by TikZ can be in the same format as the graphics created by the R/Markdown code chunks (PNG vs. PDF vs. SVG).
Improve the include_tikz() arguments to use the graphic type from the previous item and to include a fixed width.
Subsequently, the biggest change I made was to modify the Question section so that it is about a single graphic and add a corresponding Meta-information section. Doing so the exercise is self-contained and the complete source code for the file cardealer.Rmd is included at the end of this post. With this the following three commands all work:
exams2pdf("cardealer.Rmd") which renders the TikZ graphic into PDF format.
exams2html("cardealer.Rmd") which renders the TikZ graphic into PNG format.
exams2html("cardealer.Rmd", svg = TRUE) which renders the TikZ graphic into SVG format.
And given that exams2html() works the inclusion in exams2moodle() will also work because this internally also generates the same kind of HTML code. In all versions the output looks something like this:
Source code of cardealer.Rmd:
```{r tikzsource, echo = FALSE, results = "hide"}
typ <- match_exams_device()
graf01 <- '
\\definecolor{uuuuuu}{rgb}{0.26,0.26,0.26}
\\definecolor{zzttqq}{rgb}{0.6,0.2,0}
\\definecolor{ududff}{rgb}{0.30,0.30,1}
\\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\\clip(-0.1,-0.1) rectangle (5,5);
\\fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10] (0,0) -- (4.68,-0.02) -- (4.7,4.66) -- (0.02,4.68) -- cycle;
\\draw (0.99,3.80) node[anchor=north west] {\\textbf{49}};
\\draw (3.44,3.80) node[anchor=north west] {\\textbf{12}};
\\draw (2.22,1.74) node[anchor=north west] {\\textbf{14}};
\\draw (2.22,3.00) node[anchor=north west] {\\textbf{5}};
\\draw (2.22,3.96) node[anchor=north west] {\\textbf{6}};
\\draw (1.40,2.53) node[anchor=north west] {\\textbf{8}};
\\draw (3.00,2.53) node[anchor=north west] {\\textbf{9}};
\\draw (3.85,1.39) node[anchor=north west] {\\textbf{}};
\\draw (0.35,4.57) node[anchor=north west] {\\textbf{DH}};
\\draw (3.97,4.57) node[anchor=north west] {\\textbf{CA}};
\\draw (2.31,0.72) node[anchor=north west] {\\textbf{R}};
\\draw [line width=2pt] (1.76,3.08) circle (1.3cm);
\\draw [line width=2pt] (3.05,3.13) circle (1.3cm);
\\draw [line width=2pt] (2.45,1.98) circle (1.3cm);
\\draw [line width=2pt,color=zzttqq] (0,0)-- (4.68,-0.02);
\\draw [line width=2pt,color=zzttqq] (4.68,-0.02)-- (4.7,4.66);
\\draw [line width=2pt,color=zzttqq] (4.7,4.66)-- (0.02,4.68);
\\draw [line width=2pt,color=zzttqq] (0.02,4.68)-- (0,0);
\\begin{scriptsize}
\\draw [fill=ududff] (0,0) circle (2.5pt);
\\draw [fill=ududff] (4.68,-0.02) circle (2.5pt);
\\draw [fill=uuuuuu] (4.7,4.66) circle (2.5pt);
\\draw [fill=uuuuuu] (0.02,4.68) circle (2.5pt);
\\end{scriptsize}
\\end{tikzpicture}
'
```
Question
========
An auto dealer sold 103 cars in a month that had at least one of the following features:
hydraulic steering (DH), automatic gearbox (CA), radio (R). The following graph displays
how many cars had which combination of features:
```{r, echo = FALSE, results = "asis"}
include_tikz(graf01, name = "graf", format = typ, markup = "markdown",
library = "arrows", width = "5cm")
```
How many cars had all three features?
Meta-information
================
exname: car dealer
extype: num
exsolution: 5

Solved!
Thanks to the tireless accompaniment of Achim Zeileis. I share the corrected piece of code:
graf01<-c("\\definecolor{uuuuuu}{rgb}{0.26,0.26,0.26}",
"\\definecolor{zzttqq}{rgb}{0.6,0.2,0}",
"\\definecolor{ududff}{rgb}{0.30,0.30,1}",
"\\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]",
"\\clip(-0.1,-0.1) rectangle (5,5);",
"\\fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10] (0,0) -- (4.68,-0.02) -- (4.7,4.66) -- (0.02,4.68) -- cycle;",
"\\draw (0.99,3.80) node[anchor=north west] {\\textbf{49}};",
"\\draw (3.44,3.80) node[anchor=north west] {\\textbf{12}};",
"\\draw (2.22,1.74) node[anchor=north west] {\\textbf{14}};",
"\\draw (2.22,3.00) node[anchor=north west] {\\textbf{5}};",
"\\draw (2.22,3.96) node[anchor=north west] {\\textbf{6}};",
"\\draw (1.40,2.53) node[anchor=north west] {\\textbf{8}};",
"\\draw (3.00,2.53) node[anchor=north west] {\\textbf{9}};",
"\\draw (3.85,1.39) node[anchor=north west] {\\textbf{}};",
"\\draw (0.35,4.57) node[anchor=north west] {\\textbf{DH}};",
"\\draw (3.97,4.57) node[anchor=north west] {\\textbf{CA}};",
"\\draw (2.31,0.72) node[anchor=north west] {\\textbf{R}};",
"\\draw [line width=2pt] (1.76,3.08) circle (1.3cm);",
"\\draw [line width=2pt] (3.05,3.13) circle (1.3cm);",
"\\draw [line width=2pt] (2.45,1.98) circle (1.3cm);",
"\\draw [line width=2pt,color=zzttqq] (0,0)-- (4.68,-0.02);",
"\\draw [line width=2pt,color=zzttqq] (4.68,-0.02)-- (4.7,4.66);",
"\\draw [line width=2pt,color=zzttqq] (4.7,4.66)-- (0.02,4.68);",
"\\draw [line width=2pt,color=zzttqq] (0.02,4.68)-- (0,0);",
"\\begin{scriptsize}",
"\\draw [fill=ududff] (0,0) circle (2.5pt);",
"\\draw [fill=ududff] (4.68,-0.02) circle (2.5pt);",
"\\draw [fill=uuuuuu] (4.7,4.66) circle (2.5pt);",
"\\draw [fill=uuuuuu] (0.02,4.68) circle (2.5pt);",
"\\end{scriptsize}",
"\\end{tikzpicture}")
Then the chunk of code to invoke TicZ is:
```{r, echo = FALSE, results = "asis"}
include_tikz(graf01, name = "graf", markup = "markdown",format = typ,library =
c("arrows"),packages = "booktabs",width = "5cm")
```
The format = typ section is declared at the beginning of the code:
typ <- match_exams_device()
Thanks again, Achim. His work is commendable. Hopefully one day I can make contributions as great as yours in this community. Blessings!

Related

How can I store/transfer information from my ShinyApp to a dataframe in my global environment via an action button?

Good afternoon,
I am a beginner creating ShinyApps and I would really appreciate if someone could help me to solve the following problem:
The purpose of the App is to store the information that a football scout fills on the reports.
Every time a scout fills out the different items of the report, I would like to store/transfer this information in a new dataframe on my global environment in R Studio via the action button below called "Guardar". Any idea?
My e-mail is ivandiazramis8#gmail.com for any in inquiry.
Thank you!
library(shinyWidgets)
library(shinydashboard)
library(shinyauthr)
library(shinyjs)
library(sodium)
library(tibble)
library(dplyr)
library(DT)
#----------UI----------
ui <- dashboardPage(title = "Herramienta Scouting TFM", skin = "blue",
dashboardHeader(title = "Herramienta Scouting TFM",
titleWidth = "300px"),
dashboardSidebar(width = "300px",
sidebarMenu(menuItem(text = "Informe Tipo", icon = icon(name = "file-contract", lib = "font-awesome"),
menuSubItem("Informe",
tabName = "Informe_Tipo",
icon = icon("futbol"))))),
dashboardBody(
tabItems(
tabItem(tabName = "Informe_Tipo",
h1("INFORME TIPO"),
br(),
fluidRow(
column(width = 4,
box(title = "INFORMACIÓN DEL SCOUT ",
background = "light-blue",
width = 12),
box(status = "primary",
width = 12,
textInput(inputId = "Scout_1",
label = "Nombre Completo: ",
value = character(0)),
dateInput(inputId = "Fecha_Informe_1",
label = "Fecha de Realización del Informe: ",
value = Sys.Date(),
min = Sys.Date(),
max = Sys.Date(),
weekstart = 1,
language = "es")),
box(title = "INFORMACIÓN DEL JUGADOR ",
background = "light-blue",
width = 12),
box(status = "primary",
width = 12,
selectInput(inputId = "Competicion_1",
label = "Competición: ",
choices = c("Bundesliga 2", "Championship", "Liga Smartbank", "Ligue 2",
"Serie B")),
selectInput(inputId = "Equipo_1",
label = "Equipo: ",
choices = c("Jahn Regensburg", "Dynamo Dresden", "Nürnberg", "Ingolstadt",
"Hamburger SV", "Fortuna Düsseldorf", "Holstein Kiel", "Paderborn",
"Werder Bremen", "Heidenheim", "Darmstadt 98", "Schalke 04",
"Karlsruher SC", "Hannover 96", "Hansa Rostock", "Erzgebirge Aue",
"Sandhausen", "St, Pauli", "Nürnberg II", "Hatayspor", "Borussia Dortmund II",
"Werder Bremen U19", "Fortuna Düsseldorf II", "Schalke 04 II",
"Apollon Smirnis", "Hamburger SV U19", "Karlsruher SC U17", "Antwerp",
"Hallescher FC", "Union Berlin", "Freiburg", "Holstein Kiel II",
"Darmstadt 98 U19", "Verl", "Arminia Bielefeld", "Karlsruher SC U19",
"Vissel Kobe", "Werder Bremen II", "Norwich City", "Schalke 04 U19",
"Ingolstadt U19", "Waldhof Mannheim", "Hannover 96 II", "Mallorca",
"Sheffield United", "Swansea City", "West Bromwich Albion", "Blackburn Rovers",
"Arsenal", "Cardiff City", "Millwall", "Barnsley", "Nottingham Forest",
"Coventry City", "Blackpool", "Peterborough United", "Birmingham City",
"Bristol City", "Preston North End", "Queens Park Rangers", "Hull City",
"Luton Town", "Stoke City U23", "Stoke City", "Middlesbrough",
"Reading", "Derby County", "Middlesbrough U23", "Huddersfield Town",
"Reading U23", "Fulham", "Bournemouth", "Birmingham City U23",
"Swindon Town", "Derby County U23", "Portsmouth", "Guiseley",
"Sheffield United U23", "Cardiff City U23", "Northampton Town",
"Hearts", "Club Brugge", "Chelsea U23", "Nottingham Forest U23",
"Notts County", "West Bromwich Albion U23", "Barnsley U23", "Napoli",
"PAOK", "Grimsby Town", "Cesena", "Derby County U18", "Fleetwood Town",
"Accrington Stanley", "Fulham U23", "Hull City U18", "Huddersfield Town B",
"Olympiacos Piraeus", "Lincoln City", "Coventry City U23", "Ipswich Town",
"Shrewsbury Town", "Cheltenham Town", "Swansea City U18", "Portimonense",
"Charlton Athletic", "Hibernian", "Bristol City U23", "Millwall U23",
"Hull City U23", "Aris", "Gillingham", "Pisa", "Blackburn Rovers U23",
"Preston North End U18", "Oxford United", "Sheffield United U18",
"Millwall U18", "Ponferradina", "Girona", "Ibiza", "Burgos",
"Brentford", "Real Zaragoza", "Las Palmas", "Eibar", "Real Sociedad B",
"Huesca", "Leganés", "Alcorcón", "Málaga", "Fuenlabrada", "Sporting Gijón",
"Almería", "Lugo", "Real Oviedo", "Real Valladolid", "Tenerife",
"Cartagena", "Amorebieta", "Mirandés", "Real Sociedad", "Real Sociedad III",
"Las Palmas Atlético", "CD Calahorra", NA, "Sporting Gijón B",
"Tenerife B", "Cartagena B", "Girona II", "Valladolid Promesas",
"Getafe", "Real Oviedo Vetusta", "Málaga CF U17", "Alcorcón B",
"Racing Santander", "Fuenlabrada B", "Cádiz", "Elche", "Leganés B",
"Huesca B", "Dnipro-1", "Charlotte Independence", "Deportivo Alavés",
"Valencia", "Real Zaragoza B", "Barcelona", "Mirandés B", "Sabadell",
"Dunkerque", "Pau", "Young Boys", "Ajaccio", "Grenoble", "Dijon",
"Nancy", "Auxerre", "Guingamp", "Paris", "Bastia", "Valenciennes",
"Nîmes", "Rodez ", "Toulouse", "Nancy II", "Le Havre", "Sochaux",
"Niort", "Quevilly Rouen", "Amiens SC", "Caen", "Guingamp II",
"Le Havre U19", "Nîmes II", "Rizespor", "Dijon U19", "Lecce",
"Caen II", "Brescia", "Lech Poznan", "Besiktas", "Parma", "Paris II",
"Famalicão", "Dunkerque II", "Manisa BBSK", "Niort II", "Kayserispor",
"Ajaccio U19", "Quevilly Rouen II", "Dijon II", "Paris U19",
"Bayer Leverkusen", "Le Havre U17", "Nancy U18", "Paris U17",
"Spezia", "Warta Poznan", "Montpellier", "Valenciennes U19",
"U Craiova 1948", "Valenciennes II", "Sochaux U19", "Cosenza",
"Ternana", "Reggina", "Benevento", "SPAL", "Alessandria", "Como",
"Ascoli", "Cittadella", "Monza", "Frosinone", "Pordenone", "Crotone",
"Perugia", "Cremonese", "Vicenza", "Parma U19", "Renate", "Frosinone U19",
"Vålerenga", "ACN Siena", "Reggina U17", "Carrarese", "Salernitana",
"Imolese", "SPAL U19", "Pordenone U17", "Pisa U19", "Triestina",
"Pordenone U19", "Yeni Malatyaspor", "FeralpiSalò", "Vicenza U19",
"Alessandria U19", "Reggina U19", "Empoli", "Ascoli U19", "Crotone U19",
"Cosenza U19", "Benevento U19")),
selectInput(inputId = "Demarcación_1",
label = "Demarcación: ",
choices = c("Portero", "Central", "Lateral", "Mediocentro", "Extremo",
"Delantero")),
selectInput(inputId = "Nacionalidad_1",
label = "Nacionalidad: ",
choices = c("Germany", "Russia", "Austria", "Czech Republic", "Denmark",
"Sweden", "Bosnia and Herzegovina", "Poland", "Spain", "United States",
"Romania", "Finland", "Belgium", "France", "Switzerland", "England",
"Croatia", "Japan", "Slovenia", "Norway", "Mexico", "Serbia",
"Senegal", "Canada", "North Macedonia", "Georgia", "Nigeria",
"Brazil", "Netherlands", "Kosovo", "Curaçao", "Ghana", "Azerbaijan",
"Korea Republic", "Cameroon", "Dominican Republic", "Bulgaria",
"Australia", "Albania", "Luxembourg", "Slovakia", "Italy", "Iceland",
"Gambia", "Ukraine", "Sierra Leone", "Côte d'Ivoire", "Congo DR",
"New Zealand", "Sudan", "Guinea", "Congo", "Wales", "Scotland",
"Estonia", "Montenegro", "Republic of Ireland", "Argentina",
"Northern Ireland", "Portugal", "Saudi Arabia", "Namibia", "Iran",
"Paraguay", "Jamaica", "Guinea-Bissau", "Colombia", "Kenya",
"Cuba", "Angola", "Bermuda", "Ecuador", "Uruguay", "Morocco",
"Equatorial Guinea", "Venezuela", "Peru", "Panama", "Mali", "Egypt",
"Israel", "French Guiana", "Benin", "Gabon", "Cape Verde Islands",
"Guadeloupe", "Tunisia", "Haiti", "Comoros", "Réunion", "Martinique",
"Algeria", "Turkey", "South Africa", "Burkina Faso", "New Caledonia",
"Togo", "Zambia", "Lithuania", "Greece", "Hungary", "Uganda",
"Cyprus", "Moldova", "Madagascar", "Malta", "Chile", "Honduras",
"Latvia")),
selectInput(inputId = "Pie_Dominante_1",
label = "Pie Dominante: ",
choices = c("derecho", "izquierdo", "ambidiestro", NA, "unknown")),
sliderInput(inputId = "Edad_1",
label = "Edad: ",
min = 15,
max = 40,
value = 15,
ticks = FALSE)),
box(title = "INFORMACIÓN DEL PARTIDO ",
background = "light-blue",
width = 12),
box(status = "primary",
width = 12,
textInput(inputId = "Partido_1",
label = "Partido (Equipo Local) (X) - (X) (Equipo Visitante): ",
value = character(0)),
pickerInput(inputId = "Demarcación_Partido_1",
label = "Demarcación en el Partido: ",
choices = c("Portero", "Central", "Lateral", "Mediocentro", "Extremo",
"Delantero"),
selected = character(0),
multiple = TRUE,
options = list(`actions-box` = TRUE)),
sliderInput(inputId = "Minutos_Partido_1",
label = "Minutos Jugados: ",
min = 0,
max = 90,
value = 0,
ticks = FALSE))),
column(width = 8,
box(title = "VALORACIÓN DE LOS ÍTEMS ",
background = "light-blue",
width = 12),
box(title = "Capacidad de jugar con los pies: ",
status = "primary",
width = 12,
radioGroupButtons(inputId = "1_Valoración_1",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE),
textInput(inputId = "1_Comentario_1",
label = "Comentarios: ")),
box(title = "Capacidad de salida en balones divididos: ",
status = "primary",
width = 12,
radioGroupButtons(inputId = "1_Valoración_2",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE),
textInput(inputId = "1_Comentario_2",
label = "Comentarios: ")),
box(title = "Reflejos: ",
status = "primary",
width = 12,
radioGroupButtons(inputId = "1_Valoración_3",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE),
textInput(inputId = "1_Comentario_3",
label = "Comentarios: ")),
box(title = "Dominio del juego aéreo: ",
status = "primary",
width = 12,
radioGroupButtons(inputId = "1_Valoración_4",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE),
textInput(inputId = "1_Comentario_4",
label = "Comentarios: ")),
box(title = "Capacidad de comunicación: ",
status = "primary",
width = 12,
radioGroupButtons(inputId = "1_Valoración_5",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE),
textInput(inputId = "1_Comentario_5",
label = "Comentarios: ")))),
actionBttn(inputId = "boton",
label = "Guardar",
icon = icon("save", lib = "font-awesome"),
style = "jelly",
color = "primary",
size = "md")))
)
)
#----------SERVER----------
server <- function(input, output){}
#----------SHINYAPP----------
shinyApp(ui, server)
Although we could use the function assign to save a df into the .globalEnv. R session will still be busy (a shiny application is running), so the df will appear in the global environment only when the app stops. We can use downloadHandler instead.
Don't worry too much about what map/set_names and exec functions mean, I only used them here to avoid typing manually a data frame one input at a time. e.g data.frame(Nacionalidad_1 = input$Nacionalidad_1)
Now everytime the button "guardar" is pressed, a csv is downloaded that we can later read into R with read_csv.
#vector with the names of all the inputs in the app
inpt_nms <- c(
"sidebarItemExpanded", "1_Valoración_2", "1_Valoración_1",
"Nacionalidad_1", "1_Comentario_4", "1_Valoración_5", "1_Valoración_3",
"Partido_1", "1_Comentario_1", "1_Comentario_2", "Equipo_1",
"1_Comentario_3", "Competicion_1", "Pie_Dominante_1", "Minutos_Partido_1",
"sidebarCollapsed", "Scout_1", "Demarcación_Partido_1", "1_Comentario_5",
"1_Valoración_4", "boton", "Fecha_Informe_1", "Demarcación_1",
"Edad_1"
)
#server code with download handler
server <- function(input, output) {
output$boton <- downloadHandler(
filename = function() {
paste0("df_", input$Scout_1, ".csv")
},
content = function(file) {
map(inpt_nms, ~ input[[.x]]) %>%
set_names(inpt_nms) %>%
{
exec("tibble", !!!.)
} %>%
write_csv(file)
}
)
}
Full app:
library(shiny)
library(shinyWidgets)
library(shinydashboard)
library(shinyauthr)
library(shinyjs)
library(sodium)
library(tidyverse)
library(DT)
inpt_nms <- c(
"sidebarItemExpanded", "1_Valoración_2", "1_Valoración_1",
"Nacionalidad_1", "1_Comentario_4", "1_Valoración_5", "1_Valoración_3",
"Partido_1", "1_Comentario_1", "1_Comentario_2", "Equipo_1",
"1_Comentario_3", "Competicion_1", "Pie_Dominante_1", "Minutos_Partido_1",
"sidebarCollapsed", "Scout_1", "Demarcación_Partido_1", "1_Comentario_5",
"1_Valoración_4", "boton", "Fecha_Informe_1", "Demarcación_1",
"Edad_1"
)
#----------UI----------
ui <- dashboardPage(
title = "Herramienta Scouting TFM", skin = "blue",
dashboardHeader(
title = "Herramienta Scouting TFM",
titleWidth = "300px"
),
dashboardSidebar(
width = "300px",
sidebarMenu(menuItem(
text = "Informe Tipo", icon = icon(name = "file-contract", lib = "font-awesome"),
menuSubItem("Informe",
tabName = "Informe_Tipo",
icon = shiny::icon("futbol")
)
))
),
dashboardBody(
tabItems(
tabItem(
tabName = "Informe_Tipo",
h1("INFORME TIPO"),
br(),
fluidRow(
column(
width = 4,
box(
title = "INFORMACIÓN DEL SCOUT ",
background = "light-blue",
width = 12
),
box(
status = "primary",
width = 12,
textInput(
inputId = "Scout_1",
label = "Nombre Completo: ",
value = character(0)
),
dateInput(
inputId = "Fecha_Informe_1",
label = "Fecha de Realización del Informe: ",
value = Sys.Date(),
min = Sys.Date(),
max = Sys.Date(),
weekstart = 1,
language = "es"
)
),
box(
title = "INFORMACIÓN DEL JUGADOR ",
background = "light-blue",
width = 12
),
box(
status = "primary",
width = 12,
selectInput(
inputId = "Competicion_1",
label = "Competición: ",
choices = c(
"Bundesliga 2", "Championship", "Liga Smartbank", "Ligue 2",
"Serie B"
)
),
selectInput(
inputId = "Equipo_1",
label = "Equipo: ",
choices = c(
"Jahn Regensburg", "Dynamo Dresden", "Nürnberg", "Ingolstadt",
"Hamburger SV", "Fortuna Düsseldorf", "Holstein Kiel", "Paderborn",
"Werder Bremen", "Heidenheim", "Darmstadt 98", "Schalke 04",
"Karlsruher SC", "Hannover 96", "Hansa Rostock", "Erzgebirge Aue",
"Sandhausen", "St, Pauli", "Nürnberg II", "Hatayspor", "Borussia Dortmund II",
"Werder Bremen U19", "Fortuna Düsseldorf II", "Schalke 04 II",
"Apollon Smirnis", "Hamburger SV U19", "Karlsruher SC U17", "Antwerp",
"Hallescher FC", "Union Berlin", "Freiburg", "Holstein Kiel II",
"Darmstadt 98 U19", "Verl", "Arminia Bielefeld", "Karlsruher SC U19",
"Vissel Kobe", "Werder Bremen II", "Norwich City", "Schalke 04 U19",
"Ingolstadt U19", "Waldhof Mannheim", "Hannover 96 II", "Mallorca",
"Sheffield United", "Swansea City", "West Bromwich Albion", "Blackburn Rovers",
"Arsenal", "Cardiff City", "Millwall", "Barnsley", "Nottingham Forest",
"Coventry City", "Blackpool", "Peterborough United", "Birmingham City",
"Bristol City", "Preston North End", "Queens Park Rangers", "Hull City",
"Luton Town", "Stoke City U23", "Stoke City", "Middlesbrough",
"Reading", "Derby County", "Middlesbrough U23", "Huddersfield Town",
"Reading U23", "Fulham", "Bournemouth", "Birmingham City U23",
"Swindon Town", "Derby County U23", "Portsmouth", "Guiseley",
"Sheffield United U23", "Cardiff City U23", "Northampton Town",
"Hearts", "Club Brugge", "Chelsea U23", "Nottingham Forest U23",
"Notts County", "West Bromwich Albion U23", "Barnsley U23", "Napoli",
"PAOK", "Grimsby Town", "Cesena", "Derby County U18", "Fleetwood Town",
"Accrington Stanley", "Fulham U23", "Hull City U18", "Huddersfield Town B",
"Olympiacos Piraeus", "Lincoln City", "Coventry City U23", "Ipswich Town",
"Shrewsbury Town", "Cheltenham Town", "Swansea City U18", "Portimonense",
"Charlton Athletic", "Hibernian", "Bristol City U23", "Millwall U23",
"Hull City U23", "Aris", "Gillingham", "Pisa", "Blackburn Rovers U23",
"Preston North End U18", "Oxford United", "Sheffield United U18",
"Millwall U18", "Ponferradina", "Girona", "Ibiza", "Burgos",
"Brentford", "Real Zaragoza", "Las Palmas", "Eibar", "Real Sociedad B",
"Huesca", "Leganés", "Alcorcón", "Málaga", "Fuenlabrada", "Sporting Gijón",
"Almería", "Lugo", "Real Oviedo", "Real Valladolid", "Tenerife",
"Cartagena", "Amorebieta", "Mirandés", "Real Sociedad", "Real Sociedad III",
"Las Palmas Atlético", "CD Calahorra", NA, "Sporting Gijón B",
"Tenerife B", "Cartagena B", "Girona II", "Valladolid Promesas",
"Getafe", "Real Oviedo Vetusta", "Málaga CF U17", "Alcorcón B",
"Racing Santander", "Fuenlabrada B", "Cádiz", "Elche", "Leganés B",
"Huesca B", "Dnipro-1", "Charlotte Independence", "Deportivo Alavés",
"Valencia", "Real Zaragoza B", "Barcelona", "Mirandés B", "Sabadell",
"Dunkerque", "Pau", "Young Boys", "Ajaccio", "Grenoble", "Dijon",
"Nancy", "Auxerre", "Guingamp", "Paris", "Bastia", "Valenciennes",
"Nîmes", "Rodez ", "Toulouse", "Nancy II", "Le Havre", "Sochaux",
"Niort", "Quevilly Rouen", "Amiens SC", "Caen", "Guingamp II",
"Le Havre U19", "Nîmes II", "Rizespor", "Dijon U19", "Lecce",
"Caen II", "Brescia", "Lech Poznan", "Besiktas", "Parma", "Paris II",
"Famalicão", "Dunkerque II", "Manisa BBSK", "Niort II", "Kayserispor",
"Ajaccio U19", "Quevilly Rouen II", "Dijon II", "Paris U19",
"Bayer Leverkusen", "Le Havre U17", "Nancy U18", "Paris U17",
"Spezia", "Warta Poznan", "Montpellier", "Valenciennes U19",
"U Craiova 1948", "Valenciennes II", "Sochaux U19", "Cosenza",
"Ternana", "Reggina", "Benevento", "SPAL", "Alessandria", "Como",
"Ascoli", "Cittadella", "Monza", "Frosinone", "Pordenone", "Crotone",
"Perugia", "Cremonese", "Vicenza", "Parma U19", "Renate", "Frosinone U19",
"Vålerenga", "ACN Siena", "Reggina U17", "Carrarese", "Salernitana",
"Imolese", "SPAL U19", "Pordenone U17", "Pisa U19", "Triestina",
"Pordenone U19", "Yeni Malatyaspor", "FeralpiSalò", "Vicenza U19",
"Alessandria U19", "Reggina U19", "Empoli", "Ascoli U19", "Crotone U19",
"Cosenza U19", "Benevento U19"
)
),
selectInput(
inputId = "Demarcación_1",
label = "Demarcación: ",
choices = c(
"Portero", "Central", "Lateral", "Mediocentro", "Extremo",
"Delantero"
)
),
selectInput(
inputId = "Nacionalidad_1",
label = "Nacionalidad: ",
choices = c(
"Germany", "Russia", "Austria", "Czech Republic", "Denmark",
"Sweden", "Bosnia and Herzegovina", "Poland", "Spain", "United States",
"Romania", "Finland", "Belgium", "France", "Switzerland", "England",
"Croatia", "Japan", "Slovenia", "Norway", "Mexico", "Serbia",
"Senegal", "Canada", "North Macedonia", "Georgia", "Nigeria",
"Brazil", "Netherlands", "Kosovo", "Curaçao", "Ghana", "Azerbaijan",
"Korea Republic", "Cameroon", "Dominican Republic", "Bulgaria",
"Australia", "Albania", "Luxembourg", "Slovakia", "Italy", "Iceland",
"Gambia", "Ukraine", "Sierra Leone", "Côte d'Ivoire", "Congo DR",
"New Zealand", "Sudan", "Guinea", "Congo", "Wales", "Scotland",
"Estonia", "Montenegro", "Republic of Ireland", "Argentina",
"Northern Ireland", "Portugal", "Saudi Arabia", "Namibia", "Iran",
"Paraguay", "Jamaica", "Guinea-Bissau", "Colombia", "Kenya",
"Cuba", "Angola", "Bermuda", "Ecuador", "Uruguay", "Morocco",
"Equatorial Guinea", "Venezuela", "Peru", "Panama", "Mali", "Egypt",
"Israel", "French Guiana", "Benin", "Gabon", "Cape Verde Islands",
"Guadeloupe", "Tunisia", "Haiti", "Comoros", "Réunion", "Martinique",
"Algeria", "Turkey", "South Africa", "Burkina Faso", "New Caledonia",
"Togo", "Zambia", "Lithuania", "Greece", "Hungary", "Uganda",
"Cyprus", "Moldova", "Madagascar", "Malta", "Chile", "Honduras",
"Latvia"
)
),
selectInput(
inputId = "Pie_Dominante_1",
label = "Pie Dominante: ",
choices = c("derecho", "izquierdo", "ambidiestro", NA, "unknown")
),
sliderInput(
inputId = "Edad_1",
label = "Edad: ",
min = 15,
max = 40,
value = 15,
ticks = FALSE
)
),
box(
title = "INFORMACIÓN DEL PARTIDO ",
background = "light-blue",
width = 12
),
box(
status = "primary",
width = 12,
textInput(
inputId = "Partido_1",
label = "Partido (Equipo Local) (X) - (X) (Equipo Visitante): ",
value = character(0)
),
pickerInput(
inputId = "Demarcación_Partido_1",
label = "Demarcación en el Partido: ",
choices = c(
"Portero", "Central", "Lateral", "Mediocentro", "Extremo",
"Delantero"
),
selected = character(0),
multiple = TRUE,
options = list(`actions-box` = TRUE)
),
sliderInput(
inputId = "Minutos_Partido_1",
label = "Minutos Jugados: ",
min = 0,
max = 90,
value = 0,
ticks = FALSE
)
)
),
column(
width = 8,
box(
title = "VALORACIÓN DE LOS ÍTEMS ",
background = "light-blue",
width = 12
),
box(
title = "Capacidad de jugar con los pies: ",
status = "primary",
width = 12,
radioGroupButtons(
inputId = "1_Valoración_1",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE
),
textInput(
inputId = "1_Comentario_1",
label = "Comentarios: "
)
),
box(
title = "Capacidad de salida en balones divididos: ",
status = "primary",
width = 12,
radioGroupButtons(
inputId = "1_Valoración_2",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE
),
textInput(
inputId = "1_Comentario_2",
label = "Comentarios: "
)
),
box(
title = "Reflejos: ",
status = "primary",
width = 12,
radioGroupButtons(
inputId = "1_Valoración_3",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE
),
textInput(
inputId = "1_Comentario_3",
label = "Comentarios: "
)
),
box(
title = "Dominio del juego aéreo: ",
status = "primary",
width = 12,
radioGroupButtons(
inputId = "1_Valoración_4",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE
),
textInput(
inputId = "1_Comentario_4",
label = "Comentarios: "
)
),
box(
title = "Capacidad de comunicación: ",
status = "primary",
width = 12,
radioGroupButtons(
inputId = "1_Valoración_5",
label = "Valoración: ",
choices = c("1", "2", "3", "4"),
selected = character(0),
status = "primary",
justified = TRUE
),
textInput(
inputId = "1_Comentario_5",
label = "Comentarios: "
)
)
)
),
downloadButton(
outputId = "boton",
label = "Guardar",
icon = icon("save", lib = "font-awesome"),
style = "jelly",
color = "primary",
size = "md"
)
)
)
)
)
#----------SERVER----------
server <- function(input, output) {
output$boton <- downloadHandler(
filename = function() {
paste0("df_", input$Scout_1, ".csv")
},
content = function(file) {
map(inpt_nms, ~ input[[.x]]) %>%
set_names(inpt_nms) %>%
{
exec("tibble", !!!.)
} %>%
write_csv(file)
}
)
}
#----------SHINYAPP----------
shinyApp(ui, server)

How to pass randomly-generated data to include_tikz in R/exams?

When I add static data to a chart created with TikZ and include_tikz() from R/exams, they are rendered correctly. For example I have created the following graphic
using exams::include_tikz(graf01, library = "arrows") with the TikZ code below. And then I can include it in exams2html(), exams2moodle(), etc.
graf01<-c("\\definecolor{uuuuuu}{rgb}{0.26,0.26,0.26}",
"\\definecolor{zzttqq}{rgb}{0.6,0.2,0}",
"\\definecolor{ududff}{rgb}{0.30,0.30,1}",
"\\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]",
"\\clip(-0.1,-0.1) rectangle (5,5);",
"\\fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10] (0,0) -- (4.68,-0.02) -- (4.7,4.66) -- (0.02,4.68) -- cycle;",
"\\draw (3.44,3.80) node[anchor=north west] {\\textbf{12}};",
"\\draw (0.35,4.57) node[anchor=north west] {\\textbf{DH}};",
"\\draw (3.97,4.57) node[anchor=north west] {\\textbf{CA}};",
"\\draw (2.31,0.72) node[anchor=north west] {\\textbf{R}};",
"\\draw [line width=2pt] (1.76,3.08) circle (1.3cm);",
"\\draw [line width=2pt] (3.05,3.13) circle (1.3cm);",
"\\draw [line width=2pt] (2.45,1.98) circle (1.3cm);",
"\\draw [line width=2pt,color=zzttqq] (0,0)-- (4.68,-0.02);",
"\\draw [line width=2pt,color=zzttqq] (4.68,-0.02)-- (4.7,4.66);",
"\\draw [line width=2pt,color=zzttqq] (4.7,4.66)-- (0.02,4.68);",
"\\draw [line width=2pt,color=zzttqq] (0.02,4.68)-- (0,0);",
"\\begin{scriptsize}",
"\\draw [fill=ududff] (0,0) circle (2.5pt);",
"\\draw [fill=ududff] (4.68,-0.02) circle (2.5pt);",
"\\draw [fill=uuuuuu] (4.7,4.66) circle (2.5pt);",
"\\draw [fill=uuuuuu] (0.02,4.68) circle (2.5pt);",
"\\end{scriptsize}",
"\\end{tikzpicture}")
Now instead of hard-coding the number 12 in graf01[7]
"\\draw (3.44,3.80) node[anchor=north west] {\\textbf{12}};"
I want to use a randomly-generated number, say:
vald <- sample(1:20, 1)
I tried using
"\\draw (3.44,3.80) node[anchor=north west] {\\textbf{vald}};"
but then the string vald instead of its value is included:
How can I include the value of vald instead?
To include the value of a variable in a string you can use the function paste() or paste0():
vald <- 7
line7 <- paste0("\\draw (3.44,3.80) node[anchor=north west] {\\textbf{", vald, "}};")
line7
## [1] "\\draw (3.44,3.80) node[anchor=north west] {\\textbf{7}};"
Or for equivalent output sprintf():
line7 <- sprintf("\\draw (3.44,3.80) node[anchor=north west] {\\textbf{%s}};", vald)
The latter is typically more convenient if you have several placeholders like %s in a string or when you have different types of placeholds etc.
In either case you can subsequently do:
graf01[7] <- line7
include_tikz(graf01, library = "arrows")

Running gstreamer on ubuntu sending video through RTSP is too slow

I am trying to stream live video from a webcam attached on my ubuntu machine.
I first checked out the gst-rtsp-server code and followed the steps below:
$ git clone git://anongit.freedesktop.org/gstreamer/gst-rtsp-server
$ cd gst-rtsp-server
$ git checkout 1.4
$ ./autogen.sh
$ make
$ sudo make install
Then I tried to send the test pattern image
./test-launch '( videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96 )'
stream ready at rtsp://127.0.0.1:8554/test
The client side can see the pattern - works.
Then I tried to display the webcam with the following command.
./test-launch '( v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! x264enc ! rtph264pay name=pay0 pt=96 )'
This works fine but the latency is about 3 seconds.
Is there a way to reduce the latency to make it look more like in real time ?
From gst-device-monitor I see the following message:
$ gst-device-monitor-1.0
Probing devices...
Device found:
Analog Stereo: BUFFALO BSWHD06M USB Camera
class : Audio/Source
caps : audio/x-raw, format=(string){ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, S24LE, S24BE, S24_32LE, S24_32BE, U8 }, layout=(string)interleaved, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
audio/x-alaw, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
audio/x-mulaw, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
properties:
alsa.resolution_bits = 16
device.api = alsa
device.class = sound
alsa.class = generic
alsa.subclass = generic-mix
alsa.name = "USB\ Audio"
alsa.id = "USB\ Audio"
alsa.subdevice = 0
alsa.subdevice_name = "subdevice\ \#0"
alsa.device = 0
alsa.card = 1
alsa.card_name = "BUFFALO\ BSWHD06M\ USB\ Camera"
alsa.long_card_name = "KYE\ Systems\ Corp.\ BUFFALO\ BSWHD06M\ USB\ Camera\ at\ usb-0000:00:14.0-10\,\ high\ spee"
alsa.driver_name = snd_usb_audio
device.bus_path = pci-0000:00:14.0-usb-0:10:1.2
sysfs.path = /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.2/sound/card1
udev.id = usb-KYE_Systems_Corp._BUFFALO_BSWHD06M_USB_Camera-02
device.bus = usb
device.vendor.id = 0411
device.vendor.name = "BUFFALO\ INC.\ \(formerly\ MelCo.\,\ Inc.\)"
device.product.id = 0260
device.product.name = "BUFFALO\ BSWHD06M\ USB\ Camera\015"
device.serial = KYE_Systems_Corp._BUFFALO_BSWHD06M_USB_Camera
device.form_factor = webcam
device.string = front:1
device.buffering.buffer_size = 352800
device.buffering.fragment_size = 176400
device.access_mode = mmap+timer
device.profile.name = analog-stereo
device.profile.description = "Analog\ Stereo"
device.description = "BUFFALO\ BSWHD06M\ USB\ Camera\015\ Analog\ Stereo"
module-udev-detect.discovered = 1
device.icon_name = camera-web-usb
is-default = true
gst-launch-1.0 pulsesrc device=alsa_input.usb-KYE_Systems_Corp._BUFFALO_BSWHD06M_USB_Camera-02.analog-stereo ! ...
Device found:
name : Monitor of Built-in Audio Digital Stereo (HDMI 3)
class : Audio/Source
caps : audio/x-raw, format=(string){ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, S24LE, S24BE, S24_32LE, S24_32BE, U8 }, layout=(string)interleaved, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
audio/x-alaw, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
audio/x-mulaw, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
properties:
device.description = "Monitor\ of\ Built-in\ Audio\ Digital\ Stereo\ \(HDMI\ 3\)"
device.class = monitor
alsa.card = 0
alsa.card_name = "HDA\ Intel\ PCH"
alsa.long_card_name = "HDA\ Intel\ PCH\ at\ 0x51130000\ irq\ 136"
alsa.driver_name = snd_hda_intel
device.bus_path = pci-0000:00:1f.3
sysfs.path = /devices/pci0000:00/0000:00:1f.3/sound/card0
device.bus = pci
device.vendor.id = 8086
device.vendor.name = "Intel\ Corporation"
device.product.id = a348
device.product.name = "Cannon\ Lake\ PCH\ cAVS"
device.form_factor = internal
device.string = 0
module-udev-detect.discovered = 1
device.icon_name = audio-card-pci
is-default = false
gst-launch-1.0 pulsesrc device=alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra2.monitor ! ...
Device found:
name : Built-in Audio Digital Stereo (HDMI 3)
class : Audio/Sink
caps : audio/x-raw, format=(string){ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, S24LE, S24BE, S24_32LE, S24_32BE, U8 }, layout=(string)interleaved, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
audio/x-alaw, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
audio/x-mulaw, rate=(int)[ 1, 384000 ], channels=(int)[ 1, 32 ];
properties:
alsa.resolution_bits = 16
device.api = alsa
device.class = sound
alsa.class = generic
alsa.subclass = generic-mix
alsa.name = "HDMI\ 2"
alsa.id = "HDMI\ 2"
alsa.subdevice = 0
alsa.subdevice_name = "subdevice\ \#0"
alsa.device = 8
alsa.card = 0
alsa.card_name = "HDA\ Intel\ PCH"
alsa.long_card_name = "HDA\ Intel\ PCH\ at\ 0x51130000\ irq\ 136"
alsa.driver_name = snd_hda_intel
device.bus_path = pci-0000:00:1f.3
sysfs.path = /devices/pci0000:00/0000:00:1f.3/sound/card0
device.bus = pci
device.vendor.id = 8086
device.vendor.name = "Intel\ Corporation"
device.product.id = a348
device.product.name = "Cannon\ Lake\ PCH\ cAVS"
device.form_factor = internal
device.string = "hdmi:0\,2"
device.buffering.buffer_size = 352800
device.buffering.fragment_size = 176400
device.access_mode = mmap+timer
device.profile.name = hdmi-stereo-extra2
device.profile.description = "Digital\ Stereo\ \(HDMI\ 3\)"
device.description = "Built-in\ Audio\ Digital\ Stereo\ \(HDMI\ 3\)"
module-udev-detect.discovered = 1
device.icon_name = audio-card-pci
is-default = true
gst-launch-1.0 ... ! pulsesink device=alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra2
Device found:
name : BUFFALO BSWHD06M USB Camera
class : Video/Source
caps : video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)8/1;
video/x-raw, format=(string)YUY2, width=(int)800, height=(int)600, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 15/1, 8/1 };
video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
video/x-raw, format=(string)YUY2, width=(int)640, height=(int)360, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
video/x-raw, format=(string)YUY2, width=(int)352, height=(int)288, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
video/x-raw, format=(string)YUY2, width=(int)176, height=(int)144, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
video/x-raw, format=(string)YUY2, width=(int)160, height=(int)120, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
image/jpeg, width=(int)1280, height=(int)960, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)12/1;
image/jpeg, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 24/1, 20/1, 16/1 };
image/jpeg, width=(int)800, height=(int)600, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 24/1, 20/1, 16/1 };
image/jpeg, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 24/1, 20/1, 16/1 };
image/jpeg, width=(int)640, height=(int)360, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
image/jpeg, width=(int)352, height=(int)288, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 24/1, 20/1, 15/1 };
image/jpeg, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
image/jpeg, width=(int)176, height=(int)144, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 20/1, 15/1, 8/1 };
image/jpeg, width=(int)160, height=(int)120, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 30/1, 24/1, 20/1, 16/1 };
properties:
udev-probed = true
device.bus_path = pci-0000:00:14.0-usb-0:10:1.0
sysfs.path = /sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/video4linux/video0
device.bus = usb
device.subsystem = video4linux
device.vendor.id = 0411
device.vendor.name = "KYE\\x20Systems\\x20Corp."
device.product.id = 0260
device.product.name = "BUFFALO\ BSWHD06M\ USB\ Camera"
device.serial = KYE_Systems_Corp._BUFFALO_BSWHD06M_USB_Camera
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video0
v4l2.device.driver = uvcvideo
v4l2.device.card = "BUFFALO\ BSWHD06M\ USB\ Camera\015\012:\ "
v4l2.device.bus_info = usb-0000:00:14.0-10
v4l2.device.version = 329746 (0x00050812)
v4l2.device.capabilities = 2225078273 (0x84a00001)
v4l2.device.device_caps = 69206017 (0x04200001)
gst-launch-1.0 v4l2src ! ...
You are not just playing the stream, you are actually re-encoding the data. This encoding introduces latency. For the x264enc element use the tune=zerolatency option to reduce the delay. It comes at a cost of video quality though.

django.db.utils.DataError: value too long for type character varying(2)

I've added the following to my User model:
COUNTRIES = (
('AD', _('Andorra')),
('AE', _('United Arab Emirates')),
('AF', _('Afghanistan')),
('AG', _('Antigua & Barbuda')),
('AI', _('Anguilla')),
. . .
('YU', _('Yugoslavia')),
('ZA', _('South Africa')),
('ZM', _('Zambia')),
('ZR', _('Zaire')),
('ZW', _('Zimbabwe')),
('ZZ', _('Unknown or unspecified country')),
)
class CountryField(models.CharField):
def __init__(self, *args, **kwargs):
kwargs.setdefault('max_length', 2)
kwargs.setdefault('choices', COUNTRIES)
super(CountryField, self).__init__(*args, **kwargs)
def get_internal_type(self):
return "CharField"
class User(AbstractUser):
...
country = CountryField()
...
This is the migration created because of this change:
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20180207_1902'),
]
operations = [
migrations.AddField(
model_name='user',
name='country',
field=pulsemanager.users.models.CountryField(choices=[('AD', 'Andorra'), ('AE', 'United Arab Emirates'), ('AF', 'Afghanistan'), ('AG', 'Antigua & Barbuda'), ('AI', 'Anguilla'), ('AL', 'Albania'), ('AM', 'Armenia'), ('AN', 'Netherlands Antilles'), ('AO', 'Angola'), ('AQ', 'Antarctica'), ('AR', 'Argentina'), ('AS', 'American Samoa'), ('AT', 'Austria'), ('AU', 'Australia'), ('AW', 'Aruba'), ('AZ', 'Azerbaijan'), ('BA', 'Bosnia and Herzegovina'), ('BB', 'Barbados'), ('BD', 'Bangladesh'), ('BE', 'Belgium'), ('BF', 'Burkina Faso'), ('BG', 'Bulgaria'), ('BH', 'Bahrain'), ('BI', 'Burundi'), ('BJ', 'Benin'), ('BM', 'Bermuda'), ('BN', 'Brunei Darussalam'), ('BO', 'Bolivia'), ('BR', 'Brazil'), ('BS', 'Bahama'), ('BT', 'Bhutan'), ('BV', 'Bouvet Island'), ('BW', 'Botswana'), ('BY', 'Belarus'), ('BZ', 'Belize'), ('CA', 'Canada'), ('CC', 'Cocos (Keeling) Islands'), ('CF', 'Central African Republic'), ('CG', 'Congo'), ('CH', 'Switzerland'), ('CI', 'Ivory Coast'), ('CK', 'Cook Iislands'), ('CL', 'Chile'), ('CM', 'Cameroon'), ('CN', 'China'), ('CO', 'Colombia'), ('CR', 'Costa Rica'), ('CU', 'Cuba'), ('CV', 'Cape Verde'), ('CX', 'Christmas Island'), ('CY', 'Cyprus'), ('CZ', 'Czech Republic'), ('DE', 'Germany'), ('DJ', 'Djibouti'), ('DK', 'Denmark'), ('DM', 'Dominica'), ('DO', 'Dominican Republic'), ('DZ', 'Algeria'), ('EC', 'Ecuador'), ('EE', 'Estonia'), ('EG', 'Egypt'), ('EH', 'Western Sahara'), ('ER', 'Eritrea'), ('ES', 'Spain'), ('ET', 'Ethiopia'), ('FI', 'Finland'), ('FJ', 'Fiji'), ('FK', 'Falkland Islands (Malvinas)'), ('FM', 'Micronesia'), ('FO', 'Faroe Islands'), ('FR', 'France'), ('FX', 'France, Metropolitan'), ('GA', 'Gabon'), ('GB', 'United Kingdom (Great Britain)'), ('GD', 'Grenada'), ('GE', 'Georgia'), ('GF', 'French Guiana'), ('GH', 'Ghana'), ('GI', 'Gibraltar'), ('GL', 'Greenland'), ('GM', 'Gambia'), ('GN', 'Guinea'), ('GP', 'Guadeloupe'), ('GQ', 'Equatorial Guinea'), ('GR', 'Greece'), ('GS', 'South Georgia and the South Sandwich Islands'), ('GT', 'Guatemala'), ('GU', 'Guam'), ('GW', 'Guinea-Bissau'), ('GY', 'Guyana'), ('HK', 'Hong Kong'), ('HM', 'Heard & McDonald Islands'), ('HN', 'Honduras'), ('HR', 'Croatia'), ('HT', 'Haiti'), ('HU', 'Hungary'), ('ID', 'Indonesia'), ('IE', 'Ireland'), ('IL', 'Israel'), ('IN', 'India'), ('IO', 'British Indian Ocean Territory'), ('IQ', 'Iraq'), ('IR', 'Islamic Republic of Iran'), ('IS', 'Iceland'), ('IT', 'Italy'), ('JM', 'Jamaica'), ('JO', 'Jordan'), ('JP', 'Japan'), ('KE', 'Kenya'), ('KG', 'Kyrgyzstan'), ('KH', 'Cambodia'), ('KI', 'Kiribati'), ('KM', 'Comoros'), ('KN', 'St. Kitts and Nevis'), ('KP', "Korea, Democratic People's Republic of"), ('KR', 'Korea, Republic of'), ('KW', 'Kuwait'), ('KY', 'Cayman Islands'), ('KZ', 'Kazakhstan'), ('LA', "Lao People's Democratic Republic"), ('LB', 'Lebanon'), ('LC', 'Saint Lucia'), ('LI', 'Liechtenstein'), ('LK', 'Sri Lanka'), ('LR', 'Liberia'), ('LS', 'Lesotho'), ('LT', 'Lithuania'), ('LU', 'Luxembourg'), ('LV', 'Latvia'), ('LY', 'Libyan Arab Jamahiriya'), ('MA', 'Morocco'), ('MC', 'Monaco'), ('MD', 'Moldova, Republic of'), ('MG', 'Madagascar'), ('MH', 'Marshall Islands'), ('ML', 'Mali'), ('MN', 'Mongolia'), ('MM', 'Myanmar'), ('MO', 'Macau'), ('MP', 'Northern Mariana Islands'), ('MQ', 'Martinique'), ('MR', 'Mauritania'), ('MS', 'Monserrat'), ('MT', 'Malta'), ('MU', 'Mauritius'), ('MV', 'Maldives'), ('MW', 'Malawi'), ('MX', 'Mexico'), ('MY', 'Malaysia'), ('MZ', 'Mozambique'), ('NA', 'Namibia'), ('NC', 'New Caledonia'), ('NE', 'Niger'), ('NF', 'Norfolk Island'), ('NG', 'Nigeria'), ('NI', 'Nicaragua'), ('NL', 'Netherlands'), ('NO', 'Norway'), ('NP', 'Nepal'), ('NR', 'Nauru'), ('NU', 'Niue'), ('NZ', 'New Zealand'), ('OM', 'Oman'), ('PA', 'Panama'), ('PE', 'Peru'), ('PF', 'French Polynesia'), ('PG', 'Papua New Guinea'), ('PH', 'Philippines'), ('PK', 'Pakistan'), ('PL', 'Poland'), ('PM', 'St. Pierre & Miquelon'), ('PN', 'Pitcairn'), ('PR', 'Puerto Rico'), ('PT', 'Portugal'), ('PW', 'Palau'), ('PY', 'Paraguay'), ('QA', 'Qatar'), ('RE', 'Reunion'), ('RO', 'Romania'), ('RU', 'Russian Federation'), ('RW', 'Rwanda'), ('SA', 'Saudi Arabia'), ('SB', 'Solomon Islands'), ('SC', 'Seychelles'), ('SD', 'Sudan'), ('SE', 'Sweden'), ('SG', 'Singapore'), ('SH', 'St. Helena'), ('SI', 'Slovenia'), ('SJ', 'Svalbard & Jan Mayen Islands'), ('SK', 'Slovakia'), ('SL', 'Sierra Leone'), ('SM', 'San Marino'), ('SN', 'Senegal'), ('SO', 'Somalia'), ('SR', 'Suriname'), ('ST', 'Sao Tome & Principe'), ('SV', 'El Salvador'), ('SY', 'Syrian Arab Republic'), ('SZ', 'Swaziland'), ('TC', 'Turks & Caicos Islands'), ('TD', 'Chad'), ('TF', 'French Southern Territories'), ('TG', 'Togo'), ('TH', 'Thailand'), ('TJ', 'Tajikistan'), ('TK', 'Tokelau'), ('TM', 'Turkmenistan'), ('TN', 'Tunisia'), ('TO', 'Tonga'), ('TP', 'East Timor'), ('TR', 'Turkey'), ('TT', 'Trinidad & Tobago'), ('TV', 'Tuvalu'), ('TW', 'Taiwan, Province of China'), ('TZ', 'Tanzania, United Republic of'), ('UA', 'Ukraine'), ('UG', 'Uganda'), ('UM', 'United States Minor Outlying Islands'), ('US', 'United States of America'), ('UY', 'Uruguay'), ('UZ', 'Uzbekistan'), ('VA', 'Vatican City State (Holy See)'), ('VC', 'St. Vincent & the Grenadines'), ('VE', 'Venezuela'), ('VG', 'British Virgin Islands'), ('VI', 'United States Virgin Islands'), ('VN', 'Viet Nam'), ('VU', 'Vanuatu'), ('WF', 'Wallis & Futuna Islands'), ('WS', 'Samoa'), ('YE', 'Yemen'), ('YT', 'Mayotte'), ('YU', 'Yugoslavia'), ('ZA', 'South Africa'), ('ZM', 'Zambia'), ('ZR', 'Zaire'), ('ZW', 'Zimbabwe'), ('ZZ', 'Unknown or unspecified country')], default=django.utils.timezone.now, max_length=2),
preserve_default=False,
),
migrations.AlterField(
model_name='user',
name='last_name',
field=models.CharField(blank=True, max_length=150, verbose_name='last name'),
),
]
Python3 manager migrate produces this error:
django.db.utils.DataError: value too long for type character varying(2)
I did try changing max_length=150 in the alter above max_length=2, but it didn't help. So what am I doing wrong?

WSO2 ESB 4.8.1 custom proxy wizard does not start

I am using Java 1.8.0_25 on 64-bit Windows 8.1, logged as admin.
When looking into console output I can see the following:
[2014-11-25 15:29:28,047] ERROR - ApplicationDispatcher Servlet.service() for se
rvlet bridgeservlet threw exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
PWC6197: An error occurred at line: 109 in the jsp file: /proxyservices/index.js
p
PWC6199: Generated servlet error:
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced
from required .class files
PWC6197: An error occurred at line: 109 in the jsp file: /proxyservices/index.js
p
PWC6199: Generated servlet error:
The method replace(char, char) in the type String is not applicable for the argu
ments (String, String)
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErro
rHandler.java:129)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher
.java:299)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:392)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext
.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
92)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:544)
at org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.in
clude(RequestDispatcherAdaptor.java:37)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDisp
atcherAdaptor.include(ContextPathServletAdaptor.java:369)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary
.java:1015)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.jav
a:700)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tiles.jsp.context.JspUtil.doInclude(JspUtil.java:87)
at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesR
equestContext.java:88)
at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTiles
RequestContext.java:82)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:465)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttribute
Tag.java:140)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttribute
Tag.java:117)
at org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport
.java:171)
at org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecur
ityTagSupport.java:75)
at org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTag
Support.java:80)
at org.apache.jsp.admin.layout.template_jsp._jspx_meth_tiles_insertAttri
bute_7(org.apache.jsp.admin.layout.template_jsp:603)
at org.apache.jsp.admin.layout.template_jsp._jspService(org.apache.jsp.a
dmin.layout.template_jsp:335)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
92)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:339)
at org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.fo
rward(RequestDispatcherAdaptor.java:30)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDisp
atcherAdaptor.forward(ContextPathServletAdaptor.java:362)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(S
ervletTilesRequestContext.java:198)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(
ServletTilesRequestContext.java:185)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:419)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:370)
at org.wso2.carbon.ui.action.ActionHelper.render(ActionHelper.java:52)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:101)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(Charact
erSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:99)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(C
ompositeValve.java:178)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(T
omcatValveContainer.java:49)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValv
e.java:141)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.inv
oke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
936)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(Ca
rbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:589)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoin
t.java:1653)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
at java.lang.Thread.run(Thread.java:745)
[2014-11-25 15:29:28,562] ERROR - ApplicationDispatcher Servlet.service() for se
rvlet bridgeservlet threw exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
PWC6197: An error occurred at line: 109 in the jsp file: /proxyservices/index.js
p
PWC6199: Generated servlet error:
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced
from required .class files
PWC6197: An error occurred at line: 109 in the jsp file: /proxyservices/index.js
p
PWC6199: Generated servlet error:
The method replace(char, char) in the type String is not applicable for the argu
ments (String, String)
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErro
rHandler.java:129)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher
.java:299)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:392)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext
.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
92)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:544)
at org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.in
clude(RequestDispatcherAdaptor.java:37)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDisp
atcherAdaptor.include(ContextPathServletAdaptor.java:369)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary
.java:1015)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.jav
a:689)
at org.apache.tiles.jsp.context.JspUtil.doInclude(JspUtil.java:98)
at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesR
equestContext.java:88)
at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTiles
RequestContext.java:82)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:465)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttribute
Tag.java:140)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttribute
Tag.java:117)
at org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport
.java:171)
at org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecur
ityTagSupport.java:75)
at org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTag
Support.java:80)
at org.apache.jsp.admin.layout.template_jsp._jspx_meth_tiles_insertAttri
bute_7(org.apache.jsp.admin.layout.template_jsp:603)
at org.apache.jsp.admin.layout.template_jsp._jspService(org.apache.jsp.a
dmin.layout.template_jsp:335)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
92)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:339)
at org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.fo
rward(RequestDispatcherAdaptor.java:30)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDisp
atcherAdaptor.forward(ContextPathServletAdaptor.java:362)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(S
ervletTilesRequestContext.java:198)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(
ServletTilesRequestContext.java:185)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:419)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:370)
at org.wso2.carbon.ui.action.ActionHelper.render(ActionHelper.java:52)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:101)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(Charact
erSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:99)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(C
ompositeValve.java:178)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(T
omcatValveContainer.java:49)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValv
e.java:141)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.inv
oke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
936)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(Ca
rbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:589)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoin
t.java:1653)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
at java.lang.Thread.run(Thread.java:745)
[2014-11-25 15:29:28,607] ERROR - JspTilesRequestContext JSPException while incl
uding path '/proxyservices/index.jsp'.
javax.servlet.jsp.JspException: ServletException while including page.
at org.apache.tiles.jsp.context.JspUtil.doInclude(JspUtil.java:102)
at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesR
equestContext.java:88)
at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTiles
RequestContext.java:82)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:465)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttribute
Tag.java:140)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttribute
Tag.java:117)
at org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport
.java:171)
at org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecur
ityTagSupport.java:75)
at org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTag
Support.java:80)
at org.apache.jsp.admin.layout.template_jsp._jspx_meth_tiles_insertAttri
bute_7(org.apache.jsp.admin.layout.template_jsp:603)
at org.apache.jsp.admin.layout.template_jsp._jspService(org.apache.jsp.a
dmin.layout.template_jsp:335)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
92)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:339)
at org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.fo
rward(RequestDispatcherAdaptor.java:30)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDisp
atcherAdaptor.forward(ContextPathServletAdaptor.java:362)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(S
ervletTilesRequestContext.java:198)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(
ServletTilesRequestContext.java:185)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:419)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.
java:370)
at org.wso2.carbon.ui.action.ActionHelper.render(ActionHelper.java:52)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:101)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(Con
textPathServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service
(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(P
roxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyS
ervlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(Delegati
onServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(Charact
erSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:99)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(C
ompositeValve.java:178)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(T
omcatValveContainer.java:49)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValv
e.java:141)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.inv
oke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
936)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(Ca
rbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
... and more
Any ideas how to make it work?
Java 8 is not supported by WSO2 products yet. Please use Oracle Java 7 (JDK) to run WSO2 products.
For more information, see https://docs.wso2.com/display/ESB481/Installation+Prerequisites