doxygen: Table of contents broken in the pdf - c++

After running Doxygen on my C++ code, I built the pdf documentation like this :
pdflatex refman.tex
All page numbers in the table of contents in the resulting pdf file are ??. What could be the reason and how can it be fixed ?
UPDATE: Running pdflatex a second time fixes the table of contents...

It's not due to Doxygen but the way you generated the pdf with pdflatex.
You just have to recompile a second time with pdflatex to get the expected result.

Related

Generating working CHM files using Doxygen and GraphViz (Invalid .hhc file?)

I'm in the middle of documenting my C++ GUI library and I just started using Doxygen. I've got two test files that are documented now, but I have problems when trying to generate the CHM help files. Doxygen runs without error, and dot appears to be functioning correctly to generate images.
However, it appears the resulting .hhc, .hhk, and .hhp files are broken in some way. index.hhc and index.hhk are exactly the same and running 'hhc index.hhp' does not work. It returns an error :
HHC6000: Error: An internal file could not be created. Make certain there is enough disk space on the drive where you are compiling your file.
HHC5007: Error: Fatal navigational compilation error. This is likely the result of an invalid contents (.hhc) file.
I have uploaded a zip file of my two test sources, the Doxyfile generated by the Doxy Wizard, and the .hh* files created by doxygen.
http://members.allegro.cc/EdgarReynaldo/temp/test1.zip
Both HTML Help Workshop and GraphViz are on my path.
Do I need to change a setting in the doxyfile? How do I fix this?
Regards, bugsquasher
EDIT
After taking albert 's advice, everything seemed to magically work. Nothing was really different though.

How to generate CHM with Doxygen and HTML Help Compiler?

The short story: I can generate a CHM file with Doxygen. Launching the CHM file, I observe that the Contents and Index tabs do list the pages, namespaces, classes, and members of those classes. However, clicking on the items in those Contents and Index lists do not display any content.
I am on a computer using Windows 7 Professional SP1, 64-bit.
I use Doxywizard to run Doxygen version 1.8.9.1 on my code. It correctly generates the HTML output; the pages, namespaces, classes, and members appear in the documentation.
I then further want to convert the HTML into a compressed HTML (CHM) file.
I downloaded the Microsoft HTML Help Workshop version 1.31 (i.e., htmlhelp.exe version 4.74.8703 ) from the Microsoft website ( https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985(v=vs.85).aspx ). I ran the installer. As the installer was proceeding, a popup message appeared:
This computer already has a newer version of HTML Help.
However, installation completed successfully. And, the hhc.exe program is there where I told it to install.
I now specify these relevant Doxygen settings:
Wizard --> Output:
HTML is checked
"prepare for compressed HTML (.chm)" option is selected.
Expert --> HTML:
GENERATE_HTMLHELP = YES
CHM_FILE = Foo.chm
HHC_LOCATION = C:\Program Files(x86)\Microsoft\HTML Help Workshop\hhc.exe
When I run Doxygen again, it reports an error:
error: failed to run html help compiler on index.hhp
The Foo.chm file is generated where expected. But, as described above, it is missing a lot of content.
I tried running hhc.exe manually on the HHP file generated by Doxygen. It does not indicate any errors.
C:\Program Files (x86)\Microsoft\HTML Help Workshop>hhc c:\test\html\index.hhp
Microsoft HTML Help Compiler 4.74.8702
Compiling c:\test\html\Foo.chm
Compile time: 0 minutes, 3 seconds
292 Topics
3,855 Local links
83 Internet links
0 Graphics
Created c:\test\html\Foo.chm, 259,580 bytes
Compression decreased file by 1,077,915 bytes.
However, the result is the same: a Foo.chm file that is missing content.
I subsequently found that I had another installation of the HTML Help Workshop on my computer. But, the hhc.exe was the exact same version. So, that is not likely the problem.
Can you suggest what else I can try to get all the documentation content to display in the CHM file?
When I have seen this problem (the html exists and the chm has content but that content is not visible), it has been because windows security has "blocked" the chm file. To see if this is what you are encountering try the following:
From windows explorer, Right click the generated .chm file and select properties.
On the General tab, if you see an Unblock button, click it.
Close the dialog and open the .chm file.
(I have not encountered this problem with locally generated doxygen .chm files, but I am hopeful from your description that this may fix your problem.)
The essential problem was that the CHM file was on a mapped network drive.
When I copied the CHM file to a physical drive on my computer, all the content displays.
In your doxyfile, put the path to hhc.exe in double quotes, since it contains spaces.
Or even better, do not use paths with spaces.

