listings

incorporate code listings from an external file in knitr/markdown

ⅰ亾dé卋堺 提交于 2021-01-22 06:55:17
问题 I would like to incorporate listings of code drawn from external files in an Rmarkdown file. I would like it pretty (syntax highlighting, auto-indentation, etc.). The code is not R code (otherwise I could use some of the existing tricks to pretty-print R functions) - specifically, it's BUGS and Stan code. I'm not necessarily targeting LaTeX/PDF output: otherwise I could use the listings package. I'd like to be able to incorporate the files without an unwieldy external cat firstpart.rmd

incorporate code listings from an external file in knitr/markdown

痴心易碎 提交于 2021-01-22 06:54:48
问题 I would like to incorporate listings of code drawn from external files in an Rmarkdown file. I would like it pretty (syntax highlighting, auto-indentation, etc.). The code is not R code (otherwise I could use some of the existing tricks to pretty-print R functions) - specifically, it's BUGS and Stan code. I'm not necessarily targeting LaTeX/PDF output: otherwise I could use the listings package. I'd like to be able to incorporate the files without an unwieldy external cat firstpart.rmd

How to include an external code file in rmakdown to output in pdf with sintax highlight

南笙酒味 提交于 2020-06-17 03:42:28
问题 My question is inspired from this one. However, the difference is that my output is PDF. I have a C++ code saved in an external file. I want to print it into a r markdown PDF with syntax highlight. My example.cpp code, which is in fact a TMB code: // Fitting Bivariate Gaussian distribution. #include <TMB.hpp> template<class Type> Type objective_function<Type>::operator() () { using namespace density; DATA_MATRIX(Y); PARAMETER_VECTOR(rho); PARAMETER_VECTOR(sigma); vector<Type> rho_temp(1); rho

Grouping Lists into specific groups

你离开我真会死。 提交于 2020-01-24 00:19:26
问题 I'm wondering if it is possible to convert the listings into a specific groups to which I could place them in a table format later on. This is the output that I needed to group, I converted them into a list so that I could easily divide them in table manner. f=open("sample1.txt", "r") f.read() Here's the output: '0245984300999992018010100004+14650+121050FM-12+004699999V0203001N00101090001CN008000199+02141+01971101171ADDAY141021AY241021GA1021+006001081GA2061+090001021GE19MSL +99999

Grouping Lists into specific groups

心不动则不痛 提交于 2020-01-24 00:19:08
问题 I'm wondering if it is possible to convert the listings into a specific groups to which I could place them in a table format later on. This is the output that I needed to group, I converted them into a list so that I could easily divide them in table manner. f=open("sample1.txt", "r") f.read() Here's the output: '0245984300999992018010100004+14650+121050FM-12+004699999V0203001N00101090001CN008000199+02141+01971101171ADDAY141021AY241021GA1021+006001081GA2061+090001021GE19MSL +99999

How to format date in listing page

白昼怎懂夜的黑 提交于 2020-01-05 04:14:07
问题 I am new to Yii framework and just started to work on an existing website. I have a listing page and my requirement was to add a new field 'review_date_time' and I could managed to display it in listing. Now my question is how to change the format of the date and how to show a white space if date is not there in table field.Right now it is displaying 0000-00-00 00:00:00 if no date is there. My code for listing $this->widget('zii.widgets.grid.CGridView', array( 'id' => 'series-grid',

How to write a Text file from this Output

…衆ロ難τιáo~ 提交于 2019-12-23 02:25:09
问题 I have the following code so that I can search directories to find files. Now I want to add a way for users to Save the output to a text file? using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; namespace RecursiveSearchCS { public class Form1 : System.Windows.Forms.Form { internal System.Windows.Forms.Button btnSearch; internal System.Windows.Forms.TextBox txtFile; internal System.Windows

Highlighting a Chunk of Code within a lstlisting

二次信任 提交于 2019-12-20 09:48:31
问题 I have a bunch of code in a lstlisting environment. How can I highlight (color background) just a particular chunk of code within the environment? 回答1: You can use \colorbox and an escape character inside your listing: Add to your preamble \usepackage{color} \definecolor{light-gray}{gray}{0.80} then use it like this in your document: \begin{lstlisting}[escapechar=!] def mult(m: Matrix[Int], n: Matrix[Int]) { val p = !\colorbox{light-gray}{new MatrixInt}!(m.rows, n.cols) } \end{lstlisting} 回答2

GitHub repository not listing in Google search

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 09:12:42
问题 I created my first repository with GitHub but when I try to google it, its not listing RoboSpice-Extn-Retrofit-Tutorial EDIT I don't know how long it will take. On the other hand anyone can take a help of Google Webmaster, this would solve your problem in minutes :) 回答1: That repo seems to have been created less than an hour ago. Give Google a little time to parse the new repos, and it should show up. Note that it is referenced by GitHub search already: https://github.com/search?utf8=%E2%9C

How to select list of active connections to a PostgreSQL database

断了今生、忘了曾经 提交于 2019-12-20 08:22:07
问题 Is there a command in PostgreSQL to select active connections to a given database? psql states that I can't drop one of my databases because there are active connections to it , so I would like to see what the connections are (and from which machines) 回答1: Oh, I just found that command on PostgreSQL forum: SELECT * FROM pg_stat_activity; 回答2: Following will give you active connections/ queries in postgres DB- SELECT pid ,datname ,usename ,application_name ,client_hostname ,client_port