Wednesday, February 27, 2008

Today's dirty command-line trick: progress statistics for dd

Who has already been using dd for endless data transfer without really knowing what is happening ? That is rather annoying. Sure, when the target is a normal file, you can always use

watch ls -l target

But, that won't tell you the rate of transfer, and it won't work if the target is a special file (device, pipe, ...). Fortunately, dd accepts the USR1 signal to print out some small statistics... Well, combining that with the watch tricks gives this:

watch killall -USR1 dd

And there you go, dd is now regularly printing out statistics. Pretty neat, isn't it ?

Wednesday, February 20, 2008

pdfnup and page size

I use a combination of pdftk and pdfnup, from the pdfjam package to arrange (PDF) graphs produced by ctioga into an array for printing. However, I find that a simple

pdfnup --nup 3x3 concatenated_graphs.pdf

does not produce an A4 output (even with --paper a4paper), but a PDF who has the same size as individual graphs. Painful. It did take me long to realize it is a feature of pdfnup, who asks pdfTeX to have the paper size adjusted to that of the input when the layout is symmetric and no orientation has been provided. To disable that, and get a real A4 paper, specify the orientation:

pdfnup --orient portrait --nup 3x3 concatenated_graphs.pdf

Sunday, February 17, 2008

Virgin Megastore France doesn't like Iceweasel

I wanted to have a look at the French Virgin Megastore website, and I got the attached image. It says:

The version of your browser does not allow browsing this site under Linux. You must install Firefox.

Well, I don't want to know how they are detecting the "correctness" of the browser (after all, this is Iceweasel, so it is Firefox), or why they are so stupid as to forbid browsing if the "correct" navigator is not used, but, well, they've just lost a customer.

Wednesday, February 13, 2008

How to shut wine audio output

As I've mentioned before, I play to Morrowind (III) using Wine. Fine. Thanks to a nice guy on the AppDB Forum, I found out that what was causing Morrowind to segfault was simply that I had not set any audio device in my configuration... So I did with winecfg, and it worked, and I was quite delighted.

So far, nothing fantastic. It so happens that I hate to play any game with the game's music/sounds/voices, as I prefer to be quietly listening to music of my taste (I have delicate ears). As in any other game, you can switch them off in Morrowind, which is what I immediately did. However, it happens that some sounds - so far, only the sound corresponding to a shield blocking an attack (a graceful and delicate sound as you imagine) - go through even with all sound volumes are turned down to 0. It is annoying to the point I had to stop using the computer for listening music and falling back to my old CD player. Painful ! Or at least so it was until today, when I finally took my courage and found out how to fool wine into believing it is playing sounds when in fact it is not. First step, create a null ALSA output device, by adding the following to your .asoundrc:

# Null audio output
pcm.null {
  type null               # Null PCM

Then, you need to have wine use it (and only this one). For this, a quick look at the Useful Registry Keys showed that I had to add the following to my .wine/user.ref configuration file:

[Software\\Wine\\Alsa Driver] 1202930020

Just make sure wine is using ALSA output, and that's all ! Morrowind plays, without sound and does not segfault ! I'll be able to listen to my music again...

Note I'm unsure about the value 1202930020. The best is to add the key Software\Wine\Alsa Driver using regedit and then edit the configuration file -- or even do everything with regedit.

Friday, February 8, 2008

Microsoft advertises embedded windows under "Embedded Debian" !

[embedded-debian-microsoft.png] Few days ago, I was looking at my gmail mails. As usual, there was a couple of ads on the right hand side of the screen (they never really bothered me before). But that day, there was something quite different: an advertisement for Microsoft under the term "Embedded Debian" ! Well, I can understand that Microsoft wants to advertise for the keywords "Embedded Debian". After all, if they do provide good embedded OS services, that is only fair. But to do so with a title "Embedded Debian" does not really qualify as fair use of the Debian trademark !

The trouble is that this is something hard to prove, as it appears seldom and apparently randomly. When I google for the terms Embedded Debian, I come up around every second time with nearly the same ad, but taking to This domain does not appear to be connected to Microsoft anyhow (see its whois entry). Some other people tried and never saw the ad, as I did when I looked from another computer (a Windows one, funnily). The link which is depicted above did only show up in my gmail account so far. However, that domain is owned by Microsoft, so they can't deny this comes from them. Why, are we scaring them so much ??

Wednesday, February 6, 2008

Wine versus Vista for gaming

Another day starting well: apparently Wine is a better alternative than Vista for gaming (admittedly, this guy only tested four different games, but Wine was the clear winner). Great !

As for me, I finally got Morrowind working under Wine, which is one of the reasons why I haven't been that active for Debian recently.

Tuesday, February 5, 2008

gs saved the day again !

Some time ago, I was delighted at the power of Ghostscript. Well, it saved the day again, with an article that didn't want to get printed. Quite naively, I always thought that doing first pdf2ps (or pdftops, based on Xpdf, that often produces smaller and nicer postscript) and then ps2pdf was a good way to deal with unfriendly PDF files. But, in real, nothing is better than working without intermediates. The following produces a pretty neat PDF file:

gs -sOutputFile=output.pdf -sDEVICE=pdfwrite \
  -dCompatibilityLevel=1.4 input.pdf < /dev/null

As side benefits, as this command also embeds postscript fonts, the output looks better in xpdf, and it is decently smaller !