How do you read the .prof files generated by web2py's profiler?

If I run web2py with the -F option, it will generate a .prof file. How do I read the contents of this file? Hotshot doesn't appear to work (I tried RunSnakeRun as well).
Web2py uses cProfile; I found something that will load the cProfile generated file and spit out output to a webpage:
http://ymichael.com/2014/03/08/profiling-python-with-cprofile.html
pip install cprofilev, then run cprofilev on the .prof file. Enjoy!
snakeviz is a module/binary to view and generate cprofile .prof files. Recommended by the search engine. I really like its Sunburst plot.
https://jiffyclub.github.io/snakeviz/

How to convert R Markdown to PDF?

I've previously asked about the commands for converting R Markdown to HTML.
What is a good way to convert R Markdown files to PDF documents?
A good solution would preserve as much as possible of the content (e.g., images, equations, html tables, etc.). The solution needs to be able to be run from the command-line. A good solution would also be cross-platform, and ideally minimise dependencies to make it easier to share makefiles and so forth.
Specifically, there are a lot of options:
Whether to convert RMD to MD to HTML to PDF; or RMD to MD to PDF; or RMD to PDF
If using the markdown package in R, which options to specify
Whether to use pandoc, a package built into R, or something else
Here's an example rmd file that presumably provides a reasonable test of any proposed solution. It was used as the basis for this blog post.
Updated Answer (10 Feb 2013)
rmarkdown package:
There is now an rmarkdown package available on github that interfaces with Pandoc.
It includes a render function. The documentation makes it pretty clear how to convert rmarkdown to pdf among a range of other formats. This includes including output formats in the rmarkdown file or running supplying an output format to the rend function. E.g.,
render("input.Rmd", "pdf_document")
Command-line:
When I run render from the command-line (e.g., using a makefile), I sometimes have issues with pandoc not being found. Presumably, it is not on the search path.
The following answer explains how to add pandoc to the R environment.
So for example, on my computer running OSX, where I have a copy of pandoc through RStudio, I can use the following:
Rscript -e "Sys.setenv(RSTUDIO_PANDOC='/Applications/RStudio.app/Contents/MacOS/pandoc');library(rmarkdown); library(utils); render('input.Rmd', 'pdf_document')"
Old Answer (circa 2012)
So, a number of people have suggested that Pandoc is the way to go. See notes below about the importance of having an up-to-date version of Pandoc.
Using Pandoc
I used the following command to convert R Markdown to HTML (i.e., a variant of this makefile), where RMDFILE is the name of the R Markdown file without the .rmd component (it also assumes that the extension is .rmd and not .Rmd).
RMDFILE=example-r-markdown
Rscript -e "require(knitr); require(markdown); knit('$RMDFILE.rmd', '$RMDFILE.md'); markdownToHTML('$RMDFILE.md', '$RMDFILE.html', options=c('use_xhml'))"
and then this command to convert to pdf
Pandoc -s example-r-markdown.html -o example-r-markdown.pdf
A few notes about this:
I removed the reference in the example file which exports plots to imgur to host images.
I removed a reference to an image that was hosted on imgur. Figures appear to need to be local.
The options in the markdownToHTML function meant that image references are to files and not to data stored in the HTML file (i.e., I removed 'base64_images' from the option list).
The resulting output looked like this. It has clearly made a very LaTeX style document in contrast to what I get if I print the HTML file to pdf from a browser.
Getting up-to-date version of Pandoc
As mentioned by #daroczig, it's important to have an up-to-date version of Pandoc in order to output pdfs. On Ubuntu as of 15th June 2012, I was stuck with version 1.8.1 of Pandoc in the package manager, but it seems from the change log that for pdf support you need at least version 1.9+ of Pandoc.
Thus, I installed caball-install.
And then ran:
cabal update
cabal install pandoc
Pandoc was installed in ~/.cabal/bin/pandoc
Thus, when I ran pandoc it was still seeing the old version.
See here for adding to the path.
I think you really need pandoc, which great software was designed and built just for this task :) Besides pdf, you could convert your md file to e.g. docx or odt among others.
Well, installing an up-to-date version of Pandoc might be challanging on Linux (as you would need the entire haskell-platform˙to build from the sources), but really easy on Windows/Mac with only a few megabytes of download.
If you have the brewed/knitted markdown file you can just call pandoc in e.g bash or with the system function within R. A POC demo of that latter is implemented in the Ṗandoc.convert function of my little package (which you must be terribly bored of as I try to point your attention there at every opportunity).
Right now (August 2014) You could use RStudio for converting R Markdown to PDF.
Basically, RStudio use pandoc to convert Rmd to PDF.
You could change metadata to:
Add table of contents
Change figure options
Change syntax highlighting style
Add LaTeX options
And many more...
For more details - http://rmarkdown.rstudio.com/pdf_document_format.html
For an option that looks more like what you get when you print from a browser, wkhtmltopdf provides one option.
On Ubuntu
sudo apt-get install wkhtmltopdf
And then the same command as for the pandoc example to get to the HTML:
RMDFILE=example-r-markdown
Rscript -e "require(knitr); require(markdown); knit('$RMDFILE.rmd', '$RMDFILE.md'); markdownToHTML('$RMDFILE.md', '$RMDFILE.html', options=c('use_xhml'))"
and then
wkhtmltopdf example-r-markdown.html example-r-markdown.pdf
The resulting file looked like this. It did not seem to handle the MathJax (this issue is discussed here), and the page breaks are ugly. However, in some cases, such a style might be preferred over a more LaTeX style presentation.
Only two steps:
Install the latest release "pandoc" from here:
https://github.com/jgm/pandoc/releases
Call the function pandoc in the library(knitr)
library(knitr)
pandoc('input.md', format = 'latex')
Thus, you can convert your "input.md" into "input.pdf".
I found using R studio the easiest way, but if wanting to control from the command line, then a simple R script can do the trick using rmarkdown render command (as mentioned above). Full script details here
#!/usr/bin/env R
# Render R markdown to PDF.
# Invoke with:
# > R -q -f make.R --args my_report.Rmd
# load packages
require(rmarkdown)
# require a parameter naming file to render
if (length(args) == 0) {
stop("Error: missing file operand", call. = TRUE)
} else {
# read report to render from command line
for (rmd in commandArgs(trailingOnly = TRUE)) {
# render Rmd to PDF
if ( grepl("\\.Rmd$", rmd) && file.exists(rmd)) {
render(rmd, pdf_document())
} else {
print(paste("Ignoring: ", rmd))
}
}
}
If you don't want to install anything you can output html. Then open the html file - it should open in a browser window, then right click to print. In the print window, select "save as pdf" in the bottom right hand corner if you're on a Mac. Voila!
Follow these simple steps :
1: In the Rmarkdown script run Knit(Ctrl+Shift+K)
2: Then after the html markdown is opened click Open in Browser(top left side) and
the html is opened in your web browser
3: Then use Ctrl+P and save as PDF .

