Home
Projects
Sitemap
About

Index

Dell Latitude E6400 Bios update

A new BIOS update for the Latitude E6400 has just been released. Install it!. It leads to much faster resume and suspend times.

Perl coding guidelines for large projects

At work, I am currently working on a large(-ish) Perl project which needs to meet highest reliability standards. While coding, I have noticed some patterns which make finding and avoiding errors so much easier. So, here's my list (which will probably grow):

  • Always print out '$@' when you catch a die.
  • use strict and use warnings, but you already know that. Best if you have your editor automatically insert that snippet for you.
  • Use perl object orientation. It makes dealing with many interrelating components way easier. If you don't know how to write obeject oriented programs in perl, read perltoot.
  • Write tests. Even the simplest tests give me a warm fuzzy feeling inside when they pass. Test::Simple and Test::More are your friends here.
  • Use a makefile. Stuff targets in there to execute all tests, syntax check your perl and distribute the program.

More stuff when I get to it.

pstricks with LaTeX-mode/Auctex

The pstricks package for LaTeX seems to be the best package for drawing complicated diagrams in LaTeX. However, it does not work correctly when using xvdvi, or xpdf.

However, importing the package pdftricks, and then the package pstricks seems to work, if only for non-pdflatex mode (C-c C-t p). An example:

\documentclass[conference]{article}

\usepackage[utf8]{inputenc}
\usepackage{pstricks}

\begin{document}

\title{Title}

\begin{document}
\section{Introduction}
\label{sec:introduction}

\begin{figure}
  \centering
  \begin{pspicture}(5,5)
    \psline[linecolor=black](0,0)(5,5)
    \psline[linecolor=yellow](0,5)(5,0)
    \psline[linecolor=red](0,2.5)(5,2.5)
  \end{pspicture}
  \caption{Figure 1}
  \label{fig:fig1}
\end{figure}

\end{document}

This does not work with my Auctex. However, when I add \usepackage{pdftricks}, I can view the document with xdvi.

Asus P5Q Pro stability problems

When you have problems with the PC suddenly freezing on a Asus P5Q Pro motherboard, try raising the northbridge and DIMM voltages in the bios about 0.04 volts. It seems like that fixed my stability problem.

Localized Emacs. Today: parse-time

To enable me to use german day and month names in org-mode, I had a line like this in my init file:

(mapc (lambda (x) (add-to-list 'parse-time-weekdays x))
      '(("so" . 0)
        ("mo" . 1)
        ("di" . 2)
        ("mi" . 3)
        ("do" . 4)
        ("fr" . 5)
        ("sa" . 6)))

(setq seeger-german-month-names
      '(("jan" . 1)
        ("feb" . 2)
        ("mär" . 3)
        ("apr" . 4)
        ("mai" . 5)
        ("jun" . 6)
        ("jul" . 7)
        ("aug" . 8)
        ("sep" . 9)
        ("okt" . 10)
        ("nov" . 11)
        ("dez" . 12)))

(mapc (lambda (x) (add-to-list 'parse-time-months x))
      seeger-german-month-names)

(mapc (lambda (x) (add-to-list 'timezone-months-assoc (cons (upcase (car x)) (cdr x))))
      seeger-german-month-names)

Unfortunately, this completely breaks most elisp using parse-time. So, instead, now I use

(mapc (lambda (x) (add-to-list 'parse-time-months x))
      '(("jan" . 1)
        ("feb" . 2)
        ("mär" . 3)
        ("apr" . 4)
        ("mai" . 5)
        ("jun" . 6)
        ("jul" . 7)
        ("aug" . 8)
        ("sep" . 9)
        ("okt" . 10)
        ("nov" . 11)
        ("dez" . 12)))

(mapc (lambda (x) (add-to-list 'parse-time-weekdays x))
      '(("so" . 0)
        ("mo" . 1)
        ("di" . 2)
        ("mi" . 3)
        ("do" . 4)
        ("fr" . 5)
        ("sa" . 6)))

which works correctly with twittering-mode, at least (and perhaps gnus).

UPDATE: Yep, the above breaks gnus. The problem is that message-make-date, which actually shouldn't be localized, uses parse-time-weekdays and parse-time-months, which are localized. So, some more work is needed, along the lines of this:

(require 'parse-time)
(require 'message)

;; Do this before setting the variables  correctly.
(setq parse-time-months-unlocalized parse-time-months)
(setq parse-time-weekdays-unlocalized parse-time-weekdays)


(defun message-make-date-localized (&optional now)
  "Make a valid data header. Uses localized values from parse-time.el. If NOW, use that time instead."
  (let* ((now (or now (current-time)))
         (zone (nth 8 (decode-time now)))
         (sign "+"))
    (when (< zone 0)
      (setq sign "-")
      (setq zone (- zone)))
    (concat
     ;; The day name of the %a spec is locale-specific.  Pfff.
     (format "%s, " (capitalize (car (rassoc (nth 6 (decode-time now))
                                             parse-time-weekdays))))
     (format-time-string "%d" now)
     ;; The month name of the %b spec is locale-specific.  Pfff.
     (format " %s "
             (capitalize (car (rassoc (nth 4 (decode-time now))
                                      parse-time-months))))
     (format-time-string "%Y %H:%M:%S " now)
     ;; We do all of this because XEmacs doesn't have the %z spec.
     (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60)))))

(defun message-make-date-unlocalized (&optional now)
  (let ((parse-time-weekdays parse-time-weekdays-unlocalized)
        (parse-time-months parse-time-months-unlocalized))
    (message-make-date now)))

(defalias 'message-make-date message-make-date-unlocalized)

This works with gnus as well.

Nokia + self-signed certificates

I have a Nokia E71 (great phone btw), and I had constant problems getting it to work with my IMAPS server. Today, I found the problem: You need to accept the root certificate for cacert.org. Then, the mail program won't ask about accepting the certificate anymore.

Simply download the certificate in DER format from here, mail it to yourself, open it on the phone and say yes to all ensuing dialogues.

For the record: The error reported (by dovecot) was

   Apr 14 16:32:18 lvps87-230-95-74 dovecot: imap-login: SSL_accept() failed: error:140943F2:SSL routines:SSL3_READ_BYTES:sslv3 alert unexpected message [79.218.222.243]
   Apr 14 16:56:13 lvps87-230-95-74 dovecot: imap-login: SSL_accept() failed: error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown [64.57.240.132]

Autor: Jan Seeger <jan.seeger@thenybble.de>

Datum: 2010-02-07 16:31:10 CET

HTML generated by org-mode 6.19b in emacs 22