Difference between revisions of "User:Timothee Flutre/Notebook/Postdoc/2012/05/16"

From OpenWetWare
Jump to: navigation, search
(About programming: add python tutorials)
(About programming: add -N to help2man)
Line 26: Line 26:
  
 
  <nowiki>
 
  <nowiki>
help2man -o myprogram.man ./myprogram
+
help2man -N -o myprogram.man ./myprogram
 
man ./myprogram.man
 
man ./myprogram.man
 
groff -mandoc myprogram.man > myprogram.ps
 
groff -mandoc myprogram.man > myprogram.ps

Revision as of 01:44, 12 February 2014

Owwnotebook icon.png Project name <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page
<html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>Previous entry<html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html>Next entry<html><img src="/images/5/5c/Resultset_next.png" border="0" /></html>

About programming

  • Templates: it is always rewarding on the long term to start any piece of computer software with a minimum amount of generic code (command-line options, help message, license, usage of gzipped files, running time, etc). But it's a pain to write all this every time, right? And often we know how to do something in one language but not in another. So below are my typical templates for any C++/Python/R/Bash program, as well as Beamer presentation.
  • Language-independent user documentation: I'm a firm believer that it is necessary to add some user documentation, even minimal, to any program. An easy way to do this is to simply generate such documentation from the "help" message, as long as it is "properly" formatted (see help2man). The following commands work for any programming language:
help2man -N -o myprogram.man ./myprogram
man ./myprogram.man
groff -mandoc myprogram.man > myprogram.ps
ps2pdf myprogram.ps myprogram.pdf