Thursday, November 01, 2007

Synergy: share a mouse and keyboard among computers.

From the project website:
Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It's intended for users with multiple computers on their desk since each system uses its own monitor(s).
Configuration and use. Create a configuration file synergy.conf defining the hostname of the server, the hostnames of the clients and the geometry of the machines, as follows.
section: screens
section: links
right = clientname
left = servername
Start the server (Linux or Mac OS X).
synergys -f --config synergy.conf
Connect the clients (Linux or Mac OS X).
synergyc -f --name clientname server
where clientname is the hostname of the client as defined in synergy.conf above, and server is the ip address (or hostname) of the server.

Tuesday, October 30, 2007

Paper size configuration for LaTeX

Run texconfig, choose PAPER, then select LETTER. Now wait until all the appropriate configuration files are created.

Then return to the menu, select DVIPS, then select PAPER, then select LETTER.

The settings are saved in ~/.texmf-config and ~/.texmf-var, so if something goes wrong, delete those directories and start again.

Thursday, August 30, 2007

Import a repository into another repository.

1. First dump the first repository.
svnadmin dump repo1 > repo1.dumpfile
2. Filter if necessary (see svndumpfilter). Not necessary for me.

3. Create a directory in your repository for the project.
svn mkdir projectdir
svn commit -m "getting ready to import new project"
4. Load the project into the repository.
svnadmin load --parent-dir relative/path/to/projectdir repo2 < repo1.dumpfile
5. Now update your working copies.
svn update

Convert a Subversion repository from BDB to FSFS

Create a FSFS repository.
svnadmin --fs-type create repo2
Dump the first repository.
svnadmin dump repo1 > repo2.dumpfile
Load the dumpfile into the new FSFS repository.
svnadmin load repo2 < repo2.dumpfile
A lot more information is available in the Subversion FAQ

Wednesday, August 29, 2007

Fixing LaTeX-Suite's jump to error feature.

LaTeX-Suite's jump to error feature doesn't always work correctly. The following is a fix proposed by Martin Sander on the vim-latex-dev mailing list.

The key observation is that passing the option -file-line-error-style to latex formats the output in a parser-friendly manner. So add the following to your .vimrc file.
let g:Tex_CompileRule_dvi = 'latex -interaction=nonstopmode -file-line-error-style $*'
And the following line needs to be added (at the appropriate place; see the patch below for context) to the tex.vim script of the LaTeX-Suite Package.
setlocal efm+=%E%f:%l:\ %m
Here is Martin's patch.
--- /usr/share/vim/addons/compiler/tex.vim      2007-01-29
13:39:58.000000000 +0100
+++ /home/lennox/.vim/compiler/tex.vim 2007-06-14 23:33:33.000000000
@@ -202,6 +202,7 @@ function! SetLatexEfm()

setlocal efm+=%E!\ LaTeX\ %trror:\ %m
setlocal efm+=%E!\ %m
+ setlocal efm+=%E%f:%l:\ %m

setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d

Monday, August 20, 2007

AIGLX + Compiz Fusion on MacBook

