How to find out which version of Ubuntu you are running?

11 September, 2009 - 09:51
Categories:

How to find out which version of Ubuntu you are running?

Use one of the commands below:

lsb_release -a
cat /etc/lsb-release
cat /etc/issue

kthxbye

Jython and PYTHONPATH

9 September, 2009 - 11:07
Categories:

For some small tools or jobs I use Jython so I can (re)use some existing Java code, while still writing in Python. I also have various custom Python modules, of which I put the paths in my PYTHONPATH environment variable, so those modules are easily available in Python scripts and interactive sessions.

However, Jython does not automatically pick up the PYTHONPATH information, for reasons that seem to be discussed in this Jython development mailing list thread.

Jython 2.5 introduced the JYTHONPATH environmental variable as Jython-equivalent of PYTHONPATH, so setting both to the same value should do the trick for most use cases (unless you're working in a setup with incompatible Python an Jython versions).

For Jython versions prior to 2.5 (like 2.2.1 in my case), there is an easy "workaround", by invoking Jython with the appropriate -Dpython.path=foo/path:bar/path option. For example as follows:

Read more...

Eclipse TPTP woes in Ubuntu and how to solve it as non-root

19 August, 2009 - 14:09

Today, I wanted to do some profiling of a Java application in Eclipse (3.4 aka Ganymede) on my Ubuntu 8.10 box at work. Google pointed me to the Eclipse TPTP (Test & Performance Tools) platform, which I installed through the Eclipse plug-in installer thingy, that weird acting constantly blocking/reloading user interface located under the "help" menu (of all places!), but lets not get us carried away by that for the moment.

After installation (and the obligatory eclipse restart), I tried to use the new tool, but soon my enthusiasm was curbed as I got a nice red error message IWAT0435E An error occurred when connecting to the host on the monitor tab of the profile configuration dialog. No profiling for me, sir. Bummer.

Getting ready for what started to smell like another jumping through hoops session, I googled the warning and got to this eclipse bug report. Apparently, some component of TPTP requires a prehistoric version of libstdc++. Unfortunately, that version was not available anymore in the standard Ubuntu repositories since Ubuntu 8.04 or something.

Read more...

LaTeX: inline BibTeX entries with the bibentry package

17 July, 2009 - 11:28

In the introduction chapter of my PhD dissertation, I had to make a listing of my publications. The obvious brain dead way to achieve this is just typing everything manually in a list. But this feels just so wrong when you're already using BibTeX for managing references and bibliographical stuff. However, the traditional usage of BibTeX in LaTeX is to generate a full list of all references and put this in a dedicated section or chapter.

With the bibentry package (which is part of the natlib package actually) it is possible to put bibliographic entries anywhere in the text. As far as I know and experienced, the bibentry package is included in a default LaTeX setup, so you don't have to install something, just enable it in your document.

Getting it work as desired can take some trial and error, so I thought it may be a good idea to feed "them search engines" with a working example.

Read more...

Reading MP3 files in Java

15 July, 2009 - 16:12
Categories:

At work, I'm trying out BeatRoot, an application written in Java, for its BPM estimation capabilities. The data set I'm working with is encoded in MP3 format and getting this Java tool to work with the MP3 data was not an easy ride.

Read more...

Bar plots and legends in pylab/matplotlib

13 June, 2009 - 09:41

I like working with Matplotlib aka Pylab for my plotting needs in Python, but today I stumbled on a weird issue when creating a mixed bar + line plot with legend. Take the following snippet:

pylab.bar(x, yr, color='#88aa33', align='center', label='histogram')
pylab.plot(x, yc, 'bo-', label='cumulative')
pylab.legend()

This generates something like (note the entry overload in the legend):

Legend entry overload.

[Update: this issue seems to be solved. The issue described here occurred with Matplotlib version 0.91.2. With Matplotlib 0.99.0 I don't have this problem anymore.]

Read more...

Showing the running command in a bash script with "set -x"

29 May, 2009 - 09:03

Bash scripts are handy for putting a bunch of longer running jobs in one batch. In some occasions it can be useful to know which command is running at the moment, especially when the commands do not generate output themselves or this output is redirected to files.

Bash has a simple setting to achieve this:

set -x

which, according to help set, enables the following feature:

-x Print commands and their arguments as they are executed.

Disabling it just takes a mere

set +x

You can play with it from the bash command line itself, or put it in a bash script of course.

Read more...

Working with a Subversion repository through Git

25 May, 2009 - 13:53
Categories:

I'm experimenting with using a Subversion repository through Git. That way I can keep better track of my own (experimental) work, without polluting/destabilizing the central Subversion repository with small incremental commits. Git comes with a svn sub-tool that takes care of all the interfacing between the local git repository and the central Subversion repository. Mainly for my own reference, I'll collect some pointers and tricks for using this git-svn tool here. Maybe it's useful for other too.

Read more...

Ignore whitespace in Subversion diffs

20 May, 2009 - 15:24

When you're working on a software development project where not all parties use the same code style conventions or editor setting (like tabs vs. spaces, removing trailing spaces, etc), the signal to noise ratio of a source code diff can be a bit frustrating. Luckily, most diff programs have an option to ignore whitespace changes, for example -w or --ignore-all-space in GNU diff or colordiff.

The internal diff engine of Subversion also offers this option (since version 1.4 if I'm not mistaken), but it looks a bit weird to use it:

svn diff -x -w ventrolucator.cpp
Read more...

Date tick control in pylab/matplotlib

18 May, 2009 - 14:05

Today I struggled a bit with pylab's plot_date function and overlapping date tick labels:

overlapping plot_date xticks

Read more...