Monday, November 26, 2007

reftex and beamer

Well, I already said that I enjoy working with reftex. It also happens that I'm a beamer fan. Beamer is a great tool for making wonderfully-looking presentations with LaTeX. So, here's a small trick I added in my .emacs configuration file to be able to see frames in the TOC mode of reftex. It is quick, dirty and hackish, but it works:

(add-hook 'LaTeX-mode-hook (lambda ()
  (setq reftex-section-levels 
 (cons '("begin{frame}" . -3) reftex-section-levels))

Saturday, November 17, 2007

reftex-toc like code browsing

I use AUCTeX for typing long LaTeX documents with emacs and I especially appreciate the so-called reftex-toc interactive mode for browsing the table of contents of the document, jumping to the relevant position.

I've been missing for a while something similar for code. While the utility of reftex-toc is somehow limited, because I (and most probably many other people) tend to write textual documents linearly, I write code absolutely not in a linear fashion - so I spend a fair amount of my time looking for where I've written a given function... Until I decided to write a reftex-toc-like code browsing tool. It is based on imenu, which I find not very convenient. It works for Ruby code (within one file, does not work across file boundaries for now - which is probably better), and is really rudimentary, but functional enough. You can download it here. In the hope you might find a use for it...

Thursday, November 15, 2007

First days of heavy debian sponsoring

As I've rather recently joined the Debian Games Team, I've taken up a place of sponsor. Rather tedious when you have 80kB/s upload speed to upload several packages of 100M to 250M... I'm always using cowbuilder to build my packages, as I hate to install build-dependencies I will never use... And the benefit is of course to make sure it does build ! I've come up with several gotchas in my recent uploads:

  • changelog entries corresponding to never-uploaded versions
  • and, a subset of the former, first revisions of a new upstream source skipped

Here are how to feed cowbuilder to work with this properly. First, for simply unuploaded changelog entries:

cowbuilder --build --debbuildopts \
  -vLastUploadedVersion package.dsc

You can check the last uploaded version with rmadison. If the first debian revision was also skipped, you can force a sourceful upload with the following:

cowbuilder --build --debbuildopts \
  "-vLastUploadedVersion -sa" package.dsc

Saturday, November 10, 2007

Yet again some improvements in SciYAG

Well, I didn't stop so easily on my enthusiasm of the morning. So I went on. I'll probably seem to repeat myself, but I won't ever say it enough: QGraphicsScene and others are simply fantastic ! I implemented today ticks and a grid for the plot using the neat trick of subclassing QGraphicsView and providing custom handlers for drawBackground and drawForeground - so easy ! As a result, the code for the new plotting system is way more elegant than the old one (and more compact, although file size doesn't show it as it is also significantly more documented). Once again, many thanks to developers at Trolltech for their wonderful work !

SciYAG's new plot system

Today (or rather, yesterday), I started using SciYAG at work. It did prove useful, even in the stage of non-completion in which it was. Great ! However, I found that something was missing sorely: the ability to display several curves at the same time (yes, SciYAG is only pre-alpha software...). A quick look tonight showed me that it was time to change the way plots were implemented. I therefore changed completely the structure to profit from the QGraphicsScene scheme. Attached is a result obtained with the first commit... It looks great ! QGraphicsScene is very easy to use, thanks to the Qt developers.

However, I found out that when I was switching antialiasing on, the rendering time was excessively great for big plots (around a second for 7000 points on my machine). So I decided to use OpenGL rendering. It turns out that it is as simple as this:

format =

Fantastic, isn't it ??

Friday, November 9, 2007

Total installed size of a debian system

I was curious to know about the amount of space taken by packages on my server, to have an idea of the stress I give to the hard drives when I run debsums on all the packages. I used dpigs and perl to achieve this, being reasonably comfortable with the latter:

dpigs -n 300 | perl -ne 'BEGIN {$total = 0} /(\d+)/; $total += ($1 || 0) ; END { print "Total $total\n"}'

That worked, at least provided that there were less than 300 packages... I later thought about using awk, which is precisely designed for this kind of applications. That actually looks like

dpigs -n 300 | awk '{a += $1} END {print a}'

Better already. But you still need to know the number of packages installed. Well, we could ask dpkg, of course:

dpigs -n `dpkg -l | wc -l` | awk '{a += $1} END {print a}'

Thursday, November 8, 2007

ctioga's new options shortcuts

I implemented today something I had in mind for a long time: a way to pass options in a slightly more convenient way to ctioga. I'm thinking mainly about the pain of writing, say,

ctioga --math --math-samples 200 'sin(x)'

when one would rather like to write

ctioga --math --samples 200 'sin(x)'

Starting from SVN revision 637, the latter form is possible. Specifically, when an option is not recognised, ctioga tries the following:

  • if it looks like a shortcut, ctioga uses a shortcut
  • if it corresponds to an option of the current backend (such as --samples for --math-samples), the corresponding option is used
  • failing that, ctioga complains

You can see the beauty of these options in the attached graph, produced by:

ctioga --xpdf --math --samples 200 \
  --cloud --filled 'sin(x)'

Tuesday, November 6, 2007

Why debsums is your friend

I've recently had troubles with my server. It doesn't hold anything public, but helps me synchronise my data between my working place and home, and serves as a place to save sensitive data (though not the only place). I had serious random crashes, ending up in the server not being able to hold for more than a few minutes alive. Whoah !

I wrote a small script to get the output of sensors and other various data, and I was surprised to see that after a while, it began segfaulting... Quick investigation with gdb showed the culprit to reside in libc6-i686... Funny thing, reportbug also showed the exact same segmentation fault. There you go. I therefore installed debsums, checked the library, and bingo !

vincent@server:~$ debsums libc6-i686
/lib/tls/i686/cmov/                                                OK
/lib/tls/i686/cmov/                                            OK
/lib/tls/i686/cmov/                                   OK
/lib/tls/i686/cmov/                                          FAILED

There was a checksum mismatch there... I reinstalled the library, and everything appears to work fine. But, that doesn't explain yet the crashes. I'm just afraid that my hard drives are slowly giving way, which would be very disappointing provided that they are brand new (6 month !) and not heavily used (though, maybe, in a warm environment). I'll check that later on.

Monday, November 5, 2007

ctioga and tick labels

On ctioga's forum, I was asked to provide a way to turn tick labels - which there currently wasn't. But, in fact, the structure was already there. The SVN commit 632 has seen them in. See for yourself the result of

ctioga --xpdf --math --interpolate 'sin(x)' --scale yticks 2.2 --angle xticks 45

As with the title and other friends, options are available, to control the shift, scale and angle of the ticks. However, the color cannot currently be changed this way (this is a Tioga limitation).