Install AIGLX. Following the instructions for setting up AIGLX, I did the following.
  1. Edit /etc/X11/xorg.conf file as suggested in the above instructions. My xorg.conf file is below.
  2. Restart the X server with '/etc/init.d/gdm restart'.
    # /etc/X11/xorg.conf (xorg X Window System server configuration file)
    # This file was generated by dexconf, the Debian X Configuration tool, using
    # values from the debconf database.
    # Edit this file with caution, and see the xorg.conf(5) manual page.
    # (Type "man xorg.conf" at the shell prompt.)
    # This file is automatically updated on xserver-xorg package upgrades *only*
    # if it has not been modified since the last upgrade of the xserver-xorg
    # package.
    # If you have edited this file but would like it to be automatically updated
    # again, run the following command:
    # sudo dpkg-reconfigure -phigh xserver-xorg

    Section "Files"
    FontPath "/usr/share/fonts/X11/misc"
    FontPath "/usr/share/fonts/X11/cyrillic"
    FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
    FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
    FontPath "/usr/share/fonts/X11/Type1"
    FontPath "/usr/share/fonts/X11/100dpi"
    FontPath "/usr/share/fonts/X11/75dpi"
    # path to defoma fonts
    FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"

    Section "Module"
    Load "i2c"
    Load "bitmap"
    Load "ddc"
    Load "dri"
    Load "extmod"
    Load "freetype"
    Load "glx"
    Load "int10"
    Load "vbe"
    Load "dbe"

    Section "InputDevice"
    Identifier "Generic Keyboard"
    Driver "kbd"
    Option "CoreKeyboard"
    Option "XkbRules" "xorg"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "us"

    Section "InputDevice"
    Identifier "Configured Mouse"
    Driver "mouse"
    Option "CorePointer"
    Option "Device" "/dev/input/mice"
    Option "Protocol" "ImPS/2"
    Option "ZAxisMapping" "4 5"
    Option "Emulate3Buttons" "true"

    Section "InputDevice"
    Identifier "Synaptics Touchpad"
    Driver "synaptics"
    Option "SendCoreEvents" "true"
    Option "Device" "/dev/psaux"
    Option "Protocol" "auto-dev"
    Option "HorizScrollDelta" "0"
    Option "SHMConfig" "on"

    Section "InputDevice"
    Identifier "MacBook Touchpad"
    Driver "synaptics"
    Option "AccelFactor" "0.015"
    Option "BottomEdge" "310"
    Option "Device" "/dev/psaux"
    Option "FingerHigh" "30"
    Option "FingerLow" "20"
    Option "HorizScrollDelta" "0"
    Option "LeftEdge" "100"
    Option "MaxDoubleTapTime" "180"
    Option "MaxSpeed" "0.88"
    Option "MaxTapMove" "220"
    Option "MaxTapTime" "150"
    Option "MinSpeed" "0.79"
    Option "Protocol" "auto-dev"
    Option "RightEdge" "1120"
    Option "SendCoreEvents" "true"
    Option "SHMConfig" "on"
    Option "TapButton2" "3"
    Option "TapButton3" "2"
    Option "TopEdge" "50"
    Option "VertScrollDelta" "25"
    Option "VertTwoFingerScroll" "true"

    Section "InputDevice"
    Driver "wacom"
    Identifier "stylus"
    Option "Device" "/dev/input/wacom"
    Option "Type" "stylus"
    Option "ForceDevice" "ISDV4" # Tablet PC ONLY

    Section "InputDevice"
    Driver "wacom"
    Identifier "eraser"
    Option "Device" "/dev/input/wacom"
    Option "Type" "eraser"
    Option "ForceDevice" "ISDV4" # Tablet PC ONLY

    Section "InputDevice"
    Driver "wacom"
    Identifier "cursor"
    Option "Device" "/dev/input/wacom"
    Option "Type" "cursor"
    Option "ForceDevice" "ISDV4" # Tablet PC ONLY

    Section "Device"
    Identifier "Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller"
    Driver "i810"
    Option "XAANoOffscreenPixmaps"
    BusID "PCI:0:2:0"

    Section "Monitor"
    Identifier "Generic Monitor"
    Option "DPMS"
    HorizSync 28-64
    VertRefresh 43-60

    Section "Screen"
    Identifier "Default Screen"
    Device "Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller"
    Monitor "Generic Monitor"
    DefaultDepth 24
    SubSection "Display"
    Depth 1
    Modes "1280x800"
    SubSection "Display"
    Depth 4
    Modes "1280x800"
    SubSection "Display"
    Depth 8
    Modes "1280x800"
    SubSection "Display"
    Depth 15
    Modes "1280x800"
    SubSection "Display"
    Depth 16
    Modes "1280x800"
    SubSection "Display"
    Depth 24
    Modes "1280x800"

    Section "ServerLayout"
    Identifier "Default Layout"
    Screen "Default Screen"
    InputDevice "Generic Keyboard"
    InputDevice "Configured Mouse"
    InputDevice "stylus" "SendCoreEvents"
    InputDevice "cursor" "SendCoreEvents"
    InputDevice "eraser" "SendCoreEvents"
    # InputDevice "Synaptics Touchpad"
    InputDevice "MacBook Touchpad"
    Option "AIGLX" "true"

    Section "DRI"
    Mode 0666

    Section "Extensions"
    Option "Composite" "Enable"

