Ivan Kanis blog

Nano editor easter egg (July 18, 2016)

Here is how to display the easter egg in nano. Run nano and enter some text. Press C-x, press y, enter "zzy" as the file name. I will not say what happens next as it spoils the fun.

As far as I know Emacs does not have one. Well there is M-x butterfly...

setting up rkhunter (November 15, 2015)

rkhunter is a useful tool to check that your server is not infected with a rootkit.

On debian 8.2 it is missing a dependency so you will have to install it by hand:

apt-get install libwww-perl

Next you will need to run the following command once:

rkhunter --propupd

Edit the file /etc/default/rkhunter and changer the following variable:


This will run rkhunter every day and e-mail you if there is a problem.

Now you need to check that there is no error or warning:

rkhunter --check

As you are fixing the errors or warnings you can narrow down the tests with the following commands:

rkhunter --check --enable filesystem

I left one warning to make sure I got an e-mail the next day.

Fix Intel video acceleration on Xubuntu 14.4 (November 05, 2015)

If you get the following error when running mplayer:

Failed to open VDPAU backend libvdpau_i965.so: cannot open shared object file: No such file or directory

It means that mplayer did not find the video acceleration driver library. This means that your CPU is playing video instead of your video card. This is not the optimal configuration so here are the steps to fix it.

First install the driver:

apt-get install i965-va-driver libvdpau-va-gl1

Next, you will need to have the variable VDPAU_DRIVER set to the GL library name. Edit /etc/environment and add the following line:


Reboot and you should not see the error anymore.

Learning Lisp is like learning ancient Greek (July 21, 2014)

Learning Lisp is like learning ancient Greek; although it is alien, it provides insight into modern computer languages.

Messing with xterm (March 17, 2014)

I spent all morning messing with xterm. It started with an innocent question that I sent to the vim mailing list. When I pressed mf in the netrw buffer I was not getting any cue that the file was marked.

Charles told me it was turning the file bold on his setup. I realized I turned off bold font in xterm because I find them ugly. In Emacs I display bold as yellow. Wouldn't it be nice if xterm did the same?

Here is how I did it:

% mkdir .terminfo
% cd .terminfo
% infocmp -I screen-256color > screen-ivan

