Follow me
-
Recent Posts
calendar
Recent Comments
- Stan on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- Cormac on Pandas : how to compare dataframe with None
- LP on AWK: the substr command to select a substring
- jrab on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- How to disable SSL verification for urlretrieve? – Peter's blog on python: certificate verified failed
Archives
Categories
Meta
Monthly Archives: September 2011
RPy2 substitute function does not work
I’m using rpy2 to call R package from Python, which works pretty well most of the time. Yet, I’ve encountered an issue with the R function called substitute that do not behave as expected when called from rpy2. Consider the … Continue reading
Set the default printer under linux
If you want to set the default printer, you can use the command line interface and type: export PRINTER=printer-nameexport PRINTER=printer-name If you want to set the default printer permanently, and if your shell is bash (most common by default), you … Continue reading
super() function in Python raises a TypeError
Playing with class inheritance, I came across an unexpected behavior of super() function, which is used in the inheritance process. Consider this simple example of a class MyGraph thah inherits from a DiGraph class from networkx: import networkx as nx … Continue reading
a2ps usage
a2ps is a unix tool that ease the formatting of text files before printing. a2ps inputfile -o output.psa2ps inputfile -o output.ps Print code that span over more than 80 columns. You will need to decrease the font size (-f 7), … Continue reading
How to generate a PDF reference of an R package
If you have the Rd files in a man directory, then in a shell command, you can use this command: R CMD Rd2dvi –pdf –title=’Test of foo’ -o /tmp/foo.pdf man/*.RdR CMD Rd2dvi –pdf –title=’Test of foo’ -o /tmp/foo.pdf man/*.Rd
pdf2ps font issues
Sometimes, when converting a PDF file to a PS file using ps2pdf, some fuzzy fonts may appear. A solution is to provide the fonts within the documents by using: pdf2ps -dEmbedAllFonts=true <input> <output>pdf2ps -dEmbedAllFonts=true <input> <output>
scp does not work: wrong bashrc
When I tried to use scp to copy a file on a distant machine: scp -v filename username@xxx.xxx.xxx:/home/usernamescp -v filename username@xxx.xxx.xxx:/home/username it looked as if the SCP command works but the file is not copied. The interactive option (-v) does … Continue reading
How to resize images with awk and convert
If photos in a directory are too large, you may want to use a script to automatically convert all the files into another format. AWK and convert tools can help you. The following command should convert all the files with … Continue reading
matplotlib: latex strings are not interpreted
If the LaTeX strings are not intepreted in matplotlib (e.g., in the xlabel), check your configuration file ( see previous post for matplotlib configuration file). You can either do it for one session : rc(’text’, usetex=True) plot([1,2],[3,4]); title(’a^2’) rc(‘text’, usetex=True) … Continue reading