Un-install Beryl, Compiz, Emerald, etc.
apt-get remove compiz-core desktop-effects
apt-get remove beryl-ubuntu beryl-manager emerald
Install Compiz Fusion.
  1. Add repositories.
    deb feisty eyecandy
    deb-src feisty eyecandy
  2. Import key.
    wget -O - | sudo apt-key add -
  3. Install Compiz Fusion.
    apt-get update
    apt-get install compiz compizconfig-settings-manager compiz-plugins compiz-gnome compiz-fusion-plugins-extra compiz-fusion-plugins-unofficial libcompizconfig-backend-gconf
    apt-get install sexy-python
    apt-get upgrade
  4. [Optional] Test.
  5. compiz --replace
  6. Setup with the Compiz Config Settings Manager.
  7. Add compiz to AutoStarted Programs.
  8. Restart the X server with '/etc/init.d/gdm restart'.

Friday, July 13, 2007

Macbook/Synaptics Trackpad Configuration

A while back I upgraded my Macbook to Ubuntu Feisty Fawn. The installation was extremely smooth, and everything just worked.

But I have tweaked my TrackPad configuration. Make sure to edit the ServerLayout section to use the MacBook Touchpad input device.
Section "InputDevice"
Identifier "MacBook Touchpad"
Driver "synaptics"
Option "AccelFactor" "0.015"
Option "BottomEdge" "310"
Option "Device" "/dev/psaux"
Option "FingerHigh" "30"
Option "FingerLow" "20"
Option "HorizScrollDelta" "0"
Option "LeftEdge" "100"
Option "MaxDoubleTapTime" "180"
Option "MaxSpeed" "0.88"
Option "MaxTapMove" "220"
Option "MaxTapTime" "150"
Option "MinSpeed" "0.79"
Option "Protocol" "auto-dev"
Option "RightEdge" "1120"
Option "SendCoreEvents" "true"
Option "SHMConfig" "on"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "TopEdge" "50"
Option "VertScrollDelta" "25"
Option "VertTwoFingerScroll" "true"
There are several advantages to this configuration, including mimicking the Mac OS X two finger scrolling and two finger tapping for a right click. But most importantly: SHMConfig is activated; and so we can enable syndaemon (at startup)
syndaemon -i 2 -t -d
syndaemon is a program that monitors keyboard activity and disables the touchpad when the keyboard is being used. The -i option specifics the time in seconds to wait after the last keypress before enabling the touchpad; -t disables only tapping, not mouse movements; there are -k and -K options to ignore modifier keys or modifier+key combinations; finally, -d starts the program as a daemon.

Sunday, July 08, 2007

Linux workstation setup (LaTeX+Vim+Xpdf+SVN+LaTeXSuite)

Here is what I do with a fresh Ubuntu/Debian installation to get my optimal LaTeX configuration setup.

Installation. Install LaTeX, Vim, LaTeXSuite, Subversion and XPDF.
aptitude install texlive-full
aptitude install vim-latexsuite
aptitude install subversion
aptitude install vim-gtk
aptitude install xpdf
  • Xmodmap. Swap the CapsLock and Control keys. Add the following to the file ~/.xmodmaprc.
     ! Swap Caps_Lock and Control_L
    remove Lock = Caps_Lock
    remove Control = Control_L
    keysym Control_L = Caps_Lock
    keysym Caps_Lock = Control_L
    add Lock = Caps_Lock
    add Control = Control_L
    Run xmodmap to implement the changes.
    xmodmap ~/.xmodmaprc
  • Xpdf. Configure XPDF to use vi keybindings for navigation. Add the following to the file ~/.Xresouces.
    xpdf.viKeys: true
    Enable the changes with xrdb:
    xrdb ~/.Xresouces.
  • Vim. Download my .vimrc and .gvimrc files.

XPDF with vi keybindings

Here is how to enable vi keybindings for xpdf navigation (j for up, k for down, h for left, l for right).