No I can hack the escape sequence of the terminal. I replaced the bold sequence \E[1m with \E[0;33m. Vim is displaying underline in the netrw and it's not pretty. For fun I display purple instead of underline by setting smul to \E[0;35m and rmul to \E[0;37m.

Next I compile my terminfo and set my terminal:

tic screen-ivan
export TERM=screen-ivan

And here is the result on man page:

Now that I could see bold font I was surprised that vim open a plain text all in bold. Well it's due to the following setting:

hi Normal ctermfg=white

It seems straightforward but it implies that the bold font will be used. The default white in xterm is grey (color7). That is so you can see a 'bold' white with color15. Xterm implies that bold font are brighter. Since I don't care for the dull color I have set the color I want by editing ~/.Xresources like so:

XTerm*color0: black
XTerm*color1: red
XTerm*color2: green
XTerm*color3: yellow
XTerm*color4: blue
XTerm*color5: magenta
XTerm*color6: cyan
XTerm*color7: white
Xterm*colorMode: false

Now I have to redo how I specify colors in ~/.vimrc:

" colors

" (black 0) (red 1) (green 2) (yellow 3) (blue 4) (magenta 5) (cyan 6)
" (white 7) (orange 220)

" Tone down the fruit salad
hi Normal ctermfg=7
hi Comment ctermfg=2
hi Function ctermfg=6
hi Statement ctermfg=5
hi Identifier ctermfg=7
hi Number ctermfg=7
hi Operator ctermfg=7
hi PreProc ctermfg=7
hi Statement ctermfg=5
hi Special ctermfg=7
hi String ctermfg=220
hi Type ctermfg=7

Note that I am using 220 for strings. This gives me the color orange for strings. I had to compile strings with 256 colors:

./configure --prefix=/home/ivan/local --enable-colors256
make install

There is a script called 256colors2.pl that will display all the available colors. I modified it a tiny bit to display the number of the color:

And I finally fixed the highlighting of the netrw directory file with the following line in ~./vimrc

hi TabLineSel ctermfg=3

Gnus simple split unexpected feature (March 09, 2014)

I used to use the fancy split. Some months ago I reduced my inboxes a lot and felt fancy split wasn't needed anymore. I ended up with something like this:

(setq nnmail-split-methods
     '(("linux-nantes" "\\([tT]o\\|[cC]c\\):.*linux-nantes@univ-nantes\\.fr")
       ("bbdb" "\\([tT]o\\|[cC]c\\):.*bbdb-info@lists\\.sourceforge\\.net")
       ("stumpwm" "\\([tT]o\\|[cC]c\\):.*stumpwm-devel@nongnu\\.org")
       ("interesting" private-is-email-in-bbdb)
       ("spam" "X-Spam-Flag: YES")
       ("boring" "")))

The idea is to put each mailing list in its separate boxes. Interesting e-mail are based on my bbdb database queried by the function private-is-email-in-bbbd.

It worked as I expected except when they were more than one positives. For example, I had someone I know in my bbdb post to the Linux Nantes mailing list. What happened is that Gnus will create an e-mail on each inbox! Clearly that's not what I want.

So I am using again the fancy splitter which does exactly what I expect. The (| statement indicates to stop a the first positive.

(setq nnmail-split-methods 'nnmail-split-fancy
      '(| (to "linux-nantes@univ-nantes\\.fr" "linux-nantes")
          (to "bbdb-info@lists\\.sourceforge\\.net" "bbdb")
          (to "stumpwm-devel@nongnu\\.org" "stumpwm")
          (: private-is-email-in-bbdb)
          ("X-Spam-Flag" "YES" "spam")

Note that the syntax is much easier to read. There is no hairy regexp to match To and Cc, all that is handled by the to symbol. I had to modify private-is-email-in-bbdb to return "interesting" instead of t on success.

New emacs packages (February 20, 2014)

Here are three emacs packages that got my interest lately.

elfeed is a fine RSS reader. Since the demise of Google news reader I went back to newsticker. I have never been very happy with it. I am glad elfeed does a much better job. I run it on a second emacs because the HTTP fetching slows everything down.

lispy is a new kid on the block. It's inspired on paredit but works on single key stroke. I reported it broke edebug and Oleh Krehel fixed it the next day. I have disabled the insertion of matching parenthesis and quotes as it drives me crazy.

Finally a minor mode for dired called dired-details.el. It hides all that superfluous stuff displayed left of the file name in dired. A keystroke ')' will show the details again. It's very nice in directories with long file name.

I will give a training course on how to program Emacs (February 17, 2014)

I will give a 3 days training in Nantes on how to extend Emacs with elisp. If there is interest I can talk also about org meta programming with org babel. The training date is from June, 30 to July, 2. I will speak in french (or English if everyone is comfortable with it).

The maximum number of attendees will be six in order to have a convivial atmosphere and that no-one feels left out.

I feel that talking about coding is more fun while showing how to solve concrete example. You are encouraged to bring material that you are trying to solve. My goal is to show you how to make Emacs do what you want it to do, while learning elisp programming.

The training cost is 1,800 euros (tax included). If you are an employee in a french company you can use your OPCA to pay for it.

The following is the link to the web page outlining the training in french :


I have translated it in English :

Presentation of the program:

First steps:

Program with Emacs Lisp:

If you are interested in attending, please contact 2i2l at +33 02 40 3702 06 or formation@2i2l.fr

I am kicking the tires of emacs trunk (February 12, 2014)

I used eww on 24.3 that I back ported. I had a small issue in gnus so I decided to migrate to emacs trunk. Since it's in feature freeze it should be pretty usable.

I then spent two days investigating the bugs that I was finding. I published 4 bugs:

Finally I spent a lot of time investigating slow typing in org mode. It turned out it was my jumpc code. I have disabled it. Since I am not using it so I am not planning on fixing it.

On Ubuntu 13.10 halt does not turn off my computer anymore (February 04, 2014)

I migrated from 10.10 to 13.10. I usually turn off my computer by typing sudo halt in xterm.

With the new version of Ubuntu my computer will halt but not power off. Taking a look at the man page there is a command called poweroff that does the job. I find it awkward to type as my old habits die hard. A better alternative for me is to pass the argument -p to the halt command.

So I now type sudo halt -p to turn off my computer.

On Ubuntu 13.10 halt does not turn off my computer anymore (February 04, 2014)

I migrated from 10.10 to 13.10. I usually turn off my computer by typing sudo halt in xterm.

With the new version of Ubuntu my computer will halt but not power off. Taking a look at the man page there is a command called poweroff that does the job. I find it awkward to type as my old habits die hard. A better alternative for me is to pass the argument -p to the halt command.

So I now type sudo halt -p to turn off my computer.

Why I use zsh instead of bash (January 23, 2014)

It's been now two years that I use zsh as my interactive shell. Twice I had a coworker ask me why I use it. Since I am not a very good salesman, I could not tell on the spot why I switched. I will try explaining what made me a convert.

The command I like the most is M-p. I can type 'tar' then use M-p to go to the previous use of that command. I use it now all the time instead of C-r.

In a similar vein the command M-. copy the previous last argument. Pressing it repeatedly moves to previous commands.

To switch directory I just type the name of the directory without cd. (You might notice a trend here that I love saving keystrokes!). Unfortunately it's not on by default. I have the following line in my .zshrc:

setopt auto_cd

There are other goodies such as auto correct, extended glob, a great completion system (compinit), built in regular expression, etc... I won't get into it. It suffices to say that zsh is choke full of features and will do what you want it to.

I have published my .zshrc if you are curious to see it. I have a ssh wrapper function. I use it to connect to servers that don't belong to me. On the server I have two files (.zshrc and .vimrc) that I put in a hidden directory (~/.ivan). With this technique I don't mess up the system administrator preference such as vim color.

The other noteworthy function is zshrc_build_path. It sets up a PATH environment by checking that each directory exists. This keeps PATH tidy which is useful since I juggle many machines. I used to have a Python script that would generate a .bashrc, it was gross.

Although I don't use it I know that people like Oh My Zsh! so I am sure it's worth checking out too.

I do not understand Twitter (January 12, 2014)

Everyone is talking about twitter. Today I was messing with it on my Android device. Naturally I looked at the #emacs hashtag. I was annoyed I could not subscribe to it. There were not many tweet and they were mostly uninteresting.

I looked up @sachac and saw that she was chatting with @ergoemacs. I could not find a way to follow their discussion.

I have the same feeling I had in 1995 when my colleague Matt at Microsoft told me about the Web. I was not getting it. He was telling me he could order pizza online. I told him I could just pick up a phone and do that. I could also download files from my BBS, what was the point of it?

It took me some months to appreciate the Web. I have created a Twitter account five years ago and I still fail to find it interesting. What am I missing? Send me a tweet! ;)

Blazing Fast Gnus (June 30, 2013)

Emacs Gnus uses synchronous network connection. That means Emacs will wait for Gnus to finish. It will also freeze on the slightest hitch. It didn't bother me much as I only checked news and mail once a day. I viewed them as a distraction.

Now that I have setup a timer function that checks for interesting e-mail every minute, it's not peachy anymore. I have experienced emacs freezing. That is not a crash as timers and display would still work. However Emacs was unusable because I couldn't input keys anymore.

Stefan Monnier suggested I wrap my mail fetching function around with-local-quit. That helped, but I still had to hit C-g from time to time when the network operation took too long.

I had already offloaded e-mail fetching with getmail. Clearly I had to do the same thing with news. Finding the right software was not easy. Someone on #emacs in IRC suggested leafnode and that was just what I was looking for.

One nice feature of leafnode is that it can handle multiple news server. Here is my basic configuration:

expire = 20
server = news.gmane.org
server = nntp.aioe.org
server = news.gwene.org
initialfetch = 500

The server needs to run on an inetd wrapper. Debian sets that up nicely. The only bother is that I had to setup a fully qualified name on my home computer. I put tao.kanis.fr in the file /etc/hostname and I was good to go.

I just need to run fetchnews every minute. I tried to put it in /etc/crontab but it didn't work. I finally added it to my getmail.sh script. As its name implies it fetches mail every minute.

Now I just need to tell Gnus to fetch news from my computer instead of over the network:

(setq gnus-secondary-select-methods '((nntp "tao.kanis.fr")))

Now that Gnus does not interact with the network anymore, I have a blazing fast retrieval time. Emacs does not stop or freeze anymore. It's great!

Make Big Font For OSX Xterm (June 22, 2013)

I wanted a big font on my xterm in order to do a presentation. My laptop is a PowerBook. Unlike Linux, The X server on OSX only handles bitmap.

I compiled otf2bdf and downloaded the Inconsolata true type font. I then ran the following script to create a 30 point bitmap font:

otf2bdf -p 30 Inconsolata.otf > inconsolata.bdf
bdftopcf -o inconsolata.pcf inconsolata.bdf
rm inconsolata.pcf.gz
gzip inconsolata.pcf
sudo cp inconsolata.pcf.gz /usr/X11R6/lib/X11/fonts/misc
xset fp rehash

I ran the following as root to register the font:

mkfontdir .
xset fp rehash

I can now open up xterm with the font generated. I changed the point size in the above script till xterm took the entire width of my screen.

xterm -fn '-freetype-*-*-*-*-*-*-*-*-*-*-*-*-*'

As you can see the result is not perfect. It must be a bug in the conversion program but it's good enough for a presentation.

E-mail Notification With Gnus (June 07, 2013)

Over the last week I have revamped my Gnus configuration. I used to look at my e-mail once a day because I felt it was distracting. I now want notification of interesting e-mail every minute.

I will detail how I have setup this feature with my new configuration.

To speed up Gnus you need to set the nnml backend as your primary select method. This is critical as setting up a news server will use the network and slow things down.

I use getmail to fetch e-mail on a maildir directory. This way I don't have to deal with file locks of an mbox file. The getmail configuration is:

type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = ivan.kanis@googlemail.com
password = secret

type = Maildir
path = ~/keep/Maildir/

delete = True

The variables to set in Gnus are:

(setq gnus-select-method '(nnml ""))
(setq mail-sources '((maildir :path "~/keep/Maildir")))

Before I used to do fancy splitting. It turned out to be a pain to maintain. I now use plain splitting with three inboxes: interesting, medium and boring.

 '(("medium" ".*bbdb-info@lists\\.sourceforge\\.net")
   ("medium" ".*stumpwm-devel@nongnu\\.org")
   ("interesting" private-is-email-in-bbdb)
   ("interesting" "X-Ivan: interesting")
   ("boring" "")))

The function private-is-email-in-bbdb will check that the person that sent me an e-mail is in bbdb. If that's the case, the e-mail will land in the "interesting" inbox.

(defun private-is-email-in-bbdb (arg)
    (goto-line 1)
    (when (re-search-forward "^From: \\(.*\\)" nil t)
      (let ((e-mail (nth 1 (gnus-extract-address-components (match-string 1)))))
        (bbdb-search (bbdb-records) nil nil e-mail)))))

The "X-Ivan: interesting" header comes from my mail server.

I define a function that will fetch new e-mail:

(defun private-get-mail ()
  (when (get-buffer "*Group*")
    (setq ivan-var-display-message nil)
    (let (state)
      (setq state gnus-plugged)
      (gnus-agent-toggle-plugged t)
      (gnus-agent-toggle-plugged gnus-plugged))
    (setq ivan-var-display-message t)))

(run-at-time t 60 'private-get-mail)

I have gmane news as my secondary select. The function unplugs Gnus so it won't check for news over the network. I think it would be too slow.

The ivan-var-display-message variable is a nasty, nasty hack to hide all the messages issued by Gnus while it fetches e-mail. I have advised the message function like so:

(defadvice message (around ivan-fun-message activate)
  "Shut up message"
  (when ivan-var-display-message

The following function shows the e-mail indicator when there are messages in my interesting inbox (thanks to Julien Danjou):

(defun private-check-email ()
  "Return t when there are interesting e-mails"
  (when (boundp 'gnus-newsrc-alist)
    (dolist (entry gnus-newsrc-alist)
      (let ((group (car entry)))
        (when (string= group "interesting")
          (let ((unread (gnus-group-unread group)))
            (when (and (numberp unread)
                       (> unread 0))
              (return t))))))))

(setq display-time-mail-function 'private-check-email)

And now I have an indicator when there is an interesting mail to read.

Hyper Key (May 31, 2013)

I am using the / and the z keys to act as if I pressed the Alt key. Now I have the actual Alt key on my keyboard free for other uses. I have mapped it to be the Hyper key. I then use this modifier so that the keys i, j, k and l will do cursor motion.

First I set up my .xmodmap thus:

keycode 133 = Hyper_L

All keyboard are different. You can find your keycode with the program xev.

Mapping the keys in Emacs, I disable the usual keys so that I get into the habit:

(global-set-key (kbd "H-j") [left])
(global-set-key (kbd "H-k") [down])
(global-set-key (kbd "H-i") [up])
(global-set-key (kbd "H-l") [right])
(global-set-key (kbd "C-b") nil)
(global-set-key (kbd "C-f") nil)
(global-set-key (kbd "C-n") nil)
(global-set-key (kbd "C-p") nil)))

Mapping the keys in xterm with the file .Xresources:

XTerm*VT100.translations: #override \n\
 Hyper<Key>i: string("0x1b") string("[A") \n\
 Hyper<Key>k: string("0x1b") string("[B") \n\
 Hyper<Key>l: string("0x1b") string("[C") \n\
 Hyper<Key>j: string("0x1b") string("[D")

I feel that the motion keys in emacs are awkward. With this hack I will be able to use the same keys for Emacs, vim and the command line. I am not sure it's worth it, time will tell.

Zsh Directory Stack (May 15, 2013)

Directory stacks are handy to get back to a previous directory. You can manipulate the stack with push and popd. The command pushd is a bit long for me so I use the option auto_pushd instead.

# automatically do a pushd of each cd in a directory
setopt auto_pushd

Now the directories are inserted in the stack with each cd command.

There is a neat way to switch to any directory in the stack by using completion.

     cd - TAB
0 -- /home/ivan
1 -- /home/ivan/www/english
2 -- /home/ivan/keep

Hitting the TAB key shows you the entire stack. Just input the number and it will switch to that directory.

Vim Jump Cursor For Emacs (April 18, 2013)

jumpc.el implements the jump cursor feature found in vim.

A jump is added every time you insert a character on a different line.

Jumps are remembered in a jump list. With the C-o and C-i command you can go to cursor positions before older jumps, and back again. Thus you can move up and down the list.

Jumps are read and saved in the same configuration file as vim so you can switch back and forth between the two editors

It part of GNU ELPA so it's very easy to install.

Verifying A GPG Signed File (April 01, 2013)

For some reason searching the Internet didn't me help much. So here are the steps to verify the integrity of a file you have downloaded on the Internet.

      gpg --verify-files emacs-24.3.tar.gz.sig
gpg: Signature made Mon Mar 11 03:04:35 2013 CET using RSA key ID A0B0F199
gpg: Can't check signature: No public key

This means you need to import the public key A0B0F199.

      gpg --keyserver keys.gnupg.net --recv-keys A0B0F199
gpg: requesting key A0B0F199 from hkp server keys.gnupg.net
gpg: key A0B0F199: public key "Glenn Morris <rgm@gnu.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

Now that you have received the public key, you can verify the file.

      gpg --verify-files emacs-24.3.tar.gz.sig
gpg: Signature made Mon Mar 11 03:04:35 2013 CET using RSA key ID A0B0F199
gpg: Good signature from "Glenn Morris <rgm@gnu.org>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: B294 26DE FB07 724C 3C35  E5D3 6592 E9A3 A0B0 F199

The file is good. The warning just means you haven't met Glenn in person for a key exchange. It is very unlikely that the file you have downloaded is infected.

Exim Authenticate With Pam Library On FreeBSD (March 28, 2013)

You need to run exim as root. So edit Local/Makefile thus:

# FIXED_NEVER_USERS=root (comment out)

In your configuration file set:

exim_user = root
exim_group = mail

And, hey presto, it works! I hope it will save you the many hours it took me to figure it out.

Changing My Habits (March 21, 2013)

What I think is wonderful in my trade is that I can program the tools that I work with. I am trying to be as productive as possible. However when I add something to be more efficient I still use the old way. It's muscle memory. Here is how I fix it.

For example, I have made an alias of v to launch vim.

alias v=vi.sh
bindkey -s vi "type v instead"

The second line will help me get out of the habit of typing vi. When I type vi, it will say to type v instead. The nice thing is zsh will show me the message before I hit return.

In zsh typing 'cd' is not necessary to move into a directory when the auto_cd option is set. I have typed 'cd' for the last 20 years so there was only one way to improve:

setopt auto_cd
bindkey -s cd 'Not needed in zsh'

Prevent Fork Bomb From Crashing A Linux Server (March 18, 2013)

So my server crashed the other day. For the anecdote, my e-mail spam filter was going in an infinite loop with Richard Stallman's filter.

A fork bomb is when you are spawning too many process. The easiest way to create one is to write a script shell that calls itself. Notice if your server becomes unusable.

This is not a good thing. It could lead to a denial of service. It's so simple to fix I wonder why it is not done by default on Debian.

Edit /etc/security/limits.conf

*                hard    nproc           1000

That will limit the number of process to 1000. Fixed!

Display Year Calendar In Emacs (March 11, 2013)

What a shame to only have 3 months in Emacs calendar. This hack displays a proper year calendar.

Reading Keyring Password Files With Vim (March 03, 2013)

I put all my passwords in a GPG encrypted org-mode file called keyring.gpg. In a pinch, I don't want to wait for emacs to start in order to read the file. So I have created a one line script called view-keyring.sh to open the file in Vim.

gpg -d ~/dyn/keyring.gpg | vi -

Delimiting Text Wrapping In Emacs (February 24, 2013)

I maintain several quote files. Each quote is separated by %. The author line starts with " —". This line at the top is how I tell to wrap quotes without messing everything.

-*- mode: text; paragraph-separate: "%\\|    --"; -*-

The text is a simple regular expression. I guess it can be useful for other formats.

Versatile Cat (February 02, 2013)

Of course I am not talking about the pet. Unix cat has two useful switches that I have overlooked for year.

First -e show end of line as $, I find that useful to check my shell script to see if I made and error when defining a variable.

Next is -A that will display tab as ^I. It was a life saver when I was troubleshooting an automated Debian script. I had to seed configuration variable and the program was expecting tab instead of space.

Feeling At Home On Someone Else's Server (January 17, 2013)

I used to do crazy stuff to setup my Unix environment. Back when I was working at Tadpole, I had a Python script that would generate a .profile with paths that existed. Madness!

At Bouygues Telecom I saw the light. Actually I saw it when I finished working there, but that's another story .

The project I was working on had a regression test suite that was written entirely in shell. This made me realize that it was sufficiently powerful to setup my environment. So I started using bash or ksh to setup binary paths, ls colors, etc...

Later, I started using zsh and now there is no way I am going back to bash. I think of it as the emacs of shells. It comes with the kitchen sink.

Anyway to get to the point of this blog, these days to feel at home on a server I only need two configuration files:

When I am sharing an account .zshrc is usually OK as everyone else uses bash. However my .vimrc is problematic as it messes the other users editing experience. They will notice the colors are not right on their white background.

This is what I do to keep everyone happy. I renamed .vimrc to .vimrc-ivan and do the following in .zshrc to load it up:

# setup which vi to use
which vim > /dev/null 2>&1
if test $? -eq 0 ; then
    export EDITOR=vim
    if test -f ${HOME}/.vimrc-ivan ; then
        alias vi="vim -u ${HOME}/.vimrc-ivan"
        alias vi=vim
    export EDITOR=vi

In the same vein I want to run zsh on the server when I login. I can't change the shell of the account, that would also annoy people. I simply alias ssh in .zshrc:

# change host name in screen
ssh () {
    if [[ $1 -regex-match  '(redmine.*|jenkins.*)' ]] ; then
        # start zsh on servers that don't belong to me
        /usr/bin/ssh $* -t exec zsh
        /usr/bin/ssh $*
    if test x${TERM} = xscreen ; then
        printf "\033k`hostname -s`\033\\\\"

Now when I ssh to a server I have the prompt I like and I can edit files the way I want to. All this without irritating others is a boon. It's time to hack and be merry!

Configuring To Build Guile On Debian (January 11, 2013)

Should be easy, right? Of course not!

apt-get install libunistring libunistring-dev libffi-dev libgc-dev
BDW_GC_CFLAGS=-L/usr/lib BDW_GC_LIBS=-lgc ./configure

Play Sound On Activity With GNU Screen (January 10, 2013)

The first time I tried screen many years ago I didn't see the point. Now I can't live without it, I guess it's an acquired taste.

This gross hack plays sounds on activity. Here is my typical use case: I run a copy that takes a long time. As I listen to music while working I will hear a sound when it's finished.

Here is the script gong.sh that plays the sound file and the patch for screen. It's just 3 more lines and you'll need to fix the hard coded path.

I have a similar patch to copy screen selection to the X clipboard with xclip. I will post it if there is interest.

Auto Login Facebook With Emacs w3m (December 28, 2012)

One of my friend writes in Japanese on FaceBook. I look up Japanese words with Emacs. Sacha Chua mentioned that using the mobile version of Facebook works well. She suggested to turn on cookies, but I found it didn't remember my password next time I ran Emacs.

So I whipped up some code to do auto login. This is my w3m customization file so you will probably need to edit a bit before it works for you. The variables ivan-w3m-facebook-user ivan-w3m-facebook-password need to be set. Run M-x fb to launch it.

If there is sufficient interest I might write something more generic along the line of a Firefox's password manager.

Dealing With Spam (December 20, 2012)

My friend told me I should write about how I deal with spam. He said he knew no one else doing what I do, so it's worth an explanation.

I receive little spam because I run my own e-mail server. I can create as many e-mail address as I want that ends in kanis.fr.

If I receive spam I know who got infected and remove the address. For instance it happened for LinkedIn when they got hacked. I just had to remove linkedin@kanis.fr and create a new address.

All that is needed is a domain name and a Unix server. A domain name is a once a year fee. The server is $10 a month. I recommend ARP Networks if you live near the USA. I switched to Tilaa because they are closer to me geographically.

Naming Functions And Variables (December 11, 2012)

When I program I find that it is difficult to pick a name for a function or a variable. Here is my rule of thumb.

Functions are usually actions. Therefore I name them accordingly with a verb first then an object:

Some functions return a boolean. In this case I put the subject first and the verb next:

This is so that conditional statements resemble English:

Avoid double negative like the pest!

I name variables as explicitly as possible, I mostly use two word when one is not sufficient. I never put and 's' at the end, it's a source of typos. I don't abbreviate character to char or index to i. What you gain in typing is lost in refactoring or code reading. Here are some variables I created recently

That's how I do it now, it will probably change in the future ;)

Backing Up Your Unix System With Zsh Extended Glob (November 19, 2012)

Following my previous post I want to use tar instead of cpio. As before I wanted to skip big temporary directories. I spent a day trying to combine find and tar and couldn't get it to work.


# tail to skip the parent directory
find / -type d -a -not -regex "${system}" | \
     tail -n +2 | xargs tar czvf /media/portable/backup/tao/home.tar.gz

The problem with the code above is that the regular expression is unreadable.

I then remembered that zsh has tilde pattern when enabling extended glob. It matches all files before tilde except the one after. This leads to the following code:


setopt extended_glob

echo /*~(dev|proc|var/run|var/lock|sys|media|home) \
     ${HOME}/*~${HOME}/(tmp|dyn|stat|backup) \
     ${HOME}/.*~${HOME}/(.incoming|.gnome) | \
xargs tar czvf /media/portable/system.tar.gz

Note how much easier it is to read.

How To Backup You Unix System Excluding Some Directories (November 15, 2012)

It's a good idea to backup your system. I haven't done it out of sheer laziness. As they say in France "Les cordonniers sont les plus mal lacées".

I don't want to save big directories containing temporary files or external drives that are mounted.

find / -xdev -depth -regex '/\git\|backup\)' -prune -o -print0 | cpio -o0v | gzip > backup.cpio.gz

The -xdev flag of find restricts other partition mounted on the directory you are giving. Next the regex will prune directory called git or backup. The v flag of cpio will list each files being backed up.

And here is the command to restore your system:

gunzip -c backup.cpio.gz | cpio -i

Exim Slow Pause Before Banner (October 28, 2012)

I have put up with slowness when sending e-mail for a long time now. The server software called Exim would take forever before accepting what I was sending.

After much searching I found out it was doing an ident. It might be a good idea for slowing down spammers. However, for my use, I have sped it up by adding the following line in my configuration file:

rfc1413_hosts = !*.bbox.fr : *

It turns off ident for my home network that ends in bbox.fr.

GTD And Org Mode (October 19, 2012)

I think org mode is a good enough reason to use emacs. Of course there are many others but I won't delve into it for this article. For those who don't know org mode is an outliner on steroids. It's using plain text file so you can view you're data with any text editor. GTD is an acronym for Getting Things Done by David Allen.

When I started with org mode I was using tags, workflows, priorities, checklists, etc... It's wonderful stuff however I have stopped using them as I don't I feel it's needed for my use of GTD. Some may feel the tags are important to give context. I am almost always in front of a computer so this information is not very important for me.

I am currently using six org files:

I use to have all my action in one file. I was following David Allen's idea that all actions are work. I am lucky to work four days out of five and so I picked my 'off' day to do my weekly review. As I said before it didn't feel right to do work stuff at home so I am doing two weekly review: a personal one on Thursday and professional on Friday.

My action org file are outlined as such:

* In
#+category: In
** clean garage
** setup appt with doctor
* buy
#+category: buy
** music
   Jimmy Oihid - Oriental Roots
   Yardbirds - Roger The Engineer
** Donate to dynamic range radio
* emacs
#+category: emacs
** write improve file recovery
   refactor ivan-fun-diff-autosaved
** try elnode
** start a page on EmacsWiki with people's mugshot
** write shortcut between notmuch and gnus
. (and so on)
* someday
#+category: someday
** appt improvements
   add popup.
   redo multi appointment patch without refactoring
* maybe
#+category: maybe
** climb old man of hoy
** write clippy.el
** i♥emacs emacs for beginners

The first section is where I capture stuff. My weekly review is a natural process. I start at the top and type 'w' to refile. Using speed keys really help. If you don't know about it check out the documentation in the function org-speed-command-help.

Then I go through each section and see what needs to be done. I tried to be ruthless and put stuff in someday or maybe so that my list is current and feels fresh.

I then finish with things that are in someday (one day I will do it) to maybe (who knows?).

That pretty much sums up how I implement GTD with org mode.

Fixing Broken Screen Sharing On OSX 10.7 (Lion) (October 16, 2012)

The Mac has a built in VNC server for screen sharing. Unfortunately since Lion it's broken for all client except the one distributed by Apple.

I fixed this by installing Vine Server version 4.0 available here:


To have it start when your server boots you just need to go to User & Group in the System Preference. Click on the Login Items tab and drag the VNC server icon there. Obviously you will need to set autologin otherwise it won't work.

Disabling Emacs Overflowed Pure Space Warning (October 04, 2012)

I got since today this warning when I built the latest emacs. My workaround is quite simple. I just allocate double the size defined in puresize.h when running configure.


I think I will never see the warning again.

Getting Git SHA1 Of A Tree Part 2 (September 14, 2012)

Christian Neukirchen sent me an easier way.

"I knew this was easier, and it works directly, even for nested paths."

% git rev-parse master:gnupg

Getting Git SHA1 Of A Tree (September 13, 2012)

Let's say I have the directory gnupg in my repository. How do I get the tree-ish SHA1 of gnupg? Well, the trick is to specify the name of the directory after the SHA1.

git ls-tree master gnupg | awk '{print $3}'

You can recurse to find nested directories.

Edebug Expression In Scratch Buffer (September 02, 2012)

I just found out by accident that edebug works outside a function.

For example paste the following in the scratch buffer:

  (let ((buf (find-file "/etc/passwd"))
        (user (getenv "USER")) res)
    (when user
      (goto-char (point-min))
      (when (search-forward-regexp (concat "^" user) nil t)
        (setq res
              (nth 6 (split-string
                       (line-end-position)) ":")))))
    (kill-buffer buf)

The code looks in /etc/passwd for the shell belonging to the user. Put your cursor at the end of the last parenthesis and type M-x debug-defun you will then see the expression being debugged. Press n to step and q to quit.

The name of the function edebug-defun is misleading.

Emacs Isearch Extension (misearch) (August 24, 2012)

There is this new file in emacs bzr called misearch.

It adds more dimensions to the search space. It implements various features that extend isearch. One of them is an ability to search through multiple buffers.

Sadly it doesn't come with any example. Here a way to extend search to buffers with the same major mode:

(require 'misearch)

(defun misearch-next-buffer (buffer wrap)
  (catch 'found
    (let ((mode (buffer-local-value 'major-mode buffer)))
      (dolist (next-buffer (if isearch-forward
                               (cdr (buffer-list))
                             (reverse (cdr (buffer-list)))))
        (when (eq mode (buffer-local-value 'major-mode next-buffer))
          (throw 'found next-buffer))))))

(setq multi-isearch-next-buffer-function 'misearch-next-buffer)

Disk Utility Says Not Enough Space To Restore (August 17, 2012)

This happens when the snapshot was created on a bigger partition that your are trying to restore to. Here's how to get around this problem. Mount the dmg image by double clicking on it.

Next open the terminal and run the following two commands:

cp -a /Volumes/path-to-dmg/ /Volumes/partition
bless /Volumes/partition

The trailing slash is important in the cp source. It prevents copying the folder path-to-dmg inside /Volume/partition. During the copy I saw some error about socket file not being copied. It didn't seem to matter.

More French Holidays For Emacs (August 12, 2012)

Jiehong Ma has sent me more french holidays for Emacs.

(holiday-fixed 1 1 "Jour de l'an")
(holiday-fixed 1 6 "Épiphanie")
(holiday-fixed 2 2 "Chandeleur")
(holiday-fixed 2 14 "Saint Valentin")
(holiday-fixed 5 1 "Fête du travail")
(holiday-fixed 5 8 "Commémoration de la capitulation de l'Allemagne en 1945")
(holiday-fixed 6 21 "Fête de la musique")
(holiday-fixed 7 14 "Fête nationale - Prise de la Bastille")
(holiday-fixed 8 15 "Assomption (Religieux)")
(holiday-fixed 11 11 "Armistice de 1918")
(holiday-fixed 11 1 "Toussaint")
(holiday-fixed 11 2 "Commémoration des fidèles défunts")
(holiday-fixed 12 25 "Noël")
;; fêtes à date variable
(holiday-easter-etc 0 "Pâques")
(holiday-easter-etc 1 "Lundi de Pâques")
(holiday-easter-etc 39 "Ascension")
(holiday-easter-etc 49 "Pentecôte")
(holiday-easter-etc 50 "Lundi de Pentecôte")
(holiday-easter-etc -47 "Mardi gras")
(holiday-float 6 0 3 "Fête des pères") ;; troisième dimanche de juin
;; Fête des mères
 '(if (equal
       ;; Pentecôte
       (holiday-easter-etc 49)
        ;; Dernier dimanche de mai
       (holiday-float 5 0 -1 nil))
       ;; -> Premier dimanche de juin si coïncidence
      (car (car (holiday-float 6 0 1 nil)))
    ;; -> Dernier dimanche de mai sinon
    (car (car (holiday-float 5 0 -1 nil))))
 "Fête des mères")

Setting Holidays With Emacs Calendar (August 09, 2012)

This snippet does french holidays:

(setq french-holiday
      '((holiday-fixed 1 1 "Jour de l'an")
        (holiday-fixed 5 1 "Fête du travail")
        (holiday-fixed 5 8 "Victoire 45")
        (holiday-fixed 7 14 "Fête nationale")
        (holiday-fixed 8 15 "Assomption")
        (holiday-fixed 11 1 "Toussaint")
        (holiday-fixed 11 11 "Armistice 18")
        (holiday-fixed 12 25 "Noël")
        (holiday-easter-etc 1 "Lundi de Pâques")
        (holiday-easter-etc 39 "Ascension")
        (holiday-easter-etc 50 "Lundi de Pentecôte")))

(setq calendar-date-style 'european
      calendar-holidays (append french-holiday)
      calendar-mark-holidays-flag t)

Holidays will appear in the calendar with a highlight. To display the holiday in org agenda is dead easy. Just tack the following in your org file:


Charles Dickens Rum (July 31, 2012)

I am enjoying The Pickwick Papers. The word rum keep coming up. It means strange or peculiar.

Compile Slime With Emacs Bzr (July 17, 2012)

Things have changed in bzr that made my compilation of slime fails. The error message looked like this:

slime-repl.el:19:13:Error: Don't know how to compile nil

Stefan Monnier gave me the clue:

"Apparently, some of the code in slime-repl.el ends up calling (byte-compile <functionname>) where <functionname> is a function that's not yet defined. Earlier, Emacs would just silently ignore such erroneous situations."

So I just removed the following chunk in slime.el:

(require 'bytecomp)
(let ((byte-compile-warnings '()))
  (mapc #'byte-compile
          slime-events-buffer etc...

And hey, presto, it compiles again! Thanks Stefan, I would have never found the solution on my own.

Fix Emacs Flicker (July 12, 2012)

While catching up on news with newsticker Emacs was flickering and it was driving me mad. It dawned on me that it was a timer event overdoing display refresh. It's easy to find out the culprit. First look at the variable timer-list.

You will get a list looking like this:

([nil 20478 31448 437738 60 ac-clear-variables-every-minute nil nil]
 [nil 20478 31452 0 60 display-time-event-handler nil nil]
 [nil 20478 31452 0 60 appt-check nil nil])

Now all you need to do is define each timer functions to do nothing by evaluating:

(defun ac-clear-variables-every-minute ())

Do this for each functions listed in the timer variable list and you'll find the function that causes the flicker. Now you can fix it by either removing the function, improving it or calling it less often.

The Happy Manifesto (June 26, 2012)

I am reading the Happy Manifesto, fantastic stuff.

Emacs Insert Number List (June 26, 2012)

A new nifty shortcut C-x r N inserts numbers in a rectangle. It's great to turn a bullet list into numbered items.

Remove PC Speaker Beep on Linux (June 21, 2012)

Edit the file /etc/modprobe.d/blacklist.conf and add the following line:

blacklist pcspkr

VPN Greyed Out In Debian Squeeze (June 13, 2012)

This looks like a silly bug, just run the following command:

apt-get install network-manager-pptp network-manager-pptp-gnome

Script To Generate SSL Self Signed Certificate (June 06, 2012)

This script generates two files called server.crt and server.key which contain the certificate and the key.

The password is stripped from the private key. This is useful to start servers such as Apache without being prompted for the password.


# generate key
openssl genrsa -des3 -out server.key 1024

# strip password
mv server.key server.key.pass
openssl rsa -in server.key.pass -out server.key

# generate csr
openssl req -new -key server.key -out server.csr

# generate self singe certificate with csr
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
rm server.csr server.key.pass

Convert FLAC file To WAV On Linux (May 26, 2012)

I bought music on the web for the first time. It's a band called Filewile. I miss tearing up the CD jewel case cover and looking for the artwork.

Anyhow here is how to do a mass conversion:

for i in *.flac ; do flac -d $i ; done

Quickly Entering Items On Amazon Store (May 22, 2012)

Not only Amazon is a great site to buy stuff, they offer a wonderful selling service. I am selling CDs I don't care about anymore. There is one thing I wished I figured out earlier. When you enter items in your stock you just type in the bar code. Neat!

GTD Weekly Review (May 17, 2012)

GTD enforces a weekly review. I used to do it with great zeal and it would take about two hours. I did it in two phases: refile things in my "in" box to folders and then go through each folders and classify action in sub folders.

I have streamlined the process the following ways. First I am using only folders. This saves classifying time.

Secondly I am using less next actions. I have about 6 next actions actions ongoing. I used to have one for each sub sections and was faced with a mind numbing list of next actions.

Lastly I am doing personal and professional actions on different days. Doing it all at once was taking too much time. The context didn't feel right either. I didn't feel like doing professional stuff at home and vice versa.

I am also breaking the two minutes rule. If I feel like doing it I do it straight away and then get back to reviewing later.

All in all I must be spending 30 minutes a week on reviewing. I feel like I am wasting less time and staying more in focus.

Reverse Engineering The Sentinel (May 16, 2012)

The Sentinel is a game I was very fond of in the 80s. I have started reverse engineering the ZX Spectrum version. An old friend of mine has helped me find the map generation at 0x6100-0x6ff.

Pomodoro Technique (May 12, 2012)

I have been using the Pomodoro Technique for about a year now. The concept is very simple. I work for 25 minutes and then take a break of 5 minute. After 4 sets I take a long break of 15 minutes. I feel more productive as taking breaks is good for my brain. I also feel less tired after a long day at work

Resolve Mass Conflict With Git (May 10, 2012)

Sometime you will end up with a lot of files to resolve and you know you want your changes and squash upstream changes. It's very easy to do but not very well documented:

git checkout --ours file.txt
git add file.txt

The add command marks the conflict as resolved. Instead of a file you can pass a directory, that way you can resolve the content of the directory. There is the —theirs option that does the opposite, ie. squash you changes and use upstream.

Looking For A Sysadmin (May 04, 2012)

My company is looking for a system administrator. Contact me if you are interested.

Peer To Peer Internet Search (April 27, 2012)

It would be wonderful to have a peer to peer Internet search that would be a rival to Google. It would work like bittorent.

I believe a successful implementation would be an application that does the spidering as well as the search request.

Uploading File Via Bluetooth On Ubuntu 10.10 Maverick (April 21, 2012)

It doesn't work out of the box. You need to issue the following command:

sudo apt-get install gnome-user-share

More Ergonomic Escape Shortcut (April 20, 2012)

It might obvious to some but hitting C-[ is the same as pressing escape. It works on emacs, vim and the shell. It has the advantage that you keep your fingers on the home row.

Chording For Ergonomic Typing Inspired by SandS (April 19, 2012)

It all started with a post by someone talking about SandS (Shift and Space) in the org mode mailing list. The idea is that if you hold the space and type another key you will get a shift instead of a space.

He pointed to the following site. It's a Xorg extension therefore a pain to install. I found something much better called keydouble, a simple X application that just works without any fuss.

When I tried mapping the space bar as a control key it didn't work well because it's a key that I use often. I found myself inserting control without meaning to.

However I have mapped the ; key to control (it's the key that's positioned on my right pinky.) It took me a while to unlearn to use the left control and the left keys all with one hand.

The result was well worth the effort. Issuing commands in emacs has become much, much easier.

I have hacked doublecommand to get the same thing on Mac OSX. E-mail me if you are interested, It's ugly and hard coded. I would feel embarrassed to publish it.

Debian Security Upgrade Causes Apache To Stop (April 18, 2012)

If you run automatic Debian security update with a crontab it might cause your web server to stop. It happens because I edited the default and default-ssl files. I saw the following on my log:

Configuration file `/etc/apache2/sites-available/default-ssl'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
 default-ssl (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing apache2.2-common (--configure):
 EOF on stdin at conffile prompt

To fix apache you will need to run the following command:

apt-get install apache2.2-common

Next, if you can, avoid using default and default-ssl so that the next update will work smoothly. Here are the commands I ran:

cd /etc/apache2/sites/availabe
mv default french
mv default-ssl ssl
mv default-ssl.dpkg-dist default-ssl
mv default.dpkg-dist default
a2dissite default default-ssl
a2ensite french ssl
/etc/init.d/apache2 restart

Compiling Emacs Pretest 95 On OSX (April 12, 2012)

Unpack the pretest source code that can be found on http://alpha.gnu.org/gnus/emacs/pretest

tar xzf emacs-24.0.95.tar.gz
cd emacs-24.0.95
./configure --with-ns
make install

The result is in the directory nextstep. You can move to the Applications folder if you wish.

Convert MP3 File To WAV On Linux (April 06, 2012)

It's easy on Linux. Just type the following:

for i in *.mp3 ; do mpg123 -w $i.wav $i ; done

Zsh Cheat Sheet (April 01, 2012)

Zsh is very cool indeed. I have made a cheat sheet highlighting the best features.

Google Translate Japanese IRC (March 31, 2012)

Another fun hack, translate Japanese IRC to English via Google translate. As you can see the translation is not very good. This works with Emacs ERC.

And here is the code:

(defun ivan-erc-translate ()
  "Display tranlation when receiving a message in Japanese"
  (let ((string (buffer-substring-no-properties
                 (point-min) (1- (point-max)))))
    (when (and (ivan-erc-match-language 'japanese)
               (memq 'unicode (find-charset-region
                               (point-min) (point-max)))
               (ivan-japanese-kanji string))
      (goto-char (point-max))
      (forward-char -1)
      (insert (concat "\n" (ivan-japanese-kakasi string)))
      (when (string-match "^\\(<.*> \\)\\(.*\\)" string)
        (let ((nick (match-string 1 string))
              (message (match-string 2 string)))
           (concat "http://translate.google.com/translate_t?text="
                   (url-hexify-string message)
           (list (current-buffer) nick)))))))

(defun ivan-erc-translate-callback (status buffer nick)
  (set-buffer-multibyte t)
  (goto-char (point-min))
  (when (search-forward "fff'\">" nil t)
    (let ((start (point))
          (end-tag "</span>")
          (url-show-status nil))
      (when (search-forward end-tag nil t)
        (let ((string (ivan-erc-remove-url-entities
                        start (- (point) (length end-tag))))))
          ;; avoid recursion
          (when (not (ivan-japanese-kanji string))
            (erc-display-line (concat nick string) buffer))))))

(add-hook 'erc-insert-modify-hook 'ivan-erc-translate)

Make CPAN Skip Auto Prompt (March 01, 2012)

You need 'prerequisites_policy' => q[follow], in your .cpan/CPAN/MyConfig.pm and PERL_MM_USE_DEFAULT=1 in the environment.

Interesting Talk About Interactive Computing (February 21, 2012)

Victor Bret invents tools that enable people to understand and create. http://vimeo.com/36579366. It somehow resonates with the immediacy of lisp.

M-. Retrieves Previous Argument In shell (January 07, 2012)

I have just discovered M-. on my shell prompt. It works on bash and zsh. It pastes the last argument of the previous command. If you press it again it will retrieve the second to last and so on. I have found it tremendously useful so I thought I'd share.

Recovering Root Password On Debian And Grub2 (December 30, 2011)

Today I forgot my root password, it must be Alzheimer. Anyhow here is the quick recipe to reset it. On the grub boot screen type 'e' for edit. Next edit the line starting with linux, at the end add init=/bin/bash it should look like this.

linux /boot/vmlinuz-version root=UUID=hex ro quite init=/bin/bash

Next hit Ctrl-X to boot, you should land on a prompt without having to type your password. Next enter the following two commands:

mount -o remount,rw /

Enter the new password twice, type the following:


You should be all set!

Bbdb Spell v1.2 (December 15, 2011)

Mark Simpson reported that version 1.1 did not work with BBDB 2.35. Version 1.2 fixes that. You can download it here. If you are running BBDB 3.0 you don't need to do anything as Roland Winkler has added the file in git.

Export Bbdb Name To aspell Personal Dictionary (December 02, 2011)

I got tired of people's name being highlighted red when composing e-mail with flyspell. So I wrote bbdb-spell that exports peoples' first and last name from bbdb to aspell custom dictionaries.

You need to set the variable ivan-bbdb-aspell-dictionary to a list of personal dictionaries. Then run M-x ivan-bbdb-export-aspell.

YaCy a peer to peer search engine (November 29, 2011)

Just stumbled on YaCy today. What a great idea! I hope these guys will take on Google for search.

Stopwatch (November 16, 2011)

Emacs doesn't have a precise stopwatch so I wrote one. It has millisecond accuracy.

Nterm 0.5 (October 11, 2011)

I have managed to squeeze some time to work on nterm. So this new version is much faster. All drawing characters are now bitmap.

Exim Base64 Unexpected Header Error (October 07, 2011)

This error could be that your certificate is badly formatted. However in my case it was due to my private key being password protected. It is easy to fix, the following commands strip the password:

copy server.key server.key.orig
openssl rsa -in server.key.orig -out server.key

Handling Multiple SMTP Servers (August 31, 2011)

Here's how I deal with multiple SMTP servers. I have a function that runs just before sending an e-mail (after hitting C-c C-c in the message buffer). It asks where the e-mail is coming from and sets the right SMTP server.

In the example below inputting google will pick the google SMTP server. Everything else will be sent via kanis.fr.

The last setq removes the "From" header when composing an e-mail. This is required since I query this value just before sending the message. Using the default value would send the wrong header.

(defun private-gnus-prompt-address ()
  "Prompt for sender address before sending e-mail
  Optionally cover address name to avoid spam"

  ;; never user agent for e-mail
  (setq message-send-mail-real-function nil)

  (setq user-mail-address (read-string "From: " "google")
   ((string= user-mail-address "google")
     user-mail-address "ivan@gmail.com"
     smtpmail-smtp-server "smtp.gmail.com"
     smtpmail-smtp-service 587))
     smtpmail-smtp-server "kanis.fr"
     smtpmail-smtp-service 2525
     mail-host-address "kanis.fr")))
  (if (not (string-match "@" user-mail-address))
      (setq user-mail-address
            (concat user-mail-address "@" mail-host-address))))

(add-hook 'message-send-hook 'private-gnus-prompt-address)

  ;; Prevent "From" headers when composing
  '(Subject Date (optional . In-Reply-To) Message-ID (optional . User-Agent))
  message-required-headers '((optional . References)))

My Gnus Setup (August 27, 2011)

The file ivan-gnus.el contains all the code I have written on top of gnus. Here is an example of how I setup my mail accounts. The last entry is a file that I use with getmail.

;; POP
 mail-sources '((pop :server "kanis.fr"
                      :port 995
                      :user "bob"
                      :connection ssl
                      :password "3l33t")
                (pop :server "pop.gmail.com"
                     :port 995
                     :connection ssl
                     :user "foo.bar@googlemail.com"
                     :password "more3l33t")
                (file :path "~/tmp/ivan.mbox")))
  gnus-select-method '(nntp "news.gmane.org")
  gnus-secondary-select-methods '((nnml ""))
  user-mail-address "foo.bar@googlemail.com"
  smtpmail-smtp-server "smtp.gmail.com"
  smtpmail-smtp-service 587)

Remap Left Key (August 23, 2011)

C-b is too hard for me to type. I don't use the right control key because it's too hard to reach. So I use the left key which makes me leave the home row. I believe it's a waste of time.

Maybe if I had a Kinesis keyboard it would be different but I am not willing to shell out $$$ for work and home. Beside it wouldn't work when I am on a laptop.

I had a heretic idea. Why not map C-h for left a bit like vim? I have done that today for zsh and emacs. I have unmapped the left arrow so I get into the habit of using it. I will see how it goes.

Good Bye Fetchmail, Hello Getmail (July 22, 2011)

Due to a bug in Gnus I need to fetch my e-mail in a mbox file. After looking around the manual of fetchmail I couldn't find a way to do this easily.

Someone on #emacs suggested getmail. I think it's really cool and easy to setup. The installation lacks a quick recipe so here we go. You'll need to create /.getmail/getmailrc with something like:

type = SimplePOP3Retriever
server = smtp.kanis.fr
username = ivan@foo.com
password = mysecretpassword

type = Mboxrd
path = ~/tmp/ivan.mbox

delete = true

You'll need to create an empty mbox file:

touch ~/tmp/ivan.mboxc

You are all set!

Setting Up Bzr On OSX With MacPorts (July 16, 2011)

It's harder than it should be. If you do a regular MacPorts install it will crash because it doesn't have the ElemenTree module.

So here's a quick recipe using bzr source code:

sudo port install py26-celementtree py26-elementtree
sudo port install py26-crypto py26-curl py26-distribute
sudo port install py26-paramiko py26-pyrex
sudo port select --set python python26
cd ~/src/bzr-2.4b5
python setup.py install --home ~/local
export PYTHONPATH=/Users/ivan/local/lib/python
export PATH=/Users/ivan/local/bin:$PATH

You should have a bzr that should be more usable than MacPorts. It's still not working for me as it takes 3G of memory, hits the swap and renders my computer useless.

About Zsh (June 28, 2011)

I have used bash for over ten years. I just got a little curious and decided to study the competitor zsh.

I think it has a killer feature: shared history. The previous commands will be shared between instance of zsh. I find this very handy since I always run several shell with scree. The following lines turn it on:

# History sharing and huge size
setopt share_history
setopt append_history

I am not sure I will switch to zsh but it's interesting to change things a bit.

Dd Is Slow And Useless (June 25, 2011)

There is well know tool in Linux called dd for disk transfer. For example if I wanted to copy from /dev/sda to /dev/sdb I used to do:

dd if=/dev/sda of=/dev/sdb

There is no need to use dd when a simple cat will do:

cat /dev/sda > /dev/sdb

Beside saving key strokes it copies three times faster!

The Pomodoro Technique® (June 23, 2011)

Well I have been using the Pomodoro Technique® for a few months now. The idea is to work 25 minutes non stop and take a pause for 5 minutes. I think it's a very good idea for me as my mind gets numb after too much work. It is also a good regimen for time off. I find that 5 minutes is over very quickly when I am lurking in IRC. The hardest bit is to tell my co-workers that I don't want to be interrupted... I highly recommend to all IT workers.

Ubuntu Bloat (May 05, 2011)

Installing 10.4 took 2Go, now 11.4 takes 4Go. Double the size in a year nice going!

Pomodoro Technique For Emacs (April 16, 2011)

I read about the Pomodoro Technique on the org mode mailing list. I have decided to try it out and have noticed a definite gain in productivity.

I naturally take breaks such as browsing the web or chatting... The pomodoro mode gives me a precise slice of time for such breaks. I am always surprised how quickly a five minutes break just flies by. The other gain is that I am tracking my time better.

Since I use it so much I decided to write write code to integrate it with emacs.

In the screen shot above the modeline indicates that I am on my second set of work. The number indicates I have 22 minutes left and it decreases each minute. The pomodoro buffer pops up in between break and work. At that time the emacs windows will be raised in front so that I don't miss it when I am working outside emacs.

Org camp Paris 2, My Impressions (April 10, 2011)

We started with a talk by the current org maintainer Bastien. I think the most promising feature he is working on is org-bot. It's a way for someone to manipulate somebody else org file via ERC. I think it's quite exciting: this may lead the way for org to become multi user.

I gave a short talk in the beginning of the afternoon on how I implement GTD with org. We then split up in small group. Isabelle, Thierry and Vincent-Xavier took care of translating the reference card in french. I heard that Bastien and Julien specified how to implement numbered lists. Kaze, Kinouchou and others were working on usage and workflow. I showed Bernard, Mohamed and Vivien how fun it was to program in elisp.

We then went to a restaurant and had a good time. I think everyone involved felt that their time was put to good use. I hope we will do this again.

Hacked Server (March 13, 2011)

My server got hacked in February. I don't know how the intruders got in. I have learned a few things in the process of cleaning things up. First keep Debian updated with the latest stable release. I was running version 4.0 which didn't benefit from security updates anymore.

Next you'll want to install the following packages and configure them so that you get daily e-mails.


The first two are root kit detectors and will alert you if you get infected. The software aide will report all files changed and logwatch sends parts of logs that are interesting.

Running aide —init gives the most stupid warning:

aide --init
Couldn't open file /var/lib/aide/please-dont-call-aide-without-parameters/aide.db.new for writing

It turns out on Debian you must run the following command:


On top of this you should run the following script every day with cron:


apt-get -y update > /dev/null 2>&1
apt-get -y upgrade > /dev/null 2>&1
debsums 2> /dev/null | grep FAILED

It will update the security updates from Debian. Debsums showed me that my sshd was compromised so it's a good idea too. Running netstat showed me that people were accessing my server via IRC.

Linux is not as safe as advertised, keep up to date!

Inkscape better than Illustrator (January 08, 2011)

I am working on postscript files that were generated from Word. I was changing some font in Inkscape but the kerning was all wrong. I thought "I'll try Illustrator, it will do a better job". So I open the file in Ilustrator and the accented characters were gone. I tried again with a PDF file, now the accented characters were upper cased. Postcript and PDF are both Adobe technology, I just can't believe Illustrator importer is crap!

Winpack works with Windows XP SP3 (December 16, 2010)

I noticed winpack didn't work very well with Windows XP service pack 3. I have removed gnuwin32 in favor of msys/mingw. I updated hg and vim while I was at it.

Verbiste (September 14, 2010)

I have written a new interface for verbiste. It shows french conjugation for a word near the point. If you want this feature download verbiste.el and put it somewhere in your load path.

IRC with furigana (August 29, 2010)

Today I have written code that displays kanji reading in Japanese while chatting on IRC. I often know the meaning of the character but forget the pronunciation. Other people who go to Japanese channel might find this hack helpful.

Nterm version 0.4 (August 26, 2010)

In this version of nterm I have added unit testing and reworked ED and EL.

Trying Out Twitterfeed (July 29, 2010)

So Jean Michel told me about twitterfeed, it should turn my RSS feed to Facebook and Twitter. Sounds neat!

Nterm version 0.3 (July 25, 2010)

This version fixed several bugs that made the program crash. Optimisation makes nterm noticably faster.

Etags And Bookmarks (May 30, 2010)

I did some contracting work on a C++ project. I used etags on hundreds of classes and I wish I had a tag history listing mode for emacs. With bookmark it's dead simple, the following code will stash all etags you jumped to in the bookmark file.

;; put etags information in bookmark
(defun ivan-etags-bookmark ()
  (bookmark-set tagname))

(add-hook 'find-tag-hook 'ivan-etags-bookmark)

New Version Of Winpack (April 17, 2010)

I have made a new version of winpack. I cut it to half the size. It includes emacs and many other goodies. Most Unix users will feel at home with a bash shell and several GNU tools.

Thunderbird 3.0.1 TLS + SMTP broken (February 09, 2010)

What's wrong with the latest version of Thunderbird? It doesn't work with my server that uses STARTTLS. I generated a log file.

Send: EHLO patsy.makina-nantes.net
Response: 250-kanis.fr Hello 179.240.204-77.rev.gaoland.net []
Response: 250-SIZE 104857600
Response: 250-PIPELINING
Response: 250-STARTTLS
Response: 250 HELP
Send: QUIT

Well crap it should work. It did work on my father's Thunderbird a year ago . How annoying. So I told my client to use Pegasus Mail which doesn't look as pretty but it works.

Appointment Implement Variable Warning Time (December 17, 2009)

I use appointment with org. I find that a global time delay for each appointments is inconvenient. For example I need to be warned an hour before an appointment downtown and only 5 minutes for a meeting at work. I have hacked appt.el to keep track of a delay for each appointment. The function appt-add is compatible with the old appt and the change has been accepted upstream.

Nterm Version 0.2 Is Out (November 29, 2009)

The big new feature is double width and height font. If you are interested it can be downloade here.

Picture For Bbdb (September 27, 2009)

Bbdb (Big Brother DataBase) is the rolodex of emacs. I have added picture support so that you can see your contacts face.

All you need is to download the following file bbdb-picture.el.

Why Emacs Is Great (September 14, 2009)

With emacs you can chat in japanese in irc and look up words you don't know.

Miscelleneous Projects (June 29, 2007)

This month has been productive with Emacs. The mercurial back-end I wrote last year made it in CVS. I wrote a world clock that should be included as well.

Gradient Color Faces On Emacs (June 08, 2007)

Another productive day hacking and what not. A picture is worth a thousand words. Download the code if you want to use it.

Dual Screens Of Different Size (June 05, 2007)

I finally got dual screen working on my Inspiron 8100. It took me about two hours: I had a working configuration but I needed a hard reboot! I have used Xorg 7.2 on Ubuntu 7.04. Here is the relevant snippet of my xorg.conf:

Section "Device"
        Identifier      "Radeon"
        Driver          "radeon"
        Option          "MergedFB"              "true"
        Option          "CRT2Hsync"             "30-81"
        Option          "CRT2VRefresh"          "56-75"
        Option          "MonitorLayout"         "LVDS, CRT"
        Option          "CRT2Position"          "LeftOf"
        Option          "MergedNonRectangular"  "true"
        Option          "MetaModes"             "1600x1200-1280x1024"

Section "Screen"
        Identifier      "Main Screen"
        Device          "Radeon"
        Monitor         "Generic Monitor"
        DefaultDepth    24
        SubSection "Display"
                Depth           24
                Modes           "1600x1200" "1280x1024"
                Virtual         2880 1200

TV Output With Radeon (January 08, 2007)

I spent the day trying to get TV output on my laptop, a Dell Inspiron 8100. The graphic chip is an ATI Radeon Mobility 9000 R250 LF.

I installed Xorg version 7.1.1 with the ATI proprietary driver also known as fglrx version 8.28.8. I used the following command to setup xorg.conf:

aticonfig --initial=dual-head --tvf=PAL-B --tvs=VIDEO  --ovon=1 --ovt=Xv

I get TV output in color and it looks nice. I also have video overlay on both screens. Many people claim that it does not work, they must be talking about an older version of the ATI driver.

However when I play a video on the secondary screen a quarter is chopped off at the bottom. This happens even if the video is played inside a window, this makes me think there is a bug in the video overlay. It works fine on the primary screen.

There is also a mosaic of ghost videos on the primary screen. The driver is probably using wrong area of the video memory. The cursor is broken on the secondary display.

Close but no cigar.

This has nothing to do with the above but I was quite impressed that Ubuntu booted on a LVM partition.

Tiny Accented Character With Emacs (November 02, 2006)

This happens with Debian and the fix is trivial:

apt-get install euro-support-x

10 Years Of Linux (December 19, 2005)

I have just noticed that I have been using Linux for 10 years. This was was my first post on the subject. I didn't yet know that Xfree86 wasn't Linux.

From: Ivan Kanis (ivank@wrq.com)
Subject: How do you switch the left and right mouse button in linux ?

View this article only
Newsgroups: comp.os.linux.hardware
Date: 1995/12/29

My mouse is a PS/2 type of mouse. Any idea would be greatly appreciated.

It is ironical that I heard about Linux while I was working at Microsoft. My co-worker Frank told it was cool and I should check it out. He was also know as "leper" in some circle. He sent me a spoof e-mail from god@pearly.gate that baffled me.

Frank hung around with his goth friend Matt. I remember when Matt told me about the web and I was just no getting it. I wonder what Frank and Matt are up to now.

Secure Mail Server On Debian (November 23, 2005)

This a quick how-to for setting up and encrypted mail server using Exim on Debian. I have seen a bunch of web site dealing with the subject but not a complete guide. OK, enough talk, let's get started!

First install all the needed packages:

apt-get install exim4-daemon-heavy sasl2-bin

Make sure you are using split configuration files with Exim:

dpkg-reconfigure exim4-config

Next generate a self signed certificate, make sure you enter the server name and domain when the program asks for it:


Edit /etc/exim4/conf.d/main/03_exim4-config_tlsoptions and add MAIN_TLS_ENABLE = 1, it should look like this:

### main/03_exim4-config_tlsoptions

# TLS/SSL configuration.
# See /usr/share/doc/exim4-base/README.Debian.gz for explanations.

Next enable authentication by commenting out the following section in /etc/exim4/conf.d/auth/30_exim4-config_examples:

    driver = plaintext
    public_name = PLAIN
    server_condition = ${if saslauthd{{$2}{$3}}{1}{0}}
    server_set_id = $2
    server_prompts = :
        server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}

Do not worry that is using plain text to authenticate, the password is encrypted over TLS. Let's update the configuration and restart Exim:

/etc/init.d/exim4 restart

Next we need to configure sasl, first edit /etc/default/saslauthd so that the service starts.

# This needs to be uncommented before saslauthd will be run

Next you will need to give Exim the permission to use sasl and start the service:

adduser Debian-exim sasl
/etc/init.d/saslauthd start

It should be working, I use the following python script to check that the server is working:


import smtplib

server = smtplib.SMTP('mail.server.name')
server.login("joe", "test")
server.sendmail("fromaddr","toaddr", "Subject: test")

Stow (November 03, 2005)

I never realised how useful this program is. I have been playing with CVS emacs and various version of mplayer. Stow makes it easy to juggle between different version of the same program.

Put the following in your .bashrc:

function stow
command stow --dir=$HOME/local/stow $*

function unstow
command stow --dir=$HOME/local/stow -D $*

Here is how to stow mplayer:

./configure --prefix=$HOME/local/stow/mplayer107
make install
stow mplayer107

Note that mplayer is neatly tucked in it's own directory. Stow creates a symlink to mplayer at ~/local/bin/mplayer so you need to only have ~/local/bin in your path.

Say that you compiled an earlier version of mplayer 106, switching from one version to the other is very easy:

unstow mplayer107
stow mplayer106

I hope I have convinced you that using stow is a good idea, installing different software in the same location becomes unmanageable.

How to Obliterate Files From Subversion (October 02, 2005)

Here's how to obliterate files from the repository. Note that using the subversion remove command will not remove it from your repository. I had to use it as I noticed I put friends' e-mail addresses in by accident.

The following commands move the repository to a backup location, dumps the database in a file. Finally I remove the file .nobunce from the repository. You can specify multiple files to remove.

mv subversion subversion.bak
svnadmin dump subversion.bak > dump
svndumpfilter exclude trunk/ivan/.nobounce < dump > dump.filter

Now I recreate a fresh repository and load the new new dump file minus the offending file. You can delete subversion.bak when you feel confident that your new repository is working.

svnadmin create --fs-type fsfs subversion
svnadmin load subversion < dump.filter

According to the subversion documentation, there will be a command called obliterate that will do the above without the hassle.

Debian Network Interface Name (May 05, 2005)

It is quite annoying in Linux that the name of a network interface is unpredictable. I added wireless support on my laptop. The wired interface changed from eth0to eth1and caused all sorts of problem.

The package ifrenamesolves the problem nicely.

apt-get install ifrename

Next add the the mac address of each network card in /etc/iftab:

wire mac 00:40:45:24:A0:DC
wifi mac 00:0C:F1:09:2B:27

You'll need to reference you card as wire and wifi in /etc/network/interfaces. Things will break when you change network card, but that's a small price to pay for some sanity in network interface names.

Emacs Zone Out Mode (February 17, 2005)

Emacs has a mode to prevent you from zoning out. It's works pretty much like a screensaver. Try it out with the following command:

M-x zone

When you had enough turn it off with:

M-x zone-leave-me-alone

Debian Install Package on Demand (February 15, 2005)

This little known utilities grabs package on demand. Set up the following alias on your shell:

alias auto='auto-apt -y run'

You'll need to have sudo to give you root access without a password. Next time you compile a package from source just do the following:


All the dependencies will be downloaded automatically. Wonderful! It just make me grin every time I do it.

Xscreensaver bump proof (January 18, 2005)

I use xscreensaver to blank out my monitor when it's not in use. I got annoyed that my screen would activate for no particular reason.

I have made a patch to fix this problem. It will prevent the screen from activating when someone bumps your desk or wind blows on your touch pad, etc ...

It works by ignoring small cursor motion. It does the job for my laptop, maybe someone else will find it useful.

KpHone And Belkin Router 7630 (November 15, 2004)

I spent the last few days trying to figure out why kphone wouldn't work with my newly aquired Belkin router. The clue was the following security log:

15.11.2004 19:36:52 **UDP Flood to Host**, 32860->>

The problem is that the router thinks that SIP incoming packets are a denial of service attack. You'll need to follow this undocumented link. Next turn off SPI and Anti-DoS firewall protection.

I find it most uncool that Belkin did not document this link. It would have saved me a lot time had they mention it on their manual.

Alsa Microphone (November 12, 2004)

I find that enabling the microphone with Alsa is very painful. Here is a detailed step by step explanation

You'll need to launch alsamixer from a console.

Use the left arrow key till you get to the Capture channel. Press the space key you should see CAPTUR on top of the bar in red. Next increase the channel volume with the up key.

Make sure that you you have Mic1 selected on the Mic Select channel. Last it can be a good idea to unmute the Mic Boost channel to amplify your microphone input.

Now that was really simple wasn't it? Yeah right...

Intel Pro/Wireless 2100 (October 30, 2004)

First you'll need to download the firmware in the /tmp directory.

# cd /usr/lib/hotplug/firmware
# tar xzf /tmp/ipw2100-fw-1.3.tgz

You'll need to locate and dowload the ipw2100-source package. It's currently in the unstable section.

# apt-get install module-assistant wireless-tools
# dpkg -i ipw2100-source_0.56-1_all.deb
# module-assistant prepare
# module-assistant a-i ipw2100

Next you'll need to configure you're wireless access. Put the following stanza in the file /etc/network/interfaces:

iface eth1 inet dhcp
wireless_essid belkin54g
wireless_key 419e0f8585ffbff42e90df4246

Reboot your computer. Start your wireless interface by typing ifup eth1. If everything went fine you should have a wireless connection.

Alsa Debian Sarge (October 29, 2004)

I found it difficult to get Alsa to work on Debian. The problem was that the OSS modules were loaded at boot time. The fix is to tell the hotplug system to ignore OSS modules.

apt-get install alsa-base alsa-oss
cat /usr/share/doc/alsa-base/alsa-base.discover >> /etc/discover.conf

Reboot your system and check that the OSS modules are not loaded. Run alsamixer to check that Alsa is running.

Hard Disk Crash (July 30, 2004)

My hard disk crashed; that's not a big deal as I make backups frequently. The problem is I didn't have any rescue disk to get to my backup.

I had to install Windows to get to the Internet, download and burn a Gentoo CD. This is embarrassing when I bragged a while back that I got rid of Windows!

Next my backup was on a firewire device, and it was a headache to get to. I booted the Gentoo CD with gentoo dofirewire. I then typed the following command to get to my external drive.

modprobe sbp2 spb2_serialize_io=1
echo "scsi add-single-device 0 0 0" > /proc/scsi/scsi

My drive needs the spb2_serialize_io set to 1 or it won't work.

I have learned that it's not enough to make backup. I need to make a rescue CD so that I don't waste time recovering my system.

Windows No More (July 16, 2004)

Well I have finally wiped my Windows partition. I use Windows for two things:

I have tried CrossOver Office Standard and I must say I am hooked and have bought the product. It saves me a lot of time and is a snap to install. I can now use these tools without having to waste time rebooting my computer. I really encourage people to check out the trial version.

Minus One Windows Server (July 06, 2004)

It's been a while since I've updated my log. I was away working in Nice. I migrated Windows NT primary and backup domain controller servers to Linux with Samba on a LDAP back-end.

JDE (June 09, 2004)

I am getting the following (annoying) error message with JDE. It's a mode to edit Java in emacs.

bsh: Specified BeanShell jar filed does not exist:

The following cures the problem:

cd /usr/share/emacs21/site-lisp
mkdir java
cd java
ln -s /usr/share/java lib

It looks like a bug in Debian, I might report it if I find the time.

Export GIF With Gimp (June 08, 2004)

Can't export gif files with the Gimp? You need to do install the following:

apt-get install gimp1.2-nonfree

This is due to a silly patent by a company I won't care to name on LZW compression.

LaTeX French Hyphenation (June 07, 2004)

Weird error message with LaTeX:

Package babel Warning: No hyphenation patterns were loaded for
(babel)                the language `French'

The folloing command fixes hyphenation in Latex:

texconfig hyphen latex

Installing Java On Debian (June 03, 2004)

These are some note on how to integrate Sun's J2SE SDK with Debian Testing. First read the FAQ. Next are some faster steps, commands are to be typed as root:

apt-get install equivs
cd /tmp

* 20040603: ViewCVS Fix

=ViewCVS= doesn't support the latest version of =encode=. This results in
your source code not being displayed. The fix is quite simple, you'll
need to edit =viewcvs.py= like so:

enscript = popen.pipe_cmds(
           '--color', '--language=html', '--style=msvc', '-E' + lang, '-o',
           '-', '-'),

The style option is optional, the default color scheme is emacs. I just got used to the MSVC colors.

Amanda EOF Error (June 01, 2004)

Another tip with Amanda. If you get the following error when using amrecoveron a tapeless backup:

EOF, check amidxtaped.debug file on server.

You need to add the following line in your amanda.conf:

amrecover_changer = "change"

Next time you run amrecover do the following so that amanda will switch tapes for you:

settape change apt-get source java-common cd java-common-022/dummy for i in .control; do equivs-build $i; done dpkg -i .deb </example>

PostScript (May 30, 2004)

I haven't updated my journal for a while; I have been busy learning PostScript for my next project.

Removing Dangling Symbolic Links (May 15, 2004)

I want to remove dangling symbolic links and couldn't find a tool to do it quickly. Here is rmbadlink.sh which is a bastard child of cleanlinks. Not much to be said about it; I just erased the line that removes empty directory.

Partition Label (May 13, 2004)

Did you know you could add label to ext2or ext3partitions? I didn't know till today. Extract from the man page of tune2fs:

-L volume-label
        Set  the   volume  label  of   the  filesystem.    Ext2
        filesystem labels can be at most 16 characters long; if
        volume-label   is longer  than 16  characters,  tune2fs
        will truncate it and print a warning.  The volume label
        can  be used  by mount(8),  fsck(8),  and /etc/fstab(5)
        (and possibly  others) by specifying LABEL=volume_label
        instead of a block special device name like /dev/hda5.

That's good because when I run cfdisk I won't need to look at /etc/fstabat the same time to figure what partition maps to what. (I tend to have lots of partitions.)

Tomcat and Netbeans (May 12, 2004)

Good day of work. I can finally debug with Tomcat and Netbeans. The procedure is poorly documented, on Debian you need to modify the file /etc/default/tomcat4like so:

CATALINA_OPTS="-Djava.awt.headless=true \
-Xdebug -Xnoagent -Djava.compiler=NONE \

Restart Tomcat, in Netbeans go the menu and select Start Session then Attach session. Set an obvious breakpoint and you should be all set!

Snapshot of the Netbeans debugging dialog box
Snapshot of the Netbeans debugging dialog box

Beware Move (May 11, 2004)

My tip for today if you do move files from one partition to another and that you find out you do no have enough space. Do not, I repeat, do not copy the files back to their original destination. Indeed it seems that the mv command will create empty files if the destination is full. If you copy your files back you will clobber your original files with empty ones!

CD Booklet Again (May 10, 2004)

The typesetting is done but it's an absolute nightmare to make the booklet. My advice so far is to no use cd-cover for a booklet because it won't re arrange the pages as needed. I have a document that's the size of a CD. I need to find a program that re arranges the pages so I can make the booklet. I have tried psnuple, ps2ps and impose+ without much luck.

CD Booklet (May 09, 2004)

Decided to typeset a lyrics booklet for a CD. Found the cd-cover package at CTAN that does just that. I was sailing along till I tried to print it. The Postscript file that it generates is in letter instead of A4. It wouldn't be a big deal usually but I am trying to print this double sided so it has to be centered just right. I'll think about it later!

Bad Programmer; No Dougnuts (May 08, 2004)

Vowed to stay away from the computer and did a pretty good job of it :)

Someone Thinks I Am A Spammer (May 07, 2004)

Things are not getting better today... My domain name has been added to Spamcop. This means that most of my e-mail bounces back to me. Just great! I have talked with my web hosting company and we are trying to resolve the problem ASAP.

And I have to reinstall Windows XP, endless fun :(

Good session with my client, did tricky GRUB manipulation and partition swapping and it all ended well.

I have discovered why gnomemeeting crashed when answering a call. Why the edit field in Mozilla would not work the second time I ran it. It turns out that I had the accessibility feature turned on by Gnome. I don't know if this will impact other user of Debian out there but my advice is to turn it off. I find it quite funny that it completely crippled my environment. But only in hindsight, I have been gnashing my teeth for days on this.

Bad Day (May 06, 2004)

It was a bad idea to install Gnome 2.6 on my machine: my system is quite unstable.The edit box in Mozilla doesn't work and Gnomemeeting crashes when I receive a call.

Well it is Debian "unstable", isn't it? I have stored my list of packages before doing the Gnome thing so I can revert to how things were.

dpkg --get-selections > before-gnome

I have formatted my Windows partition by accident so I guess I'll have to reinstall it. Some days everything goes wrong and this is the day

Mule (May 05, 2004)

Xmule 1.8.2b crashes, I filled a bug and I reverted back to 1.8.2.

Convert Divx To VCD (May 04, 2004)

Converted a Divx movie to VCD using transcode. Bad luck, the movie is still black and white. A/V synchronization is good. I am getting closer.

Video Edit Tools (May 03, 2004)

Found some interesting tools for video editing. Christian Marillat is kindly maintaining these tools for Debian. Add the following line to your /etc/apt/sources.list:

# Christian Marillat package
deb ftp://ftp.nerim.net/debian-marillat/ testing main

Now you can play with avidemux and transcode:

apt-get update
apt-get install transcode avidemux

VCD Audio Video Not Synchronized (May 02, 2004)

The next logical step is to turn videos that I have downloaded and transfer them to a CD. So far I had very little luck. It seems that my Pioneer DVD player wants a video with 25 frame per second or I won't get colors. The problem with mucking with fps is that A/V are out of sync! It's been a bad day :(

Making VCD (May 01, 2004)

Today is VCD fun! So what is VCD? It's something that the Chinese have invented as a substitute to DVD. Why is it so interesting? You can burn your movies on a regular CD-ROM and watch them on your DVD player.

So, let's get the tool:

apt-get install vcdtools

I used an MPEG1 movie of dimension 384x288 with a bitrate of 1152 KBit/sec and an audiostream with a sample rate of 44100 Hz, stereo and a bitrate of 224 KBit/sec. Let's call this file movie.mpg.

Next I create the VCD file with the following command:

mkvcdfs movie.mpg

Next you will need to burn the file with cdrdao. I had a bit of a headache here because the version that comes with Debian testing doesn't yet support the new IDE interface that comes with Linux 2.6. I grabbed and manually installed version 1.1.7-5 in unstable and it works fine.

Now i am blanking my CD-RW:

cdrdao blank --save --driver generic-mmc --device /dev/hdb

Note that adding the --save parameter will save the options in a file called .cdrdao in your home directory. In effect, you don't need to specify the driver and the device on the command line.

Next I burn my movie:

cdrdao write vcd.toc

I pop that CD in my DVD player and the movie looks great. I am pleased!

I if use a movie encoded in NTSC, it plays back in black and white and I am not sure why

Burning CD With Debian (April 29, 2004)

Quick tip on how to burn CD with Linux kernel 2.6 and Debian testing. Edit the file /etc/default/cdrecord. Add the following two lines:

cdrw=/dev/hdb 8 4m burnfree

Replace /dev/hdb with you CD-ROM device of course! That's all there's is too it. 8is for the speed you want to write, and the 4m is the size of your CD writer buffer. The program cdrecordshould work like a charm.

Well since Gnome 2.6 just got in testing I have downloaded the whole darn thing. I had a quick look at epiphany. The new official Gnome browser. It looks fine, too bad it didn't import my Mozilla's bookmark :(

Highlighting URL With VM (April 28, 2004)

Why is VM (the best e-mail client IMHO) only highlighting the first dozen URL on my e-mail? A quick look at vm-vars.eland I found the problem. The variable vm-url-search-limitis set to a 12000. Heck 12k is puny. I have put the following in my .vm and everything is groovy again: (setq vm-url-search-limit 100000)

Voice Over IP (April 26, 2004)

Still playing around with VoiceIP. I am trying to get away from Skype because I like to work on Linux. I have mediocre results with Gnomemeeting and Netmeeting. I had much better luck with Ohphone on windows, so this might be the way to go!

Fix Amanda On Mandrake (April 21, 2004)

Setting up Amanda client on Mandrake. A word for the wise: forget about the rpm package! It doesn't have the service that the server expects: amandad.

The quickest way to make it work is to grab the source from the Amanda web page. Compile and install the client part.

./configure --without-server --with-user=backup --with-group=backup
make install

Next create and add the following lines in the file /etc/xinet.d/amanda:

service amanda
    socket_type = dgram
    protocol = udp
    wait = yes
    user = backup
    server  = /usr/local/libexec/amandad

Run amcheck on the server to check that the client is set up properly. You should be set!

Flash Plugin With Debian (April 20, 2004)

Back from a week-end break in Paris. It's really easy to install the Flash Plugin under Debian.

apt-get install libflashplugin-nonfree

BBC Radio On Linux (April 16, 2004)

I can listen to the BBC radio again on Linux! It took me a little work but the result is gratifying. Note that the pause, forward and volume controls are now working. I am thrilled :)

Snapshot of the Helix Player plugin on the BBC radio site
Snapshot of the Helix Player plugin on the BBC radio site

I have compiled the Helix Player on Debian this morning and I have taken the following notes.

You will need the Ogg Vorbis development file:

apt-get install libvorbis-dev

The player also depends on the Theora codecs. These files are not packaged in Debian yet. Grab the sources from the web site, unpack them and type the following commands:

./configure --prefix=/usr
make install

Once the dependences are taken care of you should be able to build the player. Here is what my build environment looks like :

Build System Menu
-> Current Directory: /home/ivan/src/helix/helix
[0] Set BIF branch (helix-player)
[1] Set Target(s) (player_inst)
[2] Set Profile (/home/ivan/src/helix/build/umakepf/helix-client-all-defines)
[3] run: build -trelease

Next run the build by pressing 3. I have the self extracting installer in the releasedirectory. So I ran the following command:


The installer register the plugin to Mozilla and you should be able to listen to the best radio out there!

Spam And Radio (April 15, 2004)

My e-mail address shown on my contact page is getting more and more spam. I will change it soon, beware!

I am again annoyed as I can't listen to the BBC anymore. This has worked for years with the venerable Real Player 8 for Linux. It seems that BBC has upgraded their servers and it just won't work anymore.

So I tried the Real Player One alpha without much luck. I couldn't see any Mozilla plugin in their package.

I then signed in to the Helix Communitypage so that I could try the Helix Player MS2. I got some assertion error: that's progress! Well I'll try to build the darn thing and see if I can make it work....

Had a kick to see that my friend Nick is the tech lead for the Unix player. Keep up the good work Nick!

Slune (April 09, 2004)

I went this morning to a gaming conferencing on free software. I was most impressed with games developer by a group called Nekeme. They demoed a game called Slune that must be the first 3D game in Python. I was very impressed!

Worked this afternoon on more JSP stuff.

Mplayer Plugin (April 08, 2004)

I installed the mplayer plugin for Mozilla. I can finally watch Windows Media and Quicktime streaming video on Linux. Awesome work!

Tomcat (April 07, 2004)

Helped my customer set up tomcat to serve his JSP pages on a prototype. I helped him setup PostgreSQL as well. The technology is quite neat as you just need to drop a .war file that includes all your pages and scripts. We had to use Skype on Windows to communicate. I don't like using windows but we had endless disconnect with gnomemeeting.

Gentoo (April 05, 2004)

Playing around with Gentoo. It's a pain to setup but I really like their compiling tool emerge. I am trying to setup software suspend on my laptop with OpenGL support. This apparently works with Xfree86 4.4. To be continued...

Burning CD On Linux 2.6 (April 03, 2004)

Getting things to work in Linux kernel 2.6: I can burn CD again. I removed the ide-scsi emulation option but I forgot to add "Include IDE/ATAPI CDROM support" option back in the kernel. Doh! It took me too long to figure this one out!

I need to set the following variable to sbp2 so that my external firewire drive works: serialize_io=1.

I was surprised that my options set in the directory /etc/modutils would not work anymore. I had to put it in /etc/modprobe.d instead, run update-modules and it worked as usual. It might be a bug in sarge...