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/
Related
enter image description here
I am reading an e-book on machine-learning by Dr. Joseph Brownlee.
This is the code from the book, and this is what I am getting. ( I do have the CSV. )
It may be my computer, because I haven't been able to load a CSV from any version of Python 3.
Why?
Josh, your python-interpreter is not using the same installation as Jason uses.
First: check, where is the Jason's CSV-file actually located ( python did not find it in his location )
Next: get that file moved/copied into your python-interpreter's directory.
In case: you may load the "classical" ML-dataset from here, just put it into the same directory, as your python is located and rename the file to match your .csv CSV-example
If all fails: ask Jason, where is the missing file, if it was some modified version of the "classic" ML-dataset.
Python 2.7 will make it. Do not panic. There is no need to worry about any Py3 remarks. Except for some printing issues to fix, the course will work for you in Py27 either.
You need to start the Python interpreter in the same folder as your csv file. Best way to do that would be write a Python script in the same folder, then just execute it
or give the full path to the file. open(r"C:\Users\username\files\blah.csv")
Also, you're using Python27, not Python3, and both will work, so it's recommended nowadays to use Python3
I need windows commands/script to compress multiple files in a single folder.
I see only few commandsaa are available.
Can anyone forward the basics zip and unzip commands.
This is the on line guide for Peazip commands, from its domain: http://www.peazip.org/peazip-command-line.html
As for what I recall, you can also work as usual with Peazip and then export what you are doing as a script, from "Console" tab. Then you can edit/reuse the script at will.
I'm using Pelican for a static blog, and attempting to install the figure-ref extension. Since I'm using Markdown, the plugin relies on the figureAltCaption third-party Markdown extension. However I have no idea how to install it.
Pelican has an MD_EXTENSIONS configuration option, but I've tried a few obvious options with no luck. It seems like this is a dead-simple gimme but it's not clear how to proceed. Would love some suggestions.
Unfortunately, the author of figureAltCaption appears to have not provided an install script. My suggestion would be to create one and contribute it as a pull request. This tutorial about creating Extensions for Python-Markdown covers creating an install script as well.
However, as a shortcut, you should be able to just copy the figureAltCaption.py file to the appropriate directory. Usually you want the site-packages directory. As this answer shows, just do the following from Python:
>>> import site; site.getsitepackages()
Then copy the figureAltCaption.py file to the first directory returned.
Now that the extension is on your PYTHONPATH, it should be importable. From the Python prompt, try:
import figureAltCaption
If you get no errors, then it worked and you just need to tell Pelican about it.
MD_EXTENSIONS = ['figureAltCaption']
I just did
use "data.dta"
My do file and dta are in the same folder. But it shows me error.
I also tried
use "datafolder/data.dta"
after placing data.dta into that folder. But this doesn't work either.
What should I write? It is not a good idea to write like
use "D://... /... /data.dta"
because other people should be able to run this code on his computer.
Before read the dta file, we need to tell Stata the current directory. Usually we can use cd command to change the current working directory. For example, if the data.dta is under the "C:\temp" folder, then use the following code:
cd "C:\temp"
use "data.dta"
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/