Add the following line to your ~/.Xresouces file.
xpdf.viKeys: true
Then run xrdb to load the changes:
xrdb ~/.Xresouces

PDFEdit: Edit PDF files in Linux

PDFEdit is the PDF editor that I have been looking for. It supports drawing and annotating PDF documents. It isn't included in the Ubuntu repositories yet, but there is a Debian/Ubuntu package.

Installation. Get the latest version of the software from here. The filename begins with pdfedit. Then install it with dpkg:
dpkg -i pdfedit_0.3.1-1~3v1ubuntu0_i386.deb
Use. Launch; load a PDF file; annotate.

Vim + LaTeXSuite + XPDF for LaTeX editing

Here is my LaTeX editing configuration.

Since XPDF has a refresh feature, I have set up my LaTeX editor (Vim + LaTeXSuite) to generate a PDF file and automatically refresh the XPDF window. Hence, one command compiles the LaTeX file (an appropriate number of times to get the references and citations correct!), converts the dvi file to a PDF file and refreshes the XPDF window.

General comment. If you spend a lot of time editing text, then it is well worth your time to learn to use an efficient editor. Vim is one example of such an editor. Another is Emacs.

Installation. Use apt-get to install all the software.
apt-get install vim-gtk vim-latexsuite xpdf
Configuration. Here are the relevant entries of my .vimrc file.
" General features.
syntax enable " enable syntax highlighting
set hlsearch " hightlight search
set textwidth=70 " set textwidth to 70 to cause wrapping
set history=50 " 50 lines of command lines history
set viminfo='20,\"50 " read/write a .viminfo file with at most 50 lines
set ruler " show the cursor position all the time
set spell " turn on speel checking
set nojoinspaces " only put one space after periods

" For latex-suite, as suggested by the LatexSuite documentation.
filetype plugin on " to enable latex-suite when a tex file is loaded
set shellslash
set grepprg=grep\ -nH\ $*
filetype indent off

" Run latex, then dvipdf, then refresh the xpdf window.
let g:Tex_FormatDependency_pdf = 'dvi,pdf'
let g:Tex_CompileRule_pdf = 'dvipdf $*.dvi; xpdf -remote -reload -raise'
let g:Tex_ViewRule_pdf = 'xpdf -remote'
let g:Tex_DefaultTargetFormat = 'pdf'
" Set the target format to pdf.

" Set the warning messages to ignore.
let g:Tex_IgnoredWarnings =
\"specifier changed to\n".
\"You have requested\n".
\"Missing number, treated as zero.\n".
\"There were undefined references\n".
\"Citation %.%# undefined\n".
\'LaTeX Font Warning:'"
" This number N says that latex-suite should ignore the first N of the above.
let g:Tex_IgnoreLevel = 8

