Scientific data commonly comes in tab-separated textfile format containing comment lines. What is the best way to read this data? Analogous to the recipe given by skip.montanaro, use a commented file decorator as follows:
import sys, re
import csv
class CommentedFile:
def __init__(self, f, commentstring=”#”):
self.f = f
[...]
Tags:english programming python |
Filed on February 15th, 2010 | 1 Comment »
Read this post about how to reload your pdf document. This is particularly useful when you are creating a new document with LaTeX. Sweet, I was waiting for that functionality.
Tags:english tech |
Filed on December 21st, 2009 | No Comments »
Emacs usually takes quite some time to fully start up. However, as described in the great blog Emacs-Fu, Emacs 23 can now be started in the background as a daemon. This allows to fire up a new Emacs instance really fast. Thanks djcb!
Tags:emacs english tech |
Filed on November 20th, 2009 | No Comments »
Say you want to print the lines 3 and 7, and all lines from 11 to 15 of a text-file. The following SED one-liner will do for you
sed -n -e ‘3p’ -e ‘5p’ -e ‘11,15p’ textfile.txt
Tags:commandline english linux tech |
Filed on October 31st, 2009 | 1 Comment »
For the first time I could personally sense the effects of the economic crisis. The manufacturer of my Bluetooth device ANYCOM USB-200, the Germany-based ITM Technology AG is insolvent. Immediate effect for customers like me: No more driver updates and their general unavailability on the homepage.
Here is the good news for everybody who wants to [...]
Tags:english tech windows |
Filed on October 6th, 2009 | 7 Comments »
Several people have recently asked me whether or not it is possible to use tuples in their shell script. One example is running a program with a varying set of parameters. Since they often did not find a good solution, they began to formulate their problem in a higher-level scripting language like Ruby. Surprisingly, you [...]
Tags:commandline english linux scripting tech |
Filed on October 2nd, 2009 | 1 Comment »
Writing a paper often comes along with a problem known as information fragmentation: figures, tables and the respective data sources related to the paper certainly are somewhere on your hard disk – but where? How did I name the file with the data-points again? And, the heck, which commands did I use to create that [...]
Tags:emacs english R science |
Filed on July 8th, 2009 | No Comments »
I like to have the following snippet in my .zshrc (or .bashrc) for convenience
alias lsd=”ls -l|awk ‘/^d/ {print \$9}’”
It displays all subdirectories underneath the current directory. The goodness in this variant is that it gives you the pure names and that you can use it in loops without hassle :
for d in `lsd`; do
mv $d/resultfile.dat [...]
Tags:commandline english linux |
Filed on June 7th, 2009 | No Comments »
This post describes a very, very elementary debugging skill. Yet, I could not find any concise tutorial about it on the web. So, here we go!
Assume you’re developing a small software under Linux, maybe using C or C++ and the GCC compiler. Testing your program, you find that it crashes with an error (segfault, assertion, [...]
Tags:emacs english programming |
Filed on May 26th, 2009 | No Comments »
Since weeks the media is reporting about the severity of the current economic crisis, comparing it with the Great Depression (GD) that began 1929. However, to me this seemed like a historic exaggeration since I couldn’t really rediscover the severe effects of the GD in the current crisis. However, I now found some figures that [...]
Tags:economy english politics |
Filed on April 29th, 2009 | 1 Comment »