Is there a way to get a test results and coverage html report from MSTest

I'd like to be able to produce a HTML based report from the Results.trx and data.coverage files that MSTest creates. Ideally this would just list any failures, and show some basic coverage stats.
Does anyone know of a tool that does this?
you can use TRXER tool to generate HTML reports from trx file. Download TrxerConsole.exe file from here
Build/Rebuild the project to create .dll file.
If your project name is UnitTest1 then the .dll file name will be UnitTest1.dll. Go to the location of .dll like
C:\Users\NAME\source\repos\UnitTest1 \UnitTest1
\bin\Debug\netcoreapp3.1\UnitTest1.dll
Open Developer command prompt of Visual studio 2019
Run command to set the location
cd
C:\Users\NAME\source\repos\UnitTest1\UnitTest1\bin\Debug\netcoreapp3.1\UnitTest1.dll
Run the Command to Generate trx file:
vstest.console.exe UnitTest1.dll /logger:trx
Trx file will be generated in the folder TestReults which is present in the same location where project dll file is present.
If TrxerConsole.exe is in downloads then run the command to convert into HTML.
Path of trxerconsole.exe file then space then Path of trxfile as below
C:\Users\NAME\Downloads\TrxerConsole.exe C:\Users\NAME\source\repos\DesktopWithMSTest\DesktopWithMSTest\bin\Debug\netcoreapp3.1\TestResults\TestResult.trx
HTML file will be generated in same TestResults Folder.
link to refer
your Reports will look like:
Actually we did that using the open source tool Trx2Html
Its really simple - gets trx file and output html. There are specific versions for VS2005 trx and VS2008 trx.
You can publish to the report server and then the reports will be available from a web interface.
( I did it in PowerShell)
You need this dll
Microsoft.VisualStudio.Coverage.Analysis.dll
then this line will turn .coverage into an xml file (which the .trx already is)
$dataStore = ([Microsoft.VisualStudio.CodeCoverage.CoverageInfoManager]::CreateInfoFromFile("$homeDir\tests.coverage")).BuildDataSet($null)
$dataStore.WriteXml("$homeDir\Coverage.xml")
Then you could use the MsTest xsl file from cruisecontrol.net to put the test results in a nice html format, and I have an XSL for the coverage. WHich won't fit here. I wish they had a way to upload files. Email me alex dot hutton at hotmail, and I can get you the xsl to display that coverage
The trx files are fairly simple xml documents that can easily be processed with XSLT to produce flexible and customized reports.
If you google trx and xslt you'le find a number of examples to get you started.
I have added a codeplex project for this, you can generate the html from trx as well as add code-coverage data to the same report. http://trxtohtml.codeplex.com/
try the new trx2html.codeplex.com it's not based on XSLT, but in LINQ2XML so it's easier to extend
I am writing a simple batch file to convert your XML report into HTML
Pre-requisites
Download trx2html.exe from here
Paste it to any location on your machine where XML file is being generated
Create a report.bat file and paste the code given below
#echo off
::*****************************Constants*****************************************************************
set "trxFileName=TestResult"
set "trx2html_path=C:\Users\Desktop\0.6\TrxerConsole.exe"
::********************************************************************************************
echo ------------------------"Generating test report "----------------------------------------------
%trx2html_path% ".\Results\%trxFileName%"
echo -----------------------"Test Report Generated at location=.\Results\%trxFileName%"------------
pause
I have created a tool to generate html from trx.
The tool is available from Nuget.org.
Install as global tool:
dotnet tool install --global trxlog2html --version 1.0.0
Install as local tool:
dotnet new tool-manifest
dotnet tool install --local trxlog2html --version 1.0.0
Converting the TRX to html file:
After installation, you can convert the trx file to html file with the following command.
dotnet run trxlog2html -i [input trx file path] -o [output html file path]
See the links below for more information.
https://github.com/HikosakaRyo/trxlog2html
https://www.nuget.org/packages/trxlog2html/