" TIP: if you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press Ctrl-N you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:
Use. The command \lv launches xpdf and \ll runs latex, dvipdf, xpdf -reload. LaTeXSuite has many interesting features to allow for quick writing of LaTeX documents. For example, typing `a will insert \alpha and F5 offers a shortcut to inserting an environment (e.g., displaymath). Check out the online tutorial.

Set svn to ignore auxiliary LaTeX files

Using SubVersion for LaTeX document management is great. (See my earlier post on setting this up.) However, there are certain files (.aux, .log, etc.) that are best not put under revision control because they change very often. The following describes how to set svn to ignore these files, so that the output of 'svn status' doesn't report them.

1) Create a file called "ignore-these" with the (patterns of) files you want svn to ignore. For example,
2) Then run the command,
svn -R propset svn:ignore . -F ignore-these
3) Should you need to edit these properties, use the following command.
svn propedit svn:ignore .
(On Mac OS X you need to set the EDITOR variable: 'export EDITOR=vim')

KeyJNote: stylish presentations

KeyJNote is a PDF presentation displaying application. It is a python script that uses pdf and ghostscript for PDF rendering. It is very stylish and includes many cool page transitions, an overview feature and the ability to highlight and spotlight parts of the slide during the presentation. The above image shows the overview feature.

Installation. On Ubuntu, use apt-get:
apt-get install keyjnote
Otherwise download the software from the project site.

Use. Just launch the program from the command line with the name of a pdf file; it will use random transitions. You can specify which transitions to use through an auxiliary file.

More information. There is an online manual, and a demo presentation that highlights KeyJNote's features. It is best viewed with KeyJNote.

Mathematics on Linux

I should probably change the name of this blog to Mathematics on Linux, or something to that effect.

LaTeXDraw -- Pictue drawing for LaTeX and PSTricks: Part 2

LaTeXDraw is another GPL'd graphical PSTricks editor for LateX. It is developed in java, so it's independent of the OS, and it's available in English, in Spanish and in French.

Installation. Download and unzip. There is a readme.txt file with instructions, but you need only run 'java -jar installer.jar'.

Configuration. You need to configure some things, but the program lets you know if you try to do something that needs configuration.

Use. Draw. Cut and paste the PSTricks code into your LaTeX document.

Comparison with JPicEdt. Both have their strengths. It seems JPicEdt implements more drawing functions, but that is something that can easily change with some development. I like that one can see the PSTricks code generated by LaTeXDraw as one draws. I also prefer the look of the LaTeXDraw interface.

JPicEdt -- Picture drawing for LaTeX and PSTricks: Part 1

JPicEdt is an open source, multi-platform and interactive picture editor for LaTeX and PSTricks. You use a GUI to draw your pictures and the pictures are saved as tex source code, so you just paste the code into your latex document.

Installation. The webpage has installation instructions. Basically: download and launch the installer and follow the on-screen instructions.

Configuration. You must configure the program to point to the location of latex and friends. But I have already done this, so just copy the contents in the box below to the file ~/.jpicedt/preferences, and change USERNAME to your username.

Use. Use the TeX button to compile the image, the DviPS button to convert the image to PostScript, and the PS button to view the PostScript file. When completed, save it as a TeX file, then copy and paste it into your LaTeX document.

Comparison with LaTeXDraw. Both have their strengths. It seems JPicEdt implements more drawing functions, but that is something that can easily change with some development. I like that one can see the PSTricks code generated by LaTeXDraw as one draws. I also prefer the look of the LaTeXDraw interface.
#jPicEdt Preferences
#Sun Jul 08 11:55:29 EDT 2007 100 5 5
latex.file-wrapper-prolog=\\documentclass{article} \n\\thispagestyle{empty}\n\\begin{document} \n
command.ghostview={i}/unix/tetex/ {p} evince {f}.ps
eepic.file-wrapper-prolog=\\documentclass{article} \n\\usepackage{epic,eepic} \n\\thispagestyle{empty}\n\\begin{document}\n
command.dvips={i}/unix/tetex/ {p} dvips {f}
command.dvi={i}/unix/tetex/ {p} xdvi {f}
pstricks.file-wrapper-prolog=\\documentclass{article} \n\\usepackage{pst-all} \n\\thispagestyle{empty}\n\\begin{document} \n
command.latex={i}/unix/tetex/ {p} latex {f}

Thursday, February 01, 2007

Nokia 770 Connectivity: WPA with PEAP and .p7b Certificates

(I've had a Nokia 770 Internet Tablet for almost a year now; this seems to be my first post about the device.)

Here are instructions for connecting to a wireless network with the Nokia 770 via WPA with PEAP and a pre-issued .p7b certificate.
  1. Convert the .p7b certificate to .cer certificates.The Certificate Manager cannot import .p7b certificates, so they must be converted to .cer files. Since .p7b files can contain individual certificates, you need to unpack the certificates and import each one individually. I did this in Mac OS X since it was the nearest machine at the time:
    • Double click the .p7b file;
    • KeyChain Access launches; choose to import the key;
    • One at a time, select each certificate and select Export from the File menu; export as .cer files.
  2. Import the keys. Copy the .cer files to the Nokia 770; launch the Certificate Manager (found on the Control Panel) and import each key individually.
  3. Connect to the network. Start the network connection process.
    • Security method: WPA with EAP;
    • EAP Type: PEAP;
    • Certificate: None;
    • EAP Method: MSCHAPv2;
    • User name: ********;
    • Password: ********;
    • As recommended, in the Advanced section, under the EAP tab, select "Use manual user name" and enter your username there as well.