Powered by
Movable Type 3.38 mod_perl/2

 September 2009 Archives

2009, September 01 (Tue)

Linux Xrandr custom resolution

Some monitors claim to support less resolutions than they do, or sometimes your video card might be broken and incorrectly detect the monitor data. In such a situation, xrandr will not show an entry for the desired resolution and you have to add it yourself.

To do so, you first have to create a new “mode” using the xrandr --newmode function. To get the timings, you can use the gtf utility. Together, a command might look like this:

`gtf 1600 1200 60|grep Modeline|sed -e's|Modeline|xrandr --newmode|'`

Then you can assign this mode to your monitor, like this:

xrandr --addmode VGA '"1600x1200_60.00"'

Remember to put the double quotes, this is because gtf outputs the mode name in quotes. If you don’t like this, use a different way to parse the gtf output.

Linux openSUSE multiple parallel distribution-default kernels

I’d like to install multiple kernels, one of the recent development Linux 2.6.31 kernels that openSUSE makes available in the Kernel:HEAD project and the ones in the distribution update channel that contain mostly security fixes and are of version 2.6.27 for openSUSE 11.1.

Unfortunately, the GTK package manager offers no good way to install multiple versions of the same thing, so I wrote two scripts that will download and install the kernel using rpm and also delete the older kernels.

clean_kernels will use rpm -e to uninstall all kernels except the two most recent. Just run it as is

get_kernel will download and possibly install the latest kernel from Kernel:HEAD. You should make a symlink with ln -s get_kernel get_update_kernel which will then download and possibly install the latest kernel from the update repository.

Maybe there are better ways to do this, tell me if you know.


2009, September 02 (Wed)

 ARD Mediathek

rtmp://vod.daserste.de/ardfs/mp4:videoportal/Film/c_90000/12345/format98765.f4v

rtmpdump -n vod.daserste.de -a ardfs -y mp4:videoportal/Film/c_90000/12345/format98765.f4v -o film.flv

Linux xterm startup extremely slow under certain locales (chinese zh_CN.UTF-8)

I noticed xterm/uxterm being extremly slow on startup and also on displaying the fonts menu when running under a zh_CN.UTF-8 locale. strace shows the culprit:

03.833720 writev(3, [{"1\1\4\0\1\0\7\0", 8}, {"*-GBK-0", 7}, {"\0", 1}], 3) = 16 <0.000032>
03.845074 writev(3, [{"1\1\5\0\1\0\t\0", 8}, {"*-*-GBK-0", 9}, {"\0\0\0", 3}], 3) = 20 <0.000044>
03.906162 writev(3, [{"1\1\5\0\1\0\v\0", 8}, {"*-*-*-GBK-0", 11}, {"\0", 1}], 3) = 20 <0.000046>
04.135018 writev(3, [{"1\1\6\0\1\0\r\0", 8}, {"*-*-*-*-GBK-0", 13}, {"\0\0\0", 3}], 3) = 24 <0.000040>
04.767843 writev(3, [{"1\1\6\0\1\0\17\0", 8}, {"*-*-*-*-*-GBK-0", 15}, {"\0", 1}], 3) = 24 <0.000031>
06.062369 writev(3, [{"1\1\7\0\1\0\21\0", 8}, {"*-*-*-*-*-*-GBK-0", 17}, {"\0\0\0", 3}], 3) = 28 <0.000032>
07.999531 writev(3, [{"1\1\7\0\1\0\23\0", 8}, {"*-*-*-*-*-*-*-GBK-0", 19}, {"\0", 1}], 3) = 28 <0.000032>
10.235677 writev(3, [{"1\1\10\0\1\0\25\0", 8}, {"*-*-*-*-*-*-*-*-GBK-0", 21}, {"\0\0\0", 3}], 3) = 32 <0.000032>

… and so on.

One possible workaround is to disable the GBK fontset in /usr/share/X11/locale/zh_CN.UTF-8/XLC_LOCALE. This file has an entry like the following:

#  fs3 class (Chinese Han Character GBK)
fs3    {
       charset {
               name    GBK-0:GLGR
       }
       font    {
               primary GBK-0:GLGR
               substitute GB13000.1993-1:GLGR
       }
}

If you remove it, xterm will be back to its blazing fast startup time.

Further readings:
Solaris Bugreport and fix in Solaris
Chinese blog post related to this problem on FreeBSD
Another blog post with the same solution as explained here
And a chinese forum thread about the issue

Proper fix welcome…


2009, September 29 (Tue)

 comments and tags broken

fixed now

 LaTeX url slash spacing/kerning

Writing my thesis, I was faced with internet sources in my bibliography. By default, the url (or hypertex) package uses tt-fonts for the URLs, however, I didn’t want to mix in another typeface.

Consider the result that I got with \urlstyle{same}:

http: / / www.archives.gov / genealogy / census / soundex.html

I didn’t like the extreme spacing between the slashes (//), although it was obviously the same result as if I’d typed // directly somewhere in my document.

Finally, after studying the url.sty source for a while, I came up with the following hack:

\urlstyle{same}
\def\UrlBreaks{\do\.\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]%no @
 \do\)\do\,\do\?\do\'\do+\do\=\do\#}%
\def\UrlBigBreaks{\do\/\do@url@hyp}%add /
\def\UrlSpecials{\do\/{\Url@slash}\do\ {\Url@space}\do\%{\Url@percent}\do\^^M{\Url@space}%
   \Url@force@Tilde}%
\def\Url@slash{\@ifnextchar/{\kern-.11em\mathchar47\kern-.3em}%
   {\kern-.1em\mathchar47\kern-.08em\penalty\UrlBigBreakPenalty}}

That will use the \UrlSpecials variable to assign a special behaviour to the /-character, whereupon I manually do the necessary kerning for this result:

http://www.archives.gov/genealogy/census/soundex.html

Obviously this doesn’t seem a very nice hack, so better suggestions are welcome. By the way, you could use \@gobble in the \@if-argument if you wanted to eat the next slash, for example directly typesetting them both at once, avoiding the \kern#\kern# in your document.