Author Archives: Thomas Cokelaer

Profiling Python with valgrind

1. Under Linux, install valgrind as follows (Fedora): sudo yum install valgrind kcachegrindsudo yum install valgrind kcachegrind and pyprof2calltree: pip install pyprof2calltreepip install pyprof2calltree 2. create a Python script (let us call it run.py) 3. Create the file containing the … Continue reading

Posted in Python | Tagged , | 1 Comment

svn: can’t upgrade

I’ve recently update my distribution and copied back an old SVN repo into the new distributio. This led to issues with respect to different SVN version. The old one used SVN 1.6 and the new one is 1.7 In general, … Continue reading

Posted in Computer Science, Linux | Tagged | 1 Comment

VIM : copy and paste reformats the text with lots of spaces

When I paste a piece of code or text from a copy (or the clipboard), lots of extra spaces are added at the start of each new line. The solution is to turn off the autoindent: :set paste:set paste After … Continue reading

Posted in Linux | Tagged | 1 Comment

Fedora 19 post installation

Another failed upgrade from Fedora… This time while upgrading from release 15 to 16. Although, I followed the instructions from Fedora web site, I ultimately end up (after a reboot) with a grub prompt. Quite dreadful. After a few hours … Continue reading

Posted in Linux | Tagged | Leave a comment

How to mount Sony NWZ walkman under Fedora

I recently bought a mp3/video SONY NWZ walkman (one of B172F or B173F). I plugged in the USB into the computer but it was not detected. It does not appear on the desktop and cannot be seen in a shell … Continue reading

Posted in Linux | Tagged , | 2 Comments

canviz, jake and npm

I wanted to play with canviz (http://www.ryandesign.com/canviz/) to play around with graphviz and javascript. It’s still not clear what I’ll be able to do quickly with it but first I needed to install it. I first tried from the source … Continue reading

Posted in Computer Science | Tagged , | Leave a comment

Python: Error: new-line character – how to open the file in universal-newline mode ?

I was playing with the CSV module from the Python standard library. Typically using a code such as: import csv import zipfile zip = zipfile.ZipFile("file.zip") zipdata = zip.open("ExistingFile.csv") data_iter = csv.reader(zipdata, delimiter=",") data_iter.next() import csv import zipfile zip = zipfile.ZipFile("file.zip") … Continue reading

Posted in Python | Tagged | Leave a comment

SVN: how to clean up a directory from unversioned files

Here is the command to delete all the files in a SVN directory that are not in the SVN server repository. The first part (svn status) returns all files with the ? tag (meaning they don’t belong to the repository). … Continue reading

Posted in Linux | Tagged | 1 Comment

R package dependencies: difference between imports, depends, suggests, enhances

When you want to assemble R codes into a package, you will need to write a file called DESCRIPTION. This file contains some metadata and keywords to be used and some keywords are definitely confusing (at least to me). Here … Continue reading

Posted in R, Uncategorized | Tagged | 1 Comment

Python: list of empty lists creates references not copy

In Python, you can create a list with an element repeated N times quite easily with the following syntax: >>> a = [1] * 5 >>> print(a) [1,1,1,1,1] >>> a = [1] * 5 >>> print(a) [1,1,1,1,1] Here we create … Continue reading

Posted in Python | Tagged | Leave a comment