Martin's Knowledge Base

by Martin Monperrus

  Why does my screen blink when I'm using Wine?
  Why screen captures don't work with Wink?
  How to fix "Unable to save my document" when using Samba/CIFS (e.g. using OpenOffice)?
  Why the fonts that are indexed by fontconfig and available with fc-list are not proposed by Openoffice?
  How to disable the default font path with X/Xorg?
  How to use bluesky computer modern fonts with fontconfig?
  How to use URW Times / Nimbus Roman No9 L with latex?
  How to open psafe3 files on Linux?
  How to configure xdg-open to open URLs?
  I cannot open URLs in Skype on Linux
  How to convert OpenOffice's odt files to pdf files via the command line?
  No more German sharp s (ß) with Xorg
  KDE4: where is kicker?
  KDE4: where is kcontrol?
  What is the source code repository of freepascal?
  How to get the source code of Web2c's version of TeX?
  How to compile Pascal code to Java Bytecode?
  Can I browse the code of newlib, sim, etc.?
  How to modify the dependencies of a Debian/Ubuntu DEB package before installing it?
  How to generate PDF version 1.3 with pdftex/pdflatex?
  How to install Ubuntu Jaunty using debootstrap?
  When giving a presentation with OpenOffice, how to have your personal notes on your laptop screen?
  How to use bzr-cvsps-import?
  How to annotate PDF files on Linux?
  How to change the password of the Gnome Keyring?
  How to open/explore/browse Firefox XPI files?
  Is Apache Lucene a NoSQL/document-oriented database?
  How to convert PDF 1.2 to PDF 1.4? How to change the PDF version of PDF files?
  In Qemu/KVM, what is the ip address of the host machine?
  How to use subversion with NFS?
  REST-ful ISBN with Google Books and Amazon
  How to set up a LDAP (openldap/slapd) on Linux/Debian
  Vertical text layout with Firefox
  Evince and Xpdf don't display non-embedded fonts
  Is there a version control system running in CGI mode?
  How to report a bug or ask a general question about Google Scholar?
  How to extract the first page of a PDF file?
  How to stop Firefox asking "Do this automatically for files like this from now on" on Linux?
  How to do code syntax highlighting in web pages (for instance for Javascript)?
  How to search for whole phrases with Gnome Tracker?
  How to crop PDFs on Linux?
  How to export Eclipse ecorediag diagrams as vector graphics PDF?
  How to remove comments from Latex sources ?
  How to set up automated backups of mysql?
  What is /sys/block/sda/device/queue_depth?
  How to find a Latex symbol?
  How to fix "totem: Could not create element 'gconfaudiosink'"?
  How to fix "jackd/jackd2: Cannot lock down memory area (Cannot allocate memory)"?
  How to share user-defined custom styles accross documents in libreoffice/openoffice?
  Scp and rsync hangs/stalls while ssh works
  How to match the last line with sed?
  How to copy highlighted code from Eclipse in OpenOffice/LibreOffice impress?
  How to save documents from a Google result page with right-click >> Save link as... ?
  How to obtain copyable ASCII single quote (#39) in code listings with package listings in LaTeX?
  How to change the label of a vfat partition?
  In ANTLR3, what does the BANG/exclamation mark (!) mean right after a rule name?
  How to measure Java software (LOC/SLOC)?
  USB drives are mounted by Nautilus but don't show up in the UI?
  What's the unit of the stripe-width parameter of mkfs.ext4?
  How to install a printer Brother DCP770CW on a 64 bits system?
  How to remove the page break before the bibliography?
  I can not delete notes in Tomboy, the right-click option "delete" is greyed out
  How to disable gnome-shell in Gnome 3?
  How to set the default browser in Gnome 3?
  How to disable password check/screen lock after suspend on Gnome 3?
  How to obtain centered columns with Latex package tabularx?
  Evince/Xpdf don't receive keyboard input with mozplugger on Firefox
  Why do I get "lp: Error - unable to access"?
  How to fix "Paragraph ended before \BR@c@bibitem was complete"?
  How to disable mounting /tmp as tmpfs in Debian?
  How to force using pdflatex on Hal/Arxiv?
  How to change the port for Subversion over SHH (svn+ssh)?
  How to automatically remember SSH passwords for Subversion over SHH (svn+ssh)?
  How to set up Linux's X/Xorg on a laptop Samsung np305/np-305/np305ua1?

Why does my screen blink when I'm using Wine?

Cause: the xrandr/randr extension of the X server
Solution: Add a key UseXRandR=N in the registry using Wine's regedit
See also: http://wiki.winehq.org/UsefulRegistryKeys

Why screen captures don't work with Wink?

Solution: unset Numlock
See also: http://www.debugmode.com/wink/download.php

How to fix "Unable to save my document" when using Samba/CIFS (e.g. using OpenOffice)?

Error for touch: setting times of `': Not a directory
Error for kate: The document could not be saved, as it was not possible to write to file:///mnt/jsb/toto. Check that you have write access to this file or that enough disk space is available.
Error for OpenOffice: General input/output error while accessing ...
Solution: add the option "nounix" for mounting the shared directory (e.g. mount.cifs //server.de/foo /mnt/foo -o nounix)

Why the fonts that are indexed by fontconfig and available with fc-list are not proposed by Openoffice?

In order to use a font in Openoffice, you have to provide 2 files per font, the AFM and PFB font.
For instance, for the URW Times (a.k.a "Nimbus Roman No9 L"), you have to provide both "utmr8a.afm utmr8a.pfb"

How to disable the default font path with X/Xorg?

Use the option UseDefaultFontPath in ServerFlags:
Section "ServerFlags"
Option "AllowMouseOpenFail" "true"
Option "UseDefaultFontPath" "false" # disable the default fontpath
EndSection

How to use bluesky computer modern fonts with fontconfig?

According to this page, it's not possible because bluesky fonts do not contain all latin1 characters. What is sure is that the pfb files of bluesky (e.g. /usr/share/texmf-texlive/fonts/type1/bluesky/cm/cmtex9.pfb) are not compatible/readable with fontconfig.
$ fc-cache -v -f
/usr/share/texmf-texlive/fonts/type1/bluesky/cm/: caching, new cache contents: 0 fonts, 0 dirs
See also Using computer modern type1 fonts with openoffice on Linux

How to use URW Times / Nimbus Roman No9 L with latex?

URW Times is the same font as "Nimbus Roman No9 L". It 'is used when you load the package times:
\usepackage[T1]{fontenc}
\usepackage{times}
Then pdflatex outputs:
(/usr/share/texmf-texlive/tex/latex/psnfss/times.sty) (./fonts.aux)
(/usr/share/texmf-texlive/tex/latex/psnfss/t1ptm.fd) [1{/var/lib/texmf/fonts/ma
p/pdftex/updmap/pdftex.map}] [2] (./fonts.aux) ){/usr/share/texmf-texlive/fonts
/enc/dvips/base/8r.enc} /usr/share/texmf-texlive/fonts/type1/urw/times/utmr8a.p
fb> $ pdffonts fonts.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
DPRGTM+NimbusRomNo9L-Regu Type 1 yes yes no 4 0

How to open psafe3 files on Linux?

Use password-gorilla. It is able to read and write psafe3 files from Windows's passwordsafe.

How to configure xdg-open to open URLs?

For instance xdg-open http://www.google.fr. On KDE, xdg-open uses kfmclient, which itself uses the default browser set using the Control Center (kcontrol).
KDE Components >> Component Chooser >> Web Browser

I cannot open URLs in Skype on Linux

Skype uses xdg-open to open URLS. It has to be correctly configured (see above).

How to convert OpenOffice's odt files to pdf files via the command line?

This is a wonderful solution: http://www.artofsolving.com/opensource/pyodconverter

No more German sharp s (ß) with Xorg

After an upgrade of my X window system, I lost the ability to type german sharp s (ß) with <Alt Gr> + s.
To get it back, you have to change one of the configuration files of your german keyboard, so that the third modifier (<AltGr> + s) with s produces an ß.

On my system:
file: /usr/share/X11/xkb/symbols/de
line (the change is in bold): key <AC02> { [ s, S, ssharp, U1E9E ] };
and relaunch X.

I don't think it's a bug of the configuration file, it's rather an incorrect interaction between Unicode characters, X fonts and my locale (ISO8859-1).

KDE4: where is kicker?

in KDE4, kicker has been replaced by plasma-desktop :-(

KDE4: where is kcontrol?

in KDE4, kcontrol has been replaced systemsettings :-(

What is the source code repository of freepascal?

freepascal uses a svn repository accessible at http://svn.freepascal.org/svn/fpc/ (and no more CVS at cvs.freepascal.org)

How to get the source code of Web2c's version of TeX?

$ svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/

How to compile Pascal code to Java Bytecode?

You can use nestedVM for that if your Pascal code is compatible with the GNU Pascal Compiler. For instance, in running tex on a java virtual machine, I show how to run the Pascal version of TeX in a Java Virtual Machine.

Can I browse the code of newlib, sim, etc.?

See this CVS browser!.

How to modify the dependencies of a Debian/Ubuntu DEB package before installing it?

Very nice solution: http://ubuntuforums.org/showthread.php?t=636724

How to generate PDF version 1.3 with pdftex/pdflatex?

Simply add \pdfoptionpdfminorversion=3 in the header of your tex file. See http://www.tug.org/pipermail/pdftex/2002-November/003317.html.

How to install Ubuntu Jaunty using debootstrap?

$ curl -O http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.20~jaunty1_all.deb
$ dpkg -i debootstrap_1.0.20~jaunty1_all.deb
 # this puts ubuntu jaunty in the directory ubuntu-jaunty
$ debootstrap jaunty ubuntu-jaunty http://de.archive.ubuntu.com/ubuntu/
The default installation of Ubuntu Jaunty contains 160 packages and takes 238MB.

When giving a presentation with OpenOffice, how to have your personal notes on your laptop screen?

Openoffice can project the presentation to VGA, and let both the slides and the notes on the screen of your laptop. This is like Apple's keynote and it is called Presenter Console extension.
The downloadable extension from http://extensions.services.openoffice.org/project/presenter-screen does not work on my Linux (Debian), but there is a package called openoffice.org-presenter-console.

$ apt-get install openoffice.org-presenter-console (should work on Ubuntu as well)


How to use bzr-cvsps-import?

To convert a CVS repository to a bazaar one (replace /home/cvsroot/ and modulename with your values):
$ bzr cvsps-import /home/cvsroot/ modulename bzr-import
$ bzr co bzr-import/bzr/modulename/branches/HEAD

How to annotate PDF files on Linux?

A very good solution is to run PDF-Exchange Viewer using wine.

How to change the password of the Gnome Keyring?

1. install seahorse ($ sudo apt-get install seahorse)
2. run seahorse (CLI or System >> Preferences >> Passwords and Encryption Keys)
3. right-click on "Passwords:login" >> "Change password"

How to open/explore/browse Firefox XPI files?

XPI files are actually ZIP files. Just rename file.xpi in file.zip and open it with unzip/ark/file-roller or whatever zip browser.

Is Apache Lucene a NoSQL/document-oriented database?

Yes. For instance, the APIs of Google's datastore and Apache Lucene are very similar (e.g. Entity versus Document).
See also: answer @ stackoverflow
answer @ Lucene's mailing list

How to convert PDF 1.2 to PDF 1.4? How to change the PDF version of PDF files?

This can be done with Ghostscript:
$ gs -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf -dCompatibilityLevel=1.4 input.pdf

In Qemu/KVM, what is the ip address of the host machine?

10.0.2.2

How to use subversion with NFS?

Use both subversion database format fsfs (svnadmin create --fs-type fsfs $DIR), and NFS mounting option nolock.
See http://gibbonsr.net/2009/02/nfs-and-subversion-it-can-work/.

REST-ful ISBN with Google Books and Amazon

How to ask for information with the ISBN?
http://www.amazon.com/gp/search/ref=sr_adv_b/?search-alias=stripbooks&field-isbn=978-1-60566-006-6
http://www.google.com/search?tbs=bks%3A1&q=isbn%3A978-1-60566-006-6


How to set up a LDAP (openldap/slapd) on Linux/Debian

An excellent tutorial: http://www.debuntu.org/ldap-server-and-linux-ldap-clients

Vertical text layout with Firefox

<span style="-moz-transform:rotate(90deg);">Demonstration</span> Demonstration See https://developer.mozilla.org/en/CSS/-moz-transform

Evince and Xpdf don't display non-embedded fonts

In my case, the problem was in the fontconfig configuration files. I replaced /etc/fonts/* by the latest version from the fontconfig-config package and regenerated the cache ($ fc-cache -f). It solved the issue.


Is there a version control system running in CGI mode?

Yes: Mercurial. It can run in pure python (no C extension) with CGI (hgweb.cgi). The transport is completely done using HTTP and the access control with .htaccess/.htpasswd files. Beautiful! (see this post)

How to report a bug or ask a general question about Google Scholar?

http://www.google.com/support/scholar/bin/request.py?contact_type=general (note the ?contact_type=general).

How to extract the first page of a PDF file?

With a command line: pdftk A=input.pdf cat A1-1 output firstpage.pdf

How to stop Firefox asking "Do this automatically for files like this from now on" on Linux?

Solution: install the extension InlineDisposition.
See also: https://bugzilla.mozilla.org/show_bug.cgi?id=331259 and https://bugzilla.mozilla.org/show_bug.cgi?id=236541

How to do code syntax highlighting in web pages (for instance for Javascript)?

I recommend shjs (http://shjs.sourceforge.net/). It is much better than SyntaxHighlighter which has many bugs (for instance, I encountered this one and this one)

How to search for whole phrases with Gnome Tracker?

For whole text search with tracker, you have to prepend a letter to the query (found here)
'On Searching Relevant Studies in Software Engineering' (no double quote)
"On Searching Relevant Studies in Software Engineering" (no single quote)
x"On Searching Relevant Studies in Software Engineering" OK
x "On Searching Relevant Studies in Software Engineering" (space does not matter)
a "On Searching Relevant Studies in Software Engineering" (letter does not matter)
Don't ask me why this is so strange!

How to crop PDFs on Linux?

$ apt-get install texlive-extra-utils
$ pdfcrop figure.pdf
It removes the blank margins around the content. Very useful to obtain compact figures to include with pdflatex.

How to export Eclipse ecorediag diagrams as vector graphics PDF?

The Ecore Tools Diagram plugins should be able to export PDFs but it's buggy. A solution is to:
1) install a PDF distiller printer (e.g. CUPS-PDF on Linux or PDFcreator on Windows)
2) right-click on the diagram, "File>>Print"
3) Select the PDF printer
4) Click on the option "Fit to" options"
5) Click on "OK"
6) Crop the resulting PDF (e.g. on Linux: $ pdfcrop diagram.pdf)

How to remove comments from Latex sources ?

and submit clean sources to arxiv :-):
$ sed -i -r -e '/^[[:space:]]*%/ d' -e 's/([^\\])%.*$/\1/' *tex

How to set up automated backups of mysql?

I recommend the package automysqlbackup.

What is /sys/block/sda/device/queue_depth?

The queue depth is the number of I/O operations that are sent in parallel on a device. (http://publib.boulder.ibm.com/infocenter/storwize/ic/index.jsp?topic=/com.ibm.storwize.v7000.doc/svc_iscsiqueuedepthlimits.html)

How to find a Latex symbol?

http://detexify.kirelabs.org/classify.html

How to fix "totem: Could not create element 'gconfaudiosink'"?

Solution: $ apt-get install gstreamer0.10-gconf (or gstreamer-gconf depending on your distro)

How to fix "jackd/jackd2: Cannot lock down memory area (Cannot allocate memory)"?

Solution: increase the memory allocated to /dev/shm or /run/shm in /etc/fstab (for instance from 10M to 100M). Then $ mount -o remount /run/shm

How to share user-defined custom styles accross documents in libreoffice/openoffice?

Set up a default template, e.g. .libreoffice/3/user/template/default.ott (http://wiki.services.openoffice.org/wiki/Documentation/OOoAuthors_User_Manual/Writer_Guide/Setting_a_default_template), add the style in this file.

Scp and rsync hangs/stalls while ssh works

Cause: ICMP packets are firewalled and one of the machines have high MTU set (jumbo frames).
Consequence: Path MTU discovery (pmtud) fails and the machines use high MTUs that are not supported by routers along the path
Solution: Set the MTU to the standard value (1500) on both machines.

How to match the last line with sed?

To match the end of file, the end of document, sed uses a dollar $
For instance, sed '$d' deletes the last line of a file.

How to copy highlighted code from Eclipse in OpenOffice/LibreOffice impress?

Ctrl-C in Eclipse, then Ctrl-V in OpenOffice Text, then Ctrl-C in in OpenOffice Text, then Ctrl-Shitf-V in Impress, selection Formatted Text [RTF]

How to save documents from a Google result page with right-click >> Save link as... ?

Because of the tracking mechanism of Google with special URLS, one can not right click on a search result to save it (handy for PDF files for instance). This Greasemonkey script fixes this issue.

How to obtain copyable ASCII single quote (#39) in code listings with package listings in LaTeX?

Add the option \lstset{upquote=true} and \usepackage{textcomp}. You can then copy code!
See also http://www.monperrus.net/martin/copy-pastable-listings-in-pdf-from-latex.

How to change the label of a vfat partition?

dosfslabel /dev/sdb1 the-new-name

In ANTLR3, what does the BANG/exclamation mark (!) mean right after a rule name?

It means that an AST node won't be created for this rule (even if it contains a tree construction part with "->")

How to measure Java software (LOC/SLOC)?

See Java Metrics - Free and Commercial Measurement Software

USB drives are mounted by Nautilus but don't show up in the UI?

To be visible in Nautilus, USB drives and memory sticks must be mounted under /media. /media must be a real directory and not a symlink. References: http://ubuntuforums.org/showthread.php?t=1657791, http://askubuntu.com/questions/2280/selective-mounted-volumes-for-the-gnome-desktop-and-nautilus-sidebar

What's the unit of the stripe-width parameter of mkfs.ext4?

From the man page: Configure the filesystem for a RAID array with stripe-width filesystem blocks per stripe, which means that the unit is 4096B, equivalent 4 512B-sectors. Hence, a stripe width of 128KiB (e.g. for SSD) corresponds to stripe-width=32.

How to install a printer Brother DCP770CW on a 64 bits system?

Simply force the installation of the 32 bits packages found on http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/download_prn.html:
$ dpkg -i --force-all dcp770cwcupswrapper-1.0.1-1.i386.deb dcp770cwlpr-1.0.1-1.i386.deb
This works with ia32-libs installed.

How to remove the page break before the bibliography?

This may be caused by the natbib package. Just remove the package import (this worked for me using the LNCS style llncs). See also Bibliography Starts on a New Page.

I can not delete notes in Tomboy, the right-click option "delete" is greyed out

Well, I don't know the cause, but selecting the note and using "Del" on the keyboard works.

How to disable gnome-shell in Gnome 3?

Select "Gnome Classic" as session type in the login manager. Also, to set up your panel again, you now have to Alt+right-click.

How to set the default browser in Gnome 3?

System Tools >> Preferences >> System Settings launches gnome-control-center
Then go in System Info->Default Applications->Web

If your browser doesn't show up in the dropdown bow, add the following line in ~/.local/share/applications/mimeapps.list:
x-scheme-handler/http=firefox.desktop;

Note that 1) you may replace firefox.desktop by your-favorite-browser-launcher.desktop (e.g. opera.desktop) 2) you may use gnome-desktop-item-edit to create a .desktop file (that should be located in ~/.local/share/applications).

Big thanks to http://raphaelhertzog.com/2011/04/18/status-update-of-gnome-3-in-debian-experimental/.

How to disable password check/screen lock after suspend on Gnome 3?

System Tools >> Preferences (gnome-control-center), then Screen >> Lock (from http://ubuntuforums.org/showthread.php?t=1856761)

How to obtain centered columns with Latex package tabularx?

\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
...
\begin{tabularx}{\textwidth}{|p{2cm}| Y | Y | Y | Y |}

Evince/Xpdf don't receive keyboard input with mozplugger on Firefox

Solution: remove option needs_xembed from the corresponding lines in 'mozpluggerrc'.

Why do I get "lp: Error - unable to access"?

Calling cups from KDE (e.g. okular) or acroread, you may get the error "lp: Error - unable to access. It means the lp (or lpr) is incorrect. Check which lp and lpr are available on your machine. It my case, the faulty lp was actually a lpr in the user-specific bin directory (~/bin)

How to fix "Paragraph ended before \BR@c@bibitem was complete"?

In Latex the bibliography style IEEEtran (\bibliographystyle{IEEEtran}) and the package bibentry are incompatible. A fix consists of using another style (e.g. \bibliographystyle{plain}).

How to disable mounting /tmp as tmpfs in Debian?

Set RAMTMP=no in /etc/default/rcS

How to force using pdflatex on Hal/Arxiv?

Add \pdfoutput=1 in the preamble of the Latex document.

How to change the port for Subversion over SHH (svn+ssh)?

Add a "new" protocol in ~/.subversion/config:
[tunnels]
ssh22345 = ssh  -p 22345
Then use repository URLs of the form svn+ssh22345://user@server.com/svn/path/to/repo
From http://www.techper.net/2009/01/11/changing-port-number-of-svnssh-subversion-protocol/.

How to automatically remember SSH passwords for Subversion over SHH (svn+ssh)?

Add a "new" protocol in ~/.subversion/config:
[tunnels]
#1234 is the password
ssh-with-pass = sshpass -p 1234 ssh
Then use repository URLs of the form svn+ssh-with-pass://user@server.com/svn/path/to/repo
This works without SSH keys.

See also http://fetchsoftworks.com/blog/subversion-and-ssh-authentication-shenanigans for another excellent yet somewhat heavier solution.

How to set up Linux's X/Xorg on a laptop Samsung np305/np-305/np305ua1?

Solution: load kernel module radeon and use Xorg driver fbdev.
On my laptop (kernel 3.2.0), this allows a display of 1368x768 supporting suspend-on-RAM.
Debug info from lspci: 00:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Wrestler [Radeon HD 6320]